2 * Copyright © 2016 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
21 #define DBG_FREE_CONS 0
26 #include <ao_lisp_os.h>
31 typedef uint16_t ao_poly;
32 typedef int16_t ao_signed_poly;
36 struct ao_lisp_os_save {
39 uint16_t const_checksum;
40 uint16_t const_checksum_inv;
43 #define AO_LISP_POOL_EXTRA (sizeof(struct ao_lisp_os_save))
44 #define AO_LISP_POOL ((int) (AO_LISP_POOL_TOTAL - AO_LISP_POOL_EXTRA))
47 ao_lisp_os_save(void);
50 ao_lisp_os_restore_save(struct ao_lisp_os_save *save, int offset);
53 ao_lisp_os_restore(void);
57 #ifdef AO_LISP_MAKE_CONST
58 #define AO_LISP_POOL_CONST 16384
59 extern uint8_t ao_lisp_const[AO_LISP_POOL_CONST] __attribute__((aligned(4)));
60 #define ao_lisp_pool ao_lisp_const
61 #define AO_LISP_POOL AO_LISP_POOL_CONST
63 #define _atom(n) ao_lisp_atom_poly(ao_lisp_atom_intern(n))
64 #define _bool(v) ao_lisp_bool_poly(ao_lisp_bool_get(v))
66 #define _ao_lisp_bool_true _bool(1)
67 #define _ao_lisp_bool_false _bool(0)
69 #define _ao_lisp_atom_eof _atom("eof")
70 #define _ao_lisp_atom_else _atom("else")
72 #define AO_LISP_BUILTIN_ATOMS
73 #include "ao_lisp_builtin.h"
76 #include "ao_lisp_const.h"
78 #define AO_LISP_POOL 3072
80 extern uint8_t ao_lisp_pool[AO_LISP_POOL + AO_LISP_POOL_EXTRA] __attribute__((aligned(4)));
84 #define AO_LISP_CONS 0
86 #define AO_LISP_STRING 2
87 #define AO_LISP_OTHER 3
89 #define AO_LISP_TYPE_MASK 0x0003
90 #define AO_LISP_TYPE_SHIFT 2
91 #define AO_LISP_REF_MASK 0x7ffc
92 #define AO_LISP_CONST 0x8000
94 /* These have a type value at the start of the struct */
95 #define AO_LISP_ATOM 4
96 #define AO_LISP_BUILTIN 5
97 #define AO_LISP_FRAME 6
98 #define AO_LISP_FRAME_VALS 7
99 #define AO_LISP_LAMBDA 8
100 #define AO_LISP_STACK 9
101 #define AO_LISP_BOOL 10
102 #define AO_LISP_BIGINT 11
103 #define AO_LISP_FLOAT 12
104 #define AO_LISP_NUM_TYPE 13
106 /* Leave two bits for types to use as they please */
107 #define AO_LISP_OTHER_TYPE_MASK 0x3f
109 #define AO_LISP_NIL 0
111 extern uint16_t ao_lisp_top;
113 #define AO_LISP_OOM 0x01
114 #define AO_LISP_DIVIDE_BY_ZERO 0x02
115 #define AO_LISP_INVALID 0x04
116 #define AO_LISP_UNDEFINED 0x08
117 #define AO_LISP_REDEFINED 0x10
118 #define AO_LISP_EOF 0x20
119 #define AO_LISP_EXIT 0x40
121 extern uint8_t ao_lisp_exception;
124 ao_lisp_is_const(ao_poly poly) {
125 return poly & AO_LISP_CONST;
128 #define AO_LISP_IS_CONST(a) (ao_lisp_const <= ((uint8_t *) (a)) && ((uint8_t *) (a)) < ao_lisp_const + AO_LISP_POOL_CONST)
129 #define AO_LISP_IS_POOL(a) (ao_lisp_pool <= ((uint8_t *) (a)) && ((uint8_t *) (a)) < ao_lisp_pool + AO_LISP_POOL)
130 #define AO_LISP_IS_INT(p) (ao_lisp_poly_base_type(p) == AO_LISP_INT)
133 ao_lisp_ref(ao_poly poly);
136 ao_lisp_poly(const void *addr, ao_poly type);
138 struct ao_lisp_type {
139 int (*size)(void *addr);
140 void (*mark)(void *addr);
141 void (*move)(void *addr);
145 struct ao_lisp_cons {
150 struct ao_lisp_atom {
162 struct ao_lisp_frame_vals {
165 struct ao_lisp_val vals[];
168 struct ao_lisp_frame {
175 struct ao_lisp_bool {
181 struct ao_lisp_bigint {
185 struct ao_lisp_float {
192 #if __BYTE_ORDER == __LITTLE_ENDIAN
193 static inline uint32_t
194 ao_lisp_int_bigint(int32_t i) {
195 return AO_LISP_BIGINT | (i << 8);
197 static inline int32_t
198 ao_lisp_bigint_int(uint32_t bi) {
199 return (int32_t) bi >> 8;
202 static inline uint32_t
203 ao_lisp_int_bigint(int32_t i) {
204 return (uint32_t) (i & 0xffffff) | (AO_LISP_BIGINT << 24);
206 static inlint int32_t
207 ao_lisp_bigint_int(uint32_t bi) {
208 return (int32_t) (bi << 8) >> 8;
212 #define AO_LISP_MIN_INT (-(1 << (15 - AO_LISP_TYPE_SHIFT)))
213 #define AO_LISP_MAX_INT ((1 << (15 - AO_LISP_TYPE_SHIFT)) - 1)
214 #define AO_LISP_MIN_BIGINT (-(1 << 24))
215 #define AO_LISP_MAX_BIGINT ((1 << 24) - 1)
217 #define AO_LISP_NOT_INTEGER 0x7fffffff
219 /* Set on type when the frame escapes the lambda */
220 #define AO_LISP_FRAME_MARK 0x80
221 #define AO_LISP_FRAME_PRINT 0x40
223 static inline int ao_lisp_frame_marked(struct ao_lisp_frame *f) {
224 return f->type & AO_LISP_FRAME_MARK;
227 static inline struct ao_lisp_frame *
228 ao_lisp_poly_frame(ao_poly poly) {
229 return ao_lisp_ref(poly);
232 static inline ao_poly
233 ao_lisp_frame_poly(struct ao_lisp_frame *frame) {
234 return ao_lisp_poly(frame, AO_LISP_OTHER);
237 static inline struct ao_lisp_frame_vals *
238 ao_lisp_poly_frame_vals(ao_poly poly) {
239 return ao_lisp_ref(poly);
242 static inline ao_poly
243 ao_lisp_frame_vals_poly(struct ao_lisp_frame_vals *vals) {
244 return ao_lisp_poly(vals, AO_LISP_OTHER);
248 eval_sexpr, /* Evaluate an sexpr */
249 eval_val, /* Value computed */
250 eval_formal, /* Formal computed */
251 eval_exec, /* Start a lambda evaluation */
252 eval_apply, /* Execute apply */
253 eval_cond, /* Start next cond clause */
254 eval_cond_test, /* Check cond condition */
255 eval_begin, /* Start next begin entry */
256 eval_while, /* Start while condition */
257 eval_while_test, /* Check while condition */
258 eval_macro, /* Finished with macro generation */
261 struct ao_lisp_stack {
262 uint8_t type; /* AO_LISP_STACK */
263 uint8_t state; /* enum eval_state */
264 ao_poly prev; /* previous stack frame */
265 ao_poly sexprs; /* expressions to evaluate */
266 ao_poly values; /* values computed */
267 ao_poly values_tail; /* end of the values list for easy appending */
268 ao_poly frame; /* current lookup frame */
269 ao_poly list; /* most recent function call */
272 #define AO_LISP_STACK_MARK 0x80 /* set on type when a reference has been taken */
273 #define AO_LISP_STACK_PRINT 0x40 /* stack is being printed */
275 static inline int ao_lisp_stack_marked(struct ao_lisp_stack *s) {
276 return s->type & AO_LISP_STACK_MARK;
279 static inline void ao_lisp_stack_mark(struct ao_lisp_stack *s) {
280 s->type |= AO_LISP_STACK_MARK;
283 static inline struct ao_lisp_stack *
284 ao_lisp_poly_stack(ao_poly p)
286 return ao_lisp_ref(p);
289 static inline ao_poly
290 ao_lisp_stack_poly(struct ao_lisp_stack *stack)
292 return ao_lisp_poly(stack, AO_LISP_OTHER);
295 extern ao_poly ao_lisp_v;
297 #define AO_LISP_FUNC_LAMBDA 0
298 #define AO_LISP_FUNC_NLAMBDA 1
299 #define AO_LISP_FUNC_MACRO 2
301 #define AO_LISP_FUNC_FREE_ARGS 0x80
302 #define AO_LISP_FUNC_MASK 0x7f
304 #define AO_LISP_FUNC_F_LAMBDA (AO_LISP_FUNC_FREE_ARGS | AO_LISP_FUNC_LAMBDA)
305 #define AO_LISP_FUNC_F_NLAMBDA (AO_LISP_FUNC_FREE_ARGS | AO_LISP_FUNC_NLAMBDA)
306 #define AO_LISP_FUNC_F_MACRO (AO_LISP_FUNC_FREE_ARGS | AO_LISP_FUNC_MACRO)
308 struct ao_lisp_builtin {
314 #define AO_LISP_BUILTIN_ID
315 #include "ao_lisp_builtin.h"
317 typedef ao_poly (*ao_lisp_func_t)(struct ao_lisp_cons *cons);
319 extern const ao_lisp_func_t ao_lisp_builtins[];
321 static inline ao_lisp_func_t
322 ao_lisp_func(struct ao_lisp_builtin *b)
324 return ao_lisp_builtins[b->func];
327 struct ao_lisp_lambda {
334 static inline struct ao_lisp_lambda *
335 ao_lisp_poly_lambda(ao_poly poly)
337 return ao_lisp_ref(poly);
340 static inline ao_poly
341 ao_lisp_lambda_poly(struct ao_lisp_lambda *lambda)
343 return ao_lisp_poly(lambda, AO_LISP_OTHER);
347 ao_lisp_poly_other(ao_poly poly) {
348 return ao_lisp_ref(poly);
351 static inline uint8_t
352 ao_lisp_other_type(void *other) {
354 if ((*((uint8_t *) other) & AO_LISP_OTHER_TYPE_MASK) >= AO_LISP_NUM_TYPE)
357 return *((uint8_t *) other) & AO_LISP_OTHER_TYPE_MASK;
360 static inline ao_poly
361 ao_lisp_other_poly(const void *other)
363 return ao_lisp_poly(other, AO_LISP_OTHER);
367 ao_lisp_size_round(int size)
369 return (size + 3) & ~3;
373 ao_lisp_size(const struct ao_lisp_type *type, void *addr)
375 return ao_lisp_size_round(type->size(addr));
378 #define AO_LISP_OTHER_POLY(other) ((ao_poly)(other) + AO_LISP_OTHER)
380 static inline int ao_lisp_poly_base_type(ao_poly poly) {
381 return poly & AO_LISP_TYPE_MASK;
384 static inline int ao_lisp_poly_type(ao_poly poly) {
385 int type = poly & AO_LISP_TYPE_MASK;
386 if (type == AO_LISP_OTHER)
387 return ao_lisp_other_type(ao_lisp_poly_other(poly));
392 ao_lisp_is_cons(ao_poly poly) {
393 return (ao_lisp_poly_base_type(poly) == AO_LISP_CONS);
397 ao_lisp_is_pair(ao_poly poly) {
398 return poly != AO_LISP_NIL && (ao_lisp_poly_base_type(poly) == AO_LISP_CONS);
401 static inline struct ao_lisp_cons *
402 ao_lisp_poly_cons(ao_poly poly)
404 return ao_lisp_ref(poly);
407 static inline ao_poly
408 ao_lisp_cons_poly(struct ao_lisp_cons *cons)
410 return ao_lisp_poly(cons, AO_LISP_CONS);
413 static inline int32_t
414 ao_lisp_poly_int(ao_poly poly)
416 return (int32_t) ((ao_signed_poly) poly >> AO_LISP_TYPE_SHIFT);
419 static inline ao_poly
420 ao_lisp_int_poly(int32_t i)
422 return ((ao_poly) i << 2) | AO_LISP_INT;
425 static inline struct ao_lisp_bigint *
426 ao_lisp_poly_bigint(ao_poly poly)
428 return ao_lisp_ref(poly);
431 static inline ao_poly
432 ao_lisp_bigint_poly(struct ao_lisp_bigint *bi)
434 return ao_lisp_poly(bi, AO_LISP_OTHER);
438 ao_lisp_poly_string(ao_poly poly)
440 return ao_lisp_ref(poly);
443 static inline ao_poly
444 ao_lisp_string_poly(char *s)
446 return ao_lisp_poly(s, AO_LISP_STRING);
449 static inline struct ao_lisp_atom *
450 ao_lisp_poly_atom(ao_poly poly)
452 return ao_lisp_ref(poly);
455 static inline ao_poly
456 ao_lisp_atom_poly(struct ao_lisp_atom *a)
458 return ao_lisp_poly(a, AO_LISP_OTHER);
461 static inline struct ao_lisp_builtin *
462 ao_lisp_poly_builtin(ao_poly poly)
464 return ao_lisp_ref(poly);
467 static inline ao_poly
468 ao_lisp_builtin_poly(struct ao_lisp_builtin *b)
470 return ao_lisp_poly(b, AO_LISP_OTHER);
473 static inline ao_poly
474 ao_lisp_bool_poly(struct ao_lisp_bool *b)
476 return ao_lisp_poly(b, AO_LISP_OTHER);
479 static inline struct ao_lisp_bool *
480 ao_lisp_poly_bool(ao_poly poly)
482 return ao_lisp_ref(poly);
485 static inline ao_poly
486 ao_lisp_float_poly(struct ao_lisp_float *f)
488 return ao_lisp_poly(f, AO_LISP_OTHER);
491 static inline struct ao_lisp_float *
492 ao_lisp_poly_float(ao_poly poly)
494 return ao_lisp_ref(poly);
498 ao_lisp_poly_number(ao_poly p);
500 /* memory functions */
502 extern int ao_lisp_collects[2];
503 extern int ao_lisp_freed[2];
504 extern int ao_lisp_loops[2];
506 /* returns 1 if the object was already marked */
508 ao_lisp_mark(const struct ao_lisp_type *type, void *addr);
510 /* returns 1 if the object was already marked */
512 ao_lisp_mark_memory(const struct ao_lisp_type *type, void *addr);
515 ao_lisp_move_map(void *addr);
517 /* returns 1 if the object was already moved */
519 ao_lisp_move(const struct ao_lisp_type *type, void **ref);
521 /* returns 1 if the object was already moved */
523 ao_lisp_move_memory(const struct ao_lisp_type *type, void **ref);
526 ao_lisp_alloc(int size);
528 #define AO_LISP_COLLECT_FULL 1
529 #define AO_LISP_COLLECT_INCREMENTAL 0
532 ao_lisp_collect(uint8_t style);
536 ao_lisp_cons_check(struct ao_lisp_cons *cons);
540 ao_lisp_cons_stash(int id, struct ao_lisp_cons *cons);
542 struct ao_lisp_cons *
543 ao_lisp_cons_fetch(int id);
546 ao_lisp_poly_stash(int id, ao_poly poly);
549 ao_lisp_poly_fetch(int id);
552 ao_lisp_string_stash(int id, char *string);
555 ao_lisp_string_fetch(int id);
558 ao_lisp_stack_stash(int id, struct ao_lisp_stack *stack) {
559 ao_lisp_poly_stash(id, ao_lisp_stack_poly(stack));
562 static inline struct ao_lisp_stack *
563 ao_lisp_stack_fetch(int id) {
564 return ao_lisp_poly_stack(ao_lisp_poly_fetch(id));
568 ao_lisp_frame_stash(int id, struct ao_lisp_frame *frame);
570 struct ao_lisp_frame *
571 ao_lisp_frame_fetch(int id);
575 extern const struct ao_lisp_type ao_lisp_bool_type;
578 ao_lisp_bool_write(ao_poly v);
580 #ifdef AO_LISP_MAKE_CONST
581 struct ao_lisp_bool *ao_lisp_true, *ao_lisp_false;
583 struct ao_lisp_bool *
584 ao_lisp_bool_get(uint8_t value);
588 extern const struct ao_lisp_type ao_lisp_cons_type;
590 struct ao_lisp_cons *
591 ao_lisp_cons_cons(ao_poly car, ao_poly cdr);
593 /* Return a cons or NULL for a proper list, else error */
594 struct ao_lisp_cons *
595 ao_lisp_cons_cdr(struct ao_lisp_cons *cons);
598 ao_lisp__cons(ao_poly car, ao_poly cdr);
600 extern struct ao_lisp_cons *ao_lisp_cons_free_list;
603 ao_lisp_cons_free(struct ao_lisp_cons *cons);
606 ao_lisp_cons_write(ao_poly);
609 ao_lisp_cons_display(ao_poly);
612 ao_lisp_cons_length(struct ao_lisp_cons *cons);
615 extern const struct ao_lisp_type ao_lisp_string_type;
618 ao_lisp_string_copy(char *a);
621 ao_lisp_string_cat(char *a, char *b);
624 ao_lisp_string_pack(struct ao_lisp_cons *cons);
627 ao_lisp_string_unpack(char *a);
630 ao_lisp_string_write(ao_poly s);
633 ao_lisp_string_display(ao_poly s);
636 extern const struct ao_lisp_type ao_lisp_atom_type;
638 extern struct ao_lisp_atom *ao_lisp_atoms;
639 extern struct ao_lisp_frame *ao_lisp_frame_global;
640 extern struct ao_lisp_frame *ao_lisp_frame_current;
643 ao_lisp_atom_write(ao_poly a);
645 struct ao_lisp_atom *
646 ao_lisp_atom_intern(char *name);
649 ao_lisp_atom_ref(ao_poly atom);
652 ao_lisp_atom_get(ao_poly atom);
655 ao_lisp_atom_set(ao_poly atom, ao_poly val);
658 ao_lisp_atom_def(ao_poly atom, ao_poly val);
662 ao_lisp_int_write(ao_poly i);
665 ao_lisp_poly_integer(ao_poly p);
668 ao_lisp_integer_poly(int32_t i);
671 ao_lisp_integer_typep(uint8_t t)
673 return (t == AO_LISP_INT) || (t == AO_LISP_BIGINT);
677 ao_lisp_bigint_write(ao_poly i);
679 extern const struct ao_lisp_type ao_lisp_bigint_type;
682 ao_lisp_poly_write(ao_poly p);
685 ao_lisp_poly_display(ao_poly p);
688 ao_lisp_poly_mark(ao_poly p, uint8_t note_cons);
690 /* returns 1 if the object has already been moved */
692 ao_lisp_poly_move(ao_poly *p, uint8_t note_cons);
697 ao_lisp_eval_clear_globals(void);
700 ao_lisp_eval_restart(void);
703 ao_lisp_eval(ao_poly p);
706 ao_lisp_set_cond(struct ao_lisp_cons *cons);
709 extern const struct ao_lisp_type ao_lisp_float_type;
712 ao_lisp_float_write(ao_poly p);
715 ao_lisp_float_get(float value);
717 static inline uint8_t
718 ao_lisp_number_typep(uint8_t t)
720 return ao_lisp_integer_typep(t) || (t == AO_LISP_FLOAT);
724 ao_lisp_poly_number(ao_poly p);
728 ao_lisp_builtin_write(ao_poly b);
730 extern const struct ao_lisp_type ao_lisp_builtin_type;
732 /* Check argument count */
734 ao_lisp_check_argc(ao_poly name, struct ao_lisp_cons *cons, int min, int max);
736 /* Check argument type */
738 ao_lisp_check_argt(ao_poly name, struct ao_lisp_cons *cons, int argc, int type, int nil_ok);
740 /* Fetch an arg (nil if off the end) */
742 ao_lisp_arg(struct ao_lisp_cons *cons, int argc);
745 ao_lisp_args_name(uint8_t args);
748 extern struct ao_lisp_cons *ao_lisp_read_cons;
749 extern struct ao_lisp_cons *ao_lisp_read_cons_tail;
750 extern struct ao_lisp_cons *ao_lisp_read_stack;
757 ao_lisp_read_eval_print(void);
760 extern const struct ao_lisp_type ao_lisp_frame_type;
761 extern const struct ao_lisp_type ao_lisp_frame_vals_type;
763 #define AO_LISP_FRAME_FREE 6
765 extern struct ao_lisp_frame *ao_lisp_frame_free_list[AO_LISP_FRAME_FREE];
768 ao_lisp_frame_mark(struct ao_lisp_frame *frame);
771 ao_lisp_frame_ref(struct ao_lisp_frame *frame, ao_poly atom);
773 struct ao_lisp_frame *
774 ao_lisp_frame_new(int num);
777 ao_lisp_frame_free(struct ao_lisp_frame *frame);
780 ao_lisp_frame_bind(struct ao_lisp_frame *frame, int num, ao_poly atom, ao_poly val);
783 ao_lisp_frame_add(struct ao_lisp_frame *frame, ao_poly atom, ao_poly val);
786 ao_lisp_frame_write(ao_poly p);
789 ao_lisp_frame_init(void);
792 extern const struct ao_lisp_type ao_lisp_lambda_type;
794 extern const char *ao_lisp_state_names[];
796 struct ao_lisp_lambda *
797 ao_lisp_lambda_new(ao_poly cons);
800 ao_lisp_lambda_write(ao_poly lambda);
803 ao_lisp_lambda_eval(void);
807 extern const struct ao_lisp_type ao_lisp_stack_type;
808 extern struct ao_lisp_stack *ao_lisp_stack;
809 extern struct ao_lisp_stack *ao_lisp_stack_free_list;
812 ao_lisp_stack_reset(struct ao_lisp_stack *stack);
815 ao_lisp_stack_push(void);
818 ao_lisp_stack_pop(void);
821 ao_lisp_stack_clear(void);
824 ao_lisp_stack_write(ao_poly stack);
827 ao_lisp_stack_eval(void);
832 ao_lisp_vprintf(char *format, va_list args);
835 ao_lisp_printf(char *format, ...);
838 ao_lisp_error_poly(char *name, ao_poly poly, ao_poly last);
841 ao_lisp_error_frame(int indent, char *name, struct ao_lisp_frame *frame);
844 ao_lisp_error(int error, char *format, ...);
848 #define AO_LISP_BUILTIN_DECLS
849 #include "ao_lisp_builtin.h"
851 /* debugging macros */
853 #if DBG_EVAL || DBG_READ || DBG_MEM
855 int ao_lisp_stack_depth;
857 #define DBG_INDENT() do { int _s; for(_s = 0; _s < ao_lisp_stack_depth; _s++) printf(" "); } while(0)
858 #define DBG_IN() (++ao_lisp_stack_depth)
859 #define DBG_OUT() (--ao_lisp_stack_depth)
860 #define DBG_RESET() (ao_lisp_stack_depth = 0)
861 #define DBG(...) ao_lisp_printf(__VA_ARGS__)
862 #define DBGI(...) do { printf("%4d: ", __LINE__); DBG_INDENT(); DBG(__VA_ARGS__); } while (0)
863 #define DBG_CONS(a) ao_lisp_cons_write(ao_lisp_cons_poly(a))
864 #define DBG_POLY(a) ao_lisp_poly_write(a)
865 #define OFFSET(a) ((a) ? (int) ((uint8_t *) a - ao_lisp_pool) : -1)
866 #define DBG_STACK() ao_lisp_stack_write(ao_lisp_stack_poly(ao_lisp_stack))
868 ao_lisp_frames_dump(void)
870 struct ao_lisp_stack *s;
871 DBGI(".. current frame: "); DBG_POLY(ao_lisp_frame_poly(ao_lisp_frame_current)); DBG("\n");
872 for (s = ao_lisp_stack; s; s = ao_lisp_poly_stack(s->prev)) {
873 DBGI(".. stack frame: "); DBG_POLY(s->frame); DBG("\n");
876 #define DBG_FRAMES() ao_lisp_frames_dump()
892 #define RDBGI(...) DBGI(__VA_ARGS__)
893 #define RDBG_IN() DBG_IN()
894 #define RDBG_OUT() DBG_OUT()
901 #define DBG_MEM_START 1
906 extern int dbg_move_depth;
908 #define MDBG_OFFSET(a) ((a) ? (int) ((uint8_t *) (a) - ao_lisp_pool) : -1)
912 #define MDBG_DO(a) DBG_DO(a)
913 #define MDBG_MOVE(...) do { if (dbg_mem) { int d; for (d = 0; d < dbg_move_depth; d++) printf (" "); printf(__VA_ARGS__); } } while (0)
914 #define MDBG_MORE(...) do { if (dbg_mem) printf(__VA_ARGS__); } while (0)
915 #define MDBG_MOVE_IN() (dbg_move_depth++)
916 #define MDBG_MOVE_OUT() (assert(--dbg_move_depth >= 0))
921 #define MDBG_MOVE(...)
922 #define MDBG_MORE(...)
923 #define MDBG_MOVE_IN()
924 #define MDBG_MOVE_OUT()
928 #endif /* _AO_LISP_H_ */