diff --git a/include/cyclone/types.h b/include/cyclone/types.h index 333e7cf0..d5ea1083 100644 --- a/include/cyclone/types.h +++ b/include/cyclone/types.h @@ -17,8 +17,61 @@ #include #include -/* Debug GC flag */ -#define DEBUG_GC 0 +/* Define general object type. */ +typedef void *object; + +/* GC data structures */ + +typedef struct gc_free_list_t gc_free_list; +struct gc_free_list_t { + unsigned int size; + gc_free_list *next; +}; + +typedef struct gc_heap_t gc_heap; +struct gc_heap_t { + unsigned int size; + unsigned int chunk_size; // 0 for any size, other and heap will only alloc chunks of that size + unsigned int max_size; + gc_free_list *free_list; // TBD + gc_heap *next; // TBD, linked list is not very efficient, but easy to work with as a start + char *data; +}; + +typedef struct gc_header_type_t gc_header_type; +struct gc_header_type_t { + unsigned char mark; // mark bits (only need 2) + // TODO: forwarding address (probably not needed for mark/sweep), anything else??? +}; +#define is_marked(x) (is_object_type(x) && ((list)x)->hdr.mark) + +/* HEAP definitions */ +// experimenting with a heap based off of the one in Chibi scheme +#define gc_heap_first_block(h) ((object)(h->data + gc_heap_align(gc_free_chunk_size))) +#define gc_heap_last_block(h) ((object)((char*)h->data + h->size - gc_heap_align(gc_free_chunk_size))) +#define gc_heap_end(h) ((object)((char*)h->data + h->size)) +#define gc_free_chunk_size (sizeof(gc_free_list)) + +#define gc_align(n, bits) (((n)+(1<<(bits))-1)&(((unsigned int)-1)-((1<<(bits))-1))) +// 64-bit is 3, 32-bit is 2 +#define gc_word_align(n) gc_align((n), 2) +#define gc_heap_align(n) gc_align(n, 5) + +/* GC prototypes */ +gc_heap *gc_heap_create(size_t size, size_t max_size, size_t chunk_size); +int gc_grow_heap(gc_heap *h, size_t size, size_t chunk_size); +void *gc_try_alloc(gc_heap *h, size_t size); +void *gc_alloc(gc_heap *h, size_t size); +size_t gc_allocated_bytes(object obj); +gc_heap *gc_heap_last(gc_heap *h); +size_t gc_heap_total_size(gc_heap *h); +void gc_mark(gc_heap *h, object obj); +size_t gc_sweep(gc_heap *h, size_t *sum_freed_ptr); +//void gc_collect(gc_heap *h, size_t *sum_freed) + +/* GC debugging flags */ +//#define DEBUG_GC 0 +#define GC_DEBUG_PRINTFS 0 /* Show diagnostic information for the GC when program terminates */ #define DEBUG_SHOW_DIAG 0 @@ -78,10 +131,6 @@ typedef long tag_type; #define eq(x,y) (x == y) #define nullp(x) (x == NULL) -/* Define general object type. */ - -typedef void *object; - #define type_of(x) (((list) x)->tag) #define forward(x) (((list) x)->cons_car) @@ -105,19 +154,19 @@ typedef void (*function_type)(); typedef void (*function_type_va)(int, object, object, object, ...); /* Define C-variable integration type */ -typedef struct {tag_type tag; object *pvar;} cvar_type; +typedef struct {gc_header_type hdr; tag_type tag; object *pvar;} cvar_type; typedef cvar_type *cvar; #define make_cvar(n,v) cvar_type n; n.tag = cvar_tag; n.pvar = v; /* Define boolean type. */ -typedef struct {const tag_type tag; const char *pname;} boolean_type; +typedef struct {gc_header_type hdr; const tag_type tag; const char *pname;} boolean_type; typedef boolean_type *boolean; #define boolean_pname(x) (((boolean_type *) x)->pname) /* Define symbol type. */ -typedef struct {const tag_type tag; const char *pname; object plist;} symbol_type; +typedef struct {gc_header_type hdr; const tag_type tag; const char *pname; object plist;} symbol_type; typedef symbol_type *symbol; #define symbol_pname(x) (((symbol_type *) x)->pname) @@ -127,16 +176,20 @@ typedef symbol_type *symbol; static object quote_##name = nil; /* Define numeric types */ -typedef struct {tag_type tag; int value;} integer_type; +typedef struct {gc_header_type hdr; tag_type tag; int value;} integer_type; #define make_int(n,v) integer_type n; n.tag = integer_tag; n.value = v; -typedef struct {tag_type tag; double value;} double_type; +typedef struct {gc_header_type hdr; tag_type tag; double value;} double_type; #define make_double(n,v) double_type n; n.tag = double_tag; n.value = v; #define integer_value(x) (((integer_type *) x)->value) #define double_value(x) (((double_type *) x)->value) /* Define string type */ -typedef struct {tag_type tag; char *str;} string_type; +typedef struct {gc_header_type hdr; tag_type tag; int len; char *str;} string_type; +//#define make_cstring(cs, len, s) \ +// string_type cs; cs.tag = string_tag; cs.len = len; cs.str = s; +// TODO: all of the dhalloc below needs to go away for this GC. maybe +// just plan on having strings be allocated separately like vectors. #define make_string(cv,s) string_type cv; cv.tag = string_tag; \ { int len = strlen(s); cv.str = dhallocp; \ if ((dhallocp + len + 1) >= dhbottom + global_heap_size) { \ @@ -157,19 +210,19 @@ typedef struct {tag_type tag; char *str;} string_type; // consider http://stackoverflow.com/questions/6206893/how-to-implement-char-ready-in-c // TODO: a simple wrapper around FILE may not be good enough long-term // TODO: how exactly mode will be used. need to know r/w, bin/txt -typedef struct {tag_type tag; FILE *fp; int mode;} port_type; +typedef struct {gc_header_type hdr; tag_type tag; FILE *fp; int mode;} port_type; #define make_port(p,f,m) port_type p; p.tag = port_tag; p.fp = f; p.mode = m; /* Vector type */ -typedef struct {tag_type tag; int num_elt; object *elts;} vector_type; +typedef struct {gc_header_type hdr; tag_type tag; int num_elt; object *elts;} vector_type; typedef vector_type *vector; #define make_empty_vector(v) vector_type v; v.tag = vector_tag; v.num_elt = 0; v.elts = NULL; /* Define cons type. */ -typedef struct {tag_type tag; object cons_car,cons_cdr;} cons_type; +typedef struct {gc_header_type hdr; tag_type tag; object cons_car,cons_cdr;} cons_type; typedef cons_type *list; #define car(x) (((list) x)->cons_car) @@ -208,13 +261,13 @@ cons_type n; n.tag = cons_tag; n.cons_car = a; n.cons_cdr = d; /* Closure types */ -typedef struct {tag_type tag; function_type fn; int num_args; } macro_type; -typedef struct {tag_type tag; function_type fn; int num_args; } closure0_type; -typedef struct {tag_type tag; function_type fn; int num_args; object elt1;} closure1_type; -typedef struct {tag_type tag; function_type fn; int num_args; object elt1,elt2;} closure2_type; -typedef struct {tag_type tag; function_type fn; int num_args; object elt1,elt2,elt3;} closure3_type; -typedef struct {tag_type tag; function_type fn; int num_args; object elt1,elt2,elt3,elt4;} closure4_type; -typedef struct {tag_type tag; function_type fn; int num_args; int num_elt; object *elts;} closureN_type; +typedef struct {gc_header_type hdr; tag_type tag; function_type fn; int num_args; } macro_type; +typedef struct {gc_header_type hdr; tag_type tag; function_type fn; int num_args; } closure0_type; +typedef struct {gc_header_type hdr; tag_type tag; function_type fn; int num_args; object elt1;} closure1_type; +typedef struct {gc_header_type hdr; tag_type tag; function_type fn; int num_args; object elt1,elt2;} closure2_type; +typedef struct {gc_header_type hdr; tag_type tag; function_type fn; int num_args; object elt1,elt2,elt3;} closure3_type; +typedef struct {gc_header_type hdr; tag_type tag; function_type fn; int num_args; object elt1,elt2,elt3,elt4;} closure4_type; +typedef struct {gc_header_type hdr; tag_type tag; function_type fn; int num_args; int num_elt; object *elts;} closureN_type; typedef closure0_type *closure0; typedef closure1_type *closure1; @@ -247,7 +300,7 @@ typedef closure0_type *macro; #define make_cell(n,a) make_cons(n,a,nil); /* Primitive types */ -typedef struct {tag_type tag; const char *pname; function_type fn;} primitive_type; +typedef struct {gc_header_type hdr; tag_type tag; const char *pname; function_type fn;} primitive_type; typedef primitive_type *primitive; #define defprimitive(name, pname, fnc) \ diff --git a/runtime.c b/runtime.c index d5ffa156..1abcb030 100644 --- a/runtime.c +++ b/runtime.c @@ -101,19 +101,19 @@ object Cyc_global_variables = nil; int _cyc_argc = 0; char **_cyc_argv = NULL; -static symbol_type __EOF = {eof_tag, "", nil}; // symbol_type in lieu of custom type +static symbol_type __EOF = {{0}, eof_tag, "", nil}; // symbol_type in lieu of custom type const object Cyc_EOF = &__EOF; object cell_get(object cell){ return car(cell); } -static boolean_type t_boolean = {boolean_tag, "t"}; -static boolean_type f_boolean = {boolean_tag, "f"}; +static boolean_type t_boolean = {{0}, boolean_tag, "t"}; +static boolean_type f_boolean = {{0}, boolean_tag, "f"}; const object boolean_t = &t_boolean; const object boolean_f = &f_boolean; -static symbol_type Cyc_void_symbol = {symbol_tag, "", nil}; +static symbol_type Cyc_void_symbol = {{0}, symbol_tag, "", nil}; const object quote_void = &Cyc_void_symbol; /* Stack Traces */ @@ -185,7 +185,7 @@ object add_symbol(symbol_type *psym) { } object add_symbol_by_name(const char *name) { - symbol_type sym = {symbol_tag, _strdup(name), nil}; + symbol_type sym = {{0}, symbol_tag, _strdup(name), nil}; symbol_type *psym = malloc(sizeof(symbol_type)); memcpy(psym, &sym, sizeof(symbol_type)); return add_symbol(psym); @@ -868,9 +868,9 @@ string_type Cyc_symbol2string(object sym) { object Cyc_string2symbol(object str) { object sym; Cyc_check_str(str); - sym = find_symbol_by_name(symbol_pname(str)); + sym = find_symbol_by_name(string_str(str)); if (!sym) { - sym = add_symbol_by_name(symbol_pname(str)); + sym = add_symbol_by_name(string_str(str)); } return sym; } @@ -2375,122 +2375,122 @@ void dispatch_va(int argc, function_type_va func, object clo, object cont, objec do_dispatch(argc, (function_type)func, clo, b); } -static primitive_type Cyc_91global_91vars_primitive = {primitive_tag, "Cyc-global-vars", &_Cyc_91global_91vars}; -static primitive_type Cyc_91get_91cvar_primitive = {primitive_tag, "Cyc-get-cvar", &_Cyc_91get_91cvar}; -static primitive_type Cyc_91set_91cvar_67_primitive = {primitive_tag, "Cyc-set-cvar!", &_Cyc_91set_91cvar_67}; -static primitive_type Cyc_91cvar_127_primitive = {primitive_tag, "Cyc-cvar?", &_Cyc_91cvar_127}; -static primitive_type Cyc_91has_91cycle_127_primitive = {primitive_tag, "Cyc-has-cycle?", &_Cyc_91has_91cycle_127}; -static primitive_type _87_primitive = {primitive_tag, "+", &__87}; -static primitive_type _91_primitive = {primitive_tag, "-", &__91}; -static primitive_type _85_primitive = {primitive_tag, "*", &__85}; -static primitive_type _95_primitive = {primitive_tag, "/", &__95}; -static primitive_type _123_primitive = {primitive_tag, "=", &__123}; -static primitive_type _125_primitive = {primitive_tag, ">", &__125}; -static primitive_type _121_primitive = {primitive_tag, "<", &__121}; -static primitive_type _125_123_primitive = {primitive_tag, ">=", &__125_123}; -static primitive_type _121_123_primitive = {primitive_tag, "<=", &__121_123}; -static primitive_type apply_primitive = {primitive_tag, "apply", &_apply}; -static primitive_type _75halt_primitive = {primitive_tag, "%halt", &__75halt}; -static primitive_type exit_primitive = {primitive_tag, "exit", &_cyc_exit}; -static primitive_type Cyc_91current_91exception_91handler_primitive = {primitive_tag, "Cyc_current_exception_handler", &_Cyc_91current_91exception_91handler}; -static primitive_type Cyc_91default_91exception_91handler_primitive = {primitive_tag, "Cyc_default_exception_handler", &_Cyc_91default_91exception_91handler}; -static primitive_type cons_primitive = {primitive_tag, "cons", &_cons}; -static primitive_type cell_91get_primitive = {primitive_tag, "cell-get", &_cell_91get}; -static primitive_type set_91global_67_primitive = {primitive_tag, "set-global!", &_set_91global_67}; -static primitive_type set_91cell_67_primitive = {primitive_tag, "set-cell!", &_set_91cell_67}; -static primitive_type cell_primitive = {primitive_tag, "cell", &_cell}; -static primitive_type eq_127_primitive = {primitive_tag, "eq?", &_eq_127}; -static primitive_type eqv_127_primitive = {primitive_tag, "eqv?", &_eqv_127}; -static primitive_type equal_127_primitive = {primitive_tag, "equal?", &_equal_127}; -static primitive_type assoc_primitive = {primitive_tag, "assoc", &_assoc}; -static primitive_type assq_primitive = {primitive_tag, "assq", &_assq}; -static primitive_type assv_primitive = {primitive_tag, "assv", &_assv}; -static primitive_type member_primitive = {primitive_tag, "member", &_member}; -static primitive_type memq_primitive = {primitive_tag, "memq", &_memq}; -static primitive_type memv_primitive = {primitive_tag, "memv", &_memv}; -static primitive_type length_primitive = {primitive_tag, "length", &_length}; -static primitive_type vector_91length_primitive = {primitive_tag, "vector-length", &_vector_91length}; -static primitive_type set_91car_67_primitive = {primitive_tag, "set-car!", &_set_91car_67}; -static primitive_type set_91cdr_67_primitive = {primitive_tag, "set-cdr!", &_set_91cdr_67}; -static primitive_type car_primitive = {primitive_tag, "car", &_car}; -static primitive_type cdr_primitive = {primitive_tag, "cdr", &_cdr}; -static primitive_type caar_primitive = {primitive_tag, "caar", &_caar}; -static primitive_type cadr_primitive = {primitive_tag, "cadr", &_cadr}; -static primitive_type cdar_primitive = {primitive_tag, "cdar", &_cdar}; -static primitive_type cddr_primitive = {primitive_tag, "cddr", &_cddr}; -static primitive_type caaar_primitive = {primitive_tag, "caaar", &_caaar}; -static primitive_type caadr_primitive = {primitive_tag, "caadr", &_caadr}; -static primitive_type cadar_primitive = {primitive_tag, "cadar", &_cadar}; -static primitive_type caddr_primitive = {primitive_tag, "caddr", &_caddr}; -static primitive_type cdaar_primitive = {primitive_tag, "cdaar", &_cdaar}; -static primitive_type cdadr_primitive = {primitive_tag, "cdadr", &_cdadr}; -static primitive_type cddar_primitive = {primitive_tag, "cddar", &_cddar}; -static primitive_type cdddr_primitive = {primitive_tag, "cdddr", &_cdddr}; -static primitive_type caaaar_primitive = {primitive_tag, "caaaar", &_caaaar}; -static primitive_type caaadr_primitive = {primitive_tag, "caaadr", &_caaadr}; -static primitive_type caadar_primitive = {primitive_tag, "caadar", &_caadar}; -static primitive_type caaddr_primitive = {primitive_tag, "caaddr", &_caaddr}; -static primitive_type cadaar_primitive = {primitive_tag, "cadaar", &_cadaar}; -static primitive_type cadadr_primitive = {primitive_tag, "cadadr", &_cadadr}; -static primitive_type caddar_primitive = {primitive_tag, "caddar", &_caddar}; -static primitive_type cadddr_primitive = {primitive_tag, "cadddr", &_cadddr}; -static primitive_type cdaaar_primitive = {primitive_tag, "cdaaar", &_cdaaar}; -static primitive_type cdaadr_primitive = {primitive_tag, "cdaadr", &_cdaadr}; -static primitive_type cdadar_primitive = {primitive_tag, "cdadar", &_cdadar}; -static primitive_type cdaddr_primitive = {primitive_tag, "cdaddr", &_cdaddr}; -static primitive_type cddaar_primitive = {primitive_tag, "cddaar", &_cddaar}; -static primitive_type cddadr_primitive = {primitive_tag, "cddadr", &_cddadr}; -static primitive_type cdddar_primitive = {primitive_tag, "cdddar", &_cdddar}; -static primitive_type cddddr_primitive = {primitive_tag, "cddddr", &_cddddr}; -static primitive_type char_91_125integer_primitive = {primitive_tag, "char->integer", &_char_91_125integer}; -static primitive_type integer_91_125char_primitive = {primitive_tag, "integer->char", &_integer_91_125char}; -static primitive_type string_91_125number_primitive = {primitive_tag, "string->number", &_string_91_125number}; -static primitive_type string_91length_primitive = {primitive_tag, "string-length", &_string_91length}; -static primitive_type substring_primitive = {primitive_tag, "substring", &_cyc_substring}; -static primitive_type string_91ref_primitive = {primitive_tag, "string-ref", &_cyc_string_91ref}; -static primitive_type string_91set_67_primitive = {primitive_tag, "string-set!", &_cyc_string_91set_67}; -static primitive_type Cyc_91installation_91dir_primitive = {primitive_tag, "Cyc-installation-dir", &_Cyc_91installation_91dir}; -static primitive_type command_91line_91arguments_primitive = {primitive_tag, "command-line-arguments", &_command_91line_91arguments}; -static primitive_type system_primitive = {primitive_tag, "system", &_cyc_system}; -static primitive_type string_91cmp_primitive = {primitive_tag, "string-cmp", &_string_91cmp}; -static primitive_type string_91append_primitive = {primitive_tag, "string-append", &_string_91append}; -static primitive_type list_91_125string_primitive = {primitive_tag, "list->string", &_list_91_125string}; -static primitive_type string_91_125symbol_primitive = {primitive_tag, "string->symbol", &_string_91_125symbol}; -static primitive_type symbol_91_125string_primitive = {primitive_tag, "symbol->string", &_symbol_91_125string}; -static primitive_type number_91_125string_primitive = {primitive_tag, "number->string", &_number_91_125string}; -static primitive_type list_91_125vector_primitive = {primitive_tag, "list-vector", &_list_91_125vector}; -static primitive_type make_91vector_primitive = {primitive_tag, "make-vector", &_make_91vector}; -static primitive_type vector_91ref_primitive = {primitive_tag, "vector-ref", &_vector_91ref}; -static primitive_type vector_91set_67_primitive = {primitive_tag, "vector-set!", &_vector_91set_67}; -static primitive_type boolean_127_primitive = {primitive_tag, "boolean?", &_boolean_127}; -static primitive_type char_127_primitive = {primitive_tag, "char?", &_char_127}; -static primitive_type eof_91object_127_primitive = {primitive_tag, "eof-object?", &_eof_91object_127}; -static primitive_type null_127_primitive = {primitive_tag, "null?", &_null_127}; -static primitive_type number_127_primitive = {primitive_tag, "number?", &_number_127}; -static primitive_type real_127_primitive = {primitive_tag, "real?", &_real_127}; -static primitive_type integer_127_primitive = {primitive_tag, "integer?", &_integer_127}; -static primitive_type pair_127_primitive = {primitive_tag, "pair?", &_pair_127}; -static primitive_type procedure_127_primitive = {primitive_tag, "procedure?", &_procedure_127}; -static primitive_type macro_127_primitive = {primitive_tag, "macro?", &_macro_127}; -static primitive_type port_127_primitive = {primitive_tag, "port?", &_port_127}; -static primitive_type vector_127_primitive = {primitive_tag, "vector?", &_vector_127}; -static primitive_type string_127_primitive = {primitive_tag, "string?", &_string_127}; -static primitive_type symbol_127_primitive = {primitive_tag, "symbol?", &_symbol_127}; -static primitive_type open_91input_91file_primitive = {primitive_tag, "open-input-file", &_open_91input_91file}; -static primitive_type open_91output_91file_primitive = {primitive_tag, "open-output-file", &_open_91output_91file}; -static primitive_type close_91port_primitive = {primitive_tag, "close-port", &_close_91port}; -static primitive_type close_91input_91port_primitive = {primitive_tag, "close-input-port", &_close_91input_91port}; -static primitive_type close_91output_91port_primitive = {primitive_tag, "close-output-port", &_close_91output_91port}; -static primitive_type Cyc_91flush_91output_91port_primitive = {primitive_tag, "Cyc-flush-output-port", &_Cyc_91flush_91output_91port}; -static primitive_type file_91exists_127_primitive = {primitive_tag, "file-exists?", &_file_91exists_127}; -static primitive_type delete_91file_primitive = {primitive_tag, "delete-file", &_delete_91file}; -static primitive_type read_91char_primitive = {primitive_tag, "read-char", &_read_91char}; -static primitive_type peek_91char_primitive = {primitive_tag, "peek-char", &_peek_91char}; -static primitive_type Cyc_91read_91line_primitive = {primitive_tag, "Cyc-read-line", &_Cyc_91read_91line}; -static primitive_type Cyc_91write_primitive = {primitive_tag, "Cyc-write", &_Cyc_91write}; -static primitive_type Cyc_91write_91char_primitive = {primitive_tag, "Cyc-write-char", &_Cyc_91write_91char}; -static primitive_type Cyc_91display_primitive = {primitive_tag, "Cyc-display", &_display}; -static primitive_type call_95cc_primitive = {primitive_tag, "call/cc", &_call_95cc}; +static primitive_type Cyc_91global_91vars_primitive = {{0}, primitive_tag, "Cyc-global-vars", &_Cyc_91global_91vars}; +static primitive_type Cyc_91get_91cvar_primitive = {{0}, primitive_tag, "Cyc-get-cvar", &_Cyc_91get_91cvar}; +static primitive_type Cyc_91set_91cvar_67_primitive = {{0}, primitive_tag, "Cyc-set-cvar!", &_Cyc_91set_91cvar_67}; +static primitive_type Cyc_91cvar_127_primitive = {{0}, primitive_tag, "Cyc-cvar?", &_Cyc_91cvar_127}; +static primitive_type Cyc_91has_91cycle_127_primitive = {{0}, primitive_tag, "Cyc-has-cycle?", &_Cyc_91has_91cycle_127}; +static primitive_type _87_primitive = {{0}, primitive_tag, "+", &__87}; +static primitive_type _91_primitive = {{0}, primitive_tag, "-", &__91}; +static primitive_type _85_primitive = {{0}, primitive_tag, "*", &__85}; +static primitive_type _95_primitive = {{0}, primitive_tag, "/", &__95}; +static primitive_type _123_primitive = {{0}, primitive_tag, "=", &__123}; +static primitive_type _125_primitive = {{0}, primitive_tag, ">", &__125}; +static primitive_type _121_primitive = {{0}, primitive_tag, "<", &__121}; +static primitive_type _125_123_primitive = {{0}, primitive_tag, ">=", &__125_123}; +static primitive_type _121_123_primitive = {{0}, primitive_tag, "<=", &__121_123}; +static primitive_type apply_primitive = {{0}, primitive_tag, "apply", &_apply}; +static primitive_type _75halt_primitive = {{0}, primitive_tag, "%halt", &__75halt}; +static primitive_type exit_primitive = {{0}, primitive_tag, "exit", &_cyc_exit}; +static primitive_type Cyc_91current_91exception_91handler_primitive = {{0}, primitive_tag, "Cyc_current_exception_handler", &_Cyc_91current_91exception_91handler}; +static primitive_type Cyc_91default_91exception_91handler_primitive = {{0}, primitive_tag, "Cyc_default_exception_handler", &_Cyc_91default_91exception_91handler}; +static primitive_type cons_primitive = {{0}, primitive_tag, "cons", &_cons}; +static primitive_type cell_91get_primitive = {{0}, primitive_tag, "cell-get", &_cell_91get}; +static primitive_type set_91global_67_primitive = {{0}, primitive_tag, "set-global!", &_set_91global_67}; +static primitive_type set_91cell_67_primitive = {{0}, primitive_tag, "set-cell!", &_set_91cell_67}; +static primitive_type cell_primitive = {{0}, primitive_tag, "cell", &_cell}; +static primitive_type eq_127_primitive = {{0}, primitive_tag, "eq?", &_eq_127}; +static primitive_type eqv_127_primitive = {{0}, primitive_tag, "eqv?", &_eqv_127}; +static primitive_type equal_127_primitive = {{0}, primitive_tag, "equal?", &_equal_127}; +static primitive_type assoc_primitive = {{0}, primitive_tag, "assoc", &_assoc}; +static primitive_type assq_primitive = {{0}, primitive_tag, "assq", &_assq}; +static primitive_type assv_primitive = {{0}, primitive_tag, "assv", &_assv}; +static primitive_type member_primitive = {{0}, primitive_tag, "member", &_member}; +static primitive_type memq_primitive = {{0}, primitive_tag, "memq", &_memq}; +static primitive_type memv_primitive = {{0}, primitive_tag, "memv", &_memv}; +static primitive_type length_primitive = {{0}, primitive_tag, "length", &_length}; +static primitive_type vector_91length_primitive = {{0}, primitive_tag, "vector-length", &_vector_91length}; +static primitive_type set_91car_67_primitive = {{0}, primitive_tag, "set-car!", &_set_91car_67}; +static primitive_type set_91cdr_67_primitive = {{0}, primitive_tag, "set-cdr!", &_set_91cdr_67}; +static primitive_type car_primitive = {{0}, primitive_tag, "car", &_car}; +static primitive_type cdr_primitive = {{0}, primitive_tag, "cdr", &_cdr}; +static primitive_type caar_primitive = {{0}, primitive_tag, "caar", &_caar}; +static primitive_type cadr_primitive = {{0}, primitive_tag, "cadr", &_cadr}; +static primitive_type cdar_primitive = {{0}, primitive_tag, "cdar", &_cdar}; +static primitive_type cddr_primitive = {{0}, primitive_tag, "cddr", &_cddr}; +static primitive_type caaar_primitive = {{0}, primitive_tag, "caaar", &_caaar}; +static primitive_type caadr_primitive = {{0}, primitive_tag, "caadr", &_caadr}; +static primitive_type cadar_primitive = {{0}, primitive_tag, "cadar", &_cadar}; +static primitive_type caddr_primitive = {{0}, primitive_tag, "caddr", &_caddr}; +static primitive_type cdaar_primitive = {{0}, primitive_tag, "cdaar", &_cdaar}; +static primitive_type cdadr_primitive = {{0}, primitive_tag, "cdadr", &_cdadr}; +static primitive_type cddar_primitive = {{0}, primitive_tag, "cddar", &_cddar}; +static primitive_type cdddr_primitive = {{0}, primitive_tag, "cdddr", &_cdddr}; +static primitive_type caaaar_primitive = {{0}, primitive_tag, "caaaar", &_caaaar}; +static primitive_type caaadr_primitive = {{0}, primitive_tag, "caaadr", &_caaadr}; +static primitive_type caadar_primitive = {{0}, primitive_tag, "caadar", &_caadar}; +static primitive_type caaddr_primitive = {{0}, primitive_tag, "caaddr", &_caaddr}; +static primitive_type cadaar_primitive = {{0}, primitive_tag, "cadaar", &_cadaar}; +static primitive_type cadadr_primitive = {{0}, primitive_tag, "cadadr", &_cadadr}; +static primitive_type caddar_primitive = {{0}, primitive_tag, "caddar", &_caddar}; +static primitive_type cadddr_primitive = {{0}, primitive_tag, "cadddr", &_cadddr}; +static primitive_type cdaaar_primitive = {{0}, primitive_tag, "cdaaar", &_cdaaar}; +static primitive_type cdaadr_primitive = {{0}, primitive_tag, "cdaadr", &_cdaadr}; +static primitive_type cdadar_primitive = {{0}, primitive_tag, "cdadar", &_cdadar}; +static primitive_type cdaddr_primitive = {{0}, primitive_tag, "cdaddr", &_cdaddr}; +static primitive_type cddaar_primitive = {{0}, primitive_tag, "cddaar", &_cddaar}; +static primitive_type cddadr_primitive = {{0}, primitive_tag, "cddadr", &_cddadr}; +static primitive_type cdddar_primitive = {{0}, primitive_tag, "cdddar", &_cdddar}; +static primitive_type cddddr_primitive = {{0}, primitive_tag, "cddddr", &_cddddr}; +static primitive_type char_91_125integer_primitive = {{0}, primitive_tag, "char->integer", &_char_91_125integer}; +static primitive_type integer_91_125char_primitive = {{0}, primitive_tag, "integer->char", &_integer_91_125char}; +static primitive_type string_91_125number_primitive = {{0}, primitive_tag, "string->number", &_string_91_125number}; +static primitive_type string_91length_primitive = {{0}, primitive_tag, "string-length", &_string_91length}; +static primitive_type substring_primitive = {{0}, primitive_tag, "substring", &_cyc_substring}; +static primitive_type string_91ref_primitive = {{0}, primitive_tag, "string-ref", &_cyc_string_91ref}; +static primitive_type string_91set_67_primitive = {{0}, primitive_tag, "string-set!", &_cyc_string_91set_67}; +static primitive_type Cyc_91installation_91dir_primitive = {{0}, primitive_tag, "Cyc-installation-dir", &_Cyc_91installation_91dir}; +static primitive_type command_91line_91arguments_primitive = {{0}, primitive_tag, "command-line-arguments", &_command_91line_91arguments}; +static primitive_type system_primitive = {{0}, primitive_tag, "system", &_cyc_system}; +static primitive_type string_91cmp_primitive = {{0}, primitive_tag, "string-cmp", &_string_91cmp}; +static primitive_type string_91append_primitive = {{0}, primitive_tag, "string-append", &_string_91append}; +static primitive_type list_91_125string_primitive = {{0}, primitive_tag, "list->string", &_list_91_125string}; +static primitive_type string_91_125symbol_primitive = {{0}, primitive_tag, "string->symbol", &_string_91_125symbol}; +static primitive_type symbol_91_125string_primitive = {{0}, primitive_tag, "symbol->string", &_symbol_91_125string}; +static primitive_type number_91_125string_primitive = {{0}, primitive_tag, "number->string", &_number_91_125string}; +static primitive_type list_91_125vector_primitive = {{0}, primitive_tag, "list-vector", &_list_91_125vector}; +static primitive_type make_91vector_primitive = {{0}, primitive_tag, "make-vector", &_make_91vector}; +static primitive_type vector_91ref_primitive = {{0}, primitive_tag, "vector-ref", &_vector_91ref}; +static primitive_type vector_91set_67_primitive = {{0}, primitive_tag, "vector-set!", &_vector_91set_67}; +static primitive_type boolean_127_primitive = {{0}, primitive_tag, "boolean?", &_boolean_127}; +static primitive_type char_127_primitive = {{0}, primitive_tag, "char?", &_char_127}; +static primitive_type eof_91object_127_primitive = {{0}, primitive_tag, "eof-object?", &_eof_91object_127}; +static primitive_type null_127_primitive = {{0}, primitive_tag, "null?", &_null_127}; +static primitive_type number_127_primitive = {{0}, primitive_tag, "number?", &_number_127}; +static primitive_type real_127_primitive = {{0}, primitive_tag, "real?", &_real_127}; +static primitive_type integer_127_primitive = {{0}, primitive_tag, "integer?", &_integer_127}; +static primitive_type pair_127_primitive = {{0}, primitive_tag, "pair?", &_pair_127}; +static primitive_type procedure_127_primitive = {{0}, primitive_tag, "procedure?", &_procedure_127}; +static primitive_type macro_127_primitive = {{0}, primitive_tag, "macro?", &_macro_127}; +static primitive_type port_127_primitive = {{0}, primitive_tag, "port?", &_port_127}; +static primitive_type vector_127_primitive = {{0}, primitive_tag, "vector?", &_vector_127}; +static primitive_type string_127_primitive = {{0}, primitive_tag, "string?", &_string_127}; +static primitive_type symbol_127_primitive = {{0}, primitive_tag, "symbol?", &_symbol_127}; +static primitive_type open_91input_91file_primitive = {{0}, primitive_tag, "open-input-file", &_open_91input_91file}; +static primitive_type open_91output_91file_primitive = {{0}, primitive_tag, "open-output-file", &_open_91output_91file}; +static primitive_type close_91port_primitive = {{0}, primitive_tag, "close-port", &_close_91port}; +static primitive_type close_91input_91port_primitive = {{0}, primitive_tag, "close-input-port", &_close_91input_91port}; +static primitive_type close_91output_91port_primitive = {{0}, primitive_tag, "close-output-port", &_close_91output_91port}; +static primitive_type Cyc_91flush_91output_91port_primitive = {{0}, primitive_tag, "Cyc-flush-output-port", &_Cyc_91flush_91output_91port}; +static primitive_type file_91exists_127_primitive = {{0}, primitive_tag, "file-exists?", &_file_91exists_127}; +static primitive_type delete_91file_primitive = {{0}, primitive_tag, "delete-file", &_delete_91file}; +static primitive_type read_91char_primitive = {{0}, primitive_tag, "read-char", &_read_91char}; +static primitive_type peek_91char_primitive = {{0}, primitive_tag, "peek-char", &_peek_91char}; +static primitive_type Cyc_91read_91line_primitive = {{0}, primitive_tag, "Cyc-read-line", &_Cyc_91read_91line}; +static primitive_type Cyc_91write_primitive = {{0}, primitive_tag, "Cyc-write", &_Cyc_91write}; +static primitive_type Cyc_91write_91char_primitive = {{0}, primitive_tag, "Cyc-write-char", &_Cyc_91write_91char}; +static primitive_type Cyc_91display_primitive = {{0}, primitive_tag, "Cyc-display", &_display}; +static primitive_type call_95cc_primitive = {{0}, primitive_tag, "call/cc", &_call_95cc}; const object primitive_Cyc_91global_91vars = &Cyc_91global_91vars_primitive; const object primitive_Cyc_91get_91cvar = &Cyc_91get_91cvar_primitive;