X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=src%2Fmain.c;h=5ecbcd8352344a389080641efa68a3063ec79775;hb=refs%2Fheads%2Fmaster;hp=c9876ce2c0a6067ad2f3eb6738eab1cffcecf016;hpb=081a7c4eedd6e6aa9da616ed88c82ab85efdb98f;p=muddle-interpreter.git diff --git a/src/main.c b/src/main.c index c9876ce..5ecbcd8 100644 --- a/src/main.c +++ b/src/main.c @@ -16,6 +16,7 @@ License along with this file. If not, see . */ +#include "atom.h" #include "read.h" #include "eval.h" #include "print.h" @@ -31,6 +32,7 @@ pool_object *pool; pool_ptr ptop; object *vhp_base; heap_ptr vhp; +vector_object globals; // oblists (move to ASOCs once implemented) uvector_object root; @@ -54,6 +56,8 @@ enum READER_OBJCT = 64 }; +void init_standard_env (); + int main () { @@ -85,12 +89,14 @@ main () // Entire toplevel becomes `for (;;) cf->cont.fn();` char buf[512]; ssize_t n; + // no GC (leak everything) + ptop = 1; + vhp = 1; + root = oblist_create (13); + globals = vector_create (64); + init_standard_env (); while ((n = read (STDIN_FILENO, buf, sizeof (buf))) > 0) { - // mock GC (no object persistence) - ptop = 1; - vhp = 1; - root = oblist_create (13); // terminate input assert (buf[n - 1] == '\n'); buf[n - 1] = '\0';