X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=src%2Fmain.c;h=6c6124eb5bfacf2530675665342404db8f342819;hb=6c1eef40f411ff4eec7a3f7599a81be7fae07e2a;hp=b57ee6d06bf2ad4b3dcd6ae99d1888e1e0d27c05;hpb=8d55156675587a770c5654362bcbd3d2a98e4aa9;p=muddle-interpreter.git diff --git a/src/main.c b/src/main.c index b57ee6d..6c6124e 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,5 @@ /* -Copyright (C) 2017 Keziah Wesley +Copyright (C) 2017-2018 Keziah Wesley You can redistribute and/or modify this file under the terms of the GNU Affero General Public License as published by the Free Software @@ -26,7 +26,8 @@ License along with this file. If not, see #include // TODO: put these in interpreter-wide ctx object -char *pool; +pool_object *pool; +pool_ptr ptop; char *vhp_base; char *vhp; @@ -53,10 +54,10 @@ int main () { // The REST pool (in low mem). - char *pool_base = + pool = mmap (0, POOL_OBJCT * sizeof (object), PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0); - pool = pool_base; + ptop = 1; // 0 is null // The CONTROL STACKs (TODO: per-PROCESS). object *cst_base = @@ -83,7 +84,7 @@ main () while ((n = read (STDIN_FILENO, buf, sizeof (buf))) > 0) { // mock GC (no object persistence) - pool = pool_base; + ptop = 1; vhp = vhp_base; // terminate input assert (buf[n - 1] == '\n'); @@ -99,10 +100,10 @@ main () } assert (p); if (!st.framelen) - continue; + continue; assert (st.framelen == 1); - /* // Eval the thing + cf->prevcst = cst; push_frame (eval, new_tuple (st.pos, 1), 0); while (cf->cont.fn) { @@ -110,15 +111,12 @@ main () } // Print the thing print_object (&ret); - */ - // debugging: print without eval - print_object (st.pos); printf ("\n"); // Loop! } munmap (cst_base, STACK_OBJCT * sizeof (object)); munmap (vhp_base, VECTOR_OBJCT * sizeof (object)); - munmap (pool_base, POOL_OBJCT * sizeof (object)); + munmap (pool, POOL_OBJCT * sizeof (object)); return 0; }