add dunder to prevent name clashes

This commit is contained in:
Vinzenz Schroeter 2024-10-20 12:08:19 +02:00
parent c3022e567c
commit 240766dc11
10 changed files with 97 additions and 97 deletions

View file

@ -3,7 +3,7 @@
//! prefix `sp_connection_` //! prefix `sp_connection_`
use std::ffi::{c_char, CStr}; use std::ffi::{c_char, CStr};
use std::ptr::null_mut; use std::ptr::{null_mut, NonNull};
use crate::{SPCommand, SPPacket}; use crate::{SPCommand, SPPacket};
@ -18,7 +18,7 @@ use crate::{SPCommand, SPPacket};
/// ``` /// ```
pub struct SPConnection(pub(crate) servicepoint::Connection); pub struct SPConnection(pub(crate) servicepoint::Connection);
/// Creates a new instance of [SPConnection]. /// Creates a new instance of [SPConnection] that uses UDP to send.
/// ///
/// returns: NULL if connection fails, or connected instance /// returns: NULL if connection fails, or connected instance
/// ///
@ -96,7 +96,7 @@ pub unsafe extern "C" fn sp_connection_send_packet(
/// - `command` points to a valid instance of [SPPacket] /// - `command` points to a valid instance of [SPPacket]
/// - `command` is not used concurrently or after this call /// - `command` is not used concurrently or after this call
/// ///
/// servicepoint_csbindgen_consumes: packet /// servicepoint_csbindgen_consumes: command
#[no_mangle] #[no_mangle]
pub unsafe extern "C" fn sp_connection_send_command( pub unsafe extern "C" fn sp_connection_send_command(
connection: *const SPConnection, connection: *const SPConnection,

View file

@ -1,6 +1,6 @@
//! re-exported constants for use in C //! re-exported constants for use in C
use servicepoint::{CompressionCode}; use servicepoint::CompressionCode;
use std::time::Duration; use std::time::Duration;
/// size of a single tile in one dimension /// size of a single tile in one dimension

View file

@ -81,7 +81,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public BitVec Clone() public BitVec Clone()
{ {
return new BitVec(BitVec.sp_bitvec_clone(this.Instance)); return new BitVec(BitVec.sp_bitvec_clone(this.__Instance));
} }
/// <summary> /// <summary>
@ -109,7 +109,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public bool Get(nuint index) public bool Get(nuint index)
{ {
return BitVec.sp_bitvec_get(this.Instance, index); return BitVec.sp_bitvec_get(this.__Instance, index);
} }
/// <summary> /// <summary>
@ -136,7 +136,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void Set(nuint index, bool value) public void Set(nuint index, bool value)
{ {
BitVec.sp_bitvec_set(this.Instance, index, value); BitVec.sp_bitvec_set(this.__Instance, index, value);
} }
/// <summary> /// <summary>
@ -161,7 +161,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void Fill(bool value) public void Fill(bool value)
{ {
BitVec.sp_bitvec_fill(this.Instance, value); BitVec.sp_bitvec_fill(this.__Instance, value);
} }
/// <summary> /// <summary>
@ -184,7 +184,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public nuint Len() public nuint Len()
{ {
return BitVec.sp_bitvec_len(this.Instance); return BitVec.sp_bitvec_len(this.__Instance);
} }
/// <summary> /// <summary>
@ -207,7 +207,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public bool IsEmpty() public bool IsEmpty()
{ {
return BitVec.sp_bitvec_is_empty(this.Instance); return BitVec.sp_bitvec_is_empty(this.__Instance);
} }
/// <summary> /// <summary>
@ -232,13 +232,13 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public SPByteSlice UnsafeDataRef() public SPByteSlice UnsafeDataRef()
{ {
return BitVec.sp_bitvec_unsafe_data_ref(this.Instance); return BitVec.sp_bitvec_unsafe_data_ref(this.__Instance);
} }
#region internal machinery #region internal machinery
private SPBitVec* _instance; private SPBitVec* _instance;
internal SPBitVec* Instance internal SPBitVec* __Instance
{ {
get get
{ {
@ -254,26 +254,26 @@ namespace ServicePoint
_instance = instance; _instance = instance;
} }
internal SPBitVec* Into() internal SPBitVec* __Into()
{ {
var instance = Instance; var instance = __Instance;
_instance = null; _instance = null;
return instance; return instance;
} }
private void Free() private void __Free()
{ {
if (_instance != null) if (_instance != null)
BitVec.sp_bitvec_free(Into()); BitVec.sp_bitvec_free(__Into());
} }
public void Dispose() public void Dispose()
{ {
Free(); __Free();
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
~BitVec() => Free(); ~BitVec() => __Free();
#endregion #endregion

View file

@ -88,7 +88,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public Bitmap Clone() public Bitmap Clone()
{ {
return new Bitmap(Bitmap.sp_bitmap_clone(this.Instance)); return new Bitmap(Bitmap.sp_bitmap_clone(this.__Instance));
} }
/// <summary> /// <summary>
@ -114,7 +114,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public bool Get(nuint x, nuint y) public bool Get(nuint x, nuint y)
{ {
return Bitmap.sp_bitmap_get(this.Instance, x, y); return Bitmap.sp_bitmap_get(this.__Instance, x, y);
} }
/// <summary> /// <summary>
@ -143,7 +143,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void Set(nuint x, nuint y, bool value) public void Set(nuint x, nuint y, bool value)
{ {
Bitmap.sp_bitmap_set(this.Instance, x, y, value); Bitmap.sp_bitmap_set(this.__Instance, x, y, value);
} }
/// <summary> /// <summary>
@ -168,7 +168,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void Fill(bool value) public void Fill(bool value)
{ {
Bitmap.sp_bitmap_fill(this.Instance, value); Bitmap.sp_bitmap_fill(this.__Instance, value);
} }
/// <summary> /// <summary>
@ -191,7 +191,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public nuint Width() public nuint Width()
{ {
return Bitmap.sp_bitmap_width(this.Instance); return Bitmap.sp_bitmap_width(this.__Instance);
} }
/// <summary> /// <summary>
@ -214,7 +214,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public nuint Height() public nuint Height()
{ {
return Bitmap.sp_bitmap_height(this.Instance); return Bitmap.sp_bitmap_height(this.__Instance);
} }
/// <summary> /// <summary>
@ -235,13 +235,13 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public SPByteSlice UnsafeDataRef() public SPByteSlice UnsafeDataRef()
{ {
return Bitmap.sp_bitmap_unsafe_data_ref(this.Instance); return Bitmap.sp_bitmap_unsafe_data_ref(this.__Instance);
} }
#region internal machinery #region internal machinery
private SPBitmap* _instance; private SPBitmap* _instance;
internal SPBitmap* Instance internal SPBitmap* __Instance
{ {
get get
{ {
@ -257,26 +257,26 @@ namespace ServicePoint
_instance = instance; _instance = instance;
} }
internal SPBitmap* Into() internal SPBitmap* __Into()
{ {
var instance = Instance; var instance = __Instance;
_instance = null; _instance = null;
return instance; return instance;
} }
private void Free() private void __Free()
{ {
if (_instance != null) if (_instance != null)
Bitmap.sp_bitmap_free(Into()); Bitmap.sp_bitmap_free(__Into());
} }
public void Dispose() public void Dispose()
{ {
Free(); __Free();
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
~Bitmap() => Free(); ~Bitmap() => __Free();
#endregion #endregion

View file

@ -78,7 +78,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public BrightnessGrid Clone() public BrightnessGrid Clone()
{ {
return new BrightnessGrid(BrightnessGrid.sp_brightness_grid_clone(this.Instance)); return new BrightnessGrid(BrightnessGrid.sp_brightness_grid_clone(this.__Instance));
} }
/// <summary> /// <summary>
@ -106,7 +106,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public byte Get(nuint x, nuint y) public byte Get(nuint x, nuint y)
{ {
return BrightnessGrid.sp_brightness_grid_get(this.Instance, x, y); return BrightnessGrid.sp_brightness_grid_get(this.__Instance, x, y);
} }
/// <summary> /// <summary>
@ -136,7 +136,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void Set(nuint x, nuint y, byte value) public void Set(nuint x, nuint y, byte value)
{ {
BrightnessGrid.sp_brightness_grid_set(this.Instance, x, y, value); BrightnessGrid.sp_brightness_grid_set(this.__Instance, x, y, value);
} }
/// <summary> /// <summary>
@ -162,7 +162,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void Fill(byte value) public void Fill(byte value)
{ {
BrightnessGrid.sp_brightness_grid_fill(this.Instance, value); BrightnessGrid.sp_brightness_grid_fill(this.__Instance, value);
} }
/// <summary> /// <summary>
@ -187,7 +187,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public nuint Width() public nuint Width()
{ {
return BrightnessGrid.sp_brightness_grid_width(this.Instance); return BrightnessGrid.sp_brightness_grid_width(this.__Instance);
} }
/// <summary> /// <summary>
@ -212,7 +212,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public nuint Height() public nuint Height()
{ {
return BrightnessGrid.sp_brightness_grid_height(this.Instance); return BrightnessGrid.sp_brightness_grid_height(this.__Instance);
} }
/// <summary> /// <summary>
@ -239,13 +239,13 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public SPByteSlice UnsafeDataRef() public SPByteSlice UnsafeDataRef()
{ {
return BrightnessGrid.sp_brightness_grid_unsafe_data_ref(this.Instance); return BrightnessGrid.sp_brightness_grid_unsafe_data_ref(this.__Instance);
} }
#region internal machinery #region internal machinery
private SPBrightnessGrid* _instance; private SPBrightnessGrid* _instance;
internal SPBrightnessGrid* Instance internal SPBrightnessGrid* __Instance
{ {
get get
{ {
@ -261,26 +261,26 @@ namespace ServicePoint
_instance = instance; _instance = instance;
} }
internal SPBrightnessGrid* Into() internal SPBrightnessGrid* __Into()
{ {
var instance = Instance; var instance = __Instance;
_instance = null; _instance = null;
return instance; return instance;
} }
private void Free() private void __Free()
{ {
if (_instance != null) if (_instance != null)
BrightnessGrid.sp_brightness_grid_free(Into()); BrightnessGrid.sp_brightness_grid_free(__Into());
} }
public void Dispose() public void Dispose()
{ {
Free(); __Free();
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
~BrightnessGrid() => Free(); ~BrightnessGrid() => __Free();
#endregion #endregion

View file

@ -40,7 +40,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static Command? TryFromPacket(Packet packet) public static Command? TryFromPacket(Packet packet)
{ {
var native = Command.sp_command_try_from_packet(packet.Into()); var native = Command.sp_command_try_from_packet(packet.__Into());
return native == null ? null : new Command(native); return native == null ? null : new Command(native);
} }
@ -65,7 +65,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public Command Clone() public Command Clone()
{ {
return new Command(Command.sp_command_clone(this.Instance)); return new Command(Command.sp_command_clone(this.__Instance));
} }
/// <summary> /// <summary>
@ -179,7 +179,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static Command CharBrightness(nuint x, nuint y, BrightnessGrid grid) public static Command CharBrightness(nuint x, nuint y, BrightnessGrid grid)
{ {
return new Command(Command.sp_command_char_brightness(x, y, grid.Into())); return new Command(Command.sp_command_char_brightness(x, y, grid.__Into()));
} }
/// <summary> /// <summary>
@ -214,7 +214,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static Command BitmapLinear(nuint offset, BitVec bit_vec, CompressionCode compression) public static Command BitmapLinear(nuint offset, BitVec bit_vec, CompressionCode compression)
{ {
return new Command(Command.sp_command_bitmap_linear(offset, bit_vec.Into(), compression)); return new Command(Command.sp_command_bitmap_linear(offset, bit_vec.__Into(), compression));
} }
/// <summary> /// <summary>
@ -249,7 +249,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static Command BitmapLinearAnd(nuint offset, BitVec bit_vec, CompressionCode compression) public static Command BitmapLinearAnd(nuint offset, BitVec bit_vec, CompressionCode compression)
{ {
return new Command(Command.sp_command_bitmap_linear_and(offset, bit_vec.Into(), compression)); return new Command(Command.sp_command_bitmap_linear_and(offset, bit_vec.__Into(), compression));
} }
/// <summary> /// <summary>
@ -284,7 +284,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static Command BitmapLinearOr(nuint offset, BitVec bit_vec, CompressionCode compression) public static Command BitmapLinearOr(nuint offset, BitVec bit_vec, CompressionCode compression)
{ {
return new Command(Command.sp_command_bitmap_linear_or(offset, bit_vec.Into(), compression)); return new Command(Command.sp_command_bitmap_linear_or(offset, bit_vec.__Into(), compression));
} }
/// <summary> /// <summary>
@ -319,7 +319,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static Command BitmapLinearXor(nuint offset, BitVec bit_vec, CompressionCode compression) public static Command BitmapLinearXor(nuint offset, BitVec bit_vec, CompressionCode compression)
{ {
return new Command(Command.sp_command_bitmap_linear_xor(offset, bit_vec.Into(), compression)); return new Command(Command.sp_command_bitmap_linear_xor(offset, bit_vec.__Into(), compression));
} }
/// <summary> /// <summary>
@ -347,7 +347,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static Command Cp437Data(nuint x, nuint y, Cp437Grid grid) public static Command Cp437Data(nuint x, nuint y, Cp437Grid grid)
{ {
return new Command(Command.sp_command_cp437_data(x, y, grid.Into())); return new Command(Command.sp_command_cp437_data(x, y, grid.__Into()));
} }
/// <summary> /// <summary>
@ -377,13 +377,13 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static Command BitmapLinearWin(nuint x, nuint y, Bitmap bitmap, CompressionCode compression_code) public static Command BitmapLinearWin(nuint x, nuint y, Bitmap bitmap, CompressionCode compression_code)
{ {
return new Command(Command.sp_command_bitmap_linear_win(x, y, bitmap.Into(), compression_code)); return new Command(Command.sp_command_bitmap_linear_win(x, y, bitmap.__Into(), compression_code));
} }
#region internal machinery #region internal machinery
private SPCommand* _instance; private SPCommand* _instance;
internal SPCommand* Instance internal SPCommand* __Instance
{ {
get get
{ {
@ -399,26 +399,26 @@ namespace ServicePoint
_instance = instance; _instance = instance;
} }
internal SPCommand* Into() internal SPCommand* __Into()
{ {
var instance = Instance; var instance = __Instance;
_instance = null; _instance = null;
return instance; return instance;
} }
private void Free() private void __Free()
{ {
if (_instance != null) if (_instance != null)
Command.sp_command_free(Into()); Command.sp_command_free(__Into());
} }
public void Dispose() public void Dispose()
{ {
Free(); __Free();
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
~Command() => Free(); ~Command() => __Free();
#endregion #endregion

View file

@ -15,7 +15,7 @@ namespace ServicePoint
{ {
#nullable enable #nullable enable
/// <summary> /// <summary>
/// Creates a new instance of [SPConnection]. /// Creates a new instance of [SPConnection] that uses UDP to send.
/// ///
/// returns: NULL if connection fails, or connected instance /// returns: NULL if connection fails, or connected instance
/// ///
@ -62,7 +62,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public bool SendPacket(Packet packet) public bool SendPacket(Packet packet)
{ {
return Connection.sp_connection_send_packet(this.Instance, packet.Into()); return Connection.sp_connection_send_packet(this.__Instance, packet.__Into());
} }
/// <summary> /// <summary>
@ -85,18 +85,18 @@ namespace ServicePoint
/// - `command` points to a valid instance of [SPPacket] /// - `command` points to a valid instance of [SPPacket]
/// - `command` is not used concurrently or after this call /// - `command` is not used concurrently or after this call
/// ///
/// servicepoint_csbindgen_consumes: packet /// servicepoint_csbindgen_consumes: command
/// </summary> /// </summary>
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public bool SendCommand(Command command) public bool SendCommand(Command command)
{ {
return Connection.sp_connection_send_command(this.Instance, command.Instance); return Connection.sp_connection_send_command(this.__Instance, command.__Into());
} }
#region internal machinery #region internal machinery
private SPConnection* _instance; private SPConnection* _instance;
internal SPConnection* Instance internal SPConnection* __Instance
{ {
get get
{ {
@ -112,26 +112,26 @@ namespace ServicePoint
_instance = instance; _instance = instance;
} }
internal SPConnection* Into() internal SPConnection* __Into()
{ {
var instance = Instance; var instance = __Instance;
_instance = null; _instance = null;
return instance; return instance;
} }
private void Free() private void __Free()
{ {
if (_instance != null) if (_instance != null)
Connection.sp_connection_free(Into()); Connection.sp_connection_free(__Into());
} }
public void Dispose() public void Dispose()
{ {
Free(); __Free();
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
~Connection() => Free(); ~Connection() => __Free();
#endregion #endregion

View file

@ -74,7 +74,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public Cp437Grid Clone() public Cp437Grid Clone()
{ {
return new Cp437Grid(Cp437Grid.sp_cp437_grid_clone(this.Instance)); return new Cp437Grid(Cp437Grid.sp_cp437_grid_clone(this.__Instance));
} }
/// <summary> /// <summary>
@ -100,7 +100,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public byte Get(nuint x, nuint y) public byte Get(nuint x, nuint y)
{ {
return Cp437Grid.sp_cp437_grid_get(this.Instance, x, y); return Cp437Grid.sp_cp437_grid_get(this.__Instance, x, y);
} }
/// <summary> /// <summary>
@ -129,7 +129,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void Set(nuint x, nuint y, byte value) public void Set(nuint x, nuint y, byte value)
{ {
Cp437Grid.sp_cp437_grid_set(this.Instance, x, y, value); Cp437Grid.sp_cp437_grid_set(this.__Instance, x, y, value);
} }
/// <summary> /// <summary>
@ -154,7 +154,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public void Fill(byte value) public void Fill(byte value)
{ {
Cp437Grid.sp_cp437_grid_fill(this.Instance, value); Cp437Grid.sp_cp437_grid_fill(this.__Instance, value);
} }
/// <summary> /// <summary>
@ -177,7 +177,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public nuint Width() public nuint Width()
{ {
return Cp437Grid.sp_cp437_grid_width(this.Instance); return Cp437Grid.sp_cp437_grid_width(this.__Instance);
} }
/// <summary> /// <summary>
@ -200,7 +200,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public nuint Height() public nuint Height()
{ {
return Cp437Grid.sp_cp437_grid_height(this.Instance); return Cp437Grid.sp_cp437_grid_height(this.__Instance);
} }
/// <summary> /// <summary>
@ -223,13 +223,13 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public SPByteSlice UnsafeDataRef() public SPByteSlice UnsafeDataRef()
{ {
return Cp437Grid.sp_cp437_grid_unsafe_data_ref(this.Instance); return Cp437Grid.sp_cp437_grid_unsafe_data_ref(this.__Instance);
} }
#region internal machinery #region internal machinery
private SPCp437Grid* _instance; private SPCp437Grid* _instance;
internal SPCp437Grid* Instance internal SPCp437Grid* __Instance
{ {
get get
{ {
@ -245,26 +245,26 @@ namespace ServicePoint
_instance = instance; _instance = instance;
} }
internal SPCp437Grid* Into() internal SPCp437Grid* __Into()
{ {
var instance = Instance; var instance = __Instance;
_instance = null; _instance = null;
return instance; return instance;
} }
private void Free() private void __Free()
{ {
if (_instance != null) if (_instance != null)
Cp437Grid.sp_cp437_grid_free(Into()); Cp437Grid.sp_cp437_grid_free(__Into());
} }
public void Dispose() public void Dispose()
{ {
Free(); __Free();
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
~Cp437Grid() => Free(); ~Cp437Grid() => __Free();
#endregion #endregion

View file

@ -38,7 +38,7 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public static Packet FromCommand(Command command) public static Packet FromCommand(Command command)
{ {
return new Packet(Packet.sp_packet_from_command(command.Into())); return new Packet(Packet.sp_packet_from_command(command.__Into()));
} }
/// <summary> /// <summary>
@ -87,13 +87,13 @@ namespace ServicePoint
[System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)] [System.Runtime.CompilerServices.MethodImplAttribute(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]
public Packet Clone() public Packet Clone()
{ {
return new Packet(Packet.sp_packet_clone(this.Instance)); return new Packet(Packet.sp_packet_clone(this.__Instance));
} }
#region internal machinery #region internal machinery
private SPPacket* _instance; private SPPacket* _instance;
internal SPPacket* Instance internal SPPacket* __Instance
{ {
get get
{ {
@ -109,26 +109,26 @@ namespace ServicePoint
_instance = instance; _instance = instance;
} }
internal SPPacket* Into() internal SPPacket* __Into()
{ {
var instance = Instance; var instance = __Instance;
_instance = null; _instance = null;
return instance; return instance;
} }
private void Free() private void __Free()
{ {
if (_instance != null) if (_instance != null)
Packet.sp_packet_free(Into()); Packet.sp_packet_free(__Into());
} }
public void Dispose() public void Dispose()
{ {
Free(); __Free();
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
~Packet() => Free(); ~Packet() => __Free();
#endregion #endregion

@ -1 +1 @@
Subproject commit 0442727088f0a2b165eddde446cc7be3461cc68b Subproject commit 55eb87936923e8fb3eb11cfc7be864c1f4833c98