tinyscheme_genesi... 1
tinyscheme_genesi... 2
tinyscheme_genesi... 3 #ifndef _SCHEME_PRIVATE_H
tinyscheme_genesi... 4 #define _SCHEME_PRIVATE_H
tinyscheme_genesi... 5
tinyscheme_genesi... 6 #include "scheme.h"
tinyscheme_genesi... 7
tinyscheme_genesi... 8
tinyscheme_genesi... 9
tinyscheme_genesi... 10 #ifdef __cplusplus
tinyscheme_genesi... 11 extern "C" {
tinyscheme_genesi... 12 #endif
tinyscheme_genesi... 13
tinyscheme_genesi... 14 enum scheme_port_kind {
tinyscheme_genesi... 15 port_free=0,
tinyscheme_genesi... 16 port_file=1,
tinyscheme_genesi... 17 port_string=2,
tinyscheme_genesi... 18 port_srfi6=4,
tinyscheme_genesi... 19 port_input=16,
tinyscheme_genesi... 20 port_output=32,
tinyscheme_genesi... 21 port_saw_EOF=64
tinyscheme_genesi... 22 };
tinyscheme_genesi... 23
tinyscheme_genesi... 24 typedef struct port {
tinyscheme_genesi... 25 unsigned char kind;
tinyscheme_genesi... 26 union {
tinyscheme_genesi... 27 struct {
tinyscheme_genesi... 28 FILE *file;
tinyscheme_genesi... 29 int closeit;
tinyscheme_genesi... 30 #if SHOW_ERROR_LINE
tinyscheme_genesi... 31 int curr_line;
tinyscheme_genesi... 32 char *filename;
tinyscheme_genesi... 33 #endif
tinyscheme_genesi... 34 } stdio;
tinyscheme_genesi... 35 struct {
tinyscheme_genesi... 36 char *start;
tinyscheme_genesi... 37 char *past_the_end;
tinyscheme_genesi... 38 char *curr;
tinyscheme_genesi... 39 } string;
tinyscheme_genesi... 40 } rep;
tinyscheme_genesi... 41 } port;
tinyscheme_genesi... 42
tinyscheme_genesi... 43
tinyscheme_genesi... 44 struct cell {
tinyscheme_genesi... 45 unsigned int _flag;
tinyscheme_genesi... 46 union {
tinyscheme_genesi... 47 struct {
tinyscheme_genesi... 48 char *_svalue;
tinyscheme_genesi... 49 int _length;
tinyscheme_genesi... 50 } _string;
tinyscheme_genesi... 51 num _number;
tinyscheme_genesi... 52 port *_port;
tinyscheme_genesi... 53 foreign_func _ff;
tinyscheme_genesi... 54 struct {
tinyscheme_genesi... 55 struct cell *_car;
tinyscheme_genesi... 56 struct cell *_cdr;
tinyscheme_genesi... 57 } _cons;
tinyscheme_genesi... 58 } _object;
tinyscheme_genesi... 59 };
tinyscheme_genesi... 60
tinyscheme_genesi... 61 struct scheme {
tinyscheme_genesi... 62
tinyscheme_genesi... 63 func_alloc malloc;
tinyscheme_genesi... 64 func_dealloc free;
tinyscheme_genesi... 65
tinyscheme_genesi... 66
tinyscheme_genesi... 67 int retcode;
tinyscheme_genesi... 68 int tracing;
tinyscheme_genesi... 69
tinyscheme_genesi... 70
tinyscheme_genesi... 71 #define CELL_SEGSIZE 5000 /* # of cells in one segment */
tinyscheme_genesi... 72 #define CELL_NSEGMENT 10 /* # of segments for cells */
tinyscheme_genesi... 73 char *alloc_seg[CELL_NSEGMENT];
tinyscheme_genesi... 74 pointer cell_seg[CELL_NSEGMENT];
tinyscheme_genesi... 75 int last_cell_seg;
tinyscheme_genesi... 76
tinyscheme_genesi... 77
tinyscheme_genesi... 78 pointer args;
tinyscheme_genesi... 79 pointer envir;
tinyscheme_genesi... 80 pointer code;
tinyscheme_genesi... 81 pointer dump;
tinyscheme_genesi... 82
tinyscheme_genesi... 83 int interactive_repl;
tinyscheme_genesi... 84
tinyscheme_genesi... 85 struct cell _sink;
tinyscheme_genesi... 86 pointer sink;
tinyscheme_genesi... 87 struct cell _NIL;
tinyscheme_genesi... 88 pointer NIL;
tinyscheme_genesi... 89 struct cell _HASHT;
tinyscheme_genesi... 90 pointer T;
tinyscheme_genesi... 91 struct cell _HASHF;
tinyscheme_genesi... 92 pointer F;
tinyscheme_genesi... 93 struct cell _EOF_OBJ;
tinyscheme_genesi... 94 pointer EOF_OBJ;
tinyscheme_genesi... 95 pointer oblist;
tinyscheme_genesi... 96 pointer global_env;
tinyscheme_genesi... 97 pointer c_nest;
tinyscheme_genesi... 98
tinyscheme_genesi... 99
tinyscheme_genesi... 100 pointer LAMBDA;
tinyscheme_genesi... 101 pointer QUOTE;
tinyscheme_genesi... 102
tinyscheme_genesi... 103 pointer QQUOTE;
tinyscheme_genesi... 104 pointer UNQUOTE;
tinyscheme_genesi... 105 pointer UNQUOTESP;
tinyscheme_genesi... 106 pointer FEED_TO;
tinyscheme_genesi... 107 pointer COLON_HOOK;
tinyscheme_genesi... 108 pointer ERROR_HOOK;
tinyscheme_genesi... 109 pointer SHARP_HOOK;
tinyscheme_genesi... 110 pointer COMPILE_HOOK;
tinyscheme_genesi... 111
tinyscheme_genesi... 112 pointer free_cell;
tinyscheme_genesi... 113 long fcells;
tinyscheme_genesi... 114
tinyscheme_genesi... 115 pointer inport;
tinyscheme_genesi... 116 pointer outport;
tinyscheme_genesi... 117 pointer save_inport;
tinyscheme_genesi... 118 pointer loadport;
tinyscheme_genesi... 119
tinyscheme_genesi... 120 #define MAXFIL 64
tinyscheme_genesi... 121 port load_stack[MAXFIL];
tinyscheme_genesi... 122 int nesting_stack[MAXFIL];
tinyscheme_genesi... 123 int file_i;
tinyscheme_genesi... 124 int nesting;
tinyscheme_genesi... 125
tinyscheme_genesi... 126 char gc_verbose;
tinyscheme_genesi... 127 char no_memory;
tinyscheme_genesi... 128
tinyscheme_genesi... 129 #define LINESIZE 1024
tinyscheme_genesi... 130 char linebuff[LINESIZE];
tinyscheme_genesi... 131 #define STRBUFFSIZE 256
tinyscheme_genesi... 132 char strbuff[STRBUFFSIZE];
tinyscheme_genesi... 133
tinyscheme_genesi... 134 FILE *tmpfp;
tinyscheme_genesi... 135 int tok;
tinyscheme_genesi... 136 int print_flag;
tinyscheme_genesi... 137 pointer value;
tinyscheme_genesi... 138 int op;
tinyscheme_genesi... 139
tinyscheme_genesi... 140 void *ext_data;
tinyscheme_genesi... 141 long gensym_cnt;
tinyscheme_genesi... 142
tinyscheme_genesi... 143 struct scheme_interface *vptr;
tinyscheme_genesi... 144 void *dump_base;
tinyscheme_genesi... 145 int dump_size;
tinyscheme_genesi... 146 };
tinyscheme_genesi... 147
tinyscheme_genesi... 148
tinyscheme_genesi... 149 enum scheme_opcodes {
tinyscheme_genesi... 150 #define _OP_DEF(A,B,C,D,E,OP) OP,
tinyscheme_genesi... 151 #include "opdefines.h"
tinyscheme_genesi... 152 OP_MAXDEFINED
tinyscheme_genesi... 153 };
tinyscheme_genesi... 154
tinyscheme_genesi... 155
tinyscheme_genesi... 156 #define cons(sc,a,b) _cons(sc,a,b,0)
tinyscheme_genesi... 157 #define immutable_cons(sc,a,b) _cons(sc,a,b,1)
tinyscheme_genesi... 158
tinyscheme_genesi... 159 int is_string(pointer p);
tinyscheme_genesi... 160 char *string_value(pointer p);
tinyscheme_genesi... 161 int is_number(pointer p);
tinyscheme_genesi... 162 num nvalue(pointer p);
tinyscheme_genesi... 163 long ivalue(pointer p);
tinyscheme_genesi... 164 double rvalue(pointer p);
tinyscheme_genesi... 165 int is_integer(pointer p);
tinyscheme_genesi... 166 int is_real(pointer p);
tinyscheme_genesi... 167 int is_character(pointer p);
tinyscheme_genesi... 168 long charvalue(pointer p);
tinyscheme_genesi... 169 int is_vector(pointer p);
tinyscheme_genesi... 170
tinyscheme_genesi... 171 int is_port(pointer p);
tinyscheme_genesi... 172
tinyscheme_genesi... 173 int is_pair(pointer p);
tinyscheme_genesi... 174 pointer pair_car(pointer p);
tinyscheme_genesi... 175 pointer pair_cdr(pointer p);
tinyscheme_genesi... 176 pointer set_car(pointer p, pointer q);
tinyscheme_genesi... 177 pointer set_cdr(pointer p, pointer q);
tinyscheme_genesi... 178
tinyscheme_genesi... 179 int is_symbol(pointer p);
tinyscheme_genesi... 180 char *symname(pointer p);
tinyscheme_genesi... 181 int hasprop(pointer p);
tinyscheme_genesi... 182
tinyscheme_genesi... 183 int is_syntax(pointer p);
tinyscheme_genesi... 184 int is_proc(pointer p);
tinyscheme_genesi... 185 int is_foreign(pointer p);
tinyscheme_genesi... 186 char *syntaxname(pointer p);
tinyscheme_genesi... 187 int is_closure(pointer p);
tinyscheme_genesi... 188 #ifdef USE_MACRO
tinyscheme_genesi... 189 int is_macro(pointer p);
tinyscheme_genesi... 190 #endif
tinyscheme_genesi... 191 pointer closure_code(pointer p);
tinyscheme_genesi... 192 pointer closure_env(pointer p);
tinyscheme_genesi... 193
tinyscheme_genesi... 194 int is_continuation(pointer p);
tinyscheme_genesi... 195 int is_promise(pointer p);
tinyscheme_genesi... 196 int is_environment(pointer p);
tinyscheme_genesi... 197 int is_immutable(pointer p);
tinyscheme_genesi... 198 void setimmutable(pointer p);
tinyscheme_genesi... 199
tinyscheme_genesi... 200 #ifdef __cplusplus
tinyscheme_genesi... 201 }
tinyscheme_genesi... 202 #endif
tinyscheme_genesi... 203
tinyscheme_genesi... 204 #endif
tinyscheme_genesi... 205
tinyscheme_genesi... 206
tinyscheme_genesi... 207 Local variables:
tinyscheme_genesi... 208 c-file-style: "k&r"
tinyscheme_genesi... 209 End:
tinyscheme_genesi... 210 */