From 452b5026be9bd571350ed853699f4d9192744db4 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 9 Apr 2024 10:29:33 -0700 Subject: [PATCH] Started new stdin UX --- examples/test.modal | 2 +- makefile | 1 - src/modal.c | 6 +++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/test.modal b/examples/test.modal index 6e1a3b9..ce61fe4 100644 --- a/examples/test.modal +++ b/examples/test.modal @@ -11,6 +11,6 @@ <> (?x dup) (?x ?x) <> (?x ?y swap) (?y ?x) <> (?x pop) () -<> (print ?:) (?:) +<> (print ?:) () (implode reverse (explode hello)) (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 090551a..297bc15 100644 --- a/makefile +++ b/makefile @@ -9,7 +9,6 @@ dest: @ mkdir -p bin run: all bin/modal @ bin/modal examples/hello.modal 2> /dev/null - @ bin/modal examples/test.modal test: bin/modal-debug bin/modal @ bin/modal -v @ bin/modal-debug examples/test.modal "(arg1) (arg2 (arg3))" diff --git a/src/modal.c b/src/modal.c index 86c5f00..fe2d120 100644 --- a/src/modal.c +++ b/src/modal.c @@ -73,7 +73,11 @@ put_reg(char r) char *s = regs[(int)r]; if(r == '*') s = plode(s); - else if(s) { + else if(r == '~') { + char buf; + while(fread(&buf, 1, 1, stdin) && buf >= ' ') + *outp_++ = buf; + } else if(s) { char *ss = walk(s); if(r == ':') { if(*s == '(') s++, --ss;