Edinburgh Speech Tools  2.1-release
slib.cc File Reference
#include <cstdio>
#include <cstring>
#include <cctype>
#include <csignal>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include "EST_unix.h"
#include "EST_cutils.h"
#include "siod.h"
#include "siodp.h"
Include dependency graph for slib.cc:

Go to the source code of this file.

Macros

#define DEAD_POINTER_GROWTH   (10)
 
#define ENVLOOKUP_TRICK   1
 

Functions

const char * siod_version (void)
 
void NNEWCELL (LISP *_into, long _type)
 
void need_n_cells (int n)
 
void siod_print_welcome (EST_String extra_info)
 
void siod_print_welcome (void)
 
void print_hs_1 (void)
 
void print_hs_2 (void)
 
long no_interrupt (long n)
 
void handle_sigfpe (int sig SIG_restargs)
 
void handle_sigint (int sig SIG_restargs)
 
void siod_reset_prompt (void)
 
long repl_driver (long want_sigint, long want_init, struct repl_hooks *h)
 
long repl_c_string (char *str, long want_sigint, long want_init, long want_print)
 
double myruntime (void)
 
void set_repl_hooks (void(*puts_f)(char *), LISP(*read_f)(void), LISP(*eval_f)(LISP), void(*print_f)(LISP))
 
void fput_st (FILE *f, const char *st)
 
void put_st (const char *st)
 
void grepl_puts (char *st, void(*repl_putss)(char *))
 
void set_fatal_exit_hook (void(*fcn)(void))
 
void err (const char *message, LISP x)
 
void err (const char *message, const char *x)
 
void errswitch (void)
 
void err_stack (char *ptr)
 
LISP stack_limit (LISP amount, LISP silent)
 
const char * get_c_string (LISP x)
 
LISP lerr (LISP message, LISP x)
 
void gc_fatal_error (void)
 
LISP newcell (long type)
 
LISP flocons (double x)
 
LISP symcons (char *pname, LISP vcell)
 
char * must_malloc (unsigned long size)
 
LISP gen_intern (char *name, int require_copy)
 
LISP cintern (const char *name)
 
LISP rintern (const char *name)
 
LISP intern (LISP name)
 
LISP subrcons (long type, const char *name, SUBR_FUNC f)
 
LISP closure (LISP env, LISP code)
 
void gc_unprotect (LISP *location)
 
void gc_protect (LISP *location)
 
void gc_protect_n (LISP *location, long n)
 
void gc_protect_sym (LISP *location, const char *st)
 
void scan_registers (void)
 
void init_storage (int init_heap_size)
 
void init_subr (const char *name, long type, SUBR_FUNC fcn)
 
void init_subr (const char *name, long type, SUBR_FUNC fcn, const char *doc)
 
void init_subr_0 (const char *name, LISP(*fcn)(void), const char *doc)
 
void init_subr_1 (const char *name, LISP(*fcn)(LISP), const char *doc)
 
void init_subr_2 (const char *name, LISP(*fcn)(LISP, LISP), const char *doc)
 
void init_subr_3 (const char *name, LISP(*fcn)(LISP, LISP, LISP), const char *doc)
 
void init_subr_4 (const char *name, LISP(*fcn)(LISP, LISP, LISP, LISP), const char *doc)
 
void init_lsubr (const char *name, LISP(*fcn)(LISP), const char *doc)
 
void init_fsubr (const char *name, LISP(*fcn)(LISP, LISP), const char *doc)
 
void init_msubr (const char *name, LISP(*fcn)(LISP *, LISP *), const char *doc)
 
struct user_type_hooksget_user_type_hooks (long type)
 
int siod_register_user_type (const char *name)
 
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)
 
LISP gc_relocate (LISP x)
 
LISP get_newspace (void)
 
void scan_newspace (LISP newspace)
 
void free_oldspace (LISP space, LISP end)
 
void gc_stop_and_copy (void)
 
void gc_for_newcell (void)
 
