Edinburgh Speech Tools  2.1-release
siodp.h
Go to the documentation of this file.
1 /* Scheme In One Defun, but in C this time.
2 
3  * COPYRIGHT (c) 1988-1992 BY *
4  * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. *
5  * See the source file SLIB.C for more information. *
6 
7 Declarations which are private to SLIB.C internals.
8 
9 */
10 
11 #ifndef __SIODP_H__
12 #define __SIODP_H__
13 
14 #include "io.h"
15 #include "siod.h"
16 
17 typedef int (*repl_getc_fn)(FILE *);
18 typedef void (*repl_ungetc_fn)(int,FILE *);
19 
20 /* Will get to editline functions if supported */
23 extern "C" const char *repl_prompt;
24 
25 extern char *tkbuffer;
26 extern LISP heap,heap_end,heap_org;
27 extern LISP oblistvar;
28 extern LISP open_files;
29 extern LISP eof_val;
30 extern LISP siod_docstrings;
31 extern int siod_interactive;
33 extern FILE *fwarn;
34 extern LISP unbound_marker;
35 extern long gc_kind_copying;
36 extern LISP freelist;
37 extern long gc_cells_allocated;
38 extern int siod_server_socket;
39 extern "C" int rl_pos;
40 
42 {
43  char *name;
45  LISP (*gc_relocate)(LISP);
46  void (*gc_scan)(LISP);
47  LISP (*gc_mark)(LISP);
48  void (*gc_free)(LISP);
49  void (*gc_clear)(LISP);
50  void (*prin1)(LISP, FILE *);
51  void (*print_string)(LISP, char *);
52  LISP (*leval)(LISP, LISP *, LISP *);
53  long (*c_sxhash)(LISP,long);
54  LISP (*fast_print)(LISP,LISP);
55  LISP (*fast_read)(int,LISP);
56  LISP (*equal)(LISP,LISP);};
57 
59 {LISP tag;
60  LISP retval;
61  jmp_buf cframe;
62  struct catch_frame *next;};
63 
65 {LISP *location;
66  long length;
67  struct gc_protected *next;};
68 
69 #define NEWCELL(_into,_type) \
70 {if (gc_kind_copying == 1) \
71  {if ((_into = heap) >= heap_end) \
72  gc_fatal_error(); \
73  heap = _into+1;} \
74  else \
75  {if NULLP(freelist) \
76  gc_for_newcell(); \
77  _into = freelist; \
78  freelist = CDR(freelist); \
79  ++gc_cells_allocated;} \
80  (*_into).gc_mark = 0; \
81  (*_into).type = (short) _type;}
82 #if 0
83 #define NEWCELL(_into,_type) NNEWCELL(&_into,_type)
84 void NNEWCELL (LISP *_into,long _type);
85 #endif
86 
87 #define INTERRUPT_CHECK()
88 
89 extern char *stack_limit_ptr;
90 
91 #define STACK_LIMIT(_ptr,_amt) (((char *)_ptr) - (_amt))
92 
93 /* This is wrong if stack grows in different direction */
94 #define STACK_CHECK(_ptr) \
95  if (((char *) (_ptr)) < stack_limit_ptr) err_stack((char *) _ptr);
96 
97 #define TKBUFFERN 256
98 
99 void err_stack(char *);
100 
101 #if defined(VMS) && defined(VAX)
102 #define SIG_restargs ,...
103 #else
104 #define SIG_restargs
105 #endif
106 
107 void init_storage(int init_heap_size);
108 void init_subrs_base(void);
109 void init_subrs_core(void);
110 void init_subrs_doc(void);
111 void init_subrs_file(void);
112 void init_subrs_format(void);
113 void init_subrs_list(void);
114 void init_subrs_math(void);
115 void init_subrs_sys(void);
116 void init_subrs_srv(void);
117 void init_subrs_str(void);
118 void init_subrs_xtr(void);
119 
120 void need_n_cells(int n);
121 
122 char *must_malloc(unsigned long size);
123 
124 LISP gc_relocate(LISP x);
125 void gc_fatal_error(void);
126 void gc_for_newcell(void);
127 struct user_type_hooks *get_user_type_hooks(long type);
128 void gc_mark(LISP ptr);
129 LISP newcell(long type);
130 
131 void put_st(const char *st);
132 int f_getc(FILE *f);
133 void f_ungetc(int c, FILE *f);
134 long no_interrupt(long n);
135 LISP readtl(struct gen_readio *f);
136 long repl_driver(long want_sigint,long want_init,struct repl_hooks *);
137 
138 LISP leval_args(LISP l,LISP env);
139 LISP extend_env(LISP actuals,LISP formals,LISP env);
140 LISP envlookup(LISP var,LISP env);
141 LISP closure(LISP env,LISP code);
142 extern struct catch_frame *catch_framep;
143 void close_open_files(void);
144 void close_open_files_upto(LISP end);
145 void pprintf(FILE *fd,LISP exp,int indent,int width, int depth,int length);
146 
147 #if 0
148 void handle_sigfpe(int sig SIG_restargs);
149 void handle_sigint(int sig SIG_restargs);
150 void err_ctrl_c(void);
151 double myruntime(void);
152 void grepl_puts(char *,void (*)(char *));
153 LISP gen_intern(char *name,int freeable);
154 void scan_registers(void);
155 void init_storage_1(int heap_size);
156 LISP get_newspace(void);
157 void scan_newspace(LISP newspace);
158 void free_oldspace(LISP space,LISP end);
159 void gc_stop_and_copy(void);
160 void gc_mark_and_sweep(void);
161 void gc_ms_stats_start(void);
162 void gc_ms_stats_end(void);
163 void mark_protected_registers(void);
164 void mark_locations(LISP *start,LISP *end);
165 void mark_locations_array(LISP *x,long n);
166 void gc_sweep(void);
167 LISP leval_setq(LISP args,LISP env);
168 LISP syntax_define(LISP args);
169 LISP leval_define(LISP args,LISP env);
170 LISP leval_if(LISP *pform,LISP *penv);
171 LISP leval_lambda(LISP args,LISP env);
172 LISP leval_progn(LISP *pform,LISP *penv);
173 LISP leval_or(LISP *pform,LISP *penv);
174 LISP leval_and(LISP *pform,LISP *penv);
175 LISP leval_catch(LISP args,LISP env);
176 LISP lthrow(LISP tag,LISP value);
177 LISP leval_let(LISP *pform,LISP *penv);
178 LISP reverse(LISP l);
179 LISP let_macro(LISP form);
180 LISP leval_quote(LISP args,LISP env);
181 LISP leval_tenv(LISP args,LISP env);
182 int flush_ws(struct gen_readio *f,const char *eoferr);
183 LISP lreadr(struct gen_readio *f);
184 LISP lreadparen(struct gen_readio *f);
185 LISP arglchk(LISP x);
186 
187 int rfs_getc(unsigned char **p);
188 void rfs_ungetc(unsigned char c,unsigned char **p);
189 LISP lreadstring(struct gen_readio *f);
190 
191 void file_gc_free(LISP ptr);
192 void file_prin1(LISP ptr,FILE *f);
193 LISP fd_to_scheme_file(int fd,
194  const char *name, const char *how,
195  int close_on_error);
196 LISP lgetc(LISP p);
197 LISP lputc(LISP c,LISP p);
198 LISP lputs(LISP str,LISP p);
199 
200 LISP lftell(LISP file);
201 LISP lfseek(LISP file,LISP offset,LISP direction);
202 LISP lfread(LISP size,LISP file);
203 LISP lfwrite(LISP string,LISP file);
204 
205 
206 LISP leval_while(LISP args,LISP env);
207 
208 void init_subrs_a(void);
209 void init_subrs_1(void);
210 
211 LISP stack_limit(LISP,LISP);
212 
213 void err0(void);
214 void pr(LISP);
215 void prp(LISP *);
216 
217 LISP closure_code(LISP exp);
218 LISP closure_env(LISP exp);
219 LISP lwhile(LISP form,LISP env);
220 
221 LISP siod_send_lisp_to_client(LISP x);
222 #endif
223 
224 
225 #endif
void(* gc_free)(LISP)
Definition: siodp.h:48
LISP closure_env(LISP exp)
Definition: slib.cc:1847
LISP envlookup(LISP var, LISP env)
Definition: slib.cc:1353
LISP(* fast_print)(LISP, LISP)
Definition: siodp.h:54
LISP lgetc(LISP p)
Definition: slib_file.cc:355
float end(const EST_Item &item)
Definition: EST_item_aux.cc:96
void(* gc_clear)(LISP)
Definition: siodp.h:49
LISP readtl(struct gen_readio *f)
Definition: slib.cc:1608
repl_getc_fn siod_fancy_getc
Definition: slib.cc:148
#define SIG_restargs
Definition: siodp.h:104
LISP heap
Definition: slib.cc:115
LISP extend_env(LISP actuals, LISP formals, LISP env)
Definition: slib.cc:1341
const char * repl_prompt
Definition: siodp.h:23
void init_subrs_base(void)
Definition: slib.cc:1863
void sock_acknowledge_error()
Definition: slib_server.cc:57
LISP siod_docstrings
Definition: slib.cc:151
long heap_size
Definition: slib.cc:116
void(* repl_ungetc_fn)(int, FILE *)
Definition: siodp.h:18
void close_open_files_upto(LISP end)
Definition: slib_file.cc:599
LISP siod_send_lisp_to_client(LISP x)
Definition: slib_server.cc:20
void init_subrs_list(void)
Definition: slib_list.cc:183
LISP newcell(long type)
Definition: slib.cc:668
LISP retval
Definition: siodp.h:60
LISP unbound_marker
Definition: slib.cc:140
void need_n_cells(int n)
Definition: slib.cc:200
int siod_server_socket
Definition: slib_server.cc:18
struct catch_frame * next
Definition: siodp.h:62
long length
Definition: siodp.h:66
void gc_stop_and_copy(void)
Definition: slib.cc:1075
void init_subrs_xtr(void)
Definition: slib_xtr.cc:592
struct gc_protected * next
Definition: siodp.h:67
LISP(* gc_mark)(LISP)
Definition: siodp.h:47
void init_subrs_math(void)
Definition: slib_math.cc:209
LISP tag
Definition: siodp.h:59
int f_getc(FILE *f)
Definition: slib.cc:1517
long gc_cells_allocated
Definition: slib.cc:124
void(* gc_scan)(LISP)
Definition: siodp.h:46
void(* prin1)(LISP, FILE *)
Definition: siodp.h:50
void init_subrs_file(void)
Definition: slib_file.cc:661
void handle_sigint(int sig SIG_restargs)
Definition: slib.cc:301
void(* print_string)(LISP, char *)
Definition: siodp.h:51
LISP(* leval)(LISP, LISP *, LISP *)
Definition: siodp.h:52
void init_subrs_format(void)
Definition: slib_format.cc:354
LISP open_files
Definition: slib_file.cc:19
LISP(* equal)(LISP, LISP)
Definition: siodp.h:56
void scan_registers(void)
Definition: slib.cc:815
char gc_free_once
Definition: siodp.h:44
void init_storage(int init_heap_size)
Definition: slib.cc:880
void free_oldspace(LISP space, LISP end)
Definition: slib.cc:1041
int siod_interactive
Definition: slib.cc:164
void pprintf(FILE *fd, LISP exp, int indent, int width, int depth, int length)
Definition: slib_file.cc:21
double myruntime(void)
Definition: slib.cc:434
void grepl_puts(char *st, void(*repl_putss)(char *))
Definition: slib.cc:463
void NNEWCELL(LISP *_into, long _type)
Definition: slib.cc:187
int rl_pos
Definition: siodp.h:39
LISP eof_val
Definition: slib.cc:136
f
Definition: EST_item_aux.cc:48
long no_interrupt(long n)
Definition: slib.cc:275
void scan_newspace(LISP newspace)
Definition: slib.cc:1014
void gc_for_newcell(void)
Definition: slib.cc:1093
LISP(* fast_read)(int, LISP)
Definition: siodp.h:55
LISP leval_args(LISP l, LISP env)
Definition: slib.cc:1328
getString int
Definition: EST_item_aux.cc:50
LISP * location
Definition: siodp.h:65
void pr(LISP p)
Definition: slib.cc:1941
void init_subrs_sys(void)
Definition: slib_sys.cc:94
jmp_buf cframe
Definition: siodp.h:61
int(* repl_getc_fn)(FILE *)
Definition: siodp.h:17
long gc_kind_copying
Definition: slib.cc:123
void handle_sigfpe(int sig SIG_restargs)
Definition: slib.cc:284
char * stack_limit_ptr
Definition: slib.cc:184
char * name
Definition: siodp.h:43
LISP lftell(LISP file)
Definition: slib_file.cc:378
LISP(* gc_relocate)(LISP)
Definition: siodp.h:45
float start(const EST_Item &item)
Definition: EST_item_aux.cc:52
FILE * fwarn
Definition: slib.cc:163
void prp(LISP *p)
Definition: slib.cc:1949
LISP heap_end
Definition: slib.cc:115
void f_ungetc(int c, FILE *f)
Definition: slib.cc:1530
LISP oblistvar
Definition: slib.cc:131
LISP closure(LISP env, LISP code)
Definition: slib.cc:752
void init_subrs_str(void)
Definition: slib_str.cc:335
char * must_malloc(unsigned long size)
Definition: slib.cc:693
LISP heap_org
Definition: slib.cc:115
char * tkbuffer
Definition: slib.cc:122
struct user_type_hooks * get_user_type_hooks(long type)
Definition: slib.cc:913
LISP freelist
Definition: slib.cc:127
void init_subrs_core(void)
Definition: slib_core.cc:288
void gc_fatal_error(void)
Definition: slib.cc:665
void init_subrs_doc(void)
Definition: slib_doc.cc:244
void err0(void)
Definition: slib.cc:1938
LISP gen_intern(char *name, int require_copy)
Definition: slib.cc:699
LISP let_macro(LISP form)
Definition: slib_core.cc:274
long repl_driver(long want_sigint, long want_init, struct repl_hooks *)
Definition: slib.cc:329
LISP lfseek(LISP file, LISP offset, LISP direction)
Definition: slib_file.cc:381
LISP stack_limit(LISP amount, LISP silent)
Definition: slib.cc:626
void init_subrs_srv(void)
Definition: slib_server.cc:121
void reverse(EST_Wave &sig)
long(* c_sxhash)(LISP, long)
Definition: siodp.h:53
int flush_ws(struct gen_readio *f, const char *eoferr)
Definition: slib.cc:1572
LISP lputs(LISP str, LISP p)
Definition: slib_file.cc:374
void err_stack(char *)
Definition: slib.cc:621
struct catch_frame * catch_framep
Definition: slib.cc:143
LISP closure_code(LISP exp)
Definition: slib.cc:1844
LISP lputc(LISP c, LISP p)
Definition: slib_file.cc:360
repl_ungetc_fn siod_fancy_ungetc
Definition: slib.cc:149
LISP get_newspace(void)
Definition: slib.cc:1001
void close_open_files(void)
Definition: slib_file.cc:610
void put_st(const char *st)
Definition: slib.cc:460