Edinburgh Speech Tools  2.1-release
slib_xtr.cc
Go to the documentation of this file.
1 /*
2  * COPYRIGHT (c) 1988-1994 BY *
3  * PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. *
4  * See the source file SLIB.C for more information. *
5 
6 Array-hacking code moved to another source file.
7 
8  * Functions *not* used in Edinburgh Speech Tools
9  * arrays, hash tables,
10 
11 */
12 #include <cstdio>
13 #include <cstring>
14 #include <setjmp.h>
15 #include <cstdlib>
16 #include <cctype>
17 
18 #include "siod.h"
19 #include "siodp.h"
20 
21 using namespace std;
22 
23 static LISP bashnum = NIL;
24 
25 static LISP array_gc_relocate(LISP ptr)
26 {LISP nw;
27  if ((nw = heap) >= heap_end) gc_fatal_error();
28  heap = nw+1;
29  memcpy(nw,ptr,sizeof(struct obj));
30  return(nw);}
31 
32 static void array_gc_scan(LISP ptr)
33 {long j;
34  if TYPEP(ptr,tc_lisp_array)
35  for(j=0;j < ptr->storage_as.lisp_array.dim; ++j)
36  ptr->storage_as.lisp_array.data[j] =
37  gc_relocate(ptr->storage_as.lisp_array.data[j]);}
38 
39 static LISP array_gc_mark(LISP ptr)
40 {long j;
41  if TYPEP(ptr,tc_lisp_array)
42  for(j=0;j < ptr->storage_as.lisp_array.dim; ++j)
43  gc_mark(ptr->storage_as.lisp_array.data[j]);
44  return(NIL);}
45 
46 static void array_gc_free(LISP ptr)
47 {switch (ptr->type)
48  {case tc_string:
49  wfree(ptr->storage_as.string.data);
50  break;
51  case tc_double_array:
52  wfree(ptr->storage_as.double_array.data);
53  break;
54  case tc_long_array:
55  wfree(ptr->storage_as.long_array.data);
56  break;
57  case tc_lisp_array:
58  wfree(ptr->storage_as.lisp_array.data);
59  break;}}
60 
61 static void array_prin1(LISP ptr,FILE *f)
62 {int j;
63  switch (ptr->type)
64  {case tc_string:
65  fput_st(f,"\"");
66  fput_st(f,ptr->storage_as.string.data);
67  fput_st(f,"\"");
68  break;
69  case tc_double_array:
70  fput_st(f,"#(");
71  for(j=0; j < ptr->storage_as.double_array.dim; ++j)
72  {sprintf(tkbuffer,"%g",ptr->storage_as.double_array.data[j]);
73  fput_st(f,tkbuffer);
74  if ((j + 1) < ptr->storage_as.double_array.dim)
75  fput_st(f," ");}
76  fput_st(f,")");
77  break;
78  case tc_long_array:
79  fput_st(f,"#(");
80  for(j=0; j < ptr->storage_as.long_array.dim; ++j)
81  {sprintf(tkbuffer,"%ld",ptr->storage_as.long_array.data[j]);
82  fput_st(f,tkbuffer);
83  if ((j + 1) < ptr->storage_as.long_array.dim)
84  fput_st(f," ");}
85  fput_st(f,")");
86  break;
87  case tc_lisp_array:
88  fput_st(f,"#(");
89  for(j=0; j < ptr->storage_as.lisp_array.dim; ++j)
90  {lprin1f(ptr->storage_as.lisp_array.data[j],f);
91  if ((j + 1) < ptr->storage_as.lisp_array.dim)
92  fput_st(f," ");}
93  fput_st(f,")");
94  break;}}
95 
96 static LISP aref1(LISP a,LISP i)
97 {long k;
98  if NFLONUMP(i) err("bad index to aref",i);
99  k = (long) FLONM(i);
100  if (k < 0) err("negative index to aref",i);
101  switch (a->type)
102  {case tc_string:
103  if (k >= a->storage_as.string.dim) err("index too large",i);
104  return(flocons((double) a->storage_as.string.data[k]));
105  case tc_double_array:
106  if (k >= a->storage_as.double_array.dim) err("index too large",i);
107  return(flocons(a->storage_as.double_array.data[k]));
108  case tc_long_array:
109  if (k >= a->storage_as.long_array.dim) err("index too large",i);
110  return(flocons(a->storage_as.long_array.data[k]));
111  case tc_lisp_array:
112  if (k >= a->storage_as.lisp_array.dim) err("index too large",i);
113  return(a->storage_as.lisp_array.data[k]);
114  default:
115  err("invalid argument to aref",a);}}
116 
117 static void err1_aset1(LISP i)
118 {err("index to aset too large",i);}
119 
120 static void err2_aset1(LISP v)
121 {err("bad value to store in array",v);}
122 
123 static LISP aset1(LISP a,LISP i,LISP v)
124 {long k;
125  if NFLONUMP(i) err("bad index to aset",i);
126  k = (long) FLONM(i);
127  if (k < 0) err("negative index to aset",i);
128  switch (a->type)
129  {case tc_string:
130  if NFLONUMP(v) err2_aset1(v);
131  if (k >= a->storage_as.string.dim) err1_aset1(i);
132  a->storage_as.string.data[k] = (char) FLONM(v);
133  return(v);
134  case tc_double_array:
135  if NFLONUMP(v) err2_aset1(v);
136  if (k >= a->storage_as.double_array.dim) err1_aset1(i);
137  a->storage_as.double_array.data[k] = FLONM(v);
138  return(v);
139  case tc_long_array:
140  if NFLONUMP(v) err2_aset1(v);
141  if (k >= a->storage_as.long_array.dim) err1_aset1(i);
142  a->storage_as.long_array.data[k] = (long) FLONM(v);
143  return(v);
144  case tc_lisp_array:
145  if (k >= a->storage_as.lisp_array.dim) err1_aset1(i);
146  a->storage_as.lisp_array.data[k] = v;
147  return(v);
148  default:
149  err("invalid argument to aset",a);}}
150 
151 static LISP cons_array(LISP dim,LISP kind)
152 {LISP a;
153  long flag,n,j;
154  if (NFLONUMP(dim) || (FLONM(dim) < 0))
155  err("bad dimension to cons-array",dim);
156  else
157  n = (long) FLONM(dim);
158  flag = no_interrupt(1);
159  a = cons(NIL,NIL);
160  if EQ(cintern("double"),kind)
161  {a->type = tc_double_array;
162  a->storage_as.double_array.dim = n;
163  a->storage_as.double_array.data = (double *) must_malloc(n *
164  sizeof(double));
165  for(j=0;j<n;++j) a->storage_as.double_array.data[j] = 0.0;}
166  else if EQ(cintern("long"),kind)
167  {a->type = tc_long_array;
168  a->storage_as.long_array.dim = n;
169  a->storage_as.long_array.data = (long *) must_malloc(n * sizeof(long));
170  for(j=0;j<n;++j) a->storage_as.long_array.data[j] = 0;}
171  else if EQ(cintern("string"),kind)
172  {a->type = tc_string;
173  a->storage_as.double_array.dim = n+1;
174  a->storage_as.string.data = (char *) must_malloc(n+1);
175  a->storage_as.string.data[n] = 0;
176  for(j=0;j<n;++j) a->storage_as.string.data[j] = ' ';}
177  else if (EQ(cintern("lisp"),kind) || NULLP(kind))
178  {a->type = tc_lisp_array;
179  a->storage_as.lisp_array.dim = n;
180  a->storage_as.lisp_array.data = (LISP *) must_malloc(n * sizeof(LISP));
181  for(j=0;j<n;++j) a->storage_as.lisp_array.data[j] = NIL;}
182  else
183  err("bad type of array",kind);
184  no_interrupt(flag);
185  return(a);}
186 
187 #define HASH_COMBINE(_h1,_h2,_mod) ((((_h1) * 17 + 1) ^ (_h2)) % (_mod))
188 
189 static long c_sxhash(LISP obj,long n)
190 {long hash;
191  unsigned char *s;
192  LISP tmp;
193  struct user_type_hooks *p;
194  STACK_CHECK(&obj);
195  INTERRUPT_CHECK();
196  switch TYPE(obj)
197  {case tc_nil:
198  return(0);
199  case tc_cons:
200  hash = c_sxhash(CAR(obj),n);
201  for(tmp=CDR(obj);CONSP(tmp);tmp=CDR(tmp))
202  hash = HASH_COMBINE(hash,c_sxhash(CAR(tmp),n),n);
203  hash = HASH_COMBINE(hash,c_sxhash(tmp,n),n);
204  return(hash);
205  case tc_symbol:
206  for(hash=0,s=(unsigned char *)PNAME(obj);*s;++s)
207  hash = HASH_COMBINE(hash,*s,n);
208  return(hash);
209  case tc_subr_0:
210  case tc_subr_1:
211  case tc_subr_2:
212  case tc_subr_3:
213  case tc_subr_4:
214  case tc_lsubr:
215  case tc_fsubr:
216  case tc_msubr:
217  for(hash=0,s=(unsigned char *) obj->storage_as.subr.name;*s;++s)
218  hash = HASH_COMBINE(hash,*s,n);
219  return(hash);
220  case tc_flonum:
221  return(((unsigned long)FLONM(obj)) % n);
222  default:
223  p = get_user_type_hooks(TYPE(obj));
224  if (p->c_sxhash)
225  return((*p->c_sxhash)(obj,n));
226  else
227  return(0);}}
228 
229 static LISP sxhash(LISP obj,LISP n)
230 {return(flocons(c_sxhash(obj,FLONUMP(n) ? (long) FLONM(n) : 10000)));}
231 
232 static LISP array_equal(LISP a,LISP b)
233 {long j,len;
234  switch(TYPE(a))
235  {case tc_string:
236  len = a->storage_as.string.dim;
237  if (len != b->storage_as.string.dim) return(NIL);
238  if (memcmp(a->storage_as.string.data,b->storage_as.string.data,len) == 0)
239  return(truth);
240  else
241  return(NIL);
242  case tc_long_array:
243  len = a->storage_as.long_array.dim;
244  if (len != b->storage_as.long_array.dim) return(NIL);
245  if (memcmp(a->storage_as.long_array.data,
246  b->storage_as.long_array.data,
247  len * sizeof(long)) == 0)
248  return(truth);
249  else
250  return(NIL);
251  case tc_double_array:
252  len = a->storage_as.double_array.dim;
253  if (len != b->storage_as.double_array.dim) return(NIL);
254  for(j=0;j<len;++j)
255  if (a->storage_as.double_array.data[j] !=
256  b->storage_as.double_array.data[j])
257  return(NIL);
258  return(truth);
259  case tc_lisp_array:
260  len = a->storage_as.lisp_array.dim;
261  if (len != b->storage_as.lisp_array.dim) return(NIL);
262  for(j=0;j<len;++j)
263  if NULLP(equal(a->storage_as.lisp_array.data[j],
264  b->storage_as.lisp_array.data[j]))
265  return(NIL);
266  return(truth);
267  default:
268  errswitch();}}
269 
270 static long array_sxhash(LISP a,long n)
271 {long j,len,hash;
272  unsigned char *char_data;
273  unsigned long *long_data;
274  double *double_data;
275  switch(TYPE(a))
276  {case tc_string:
277  len = a->storage_as.string.dim;
278  for(j=0,hash=0,char_data=(unsigned char *)a->storage_as.string.data;
279  j < len;
280  ++j,++char_data)
281  hash = HASH_COMBINE(hash,*char_data,n);
282  return(hash);
283  case tc_long_array:
284  len = a->storage_as.long_array.dim;
285  for(j=0,hash=0,long_data=(unsigned long *)a->storage_as.long_array.data;
286  j < len;
287  ++j,++long_data)
288  hash = HASH_COMBINE(hash,*long_data % n,n);
289  return(hash);
290  case tc_double_array:
291  len = a->storage_as.double_array.dim;
292  for(j=0,hash=0,double_data=a->storage_as.double_array.data;
293  j < len;
294  ++j,++double_data)
295  hash = HASH_COMBINE(hash,(unsigned long)*double_data % n,n);
296  return(hash);
297  case tc_lisp_array:
298  len = a->storage_as.lisp_array.dim;
299  for(j=0,hash=0; j < len; ++j)
300  hash = HASH_COMBINE(hash,
301  c_sxhash(a->storage_as.lisp_array.data[j],n),
302  n);
303  return(hash);
304  default:
305  errswitch();
306  return(0);}}
307 
308 static long href_index(LISP table,LISP key)
309 {long index;
310  if NTYPEP(table,tc_lisp_array) err("not a hash table",table);
311  index = c_sxhash(key,table->storage_as.lisp_array.dim);
312  if ((index < 0) || (index >= table->storage_as.lisp_array.dim))
313  {err("sxhash inconsistency",table);
314  return(0);}
315  else
316  return(index);}
317 
318 static LISP href(LISP table,LISP key)
319 {return(cdr(assoc(key,
320  table->storage_as.lisp_array.data[href_index(table,key)])));}
321 
322 static LISP hset(LISP table,LISP key,LISP value)
323 {long index;
324  LISP cell,l;
325  index = href_index(table,key);
326  l = table->storage_as.lisp_array.data[index];
327  if NNULLP(cell = assoc(key,l))
328  return(setcdr(cell,value));
329  cell = cons(key,value);
330  table->storage_as.lisp_array.data[index] = cons(cell,l);
331  return(value);}
332 
333 static LISP make_list(LISP x,LISP v)
334 {long n;
335  LISP l;
336  n = get_c_int(x);
337  l = NIL;
338  while(n > 0)
339  {l = cons(v,l); --n;}
340  return(l);}
341 
342 static void put_long(long i,FILE *f)
343 {if (fwrite(&i,sizeof(long),1,f) != 1)
344  cerr << "Could not put long to file" << endl;
345 }
346 
347 static long get_long(FILE *f)
348 {long i=0;
349  if (fread(&i,sizeof(long),1,f) != 1)
350  cerr << "Could not get long" << endl;
351  return(i);}
352 
353 static long fast_print_table(LISP obj,LISP table)
354 {FILE *f;
355  LISP ht,index;
356  f = get_c_file(car(table),(FILE *) NULL);
357  if NULLP(ht = car(cdr(table)))
358  return(1);
359  index = href(ht,obj);
360  if NNULLP(index)
361  {putc(FO_fetch,f);
362  put_long(get_c_int(index),f);
363  return(0);}
364  if NULLP(index = car(cdr(cdr(table))))
365  return(1);
366  hset(ht,obj,index);
367  FLONM(bashnum) = 1.0;
368  setcar(cdr(cdr(table)),flocons(get_c_int(bashnum)+get_c_int(index)));
369  putc(FO_store,f);
370  put_long(get_c_int(index),f);
371  return(1);}
372 
373 static LISP fast_print(LISP obj,LISP table)
374 {FILE *f;
375  long len;
376  LISP tmp;
377  struct user_type_hooks *p;
378  STACK_CHECK(&obj);
379  f = get_c_file(car(table),(FILE *) NULL);
380  switch(TYPE(obj))
381  {case tc_nil:
382  putc(tc_nil,f);
383  return(NIL);
384  case tc_cons:
385  for(len=0,tmp=obj;CONSP(tmp);tmp=CDR(tmp)) {INTERRUPT_CHECK();++len;}
386  if (len == 1)
387  {putc(tc_cons,f);
388  fast_print(car(obj),table);
389  fast_print(cdr(obj),table);}
390  else if NULLP(tmp)
391  {putc(FO_list,f);
392  put_long(len,f);
393  for(tmp=obj;CONSP(tmp);tmp=CDR(tmp))
394  fast_print(CAR(tmp),table);}
395  else
396  {putc(FO_listd,f);
397  put_long(len,f);
398  for(tmp=obj;CONSP(tmp);tmp=CDR(tmp))
399  fast_print(CAR(tmp),table);
400  fast_print(tmp,table);}
401  return(NIL);
402  case tc_flonum:
403  putc(tc_flonum,f);
404  fwrite(&obj->storage_as.flonum.data,
405  sizeof(obj->storage_as.flonum.data),
406  1,
407  f);
408  return(NIL);
409  case tc_symbol:
410  if (fast_print_table(obj,table))
411  {putc(tc_symbol,f);
412  len = strlen(PNAME(obj));
413  if (len >= TKBUFFERN)
414  err("symbol name too long",obj);
415  put_long(len,f);
416  fwrite(PNAME(obj),len,1,f);
417  return(truth);}
418  else
419  return(NIL);
420  default:
421  p = get_user_type_hooks(TYPE(obj));
422  if (p->fast_print)
423  return((*p->fast_print)(obj,table));
424  else
425  err("cannot fast-print",obj);}}
426 
427 static LISP fast_read(LISP table)
428 {FILE *f;
429  LISP tmp,l;
430  struct user_type_hooks *p;
431  int c;
432  long len;
433  f = get_c_file(car(table),(FILE *) NULL);
434  c = getc(f);
435  if (c == EOF) return(table);
436  switch(c)
437  {case FO_fetch:
438  len = get_long(f);
439  FLONM(bashnum) = len;
440  return(href(car(cdr(table)),bashnum));
441  case FO_store:
442  len = get_long(f);
443  tmp = fast_read(table);
444  hset(car(cdr(table)),flocons(len),tmp);
445  return(tmp);
446  case tc_nil:
447  return(NIL);
448  case tc_cons:
449  tmp = fast_read(table);
450  return(cons(tmp,fast_read(table)));
451  case FO_list:
452  case FO_listd:
453  len = get_long(f);
454  FLONM(bashnum) = len;
455  l = make_list(bashnum,NIL);
456  tmp = l;
457  while(len > 1)
458  {CAR(tmp) = fast_read(table);
459  tmp = CDR(tmp);
460  --len;}
461  CAR(tmp) = fast_read(table);
462  if (c == FO_listd)
463  CDR(tmp) = fast_read(table);
464  return(l);
465  case tc_flonum:
466  tmp = newcell(tc_flonum);
467  if (fread(&tmp->storage_as.flonum.data,
468  sizeof(tmp->storage_as.flonum.data),
469  1,
470  f) != 1 )
471  cerr << "Could not read float from file" << endl;
472  return(tmp);
473  case tc_symbol:
474  len = get_long(f);
475  if (len >= TKBUFFERN)
476  err("symbol name too long",NIL);
477  if (fread(tkbuffer,len,1,f) != 1)
478  cerr << "Could not read symbol" << endl;
479  tkbuffer[len] = 0;
480  return(rintern(tkbuffer));
481  default:
482  p = get_user_type_hooks(c);
483  if (p->fast_read)
484  return(*p->fast_read)(c,table);
485  else
486  err("unknown fast-read opcode",flocons(c));}}
487 
488 static LISP array_fast_print(LISP ptr,LISP table)
489 {int j,len;
490  FILE *f;
491  f = get_c_file(car(table),(FILE *) NULL);
492  switch (ptr->type)
493  {case tc_string:
494  putc(tc_string,f);
495  len = ptr->storage_as.string.dim;
496  put_long(len,f);
497  fwrite(ptr->storage_as.string.data,len,1,f);
498  return(NIL);
499  case tc_double_array:
500  putc(tc_double_array,f);
501  len = ptr->storage_as.double_array.dim * sizeof(double);
502  put_long(len,f);
503  fwrite(ptr->storage_as.double_array.data,len,1,f);
504  return(NIL);
505  case tc_long_array:
506  putc(tc_long_array,f);
507  len = ptr->storage_as.long_array.dim * sizeof(long);
508  put_long(len,f);
509  fwrite(ptr->storage_as.long_array.data,len,1,f);
510  return(NIL);
511  case tc_lisp_array:
512  putc(tc_lisp_array,f);
513  len = ptr->storage_as.lisp_array.dim;
514  put_long(len,f);
515  for(j=0; j < len; ++j)
516  fast_print(ptr->storage_as.lisp_array.data[j],table);
517  return(NIL);
518  default:
519  errswitch();}}
520 
521 static LISP array_fast_read(int code,LISP table)
522 {long j,len,iflag;
523  FILE *f;
524  LISP ptr;
525  f = get_c_file(car(table),(FILE *) NULL);
526  switch (code)
527  {case tc_string:
528  len = get_long(f);
529  ptr = strcons(len,NULL);
530  if (fread(ptr->storage_as.string.data,len,1,f) != 1)
531  cerr << "Could not read string" << endl;
532  ptr->storage_as.string.data[len] = 0;
533  return(ptr);
534  case tc_double_array:
535  len = get_long(f);
536  iflag = no_interrupt(1);
537  ptr = newcell(tc_double_array);
538  ptr->storage_as.double_array.dim = len;
539  ptr->storage_as.double_array.data =
540  (double *) must_malloc(len * sizeof(double));
541  if (fread(ptr->storage_as.double_array.data,sizeof(double),len,f) != (long unsigned)len)
542  cerr << "Could not read double array" << endl;
543  no_interrupt(iflag);
544  return(ptr);
545  case tc_long_array:
546  len = get_long(f);
547  iflag = no_interrupt(1);
548  ptr = newcell(tc_long_array);
549  ptr->storage_as.long_array.dim = len;
550  ptr->storage_as.long_array.data =
551  (long *) must_malloc(len * sizeof(long));
552  if (fread(ptr->storage_as.long_array.data,sizeof(long),len,f) != (long unsigned) len)
553  cerr << "Could not read long array" << endl;
554  no_interrupt(iflag);
555  return(ptr);
556  case tc_lisp_array:
557  len = get_long(f);
558  FLONM(bashnum) = len;
559  ptr = cons_array(bashnum,NIL);
560  for(j=0; j < len; ++j)
561  ptr->storage_as.lisp_array.data[j] = fast_read(table);
562  return(ptr);
563  default:
564  errswitch();}}
565 
566 static void init_storage_xtr1(long type)
567 {long j;
568  struct user_type_hooks *p;
569  set_gc_hooks(type,
570  FALSE,
571  array_gc_relocate,
572  array_gc_mark,
573  array_gc_scan,
574  array_gc_free,
575  NULL,
576  &j);
577  set_print_hooks(type,array_prin1, NULL);
578  p = get_user_type_hooks(type);
579  p->fast_print = array_fast_print;
580  p->fast_read = array_fast_read;
581  p->equal = array_equal;
582  p->c_sxhash = array_sxhash;}
583 
584 static void init_storage_xtr(void)
585 {gc_protect(&bashnum);
586  bashnum = newcell(tc_flonum);
587  init_storage_xtr1(tc_string);
588  init_storage_xtr1(tc_double_array);
589  init_storage_xtr1(tc_long_array);
590  init_storage_xtr1(tc_lisp_array);}
591 
592 void init_subrs_xtr(void)
593 {
594 
595  init_storage_xtr();
596 
597  init_subr_2("aref",aref1,
598  "(aref ARRAY INDEX)\n\
599  Return ARRAY[INDEX]");
600  init_subr_3("aset",aset1,
601  "(aset ARRAY INDEX VAL)\n\
602  Set ARRAY[INDEX] = VAL");
603  init_subr_2("cons-array",cons_array,
604  "(cons-array DIM KIND)\n\
605  Construct array of size DIM and type KIND. Where KIND may be one of\n\
606  double, long, string or lisp.");
607  init_subr_2("sxhash",sxhash,
608  "(sxhash OBJ N)\n\
609  Return hashing value for OBJ, in range n.");
610  init_subr_2("href",href,
611  "(href TABLE KEY)\n\
612  Return value in hash table TABLE with KEY.");
613  init_subr_3("hset",hset,
614  "(hset TABLE KEY VALUE)\n\
615  Set hash table TABLE KEY to VALUE.");
616  init_subr_1("fast-read",fast_read,
617  "(fast-read TABLE)\n\
618  ");
619  init_subr_2("fast-print",fast_print,
620  "(fast-print P TABLE)\n\
621  ");
622  init_subr_2("make-list",make_list,
623  "(make-list SIZE VALUE)\n\
624  Return list of SIZE with each member VALUE.");
625 }
Definition: siod_defs.h:32
#define FO_fetch
Definition: siod_defs.h:145
LISP(* fast_print)(LISP, LISP)
Definition: siodp.h:54
#define tc_fsubr
Definition: siod_defs.h:112
#define NTYPEP(x, y)
Definition: siod_defs.h:101
#define INTERRUPT_CHECK()
Definition: siodp.h:87
LISP heap
Definition: slib.cc:115
#define tc_symbol
Definition: siod_defs.h:106
#define NULLP(x)
Definition: siod_defs.h:95
#define FO_listd
Definition: siod_defs.h:148
long int get_c_int(LISP x)
Definition: slib.cc:1850
#define NIL
Definition: siod_defs.h:92
#define STACK_CHECK(_ptr)
Definition: siodp.h:94
#define TKBUFFERN
Definition: siodp.h:97
#define HASH_COMBINE(_h1, _h2, _mod)
Definition: slib_xtr.cc:187
void init_subr_2(const char *name, LISP(*fcn)(LISP, LISP), const char *doc)
Definition: slib.cc:900
LISP strcons(long length, const char *data)
Definition: slib_str.cc:27
#define EQ(x, y)
Definition: siod_defs.h:93
LISP newcell(long type)
Definition: slib.cc:668
#define tc_flonum
Definition: siod_defs.h:105
#define NFLONUMP(x)
Definition: siod_defs.h:159
void set_print_hooks(long type, void(*prin1)(LISP, FILE *), void(*print_string)(LISP, char *))
Definition: slib.cc:1486
int index(EST_TList< T > &l, T &val, bool(*eq)(const EST_UItem *, const EST_UItem *)=NULL)
Definition: EST_TList.h:286
LISP setcdr(LISP cell, LISP value)
Definition: slib_list.cc:58
#define TYPE(x)
Definition: siod_defs.h:98
LISP equal(LISP, LISP)
Definition: slib_list.cc:133
#define tc_lisp_array
Definition: siod_defs.h:119
FILE * get_c_file(LISP p, FILE *deflt)
Definition: slib_file.cc:349
#define PNAME(x)
Definition: siod_defs.h:78
void err(const char *message, LISP x) EST_NORETURN
Definition: slib.cc:608
void gc_mark(LISP ptr)
Definition: slib.cc:1135
#define FO_list
Definition: siod_defs.h:147
void errswitch(void) EST_NORETURN
Definition: slib.cc:618
#define tc_lsubr
Definition: siod_defs.h:111
LISP(* equal)(LISP, LISP)
Definition: siodp.h:56
#define tc_msubr
Definition: siod_defs.h:113
LISP cintern(const char *name)
Definition: slib.cc:728
LISP cons(LISP x, LISP y)
Definition: slib_list.cc:97
void fput_st(FILE *f, const char *st)
Definition: slib.cc:450
#define tc_nil
Definition: siod_defs.h:103
void init_subrs_xtr(void)
Definition: slib_xtr.cc:592
#define FO_store
Definition: siod_defs.h:146
#define tc_cons
Definition: siod_defs.h:104
#define FLONUMP(x)
Definition: siod_defs.h:154
LISP assoc(LISP x, LISP alist)
Definition: slib_list.cc:36
#define FALSE
Definition: EST_bool.h:119
#define tc_subr_0
Definition: siod_defs.h:107
NULL
Definition: EST_WFST.cc:55
f
Definition: EST_item_aux.cc:48
void init_subr_1(const char *name, LISP(*fcn)(LISP), const char *doc)
Definition: slib.cc:898
long no_interrupt(long n)
Definition: slib.cc:275
LISP setcar(LISP cell, LISP value)
Definition: slib_list.cc:54
LISP(* fast_read)(int, LISP)
Definition: siodp.h:55
#define tc_subr_3
Definition: siod_defs.h:110
#define TYPEP(x, y)
Definition: siod_defs.h:100
#define CAR(x)
Definition: siod_defs.h:76
#define tc_string
Definition: siod_defs.h:116
void init_subr_3(const char *name, LISP(*fcn)(LISP, LISP, LISP), const char *doc)
Definition: slib.cc:902
LISP rintern(const char *name)
Definition: slib.cc:734
#define tc_subr_2
Definition: siod_defs.h:109
LISP heap_end
Definition: slib.cc:115
#define tc_subr_4
Definition: siod_defs.h:122
char * must_malloc(unsigned long size)
Definition: slib.cc:693
char * tkbuffer
Definition: slib.cc:122
struct user_type_hooks * get_user_type_hooks(long type)
Definition: slib.cc:913
LISP flocons(double x)
Definition: slib.cc:673
LISP gc_relocate(LISP x)
Definition: slib.cc:964
void gc_fatal_error(void)
Definition: slib.cc:665
#define tc_subr_1
Definition: siod_defs.h:108
void gc_protect(LISP *location)
Definition: slib.cc:791
LISP car(LISP x)
Definition: slib_list.cc:115
LISP truth
Definition: slib.cc:135
#define tc_double_array
Definition: siod_defs.h:117
LISP lprin1f(LISP exp, FILE *f)
Definition: slib_file.cc:471
#define tc_long_array
Definition: siod_defs.h:118
void wfree(void *p)
Definition: walloc.c:131
void set_gc_hooks(long type, int gc_free_once, LISP(*rel)(LISP), LISP(*mark)(LISP), void(*scan)(LISP), void(*free)(LISP), void(*clear)(LISP), long *kind)
Definition: slib.cc:946
long(* c_sxhash)(LISP, long)
Definition: siodp.h:53
#define CONSP(x)
Definition: siod_defs.h:153
LISP cdr(LISP x)
Definition: slib_list.cc:124
#define CDR(x)
Definition: siod_defs.h:77
#define FLONM(x)
Definition: siod_defs.h:87
#define NNULLP(x)
Definition: siod_defs.h:96