-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbase_decls.h
209 lines (134 loc) · 5.12 KB
/
base_decls.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
typedef char * charptr;
typedef void * voidptr;
typedef voidptr * voidptrptr;
typedef FILE * FILEptr;
typedef struct pliststruct{
void * key;
struct expstruct * data;
struct pliststruct * rest;
}pliststruct,*plist;
typedef struct expstruct{
plist data;
void * extension;
char constructor;
struct expstruct * arg1;
struct expstruct * arg2;
}expstruct,*expptr;
/** ========================================================================
errors and breaks
========================================================================**/
void breakpt(charptr s);
void berror(charptr s);
/** ========================================================================
the catch and throw data structures must be visible to dynamically linked procedures.
======================================================================== **/
int catch_freeptr[1];
jmp_buf catch_stack[CATCH_DIM];
/** ========================================================================
interning (procedures called by the expansion of backquote)
and destructuring pro
========================================================================**/
expptr string_atom(char * s);
int atomp(expptr e);
charptr atom_string(expptr a);
charptr exp_string(expptr e);
expptr cons(expptr x, expptr y);
int cellp(expptr e);
expptr car(expptr x);
expptr stack_cons(expptr x, expptr y);
expptr cdr(expptr x);
expptr intern_paren(char openchar, expptr arg);
int parenp(expptr e);
expptr paren_inside(expptr e);
char constructor(expptr e);
/** ========================================================================
case
Case needs constructor, arg1, and arg2 which are all preprocessor inlines.
It also uses case_error
========================================================================**/
void match_failure(expptr topexp, expptr patterns);
/** ========================================================================
properties of expressions
========================================================================**/
voidptr getprop(expptr e, expptr key, expptr defaultval);
void setprop(expptr e, expptr key, void * val);
int getprop_int(expptr e, expptr key, int defaultval);
void setprop_int (expptr e, void * key, int val);
/** ========================================================================
conversions
========================================================================**/
expptr int_exp(int i);
int exp_int(expptr s);
expptr pointer_exp(void* p);
/** ========================================================================
gensym
========================================================================**/
expptr gensym(expptr sym);
/** ========================================================================
reading and printing
========================================================================**/
void pprint(expptr e, FILEptr f, int i);
/** ========================================================================
macros
========================================================================**/
expptr top_atom(expptr e);
void set_macro(expptr sym, expptr f(expptr));
expptr macroexpand(expptr e);
expptr macroexpand1(expptr e);
int symbolp(expptr e);
/** ========================================================================
cons and nil
========================================================================**/
expptr append(expptr l1, expptr l2);
int member(expptr x, expptr l);
expptr reverse(expptr l);
typedef expptr exp_to_exp(expptr);
typedef void exp_to_void(expptr);
expptr mapcar(exp_to_exp f, expptr l);
void mapc(exp_to_void f, expptr l);
int length(expptr l);
/** ========================================================================
undo frames
========================================================================**/
voidptr undo_alloc(int size);
void undo_set_proc(void ** loc, void * val);
void undo_set_int_proc(int * loc, int val);
void add_undone_int(int * loc);
void add_undone_pointer(voidptr * loc);
void push_undo_frame();
void pop_undo_frame();
void clear_undo_frame();
void restart_undo_frame(int n);
expptr clean_undo_frame(expptr e);
/** ========================================================================
stack frames
========================================================================**/
voidptrptr stack;
void push_memory_frame();
void pop_memory_frame();
voidptr stack_alloc(int size);
/** ========================================================================
misc.
========================================================================**/
expptr file_expressions(char *name);
expptr read_from_ide();
void send_print_tag();
void send_result(char* result);
int in_ide_proc();
FILEptr read_stream_proc();
void mcpprint(expptr e);
expptr expptr_to_undo(expptr stack_exp);
expptr expptr_to_stack(expptr exp);
void add_init_form(expptr form);
void add_preamble(expptr form);
void add_form(expptr form);
int occurs_in(expptr symbol, expptr exp);
int catch_freeptr[1];
jmp_buf catch_stack[CATCH_DIM];
expptr catch_name[1];
expptr catch_type[1];
voidptr catch_val[1];
char undo_heap[UNDO_HEAP_DIM];
void declare_except_fun(expptr name, expptr argtype);
void throw_primitive();
voidptr undo_freeptr();