diff --git a/rust/src/plane.rs b/rust/src/plane.rs index 818ab923c..59e864ea3 100644 --- a/rust/src/plane.rs +++ b/rust/src/plane.rs @@ -88,10 +88,10 @@ // // static inline functions to reimplement: 42 // ------------------------------------------ (done / (x) wont / remaining) -// (+) implement : 10 / … / 32 -// (#) unit tests: 0 / … / 42 +// (+) implement: 18 / … / 24 +// (#) unit test: 0 / … / 42 // ------------------------------------------ -// ncplane_align +//+ncplane_align // ncplane_at_cursor_cell // ncplane_at_yx_cell //+ncplane_bchannel @@ -99,7 +99,7 @@ //+ncplane_bg_alpha //+ncplane_bg_default_p //+ncplane_bg_rgb -// ncplane_box_sized +//+ncplane_box_sized //+ncplane_dim_x //+ncplane_dim_y // ncplane_double_box @@ -111,7 +111,7 @@ //+ncplane_fg_rgb // ncplane_gradient_sized // ncplane_highgradient_sized -// ncplane_hline +//+ncplane_hline //+ncplane_perimeter // ncplane_perimeter_double // ncplane_perimeter_rounded @@ -131,7 +131,7 @@ // ncplane_resize_simple // ncplane_rounded_box // ncplane_rounded_box_sized -// ncplane_vline +//+ncplane_vline // ncplane_vprintf use core::ptr::null_mut; @@ -139,60 +139,47 @@ use cstr_core::CString; use crate as ffi; use ffi::types::{AlphaBits, Channel, Color, IntResult}; +use ffi::{cell, ncplane, ncalign_e}; -pub fn ncplane_putstr(plane: *mut ffi::ncplane, _str: &str) -> i32 { - unsafe { - ffi::ncplane_putstr_yx( - plane, - -1, - -1, - CString::new(_str).expect("Bad string").as_ptr(), - ) - } -} +/// Return the column at which 'cols' columns ought start in order to be aligned +/// according to 'align' within ncplane 'n'. Returns INT_MAX on invalid 'align'. +/// Undefined behavior on negative 'cols'. +// XXX: change cols type to u32? https://github.com/dankamongmen/notcurses/issues/904 +// TODO: TEST +#[inline] +pub fn ncplane_align(plane: &ncplane, align: ncalign_e, cols: i32) -> i32 { + if align == ffi::ncalign_e_NCALIGN_LEFT { return 0; } -pub fn ncplane_dim_y(plane: *const ffi::ncplane) -> i32 { - unsafe { - let mut y = 0; - ffi::ncplane_dim_yx(plane, &mut y, null_mut()); - return y; - } -} + let plane_cols = ncplane_dim_x(plane); + if cols > plane_cols { return 0; } -pub fn ncplane_dim_x(plane: *const ffi::ncplane) -> i32 { - unsafe { - let mut x = 0; - ffi::ncplane_dim_yx(plane, null_mut(), &mut x); - return x; + if align == ffi::ncalign_e_NCALIGN_CENTER { + return plane_cols - cols / 2; + } else if align == ffi::ncalign_e_NCALIGN_RIGHT { + return plane_cols - cols; } + core::i32::MAX } -pub fn ncplane_perimeter( - plane: *mut ffi::ncplane, - _ul: *const ffi::cell, - _ur: *const ffi::cell, - _ll: *const ffi::cell, - _lr: *const ffi::cell, - _hl: *const ffi::cell, - _vl: *const ffi::cell, - _ctlword: u32, -) -> IntResult { - unsafe { ffi::ncplane_cursor_move_yx(plane, 0, 0) } -} - -// // Resize the plane, retaining what data we can (everything, unless we're -// // shrinking in some dimension). Keep the origin where it is. // static inline int -// ncplane_resize_simple(struct ncplane* n, int ylen, int xlen){ -// int oldy, oldx; -// ncplane_dim_yx(n, &oldy, &oldx); // current dimensions of 'n' -// int keepleny = oldy > ylen ? ylen : oldy; -// int keeplenx = oldx > xlen ? xlen : oldx; -// return ncplane_resize(n, 0, 0, keepleny, keeplenx, 0, 0, ylen, xlen); +// ncplane_align(const struct ncplane* n, ncalign_e align, int c){ +// if(align == NCALIGN_LEFT){ +// return 0; +// } +// int cols = ncplane_dim_x(n); +// if(c > cols){ +// return 0; +// } +// if(align == NCALIGN_CENTER){ +// return (cols - c) / 2; +// }else if(align == NCALIGN_RIGHT){ +// return cols - c; +// } +// return INT_MAX; // } -// // Retrieve the current contents of the cell under the cursor into 'c'. This -// // cell is invalidated if the associated plane is destroyed. +// Retrieve the current contents of the cell under the cursor into 'c'. This +// cell is invalidated if the associated plane is destroyed. // static inline int // ncplane_at_cursor_cell(struct ncplane* n, cell* c){ // char* egc = ncplane_at_cursor(n, &c->attrword, &c->channels); @@ -208,8 +195,8 @@ pub fn ncplane_perimeter( // return r; // } -// // Retrieve the current contents of the specified cell into 'c'. This cell is -// // invalidated if the associated plane is destroyed. +// Retrieve the current contents of the specified cell into 'c'. This cell is +// invalidated if the associated plane is destroyed. // static inline int // ncplane_at_yx_cell(struct ncplane* n, int y, int x, cell* c){ // char* egc = ncplane_at_yx(n, y, x, &c->attrword, &c->channels); @@ -223,47 +210,119 @@ pub fn ncplane_perimeter( // return r; // } -// // Return the column at which 'c' cols ought start in order to be aligned -// // according to 'align' within ncplane 'n'. Returns INT_MAX on invalid 'align'. -// // Undefined behavior on negative 'c'. +/// Draw a box with its upper-left corner at the current cursor position, having +/// dimensions 'ylen'x'xlen'. See ncplane_box() for more information. The +/// minimum box size is 2x2, and it cannot be drawn off-screen. +// TODO: TEST +#[inline] +pub fn ncplane_box_sized(plane: &mut ncplane, ul: &cell, ur: &cell, ll: &cell, lr: &cell, hline: &cell, vline: &cell, ylen: i32, xlen: i32, ctrlword: u32) -> IntResult { + unsafe { + let (mut y, mut x) = (0,0); + ffi::ncplane_cursor_yx(plane, &mut y, &mut x); + ffi::ncplane_box(plane, ul, ur, ll, lr, hline, vline, y + ylen -1, x + xlen -1, ctrlword) + } +} + +/// +// TODO: TEST +#[inline] +pub fn ncplane_dim_x(plane: &ncplane) -> i32 { + unsafe { + let mut x = 0; + ffi::ncplane_dim_yx(plane, null_mut(), &mut x); + return x; + } +} + +/// +// TODO: TEST +#[inline] +pub fn ncplane_dim_y(plane: &ncplane) -> i32 { + unsafe { + let mut y = 0; + ffi::ncplane_dim_yx(plane, &mut y, null_mut()); + return y; + } +} + +/// +/// On error, return the negative number of cells drawn. +// TODO: TEST +#[inline] +pub fn ncplane_hline(plane: &mut ncplane, cell: &cell, len: i32) -> i32 { + unsafe { + ffi::ncplane_hline_interp(plane, cell, len, cell.channels, cell.channels) + } +} + +/// +// TODO: TEST +#[inline] +pub fn ncplane_perimeter(plane: &mut ncplane, ul: &cell, ur: &cell, ll: &cell, lr: &cell, hline: &cell, vline: &cell, ctlword: u32) -> IntResult { + unsafe { + ffi::ncplane_cursor_move_yx(plane, 0, 0); + let (mut dimy, mut dimx) = (0,0); + ffi::ncplane_dim_yx(plane, &mut dimy, &mut dimx); + ncplane_box_sized(plane, ul, ur, ll, lr, hline, vline, dimy, dimx, ctlword) + } +} + // static inline int -// ncplane_align(const struct ncplane* n, ncalign_e align, int c){ -// if(align == NCALIGN_LEFT){ -// return 0; +// ncplane_perimeter_double(struct ncplane* n, uint32_t attrword, +// uint64_t channels, unsigned ctlword){ +// if(ncplane_cursor_move_yx(n, 0, 0)){ +// return -1; // } -// int cols = ncplane_dim_x(n); -// if(c > cols){ -// return 0; +// int dimy, dimx; +// ncplane_dim_yx(n, &dimy, &dimx); +// cell ul = CELL_TRIVIAL_INITIALIZER; +// cell ur = CELL_TRIVIAL_INITIALIZER; +// cell ll = CELL_TRIVIAL_INITIALIZER; +// cell lr = CELL_TRIVIAL_INITIALIZER; +// cell vl = CELL_TRIVIAL_INITIALIZER; +// cell hl = CELL_TRIVIAL_INITIALIZER; +// if(cells_double_box(n, attrword, channels, &ul, &ur, &ll, &lr, &hl, &vl)){ +// return -1; // } -// if(align == NCALIGN_CENTER){ -// return (cols - c) / 2; -// }else if(align == NCALIGN_RIGHT){ -// return cols - c; +// int r = ncplane_box_sized(n, &ul, &ur, &ll, &lr, &hl, &vl, dimy, dimx, ctlword); +// cell_release(n, &ul); cell_release(n, &ur); +// cell_release(n, &ll); cell_release(n, &lr); +// cell_release(n, &hl); cell_release(n, &vl); +// return r; +// } + + +// static inline int +// ncplane_perimeter_rounded(struct ncplane* n, uint32_t attrword, +// uint64_t channels, unsigned ctlword){ +// if(ncplane_cursor_move_yx(n, 0, 0)){ +// return -1; // } -// return INT_MAX; +// int dimy, dimx; +// ncplane_dim_yx(n, &dimy, &dimx); +// cell ul = CELL_TRIVIAL_INITIALIZER; +// cell ur = CELL_TRIVIAL_INITIALIZER; +// cell ll = CELL_TRIVIAL_INITIALIZER; +// cell lr = CELL_TRIVIAL_INITIALIZER; +// cell vl = CELL_TRIVIAL_INITIALIZER; +// cell hl = CELL_TRIVIAL_INITIALIZER; +// if(cells_rounded_box(n, attrword, channels, &ul, &ur, &ll, &lr, &hl, &vl)){ +// return -1; +// } +// int r = ncplane_box_sized(n, &ul, &ur, &ll, &lr, &hl, &vl, dimy, dimx, ctlword); +// cell_release(n, &ul); cell_release(n, &ur); +// cell_release(n, &ll); cell_release(n, &lr); +// cell_release(n, &hl); cell_release(n, &vl); +// return r; // } + // // Call ncplane_putc_yx() for the current cursor location. // static inline int // ncplane_putc(struct ncplane* n, const cell* c){ // return ncplane_putc_yx(n, -1, -1, c); // } -// // Replace the EGC underneath us, but retain the styling. The current styling -// // of the plane will not be changed. -// // -// // Replace the cell at the specified coordinates with the provided 7-bit char -// // 'c'. Advance the cursor by 1. On success, returns 1. On failure, returns -1. -// // This works whether the underlying char is signed or unsigned. -// static inline int -// ncplane_putsimple_yx(struct ncplane* n, int y, int x, char c){ -// cell ce = CELL_INITIALIZER((uint32_t)c, ncplane_attr(n), ncplane_channels(n)); -// if(!cell_simple_p(&ce)){ -// return -1; -// } -// return ncplane_putc_yx(n, y, x, &ce); -// } - // // Call ncplane_putsimple_yx() at the current cursor location. // static inline int // ncplane_putsimple(struct ncplane* n, char c){ @@ -275,35 +334,35 @@ pub fn ncplane_perimeter( // ncplane_putegc(struct ncplane* n, const char* gclust, int* sbytes){ // return ncplane_putegc_yx(n, -1, -1, gclust, sbytes); // } + +// Replace the EGC underneath us, but retain the styling. The current styling +// of the plane will not be changed. // -// // ncplane_putegc(), but following a conversion from wchar_t to UTF-8 multibyte. +// Replace the cell at the specified coordinates with the provided 7-bit char +// 'c'. Advance the cursor by 1. On success, returns 1. On failure, returns -1. +// This works whether the underlying char is signed or unsigned. // static inline int -// ncplane_putwegc(struct ncplane* n, const wchar_t* gclust, int* sbytes){ -// // maximum of six UTF8-encoded bytes per wchar_t -// const size_t mbytes = (wcslen(gclust) * WCHAR_MAX_UTF8BYTES) + 1; -// char* mbstr = (char*)malloc(mbytes); // need cast for c++ callers -// if(mbstr == NULL){ -// return -1; -// } -// size_t s = wcstombs(mbstr, gclust, mbytes); -// if(s == (size_t)-1){ -// free(mbstr); +// ncplane_putsimple_yx(struct ncplane* n, int y, int x, char c){ +// cell ce = CELL_INITIALIZER((uint32_t)c, ncplane_attr(n), ncplane_channels(n)); +// if(!cell_simple_p(&ce)){ // return -1; // } -// int ret = ncplane_putegc(n, mbstr, sbytes); -// free(mbstr); -// return ret; +// return ncplane_putc_yx(n, y, x, &ce); // } -// // Call ncplane_putwegc() after successfully moving to y, x. -// static inline int -// ncplane_putwegc_yx(struct ncplane* n, int y, int x, const wchar_t* gclust, -// int* sbytes){ -// if(ncplane_cursor_move_yx(n, y, x)){ -// return -1; -// } -// return ncplane_putwegc(n, gclust, sbytes); -// } +/// +// TODO: TEST +#[inline] +pub fn ncplane_putstr(plane: *mut ncplane, _str: &str) -> i32 { + unsafe { + ffi::ncplane_putstr_yx( + plane, + -1, + -1, + CString::new(_str).expect("Bad string").as_ptr(), + ) + } +} // static inline int // ncplane_putstr(struct ncplane* n, const char* gclustarr){ @@ -334,6 +393,35 @@ pub fn ncplane_perimeter( // return ret; // } +// // ncplane_putegc(), but following a conversion from wchar_t to UTF-8 multibyte. +// static inline int +// ncplane_putwegc(struct ncplane* n, const wchar_t* gclust, int* sbytes){ +// // maximum of six UTF8-encoded bytes per wchar_t +// const size_t mbytes = (wcslen(gclust) * WCHAR_MAX_UTF8BYTES) + 1; +// char* mbstr = (char*)malloc(mbytes); // need cast for c++ callers +// if(mbstr == NULL){ +// return -1; +// } +// size_t s = wcstombs(mbstr, gclust, mbytes); +// if(s == (size_t)-1){ +// free(mbstr); +// return -1; +// } +// int ret = ncplane_putegc(n, mbstr, sbytes); +// free(mbstr); +// return ret; +// } + +// Call ncplane_putwegc() after successfully moving to y, x. +// static inline int +// ncplane_putwegc_yx(struct ncplane* n, int y, int x, const wchar_t* gclust, +// int* sbytes){ +// if(ncplane_cursor_move_yx(n, y, x)){ +// return -1; +// } +// return ncplane_putwegc(n, gclust, sbytes); +// } + // static inline int // ncplane_putwstr_aligned(struct ncplane* n, int y, ncalign_e align, // const wchar_t* gclustarr){ @@ -347,26 +435,21 @@ pub fn ncplane_perimeter( // return ncplane_putwstr_yx(n, -1, -1, gclustarr); // } -// // Replace the cell at the specified coordinates with the provided wide char -// // 'w'. Advance the cursor by the character's width as reported by wcwidth(). -// // On success, returns 1. On failure, returns -1. +// Replace the cell at the specified coordinates with the provided wide char +// 'w'. Advance the cursor by the character's width as reported by wcwidth(). +// On success, returns 1. On failure, returns -1. // static inline int // ncplane_putwc_yx(struct ncplane* n, int y, int x, wchar_t w){ // wchar_t warr[2] = { w, L'\0' }; // return ncplane_putwstr_yx(n, y, x, warr); // } -// // Call ncplane_putwc() at the current cursor position. +// Call ncplane_putwc() at the current cursor position. // static inline int // ncplane_putwc(struct ncplane* n, wchar_t w){ // return ncplane_putwc_yx(n, -1, -1, w); // } -// static inline int -// ncplane_vprintf(struct ncplane* n, const char* format, va_list ap){ -// return ncplane_vprintf_yx(n, -1, -1, format, ap); -// } - // static inline int // ncplane_printf(struct ncplane* n, const char* format, ...) // __attribute__ ((format (printf, 2, 3))); @@ -420,40 +503,32 @@ pub fn ncplane_perimeter( // return ret; // } +// // Resize the plane, retaining what data we can (everything, unless we're +// // shrinking in some dimension). Keep the origin where it is. // static inline int -// ncplane_hline(struct ncplane* n, const cell* c, int len){ -// return ncplane_hline_interp(n, c, len, c->channels, c->channels); +// ncplane_resize_simple(struct ncplane* n, int ylen, int xlen){ +// int oldy, oldx; +// ncplane_dim_yx(n, &oldy, &oldx); // current dimensions of 'n' +// int keepleny = oldy > ylen ? ylen : oldy; +// int keeplenx = oldx > xlen ? xlen : oldx; +// return ncplane_resize(n, 0, 0, keepleny, keeplenx, 0, 0, ylen, xlen); // } -// static inline int -// ncplane_vline(struct ncplane* n, const cell* c, int len){ -// return ncplane_vline_interp(n, c, len, c->channels, c->channels); -// } +/// +/// On error, return the negative number of cells drawn. +// TODO: TEST +#[inline] +pub fn ncplane_vline(plane: &mut ncplane, cell: &cell, len: i32) -> i32 { + unsafe { + ffi::ncplane_vline_interp(plane, cell, len, cell.channels, cell.channels) + } +} -// // Draw a box with its upper-left corner at the current cursor position, having -// // dimensions 'ylen'x'xlen'. See ncplane_box() for more information. The -// // minimum box size is 2x2, and it cannot be drawn off-screen. // static inline int -// ncplane_box_sized(struct ncplane* n, const cell* ul, const cell* ur, -// const cell* ll, const cell* lr, const cell* hline, -// const cell* vline, int ylen, int xlen, unsigned ctlword){ -// int y, x; -// ncplane_cursor_yx(n, &y, &x); -// return ncplane_box(n, ul, ur, ll, lr, hline, vline, y + ylen - 1, -// x + xlen - 1, ctlword); +// ncplane_vprintf(struct ncplane* n, const char* format, va_list ap){ +// return ncplane_vprintf_yx(n, -1, -1, format, ap); // } -// static inline int -// ncplane_perimeter(struct ncplane* n, const cell* ul, const cell* ur, -// const cell* ll, const cell* lr, const cell* hline, -// const cell* vline, unsigned ctlword){ -// if(ncplane_cursor_move_yx(n, 0, 0)){ -// return -1; -// } -// int dimy, dimx; -// ncplane_dim_yx(n, &dimy, &dimx); -// return ncplane_box_sized(n, ul, ur, ll, lr, hline, vline, dimy, dimx, ctlword); -// } // // Draw a gradient with its upper-left corner at the current cursor position, // // having dimensions 'ylen'x'xlen'. See ncplane_gradient for more information. @@ -488,21 +563,21 @@ pub fn ncplane_perimeter( /// Extract the 32-bit working foreground channel from an ncplane. // TODO: TEST #[inline] -pub fn ncplane_fchannel(plane: &ffi::ncplane) -> Channel { +pub fn ncplane_fchannel(plane: &ncplane) -> Channel { ffi::channels_fchannel(unsafe { ffi::ncplane_channels(plane)}) } /// Extract the 32-bit working background channel from an ncplane. // TODO: TEST #[inline] -pub fn ncplane_bchannel(plane: &ffi::ncplane) -> Channel { +pub fn ncplane_bchannel(plane: &ncplane) -> Channel { ffi::channels_bchannel(unsafe { ffi::ncplane_channels(plane)}) } /// Extract 24 bits of working foreground RGB from an ncplane, shifted to LSBs. // TODO: TEST #[inline] -pub fn ncplane_fg(plane: &ffi::ncplane) -> Channel { +pub fn ncplane_fg(plane: &ncplane) -> Channel { ffi::channels_fg(unsafe { ffi::ncplane_channels(plane)}) } @@ -510,35 +585,35 @@ pub fn ncplane_fg(plane: &ffi::ncplane) -> Channel { /// Extract 24 bits of working background RGB from an ncplane, shifted to LSBs. // TODO: TEST #[inline] -pub fn ncplane_bg(plane: &ffi::ncplane) -> Channel { +pub fn ncplane_bg(plane: &ncplane) -> Channel { ffi::channels_bg(unsafe { ffi::ncplane_channels(plane)}) } /// Extract 2 bits of foreground alpha from 'struct ncplane', shifted to LSBs. // TODO: TEST #[inline] -pub fn ncplane_fg_alpha(plane: &ffi::ncplane) -> AlphaBits { +pub fn ncplane_fg_alpha(plane: &ncplane) -> AlphaBits { ffi::channels_fg_alpha(unsafe { ffi::ncplane_channels(plane)}) } /// Extract 2 bits of background alpha from 'struct ncplane', shifted to LSBs. // TODO: TEST #[inline] -pub fn ncplane_bg_alpha(plane: &ffi::ncplane) -> AlphaBits { +pub fn ncplane_bg_alpha(plane: &ncplane) -> AlphaBits { ffi::channels_bg_alpha(unsafe { ffi::ncplane_channels(plane)}) } /// Is the plane's foreground using the "default foreground color"? // TODO: TEST #[inline] -pub fn ncplane_fg_default_p(plane: &ffi::ncplane) -> bool { +pub fn ncplane_fg_default_p(plane: &ncplane) -> bool { ffi::channels_fg_default_p(unsafe { ffi::ncplane_channels(plane)}) } /// Is the plane's background using the "default background color"? // TODO: TEST #[inline] -pub fn ncplane_bg_default_p(plane: &ffi::ncplane) -> bool { +pub fn ncplane_bg_default_p(plane: &ncplane) -> bool { ffi::channels_bg_default_p(unsafe { ffi::ncplane_channels(plane)}) } @@ -546,7 +621,7 @@ pub fn ncplane_bg_default_p(plane: &ffi::ncplane) -> bool { // TODO: TEST #[inline] pub fn ncplane_fg_rgb( - plane: &ffi::ncplane, + plane: &ncplane, red: &mut Color, green: &mut Color, blue: &mut Color, @@ -558,7 +633,7 @@ pub fn ncplane_fg_rgb( // TODO: TEST #[inline] pub fn ncplane_bg_rgb( - plane: &ffi::ncplane, + plane: &ncplane, red: &mut Color, green: &mut Color, blue: &mut Color, @@ -582,30 +657,6 @@ pub fn ncplane_bg_rgb( // return ret; // } -// static inline int -// ncplane_perimeter_rounded(struct ncplane* n, uint32_t attrword, -// uint64_t channels, unsigned ctlword){ -// if(ncplane_cursor_move_yx(n, 0, 0)){ -// return -1; -// } -// int dimy, dimx; -// ncplane_dim_yx(n, &dimy, &dimx); -// cell ul = CELL_TRIVIAL_INITIALIZER; -// cell ur = CELL_TRIVIAL_INITIALIZER; -// cell ll = CELL_TRIVIAL_INITIALIZER; -// cell lr = CELL_TRIVIAL_INITIALIZER; -// cell vl = CELL_TRIVIAL_INITIALIZER; -// cell hl = CELL_TRIVIAL_INITIALIZER; -// if(cells_rounded_box(n, attrword, channels, &ul, &ur, &ll, &lr, &hl, &vl)){ -// return -1; -// } -// int r = ncplane_box_sized(n, &ul, &ur, &ll, &lr, &hl, &vl, dimy, dimx, ctlword); -// cell_release(n, &ul); cell_release(n, &ur); -// cell_release(n, &ll); cell_release(n, &lr); -// cell_release(n, &hl); cell_release(n, &vl); -// return r; -// } - // static inline int // ncplane_rounded_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels, // int ylen, int xlen, unsigned ctlword){ @@ -631,30 +682,6 @@ pub fn ncplane_bg_rgb( // return ret; // } -// static inline int -// ncplane_perimeter_double(struct ncplane* n, uint32_t attrword, -// uint64_t channels, unsigned ctlword){ -// if(ncplane_cursor_move_yx(n, 0, 0)){ -// return -1; -// } -// int dimy, dimx; -// ncplane_dim_yx(n, &dimy, &dimx); -// cell ul = CELL_TRIVIAL_INITIALIZER; -// cell ur = CELL_TRIVIAL_INITIALIZER; -// cell ll = CELL_TRIVIAL_INITIALIZER; -// cell lr = CELL_TRIVIAL_INITIALIZER; -// cell vl = CELL_TRIVIAL_INITIALIZER; -// cell hl = CELL_TRIVIAL_INITIALIZER; -// if(cells_double_box(n, attrword, channels, &ul, &ur, &ll, &lr, &hl, &vl)){ -// return -1; -// } -// int r = ncplane_box_sized(n, &ul, &ur, &ll, &lr, &hl, &vl, dimy, dimx, ctlword); -// cell_release(n, &ul); cell_release(n, &ur); -// cell_release(n, &ll); cell_release(n, &lr); -// cell_release(n, &hl); cell_release(n, &vl); -// return r; -// } - // static inline int // ncplane_double_box_sized(struct ncplane* n, uint32_t attr, uint64_t channels, // int ylen, int xlen, unsigned ctlword){