3 #ifndef _SCHEME_PRIVATE_H
4 #define _SCHEME_PRIVATE_H
7 /*------------------ Ugly internals -----------------------------------*/
8 /*------------------ Of interest only to FFI users --------------------*/
11 enum scheme_port_kind
{
53 /* arrays for segments */
61 #define CELL_SEGSIZE 5000 /* # of cells in one segment */
62 #define CELL_NSEGMENT 10 /* # of segments for cells */
63 char *alloc_seg
[CELL_NSEGMENT
];
64 pointer cell_seg
[CELL_NSEGMENT
];
67 /* We use 4 registers. */
68 pointer args
; /* register for arguments of function */
69 pointer envir
; /* stack register for current environment */
70 pointer code
; /* register for current code */
71 pointer dump
; /* stack register for next evaluation */
73 int interactive_repl
; /* are we in an interactive REPL? */
76 pointer sink
; /* when mem. alloc. fails */
78 pointer NIL
; /* special cell representing empty cell */
80 pointer T
; /* special cell representing #t */
82 pointer F
; /* special cell representing #f */
84 pointer EOF_OBJ
; /* special cell representing end-of-file object */
85 pointer oblist
; /* pointer to symbol table */
86 pointer global_env
; /* pointer to global environment */
88 /* global pointers to special symbols */
89 pointer LAMBDA
; /* pointer to syntax lambda */
90 pointer QUOTE
; /* pointer to syntax quote */
92 pointer QQUOTE
; /* pointer to symbol quasiquote */
93 pointer UNQUOTE
; /* pointer to symbol unquote */
94 pointer UNQUOTESP
; /* pointer to symbol unquote-splicing */
95 pointer FEED_TO
; /* => */
96 pointer COLON_HOOK
; /* *colon-hook* */
97 pointer ERROR_HOOK
; /* *error-hook* */
98 pointer SHARP_HOOK
; /* *sharp-hook* */
100 pointer free_cell
; /* pointer to top of free cells */
101 long fcells
; /* # of free cells */
109 port load_stack
[MAXFIL
]; /* Stack of open files for port -1 (LOADing) */
110 int nesting_stack
[MAXFIL
];
114 char gc_verbose
; /* if gc_verbose is not zero, print gc status */
115 char no_memory
; /* Whether mem. alloc. has failed */
117 #define LINESIZE 1024
118 char linebuff
[LINESIZE
];
127 void *ext_data
; /* For the benefit of foreign functions */
130 struct scheme_interface
*vptr
;
131 void *dump_base
; /* pointer to base of allocated dump stack */
132 int dump_size
; /* number of frames allocated for dump stack */
136 enum scheme_opcodes
{
137 #define _OP_DEF(A,B,C,D,E,OP) OP,
138 #include "opdefines.h"
143 #define cons(sc,a,b) _cons(sc,a,b,0)
144 #define immutable_cons(sc,a,b) _cons(sc,a,b,1)
146 int is_string(pointer p
);
147 char *string_value(pointer p
);
148 int is_number(pointer p
);
149 num
nvalue(pointer p
);
150 long ivalue(pointer p
);
151 double rvalue(pointer p
);
152 int is_integer(pointer p
);
153 int is_real(pointer p
);
154 int is_character(pointer p
);
155 long charvalue(pointer p
);
156 int is_vector(pointer p
);
158 int is_port(pointer p
);
160 int is_pair(pointer p
);
161 pointer
pair_car(pointer p
);
162 pointer
pair_cdr(pointer p
);
163 pointer
set_car(pointer p
, pointer q
);
164 pointer
set_cdr(pointer p
, pointer q
);
166 int is_symbol(pointer p
);
167 char *symname(pointer p
);
168 int hasprop(pointer p
);
170 int is_syntax(pointer p
);
171 int is_proc(pointer p
);
172 int is_foreign(pointer p
);
173 char *syntaxname(pointer p
);
174 int is_closure(pointer p
);
176 int is_macro(pointer p
);
178 pointer
closure_code(pointer p
);
179 pointer
closure_env(pointer p
);
181 int is_continuation(pointer p
);
182 int is_promise(pointer p
);
183 int is_environment(pointer p
);
184 int is_immutable(pointer p
);
185 void setimmutable(pointer p
);