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

Diff of /stack/stack.h

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

revision 1.4 by teddy, Thu Mar 7 03:28:29 2002 UTC revision 1.12 by masse, Tue Mar 12 14:06:05 2002 UTC
# Line 24  Line 24 
24    
25  /* First, define some types. */  /* First, define some types. */
26    
27    struct cons_struct;
28    
29  /* A value of some type */  /* A value of some type */
30  typedef struct {  typedef struct {
31    enum {    enum {
32      integer,      integer,
33        tfloat,
34      string,      string,
35      func,                       /* Function pointer */      func,                       /* Function pointer */
36      symb,      symb,                       /* Symbol */
37      list      tcons                       /* A pair of two values */
38    } type:3;                     /* Type of stack element */    } type:4;                     /* Type of stack element */
39    
40    int gc_garb:1;    union {
41        struct {
42          unsigned int mark:1;      /* Used internally in the GC */
43          unsigned int protect:1;   /* Protect from GC */
44        } flag;
45        unsigned int no_gc:2;       /* Both flags as one integer */
46      } gc;                         /* Garbage collector stuff */
47    
48    union {    union {
49      void *ptr;                  /* Pointer to the content */      void *ptr;                  /* Pointer to the content */
50      int val;                    /* ...or an integer */      struct cons_struct *c;      /* ...or a pointer to a cons cell */
51        int i;                      /* ...or an integer */
52        float f;                    /* ...or a floating point number */
53    } content;                    /* Stores a pointer or an integer */    } content;                    /* Stores a pointer or an integer */
54    
55  } value;  } value;
56    
57    /* An item (value) on a stack */
58    typedef struct stackitem_struct
59    {
60      value *item;                 /* The value on the stack */
61                                   /* (This is never NULL) */
62      struct stackitem_struct *next; /* Next item */
63    } stackitem;
64    
65    typedef struct cons_struct {    /* A pair of two values */
66      value *car;
67      value *cdr;
68    } cons;
69    
70  /* A symbol with a name and possible value */  /* A symbol with a name and possible value */
71  /* (These do not need reference counters, they are kept unique by  /* (These do not need reference counters, they are kept unique by
72     hashing.) */     hashing.) */
# Line 55  typedef struct symbol_struct { Line 79  typedef struct symbol_struct {
79  /* A type for a hash table for symbols */  /* A type for a hash table for symbols */
80  typedef symbol *hashtbl[HASHTBLSIZE]; /* Hash table declaration */  typedef symbol *hashtbl[HASHTBLSIZE]; /* Hash table declaration */
81    
 /* An item (value) on a stack */  
 typedef struct stackitem_struct  
 {  
   value *item;                  /* The value on the stack */  
                                 /* (This is never NULL) */  
   struct stackitem_struct *next; /* Next item */  
 } stackitem;  
   
82  /* An environment; gives access to the stack and a hash table of  /* An environment; gives access to the stack and a hash table of
83     defined symbols */     defined symbols */
84  typedef struct {  typedef struct {
85    stackitem *gc_ref;    stackitem *gc_ref;
   stackitem *gc_protect;  
86    int gc_limit, gc_count;    int gc_limit, gc_count;
87    
88    stackitem *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 */
91    char *in_string;              /* Input pending to be read */    char *in_string;              /* Input pending to be read */
# Line 90  extern void toss(environment*); Line 105  extern void toss(environment*);
105  symbol **hash(hashtbl, const char*);  symbol **hash(hashtbl, const char*);
106  value* new_val(environment*);  value* new_val(environment*);
107  void gc_mark(value*);  void gc_mark(value*);
108    void gc_maybe(environment *env);
109  extern void gc_init(environment*);  extern void gc_init(environment*);
110  void push_val(environment*, value*);  void push_val(environment*, value*);
111  void push_int(environment*, int);  void push_int(environment*, int);
112    void push_float(environment*, float);
113  void push_cstring(environment*, const char*);  void push_cstring(environment*, const char*);
114  char *mangle_str(const char*);  char *mangle_str(const char*);
115  extern void mangle(environment*);  extern void mangle(environment*);
116  void push_sym(environment*, const char*);  void push_sym(environment*, const char*);
117  extern void nl();  extern void nl();
118  extern void type(environment*);  extern void type(environment*);
119  void print_h(stackitem*, int);  void print_h(value*, int);
120  extern void print_(environment*);  extern void print_(environment*);
121  extern void print(environment*);  extern void print(environment*);
122  extern void princ_(environment*);  extern void princ_(environment*);
123  extern void princ(environment*);  extern void princ(environment*);
124  void print_st(stackitem*, long);  void print_st(value*, long);
125  extern void printstack(environment*);  extern void printstack(environment*);
126  extern void swap(environment*);  extern void swap(environment*);
127  extern void rot(environment*);  extern void rot(environment*);
# Line 136  extern void to(environment*); Line 153  extern void to(environment*);
153  extern void readline(environment*);  extern void readline(environment*);
154  extern void sx_72656164(environment*);  extern void sx_72656164(environment*);
155  extern void foreach(environment*);  extern void foreach(environment*);
156  void protect(environment*, value*);  void protect(value*);
157  void unprotect(environment*);  void unprotect(value*);
158  extern void copying(environment *env);  extern void copying(environment*);
159  extern void warranty(environment *env);  extern void warranty(environment*);
160    extern void sx_2a(environment*);
161    extern void sx_2f(environment*);
162    extern void mod(environment*);
163    extern void sx_3c(environment*);
164    extern void sx_3c3d(environment*);
165    extern void sx_3e3d(environment*);
166    extern void sx_646976(environment*);

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.12

root@recompile.se
ViewVC Help
Powered by ViewVC 1.1.26