home *** CD-ROM | disk | FTP | other *** search
- /* xlinit.c - xlisp initialization module */
-
- #ifdef AZTEC
- #include "stdio.h"
- #else
- #include <stdio.h>
- #endif
-
- #include "xlisp.h"
-
- /* global variables */
- struct node *true;
- struct node *s_quote;
- struct node *s_lambda,*s_nlambda;
- struct node *s_stdin,*s_stdout;
- struct node *s_tracenable;
- struct node *k_rest,*k_aux;
- struct node *a_subr;
- struct node *a_fsubr;
- struct node *a_list;
- struct node *a_sym;
- struct node *a_int;
- struct node *a_str;
- struct node *a_obj;
- struct node *a_fptr;
-
- /* external variables */
- extern struct fdef ftab[];
-
- /* xlinit - xlisp initialization routine */
- xlinit()
- {
- struct fdef *fptr;
- struct node *sym;
-
- /* initialize xlisp (must be in this order) */
- xlminit(); /* initialize xldmem.c */
- xlsinit(); /* initialize xlsym.c */
- xleinit(); /* initialize xleval.c */
- xloinit(); /* initialize xlobj.c */
-
- /* enter the builtin functions */
- for (fptr = ftab; fptr->f_name; fptr++)
- xlsubr(fptr->f_name,fptr->f_type,fptr->f_fcn);
-
- /* enter the 't' symbol */
- true = xlsenter("t");
- true->n_symvalue = true;
-
- /* enter some important symbols */
- s_quote = xlsenter("quote");
- s_lambda = xlsenter("lambda");
- s_nlambda = xlsenter("nlambda");
- k_rest = xlsenter("&rest");
- k_aux = xlsenter("&aux");
-
- /* enter *standard-input* and *standard-output* */
- s_stdin = xlsenter("*standard-input*");
- s_stdin->n_symvalue = newnode(FPTR);
- s_stdin->n_symvalue->n_fp = stdin;
- s_stdin->n_symvalue->n_savech = 0;
- s_stdout = xlsenter("*standard-output*");
- s_stdout->n_symvalue = newnode(FPTR);
- s_stdout->n_symvalue->n_fp = stdout;
- s_stdout->n_symvalue->n_savech = 0;
-
- /* enter the error traceback enable flag */
- s_tracenable = xlsenter("*tracenable*");
- s_tracenable->n_symvalue = true;
-
- /* enter a copyright notice into the oblist */
- sym = xlsenter("**Copyright-1984-by-David-Betz**");
- sym->n_symvalue = true;
-
- /* enter type names */
- a_subr = xlsenter("SUBR");
- a_fsubr = xlsenter("FSUBR");
- a_list = xlsenter("LIST");
- a_sym = xlsenter("SYM");
- a_int = xlsenter("INT");
- a_str = xlsenter("STR");
- a_obj = xlsenter("OBJ");
- a_fptr = xlsenter("FPTR");
- }