void gc_mark (LISP ptr)
 
LISP user_gc (LISP args)
 
LISP set_backtrace (LISP n)
 
LISP gc_status (LISP args)
 
LISP leval_args (LISP l, LISP env)
 
LISP extend_env (LISP actuals, LISP formals, LISP env)
 
LISP envlookup (LISP var, LISP env)
 
void set_eval_hooks (long type, LISP(*fcn)(LISP, LISP *, LISP *))
 
LISP leval (LISP x, LISP qenv)
 
void set_print_hooks (long type, void(*prin1)(LISP, FILE *), void(*print_string)(LISP, char *))
 
void set_io_hooks (long type, LISP(*fast_print)(LISP, LISP), LISP(*fast_read)(int, LISP))
 
void set_type_hooks (long type, long(*c_sxhash)(LISP, long), LISP(*equal)(LISP, LISP))
 
int f_getc (FILE *f)
 
void f_ungetc (int c, FILE *f)
 
int flush_ws (struct gen_readio *f, const char *eoferr)
 
LISP lreadf (FILE *f)
 
LISP readtl (struct gen_readio *f)
 
void set_read_hooks (char *all_set, char *end_set, LISP(*fcn1)(int, struct gen_readio *), LISP(*fcn2)(char *, long, int *))
 
LISP lreadtk (long j)
 
LISP siod_quit (void)
 
LISP l_exit (LISP arg)
 
LISP lfwarning (LISP mode)
 
LISP closure_code (LISP exp)
 
LISP closure_env (LISP exp)
 
long int get_c_int (LISP x)
 
double get_c_double (LISP x)
 
float get_c_float (LISP x)
 
void init_subrs_base (void)
 
void init_subrs (void)
 
void err0 (void)
 
void pr (LISP p)
 
void prp (LISP *p)
 
LISP siod_make_typed_cell (long type, void *s)
 

Variables

LISP heap_1
 
LISP heap_2
 
LISP heap
 
LISP heap_end
 
LISP heap_org
 
long heap_size = DEFAULT_HEAP_SIZE
 
long old_heap_used
 
long which_heap
 
long gc_status_flag = 0
 
long show_backtrace = 0
 
char * init_file = (char *) NULL
 
char * tkbuffer = NULL
 
long gc_kind_copying = 0
 
long gc_cells_allocated = 0
 
double gc_time_taken
 
LISP * stack_start_ptr
 
LISP freelist
 
long nointerrupt = 1
 
long interrupt_differed = 0
 
LISP oblistvar = NIL
 
LISP current_env = NIL
 
LISP restricted = NIL
 
LISP truth = NIL
 
LISP eof_val = NIL
 
LISP sym_errobj = NIL
 
LISP unbound_marker = NIL
 
LISP * obarray
 
long obarray_dim = 100
 
struct catch_framecatch_framep = (struct catch_frame *) NULL
 
void(* repl_puts )(char *) = NULL
 
LISP(* repl_read )(void) = NULL
 
LISP(* repl_eval )(LISP) = NULL
 
void(* repl_print )(LISP) = NULL
 
repl_getc_fn siod_fancy_getc = f_getc
 
repl_ungetc_fn siod_fancy_ungetc = f_ungetc
 
LISP * inums
 
LISP siod_docstrings = NIL
 
long inums_dim = 100
 
struct user_type_hooksuser_types = NULL
 
struct gc_protectedprotected_registers = NULL
 
jmp_buf save_regs_gc_mark
 
double gc_rt
 
long gc_cells_collected
 
LISP(* user_readm )(int, struct gen_readio *) = NULL
 
LISP(* user_readt )(char *, long, int *) = NULL
 
void(* fatal_exit_hook )(void) = NULL
 
FILE * fwarn =NULL
 
int siod_interactive = 1
 
int el_pos = -1
 
const char * repl_prompt = "siod>"
 
const char * siod_prog_name = "siod"
 
const char * siod_primary_prompt = "siod> "
 
