Merge branch 'master' of github.com:dankamongmen/notcurses

pull/1586/head
nick black 3 years ago
commit 445bf4b58f
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -18,15 +18,32 @@ pub mod ffi {
// Miscellaneous ---------------------------------------------------------------
#[rustfmt::skip]
#[doc(inline)]
pub use ffi::{
// structs
__va_list_tag,
// functions
ncstrwidth,
};
// https://github.com/dankamongmen/notcurses/issues/1339
//
// Let's first see whether this works for: i686, aarch64, armv7l & ppc64le.
//
// #[cfg(target_arch = "x86_64")]
// #[cfg(target_arch = "s390x")]
// pub use ffi::{__va_list_tag};
//
// #[cfg(not(target_arch = "x86_64"))]
// #[cfg(not(target_arch = "s390x"))]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct __va_list_tag {
pub gp_offset: cty::c_uint,
pub fp_offset: cty::c_uint,
pub overflow_arg_area: *mut cty::c_void,
pub reg_save_area: *mut cty::c_void,
}
// blitset ---------------------------------------------------------------------
//
// already wrapped:

@ -660,7 +660,13 @@ impl NcDirect {
h1: NcChannelPair,
h2: NcChannelPair,
) -> NcResult<()> {
error![unsafe { crate::ncdirect_hline_interp(self, &(*egc as i8), len as i32, h1, h2) }]
// https://github.com/dankamongmen/notcurses/issues/1339
#[cfg(any(target_arch = "x86_64", target_arch = "i686"))]
let egc_ptr = &(*egc as i8);
#[cfg(not(any(target_arch = "x86_64", target_arch = "i686")))]
let egc_ptr = &(*egc as u8);
error![unsafe { crate::ncdirect_hline_interp(self, egc_ptr, len as i32, h1, h2) }]
}
/// Draws horizontal lines using the specified [NcChannelPair]s, interpolating
@ -682,6 +688,12 @@ impl NcDirect {
h1: NcChannelPair,
h2: NcChannelPair,
) -> NcResult<()> {
error![unsafe { crate::ncdirect_vline_interp(self, &(*egc as i8), len as i32, h1, h2) }]
// https://github.com/dankamongmen/notcurses/issues/1339
#[cfg(any(target_arch = "x86_64", target_arch = "i686"))]
let egc_ptr = &(*egc as i8);
#[cfg(not(any(target_arch = "x86_64", target_arch = "i686")))]
let egc_ptr = &(*egc as u8);
error![unsafe { crate::ncdirect_vline_interp(self, egc_ptr, len as i32, h1, h2) }]
}
}

@ -549,9 +549,16 @@ impl Notcurses {
//
// CHECK that this works.
pub fn render_to_buffer(&mut self, buffer: &mut Vec<u8>) -> NcResult<()> {
let mut len = buffer.len() as u64;
#[allow(unused_mut)] // CHECK whether it actually works without the mut
let mut len = buffer.len() as u32;
// https://github.com/dankamongmen/notcurses/issues/1339
#[cfg(any(target_arch = "x86_64", target_arch = "i686"))]
let mut buf = buffer.as_mut_ptr() as *mut i8;
error![unsafe { crate::notcurses_render_to_buffer(self, &mut buf, &mut len) }]
#[cfg(not(any(target_arch = "x86_64", target_arch = "i686")))]
let mut buf = buffer.as_mut_ptr() as *mut u8;
error![unsafe { crate::notcurses_render_to_buffer(self, &mut buf, &mut len.into()) }]
}
/// Writes the last rendered frame, in its entirety, to 'fp'.

@ -1895,10 +1895,17 @@ impl NcPlane {
y_stop: NcDim,
x_stop: NcDim,
) -> NcResult<NcDim> {
// https://github.com/dankamongmen/notcurses/issues/1339
#[cfg(any(target_arch = "x86_64", target_arch = "i686"))]
let egc_ptr = &(*egc as i8);
#[cfg(not(any(target_arch = "x86_64", target_arch = "i686")))]
let egc_ptr = &(*egc as u8);
let res = unsafe {
crate::ncplane_gradient(
self,
&(*egc as i8),
egc_ptr,
stylemask as u32,
ul,
ur,

@ -163,8 +163,8 @@ pub fn ncplane_putstr(plane: &mut NcPlane, string: &str) -> NcIntResult {
///
/// *Method: NcPlane.[putnstr()][NcPlane#method.putnstr].*
#[inline]
pub fn ncplane_putnstr(plane: &mut NcPlane, size: u64, gclustarr: &[u8]) -> NcIntResult {
unsafe { crate::ncplane_putnstr_yx(plane, -1, -1, size, cstring![gclustarr]) }
pub fn ncplane_putnstr(plane: &mut NcPlane, size: u32, gclustarr: &[u8]) -> NcIntResult {
unsafe { crate::ncplane_putnstr_yx(plane, -1, -1, size.into(), cstring![gclustarr]) }
}
/// The [NcPlane] equivalent of `vprintf(3)`.
@ -689,12 +689,18 @@ pub fn ncplane_gradient_sized(
if y_len < 1 || x_len < 1 {
return NCRESULT_ERR;
}
// https://github.com/dankamongmen/notcurses/issues/1339
#[cfg(any(target_arch = "x86_64", target_arch = "i686"))]
let egc_ptr = &(*egc as i8);
#[cfg(not(any(target_arch = "x86_64", target_arch = "i686")))]
let egc_ptr = &(*egc as u8);
let (mut y, mut x) = (0, 0);
unsafe {
crate::ncplane_cursor_yx(plane, &mut y, &mut x);
crate::ncplane_gradient(
plane,
&(*egc as i8),
egc_ptr,
stylemask as u32,
ul as u64,
ur as u64,

@ -12,7 +12,11 @@ pub type NcSignalSet = crate::bindings::ffi::sigset_t;
impl NcSignalSet {
/// New NcSignalSet.
pub fn new() -> Self {
Self { __val: [0; 16] }
// https://github.com/dankamongmen/notcurses/issues/1339
#[cfg(any(target_arch = "armv7l", target_arch = "i686"))]
return Self { __val: [0; 32] };
#[cfg(not(any(target_arch = "armv7l", target_arch = "i686")))]
return Self { __val: [0; 16] };
}
/// Adds `signum` to this set.

Loading…
Cancel
Save