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