Edinburgh Speech Tools 2.4-release
siod.h
1/* Scheme In One Defun, but in C this time.
2
3 * COPYRIGHT (c) 1988-1994 BY *
4 * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. *
5 * See the source file SLIB.C for more information. *
6
7*/
8
9/*===========================================================*/
10/* */
11/* Public LISP functions */
12/* */
13/*===========================================================*/
14#ifndef __SIOD_H__
15#define __SIOD_H__
16
17#include "EST_String.h"
18#include "EST_string_aux.h"
19#include "EST_error.h"
20#include "EST_Val.h"
21#include "siod_defs.h"
22
23int siod_init(int heap_size=DEFAULT_HEAP_SIZE);
24int siod_repl(int interactive);
25void siod_print_welcome(EST_String extra_info);
26void siod_print_welcome(void);
27
28const char *get_c_string(LISP x);
29int get_c_int(LISP x);
30double get_c_double(LISP x);
31float get_c_float(LISP x);
32LISP flocons(double x);
33FILE *get_c_file(LISP p,FILE *deflt);
34LISP siod_make_typed_cell(long type, void *s);
35LISP cintern(const char *name);
36LISP rintern(const char *name);
37LISP strintern(const char *data);
38LISP strcons(long length,const char *data);
39LISP cstrcons(const char *data);
40
41void init_subr(const char *name, long type, SUBR_FUNC fcn, const char *doc);
42void init_subr_0(const char *name, LISP (*fcn)(void), const char *doc);
43void init_subr_1(const char *name, LISP (*fcn)(LISP), const char *doc);
44void init_subr_2(const char *name, LISP (*fcn)(LISP,LISP), const char *doc);
45void init_subr_3(const char *name, LISP (*fcn)(LISP,LISP,LISP), const char *doc);
46void init_subr_4(const char *name, LISP (*fcn)(LISP,LISP,LISP,LISP), const char *doc);
47void init_lsubr(const char *name, LISP (*fcn)(LISP), const char *doc);
48void init_fsubr(const char *name, LISP (*fcn)(LISP,LISP), const char *doc);
49void init_msubr(const char *name, LISP (*fcn)(LISP *,LISP *), const char *doc);
50void setdoc(LISP name,LISP doc);
51
52int siod_register_user_type(const char *name);
53void set_gc_hooks(long type,
54 int gc_free_once,
55 LISP (*rel)(LISP),
56 LISP (*mark)(LISP),
57 void (*scan)(LISP),
58 void (*free)(LISP),
59 void (*clear)(LISP),
60 long *kind);
61void set_eval_hooks(long type,LISP (*fcn)(LISP, LISP *, LISP *));
62void set_type_hooks(long type, long (*c_sxhash)(LISP,long), LISP (*equal)(LISP,LISP));
63void set_print_hooks(long type,void (*prin1)(LISP, FILE *), void (*print_string)(LISP, char *));
64void set_io_hooks(long type, LISP (*fast_print)(LISP,LISP), LISP (*fast_read)(int,LISP));
65
66void set_fatal_exit_hook(void (*fcn)(void));
67
68extern long nointerrupt;
69extern LISP current_env;
70extern LISP truth;
71extern int audsp_mode;
72extern int siod_ctrl_c;
73extern const char *siod_prog_name;
74extern const char *siod_primary_prompt;
75extern const char *siod_secondary_prompt;
76
77void siod_reset_prompt(void);
78
79LISP siod_get_lval(const char *name,const char *message);
80LISP siod_set_lval(const char *name,LISP val);
81LISP siod_assoc_str(const char *key,LISP alist);
82LISP siod_member_str(const char *key,LISP list);
83LISP siod_regex_member_str(const EST_String &key,LISP list);
84EST_Regex &make_regex(const char *r);
85LISP siod_member_int(const int key,LISP list);
86LISP siod_nth(int nth,LISP list);
87LISP siod_last(LISP list);
88int siod_llength(LISP list);
89int siod_atomic_list(LISP list);
90LISP siod_flatten(LISP tree);
91int siod_eof(LISP item);
92EST_String siod_sprint(LISP exp);
93LISP symbol_boundp(LISP x,LISP env);
94
95LISP get_param_lisp(const char *name, LISP params, LISP defval);
96int get_param_int(const char *name, LISP params, int defval);
97float get_param_float(const char *name, LISP params, float defval);
98const char *get_param_str(const char *name, LISP params,const char *defval);
99LISP make_param_int(const char *name, int val);
100LISP make_param_float(const char *name, float val);
101LISP make_param_str(const char *name,const char *val);
102LISP make_param_lisp(const char *name,LISP val);
103LISP apply_hooks(LISP hook,LISP arg);
104LISP apply_hooks_right(LISP hook,LISP args);
105LISP apply(LISP func,LISP args);
106
107int parse_url(const EST_String &url,
108 EST_String &protocol,
109 EST_String &host,
110 EST_String &port,
111 EST_String &path);
112
113LISP err(const char *message, LISP x);
114LISP err(const char *message, const char *s);
115LISP errswitch(void);
116
117void siod_list_to_strlist(LISP l, EST_StrList &a);
118LISP siod_strlist_to_list(EST_StrList &a);
119void siod_tidy_up();
120LISP siod_quit(void);
121const char *siod_version(void);
122
123void gc_protect(LISP *location);
124void gc_unprotect(LISP *location);
125void gc_protect_n(LISP *location,long n);
126void gc_protect_sym(LISP *location,const char *st);
127LISP user_gc(LISP args);
128
129// Siod internal function that lots of people use
130LISP equal(LISP,LISP);
131LISP eql(LISP x,LISP y);
132LISP reverse(LISP obj);
133LISP append(LISP l1, LISP l2);
134LISP cons(LISP x,LISP y);
135LISP car(LISP x);
136LISP cdr(LISP x);
137LISP consp(LISP x);
138LISP numberp(LISP x);
139LISP atomp(LISP x);
140LISP assoc(LISP x,LISP alist);
141LISP setcar(LISP cell, LISP value);
142LISP setcdr(LISP cell, LISP value);
143LISP assq(LISP x,LISP alist);
144LISP delq(LISP elem,LISP l);
145LISP leval(LISP x,LISP env);
146LISP symbol_value(LISP x,LISP env);
147LISP setvar(LISP var,LISP val,LISP env);
148LISP copy_list(LISP x);
149LISP quote(LISP item);
150LISP read_from_lstring(LISP x);
151LISP symbolexplode(LISP name);
152
153LISP fopen_c(const char *name, const char *how);
154LISP fclose_l(LISP p);
155LISP lprin1f(LISP exp,FILE *f);
156void pprint(LISP exp);
157LISP lprint(LISP exp);
158void pprint_to_fd(FILE *fd,LISP exp);
159LISP lread(void);
160LISP lreadtk(long j);
161LISP lreadf(FILE *f);
162#ifdef WIN32
163LISP lreadwinsock(void);
164#endif
165void set_read_hooks(char *all_set,char *end_set,
166 LISP (*fcn1)(int, struct gen_readio *),
167 LISP (*fcn2)(char *,long, int *));
168LISP vload(const char *fname,long cflag);
169LISP read_from_string(const char *);
170long repl_c_string(char *,long want_sigint,long want_init,long want_print);
171long repl_from_socket(int fd);
172void init_subrs(void);
173LISP stringexplode(const char *str);
174void fput_st(FILE *f,const char *st);
175LISP get_eof_val(void);
176
177
178#if 0
179void print_hs_1(void);
180void print_hs_2(void);
181void set_repl_hooks(void (*puts_f)(char *),
182 LISP (*read_f)(void),
183 LISP (*eval_f)(LISP),
184 void (*print_f)(LISP));
185long repl(struct repl_hooks *);
186LISP lerr(LISP message, LISP x);
187LISP eq(LISP x,LISP y);
188LISP symcons(char *pname,LISP vcell);
189LISP symbol_value_p(LISP x,LISP env,int *set);
190LISP subrcons(long type, const char *name, SUBR_FUNC f);
191
192void init_storage(int heap_size=DEFAULT_HEAP_SIZE);
193
194LISP gc_status(LISP args);
195
196/* For user defined types in OBJ */
197
198LISP oblistfn(void);
199LISP save_forms(LISP fname,LISP forms,LISP how);
200LISP intern(LISP x);
201void init_trace(void);
202LISP siod_fdopen_c(int fd,const char *name,char *how);
203
204LISP probe_file(LISP fname);
205
206LISP fopen_l(LISP name,LISP how);
207LISP fopen_l(LISP name,const char *how);
208
209#endif
210#define siod_error() (errjmp_ok ? longjmp(*est_errjmp,1) : exit(-1))
211
212#include "siod_est.h"
213
214#endif
Definition: siod_defs.h:31