From faef2d81c224b715c5e429d04c59ba50fb772d9e Mon Sep 17 00:00:00 2001 From: thing1 Date: Tue, 15 Oct 2024 10:19:30 +0100 Subject: added a stupid amount of work to zpy, and started the document work in latex rather than groff --- comp/lucas-standen-NEA/code2/examples/Makefile | 5 ++- comp/lucas-standen-NEA/code2/examples/dvd.png | Bin 1247 -> 0 bytes comp/lucas-standen-NEA/code2/examples/fib_example | Bin 0 -> 25496 bytes .../code2/examples/helloworld/main | Bin 0 -> 24720 bytes .../code2/examples/helloworld/main.zpy | 3 ++ .../code2/examples/helloworld/zpybuild.sh | 2 ++ .../code2/examples/helloworldadv/helloworld.c | 4 +++ .../code2/examples/helloworldadv/helloworld.zpy | 3 ++ .../code2/examples/helloworldadv/main | Bin 0 -> 19440 bytes .../code2/examples/helloworldadv/main.c | 4 +++ .../code2/examples/helloworldadv/main.zpy | 3 ++ .../code2/examples/helloworldadv/zpybuild.sh | 4 +++ .../code2/examples/raylib_example.zpy | 36 -------------------- .../code2/examples/raylib_example/dvd.png | Bin 0 -> 1247 bytes .../code2/examples/raylib_example/main | Bin 0 -> 1077360 bytes .../code2/examples/raylib_example/main.zpy | 37 +++++++++++++++++++++ .../code2/examples/raylib_example/zpybuild.sh | 4 +++ .../lucas-standen-NEA/code2/examples/spaceinvaders | Bin 0 -> 1086520 bytes .../code2/examples/spaceinvaders.zpy | 2 ++ comp/lucas-standen-NEA/code2/examples/str_example | Bin 0 -> 25952 bytes .../lucas-standen-NEA/code2/examples/syntaxerr.zpy | 4 ++- comp/lucas-standen-NEA/code2/examples/tmp.zpy.c | 2 ++ 22 files changed, 73 insertions(+), 40 deletions(-) delete mode 100644 comp/lucas-standen-NEA/code2/examples/dvd.png create mode 100755 comp/lucas-standen-NEA/code2/examples/fib_example create mode 100755 comp/lucas-standen-NEA/code2/examples/helloworld/main create mode 100644 comp/lucas-standen-NEA/code2/examples/helloworld/main.zpy create mode 100644 comp/lucas-standen-NEA/code2/examples/helloworld/zpybuild.sh create mode 100644 comp/lucas-standen-NEA/code2/examples/helloworldadv/helloworld.c create mode 100644 comp/lucas-standen-NEA/code2/examples/helloworldadv/helloworld.zpy create mode 100755 comp/lucas-standen-NEA/code2/examples/helloworldadv/main create mode 100644 comp/lucas-standen-NEA/code2/examples/helloworldadv/main.c create mode 100644 comp/lucas-standen-NEA/code2/examples/helloworldadv/main.zpy create mode 100644 comp/lucas-standen-NEA/code2/examples/helloworldadv/zpybuild.sh delete mode 100644 comp/lucas-standen-NEA/code2/examples/raylib_example.zpy create mode 100644 comp/lucas-standen-NEA/code2/examples/raylib_example/dvd.png create mode 100755 comp/lucas-standen-NEA/code2/examples/raylib_example/main create mode 100644 comp/lucas-standen-NEA/code2/examples/raylib_example/main.zpy create mode 100644 comp/lucas-standen-NEA/code2/examples/raylib_example/zpybuild.sh create mode 100755 comp/lucas-standen-NEA/code2/examples/spaceinvaders create mode 100755 comp/lucas-standen-NEA/code2/examples/str_example create mode 100644 comp/lucas-standen-NEA/code2/examples/tmp.zpy.c (limited to 'comp/lucas-standen-NEA/code2/examples') diff --git a/comp/lucas-standen-NEA/code2/examples/Makefile b/comp/lucas-standen-NEA/code2/examples/Makefile index 18a9e64..d3ee327 100644 --- a/comp/lucas-standen-NEA/code2/examples/Makefile +++ b/comp/lucas-standen-NEA/code2/examples/Makefile @@ -1,9 +1,8 @@ all: - zpy raylib_example.zpy -o raylib_example -f -lraylib -f -lm -i raylib.h zpy spaceinvaders.zpy -o spaceinvaders -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 syntaxerr.zpy -o syntaxerr + zpy syntaxerr.zpy -o syntaxerr clean: - rm -rf fib_example raylib_example str_example spaceinvaders tmp.zpy.c + rm -rf fib_example raylib_example str_example spaceinvaders syntaxerr tmp.zpy.c diff --git a/comp/lucas-standen-NEA/code2/examples/dvd.png b/comp/lucas-standen-NEA/code2/examples/dvd.png deleted file mode 100644 index 8e219f7..0000000 Binary files a/comp/lucas-standen-NEA/code2/examples/dvd.png and /dev/null differ diff --git a/comp/lucas-standen-NEA/code2/examples/fib_example b/comp/lucas-standen-NEA/code2/examples/fib_example new file mode 100755 index 0000000..bdd94ec Binary files /dev/null and b/comp/lucas-standen-NEA/code2/examples/fib_example differ diff --git a/comp/lucas-standen-NEA/code2/examples/helloworld/main b/comp/lucas-standen-NEA/code2/examples/helloworld/main new file mode 100755 index 0000000..653d84c Binary files /dev/null and b/comp/lucas-standen-NEA/code2/examples/helloworld/main differ diff --git a/comp/lucas-standen-NEA/code2/examples/helloworld/main.zpy b/comp/lucas-standen-NEA/code2/examples/helloworld/main.zpy new file mode 100644 index 0000000..ef0a288 --- /dev/null +++ b/comp/lucas-standen-NEA/code2/examples/helloworld/main.zpy @@ -0,0 +1,3 @@ +(defun main int) + (printstr "hello world\n") +(endfun) diff --git a/comp/lucas-standen-NEA/code2/examples/helloworld/zpybuild.sh b/comp/lucas-standen-NEA/code2/examples/helloworld/zpybuild.sh new file mode 100644 index 0000000..7f675c3 --- /dev/null +++ b/comp/lucas-standen-NEA/code2/examples/helloworld/zpybuild.sh @@ -0,0 +1,2 @@ +#!/bin/sh +zpy ./main.zpy -o main diff --git a/comp/lucas-standen-NEA/code2/examples/helloworldadv/helloworld.c b/comp/lucas-standen-NEA/code2/examples/helloworldadv/helloworld.c new file mode 100644 index 0000000..f1e746f --- /dev/null +++ b/comp/lucas-standen-NEA/code2/examples/helloworldadv/helloworld.c @@ -0,0 +1,4 @@ +#include +void helloworld(){ +printstr("hello world\n"); +} diff --git a/comp/lucas-standen-NEA/code2/examples/helloworldadv/helloworld.zpy b/comp/lucas-standen-NEA/code2/examples/helloworldadv/helloworld.zpy new file mode 100644 index 0000000..9e3553b --- /dev/null +++ b/comp/lucas-standen-NEA/code2/examples/helloworldadv/helloworld.zpy @@ -0,0 +1,3 @@ +(defun helloworld void) + (printstr "hello world\n") +(endfun) diff --git a/comp/lucas-standen-NEA/code2/examples/helloworldadv/main b/comp/lucas-standen-NEA/code2/examples/helloworldadv/main new file mode 100755 index 0000000..593fe40 Binary files /dev/null and b/comp/lucas-standen-NEA/code2/examples/helloworldadv/main differ diff --git a/comp/lucas-standen-NEA/code2/examples/helloworldadv/main.c b/comp/lucas-standen-NEA/code2/examples/helloworldadv/main.c new file mode 100644 index 0000000..a2b6927 --- /dev/null +++ b/comp/lucas-standen-NEA/code2/examples/helloworldadv/main.c @@ -0,0 +1,4 @@ +#include +int main(){ +helloworld(); +} diff --git a/comp/lucas-standen-NEA/code2/examples/helloworldadv/main.zpy b/comp/lucas-standen-NEA/code2/examples/helloworldadv/main.zpy new file mode 100644 index 0000000..05b6155 --- /dev/null +++ b/comp/lucas-standen-NEA/code2/examples/helloworldadv/main.zpy @@ -0,0 +1,3 @@ +(defun main int) + (helloworld) +(endfun) diff --git a/comp/lucas-standen-NEA/code2/examples/helloworldadv/zpybuild.sh b/comp/lucas-standen-NEA/code2/examples/helloworldadv/zpybuild.sh new file mode 100644 index 0000000..26424d7 --- /dev/null +++ b/comp/lucas-standen-NEA/code2/examples/helloworldadv/zpybuild.sh @@ -0,0 +1,4 @@ +#!/bin/sh +zpy ./main.zpy -c -o main.c +zpy ./helloworld.zpy -c -o helloworld.c +cc main.c helloworld.c /usr/local/share/zpylib/zpylib.o -o main -I/usr/local/share/zpylib/include -Wno-implicit-function-declaration diff --git a/comp/lucas-standen-NEA/code2/examples/raylib_example.zpy b/comp/lucas-standen-NEA/code2/examples/raylib_example.zpy deleted file mode 100644 index 7c6e599..0000000 --- a/comp/lucas-standen-NEA/code2/examples/raylib_example.zpy +++ /dev/null @@ -1,36 +0,0 @@ -(defun main int) - (InitWindow 800 800 "test test") - (SetTargetFPS 60) - - (let img:Image (LoadImage "dvd.png")) - (let tex:Texture (LoadTextureFromImage img)) - (UnloadImage img) - - (let x:int (randint 4 9)) - (let y:int (randint 4 9)) - (let xd:int (randint 3 5)) - (let yd:int (randint 3 5)) - - (for i:int 0 (= (WindowShouldClose) 0) 0) - (BeginDrawing) - (ClearBackground RAYWHITE) - (DrawTexture tex x y WHITE) - (EndDrawing) - - (set x (+ x xd)) - (set y (+ y yd)) - - (if (> x 750)) - (set xd -xd) - (elif (< x 0)) - (set xd -xd) - (endif) - (if (> y 750)) - (set yd -yd) - (elif (< y 0)) - (set yd -yd) - (endif) - - (endfor) - (CloseWindow) -(endfun) diff --git a/comp/lucas-standen-NEA/code2/examples/raylib_example/dvd.png b/comp/lucas-standen-NEA/code2/examples/raylib_example/dvd.png new file mode 100644 index 0000000..8e219f7 Binary files /dev/null and b/comp/lucas-standen-NEA/code2/examples/raylib_example/dvd.png differ diff --git a/comp/lucas-standen-NEA/code2/examples/raylib_example/main b/comp/lucas-standen-NEA/code2/examples/raylib_example/main new file mode 100755 index 0000000..b124ebf Binary files /dev/null and b/comp/lucas-standen-NEA/code2/examples/raylib_example/main differ diff --git a/comp/lucas-standen-NEA/code2/examples/raylib_example/main.zpy b/comp/lucas-standen-NEA/code2/examples/raylib_example/main.zpy new file mode 100644 index 0000000..cd6a382 --- /dev/null +++ b/comp/lucas-standen-NEA/code2/examples/raylib_example/main.zpy @@ -0,0 +1,37 @@ +//# this function is my main loop +(defun main int) + (InitWindow 800 800 "test test") + (SetTargetFPS 60) + + (let img:Image (LoadImage "dvd.png")) + (let tex:Texture (LoadTextureFromImage img)) + (UnloadImage img) + + (let x:int (randint 4 9)) + (let y:int (randint 4 9)) + (let xd:int (randint 3 5)) + (let yd:int (randint 3 5)) + + (for i:int 0 (= (WindowShouldClose) 0) 0) + (BeginDrawing) + (ClearBackground RAYWHITE) + (DrawTexture tex x y WHITE) + (EndDrawing) + + (set x (+ x xd)) + (set y (+ y yd)) + + (if (> x 750)) + (set xd -xd) + (elif (< x 0)) + (set xd -xd) + (endif) + (if (> y 750)) + (set yd -yd) + (elif (< y 0)) + (set yd -yd) + (endif) + + (endfor) + (CloseWindow) +(endfun) diff --git a/comp/lucas-standen-NEA/code2/examples/raylib_example/zpybuild.sh b/comp/lucas-standen-NEA/code2/examples/raylib_example/zpybuild.sh new file mode 100644 index 0000000..3916f3b --- /dev/null +++ b/comp/lucas-standen-NEA/code2/examples/raylib_example/zpybuild.sh @@ -0,0 +1,4 @@ +#!/bin/sh +zpy ./main.zpy -c -o main.c -i raylib.h +cc main.c /usr/local/share/zpylib/zpylib.o -o main -I/usr/local/share/zpylib/include -Wno-implicit-function-declaration -lraylib -lm +rm -rf main.c diff --git a/comp/lucas-standen-NEA/code2/examples/spaceinvaders b/comp/lucas-standen-NEA/code2/examples/spaceinvaders new file mode 100755 index 0000000..ec88002 Binary files /dev/null and b/comp/lucas-standen-NEA/code2/examples/spaceinvaders differ diff --git a/comp/lucas-standen-NEA/code2/examples/spaceinvaders.zpy b/comp/lucas-standen-NEA/code2/examples/spaceinvaders.zpy index 698999a..5e51ed3 100644 --- a/comp/lucas-standen-NEA/code2/examples/spaceinvaders.zpy +++ b/comp/lucas-standen-NEA/code2/examples/spaceinvaders.zpy @@ -8,6 +8,7 @@ (def exists:bool) (endstruct) +//# this checks if 2 entitys are touching (defun touching bool a:entity* b:entity*) (def r1:Rectangle) (def r2:Rectangle) @@ -24,6 +25,7 @@ (return (CheckCollisionRecs r1 r2)) (endfun) +//# the main loop of the program (defun main int) (InitWindow 800 800 "test test") (SetTargetFPS 60) diff --git a/comp/lucas-standen-NEA/code2/examples/str_example b/comp/lucas-standen-NEA/code2/examples/str_example new file mode 100755 index 0000000..c543ab7 Binary files /dev/null and b/comp/lucas-standen-NEA/code2/examples/str_example differ diff --git a/comp/lucas-standen-NEA/code2/examples/syntaxerr.zpy b/comp/lucas-standen-NEA/code2/examples/syntaxerr.zpy index c74d53b..87494ed 100644 --- a/comp/lucas-standen-NEA/code2/examples/syntaxerr.zpy +++ b/comp/lucas-standen-NEA/code2/examples/syntaxerr.zpy @@ -1,3 +1,5 @@ (defun main int) - (return) + (let x:int) + (set x 10) + (return 10) (endfun) diff --git a/comp/lucas-standen-NEA/code2/examples/tmp.zpy.c b/comp/lucas-standen-NEA/code2/examples/tmp.zpy.c new file mode 100644 index 0000000..2305f24 --- /dev/null +++ b/comp/lucas-standen-NEA/code2/examples/tmp.zpy.c @@ -0,0 +1,2 @@ +#include +int main(){ -- cgit v1.2.3