use GroupedNativeMethods

This commit is contained in:
Vinzenz Schroeter 2024-10-16 22:46:34 +02:00
parent 01f2f90121
commit 91cc982394
23 changed files with 217 additions and 160 deletions

View file

@ -37,7 +37,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_bitvec_free`. /// by explicitly calling `sp_bitvec_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitvec_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitvec_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPBitVec* sp_bitvec_new(nuint size); public static extern BitVec* sp_bitvec_new(nuint size);
/// <summary> /// <summary>
/// Interpret the data as a series of bits and load then into a new [SPBitVec] instance. /// Interpret the data as a series of bits and load then into a new [SPBitVec] instance.
@ -58,7 +58,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_bitvec_free`. /// by explicitly calling `sp_bitvec_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitvec_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitvec_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPBitVec* sp_bitvec_load(byte* data, nuint data_length); public static extern BitVec* sp_bitvec_load(byte* data, nuint data_length);
/// <summary> /// <summary>
/// Clones a [SPBitVec]. /// Clones a [SPBitVec].
@ -79,7 +79,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_bitvec_free`. /// by explicitly calling `sp_bitvec_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitvec_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitvec_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPBitVec* sp_bitvec_clone(SPBitVec* bit_vec); public static extern BitVec* sp_bitvec_clone(BitVec* bit_vec);
/// <summary> /// <summary>
/// Deallocates a [SPBitVec]. /// Deallocates a [SPBitVec].
@ -97,7 +97,7 @@ namespace ServicePoint.BindGen
/// - `bit_vec` was not passed to another consuming function, e.g. to create a [SPCommand] /// - `bit_vec` was not passed to another consuming function, e.g. to create a [SPCommand]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitvec_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitvec_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void sp_bitvec_free(SPBitVec* bit_vec); public static extern void sp_bitvec_free(BitVec* bit_vec);
/// <summary> /// <summary>
/// Gets the value of a bit from the [SPBitVec]. /// Gets the value of a bit from the [SPBitVec].
@ -123,7 +123,7 @@ namespace ServicePoint.BindGen
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitvec_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitvec_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: MarshalAs(UnmanagedType.U1)] [return: MarshalAs(UnmanagedType.U1)]
public static extern bool sp_bitvec_get(SPBitVec* bit_vec, nuint index); public static extern bool sp_bitvec_get(BitVec* bit_vec, nuint index);
/// <summary> /// <summary>
/// Sets the value of a bit in the [SPBitVec]. /// Sets the value of a bit in the [SPBitVec].
@ -147,7 +147,7 @@ namespace ServicePoint.BindGen
/// - `bit_vec` is not written to or read from concurrently /// - `bit_vec` is not written to or read from concurrently
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitvec_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern void sp_bitvec_set(BitVec* bit_vec, nuint index, [MarshalAs(UnmanagedType.U1)] bool value);
/// <summary> /// <summary>
/// Sets the value of all bits in the [SPBitVec]. /// Sets the value of all bits in the [SPBitVec].
@ -169,7 +169,7 @@ namespace ServicePoint.BindGen
/// - `bit_vec` is not written to or read from concurrently /// - `bit_vec` is not written to or read from concurrently
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitvec_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern void sp_bitvec_fill(BitVec* bit_vec, [MarshalAs(UnmanagedType.U1)] bool value);
/// <summary> /// <summary>
/// Gets the length of the [SPBitVec] in bits. /// Gets the length of the [SPBitVec] in bits.
@ -189,7 +189,7 @@ namespace ServicePoint.BindGen
/// - `bit_vec` points to a valid [SPBitVec] /// - `bit_vec` points to a valid [SPBitVec]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitvec_len", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitvec_len", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern nuint sp_bitvec_len(SPBitVec* bit_vec); public static extern nuint sp_bitvec_len(BitVec* bit_vec);
/// <summary> /// <summary>
/// Returns true if length is 0. /// Returns true if length is 0.
@ -210,7 +210,7 @@ namespace ServicePoint.BindGen
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitvec_is_empty", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitvec_is_empty", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: MarshalAs(UnmanagedType.U1)] [return: MarshalAs(UnmanagedType.U1)]
public static extern bool sp_bitvec_is_empty(SPBitVec* bit_vec); public static extern bool sp_bitvec_is_empty(BitVec* bit_vec);
/// <summary> /// <summary>
/// Gets an unsafe reference to the data of the [SPBitVec] instance. /// Gets an unsafe reference to the data of the [SPBitVec] instance.
@ -232,13 +232,13 @@ namespace ServicePoint.BindGen
/// - the returned memory range is never accessed concurrently, either via the [SPBitVec] or directly /// - the returned memory range is never accessed concurrently, either via the [SPBitVec] or directly
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitvec_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern ByteSlice sp_bitvec_unsafe_data_ref(BitVec* bit_vec);
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe partial struct SPBitVec public unsafe partial struct BitVec
{ {
} }

View file

