From 5f15635cd8f2bd0c573e68733f58d1b29e4f32fe Mon Sep 17 00:00:00 2001 From: Samuele Lorefice Date: Wed, 22 Jan 2025 18:11:09 +0100 Subject: [PATCH] Fixed array generation expression, removed compat types as they are being remapped --- BlendFile/CompatTypes/int64_t.cs | 9 --------- BlendFile/CompatTypes/int8_t.cs | 31 ------------------------------ BlendFile/CompatTypes/uchar.cs | 32 ------------------------------- BlendFile/CompatTypes/uint64_t.cs | 9 --------- CodeGenerator/Program.cs | 4 ++-- 5 files changed, 2 insertions(+), 83 deletions(-) delete mode 100644 BlendFile/CompatTypes/int64_t.cs delete mode 100644 BlendFile/CompatTypes/int8_t.cs delete mode 100644 BlendFile/CompatTypes/uchar.cs delete mode 100644 BlendFile/CompatTypes/uint64_t.cs diff --git a/BlendFile/CompatTypes/int64_t.cs b/BlendFile/CompatTypes/int64_t.cs deleted file mode 100644 index bce2982..0000000 --- a/BlendFile/CompatTypes/int64_t.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace BlendFile.CompatTypes; - -public readonly struct int64_t { - public Int64 Value { get; } - - public int64_t(long value) { - Value = value; - } -} \ No newline at end of file diff --git a/BlendFile/CompatTypes/int8_t.cs b/BlendFile/CompatTypes/int8_t.cs deleted file mode 100644 index 8875feb..0000000 --- a/BlendFile/CompatTypes/int8_t.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace BlendFile.CompatTypes; - -public readonly struct int8_t { - public int8_t Value => _value; - private readonly sbyte _value; - - public int8_t(sbyte value) => _value = value; - public int8_t(int8_t value) => _value = value._value; - - public static explicit operator sbyte(int8_t value) => value._value; - public static implicit operator int8_t(sbyte value) => new(value); - - public static explicit operator byte(int8_t value) => (byte)value._value; - public static implicit operator int8_t(byte value) => new((sbyte)value); - - public static explicit operator int(int8_t value) => value._value; - public static implicit operator int8_t(int value) => new((sbyte)value); - - public static int8_t operator +(int8_t left, int8_t right) => left._value + right._value; - public static int8_t operator -(int8_t left, int8_t right) => left._value - right._value; - public static int8_t operator *(int8_t left, int8_t right) => left._value * right._value; - public static int8_t operator /(int8_t left, int8_t right) => left._value / right._value; - public static int8_t operator %(int8_t left, int8_t right) => left._value % right._value; - public static int8_t operator &(int8_t left, int8_t right) => left._value & right._value; - public static int8_t operator |(int8_t left, int8_t right) => left._value | right._value; - public static int8_t operator ^(int8_t left, int8_t right) => left._value ^ right._value; - public static int8_t operator <<(int8_t left, int right) => left._value << right; - public static int8_t operator >>(int8_t left, int right) => left._value >> right; - public static int8_t operator ++(int8_t value) => new (value._value + 1); - public static int8_t operator --(int8_t value) => new (value._value - 1); -} \ No newline at end of file diff --git a/BlendFile/CompatTypes/uchar.cs b/BlendFile/CompatTypes/uchar.cs deleted file mode 100644 index d333e21..0000000 --- a/BlendFile/CompatTypes/uchar.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace BlendFile.CompatTypes; - -public readonly struct uchar { - public uchar Value => _value; - - private readonly byte _value; - - public uchar(byte value) => _value = value; - public uchar(uchar value) => _value = value._value; - - public static explicit operator byte(uchar value) => value._value; - public static implicit operator uchar(byte value) => new(value); - - public static explicit operator sbyte(uchar value) => (sbyte)value._value; - public static implicit operator uchar(sbyte value) => new((byte)value); - - public static explicit operator int(uchar value) => value._value; - public static implicit operator uchar(int value) => new((byte)value); - - public static uchar operator +(uchar left, uchar right) => left._value + right._value; - public static uchar operator -(uchar left, uchar right) => left._value - right._value; - public static uchar operator *(uchar left, uchar right) => left._value * right._value; - public static uchar operator /(uchar left, uchar right) => left._value / right._value; - public static uchar operator %(uchar left, uchar right) => left._value % right._value; - public static uchar operator &(uchar left, uchar right) => left._value & right._value; - public static uchar operator |(uchar left, uchar right) => left._value | right._value; - public static uchar operator ^(uchar left, uchar right) => left._value ^ right._value; - public static uchar operator <<(uchar left, byte right) => left._value << right; - public static uchar operator >>(uchar left, byte right) => left._value >> right; - public static uchar operator ++(uchar value) => new (value._value + 1); - public static uchar operator --(uchar value) => new (value._value - 1); -} diff --git a/BlendFile/CompatTypes/uint64_t.cs b/BlendFile/CompatTypes/uint64_t.cs deleted file mode 100644 index d92da8f..0000000 --- a/BlendFile/CompatTypes/uint64_t.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace BlendFile.CompatTypes; - -public readonly struct uint64_t { - public UInt64 Value { get; } - - public uint64_t(ulong value) { - Value = value; - } -} \ No newline at end of file diff --git a/CodeGenerator/Program.cs b/CodeGenerator/Program.cs index 42b33e1..8eafcbf 100644 --- a/CodeGenerator/Program.cs +++ b/CodeGenerator/Program.cs @@ -171,8 +171,8 @@ namespace CodeGenerator { } public static CodeExpression GenerateArrayInitExpression(CodeTypeReference type, IEnumerable dimensions) { - string dims = string.Concat(dimensions.Select(d => $"[{d}]")); - return new CodeSnippetExpression($"new {type.BaseType}{dims}"); + string dims = string.Concat(dimensions.Select(d => $"{d},")); + return new CodeSnippetExpression($"new {type.BaseType}[{dims}]"); } private static CodeTypeConstructor GenerateStaticConstructor(CodeTypeDeclaration ctd) {