csbindgen one file per file
This commit is contained in:
		
							parent
							
								
									55aa7ecf4c
								
							
						
					
					
						commit
						01f2f90121
					
				
					 25 changed files with 1758 additions and 1558 deletions
				
			
		| 
						 | 
				
			
			@ -25,7 +25,7 @@
 | 
			
		|||
//! }
 | 
			
		||||
//! ```
 | 
			
		||||
 | 
			
		||||
pub use crate::bitvec::*;
 | 
			
		||||
pub use crate::bit_vec::*;
 | 
			
		||||
pub use crate::bitmap::*;
 | 
			
		||||
pub use crate::brightness_grid::*;
 | 
			
		||||
pub use crate::byte_slice::*;
 | 
			
		||||
| 
						 | 
				
			
			@ -35,7 +35,7 @@ pub use crate::constants::*;
 | 
			
		|||
pub use crate::cp437_grid::*;
 | 
			
		||||
pub use crate::packet::*;
 | 
			
		||||
 | 
			
		||||
mod bitvec;
 | 
			
		||||
mod bit_vec;
 | 
			
		||||
mod bitmap;
 | 
			
		||||
mod brightness_grid;
 | 
			
		||||
mod byte_slice;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@ test = false
 | 
			
		|||
 | 
			
		||||
[build-dependencies]
 | 
			
		||||
csbindgen = "1.9.3"
 | 
			
		||||
convert_case = "0.6.0"
 | 
			
		||||
 | 
			
		||||
[dependencies]
 | 
			
		||||
servicepoint_binding_c = { version = "0.10.0", path = "../servicepoint_binding_c" }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,247 @@
 | 
			
		|||
// <auto-generated>
 | 
			
		||||
// This code is generated by csbindgen.
 | 
			
		||||
// DON'T CHANGE THIS DIRECTLY.
 | 
			
		||||
// </auto-generated>
 | 
			
		||||
#pragma warning disable CS8500
 | 
			
		||||
