diff --git a/crates/servicepoint_binding_c/README.md b/crates/servicepoint_binding_c/README.md index 836af2e..8a8281c 100644 --- a/crates/servicepoint_binding_c/README.md +++ b/crates/servicepoint_binding_c/README.md @@ -28,8 +28,8 @@ int main(void) { SPPacket *packet = sp_packet_from_command(command); while (sp_connection_send(connection, sp_packet_clone(packet))); - sp_packet_dealloc(packet); - sp_connection_dealloc(connection); + sp_packet_free(packet); + sp_connection_free(connection); return 0; } ``` diff --git a/crates/servicepoint_binding_c/examples/lang_c/src/main.c b/crates/servicepoint_binding_c/examples/lang_c/src/main.c index 738cdfe..77ddf5a 100644 --- a/crates/servicepoint_binding_c/examples/lang_c/src/main.c +++ b/crates/servicepoint_binding_c/examples/lang_c/src/main.c @@ -13,7 +13,7 @@ int main(void) { SPPacket *packet = sp_packet_from_command(command); while (sp_connection_send(connection, sp_packet_clone(packet))); - sp_packet_dealloc(packet); - sp_connection_dealloc(connection); + sp_packet_free(packet); + sp_connection_free(connection); return 0; } diff --git a/crates/servicepoint_binding_c/src/bit_vec.rs b/crates/servicepoint_binding_c/src/bit_vec.rs index 4455cfa..f5024d1 100644 --- a/crates/servicepoint_binding_c/src/bit_vec.rs +++ b/crates/servicepoint_binding_c/src/bit_vec.rs @@ -1,4 +1,4 @@ -//! C functions for interacting with `BitVec`s +//! C functions for interacting with `SPBitVec`s //! //! prefix `sp_bit_vec_` @@ -11,7 +11,7 @@ use servicepoint::bitvec::prelude::{BitVec, Msb0}; /// ```C /// SPBitVec vec = sp_bit_vec_new(8); /// sp_bit_vec_set(vec, 5, true); -/// sp_bit_vec_dealloc(vec); +/// sp_bit_vec_free(vec); /// ``` pub struct SPBitVec(BitVec); @@ -33,13 +33,13 @@ impl Clone for SPBitVec { } } -/// Creates a new `BitVec` instance. +/// Creates a new `SPBitVec` instance. /// /// # Arguments /// /// - `size`: size in bits. /// -/// returns: `BitVec` with all bits set to false. +/// returns: `SPBitVec` with all bits set to false. /// /// # Panics /// @@ -50,13 +50,13 @@ impl Clone for SPBitVec { /// The caller has to make sure that: /// /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_bit_vec_dealloc`. +/// by explicitly calling `sp_bit_vec_free`. #[no_mangle] pub unsafe extern "C" fn sp_bit_vec_new(size: usize) -> *mut SPBitVec { Box::into_raw(Box::new(SPBitVec(BitVec::repeat(false, size)))) } -/// Interpret the data as a series of bits and load then into a new `BitVec` instance. +/// Interpret the data as a series of bits and load then into a new `SPBitVec` instance. /// /// # Safety /// @@ -65,7 +65,7 @@ pub unsafe extern "C" fn sp_bit_vec_new(size: usize) -> *mut SPBitVec { /// - `data` points to a valid memory location of at least `data_length` /// bytes in size. /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_bit_vec_dealloc`. +/// by explicitly calling `sp_bit_vec_free`. #[no_mangle] pub unsafe extern "C" fn sp_bit_vec_load( data: *const u8, @@ -75,16 +75,16 @@ pub unsafe extern "C" fn sp_bit_vec_load( Box::into_raw(Box::new(SPBitVec(BitVec::from_slice(data)))) } -/// Clones a `BitVec`. +/// Clones a `SPBitVec`. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BitVec` +/// - `this` points to a valid `SPBitVec` /// - `this` is not written to concurrently /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_bit_vec_dealloc`. +/// by explicitly calling `sp_bit_vec_free`. #[no_mangle] pub unsafe extern "C" fn sp_bit_vec_clone( this: *const SPBitVec, @@ -92,21 +92,21 @@ pub unsafe extern "C" fn sp_bit_vec_clone( Box::into_raw(Box::new((*this).clone())) } -/// Deallocates a `BitVec`. +/// Deallocates a `SPBitVec`. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BitVec` +/// - `this` points to a valid `SPBitVec` /// - `this` is not used concurrently or after this call -/// - `this` was not passed to another consuming function, e.g. to create a `Command` +/// - `this` was not passed to another consuming function, e.g. to create a `SPCommand` #[no_mangle] -pub unsafe extern "C" fn sp_bit_vec_dealloc(this: *mut SPBitVec) { +pub unsafe extern "C" fn sp_bit_vec_free(this: *mut SPBitVec) { _ = Box::from_raw(this); } -/// Gets the value of a bit from the `BitVec`. +/// Gets the value of a bit from the `SPBitVec`. /// /// # Arguments /// @@ -123,7 +123,7 @@ pub unsafe extern "C" fn sp_bit_vec_dealloc(this: *mut SPBitVec) { /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BitVec` +/// - `this` points to a valid `SPBitVec` /// - `this` is not written to concurrently #[no_mangle] pub unsafe extern "C" fn sp_bit_vec_get( @@ -133,7 +133,7 @@ pub unsafe extern "C" fn sp_bit_vec_get( *(*this).0.get(index).unwrap() } -/// Sets the value of a bit in the `BitVec`. +/// Sets the value of a bit in the `SPBitVec`. /// /// # Arguments /// @@ -151,7 +151,7 @@ pub unsafe extern "C" fn sp_bit_vec_get( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BitVec` +/// - `this` points to a valid `SPBitVec` /// - `this` is not written to or read from concurrently #[no_mangle] pub unsafe extern "C" fn sp_bit_vec_set( @@ -162,7 +162,7 @@ pub unsafe extern "C" fn sp_bit_vec_set( (*this).0.set(index, value) } -/// Sets the value of all bits in the `BitVec`. +/// Sets the value of all bits in the `SPBitVec`. /// /// # Arguments /// @@ -172,20 +172,20 @@ pub unsafe extern "C" fn sp_bit_vec_set( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BitVec` +/// - `this` points to a valid `SPBitVec` /// - `this` is not written to or read from concurrently #[no_mangle] pub unsafe extern "C" fn sp_bit_vec_fill(this: *mut SPBitVec, value: bool) { (*this).0.fill(value) } -/// Gets the length of the `BitVec` in bits. +/// Gets the length of the `SPBitVec` in bits. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BitVec` +/// - `this` points to a valid `SPBitVec` #[no_mangle] pub unsafe extern "C" fn sp_bit_vec_len(this: *const SPBitVec) -> usize { (*this).0.len() @@ -197,21 +197,21 @@ pub unsafe extern "C" fn sp_bit_vec_len(this: *const SPBitVec) -> usize { /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BitVec` +/// - `this` points to a valid `SPBitVec` #[no_mangle] pub unsafe extern "C" fn sp_bit_vec_is_empty(this: *const SPBitVec) -> bool { (*this).0.is_empty() } -/// Gets an unsafe reference to the data of the `BitVec` instance. +/// Gets an unsafe reference to the data of the `SPBitVec` instance. /// /// ## Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BitVec` -/// - the returned memory range is never accessed after the passed `BitVec` has been freed -/// - the returned memory range is never accessed concurrently, either via the `BitVec` or directly +/// - `this` points to a valid `SPBitVec` +/// - the returned memory range is never accessed after the passed `SPBitVec` has been freed +/// - the returned memory range is never accessed concurrently, either via the `SPBitVec` or directly #[no_mangle] pub unsafe extern "C" fn sp_bit_vec_unsafe_data_ref( this: *mut SPBitVec, diff --git a/crates/servicepoint_binding_c/src/brightness_grid.rs b/crates/servicepoint_binding_c/src/brightness_grid.rs index a7d45f2..e129b94 100644 --- a/crates/servicepoint_binding_c/src/brightness_grid.rs +++ b/crates/servicepoint_binding_c/src/brightness_grid.rs @@ -1,4 +1,4 @@ -//! C functions for interacting with `BrightnessGrid`s +//! C functions for interacting with `SPBrightnessGrid`s //! //! prefix `sp_brightness_grid_` @@ -19,7 +19,7 @@ use std::intrinsics::transmute; /// sp_brightness_grid_set(grid, 1, 1, 10); /// /// SPCommand command = sp_command_char_brightness(grid); -/// sp_connection_dealloc(connection); +/// sp_connection_free(connection); /// ``` pub struct SPBrightnessGrid { pub(crate) actual: servicepoint::BrightnessGrid, @@ -33,16 +33,16 @@ impl Clone for SPBrightnessGrid { } } -/// Creates a new `BrightnessGrid` with the specified dimensions. +/// Creates a new `SPBrightnessGrid` with the specified dimensions. /// -/// returns: `BrightnessGrid` initialized to 0. +/// returns: `SPBrightnessGrid` initialized to 0. /// /// # Safety /// /// The caller has to make sure that: /// /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_brightness_grid_dealloc`. +/// by explicitly calling `sp_brightness_grid_free`. #[no_mangle] pub unsafe extern "C" fn sp_brightness_grid_new( width: usize, @@ -53,7 +53,7 @@ pub unsafe extern "C" fn sp_brightness_grid_new( })) } -/// Loads a `BrightnessGrid` with the specified dimensions from the provided data. +/// Loads a `SPBrightnessGrid` with the specified dimensions from the provided data. /// /// # Panics /// @@ -66,7 +66,7 @@ pub unsafe extern "C" fn sp_brightness_grid_new( /// - `data` points to a valid memory location of at least `data_length` /// bytes in size. /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_brightness_grid_dealloc`. +/// by explicitly calling `sp_brightness_grid_free`. #[no_mangle] pub unsafe extern "C" fn sp_brightness_grid_load( width: usize, @@ -81,16 +81,16 @@ pub unsafe extern "C" fn sp_brightness_grid_load( Box::into_raw(Box::new(SPBrightnessGrid { actual: grid })) } -/// Clones a `BrightnessGrid`. +/// Clones a `SPBrightnessGrid`. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BrightnessGrid` +/// - `this` points to a valid `SPBrightnessGrid` /// - `this` is not written to concurrently /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_brightness_grid_dealloc`. +/// by explicitly calling `sp_brightness_grid_free`. #[no_mangle] pub unsafe extern "C" fn sp_brightness_grid_clone( this: *const SPBrightnessGrid, @@ -98,17 +98,17 @@ pub unsafe extern "C" fn sp_brightness_grid_clone( Box::into_raw(Box::new((*this).clone())) } -/// Deallocates a `BrightnessGrid`. +/// Deallocates a `SPBrightnessGrid`. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BrightnessGrid` +/// - `this` points to a valid `SPBrightnessGrid` /// - `this` is not used concurrently or after this call -/// - `this` was not passed to another consuming function, e.g. to create a `Command` +/// - `this` was not passed to another consuming function, e.g. to create a `SPCommand` #[no_mangle] -pub unsafe extern "C" fn sp_brightness_grid_dealloc( +pub unsafe extern "C" fn sp_brightness_grid_free( this: *mut SPBrightnessGrid, ) { _ = Box::from_raw(this); @@ -129,7 +129,7 @@ pub unsafe extern "C" fn sp_brightness_grid_dealloc( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BrightnessGrid` +/// - `this` points to a valid `SPBrightnessGrid` /// - `this` is not written to concurrently #[no_mangle] pub unsafe extern "C" fn sp_brightness_grid_get( @@ -140,7 +140,7 @@ pub unsafe extern "C" fn sp_brightness_grid_get( (*this).actual.get(x, y).into() } -/// Sets the value of the specified position in the `BrightnessGrid`. +/// Sets the value of the specified position in the `SPBrightnessGrid`. /// /// # Arguments /// @@ -159,7 +159,7 @@ pub unsafe extern "C" fn sp_brightness_grid_get( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BitVec` +/// - `this` points to a valid `SPBitVec` /// - `this` is not written to or read from concurrently #[no_mangle] pub unsafe extern "C" fn sp_brightness_grid_set( @@ -173,7 +173,7 @@ pub unsafe extern "C" fn sp_brightness_grid_set( (*this).actual.set(x, y, brightness); } -/// Sets the value of all cells in the `BrightnessGrid`. +/// Sets the value of all cells in the `SPBrightnessGrid`. /// /// # Arguments /// @@ -188,7 +188,7 @@ pub unsafe extern "C" fn sp_brightness_grid_set( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BrightnessGrid` +/// - `this` points to a valid `SPBrightnessGrid` /// - `this` is not written to or read from concurrently #[no_mangle] pub unsafe extern "C" fn sp_brightness_grid_fill( @@ -200,7 +200,7 @@ pub unsafe extern "C" fn sp_brightness_grid_fill( (*this).actual.fill(brightness); } -/// Gets the width of the `BrightnessGrid` instance. +/// Gets the width of the `SPBrightnessGrid` instance. /// /// # Arguments /// @@ -210,7 +210,7 @@ pub unsafe extern "C" fn sp_brightness_grid_fill( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BrightnessGrid` +/// - `this` points to a valid `SPBrightnessGrid` #[no_mangle] pub unsafe extern "C" fn sp_brightness_grid_width( this: *const SPBrightnessGrid, @@ -218,7 +218,7 @@ pub unsafe extern "C" fn sp_brightness_grid_width( (*this).actual.width() } -/// Gets the height of the `BrightnessGrid` instance. +/// Gets the height of the `SPBrightnessGrid` instance. /// /// # Arguments /// @@ -228,7 +228,7 @@ pub unsafe extern "C" fn sp_brightness_grid_width( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BrightnessGrid` +/// - `this` points to a valid `SPBrightnessGrid` #[no_mangle] pub unsafe extern "C" fn sp_brightness_grid_height( this: *const SPBrightnessGrid, @@ -236,15 +236,15 @@ pub unsafe extern "C" fn sp_brightness_grid_height( (*this).actual.height() } -/// Gets an unsafe reference to the data of the `BrightnessGrid` instance. +/// Gets an unsafe reference to the data of the `SPBrightnessGrid` instance. /// /// ## Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BrightnessGrid` -/// - the returned memory range is never accessed after the passed `BrightnessGrid` has been freed -/// - the returned memory range is never accessed concurrently, either via the `BrightnessGrid` or directly +/// - `this` points to a valid `SPBrightnessGrid` +/// - the returned memory range is never accessed after the passed `SPBrightnessGrid` has been freed +/// - the returned memory range is never accessed concurrently, either via the `SPBrightnessGrid` or directly #[no_mangle] pub unsafe extern "C" fn sp_brightness_grid_unsafe_data_ref( this: *mut SPBrightnessGrid, diff --git a/crates/servicepoint_binding_c/src/command.rs b/crates/servicepoint_binding_c/src/command.rs index 3ece0f1..7e92bf0 100644 --- a/crates/servicepoint_binding_c/src/command.rs +++ b/crates/servicepoint_binding_c/src/command.rs @@ -1,4 +1,4 @@ -//! C functions for interacting with `Command`s +//! C functions for interacting with `SPCommand`s //! //! prefix `sp_command_` @@ -39,11 +39,11 @@ impl Clone for SPCommand { /// /// The caller has to make sure that: /// -/// - `packet` points to a valid instance of `SPPacket` -/// - `packet` is not used concurrently or after this call +/// - `SPPacket` points to a valid instance of `SPPacket` +/// - `SPPacket` is not used concurrently or after this call /// - the result is checked for NULL /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_try_from_packet( packet: *mut SPPacket, @@ -61,10 +61,10 @@ pub unsafe extern "C" fn sp_command_try_from_packet( /// /// The caller has to make sure that: /// -/// - `this` points to a valid instance of `Command` +/// - `this` points to a valid instance of `SPCommand` /// - `this` is not written to concurrently -/// - the returned `Command` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_clone( original: *const SPCommand, @@ -86,8 +86,8 @@ pub unsafe extern "C" fn sp_command_clone( /// /// The caller has to make sure that: /// -/// - the returned `Command` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_clear() -> *mut SPCommand { Box::into_raw(Box::new(SPCommand(servicepoint::Command::Clear))) @@ -102,8 +102,8 @@ pub unsafe extern "C" fn sp_command_clear() -> *mut SPCommand { /// /// The caller has to make sure that: /// -/// - the returned `Command` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_hard_reset() -> *mut SPCommand { Box::into_raw(Box::new(SPCommand(servicepoint::Command::HardReset))) @@ -115,8 +115,8 @@ pub unsafe extern "C" fn sp_command_hard_reset() -> *mut SPCommand { /// /// The caller has to make sure that: /// -/// - the returned `Command` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_fade_out() -> *mut SPCommand { Box::into_raw(Box::new(SPCommand(servicepoint::Command::FadeOut))) @@ -134,7 +134,7 @@ pub unsafe extern "C" fn sp_command_fade_out() -> *mut SPCommand { /// The caller has to make sure that: /// /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_brightness( brightness: u8, @@ -157,8 +157,8 @@ pub unsafe extern "C" fn sp_command_brightness( /// /// - `grid` points to a valid instance of `SPBrightnessGrid` /// - `grid` is not used concurrently or after this call -/// - the returned `Command` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_char_brightness( x: usize, @@ -173,24 +173,24 @@ pub unsafe extern "C" fn sp_command_char_brightness( } /// Allocates a new `Command::BitmapLinear` instance. -/// The passed `BitVec` gets consumed. +/// The passed `SPBitVec` gets consumed. /// /// Set pixel data starting at the pixel offset on screen. /// /// The screen will continuously overwrite more pixel data without regarding the offset, meaning /// once the starting row is full, overwriting will continue on column 0. /// -/// The contained `BitVec` is always uncompressed. +/// The contained `SPBitVec` is always uncompressed. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `bit_vec` points to a valid instance of `BitVec` +/// - `bit_vec` points to a valid instance of `SPBitVec` /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values -/// - the returned `Command` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_bitmap_linear( offset: usize, @@ -206,24 +206,24 @@ pub unsafe extern "C" fn sp_command_bitmap_linear( } /// Allocates a new `Command::BitmapLinearAnd` instance. -/// The passed `BitVec` gets consumed. +/// The passed `SPBitVec` gets consumed. /// /// Set pixel data according to an and-mask starting at the offset. /// /// The screen will continuously overwrite more pixel data without regarding the offset, meaning /// once the starting row is full, overwriting will continue on column 0. /// -/// The contained `BitVec` is always uncompressed. +/// The contained `SPBitVec` is always uncompressed. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `bit_vec` points to a valid instance of `BitVec` +/// - `bit_vec` points to a valid instance of `SPBitVec` /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values -/// - the returned `Command` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_bitmap_linear_and( offset: usize, @@ -239,24 +239,24 @@ pub unsafe extern "C" fn sp_command_bitmap_linear_and( } /// Allocates a new `Command::BitmapLinearOr` instance. -/// The passed `BitVec` gets consumed. +/// The passed `SPBitVec` gets consumed. /// /// Set pixel data according to an or-mask starting at the offset. /// /// The screen will continuously overwrite more pixel data without regarding the offset, meaning /// once the starting row is full, overwriting will continue on column 0. /// -/// The contained `BitVec` is always uncompressed. +/// The contained `SPBitVec` is always uncompressed. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `bit_vec` points to a valid instance of `BitVec` +/// - `bit_vec` points to a valid instance of `SPBitVec` /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values -/// - the returned `Command` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_bitmap_linear_or( offset: usize, @@ -272,24 +272,24 @@ pub unsafe extern "C" fn sp_command_bitmap_linear_or( } /// Allocates a new `Command::BitmapLinearXor` instance. -/// The passed `BitVec` gets consumed. +/// The passed `SPBitVec` gets consumed. /// /// Set pixel data according to a xor-mask starting at the offset. /// /// The screen will continuously overwrite more pixel data without regarding the offset, meaning /// once the starting row is full, overwriting will continue on column 0. /// -/// The contained `BitVec` is always uncompressed. +/// The contained `SPBitVec` is always uncompressed. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `bit_vec` points to a valid instance of `BitVec` +/// - `bit_vec` points to a valid instance of `SPBitVec` /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values -/// - the returned `Command` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_bitmap_linear_xor( offset: usize, @@ -305,7 +305,7 @@ pub unsafe extern "C" fn sp_command_bitmap_linear_xor( } /// Allocates a new `Command::Cp437Data` instance. -/// The passed `ByteGrid` gets consumed. +/// The passed `SPCp437Grid` gets consumed. /// /// Show text on the screen. /// @@ -318,25 +318,25 @@ pub unsafe extern "C" fn sp_command_bitmap_linear_xor( /// /// The caller has to make sure that: /// -/// - `byte_grid` points to a valid instance of `ByteGrid` -/// - `byte_grid` is not used concurrently or after this call -/// - the returned `Command` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// - `grid` points to a valid instance of `SPCp437Grid` +/// - `grid` is not used concurrently or after this call +/// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_cp437_data( x: usize, y: usize, - byte_grid: *mut SPCp437Grid, + grid: *mut SPCp437Grid, ) -> *mut SPCommand { - let byte_grid = *Box::from_raw(byte_grid); + let grid = *Box::from_raw(grid); Box::into_raw(Box::new(SPCommand(servicepoint::Command::Cp437Data( Origin::new(x, y), - byte_grid.actual, + grid.actual, )))) } /// Allocates a new `Command::BitmapLinearWin` instance. -/// The passed `PixelGrid` gets consumed. +/// The passed `SPPixelGrid` gets consumed. /// /// Sets a window of pixels to the specified values /// @@ -344,11 +344,11 @@ pub unsafe extern "C" fn sp_command_cp437_data( /// /// The caller has to make sure that: /// -/// - `pixel_grid` points to a valid instance of `PixelGrid` +/// - `pixel_grid` points to a valid instance of `SPPixelGrid` /// - `pixel_grid` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values -/// - the returned `Command` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_command_dealloc`. +/// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_command_free`. #[no_mangle] pub unsafe extern "C" fn sp_command_bitmap_linear_win( x: usize, @@ -366,23 +366,23 @@ pub unsafe extern "C" fn sp_command_bitmap_linear_win( )))) } -/// Deallocates a `Command`. +/// Deallocates a `SPCommand`. /// /// # Examples /// /// ```C /// SPCommand c = sp_command_clear(); -/// sp_command_dealloc(c); +/// sp_command_free(c); /// ``` /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `Command` +/// - `this` points to a valid `SPCommand` /// - `this` is not used concurrently or after this call -/// - `this` was not passed to another consuming function, e.g. to create a `Packet` +/// - `this` was not passed to another consuming function, e.g. to create a `SPPacket` #[no_mangle] -pub unsafe extern "C" fn sp_command_dealloc(ptr: *mut SPCommand) { +pub unsafe extern "C" fn sp_command_free(ptr: *mut SPCommand) { _ = Box::from_raw(ptr); } diff --git a/crates/servicepoint_binding_c/src/connection.rs b/crates/servicepoint_binding_c/src/connection.rs index ae82831..a6bd5a0 100644 --- a/crates/servicepoint_binding_c/src/connection.rs +++ b/crates/servicepoint_binding_c/src/connection.rs @@ -1,4 +1,4 @@ -//! C functions for interacting with `Connection`s +//! C functions for interacting with `SPConnection`s //! //! prefix `sp_connection_` @@ -18,7 +18,7 @@ use crate::SPPacket; /// ``` pub struct SPConnection(pub(crate) servicepoint::Connection); -/// Creates a new instance of `Connection`. +/// Creates a new instance of `SPConnection`. /// /// returns: NULL if connection fails, or connected instance /// @@ -31,7 +31,7 @@ pub struct SPConnection(pub(crate) servicepoint::Connection); /// The caller has to make sure that: /// /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_connection_dealloc`. +/// by explicitly calling `sp_connection_free`. #[no_mangle] pub unsafe extern "C" fn sp_connection_open( host: *const c_char, @@ -45,8 +45,8 @@ pub unsafe extern "C" fn sp_connection_open( Box::into_raw(Box::new(SPConnection(connection))) } -/// Sends a `Packet` to the display using the `Connection`. -/// The passed `Packet` gets consumed. +/// Sends a `SPPacket` to the display using the `SPConnection`. +/// The passed `SPPacket` gets consumed. /// /// returns: true in case of success /// @@ -54,9 +54,9 @@ pub unsafe extern "C" fn sp_connection_open( /// /// The caller has to make sure that: /// -/// - `connection` points to a valid instance of `Connection` -/// - `packet` points to a valid instance of `Packet` -/// - `packet` is not used concurrently or after this call +/// - `SPConnection` points to a valid instance of `SPConnection` +/// - `SPPacket` points to a valid instance of `SPPacket` +/// - `SPPacket` is not used concurrently or after this call #[no_mangle] pub unsafe extern "C" fn sp_connection_send( connection: *const SPConnection, @@ -66,15 +66,15 @@ pub unsafe extern "C" fn sp_connection_send( (*connection).0.send((*packet).0).is_ok() } -/// Closes and deallocates a `Connection`. +/// Closes and deallocates a `SPConnection`. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `Connection` +/// - `this` points to a valid `SPConnection` /// - `this` is not used concurrently or after this call #[no_mangle] -pub unsafe extern "C" fn sp_connection_dealloc(ptr: *mut SPConnection) { +pub unsafe extern "C" fn sp_connection_free(ptr: *mut SPConnection) { _ = Box::from_raw(ptr); } diff --git a/crates/servicepoint_binding_c/src/cp437_grid.rs b/crates/servicepoint_binding_c/src/cp437_grid.rs index 963456d..7d24f0b 100644 --- a/crates/servicepoint_binding_c/src/cp437_grid.rs +++ b/crates/servicepoint_binding_c/src/cp437_grid.rs @@ -1,4 +1,4 @@ -//! C functions for interacting with `Cp437Grid`s +//! C functions for interacting with `SPCp437Grid`s //! //! prefix `sp_cp437_grid_` @@ -15,7 +15,7 @@ use servicepoint::{DataRef, Grid}; /// Cp437Grid grid = sp_cp437_grid_new(4, 3); /// sp_cp437_grid_fill(grid, '?'); /// sp_cp437_grid_set(grid, 0, 0, '!'); -/// sp_cp437_grid_dealloc(grid); +/// sp_cp437_grid_free(grid); /// ``` pub struct SPCp437Grid { pub(crate) actual: servicepoint::Cp437Grid, @@ -29,16 +29,16 @@ impl Clone for SPCp437Grid { } } -/// Creates a new `Cp437Grid` with the specified dimensions. +/// Creates a new `SPCp437Grid` with the specified dimensions. /// -/// returns: `Cp437Grid` initialized to 0. +/// returns: `SPCp437Grid` initialized to 0. /// /// # Safety /// /// The caller has to make sure that: /// /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_cp437_grid_dealloc`. +/// by explicitly calling `sp_cp437_grid_free`. #[no_mangle] pub unsafe extern "C" fn sp_cp437_grid_new( width: usize, @@ -49,7 +49,7 @@ pub unsafe extern "C" fn sp_cp437_grid_new( })) } -/// Loads a `Cp437Grid` with the specified dimensions from the provided data. +/// Loads a `SPCp437Grid` with the specified dimensions from the provided data. /// /// # Panics /// @@ -62,7 +62,7 @@ pub unsafe extern "C" fn sp_cp437_grid_new( /// - `data` points to a valid memory location of at least `data_length` /// bytes in size. /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_cp437_grid_dealloc`. +/// by explicitly calling `sp_cp437_grid_free`. #[no_mangle] pub unsafe extern "C" fn sp_cp437_grid_load( width: usize, @@ -76,16 +76,16 @@ pub unsafe extern "C" fn sp_cp437_grid_load( })) } -/// Clones a `Cp437Grid`. +/// Clones a `SPCp437Grid`. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `Cp437Grid` +/// - `this` points to a valid `SPCp437Grid` /// - `this` is not written to concurrently /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_cp437_grid_dealloc`. +/// by explicitly calling `sp_cp437_grid_free`. #[no_mangle] pub unsafe extern "C" fn sp_cp437_grid_clone( this: *const SPCp437Grid, @@ -93,17 +93,17 @@ pub unsafe extern "C" fn sp_cp437_grid_clone( Box::into_raw(Box::new((*this).clone())) } -/// Deallocates a `Cp437Grid`. +/// Deallocates a `SPCp437Grid`. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `Cp437Grid` +/// - `this` points to a valid `SPCp437Grid` /// - `this` is not used concurrently or after this call -/// - `this` was not passed to another consuming function, e.g. to create a `Command` +/// - `this` was not passed to another consuming function, e.g. to create a `SPCommand` #[no_mangle] -pub unsafe extern "C" fn sp_cp437_grid_dealloc(this: *mut SPCp437Grid) { +pub unsafe extern "C" fn sp_cp437_grid_free(this: *mut SPCp437Grid) { _ = Box::from_raw(this); } @@ -122,7 +122,7 @@ pub unsafe extern "C" fn sp_cp437_grid_dealloc(this: *mut SPCp437Grid) { /// /// The caller has to make sure that: /// -/// - `this` points to a valid `Cp437Grid` +/// - `this` points to a valid `SPCp437Grid` /// - `this` is not written to concurrently #[no_mangle] pub unsafe extern "C" fn sp_cp437_grid_get( @@ -133,7 +133,7 @@ pub unsafe extern "C" fn sp_cp437_grid_get( (*this).actual.get(x, y) } -/// Sets the value of the specified position in the `Cp437Grid`. +/// Sets the value of the specified position in the `SPCp437Grid`. /// /// # Arguments /// @@ -151,7 +151,7 @@ pub unsafe extern "C" fn sp_cp437_grid_get( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `BitVec` +/// - `this` points to a valid `SPBitVec` /// - `this` is not written to or read from concurrently #[no_mangle] pub unsafe extern "C" fn sp_cp437_grid_set( @@ -163,7 +163,7 @@ pub unsafe extern "C" fn sp_cp437_grid_set( (*this).actual.set(x, y, value); } -/// Sets the value of all cells in the `Cp437Grid`. +/// Sets the value of all cells in the `SPCp437Grid`. /// /// # Arguments /// @@ -174,14 +174,14 @@ pub unsafe extern "C" fn sp_cp437_grid_set( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `Cp437Grid` +/// - `this` points to a valid `SPCp437Grid` /// - `this` is not written to or read from concurrently #[no_mangle] pub unsafe extern "C" fn sp_cp437_grid_fill(this: *mut SPCp437Grid, value: u8) { (*this).actual.fill(value); } -/// Gets the width of the `Cp437Grid` instance. +/// Gets the width of the `SPCp437Grid` instance. /// /// # Arguments /// @@ -191,7 +191,7 @@ pub unsafe extern "C" fn sp_cp437_grid_fill(this: *mut SPCp437Grid, value: u8) { /// /// The caller has to make sure that: /// -/// - `this` points to a valid `Cp437Grid` +/// - `this` points to a valid `SPCp437Grid` #[no_mangle] pub unsafe extern "C" fn sp_cp437_grid_width( this: *const SPCp437Grid, @@ -199,7 +199,7 @@ pub unsafe extern "C" fn sp_cp437_grid_width( (*this).actual.width() } -/// Gets the height of the `Cp437Grid` instance. +/// Gets the height of the `SPCp437Grid` instance. /// /// # Arguments /// @@ -209,7 +209,7 @@ pub unsafe extern "C" fn sp_cp437_grid_width( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `Cp437Grid` +/// - `this` points to a valid `SPCp437Grid` #[no_mangle] pub unsafe extern "C" fn sp_cp437_grid_height( this: *const SPCp437Grid, @@ -217,15 +217,15 @@ pub unsafe extern "C" fn sp_cp437_grid_height( (*this).actual.height() } -/// Gets an unsafe reference to the data of the `Cp437Grid` instance. +/// Gets an unsafe reference to the data of the `SPCp437Grid` instance. /// /// ## Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `Cp437Grid` -/// - the returned memory range is never accessed after the passed `Cp437Grid` has been freed -/// - the returned memory range is never accessed concurrently, either via the `Cp437Grid` or directly +/// - `this` points to a valid `SPCp437Grid` +/// - the returned memory range is never accessed after the passed `SPCp437Grid` has been freed +/// - the returned memory range is never accessed concurrently, either via the `SPCp437Grid` or directly #[no_mangle] pub unsafe extern "C" fn sp_cp437_grid_unsafe_data_ref( this: *mut SPCp437Grid, diff --git a/crates/servicepoint_binding_c/src/lib.rs b/crates/servicepoint_binding_c/src/lib.rs index 159b64d..6d38abc 100644 --- a/crates/servicepoint_binding_c/src/lib.rs +++ b/crates/servicepoint_binding_c/src/lib.rs @@ -20,8 +20,8 @@ //! SPPacket *packet = sp_packet_from_command(command); //! while (sp_connection_send(connection, sp_packet_clone(packet))); //! -//! sp_packet_dealloc(packet); -//! sp_connection_dealloc(connection); +//! sp_packet_free(packet); +//! sp_connection_free(connection); //! return 0; //! } //! ``` diff --git a/crates/servicepoint_binding_c/src/packet.rs b/crates/servicepoint_binding_c/src/packet.rs index c575de7..0a2bdef 100644 --- a/crates/servicepoint_binding_c/src/packet.rs +++ b/crates/servicepoint_binding_c/src/packet.rs @@ -1,4 +1,4 @@ -//! C functions for interacting with `Packet`s +//! C functions for interacting with `SPPacket`s //! //! prefix `sp_packet_` @@ -9,17 +9,17 @@ use crate::SPCommand; /// The raw packet pub struct SPPacket(pub(crate) servicepoint::Packet); -/// Turns a `Command` into a `Packet`. -/// The `Command` gets consumed. +/// Turns a `SPCommand` into a `SPPacket`. +/// The `SPCommand` gets consumed. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `command` points to a valid instance of `Command` -/// - `command` is not used concurrently or after this call -/// - the returned `Packet` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_packet_dealloc`. +/// - `SPCommand` points to a valid instance of `SPCommand` +/// - `SPCommand` is not used concurrently or after this call +/// - the returned `SPPacket` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_packet_free`. #[no_mangle] pub unsafe extern "C" fn sp_packet_from_command( command: *mut SPCommand, @@ -29,7 +29,7 @@ pub unsafe extern "C" fn sp_packet_from_command( Box::into_raw(Box::new(packet)) } -/// Tries to load a `Packet` from the passed array with the specified length. +/// Tries to load a `SPPacket` from the passed array with the specified length. /// /// returns: NULL in case of an error, pointer to the allocated packet otherwise /// @@ -39,8 +39,8 @@ pub unsafe extern "C" fn sp_packet_from_command( /// /// - `data` points to a valid memory region of at least `length` bytes /// - `data` is not written to concurrently -/// - the returned `Packet` instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_packet_dealloc`. +/// - the returned `SPPacket` instance is freed in some way, either by using a consuming function or +/// by explicitly calling `sp_packet_free`. #[no_mangle] pub unsafe extern "C" fn sp_packet_try_load( data: *const u8, @@ -53,16 +53,16 @@ pub unsafe extern "C" fn sp_packet_try_load( } } -/// Clones a `Packet`. +/// Clones a `SPPacket`. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `Packet` +/// - `this` points to a valid `SPPacket` /// - `this` is not written to concurrently /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_packet_dealloc`. +/// by explicitly calling `sp_packet_free`. #[no_mangle] pub unsafe extern "C" fn sp_packet_clone( this: *const SPPacket, @@ -70,15 +70,15 @@ pub unsafe extern "C" fn sp_packet_clone( Box::into_raw(Box::new(SPPacket((*this).0.clone()))) } -/// Deallocates a `Packet`. +/// Deallocates a `SPPacket`. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `Packet` +/// - `this` points to a valid `SPPacket` /// - `this` is not used concurrently or after this call #[no_mangle] -pub unsafe extern "C" fn sp_packet_dealloc(this: *mut SPPacket) { +pub unsafe extern "C" fn sp_packet_free(this: *mut SPPacket) { _ = Box::from_raw(this) } diff --git a/crates/servicepoint_binding_c/src/pixel_grid.rs b/crates/servicepoint_binding_c/src/pixel_grid.rs index d8b4a32..2f6e00a 100644 --- a/crates/servicepoint_binding_c/src/pixel_grid.rs +++ b/crates/servicepoint_binding_c/src/pixel_grid.rs @@ -1,4 +1,4 @@ -//! C functions for interacting with `PixelGrid`s +//! C functions for interacting with `SPPixelGrid`s //! //! prefix `sp_pixel_grid_` @@ -14,18 +14,18 @@ use crate::byte_slice::SPByteSlice; /// Cp437Grid grid = sp_pixel_grid_new(8, 3); /// sp_pixel_grid_fill(grid, true); /// sp_pixel_grid_set(grid, 0, 0, false); -/// sp_pixel_grid_dealloc(grid); +/// sp_pixel_grid_free(grid); /// ``` pub struct SPPixelGrid(pub(crate) servicepoint::PixelGrid); -/// Creates a new `PixelGrid` with the specified dimensions. +/// Creates a new `SPPixelGrid` with the specified dimensions. /// /// # Arguments /// /// - `width`: size in pixels in x-direction /// - `height`: size in pixels in y-direction /// -/// returns: `PixelGrid` initialized to all pixels off +/// returns: `SPPixelGrid` initialized to all pixels off /// /// # Panics /// @@ -36,7 +36,7 @@ pub struct SPPixelGrid(pub(crate) servicepoint::PixelGrid); /// The caller has to make sure that: /// /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_pixel_grid_dealloc`. +/// by explicitly calling `sp_pixel_grid_free`. #[no_mangle] pub unsafe extern "C" fn sp_pixel_grid_new( width: usize, @@ -47,14 +47,14 @@ pub unsafe extern "C" fn sp_pixel_grid_new( )))) } -/// Loads a `PixelGrid` with the specified dimensions from the provided data. +/// Loads a `SPPixelGrid` with the specified dimensions from the provided data. /// /// # Arguments /// /// - `width`: size in pixels in x-direction /// - `height`: size in pixels in y-direction /// -/// returns: `PixelGrid` that contains a copy of the provided data +/// returns: `SPPixelGrid` that contains a copy of the provided data /// /// # Panics /// @@ -67,7 +67,7 @@ pub unsafe extern "C" fn sp_pixel_grid_new( /// /// - `data` points to a valid memory location of at least `data_length` bytes in size. /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_pixel_grid_dealloc`. +/// by explicitly calling `sp_pixel_grid_free`. #[no_mangle] pub unsafe extern "C" fn sp_pixel_grid_load( width: usize, @@ -81,16 +81,16 @@ pub unsafe extern "C" fn sp_pixel_grid_load( )))) } -/// Clones a `PixelGrid`. +/// Clones a `SPPixelGrid`. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `PixelGrid` +/// - `this` points to a valid `SPPixelGrid` /// - `this` is not written to concurrently /// - the returned instance is freed in some way, either by using a consuming function or -/// by explicitly calling `sp_pixel_grid_dealloc`. +/// by explicitly calling `sp_pixel_grid_free`. #[no_mangle] pub unsafe extern "C" fn sp_pixel_grid_clone( this: *const SPPixelGrid, @@ -98,21 +98,21 @@ pub unsafe extern "C" fn sp_pixel_grid_clone( Box::into_raw(Box::new(SPPixelGrid((*this).0.clone()))) } -/// Deallocates a `PixelGrid`. +/// Deallocates a `SPPixelGrid`. /// /// # Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `PixelGrid` +/// - `this` points to a valid `SPPixelGrid` /// - `this` is not used concurrently or after this call -/// - `this` was not passed to another consuming function, e.g. to create a `Command` +/// - `this` was not passed to another consuming function, e.g. to create a `SPCommand` #[no_mangle] -pub unsafe extern "C" fn sp_pixel_grid_dealloc(this: *mut SPPixelGrid) { +pub unsafe extern "C" fn sp_pixel_grid_free(this: *mut SPPixelGrid) { _ = Box::from_raw(this); } -/// Gets the current value at the specified position in the `PixelGrid`. +/// Gets the current value at the specified position in the `SPPixelGrid`. /// /// # Arguments /// @@ -127,7 +127,7 @@ pub unsafe extern "C" fn sp_pixel_grid_dealloc(this: *mut SPPixelGrid) { /// /// The caller has to make sure that: /// -/// - `this` points to a valid `PixelGrid` +/// - `this` points to a valid `SPPixelGrid` /// - `this` is not written to concurrently #[no_mangle] pub unsafe extern "C" fn sp_pixel_grid_get( @@ -138,7 +138,7 @@ pub unsafe extern "C" fn sp_pixel_grid_get( (*this).0.get(x, y) } -/// Sets the value of the specified position in the `PixelGrid`. +/// Sets the value of the specified position in the `SPPixelGrid`. /// /// # Arguments /// @@ -156,7 +156,7 @@ pub unsafe extern "C" fn sp_pixel_grid_get( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `PixelGrid` +/// - `this` points to a valid `SPPixelGrid` /// - `this` is not written to or read from concurrently #[no_mangle] pub unsafe extern "C" fn sp_pixel_grid_set( @@ -168,7 +168,7 @@ pub unsafe extern "C" fn sp_pixel_grid_set( (*this).0.set(x, y, value); } -/// Sets the state of all pixels in the `PixelGrid`. +/// Sets the state of all pixels in the `SPPixelGrid`. /// /// # Arguments /// @@ -179,7 +179,7 @@ pub unsafe extern "C" fn sp_pixel_grid_set( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `PixelGrid` +/// - `this` points to a valid `SPPixelGrid` /// - `this` is not written to or read from concurrently #[no_mangle] pub unsafe extern "C" fn sp_pixel_grid_fill( @@ -189,7 +189,7 @@ pub unsafe extern "C" fn sp_pixel_grid_fill( (*this).0.fill(value); } -/// Gets the width in pixels of the `PixelGrid` instance. +/// Gets the width in pixels of the `SPPixelGrid` instance. /// /// # Arguments /// @@ -199,7 +199,7 @@ pub unsafe extern "C" fn sp_pixel_grid_fill( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `PixelGrid` +/// - `this` points to a valid `SPPixelGrid` #[no_mangle] pub unsafe extern "C" fn sp_pixel_grid_width( this: *const SPPixelGrid, @@ -207,7 +207,7 @@ pub unsafe extern "C" fn sp_pixel_grid_width( (*this).0.width() } -/// Gets the height in pixels of the `PixelGrid` instance. +/// Gets the height in pixels of the `SPPixelGrid` instance. /// /// # Arguments /// @@ -217,7 +217,7 @@ pub unsafe extern "C" fn sp_pixel_grid_width( /// /// The caller has to make sure that: /// -/// - `this` points to a valid `PixelGrid` +/// - `this` points to a valid `SPPixelGrid` #[no_mangle] pub unsafe extern "C" fn sp_pixel_grid_height( this: *const SPPixelGrid, @@ -225,15 +225,15 @@ pub unsafe extern "C" fn sp_pixel_grid_height( (*this).0.height() } -/// Gets an unsafe reference to the data of the `PixelGrid` instance. +/// Gets an unsafe reference to the data of the `SPPixelGrid` instance. /// /// ## Safety /// /// The caller has to make sure that: /// -/// - `this` points to a valid `PixelGrid` -/// - the returned memory range is never accessed after the passed `PixelGrid` has been freed -/// - the returned memory range is never accessed concurrently, either via the `PixelGrid` or directly +/// - `this` points to a valid `SPPixelGrid` +/// - the returned memory range is never accessed after the passed `SPPixelGrid` has been freed +/// - the returned memory range is never accessed concurrently, either via the `SPPixelGrid` or directly #[no_mangle] pub unsafe extern "C" fn sp_pixel_grid_unsafe_data_ref( this: *mut SPPixelGrid, diff --git a/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs b/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs index fd7e1d3..8183a4d 100644 --- a/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs +++ b/crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs @@ -20,13 +20,13 @@ namespace ServicePoint.BindGen /// - /// Creates a new `BitVec` instance. + /// Creates a new `SPBitVec` instance. /// /// # Arguments /// /// - `size`: size in bits. /// - /// returns: `BitVec` with all bits set to false. + /// returns: `SPBitVec` with all bits set to false. /// /// # Panics /// @@ -37,13 +37,13 @@ namespace ServicePoint.BindGen /// The caller has to make sure that: /// /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_bit_vec_dealloc`. + /// by explicitly calling `sp_bit_vec_free`. /// [DllImport(__DllName, EntryPoint = "sp_bit_vec_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern BitVec* sp_bit_vec_new(nuint size); /// - /// Interpret the data as a series of bits and load then into a new `BitVec` instance. + /// Interpret the data as a series of bits and load then into a new `SPBitVec` instance. /// /// # Safety /// @@ -52,42 +52,42 @@ namespace ServicePoint.BindGen /// - `data` points to a valid memory location of at least `data_length` /// bytes in size. /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_bit_vec_dealloc`. + /// by explicitly calling `sp_bit_vec_free`. /// [DllImport(__DllName, EntryPoint = "sp_bit_vec_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern BitVec* sp_bit_vec_load(byte* data, nuint data_length); /// - /// Clones a `BitVec`. + /// Clones a `SPBitVec`. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BitVec` + /// - `this` points to a valid `SPBitVec` /// - `this` is not written to concurrently /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_bit_vec_dealloc`. + /// by explicitly calling `sp_bit_vec_free`. /// [DllImport(__DllName, EntryPoint = "sp_bit_vec_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern BitVec* sp_bit_vec_clone(BitVec* @this); /// - /// Deallocates a `BitVec`. + /// Deallocates a `SPBitVec`. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BitVec` + /// - `this` points to a valid `SPBitVec` /// - `this` is not used concurrently or after this call - /// - `this` was not passed to another consuming function, e.g. to create a `Command` + /// - `this` was not passed to another consuming function, e.g. to create a `SPCommand` /// - [DllImport(__DllName, EntryPoint = "sp_bit_vec_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void sp_bit_vec_dealloc(BitVec* @this); + [DllImport(__DllName, EntryPoint = "sp_bit_vec_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sp_bit_vec_free(BitVec* @this); /// - /// Gets the value of a bit from the `BitVec`. + /// Gets the value of a bit from the `SPBitVec`. /// /// # Arguments /// @@ -104,7 +104,7 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BitVec` + /// - `this` points to a valid `SPBitVec` /// - `this` is not written to concurrently /// [DllImport(__DllName, EntryPoint = "sp_bit_vec_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -112,7 +112,7 @@ namespace ServicePoint.BindGen public static extern bool sp_bit_vec_get(BitVec* @this, nuint index); /// - /// Sets the value of a bit in the `BitVec`. + /// Sets the value of a bit in the `SPBitVec`. /// /// # Arguments /// @@ -130,14 +130,14 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BitVec` + /// - `this` points to a valid `SPBitVec` /// - `this` is not written to or read from concurrently /// [DllImport(__DllName, EntryPoint = "sp_bit_vec_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp_bit_vec_set(BitVec* @this, nuint index, [MarshalAs(UnmanagedType.U1)] bool value); /// - /// Sets the value of all bits in the `BitVec`. + /// Sets the value of all bits in the `SPBitVec`. /// /// # Arguments /// @@ -147,20 +147,20 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BitVec` + /// - `this` points to a valid `SPBitVec` /// - `this` is not written to or read from concurrently /// [DllImport(__DllName, EntryPoint = "sp_bit_vec_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp_bit_vec_fill(BitVec* @this, [MarshalAs(UnmanagedType.U1)] bool value); /// - /// Gets the length of the `BitVec` in bits. + /// Gets the length of the `SPBitVec` in bits. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BitVec` + /// - `this` points to a valid `SPBitVec` /// [DllImport(__DllName, EntryPoint = "sp_bit_vec_len", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp_bit_vec_len(BitVec* @this); @@ -172,43 +172,43 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BitVec` + /// - `this` points to a valid `SPBitVec` /// [DllImport(__DllName, EntryPoint = "sp_bit_vec_is_empty", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: MarshalAs(UnmanagedType.U1)] public static extern bool sp_bit_vec_is_empty(BitVec* @this); /// - /// Gets an unsafe reference to the data of the `BitVec` instance. + /// Gets an unsafe reference to the data of the `SPBitVec` instance. /// /// ## Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BitVec` - /// - the returned memory range is never accessed after the passed `BitVec` has been freed - /// - the returned memory range is never accessed concurrently, either via the `BitVec` or directly + /// - `this` points to a valid `SPBitVec` + /// - the returned memory range is never accessed after the passed `SPBitVec` has been freed + /// - the returned memory range is never accessed concurrently, either via the `SPBitVec` or directly /// [DllImport(__DllName, EntryPoint = "sp_bit_vec_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern ByteSlice sp_bit_vec_unsafe_data_ref(BitVec* @this); /// - /// Creates a new `BrightnessGrid` with the specified dimensions. + /// Creates a new `SPBrightnessGrid` with the specified dimensions. /// - /// returns: `BrightnessGrid` initialized to 0. + /// returns: `SPBrightnessGrid` initialized to 0. /// /// # Safety /// /// The caller has to make sure that: /// /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_brightness_grid_dealloc`. + /// by explicitly calling `sp_brightness_grid_free`. /// [DllImport(__DllName, EntryPoint = "sp_brightness_grid_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern BrightnessGrid* sp_brightness_grid_new(nuint width, nuint height); /// - /// Loads a `BrightnessGrid` with the specified dimensions from the provided data. + /// Loads a `SPBrightnessGrid` with the specified dimensions from the provided data. /// /// # Panics /// @@ -221,39 +221,39 @@ namespace ServicePoint.BindGen /// - `data` points to a valid memory location of at least `data_length` /// bytes in size. /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_brightness_grid_dealloc`. + /// by explicitly calling `sp_brightness_grid_free`. /// [DllImport(__DllName, EntryPoint = "sp_brightness_grid_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern BrightnessGrid* sp_brightness_grid_load(nuint width, nuint height, byte* data, nuint data_length); /// - /// Clones a `BrightnessGrid`. + /// Clones a `SPBrightnessGrid`. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BrightnessGrid` + /// - `this` points to a valid `SPBrightnessGrid` /// - `this` is not written to concurrently /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_brightness_grid_dealloc`. + /// by explicitly calling `sp_brightness_grid_free`. /// [DllImport(__DllName, EntryPoint = "sp_brightness_grid_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern BrightnessGrid* sp_brightness_grid_clone(BrightnessGrid* @this); /// - /// Deallocates a `BrightnessGrid`. + /// Deallocates a `SPBrightnessGrid`. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BrightnessGrid` + /// - `this` points to a valid `SPBrightnessGrid` /// - `this` is not used concurrently or after this call - /// - `this` was not passed to another consuming function, e.g. to create a `Command` + /// - `this` was not passed to another consuming function, e.g. to create a `SPCommand` /// - [DllImport(__DllName, EntryPoint = "sp_brightness_grid_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void sp_brightness_grid_dealloc(BrightnessGrid* @this); + [DllImport(__DllName, EntryPoint = "sp_brightness_grid_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sp_brightness_grid_free(BrightnessGrid* @this); /// /// Gets the current value at the specified position. @@ -271,14 +271,14 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BrightnessGrid` + /// - `this` points to a valid `SPBrightnessGrid` /// - `this` is not written to concurrently /// [DllImport(__DllName, EntryPoint = "sp_brightness_grid_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern byte sp_brightness_grid_get(BrightnessGrid* @this, nuint x, nuint y); /// - /// Sets the value of the specified position in the `BrightnessGrid`. + /// Sets the value of the specified position in the `SPBrightnessGrid`. /// /// # Arguments /// @@ -297,14 +297,14 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BitVec` + /// - `this` points to a valid `SPBitVec` /// - `this` is not written to or read from concurrently /// [DllImport(__DllName, EntryPoint = "sp_brightness_grid_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp_brightness_grid_set(BrightnessGrid* @this, nuint x, nuint y, byte value); /// - /// Sets the value of all cells in the `BrightnessGrid`. + /// Sets the value of all cells in the `SPBrightnessGrid`. /// /// # Arguments /// @@ -319,14 +319,14 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BrightnessGrid` + /// - `this` points to a valid `SPBrightnessGrid` /// - `this` is not written to or read from concurrently /// [DllImport(__DllName, EntryPoint = "sp_brightness_grid_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp_brightness_grid_fill(BrightnessGrid* @this, byte value); /// - /// Gets the width of the `BrightnessGrid` instance. + /// Gets the width of the `SPBrightnessGrid` instance. /// /// # Arguments /// @@ -336,13 +336,13 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BrightnessGrid` + /// - `this` points to a valid `SPBrightnessGrid` /// [DllImport(__DllName, EntryPoint = "sp_brightness_grid_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp_brightness_grid_width(BrightnessGrid* @this); /// - /// Gets the height of the `BrightnessGrid` instance. + /// Gets the height of the `SPBrightnessGrid` instance. /// /// # Arguments /// @@ -352,21 +352,21 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BrightnessGrid` + /// - `this` points to a valid `SPBrightnessGrid` /// [DllImport(__DllName, EntryPoint = "sp_brightness_grid_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp_brightness_grid_height(BrightnessGrid* @this); /// - /// Gets an unsafe reference to the data of the `BrightnessGrid` instance. + /// Gets an unsafe reference to the data of the `SPBrightnessGrid` instance. /// /// ## Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BrightnessGrid` - /// - the returned memory range is never accessed after the passed `BrightnessGrid` has been freed - /// - the returned memory range is never accessed concurrently, either via the `BrightnessGrid` or directly + /// - `this` points to a valid `SPBrightnessGrid` + /// - the returned memory range is never accessed after the passed `SPBrightnessGrid` has been freed + /// - the returned memory range is never accessed concurrently, either via the `SPBrightnessGrid` or directly /// [DllImport(__DllName, EntryPoint = "sp_brightness_grid_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern ByteSlice sp_brightness_grid_unsafe_data_ref(BrightnessGrid* @this); @@ -380,11 +380,11 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `packet` points to a valid instance of `SPPacket` - /// - `packet` is not used concurrently or after this call + /// - `SPPacket` points to a valid instance of `SPPacket` + /// - `SPPacket` is not used concurrently or after this call /// - the result is checked for NULL /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_try_from_packet", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_try_from_packet(Packet* packet); @@ -396,10 +396,10 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid instance of `Command` + /// - `this` points to a valid instance of `SPCommand` /// - `this` is not written to concurrently - /// - the returned `Command` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_clone(Command* original); @@ -419,8 +419,8 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - the returned `Command` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_clear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_clear(); @@ -435,8 +435,8 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - the returned `Command` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_hard_reset", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_hard_reset(); @@ -448,8 +448,8 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - the returned `Command` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_fade_out", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_fade_out(); @@ -467,7 +467,7 @@ namespace ServicePoint.BindGen /// The caller has to make sure that: /// /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_brightness(byte brightness); @@ -484,111 +484,111 @@ namespace ServicePoint.BindGen /// /// - `grid` points to a valid instance of `SPBrightnessGrid` /// - `grid` is not used concurrently or after this call - /// - the returned `Command` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_char_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_char_brightness(nuint x, nuint y, BrightnessGrid* grid); /// /// Allocates a new `Command::BitmapLinear` instance. - /// The passed `BitVec` gets consumed. + /// The passed `SPBitVec` gets consumed. /// /// Set pixel data starting at the pixel offset on screen. /// /// The screen will continuously overwrite more pixel data without regarding the offset, meaning /// once the starting row is full, overwriting will continue on column 0. /// - /// The contained `BitVec` is always uncompressed. + /// The contained `SPBitVec` is always uncompressed. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `bit_vec` points to a valid instance of `BitVec` + /// - `bit_vec` points to a valid instance of `SPBitVec` /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values - /// - the returned `Command` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_bitmap_linear(nuint offset, BitVec* bit_vec, CompressionCode compression); /// /// Allocates a new `Command::BitmapLinearAnd` instance. - /// The passed `BitVec` gets consumed. + /// The passed `SPBitVec` gets consumed. /// /// Set pixel data according to an and-mask starting at the offset. /// /// The screen will continuously overwrite more pixel data without regarding the offset, meaning /// once the starting row is full, overwriting will continue on column 0. /// - /// The contained `BitVec` is always uncompressed. + /// The contained `SPBitVec` is always uncompressed. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `bit_vec` points to a valid instance of `BitVec` + /// - `bit_vec` points to a valid instance of `SPBitVec` /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values - /// - the returned `Command` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_and", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_bitmap_linear_and(nuint offset, BitVec* bit_vec, CompressionCode compression); /// /// Allocates a new `Command::BitmapLinearOr` instance. - /// The passed `BitVec` gets consumed. + /// The passed `SPBitVec` gets consumed. /// /// Set pixel data according to an or-mask starting at the offset. /// /// The screen will continuously overwrite more pixel data without regarding the offset, meaning /// once the starting row is full, overwriting will continue on column 0. /// - /// The contained `BitVec` is always uncompressed. + /// The contained `SPBitVec` is always uncompressed. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `bit_vec` points to a valid instance of `BitVec` + /// - `bit_vec` points to a valid instance of `SPBitVec` /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values - /// - the returned `Command` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_or", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_bitmap_linear_or(nuint offset, BitVec* bit_vec, CompressionCode compression); /// /// Allocates a new `Command::BitmapLinearXor` instance. - /// The passed `BitVec` gets consumed. + /// The passed `SPBitVec` gets consumed. /// /// Set pixel data according to a xor-mask starting at the offset. /// /// The screen will continuously overwrite more pixel data without regarding the offset, meaning /// once the starting row is full, overwriting will continue on column 0. /// - /// The contained `BitVec` is always uncompressed. + /// The contained `SPBitVec` is always uncompressed. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `bit_vec` points to a valid instance of `BitVec` + /// - `bit_vec` points to a valid instance of `SPBitVec` /// - `bit_vec` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values - /// - the returned `Command` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_xor", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_bitmap_linear_xor(nuint offset, BitVec* bit_vec, CompressionCode compression); /// /// Allocates a new `Command::Cp437Data` instance. - /// The passed `ByteGrid` gets consumed. + /// The passed `SPCp437Grid` gets consumed. /// /// Show text on the screen. /// @@ -601,17 +601,17 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `byte_grid` points to a valid instance of `ByteGrid` - /// - `byte_grid` is not used concurrently or after this call - /// - the returned `Command` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// - `grid` points to a valid instance of `SPCp437Grid` + /// - `grid` is not used concurrently or after this call + /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_cp437_data", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern Command* sp_command_cp437_data(nuint x, nuint y, Cp437Grid* byte_grid); + public static extern Command* sp_command_cp437_data(nuint x, nuint y, Cp437Grid* grid); /// /// Allocates a new `Command::BitmapLinearWin` instance. - /// The passed `PixelGrid` gets consumed. + /// The passed `SPPixelGrid` gets consumed. /// /// Sets a window of pixels to the specified values /// @@ -619,38 +619,38 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `pixel_grid` points to a valid instance of `PixelGrid` + /// - `pixel_grid` points to a valid instance of `SPPixelGrid` /// - `pixel_grid` is not used concurrently or after this call /// - `compression` matches one of the allowed enum values - /// - the returned `Command` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_command_dealloc`. + /// - the returned `SPCommand` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_command_free`. /// [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_win", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Command* sp_command_bitmap_linear_win(nuint x, nuint y, PixelGrid* pixel_grid, CompressionCode compression_code); /// - /// Deallocates a `Command`. + /// Deallocates a `SPCommand`. /// /// # Examples /// /// ```C /// SPCommand c = sp_command_clear(); - /// sp_command_dealloc(c); + /// sp_command_free(c); /// ``` /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `Command` + /// - `this` points to a valid `SPCommand` /// - `this` is not used concurrently or after this call - /// - `this` was not passed to another consuming function, e.g. to create a `Packet` + /// - `this` was not passed to another consuming function, e.g. to create a `SPPacket` /// - [DllImport(__DllName, EntryPoint = "sp_command_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void sp_command_dealloc(Command* ptr); + [DllImport(__DllName, EntryPoint = "sp_command_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sp_command_free(Command* ptr); /// - /// Creates a new instance of `Connection`. + /// Creates a new instance of `SPConnection`. /// /// returns: NULL if connection fails, or connected instance /// @@ -663,14 +663,14 @@ namespace ServicePoint.BindGen /// The caller has to make sure that: /// /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_connection_dealloc`. + /// by explicitly calling `sp_connection_free`. /// [DllImport(__DllName, EntryPoint = "sp_connection_open", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Connection* sp_connection_open(byte* host); /// - /// Sends a `Packet` to the display using the `Connection`. - /// The passed `Packet` gets consumed. + /// Sends a `SPPacket` to the display using the `SPConnection`. + /// The passed `SPPacket` gets consumed. /// /// returns: true in case of success /// @@ -678,44 +678,44 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `connection` points to a valid instance of `Connection` - /// - `packet` points to a valid instance of `Packet` - /// - `packet` is not used concurrently or after this call + /// - `SPConnection` points to a valid instance of `SPConnection` + /// - `SPPacket` points to a valid instance of `SPPacket` + /// - `SPPacket` is not used concurrently or after this call /// [DllImport(__DllName, EntryPoint = "sp_connection_send", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: MarshalAs(UnmanagedType.U1)] public static extern bool sp_connection_send(Connection* connection, Packet* packet); /// - /// Closes and deallocates a `Connection`. + /// Closes and deallocates a `SPConnection`. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `Connection` + /// - `this` points to a valid `SPConnection` /// - `this` is not used concurrently or after this call /// - [DllImport(__DllName, EntryPoint = "sp_connection_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void sp_connection_dealloc(Connection* ptr); + [DllImport(__DllName, EntryPoint = "sp_connection_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sp_connection_free(Connection* ptr); /// - /// Creates a new `Cp437Grid` with the specified dimensions. + /// Creates a new `SPCp437Grid` with the specified dimensions. /// - /// returns: `Cp437Grid` initialized to 0. + /// returns: `SPCp437Grid` initialized to 0. /// /// # Safety /// /// The caller has to make sure that: /// /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_cp437_grid_dealloc`. + /// by explicitly calling `sp_cp437_grid_free`. /// [DllImport(__DllName, EntryPoint = "sp_cp437_grid_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Cp437Grid* sp_cp437_grid_new(nuint width, nuint height); /// - /// Loads a `Cp437Grid` with the specified dimensions from the provided data. + /// Loads a `SPCp437Grid` with the specified dimensions from the provided data. /// /// # Panics /// @@ -728,39 +728,39 @@ namespace ServicePoint.BindGen /// - `data` points to a valid memory location of at least `data_length` /// bytes in size. /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_cp437_grid_dealloc`. + /// by explicitly calling `sp_cp437_grid_free`. /// [DllImport(__DllName, EntryPoint = "sp_cp437_grid_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Cp437Grid* sp_cp437_grid_load(nuint width, nuint height, byte* data, nuint data_length); /// - /// Clones a `Cp437Grid`. + /// Clones a `SPCp437Grid`. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `Cp437Grid` + /// - `this` points to a valid `SPCp437Grid` /// - `this` is not written to concurrently /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_cp437_grid_dealloc`. + /// by explicitly calling `sp_cp437_grid_free`. /// [DllImport(__DllName, EntryPoint = "sp_cp437_grid_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Cp437Grid* sp_cp437_grid_clone(Cp437Grid* @this); /// - /// Deallocates a `Cp437Grid`. + /// Deallocates a `SPCp437Grid`. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `Cp437Grid` + /// - `this` points to a valid `SPCp437Grid` /// - `this` is not used concurrently or after this call - /// - `this` was not passed to another consuming function, e.g. to create a `Command` + /// - `this` was not passed to another consuming function, e.g. to create a `SPCommand` /// - [DllImport(__DllName, EntryPoint = "sp_cp437_grid_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void sp_cp437_grid_dealloc(Cp437Grid* @this); + [DllImport(__DllName, EntryPoint = "sp_cp437_grid_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sp_cp437_grid_free(Cp437Grid* @this); /// /// Gets the current value at the specified position. @@ -778,14 +778,14 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `Cp437Grid` + /// - `this` points to a valid `SPCp437Grid` /// - `this` is not written to concurrently /// [DllImport(__DllName, EntryPoint = "sp_cp437_grid_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern byte sp_cp437_grid_get(Cp437Grid* @this, nuint x, nuint y); /// - /// Sets the value of the specified position in the `Cp437Grid`. + /// Sets the value of the specified position in the `SPCp437Grid`. /// /// # Arguments /// @@ -803,14 +803,14 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `BitVec` + /// - `this` points to a valid `SPBitVec` /// - `this` is not written to or read from concurrently /// [DllImport(__DllName, EntryPoint = "sp_cp437_grid_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp_cp437_grid_set(Cp437Grid* @this, nuint x, nuint y, byte value); /// - /// Sets the value of all cells in the `Cp437Grid`. + /// Sets the value of all cells in the `SPCp437Grid`. /// /// # Arguments /// @@ -821,14 +821,14 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `Cp437Grid` + /// - `this` points to a valid `SPCp437Grid` /// - `this` is not written to or read from concurrently /// [DllImport(__DllName, EntryPoint = "sp_cp437_grid_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp_cp437_grid_fill(Cp437Grid* @this, byte value); /// - /// Gets the width of the `Cp437Grid` instance. + /// Gets the width of the `SPCp437Grid` instance. /// /// # Arguments /// @@ -838,13 +838,13 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `Cp437Grid` + /// - `this` points to a valid `SPCp437Grid` /// [DllImport(__DllName, EntryPoint = "sp_cp437_grid_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp_cp437_grid_width(Cp437Grid* @this); /// - /// Gets the height of the `Cp437Grid` instance. + /// Gets the height of the `SPCp437Grid` instance. /// /// # Arguments /// @@ -854,43 +854,43 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `Cp437Grid` + /// - `this` points to a valid `SPCp437Grid` /// [DllImport(__DllName, EntryPoint = "sp_cp437_grid_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp_cp437_grid_height(Cp437Grid* @this); /// - /// Gets an unsafe reference to the data of the `Cp437Grid` instance. + /// Gets an unsafe reference to the data of the `SPCp437Grid` instance. /// /// ## Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `Cp437Grid` - /// - the returned memory range is never accessed after the passed `Cp437Grid` has been freed - /// - the returned memory range is never accessed concurrently, either via the `Cp437Grid` or directly + /// - `this` points to a valid `SPCp437Grid` + /// - the returned memory range is never accessed after the passed `SPCp437Grid` has been freed + /// - the returned memory range is never accessed concurrently, either via the `SPCp437Grid` or directly /// [DllImport(__DllName, EntryPoint = "sp_cp437_grid_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern ByteSlice sp_cp437_grid_unsafe_data_ref(Cp437Grid* @this); /// - /// Turns a `Command` into a `Packet`. - /// The `Command` gets consumed. + /// Turns a `SPCommand` into a `SPPacket`. + /// The `SPCommand` gets consumed. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `command` points to a valid instance of `Command` - /// - `command` is not used concurrently or after this call - /// - the returned `Packet` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_packet_dealloc`. + /// - `SPCommand` points to a valid instance of `SPCommand` + /// - `SPCommand` is not used concurrently or after this call + /// - the returned `SPPacket` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_packet_free`. /// [DllImport(__DllName, EntryPoint = "sp_packet_from_command", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Packet* sp_packet_from_command(Command* command); /// - /// Tries to load a `Packet` from the passed array with the specified length. + /// Tries to load a `SPPacket` from the passed array with the specified length. /// /// returns: NULL in case of an error, pointer to the allocated packet otherwise /// @@ -900,49 +900,49 @@ namespace ServicePoint.BindGen /// /// - `data` points to a valid memory region of at least `length` bytes /// - `data` is not written to concurrently - /// - the returned `Packet` instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_packet_dealloc`. + /// - the returned `SPPacket` instance is freed in some way, either by using a consuming function or + /// by explicitly calling `sp_packet_free`. /// [DllImport(__DllName, EntryPoint = "sp_packet_try_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Packet* sp_packet_try_load(byte* data, nuint length); /// - /// Clones a `Packet`. + /// Clones a `SPPacket`. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `Packet` + /// - `this` points to a valid `SPPacket` /// - `this` is not written to concurrently /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_packet_dealloc`. + /// by explicitly calling `sp_packet_free`. /// [DllImport(__DllName, EntryPoint = "sp_packet_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern Packet* sp_packet_clone(Packet* @this); /// - /// Deallocates a `Packet`. + /// Deallocates a `SPPacket`. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `Packet` + /// - `this` points to a valid `SPPacket` /// - `this` is not used concurrently or after this call /// - [DllImport(__DllName, EntryPoint = "sp_packet_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void sp_packet_dealloc(Packet* @this); + [DllImport(__DllName, EntryPoint = "sp_packet_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sp_packet_free(Packet* @this); /// - /// Creates a new `PixelGrid` with the specified dimensions. + /// Creates a new `SPPixelGrid` with the specified dimensions. /// /// # Arguments /// /// - `width`: size in pixels in x-direction /// - `height`: size in pixels in y-direction /// - /// returns: `PixelGrid` initialized to all pixels off + /// returns: `SPPixelGrid` initialized to all pixels off /// /// # Panics /// @@ -953,20 +953,20 @@ namespace ServicePoint.BindGen /// The caller has to make sure that: /// /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_pixel_grid_dealloc`. + /// by explicitly calling `sp_pixel_grid_free`. /// [DllImport(__DllName, EntryPoint = "sp_pixel_grid_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern PixelGrid* sp_pixel_grid_new(nuint width, nuint height); /// - /// Loads a `PixelGrid` with the specified dimensions from the provided data. + /// Loads a `SPPixelGrid` with the specified dimensions from the provided data. /// /// # Arguments /// /// - `width`: size in pixels in x-direction /// - `height`: size in pixels in y-direction /// - /// returns: `PixelGrid` that contains a copy of the provided data + /// returns: `SPPixelGrid` that contains a copy of the provided data /// /// # Panics /// @@ -979,42 +979,42 @@ namespace ServicePoint.BindGen /// /// - `data` points to a valid memory location of at least `data_length` bytes in size. /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_pixel_grid_dealloc`. + /// by explicitly calling `sp_pixel_grid_free`. /// [DllImport(__DllName, EntryPoint = "sp_pixel_grid_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern PixelGrid* sp_pixel_grid_load(nuint width, nuint height, byte* data, nuint data_length); /// - /// Clones a `PixelGrid`. + /// Clones a `SPPixelGrid`. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `PixelGrid` + /// - `this` points to a valid `SPPixelGrid` /// - `this` is not written to concurrently /// - the returned instance is freed in some way, either by using a consuming function or - /// by explicitly calling `sp_pixel_grid_dealloc`. + /// by explicitly calling `sp_pixel_grid_free`. /// [DllImport(__DllName, EntryPoint = "sp_pixel_grid_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern PixelGrid* sp_pixel_grid_clone(PixelGrid* @this); /// - /// Deallocates a `PixelGrid`. + /// Deallocates a `SPPixelGrid`. /// /// # Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `PixelGrid` + /// - `this` points to a valid `SPPixelGrid` /// - `this` is not used concurrently or after this call - /// - `this` was not passed to another consuming function, e.g. to create a `Command` + /// - `this` was not passed to another consuming function, e.g. to create a `SPCommand` /// - [DllImport(__DllName, EntryPoint = "sp_pixel_grid_dealloc", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void sp_pixel_grid_dealloc(PixelGrid* @this); + [DllImport(__DllName, EntryPoint = "sp_pixel_grid_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sp_pixel_grid_free(PixelGrid* @this); /// - /// Gets the current value at the specified position in the `PixelGrid`. + /// Gets the current value at the specified position in the `SPPixelGrid`. /// /// # Arguments /// @@ -1029,7 +1029,7 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `PixelGrid` + /// - `this` points to a valid `SPPixelGrid` /// - `this` is not written to concurrently /// [DllImport(__DllName, EntryPoint = "sp_pixel_grid_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -1037,7 +1037,7 @@ namespace ServicePoint.BindGen public static extern bool sp_pixel_grid_get(PixelGrid* @this, nuint x, nuint y); /// - /// Sets the value of the specified position in the `PixelGrid`. + /// Sets the value of the specified position in the `SPPixelGrid`. /// /// # Arguments /// @@ -1055,14 +1055,14 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `PixelGrid` + /// - `this` points to a valid `SPPixelGrid` /// - `this` is not written to or read from concurrently /// [DllImport(__DllName, EntryPoint = "sp_pixel_grid_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp_pixel_grid_set(PixelGrid* @this, nuint x, nuint y, [MarshalAs(UnmanagedType.U1)] bool value); /// - /// Sets the state of all pixels in the `PixelGrid`. + /// Sets the state of all pixels in the `SPPixelGrid`. /// /// # Arguments /// @@ -1073,14 +1073,14 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `PixelGrid` + /// - `this` points to a valid `SPPixelGrid` /// - `this` is not written to or read from concurrently /// [DllImport(__DllName, EntryPoint = "sp_pixel_grid_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern void sp_pixel_grid_fill(PixelGrid* @this, [MarshalAs(UnmanagedType.U1)] bool value); /// - /// Gets the width in pixels of the `PixelGrid` instance. + /// Gets the width in pixels of the `SPPixelGrid` instance. /// /// # Arguments /// @@ -1090,13 +1090,13 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `PixelGrid` + /// - `this` points to a valid `SPPixelGrid` /// [DllImport(__DllName, EntryPoint = "sp_pixel_grid_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp_pixel_grid_width(PixelGrid* @this); /// - /// Gets the height in pixels of the `PixelGrid` instance. + /// Gets the height in pixels of the `SPPixelGrid` instance. /// /// # Arguments /// @@ -1106,21 +1106,21 @@ namespace ServicePoint.BindGen /// /// The caller has to make sure that: /// - /// - `this` points to a valid `PixelGrid` + /// - `this` points to a valid `SPPixelGrid` /// [DllImport(__DllName, EntryPoint = "sp_pixel_grid_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern nuint sp_pixel_grid_height(PixelGrid* @this); /// - /// Gets an unsafe reference to the data of the `PixelGrid` instance. + /// Gets an unsafe reference to the data of the `SPPixelGrid` instance. /// /// ## Safety /// /// The caller has to make sure that: /// - /// - `this` points to a valid `PixelGrid` - /// - the returned memory range is never accessed after the passed `PixelGrid` has been freed - /// - the returned memory range is never accessed concurrently, either via the `PixelGrid` or directly + /// - `this` points to a valid `SPPixelGrid` + /// - the returned memory range is never accessed after the passed `SPPixelGrid` has been freed + /// - the returned memory range is never accessed concurrently, either via the `SPPixelGrid` or directly /// [DllImport(__DllName, EntryPoint = "sp_pixel_grid_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern ByteSlice sp_pixel_grid_unsafe_data_ref(PixelGrid* @this); diff --git a/crates/servicepoint_binding_cs/ServicePoint/BitVec.cs b/crates/servicepoint_binding_cs/ServicePoint/BitVec.cs index 13b2200..2abe78c 100644 --- a/crates/servicepoint_binding_cs/ServicePoint/BitVec.cs +++ b/crates/servicepoint_binding_cs/ServicePoint/BitVec.cs @@ -84,8 +84,5 @@ public sealed class BitVec : SpNativeInstance { } - private protected override unsafe void Dealloc() - { - NativeMethods.sp_bit_vec_dealloc(Instance); - } + private protected override unsafe void Free() => NativeMethods.sp_bit_vec_free(Instance); } diff --git a/crates/servicepoint_binding_cs/ServicePoint/BrightnessGrid.cs b/crates/servicepoint_binding_cs/ServicePoint/BrightnessGrid.cs index b80f64f..53970b5 100644 --- a/crates/servicepoint_binding_cs/ServicePoint/BrightnessGrid.cs +++ b/crates/servicepoint_binding_cs/ServicePoint/BrightnessGrid.cs @@ -96,8 +96,5 @@ public sealed class BrightnessGrid : SpNativeInstance { } - private protected override unsafe void Dealloc() - { - NativeMethods.sp_brightness_grid_dealloc(Instance); - } + private protected override unsafe void Free() => NativeMethods.sp_brightness_grid_free(Instance); } diff --git a/crates/servicepoint_binding_cs/ServicePoint/Command.cs b/crates/servicepoint_binding_cs/ServicePoint/Command.cs index a0349c8..e17c685 100644 --- a/crates/servicepoint_binding_cs/ServicePoint/Command.cs +++ b/crates/servicepoint_binding_cs/ServicePoint/Command.cs @@ -125,8 +125,5 @@ public sealed class Command : SpNativeInstance { } - private protected override unsafe void Dealloc() - { - NativeMethods.sp_command_dealloc(Instance); - } + private protected override unsafe void Free() => NativeMethods.sp_command_free(Instance); } diff --git a/crates/servicepoint_binding_cs/ServicePoint/Connection.cs b/crates/servicepoint_binding_cs/ServicePoint/Connection.cs index 3d1a480..302bc57 100644 --- a/crates/servicepoint_binding_cs/ServicePoint/Connection.cs +++ b/crates/servicepoint_binding_cs/ServicePoint/Connection.cs @@ -24,10 +24,7 @@ public sealed class Connection : SpNativeInstance } } - private protected override unsafe void Dealloc() - { - NativeMethods.sp_connection_dealloc(Instance); - } + private protected override unsafe void Free() => NativeMethods.sp_connection_free(Instance); private unsafe Connection(BindGen.Connection* instance) : base(instance) { diff --git a/crates/servicepoint_binding_cs/ServicePoint/Cp437Grid.cs b/crates/servicepoint_binding_cs/ServicePoint/Cp437Grid.cs index e795c85..905828b 100644 --- a/crates/servicepoint_binding_cs/ServicePoint/Cp437Grid.cs +++ b/crates/servicepoint_binding_cs/ServicePoint/Cp437Grid.cs @@ -127,8 +127,5 @@ public sealed class Cp437Grid : SpNativeInstance { } - private protected override unsafe void Dealloc() - { - NativeMethods.sp_cp437_grid_dealloc(Instance); - } + private protected override unsafe void Free() => NativeMethods.sp_cp437_grid_free(Instance); } diff --git a/crates/servicepoint_binding_cs/ServicePoint/Packet.cs b/crates/servicepoint_binding_cs/ServicePoint/Packet.cs index ab4b08a..24c2c18 100644 --- a/crates/servicepoint_binding_cs/ServicePoint/Packet.cs +++ b/crates/servicepoint_binding_cs/ServicePoint/Packet.cs @@ -32,8 +32,5 @@ public sealed class Packet : SpNativeInstance { } - private protected override unsafe void Dealloc() - { - NativeMethods.sp_packet_dealloc(Instance); - } + private protected override unsafe void Free() => NativeMethods.sp_packet_free(Instance); } diff --git a/crates/servicepoint_binding_cs/ServicePoint/PixelGrid.cs b/crates/servicepoint_binding_cs/ServicePoint/PixelGrid.cs index 1e6fb11..77e0cf3 100644 --- a/crates/servicepoint_binding_cs/ServicePoint/PixelGrid.cs +++ b/crates/servicepoint_binding_cs/ServicePoint/PixelGrid.cs @@ -96,8 +96,5 @@ public sealed class PixelGrid : SpNativeInstance { } - private protected override unsafe void Dealloc() - { - NativeMethods.sp_pixel_grid_dealloc(Instance); - } + private protected override unsafe void Free() => NativeMethods.sp_pixel_grid_free(Instance); } diff --git a/crates/servicepoint_binding_cs/ServicePoint/SpNativeInstance.cs b/crates/servicepoint_binding_cs/ServicePoint/SpNativeInstance.cs index 23013c8..b6c492e 100644 --- a/crates/servicepoint_binding_cs/ServicePoint/SpNativeInstance.cs +++ b/crates/servicepoint_binding_cs/ServicePoint/SpNativeInstance.cs @@ -22,7 +22,7 @@ public abstract class SpNativeInstance _instance = instance; } - private protected abstract void Dealloc(); + private protected abstract void Free(); internal unsafe T* Into() { @@ -34,7 +34,7 @@ public abstract class SpNativeInstance private unsafe void ReleaseUnmanagedResources() { if (_instance != null) - Dealloc(); + Free(); _instance = null; }