From 57207920c891676bf88b6d7d52f623cbe337b5a5 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 8 Apr 2024 15:47:58 -0700 Subject: [PATCH] Added time to debug build --- examples/hello.modal | 8 ++++---- examples/test.modal | 6 ++---- makefile | 18 ++++++++++-------- src/modal.c | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/hello.modal b/examples/hello.modal index 2b3e220..fef5e5c 100644 --- a/examples/hello.modal +++ b/examples/hello.modal @@ -1,5 +1,5 @@ -<> (?x dup) (?x ?x) -<> (?x ?y swap) (?y ?x) -<> ( ?x pop) () +<> (greeting) (Melcome to) +<> (name) (Modal --) +<> (?: ?: -- print) () -(1 2 3) (4 5 6) swap pop dup +greeting name print \ No newline at end of file diff --git a/examples/test.modal b/examples/test.modal index bf84ae8..20476c8 100644 --- a/examples/test.modal +++ b/examples/test.modal @@ -12,8 +12,6 @@ <> (?x dup) (?x ?x) <> (?x ?y swap) (?y ?x) <> (?x pop) () +<> (print ?:) () -(implode reverse (explode hello)) (read) (explode hello) empty-register (eq abc abc) (eq abc def) (1 2 3) (4 5 6) swap pop dup (hey 1234 pop) - - - +(implode reverse (explode hello)) (read) (explode hello) empty-register (eq abc abc) (eq abc def) (1 2 3) (4 5 6) swap pop dup (hey 1234 pop) (print Done.) \ No newline at end of file diff --git a/makefile b/makefile index cd47e71..3ed5315 100644 --- a/makefile +++ b/makefile @@ -3,16 +3,16 @@ DEBUG_flags=-std=c89 -D_POSIX_C_SOURCE=199309L -DDEBUG -Wall -Wno-unknown-pragma .PHONY: all debug dest run test install uninstall format clean archive -all: dest bin/modal +all: dest dest: @ mkdir -p bin -run: all - @ bin/modal examples/test.modal "(arg1) (arg2 (arg3))" -test: all - @ bin/modal -v - @ bin/modal examples/test.modal 2> /dev/null -install: all +run: bin/modal + @ bin/modal examples/hello.modal 2> /dev/null +test: bin/modal-debug + @ bin/modal -v + @ time bin/modal examples/test.modal "(arg1) (arg2 (arg3))" +install: bin/modal cp bin/modal ~/bin/ uninstall: rm -f ~/bin/modal @@ -23,6 +23,8 @@ clean: archive: all cp src/modal.c ../oscean/etc/modal.c.txt +bin/modal-debug: src/modal.c + @ cc ${DEBUG_flags} src/modal.c -o bin/modal-debug bin/modal: src/modal.c - @ cc ${DEBUG_flags} ${CFLAGS} src/modal.c -o bin/modal + @ cc ${RELEASE_flags} src/modal.c -o bin/modal-debug diff --git a/src/modal.c b/src/modal.c index f17dc9a..88ead4e 100644 --- a/src/modal.c +++ b/src/modal.c @@ -194,7 +194,7 @@ main(int argc, char **argv) if(argc < 2) return !printf("usage: modal [-v] source.modal\n"); if(argc < 3 && argv[1][0] == '-' && argv[1][1] == 'v') - return !printf("Modal - Modal Interpreter, 8 Apr 2024.\n"); + return !printf("Modal Interpreter, 8 Apr 2024.\n"); if(!(f = fopen(argv[1], "r"))) return !printf("Invalid Modal file: %s.\n", argv[1]); while(fread(&c, 1, 1, f)) {