From 7bbfca116a81abb60bfcb48c939dc599ccf380dc Mon Sep 17 00:00:00 2001 From: John Foderaro Date: Thu, 27 Dec 1979 18:44:17 -0800 Subject: [PATCH] BSD 3 development Work on file usr/src/cmd/lisp/inits.c Synthesized-from: 3bsd --- usr/src/cmd/lisp/inits.c | 140 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 usr/src/cmd/lisp/inits.c diff --git a/usr/src/cmd/lisp/inits.c b/usr/src/cmd/lisp/inits.c new file mode 100644 index 0000000000..993c3c015d --- /dev/null +++ b/usr/src/cmd/lisp/inits.c @@ -0,0 +1,140 @@ +#include "global.h" +#include +/************************************************************************/ +/* */ +/* file: inits.i */ +/* contents: initialization routines */ +/* */ + + +/* initial **************************************************************/ +/* initializes the parts of the system that cannot be automatically */ +/* accomplished in the declarations. */ + +int reborn=0; /* flag to tell whether we are in fast-load version */ +extern char *stabf; +extern int fvirgin; +extern int keywait; +extern sigstruck, sigdelay; +initial() +{ + int sigalrmh(), sigfpeh(), siginth(); + lispval Isstatus(),Istsrch(); + + if( signal(SIGINT,SIG_IGN) != SIG_IGN) + signal(SIGINT,siginth); + if( signal(SIGHUP,SIG_IGN) != SIG_IGN) + signal(SIGHUP,siginth); + signal(SIGFPE,siginth); + signal(SIGALRM,siginth); + /* signals SIGBUS and SIGSEGV will be set up when the status list + is set up when the lisp is virgin, and will be set up according + to the current value on the status list if the lisp is reborn + */ + + if( reborn ) { + register FILE *p = _iob + 3; + static FILE empty; + for(; p < _iob + _NFILE; p++) + *p = empty; + np = lbot = orgnp; + stabf = 0; + fvirgin = 1; + loading->clb = nil; + + /* set up SIGBUS and SIGSEGV from current value + of status flag dumpcore + */ + Isstatus(matom("dumpcore"), + (Istsrch(matom("dumpcore")))->cdr->cdr->cdr); + + makenv(); + return; + } + for (hash=0;hashval = env; + for (envp=environ; *envp!=NULL; envp++) ; + while (--envp >= environ) { + for(p= *envp,q=envstr; (*q++ = *p++)!='=';); + *--q = 0; + /* at this point lbot->val==env, so it is protected + from gc */ + lbot->val = temp = newdot(); + temp->cdr = env; + env = temp; + temp = newdot(); + temp->car = matom(envstr); + temp->cdr = matom(p); + env->car = temp; + } + matom("environment")->clb = env; +} + +siginth(signo){ + signal(signo,siginth); + sigstruck |= (1 << signo); + /*if(signo==SIGBUS || signo==SIGBUS || keywait)*/ + sigcall(signo); +} +sigcall(which) +register which; +{ + extern lispval Lfuncal(); + extern lispval sigacts[16]; + struct argent *oldlbot, *oldnp, saved; + + if(sigacts[which]!=((lispval) 0)) { + oldlbot = lbot; + oldnp = np; + lbot = np; + np -> val = sigacts[which]; + INRNP; + np -> val = inewint(which); + INRNP; + Lfuncal(); + lbot = oldlbot; + np = oldnp; + } + sigstruck &= ~ (1<