Work on GC

This commit is contained in:
2026-01-24 22:37:14 -08:00
parent f67ed56d52
commit 05bcb77f24
5 changed files with 186 additions and 259 deletions
+20 -27
View File
@@ -4,33 +4,26 @@
#include <stdio.h>
/* DEFUN(cool_func, "cool-func", (LispVal * a, LispVal *b), "(a &optional b)",
*/
/* "") { */
/* printf("A: "); */
/* debug_obj_info(stdout, a); */
/* printf("B: "); */
/* debug_obj_info(stdout, b); */
/* return Qnil; */
/* } */
DEFUN(cool_func, "cool-func", (LispVal * a, LispVal *b), "(a &optional b)",
"") {
printf("A: ");
debug_obj_info(stdout, a);
printf("B: ");
debug_obj_info(stdout, b);
return Qnil;
}
/* int main(int argc, const cha-r **argv) { */
/* LispGCStats gc_stats; */
/* lisp_init(); */
/* REGISTER_GLOBAL_FUNCTION(cool_func); */
/* push_stack_frame(Qnil, Qnil, Qnil); */
/* ReadStream s; */
/* const char BUF[] = "(cool-func 1 (cons 1 2))"; */
/* read_stream_init(&s, BUF, sizeof(BUF) - 1); */
/* LispVal *l = read(&s); */
/* Feval(l); */
/* lisp_gc_now(&gc_stats); */
/* debug_print_gc_stats(stdout, &gc_stats); */
/* pop_stack_frame(); */
/* lisp_shutdown(); */
/* return 0; */
/* } */
int main(int argc, const char **argvc) {
int main(int argc, const char **argv) {
lisp_init();
REGISTER_GLOBAL_FUNCTION(cool_func);
push_stack_frame(Qnil, Qnil, Qnil);
ReadStream s;
const char BUF[] = "(cool-func 1 (cons 1 2))";
read_stream_init(&s, BUF, sizeof(BUF) - 1);
LispVal *l = read(&s);
Feval(l);
lisp_gc_now(NULL);
pop_stack_frame();
lisp_shutdown();
return 0;
}