2
/* Scheme In One Defun, but in C this time.
4
* COPYRIGHT (c) 1988-1994 BY *
5
* PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. *
6
* See the source file SLIB.C for more information. *
8
$Id: siod.h,v 1.3 1999/09/23 23:42:37 yosh Exp $
42
struct obj *(*f) (void);
48
struct obj *(*f) (struct obj *);
54
struct obj *(*f) (struct obj *, struct obj *);
60
struct obj *(*f) (struct obj *, struct obj *, struct obj *);
66
struct obj *(*f) (struct obj *, struct obj *, struct obj *,
73
struct obj *(*f) (struct obj *, struct obj *, struct obj *,
74
struct obj *, struct obj *);
80
struct obj *(*f) (struct obj **, struct obj **);
86
struct obj *(*f) (void *,...);
129
#define CAR(x) ((*x).storage_as.cons.car)
130
#define CDR(x) ((*x).storage_as.cons.cdr)
131
#define PNAME(x) ((*x).storage_as.symbol.pname)
132
#define VCELL(x) ((*x).storage_as.symbol.vcell)
133
#define SUBR0(x) (*((*x).storage_as.subr0.f))
134
#define SUBR1(x) (*((*x).storage_as.subr1.f))
135
#define SUBR2(x) (*((*x).storage_as.subr2.f))
136
#define SUBR3(x) (*((*x).storage_as.subr3.f))
137
#define SUBR4(x) (*((*x).storage_as.subr4.f))
138
#define SUBR5(x) (*((*x).storage_as.subr5.f))
139
#define SUBRM(x) (*((*x).storage_as.subrm.f))
140
#define SUBRF(x) (*((*x).storage_as.subr.f))
141
#define FLONM(x) ((*x).storage_as.flonum.data)
143
#define NIL ((struct obj *) 0)
144
#define EQ(x,y) ((x) == (y))
145
#define NEQ(x,y) ((x) != (y))
146
#define NULLP(x) EQ(x,NIL)
147
#define NNULLP(x) NEQ(x,NIL)
149
#define TYPE(x) (((x) == NIL) ? 0 : ((*(x)).type))
151
#define TYPEP(x,y) (TYPE(x) == (y))
152
#define NTYPEP(x,y) (TYPE(x) != (y))
165
#define tc_closure 11
166
#define tc_free_cell 12
168
#define tc_double_array 14
169
#define tc_long_array 15
170
#define tc_lisp_array 16
172
#define tc_byte_array 18
175
#define tc_subr_2n 21
176
#define FO_comment 35
177
#define tc_user_min 50
178
#define tc_user_max 100
185
#define tc_table_dim 100
187
typedef struct obj *LISP;
188
typedef LISP (*SUBR_FUNC) (void);
190
#define CONSP(x) TYPEP(x,tc_cons)
191
#define FLONUMP(x) TYPEP(x,tc_flonum)
192
#define SYMBOLP(x) TYPEP(x,tc_symbol)
194
#define NCONSP(x) NTYPEP(x,tc_cons)
195
#define NFLONUMP(x) NTYPEP(x,tc_flonum)
196
#define NSYMBOLP(x) NTYPEP(x,tc_symbol)
198
#define TKBUFFERN 5120
202
int (*getc_fcn) (void *);
203
void (*ungetc_fcn) (int, void *);
209
int (*putc_fcn) (int, void *);
210
int (*puts_fcn) (char *, void *);
214
#define GETC_FCN(x) (*((*x).getc_fcn))((*x).cb_argument)
215
#define UNGETC_FCN(c,x) (*((*x).ungetc_fcn))(c,(*x).cb_argument)
216
#define PUTC_FCN(c,x) (*((*x).putc_fcn))(c,(*x).cb_argument)
217
#define PUTS_FCN(c,x) (*((*x).puts_fcn))(c,(*x).cb_argument)
221
void (*repl_puts) (char *);
222
LISP (*repl_read) (void);
223
LISP (*repl_eval) (LISP);
224
void (*repl_print) (LISP);
227
void process_cla (int argc, char **argv, int warnflag);
228
void print_welcome (void);
229
void print_hs_1 (void);
230
void print_hs_2 (void);
231
long no_interrupt (long n);
232
LISP get_eof_val (void);
233
long repl_driver (long want_sigint, long want_init, struct repl_hooks *);
234
void set_repl_hooks (void (*puts_f) (char *),
235
LISP (*read_f) (void),
236
LISP (*eval_f) (LISP),
237
void (*print_f) (LISP));
238
long repl (struct repl_hooks *);
239
LISP my_err (char *message, LISP x);
240
LISP errswitch (void);
241
char *get_c_string (LISP x);
242
char *get_c_string_dim (LISP x, long *);
243
char *try_get_c_string (LISP x);
244
long get_c_long (LISP x);
245
double get_c_double (LISP x);
246
LISP lerr (LISP message, LISP x);
248
LISP newcell (long type);
249
LISP cons (LISP x, LISP y);
253
LISP setcar (LISP cell, LISP value);
254
LISP setcdr (LISP cell, LISP value);
255
LISP flocons (double x);
256
LISP numberp (LISP x);
257
LISP plus (LISP x, LISP y);
258
LISP ltimes (LISP x, LISP y);
259
LISP difference (LISP x, LISP y);
260
LISP Quotient (LISP x, LISP y);
261
LISP greaterp (LISP x, LISP y);
262
LISP lessp (LISP x, LISP y);
263
LISP eq (LISP x, LISP y);
264
LISP eql (LISP x, LISP y);
265
LISP symcons (char *pname, LISP vcell);
266
LISP symbolp (LISP x);
267
LISP symbol_boundp (LISP x, LISP env);
268
LISP symbol_value (LISP x, LISP env);
269
LISP cintern (char *name);
270
LISP rintern (char *name);
271
LISP subrcons (long type, char *name, SUBR_FUNC f);
272
LISP closure (LISP env, LISP code);
273
void gc_protect (LISP * location);
274
void gc_protect_n (LISP * location, long n);
275
void gc_protect_sym (LISP * location, char *st);
276
void gc_unprotect (LISP * location);
278
void init_storage (void);
279
void init_slibu (void);
281
void init_subr (char *name, long type, SUBR_FUNC fcn);
282
void init_subr_0 (char *name, LISP (*fcn) (void));
283
void init_subr_1 (char *name, LISP (*fcn) (LISP));
284
void init_subr_2 (char *name, LISP (*fcn) (LISP, LISP));
285
void init_subr_2n (char *name, LISP (*fcn) (LISP, LISP));
286
void init_subr_3 (char *name, LISP (*fcn) (LISP, LISP, LISP));
287
void init_subr_4 (char *name, LISP (*fcn) (LISP, LISP, LISP, LISP));
288
void init_subr_5 (char *name, LISP (*fcn) (LISP, LISP, LISP, LISP, LISP));
289
void init_lsubr (char *name, LISP (*fcn) (LISP));
290
void init_fsubr (char *name, LISP (*fcn) (LISP, LISP));
291
void init_msubr (char *name, LISP (*fcn) (LISP *, LISP *));
293
LISP assq (LISP x, LISP alist);
294
LISP delq (LISP elem, LISP l);
295
void set_gc_hooks (long type,
301
LISP gc_relocate (LISP x);
302
LISP user_gc (LISP args);
303
LISP gc_status (LISP args);
304
void set_eval_hooks (long type, LISP (*fcn) (LISP, LISP *, LISP *));
305
LISP leval (LISP x, LISP env);
306
LISP symbolconc (LISP args);
307
void set_print_hooks (long type, void (*fcn) (LISP, struct gen_printio *));
308
LISP lprin1g (LISP exp, struct gen_printio *f);
309
LISP lprin1f (LISP exp, FILE * f);
310
LISP lprint (LISP exp, LISP);
312
LISP lreadtk (char *, long j);
313
LISP lreadf (FILE * f);
314
void set_read_hooks (char *all_set, char *end_set,
315
LISP (*fcn1) (int, struct gen_readio *),
316
LISP (*fcn2) (char *, long, int *));
318
LISP vload (char *fname, long cflag, long rflag);
319
LISP load (LISP fname, LISP cflag, LISP rflag);
320
LISP require (LISP fname);
321
LISP save_forms (LISP fname, LISP forms, LISP how);
324
LISP strcons (long length, char *data);
325
LISP read_from_string (LISP x);
326
LISP aref1 (LISP a, LISP i);
327
LISP aset1 (LISP a, LISP i, LISP v);
328
LISP cons_array (LISP dim, LISP kind);
329
LISP arcons (long typecode, long n, long initp);
330
LISP string_append (LISP args);
331
LISP string_length (LISP string);
332
LISP string_search (LISP, LISP);
333
LISP substring (LISP, LISP, LISP);
334
LISP string_trim (LISP);
335
LISP string_trim_left (LISP);
336
LISP string_trim_right (LISP);
337
LISP string_upcase (LISP);
338
LISP string_downcase (LISP);
339
void init_subrs (void);
340
LISP copy_list (LISP);
341
long c_sxhash (LISP, long);
342
LISP sxhash (LISP, LISP);
343
LISP href (LISP, LISP);
344
LISP hset (LISP, LISP, LISP);
345
LISP fast_print (LISP, LISP);
346
LISP fast_read (LISP);
347
LISP equal (LISP, LISP);
348
LISP assoc (LISP x, LISP alist);
349
LISP make_list (LISP x, LISP v);
350
void set_fatal_exit_hook (void (*fcn) (void));
351
LISP parse_number (LISP x);
352
LISP intern (LISP x);
353
void init_trace (void);
354
long repl_c_string (char *, long want_sigint, long want_init, long want_print);
355
char *siod_version (void);
356
LISP nreverse (LISP);
357
LISP number2string (LISP, LISP, LISP, LISP);
358
LISP string2number (LISP, LISP);
359
LISP siod_verbose (LISP);
360
int siod_verbose_check (int);
361
LISP setvar (LISP, LISP, LISP);
362
long allocate_user_tc (void);
374
void chk_string (LISP, char **, long *);
375
LISP a_true_value (void);
376
LISP lapply (LISP fcn, LISP args);
377
LISP mallocl (void *lplace, long size);
378
void gput_st (struct gen_printio *, char *);
379
void put_st (char *st);
380
LISP listn (long n,...);
381
char *must_malloc (unsigned long size);
382
LISP lstrbreakup (LISP str, LISP lmarker);
383
LISP lstrunbreakup (LISP elems, LISP lmarker);
384
LISP nconc (LISP, LISP);
385
LISP poparg (LISP *, LISP);
386
FILE *get_c_file (LISP p, FILE * deflt);
387
char *last_c_errmsg (int);
388
LISP llast_c_errmsg (int);
390
#define SAFE_STRCPY(_to,_from) safe_strcpy((_to),sizeof(_to),(_from))
391
#define SAFE_STRCAT(_to,_from) safe_strcat((_to),sizeof(_to),(_from))
392
#define SAFE_STRLEN(_buff) safe_strlen((_buff),sizeof(_buff))
394
char *safe_strcpy (char *s1, size_t size1, const char *s2);
395
char *safe_strcat (char *s1, size_t size1, const char *s2);
397
size_t safe_strlen (const char *s, size_t size);
398
LISP memq (LISP x, LISP il);
399
LISP lstrbreakup (LISP, LISP);
400
LISP lstrbreakup (LISP, LISP);
401
LISP nth (LISP, LISP);
404
LISP readtl (struct gen_readio *f);
405
LISP funcall1 (LISP, LISP);
406
LISP funcall2 (LISP, LISP, LISP);
407
LISP apply1 (LISP, LISP, LISP);
409
LISP lungetc (LISP i, LISP p);
410
LISP lputc (LISP c, LISP p);
411
LISP lputs (LISP str, LISP p);
413
int assemble_options (LISP,...);
414
LISP ccall_catch (LISP tag, LISP (*fcn) (void *), void *);
415
LISP lref_default (LISP li, LISP x, LISP fcn);
418
LISP symalist (char *item,...);
420
LISP encode_st_mode (LISP l);
421
LISP encode_open_flags (LISP l);
424
#endif /* __SIOD_H__ */