summaryrefslogtreecommitdiff
path: root/symbol.c
diff options
context:
space:
mode:
authorPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-12 00:09:12 +0000
committerPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-12 00:09:12 +0000
commit85aa2ad424c68343ef09e5f6df243ad6499e47d5 (patch)
tree8712baf633e82ffdba79b3a59b17734de0eaf4d7 /symbol.c
parent2ff4b85fc73f0cf82034e2a19ea8c5d677812c9c (diff)
Add a small version of monadic ⍳ and some simple form of ⎕IO
Diffstat (limited to 'symbol.c')
-rw-r--r--symbol.c14
1 files changed, 14 insertions, 0 deletions
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