const char * siod_secondary_prompt = "> "
 
void ** dead_pointers = NULL
 
int size_dead_pointers = 0
 
int num_dead_pointers = 0
 
char * stack_limit_ptr = NULL
 
long stack_size = 500000
 
int audsp_mode = FALSE
 
int siod_ctrl_c = FALSE
 
LISP global_var = NIL
 
LISP global_env = NIL
 

Macro Definition Documentation

#define DEAD_POINTER_GROWTH   (10)

Definition at line 180 of file slib.cc.

#define ENVLOOKUP_TRICK   1

Definition at line 1349 of file slib.cc.

Function Documentation

const char* siod_version ( void  )

Definition at line 111 of file slib.cc.

void NNEWCELL ( LISP *  _into,
long  _type 
)

Definition at line 187 of file slib.cc.

void need_n_cells ( int  n)

Definition at line 200 of file slib.cc.

void siod_print_welcome ( EST_String  extra_info)

Definition at line 239 of file slib.cc.

void siod_print_welcome ( void  )

Definition at line 247 of file slib.cc.

void print_hs_1 ( void  )

Definition at line 252 of file slib.cc.

void print_hs_2 ( void  )

Definition at line 258 of file slib.cc.

long no_interrupt ( long  n)

Definition at line 275 of file slib.cc.

void handle_sigfpe ( int sig  SIG_restargs)

Definition at line 284 of file slib.cc.

void handle_sigint ( int sig  SIG_restargs)

Definition at line 301 of file slib.cc.

void siod_reset_prompt ( void  )

Definition at line 321 of file slib.cc.

long repl_driver ( long  want_sigint,
long  want_init,
struct repl_hooks h 
)

Definition at line 329 of file slib.cc.

long repl_c_string ( char *  str,
long  want_sigint,
long  want_init,
long  want_print 
)

Definition at line 392 of file slib.cc.

double myruntime ( void  )

Definition at line 434 of file slib.cc.

void set_repl_hooks ( void(*)(char *)  puts_f,
LISP(*)(void)  read_f,
LISP(*)(LISP)  eval_f,
void(*)(LISP)  print_f 
)

Definition at line 441 of file slib.cc.

void fput_st ( FILE *  f,
const char *  st 
)

Definition at line 450 of file slib.cc.

void put_st ( const char *  st)

Definition at line 460 of file slib.cc.

void grepl_puts ( char *  st,
void(*)(char *)  repl_putss 
)

Definition at line 463 of file slib.cc.

void set_fatal_exit_hook ( void(*)(void)  fcn)

Definition at line 570 of file slib.cc.

void err ( const char *  message,
LISP  x 
)

Definition at line 608 of file slib.cc.

void err ( const char *  message,
const char *  x 
)

Definition at line 613 of file slib.cc.

void errswitch ( void  )

Definition at line 618 of file slib.cc.

void err_stack ( char *  ptr)

Definition at line 621 of file slib.cc.

LISP stack_limit ( LISP  amount,
LISP  silent 
)

Definition at line 626 of file slib.cc.

const char* get_c_string ( LISP  x)

Definition at line 638 of file slib.cc.

LISP lerr ( LISP  message,
LISP  x 
)

Definition at line 661 of file slib.cc.

void gc_fatal_error ( void  )

Definition at line 665 of file slib.cc.

LISP newcell ( long  type)

Definition at line 668 of file slib.cc.

LISP flocons ( double  x)

Definition at line 673 of file slib.cc.

LISP symcons ( char *  pname,
LISP  vcell 
)

Definition at line 686 of file slib.cc.

char* must_malloc ( unsigned long  size)

Definition at line 693 of file slib.cc.

LISP gen_intern ( char *  name,
int  require_copy 
)

Definition at line 699 of file slib.cc.

LISP cintern ( const char *  name)

Definition at line 728 of file slib.cc.

LISP rintern ( const char *  name)

Definition at line 734 of file slib.cc.

