| 30 |
/* A value of some type */ |
/* A value of some type */ |
| 31 |
typedef struct { |
typedef struct { |
| 32 |
enum { |
enum { |
| 33 |
|
empty, /* The empty list */ |
| 34 |
integer, |
integer, |
| 35 |
tfloat, |
tfloat, |
| 36 |
string, |
string, |
| 68 |
typedef struct cons_struct { /* A pair of two values */ |
typedef struct cons_struct { /* A pair of two values */ |
| 69 |
value *car; |
value *car; |
| 70 |
value *cdr; |
value *cdr; |
| 71 |
} cons; |
} pair; |
| 72 |
|
|
| 73 |
/* A symbol with a name and possible value */ |
/* A symbol with a name and possible value */ |
| 74 |
/* (These do not need reference counters, they are kept unique by |
/* (These do not need reference counters, they are kept unique by |
| 85 |
/* An environment; gives access to the stack and a hash table of |
/* An environment; gives access to the stack and a hash table of |
| 86 |
defined symbols */ |
defined symbols */ |
| 87 |
typedef struct { |
typedef struct { |
|
stackitem *gc_ref; |
|
|
int gc_limit, gc_count; |
|
|
|
|
| 88 |
value *head; /* Head of the stack */ |
value *head; /* Head of the stack */ |
| 89 |
hashtbl symbols; /* Hash table of all variable bindings */ |
hashtbl symbols; /* Hash table of all variable bindings */ |
| 90 |
int err; /* Error flag */ |
int err; /* Error flag */ |
| 93 |
read from in_string */ |
read from in_string */ |
| 94 |
FILE *inputstream; /* stdin or a file, most likely */ |
FILE *inputstream; /* stdin or a file, most likely */ |
| 95 |
int interactive; /* print prompts, stack, etc */ |
int interactive; /* print prompts, stack, etc */ |
| 96 |
|
|
| 97 |
|
/* Garbage Collector stuff*/ |
| 98 |
|
stackitem *gc_ref; /* Stack of all allocated values */ |
| 99 |
|
int gc_limit; /* Run GC when this much is allocated */ |
| 100 |
|
int gc_count; /* Amount currently allocated */ |
| 101 |
} environment; |
} environment; |
| 102 |
|
|
| 103 |
/* A type for pointers to external functions */ |
/* A type for pointers to external functions */ |
| 169 |
extern void sx_3c3d(environment*); |
extern void sx_3c3d(environment*); |
| 170 |
extern void sx_3e3d(environment*); |
extern void sx_3e3d(environment*); |
| 171 |
extern void sx_646976(environment*); |
extern void sx_646976(environment*); |
| 172 |
|
extern void then(environment*); |