Skip to content

Commit

Permalink
remove C prefix in csbindgen
Browse files Browse the repository at this point in the history
  • Loading branch information
kaesaecracker committed Aug 29, 2024
1 parent 956e5df commit e0d5eff
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 58 deletions.
100 changes: 50 additions & 50 deletions crates/servicepoint_binding_cs/ServicePoint/BindGen/ServicePoint.g.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/servicepoint_binding_cs/ServicePoint/BitVec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ServicePoint;

public sealed class BitVec : SpNativeInstance<BindGen.CBitVec>
public sealed class BitVec : SpNativeInstance<BindGen.BitVec>
{
public static BitVec New(int size)
{
Expand Down Expand Up @@ -80,7 +80,7 @@ public Span<byte> Data
}
}

private unsafe BitVec(BindGen.CBitVec* instance) : base(instance)
private unsafe BitVec(BindGen.BitVec* instance) : base(instance)
{
}

Expand Down
4 changes: 2 additions & 2 deletions crates/servicepoint_binding_cs/ServicePoint/BrightnessGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ServicePoint;

public sealed class BrightnessGrid : SpNativeInstance<BindGen.CBrightnessGrid>
public sealed class BrightnessGrid : SpNativeInstance<BindGen.BrightnessGrid>
{
public static BrightnessGrid New(int width, int height)
{
Expand Down Expand Up @@ -92,7 +92,7 @@ public Span<byte> Data
}
}

private unsafe BrightnessGrid(BindGen.CBrightnessGrid* instance) : base(instance)
private unsafe BrightnessGrid(BindGen.BrightnessGrid* instance) : base(instance)
{
}

Expand Down
4 changes: 2 additions & 2 deletions crates/servicepoint_binding_cs/ServicePoint/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace ServicePoint;

public sealed class Command : SpNativeInstance<BindGen.CCommand>
public sealed class Command : SpNativeInstance<BindGen.Command>
{
public static bool TryFromPacket(Packet packet, [MaybeNullWhen(false)] out Command command)
{
Expand Down Expand Up @@ -121,7 +121,7 @@ public static Command Cp437Data(int x, int y, Cp437Grid byteGrid)
}
}

private unsafe Command(BindGen.CCommand* instance) : base(instance)
private unsafe Command(BindGen.Command* instance) : base(instance)
{
}

Expand Down
4 changes: 2 additions & 2 deletions crates/servicepoint_binding_cs/ServicePoint/Cp437Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace ServicePoint;

public sealed class Cp437Grid : SpNativeInstance<BindGen.CCp437Grid>
public sealed class Cp437Grid : SpNativeInstance<BindGen.Cp437Grid>
{
public static Cp437Grid New(int width, int height)
{
Expand Down Expand Up @@ -123,7 +123,7 @@ public Span<byte> Data
}
}

private unsafe Cp437Grid(BindGen.CCp437Grid* instance) : base(instance)
private unsafe Cp437Grid(BindGen.Cp437Grid* instance) : base(instance)
{
}

Expand Down
10 changes: 10 additions & 0 deletions crates/servicepoint_binding_cs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ fn main() {
.csharp_use_nint_types(true)
.csharp_class_accessibility("public")
.csharp_generate_const_filter(|_| true)
.csharp_type_rename(move |name| {
if name.len() > 1
&& name.starts_with("C")
&& name.chars().nth(1).unwrap().is_uppercase()
{
name[1..].to_string()
} else {
name
}
})
.generate_csharp_file("ServicePoint/BindGen/ServicePoint.g.cs")
.unwrap();
}

0 comments on commit e0d5eff

Please sign in to comment.