-static void
-ao_lisp_stack_reset(struct ao_lisp_stack *stack)
-{
- stack->state = eval_sexpr;
- stack->sexprs = AO_LISP_NIL;
- stack->values = AO_LISP_NIL;
- stack->values_tail = AO_LISP_NIL;
-}
-
-
-static int
-ao_lisp_stack_push(void)
-{
- struct ao_lisp_stack *stack;
- if (ao_lisp_stack_free_list) {
- stack = ao_lisp_stack_free_list;
- ao_lisp_stack_free_list = ao_lisp_poly_stack(stack->prev);
- } else {
- stack = ao_lisp_alloc(sizeof (struct ao_lisp_stack));
- if (!stack)
- return 0;
- }
- stack->prev = ao_lisp_stack_poly(ao_lisp_stack);
- stack->frame = ao_lisp_frame_poly(ao_lisp_frame_current);
- stack->list = AO_LISP_NIL;
- ao_lisp_stack = stack;
- ao_lisp_stack_reset(stack);
- DBGI("stack push\n");
- DBG_FRAMES();
- DBG_IN();
- return 1;
-}
-
-static void
-ao_lisp_stack_pop(void)
-{
- ao_poly prev;
- struct ao_lisp_frame *prev_frame;
-
- if (!ao_lisp_stack)
- return;
- prev = ao_lisp_stack->prev;
- ao_lisp_stack->prev = ao_lisp_stack_poly(ao_lisp_stack_free_list);
- ao_lisp_stack_free_list = ao_lisp_stack;
-
- ao_lisp_stack = ao_lisp_poly_stack(prev);
- prev_frame = ao_lisp_frame_current;
- if (ao_lisp_stack)
- ao_lisp_frame_current = ao_lisp_poly_frame(ao_lisp_stack->frame);
- else
- ao_lisp_frame_current = NULL;
- if (ao_lisp_frame_current != prev_frame)
- ao_lisp_frame_free(prev_frame);
- DBG_OUT();
- DBGI("stack pop\n");
- DBG_FRAMES();
-}
-
-static void
-ao_lisp_stack_clear(void)
-{
- ao_lisp_stack = NULL;
- ao_lisp_frame_current = NULL;
- ao_lisp_v = AO_LISP_NIL;
-}
-