@ -38,7 +38,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_bitmap_free`. /// by explicitly calling `sp_bitmap_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitmap_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitmap_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPBitmap* sp_bitmap_new(nuint width, nuint height); public static extern Bitmap* sp_bitmap_new(nuint width, nuint height);
/// <summary> /// <summary>
/// Loads a [SPBitmap] with the specified dimensions from the provided data. /// Loads a [SPBitmap] with the specified dimensions from the provided data.
@ -65,7 +65,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_bitmap_free`. /// by explicitly calling `sp_bitmap_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitmap_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern Bitmap* sp_bitmap_load(nuint width, nuint height, byte* data, nuint data_length);
/// <summary> /// <summary>
/// Clones a [SPBitmap]. /// Clones a [SPBitmap].
@ -86,7 +86,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_bitmap_free`. /// by explicitly calling `sp_bitmap_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitmap_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitmap_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPBitmap* sp_bitmap_clone(SPBitmap* bitmap); public static extern Bitmap* sp_bitmap_clone(Bitmap* bitmap);
/// <summary> /// <summary>
/// Deallocates a [SPBitmap]. /// Deallocates a [SPBitmap].
@ -104,7 +104,7 @@ namespace ServicePoint.BindGen
/// - `bitmap` was not passed to another consuming function, e.g. to create a [SPCommand] /// - `bitmap` was not passed to another consuming function, e.g. to create a [SPCommand]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitmap_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitmap_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void sp_bitmap_free(SPBitmap* bitmap); public static extern void sp_bitmap_free(Bitmap* bitmap);
/// <summary> /// <summary>
/// Gets the current value at the specified position in the [SPBitmap]. /// Gets the current value at the specified position in the [SPBitmap].
@ -128,7 +128,7 @@ namespace ServicePoint.BindGen
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitmap_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitmap_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: MarshalAs(UnmanagedType.U1)] [return: MarshalAs(UnmanagedType.U1)]
public static extern bool sp_bitmap_get(SPBitmap* bitmap, nuint x, nuint y); public static extern bool sp_bitmap_get(Bitmap* bitmap, nuint x, nuint y);
/// <summary> /// <summary>
/// Sets the value of the specified position in the [SPBitmap]. /// Sets the value of the specified position in the [SPBitmap].
@ -154,7 +154,7 @@ namespace ServicePoint.BindGen
/// - `bitmap` is not written to or read from concurrently /// - `bitmap` is not written to or read from concurrently
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitmap_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern void sp_bitmap_set(Bitmap* bitmap, nuint x, nuint y, [MarshalAs(UnmanagedType.U1)] bool value);
/// <summary> /// <summary>
/// Sets the state of all pixels in the [SPBitmap]. /// Sets the state of all pixels in the [SPBitmap].
@ -176,7 +176,7 @@ namespace ServicePoint.BindGen
/// - `bitmap` is not written to or read from concurrently /// - `bitmap` is not written to or read from concurrently
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitmap_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern void sp_bitmap_fill(Bitmap* bitmap, [MarshalAs(UnmanagedType.U1)] bool value);
/// <summary> /// <summary>
/// Gets the width in pixels of the [SPBitmap] instance. /// Gets the width in pixels of the [SPBitmap] instance.
@ -196,7 +196,7 @@ namespace ServicePoint.BindGen
/// - `bitmap` points to a valid [SPBitmap] /// - `bitmap` points to a valid [SPBitmap]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitmap_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitmap_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern nuint sp_bitmap_width(SPBitmap* bitmap); public static extern nuint sp_bitmap_width(Bitmap* bitmap);
/// <summary> /// <summary>
/// Gets the height in pixels of the [SPBitmap] instance. /// Gets the height in pixels of the [SPBitmap] instance.
@ -216,7 +216,7 @@ namespace ServicePoint.BindGen
/// - `bitmap` points to a valid [SPBitmap] /// - `bitmap` points to a valid [SPBitmap]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitmap_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitmap_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern nuint sp_bitmap_height(SPBitmap* bitmap); public static extern nuint sp_bitmap_height(Bitmap* bitmap);
/// <summary> /// <summary>
/// Gets an unsafe reference to the data of the [SPBitmap] instance. /// Gets an unsafe reference to the data of the [SPBitmap] instance.
@ -234,13 +234,13 @@ namespace ServicePoint.BindGen
/// - the returned memory range is never accessed concurrently, either via the [SPBitmap] or directly /// - the returned memory range is never accessed concurrently, either via the [SPBitmap] or directly
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_bitmap_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_bitmap_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPByteSlice sp_bitmap_unsafe_data_ref(SPBitmap* bitmap); public static extern ByteSlice sp_bitmap_unsafe_data_ref(Bitmap* bitmap);
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe partial struct SPBitmap public unsafe partial struct Bitmap
{ {
} }

View file

