X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Flisp%2Fao_lisp_eval.c;h=1044aa48a6a3eff6122769dbdb95ea8c138cafcf;hb=00bf2ca86b60e6501880011897cea073865c5a03;hp=844e7ce7d896a3ca3d6f50a3a927a1cafd1724d5;hpb=e1acf5eb12aceda7aa838df031c1da1129d0fa5d;p=fw%2Faltos diff --git a/src/lisp/ao_lisp_eval.c b/src/lisp/ao_lisp_eval.c index 844e7ce7..1044aa48 100644 --- a/src/lisp/ao_lisp_eval.c +++ b/src/lisp/ao_lisp_eval.c @@ -110,6 +110,8 @@ ao_lisp_eval_sexpr(void) /* fall through */ case AO_LISP_BOOL: case AO_LISP_INT: + case AO_LISP_BIGINT: + case AO_LISP_FLOAT: case AO_LISP_STRING: case AO_LISP_BUILTIN: case AO_LISP_LAMBDA: @@ -270,7 +272,7 @@ ao_lisp_eval_exec(void) DBGI("set "); DBG_POLY(atom); DBG(" = "); DBG_POLY(val); DBG("\n"); }); builtin = ao_lisp_poly_builtin(ao_lisp_v); - if (builtin->args & AO_LISP_FUNC_FREE_ARGS && !ao_lisp_stack_marked(ao_lisp_stack) && !ao_lisp_skip_cons_free) + if (builtin && builtin->args & AO_LISP_FUNC_FREE_ARGS && !ao_lisp_stack_marked(ao_lisp_stack) && !ao_lisp_skip_cons_free) ao_lisp_cons_free(ao_lisp_poly_cons(ao_lisp_stack->values)); ao_lisp_v = v; @@ -281,7 +283,7 @@ ao_lisp_eval_exec(void) break; case AO_LISP_LAMBDA: DBGI(".. frame "); DBG_POLY(ao_lisp_frame_poly(ao_lisp_frame_current)); DBG("\n"); - ao_lisp_stack->state = eval_progn; + ao_lisp_stack->state = eval_begin; v = ao_lisp_lambda_eval(); ao_lisp_stack->sexprs = v; ao_lisp_stack->values = AO_LISP_NIL; @@ -386,7 +388,7 @@ ao_lisp_eval_cond_test(void) ao_poly c = car->cdr; if (c) { - ao_lisp_stack->state = eval_progn; + ao_lisp_stack->state = eval_begin; ao_lisp_stack->sexprs = c; } else ao_lisp_stack->state = eval_val; @@ -401,17 +403,17 @@ ao_lisp_eval_cond_test(void) /* * Evaluate a list of sexprs, returning the value from the last one. * - * ao_lisp_progn records the list in stack->sexprs, so we just need to + * ao_lisp_begin records the list in stack->sexprs, so we just need to * walk that list. Set ao_lisp_v to the car of the list and jump to * eval_sexpr. When that's done, it will land in eval_val. For all but - * the last, leave a stack frame with eval_progn set so that we come + * the last, leave a stack frame with eval_begin set so that we come * back here. For the last, don't add a stack frame so that we can * just continue on. */ static int -ao_lisp_eval_progn(void) +ao_lisp_eval_begin(void) { - DBGI("progn: "); DBG_POLY(ao_lisp_v); DBG(" sexprs "); DBG_POLY(ao_lisp_stack->sexprs); DBG("\n"); + DBGI("begin: "); DBG_POLY(ao_lisp_v); DBG(" sexprs "); DBG_POLY(ao_lisp_stack->sexprs); DBG("\n"); DBGI(".. frame "); DBG_POLY(ao_lisp_frame_poly(ao_lisp_frame_current)); DBG("\n"); DBGI(".. saved frame "); DBG_POLY(ao_lisp_stack->frame); DBG("\n"); @@ -426,7 +428,7 @@ ao_lisp_eval_progn(void) * return the value of the last one by just landing in eval_sexpr */ if (ao_lisp_stack->sexprs) { - ao_lisp_stack->state = eval_progn; + ao_lisp_stack->state = eval_begin; if (!ao_lisp_stack_push()) return 0; } @@ -474,7 +476,7 @@ ao_lisp_eval_while_test(void) ao_lisp_stack->state = eval_while; if (!ao_lisp_stack_push()) return 0; - ao_lisp_stack->state = eval_progn; + ao_lisp_stack->state = eval_begin; ao_lisp_stack->sexprs = ao_lisp_v; } else @@ -514,7 +516,7 @@ static int (*const evals[])(void) = { [eval_apply] = ao_lisp_eval_apply, [eval_cond] = ao_lisp_eval_cond, [eval_cond_test] = ao_lisp_eval_cond_test, - [eval_progn] = ao_lisp_eval_progn, + [eval_begin] = ao_lisp_eval_begin, [eval_while] = ao_lisp_eval_while, [eval_while_test] = ao_lisp_eval_while_test, [eval_macro] = ao_lisp_eval_macro, @@ -528,7 +530,7 @@ const char *ao_lisp_state_names[] = { [eval_apply] = "apply", [eval_cond] = "cond", [eval_cond_test] = "cond_test", - [eval_progn] = "progn", + [eval_begin] = "begin", [eval_while] = "while", [eval_while_test] = "while_test", [eval_macro] = "macro",