From 85aa2ad424c68343ef09e5f6df243ad6499e47d5 Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Wed, 12 Jan 2022 00:09:12 +0000 Subject: =?UTF-8?q?Add=20a=20small=20version=20of=20monadic=20=E2=8D=B3=20?= =?UTF-8?q?and=20some=20simple=20form=20of=20=E2=8E=95IO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- symbol.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'symbol.c') diff --git a/symbol.c b/symbol.c index a9d1d1f..6cdbffe 100644 --- a/symbol.c +++ b/symbol.c @@ -5,6 +5,7 @@ #include "apl9.h" Symtab *globalsymtab; +Symtab *currentsymtab; Symbol * getsym(Symtab *tab, Rune *name) @@ -27,5 +28,18 @@ newsymtab(void) Symtab *tab = malloc(sizeof(Symtab)); tab->nsyms = 0; tab->syms = nil; + + Symbol *io = getsym(tab, L"⎕IO"); + io->value.tag = ArrayTag; + io->value.array = mkscalarint(1); + io->undefined = 0; + return tab; +} + +vlong +globalIO(void) +{ + Symbol *s = getsym(currentsymtab, L"⎕IO"); + return s->value.array->intdata[0]; } \ No newline at end of file -- cgit v1.2.3