home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / xlisp / xlisp12.ark / XLINIT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1985-02-20  |  2.3 KB  |  85 lines

  1. /* xlinit.c - xlisp initialization module */
  2.  
  3. #ifdef AZTEC
  4. #include "stdio.h"
  5. #else
  6. #include <stdio.h>
  7. #endif
  8.  
  9. #include "xlisp.h"
  10.  
  11. /* global variables */
  12. struct node *true;
  13. struct node *s_quote;
  14. struct node *s_lambda,*s_nlambda;
  15. struct node *s_stdin,*s_stdout;
  16. struct node *s_tracenable;
  17. struct node *k_rest,*k_aux;
  18. struct node *a_subr;
  19. struct node *a_fsubr;
  20. struct node *a_list;
  21. struct node *a_sym;
  22. struct node *a_int;
  23. struct node *a_str;
  24. struct node *a_obj;
  25. struct node *a_fptr;
  26.  
  27. /* external variables */
  28. extern struct fdef ftab[];
  29.  
  30. /* xlinit - xlisp initialization routine */
  31. xlinit()
  32. {
  33.     struct fdef *fptr;
  34.     struct node *sym;
  35.  
  36.     /* initialize xlisp (must be in this order) */
  37.     xlminit();    /* initialize xldmem.c */
  38.     xlsinit();    /* initialize xlsym.c */
  39.     xleinit();    /* initialize xleval.c */
  40.     xloinit();    /* initialize xlobj.c */
  41.  
  42.     /* enter the builtin functions */
  43.     for (fptr = ftab; fptr->f_name; fptr++)
  44.     xlsubr(fptr->f_name,fptr->f_type,fptr->f_fcn);
  45.  
  46.     /* enter the 't' symbol */
  47.     true = xlsenter("t");
  48.     true->n_symvalue = true;
  49.  
  50.     /* enter some important symbols */
  51.     s_quote    = xlsenter("quote");
  52.     s_lambda    = xlsenter("lambda");
  53.     s_nlambda    = xlsenter("nlambda");
  54.     k_rest    = xlsenter("&rest");
  55.     k_aux    = xlsenter("&aux");
  56.  
  57.     /* enter *standard-input* and *standard-output* */
  58.     s_stdin = xlsenter("*standard-input*");
  59.     s_stdin->n_symvalue = newnode(FPTR);
  60.     s_stdin->n_symvalue->n_fp = stdin;
  61.     s_stdin->n_symvalue->n_savech = 0;
  62.     s_stdout = xlsenter("*standard-output*");
  63.     s_stdout->n_symvalue = newnode(FPTR);
  64.     s_stdout->n_symvalue->n_fp = stdout;
  65.     s_stdout->n_symvalue->n_savech = 0;
  66.  
  67.     /* enter the error traceback enable flag */
  68.     s_tracenable = xlsenter("*tracenable*");
  69.     s_tracenable->n_symvalue = true;
  70.  
  71.     /* enter a copyright notice into the oblist */
  72.     sym = xlsenter("**Copyright-1984-by-David-Betz**");
  73.     sym->n_symvalue = true;
  74.  
  75.     /* enter type names */
  76.     a_subr    = xlsenter("SUBR");
  77.     a_fsubr    = xlsenter("FSUBR");
  78.     a_list    = xlsenter("LIST");
  79.     a_sym    = xlsenter("SYM");
  80.     a_int    = xlsenter("INT");
  81.     a_str    = xlsenter("STR");
  82.     a_obj    = xlsenter("OBJ");
  83.     a_fptr    = xlsenter("FPTR");
  84. }
  85.