@ -32,7 +32,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_brightness_grid_free`. /// by explicitly calling `sp_brightness_grid_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_brightness_grid_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_brightness_grid_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPBrightnessGrid* sp_brightness_grid_new(nuint width, nuint height); public static extern BrightnessGrid* sp_brightness_grid_new(nuint width, nuint height);
/// <summary> /// <summary>
/// Loads a [SPBrightnessGrid] with the specified dimensions from the provided data. /// Loads a [SPBrightnessGrid] with the specified dimensions from the provided data.
@ -54,7 +54,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_brightness_grid_free`. /// by explicitly calling `sp_brightness_grid_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_brightness_grid_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern BrightnessGrid* sp_brightness_grid_load(nuint width, nuint height, byte* data, nuint data_length);
/// <summary> /// <summary>
/// Clones a [SPBrightnessGrid]. /// Clones a [SPBrightnessGrid].
@ -79,7 +79,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_brightness_grid_free`. /// by explicitly calling `sp_brightness_grid_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_brightness_grid_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_brightness_grid_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPBrightnessGrid* sp_brightness_grid_clone(SPBrightnessGrid* brightness_grid); public static extern BrightnessGrid* sp_brightness_grid_clone(BrightnessGrid* brightness_grid);
/// <summary> /// <summary>
/// Deallocates a [SPBrightnessGrid]. /// Deallocates a [SPBrightnessGrid].
@ -101,7 +101,7 @@ namespace ServicePoint.BindGen
/// - `brightness_grid` was not passed to another consuming function, e.g. to create a [SPCommand] /// - `brightness_grid` was not passed to another consuming function, e.g. to create a [SPCommand]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_brightness_grid_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_brightness_grid_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void sp_brightness_grid_free(SPBrightnessGrid* brightness_grid); public static extern void sp_brightness_grid_free(BrightnessGrid* brightness_grid);
/// <summary> /// <summary>
/// Gets the current value at the specified position. /// Gets the current value at the specified position.
@ -126,7 +126,7 @@ namespace ServicePoint.BindGen
/// - `brightness_grid` is not written to concurrently /// - `brightness_grid` is not written to concurrently
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_brightness_grid_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern byte sp_brightness_grid_get(BrightnessGrid* brightness_grid, nuint x, nuint y);
/// <summary> /// <summary>
/// Sets the value of the specified position in the [SPBrightnessGrid]. /// Sets the value of the specified position in the [SPBrightnessGrid].
@ -153,7 +153,7 @@ namespace ServicePoint.BindGen
/// - `brightness_grid` is not written to or read from concurrently /// - `brightness_grid` is not written to or read from concurrently
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_brightness_grid_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern void sp_brightness_grid_set(BrightnessGrid* brightness_grid, nuint x, nuint y, byte value);
/// <summary> /// <summary>
/// Sets the value of all cells in the [SPBrightnessGrid]. /// Sets the value of all cells in the [SPBrightnessGrid].
@ -176,7 +176,7 @@ namespace ServicePoint.BindGen
/// - `brightness_grid` is not written to or read from concurrently /// - `brightness_grid` is not written to or read from concurrently
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_brightness_grid_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern void sp_brightness_grid_fill(BrightnessGrid* brightness_grid, byte value);
/// <summary> /// <summary>
/// Gets the width of the [SPBrightnessGrid] instance. /// Gets the width of the [SPBrightnessGrid] instance.
@ -198,7 +198,7 @@ namespace ServicePoint.BindGen
/// - `brightness_grid` points to a valid [SPBrightnessGrid] /// - `brightness_grid` points to a valid [SPBrightnessGrid]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_brightness_grid_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_brightness_grid_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern nuint sp_brightness_grid_width(SPBrightnessGrid* brightness_grid); public static extern nuint sp_brightness_grid_width(BrightnessGrid* brightness_grid);
/// <summary> /// <summary>
/// Gets the height of the [SPBrightnessGrid] instance. /// Gets the height of the [SPBrightnessGrid] instance.
@ -220,7 +220,7 @@ namespace ServicePoint.BindGen
/// - `brightness_grid` points to a valid [SPBrightnessGrid] /// - `brightness_grid` points to a valid [SPBrightnessGrid]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_brightness_grid_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_brightness_grid_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern nuint sp_brightness_grid_height(SPBrightnessGrid* brightness_grid); public static extern nuint sp_brightness_grid_height(BrightnessGrid* brightness_grid);
/// <summary> /// <summary>
/// Gets an unsafe reference to the data of the [SPBrightnessGrid] instance. /// Gets an unsafe reference to the data of the [SPBrightnessGrid] instance.
@ -244,13 +244,13 @@ namespace ServicePoint.BindGen
/// - the returned memory range is never accessed concurrently, either via the [SPBrightnessGrid] or directly /// - the returned memory range is never accessed concurrently, either via the [SPBrightnessGrid] or directly
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_brightness_grid_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern ByteSlice sp_brightness_grid_unsafe_data_ref(BrightnessGrid* brightness_grid);
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe partial struct SPBrightnessGrid public unsafe partial struct BrightnessGrid
{ {
} }

View file

