From 744cd740162b2e0c6be24502b945678bd093dbcb Mon Sep 17 00:00:00 2001 From: zongor Date: Tue, 2 Jun 2026 21:19:07 -0700 Subject: [PATCH] move a bunch of stuff around --- test/{ => hardcoded}/add-hardcoded.tal | 0 test/{ => hardcoded}/attack.c | 5 +++-- test/{ => hardcoded}/bang-hardcoded.tal | 0 test/{ => hardcoded}/fib-hardcoded.tal | 0 test/{ => hardcoded}/global-hardcoded.tal | 0 test/{ => hardcoded}/hello-hardcoded.tal | 0 test/{ => hardcoded}/if-hardcoded.tal | 0 test/{ => hardcoded}/while-hardcoded.tal | 0 test/simple.ul | 1 - test/str.ul | 16 ++++++++-------- test/{ => tal}/attack.tal | 0 test/{ => tal}/bang.tal | 0 test/{ => tal}/fib.tal | 0 test/{ => tal}/global.tal | 0 test/{ => tal}/hello.tal | 0 test/{ => tal}/if.tal | 0 test/{ => tal}/while.tal | 0 17 files changed, 11 insertions(+), 11 deletions(-) rename test/{ => hardcoded}/add-hardcoded.tal (100%) rename test/{ => hardcoded}/attack.c (91%) rename test/{ => hardcoded}/bang-hardcoded.tal (100%) rename test/{ => hardcoded}/fib-hardcoded.tal (100%) rename test/{ => hardcoded}/global-hardcoded.tal (100%) rename test/{ => hardcoded}/hello-hardcoded.tal (100%) rename test/{ => hardcoded}/if-hardcoded.tal (100%) rename test/{ => hardcoded}/while-hardcoded.tal (100%) delete mode 100755 test/simple.ul rename test/{ => tal}/attack.tal (100%) rename test/{ => tal}/bang.tal (100%) rename test/{ => tal}/fib.tal (100%) rename test/{ => tal}/global.tal (100%) rename test/{ => tal}/hello.tal (100%) rename test/{ => tal}/if.tal (100%) rename test/{ => tal}/while.tal (100%) diff --git a/test/add-hardcoded.tal b/test/hardcoded/add-hardcoded.tal similarity index 100% rename from test/add-hardcoded.tal rename to test/hardcoded/add-hardcoded.tal diff --git a/test/attack.c b/test/hardcoded/attack.c similarity index 91% rename from test/attack.c rename to test/hardcoded/attack.c index a019dc0..2fdc2c6 100755 --- a/test/attack.c +++ b/test/hardcoded/attack.c @@ -7,8 +7,9 @@ unsigned calc_damage(unsigned at, unsigned accuracy) { return at * accuracy / 20 - 3; } -void main() { +int main() { unsigned dmg = calc_damage(AT, accuracy); printf("%d%s", dmg, msg); -} \ No newline at end of file + return 0; +} diff --git a/test/bang-hardcoded.tal b/test/hardcoded/bang-hardcoded.tal similarity index 100% rename from test/bang-hardcoded.tal rename to test/hardcoded/bang-hardcoded.tal diff --git a/test/fib-hardcoded.tal b/test/hardcoded/fib-hardcoded.tal similarity index 100% rename from test/fib-hardcoded.tal rename to test/hardcoded/fib-hardcoded.tal diff --git a/test/global-hardcoded.tal b/test/hardcoded/global-hardcoded.tal similarity index 100% rename from test/global-hardcoded.tal rename to test/hardcoded/global-hardcoded.tal diff --git a/test/hello-hardcoded.tal b/test/hardcoded/hello-hardcoded.tal similarity index 100% rename from test/hello-hardcoded.tal rename to test/hardcoded/hello-hardcoded.tal diff --git a/test/if-hardcoded.tal b/test/hardcoded/if-hardcoded.tal similarity index 100% rename from test/if-hardcoded.tal rename to test/hardcoded/if-hardcoded.tal diff --git a/test/while-hardcoded.tal b/test/hardcoded/while-hardcoded.tal similarity index 100% rename from test/while-hardcoded.tal rename to test/hardcoded/while-hardcoded.tal diff --git a/test/simple.ul b/test/simple.ul deleted file mode 100755 index 2ae047b..0000000 --- a/test/simple.ul +++ /dev/null @@ -1 +0,0 @@ -print((122 - 32)); // prints ascii `Z` diff --git a/test/str.ul b/test/str.ul index 80ee684..9dc0946 100644 --- a/test/str.ul +++ b/test/str.ul @@ -16,17 +16,17 @@ function pln(str string) { /** * Concatinates 2 strings */ -function concat(str src1, str src2) str { +function strcat(str src1, str src2) str { str result = malloc(src1.length + src2.length); - memcpy(result[0].ref, src1.ref); - memcpy((&result + src1.length), src2.ref); + memcpy(&result[0], &src1); + memcpy((&result + src1.length), &src2); return result; } /** * finds index of string, -1 if not found */ -function str_index_of(str haystack, byte needle) int { +function stridx(str haystack, byte needle) int { int i = -1; for (byte c in haystack) { i = i + 1; @@ -40,7 +40,7 @@ function str_index_of(str haystack, byte needle) int { /** * checks if 2 strings are equal */ -function str_eq(str src1, str src2) bool { +function streq(str src1, str src2) bool { if (src1.length != src2.length) return false; for (int i=0; src1.length; i++) { if (src1[i] != src2[i]) return false; @@ -51,7 +51,7 @@ function str_eq(str src1, str src2) bool { /** * Slice string */ -function str_slice(str src, int start, int stop) str { +function slice(str src, int start, int stop) str { int len = stop - start; str result = malloc(len); for (int i=start; i 0); str result = malloc(5 - i); - memcpy(result, buffer[0].ref + i, 5 - i); + memcpy(result, &buffer[0] + i, 5 - i); return result; } diff --git a/test/attack.tal b/test/tal/attack.tal similarity index 100% rename from test/attack.tal rename to test/tal/attack.tal diff --git a/test/bang.tal b/test/tal/bang.tal similarity index 100% rename from test/bang.tal rename to test/tal/bang.tal diff --git a/test/fib.tal b/test/tal/fib.tal similarity index 100% rename from test/fib.tal rename to test/tal/fib.tal diff --git a/test/global.tal b/test/tal/global.tal similarity index 100% rename from test/global.tal rename to test/tal/global.tal diff --git a/test/hello.tal b/test/tal/hello.tal similarity index 100% rename from test/hello.tal rename to test/tal/hello.tal diff --git a/test/if.tal b/test/tal/if.tal similarity index 100% rename from test/if.tal rename to test/tal/if.tal diff --git a/test/while.tal b/test/tal/while.tal similarity index 100% rename from test/while.tal rename to test/tal/while.tal