- /* allocator test */
- for (j = 0; j < 10; j++) {
- list = 0;
- string = ao_lisp_string_new(0);
- for (i = 0; i < 2; i++) {
- string = ao_lisp_string_cat(string, "a");
- list = ao_lisp_cons_cons(ao_lisp_string_poly(string), list);
- list = ao_lisp_cons_cons(ao_lisp_int_poly(i), list);
- atom = ao_lisp_atom_intern("ant");
- list = ao_lisp_cons_cons(ao_lisp_atom_poly(atom), list);
- }
- ao_lisp_poly_print(ao_lisp_cons_poly(list));
- printf("\n");
+int
+ao_lisp_os_restore(void)
+{
+ FILE *restore = fopen(save_file, "r");
+ size_t ret;
+
+ if (!restore) {
+ perror(save_file);
+ return 0;
+ }
+ ret = fread(ao_lisp_pool, 1, AO_LISP_POOL_TOTAL, restore);
+ fclose(restore);
+ if (ret != AO_LISP_POOL_TOTAL)
+ return 0;
+ return 1;
+}
+
+int
+ao_lisp_getc(void)
+{
+ int c;
+
+ if (ao_lisp_file)
+ return getc(ao_lisp_file);
+
+ if (newline) {
+ printf("> ");
+ newline = 0;