--- stack/stack.h 2002/03/10 20:08:47 1.10 +++ stack/stack.h 2002/03/14 10:39:11 1.14 @@ -25,6 +25,7 @@ /* First, define some types. */ struct cons_struct; +struct symbol_struct; /* A value of some type */ typedef struct { @@ -33,23 +34,24 @@ tfloat, string, func, /* Function pointer */ - symb, - tcons + symb, /* Symbol */ + tcons /* A pair of two values */ } type:4; /* Type of stack element */ union { struct { - unsigned int mark:1; - unsigned int protect:1; + unsigned int mark:1; /* Used internally in the GC */ + unsigned int protect:1; /* Protect from GC */ } flag; - unsigned int no_gc:2; - } gc; + unsigned int no_gc:2; /* Both flags as one integer */ + } gc; /* Garbage collector stuff */ union { - struct cons_struct *c; void *ptr; /* Pointer to the content */ + struct cons_struct *c; /* ...or a pointer to a cons cell */ + struct symbol_struct *sym; /* ...or a pointer to a symbol */ int i; /* ...or an integer */ - float f; + float f; /* ...or a floating point number */ } content; /* Stores a pointer or an integer */ } value; @@ -62,7 +64,7 @@ struct stackitem_struct *next; /* Next item */ } stackitem; -typedef struct cons_struct { +typedef struct cons_struct { /* A pair of two values */ value *car; value *cdr; } cons; @@ -85,7 +87,7 @@ stackitem *gc_ref; int gc_limit, gc_count; - cons *head; /* Head of the stack */ + value *head; /* Head of the stack */ hashtbl symbols; /* Hash table of all variable bindings */ int err; /* Error flag */ char *in_string; /* Input pending to be read */ @@ -116,12 +118,12 @@ void push_sym(environment*, const char*); extern void nl(); extern void type(environment*); -void print_h(cons*, int); +void print_h(value*, int); extern void print_(environment*); extern void print(environment*); extern void princ_(environment*); extern void princ(environment*); -void print_st(cons*, long); +void print_st(value*, long); extern void printstack(environment*); extern void swap(environment*); extern void rot(environment*); @@ -164,3 +166,4 @@ extern void sx_3c3d(environment*); extern void sx_3e3d(environment*); extern void sx_646976(environment*); +extern void then(environment*);