home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / xlisp.lbr / XLISP.CQ / xlisp.c
Encoding:
C/C++ Source or Header  |  1985-06-03  |  2.1 KB  |  92 lines

  1.  
  2.                       /* xlisp - a small subset of lisp */
  3.  
  4. #ifdef CI_86
  5. #include "A:STDIO.H"
  6. #include "xlisp.h"
  7. #endif
  8.  
  9. #ifdef AZTEC
  10. #include "a:stdio.h"
  11. #include "a:setjmp.h"
  12. #include "xlisp.h"
  13. #endif
  14.  
  15. #ifdef DECUS
  16. #include <stdio.h>
  17. #include <setjmp.h>
  18. #include <xlisp.h>
  19. #endif
  20.  
  21.                           /* External variables */
  22.  
  23. extern struct node *xlenv;
  24. extern struct node *xlstack;
  25. extern int xlpvals;
  26.  
  27.                               /* Local variables */
  28.  
  29. static char ljmp[6];
  30.  
  31.                            /**************************
  32.                            * main - the main routine *
  33.                            **************************/
  34.  
  35. main(argc,argv)
  36.   int argc; char *argv[];
  37. {
  38.     struct node expr;
  39.  
  40.     xldmeminit();                 /* initialize the dynamic memory module */
  41.                                   /* (must be first initilization call */
  42. #ifdef DEBUG
  43.     xldebuginit();
  44. #endif
  45.                                   /* initialize each lisp module */
  46.     xlinit();
  47.     xleinit();
  48.     xllinit();
  49.     xlminit();
  50.     xloinit();
  51.     xlsinit();
  52.     xlfinit();
  53.     xlpinit();
  54.  
  55. #ifdef KEYMAPCLASS
  56.     xlkinit();
  57. #endif
  58.  
  59.     xltin(FALSE);
  60.  
  61.     if (argc > 1)                 /* read the input file if specified */
  62.         xlfin(argv[1]);
  63.     else
  64.         printf("XLISP version 1.2\n");
  65.  
  66.     setjmp(ljmp);                 /* Set up the error return */
  67.     while (TRUE)                  /* Main command processing loop */
  68.     {
  69.         xlstack = xlenv = NULL;   /* Free any previous expression and */
  70.                                   /* left over context */
  71.  
  72.         xlsave(&expr,NULL);       /* create a new stack frame */
  73.  
  74.         expr.n_ptr = xlread();    /* Read and evaluate an expression */
  75.         expr.n_ptr = xleval(expr.n_ptr);
  76.  
  77.         if (xlpvals)              /* print it if necessary */
  78.         {
  79.             xlprint(expr.n_ptr, TRUE);
  80.             putchar('\n');
  81.         }
  82.     }
  83. }
  84.  
  85.  
  86. xlabort()
  87. {
  88.     /* Procedure to localize machine dependent abort jump */
  89.  
  90.     longjmp(ljmp);
  91. }
  92.