add prefix centrally

This commit is contained in:
Vinzenz Schroeter 2025-06-21 23:51:10 +02:00
parent 1eb59d986a
commit 500cbbc872
20 changed files with 195 additions and 195 deletions

File diff suppressed because it is too large Load diff

View file

@ -8,14 +8,14 @@ use std::ptr::NonNull;
wrap_command!(Bitmap);
wrap_fields!(sp_cmd_bitmap::BitmapCommand;
wrap_fields!(cmd_bitmap::BitmapCommand;
prop bitmap: Bitmap { mut get(); move set(value); };
prop compression: CompressionCode { get(); set(value); };
);
wrap_origin_accessors!(sp_cmd_bitmap::BitmapCommand);
wrap_origin_accessors!(cmd_bitmap::BitmapCommand);
wrap_functions!(sp_cmd_bitmap;
wrap_functions!(cmd_bitmap;
/// Sets a window of pixels to the specified values.
///
/// The passed [Bitmap] gets consumed.

View file

@ -11,14 +11,14 @@ use std::ptr::NonNull;
wrap_command!(BitVec);
wrap_fields!(sp_cmd_bitvec::BitVecCommand;
wrap_fields!(cmd_bitvec::BitVecCommand;
prop bitvec: DisplayBitVec { mut get(); move set(value); };
prop offset: Offset { get(); set(value); };
prop operation: BinaryOperation { get(); set(value); };
prop compression: CompressionCode { get(); set(value); };
);
wrap_functions!(sp_cmd_bitvec;
wrap_functions!(cmd_bitvec;
/// Set pixel data starting at the pixel offset on screen.
///

View file

@ -8,13 +8,13 @@ use std::ptr::NonNull;
wrap_command!(BrightnessGrid);
wrap_fields!(sp_cmd_brightness_grid::BrightnessGridCommand;
wrap_fields!(cmd_brightness_grid::BrightnessGridCommand;
prop grid: BrightnessGrid { mut get(); move set(grid); };
);
wrap_origin_accessors!(sp_cmd_brightness_grid::BrightnessGridCommand);
wrap_origin_accessors!(cmd_brightness_grid::BrightnessGridCommand);
wrap_functions!(sp_cmd_brightness_grid;
wrap_functions!(cmd_brightness_grid;
/// Set the brightness of individual tiles in a rectangular area of the display.
///

View file

@ -20,7 +20,7 @@ macro_rules! wrap_cc_only {
($(#[$meta:meta])* $command:ident) => {
::paste::paste!{
wrap_cc_only!($(#[$meta])*; $command, [< sp_cmd_ $command:lower >], [< $command Command >]);
wrap_cc_only!($(#[$meta])*; $command, [< cmd_ $command:lower >], [< $command Command >]);
}
};
}

View file

@ -8,13 +8,13 @@ use std::ptr::NonNull;
wrap_command!(CharGrid);
wrap_fields!(sp_cmd_char_grid::CharGridCommand;
wrap_fields!(cmd_char_grid::CharGridCommand;
prop grid: CharGrid { mut get(); move set(grid); };
);
wrap_origin_accessors!(sp_cmd_char_grid::CharGridCommand);
wrap_origin_accessors!(cmd_char_grid::CharGridCommand);
wrap_functions!(sp_cmd_char_grid;
wrap_functions!(cmd_char_grid;
/// Show UTF-8 encoded text on the screen.
///

View file

@ -8,13 +8,13 @@ use std::ptr::NonNull;
wrap_command!(Cp437Grid);
wrap_fields!(sp_cmd_cp437_grid::Cp437GridCommand;
wrap_fields!(cmd_cp437_grid::Cp437GridCommand;
prop grid: Cp437Grid { mut get(); move set(grid); };
);
wrap_origin_accessors!(sp_cmd_cp437_grid::Cp437GridCommand);
wrap_origin_accessors!(cmd_cp437_grid::Cp437GridCommand);
wrap_functions!(sp_cmd_cp437_grid;
wrap_functions!(cmd_cp437_grid;
/// Show text on the screen.
///

View file

@ -69,7 +69,7 @@ impl SPCommand {
};
}
wrap_functions!(sp_cmd_generic;
wrap_functions!(cmd_generic;
/// Tries to turn a [Packet] into a [SPCommand].
///

View file

@ -6,7 +6,7 @@ use crate::{
use servicepoint::{Brightness, GlobalBrightnessCommand, Packet};
use std::ptr::NonNull;
wrap_functions!(sp_cmd_brightness_global;
wrap_functions!(cmd_brightness_global;
/// Set the brightness of all tiles to the same value.
///
@ -25,7 +25,7 @@ wrap_functions!(sp_cmd_brightness_global;
wrap_command!(GlobalBrightness);
wrap_fields!(
sp_cmd_brightness_global::GlobalBrightnessCommand;
cmd_brightness_global::GlobalBrightnessCommand;
prop brightness: Brightness {
get();
set(value);

View file

@ -70,7 +70,7 @@ macro_rules! wrap_command {
};
($command:ident) => {
::paste::paste!{
wrap_command!($command, [< sp_cmd_ $command:lower >], [< $command Command >]);
wrap_command!($command, [< cmd_ $command:lower >], [< $command Command >]);
}
};
}

View file

@ -9,10 +9,10 @@ use servicepoint::{
};
use std::ptr::NonNull;
wrap_clone!(sp_bitmap::Bitmap);
wrap_free!(sp_bitmap::Bitmap);
wrap_clone!(bitmap::Bitmap);
wrap_free!(bitmap::Bitmap);
wrap_functions!(sp_bitmap;
wrap_functions!(bitmap;
/// Creates a new [Bitmap] with the specified dimensions.
///
@ -106,7 +106,7 @@ wrap_functions!(sp_bitmap;
);
wrap_methods!(
sp_bitmap::Bitmap;
bitmap::Bitmap;
/// Gets the current value at the specified position.
///
@ -148,7 +148,6 @@ wrap_methods!(
///
/// The returned memory is valid for the lifetime of the bitmap.
mut fn data_ref_mut() -> ByteSlice {
return(slice) { unsafe { ByteSlice::from_slice(slice) } };
};
);

View file

@ -8,7 +8,7 @@ use servicepoint::{
};
use std::ptr::NonNull;
wrap_functions!(sp_bitvec;
wrap_functions!(bitvec;
/// Creates a new [DisplayBitVec] instance.
///
@ -55,11 +55,11 @@ wrap_functions!(sp_bitvec;
);
wrap_clone!(sp_bitvec::DisplayBitVec);
wrap_free!(sp_bitvec::DisplayBitVec);
wrap_clone!(bitvec::DisplayBitVec);
wrap_free!(bitvec::DisplayBitVec);
wrap_methods!(
sp_bitvec::DisplayBitVec;
bitvec::DisplayBitVec;
/// Gets the value of a bit.
///

View file

@ -9,7 +9,7 @@ use servicepoint::{
};
use std::{mem::transmute, ptr::NonNull};
wrap_functions!(sp_brightness_grid;
wrap_functions!(brightness_grid;
/// Creates a new [BrightnessGrid] with the specified dimensions.
///
@ -71,11 +71,11 @@ wrap_functions!(sp_brightness_grid;
);
wrap_clone!(sp_brightness_grid::BrightnessGrid);
wrap_free!(sp_brightness_grid::BrightnessGrid);
wrap_clone!(brightness_grid::BrightnessGrid);
wrap_free!(brightness_grid::BrightnessGrid);
wrap_methods!(
sp_brightness_grid::BrightnessGrid;
brightness_grid::BrightnessGrid;
/// Gets the current value at the specified position.
///

View file

@ -6,7 +6,7 @@ use crate::{
use servicepoint::{CharGrid, CharGridCommand, Grid, Origin, Packet};
use std::ptr::NonNull;
wrap_functions!(sp_char_grid;
wrap_functions!(char_grid;
/// Creates a new [CharGrid] with the specified dimensions.
///
@ -58,11 +58,11 @@ wrap_functions!(sp_char_grid;
);
wrap_clone!(sp_char_grid::CharGrid);
wrap_free!(sp_char_grid::CharGrid);
wrap_clone!(char_grid::CharGrid);
wrap_free!(char_grid::CharGrid);
wrap_methods!(
sp_char_grid::CharGrid;
char_grid::CharGrid;
/// Returns the current value at the specified position.
///

View file

@ -9,7 +9,7 @@ use servicepoint::{
};
use std::ptr::NonNull;
wrap_functions!(sp_cp437_grid;
wrap_functions!(cp437_grid;
/// Creates a new [Cp437Grid] with the specified dimensions.
///
@ -50,11 +50,11 @@ wrap_functions!(sp_cp437_grid;
);
wrap_clone!(sp_cp437_grid::Cp437Grid);
wrap_free!(sp_cp437_grid::Cp437Grid);
wrap_clone!(cp437_grid::Cp437Grid);
wrap_free!(cp437_grid::Cp437Grid);
wrap_methods!(
sp_cp437_grid::Cp437Grid;
cp437_grid::Cp437Grid;
/// Gets the current value at the specified position.
///
/// # Arguments

View file

@ -14,5 +14,6 @@ pub use cp437_grid::*;
mod _hidden {
/// This is a type only used by cbindgen to have a type for pointers.
#[allow(unused)]
pub struct DisplayBitVec;
}

View file

@ -2,8 +2,6 @@
//!
//! # Examples
//!
//! Make sure to check out [this GitHub repo](https://github.com/arfst23/ServicePoint) as well!
//!
//! ```C
//! #include <stdio.h>
//! #include "servicepoint.h"
@ -24,6 +22,8 @@
//! return 0;
//! }
//! ```
//!
//! There are more examples in the source repository.
/// Functions related to commands.
pub mod commands;
@ -43,7 +43,7 @@ pub const SP_FRAME_PACING_MS: u128 = 30;
mod feature_env_logger {
use crate::macros::wrap_functions;
wrap_functions!(sp_envlogger;
wrap_functions!(envlogger;
/// Call this function at the beginning of main to enable rust logging controlled by the
/// `RUST_LOG` environment variable. See [env_logger](https://docs.rs/env_logger/latest/env_logger/).
fn init() {

View file

@ -223,7 +223,7 @@ macro_rules! wrap_functions {
#[doc = ""]
#[doc = concat!(" This function is part of the ", stringify!($module), " module.")]
#[no_mangle]
pub unsafe extern "C" fn [< $module _ $function >](
pub unsafe extern "C" fn [< sp_ $module _ $function >](
$($param_name: $param_type),*
) $(-> $return_type)?
$block

View file

@ -6,7 +6,7 @@ use crate::{
use servicepoint::{CommandCode, Header, Packet};
use std::ptr::NonNull;
wrap_functions!(sp_packet;
wrap_functions!(packet;
/// Tries to load a [Packet] from the passed array with the specified length.
///
@ -68,11 +68,11 @@ wrap_functions!(sp_packet;
}
);
wrap_clone!(sp_packet::Packet);
wrap_free!(sp_packet::Packet);
wrap_clone!(packet::Packet);
wrap_free!(packet::Packet);
wrap_fields!(
sp_packet::Packet;
packet::Packet;
prop header: Header {
get();
mut get();

View file

@ -10,9 +10,9 @@ use std::{
ptr::NonNull,
};
wrap_free!(sp_udp::UdpSocket);
wrap_free!(udp::UdpSocket);
wrap_functions!(sp_udp;
wrap_functions!(udp;
/// Creates a new instance of [UdpSocket].
///