@ -13,7 +13,7 @@ namespace ServicePoint.BindGen
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe partial struct SPByteSlice public unsafe partial struct ByteSlice
{ {
public byte* start; public byte* start;
public nuint length; public nuint length;

View file

@ -38,7 +38,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_try_from_packet", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_command_try_from_packet", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPCommand* sp_command_try_from_packet(SPPacket* packet); public static extern Command* sp_command_try_from_packet(Packet* packet);
/// <summary> /// <summary>
/// Clones a [SPCommand] instance. /// Clones a [SPCommand] instance.
@ -59,7 +59,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_command_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPCommand* sp_command_clone(SPCommand* command); public static extern Command* sp_command_clone(Command* command);
/// <summary> /// <summary>
/// Set all pixels to the off state. /// Set all pixels to the off state.
@ -82,7 +82,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_clear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_command_clear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPCommand* sp_command_clear(); public static extern Command* sp_command_clear();
/// <summary> /// <summary>
/// Kills the udp daemon on the display, which usually results in a restart. /// Kills the udp daemon on the display, which usually results in a restart.
@ -99,7 +99,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_hard_reset", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_command_hard_reset", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPCommand* sp_command_hard_reset(); public static extern Command* sp_command_hard_reset();
/// <summary> /// <summary>
/// A yet-to-be-tested command. /// A yet-to-be-tested command.
@ -114,7 +114,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_fade_out", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_command_fade_out", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPCommand* sp_command_fade_out(); public static extern Command* sp_command_fade_out();
/// <summary> /// <summary>
/// Set the brightness of all tiles to the same value. /// Set the brightness of all tiles to the same value.
@ -133,7 +133,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_command_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPCommand* sp_command_brightness(byte brightness); public static extern Command* sp_command_brightness(byte brightness);
/// <summary> /// <summary>
/// Set the brightness of individual tiles in a rectangular area of the display. /// Set the brightness of individual tiles in a rectangular area of the display.
@ -156,7 +156,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_char_brightness", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern Command* sp_command_char_brightness(nuint x, nuint y, BrightnessGrid* grid);
/// <summary> /// <summary>
/// Set pixel data starting at the pixel offset on screen. /// Set pixel data starting at the pixel offset on screen.
@ -186,7 +186,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern Command* sp_command_bitmap_linear(nuint offset, BitVec* bit_vec, CompressionCode compression);
/// <summary> /// <summary>
/// Set pixel data according to an and-mask starting at the offset. /// Set pixel data according to an and-mask starting at the offset.
@ -216,7 +216,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_and", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern Command* sp_command_bitmap_linear_and(nuint offset, BitVec* bit_vec, CompressionCode compression);
/// <summary> /// <summary>
/// Set pixel data according to an or-mask starting at the offset. /// Set pixel data according to an or-mask starting at the offset.
@ -246,7 +246,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_or", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern Command* sp_command_bitmap_linear_or(nuint offset, BitVec* bit_vec, CompressionCode compression);
/// <summary> /// <summary>
/// Set pixel data according to a xor-mask starting at the offset. /// Set pixel data according to a xor-mask starting at the offset.
@ -276,7 +276,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_xor", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern Command* sp_command_bitmap_linear_xor(nuint offset, BitVec* bit_vec, CompressionCode compression);
/// <summary> /// <summary>
/// Show text on the screen. /// Show text on the screen.
@ -299,7 +299,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_cp437_data", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern Command* sp_command_cp437_data(nuint x, nuint y, Cp437Grid* grid);
/// <summary> /// <summary>
/// Sets a window of pixels to the specified values. /// Sets a window of pixels to the specified values.
@ -324,7 +324,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_command_free`. /// by explicitly calling `sp_command_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_bitmap_linear_win", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern Command* sp_command_bitmap_linear_win(nuint x, nuint y, Bitmap* bitmap, CompressionCode compression_code);
/// <summary> /// <summary>
/// Deallocates a [SPCommand]. /// Deallocates a [SPCommand].
@ -349,13 +349,13 @@ namespace ServicePoint.BindGen
/// - `command` was not passed to another consuming function, e.g. to create a [SPPacket] /// - `command` was not passed to another consuming function, e.g. to create a [SPPacket]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_command_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_command_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void sp_command_free(SPCommand* command); public static extern void sp_command_free(Command* command);
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe partial struct SPCommand public unsafe partial struct Command
{ {
} }

View file

@ -33,7 +33,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_connection_free`. /// by explicitly calling `sp_connection_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_connection_open", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_connection_open", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPConnection* sp_connection_open(byte* host); public static extern Connection* sp_connection_open(byte* host);
/// <summary> /// <summary>
/// Sends a [SPPacket] to the display using the [SPConnection]. /// Sends a [SPPacket] to the display using the [SPConnection].
@ -57,7 +57,7 @@ namespace ServicePoint.BindGen
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_connection_send_packet", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_connection_send_packet", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: MarshalAs(UnmanagedType.U1)] [return: MarshalAs(UnmanagedType.U1)]
public static extern bool sp_connection_send_packet(SPConnection* connection, SPPacket* packet); public static extern bool sp_connection_send_packet(Connection* connection, Packet* packet);
/// <summary> /// <summary>
/// Sends a [SPCommand] to the display using the [SPConnection]. /// Sends a [SPCommand] to the display using the [SPConnection].
@ -81,7 +81,7 @@ namespace ServicePoint.BindGen
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_connection_send_command", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_connection_send_command", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
[return: MarshalAs(UnmanagedType.U1)] [return: MarshalAs(UnmanagedType.U1)]
public static extern bool sp_connection_send_command(SPConnection* connection, SPCommand* command); public static extern bool sp_connection_send_command(Connection* connection, Command* command);
/// <summary> /// <summary>
/// Closes and deallocates a [SPConnection]. /// Closes and deallocates a [SPConnection].
@ -98,13 +98,13 @@ namespace ServicePoint.BindGen
/// - `connection` is not used concurrently or after this call /// - `connection` is not used concurrently or after this call
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_connection_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_connection_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void sp_connection_free(SPConnection* connection); public static extern void sp_connection_free(Connection* connection);
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe partial struct SPConnection public unsafe partial struct Connection
{ {
} }

View file

@ -23,7 +23,7 @@ namespace ServicePoint.BindGen
} }
public enum SPCompressionCode : ushort public enum CompressionCode : ushort
{ {
Uncompressed = 0, Uncompressed = 0,
Zlib = 26490, Zlib = 26490,

View file

@ -29,7 +29,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_cp437_grid_free`. /// by explicitly calling `sp_cp437_grid_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_cp437_grid_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_cp437_grid_new", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPCp437Grid* sp_cp437_grid_new(nuint width, nuint height); public static extern Cp437Grid* sp_cp437_grid_new(nuint width, nuint height);
/// <summary> /// <summary>
/// Loads a [SPCp437Grid] with the specified dimensions from the provided data. /// Loads a [SPCp437Grid] with the specified dimensions from the provided data.
@ -51,7 +51,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_cp437_grid_free`. /// by explicitly calling `sp_cp437_grid_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_cp437_grid_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern Cp437Grid* sp_cp437_grid_load(nuint width, nuint height, byte* data, nuint data_length);
/// <summary> /// <summary>
/// Clones a [SPCp437Grid]. /// Clones a [SPCp437Grid].
@ -72,7 +72,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_cp437_grid_free`. /// by explicitly calling `sp_cp437_grid_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_cp437_grid_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_cp437_grid_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPCp437Grid* sp_cp437_grid_clone(SPCp437Grid* cp437_grid); public static extern Cp437Grid* sp_cp437_grid_clone(Cp437Grid* cp437_grid);
/// <summary> /// <summary>
/// Deallocates a [SPCp437Grid]. /// Deallocates a [SPCp437Grid].
@ -90,7 +90,7 @@ namespace ServicePoint.BindGen
/// - `cp437_grid` was not passed to another consuming function, e.g. to create a [SPCommand] /// - `cp437_grid` was not passed to another consuming function, e.g. to create a [SPCommand]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_cp437_grid_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_cp437_grid_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void sp_cp437_grid_free(SPCp437Grid* cp437_grid); public static extern void sp_cp437_grid_free(Cp437Grid* cp437_grid);
/// <summary> /// <summary>
/// Gets the current value at the specified position. /// Gets the current value at the specified position.
@ -113,7 +113,7 @@ namespace ServicePoint.BindGen
/// - `cp437_grid` is not written to concurrently /// - `cp437_grid` is not written to concurrently
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_cp437_grid_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern byte sp_cp437_grid_get(Cp437Grid* cp437_grid, nuint x, nuint y);
/// <summary> /// <summary>
/// Sets the value of the specified position in the [SPCp437Grid]. /// Sets the value of the specified position in the [SPCp437Grid].
@ -139,7 +139,7 @@ namespace ServicePoint.BindGen
/// - `cp437_grid` is not written to or read from concurrently /// - `cp437_grid` is not written to or read from concurrently
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_cp437_grid_set", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern void sp_cp437_grid_set(Cp437Grid* cp437_grid, nuint x, nuint y, byte value);
/// <summary> /// <summary>
/// Sets the value of all cells in the [SPCp437Grid]. /// Sets the value of all cells in the [SPCp437Grid].
@ -161,7 +161,7 @@ namespace ServicePoint.BindGen
/// - `cp437_grid` is not written to or read from concurrently /// - `cp437_grid` is not written to or read from concurrently
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_cp437_grid_fill", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern void sp_cp437_grid_fill(Cp437Grid* cp437_grid, byte value);
/// <summary> /// <summary>
/// Gets the width of the [SPCp437Grid] instance. /// Gets the width of the [SPCp437Grid] instance.
@ -181,7 +181,7 @@ namespace ServicePoint.BindGen
/// - `cp437_grid` points to a valid [SPCp437Grid] /// - `cp437_grid` points to a valid [SPCp437Grid]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_cp437_grid_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_cp437_grid_width", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern nuint sp_cp437_grid_width(SPCp437Grid* cp437_grid); public static extern nuint sp_cp437_grid_width(Cp437Grid* cp437_grid);
/// <summary> /// <summary>
/// Gets the height of the [SPCp437Grid] instance. /// Gets the height of the [SPCp437Grid] instance.
@ -201,7 +201,7 @@ namespace ServicePoint.BindGen
/// - `cp437_grid` points to a valid [SPCp437Grid] /// - `cp437_grid` points to a valid [SPCp437Grid]
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_cp437_grid_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_cp437_grid_height", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern nuint sp_cp437_grid_height(SPCp437Grid* cp437_grid); public static extern nuint sp_cp437_grid_height(Cp437Grid* cp437_grid);
/// <summary> /// <summary>
/// Gets an unsafe reference to the data of the [SPCp437Grid] instance. /// Gets an unsafe reference to the data of the [SPCp437Grid] instance.
@ -221,13 +221,13 @@ namespace ServicePoint.BindGen
/// - the returned memory range is never accessed concurrently, either via the [SPCp437Grid] or directly /// - the returned memory range is never accessed concurrently, either via the [SPCp437Grid] or directly
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_cp437_grid_unsafe_data_ref", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [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); public static extern ByteSlice sp_cp437_grid_unsafe_data_ref(Cp437Grid* cp437_grid);
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe partial struct SPCp437Grid public unsafe partial struct Cp437Grid
{ {
} }

View file

@ -0,0 +1,49 @@
using GroupedNativeMethodsGenerator;
namespace ServicePoint.BindGen;
[GroupedNativeMethods(removePrefix: "sp_bitmap_")]
public static unsafe partial class BitmapNative
{
}
[GroupedNativeMethods(removePrefix: "sp_bitvec_")]
public static unsafe partial class BitVecNative
{
}
[GroupedNativeMethods(removePrefix: "sp_brightness_grid")]
public static unsafe partial class BrightnessGridNative
{
}
[GroupedNativeMethods(removePrefix: "sp_byte_slice")]
public static unsafe partial class ByteSliceNative
{
}
[GroupedNativeMethods(removePrefix: "sp_command_")]
public static unsafe partial class CommandNative
{
}
[GroupedNativeMethods(removePrefix: "sp_connection_")]
public static unsafe partial class ConnectionNative
{
}
[GroupedNativeMethods(removePrefix: "sp_constants_")]
public static unsafe partial class ConstantsNative
{
}
[GroupedNativeMethods(removePrefix: "sp_cp437_grid_")]
public static unsafe partial class Cp437GridNative
{
}
[GroupedNativeMethods(removePrefix: "sp_packet_")]
public static unsafe partial class PacketNative
{
}

View file

@ -1,17 +0,0 @@
// <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
{
}

View file

@ -36,7 +36,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_packet_free`. /// by explicitly calling `sp_packet_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_packet_from_command", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_packet_from_command", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPPacket* sp_packet_from_command(SPCommand* command); public static extern Packet* sp_packet_from_command(Command* command);
/// <summary> /// <summary>
/// Tries to load a [SPPacket] from the passed array with the specified length. /// Tries to load a [SPPacket] from the passed array with the specified length.
@ -57,7 +57,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_packet_free`. /// by explicitly calling `sp_packet_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_packet_try_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_packet_try_load", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPPacket* sp_packet_try_load(byte* data, nuint length); public static extern Packet* sp_packet_try_load(byte* data, nuint length);
/// <summary> /// <summary>
/// Clones a [SPPacket]. /// Clones a [SPPacket].
@ -78,7 +78,7 @@ namespace ServicePoint.BindGen
/// by explicitly calling `sp_packet_free`. /// by explicitly calling `sp_packet_free`.
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_packet_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_packet_clone", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern SPPacket* sp_packet_clone(SPPacket* packet); public static extern Packet* sp_packet_clone(Packet* packet);
/// <summary> /// <summary>
/// Deallocates a [SPPacket]. /// Deallocates a [SPPacket].
@ -95,13 +95,13 @@ namespace ServicePoint.BindGen
/// - `packet` is not used concurrently or after this call /// - `packet` is not used concurrently or after this call
/// </summary> /// </summary>
[DllImport(__DllName, EntryPoint = "sp_packet_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [DllImport(__DllName, EntryPoint = "sp_packet_free", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern void sp_packet_free(SPPacket* packet); public static extern void sp_packet_free(Packet* packet);
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe partial struct SPPacket public unsafe partial struct Packet
{ {
} }

View file

@ -2,7 +2,7 @@ using ServicePoint.BindGen;
namespace ServicePoint; namespace ServicePoint;
public sealed class BitVec : SpNativeInstance<SPBitVec> public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
{ {
public static BitVec New(nuint size) public static BitVec New(nuint size)
{ {
@ -27,7 +27,7 @@ public sealed class BitVec : SpNativeInstance<SPBitVec>
{ {
unsafe unsafe
{ {
return new BitVec(BitVecNative.sp_bitvec_clone(Instance)); return new BitVec(Instance->Clone());
} }
} }
@ -37,14 +37,14 @@ public sealed class BitVec : SpNativeInstance<SPBitVec>
{ {
unsafe unsafe
{ {
return BitVecNative.sp_bitvec_get(Instance, index); return Instance->Get(index);
} }
} }
set set
{ {
unsafe unsafe
{ {
BitVecNative.sp_bitvec_set(Instance, index, value); Instance->Set(index, value);
} }
} }
} }
@ -53,7 +53,7 @@ public sealed class BitVec : SpNativeInstance<SPBitVec>
{ {
unsafe unsafe
{ {
BitVecNative.sp_bitvec_fill(Instance, value); Instance->Fill(value);
} }
} }
@ -63,7 +63,7 @@ public sealed class BitVec : SpNativeInstance<SPBitVec>
{ {
unsafe unsafe
{ {
return BitVecNative.sp_bitvec_len(Instance); return Instance->Len();
} }
} }
} }
@ -74,15 +74,14 @@ public sealed class BitVec : SpNativeInstance<SPBitVec>
{ {
unsafe unsafe
{ {
var slice = BitVecNative.sp_bitvec_unsafe_data_ref(Instance); return Instance->UnsafeDataRef().AsSpan();
return new Span<byte>(slice.start, (int)slice.length);
} }
} }
} }
private unsafe BitVec(SPBitVec* instance) : base(instance) private unsafe BitVec(BindGen.BitVec* instance) : base(instance)
{ {
} }
private protected override unsafe void Free() => BitVecNative.sp_bitvec_free(Instance); private protected override unsafe void Free() => Instance->Free();
} }

