Edinburgh Speech Tools  2.4-release
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
siodp.h
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 
16 typedef int (*repl_getc_fn)(FILE *);
17 typedef void (*repl_ungetc_fn)(int,FILE *);
18 
19 /* Will get to editline functions if supported */
20 extern repl_getc_fn siod_fancy_getc;
21 extern repl_ungetc_fn siod_fancy_ungetc;
22 extern "C" const char *repl_prompt;
23 
24 extern char *tkbuffer;
25 extern LISP heap,heap_end,heap_org;
26 extern LISP oblistvar;
27 extern LISP open_files;
28 extern LISP eof_val;
29 extern LISP siod_docstrings;
30 extern int siod_interactive;
31 void sock_acknowledge_error();
32 extern FILE *fwarn;
33 extern LISP unbound_marker;
34 extern long gc_kind_copying;
35 extern LISP freelist;
36 extern long gc_cells_allocated;
37 extern int siod_server_socket;
38 extern "C" int rl_pos;
39 
41 {
42  char *name;
43  char gc_free_once;
44  LISP (*gc_relocate)(LISP);
45  void (*gc_scan)(LISP);
46  LISP (*gc_mark)(LISP);
47  void (*gc_free)(LISP);
48  void (*gc_clear)(LISP);
49  void (*prin1)(LISP, FILE *);
50  void (*print_string)(LISP, char *);
51  LISP (*leval)(LISP, LISP *, LISP *);
52  long (*c_sxhash)(LISP,long);
53  LISP (*fast_print)(LISP,LISP);
54  LISP (*fast_read)(int,LISP);
55  LISP (*equal)(LISP,LISP);};
56 
58 {LISP tag;
59  LISP retval;
60  jmp_buf cframe;
61  struct catch_frame *next;};
62 
64 {LISP *location;
65  long length;
66  struct gc_protected *next;};
67 
68 #define NEWCELL(_into,_type) \
69 {if (gc_kind_copying == 1) \
70  {if ((_into = heap) >= heap_end) \
71  gc_fatal_error(); \
72  heap = _into+1;} \
73  else \
74  {if NULLP(freelist) \
75  gc_for_newcell(); \
76  _into = freelist; \
77  freelist = CDR(freelist); \
78  ++gc_cells_allocated;} \
79  (*_into).gc_mark = 0; \
80  (*_into).type = (short) _type;}
81 #if 0
82 #define NEWCELL(_into,_type) NNEWCELL(&_into,_type)
83 void NNEWCELL (LISP *_into,long _type);
84 #endif
85 
86 #ifdef THINK_C
87 extern int ipoll_counter;
88 void full_interrupt_poll(int *counter);
89 #define INTERRUPT_CHECK() if (--ipoll_counter < 0) full_interrupt_poll(&ipoll_counter)
90 #else
91 #define INTERRUPT_CHECK()
92 #endif
93 
94 extern char *stack_limit_ptr;
95 
96 #define STACK_LIMIT(_ptr,_amt) (((char *)_ptr) - (_amt))
97 
98 /* This is wrong if stack grows in different direction */
99 #define STACK_CHECK(_ptr) \
100  if (((char *) (_ptr)) < stack_limit_ptr) err_stack((char *) _ptr);
101 
102 #define TKBUFFERN 256
103 
104 void err_stack(char *);
105 
106 #if defined(VMS) && defined(VAX)
107 #define SIG_restargs ,...
108 #else
109 #define SIG_restargs
110 #endif
111 
112 void init_storage(int init_heap_size);
113 void init_subrs_base(void);
114 void init_subrs_core(void);
115 void init_subrs_doc(void);
116 void init_subrs_file(void);
117 void init_subrs_format(void);
118 void init_subrs_list(void);
119 void init_subrs_math(void);
120 void init_subrs_sys(void);
121 void init_subrs_srv(void);
122 void init_subrs_str(void);
123 void init_subrs_xtr(void);
124 
125 void need_n_cells(int n);
126 
127 char *must_malloc(unsigned long size);
128 
129 LISP gc_relocate(LISP x);
130 void gc_fatal_error(void);
131 void gc_for_newcell(void);
132 struct user_type_hooks *get_user_type_hooks(long type);
133 void gc_mark(LISP ptr);
134 LISP newcell(long type);
135 
136 void put_st(const char *st);
137 int f_getc(FILE *f);
138 void f_ungetc(int c, FILE *f);
139 long no_interrupt(long n);
140 LISP readtl(struct gen_readio *f);
141 long repl_driver(long want_sigint,long want_init,struct repl_hooks *);
142 
143 LISP leval_args(LISP l,LISP env);
144 LISP extend_env(LISP actuals,LISP formals,LISP env);
145 LISP envlookup(LISP var,LISP env);
146 LISP closure(LISP env,LISP code);
147 extern struct catch_frame *catch_framep;
148 void close_open_files(void);
149 void close_open_files_upto(LISP end);
150 void pprintf(FILE *fd,LISP exp,int indent,int width, int depth,int length);
151 
152 #if 0
153 void handle_sigfpe(int sig SIG_restargs);
154 void handle_sigint(int sig SIG_restargs);
155 void err_ctrl_c(void);
156 double myruntime(void);
157 void grepl_puts(char *,void (*)(char *));
158 LISP gen_intern(char *name,int freeable);
159 void scan_registers(void);
160 void init_storage_1(int heap_size);
161 LISP get_newspace(void);
162 void scan_newspace(LISP newspace);
163 void free_oldspace(LISP space,LISP end);
164 void gc_stop_and_copy(void);
165 void gc_mark_and_sweep(void);
166 void gc_ms_stats_start(void);
167 void gc_ms_stats_end(void);
168 void mark_protected_registers(void);
169 void mark_locations(LISP *start,LISP *end);
170 void mark_locations_array(LISP *x,long n);
171 void gc_sweep(void);
172 LISP leval_setq(LISP args,LISP env);
173 LISP syntax_define(LISP args);
174 LISP leval_define(LISP args,LISP env);
175 LISP leval_if(LISP *pform,LISP *penv);
176 LISP leval_lambda(LISP args,LISP env);
177 LISP leval_progn(LISP *pform,LISP *penv);
178 LISP leval_or(LISP *pform,LISP *penv);
179 LISP leval_and(LISP *pform,LISP *penv);
180 LISP leval_catch(LISP args,LISP env);
181 LISP lthrow(LISP tag,LISP value);
182 LISP leval_let(LISP *pform,LISP *penv);
183 LISP reverse(LISP l);
184 LISP let_macro(LISP form);
185 LISP leval_quote(LISP args,LISP env);
186 LISP leval_tenv(LISP args,LISP env);
187 int flush_ws(struct gen_readio *f,const char *eoferr);
188 LISP lreadr(struct gen_readio *f);
189 LISP lreadparen(struct gen_readio *f);
190 LISP arglchk(LISP x);
191 
192 int rfs_getc(unsigned char **p);
193 void rfs_ungetc(unsigned char c,unsigned char **p);
194 LISP lreadstring(struct gen_readio *f);
195 
196 void file_gc_free(LISP ptr);
197 void file_prin1(LISP ptr,FILE *f);
198 LISP fd_to_scheme_file(int fd,
199  const char *name, const char *how,
200  int close_on_error);
201 LISP lgetc(LISP p);
202 LISP lputc(LISP c,LISP p);
203 LISP lputs(LISP str,LISP p);
204 
205 LISP lftell(LISP file);
206 LISP lfseek(LISP file,LISP offset,LISP direction);
207 LISP lfread(LISP size,LISP file);
208 LISP lfwrite(LISP string,LISP file);
209 
210 
211 LISP leval_while(LISP args,LISP env);
212 
213 void init_subrs_a(void);
214 void init_subrs_1(void);
215 
216 LISP stack_limit(LISP,LISP);
217 
218 void err0(void);
219 void pr(LISP);
220 void prp(LISP *);
221 
222 LISP closure_code(LISP exp);
223 LISP closure_env(LISP exp);
224 LISP lwhile(LISP form,LISP env);
225 
226 LISP siod_send_lisp_to_client(LISP x);
227 #endif
228 
229 
230 #endif