--- stack/stack.h 2002/03/12 14:53:19 1.13 +++ stack/stack.h 2002/03/21 03:19:32 1.19 @@ -30,6 +30,7 @@ /* A value of some type */ typedef struct { enum { + empty, /* The empty list */ integer, tfloat, string, @@ -67,7 +68,7 @@ typedef struct cons_struct { /* A pair of two values */ value *car; value *cdr; -} cons; +} pair; /* A symbol with a name and possible value */ /* (These do not need reference counters, they are kept unique by @@ -84,9 +85,6 @@ /* An environment; gives access to the stack and a hash table of defined symbols */ typedef struct { - stackitem *gc_ref; - int gc_limit, gc_count; - value *head; /* Head of the stack */ hashtbl symbols; /* Hash table of all variable bindings */ int err; /* Error flag */ @@ -95,6 +93,11 @@ read from in_string */ FILE *inputstream; /* stdin or a file, most likely */ int interactive; /* print prompts, stack, etc */ + + /* Garbage Collector stuff*/ + stackitem *gc_ref; /* Stack of all allocated values */ + int gc_limit; /* Run GC when this much is allocated */ + int gc_count; /* Amount currently allocated */ } environment; /* A type for pointers to external functions */ @@ -107,8 +110,10 @@ symbol **hash(hashtbl, const char*); value* new_val(environment*); void gc_mark(value*); -void gc_maybe(environment *env); +void gc_maybe(environment*); extern void gc_init(environment*); +void protect(value*); +void unprotect(value*); void push_val(environment*, value*); void push_int(environment*, int); void push_float(environment*, float); @@ -118,7 +123,7 @@ void push_sym(environment*, const char*); extern void nl(); extern void type(environment*); -void print_h(value*, int); +void print_val(value*, int, stackitem*); extern void print_(environment*); extern void print(environment*); extern void princ_(environment*); @@ -145,24 +150,33 @@ extern void sx_2b(environment*); extern void sx_2d(environment*); extern void sx_3e(environment*); +extern void sx_3c(environment*); +extern void sx_3c3d(environment*); +extern void sx_3e3d(environment*); value *copy_val(environment*, value*); extern void sx_647570(environment*); extern void sx_6966(environment*); extern void ifelse(environment*); +extern void sx_656c7365(environment*); +extern void then(environment*); extern void sx_7768696c65(environment*); extern void sx_666f72(environment*); +extern void foreach(environment*); extern void to(environment*); extern void readline(environment*); extern void sx_72656164(environment*); -extern void foreach(environment*); -void protect(value*); -void unprotect(value*); +extern void beep(environment*); +extern void sx_77616974(environment*); extern void copying(environment*); extern void warranty(environment*); extern void sx_2a(environment*); extern void sx_2f(environment*); extern void mod(environment*); -extern void sx_3c(environment*); -extern void sx_3c3d(environment*); -extern void sx_3e3d(environment*); extern void sx_646976(environment*); +extern void setcar(environment*); +extern void setcdr(environment*); +extern void car(environment*); +extern void cdr(environment*); +extern void cons(environment*); +extern void assq(environment*); +void assocgen(environment*, funcp);