add prefix centrally
This commit is contained in:
parent
1eb59d986a
commit
500cbbc872
File diff suppressed because it is too large
Load diff
|
@ -8,14 +8,14 @@ use std::ptr::NonNull;
|
||||||
|
|
||||||
wrap_command!(Bitmap);
|
wrap_command!(Bitmap);
|
||||||
|
|
||||||
wrap_fields!(sp_cmd_bitmap::BitmapCommand;
|
wrap_fields!(cmd_bitmap::BitmapCommand;
|
||||||
prop bitmap: Bitmap { mut get(); move set(value); };
|
prop bitmap: Bitmap { mut get(); move set(value); };
|
||||||
prop compression: CompressionCode { get(); 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.
|
/// Sets a window of pixels to the specified values.
|
||||||
///
|
///
|
||||||
/// The passed [Bitmap] gets consumed.
|
/// The passed [Bitmap] gets consumed.
|
||||||
|
|
|
@ -11,14 +11,14 @@ use std::ptr::NonNull;
|
||||||
|
|
||||||
wrap_command!(BitVec);
|
wrap_command!(BitVec);
|
||||||
|
|
||||||
wrap_fields!(sp_cmd_bitvec::BitVecCommand;
|
wrap_fields!(cmd_bitvec::BitVecCommand;
|
||||||
prop bitvec: DisplayBitVec { mut get(); move set(value); };
|
prop bitvec: DisplayBitVec { mut get(); move set(value); };
|
||||||
prop offset: Offset { get(); set(value); };
|
prop offset: Offset { get(); set(value); };
|
||||||
prop operation: BinaryOperation { get(); set(value); };
|
prop operation: BinaryOperation { get(); set(value); };
|
||||||
prop compression: CompressionCode { 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.
|
/// Set pixel data starting at the pixel offset on screen.
|
||||||
///
|
///
|
||||||
|
|
|
@ -8,13 +8,13 @@ use std::ptr::NonNull;
|
||||||
|
|
||||||
wrap_command!(BrightnessGrid);
|
wrap_command!(BrightnessGrid);
|
||||||
|
|
||||||
wrap_fields!(sp_cmd_brightness_grid::BrightnessGridCommand;
|
wrap_fields!(cmd_brightness_grid::BrightnessGridCommand;
|
||||||
prop grid: BrightnessGrid { mut get(); move set(grid); };
|
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.
|
/// Set the brightness of individual tiles in a rectangular area of the display.
|
||||||
///
|
///
|
||||||
|
|
|
@ -20,7 +20,7 @@ macro_rules! wrap_cc_only {
|
||||||
|
|
||||||
($(#[$meta:meta])* $command:ident) => {
|
($(#[$meta:meta])* $command:ident) => {
|
||||||
::paste::paste!{
|
::paste::paste!{
|
||||||
wrap_cc_only!($(#[$meta])*; $command, [< sp_cmd_ $command:lower >], [< $command Command >]);
|
wrap_cc_only!($(#[$meta])*; $command, [< cmd_ $command:lower >], [< $command Command >]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,13 @@ use std::ptr::NonNull;
|
||||||
|
|
||||||
wrap_command!(CharGrid);
|
wrap_command!(CharGrid);
|
||||||
|
|
||||||
wrap_fields!(sp_cmd_char_grid::CharGridCommand;
|
wrap_fields!(cmd_char_grid::CharGridCommand;
|
||||||
prop grid: CharGrid { mut get(); move set(grid); };
|
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.
|
/// Show UTF-8 encoded text on the screen.
|
||||||
///
|
///
|
||||||
|
|
|
@ -8,13 +8,13 @@ use std::ptr::NonNull;
|
||||||
|
|
||||||
wrap_command!(Cp437Grid);
|
wrap_command!(Cp437Grid);
|
||||||
|
|
||||||
wrap_fields!(sp_cmd_cp437_grid::Cp437GridCommand;
|
wrap_fields!(cmd_cp437_grid::Cp437GridCommand;
|
||||||
prop grid: Cp437Grid { mut get(); move set(grid); };
|
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.
|
/// Show text on the screen.
|
||||||
///
|
///
|
||||||
|
|
|
@ -69,7 +69,7 @@ impl SPCommand {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
wrap_functions!(sp_cmd_generic;
|
wrap_functions!(cmd_generic;
|
||||||
|
|
||||||
/// Tries to turn a [Packet] into a [SPCommand].
|
/// Tries to turn a [Packet] into a [SPCommand].
|
||||||
///
|
///
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
||||||
use servicepoint::{Brightness, GlobalBrightnessCommand, Packet};
|
use servicepoint::{Brightness, GlobalBrightnessCommand, Packet};
|
||||||
use std::ptr::NonNull;
|
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.
|
/// Set the brightness of all tiles to the same value.
|
||||||
///
|
///
|
||||||
|
@ -25,7 +25,7 @@ wrap_functions!(sp_cmd_brightness_global;
|
||||||
wrap_command!(GlobalBrightness);
|
wrap_command!(GlobalBrightness);
|
||||||
|
|
||||||
wrap_fields!(
|
wrap_fields!(
|
||||||
sp_cmd_brightness_global::GlobalBrightnessCommand;
|
cmd_brightness_global::GlobalBrightnessCommand;
|
||||||
prop brightness: Brightness {
|
prop brightness: Brightness {
|
||||||
get();
|
get();
|
||||||
set(value);
|
set(value);
|
||||||
|
|
|
@ -70,7 +70,7 @@ macro_rules! wrap_command {
|
||||||
};
|
};
|
||||||
($command:ident) => {
|
($command:ident) => {
|
||||||
::paste::paste!{
|
::paste::paste!{
|
||||||
wrap_command!($command, [< sp_cmd_ $command:lower >], [< $command Command >]);
|
wrap_command!($command, [< cmd_ $command:lower >], [< $command Command >]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,10 @@ use servicepoint::{
|
||||||
};
|
};
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
|
||||||
wrap_clone!(sp_bitmap::Bitmap);
|
wrap_clone!(bitmap::Bitmap);
|
||||||
wrap_free!(sp_bitmap::Bitmap);
|
wrap_free!(bitmap::Bitmap);
|
||||||
|
|
||||||
wrap_functions!(sp_bitmap;
|
wrap_functions!(bitmap;
|
||||||
|
|
||||||
/// Creates a new [Bitmap] with the specified dimensions.
|
/// Creates a new [Bitmap] with the specified dimensions.
|
||||||
///
|
///
|
||||||
|
@ -106,7 +106,7 @@ wrap_functions!(sp_bitmap;
|
||||||
);
|
);
|
||||||
|
|
||||||
wrap_methods!(
|
wrap_methods!(
|
||||||
sp_bitmap::Bitmap;
|
bitmap::Bitmap;
|
||||||
|
|
||||||
/// Gets the current value at the specified position.
|
/// 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.
|
/// The returned memory is valid for the lifetime of the bitmap.
|
||||||
mut fn data_ref_mut() -> ByteSlice {
|
mut fn data_ref_mut() -> ByteSlice {
|
||||||
|
|
||||||
return(slice) { unsafe { ByteSlice::from_slice(slice) } };
|
return(slice) { unsafe { ByteSlice::from_slice(slice) } };
|
||||||
};
|
};
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,7 +8,7 @@ use servicepoint::{
|
||||||
};
|
};
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
|
||||||
wrap_functions!(sp_bitvec;
|
wrap_functions!(bitvec;
|
||||||
|
|
||||||
/// Creates a new [DisplayBitVec] instance.
|
/// Creates a new [DisplayBitVec] instance.
|
||||||
///
|
///
|
||||||
|
@ -55,11 +55,11 @@ wrap_functions!(sp_bitvec;
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
wrap_clone!(sp_bitvec::DisplayBitVec);
|
wrap_clone!(bitvec::DisplayBitVec);
|
||||||
wrap_free!(sp_bitvec::DisplayBitVec);
|
wrap_free!(bitvec::DisplayBitVec);
|
||||||
|
|
||||||
wrap_methods!(
|
wrap_methods!(
|
||||||
sp_bitvec::DisplayBitVec;
|
bitvec::DisplayBitVec;
|
||||||
|
|
||||||
/// Gets the value of a bit.
|
/// Gets the value of a bit.
|
||||||
///
|
///
|
||||||
|
|
|
@ -9,7 +9,7 @@ use servicepoint::{
|
||||||
};
|
};
|
||||||
use std::{mem::transmute, ptr::NonNull};
|
use std::{mem::transmute, ptr::NonNull};
|
||||||
|
|
||||||
wrap_functions!(sp_brightness_grid;
|
wrap_functions!(brightness_grid;
|
||||||
|
|
||||||
/// Creates a new [BrightnessGrid] with the specified dimensions.
|
/// Creates a new [BrightnessGrid] with the specified dimensions.
|
||||||
///
|
///
|
||||||
|
@ -71,11 +71,11 @@ wrap_functions!(sp_brightness_grid;
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
wrap_clone!(sp_brightness_grid::BrightnessGrid);
|
wrap_clone!(brightness_grid::BrightnessGrid);
|
||||||
wrap_free!(sp_brightness_grid::BrightnessGrid);
|
wrap_free!(brightness_grid::BrightnessGrid);
|
||||||
|
|
||||||
wrap_methods!(
|
wrap_methods!(
|
||||||
sp_brightness_grid::BrightnessGrid;
|
brightness_grid::BrightnessGrid;
|
||||||
|
|
||||||
/// Gets the current value at the specified position.
|
/// Gets the current value at the specified position.
|
||||||
///
|
///
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
||||||
use servicepoint::{CharGrid, CharGridCommand, Grid, Origin, Packet};
|
use servicepoint::{CharGrid, CharGridCommand, Grid, Origin, Packet};
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
|
||||||
wrap_functions!(sp_char_grid;
|
wrap_functions!(char_grid;
|
||||||
|
|
||||||
/// Creates a new [CharGrid] with the specified dimensions.
|
/// Creates a new [CharGrid] with the specified dimensions.
|
||||||
///
|
///
|
||||||
|
@ -58,11 +58,11 @@ wrap_functions!(sp_char_grid;
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
wrap_clone!(sp_char_grid::CharGrid);
|
wrap_clone!(char_grid::CharGrid);
|
||||||
wrap_free!(sp_char_grid::CharGrid);
|
wrap_free!(char_grid::CharGrid);
|
||||||
|
|
||||||
wrap_methods!(
|
wrap_methods!(
|
||||||
sp_char_grid::CharGrid;
|
char_grid::CharGrid;
|
||||||
|
|
||||||
/// Returns the current value at the specified position.
|
/// Returns the current value at the specified position.
|
||||||
///
|
///
|
||||||
|
|
|
@ -9,7 +9,7 @@ use servicepoint::{
|
||||||
};
|
};
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
|
||||||
wrap_functions!(sp_cp437_grid;
|
wrap_functions!(cp437_grid;
|
||||||
|
|
||||||
/// Creates a new [Cp437Grid] with the specified dimensions.
|
/// Creates a new [Cp437Grid] with the specified dimensions.
|
||||||
///
|
///
|
||||||
|
@ -50,11 +50,11 @@ wrap_functions!(sp_cp437_grid;
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
wrap_clone!(sp_cp437_grid::Cp437Grid);
|
wrap_clone!(cp437_grid::Cp437Grid);
|
||||||
wrap_free!(sp_cp437_grid::Cp437Grid);
|
wrap_free!(cp437_grid::Cp437Grid);
|
||||||
|
|
||||||
wrap_methods!(
|
wrap_methods!(
|
||||||
sp_cp437_grid::Cp437Grid;
|
cp437_grid::Cp437Grid;
|
||||||
/// Gets the current value at the specified position.
|
/// Gets the current value at the specified position.
|
||||||
///
|
///
|
||||||
/// # Arguments
|
/// # Arguments
|
||||||
|
|
|
@ -14,5 +14,6 @@ pub use cp437_grid::*;
|
||||||
|
|
||||||
mod _hidden {
|
mod _hidden {
|
||||||
/// This is a type only used by cbindgen to have a type for pointers.
|
/// This is a type only used by cbindgen to have a type for pointers.
|
||||||
|
#[allow(unused)]
|
||||||
pub struct DisplayBitVec;
|
pub struct DisplayBitVec;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
//!
|
//!
|
||||||
//! # Examples
|
//! # Examples
|
||||||
//!
|
//!
|
||||||
//! Make sure to check out [this GitHub repo](https://github.com/arfst23/ServicePoint) as well!
|
|
||||||
//!
|
|
||||||
//! ```C
|
//! ```C
|
||||||
//! #include <stdio.h>
|
//! #include <stdio.h>
|
||||||
//! #include "servicepoint.h"
|
//! #include "servicepoint.h"
|
||||||
|
@ -24,6 +22,8 @@
|
||||||
//! return 0;
|
//! return 0;
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
|
//!
|
||||||
|
//! There are more examples in the source repository.
|
||||||
|
|
||||||
/// Functions related to commands.
|
/// Functions related to commands.
|
||||||
pub mod commands;
|
pub mod commands;
|
||||||
|
@ -43,7 +43,7 @@ pub const SP_FRAME_PACING_MS: u128 = 30;
|
||||||
mod feature_env_logger {
|
mod feature_env_logger {
|
||||||
use crate::macros::wrap_functions;
|
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
|
/// 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/).
|
/// `RUST_LOG` environment variable. See [env_logger](https://docs.rs/env_logger/latest/env_logger/).
|
||||||
fn init() {
|
fn init() {
|
||||||
|
|
|
@ -223,7 +223,7 @@ macro_rules! wrap_functions {
|
||||||
#[doc = ""]
|
#[doc = ""]
|
||||||
#[doc = concat!(" This function is part of the ", stringify!($module), " module.")]
|
#[doc = concat!(" This function is part of the ", stringify!($module), " module.")]
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn [< $module _ $function >](
|
pub unsafe extern "C" fn [< sp_ $module _ $function >](
|
||||||
$($param_name: $param_type),*
|
$($param_name: $param_type),*
|
||||||
) $(-> $return_type)?
|
) $(-> $return_type)?
|
||||||
$block
|
$block
|
||||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
||||||
use servicepoint::{CommandCode, Header, Packet};
|
use servicepoint::{CommandCode, Header, Packet};
|
||||||
use std::ptr::NonNull;
|
use std::ptr::NonNull;
|
||||||
|
|
||||||
wrap_functions!(sp_packet;
|
wrap_functions!(packet;
|
||||||
|
|
||||||
/// Tries to load a [Packet] from the passed array with the specified length.
|
/// 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_clone!(packet::Packet);
|
||||||
wrap_free!(sp_packet::Packet);
|
wrap_free!(packet::Packet);
|
||||||
|
|
||||||
wrap_fields!(
|
wrap_fields!(
|
||||||
sp_packet::Packet;
|
packet::Packet;
|
||||||
prop header: Header {
|
prop header: Header {
|
||||||
get();
|
get();
|
||||||
mut get();
|
mut get();
|
||||||
|
|
|
@ -10,9 +10,9 @@ use std::{
|
||||||
ptr::NonNull,
|
ptr::NonNull,
|
||||||
};
|
};
|
||||||
|
|
||||||
wrap_free!(sp_udp::UdpSocket);
|
wrap_free!(udp::UdpSocket);
|
||||||
|
|
||||||
wrap_functions!(sp_udp;
|
wrap_functions!(udp;
|
||||||
|
|
||||||
/// Creates a new instance of [UdpSocket].
|
/// Creates a new instance of [UdpSocket].
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue