rust: fix comments

pull/1097/head
joseLuís 4 years ago
parent e8ff092f50
commit fed2d7cb9b

@ -73,7 +73,6 @@ use nc::types::{
///
/// Until we can change gcluster to a safer type, this function will remain unsafe
///
// TODO: TEST!
#[allow(unused_unsafe)]
pub unsafe fn cell_prime(
plane: &mut nc::ncplane,
@ -98,7 +97,6 @@ pub unsafe fn cell_prime(
///
/// Until we can change gcluster to a safer type, this function will remain unsafe
///
// TODO: TEST!
#[allow(unused_unsafe)]
pub unsafe fn cells_load_box(
plane: &mut Plane,
@ -166,7 +164,6 @@ pub unsafe fn cells_load_box(
}
///
// TODO: TEST
#[inline]
pub fn cell_init(cell: &mut Cell) {
*cell = unsafe { core::mem::zeroed() }
@ -175,14 +172,12 @@ pub fn cell_init(cell: &mut Cell) {
/// Set the specified style bits for the cell 'c', whether they're actively
/// supported or not. Only the lower 16 bits are meaningful.
/// static inline void
// TODO: TEST
#[inline]
pub fn cell_styles_set(cell: &mut Cell, stylebits: StyleMask) {
cell.stylemask = stylebits & nc::NCSTYLE_MASK as u16;
}
/// Extract the style bits from the cell.
// TODO: TEST
#[inline]
pub fn cell_styles(cell: &Cell) -> StyleMask {
cell.stylemask
@ -190,49 +185,42 @@ pub fn cell_styles(cell: &Cell) -> StyleMask {
/// Add the specified styles (in the LSBs) to the cell's existing spec, whether
/// they're actively supported or not.
// TODO: TEST
#[inline]
pub fn cell_styles_on(cell: &mut Cell, stylebits: StyleMask) {
cell.stylemask |= stylebits & nc::NCSTYLE_MASK as u16;
}
/// Remove the specified styles (in the LSBs) from the cell's existing spec.
// TODO: TEST
#[inline]
pub fn cell_styles_off(cell: &mut Cell, stylebits: StyleMask) {
cell.stylemask &= !(stylebits & nc::NCSTYLE_MASK as u16);
}
/// Use the default color for the foreground.
// TODO: TEST
#[inline]
pub fn cell_set_fg_default(cell: &mut Cell) {
nc::channels_set_fg_default(&mut cell.channels);
}
/// Use the default color for the background.
// TODO: TEST
#[inline]
pub fn cell_set_bg_default(cell: &mut Cell) {
nc::channels_set_bg_default(&mut cell.channels);
}
/// Set the foreground alpha.
// TODO: TEST
#[inline]
pub fn cell_set_fg_alpha(cell: &mut Cell, alpha: AlphaBits) {
nc::channels_set_fg_alpha(&mut cell.channels, alpha);
}
/// Set the background alpha.
// TODO: TEST
#[inline]
pub fn cell_set_bg_alpha(cell: &mut Cell, alpha: AlphaBits) {
nc::channels_set_bg_alpha(&mut cell.channels, alpha);
}
/// Does the cell contain an East Asian Wide codepoint?
// TODO: TEST
// NOTE: remove casting when fixed: https://github.com/rust-lang/rust-bindgen/issues/1875
#[inline]
pub fn cell_double_wide_p(cell: &Cell) -> bool {
@ -240,14 +228,12 @@ pub fn cell_double_wide_p(cell: &Cell) -> bool {
}
/// Is this the right half of a wide character?
// TODO: TEST
#[inline]
pub fn cell_wide_right_p(cell: &Cell) -> bool {
cell_double_wide_p(cell) && cell.gcluster == 0
}
/// Is this the left half of a wide character?
// TODO: TEST
#[inline]
pub fn cell_wide_left_p(cell: &Cell) -> bool {
cell_double_wide_p(cell) && cell.gcluster != 0
@ -255,7 +241,6 @@ pub fn cell_wide_left_p(cell: &Cell) -> bool {
/// copy the UTF8-encoded EGC out of the cell, whether simple or complex. the
/// result is not tied to the ncplane, and persists across erases / destruction.
// TODO: TEST
#[inline]
pub fn cell_strdup(plane: &Plane, cell: &Cell) -> EGC {
core::char::from_u32(
@ -270,7 +255,6 @@ pub fn cell_strdup(plane: &Plane, cell: &Cell) -> EGC {
}
/// Extract the three elements of a cell.
// TODO: TEST
#[inline]
pub fn cell_extract(
plane: &Plane,
@ -291,7 +275,6 @@ pub fn cell_extract(
/// The actual egcpool index needn't be the same--indeed, the planes needn't even
/// be the same. Only the expanded EGC must be equal. The EGC must be bit-equal;
/// it would probably be better to test whether they're Unicode-equal FIXME.
// TODO: TEST
#[inline]
pub fn cellcmp(plane1: &Plane, cell1: &Cell, plane2: &Plane, cell2: &Cell) -> bool {
if cell1.stylemask != cell2.stylemask {
@ -308,7 +291,7 @@ pub fn cellcmp(plane1: &Plane, cell1: &Cell, plane2: &Plane, cell2: &Cell) -> bo
}
}
// TODO: TEST
///
// NOTE: remove casting for CELL_WIEDASIAN_MASK when fixed: https://github.com/rust-lang/rust-bindgen/issues/1875
#[inline]
pub fn cell_load_simple(plane: &mut Plane, cell: &mut Cell, ch: EGC) -> i32 {
@ -321,70 +304,60 @@ pub fn cell_load_simple(plane: &mut Plane, cell: &mut Cell, ch: EGC) -> i32 {
}
/// Extract the 32-bit background channel from a cell.
// TODO: TEST
#[inline]
pub fn cell_bchannel(cell: &Cell) -> Channel {
nc::channels_bchannel(cell.channels)
}
/// Extract the 32-bit foreground channel from a cell.
// TODO: TEST
#[inline]
pub fn cell_fchannel(cell: &Cell) -> Channel {
nc::channels_fchannel(cell.channels)
}
/// Set the 32-bit background channel of a cell.
// TODO: TEST
#[inline]
pub fn cell_set_bchannel(cell: &mut Cell, channel: Channel) -> ChannelPair {
nc::channels_set_bchannel(&mut cell.channels, channel)
}
/// Set the 32-bit foreground channel of a cell.
// TODO: TEST
#[inline]
pub fn cell_set_fchannel(cell: &mut Cell, channel: Channel) -> ChannelPair {
nc::channels_set_fchannel(&mut cell.channels, channel)
}
/// Extract 24 bits of foreground RGB from 'cell', shifted to LSBs.
// TODO: TEST
#[inline]
pub fn cell_fg_rgb(cell: &Cell) -> Channel {
nc::channels_fg_rgb(cell.channels)
}
/// Extract 24 bits of background RGB from 'cell', shifted to LSBs.
// TODO: TEST
#[inline]
pub fn cell_bg_rgb(cell: &Cell) -> Channel {
nc::channels_bg_rgb(cell.channels)
}
/// Extract 2 bits of foreground alpha from 'cell', shifted to LSBs.
// TODO: TEST
#[inline]
pub fn cell_fg_alpha(cell: &Cell) -> AlphaBits {
nc::channels_fg_alpha(cell.channels)
}
/// Extract 2 bits of background alpha from 'cell', shifted to LSBs.
// TODO: TEST
#[inline]
pub fn cell_bg_alpha(cell: &Cell) -> AlphaBits {
nc::channels_bg_alpha(cell.channels)
}
/// Extract 24 bits of foreground RGB from 'cell', split into components.
// TODO: TEST
#[inline]
pub fn cell_fg_rgb8(cell: &Cell, red: &mut Color, green: &mut Color, blue: &mut Color) -> Channel {
nc::channels_fg_rgb8(cell.channels, red, green, blue)
}
/// Extract 24 bits of background RGB from 'cell', split into components.
// TODO: TEST
#[inline]
pub fn cell_bg_rgb8(cell: &Cell, red: &mut Color, green: &mut Color, blue: &mut Color) -> Channel {
nc::channels_bg_rgb8(cell.channels, red, green, blue)
@ -392,14 +365,12 @@ pub fn cell_bg_rgb8(cell: &Cell, red: &mut Color, green: &mut Color, blue: &mut
/// Set the r, g, and b cell for the foreground component of this 64-bit
/// 'cell' variable, and mark it as not using the default color.
// TODO: TEST
#[inline]
pub fn cell_set_fg_rgb8(cell: &mut Cell, red: Color, green: Color, blue: Color) {
nc::channels_set_fg_rgb8(&mut cell.channels, red, green, blue);
}
/// Same as `cell_set_fg_rgb8()` but with an assembled 24-bit RGB value.
// TODO: TEST
#[inline]
pub fn cell_set_fg_rgb(cell: &mut Cell, channel: Channel) {
nc::channels_set_fg_rgb(&mut cell.channels, channel);
@ -408,7 +379,6 @@ pub fn cell_set_fg_rgb(cell: &mut Cell, channel: Channel) {
/// Set the cell's foreground palette index, set the foreground palette index
/// bit, set it foreground-opaque, and clear the foreground default color bit.
///
// TODO: TEST
// NOTE: this function now can't fail
#[inline]
pub fn cell_set_fg_palindex(cell: &mut Cell, index: PaletteIndex) {
@ -419,7 +389,7 @@ pub fn cell_set_fg_palindex(cell: &mut Cell, index: PaletteIndex) {
cell.channels |= (index as u64) << 32;
}
// TODO: TEST
///
#[inline]
pub fn cell_fg_palindex(cell: &Cell) -> PaletteIndex {
((cell.channels & 0xff00000000_u64) >> 32) as PaletteIndex
@ -428,7 +398,6 @@ pub fn cell_fg_palindex(cell: &Cell) -> PaletteIndex {
/// Set the r, g, and b cell for the background component of this 64-bit
/// 'cell' variable, and mark it as not using the default color.
///
// TODO: TEST
#[inline]
pub fn cell_set_bg_rgb8(cell: &mut Cell, red: Color, green: Color, blue: Color) {
nc::channels_set_bg_rgb8(&mut cell.channels, red, green, blue);
@ -436,7 +405,6 @@ pub fn cell_set_bg_rgb8(cell: &mut Cell, red: Color, green: Color, blue: Color)
/// Same as `cell_set_fg_rgb8()` but with an assembled 24-bit RGB value.
///
// TODO: TEST
#[inline]
pub fn cell_set_bg_rgb(cell: &mut Cell, channel: Channel) {
nc::channels_set_bg_rgb(&mut cell.channels, channel);
@ -445,7 +413,6 @@ pub fn cell_set_bg_rgb(cell: &mut Cell, channel: Channel) {
/// Set the cell's background palette index, set the background palette index
/// bit, set it background-opaque, and clear the background default color bit.
///
// TODO: TEST
// NOTE: this function now can't fail
#[inline]
pub fn cell_set_bg_palindex(cell: &mut Cell, index: PaletteIndex) {
@ -456,19 +423,19 @@ pub fn cell_set_bg_palindex(cell: &mut Cell, index: PaletteIndex) {
cell.channels |= index as u64;
}
// TODO: TEST
///
#[inline]
pub fn cell_bg_palindex(cell: &Cell) -> PaletteIndex {
(cell.channels & 0xff) as PaletteIndex
}
/// Is the foreground using the "default foreground color"?
// TODO: TEST
#[inline]
pub fn cell_fg_default_p(cell: &Cell) -> bool {
nc::channels_fg_default_p(cell.channels)
}
// TODO: TEST
///
#[inline]
pub fn cell_fg_palindex_p(cell: &Cell) -> bool {
nc::channels_fg_palindex_p(cell.channels)
@ -477,13 +444,12 @@ pub fn cell_fg_palindex_p(cell: &Cell) -> bool {
/// Is the background using the "default background color"? The "default
/// background color" must generally be used to take advantage of
/// terminal-effected transparency.
// TODO: TEST
#[inline]
pub fn cell_bg_default_p(cell: &Cell) -> bool {
nc::channels_bg_default_p(cell.channels)
}
// TODO: TEST
///
#[inline]
pub fn cell_bg_palindex_p(cell: &Cell) -> bool {
nc::channels_bg_palindex_p(cell.channels)

@ -100,7 +100,6 @@ pub fn channel_set_rgb8(channel: &mut Channel, r: Color, g: Color, b: Color) {
}
/// Same as channel_set_rgb8(), but provide an assembled, packed 24 bits of rgb.
// TODO: TEST
#[inline]
pub fn channel_set(channel: &mut Channel, rgb: Rgb) {
*channel = (*channel & !nc::CELL_BG_RGB_MASK) | nc::CELL_BGDEFAULT_MASK | (rgb & 0x00ffffff);
@ -125,14 +124,12 @@ pub fn channel_set_alpha(channel: &mut Channel, alpha: AlphaBits) {
}
/// Is this channel using the "default color" rather than RGB/palette-indexed?
// TODO: TEST
#[inline]
pub fn channel_default_p(channel: Channel) -> bool {
(channel & nc::CELL_BGDEFAULT_MASK) == 0
}
/// Is this channel using palette-indexed color rather than RGB?
// TODO: TEST
#[inline]
pub fn channel_palindex_p(channel: Channel) -> bool {
!channel_default_p(channel) && (channel & nc::CELL_BG_PALETTE) == 0
@ -181,35 +178,30 @@ pub fn channels_combine(fchannel: Channel, bchannel: Channel) -> ChannelPair {
}
/// Extract 24 bits of foreground RGB from 'channels', shifted to LSBs.
// TODO: TEST
#[inline]
pub fn channels_fg_rgb(channels: ChannelPair) -> Channel {
channels_fchannel(channels) & nc::CELL_BG_RGB_MASK
}
/// Extract 24 bits of background RGB from 'channels', shifted to LSBs.
// TODO: TEST
#[inline]
pub fn channels_bg_rgb(channels: ChannelPair) -> Channel {
channels_bchannel(channels) & nc::CELL_BG_RGB_MASK
}
/// Extract 2 bits of foreground alpha from 'channels', shifted to LSBs.
// TODO: TEST
#[inline]
pub fn channels_fg_alpha(channels: ChannelPair) -> AlphaBits {
channel_alpha(channels_fchannel(channels))
}
/// Extract 2 bits of background alpha from 'channels', shifted to LSBs.
// TODO: TEST
#[inline]
pub fn channels_bg_alpha(channels: ChannelPair) -> AlphaBits {
channel_alpha(channels_bchannel(channels))
}
/// Extract 24 bits of foreground RGB from 'channels', split into subchannels.
// TODO: TEST
#[inline]
pub fn channels_fg_rgb8(
channels: ChannelPair,
@ -221,7 +213,6 @@ pub fn channels_fg_rgb8(
}
/// Extract 24 bits of background RGB from 'channels', split into subchannels.
// TODO: TEST
#[inline]
pub fn channels_bg_rgb8(
channels: ChannelPair,
@ -234,7 +225,6 @@ pub fn channels_bg_rgb8(
/// Set the r, g, and b channels for the foreground component of this 64-bit
/// 'channels' variable, and mark it as not using the default color.
// TODO: TEST
#[inline]
pub fn channels_set_fg_rgb8(channels: &mut ChannelPair, r: Color, g: Color, b: Color) {
let mut channel = channels_fchannel(*channels);
@ -243,7 +233,6 @@ pub fn channels_set_fg_rgb8(channels: &mut ChannelPair, r: Color, g: Color, b: C
}
/// Same as channels_set_fg_rgb8 but set an assembled 24 bit channel at once.
// TODO: TEST
#[inline]
pub fn channels_set_fg_rgb(channels: &mut ChannelPair, rgb: Rgb) {
let mut channel = channels_fchannel(*channels);
@ -253,7 +242,6 @@ pub fn channels_set_fg_rgb(channels: &mut ChannelPair, rgb: Rgb) {
/// Set the r, g, and b channels for the background component of this 64-bit
/// 'channels' variable, and mark it as not using the default color.
// TODO: TEST
#[inline]
pub fn channels_set_bg_rgb8(channels: &mut ChannelPair, r: Color, g: Color, b: Color) {
let mut channel = channels_bchannel(*channels);
@ -262,7 +250,6 @@ pub fn channels_set_bg_rgb8(channels: &mut ChannelPair, r: Color, g: Color, b: C
}
/// Same as channels_set_bg_rgb8 but set an assembled 24 bit channel at once.
// TODO: TEST
#[inline]
pub fn channels_set_bg_rgb(channels: &mut ChannelPair, rgb: Rgb) {
let mut channel = channels_bchannel(*channels);
@ -271,7 +258,6 @@ pub fn channels_set_bg_rgb(channels: &mut ChannelPair, rgb: Rgb) {
}
/// Set the 2-bit alpha component of the foreground channel.
// TODO: TEST
#[inline]
pub fn channels_set_fg_alpha(channels: &mut ChannelPair, alpha: AlphaBits) {
let mut channel = channels_fchannel(*channels);
@ -280,7 +266,6 @@ pub fn channels_set_fg_alpha(channels: &mut ChannelPair, alpha: AlphaBits) {
}
/// Set the 2-bit alpha component of the background channel.
// TODO: TEST
#[inline]
pub fn channels_set_bg_alpha(channels: &mut ChannelPair, alpha: AlphaBits) {
let mut alpha_clean = alpha;
@ -294,14 +279,12 @@ pub fn channels_set_bg_alpha(channels: &mut ChannelPair, alpha: AlphaBits) {
}
/// Is the foreground using the "default foreground color"?
// TODO: TEST
#[inline]
pub fn channels_fg_default_p(channels: ChannelPair) -> bool {
channel_default_p(channels_fchannel(channels))
}
/// Is the foreground using indexed palette color?
// TODO: TEST
#[inline]
pub fn channels_fg_palindex_p(channels: ChannelPair) -> bool {
channel_palindex_p(channels_fchannel(channels))
@ -310,21 +293,18 @@ pub fn channels_fg_palindex_p(channels: ChannelPair) -> bool {
/// Is the background using the "default background color"? The "default
/// background color" must generally be used to take advantage of
/// terminal-effected transparency.
// TODO: TEST
#[inline]
pub fn channels_bg_default_p(channels: ChannelPair) -> bool {
channel_default_p(channels_bchannel(channels))
}
/// Is the background using indexed palette color?
// TODO: TEST
#[inline]
pub fn channels_bg_palindex_p(channels: ChannelPair) -> bool {
channel_palindex_p(channels_bchannel(channels))
}
/// Mark the foreground channel as using its default color.
// TODO: TEST
#[inline]
pub fn channels_set_fg_default(channels: &mut ChannelPair) -> ChannelPair {
let mut channel = channels_fchannel(*channels);
@ -334,7 +314,6 @@ pub fn channels_set_fg_default(channels: &mut ChannelPair) -> ChannelPair {
}
/// Mark the background channel as using its default color.
// TODO: TEST
#[inline]
pub fn channels_set_bg_default(channels: &mut ChannelPair) -> ChannelPair {
let mut channel = channels_bchannel(*channels);

@ -58,7 +58,6 @@ use crate as nc;
use nc::types::{Align, FullMode, Input, Plane, ALIGN_CENTER, ALIGN_LEFT};
/// return the offset into 'availcols' at which 'cols' ought be output given the requirements of 'align'
// TODO: TEST
#[inline]
pub fn notcurses_align(availcols: i32, align: Align, cols: i32) -> i32 {
if align == ALIGN_LEFT {
@ -75,7 +74,6 @@ pub fn notcurses_align(availcols: i32, align: Align, cols: i32) -> i32 {
/// 'input' may be NULL if the caller is uninterested in event details.
/// If no event is ready, returns 0.
// TODO: TEST
#[inline]
pub fn notcurses_getc_nblock(nc: &mut FullMode, input: &mut Input) -> nc::char32_t {
unsafe {
@ -91,7 +89,6 @@ pub fn notcurses_getc_nblock(nc: &mut FullMode, input: &mut Input) -> nc::char32
/// 'input' may be NULL if the caller is uninterested in event details.
/// Blocks until an event is processed or a signal is received.
// TODO: TEST
#[inline]
pub fn notcurses_getc_nblocking(nc: &mut FullMode, input: &mut Input) -> nc::char32_t {
unsafe {
@ -102,7 +99,6 @@ pub fn notcurses_getc_nblocking(nc: &mut FullMode, input: &mut Input) -> nc::cha
}
/// notcurses_stdplane(), plus free bonus dimensions written to non-NULL y/x!
// TODO: TEST
#[inline]
pub fn notcurses_stddim_yx(nc: &mut FullMode, y: &mut i32, x: &mut i32) -> Plane {
unsafe {
@ -113,7 +109,6 @@ pub fn notcurses_stddim_yx(nc: &mut FullMode, y: &mut i32, x: &mut i32) -> Plane
}
/// Return our current idea of the terminal dimensions in rows and cols.
// TODO: TEST
#[inline]
pub fn notcurses_term_dim_yx(nc: &FullMode, rows: &mut i32, cols: &mut i32) {
unsafe {

@ -164,7 +164,6 @@ use nc::types::{
/// Undefined behavior on negative 'cols'.
//
// NOTE: [leave cols as i32](https://github.com/dankamongmen/notcurses/issues/904)
// TODO: TEST
#[inline]
pub fn ncplane_align(plane: &Plane, align: Align, cols: i32) -> i32 {
nc::notcurses_align(nc::ncplane_dim_x(plane), align, cols)
@ -172,7 +171,6 @@ pub fn ncplane_align(plane: &Plane, align: Align, cols: i32) -> i32 {
/// Retrieve the current contents of the cell under the cursor into 'cell'.
/// This cell is invalidated if the associated plane is destroyed.
// TODO: TEST
#[inline]
pub fn nplane_at_cursor_cell(plane: &mut Plane, cell: &mut Cell) -> IntResult {
let mut egc = unsafe { nc::ncplane_at_cursor(plane, &mut cell.stylemask, &mut cell.channels) };
@ -190,7 +188,6 @@ pub fn nplane_at_cursor_cell(plane: &mut Plane, cell: &mut Cell) -> IntResult {
/// Retrieve the current contents of the specified cell into 'cell'.
/// This cell is invalidated if the associated plane is destroyed.
// TODO: TEST
#[inline]
pub fn ncplane_at_yx_cell(plane: &mut Plane, y: i32, x: i32, cell: &mut Cell) -> IntResult {
let mut egc =
@ -210,7 +207,6 @@ pub fn ncplane_at_yx_cell(plane: &mut Plane, y: i32, x: i32, cell: &mut Cell) ->
/// 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 Plane,
@ -243,7 +239,6 @@ pub fn ncplane_box_sized(
}
///
// TODO: TEST
#[inline]
pub fn ncplane_dim_x(plane: &Plane) -> i32 {
unsafe {
@ -254,7 +249,6 @@ pub fn ncplane_dim_x(plane: &Plane) -> i32 {
}
///
// TODO: TEST
#[inline]
pub fn ncplane_dim_y(plane: &Plane) -> i32 {
unsafe {
@ -264,7 +258,7 @@ pub fn ncplane_dim_y(plane: &Plane) -> i32 {
}
}
// TODO: TEST
///
#[inline]
pub fn ncplane_double_box(
plane: &mut Plane,
@ -310,7 +304,7 @@ pub fn ncplane_double_box(
ret
}
// TODO: TEST
///
#[inline]
pub fn ncplane_double_box_sized(
plane: &mut Plane,
@ -335,14 +329,12 @@ pub fn ncplane_double_box_sized(
}
/// On error, return the negative number of cells drawn.
// TODO: TEST
#[inline]
pub fn ncplane_hline(plane: &mut Plane, cell: &Cell, len: i32) -> i32 {
unsafe { nc::ncplane_hline_interp(plane, cell, len, cell.channels, cell.channels) }
}
///
// TODO: TEST
#[inline]
pub fn ncplane_perimeter(
plane: &mut Plane,
@ -362,7 +354,7 @@ pub fn ncplane_perimeter(
}
}
// TODO: TEST
///
#[inline]
pub fn ncplane_perimeter_double(
plane: &mut Plane,
@ -411,7 +403,7 @@ pub fn ncplane_perimeter_double(
ret
}
// TODO: TEST!
///
#[inline]
pub fn ncplane_perimeter_rounded(
plane: &mut Plane,
@ -461,21 +453,18 @@ pub fn ncplane_perimeter_rounded(
}
/// Call ncplane_putc_yx() for the current cursor location.
// TODO: TEST
#[inline]
pub fn ncplane_putc(plane: &mut Plane, cell: &Cell) -> IntResult {
unsafe { nc::ncplane_putc_yx(plane, -1, -1, cell) }
}
/// Call ncplane_putegc() at the current cursor location.
// TODO: TEST
#[inline]
pub fn ncplane_putegc(plane: &mut Plane, gcluster: i8, sbytes: &mut i32) -> IntResult {
unsafe { nc::ncplane_putegc_yx(plane, -1, -1, &gcluster, sbytes) }
}
///
// TODO: TEST
#[inline]
pub fn ncplane_putstr(plane: &mut Plane, gclustarr: &[u8]) -> IntResult {
unsafe {
@ -489,7 +478,6 @@ pub fn ncplane_putstr(plane: &mut Plane, gclustarr: &[u8]) -> IntResult {
}
///
// TODO: TEST
#[inline]
pub fn ncplane_putnstr(plane: &mut Plane, size: nc::size_t, gclustarr: &[u8]) -> IntResult {
unsafe {
@ -505,7 +493,6 @@ pub fn ncplane_putnstr(plane: &mut Plane, size: nc::size_t, gclustarr: &[u8]) ->
/// Resize the plane, retaining what data we can (everything, unless we're
/// shrinking in some dimension). Keep the origin where it is.
// TODO: TEST
#[inline]
pub fn ncplane_resize_simple(plane: &mut Plane, ylen: i32, xlen: i32) -> IntResult {
let (mut oldy, mut oldx) = (0, 0);
@ -531,13 +518,12 @@ pub fn ncplane_resize_simple(plane: &mut Plane, ylen: i32, xlen: i32) -> IntResu
///
/// On error, return the negative number of cells drawn.
// TODO: TEST
#[inline]
pub fn ncplane_vline(plane: &mut Plane, cell: &Cell, len: i32) -> i32 {
unsafe { nc::ncplane_vline_interp(plane, cell, len, cell.channels, cell.channels) }
}
// TODO: TEST
///
#[inline]
pub fn ncplane_vprintf(plane: &mut Plane, format: &str, ap: &mut nc::__va_list_tag) -> IntResult {
unsafe {
@ -554,7 +540,6 @@ pub fn ncplane_vprintf(plane: &mut Plane, format: &str, ap: &mut nc::__va_list_t
/// Draw a gradient with its upper-left corner at the current cursor position,
/// having dimensions 'ylen'x'xlen'. See ncplane_gradient for more information.
/// static inline int
// TODO: TEST
// XXX receive cells as u32? https://github.com/dankamongmen/notcurses/issues/920
#[inline]
pub fn ncplane_gradient_sized(
@ -589,63 +574,54 @@ pub fn ncplane_gradient_sized(
}
/// Extract the 32-bit working foreground channel from an ncplane.
// TODO: TEST
#[inline]
pub fn ncplane_fchannel(plane: &Plane) -> Channel {
nc::channels_fchannel(unsafe { nc::ncplane_channels(plane) })
}
/// Extract the 32-bit working background channel from an ncplane.
// TODO: TEST
#[inline]
pub fn ncplane_bchannel(plane: &Plane) -> Channel {
nc::channels_bchannel(unsafe { nc::ncplane_channels(plane) })
}
/// Extract 24 bits of working foreground RGB from an ncplane, shifted to LSBs.
// TODO: TEST
#[inline]
pub fn ncplane_fg_rgb(plane: &Plane) -> Channel {
nc::channels_fg_rgb(unsafe { nc::ncplane_channels(plane) })
}
/// Extract 24 bits of working background RGB from an ncplane, shifted to LSBs.
// TODO: TEST
#[inline]
pub fn ncplane_bg_rgb(plane: &Plane) -> Channel {
nc::channels_bg_rgb(unsafe { nc::ncplane_channels(plane) })
}
/// Extract 2 bits of foreground alpha from 'struct ncplane', shifted to LSBs.
// TODO: TEST
#[inline]
pub fn ncplane_fg_alpha(plane: &Plane) -> AlphaBits {
nc::channels_fg_alpha(unsafe { nc::ncplane_channels(plane) })
}
/// Extract 2 bits of background alpha from 'struct ncplane', shifted to LSBs.
// TODO: TEST
#[inline]
pub fn ncplane_bg_alpha(plane: &Plane) -> AlphaBits {
nc::channels_bg_alpha(unsafe { nc::ncplane_channels(plane) })
}
/// Is the plane's foreground using the "default foreground color"?
// TODO: TEST
#[inline]
pub fn ncplane_fg_default_p(plane: &Plane) -> bool {
nc::channels_fg_default_p(unsafe { nc::ncplane_channels(plane) })
}
/// Is the plane's background using the "default background color"?
// TODO: TEST
#[inline]
pub fn ncplane_bg_default_p(plane: &Plane) -> bool {
nc::channels_bg_default_p(unsafe { nc::ncplane_channels(plane) })
}
/// Extract 24 bits of foreground RGB from a plane, split into components.
// TODO: TEST
#[inline]
pub fn ncplane_fg_rgb8(
plane: &Plane,
@ -657,7 +633,6 @@ pub fn ncplane_fg_rgb8(
}
/// Extract 24 bits of background RGB from a plane, split into components.
// TODO: TEST
#[inline]
pub fn ncplane_bg_rgb8(
plane: &Plane,
@ -668,7 +643,7 @@ pub fn ncplane_bg_rgb8(
nc::channels_bg_rgb8(unsafe { nc::ncplane_channels(plane) }, red, green, blue)
}
// TODO: TEST
///
#[inline]
pub fn ncplane_rounded_box(
plane: &mut Plane,
@ -714,7 +689,7 @@ pub fn ncplane_rounded_box(
ret
}
// TODO: TEST
///
#[inline]
pub fn ncplane_rounded_box_sized(
plane: &mut Plane,

@ -42,3 +42,15 @@ pub fn ncvisual_default_blitter(utf8: bool, scale: Scale) -> Blitter {
}
BLIT_1x1
}
#[cfg(test)]
mod test {
// use super::nc;
// use serial_test::serial;
/*
#[test]
#[serial]
fn () {
}
*/
}

Loading…
Cancel
Save