LISP intern ( LISP  name)

Definition at line 742 of file slib.cc.

LISP subrcons ( long  type,
const char *  name,
SUBR_FUNC  f 
)

Definition at line 745 of file slib.cc.

LISP closure ( LISP  env,
LISP  code 
)

Definition at line 752 of file slib.cc.

void gc_unprotect ( LISP *  location)

Definition at line 759 of file slib.cc.

void gc_protect ( LISP *  location)

Definition at line 791 of file slib.cc.

void gc_protect_n ( LISP *  location,
long  n 
)

Definition at line 803 of file slib.cc.

void gc_protect_sym ( LISP *  location,
const char *  st 
)

Definition at line 811 of file slib.cc.

void scan_registers ( void  )

Definition at line 815 of file slib.cc.

void init_storage ( int  init_heap_size)

Definition at line 880 of file slib.cc.

void init_subr ( const char *  name,
long  type,
SUBR_FUNC  fcn 
)

Definition at line 888 of file slib.cc.

void init_subr ( const char *  name,
long  type,
SUBR_FUNC  fcn,
const char *  doc 
)

Definition at line 890 of file slib.cc.

void init_subr_0 ( const char *  name,
LISP(*)(void)  fcn,
const char *  doc 
)

Definition at line 896 of file slib.cc.

void init_subr_1 ( const char *  name,
LISP(*)(LISP)  fcn,
const char *  doc 
)

Definition at line 898 of file slib.cc.

void init_subr_2 ( const char *  name,
LISP(*)(LISP, LISP)  fcn,
const char *  doc 
)

Definition at line 900 of file slib.cc.

void init_subr_3 ( const char *  name,
LISP(*)(LISP, LISP, LISP)  fcn,
const char *  doc 
)

Definition at line 902 of file slib.cc.

void init_subr_4 ( const char *  name,
LISP(*)(LISP, LISP, LISP, LISP)  fcn,
const char *  doc 
)

Definition at line 904 of file slib.cc.

void init_lsubr ( const char *  name,
LISP(*)(LISP)  fcn,
const char *  doc 
)

Definition at line 906 of file slib.cc.

void init_fsubr ( const char *  name,
LISP(*)(LISP, LISP)  fcn,
const char *  doc 
)

Definition at line 908 of file slib.cc.

void init_msubr ( const char *  name,
LISP(*)(LISP *, LISP *)  fcn,
const char *  doc 
)

Definition at line 910 of file slib.cc.

struct user_type_hooks* get_user_type_hooks ( long  type)

Definition at line 913 of file slib.cc.

int siod_register_user_type ( const char *  name)

Definition at line 925 of file slib.cc.

void set_gc_hooks ( long  type,
int  gc_free_once,
LISP(*)(LISP)  rel,
LISP(*)(LISP)  mark,
void(*)(LISP)  scan,
void(*)(LISP)  free,
void(*)(LISP)  clear,
long *  kind 
)

Definition at line 946 of file slib.cc.

LISP gc_relocate ( LISP  x)

Definition at line 964 of file slib.cc.

LISP get_newspace ( void  )

Definition at line 1001 of file slib.cc.

void scan_newspace ( LISP  newspace)

Definition at line 1014 of file slib.cc.

void free_oldspace ( LISP  space,
LISP  end 
)

Definition at line 1041 of file slib.cc.

void gc_stop_and_copy ( void  )

Definition at line 1075 of file slib.cc.

void gc_for_newcell ( void  )

Definition at line 1093 of file slib.cc.

void gc_mark ( LISP  ptr)

Definition at line 1135 of file slib.cc.

LISP user_gc ( LISP  args)

Definition at line 1269 of file slib.cc.

LISP set_backtrace ( LISP  n)

Definition at line 1293 of file slib.cc.

LISP gc_status ( LISP  args)

Definition at line 1302 of file slib.cc.

LISP leval_args ( LISP  l,
LISP  env 
)

Definition at line 1328 of file slib.cc.

