#else
#include "ao_lisp_const.h"
#ifndef AO_LISP_POOL
-#define AO_LISP_POOL 1024
+#define AO_LISP_POOL 16384
#endif
extern uint8_t ao_lisp_pool[AO_LISP_POOL];
#endif
static inline void *
ao_lisp_ref(ao_poly poly) {
+ if (poly == 0xBEEF)
+ abort();
if (poly == AO_LISP_NIL)
return NULL;
if (poly & AO_LISP_CONST)
};
struct ao_lisp_frame {
+ uint8_t type;
uint8_t num;
- uint8_t readonly;
ao_poly next;
struct ao_lisp_val vals[];
};
builtin_times,
builtin_divide,
builtin_mod,
+ builtin_equal,
+ builtin_less,
+ builtin_greater,
+ builtin_less_equal,
+ builtin_greater_equal,
builtin_last
};
}
/* memory functions */
-void
+/* returns 1 if the object was already marked */
+int
ao_lisp_mark(const struct ao_lisp_type *type, void *addr);
/* returns 1 if the object was already marked */
void *
ao_lisp_move_map(void *addr);
-void *
-ao_lisp_move(const struct ao_lisp_type *type, void *addr);
+/* returns 1 if the object was already moved */
+int
+ao_lisp_move(const struct ao_lisp_type *type, void **ref);
-/* returns NULL if the object was already moved */
-void *
-ao_lisp_move_memory(void *addr, int size);
+/* returns 1 if the object was already moved */
+int
+ao_lisp_move_memory(void **ref, int size);
void *
ao_lisp_alloc(int size);
int
ao_lisp_root_add(const struct ao_lisp_type *type, void *addr);
+int
+ao_lisp_root_poly_add(ao_poly *p);
+
void
ao_lisp_root_clear(void *addr);
ao_poly
ao_lisp_poly_print(ao_poly p);
-void
+int
ao_lisp_poly_mark(ao_poly p);
-ao_poly
-ao_lisp_poly_move(ao_poly p);
+/* returns 1 if the object has already been moved */
+int
+ao_lisp_poly_move(ao_poly *p);
/* eval */
+
ao_poly
ao_lisp_eval(ao_poly p);
ao_lisp_frame_ref(struct ao_lisp_frame *frame, ao_poly atom);
struct ao_lisp_frame *
-ao_lisp_frame_new(int num, int readonly);
+ao_lisp_frame_new(int num);
struct ao_lisp_frame *
ao_lisp_frame_add(struct ao_lisp_frame *frame, ao_poly atom, ao_poly val);