/[cvs]/stack/stack.h
ViewVC logotype

Diff of /stack/stack.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by masse, Tue Mar 12 14:53:19 2002 UTC revision 1.21 by teddy, Sat Mar 30 02:31:24 2002 UTC
# Line 30  struct symbol_struct; Line 30  struct symbol_struct;
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,
37      func,                       /* Function pointer */      func,                       /* Function pointer */
38      symb,                       /* Symbol */      symb,                       /* Symbol */
39      tcons                       /* A pair of two values */      tcons,                      /* A pair of two values */
40        port                        /* An I/O port */
41    } type:4;                     /* Type of stack element */    } type:4;                     /* Type of stack element */
42    
43    union {    union {
# Line 50  typedef struct { Line 52  typedef struct {
52      void *ptr;                  /* Pointer to the content */      void *ptr;                  /* Pointer to the content */
53      struct cons_struct *c;      /* ...or a pointer to a cons cell */      struct cons_struct *c;      /* ...or a pointer to a cons cell */
54      struct symbol_struct *sym;  /* ...or a pointer to a symbol */      struct symbol_struct *sym;  /* ...or a pointer to a symbol */
55        FILE *p;                    /* ...or an I/O stream */
56      int i;                      /* ...or an integer */      int i;                      /* ...or an integer */
57      float f;                    /* ...or a floating point number */      float f;                    /* ...or a floating point number */
58    } content;                    /* Stores a pointer or an integer */    } content;                    /* Stores a pointer or an integer */
# Line 67  typedef struct stackitem_struct Line 70  typedef struct stackitem_struct
70  typedef struct cons_struct {    /* A pair of two values */  typedef struct cons_struct {    /* A pair of two values */
71    value *car;    value *car;
72    value *cdr;    value *cdr;
73  } cons;  } pair;
74    
75  /* A symbol with a name and possible value */  /* A symbol with a name and possible value */
76  /* (These do not need reference counters, they are kept unique by  /* (These do not need reference counters, they are kept unique by
# Line 84  typedef symbol *hashtbl[HASHTBLSIZE]; /* Line 87  typedef symbol *hashtbl[HASHTBLSIZE]; /*
87  /* An environment; gives access to the stack and a hash table of  /* An environment; gives access to the stack and a hash table of
88     defined symbols */     defined symbols */
89  typedef struct {  typedef struct {
   stackitem *gc_ref;  
   int gc_limit, gc_count;  
   
90    value *head;                  /* Head of the stack */    value *head;                  /* Head of the stack */
91    hashtbl symbols;              /* Hash table of all variable bindings */    hashtbl symbols;              /* Hash table of all variable bindings */
92    int err;                      /* Error flag */    int err;                      /* Error flag */
# Line 95  typedef struct { Line 95  typedef struct {
95                                     read from in_string */                                     read from in_string */
96    FILE *inputstream;            /* stdin or a file, most likely */    FILE *inputstream;            /* stdin or a file, most likely */
97    int interactive;              /* print prompts, stack, etc */    int interactive;              /* print prompts, stack, etc */
98    
99      /* Garbage Collector stuff*/
100      stackitem *gc_ref;            /* Stack of all allocated values */
101      int gc_limit;                 /* Run GC when this much is allocated */
102      int gc_count;                 /* Amount currently allocated */
103  } environment;  } environment;
104    
105  /* A type for pointers to external functions */  /* A type for pointers to external functions */
# Line 107  extern void toss(environment*); Line 112  extern void toss(environment*);
112  symbol **hash(hashtbl, const char*);  symbol **hash(hashtbl, const char*);
113  value* new_val(environment*);  value* new_val(environment*);
114  void gc_mark(value*);  void gc_mark(value*);
115  void gc_maybe(environment *env);  void gc_maybe(environment*);
116  extern void gc_init(environment*);  extern void gc_init(environment*);
117    void protect(value*);
118    void unprotect(value*);
119  void push_val(environment*, value*);  void push_val(environment*, value*);
120  void push_int(environment*, int);  void push_int(environment*, int);
121  void push_float(environment*, float);  void push_float(environment*, float);
# Line 116  void push_cstring(environment*, const ch Line 123  void push_cstring(environment*, const ch
123  char *mangle_str(const char*);  char *mangle_str(const char*);
124  extern void mangle(environment*);  extern void mangle(environment*);
125  void push_sym(environment*, const char*);  void push_sym(environment*, const char*);
126  extern void nl();  extern void nl(environment*);
127    extern void nlport(environment*);
128  extern void type(environment*);  extern void type(environment*);
129  void print_h(value*, int);  void print_val(environment *, value*, int, stackitem*, FILE*);
130  extern void print_(environment*);  extern void print_(environment*);
131  extern void print(environment*);  extern void print(environment*);
132  extern void princ_(environment*);  extern void princ_(environment*);
133  extern void princ(environment*);  extern void princ(environment*);
134  void print_st(value*, long);  extern void printport_(environment*);
135    extern void printport(environment*);
136    extern void princport_(environment*);
137    extern void princport(environment*);
138    void print_st(environment*, value*, long);
139  extern void printstack(environment*);  extern void printstack(environment*);
140  extern void swap(environment*);  extern void swap(environment*);
141  extern void rot(environment*);  extern void rot(environment*);
# Line 145  extern void errn(environment*); Line 157  extern void errn(environment*);
157  extern void sx_2b(environment*);  extern void sx_2b(environment*);
158  extern void sx_2d(environment*);  extern void sx_2d(environment*);
159  extern void sx_3e(environment*);  extern void sx_3e(environment*);
160    extern void sx_3c(environment*);
161    extern void sx_3c3d(environment*);
162    extern void sx_3e3d(environment*);
163  value *copy_val(environment*, value*);  value *copy_val(environment*, value*);
164  extern void sx_647570(environment*);  extern void sx_647570(environment*);
165  extern void sx_6966(environment*);  extern void sx_6966(environment*);
166  extern void ifelse(environment*);  extern void ifelse(environment*);
167    extern void sx_656c7365(environment*);
168    extern void then(environment*);
169  extern void sx_7768696c65(environment*);  extern void sx_7768696c65(environment*);
170  extern void sx_666f72(environment*);  extern void sx_666f72(environment*);
171    extern void foreach(environment*);
172  extern void to(environment*);  extern void to(environment*);
173  extern void readline(environment*);  extern void readline(environment*);
174    extern void readlineport(environment*);
175    void readlinestream(environment*, FILE*);
176  extern void sx_72656164(environment*);  extern void sx_72656164(environment*);
177  extern void foreach(environment*);  extern void readport(environment*);
178  void protect(value*);  void readstream(environment*, FILE*);
179  void unprotect(value*);  extern void beep(environment*);
180    extern void sx_77616974(environment*);
181  extern void copying(environment*);  extern void copying(environment*);
182  extern void warranty(environment*);  extern void warranty(environment*);
183  extern void sx_2a(environment*);  extern void sx_2a(environment*);
184  extern void sx_2f(environment*);  extern void sx_2f(environment*);
185  extern void mod(environment*);  extern void mod(environment*);
 extern void sx_3c(environment*);  
 extern void sx_3c3d(environment*);  
 extern void sx_3e3d(environment*);  
186  extern void sx_646976(environment*);  extern void sx_646976(environment*);
187    extern void setcar(environment*);
188    extern void setcdr(environment*);
189    extern void car(environment*);
190    extern void cdr(environment*);
191    extern void cons(environment*);
192    extern void assq(environment*);
193    void assocgen(environment*, funcp);
194    extern void sx_646f(environment *);
195    extern void sx_6f70656e(environment*);
196    extern void sx_636c6f7365(environment*);

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.21

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26