View file

@ -2,7 +2,7 @@ using ServicePoint.BindGen;
namespace ServicePoint; namespace ServicePoint;
public sealed class Bitmap : SpNativeInstance<SPBitmap> public sealed class Bitmap : SpNativeInstance<BindGen.Bitmap>
{ {
public static Bitmap New(nuint width, nuint height) public static Bitmap New(nuint width, nuint height)
{ {
@ -28,7 +28,7 @@ public sealed class Bitmap : SpNativeInstance<SPBitmap>
{ {
unsafe unsafe
{ {
return new Bitmap(BitmapNative.sp_bitmap_clone(Instance)); return new Bitmap(Instance->Clone());
} }
} }
@ -38,14 +38,14 @@ public sealed class Bitmap : SpNativeInstance<SPBitmap>
{ {
unsafe unsafe
{ {
return BitmapNative.sp_bitmap_get(Instance, x, y); return Instance->Get(x, y);
} }
} }
set set
{ {
unsafe unsafe
{ {
BitmapNative.sp_bitmap_set(Instance, x, y, value); Instance->Set(x, y, value);
} }
} }
} }
@ -54,7 +54,7 @@ public sealed class Bitmap : SpNativeInstance<SPBitmap>
{ {
unsafe unsafe
{ {
BitmapNative.sp_bitmap_fill(Instance, value); Instance->Fill(value);
} }
} }
@ -64,7 +64,7 @@ public sealed class Bitmap : SpNativeInstance<SPBitmap>
{ {
unsafe unsafe
{ {
return BitmapNative.sp_bitmap_width(Instance); return Instance->Width();
} }
} }
} }
@ -75,7 +75,7 @@ public sealed class Bitmap : SpNativeInstance<SPBitmap>
{ {
unsafe unsafe
{ {
return BitmapNative.sp_bitmap_height(Instance); return Instance->Height();
} }
} }
} }
@ -86,15 +86,15 @@ public sealed class Bitmap : SpNativeInstance<SPBitmap>
{ {
unsafe unsafe
{ {
var slice = BitmapNative.sp_bitmap_unsafe_data_ref(Instance); var slice = Instance->UnsafeDataRef();
return new Span<byte>(slice.start, (int)slice.length); return new Span<byte>(slice.start, (int)slice.length);
} }
} }
} }
private unsafe Bitmap(SPBitmap* instance) : base(instance) private unsafe Bitmap(BindGen.Bitmap* instance) : base(instance)
{ {
} }
private protected override unsafe void Free() => BitmapNative.sp_bitmap_free(Instance); private protected override unsafe void Free() => Instance->Free();
} }