LISP extend_env ( LISP  actuals,
LISP  formals,
LISP  env 
)

Definition at line 1341 of file slib.cc.

LISP envlookup ( LISP  var,
LISP  env 
)

Definition at line 1353 of file slib.cc.

void set_eval_hooks ( long  type,
LISP(*)(LISP, LISP *, LISP *)  fcn 
)

Definition at line 1373 of file slib.cc.

LISP leval ( LISP  x,
LISP  qenv 
)

Definition at line 1378 of file slib.cc.

void set_print_hooks ( long  type,
void(*)(LISP, FILE *)  prin1,
void(*)(LISP, char *)  print_string 
)

Definition at line 1486 of file slib.cc.

void set_io_hooks ( long  type,
LISP(*)(LISP, LISP)  fast_print,
LISP(*)(int, LISP)  fast_read 
)

Definition at line 1496 of file slib.cc.

void set_type_hooks ( long  type,
long(*)(LISP, long)  c_sxhash,
LISP(*)(LISP, LISP)  equal 
)

Definition at line 1506 of file slib.cc.

int f_getc ( FILE *  f)

Definition at line 1517 of file slib.cc.

void f_ungetc ( int  c,
FILE *  f 
)

Definition at line 1530 of file slib.cc.

int flush_ws ( struct gen_readio f,
const char *  eoferr 
)

Definition at line 1572 of file slib.cc.

LISP lreadf ( FILE *  f)

Definition at line 1582 of file slib.cc.

LISP readtl ( struct gen_readio f)

Definition at line 1608 of file slib.cc.

void set_read_hooks ( char *  all_set,
char *  end_set,
LISP(*)(int, struct gen_readio *)  fcn1,
LISP(*)(char *, long, int *)  fcn2 
)

Definition at line 1615 of file slib.cc.

LISP lreadtk ( long  j)

Definition at line 1788 of file slib.cc.

LISP siod_quit ( void  )

Definition at line 1817 of file slib.cc.

LISP l_exit ( LISP  arg)

Definition at line 1823 of file slib.cc.

LISP lfwarning ( LISP  mode)

Definition at line 1834 of file slib.cc.

LISP closure_code ( LISP  exp)

Definition at line 1844 of file slib.cc.

LISP closure_env ( LISP  exp)

Definition at line 1847 of file slib.cc.

long int get_c_int ( LISP  x)

Definition at line 1850 of file slib.cc.

double get_c_double ( LISP  x)

Definition at line 1854 of file slib.cc.

float get_c_float ( LISP  x)

Definition at line 1858 of file slib.cc.

void init_subrs_base ( void  )

Definition at line 1863 of file slib.cc.

void init_subrs ( void  )

Definition at line 1922 of file slib.cc.

void err0 ( void  )

Definition at line 1938 of file slib.cc.

void pr ( LISP  p)

Definition at line 1941 of file slib.cc.

void prp ( LISP *  p)

Definition at line 1949 of file slib.cc.

LISP siod_make_typed_cell ( long  type,
void *  s 
)

Definition at line 1953 of file slib.cc.

Variable Documentation

LISP heap_1

Definition at line 114 of file slib.cc.

LISP heap_2

Definition at line 114 of file slib.cc.

LISP heap

Definition at line 115 of file slib.cc.

LISP heap_end

Definition at line 115 of file slib.cc.

LISP heap_org

Definition at line 115 of file slib.cc.

long heap_size = DEFAULT_HEAP_SIZE

Definition at line 116 of file slib.cc.

long old_heap_used

Definition at line 117 of file slib.cc.

long which_heap

Definition at line 118 of file slib.cc.

long gc_status_flag = 0

Definition at line 119 of file slib.cc.

long show_backtrace = 0

Definition at line 120 of file slib.cc.

char* init_file = (char *) NULL

Definition at line 121 of file slib.cc.

char* tkbuffer = NULL

Definition at line 122 of file slib.cc.

long gc_kind_copying = 0

