… | |
… | |
61 | { |
61 | { |
62 | union |
62 | union |
63 | { |
63 | { |
64 | struct |
64 | struct |
65 | { |
65 | { |
66 | char *svalue; |
66 | uint8_t *svalue; |
67 | uint32_t length; |
67 | uint32_t length; |
68 | } string; |
68 | } string; |
69 | |
69 | |
70 | struct { |
70 | struct { |
71 | struct cell **vvalue; |
71 | struct cell **vvalue; |
72 | uint32_t length; |
72 | uint32_t length; |
73 | } vector; |
73 | } vector; |
74 | |
74 | |
75 | num number; |
75 | intptr_t ivalue; |
|
|
76 | #if USE_REAL |
|
|
77 | double rvalue; |
|
|
78 | #endif |
76 | |
79 | |
77 | port *port; |
80 | port *port; |
78 | |
81 | |
79 | foreign_func ff; |
82 | foreign_func ff; |
80 | |
83 | |
… | |
… | |
109 | /* arrays for segments */ |
112 | /* arrays for segments */ |
110 | #ifndef CELL_SEGSIZE |
113 | #ifndef CELL_SEGSIZE |
111 | # define CELL_SEGSIZE 128 /* # of cells in one segment */ |
114 | # define CELL_SEGSIZE 128 /* # of cells in one segment */ |
112 | #endif |
115 | #endif |
113 | #ifndef CELL_NSEGMENT |
116 | #ifndef CELL_NSEGMENT |
114 | # define CELL_NSEGMENT 10 /* # of segments for cells */ |
117 | # define CELL_NSEGMENT 20 /* # of segments for cells */ |
115 | #endif |
118 | #endif |
116 | char *alloc_seg[CELL_NSEGMENT]; |
119 | char *alloc_seg[CELL_NSEGMENT]; |
117 | pointer cell_seg[CELL_NSEGMENT]; |
120 | pointer cell_seg[CELL_NSEGMENT]; |
118 | int cell_segsize[CELL_NSEGMENT]; |
121 | int cell_segsize[CELL_NSEGMENT]; |
119 | int last_cell_seg; |
122 | int last_cell_seg; |
… | |
… | |
147 | pointer inport; |
150 | pointer inport; |
148 | pointer outport; |
151 | pointer outport; |
149 | pointer save_inport; |
152 | pointer save_inport; |
150 | pointer loadport; |
153 | pointer loadport; |
151 | |
154 | |
152 | # define MAXFIL 64 |
155 | #define MAXFIL 8 |
153 | port load_stack[MAXFIL]; /* Stack of open files for port -1 (LOADing) */ |
156 | port load_stack[MAXFIL]; /* Stack of open files for port -1 (LOADing) */ |
154 | int nesting_stack[MAXFIL]; |
157 | int nesting_stack[MAXFIL]; |
155 | int file_i; |
158 | int file_i; |
156 | int nesting; |
159 | int nesting; |
157 | |
160 | |
158 | char gc_verbose; /* if gc_verbose is not zero, print gc status */ |
161 | char gc_verbose; /* if gc_verbose is not zero, print gc status */ |
159 | char no_memory; /* Whether mem. alloc. has failed */ |
162 | char no_memory; /* Whether mem. alloc. has failed */ |
160 | |
163 | |
161 | # define LINESIZE 1024 |
164 | #define LINESIZE 1024 |
162 | char linebuff[LINESIZE]; |
165 | char linebuff[LINESIZE]; |
163 | # define STRBUFFSIZE 256 |
166 | #define STRBUFFSIZE 256 |
164 | char strbuff[STRBUFFSIZE]; |
167 | char strbuff[STRBUFFSIZE]; |
165 | |
168 | |
166 | int tmpfp; |
169 | int tmpfp; |
167 | int tok; |
170 | int tok; |
168 | int print_flag; |
171 | int print_flag; |
… | |
… | |
170 | int op; |
173 | int op; |
171 | |
174 | |
172 | void *ext_data; /* For the benefit of foreign functions */ |
175 | void *ext_data; /* For the benefit of foreign functions */ |
173 | long gensym_cnt; |
176 | long gensym_cnt; |
174 | |
177 | |
|
|
178 | #if USE_INTCACHE |
|
|
179 | #define INTCACHE_MIN -10 |
|
|
180 | #define INTCACHE_MAX 32 |
|
|
181 | pointer intcache[INTCACHE_MAX - INTCACHE_MIN + 1]; |
|
|
182 | #endif |
|
|
183 | |
175 | struct scheme_interface *vptr; |
184 | struct scheme_interface *vptr; |
176 | struct dump_stack_frame *dump_base; /* pointer to base of allocated dump stack */ |
185 | struct dump_stack_frame *dump_base; /* pointer to base of allocated dump stack */ |
177 | int dump_size; /* number of frames allocated for dump stack */ |
186 | int dump_size; /* number of frames allocated for dump stack */ |
178 | }; |
187 | }; |
179 | |
188 | |
180 | /* operator code */ |
189 | /* operator code */ |
181 | enum scheme_opcodes |
190 | enum scheme_opcodes |
182 | { |
191 | { |
183 | # define OP_DEF(A,B,C,D,E,OP) OP, |
192 | #define OP_DEF(func,name,minarity,maxarity,argtest,op) op, |
184 | # include "opdefines.h" |
193 | #include "opdefines.h" |
|
|
194 | #undef OP_DEF |
185 | OP_MAXDEFINED |
195 | OP_MAXDEFINED |
186 | }; |
196 | }; |
187 | |
197 | |
|
|
198 | typedef struct num num; |
|
|
199 | |
188 | # define cons(a,b) xcons(SCHEME_A_ a,b,0) |
200 | #define cons(a,b) xcons(SCHEME_A_ a,b,0) |
189 | # define immutable_cons(a,b) xcons(SCHEME_A_ a,b,1) |
201 | #define immutable_cons(a,b) xcons(SCHEME_A_ a,b,1) |
190 | |
202 | |
191 | INTERFACE int is_string (pointer p); |
203 | INTERFACE int is_string (pointer p); |
192 | INTERFACE char *string_value (pointer p); |
204 | INTERFACE char *string_value (pointer p); |
193 | INTERFACE int is_number (pointer p); |
205 | INTERFACE int is_number (pointer p); |
194 | INTERFACE num nvalue (pointer p); |
206 | INTERFACE num nvalue (pointer p); |
195 | INTERFACE IVALUE ivalue (pointer p); |
|
|
196 | INTERFACE RVALUE rvalue (pointer p); |
|
|
197 | INTERFACE int is_integer (pointer p); |
207 | INTERFACE int is_integer (pointer p); |
198 | INTERFACE int is_real (pointer p); |
208 | INTERFACE int is_real (pointer p); |
199 | INTERFACE int is_character (pointer p); |
209 | INTERFACE int is_character (pointer p); |
200 | INTERFACE long charvalue (pointer p); |
210 | INTERFACE long charvalue (pointer p); |
201 | INTERFACE int is_vector (pointer p); |
211 | INTERFACE int is_vector (pointer p); |
… | |
… | |
215 | INTERFACE int is_syntax (pointer p); |
225 | INTERFACE int is_syntax (pointer p); |
216 | INTERFACE int is_proc (pointer p); |
226 | INTERFACE int is_proc (pointer p); |
217 | INTERFACE int is_foreign (pointer p); |
227 | INTERFACE int is_foreign (pointer p); |
218 | INTERFACE char *syntaxname (pointer p); |
228 | INTERFACE char *syntaxname (pointer p); |
219 | INTERFACE int is_closure (pointer p); |
229 | INTERFACE int is_closure (pointer p); |
220 | # ifdef USE_MACRO |
230 | #ifdef USE_MACRO |
221 | INTERFACE int is_macro (pointer p); |
231 | INTERFACE int is_macro (pointer p); |
222 | # endif |
232 | #endif |
223 | INTERFACE pointer closure_code (pointer p); |
233 | INTERFACE pointer closure_code (pointer p); |
224 | INTERFACE pointer closure_env (pointer p); |
234 | INTERFACE pointer closure_env (pointer p); |
225 | |
235 | |
226 | INTERFACE int is_continuation (pointer p); |
236 | INTERFACE int is_continuation (pointer p); |
227 | INTERFACE int is_promise (pointer p); |
237 | INTERFACE int is_promise (pointer p); |