xldinit(void) { if ((trace_stack = (NODE **)malloc(500 * sizeof(NODE *))) == 0) { printf("insufficient memory"); osfinish(); exit(1); } total += (long)(500 * sizeof(NODE *)); xlsample = 0; xltrace = -1; xldebug = 0; }
main(int argc, char **argv) { CONTEXT cntxt; NODE *expr; int i; osinit("XLISP version 1.6, Copyright (c) 1985, by David Betz"); xlbegin(&cntxt,64|8,(NODE *) 1); if (setjmp(cntxt.c_jmpbuf)) { printf("fatal initialization error\n"); osfinish(); exit(1); } xlinit(); xlend(&cntxt); xlbegin(&cntxt,64|8,true); if (setjmp(cntxt.c_jmpbuf) == 0) xlload("init.lsp",0,0); if (setjmp(cntxt.c_jmpbuf) == 0) for (i = 1; i < argc; i++) if (!xlload(argv[i],1,0)) xlfail("can't load file"); xlsave(&expr,(NODE **)0); while (1) { if (i = setjmp(cntxt.c_jmpbuf)) { if (i == 64) stdputstr("[ back to the top level ]\n"); ((s_evalhook)->n_info.n_xsym.xsy_value = ((NODE *)0)); ((s_applyhook)->n_info.n_xsym.xsy_value = ((NODE *)0)); xldebug = 0; xlflush(); } if (!xlread(((s_stdin)->n_info.n_xsym.xsy_value),&expr,0)) break; expr = xleval(expr); stdprint(expr); } xlend(&cntxt); osfinish (); exit (0); }
/* xlminit - initialize the dynamic memory module */ void xlminit(void ) { /* initialize our internal variables */ anodes = NNODES; total = 0L; nnodes = nsegs = nfree = gccalls = 0; fnodes = NIL; segs = NULL; /* initialize structures that are marked by the collector */ xlenv = obarray = NIL; /* allocate the evaluation stack */ if ((xlstkbase = (NODE ***)malloc(EDEPTH * sizeof(NODE **))) == NULL) { printf("insufficient memory"); osfinish (); exit(1); } total += (long)(EDEPTH * sizeof(NODE **)); xlstack = xlstktop = xlstkbase + EDEPTH; }
/* livecdr - do we need to follow the cdr? */ LOCAL int livecdr(NODE *n) { switch (ntype(n)) { case SUBR: case FSUBR: case INT: case FLOAT: case STR: case FPTR: case OBJ: case VECT: return (FALSE); case SYM: case LIST: return (cdr(n) != NIL); default: printf("bad node type (%d) found during right scan\n",ntype(n)); osfinish (); exit(1); } /*NOTREACHED*/ }
pascal OSErr AEQuit (AppleEvent *theAppleEvent, AppleEvent *theReply, long Refcon) { osfinish(); }