|
|
1.1 root 1: #ifndef lint
2: static char *rcsid =
3: "$Header: lisp.c,v 1.2 83/09/07 17:56:04 sklower Exp $";
4: #endif
5:
6: /* -[Sat Jan 29 13:24:33 1983 by jkf]-
7: * lisp.c $Locker: $
8: * main program
9: *
10: * (c) copyright 1982, Regents of the University of California
11: */
12:
13: #include "global.h"
14: #include "frame.h"
15:
16: /* main *****************************************************************/
17: /* Execution of the lisp system begins here. This is the top level */
18: /* executor which is an infinite loop. The structure is similar to */
19: /* error. */
20:
21: extern char _sobuf[];
22: extern lispval reborn;
23: extern int rlevel;
24: static int virgin = 0;
25: int Xargc;
26: char **Xargv;
27: extern char **environ;
28:
29: main(argc,argv,arge)
30: char **argv,**arge;
31: {
32: lispval matom(), Lapply();
33: extern struct frame *errp;
34: extern int holbeg,holend,usehole;
35: extern int *curhbeg;
36: pbuf pb;
37:
38: environ = arge;
39: setbuf(stdout,_sobuf);
40: Xargc = argc;
41: Xargv = argv;
42: virgin = 0;
43: errp = (struct frame *)0;
44: initial();
45:
46: errp = Pushframe(F_RESET,nil,nil);
47: switch(retval)
48: {
49: case C_RESET: break; /* what to do? */
50: case C_INITIAL: break; /* first time */
51: }
52:
53: for(EVER) {
54: lbot = np = orgnp;
55: rlevel = 0;
56: depth = 0;
57: clearerr(piport = stdin);
58: clearerr(poport = stdout);
59: np++->val = matom("top-level");
60: np++->val = nil;
61: Lapply();
62: }
63: }
64:
65: lispval
66: Ntpl()
67: {
68: lispval Lread(),Istsrch();
69:
70: if (virgin == 0) {
71: fputs((char *)Istsrch(matom("version"))->d.cdr->d.cdr->d.cdr,poport);
72: virgin = 1;
73: }
74: lbot = np;
75: np++->val = P(stdin);
76: np++->val = eofa;
77: while (TRUE)
78: {
79: fputs("\n-> ",stdout);
80: dmpport(stdout);
81: vtemp = Lread();
82: if(vtemp == eofa) exit(0);
83: printr(eval(vtemp),stdout);
84: }
85: }
86:
87: /* franzexit :: give up the ghost
88: * this function is called whenever one decides to kill this process.
89: * We clean up a bit then call then standard exit routine. C code
90: * in franz should never call exit() directly.
91: */
92: franzexit(code)
93: {
94: extern int fvirgin;
95: extern char *stabf;
96: if(!fvirgin) unlink(stabf); /* give up any /tmp symbol tables */
97: exit(code);
98: /* is this something special?? _cleanup();
99: * proflush();
100: * _exit(code);
101: */
102:
103: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.