rust: improve info headers for maximum consistency

and implement 1 palette fuction
This commit is contained in:
joseLuís 2020-08-11 11:30:46 +02:00
parent 70adc5645b
commit 8b01f26730
7 changed files with 68 additions and 92 deletions

View File

@ -1,5 +1,5 @@
// Already exported by bindgen: 6
//
// functions already exported by bindgen : 6
// -----------------------------------------
// - cell_duplicate
// - cell_extended_gcluster
// - cell_load
@ -7,15 +7,11 @@
// - cells_double_box
// - cells_rounded_box
//
// FUNCTIONS TO REIMPLEMENT:
// - from notcurses.h: 45
// - done: ±2
// static inline functions to reimplement: 45
// ------------------------------------------
// - finished : ±2
// - remaining: 43
//
// ---------------
// + reimplemented
// # and unit test
// --------------
// --------------- (+) implemented (#) + unit test (x) wont implement
// cell_bchannel
// cell_bg
// cell_bg_alpha

View File

@ -1,37 +1,34 @@
// NOTE: There are several differences from the original functions in C:
// ---------------------------------------------------------------------------------------
// - NOTE: The channel components are u8 instead of u32.
// Because of type enforcing, some runtime checks are now unnecessary.
//
// - The channel components are u8 instead of u32. Because of type enforcing by the
// compiler, some runtime checks are now unnecessary.
//
// - These functions now can't fail and doesn't have to return an error:
// - NOTE: These functions now can't fail and don't have to return an error:
// - `channel_set_rgb()`
// - `channels_set_fg_rgb()`
// - `channels_set_bg_rgb()`
//
// - These functions were therefore deemed unnecessary to implement:
// - NOTE: These functions were therefore deemed unnecessary to implement:
// - `channel_set_rgb_clipped()`
// - `channels_set_fg_rgb_clipped()`
// - `channels_set_bg_rgb_clipped()`
//
// - These functions return an integer error result:
// - These functions still return an integer error result:
// - `channel_set_alpha()`
// - `channel_set_rgb()`
// - `channels_set_fg()`
// - `channels_set_bg()`
// - `channels_set_fg_alpha()`
// - `channels_set_bg_alpha()`
// ---------------------------------------------------------------------------------------
//
// functions already exported by bindgen : 0
// ------------------------------------------
//
// FUNCTIONS TO REIMPLEMENT:
// - from notcurses.h: 38
// - done: ±37
// static inline functions to reimplement: 38
// ------------------------------------------
// - finished : 37
// - remaining: 1
//
// ---------------
// + reimplemented
// # and unit test
// x not needed
// --------------
// --------------- (+) implemented (#) + unit test (x) wont implement
//#channel_alpha
//#channel_b
//#channel_default_p // FIXME TEST

View File

@ -1,13 +1,9 @@
// Functions already exported by bindgen: 0
// static inline functions to reimplement: 2
// - done: 2
// - remaining: 0
// functions already exported by bindgen : 0
//
// Function list
// ---------------
// + reimplemented
// # and unit test
// --------------
// static inline functions to reimplement: 2
// - finished : 2
// - remaining: 0
// --------------- (+) implemented (#) + unit test (x) wont implement
//+nckey_mouse_p
//+nckey_supppuab_p

View File

@ -1,5 +1,5 @@
// Already exported by bindgen: 35
//
// functions already exported by bindgen : 35
// ------------------------------------------
// notcurses_at_yx
// notcurses_canchangecolor
// notcurses_canfade
@ -36,15 +36,11 @@
// notcurses_version
// notcurses_version_components
//
// FUNCTIONS TO REIMPLEMENT:
// - from notcurses.h: 4
// - done: 0
// static inline functions to reimplement: 4
// -----------------------------------------
// - finished : 0
// - remaining: 4
//
// ---------------
// + reimplemented
// # and unit test
// --------------
// --------------- (+) implemented (#) + unit test (x) wont implement
// notcurses_getc_blocking
// notcurses_getc_nblock
// notcurses_stddim_yx

View File

@ -1,32 +1,32 @@
// Already exported by bindgen: 3
// ---------------------------------------------------------------------------------------
// NOTE: These functions now can't fail and dont't have to return an error:
// - `palette256_set_rgb()`
// ---------------------------------------------------------------------------------------
//
// functions already exported by bindgen : 3
// -----------------------------------------
// palette256_free
// palette256_new
// palette256_use
//
// FUNCTIONS TO REIMPLEMENT:
// - from notcurses.h: 3
// - done: 0
// - remaining: 3
//
// ---------------
// + reimplemented
// # and unit test
// --------------
// palette256_get_rgb
// static inline functions to reimplement: 3
// -----------------------------------------
// - finished : 1
// - remaining: 2
// --------------- (+) implemented (#) + unit test (x) wont implement
//+palette256_get_rgb
// palette256_set
// palette256_set_rgb
use crate as ffi;
use crate::types::Color;
// // Manipulate entries in the palette store 'p'. These are *not* locked.
// static inline int
// palette256_set_rgb(palette256* p, int idx, int r, int g, int b){
// if(idx < 0 || (size_t)idx > sizeof(p->chans) / sizeof(*p->chans)){
// return -1;
// }
// return channel_set_rgb(&p->chans[idx], r, g, b);
// }
//
/// Manipulate entries in the palette store 'p'. These are *not* locked.
pub fn palette256_set_rgb(palette: &mut ffi::palette256, idx: usize, r: Color, g: Color, b: Color) {
ffi::channel_set_rgb(&mut palette.chans[idx], r, g, b)
}
// XXX: what is the return type?
// static inline int
// palette256_set(palette256* p, int idx, unsigned rgb){
// if(idx < 0 || (size_t)idx > sizeof(p->chans) / sizeof(*p->chans)){
@ -34,7 +34,7 @@
// }
// return channel_set(&p->chans[idx], rgb);
// }
//
// static inline int
// palette256_get_rgb(const palette256* p, int idx, unsigned* RESTRICT r, unsigned* RESTRICT g, unsigned* RESTRICT b){
// if(idx < 0 || (size_t)idx > sizeof(p->chans) / sizeof(*p->chans)){

View File

@ -1,15 +1,11 @@
// Already exported by bindgen: 0
// functions already exported by bindgen : 0
// -----------------------------------------
//
// FUNCTIONS TO REIMPLEMENT:
// - from notcurses.h: 10
// - done: 0
// static inline functions to reimplement: 3
// -----------------------------------------
// - finished : 0
// - remaining: 10
//
// ---------------
// + reimplemented
// # and unit test
// --------------
//
// --------------- (+) implemented (#) + unit test (x) wont implement
// ncpixel
// ncpixel_a
// ncpixel_b

View File

@ -1,5 +1,5 @@
// Already exported by bindgen: 86
//
// functions already exported by bindgen : 86
// ------------------------------------------
// ncplane_aligned
// ncplane_at_cursor
// ncplane_attr
@ -87,16 +87,11 @@
// ncplane_vprintf_yx
// ncplane_yx
//
//
// FUNCTIONS TO REIMPLEMENT:
// - from notcurses.h: 42
// - done: ±4
// static inline functions to reimplement: 42
// ------------------------------------------
// - finished : ±4
// - remaining: 38
//
// ---------------
// + reimplemented
// # and unit test
// --------------
// --------------- (+) implemented (#) + unit test (x) wont implement
// ncplane_align
// ncplane_at_cursor_cell
// ncplane_at_yx_cell