From 4cfed6886cea13c4979f522fe0b83eeb3d156c2e Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Fri, 2 Feb 2024 15:56:27 -0800 Subject: [PATCH 1/7] Allow conversion to void* type --- CLanguage/Compiler/EmitContext.cs | 8 +++++++- CLanguage/Types/CType.cs | 32 ++++++++++++++++++++----------- CLanguageTests/OverloadTests.cs | 25 +++++++++++++++++++----- 3 files changed, 48 insertions(+), 17 deletions(-) diff --git a/CLanguage/Compiler/EmitContext.cs b/CLanguage/Compiler/EmitContext.cs index 98fac8a..645ddd8 100644 --- a/CLanguage/Compiler/EmitContext.cs +++ b/CLanguage/Compiler/EmitContext.cs @@ -122,12 +122,18 @@ public void EmitCast (CType fromType, CType toType) Emit (op); // This conversion is implicit with how the evaluator stores its stuff } - else if (fromBasicType != null && fromBasicType.IsIntegral && toType is CPointerType && fromBasicType.NumValues == toType.NumValues) { + else if (fromBasicType != null && fromBasicType.IsIntegral && toType is CPointerType) { // Support `const char *p = 0;` } else if (fromType is CArrayType fat && toType is CPointerType tpt && fat.ElementType.NumValues == tpt.InnerType.NumValues) { // Demote arrays to pointers } + else if (fromType is CArrayType && toType.IsVoidPointer) { + // Demote arrays to void pointers without size check. Better hope sizeof works. + } + else if (fromType.IsPointer && toType.IsVoidPointer) { + // Demote pointers to void pointers without size check. Better hope sizeof works. + } else if (fromType is CEnumType et && toType is CIntType bt) { // Enums act like ints } diff --git a/CLanguage/Types/CType.cs b/CLanguage/Types/CType.cs index 927c513..86c9612 100644 --- a/CLanguage/Types/CType.cs +++ b/CLanguage/Types/CType.cs @@ -1,9 +1,9 @@ -using System; +using System; using System.Linq; using System.Text; -using CLanguage.Interpreter; +using CLanguage.Interpreter; using CLanguage.Syntax; -using CLanguage.Compiler; +using CLanguage.Compiler; namespace CLanguage.Types { @@ -11,21 +11,31 @@ public abstract class CType { public TypeQualifiers TypeQualifiers { get; set; } - public abstract int GetByteSize (EmitContext c); + public abstract int GetByteSize (EmitContext c); public abstract int NumValues { get; } public static readonly CVoidType Void = new CVoidType (); public virtual bool IsIntegral => false; - public virtual bool IsVoid => false; - - readonly Lazy pointer; - - public CPointerType Pointer => pointer.Value; - + public virtual bool IsVoid => false; + + readonly Lazy pointer; + + public CPointerType Pointer => pointer.Value; + + public bool IsVoidPointer => this switch { + CPointerType pt => pt.InnerType.IsVoid || pt.InnerType.IsVoidPointer, + _ => false, + }; + + public bool IsPointer => this switch { + CPointerType pt => true, + _ => false, + }; + public CType () - { + { pointer = new Lazy (CreatePointerType); } diff --git a/CLanguageTests/OverloadTests.cs b/CLanguageTests/OverloadTests.cs index c437eef..ab32f38 100644 --- a/CLanguageTests/OverloadTests.cs +++ b/CLanguageTests/OverloadTests.cs @@ -8,12 +8,12 @@ namespace CLanguage.Tests [TestClass] public class OverloadTests { - CInterpreter Run (string code) + static CInterpreter Run (string code) { var fullCode = "void start() { __cinit(); main(); } " + code; var i = CLanguageService.CreateInterpreter (fullCode, new ArduinoTestMachineInfo (), printer: new TestPrinter ()); i.Reset ("start"); - i.Step (); + i.Run (); return i; } @@ -102,13 +102,28 @@ void main () { } [TestMethod] - public void PrintlnConstCharPtr () + public void VoidPtrFromArray () { var i = Run (@" +int f(void *x) { return 1; } +int xs[5] = { 10, 20, 30, 40, 50 }; void main () { - Serial.println(""hello""); + int fr = f(xs); + assertAreEqual (1, fr); +}"); + } + + [TestMethod] + public void VoidPtrFromOtherPtr () + { + var i = Run (@" +int f(void *x) { return 1; } +int xs[5] = { 10, 20, 30, 40, 50 }; +void main () { + int *p = xs; + int fr = f(p); + assertAreEqual (1, fr); }"); - Assert.AreEqual("hello\n", ((ArduinoTestMachineInfo)i.Executable.MachineInfo).Arduino.SerialOut.ToString()); } } } From 463432cbf131f610f96d4831c1fdfc73d4a13000 Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Fri, 2 Feb 2024 16:03:29 -0800 Subject: [PATCH 2/7] Interpreter sizeof report num values so low level functions can work --- CLanguage/Compiler/EmitContext.cs | 4 ++-- CLanguage/Syntax/SizeOfExpression.cs | 2 +- CLanguage/Syntax/SizeOfTypeExpression.cs | 2 +- CLanguageTests/ClassTests.cs | 4 ++-- CLanguageTests/InterpreterTests.cs | 14 ++++++++------ 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/CLanguage/Compiler/EmitContext.cs b/CLanguage/Compiler/EmitContext.cs index 645ddd8..05963c7 100644 --- a/CLanguage/Compiler/EmitContext.cs +++ b/CLanguage/Compiler/EmitContext.cs @@ -129,10 +129,10 @@ public void EmitCast (CType fromType, CType toType) // Demote arrays to pointers } else if (fromType is CArrayType && toType.IsVoidPointer) { - // Demote arrays to void pointers without size check. Better hope sizeof works. + // Demote arrays to void pointers without size check. sizeof() reports type.NumValues. } else if (fromType.IsPointer && toType.IsVoidPointer) { - // Demote pointers to void pointers without size check. Better hope sizeof works. + // Demote pointers to void pointers without size check. sizeof() reports type.NumValues. } else if (fromType is CEnumType et && toType is CIntType bt) { // Enums act like ints diff --git a/CLanguage/Syntax/SizeOfExpression.cs b/CLanguage/Syntax/SizeOfExpression.cs index 3e4387a..99f44d5 100644 --- a/CLanguage/Syntax/SizeOfExpression.cs +++ b/CLanguage/Syntax/SizeOfExpression.cs @@ -25,7 +25,7 @@ public override CType GetEvaluatedCType (EmitContext ec) protected override void DoEmit(EmitContext ec) { var type = Query.GetEvaluatedCType (ec); - Value cval = type.GetByteSize (ec); + Value cval = type.NumValues; ec.Emit (OpCode.LoadConstant, cval); } } diff --git a/CLanguage/Syntax/SizeOfTypeExpression.cs b/CLanguage/Syntax/SizeOfTypeExpression.cs index 14d94a7..a931330 100644 --- a/CLanguage/Syntax/SizeOfTypeExpression.cs +++ b/CLanguage/Syntax/SizeOfTypeExpression.cs @@ -22,7 +22,7 @@ public override CType GetEvaluatedCType (EmitContext ec) protected override void DoEmit (EmitContext ec) { var type = ec.ResolveTypeName (TypeName); - Value cval = type.GetByteSize (ec); + Value cval = type.NumValues; ec.Emit (OpCode.LoadConstant, cval); } } diff --git a/CLanguageTests/ClassTests.cs b/CLanguageTests/ClassTests.cs index f3c7602..c793835 100644 --- a/CLanguageTests/ClassTests.cs +++ b/CLanguageTests/ClassTests.cs @@ -33,8 +33,8 @@ typedef class C { } OtherC; OtherC c; void main() { - assertAreEqual(2, sizeof(c)); - assertAreEqual(2, sizeof(OtherC)); + assertAreEqual(1, sizeof(c)); + assertAreEqual(1, sizeof(OtherC)); } "); } diff --git a/CLanguageTests/InterpreterTests.cs b/CLanguageTests/InterpreterTests.cs index 1465aef..874a772 100644 --- a/CLanguageTests/InterpreterTests.cs +++ b/CLanguageTests/InterpreterTests.cs @@ -330,7 +330,7 @@ public void SizeofInt () var i = Run (@" void main () { int s = sizeof(int); - assertAreEqual (2, s); + assertAreEqual (1, s); }"); } @@ -340,7 +340,7 @@ public void SizeofSizeofInt () var i = Run (@" void main () { int s = sizeof(sizeof(int)); - assertAreEqual (4, s); + assertAreEqual (1, s); }"); } @@ -350,7 +350,7 @@ public void SizeofIntPtr () var i = Run (@" void main () { int s = sizeof(int*); - assertAreEqual (2, s); + assertAreEqual (1, s); }"); } @@ -360,7 +360,7 @@ public void SizeofLongInt () var i = Run (@" void main () { int s = sizeof(long int); - assertAreEqual (4, s); + assertAreEqual (1, s); }"); } @@ -370,8 +370,10 @@ public void SizeofArray () var i = Run (@" int array[] = { 0, 1, 2, 3, 4 }; void main () { - int num = sizeof(array) / sizeof(array[0]); - int num2 = sizeof(array) / sizeof(int); + int sa = sizeof(array); + assertAreEqual (5, sa); + int num = sa / sizeof(array[0]); + int num2 = sa / sizeof(int); assertAreEqual (5, num); assertAreEqual (5, num2); }"); From eb20e13c60dd52f5becfd0749fc175e216aedaab Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Fri, 2 Feb 2024 16:07:48 -0800 Subject: [PATCH 3/7] Add WriteMemory --- CLanguage/Interpreter/CInterpreter.cs | 155 +++++++++++++------------- 1 file changed, 80 insertions(+), 75 deletions(-) diff --git a/CLanguage/Interpreter/CInterpreter.cs b/CLanguage/Interpreter/CInterpreter.cs index f5bcfbf..19562b1 100644 --- a/CLanguage/Interpreter/CInterpreter.cs +++ b/CLanguage/Interpreter/CInterpreter.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using CLanguage.Types; - +using CLanguage.Types; + namespace CLanguage.Interpreter { public class CInterpreter @@ -42,6 +42,11 @@ public Value ReadMemory (int address) return Stack[address]; } + public Value WriteMemory (int address, Value value) + { + return Stack[address] = value; + } + public string ReadStringWithEncoding (int address, Encoding encoding) { var b = (byte)Stack[address]; @@ -238,92 +243,92 @@ public void Step (int microseconds) } } - public Value RunFunction (Value functionAddress, int microseconds) - { - Call (functionAddress); - return StepFunction (microseconds); + public Value RunFunction (Value functionAddress, int microseconds) + { + Call (functionAddress); + return StepFunction (microseconds); } - public Value RunFunction (Value functionAddress, Value arg0, int microseconds) - { - Push (arg0); - Call (functionAddress); - return StepFunction (microseconds); + public Value RunFunction (Value functionAddress, Value arg0, int microseconds) + { + Push (arg0); + Call (functionAddress); + return StepFunction (microseconds); } - public Value RunFunction (Value functionAddress, Value arg0, Value arg1, int microseconds) - { - Push (arg0); - Push (arg1); - Call (functionAddress); - return StepFunction (microseconds); + public Value RunFunction (Value functionAddress, Value arg0, Value arg1, int microseconds) + { + Push (arg0); + Push (arg1); + Call (functionAddress); + return StepFunction (microseconds); } - public Value RunFunction (Value functionAddress, Value arg0, Value arg1, Value arg2, int microseconds) - { - Push (arg0); - Push (arg1); - Push (arg2); - Call (functionAddress); - return StepFunction (microseconds); + public Value RunFunction (Value functionAddress, Value arg0, Value arg1, Value arg2, int microseconds) + { + Push (arg0); + Push (arg1); + Push (arg2); + Call (functionAddress); + return StepFunction (microseconds); } - Value StepFunction (int microseconds) - { - if (ActiveFrame == null) - return 0; - - var startFI = FI; - var startReturnType = ActiveFrame?.Function.FunctionType.ReturnType; - - if (microseconds <= SleepTime) { - SleepTime -= microseconds; - } - else { - RemainingTime = microseconds - SleepTime; - SleepTime = 0; - + Value StepFunction (int microseconds) + { + if (ActiveFrame == null) + return 0; + + var startFI = FI; + var startReturnType = ActiveFrame?.Function.FunctionType.ReturnType; + + if (microseconds <= SleepTime) { + SleepTime -= microseconds; + } + else { + RemainingTime = microseconds - SleepTime; + SleepTime = 0; + try { - var a = ActiveFrame; + var a = ActiveFrame; while (a != null && FI >= startFI && RemainingTime > 0) { - RemainingTime -= CpuSpeed; + RemainingTime -= CpuSpeed; a.Function.Step (this, a); a = ActiveFrame; if (YieldedValue != 0) - break; - } - } - catch (Exception) { - Reset (); - throw; - } - } - - // Pop frames until we are back to the caller - while (FI >= startFI) { - // Failed to return. Force it. - if (ActiveFrame?.Function.FunctionType.ReturnType is CType rt) { - // Return 0. - if (!rt.IsVoid) { - int n = rt.NumValues; - for (int i = 0; i < n; i++) { - Stack[SP++] = 0; - } - } - Return (); - } - else { - break; - } - } - - // Get the return value - Value returnValue = 0; - int numReturnValues = startReturnType != null ? startReturnType.NumValues : 0; - for (var i = 0; i < numReturnValues; i++) { - returnValue = Stack[--SP]; - } - return returnValue; + break; + } + } + catch (Exception) { + Reset (); + throw; + } + } + + // Pop frames until we are back to the caller + while (FI >= startFI) { + // Failed to return. Force it. + if (ActiveFrame?.Function.FunctionType.ReturnType is CType rt) { + // Return 0. + if (!rt.IsVoid) { + int n = rt.NumValues; + for (int i = 0; i < n; i++) { + Stack[SP++] = 0; + } + } + Return (); + } + else { + break; + } + } + + // Get the return value + Value returnValue = 0; + int numReturnValues = startReturnType != null ? startReturnType.NumValues : 0; + for (var i = 0; i < numReturnValues; i++) { + returnValue = Stack[--SP]; + } + return returnValue; } } } From f7c1f380bf99254c7f94200cc3ec364a6c14b71a Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Fri, 2 Feb 2024 16:26:57 -0800 Subject: [PATCH 4/7] Test that memcmp can be written --- .gitignore | 2 +- .vscode/settings.json | 3 ++- CLanguageTests/InterpreterTests.cs | 19 +++++++++++++++++++ CLanguageTests/TestMachineInfo.cs | 20 ++++++++++++++++++++ 4 files changed, 42 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f9edccc..599781a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ # Test files CLanguageTests/a.out -CLanguageTests/test.c +CLanguageTests/test*.c /*.nupkg diff --git a/.vscode/settings.json b/.vscode/settings.json index cad7657..4777347 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "cmake.configureOnOpen": false + "cmake.configureOnOpen": false, + "dotnet.preferCSharpExtension": true } \ No newline at end of file diff --git a/CLanguageTests/InterpreterTests.cs b/CLanguageTests/InterpreterTests.cs index 874a772..4257505 100644 --- a/CLanguageTests/InterpreterTests.cs +++ b/CLanguageTests/InterpreterTests.cs @@ -379,6 +379,25 @@ void main () { }"); } + [TestMethod] + public void InternalFunctionMemcmpWorks () + { + var i = Run (@" +int memcmp (const void *s1, const void *s2, int n); +int ones[5] = { 1, 1, 1, 1, 1 }; +int ones2[5] = { 1, 1, 1, 1, 1 }; +int twos[5] = { 2, 2, 2, 2, 2 }; +void main () { + assertAreEqual (0, memcmp(ones, ones2, sizeof(ones))); + assertAreEqual (0, memcmp(ones2, ones, sizeof(ones))); + assertAreEqual (0, memcmp(ones, ones, sizeof(ones))); + assertAreEqual (0, memcmp(ones2, ones2, sizeof(ones))); + assertAreEqual (0, memcmp(twos, twos, sizeof(twos))); + assertAreEqual (-1, memcmp(ones, twos, sizeof(ones))); + assertAreEqual (1, memcmp(twos, ones, sizeof(ones))); +}"); + } + [TestMethod] public void LocalVariableInitialization () { diff --git a/CLanguageTests/TestMachineInfo.cs b/CLanguageTests/TestMachineInfo.cs index e819264..37ea0fd 100644 --- a/CLanguageTests/TestMachineInfo.cs +++ b/CLanguageTests/TestMachineInfo.cs @@ -32,6 +32,7 @@ public TestMachineInfo () AddInternalFunction ("void assertBoolsAreEqual (bool expected, bool actual)", AssertBoolsAreEqual); AddInternalFunction ("void assertFloatsAreEqual (float expected, float actual)", AssertFloatsAreEqual); AddInternalFunction ("void assertDoublesAreEqual (double expected, double actual)", AssertDoublesAreEqual); + AddInternalFunction ("int memcmp (void* s1, void* s2, int n)", Memcmp); } static void AssertAreEqual (CInterpreter state) @@ -82,6 +83,25 @@ static void AssertBoolsAreEqual (CInterpreter state) var actual = state.ReadArg (1); Assert.AreEqual ((int)expected, (int)actual); } + + static void Memcmp (CInterpreter interpreter) + { + var s1 = interpreter.ReadArg (0).PointerValue; + var s2 = interpreter.ReadArg (1).PointerValue; + var n = interpreter.ReadArg (2).UInt32Value; + while (n > 0) { + var v1 = interpreter.ReadMemory (s1).UInt8Value; + var v2 = interpreter.ReadMemory (s2).UInt8Value; + if (v1 != v2) { + interpreter.Push (v1 - v2); + return; + } + s1++; + s2++; + n--; + } + interpreter.Push (0); + } } } From e78af88569c3561a52f441dbfaa9afa178ebae0c Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Fri, 2 Feb 2024 16:27:51 -0800 Subject: [PATCH 5/7] Bump the version since sizeof() is a breaking change --- .github/workflows/build-nugets.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-nugets.yml b/.github/workflows/build-nugets.yml index ed4e764..017b735 100644 --- a/.github/workflows/build-nugets.yml +++ b/.github/workflows/build-nugets.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v2 - name: Update Versions env: - VERSION_PREFIX: 0.19 + VERSION_PREFIX: 0.20 VERSION_SUFFIX: ${{github.run_number}} run: | VERSION=$VERSION_PREFIX.$VERSION_SUFFIX From c261b50710376b2fc510f30d0d292da60015b286 Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Fri, 2 Feb 2024 16:36:53 -0800 Subject: [PATCH 6/7] Update tests to use Run --- CLanguageTests/ArduinoInterpreterTests.cs | 2 +- CLanguageTests/ArrayTests.cs | 2 +- CLanguageTests/CastTests.cs | 2 +- CLanguageTests/FloatTests.cs | 2 +- CLanguageTests/IntegerTests.cs | 2 +- CLanguageTests/LogicTests.cs | 2 +- CLanguageTests/StringTests.cs | 2 +- CLanguageTests/TestsBase.cs | 2 +- CLanguageTests/TypedefTests.cs | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CLanguageTests/ArduinoInterpreterTests.cs b/CLanguageTests/ArduinoInterpreterTests.cs index 53a2c36..d9b6432 100644 --- a/CLanguageTests/ArduinoInterpreterTests.cs +++ b/CLanguageTests/ArduinoInterpreterTests.cs @@ -21,7 +21,7 @@ ArduinoTestMachineInfo.TestArduino Run (string code) var fullCode = code + "\n\nvoid main() { __cinit(); setup(); while(1){loop();}}"; var i = CLanguageService.CreateInterpreter (fullCode, machine, new TestPrinter ()); i.Reset ("main"); - i.Step (); + i.Run (); return machine.Arduino; } diff --git a/CLanguageTests/ArrayTests.cs b/CLanguageTests/ArrayTests.cs index e8153d7..ccec83d 100644 --- a/CLanguageTests/ArrayTests.cs +++ b/CLanguageTests/ArrayTests.cs @@ -13,7 +13,7 @@ CInterpreter Run (string code) var fullCode = "void start() { __cinit(); main(); } " + code; var i = CLanguageService.CreateInterpreter (fullCode, new ArduinoTestMachineInfo (), printer: new TestPrinter ()); i.Reset ("start"); - i.Step (); + i.Run (); return i; } diff --git a/CLanguageTests/CastTests.cs b/CLanguageTests/CastTests.cs index 62b7acc..f284303 100644 --- a/CLanguageTests/CastTests.cs +++ b/CLanguageTests/CastTests.cs @@ -13,7 +13,7 @@ CInterpreter Run (string code) var fullCode = "void start() { __cinit(); main(); } " + code; var i = CLanguageService.CreateInterpreter (fullCode, new ArduinoTestMachineInfo (), printer: new TestPrinter ()); i.Reset ("start"); - i.Step (); + i.Run (); return i; } diff --git a/CLanguageTests/FloatTests.cs b/CLanguageTests/FloatTests.cs index cfa6332..9fff7f3 100644 --- a/CLanguageTests/FloatTests.cs +++ b/CLanguageTests/FloatTests.cs @@ -14,7 +14,7 @@ CInterpreter Run (string code) var fullCode = "void start() { __cinit(); main(); } " + code; var i = CLanguageService.CreateInterpreter (fullCode, new ArduinoTestMachineInfo (), printer: new TestPrinter ()); i.Reset ("start"); - i.Step (); + i.Run (); return i; } diff --git a/CLanguageTests/IntegerTests.cs b/CLanguageTests/IntegerTests.cs index 960372a..5836c87 100644 --- a/CLanguageTests/IntegerTests.cs +++ b/CLanguageTests/IntegerTests.cs @@ -250,7 +250,7 @@ CInterpreter Run (string code) var fullCode = "void start() { __cinit(); main(); } " + code; var i = CLanguageService.CreateInterpreter (fullCode, new ArduinoTestMachineInfo (), printer: new TestPrinter ()); i.Reset ("start"); - i.Step (); + i.Run (); return i; } diff --git a/CLanguageTests/LogicTests.cs b/CLanguageTests/LogicTests.cs index 392c2ad..46cd8fc 100644 --- a/CLanguageTests/LogicTests.cs +++ b/CLanguageTests/LogicTests.cs @@ -14,7 +14,7 @@ CInterpreter Run (string code) var fullCode = "void start() { __cinit(); main(); } " + code; var i = CLanguageService.CreateInterpreter (fullCode, new ArduinoTestMachineInfo (), printer: new TestPrinter ()); i.Reset ("start"); - i.Step (); + i.Run (); return i; } diff --git a/CLanguageTests/StringTests.cs b/CLanguageTests/StringTests.cs index 7c77d18..6b3ad04 100644 --- a/CLanguageTests/StringTests.cs +++ b/CLanguageTests/StringTests.cs @@ -13,7 +13,7 @@ CInterpreter Run (string code) var fullCode = "void start() { __cinit(); main(); } " + code; var i = CLanguageService.CreateInterpreter (fullCode, new ArduinoTestMachineInfo (), printer: new TestPrinter ()); i.Reset ("start"); - i.Step (); + i.Run (); return i; } diff --git a/CLanguageTests/TestsBase.cs b/CLanguageTests/TestsBase.cs index 1f2169b..b2e2fad 100644 --- a/CLanguageTests/TestsBase.cs +++ b/CLanguageTests/TestsBase.cs @@ -21,7 +21,7 @@ protected CInterpreter Run (string code, MachineInfo mi, params int[] expectedEr var i = CLanguageService.CreateInterpreter (fullCode, mi ?? new TestMachineInfo (), printer: printer); printer.CheckForErrors (); i.Reset ("start"); - i.Step (); + i.Run (); return i; } diff --git a/CLanguageTests/TypedefTests.cs b/CLanguageTests/TypedefTests.cs index 937b72f..cf66e51 100644 --- a/CLanguageTests/TypedefTests.cs +++ b/CLanguageTests/TypedefTests.cs @@ -14,7 +14,7 @@ CInterpreter Run (string code) var fullCode = "void start() { __cinit(); main(); } " + code; var i = CLanguageService.CreateInterpreter (fullCode, new TestMachineInfo (), printer: new TestPrinter ()); i.Reset ("start"); - i.Step (); + i.Run (); return i; } From c828da59cc12e577da8ea842fef6438af4b5da38 Mon Sep 17 00:00:00 2001 From: "Frank A. Krueger" Date: Fri, 2 Feb 2024 16:37:09 -0800 Subject: [PATCH 7/7] Only package main --- .github/workflows/build-nugets.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-nugets.yml b/.github/workflows/build-nugets.yml index 017b735..b2b95d9 100644 --- a/.github/workflows/build-nugets.yml +++ b/.github/workflows/build-nugets.yml @@ -12,7 +12,7 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Update Versions env: VERSION_PREFIX: 0.20 @@ -23,7 +23,7 @@ jobs: sed -i bak "s:1.0.0:$VERSION:g" CLanguage.Editor.nuspec sed -i bak2 "s:version=\"1.0.0\":version=\"$VERSION\":g" CLanguage.Editor.nuspec - name: Setup .NET Core - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: dotnet-version: 6.0.300 - name: Install dependencies @@ -39,13 +39,16 @@ jobs: - name: Build iOS Editor run: msbuild /p:Configuration=Release Editor/iOS/CLanguage.Editor.iOS.csproj - name: Package Library + if: github.event_name == 'push' run: | mkdir PackageOut cd CLanguage && dotnet pack --include-symbols --no-build -c Release -v normal -o ../PackageOut - name: Package Editor + if: github.event_name == 'push' run: | nuget pack CLanguage.Editor.nuspec -OutputDirectory PackageOut - name: Package + if: github.event_name == 'push' uses: actions/upload-artifact@master with: path: PackageOut