((add ,a ,b)
(let* ((empty (clone info #:text '()))
- (accu ((expr->base empty) a))
+ (accu ((expr->accu empty) a))
(base ((expr->base empty) b)))
(clone info #:text
(append text
((sub ,a ,b)
(let* ((empty (clone info #:text '()))
- (accu ((expr->base empty) a))
+ (accu ((expr->accu empty) a))
(base ((expr->base empty) b)))
(clone info #:text
(append text
((lshift ,a (p-expr (fixed ,value)))
(let* ((empty (clone info #:text '()))
- (accu ((expr->base empty) a))
+ (accu ((expr->accu empty) a))
(value (cstring->number value)))
(clone info #:text
(append text
}
#endif
-#if 1
- //FIXME GNUC
SCM
push_cc (SCM p1, SCM p2, SCM a, SCM c) ///((internal))
{
r3 = x;
return cell_unspecified;
}
-#endif
#if __GNUC__
SCM caar (SCM x) {return car (car (x));}
SCM
eval_apply ()
{
- puts ("e/a: fixme\n");
eval_apply:
- puts ("eval_apply\n");
// if (g_free + GC_SAFETY > ARENA_SIZE)
// gc_pop_frame (gc (gc_push_frame ()));
SCM y = cell_nil;
apply:
- puts ("apply\n");
switch (TYPE (car (r1)))
{
case TFUNCTION: {
puts ("apply.function\n");
- y = 0x22;
//check_formals (car (r1), MAKE_NUMBER (FUNCTION (car (r1)).arity), cdr (r1));
-#if __GNUC__
- r1 = call (car (r1), cdr (r1)); /// FIXME: move into eval_apply
-#else
- //FIXME
- x = car (r1);
- y = cdr (r1);
- r1 = call (x, y);
-#endif
- puts ("after call\n");
- y = 0x44;
+ r1 = call (car (r1), cdr (r1));
goto vm_return;
}
}
-// #if __GNUC__
-// //FIXME
-// push_cc (car (r1), r1, r0, cell_vm_apply2);
-// #endif
-// goto eval;
-// apply2:
-// //check_apply (r1, car (r2));
-// r1 = cons (r1, cdr (r2));
-// goto apply;
-
- eval:
- begin:
- begin2:
vm_return:
- // FIXME
- puts ("vm-return00\n");
x = r1;
gc_pop_frame ();
- puts ("vm-return01\n");
r1 = x;
goto eval_apply;
}
puts ("read done\n");
- g_free = (p-(char*)g_cells) / sizeof (struct scm);
+ // g_free = (p-(char*)g_cells) / sizeof (struct scm);
+ c = p-(char*)g_cells;
+ exit (c);
+
+
+
+
+ if (g_free != 15) exit (33);
+
+ // puts ("Xg_free: ");
+ // puts (itoa (g_free));
+ // puts ("\n");
+
+
+ ///if (g_free != 19) return 33;
+
// gc_peek_frame ();
// g_symbols = r1;
g_symbols = 1;
if (argc > 1 && !strcmp (argv[1], "--dump")) return dump ();
#endif
-#if 0
- //__GNUC__
+#if 1
+
+#if __GNUC__
+ puts ("g_free=");
+ puts (itoa(g_free));
+ puts ("\n");
+#else
+ g_free = 19;
+
+#endif
+
+ //return cons (r0, cell_nil);
+
//FIXME
push_cc (r2, cell_unspecified, r0, cell_unspecified);
+#if __GNUC__
for (int x=19; x<26 ;x++)
{
puts(itoa(x));
puts(itoa(g_cells[x].cdr));
puts("\n");
}
+#endif
#else
-
g_stack = 23;
g_free = 24;
r1 = r2; //10: the-program
r2 = cell_unspecified;
#endif
-#if __GNUC__
+ puts ("g_stack: ");
display_ (g_stack);
+ puts ("\n");
+
+#if __GNUC__
puts ("g_free=");
puts (itoa(g_free));
*x++ = c;
if (*g_chars != 'C') return 1;
+ puts ("t: 1 + 2\n");
+ if (1 + 2 != 3) return 1;
+
+ puts ("t: 2 - 1\n");
+ if (2 - 1 != 1) return 1;
+
+ puts ("t: 1 << 3\n");
+ if (1 << 3 != 8) return 1;
+
+ puts ("t: 8 / 4\n");
+ if (8 / 4 != 2) return 1;
+
puts ("t: inc (0)\n");
if (inc (0) != 1) return 1;