3 /** \file scheme-private.h
4 \brief Private data for the TinyScheme compiler
8 #ifndef _SCHEME_PRIVATE_H
9 #define _SCHEME_PRIVATE_H
13 enum scheme_port_kind
{
55 /* arrays for segments */
63 #define CELL_SEGSIZE 5000 /* # of cells in one segment */
64 #define CELL_NSEGMENT 10 /* # of segments for cells */
65 char *alloc_seg
[CELL_NSEGMENT
];
66 pointer cell_seg
[CELL_NSEGMENT
];
69 /* We use 4 registers. */
70 pointer args
; /* register for arguments of function */
71 pointer envir
; /* stack register for current environment */
72 pointer code
; /* register for current code */
73 pointer dump
; /* stack register for next evaluation */
75 int interactive_repl
; /* are we in an interactive REPL? */
78 pointer sink
; /* when mem. alloc. fails */
80 pointer NIL
; /* special cell representing empty cell */
82 pointer T
; /* special cell representing #t */
84 pointer F
; /* special cell representing #f */
86 pointer EOF_OBJ
; /* special cell representing end-of-file object */
87 pointer oblist
; /* pointer to symbol table */
88 pointer global_env
; /* pointer to global environment */
90 /* global pointers to special symbols */
91 pointer LAMBDA
; /* pointer to syntax lambda */
92 pointer QUOTE
; /* pointer to syntax quote */
94 pointer QQUOTE
; /* pointer to symbol quasiquote */
95 pointer UNQUOTE
; /* pointer to symbol unquote */
96 pointer UNQUOTESP
; /* pointer to symbol unquote-splicing */
97 pointer FEED_TO
; /* => */
98 pointer COLON_HOOK
; /* *colon-hook* */
99 pointer ERROR_HOOK
; /* *error-hook* */
100 pointer SHARP_HOOK
; /* *sharp-hook* */
102 pointer free_cell
; /* pointer to top of free cells */
103 long fcells
; /* # of free cells */
111 port load_stack
[MAXFIL
]; /* Stack of open files for port -1 (LOADing) */
112 int nesting_stack
[MAXFIL
];
116 char gc_verbose
; /* if gc_verbose is not zero, print gc status */
117 char no_memory
; /* Whether mem. alloc. has failed */
119 #define LINESIZE 1024
120 char linebuff
[LINESIZE
];
129 void *ext_data
; /* For the benefit of foreign functions */
132 struct scheme_interface
*vptr
;
133 void *dump_base
; /* pointer to base of allocated dump stack */
134 int dump_size
; /* number of frames allocated for dump stack */
138 enum scheme_opcodes
{
139 #define _OP_DEF(A,B,C,D,E,OP) OP,
140 #include "opdefines.h"
145 #define cons(sc,a,b) _cons(sc,a,b,0)
146 #define immutable_cons(sc,a,b) _cons(sc,a,b,1)
148 int is_string(pointer p
);
149 char *string_value(pointer p
);
150 int is_number(pointer p
);
151 num
nvalue(pointer p
);
152 long ivalue(pointer p
);
153 double rvalue(pointer p
);
154 int is_integer(pointer p
);
155 int is_real(pointer p
);
156 int is_character(pointer p
);
157 long charvalue(pointer p
);
158 int is_vector(pointer p
);
160 int is_port(pointer p
);
162 int is_pair(pointer p
);
163 pointer
pair_car(pointer p
);
164 pointer
pair_cdr(pointer p
);
165 pointer
set_car(pointer p
, pointer q
);
166 pointer
set_cdr(pointer p
, pointer q
);
168 int is_symbol(pointer p
);
169 char *symname(pointer p
);
170 int hasprop(pointer p
);
172 int is_syntax(pointer p
);
173 int is_proc(pointer p
);
174 int is_foreign(pointer p
);
175 char *syntaxname(pointer p
);
176 int is_closure(pointer p
);
178 int is_macro(pointer p
);
180 pointer
closure_code(pointer p
);
181 pointer
closure_env(pointer p
);
183 int is_continuation(pointer p
);
184 int is_promise(pointer p
);
185 int is_environment(pointer p
);
186 int is_immutable(pointer p
);
187 void setimmutable(pointer p
);