summaryrefslogtreecommitdiff
path: root/comp/lucas-standen-NEA/code2
diff options
context:
space:
mode:
authorthing1 <thing1@seacrossedlovers.xyz>2024-09-24 11:01:01 +0100
committerthing1 <thing1@seacrossedlovers.xyz>2024-09-24 11:01:01 +0100
commit905588e11c174e3ac2d6bb235c7ab81532f98691 (patch)
treeb7e083be0e610ccdb8915a95245016d38dd75d56 /comp/lucas-standen-NEA/code2
parent468fc8ca7d9ea4a0529aa055bad14c02347c748a (diff)
did some fixes to the compiler around the auto mem free
Diffstat (limited to 'comp/lucas-standen-NEA/code2')
-rw-r--r--comp/lucas-standen-NEA/code2/comp.c2
-rw-r--r--comp/lucas-standen-NEA/code2/examples/Makefile1
-rwxr-xr-xcomp/lucas-standen-NEA/code2/examples/fib_examplebin21664 -> 21864 bytes
-rwxr-xr-xcomp/lucas-standen-NEA/code2/examples/guestbookbin0 -> 21064 bytes
-rw-r--r--comp/lucas-standen-NEA/code2/examples/guestbook.zpy9
-rwxr-xr-xcomp/lucas-standen-NEA/code2/examples/raylib_examplebin1140296 -> 1082840 bytes
-rwxr-xr-xcomp/lucas-standen-NEA/code2/examples/str_examplebin21976 -> 22184 bytes
-rw-r--r--comp/lucas-standen-NEA/code2/stdlib/zpylib.c10
-rw-r--r--comp/lucas-standen-NEA/code2/stdlib/zpylib.h1
-rwxr-xr-xcomp/lucas-standen-NEA/code2/zpybin40888 -> 36888 bytes
10 files changed, 22 insertions, 1 deletions
diff --git a/comp/lucas-standen-NEA/code2/comp.c b/comp/lucas-standen-NEA/code2/comp.c
index c21bc3a..f06631b 100644
--- 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
index 13178a5..5ec43aa 100644
--- 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
index d9748fd..583d041 100755
--- 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
new file mode 100755
index 0000000..ecc4cc7
--- /dev/null
+++ 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
new file mode 100644
index 0000000..4fadecd
--- /dev/null
+++ 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
index 5b946d1..43ba321 100755
--- 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
index b73017f..b8c6870 100755
--- 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
index 9932785..86f0dc3 100644
--- 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
index d86dc2d..808ef55 100644
--- 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
index df68993..107d933 100755
--- a/comp/lucas-standen-NEA/code2/zpy
+++ b/comp/lucas-standen-NEA/code2/zpy
Binary files differ