altos/lisp: Finish first pass through r7rs
[fw/altos] / src / lisp / ao_lisp_save.c
index e6e8b65e151ae28ba8bc211bc7ae4b4abb6ce668..c990e9c66c2271a90ced480c8b543a9bfa904b26 100644 (file)
 #include <ao_lisp.h>
 
 ao_poly
-ao_lisp_save(struct ao_lisp_cons *cons)
+ao_lisp_do_save(struct ao_lisp_cons *cons)
 {
        if (!ao_lisp_check_argc(_ao_lisp_atom_save, cons, 0, 0))
                return AO_LISP_NIL;
 
 #ifdef AO_LISP_SAVE
-       struct ao_lisp_os_save *os = (struct ao_lisp_os_save *) &ao_lisp_pool[AO_LISP_POOL];
+       struct ao_lisp_os_save *os = (struct ao_lisp_os_save *) (void *) &ao_lisp_pool[AO_LISP_POOL];
 
        ao_lisp_collect(AO_LISP_COLLECT_FULL);
        os->atoms = ao_lisp_atom_poly(ao_lisp_atoms);
@@ -30,20 +30,20 @@ ao_lisp_save(struct ao_lisp_cons *cons)
        os->const_checksum_inv = (uint16_t) ~ao_lisp_const_checksum;
 
        if (ao_lisp_os_save())
-               return _ao_lisp_atom_t;
+               return _ao_lisp_bool_true;
 #endif
-       return AO_LISP_NIL;
+       return _ao_lisp_bool_false;
 }
 
 ao_poly
-ao_lisp_restore(struct ao_lisp_cons *cons)
+ao_lisp_do_restore(struct ao_lisp_cons *cons)
 {
        if (!ao_lisp_check_argc(_ao_lisp_atom_save, cons, 0, 0))
                return AO_LISP_NIL;
 
 #ifdef AO_LISP_SAVE
        struct ao_lisp_os_save save;
-       struct ao_lisp_os_save *os = (struct ao_lisp_os_save *) &ao_lisp_pool[AO_LISP_POOL];
+       struct ao_lisp_os_save *os = (struct ao_lisp_os_save *) (void *) &ao_lisp_pool[AO_LISP_POOL];
 
        if (!ao_lisp_os_restore_save(&save, AO_LISP_POOL))
                return ao_lisp_error(AO_LISP_INVALID, "header restore failed");
@@ -68,9 +68,10 @@ ao_lisp_restore(struct ao_lisp_cons *cons)
 
                /* Re-create the evaluator stack */
                if (!ao_lisp_eval_restart())
-                       return AO_LISP_NIL;
-               return _ao_lisp_atom_t;
+                       return _ao_lisp_bool_false;
+
+               return _ao_lisp_bool_true;
        }
 #endif
-       return AO_LISP_NIL;
+       return _ao_lisp_bool_false;
 }