school

thing1's amazing school repo
Log | Files | Refs | Submodules | README

commit 905588e11c174e3ac2d6bb235c7ab81532f98691
parent 468fc8ca7d9ea4a0529aa055bad14c02347c748a
Author: thing1 <thing1@seacrossedlovers.xyz>
Date:   Tue, 24 Sep 2024 11:01:01 +0100

did some fixes to the compiler around the auto mem free

Diffstat:
Mcomp/lucas-standen-NEA/code2/comp.c | 2+-
Mcomp/lucas-standen-NEA/code2/examples/Makefile | 1+
Mcomp/lucas-standen-NEA/code2/examples/fib_example | 0
Acomp/lucas-standen-NEA/code2/examples/guestbook | 0
Acomp/lucas-standen-NEA/code2/examples/guestbook.zpy | 9+++++++++
Mcomp/lucas-standen-NEA/code2/examples/raylib_example | 0
Mcomp/lucas-standen-NEA/code2/examples/str_example | 0
Mcomp/lucas-standen-NEA/code2/stdlib/zpylib.c | 10++++++++++
Mcomp/lucas-standen-NEA/code2/stdlib/zpylib.h | 1+
Mcomp/lucas-standen-NEA/code2/zpy | 0
10 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/comp/lucas-standen-NEA/code2/comp.c b/comp/lucas-standen-NEA/code2/comp.c @@ -258,7 +258,7 @@ end: void Compile(astNode *line, FILE *f){ char *code = compile(line); if (neededmemptr == true){ - tofree[freeptr] = getVarName(line->args[0]); + tofree[freeptr] = line->args[0]; freeptr++; neededmemptr = false; } diff --git a/comp/lucas-standen-NEA/code2/examples/Makefile b/comp/lucas-standen-NEA/code2/examples/Makefile @@ -2,5 +2,6 @@ all: zpy raylib_example.zpy -o raylib_example -f -lraylib -f -lm -i raylib.h zpy fib_example.zpy -o fib_example -f -ggdb zpy str_example.zpy -o str_example -f -ggdb + zpy guestbook.zpy -o guestbook clean: rm -rf fib_example raylib_example str_example diff --git a/comp/lucas-standen-NEA/code2/examples/fib_example b/comp/lucas-standen-NEA/code2/examples/fib_example Binary files differ. diff --git a/comp/lucas-standen-NEA/code2/examples/guestbook b/comp/lucas-standen-NEA/code2/examples/guestbook Binary files differ. diff --git a/comp/lucas-standen-NEA/code2/examples/guestbook.zpy b/comp/lucas-standen-NEA/code2/examples/guestbook.zpy @@ -0,0 +1,9 @@ +(defun main int) + (let names:char** (alloc (sizeof char**))) + (for i:int 1 (< i 256) 1) + (set names[i] (readstr)) + (printstr "name_count:") + (printint i) + (printchar '\n') + (endfor) +(endfun) diff --git a/comp/lucas-standen-NEA/code2/examples/raylib_example b/comp/lucas-standen-NEA/code2/examples/raylib_example Binary files differ. diff --git a/comp/lucas-standen-NEA/code2/examples/str_example b/comp/lucas-standen-NEA/code2/examples/str_example Binary files differ. diff --git a/comp/lucas-standen-NEA/code2/stdlib/zpylib.c b/comp/lucas-standen-NEA/code2/stdlib/zpylib.c @@ -4,6 +4,10 @@ #include "./String/String.h" +void printstr(char *s){ + printf("%s", s); +} + void printchar(char c){ putchar(c); } @@ -16,6 +20,12 @@ void printfloat(double f){ printf("%f", f); } +char *readstr(){ + char *str = calloc(0, 256); + fgets(str, 256, stdin); + return str; +} + char readchar(){ char c; scanf("%c", &c); diff --git a/comp/lucas-standen-NEA/code2/stdlib/zpylib.h b/comp/lucas-standen-NEA/code2/stdlib/zpylib.h @@ -4,6 +4,7 @@ void printstr(char *str); void printint(int i); void printfloat(double f); +char *readstr(); int readint(); void readfloat(double f); int randint(int lower, int upper); diff --git a/comp/lucas-standen-NEA/code2/zpy b/comp/lucas-standen-NEA/code2/zpy Binary files differ.