View file

@ -2,7 +2,7 @@ using ServicePoint.BindGen;
namespace ServicePoint; namespace ServicePoint;
public sealed class BrightnessGrid : SpNativeInstance<SPBrightnessGrid> public sealed class BrightnessGrid : SpNativeInstance<BindGen.BrightnessGrid>
{ {
public static BrightnessGrid New(nuint width, nuint height) public static BrightnessGrid New(nuint width, nuint height)
{ {
@ -28,7 +28,7 @@ public sealed class BrightnessGrid : SpNativeInstance<SPBrightnessGrid>
{ {
unsafe unsafe
{ {
return new BrightnessGrid(BrightnessGridNative.sp_brightness_grid_clone(Instance)); return new BrightnessGrid(Instance->Clone());
} }
} }
@ -38,14 +38,14 @@ public sealed class BrightnessGrid : SpNativeInstance<SPBrightnessGrid>
{ {
unsafe unsafe
{ {
return BrightnessGridNative.sp_brightness_grid_get(Instance, x, y); return Instance->Get(x, y);
} }
} }
set set
{ {
unsafe unsafe
{ {
BrightnessGridNative.sp_brightness_grid_set(Instance, x, y, value); Instance->Set(x, y, value);
} }
} }
} }
@ -54,7 +54,7 @@ public sealed class BrightnessGrid : SpNativeInstance<SPBrightnessGrid>
{ {
unsafe unsafe
{ {
BrightnessGridNative.sp_brightness_grid_fill(Instance, value); Instance->Fill(value);
} }
} }
@ -64,7 +64,7 @@ public sealed class BrightnessGrid : SpNativeInstance<SPBrightnessGrid>
{ {
unsafe unsafe
{ {
return BrightnessGridNative.sp_brightness_grid_width(Instance); return Instance->Width();
} }
} }
} }
@ -75,7 +75,7 @@ public sealed class BrightnessGrid : SpNativeInstance<SPBrightnessGrid>
{ {
unsafe unsafe
{ {
return BrightnessGridNative.sp_brightness_grid_height(Instance); return Instance->Height();
} }
} }
} }
@ -86,15 +86,14 @@ public sealed class BrightnessGrid : SpNativeInstance<SPBrightnessGrid>
{ {
unsafe unsafe
{ {
var slice = BrightnessGridNative.sp_brightness_grid_unsafe_data_ref(Instance); return Instance->UnsafeDataRef().AsSpan();
return new Span<byte>(slice.start, (int)slice.length);
} }
} }
} }
private unsafe BrightnessGrid(SPBrightnessGrid* instance) : base(instance) private unsafe BrightnessGrid(BindGen.BrightnessGrid* instance) : base(instance)
{ {
} }
private protected override unsafe void Free() => BrightnessGridNative.sp_brightness_grid_free(Instance); private protected override unsafe void Free() => Instance->Free();
} }

