From dfe1099bdc6e4bb5c9a4bcfde93e82853bbc02f4 Mon Sep 17 00:00:00 2001 From: James-Livesey Date: Fri, 28 Jun 2024 18:58:57 +0100 Subject: [PATCH] Use better naming convention for syscalls (such as `.log` becoming `.io_out`) Also remove info from readme which is outdated. --- README.md | 12 +- build.sh | 1 + dist/libvoxel-config.h | 1 + dist/libvoxel.h | 54 ++++--- examples/another.vxl | 2 +- examples/hello.vxl | 6 +- examples/imported.vxl | 2 +- examples/smallest.vxl | 2 +- src/builtins/core/core.h | 14 -- src/builtins/io/io.h | 24 +++ src/builtins/threads/threads.h | 12 +- src/config.h | 1 + src/contexts.h | 1 + stdlib/core.vxl | 2 +- stdlib/io/io.vxl | 6 +- stdlib/threads/threads.vxl | 12 +- test/buffers/main.vxl | 48 +++--- test/classes/main.vxl | 118 +++++++------- test/closures/main.vxl | 56 +++---- test/dce/main.vxl | 4 +- test/enums/imported.vxl | 24 +-- test/enums/main.vxl | 66 ++++---- test/exceptions/main.vxl | 16 +- test/expressions/main.vxl | 212 ++++++++++++------------ test/forloops/main.vxl | 50 +++--- test/functions/main.vxl | 116 ++++++------- test/imports/a.vxl | 4 +- test/imports/b.vxl | 4 +- test/imports/main.vxl | 14 +- test/lists/main.vxl | 288 ++++++++++++++++----------------- test/objects/main.vxl | 120 +++++++------- test/prototypes/main.vxl | 116 ++++++------- test/staticmacros/main.vxl | 24 +-- test/strings/main.vxl | 54 +++---- test/threads/main.vxl | 18 +-- test/whileloops/main.vxl | 28 ++-- 36 files changed, 776 insertions(+), 756 deletions(-) create mode 100644 src/builtins/io/io.h diff --git a/README.md b/README.md index 57ae6c2..a60f1ac 100644 --- a/README.md +++ b/README.md @@ -7,18 +7,10 @@ Voxel only generates the necessary bytecode to provide the supporting features n ``` 56 78 43 01 22 48 65 6c 6c 6f 2c 20 77 6f 72 6c VxC."Hello, worl -64 21 0a 00 33 01 2e 6c 6f 67 00 70 00 d!..3..log.p. +64 21 0a 00 33 01 2e 69 6f 5f 6f 75 74 00 70 00 d!..3..io_out.p. ``` -Since this program does not make use of Voxel's auxiliary features, all code from [`core.vxl`](tools/vxbuild-js/core.vxl) in this example has been excluded through static code analysis and is therefore never compiled into the bytecode. - -The following Voxel code produced the above bytecode: - -```voxel -syscall log("Hello, world!\n"); -``` - -More examples of Voxel programs can be found in the [`examples`](examples) and [`test`](test) directories. +Examples of Voxel programs can be found in the [`examples`](examples) and [`test`](test) directories. ## Key features of the Voxel programming language * **Functions** — named and anonymous diff --git a/build.sh b/build.sh index d246a86..301ef51 100755 --- a/build.sh +++ b/build.sh @@ -31,6 +31,7 @@ include src/builtins/core/strings.h include src/builtins/core/objects.h include src/builtins/core/lists.h include src/builtins/core/core.h +include src/builtins/io/io.h include src/builtins/threads/threads.h include src/maths.h include src/contexts.h diff --git a/dist/libvoxel-config.h b/dist/libvoxel-config.h index c853ea2..5d3bf6e 100644 --- a/dist/libvoxel-config.h +++ b/dist/libvoxel-config.h @@ -23,6 +23,7 @@ #endif #define VOXEL_BUILTINS_CORE +#define VOXEL_BUILTINS_IO #define VOXEL_BUILTINS_THREADS // #define VOXEL_DEBUG diff --git a/dist/libvoxel.h b/dist/libvoxel.h index edd52cc..e375a90 100644 --- a/dist/libvoxel.h +++ b/dist/libvoxel.h @@ -1594,19 +1594,6 @@ void voxel_builtins_core_joinList(voxel_Executor* executor) { #ifdef VOXEL_BUILTINS_CORE -void voxel_builtins_core_log(voxel_Executor* executor) { - voxel_Int argCount = voxel_popNumberInt(executor); - voxel_Thing* thing = voxel_pop(executor); - - if (thing) { - voxel_logThing(executor->context, thing); - - voxel_unreferenceThing(executor->context, thing); - } - - voxel_pushNull(executor); -} - void voxel_builtins_core_params(voxel_Executor* executor) { voxel_Int required = voxel_popNumberInt(executor); voxel_Int actual = voxel_popNumberInt(executor); @@ -1906,7 +1893,6 @@ void voxel_builtins_core_getEnumEntry(voxel_Executor* executor) { } void voxel_builtins_core(voxel_Context* context) { - voxel_defineBuiltin(context, ".log", &voxel_builtins_core_log); voxel_defineBuiltin(context, ".P", &voxel_builtins_core_params); voxel_defineBuiltin(context, ".T", &voxel_builtins_core_getType); voxel_defineBuiltin(context, ".C", &voxel_builtins_core_toClosure); @@ -1979,6 +1965,33 @@ void voxel_builtins_core(voxel_Context* context) {} #endif +// src/builtins/io/io.h + +#ifdef VOXEL_BUILTINS_IO + +void voxel_builtins_io_out(voxel_Executor* executor) { + voxel_Int argCount = voxel_popNumberInt(executor); + voxel_Thing* thing = voxel_pop(executor); + + if (thing) { + voxel_logThing(executor->context, thing); + + voxel_unreferenceThing(executor->context, thing); + } + + voxel_pushNull(executor); +} + +void voxel_builtins_io(voxel_Context* context) { + voxel_defineBuiltin(context, ".io_out", &voxel_builtins_io_out); +} + +#else + +void voxel_builtins_io(voxel_Context* context) {} + +#endif + // src/builtins/threads/threads.h #ifdef VOXEL_BUILTINS_THREADS @@ -2123,12 +2136,12 @@ void voxel_builtins_threads_preserveSymbols(voxel_Executor* executor) { } void voxel_builtins_threads(voxel_Context* context) { - voxel_defineBuiltin(context, ".Thn", &voxel_builtins_threads_newThread); - voxel_defineBuiltin(context, ".Thd", &voxel_builtins_threads_destroyThread); - voxel_defineBuiltin(context, ".Thoi", &voxel_builtins_threads_getOwnThreadId); - voxel_defineBuiltin(context, ".Thir", &voxel_builtins_threads_threadIsRunning); - voxel_defineBuiltin(context, ".Thsr", &voxel_builtins_threads_setThreadIsRunning); - voxel_defineBuiltin(context, ".Thps", &voxel_builtins_threads_preserveSymbols); + voxel_defineBuiltin(context, ".threads_new", &voxel_builtins_threads_newThread); + voxel_defineBuiltin(context, ".threads_destroy", &voxel_builtins_threads_destroyThread); + voxel_defineBuiltin(context, ".threads_getOwnId", &voxel_builtins_threads_getOwnThreadId); + voxel_defineBuiltin(context, ".threads_isRunning", &voxel_builtins_threads_threadIsRunning); + voxel_defineBuiltin(context, ".threads_setIsRunning", &voxel_builtins_threads_setThreadIsRunning); + voxel_defineBuiltin(context, ".threads_preserve", &voxel_builtins_threads_preserveSymbols); } #else @@ -2213,6 +2226,7 @@ voxel_Context* voxel_newContext() { voxel_newExecutor(context); voxel_builtins_core(context); + voxel_builtins_io(context); voxel_builtins_threads(context); return context; diff --git a/examples/another.vxl b/examples/another.vxl index dd4a006..5d78049 100644 --- a/examples/another.vxl +++ b/examples/another.vxl @@ -1 +1 @@ -syscall log("This was also imported!\n"); \ No newline at end of file +syscall io_out("This was also imported!\n"); \ No newline at end of file diff --git a/examples/hello.vxl b/examples/hello.vxl index 8d4dd60..7bde4be 100644 --- a/examples/hello.vxl +++ b/examples/hello.vxl @@ -18,12 +18,12 @@ var thisIsAwesome = true; // Functions (these ones are mainly for usage later on) function print(value) { - syscall log(value); + syscall io_out(value); } function println(value) { - syscall log(value); - syscall log("\n"); + syscall io_out(value); + syscall io_out("\n"); } function newList() { diff --git a/examples/imported.vxl b/examples/imported.vxl index a59641b..ce95491 100644 --- a/examples/imported.vxl +++ b/examples/imported.vxl @@ -1,7 +1,7 @@ import "another.vxl" as another; import "hello.vxl" as hello; -syscall log("This was imported!\n"); +syscall io_out("This was imported!\n"); var valueFromImport = "this value has been exported"; diff --git a/examples/smallest.vxl b/examples/smallest.vxl index dc2a28d..95efd14 100644 --- a/examples/smallest.vxl +++ b/examples/smallest.vxl @@ -1 +1 @@ -syscall log("Hello, world!\n"); \ No newline at end of file +syscall io_out("Hello, world!\n"); \ No newline at end of file diff --git a/src/builtins/core/core.h b/src/builtins/core/core.h index c9aa296..b02bbb8 100644 --- a/src/builtins/core/core.h +++ b/src/builtins/core/core.h @@ -1,18 +1,5 @@ #ifdef VOXEL_BUILTINS_CORE -void voxel_builtins_core_log(voxel_Executor* executor) { - voxel_Int argCount = voxel_popNumberInt(executor); - voxel_Thing* thing = voxel_pop(executor); - - if (thing) { - voxel_logThing(executor->context, thing); - - voxel_unreferenceThing(executor->context, thing); - } - - voxel_pushNull(executor); -} - void voxel_builtins_core_params(voxel_Executor* executor) { voxel_Int required = voxel_popNumberInt(executor); voxel_Int actual = voxel_popNumberInt(executor); @@ -312,7 +299,6 @@ void voxel_builtins_core_getEnumEntry(voxel_Executor* executor) { } void voxel_builtins_core(voxel_Context* context) { - voxel_defineBuiltin(context, ".log", &voxel_builtins_core_log); voxel_defineBuiltin(context, ".P", &voxel_builtins_core_params); voxel_defineBuiltin(context, ".T", &voxel_builtins_core_getType); voxel_defineBuiltin(context, ".C", &voxel_builtins_core_toClosure); diff --git a/src/builtins/io/io.h b/src/builtins/io/io.h new file mode 100644 index 0000000..0f5e047 --- /dev/null +++ b/src/builtins/io/io.h @@ -0,0 +1,24 @@ +#ifdef VOXEL_BUILTINS_IO + +void voxel_builtins_io_out(voxel_Executor* executor) { + voxel_Int argCount = voxel_popNumberInt(executor); + voxel_Thing* thing = voxel_pop(executor); + + if (thing) { + voxel_logThing(executor->context, thing); + + voxel_unreferenceThing(executor->context, thing); + } + + voxel_pushNull(executor); +} + +void voxel_builtins_io(voxel_Context* context) { + voxel_defineBuiltin(context, ".io_out", &voxel_builtins_io_out); +} + +#else + +void voxel_builtins_io(voxel_Context* context) {} + +#endif \ No newline at end of file diff --git a/src/builtins/threads/threads.h b/src/builtins/threads/threads.h index 6377c0b..44fe4d2 100644 --- a/src/builtins/threads/threads.h +++ b/src/builtins/threads/threads.h @@ -140,12 +140,12 @@ void voxel_builtins_threads_preserveSymbols(voxel_Executor* executor) { } void voxel_builtins_threads(voxel_Context* context) { - voxel_defineBuiltin(context, ".Thn", &voxel_builtins_threads_newThread); - voxel_defineBuiltin(context, ".Thd", &voxel_builtins_threads_destroyThread); - voxel_defineBuiltin(context, ".Thoi", &voxel_builtins_threads_getOwnThreadId); - voxel_defineBuiltin(context, ".Thir", &voxel_builtins_threads_threadIsRunning); - voxel_defineBuiltin(context, ".Thsr", &voxel_builtins_threads_setThreadIsRunning); - voxel_defineBuiltin(context, ".Thps", &voxel_builtins_threads_preserveSymbols); + voxel_defineBuiltin(context, ".threads_new", &voxel_builtins_threads_newThread); + voxel_defineBuiltin(context, ".threads_destroy", &voxel_builtins_threads_destroyThread); + voxel_defineBuiltin(context, ".threads_getOwnId", &voxel_builtins_threads_getOwnThreadId); + voxel_defineBuiltin(context, ".threads_isRunning", &voxel_builtins_threads_threadIsRunning); + voxel_defineBuiltin(context, ".threads_setIsRunning", &voxel_builtins_threads_setThreadIsRunning); + voxel_defineBuiltin(context, ".threads_preserve", &voxel_builtins_threads_preserveSymbols); } #else diff --git a/src/config.h b/src/config.h index c853ea2..5d3bf6e 100644 --- a/src/config.h +++ b/src/config.h @@ -23,6 +23,7 @@ #endif #define VOXEL_BUILTINS_CORE +#define VOXEL_BUILTINS_IO #define VOXEL_BUILTINS_THREADS // #define VOXEL_DEBUG diff --git a/src/contexts.h b/src/contexts.h index 487f866..f8e1100 100644 --- a/src/contexts.h +++ b/src/contexts.h @@ -17,6 +17,7 @@ voxel_Context* voxel_newContext() { voxel_newExecutor(context); voxel_builtins_core(context); + voxel_builtins_io(context); voxel_builtins_threads(context); return context; diff --git a/stdlib/core.vxl b/stdlib/core.vxl index 451a0aa..08ac0ae 100644 --- a/stdlib/core.vxl +++ b/stdlib/core.vxl @@ -2,7 +2,7 @@ var thisStack = []; var nextThis = null; var superStack = []; -syscall Thps([ +syscall threads_preserve([ #symbol(thisStack), #symbol(nextThis), #symbol(superStack) diff --git a/stdlib/io/io.vxl b/stdlib/io/io.vxl index c847c2f..ed04f94 100644 --- a/stdlib/io/io.vxl +++ b/stdlib/io/io.vxl @@ -26,14 +26,14 @@ class StandardOutputStream extends Stream { write(data) { super.write(data); - syscall log(data); + syscall io_out(data); } } function print(data) { - syscall log(data); + syscall io_out(data); } function println(data) { - syscall log(data + "\n"); + syscall io_out(data + "\n"); } \ No newline at end of file diff --git a/stdlib/threads/threads.vxl b/stdlib/threads/threads.vxl index 6dda837..f07f488 100644 --- a/stdlib/threads/threads.vxl +++ b/stdlib/threads/threads.vxl @@ -38,7 +38,7 @@ class Thread { } if (this._hasStarted) { - syscall Thd(this._id); + syscall threads_destroy(this._id); } this._hasBeenClosed = true; @@ -51,7 +51,7 @@ class Thread { this._checkThreadExists(); if (this._isPaused) { - syscall Thsr(true, this._id); + syscall threads_setIsRunning(true, this._id); this._isPaused = false; @@ -62,7 +62,7 @@ class Thread { throw ThreadError.CANNOT_ENTER_STATE; } - this._id = syscall Thn(this.callFunction, this.callArgs); + this._id = syscall threads_new(this.callFunction, this.callArgs); this._hasStarted = true; } @@ -73,7 +73,7 @@ class Thread { throw ThreadError.CANNOT_ENTER_STATE; } - syscall Thsr(false, this._id); + syscall threads_setIsRunning(false, this._id); this._isPaused = true; } @@ -87,7 +87,7 @@ class Thread { return false; } - return syscall Thir(this._id); + return syscall threads_isRunning(this._id); } isPaused() { @@ -133,7 +133,7 @@ class MainThread extends Thread { } function getOwnThread() { - var id = syscall Thoi(); + var id = syscall threads_getOwnId(); return _existingThreads.find(function(thread) { return thread._id == id; diff --git a/test/buffers/main.vxl b/test/buffers/main.vxl index 074840c..1380333 100644 --- a/test/buffers/main.vxl +++ b/test/buffers/main.vxl @@ -4,44 +4,44 @@ import buffers; var byte1 = Byte(0x41); var byte2 = Byte("B"); -syscall log("Byte 1: "); -syscall log(byte1); -syscall log("\n"); +syscall io_out("Byte 1: "); +syscall io_out(byte1); +syscall io_out("\n"); -syscall log("Byte 2: "); -syscall log(byte2); -syscall log("\n"); +syscall io_out("Byte 2: "); +syscall io_out(byte2); +syscall io_out("\n"); var buffer = Buffer(0x41, 0x42, 0x43, " Hello, world! ", "This is a buffer."); -syscall log("Buffer: "); -syscall log(buffer); -syscall log("\n"); +syscall io_out("Buffer: "); +syscall io_out(buffer); +syscall io_out("\n"); -syscall log("Size of buffer: "); -syscall log(buffer.size); -syscall log("\n"); +syscall io_out("Size of buffer: "); +syscall io_out(buffer.size); +syscall io_out("\n"); -syscall log("Get byte at index 1 from buffer: "); -syscall log(buffer[1]); -syscall log("\n"); +syscall io_out("Get byte at index 1 from buffer: "); +syscall io_out(buffer[1]); +syscall io_out("\n"); buffer[1] = Byte(0x44); -syscall log("Set byte at index 1 in buffer: "); -syscall log(buffer[1]); -syscall log("\n"); +syscall io_out("Set byte at index 1 in buffer: "); +syscall io_out(buffer[1]); +syscall io_out("\n"); var bigBuffer = buffers.create(65536 * 4, Byte(".")); -syscall log("Section of big buffer: "); -syscall log(bigBuffer.section((65536 * 2) + 4, (65536 * 2) + 12)); -syscall log("\n"); +syscall io_out("Section of big buffer: "); +syscall io_out(bigBuffer.section((65536 * 2) + 4, (65536 * 2) + 12)); +syscall io_out("\n"); buffer.copy(bigBuffer, (65536 * 2) + 4, 4); -syscall log("Write small buffer into big buffer: "); -syscall log(bigBuffer.section((65536 * 2) + 4, (65536 * 2) + 12)); -syscall log("\n"); \ No newline at end of file +syscall io_out("Write small buffer into big buffer: "); +syscall io_out(bigBuffer.section((65536 * 2) + 4, (65536 * 2) + 12)); +syscall io_out("\n"); \ No newline at end of file diff --git a/test/classes/main.vxl b/test/classes/main.vxl index d8b2b30..ac92d2c 100644 --- a/test/classes/main.vxl +++ b/test/classes/main.vxl @@ -2,11 +2,11 @@ class TestClass { propSetInChild = 123; constructor(a, b) { - syscall log("TestClass constructor called with args: "); - syscall log(a); - syscall log(", "); - syscall log(b); - syscall log("\n"); + syscall io_out("TestClass constructor called with args: "); + syscall io_out(a); + syscall io_out(", "); + syscall io_out(b); + syscall io_out("\n"); this.a = a; this.b = b; @@ -41,47 +41,47 @@ class ClassWithoutConstructor { var instance1 = new TestClass(2, 3); var instance2 = new TestClass(3, 4); -syscall log("instance1 multiply result: "); -syscall log(instance1.multiply()); -syscall log("\n"); +syscall io_out("instance1 multiply result: "); +syscall io_out(instance1.multiply()); +syscall io_out("\n"); -syscall log("instance1 added result: "); -syscall log(instance1.added); -syscall log("\n"); +syscall io_out("instance1 added result: "); +syscall io_out(instance1.added); +syscall io_out("\n"); instance1.accumulate(); -syscall log("instance1 multiply after accumulate result: "); -syscall log(instance1.multiply()); -syscall log("\n"); +syscall io_out("instance1 multiply after accumulate result: "); +syscall io_out(instance1.multiply()); +syscall io_out("\n"); instance1.both = 3; -syscall log("instance1 multiply after set both result: "); -syscall log(instance1.multiply()); -syscall log("\n"); +syscall io_out("instance1 multiply after set both result: "); +syscall io_out(instance1.multiply()); +syscall io_out("\n"); -syscall log("instance2 multiply result: "); -syscall log(instance2.multiply()); -syscall log("\n"); +syscall io_out("instance2 multiply result: "); +syscall io_out(instance2.multiply()); +syscall io_out("\n"); instance2.accumulate(); -syscall log("instance2 multiply after accumulate result: "); -syscall log(instance2.multiply()); -syscall log("\n"); +syscall io_out("instance2 multiply after accumulate result: "); +syscall io_out(instance2.multiply()); +syscall io_out("\n"); var instance3 = new ClassWithoutConstructor(); -syscall log("Class without constructor value: "); -syscall log(instance3.getValue()); -syscall log("\n"); +syscall io_out("Class without constructor value: "); +syscall io_out(instance3.getValue()); +syscall io_out("\n"); class ChildClass extends TestClass { constructor(a, b, c) { - syscall log("ChildClass constructor called with extra arg: "); - syscall log(c); - syscall log("\n"); + syscall io_out("ChildClass constructor called with extra arg: "); + syscall io_out(c); + syscall io_out("\n"); super(a, b); @@ -97,23 +97,23 @@ var instance4 = new ChildClass(4, 5, 6); instance4.propSetInChild = 456; -syscall log("instance1 parent class prop: "); -syscall log(instance1.propSetInChild); -syscall log("\n"); +syscall io_out("instance1 parent class prop: "); +syscall io_out(instance1.propSetInChild); +syscall io_out("\n"); -syscall log("instance4 child class prop: "); -syscall log(instance4.propSetInChild); -syscall log("\n"); +syscall io_out("instance4 child class prop: "); +syscall io_out(instance4.propSetInChild); +syscall io_out("\n"); -syscall log("instance4 multiply result: "); -syscall log(instance4.multiply()); -syscall log("\n"); +syscall io_out("instance4 multiply result: "); +syscall io_out(instance4.multiply()); +syscall io_out("\n"); instance4.accumulate(); -syscall log("instance4 multiply after accumulate result: "); -syscall log(instance4.multiply()); -syscall log("\n"); +syscall io_out("instance4 multiply after accumulate result: "); +syscall io_out(instance4.multiply()); +syscall io_out("\n"); class Animal { constructor(name, legCount) { @@ -122,27 +122,27 @@ class Animal { } describe() { - syscall log("Leg count: "); - syscall log(this.legCount); - syscall log("\n"); + syscall io_out("Leg count: "); + syscall io_out(this.legCount); + syscall io_out("\n"); } jump() { if (this.legCount == 0) { - syscall log("This animal can't jump\n"); + syscall io_out("This animal can't jump\n"); return; } - syscall log("This animal jumps up into the air\n"); + syscall io_out("This animal jumps up into the air\n"); } swim() { - syscall log("This animal can't swim\n"); + syscall io_out("This animal can't swim\n"); } fly() { - syscall log("This animal can't fly\n"); + syscall io_out("This animal can't fly\n"); } } @@ -152,10 +152,10 @@ class SwimmingAnimalMixin { } swim() { - syscall log("This animal swims through the water\n"); + syscall io_out("This animal swims through the water\n"); if (!this.canBreatheUnderwater) { - syscall log("...then comes out, gasping for a breath of fresh air\n"); + syscall io_out("...then comes out, gasping for a breath of fresh air\n"); } } } @@ -166,10 +166,10 @@ class FlyingAnimalMixin { } fly() { - syscall log("This animal flies through the sky\n"); + syscall io_out("This animal flies through the sky\n"); if (!this.canFlyLongDistances) { - syscall log("...then falls to the ground a few seconds later\n"); + syscall io_out("...then falls to the ground a few seconds later\n"); } } } @@ -180,7 +180,7 @@ class Giraffe extends Animal { } describe() { - syscall log("Has a long neck\n"); + syscall io_out("Has a long neck\n"); super.describe(); } @@ -192,7 +192,7 @@ class Fish extends Animal, SwimmingAnimalMixin { } describe() { - syscall log("Has shiny skin\n"); + syscall io_out("Has shiny skin\n"); super.describe(); } @@ -206,7 +206,7 @@ class Seagull extends Animal, SwimmingAnimalMixin, FlyingAnimalMixin { } describe() { - syscall log("Has a long beak\n"); + syscall io_out("Has a long beak\n"); super.describe(); } @@ -220,7 +220,7 @@ class Chicken extends Animal, FlyingAnimalMixin { } describe() { - syscall log("Has brown feathers\n"); + syscall io_out("Has brown feathers\n"); super.describe(); } @@ -234,9 +234,9 @@ var farm = [ ]; farm.forEach(function(animal) { - syscall log("Animal's name: "); - syscall log(animal.name); - syscall log("\n"); + syscall io_out("Animal's name: "); + syscall io_out(animal.name); + syscall io_out("\n"); animal.describe(); animal.jump(); diff --git a/test/closures/main.vxl b/test/closures/main.vxl index aac5626..0815b3c 100644 --- a/test/closures/main.vxl +++ b/test/closures/main.vxl @@ -8,22 +8,22 @@ function outer(a) { var one = outer(1); -syscall log(one(1)); -syscall log("\n"); +syscall io_out(one(1)); +syscall io_out("\n"); -syscall log(one(2)); -syscall log("\n"); +syscall io_out(one(2)); +syscall io_out("\n"); var two = outer(2); -syscall log(two(1)); -syscall log("\n"); +syscall io_out(two(1)); +syscall io_out("\n"); -syscall log(two(2)); -syscall log("\n"); +syscall io_out(two(2)); +syscall io_out("\n"); -syscall log(outer(3)(2)); -syscall log("\n"); +syscall io_out(outer(3)(2)); +syscall io_out("\n"); var anonymousOuter = function(a) { return function(b) { @@ -33,13 +33,13 @@ var anonymousOuter = function(a) { var three = anonymousOuter(3); -syscall log(three(1)); -syscall log("\n"); +syscall io_out(three(1)); +syscall io_out("\n"); var four = anonymousOuter(4); -syscall log(four(1)); -syscall log("\n"); +syscall io_out(four(1)); +syscall io_out("\n"); function deepOuter(a) { return function(b) { @@ -49,21 +49,21 @@ function deepOuter(a) { }; } -syscall log(deepOuter(2)(3)(4)); -syscall log("\n"); +syscall io_out(deepOuter(2)(3)(4)); +syscall io_out("\n"); -syscall log("outer(1) is ClosureFunction: "); -syscall log(outer(1) is ClosureFunction); -syscall log("\n"); +syscall io_out("outer(1) is ClosureFunction: "); +syscall io_out(outer(1) is ClosureFunction); +syscall io_out("\n"); -syscall log("outer(1) is Function: "); -syscall log(outer(1) is Function); -syscall log("\n"); +syscall io_out("outer(1) is Function: "); +syscall io_out(outer(1) is Function); +syscall io_out("\n"); -syscall log("deepOuter(1) is ClosureFunction: "); -syscall log(deepOuter(1) is ClosureFunction); -syscall log("\n"); +syscall io_out("deepOuter(1) is ClosureFunction: "); +syscall io_out(deepOuter(1) is ClosureFunction); +syscall io_out("\n"); -syscall log("deepOuter(1) is Function: "); -syscall log(deepOuter(1) is Function); -syscall log("\n"); \ No newline at end of file +syscall io_out("deepOuter(1) is Function: "); +syscall io_out(deepOuter(1) is Function); +syscall io_out("\n"); \ No newline at end of file diff --git a/test/dce/main.vxl b/test/dce/main.vxl index 045ddde..d2154bc 100644 --- a/test/dce/main.vxl +++ b/test/dce/main.vxl @@ -95,12 +95,12 @@ falsyToStartWith = true; check(); function sideEffect() { - syscall log("Side effect called\n"); + syscall io_out("Side effect called\n"); } var ClassSideEffect = { constructor: function() { - syscall log("Class side effect called\n"); + syscall io_out("Class side effect called\n"); } }; diff --git a/test/enums/imported.vxl b/test/enums/imported.vxl index 5a2e193..884c2a7 100644 --- a/test/enums/imported.vxl +++ b/test/enums/imported.vxl @@ -5,18 +5,18 @@ enum ImportedEnum { IMPORTED_VALUE_D = -10 }; -syscall log("ImportedEnum.IMPORTED_VALUE_A = "); -syscall log(ImportedEnum.IMPORTED_VALUE_A); -syscall log("\n"); +syscall io_out("ImportedEnum.IMPORTED_VALUE_A = "); +syscall io_out(ImportedEnum.IMPORTED_VALUE_A); +syscall io_out("\n"); -syscall log("ImportedEnum.IMPORTED_VALUE_B = "); -syscall log(ImportedEnum.IMPORTED_VALUE_B); -syscall log("\n"); +syscall io_out("ImportedEnum.IMPORTED_VALUE_B = "); +syscall io_out(ImportedEnum.IMPORTED_VALUE_B); +syscall io_out("\n"); -syscall log("ImportedEnum.IMPORTED_VALUE_C = "); -syscall log(ImportedEnum.IMPORTED_VALUE_C); -syscall log("\n"); +syscall io_out("ImportedEnum.IMPORTED_VALUE_C = "); +syscall io_out(ImportedEnum.IMPORTED_VALUE_C); +syscall io_out("\n"); -syscall log("ImportedEnum.IMPORTED_VALUE_D = "); -syscall log(ImportedEnum.IMPORTED_VALUE_D); -syscall log("\n"); \ No newline at end of file +syscall io_out("ImportedEnum.IMPORTED_VALUE_D = "); +syscall io_out(ImportedEnum.IMPORTED_VALUE_D); +syscall io_out("\n"); \ No newline at end of file diff --git a/test/enums/main.vxl b/test/enums/main.vxl index 3fb0ced..502d285 100644 --- a/test/enums/main.vxl +++ b/test/enums/main.vxl @@ -7,50 +7,50 @@ enum TestEnum { VALUE_D = -1 } -syscall log("TestEnum.VALUE_A = "); -syscall log(TestEnum.VALUE_A); -syscall log("\n"); +syscall io_out("TestEnum.VALUE_A = "); +syscall io_out(TestEnum.VALUE_A); +syscall io_out("\n"); -syscall log("TestEnum.VALUE_B = "); -syscall log(TestEnum.VALUE_B); -syscall log("\n"); +syscall io_out("TestEnum.VALUE_B = "); +syscall io_out(TestEnum.VALUE_B); +syscall io_out("\n"); -syscall log("TestEnum.VALUE_C = "); -syscall log(TestEnum.VALUE_C); -syscall log("\n"); +syscall io_out("TestEnum.VALUE_C = "); +syscall io_out(TestEnum.VALUE_C); +syscall io_out("\n"); -syscall log("TestEnum.VALUE_D = "); -syscall log(TestEnum.VALUE_D); -syscall log("\n"); +syscall io_out("TestEnum.VALUE_D = "); +syscall io_out(TestEnum.VALUE_D); +syscall io_out("\n"); -syscall log("imported.ImportedEnum.IMPORTED_VALUE_A = "); -syscall log(imported.ImportedEnum.IMPORTED_VALUE_A); -syscall log("\n"); +syscall io_out("imported.ImportedEnum.IMPORTED_VALUE_A = "); +syscall io_out(imported.ImportedEnum.IMPORTED_VALUE_A); +syscall io_out("\n"); -syscall log("imported.ImportedEnum.IMPORTED_VALUE_B = "); -syscall log(imported.ImportedEnum.IMPORTED_VALUE_B); -syscall log("\n"); +syscall io_out("imported.ImportedEnum.IMPORTED_VALUE_B = "); +syscall io_out(imported.ImportedEnum.IMPORTED_VALUE_B); +syscall io_out("\n"); -syscall log("imported.ImportedEnum.IMPORTED_VALUE_C = "); -syscall log(imported.ImportedEnum.IMPORTED_VALUE_C); -syscall log("\n"); +syscall io_out("imported.ImportedEnum.IMPORTED_VALUE_C = "); +syscall io_out(imported.ImportedEnum.IMPORTED_VALUE_C); +syscall io_out("\n"); -syscall log("imported.ImportedEnum.IMPORTED_VALUE_D = "); -syscall log(imported.ImportedEnum.IMPORTED_VALUE_D); -syscall log("\n"); +syscall io_out("imported.ImportedEnum.IMPORTED_VALUE_D = "); +syscall io_out(imported.ImportedEnum.IMPORTED_VALUE_D); +syscall io_out("\n"); var testValueA = TestEnum.VALUE_A; var importedValueA = imported.ImportedEnum.IMPORTED_VALUE_A; var unknown = -99; -syscall log("testValueA.getEnumEntry() = "); -syscall log(testValueA.getEnumEntry()); -syscall log("\n"); +syscall io_out("testValueA.getEnumEntry() = "); +syscall io_out(testValueA.getEnumEntry()); +syscall io_out("\n"); -syscall log("importedValueA.getEnumEntry() = "); -syscall log(importedValueA.getEnumEntry()); -syscall log("\n"); +syscall io_out("importedValueA.getEnumEntry() = "); +syscall io_out(importedValueA.getEnumEntry()); +syscall io_out("\n"); -syscall log("unknown.getEnumEntry() = "); -syscall log(unknown.getEnumEntry()); -syscall log("\n"); \ No newline at end of file +syscall io_out("unknown.getEnumEntry() = "); +syscall io_out(unknown.getEnumEntry()); +syscall io_out("\n"); \ No newline at end of file diff --git a/test/exceptions/main.vxl b/test/exceptions/main.vxl index 0967c69..af97aa1 100644 --- a/test/exceptions/main.vxl +++ b/test/exceptions/main.vxl @@ -1,7 +1,7 @@ try { - syscall log("No error thrown\n"); + syscall io_out("No error thrown\n"); } catch (error) { - syscall log("Caught error that does not exist\n"); + syscall io_out("Caught error that does not exist\n"); } try { @@ -11,9 +11,9 @@ try { try { throw 2; } catch (error) { - syscall log("Caught error: "); - syscall log(error); - syscall log("\n"); + syscall io_out("Caught error: "); + syscall io_out(error); + syscall io_out("\n"); } function rethrow() { @@ -27,9 +27,9 @@ function rethrow() { try { rethrow(); } catch (error) { - syscall log("Caught error: "); - syscall log(error); - syscall log("\n"); + syscall io_out("Caught error: "); + syscall io_out(error); + syscall io_out("\n"); } try { diff --git a/test/expressions/main.vxl b/test/expressions/main.vxl index a91a2d9..22f6940 100644 --- a/test/expressions/main.vxl +++ b/test/expressions/main.vxl @@ -1,177 +1,177 @@ var complexExpression = -5 + 12 * (-3 + 2) * -(5 - 4); -syscall log("Complex expression result: "); -syscall log(complexExpression); -syscall log("\n"); +syscall io_out("Complex expression result: "); +syscall io_out(complexExpression); +syscall io_out("\n"); -syscall log("Complex expression is number: "); -syscall log(complexExpression is Number); -syscall log("\n"); +syscall io_out("Complex expression is number: "); +syscall io_out(complexExpression is Number); +syscall io_out("\n"); -syscall log("Complex expression is string: "); -syscall log(complexExpression is String); -syscall log("\n"); +syscall io_out("Complex expression is string: "); +syscall io_out(complexExpression is String); +syscall io_out("\n"); var ternaryResult = complexExpression == 7 ? "result is 7" : "result is not 7"; -syscall log("Stored ternary expression result: "); -syscall log(ternaryResult); -syscall log("\n"); +syscall io_out("Stored ternary expression result: "); +syscall io_out(ternaryResult); +syscall io_out("\n"); -syscall log("Immediate ternary expression result: "); -syscall log(complexExpression == 6 ? "result is 6" : "result is not 6"); -syscall log("\n"); +syscall io_out("Immediate ternary expression result: "); +syscall io_out(complexExpression == 6 ? "result is 6" : "result is not 6"); +syscall io_out("\n"); var floatValue = -3.782e-6; -syscall log("Float value result: "); -syscall log(floatValue); -syscall log("\n"); +syscall io_out("Float value result: "); +syscall io_out(floatValue); +syscall io_out("\n"); function sideEffect() { - syscall log("Side effect called\n"); + syscall io_out("Side effect called\n"); return 123; } var count = 2; -syscall log("Initial count value: "); -syscall log(count); -syscall log("\n"); +syscall io_out("Initial count value: "); +syscall io_out(count); +syscall io_out("\n"); -syscall log("Count prefix increment: "); -syscall log(++count); -syscall log("\n"); +syscall io_out("Count prefix increment: "); +syscall io_out(++count); +syscall io_out("\n"); -syscall log("New count value: "); -syscall log(count); -syscall log("\n"); +syscall io_out("New count value: "); +syscall io_out(count); +syscall io_out("\n"); -syscall log("Count suffix increment: "); -syscall log(count++); -syscall log("\n"); +syscall io_out("Count suffix increment: "); +syscall io_out(count++); +syscall io_out("\n"); -syscall log("New count value: "); -syscall log(count); -syscall log("\n"); +syscall io_out("New count value: "); +syscall io_out(count); +syscall io_out("\n"); -syscall log("Count prefix decrement: "); -syscall log(--count); -syscall log("\n"); +syscall io_out("Count prefix decrement: "); +syscall io_out(--count); +syscall io_out("\n"); -syscall log("New count value: "); -syscall log(count); -syscall log("\n"); +syscall io_out("New count value: "); +syscall io_out(count); +syscall io_out("\n"); -syscall log("Count suffix decrement: "); -syscall log(count--); -syscall log("\n"); +syscall io_out("Count suffix decrement: "); +syscall io_out(count--); +syscall io_out("\n"); -syscall log("New count value: "); -syscall log(count); -syscall log("\n"); +syscall io_out("New count value: "); +syscall io_out(count); +syscall io_out("\n"); -syscall log("Count operator assignment increment: "); -syscall log(count += 2); -syscall log("\n"); +syscall io_out("Count operator assignment increment: "); +syscall io_out(count += 2); +syscall io_out("\n"); -syscall log("New count value: "); -syscall log(count); -syscall log("\n"); +syscall io_out("New count value: "); +syscall io_out(count); +syscall io_out("\n"); -syscall log("Count operator assignment decrement: "); -syscall log(count -= 2); -syscall log("\n"); +syscall io_out("Count operator assignment decrement: "); +syscall io_out(count -= 2); +syscall io_out("\n"); -syscall log("New count value: "); -syscall log(count); -syscall log("\n"); +syscall io_out("New count value: "); +syscall io_out(count); +syscall io_out("\n"); var list = [1, 2, 3, null, 0]; -syscall log("Index accessor count prefix increment: "); -syscall log(++list[1]); -syscall log("\n"); +syscall io_out("Index accessor count prefix increment: "); +syscall io_out(++list[1]); +syscall io_out("\n"); -syscall log("New count value: "); -syscall log(list[1]); -syscall log("\n"); +syscall io_out("New count value: "); +syscall io_out(list[1]); +syscall io_out("\n"); -syscall log("Index accessor operator assignment increment: "); -syscall log(list[1] += 2); -syscall log("\n"); +syscall io_out("Index accessor operator assignment increment: "); +syscall io_out(list[1] += 2); +syscall io_out("\n"); -syscall log("New count value: "); -syscall log(list[1]); -syscall log("\n"); +syscall io_out("New count value: "); +syscall io_out(list[1]); +syscall io_out("\n"); var object = {count: 2, nullValue: null, nonNullValue: 0}; -syscall log("Property accessor count prefix increment: "); -syscall log(++object.count); -syscall log("\n"); +syscall io_out("Property accessor count prefix increment: "); +syscall io_out(++object.count); +syscall io_out("\n"); -syscall log("New count value: "); -syscall log(object.count); -syscall log("\n"); +syscall io_out("New count value: "); +syscall io_out(object.count); +syscall io_out("\n"); -syscall log("Property accessor operator assignment increment: "); -syscall log(object.count += 2); -syscall log("\n"); +syscall io_out("Property accessor operator assignment increment: "); +syscall io_out(object.count += 2); +syscall io_out("\n"); -syscall log("New count value: "); -syscall log(object.count); -syscall log("\n"); +syscall io_out("New count value: "); +syscall io_out(object.count); +syscall io_out("\n"); var nullValue = null; -syscall log("Nullish coalescing assignment operator on null value\n"); +syscall io_out("Nullish coalescing assignment operator on null value\n"); nullValue ??= sideEffect(); -syscall log("Check value: "); -syscall log(nullValue); -syscall log("\n"); +syscall io_out("Check value: "); +syscall io_out(nullValue); +syscall io_out("\n"); var nonNullValue = 0; -syscall log("Nullish coalescing assignment operator on non-null value\n"); +syscall io_out("Nullish coalescing assignment operator on non-null value\n"); nonNullValue ??= sideEffect(); -syscall log("Check value: "); -syscall log(nonNullValue); -syscall log("\n"); +syscall io_out("Check value: "); +syscall io_out(nonNullValue); +syscall io_out("\n"); -syscall log("Nullish coalescing assignment operator on null value via index accessor\n"); +syscall io_out("Nullish coalescing assignment operator on null value via index accessor\n"); list[3] ??= sideEffect(); -syscall log("Check value: "); -syscall log(list[3]); -syscall log("\n"); +syscall io_out("Check value: "); +syscall io_out(list[3]); +syscall io_out("\n"); -syscall log("Nullish coalescing assignment operator on non-null value via index accessor\n"); +syscall io_out("Nullish coalescing assignment operator on non-null value via index accessor\n"); list[4] ??= sideEffect(); -syscall log("Check value: "); -syscall log(list[4]); -syscall log("\n"); +syscall io_out("Check value: "); +syscall io_out(list[4]); +syscall io_out("\n"); -syscall log("Nullish coalescing assignment operator on null value via property accessor\n"); +syscall io_out("Nullish coalescing assignment operator on null value via property accessor\n"); object.nullValue ??= sideEffect(); -syscall log("Check value: "); -syscall log(object.nullValue); -syscall log("\n"); +syscall io_out("Check value: "); +syscall io_out(object.nullValue); +syscall io_out("\n"); -syscall log("Nullish coalescing assignment operator on non-null value via property accessor\n"); +syscall io_out("Nullish coalescing assignment operator on non-null value via property accessor\n"); object.nonNullValue ??= sideEffect(); -syscall log("Check value: "); -syscall log(object.nonNullValue); -syscall log("\n"); \ No newline at end of file +syscall io_out("Check value: "); +syscall io_out(object.nonNullValue); +syscall io_out("\n"); \ No newline at end of file diff --git a/test/forloops/main.vxl b/test/forloops/main.vxl index 14997b3..219fcea 100644 --- a/test/forloops/main.vxl +++ b/test/forloops/main.vxl @@ -1,65 +1,65 @@ -syscall log("Basic loop:\n"); +syscall io_out("Basic loop:\n"); for (var i = 0; i < 5; i++) { - syscall log(i); - syscall log("\n"); + syscall io_out(i); + syscall io_out("\n"); } -syscall log("\n"); +syscall io_out("\n"); -syscall log("Nested loop:\n"); +syscall io_out("Nested loop:\n"); for (var y = 0; y < 4; y++) { for (var x = 0; x < 4; x++) { - syscall log("x: "); - syscall log(x); - syscall log(", y: "); - syscall log(y); - syscall log("\n"); + syscall io_out("x: "); + syscall io_out(x); + syscall io_out(", y: "); + syscall io_out(y); + syscall io_out("\n"); } } -syscall log("\n"); +syscall io_out("\n"); var a = 0; var b = 10; -syscall log("Loop with missing start statement:\n"); +syscall io_out("Loop with missing start statement:\n"); for (; a < b; a++) { - syscall log(a); - syscall log("\n"); + syscall io_out(a); + syscall io_out("\n"); b = b - 1; } -syscall log("\n"); +syscall io_out("\n"); -syscall log("Loop that breaks:\n"); +syscall io_out("Loop that breaks:\n"); for (var i = 0; i < 10; i++) { - syscall log(i); - syscall log("\n"); + syscall io_out(i); + syscall io_out("\n"); if (i == 4) { - syscall log("Break loop\n"); + syscall io_out("Break loop\n"); break; } } -syscall log("\n"); -syscall log("Loop that uses `continue` statement:\n"); +syscall io_out("\n"); +syscall io_out("Loop that uses `continue` statement:\n"); for (var i = 0; i < 5; i++) { - syscall log(i); - syscall log("\n"); + syscall io_out(i); + syscall io_out("\n"); if (i % 2 == 0) { - syscall log("Continue\n"); + syscall io_out("Continue\n"); continue; } - syscall log("No continue\n"); + syscall io_out("No continue\n"); } \ No newline at end of file diff --git a/test/functions/main.vxl b/test/functions/main.vxl index d6b6dd7..227ded9 100644 --- a/test/functions/main.vxl +++ b/test/functions/main.vxl @@ -1,11 +1,11 @@ var globalValue = "global"; function voidReturn() { - syscall log("Void return called\n"); + syscall io_out("Void return called\n"); } function valueReturn() { - syscall log("Value return called\n"); + syscall io_out("Value return called\n"); return 1 + 1; } @@ -13,53 +13,53 @@ function valueReturn() { function localValueReturn() { var localValue = "local"; - syscall log("Local value return called: "); - syscall log(localValue); - syscall log("\n"); + syscall io_out("Local value return called: "); + syscall io_out(localValue); + syscall io_out("\n"); return localValue; } function globalValueReturn() { - syscall log("Global value return called: "); - syscall log(globalValue); - syscall log("\n"); + syscall io_out("Global value return called: "); + syscall io_out(globalValue); + syscall io_out("\n"); return globalValue; } function globalValueMutate() { - syscall log("Global value before: "); - syscall log(globalValue); - syscall log("\n"); + syscall io_out("Global value before: "); + syscall io_out(globalValue); + syscall io_out("\n"); globalValue = "mutated"; - syscall log("Global value after: "); - syscall log(globalValue); - syscall log("\n"); + syscall io_out("Global value after: "); + syscall io_out(globalValue); + syscall io_out("\n"); } function globalValueStoreLocalAndMutate() { var localValue = globalValue; - syscall log("Local value before: "); - syscall log(localValue); - syscall log("\n"); + syscall io_out("Local value before: "); + syscall io_out(localValue); + syscall io_out("\n"); localValue = "mutated"; - syscall log("Local value before: "); - syscall log(localValue); - syscall log("\n"); + syscall io_out("Local value before: "); + syscall io_out(localValue); + syscall io_out("\n"); } function printArguments(a, b) { - syscall log(a); - syscall log("\n"); + syscall io_out(a); + syscall io_out("\n"); - syscall log(b); - syscall log("\n"); + syscall io_out(b); + syscall io_out("\n"); } function addArguments(a, b) { @@ -67,25 +67,25 @@ function addArguments(a, b) { } function setArgument(arg) { - syscall log("Argument before: "); - syscall log(arg); - syscall log("\n"); + syscall io_out("Argument before: "); + syscall io_out(arg); + syscall io_out("\n"); arg = "mutated"; - syscall log("Argument after: "); - syscall log(arg); - syscall log("\n"); + syscall io_out("Argument after: "); + syscall io_out(arg); + syscall io_out("\n"); } function shadowedGlobalValue(globalValue) { - syscall log("Value of shadowed global value: "); - syscall log(globalValue); - syscall log("\n"); + syscall io_out("Value of shadowed global value: "); + syscall io_out(globalValue); + syscall io_out("\n"); } function callOtherFunctions() { - syscall log("Calling other functions:\n"); + syscall io_out("Calling other functions:\n"); voidReturn(); @@ -104,66 +104,66 @@ voidReturn(); var valueReturnResult = valueReturn(); -syscall log(valueReturnResult); -syscall log("\n"); +syscall io_out(valueReturnResult); +syscall io_out("\n"); var localValueReturnResult = localValueReturn(); -syscall log(localValueReturnResult); -syscall log("\n"); +syscall io_out(localValueReturnResult); +syscall io_out("\n"); var globalValueReturnResult = globalValueReturn(); -syscall log(globalValueReturnResult); -syscall log("\n"); +syscall io_out(globalValueReturnResult); +syscall io_out("\n"); globalValueMutate(); -syscall log("Global value in global scope: "); -syscall log(globalValue); -syscall log("\n"); +syscall io_out("Global value in global scope: "); +syscall io_out(globalValue); +syscall io_out("\n"); globalValueStoreLocalAndMutate(); -syscall log("Global value in global scope: "); -syscall log(globalValue); -syscall log("\n"); +syscall io_out("Global value in global scope: "); +syscall io_out(globalValue); +syscall io_out("\n"); printArguments("argument 1", "argument 2"); -syscall log("Add arguments: "); -syscall log(addArguments(2, 3)); -syscall log("\n"); +syscall io_out("Add arguments: "); +syscall io_out(addArguments(2, 3)); +syscall io_out("\n"); var arg = "original"; setArgument(arg); -syscall log("Argument in global scope: "); -syscall log(arg); -syscall log("\n"); +syscall io_out("Argument in global scope: "); +syscall io_out(arg); +syscall io_out("\n"); shadowedGlobalValue("shadowed"); var calledValueReturnResult = callOtherFunctions(); -syscall log(calledValueReturnResult); -syscall log("\n"); +syscall io_out(calledValueReturnResult); +syscall io_out("\n"); var fibonacciResult = fibonacci(10); -syscall log(fibonacciResult); -syscall log("\n"); +syscall io_out(fibonacciResult); +syscall io_out("\n"); var namedFunction = function named() { - syscall log("Named function called\n"); + syscall io_out("Named function called\n"); } named(); namedFunction(); var anonymousFunction = function() { - syscall log("Anonymous function called\n"); + syscall io_out("Anonymous function called\n"); } anonymousFunction(); \ No newline at end of file diff --git a/test/imports/a.vxl b/test/imports/a.vxl index 021336a..82a7793 100644 --- a/test/imports/a.vxl +++ b/test/imports/a.vxl @@ -4,13 +4,13 @@ var value = "value in module A"; var count = 1 + (b.count ?? 0); function test() { - syscall log("Module A test function called\n"); + syscall io_out("Module A test function called\n"); } function callBTest() { b.test(); } -syscall log("Module A imported\n"); +syscall io_out("Module A imported\n"); callBTest(); \ No newline at end of file diff --git a/test/imports/b.vxl b/test/imports/b.vxl index c4f88e2..1d2b89a 100644 --- a/test/imports/b.vxl +++ b/test/imports/b.vxl @@ -4,9 +4,9 @@ var value = "value in module B"; var count = 1 + (a.count ?? 0); function test() { - syscall log("Module B test function called\n"); + syscall io_out("Module B test function called\n"); a.test(); } -syscall log("Module B imported\n"); \ No newline at end of file +syscall io_out("Module B imported\n"); \ No newline at end of file diff --git a/test/imports/main.vxl b/test/imports/main.vxl index 2cbf676..a0c75d1 100644 --- a/test/imports/main.vxl +++ b/test/imports/main.vxl @@ -1,14 +1,14 @@ import "a.vxl" as a; -syscall log("Main module begins\n"); +syscall io_out("Main module begins\n"); -syscall log("Module A value: "); -syscall log(a.value); -syscall log("\n"); +syscall io_out("Module A value: "); +syscall io_out(a.value); +syscall io_out("\n"); -syscall log("Module A count: "); -syscall log(a.count); -syscall log("\n"); +syscall io_out("Module A count: "); +syscall io_out(a.count); +syscall io_out("\n"); a.test(); diff --git a/test/lists/main.vxl b/test/lists/main.vxl index f23a947..d06bc49 100644 --- a/test/lists/main.vxl +++ b/test/lists/main.vxl @@ -1,100 +1,100 @@ var list = ["a", "b", "c"]; -syscall log("Define list: "); -syscall log(list); -syscall log("\n"); +syscall io_out("Define list: "); +syscall io_out(list); +syscall io_out("\n"); list.push("d"); -syscall log("Push d: "); -syscall log(list); -syscall log("\n"); +syscall io_out("Push d: "); +syscall io_out(list); +syscall io_out("\n"); -syscall log("Get list length: "); -syscall log(list.length); -syscall log("\n"); +syscall io_out("Get list length: "); +syscall io_out(list.length); +syscall io_out("\n"); -syscall log("Get item at index 0 from list: "); -syscall log(list[0]); -syscall log("\n"); +syscall io_out("Get item at index 0 from list: "); +syscall io_out(list[0]); +syscall io_out("\n"); -syscall log("Get item at index 2 from list: "); -syscall log(list[2]); -syscall log("\n"); +syscall io_out("Get item at index 2 from list: "); +syscall io_out(list[2]); +syscall io_out("\n"); -syscall log("Get item at index 4 from list: "); -syscall log(list[4]); -syscall log("\n"); +syscall io_out("Get item at index 4 from list: "); +syscall io_out(list[4]); +syscall io_out("\n"); -syscall log("Get item at index -1 from list: "); -syscall log(list[-1]); -syscall log("\n"); +syscall io_out("Get item at index -1 from list: "); +syscall io_out(list[-1]); +syscall io_out("\n"); -syscall log("Get item at index -2 from list: "); -syscall log(list-[-2]); -syscall log("\n"); +syscall io_out("Get item at index -2 from list: "); +syscall io_out(list-[-2]); +syscall io_out("\n"); -syscall log("Get item at index -4 from list: "); -syscall log(list[-4]); -syscall log("\n"); +syscall io_out("Get item at index -4 from list: "); +syscall io_out(list[-4]); +syscall io_out("\n"); list[2] = 123; -syscall log("Set item at index 2 in list: "); -syscall log(list); -syscall log("\n"); +syscall io_out("Set item at index 2 in list: "); +syscall io_out(list); +syscall io_out("\n"); list[-1] = true; -syscall log("Set item at index -1 in list: "); -syscall log(list); -syscall log("\n"); +syscall io_out("Set item at index -1 in list: "); +syscall io_out(list); +syscall io_out("\n"); list[4] = "new"; -syscall log("Set item at index 4 in list: "); -syscall log(list); -syscall log("\n"); - -syscall log("Popping item from list: "); -syscall log(list.pop()); -syscall log(" => "); -syscall log(list); -syscall log("\n"); - -syscall log("Popping item from list: "); -syscall log(list.pop()); -syscall log(" => "); -syscall log(list); -syscall log("\n"); - -syscall log("Popping item from list: "); -syscall log(list.pop()); -syscall log(" => "); -syscall log(list); -syscall log("\n"); - -syscall log("Popping item from list: "); -syscall log(list.pop()); -syscall log(" => "); -syscall log(list); -syscall log("\n"); - -syscall log("Popping item from list: "); -syscall log(list.pop()); -syscall log(" => "); -syscall log(list); -syscall log("\n"); - -syscall log("Popping item from list: "); -syscall log(list.pop()); -syscall log(" => "); -syscall log(list); -syscall log("\n"); - -syscall log("Get list length: "); -syscall log(list.length); -syscall log("\n"); +syscall io_out("Set item at index 4 in list: "); +syscall io_out(list); +syscall io_out("\n"); + +syscall io_out("Popping item from list: "); +syscall io_out(list.pop()); +syscall io_out(" => "); +syscall io_out(list); +syscall io_out("\n"); + +syscall io_out("Popping item from list: "); +syscall io_out(list.pop()); +syscall io_out(" => "); +syscall io_out(list); +syscall io_out("\n"); + +syscall io_out("Popping item from list: "); +syscall io_out(list.pop()); +syscall io_out(" => "); +syscall io_out(list); +syscall io_out("\n"); + +syscall io_out("Popping item from list: "); +syscall io_out(list.pop()); +syscall io_out(" => "); +syscall io_out(list); +syscall io_out("\n"); + +syscall io_out("Popping item from list: "); +syscall io_out(list.pop()); +syscall io_out(" => "); +syscall io_out(list); +syscall io_out("\n"); + +syscall io_out("Popping item from list: "); +syscall io_out(list.pop()); +syscall io_out(" => "); +syscall io_out(list); +syscall io_out("\n"); + +syscall io_out("Get list length: "); +syscall io_out(list.length); +syscall io_out("\n"); list.unshift(2); list.unshift(3); @@ -102,47 +102,47 @@ list.unshift(4); list.unshift(5); list.unshift(6); -syscall log("Unshift a few list items: "); -syscall log(list); -syscall log("\n"); +syscall io_out("Unshift a few list items: "); +syscall io_out(list); +syscall io_out("\n"); -syscall log("Shifting from list: "); -syscall log(list.shift()); -syscall log("\n"); +syscall io_out("Shifting from list: "); +syscall io_out(list.shift()); +syscall io_out("\n"); -syscall log("Shifting from list: "); -syscall log(list.shift()); -syscall log("\n"); +syscall io_out("Shifting from list: "); +syscall io_out(list.shift()); +syscall io_out("\n"); -syscall log("Shifting from list: "); -syscall log(list.shift()); -syscall log("\n"); +syscall io_out("Shifting from list: "); +syscall io_out(list.shift()); +syscall io_out("\n"); -syscall log("List after shifting: "); -syscall log(list); -syscall log("\n"); +syscall io_out("List after shifting: "); +syscall io_out(list); +syscall io_out("\n"); list.insert(1, 4); -syscall log("Inserted into list: "); -syscall log(list); -syscall log("\n"); +syscall io_out("Inserted into list: "); +syscall io_out(list); +syscall io_out("\n"); -syscall log("Removed from list by index: "); -syscall log(list.removeAt(1)); -syscall log("\n"); +syscall io_out("Removed from list by index: "); +syscall io_out(list.removeAt(1)); +syscall io_out("\n"); -syscall log("List after removal: "); -syscall log(list); -syscall log("\n"); +syscall io_out("List after removal: "); +syscall io_out(list); +syscall io_out("\n"); -syscall log("Removed from list by value; success: "); -syscall log(list.remove(2)); -syscall log("\n"); +syscall io_out("Removed from list by value; success: "); +syscall io_out(list.remove(2)); +syscall io_out("\n"); -syscall log("List after removal: "); -syscall log(list); -syscall log("\n"); +syscall io_out("List after removal: "); +syscall io_out(list); +syscall io_out("\n"); var empty = []; @@ -152,67 +152,67 @@ empty.shift(); var values = [1, 2, 3, 4, 5]; values.forEach(function(value, i) { - syscall log("values["); - syscall log(i); - syscall log("] = "); - syscall log(value); - syscall log("\n"); + syscall io_out("values["); + syscall io_out(i); + syscall io_out("] = "); + syscall io_out(value); + syscall io_out("\n"); }); -syscall log("Mapping: "); -syscall log(values.map(function(value, i) { +syscall io_out("Mapping: "); +syscall io_out(values.map(function(value, i) { return (value * 3) + i; })); -syscall log("\n"); +syscall io_out("\n"); -syscall log("Filtering to get odd numbers: "); -syscall log(values.filter(function(value) { +syscall io_out("Filtering to get odd numbers: "); +syscall io_out(values.filter(function(value) { return value % 2 == 1; })); -syscall log("\n"); +syscall io_out("\n"); -syscall log("Finding the first even number: "); -syscall log(values.find(function(value) { +syscall io_out("Finding the first even number: "); +syscall io_out(values.find(function(value) { return value % 2 == 0; })); -syscall log("\n"); +syscall io_out("\n"); -syscall log("Finding the index of the first even number: "); -syscall log(values.findIndex(function(value) { +syscall io_out("Finding the index of the first even number: "); +syscall io_out(values.findIndex(function(value) { return value % 2 == 0; })); -syscall log("\n"); +syscall io_out("\n"); -syscall log("Finding the number 6: "); -syscall log(values.find(function(value) { +syscall io_out("Finding the number 6: "); +syscall io_out(values.find(function(value) { return value == 6; })); -syscall log("\n"); +syscall io_out("\n"); -syscall log("Finding the index of the number 6: "); -syscall log(values.findIndex(function(value) { +syscall io_out("Finding the index of the number 6: "); +syscall io_out(values.findIndex(function(value) { return value == 6; })); -syscall log("\n"); +syscall io_out("\n"); -syscall log("Reducing to find sum: "); -syscall log(values.reduce(function(accumulator, value) { +syscall io_out("Reducing to find sum: "); +syscall io_out(values.reduce(function(accumulator, value) { return accumulator + value; }, 0)); -syscall log("\n"); +syscall io_out("\n"); -syscall log("Index of 3: "); -syscall log(values.indexOf(3)); -syscall log("\n"); +syscall io_out("Index of 3: "); +syscall io_out(values.indexOf(3)); +syscall io_out("\n"); -syscall log("Index of 6: "); -syscall log(values.indexOf(6)); -syscall log("\n"); +syscall io_out("Index of 6: "); +syscall io_out(values.indexOf(6)); +syscall io_out("\n"); -syscall log("List contains 3: "); -syscall log(values.contains(3)); -syscall log("\n"); +syscall io_out("List contains 3: "); +syscall io_out(values.contains(3)); +syscall io_out("\n"); -syscall log("List contains 6: "); -syscall log(values.contains(6)); -syscall log("\n"); \ No newline at end of file +syscall io_out("List contains 6: "); +syscall io_out(values.contains(6)); +syscall io_out("\n"); \ No newline at end of file diff --git a/test/objects/main.vxl b/test/objects/main.vxl index 244b290..1ecc0a7 100644 --- a/test/objects/main.vxl +++ b/test/objects/main.vxl @@ -9,104 +9,104 @@ var object = { "quoted key value": true }; -syscall log("Define object: "); -syscall log(object); -syscall log("\n"); +syscall io_out("Define object: "); +syscall io_out(object); +syscall io_out("\n"); -syscall log("Get value: "); -syscall log(object["key"]); -syscall log("\n"); +syscall io_out("Get value: "); +syscall io_out(object["key"]); +syscall io_out("\n"); -syscall log("Get value using property accessor: "); -syscall log(object.key); -syscall log("\n"); +syscall io_out("Get value using property accessor: "); +syscall io_out(object.key); +syscall io_out("\n"); -syscall log("Get value not in object: "); -syscall log(object["missing"]); -syscall log("\n"); +syscall io_out("Get value not in object: "); +syscall io_out(object["missing"]); +syscall io_out("\n"); -syscall log("Get value not in object using proeprty accessor: "); -syscall log(object.missing); -syscall log("\n"); +syscall io_out("Get value not in object using proeprty accessor: "); +syscall io_out(object.missing); +syscall io_out("\n"); -syscall log("Get nested object value: "); -syscall log(object["nestedObject"]["key2"]); -syscall log("\n"); +syscall io_out("Get nested object value: "); +syscall io_out(object["nestedObject"]["key2"]); +syscall io_out("\n"); -syscall log("Get nested object value using property accessor: "); -syscall log(object.nestedObject.key2); -syscall log("\n"); +syscall io_out("Get nested object value using property accessor: "); +syscall io_out(object.nestedObject.key2); +syscall io_out("\n"); object["key"] = 456; -syscall log("Set existing property value: "); -syscall log(object); -syscall log("\n"); +syscall io_out("Set existing property value: "); +syscall io_out(object); +syscall io_out("\n"); object["newKey"] = 789; -syscall log("Set new property value: "); -syscall log(object); -syscall log("\n"); +syscall io_out("Set new property value: "); +syscall io_out(object); +syscall io_out("\n"); object.key = 321; -syscall log("Set existing property value using property accessor: "); -syscall log(object); -syscall log("\n"); +syscall io_out("Set existing property value using property accessor: "); +syscall io_out(object); +syscall io_out("\n"); -syscall log("Get object length: "); -syscall log(object.length); -syscall log("\n"); +syscall io_out("Get object length: "); +syscall io_out(object.length); +syscall io_out("\n"); syscall Or(object, "nestedObject"); -syscall log("Removing nested object: "); -syscall log(object); -syscall log("\n"); +syscall io_out("Removing nested object: "); +syscall io_out(object); +syscall io_out("\n"); var mangledObject = {key: 123}; -syscall log("Get value using property accessor on mangled object: key = "); -syscall log(mangledObject.key); -syscall log("\n"); +syscall io_out("Get value using property accessor on mangled object: key = "); +syscall io_out(mangledObject.key); +syscall io_out("\n"); mangledObject.key = 456; -syscall log("Set value using property accessor on mangled object: key = "); -syscall log(mangledObject.key); -syscall log("\n"); +syscall io_out("Set value using property accessor on mangled object: key = "); +syscall io_out(mangledObject.key); +syscall io_out("\n"); mangledObject.mangledNestedObject = { mangledKey1: "value1", mangledKey2: "value2" }; -syscall log("Get value of nested object using property accessor on mangled object: mangledNestedObject.mangledKey1 = "); -syscall log(mangledObject.mangledNestedObject.mangledKey1); -syscall log("\n"); +syscall io_out("Get value of nested object using property accessor on mangled object: mangledNestedObject.mangledKey1 = "); +syscall io_out(mangledObject.mangledNestedObject.mangledKey1); +syscall io_out("\n"); mangledObject.mangledNestedObject.mangledKey3 = "value3"; -syscall log("Set new value of nested object using property accessor on mangled object: mangledNestedObject.mangledKey3 = "); -syscall log(mangledObject.mangledNestedObject.mangledKey3); -syscall log("\n"); +syscall io_out("Set new value of nested object using property accessor on mangled object: mangledNestedObject.mangledKey3 = "); +syscall io_out(mangledObject.mangledNestedObject.mangledKey3); +syscall io_out("\n"); var a = {key: 123}; var b = {key: 123}; -syscall log("Object A is equal to object B: "); -syscall log(a == b); -syscall log("\n"); +syscall io_out("Object A is equal to object B: "); +syscall io_out(a == b); +syscall io_out("\n"); -syscall log("Object A is identical to object B: "); -syscall log(a === b); -syscall log("\n"); +syscall io_out("Object A is identical to object B: "); +syscall io_out(a === b); +syscall io_out("\n"); -syscall log("Object A is not equal to object B: "); -syscall log(a != b); -syscall log("\n"); +syscall io_out("Object A is not equal to object B: "); +syscall io_out(a != b); +syscall io_out("\n"); -syscall log("Object A is not identical to object B: "); -syscall log(a !== b); -syscall log("\n"); \ No newline at end of file +syscall io_out("Object A is not identical to object B: "); +syscall io_out(a !== b); +syscall io_out("\n"); \ No newline at end of file diff --git a/test/prototypes/main.vxl b/test/prototypes/main.vxl index 7496c86..876ee25 100644 --- a/test/prototypes/main.vxl +++ b/test/prototypes/main.vxl @@ -17,62 +17,62 @@ var child = { child.prototypes.push(primaryParent); child.prototypes.push(secondaryParent); -syscall log("key1: "); -syscall log(child.key1); -syscall log("\n"); +syscall io_out("key1: "); +syscall io_out(child.key1); +syscall io_out("\n"); -syscall log("key2: "); -syscall log(child.key2); -syscall log("\n"); +syscall io_out("key2: "); +syscall io_out(child.key2); +syscall io_out("\n"); -syscall log("key3: "); -syscall log(child.key3); -syscall log("\n"); +syscall io_out("key3: "); +syscall io_out(child.key3); +syscall io_out("\n"); -syscall log("key4: "); -syscall log(child.key4); -syscall log("\n"); +syscall io_out("key4: "); +syscall io_out(child.key4); +syscall io_out("\n"); -syscall log("key5: "); -syscall log(child.key5); -syscall log("\n"); +syscall io_out("key5: "); +syscall io_out(child.key5); +syscall io_out("\n"); child.key2 = "child value2"; child.key4 = "child value4"; -syscall log("Set keys\n"); +syscall io_out("Set keys\n"); -syscall log("key2: "); -syscall log(child.key2); -syscall log("\n"); +syscall io_out("key2: "); +syscall io_out(child.key2); +syscall io_out("\n"); -syscall log("key4: "); -syscall log(child.key4); -syscall log("\n"); +syscall io_out("key4: "); +syscall io_out(child.key4); +syscall io_out("\n"); -syscall log("primaryParent key2: "); -syscall log(primaryParent.key2); -syscall log("\n"); +syscall io_out("primaryParent key2: "); +syscall io_out(primaryParent.key2); +syscall io_out("\n"); -syscall log("secondaryParent key4: "); -syscall log(secondaryParent.key4); -syscall log("\n"); +syscall io_out("secondaryParent key4: "); +syscall io_out(secondaryParent.key4); +syscall io_out("\n"); -syscall log("child is primaryParent: "); -syscall log(child is primaryParent); -syscall log("\n"); +syscall io_out("child is primaryParent: "); +syscall io_out(child is primaryParent); +syscall io_out("\n"); -syscall log("child inherits primaryParent: "); -syscall log(child inherits primaryParent); -syscall log("\n"); +syscall io_out("child inherits primaryParent: "); +syscall io_out(child inherits primaryParent); +syscall io_out("\n"); -syscall log("primaryParent is secondaryParent: "); -syscall log(primaryParent is secondaryParent); -syscall log("\n"); +syscall io_out("primaryParent is secondaryParent: "); +syscall io_out(primaryParent is secondaryParent); +syscall io_out("\n"); -syscall log("primaryParent inherits secondaryParent: "); -syscall log(primaryParent inherits secondaryParent); -syscall log("\n"); +syscall io_out("primaryParent inherits secondaryParent: "); +syscall io_out(primaryParent inherits secondaryParent); +syscall io_out("\n"); var derivedParent = { key3: "derivedParent key3", @@ -89,26 +89,26 @@ var derivedChild = { derivedChild.prototypes.push(derivedParent); -syscall log("derivedChild key3: "); -syscall log(derivedChild.key3); -syscall log("\n"); +syscall io_out("derivedChild key3: "); +syscall io_out(derivedChild.key3); +syscall io_out("\n"); -syscall log("derivedChild key7: "); -syscall log(derivedChild.key7); -syscall log("\n"); +syscall io_out("derivedChild key7: "); +syscall io_out(derivedChild.key7); +syscall io_out("\n"); -syscall log("derivedChild is primaryParent: "); -syscall log(derivedChild is primaryParent); -syscall log("\n"); +syscall io_out("derivedChild is primaryParent: "); +syscall io_out(derivedChild is primaryParent); +syscall io_out("\n"); -syscall log("derivedChild inherits primaryParent: "); -syscall log(derivedChild inherits primaryParent); -syscall log("\n"); +syscall io_out("derivedChild inherits primaryParent: "); +syscall io_out(derivedChild inherits primaryParent); +syscall io_out("\n"); -syscall log("derivedChild is derivedParent: "); -syscall log(derivedChild is derivedParent); -syscall log("\n"); +syscall io_out("derivedChild is derivedParent: "); +syscall io_out(derivedChild is derivedParent); +syscall io_out("\n"); -syscall log("derivedChild inherits derivedParent: "); -syscall log(derivedChild inherits derivedParent); -syscall log("\n"); \ No newline at end of file +syscall io_out("derivedChild inherits derivedParent: "); +syscall io_out(derivedChild inherits derivedParent); +syscall io_out("\n"); \ No newline at end of file diff --git a/test/staticmacros/main.vxl b/test/staticmacros/main.vxl index 0402a41..ca0eab5 100644 --- a/test/staticmacros/main.vxl +++ b/test/staticmacros/main.vxl @@ -9,18 +9,18 @@ object.unusedProp = 456; object.usedProp; -syscall log("#used(used): "); -syscall log(#used(used)); -syscall log("\n"); +syscall io_out("#used(used): "); +syscall io_out(#used(used)); +syscall io_out("\n"); -syscall log("#used(unused): "); -syscall log(#used(unused)); -syscall log("\n"); +syscall io_out("#used(unused): "); +syscall io_out(#used(unused)); +syscall io_out("\n"); -syscall log("#usedprop(usedProp): "); -syscall log(#usedprop(usedProp)); -syscall log("\n"); +syscall io_out("#usedprop(usedProp): "); +syscall io_out(#usedprop(usedProp)); +syscall io_out("\n"); -syscall log("#usedprop(unusedProp): "); -syscall log(#usedprop(unusedProp)); -syscall log("\n"); \ No newline at end of file +syscall io_out("#usedprop(unusedProp): "); +syscall io_out(#usedprop(unusedProp)); +syscall io_out("\n"); \ No newline at end of file diff --git a/test/strings/main.vxl b/test/strings/main.vxl index 83d15d8..79c0191 100644 --- a/test/strings/main.vxl +++ b/test/strings/main.vxl @@ -1,39 +1,39 @@ var string = "abcdef"; -syscall log("String: "); -syscall log(string); -syscall log("\n"); +syscall io_out("String: "); +syscall io_out(string); +syscall io_out("\n"); -syscall log("Size: "); -syscall log(string.size); -syscall log("\n"); +syscall io_out("Size: "); +syscall io_out(string.size); +syscall io_out("\n"); -syscall log("Reversed: "); -syscall log(string.reverse()); -syscall log("\n"); +syscall io_out("Reversed: "); +syscall io_out(string.reverse()); +syscall io_out("\n"); -syscall log("Cut start: "); -syscall log(string.cutStart(4)); -syscall log("\n"); +syscall io_out("Cut start: "); +syscall io_out(string.cutStart(4)); +syscall io_out("\n"); -syscall log("Cut end: "); -syscall log(string.cutEnd(4)); -syscall log("\n"); +syscall io_out("Cut end: "); +syscall io_out(string.cutEnd(4)); +syscall io_out("\n"); -syscall log("Substring: "); -syscall log(string.substring(2, 4)); -syscall log("\n"); +syscall io_out("Substring: "); +syscall io_out(string.substring(2, 4)); +syscall io_out("\n"); -syscall log("Pad start: "); -syscall log(string.padStart(10, "123")); -syscall log("\n"); +syscall io_out("Pad start: "); +syscall io_out(string.padStart(10, "123")); +syscall io_out("\n"); -syscall log("Pad end: "); -syscall log(string.padEnd(10, "123")); -syscall log("\n"); +syscall io_out("Pad end: "); +syscall io_out(string.padEnd(10, "123")); +syscall io_out("\n"); var numericString = "1234"; -syscall log("Numeric string to number + 1: "); -syscall log(numericString.toNumber() + 1); -syscall log("\n"); \ No newline at end of file +syscall io_out("Numeric string to number + 1: "); +syscall io_out(numericString.toNumber() + 1); +syscall io_out("\n"); \ No newline at end of file diff --git a/test/threads/main.vxl b/test/threads/main.vxl index 9755026..525801d 100644 --- a/test/threads/main.vxl +++ b/test/threads/main.vxl @@ -1,20 +1,20 @@ function repeat(value, times) { for (var i = 0; i < times; i++) { - syscall log(value); + syscall io_out(value); } } -var thread1 = syscall Thn(repeat, ["Thread 1\n", 5]); -var thread2 = syscall Thn(repeat, ["Thread 2\n", 5]); +var thread1 = syscall threads_new(repeat, ["Thread 1\n", 5]); +var thread2 = syscall threads_new(repeat, ["Thread 2\n", 5]); repeat("Main executor\n", 5); -while (syscall Thir(thread1)) {} +while (syscall threads_isRunning(thread1)) {} -syscall Thd(thread1); -syscall log("Destroyed thread 1\n"); +syscall threads_destroy(thread1); +syscall io_out("Destroyed thread 1\n"); -while (syscall Thir(thread2)) {} +while (syscall threads_isRunning(thread2)) {} -syscall Thd(thread2); -syscall log("Destroyed thread 2\n"); \ No newline at end of file +syscall threads_destroy(thread2); +syscall io_out("Destroyed thread 2\n"); \ No newline at end of file diff --git a/test/whileloops/main.vxl b/test/whileloops/main.vxl index 6d2c126..1112f0e 100644 --- a/test/whileloops/main.vxl +++ b/test/whileloops/main.vxl @@ -1,26 +1,26 @@ var i = 0; -syscall log("Basic loop:\n"); +syscall io_out("Basic loop:\n"); while (i < 5) { - syscall log(i); - syscall log("\n"); + syscall io_out(i); + syscall io_out("\n"); i++; } -syscall log("\n"); +syscall io_out("\n"); var j = 0; -syscall log("Loop that breaks:\n"); +syscall io_out("Loop that breaks:\n"); while (true) { - syscall log(j); - syscall log("\n"); + syscall io_out(j); + syscall io_out("\n"); if (j == 4) { - syscall log("Break loop\n"); + syscall io_out("Break loop\n"); break; } @@ -28,25 +28,25 @@ while (true) { j++; } -syscall log("\n"); +syscall io_out("\n"); var k = 0; -syscall log("Loop that uses `continue` statement:\n"); +syscall io_out("Loop that uses `continue` statement:\n"); while (k < 5) { - syscall log(k); - syscall log("\n"); + syscall io_out(k); + syscall io_out("\n"); if (k % 2 == 0) { - syscall log("Continue\n"); + syscall io_out("Continue\n"); k++; continue; } - syscall log("No continue\n"); + syscall io_out("No continue\n"); k++; } \ No newline at end of file