#pragma warning disable CS8981
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace ServicePoint.BindGen
 | 
			
		||||
{
 | 
			
		||||
    public static unsafe partial class BitVecNative
 | 
			
		||||
    {
 | 
			
		||||
        const string __DllName = "servicepoint_binding_c";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Creates a new [SPBitVec] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `size`: size in bits.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: [SPBitVec] with all bits set to false. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `size` is not divisible by 8.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # 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_bitvec_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitvec_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPBitVec* sp_bitvec_new(nuint size);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Interpret the data as a series of bits and load then into a new [SPBitVec] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: [SPBitVec] instance containing data. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `data` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `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_bitvec_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitvec_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPBitVec* sp_bitvec_load(byte* data, nuint data_length);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Clones a [SPBitVec].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: new [SPBitVec] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bit_vec` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec` points to a valid [SPBitVec]
 | 
			
		||||
        ///  - `bit_vec` is not written to concurrently
 | 
			
		||||
        ///  - the returned instance is freed in some way, either by using a consuming function or
 | 
			
		||||
        ///    by explicitly calling `sp_bitvec_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitvec_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPBitVec* sp_bitvec_clone(SPBitVec* bit_vec);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Deallocates a [SPBitVec].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `but_vec` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec` points to a valid [SPBitVec]
 | 
			
		||||
        ///  - `bit_vec` is not used concurrently or after this call
 | 
			
		||||
        ///  - `bit_vec` was not passed to another consuming function, e.g. to create a [SPCommand]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitvec_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_bitvec_free(SPBitVec* bit_vec);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets the value of a bit from the [SPBitVec].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec`: instance to read from
 | 
			
		||||
        ///  - `index`: the bit index to read
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: value of the bit
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bit_vec` is NULL
 | 
			
		||||
        ///  - when accessing `index` out of bounds
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec` points to a valid [SPBitVec]
 | 
			
		||||
        ///  - `bit_vec` is not written to concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitvec_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        [return: MarshalAs(UnmanagedType.U1)]
 | 
			
		||||
        public static extern bool sp_bitvec_get(SPBitVec* bit_vec, nuint index);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Sets the value of a bit in the [SPBitVec].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec`: instance to write to
 | 
			
		||||
        ///  - `index`: the bit index to edit
 | 
			
		||||
        ///  - `value`: the value to set the bit to
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bit_vec` is NULL
 | 
			
		||||
        ///  - when accessing `index` out of bounds
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec` points to a valid [SPBitVec]
 | 
			
		||||
        ///  - `bit_vec` is not written to or read from concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitvec_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_bitvec_set(SPBitVec* bit_vec, nuint index, [MarshalAs(UnmanagedType.U1)] bool value);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Sets the value of all bits in the [SPBitVec].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec`: instance to write to
 | 
			
		||||
        ///  - `value`: the value to set all bits to
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bit_vec` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec` points to a valid [SPBitVec]
 | 
			
		||||
        ///  - `bit_vec` is not written to or read from concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitvec_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_bitvec_fill(SPBitVec* bit_vec, [MarshalAs(UnmanagedType.U1)] bool value);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets the length of the [SPBitVec] in bits.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec`: instance to write to
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bit_vec` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec` points to a valid [SPBitVec]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitvec_len", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern nuint sp_bitvec_len(SPBitVec* bit_vec);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Returns true if length is 0.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec`: instance to write to
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bit_vec` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec` points to a valid [SPBitVec]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitvec_is_empty", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        [return: MarshalAs(UnmanagedType.U1)]
 | 
			
		||||
        public static extern bool sp_bitvec_is_empty(SPBitVec* bit_vec);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets an unsafe reference to the data of the [SPBitVec] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec`: instance to write to
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bit_vec` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  ## Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bit_vec` 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
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitvec_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPByteSlice sp_bitvec_unsafe_data_ref(SPBitVec* bit_vec);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public unsafe partial struct SPBitVec
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,249 @@
 | 
			
		|||
// <auto-generated>
 | 
			
		||||
// This code is generated by csbindgen.
 | 
			
		||||
// DON'T CHANGE THIS DIRECTLY.
 | 
			
		||||
// </auto-generated>
 | 
			
		||||
#pragma warning disable CS8500
 | 
			
		||||
#pragma warning disable CS8981
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace ServicePoint.BindGen
 | 
			
		||||
{
 | 
			
		||||
    public static unsafe partial class BitmapNative
 | 
			
		||||
    {
 | 
			
		||||
        const string __DllName = "servicepoint_binding_c";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Creates a new [SPBitmap] with the specified dimensions.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `width`: size in pixels in x-direction
 | 
			
		||||
        ///  - `height`: size in pixels in y-direction
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: [SPBitmap] initialized to all pixels off. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when the width is not dividable by 8
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # 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_bitmap_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitmap_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPBitmap* sp_bitmap_new(nuint width, nuint height);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Loads a [SPBitmap] with the specified dimensions from the provided data.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `width`: size in pixels in x-direction
 | 
			
		||||
        ///  - `height`: size in pixels in y-direction
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: [SPBitmap] that contains a copy of the provided data. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `data` is NULL
 | 
			
		||||
        ///  - when the dimensions and data size do not match exactly.
 | 
			
		||||
        ///  - when the width is not dividable by 8
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `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_bitmap_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitmap_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPBitmap* sp_bitmap_load(nuint width, nuint height, byte* data, nuint data_length);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Clones a [SPBitmap].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bitmap` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap` points to a valid [SPBitmap]
 | 
			
		||||
        ///  - `bitmap` is not written to concurrently
 | 
			
		||||
        ///  - the returned instance is freed in some way, either by using a consuming function or
 | 
			
		||||
        ///    by explicitly calling `sp_bitmap_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitmap_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPBitmap* sp_bitmap_clone(SPBitmap* bitmap);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Deallocates a [SPBitmap].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bitmap` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap` points to a valid [SPBitmap]
 | 
			
		||||
        ///  - `bitmap` is not used concurrently or after bitmap call
 | 
			
		||||
        ///  - `bitmap` was not passed to another consuming function, e.g. to create a [SPCommand]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitmap_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_bitmap_free(SPBitmap* bitmap);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets the current value at the specified position in the [SPBitmap].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap`: instance to read from
 | 
			
		||||
        ///  - `x` and `y`: position of the cell to read
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bitmap` is NULL
 | 
			
		||||
        ///  - when accessing `x` or `y` out of bounds
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap` points to a valid [SPBitmap]
 | 
			
		||||
        ///  - `bitmap` is not written to concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitmap_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        [return: MarshalAs(UnmanagedType.U1)]
 | 
			
		||||
        public static extern bool sp_bitmap_get(SPBitmap* bitmap, nuint x, nuint y);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Sets the value of the specified position in the [SPBitmap].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap`: instance to write to
 | 
			
		||||
        ///  - `x` and `y`: position of the cell
 | 
			
		||||
        ///  - `value`: the value to write to the cell
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: old value of the cell
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bitmap` is NULL
 | 
			
		||||
        ///  - when accessing `x` or `y` out of bounds
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap` points to a valid [SPBitmap]
 | 
			
		||||
        ///  - `bitmap` is not written to or read from concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitmap_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_bitmap_set(SPBitmap* bitmap, nuint x, nuint y, [MarshalAs(UnmanagedType.U1)] bool value);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Sets the state of all pixels in the [SPBitmap].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap`: instance to write to
 | 
			
		||||
        ///  - `value`: the value to set all pixels to
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bitmap` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap` points to a valid [SPBitmap]
 | 
			
		||||
        ///  - `bitmap` is not written to or read from concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitmap_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_bitmap_fill(SPBitmap* bitmap, [MarshalAs(UnmanagedType.U1)] bool value);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets the width in pixels of the [SPBitmap] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap`: instance to read from
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bitmap` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap` points to a valid [SPBitmap]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitmap_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern nuint sp_bitmap_width(SPBitmap* bitmap);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets the height in pixels of the [SPBitmap] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap`: instance to read from
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bitmap` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap` points to a valid [SPBitmap]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitmap_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern nuint sp_bitmap_height(SPBitmap* bitmap);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets an unsafe reference to the data of the [SPBitmap] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bitmap` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap` points to a valid [SPBitmap]
 | 
			
		||||
        ///  - the returned memory range is never accessed after the passed [SPBitmap] has been freed
 | 
			
		||||
        ///  - the returned memory range is never accessed concurrently, either via the [SPBitmap] or directly
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_bitmap_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPByteSlice sp_bitmap_unsafe_data_ref(SPBitmap* bitmap);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public unsafe partial struct SPBitmap
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,259 @@
 | 
			
		|||
// <auto-generated>
 | 
			
		||||
// This code is generated by csbindgen.
 | 
			
		||||
// DON'T CHANGE THIS DIRECTLY.
 | 
			
		||||
// </auto-generated>
 | 
			
		||||
#pragma warning disable CS8500
 | 
			
		||||
#pragma warning disable CS8981
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace ServicePoint.BindGen
 | 
			
		||||
{
 | 
			
		||||
    public static unsafe partial class BrightnessGridNative
 | 
			
		||||
    {
 | 
			
		||||
        const string __DllName = "servicepoint_binding_c";
 | 
			
		||||
 | 
			
		||||
        public const byte SP_BRIGHTNESS_MIN = 0;
 | 
			
		||||
        public const byte SP_BRIGHTNESS_MAX = 11;
 | 
			
		||||
        public const byte SP_BRIGHTNESS_LEVELS = 12;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Creates a new [SPBrightnessGrid] with the specified dimensions.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: [SPBrightnessGrid] initialized to 0. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # 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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_brightness_grid_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPBrightnessGrid* sp_brightness_grid_new(nuint width, nuint height);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Loads a [SPBrightnessGrid] with the specified dimensions from the provided data.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: new [SPBrightnessGrid] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `data` is NULL
 | 
			
		||||
        ///  - when the provided `data_length` does not match `height` and `width`
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_brightness_grid_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPBrightnessGrid* sp_brightness_grid_load(nuint width, nuint height, byte* data, nuint data_length);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Clones a [SPBrightnessGrid].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid`: instance to read from
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: new [SPBrightnessGrid] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `brightness_grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid` points to a valid [SPBrightnessGrid]
 | 
			
		||||
        ///  - `brightness_grid` 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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_brightness_grid_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPBrightnessGrid* sp_brightness_grid_clone(SPBrightnessGrid* brightness_grid);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Deallocates a [SPBrightnessGrid].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid`: instance to read from
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `brightness_grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid` points to a valid [SPBrightnessGrid]
 | 
			
		||||
        ///  - `brightness_grid` is not used concurrently or after this call
 | 
			
		||||
        ///  - `brightness_grid` was not passed to another consuming function, e.g. to create a [SPCommand]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_brightness_grid_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_brightness_grid_free(SPBrightnessGrid* brightness_grid);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets the current value at the specified position.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid`: instance to read from
 | 
			
		||||
        ///  - `x` and `y`: position of the cell to read
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: value at position
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `brightness_grid` is NULL
 | 
			
		||||
        ///  - When accessing `x` or `y` out of bounds.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid` points to a valid [SPBrightnessGrid]
 | 
			
		||||
        ///  - `brightness_grid` is not written to concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_brightness_grid_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern byte sp_brightness_grid_get(SPBrightnessGrid* brightness_grid, nuint x, nuint y);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Sets the value of the specified position in the [SPBrightnessGrid].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid`: instance to write to
 | 
			
		||||
        ///  - `x` and `y`: position of the cell
 | 
			
		||||
        ///  - `value`: the value to write to the cell
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: old value of the cell
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `brightness_grid` is NULL
 | 
			
		||||
        ///  - When accessing `x` or `y` out of bounds.
 | 
			
		||||
        ///  - When providing an invalid brightness value
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid` points to a valid [SPBitVec]
 | 
			
		||||
        ///  - `brightness_grid` is not written to or read from concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_brightness_grid_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_brightness_grid_set(SPBrightnessGrid* brightness_grid, nuint x, nuint y, byte value);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Sets the value of all cells in the [SPBrightnessGrid].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid`: instance to write to
 | 
			
		||||
        ///  - `value`: the value to set all cells to
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `brightness_grid` is NULL
 | 
			
		||||
        ///  - When providing an invalid brightness value
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid` points to a valid [SPBrightnessGrid]
 | 
			
		||||
        ///  - `brightness_grid` is not written to or read from concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_brightness_grid_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_brightness_grid_fill(SPBrightnessGrid* brightness_grid, byte value);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets the width of the [SPBrightnessGrid] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid`: instance to read from
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: width
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `brightness_grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid` points to a valid [SPBrightnessGrid]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_brightness_grid_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern nuint sp_brightness_grid_width(SPBrightnessGrid* brightness_grid);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets the height of the [SPBrightnessGrid] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid`: instance to read from
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: height
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `brightness_grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid` points to a valid [SPBrightnessGrid]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_brightness_grid_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern nuint sp_brightness_grid_height(SPBrightnessGrid* brightness_grid);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets an unsafe reference to the data of the [SPBrightnessGrid] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid`: instance to read from
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: slice of bytes underlying the `brightness_grid`.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `brightness_grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `brightness_grid` 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
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_brightness_grid_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPByteSlice sp_brightness_grid_unsafe_data_ref(SPBrightnessGrid* brightness_grid);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public unsafe partial struct SPBrightnessGrid
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,24 @@
 | 
			
		|||
// <auto-generated>
 | 
			
		||||
// This code is generated by csbindgen.
 | 
			
		||||
// DON'T CHANGE THIS DIRECTLY.
 | 
			
		||||
// </auto-generated>
 | 
			
		||||
#pragma warning disable CS8500
 | 
			
		||||
#pragma warning disable CS8981
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace ServicePoint.BindGen
 | 
			
		||||
{
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public unsafe partial struct SPByteSlice
 | 
			
		||||
    {
 | 
			
		||||
        public byte* start;
 | 
			
		||||
        public nuint length;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,364 @@
 | 
			
		|||
// <auto-generated>
 | 
			
		||||
// This code is generated by csbindgen.
 | 
			
		||||
// DON'T CHANGE THIS DIRECTLY.
 | 
			
		||||
// </auto-generated>
 | 
			
		||||
#pragma warning disable CS8500
 | 
			
		||||
#pragma warning disable CS8981
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace ServicePoint.BindGen
 | 
			
		||||
{
 | 
			
		||||
    public static unsafe partial class CommandNative
 | 
			
		||||
    {
 | 
			
		||||
        const string __DllName = "servicepoint_binding_c";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Tries to turn a [SPPacket] into a [SPCommand].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The packet is deallocated in the process.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: pointer to new [SPCommand] instance or NULL if parsing failed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `packet` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - [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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_try_from_packet", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_try_from_packet(SPPacket* packet);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Clones a [SPCommand] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: new [SPCommand] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `command` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `command` points to a valid instance of [SPCommand]
 | 
			
		||||
        ///  - `command` is not written to concurrently
 | 
			
		||||
        ///  - the returned [SPCommand] instance is freed in some way, either by using a consuming function or
 | 
			
		||||
        ///    by explicitly calling `sp_command_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_clone(SPCommand* command);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Set all pixels to the off state.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Does not affect brightness.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: a new [Command::Clear] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Examples
 | 
			
		||||
        ///
 | 
			
		||||
        ///  ```C
 | 
			
		||||
        ///  sp_connection_send_command(connection, sp_command_clear());
 | 
			
		||||
        ///  ```
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_clear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_clear();
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Kills the udp daemon on the display, which usually results in a restart.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Please do not send this in your normal program flow.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: a new [Command::HardReset] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_hard_reset", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_hard_reset();
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  A yet-to-be-tested command.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: a new `Command::FadeOut` instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_fade_out", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_fade_out();
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Set the brightness of all tiles to the same value.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: a new [Command::Brightness] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - When the provided brightness value is out of range (0-11).
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_brightness(byte brightness);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Set the brightness of individual tiles in a rectangular area of the display.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The passed [SPBrightnessGrid] gets consumed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: a new [Command::CharBrightness] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `grid` points to a valid instance of [SPBrightnessGrid]
 | 
			
		||||
        ///  - `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`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_char_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_char_brightness(nuint x, nuint y, SPBrightnessGrid* grid);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  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 [SPBitVec] is always uncompressed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The passed [SPBitVec] gets consumed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: a new [Command::BitmapLinear] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bit_vec` is null
 | 
			
		||||
        ///  - when `compression_code` is not a valid value
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `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 [SPCommand] instance is freed in some way, either by using a consuming function or
 | 
			
		||||
        ///    by explicitly calling `sp_command_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_bitmap_linear(nuint offset, SPBitVec* bit_vec, SPCompressionCode compression);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  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 [SPBitVec] is always uncompressed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The passed [SPBitVec] gets consumed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: a new [Command::BitmapLinearAnd] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bit_vec` is null
 | 
			
		||||
        ///  - when `compression_code` is not a valid value
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `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 [SPCommand] instance is freed in some way, either by using a consuming function or
 | 
			
		||||
        ///    by explicitly calling `sp_command_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_and", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_bitmap_linear_and(nuint offset, SPBitVec* bit_vec, SPCompressionCode compression);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  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 [SPBitVec] is always uncompressed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The passed [SPBitVec] gets consumed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: a new [Command::BitmapLinearOr] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bit_vec` is null
 | 
			
		||||
        ///  - when `compression_code` is not a valid value
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `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 [SPCommand] instance is freed in some way, either by using a consuming function or
 | 
			
		||||
        ///    by explicitly calling `sp_command_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_or", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_bitmap_linear_or(nuint offset, SPBitVec* bit_vec, SPCompressionCode compression);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  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 [SPBitVec] is always uncompressed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The passed [SPBitVec] gets consumed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: a new [Command::BitmapLinearXor] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bit_vec` is null
 | 
			
		||||
        ///  - when `compression_code` is not a valid value
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `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 [SPCommand] instance is freed in some way, either by using a consuming function or
 | 
			
		||||
        ///    by explicitly calling `sp_command_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_xor", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_bitmap_linear_xor(nuint offset, SPBitVec* bit_vec, SPCompressionCode compression);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Show text on the screen.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The passed [SPCp437Grid] gets consumed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: a new [Command::Cp437Data] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `grid` is null
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `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`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_cp437_data", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_cp437_data(nuint x, nuint y, SPCp437Grid* grid);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Sets a window of pixels to the specified values.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The passed [SPBitmap] gets consumed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Returns: a new [Command::BitmapLinearWin] instance. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `bitmap` is null
 | 
			
		||||
        ///  - when `compression_code` is not a valid value
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `bitmap` points to a valid instance of [SPBitmap]
 | 
			
		||||
        ///  - `bitmap` is not used concurrently or after this call
 | 
			
		||||
        ///  - `compression` matches one of the allowed enum values
 | 
			
		||||
        ///  - the returned [SPCommand] instance is freed in some way, either by using a consuming function or
 | 
			
		||||
        ///    by explicitly calling `sp_command_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_win", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCommand* sp_command_bitmap_linear_win(nuint x, nuint y, SPBitmap* bitmap, SPCompressionCode compression_code);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Deallocates a [SPCommand].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Examples
 | 
			
		||||
        ///
 | 
			
		||||
        ///  ```C
 | 
			
		||||
        ///  SPCommand c = sp_command_clear();
 | 
			
		||||
        ///  sp_command_free(c);
 | 
			
		||||
        ///  ```
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `command` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `command` points to a valid [SPCommand]
 | 
			
		||||
        ///  - `command` is not used concurrently or after this call
 | 
			
		||||
        ///  - `command` was not passed to another consuming function, e.g. to create a [SPPacket]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_command_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_command_free(SPCommand* command);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public unsafe partial struct SPCommand
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,113 @@
 | 
			
		|||
// <auto-generated>
 | 
			
		||||
// This code is generated by csbindgen.
 | 
			
		||||
// DON'T CHANGE THIS DIRECTLY.
 | 
			
		||||
// </auto-generated>
 | 
			
		||||
#pragma warning disable CS8500
 | 
			
		||||
#pragma warning disable CS8981
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace ServicePoint.BindGen
 | 
			
		||||
{
 | 
			
		||||
    public static unsafe partial class ConnectionNative
 | 
			
		||||
    {
 | 
			
		||||
        const string __DllName = "servicepoint_binding_c";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Creates a new instance of [SPConnection].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: NULL if connection fails, or connected instance
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `host` is null or an invalid host
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # 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_connection_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_connection_open", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPConnection* sp_connection_open(byte* host);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Sends a [SPPacket] to the display using the [SPConnection].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The passed `packet` gets consumed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: true in case of success
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `connection` is NULL
 | 
			
		||||
        ///  - when `packet` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `connection` points to a valid instance of [SPConnection]
 | 
			
		||||
        ///  - `packet` points to a valid instance of [SPPacket]
 | 
			
		||||
        ///  - `packet` is not used concurrently or after this call
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_connection_send_packet", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        [return: MarshalAs(UnmanagedType.U1)]
 | 
			
		||||
        public static extern bool sp_connection_send_packet(SPConnection* connection, SPPacket* packet);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Sends a [SPCommand] to the display using the [SPConnection].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The passed `command` gets consumed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: true in case of success
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `connection` is NULL
 | 
			
		||||
        ///  - when `command` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `connection` points to a valid instance of [SPConnection]
 | 
			
		||||
        ///  - `command` points to a valid instance of [SPPacket]
 | 
			
		||||
        ///  - `command` is not used concurrently or after this call
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_connection_send_command", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        [return: MarshalAs(UnmanagedType.U1)]
 | 
			
		||||
        public static extern bool sp_connection_send_command(SPConnection* connection, SPCommand* command);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Closes and deallocates a [SPConnection].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `connection` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `connection` points to a valid [SPConnection]
 | 
			
		||||
        ///  - `connection` is not used concurrently or after this call
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_connection_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_connection_free(SPConnection* connection);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public unsafe partial struct SPConnection
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
// <auto-generated>
 | 
			
		||||
// This code is generated by csbindgen.
 | 
			
		||||
// DON'T CHANGE THIS DIRECTLY.
 | 
			
		||||
// </auto-generated>
 | 
			
		||||
#pragma warning disable CS8500
 | 
			
		||||
#pragma warning disable CS8981
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace ServicePoint.BindGen
 | 
			
		||||
{
 | 
			
		||||
    public static unsafe partial class ConstantsNative
 | 
			
		||||
    {
 | 
			
		||||
        const string __DllName = "servicepoint_binding_c";
 | 
			
		||||
 | 
			
		||||
        public const nuint SP_TILE_SIZE = 8;
 | 
			
		||||
        public const nuint SP_TILE_WIDTH = 56;
 | 
			
		||||
        public const nuint SP_TILE_HEIGHT = 20;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public enum SPCompressionCode : ushort
 | 
			
		||||
    {
 | 
			
		||||
        Uncompressed = 0,
 | 
			
		||||
        Zlib = 26490,
 | 
			
		||||
        Bzip2 = 25210,
 | 
			
		||||
        Lzma = 27770,
 | 
			
		||||
        Zstd = 31347,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,236 @@
 | 
			
		|||
// <auto-generated>
 | 
			
		||||
// This code is generated by csbindgen.
 | 
			
		||||
// DON'T CHANGE THIS DIRECTLY.
 | 
			
		||||
// </auto-generated>
 | 
			
		||||
#pragma warning disable CS8500
 | 
			
		||||
#pragma warning disable CS8981
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace ServicePoint.BindGen
 | 
			
		||||
{
 | 
			
		||||
    public static unsafe partial class Cp437GridNative
 | 
			
		||||
    {
 | 
			
		||||
        const string __DllName = "servicepoint_binding_c";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Creates a new [SPCp437Grid] with the specified dimensions.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: [SPCp437Grid] initialized to 0. Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # 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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_cp437_grid_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCp437Grid* sp_cp437_grid_new(nuint width, nuint height);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Loads a [SPCp437Grid] with the specified dimensions from the provided data.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `data` is NULL
 | 
			
		||||
        ///  - when the provided `data_length` does not match `height` and `width`
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_cp437_grid_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCp437Grid* sp_cp437_grid_load(nuint width, nuint height, byte* data, nuint data_length);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Clones a [SPCp437Grid].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `cp437_grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid` points to a valid [SPCp437Grid]
 | 
			
		||||
        ///  - `cp437_grid` 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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_cp437_grid_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPCp437Grid* sp_cp437_grid_clone(SPCp437Grid* cp437_grid);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Deallocates a [SPCp437Grid].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `cp437_grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid` points to a valid [SPCp437Grid]
 | 
			
		||||
        ///  - `cp437_grid` is not used concurrently or after cp437_grid call
 | 
			
		||||
        ///  - `cp437_grid` was not passed to another consuming function, e.g. to create a [SPCommand]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_cp437_grid_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_cp437_grid_free(SPCp437Grid* cp437_grid);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets the current value at the specified position.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid`: instance to read from
 | 
			
		||||
        ///  - `x` and `y`: position of the cell to read
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `cp437_grid` is NULL
 | 
			
		||||
        ///  - when accessing `x` or `y` out of bounds
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid` points to a valid [SPCp437Grid]
 | 
			
		||||
        ///  - `cp437_grid` is not written to concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_cp437_grid_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern byte sp_cp437_grid_get(SPCp437Grid* cp437_grid, nuint x, nuint y);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Sets the value of the specified position in the [SPCp437Grid].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid`: instance to write to
 | 
			
		||||
        ///  - `x` and `y`: position of the cell
 | 
			
		||||
        ///  - `value`: the value to write to the cell
 | 
			
		||||
        ///
 | 
			
		||||
        ///  returns: old value of the cell
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `cp437_grid` is NULL
 | 
			
		||||
        ///  - when accessing `x` or `y` out of bounds
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid` points to a valid [SPBitVec]
 | 
			
		||||
        ///  - `cp437_grid` is not written to or read from concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_cp437_grid_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_cp437_grid_set(SPCp437Grid* cp437_grid, nuint x, nuint y, byte value);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Sets the value of all cells in the [SPCp437Grid].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid`: instance to write to
 | 
			
		||||
        ///  - `value`: the value to set all cells to
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `cp437_grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid` points to a valid [SPCp437Grid]
 | 
			
		||||
        ///  - `cp437_grid` is not written to or read from concurrently
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_cp437_grid_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_cp437_grid_fill(SPCp437Grid* cp437_grid, byte value);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets the width of the [SPCp437Grid] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid`: instance to read from
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `cp437_grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid` points to a valid [SPCp437Grid]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_cp437_grid_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern nuint sp_cp437_grid_width(SPCp437Grid* cp437_grid);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets the height of the [SPCp437Grid] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Arguments
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid`: instance to read from
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `cp437_grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid` points to a valid [SPCp437Grid]
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_cp437_grid_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern nuint sp_cp437_grid_height(SPCp437Grid* cp437_grid);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Gets an unsafe reference to the data of the [SPCp437Grid] instance.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `cp437_grid` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  ## Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `cp437_grid` 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
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_cp437_grid_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPByteSlice sp_cp437_grid_unsafe_data_ref(SPCp437Grid* cp437_grid);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public unsafe partial struct SPCp437Grid
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,17 @@
 | 
			
		|||
// <auto-generated>
 | 
			
		||||
// This code is generated by csbindgen.
 | 
			
		||||
// DON'T CHANGE THIS DIRECTLY.
 | 
			
		||||
// </auto-generated>
 | 
			
		||||
#pragma warning disable CS8500
 | 
			
		||||
#pragma warning disable CS8981
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace ServicePoint.BindGen
 | 
			
		||||
{
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,110 @@
 | 
			
		|||
// <auto-generated>
 | 
			
		||||
// This code is generated by csbindgen.
 | 
			
		||||
// DON'T CHANGE THIS DIRECTLY.
 | 
			
		||||
// </auto-generated>
 | 
			
		||||
#pragma warning disable CS8500
 | 
			
		||||
#pragma warning disable CS8981
 | 
			
		||||
using System;
 | 
			
		||||
using System.Runtime.InteropServices;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace ServicePoint.BindGen
 | 
			
		||||
{
 | 
			
		||||
    public static unsafe partial class PacketNative
 | 
			
		||||
    {
 | 
			
		||||
        const string __DllName = "servicepoint_binding_c";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Turns a [SPCommand] into a [SPPacket].
 | 
			
		||||
        ///  The [SPCommand] gets consumed.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `command` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - [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`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_packet_from_command", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPPacket* sp_packet_from_command(SPCommand* command);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  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
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `data` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `data` points to a valid memory region of at least `length` bytes
 | 
			
		||||
        ///  - `data` is not written to concurrently
 | 
			
		||||
        ///  - the returned [SPPacket] instance is freed in some way, either by using a consuming function or
 | 
			
		||||
        ///    by explicitly calling `sp_packet_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_packet_try_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPPacket* sp_packet_try_load(byte* data, nuint length);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Clones a [SPPacket].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  Will never return NULL.
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `packet` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `packet` points to a valid [SPPacket]
 | 
			
		||||
        ///  - `packet` 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_free`.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_packet_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern SPPacket* sp_packet_clone(SPPacket* packet);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///  Deallocates a [SPPacket].
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Panics
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - when `sp_packet_free` is NULL
 | 
			
		||||
        ///
 | 
			
		||||
        ///  # Safety
 | 
			
		||||
        ///
 | 
			
		||||
        ///  The caller has to make sure that:
 | 
			
		||||
        ///
 | 
			
		||||
        ///  - `packet` points to a valid [SPPacket]
 | 
			
		||||
        ///  - `packet` is not used concurrently or after this call
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        [DllImport(__DllName, EntryPoint = "sp_packet_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
 | 
			
		||||
        public static extern void sp_packet_free(SPPacket* packet);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    [StructLayout(LayoutKind.Sequential)]
 | 
			
		||||
    public unsafe partial struct SPPacket
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
				
			
			@ -2,13 +2,13 @@ using ServicePoint.BindGen;
 | 
			
		|||
 | 
			
		||||
namespace ServicePoint;
 | 
			
		||||
 | 
			
		||||
public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
 | 
			
		||||
public sealed class BitVec : SpNativeInstance<SPBitVec>
 | 
			
		||||
{
 | 
			
		||||
    public static BitVec New(nuint size)
 | 
			
		||||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new BitVec(NativeMethods.sp_bitvec_new(size));
 | 
			
		||||
            return new BitVec(BitVecNative.sp_bitvec_new(size));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +18,7 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
 | 
			
		|||
        {
 | 
			
		||||
            fixed (byte* bytesPtr = bytes)
 | 
			
		||||
            {
 | 
			
		||||
                return new BitVec(NativeMethods.sp_bitvec_load(bytesPtr, (nuint)bytes.Length));
 | 
			
		||||
                return new BitVec(BitVecNative.sp_bitvec_load(bytesPtr, (nuint)bytes.Length));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -27,7 +27,7 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new BitVec(NativeMethods.sp_bitvec_clone(Instance));
 | 
			
		||||
            return new BitVec(BitVecNative.sp_bitvec_clone(Instance));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -37,14 +37,14 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                return NativeMethods.sp_bitvec_get(Instance, index);
 | 
			
		||||
                return BitVecNative.sp_bitvec_get(Instance, index);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        set
 | 
			
		||||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                NativeMethods.sp_bitvec_set(Instance, index, value);
 | 
			
		||||
                BitVecNative.sp_bitvec_set(Instance, index, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -53,7 +53,7 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            NativeMethods.sp_bitvec_fill(Instance, value);
 | 
			
		||||
            BitVecNative.sp_bitvec_fill(Instance, value);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -63,7 +63,7 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                return NativeMethods.sp_bitvec_len(Instance);
 | 
			
		||||
                return BitVecNative.sp_bitvec_len(Instance);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -74,15 +74,15 @@ public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                var slice = NativeMethods.sp_bitvec_unsafe_data_ref(Instance);
 | 
			
		||||
                var slice = BitVecNative.sp_bitvec_unsafe_data_ref(Instance);
 | 
			
		||||
                return new Span<byte>(slice.start, (int)slice.length);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private unsafe BitVec(BindGen.BitVec* instance) : base(instance)
 | 
			
		||||
    private unsafe BitVec(SPBitVec* instance) : base(instance)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private protected override unsafe void Free() => NativeMethods.sp_bitvec_free(Instance);
 | 
			
		||||
    private protected override unsafe void Free() => BitVecNative.sp_bitvec_free(Instance);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,13 +2,13 @@ using ServicePoint.BindGen;
 | 
			
		|||
 | 
			
		||||
namespace ServicePoint;
 | 
			
		||||
 | 
			
		||||
public sealed class Bitmap : SpNativeInstance<BindGen.Bitmap>
 | 
			
		||||
public sealed class Bitmap : SpNativeInstance<SPBitmap>
 | 
			
		||||
{
 | 
			
		||||
    public static Bitmap New(nuint width, nuint height)
 | 
			
		||||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Bitmap(NativeMethods.sp_bitmap_new(width, height));
 | 
			
		||||
            return new Bitmap(BitmapNative.sp_bitmap_new(width, height));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +18,7 @@ public sealed class Bitmap : SpNativeInstance<BindGen.Bitmap>
 | 
			
		|||
        {
 | 
			
		||||
            fixed (byte* bytesPtr = bytes)
 | 
			
		||||
            {
 | 
			
		||||
                return new Bitmap(NativeMethods.sp_bitmap_load(width, height, bytesPtr,
 | 
			
		||||
                return new Bitmap(BitmapNative.sp_bitmap_load(width, height, bytesPtr,
 | 
			
		||||
                    (nuint)bytes.Length));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ public sealed class Bitmap : SpNativeInstance<BindGen.Bitmap>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Bitmap(NativeMethods.sp_bitmap_clone(Instance));
 | 
			
		||||
            return new Bitmap(BitmapNative.sp_bitmap_clone(Instance));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -38,14 +38,14 @@ public sealed class Bitmap : SpNativeInstance<BindGen.Bitmap>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                return NativeMethods.sp_bitmap_get(Instance, x, y);
 | 
			
		||||
                return BitmapNative.sp_bitmap_get(Instance, x, y);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        set
 | 
			
		||||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                NativeMethods.sp_bitmap_set(Instance, x, y, value);
 | 
			
		||||
                BitmapNative.sp_bitmap_set(Instance, x, y, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -54,7 +54,7 @@ public sealed class Bitmap : SpNativeInstance<BindGen.Bitmap>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            NativeMethods.sp_bitmap_fill(Instance, value);
 | 
			
		||||
            BitmapNative.sp_bitmap_fill(Instance, value);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -64,7 +64,7 @@ public sealed class Bitmap : SpNativeInstance<BindGen.Bitmap>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                return NativeMethods.sp_bitmap_width(Instance);
 | 
			
		||||
                return BitmapNative.sp_bitmap_width(Instance);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -75,7 +75,7 @@ public sealed class Bitmap : SpNativeInstance<BindGen.Bitmap>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                return NativeMethods.sp_bitmap_height(Instance);
 | 
			
		||||
                return BitmapNative.sp_bitmap_height(Instance);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -86,15 +86,15 @@ public sealed class Bitmap : SpNativeInstance<BindGen.Bitmap>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                var slice = NativeMethods.sp_bitmap_unsafe_data_ref(Instance);
 | 
			
		||||
                var slice = BitmapNative.sp_bitmap_unsafe_data_ref(Instance);
 | 
			
		||||
                return new Span<byte>(slice.start, (int)slice.length);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private unsafe Bitmap(BindGen.Bitmap* instance) : base(instance)
 | 
			
		||||
    private unsafe Bitmap(SPBitmap* instance) : base(instance)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private protected override unsafe void Free() => NativeMethods.sp_bitmap_free(Instance);
 | 
			
		||||
    private protected override unsafe void Free() => BitmapNative.sp_bitmap_free(Instance);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,13 +2,13 @@ using ServicePoint.BindGen;
 | 
			
		|||
 | 
			
		||||
namespace ServicePoint;
 | 
			
		||||
 | 
			
		||||
public sealed class BrightnessGrid : SpNativeInstance<BindGen.BrightnessGrid>
 | 
			
		||||
public sealed class BrightnessGrid : SpNativeInstance<SPBrightnessGrid>
 | 
			
		||||
{
 | 
			
		||||
    public static BrightnessGrid New(nuint width, nuint height)
 | 
			
		||||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new BrightnessGrid(NativeMethods.sp_brightness_grid_new(width, height));
 | 
			
		||||
            return new BrightnessGrid(BrightnessGridNative.sp_brightness_grid_new(width, height));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +18,7 @@ public sealed class BrightnessGrid : SpNativeInstance<BindGen.BrightnessGrid>
 | 
			
		|||
        {
 | 
			
		||||
            fixed (byte* bytesPtr = bytes)
 | 
			
		||||
            {
 | 
			
		||||
                return new BrightnessGrid(NativeMethods.sp_brightness_grid_load(width, height, bytesPtr,
 | 
			
		||||
                return new BrightnessGrid(BrightnessGridNative.sp_brightness_grid_load(width, height, bytesPtr,
 | 
			
		||||
                    (nuint)bytes.Length));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ public sealed class BrightnessGrid : SpNativeInstance<BindGen.BrightnessGrid>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new BrightnessGrid(NativeMethods.sp_brightness_grid_clone(Instance));
 | 
			
		||||
            return new BrightnessGrid(BrightnessGridNative.sp_brightness_grid_clone(Instance));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -38,14 +38,14 @@ public sealed class BrightnessGrid : SpNativeInstance<BindGen.BrightnessGrid>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                return NativeMethods.sp_brightness_grid_get(Instance, x, y);
 | 
			
		||||
                return BrightnessGridNative.sp_brightness_grid_get(Instance, x, y);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        set
 | 
			
		||||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                NativeMethods.sp_brightness_grid_set(Instance, x, y, value);
 | 
			
		||||
                BrightnessGridNative.sp_brightness_grid_set(Instance, x, y, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -54,7 +54,7 @@ public sealed class BrightnessGrid : SpNativeInstance<BindGen.BrightnessGrid>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            NativeMethods.sp_brightness_grid_fill(Instance, value);
 | 
			
		||||
            BrightnessGridNative.sp_brightness_grid_fill(Instance, value);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -64,7 +64,7 @@ public sealed class BrightnessGrid : SpNativeInstance<BindGen.BrightnessGrid>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                return NativeMethods.sp_brightness_grid_width(Instance);
 | 
			
		||||
                return BrightnessGridNative.sp_brightness_grid_width(Instance);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -75,7 +75,7 @@ public sealed class BrightnessGrid : SpNativeInstance<BindGen.BrightnessGrid>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                return NativeMethods.sp_brightness_grid_height(Instance);
 | 
			
		||||
                return BrightnessGridNative.sp_brightness_grid_height(Instance);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -86,15 +86,15 @@ public sealed class BrightnessGrid : SpNativeInstance<BindGen.BrightnessGrid>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                var slice = NativeMethods.sp_brightness_grid_unsafe_data_ref(Instance);
 | 
			
		||||
                var slice = BrightnessGridNative.sp_brightness_grid_unsafe_data_ref(Instance);
 | 
			
		||||
                return new Span<byte>(slice.start, (int)slice.length);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private unsafe BrightnessGrid(BindGen.BrightnessGrid* instance) : base(instance)
 | 
			
		||||
    private unsafe BrightnessGrid(SPBrightnessGrid* instance) : base(instance)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private protected override unsafe void Free() => NativeMethods.sp_brightness_grid_free(Instance);
 | 
			
		||||
    private protected override unsafe void Free() => BrightnessGridNative.sp_brightness_grid_free(Instance);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,13 +3,13 @@ using ServicePoint.BindGen;
 | 
			
		|||
 | 
			
		||||
namespace ServicePoint;
 | 
			
		||||
 | 
			
		||||
public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		||||
public sealed class Command : SpNativeInstance<SPCommand>
 | 
			
		||||
{
 | 
			
		||||
    public static bool TryFromPacket(Packet packet, [MaybeNullWhen(false)] out Command command)
 | 
			
		||||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            var result = NativeMethods.sp_command_try_from_packet(packet.Into());
 | 
			
		||||
            var result = CommandNative.sp_command_try_from_packet(packet.Into());
 | 
			
		||||
            if (result == null)
 | 
			
		||||
            {
 | 
			
		||||
                command = null;
 | 
			
		||||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(NativeMethods.sp_command_clone(Instance));
 | 
			
		||||
            return new Command(CommandNative.sp_command_clone(Instance));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(NativeMethods.sp_command_clear());
 | 
			
		||||
            return new Command(CommandNative.sp_command_clear());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(NativeMethods.sp_command_hard_reset());
 | 
			
		||||
            return new Command(CommandNative.sp_command_hard_reset());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +49,7 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(NativeMethods.sp_command_fade_out());
 | 
			
		||||
            return new Command(CommandNative.sp_command_fade_out());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -57,7 +57,7 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(NativeMethods.sp_command_brightness(brightness));
 | 
			
		||||
            return new Command(CommandNative.sp_command_brightness(brightness));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -65,7 +65,7 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(NativeMethods.sp_command_char_brightness(x, y, grid.Into()));
 | 
			
		||||
            return new Command(CommandNative.sp_command_char_brightness(x, y, grid.Into()));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -74,7 +74,7 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(
 | 
			
		||||
                NativeMethods.sp_command_bitmap_linear(offset, bitVec.Into(), compressionCode));
 | 
			
		||||
                CommandNative.sp_command_bitmap_linear(offset, bitVec.Into(), compressionCode));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -83,7 +83,7 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(
 | 
			
		||||
                NativeMethods.sp_command_bitmap_linear_and(offset, bitVec.Into(), compressionCode));
 | 
			
		||||
                CommandNative.sp_command_bitmap_linear_and(offset, bitVec.Into(), compressionCode));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -92,7 +92,7 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(
 | 
			
		||||
                NativeMethods.sp_command_bitmap_linear_or(offset, bitVec.Into(), compressionCode));
 | 
			
		||||
                CommandNative.sp_command_bitmap_linear_or(offset, bitVec.Into(), compressionCode));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -101,7 +101,7 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(
 | 
			
		||||
                NativeMethods.sp_command_bitmap_linear_xor(offset, bitVec.Into(), compressionCode));
 | 
			
		||||
                CommandNative.sp_command_bitmap_linear_xor(offset, bitVec.Into(), compressionCode));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -109,7 +109,7 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(NativeMethods.sp_command_bitmap_linear_win(x, y, bitmap.Into(), compression));
 | 
			
		||||
            return new Command(CommandNative.sp_command_bitmap_linear_win(x, y, bitmap.Into(), compression));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -117,13 +117,13 @@ public sealed class Command : SpNativeInstance<BindGen.Command>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Command(NativeMethods.sp_command_cp437_data(x, y, byteGrid.Into()));
 | 
			
		||||
            return new Command(CommandNative.sp_command_cp437_data(x, y, byteGrid.Into()));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private unsafe Command(BindGen.Command* instance) : base(instance)
 | 
			
		||||
    private unsafe Command(SPCommand* instance) : base(instance)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private protected override unsafe void Free() => NativeMethods.sp_command_free(Instance);
 | 
			
		||||
    private protected override unsafe void Free() => CommandNative.sp_command_free(Instance);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@ using ServicePoint.BindGen;
 | 
			
		|||
 | 
			
		||||
namespace ServicePoint;
 | 
			
		||||
 | 
			
		||||
public sealed class Connection : SpNativeInstance<BindGen.Connection>
 | 
			
		||||
public sealed class Connection : SpNativeInstance<SPConnection>
 | 
			
		||||
{
 | 
			
		||||
    public static Connection Open(string host)
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ public sealed class Connection : SpNativeInstance<BindGen.Connection>
 | 
			
		|||
        {
 | 
			
		||||
            fixed (byte* bytePtr = Encoding.UTF8.GetBytes(host))
 | 
			
		||||
            {
 | 
			
		||||
                return new Connection(NativeMethods.sp_connection_open(bytePtr));
 | 
			
		||||
                return new Connection(ConnectionNative.sp_connection_open(bytePtr));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -20,7 +20,7 @@ public sealed class Connection : SpNativeInstance<BindGen.Connection>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return NativeMethods.sp_connection_send_packet(Instance, packet.Into());
 | 
			
		||||
            return ConnectionNative.sp_connection_send_packet(Instance, packet.Into());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -28,13 +28,13 @@ public sealed class Connection : SpNativeInstance<BindGen.Connection>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return NativeMethods.sp_connection_send_command(Instance, command.Into());
 | 
			
		||||
            return ConnectionNative.sp_connection_send_command(Instance, command.Into());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private protected override unsafe void Free() => NativeMethods.sp_connection_free(Instance);
 | 
			
		||||
    private protected override unsafe void Free() => ConnectionNative.sp_connection_free(Instance);
 | 
			
		||||
 | 
			
		||||
    private unsafe Connection(BindGen.Connection* instance) : base(instance)
 | 
			
		||||
    private unsafe Connection(SPConnection* instance) : base(instance)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,13 +5,13 @@ namespace ServicePoint;
 | 
			
		|||
public static class Constants
 | 
			
		||||
{
 | 
			
		||||
    /// size of a single tile in one dimension
 | 
			
		||||
    public const nuint TileSize = NativeMethods.SP_TILE_SIZE;
 | 
			
		||||
    public const nuint TileSize = ConstantsNative.SP_TILE_SIZE;
 | 
			
		||||
 | 
			
		||||
    /// tile count in the x-direction
 | 
			
		||||
    public const nuint TileWidth = NativeMethods.SP_TILE_WIDTH;
 | 
			
		||||
    public const nuint TileWidth = ConstantsNative.SP_TILE_WIDTH;
 | 
			
		||||
 | 
			
		||||
    /// tile count in the y-direction
 | 
			
		||||
    public const nuint TileHeight = NativeMethods.SP_TILE_SIZE;
 | 
			
		||||
    public const nuint TileHeight = ConstantsNative.SP_TILE_SIZE;
 | 
			
		||||
 | 
			
		||||
    /// screen width in pixels
 | 
			
		||||
    public const nuint PixelWidth = TileWidth * TileSize;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,13 +3,13 @@ using ServicePoint.BindGen;
 | 
			
		|||
 | 
			
		||||
namespace ServicePoint;
 | 
			
		||||
 | 
			
		||||
public sealed class Cp437Grid : SpNativeInstance<BindGen.Cp437Grid>
 | 
			
		||||
public sealed class Cp437Grid : SpNativeInstance<SPCp437Grid>
 | 
			
		||||
{
 | 
			
		||||
    public static Cp437Grid New(int width, int height)
 | 
			
		||||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Cp437Grid(NativeMethods.sp_cp437_grid_new((nuint)width, (nuint)height));
 | 
			
		||||
            return new Cp437Grid(Cp437GridNative.sp_cp437_grid_new((nuint)width, (nuint)height));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ public sealed class Cp437Grid : SpNativeInstance<BindGen.Cp437Grid>
 | 
			
		|||
        {
 | 
			
		||||
            fixed (byte* bytesPtr = bytes)
 | 
			
		||||
            {
 | 
			
		||||
                return new Cp437Grid(NativeMethods.sp_cp437_grid_load((nuint)width, (nuint)height, bytesPtr,
 | 
			
		||||
                return new Cp437Grid(Cp437GridNative.sp_cp437_grid_load((nuint)width, (nuint)height, bytesPtr,
 | 
			
		||||
                    (nuint)bytes.Length));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +29,7 @@ public sealed class Cp437Grid : SpNativeInstance<BindGen.Cp437Grid>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Cp437Grid(NativeMethods.sp_cp437_grid_clone(Instance));
 | 
			
		||||
            return new Cp437Grid(Cp437GridNative.sp_cp437_grid_clone(Instance));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -39,14 +39,14 @@ public sealed class Cp437Grid : SpNativeInstance<BindGen.Cp437Grid>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                return NativeMethods.sp_cp437_grid_get(Instance, (nuint)x, (nuint)y);
 | 
			
		||||
                return Cp437GridNative.sp_cp437_grid_get(Instance, (nuint)x, (nuint)y);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        set
 | 
			
		||||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                NativeMethods.sp_cp437_grid_set(Instance, (nuint)x, (nuint)y, value);
 | 
			
		||||
                Cp437GridNative.sp_cp437_grid_set(Instance, (nuint)x, (nuint)y, value);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -85,7 +85,7 @@ public sealed class Cp437Grid : SpNativeInstance<BindGen.Cp437Grid>
 | 
			
		|||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            NativeMethods.sp_cp437_grid_fill(Instance, value);
 | 
			
		||||
            Cp437GridNative.sp_cp437_grid_fill(Instance, value);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +95,7 @@ public sealed class Cp437Grid : SpNativeInstance<BindGen.Cp437Grid>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                return (int)NativeMethods.sp_cp437_grid_width(Instance);
 | 
			
		||||
                return (int)Cp437GridNative.sp_cp437_grid_width(Instance);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -106,7 +106,7 @@ public sealed class Cp437Grid : SpNativeInstance<BindGen.Cp437Grid>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                return (int)NativeMethods.sp_cp437_grid_height(Instance);
 | 
			
		||||
                return (int)Cp437GridNative.sp_cp437_grid_height(Instance);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -117,15 +117,15 @@ public sealed class Cp437Grid : SpNativeInstance<BindGen.Cp437Grid>
 | 
			
		|||
        {
 | 
			
		||||
            unsafe
 | 
			
		||||
            {
 | 
			
		||||
                var slice = NativeMethods.sp_cp437_grid_unsafe_data_ref(Instance);
 | 
			
		||||
                var slice = Cp437GridNative.sp_cp437_grid_unsafe_data_ref(Instance);
 | 
			
		||||
                return new Span<byte>(slice.start, (int)slice.length);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private unsafe Cp437Grid(BindGen.Cp437Grid* instance) : base(instance)
 | 
			
		||||
    private unsafe Cp437Grid(SPCp437Grid* instance) : base(instance)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private protected override unsafe void Free() => NativeMethods.sp_cp437_grid_free(Instance);
 | 
			
		||||
    private protected override unsafe void Free() => Cp437GridNative.sp_cp437_grid_free(Instance);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1 +1,2 @@
 | 
			
		|||
global using System;
 | 
			
		||||
global using CompressionCode = ServicePoint.BindGen.SPCompressionCode;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,13 +3,13 @@ using ServicePoint.BindGen;
 | 
			
		|||
 | 
			
		||||
namespace ServicePoint;
 | 
			
		||||
 | 
			
		||||
public sealed class Packet : SpNativeInstance<BindGen.Packet>
 | 
			
		||||
public sealed class Packet : SpNativeInstance<SPPacket>
 | 
			
		||||
{
 | 
			
		||||
    public static Packet FromCommand(Command command)
 | 
			
		||||
    {
 | 
			
		||||
        unsafe
 | 
			
		||||
        {
 | 
			
		||||
            return new Packet(NativeMethods.sp_packet_from_command(command.Into()));
 | 
			
		||||
            return new Packet(PacketNative.sp_packet_from_command(command.Into()));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -19,7 +19,7 @@ public sealed class Packet : SpNativeInstance<BindGen.Packet>
 | 
			
		|||
        {
 | 
			
		||||
            fixed (byte* bytesPtr = bytes)
 | 
			
		||||
            {
 | 
			
		||||
                var instance = NativeMethods.sp_packet_try_load(bytesPtr, (nuint)bytes.Length);
 | 
			
		||||
                var instance = PacketNative.sp_packet_try_load(bytesPtr, (nuint)bytes.Length);
 | 
			
		||||
                packet = instance == null
 | 
			
		||||
                    ? null
 | 
			
		||||
                    : new Packet(instance);
 | 
			
		||||
| 
						 | 
				
			
			@ -28,9 +28,9 @@ public sealed class Packet : SpNativeInstance<BindGen.Packet>
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private unsafe Packet(BindGen.Packet* instance) : base(instance)
 | 
			
		||||
    private unsafe Packet(SPPacket* instance) : base(instance)
 | 
			
		||||
    {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private protected override unsafe void Free() => NativeMethods.sp_packet_free(Instance);
 | 
			
		||||
    private protected override unsafe void Free() => PacketNative.sp_packet_free(Instance);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,39 +1,34 @@
 | 
			
		|||
//! Build script generating the C# code needed to call methods from the `servicepoint` C library.
 | 
			
		||||
 | 
			
		||||
use std::fs;
 | 
			
		||||
use std::{fs, path::Path};
 | 
			
		||||
 | 
			
		||||
use convert_case::{Case, Casing};
 | 
			
		||||
 | 
			
		||||
fn main() {
 | 
			
		||||
    println!("cargo::rerun-if-changed=../servicepoint_binding_c/src");
 | 
			
		||||
    println!("cargo::rerun-if-changed=build.rs");
 | 
			
		||||
 | 
			
		||||
    let mut builder = csbindgen::Builder::default();
 | 
			
		||||
 | 
			
		||||
    let mut paths = fs::read_dir("../servicepoint_binding_c/src").unwrap()
 | 
			
		||||
    let mut paths = fs::read_dir("../servicepoint_binding_c/src")
 | 
			
		||||
        .unwrap()
 | 
			
		||||
        .map(|x| x.unwrap().path())
 | 
			
		||||
        .collect::<Vec<_>>();
 | 
			
		||||
    paths.sort();
 | 
			
		||||
 | 
			
		||||
    for path in paths {
 | 
			
		||||
    for path in &paths {
 | 
			
		||||
        println!("cargo:rerun-if-changed={}", path.display());
 | 
			
		||||
        builder = builder.input_extern_file(path);
 | 
			
		||||
        let class = Path::new(path).file_stem().unwrap().to_str().unwrap();
 | 
			
		||||
        let class = class.to_case(Case::UpperCamel) + "Native";
 | 
			
		||||
        csbindgen::Builder::default()
 | 
			
		||||
            .input_extern_file(path)
 | 
			
		||||
            .csharp_class_name(&class)
 | 
			
		||||
            .csharp_dll_name("servicepoint_binding_c")
 | 
			
		||||
            .csharp_namespace("ServicePoint.BindGen")
 | 
			
		||||
            .csharp_use_nint_types(true)
 | 
			
		||||
            .csharp_class_accessibility("public")
 | 
			
		||||
            .csharp_generate_const_filter(|_| true)
 | 
			
		||||
            .always_included_types(["SPByteSlice", "SPCompressionCode"])
 | 
			
		||||
            .generate_csharp_file(format!("ServicePoint/BindGen/{}.g.cs", &class))
 | 
			
		||||
            .unwrap();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    builder
 | 
			
		||||
        .csharp_dll_name("servicepoint_binding_c")
 | 
			
		||||
        .csharp_namespace("ServicePoint.BindGen")
 | 
			
		||||
        .csharp_use_nint_types(true)
 | 
			
		||||
        .csharp_class_accessibility("public")
 | 
			
		||||
        .csharp_generate_const_filter(|_| true)
 | 
			
		||||
        .csharp_type_rename(move |name| {
 | 
			
		||||
            if name.len() > 2
 | 
			
		||||
                && name.starts_with("SP")
 | 
			
		||||
                && name.chars().nth(2).unwrap().is_uppercase()
 | 
			
		||||
            {
 | 
			
		||||
                name[2..].to_string()
 | 
			
		||||
            } else {
 | 
			
		||||
                name
 | 
			
		||||
            }
 | 
			
		||||
        })
 | 
			
		||||
        .generate_csharp_file("ServicePoint/BindGen/ServicePoint.g.cs")
 | 
			
		||||
        .unwrap();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
using ServicePoint;
 | 
			
		||||
using CompressionCode = ServicePoint.BindGen.CompressionCode;
 | 
			
		||||
 | 
			
		||||
using CompressionCode = ServicePoint.BindGen.SPCompressionCode;
 | 
			
		||||
 | 
			
		||||
using var connection = Connection.Open("127.0.0.1:2342");
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue