Annotation of 41BSD/cmd/lisp/lisp.c, revision 1.1.1.1

1.1       root        1: static char *sccsid = "@(#)lisp.c      34.1 10/3/80";
                      2: 
                      3: #include       "global.h"
                      4: 
                      5: /* main *****************************************************************/
                      6: /* Execution of the lisp system begins here.  This is the top level    */
                      7: /* executor which is an infinite loop.  The structure is similar to    */
                      8: /* error.                                                              */
                      9: 
                     10: extern char _sobuf[];
                     11: extern lispval reborn;
                     12: extern int rlevel;
                     13: static int virgin = 0;
                     14: int    Xargc;
                     15: char   **Xargv;
                     16: extern int environ;
                     17: 
                     18: main(argc,argv,arge)
                     19: char **argv;
                     20: {
                     21:        lispval temp, matom();
                     22:        extern int errp;
                     23:        extern int holbeg,holend,usehole;
                     24:        extern int *curhbeg;
                     25: 
                     26:        snpand(0);
                     27:        
                     28:        environ = arge;
                     29:        setbuf(stdout,_sobuf);
                     30:        Xargc = argc;
                     31:        Xargv = argv;
                     32:        virgin = 0;
                     33:        initial();
                     34: /* printf("poport = 0%o\n",poport); */
                     35:        while(retval = setexit())
                     36:                switch (retval) {
                     37: 
                     38:                case BRGOTO:    error("GOTO LABEL NOT FOUND",FALSE);
                     39: 
                     40:                case BRRETN:    error("NO PROG TO RETURN FROM",FALSE);
                     41:                
                     42:                case BRRETB:
                     43:                default:        popnames(orgbnp);
                     44: 
                     45:        }
                     46:        for(EVER) {
                     47:                lbot = np = orgnp;
                     48:                rlevel = 0;
                     49:                depth = 0;
                     50:                errp = 0;
                     51:                clearerr(piport = stdin);
                     52:                clearerr(poport = stdout);
                     53:                np++->val = matom("top-level");
                     54:                np++->val = nil;
                     55:                Lapply();
                     56:        }
                     57: }
                     58: Ntpl()
                     59: {
                     60:        lispval Lread(),Istsrch();
                     61:        snpand(0);
                     62: 
                     63:        if (virgin == 0) {
                     64:                fputs(Istsrch(matom("version"))->d.cdr->d.cdr->d.cdr,poport);
                     65:                virgin = 1;
                     66:        }
                     67:        lbot = np;
                     68:        np++->val = P(stdin);
                     69:        np++->val = eofa;
                     70:        while (TRUE)
                     71:                {
                     72:                fputs("\n-> ",stdout);
                     73:                dmpport(stdout);
                     74:                vtemp = Lread();
                     75:                if(vtemp == eofa) exit(0);
                     76:                printr(eval(vtemp),stdout);
                     77:                }
                     78:        }
                     79: 
                     80: #ifndef VMS
                     81: exit(code)
                     82: {
                     83:        extern int fvirgin;
                     84:        extern char *stabf;
                     85:        if(!fvirgin) unlink(stabf);
                     86:        _cleanup();
                     87:        proflush();
                     88:        _exit(code);
                     89: }
                     90: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.