Definition at line 123 of file slib.cc.

long gc_cells_allocated = 0

Definition at line 124 of file slib.cc.

double gc_time_taken

Definition at line 125 of file slib.cc.

LISP* stack_start_ptr

Definition at line 126 of file slib.cc.

LISP freelist

Definition at line 127 of file slib.cc.

long nointerrupt = 1

Definition at line 129 of file slib.cc.

long interrupt_differed = 0

Definition at line 130 of file slib.cc.

LISP oblistvar = NIL

Definition at line 131 of file slib.cc.

LISP current_env = NIL

Definition at line 132 of file slib.cc.

LISP restricted = NIL

Definition at line 134 of file slib.cc.

LISP truth = NIL

Definition at line 135 of file slib.cc.

LISP eof_val = NIL

Definition at line 136 of file slib.cc.

LISP sym_errobj = NIL

Definition at line 137 of file slib.cc.

LISP unbound_marker = NIL

Definition at line 140 of file slib.cc.

LISP* obarray

Definition at line 141 of file slib.cc.

long obarray_dim = 100

Definition at line 142 of file slib.cc.

struct catch_frame* catch_framep = (struct catch_frame *) NULL

Definition at line 143 of file slib.cc.

void(* repl_puts) (char *) = NULL

Definition at line 144 of file slib.cc.

LISP(* repl_read) (void) = NULL

Definition at line 145 of file slib.cc.

LISP(* repl_eval) (LISP) = NULL

Definition at line 146 of file slib.cc.

void(* repl_print) (LISP) = NULL

Definition at line 147 of file slib.cc.

repl_getc_fn siod_fancy_getc = f_getc

Definition at line 148 of file slib.cc.

repl_ungetc_fn siod_fancy_ungetc = f_ungetc

Definition at line 149 of file slib.cc.

LISP* inums

Definition at line 150 of file slib.cc.

LISP siod_docstrings = NIL

Definition at line 151 of file slib.cc.

long inums_dim = 100

Definition at line 152 of file slib.cc.

struct user_type_hooks* user_types = NULL

Definition at line 153 of file slib.cc.

struct gc_protected* protected_registers = NULL

Definition at line 154 of file slib.cc.

jmp_buf save_regs_gc_mark

Definition at line 155 of file slib.cc.

double gc_rt

Definition at line 156 of file slib.cc.

long gc_cells_collected

Definition at line 157 of file slib.cc.

LISP(* user_readm) (int, struct gen_readio *) = NULL

Definition at line 160 of file slib.cc.

LISP(* user_readt) (char *, long, int *) = NULL

Definition at line 161 of file slib.cc.

void(* fatal_exit_hook) (void) = NULL

Definition at line 162 of file slib.cc.

FILE* fwarn =NULL

Definition at line 163 of file slib.cc.

int siod_interactive = 1

Definition at line 164 of file slib.cc.

int el_pos = -1

Definition at line 168 of file slib.cc.

const char* repl_prompt = "siod>"

Definition at line 170 of file slib.cc.

const char* siod_prog_name = "siod"

Definition at line 171 of file slib.cc.

const char* siod_primary_prompt = "siod> "

Definition at line 172 of file slib.cc.

const char* siod_secondary_prompt = "> "

Definition at line 173 of file slib.cc.

void** dead_pointers = NULL

Definition at line 177 of file slib.cc.

int size_dead_pointers = 0

Definition at line 178 of file slib.cc.

int num_dead_pointers = 0

Definition at line 179 of file slib.cc.

char* stack_limit_ptr = NULL

Definition at line 184 of file slib.cc.

long stack_size = 500000

Definition at line 185 of file slib.cc.

int audsp_mode = FALSE

Definition at line 266 of file slib.cc.

int siod_ctrl_c = FALSE

Definition at line 267 of file slib.cc.

LISP global_var = NIL

Definition at line 1350 of file slib.cc.

LISP global_env = NIL

Definition at line 1351 of file slib.cc.