View file

@ -3,7 +3,7 @@ using ServicePoint.BindGen;
namespace ServicePoint; namespace ServicePoint;
public sealed class Command : SpNativeInstance<SPCommand> public sealed class Command : SpNativeInstance<BindGen.Command>
{ {
public static bool TryFromPacket(Packet packet, [MaybeNullWhen(false)] out Command command) public static bool TryFromPacket(Packet packet, [MaybeNullWhen(false)] out Command command)
{ {
@ -25,7 +25,7 @@ public sealed class Command : SpNativeInstance<SPCommand>
{ {
unsafe unsafe
{ {
return new Command(CommandNative.sp_command_clone(Instance)); return new Command(Instance->Clone());
} }
} }
@ -121,9 +121,9 @@ public sealed class Command : SpNativeInstance<SPCommand>
} }
} }
private unsafe Command(SPCommand* instance) : base(instance) private unsafe Command(BindGen.Command* instance) : base(instance)
{ {
} }
private protected override unsafe void Free() => CommandNative.sp_command_free(Instance); private protected override unsafe void Free() => Instance->Free();
} }

View file

@ -3,7 +3,7 @@ using ServicePoint.BindGen;
namespace ServicePoint; namespace ServicePoint;
public sealed class Connection : SpNativeInstance<SPConnection> public sealed class Connection : SpNativeInstance<BindGen.Connection>
{ {
public static Connection Open(string host) public static Connection Open(string host)
{ {
@ -20,7 +20,7 @@ public sealed class Connection : SpNativeInstance<SPConnection>
{ {
unsafe unsafe
{ {
return ConnectionNative.sp_connection_send_packet(Instance, packet.Into()); return Instance->SendPacket(packet.Into());
} }
} }
@ -28,13 +28,13 @@ public sealed class Connection : SpNativeInstance<SPConnection>
{ {
unsafe unsafe
{ {
return ConnectionNative.sp_connection_send_command(Instance, command.Into()); return Instance->SendCommand(command.Into());
} }
} }
private protected override unsafe void Free() => ConnectionNative.sp_connection_free(Instance); private protected override unsafe void Free() => Instance->Free();
private unsafe Connection(SPConnection* instance) : base(instance) private unsafe Connection(BindGen.Connection* instance) : base(instance)
{ {
} }
} }

View file

@ -3,23 +3,23 @@ using ServicePoint.BindGen;
namespace ServicePoint; namespace ServicePoint;
public sealed class Cp437Grid : SpNativeInstance<SPCp437Grid> public sealed class Cp437Grid : SpNativeInstance<BindGen.Cp437Grid>
{ {
public static Cp437Grid New(int width, int height) public static Cp437Grid New(nuint width, nuint height)
{ {
unsafe unsafe
{ {
return new Cp437Grid(Cp437GridNative.sp_cp437_grid_new((nuint)width, (nuint)height)); return new Cp437Grid(Cp437GridNative.sp_cp437_grid_new(width, height));
} }
} }
public static Cp437Grid Load(int width, int height, Span<byte> bytes) public static Cp437Grid Load(nuint width, nuint height, Span<byte> bytes)
{ {
unsafe unsafe
{ {
fixed (byte* bytesPtr = bytes) fixed (byte* bytesPtr = bytes)
{ {
return new Cp437Grid(Cp437GridNative.sp_cp437_grid_load((nuint)width, (nuint)height, bytesPtr, return new Cp437Grid(Cp437GridNative.sp_cp437_grid_load(width, height, bytesPtr,
(nuint)bytes.Length)); (nuint)bytes.Length));
} }
} }
@ -29,38 +29,38 @@ public sealed class Cp437Grid : SpNativeInstance<SPCp437Grid>
{ {
unsafe unsafe
{ {
return new Cp437Grid(Cp437GridNative.sp_cp437_grid_clone(Instance)); return new Cp437Grid(Instance->Clone());
} }
} }
public byte this[int x, int y] public byte this[nuint x, nuint y]
{ {
get get
{ {
unsafe unsafe
{ {
return Cp437GridNative.sp_cp437_grid_get(Instance, (nuint)x, (nuint)y); return Instance->Get(x, y);
} }
} }
set set
{ {
unsafe unsafe
{ {
Cp437GridNative.sp_cp437_grid_set(Instance, (nuint)x, (nuint)y, value); Instance->Set(x, y, value);
} }
} }
} }
public string this[int y] public string this[nuint y]
{ {
set set
{ {
var width = Width; var width = Width;
ArgumentOutOfRangeException.ThrowIfGreaterThan(value.Length, width); ArgumentOutOfRangeException.ThrowIfGreaterThan((nuint)value.Length, width);
var x = 0; nuint x = 0;
for (; x < value.Length; x++) for (; x < (nuint)value.Length; x++)
this[x, y] = (byte)value[x]; this[x, y] = (byte)value[(int)x];
for (; x < width; x++) for (; x < width; x++)
this[x, y] = 0; this[x, y] = 0;
@ -69,7 +69,7 @@ public sealed class Cp437Grid : SpNativeInstance<SPCp437Grid>
get get
{ {
var sb = new StringBuilder(); var sb = new StringBuilder();
for (int x = 0; x < Width; x++) for (nuint x = 0; x < Width; x++)
{ {
var val = this[x, y]; var val = this[x, y];
if (val == 0) if (val == 0)
@ -85,28 +85,28 @@ public sealed class Cp437Grid : SpNativeInstance<SPCp437Grid>
{ {
unsafe unsafe
{ {
Cp437GridNative.sp_cp437_grid_fill(Instance, value); Instance->Fill(value);
} }
} }
public int Width public nuint Width
{ {
get get
{ {
unsafe unsafe
{ {
return (int)Cp437GridNative.sp_cp437_grid_width(Instance); return Instance->Width();
} }
} }
} }
public int Height public nuint Height
{ {
get get
{ {
unsafe unsafe
{ {
return (int)Cp437GridNative.sp_cp437_grid_height(Instance); return Instance->Height();
} }
} }
} }
@ -117,15 +117,14 @@ public sealed class Cp437Grid : SpNativeInstance<SPCp437Grid>
{ {
unsafe unsafe
{ {
var slice = Cp437GridNative.sp_cp437_grid_unsafe_data_ref(Instance); return Instance->UnsafeDataRef().AsSpan();
return new Span<byte>(slice.start, (int)slice.length);
} }
} }
} }
private unsafe Cp437Grid(SPCp437Grid* instance) : base(instance) private unsafe Cp437Grid(BindGen.Cp437Grid* instance) : base(instance)
{ {
} }
private protected override unsafe void Free() => Cp437GridNative.sp_cp437_grid_free(Instance); private protected override unsafe void Free() => Instance->Free();
} }

View file

@ -1,2 +1 @@
global using System; global using System;
global using CompressionCode = ServicePoint.BindGen.SPCompressionCode;

View file

@ -3,7 +3,7 @@ using ServicePoint.BindGen;
namespace ServicePoint; namespace ServicePoint;
public sealed class Packet : SpNativeInstance<SPPacket> public sealed class Packet : SpNativeInstance<BindGen.Packet>
{ {
public static Packet FromCommand(Command command) public static Packet FromCommand(Command command)
{ {
@ -28,9 +28,9 @@ public sealed class Packet : SpNativeInstance<SPPacket>
} }
} }
private unsafe Packet(SPPacket* instance) : base(instance) private unsafe Packet(BindGen.Packet* instance) : base(instance)
{ {
} }
private protected override unsafe void Free() => PacketNative.sp_packet_free(Instance); private protected override unsafe void Free() => Instance->Free();
} }

View file

@ -9,6 +9,11 @@
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck> <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
</PropertyGroup> </PropertyGroup>
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<PropertyGroup> <PropertyGroup>
<PackageId>ServicePoint</PackageId> <PackageId>ServicePoint</PackageId>
<Version>0.10.0</Version> <Version>0.10.0</Version>
@ -47,6 +52,11 @@
</Content> </Content>
</ItemGroup> </ItemGroup>
<!--additional csbindgen code generators-->
<ItemGroup>
<PackageReference Include="csbindgen" Version="1.9.3" PrivateAssets="All"/>
</ItemGroup>
<ItemGroup> <ItemGroup>
<!-- include link to source code at revision --> <!-- include link to source code at revision -->
<None Include="../README.md" Pack="true" PackagePath="\"/> <None Include="../README.md" Pack="true" PackagePath="\"/>

View file

@ -1,4 +1,5 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using ServicePoint.BindGen;
namespace ServicePoint; namespace ServicePoint;
@ -13,4 +14,9 @@ public static class ServicePointExtensions
{ {
return Command.TryFromPacket(packet, out command); return Command.TryFromPacket(packet, out command);
} }
public unsafe static Span<byte> AsSpan(this ByteSlice slice)
{
return new Span<byte>(slice.start, (int)slice.length);
}
} }

View file

@ -16,8 +16,12 @@ fn main() {
for path in &paths { for path in &paths {
println!("cargo:rerun-if-changed={}", path.display()); println!("cargo:rerun-if-changed={}", path.display());
let class = Path::new(path).file_stem().unwrap().to_str().unwrap(); let file: &str = Path::new(path).file_stem().unwrap().to_str().unwrap();
let class = class.to_case(Case::UpperCamel) + "Native"; if file == "lib"{
continue;
}
let class = file.to_case(Case::UpperCamel) + "Native";
csbindgen::Builder::default() csbindgen::Builder::default()
.input_extern_file(path) .input_extern_file(path)
.csharp_class_name(&class) .csharp_class_name(&class)
@ -27,6 +31,16 @@ fn main() {
.csharp_class_accessibility("public") .csharp_class_accessibility("public")
.csharp_generate_const_filter(|_| true) .csharp_generate_const_filter(|_| true)
.always_included_types(["SPByteSlice", "SPCompressionCode"]) .always_included_types(["SPByteSlice", "SPCompressionCode"])
.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(format!("ServicePoint/BindGen/{}.g.cs", &class)) .generate_csharp_file(format!("ServicePoint/BindGen/{}.g.cs", &class))
.unwrap(); .unwrap();
} }

View file

@ -1,6 +1,5 @@
using ServicePoint; using ServicePoint;
using CompressionCode = ServicePoint.BindGen.CompressionCode;
using CompressionCode = ServicePoint.BindGen.SPCompressionCode;
using var connection = Connection.Open("127.0.0.1:2342"); using var connection = Connection.Open("127.0.0.1:2342");