BSD 4 release
[unix-history] / usr / src / cmd / lisp / sysat.c
index 84a54ac..755fde2 100644 (file)
@@ -1,28 +1,32 @@
+static char *sccsid = "@(#)sysat.c     34.13 11/11/80";
+
 #include "global.h"
 #include "lfuncs.h"
 #define MK(x,y,z) mfun(x,y,z)
 #include "global.h"
 #include "lfuncs.h"
 #define MK(x,y,z) mfun(x,y,z)
-#define FIDDLE(a,b,c,d) a->clb=newdot(); (a->clb->car=newint())->i=b->i; \
-       a->clb->cdr=newdot(); (a->clb->cdr->car=newint())->i=c->i; \
-       a->clb->cdr->cdr=newdot(); (a->clb->cdr->cdr->car=newint())->i=d; \
-       b = a->clb->car; c = a->clb->cdr->car; \
-       copval(a,a->clb); a->clb = nil;
+#define FIDDLE(z,b,c,y) z->a.clb=newdot(); (z->a.clb->d.car=newint())->i=b->i; \
+       z->a.clb->d.cdr=newdot(); (z->a.clb->d.cdr->d.car=newint())->i=c->i; \
+       z->a.clb->d.cdr->d.cdr=newdot(); (z->a.clb->d.cdr->d.cdr->d.car=newint())->i=y; \
+       b = z->a.clb->d.car; c = z->a.clb->d.cdr->d.car; \
+       copval(z,z->a.clb); z->a.clb = nil;
 
 #define cforget(x) protect(x); Lforget(); unprot();
 
 /*  The following array serves as the temporary counters of the items  */
 /*  and pages used in each space.                                      */
 
 
 #define cforget(x) protect(x); Lforget(); unprot();
 
 /*  The following array serves as the temporary counters of the items  */
 /*  and pages used in each space.                                      */
 
-long int tint[18]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+long int tint[2*NUMSPACES];
 
 
-long int tgcthresh = 15;
-int initflag = TRUE;   /*  starts off TRUE to indicate unsafe to gc  */
+extern int tgcthresh; 
+extern int initflag;   /*  starts off TRUE to indicate unsafe to gc  */
 
 
+extern int *beginsweep;        /* place for garbage collector to begin sweeping */
 #define PAGE_LIMIT 3800
 
 extern Iaddstat();
 
 makevals()
        {
 #define PAGE_LIMIT 3800
 
 extern Iaddstat();
 
 makevals()
        {
+       int i;
        lispval temp;
 
        /*  system list structure and atoms are initialized.  */
        lispval temp;
 
        /*  system list structure and atoms are initialized.  */
@@ -49,6 +53,12 @@ makevals()
        funct_items = (lispval) &tint[16];
        funct_pages = (lispval) &tint[17];
 
        funct_items = (lispval) &tint[16];
        funct_pages = (lispval) &tint[17];
 
+       for (i=0; i < 8; i++)
+       {
+               hunk_pages[i] = (lispval) &tint[18+i*2];
+               hunk_items[i] = (lispval) &tint[19+i*2];
+       }
+
        /*  This also applies to the garbage collection threshhold  */
 
        gcthresh = (lispval) &tgcthresh;
        /*  This also applies to the garbage collection threshhold  */
 
        gcthresh = (lispval) &tgcthresh;
@@ -57,8 +67,11 @@ makevals()
 
        /*  nil is a special case, constructed especially at location zero  */
 
 
        /*  nil is a special case, constructed especially at location zero  */
 
-       hasht['n'^'i'^'l'] = (struct atom *)nil;
+       hasht[hashfcn("nil")] = (struct atom *)nil;
 
 
+/*
+ * Names of various spaces and things
+ */
 
        atom_name = matom("symbol");
        str_name = matom("string");
 
        atom_name = matom("symbol");
        str_name = matom("string");
@@ -69,45 +82,83 @@ makevals()
        array_name = matom("array");
        val_name = matom("value");
        funct_name = matom("binary");
        array_name = matom("array");
        val_name = matom("value");
        funct_name = matom("binary");
+       port_name = matom("port");              /* not really a space */
 
 
+       {
+           char name[6];
 
 
-       /*  set up the name stack as an array of pointers */
+           strcpy(name, "hunk0");
+           for (i=0; i< 8; i++) {
+               hunk_name[i] = matom(name);
+               name[4]++;
+           }
+       }
+
+       /* allocate space for namestack and bindstack first
+        * then set up beginsweep variable so that the sweeper will
+        * ignore these `always in use' pages
+        */
 
 
-       lbot = orgnp = np = ((struct argent *)csegment(val_name,NAMESIZE));
-       nplim = orgnp+NAMESIZE-5;
+       lbot = orgnp = np = ((struct argent *)csegment(val_name,NAMESIZE,FALSE));
+       orgbnp = bnp = ((struct nament *)csegment(dtpr_name,NAMESIZE,FALSE));
+       beginsweep = (int *) sbrk(0);
+
+       /*  set up the name stack as an array of pointers */
+       nplim = orgnp+NAMESIZE-6*NAMINC;
        temp = matom("namestack");
        temp = matom("namestack");
-       nstack = temp->fnbnd = newarray();
-       nstack->data = (char *) (np);
-       (nstack->length = newint())->i = NAMESIZE;
-       (nstack->delta = newint())->i = sizeof(struct argent);
+       nstack = temp->a.fnbnd = newarray();
+       nstack->ar.data = (char *) (np);
+       (nstack->ar.length = newint())->i = NAMESIZE;
+       (nstack->ar.delta = newint())->i = sizeof(struct argent);
+       Vnogbar = matom("unmarked_array");
+       /* marking of the namestack will be done explicitly in gc1 */
+       (nstack->ar.aux = newdot())->d.car = Vnogbar; 
+                                               
 
        /* set up the binding stack as an array of dotted pairs */
 
 
        /* set up the binding stack as an array of dotted pairs */
 
-       orgbnp = bnp = ((struct nament *)csegment(dtpr_name,NAMESIZE));
        bnplim = orgbnp+NAMESIZE-5;
        temp = matom("bindstack");
        bnplim = orgbnp+NAMESIZE-5;
        temp = matom("bindstack");
-       bstack = temp->fnbnd = newarray();
-       bstack->data = (char *) (bnp);
-       (bstack->length = newint())->i = NAMESIZE;
-       (nstack->delta = newint())->i = sizeof(struct nament);
+       bstack = temp->a.fnbnd = newarray();
+       bstack->ar.data = (char *) (bnp);
+       (bstack->ar.length = newint())->i = NAMESIZE;
+       (bstack->ar.delta = newint())->i = sizeof(struct nament);
+       /* marking of the bindstack will be done explicitly in gc1 */
+       (bstack->ar.aux = newdot())->d.car = Vnogbar; 
 
        /* more atoms */
 
        tatom = matom("t");
 
        /* more atoms */
 
        tatom = matom("t");
-       tatom->clb = tatom;
+       tatom->a.clb = tatom;
        lambda = matom("lambda");
        nlambda = matom("nlambda");
        macro = matom("macro");
        ibase = matom("ibase");         /* base for input conversion */
        lambda = matom("lambda");
        nlambda = matom("nlambda");
        macro = matom("macro");
        ibase = matom("ibase");         /* base for input conversion */
-       ibase->clb = inewint(10);
+       ibase->a.clb = inewint(10);
+       rsetatom = matom("*rset");
+       rsetatom->a.clb = nil;
+       Vsubrou = matom("subroutine");
        Vpiport = matom("piport");
        Vpiport = matom("piport");
-       Vpiport->clb = P(piport = stdin);       /* standard input */
+       Vpiport->a.clb = P(piport = stdin);     /* standard input */
        Vpoport = matom("poport");
        Vpoport = matom("poport");
-       Vpoport->clb = P(poport = stdout);      /* stand. output */
-       matom("errport")->clb = (P(errport = stderr));/* stand. err. */
-       (Vreadtable = matom("readtable"))->clb  = Imkrtab(0);
+       Vpoport->a.clb = P(poport = stdout);    /* stand. output */
+       matom("errport")->a.clb = (P(errport = stderr));/* stand. err. */
+       ioname[PN(stdin)]  = (lispval) inewstr("$stdin");
+       ioname[PN(stdout)] = (lispval) inewstr("$stdout");
+       ioname[PN(stderr)] = (lispval) inewstr("$stderr");
+       (Vreadtable = matom("readtable"))->a.clb  = Imkrtab(0);
        strtab = Imkrtab(0);
        strtab = Imkrtab(0);
+       Vptport = matom("ptport");
+       Vptport->a.clb = nil;                           /* protocal port */
+
+       Vcntlw = matom("^w");   /* when non nil, inhibits output to term */
+       Vcntlw->a.clb = nil;
 
 
+       Vprinlevel = matom("prinlevel");        /* printer recursion count */
+       Vprinlevel->a.clb = nil;                /* infinite recursion */
+
+       Vprinlength = matom("prinlength");      /* printer element count */
+       Vprinlength->a.clb = nil;               /* infinite elements */
        /*  The following atoms are used as tokens by the reader  */
 
        perda = matom(".");
        /*  The following atoms are used as tokens by the reader  */
 
        perda = matom(".");
@@ -119,7 +170,7 @@ makevals()
        exclpa = matom("!");
 
 
        exclpa = matom("!");
 
 
-       (Eofa = matom("eof"))->clb = eofa;
+       (Eofa = matom("eof"))->a.clb = eofa;
        cara = MK("car",Lcar,lambda);
        cdra = MK("cdr",Lcdr,lambda);
 
        cara = MK("car",Lcar,lambda);
        cdra = MK("cdr",Lcdr,lambda);
 
@@ -127,11 +178,11 @@ makevals()
        /*  Perhaps this is a kludge which should be abandoned.  */
        /*  On the other hand, perhaps it is an inspiration.    */
 
        /*  Perhaps this is a kludge which should be abandoned.  */
        /*  On the other hand, perhaps it is an inspiration.    */
 
-       matom("perd")->clb = perda;
-       matom("lpar")->clb = lpara;
-       matom("rpar")->clb = rpara;
-       matom("lbkt")->clb = lbkta;
-       matom("rbkt")->clb = rbkta;
+       matom("perd")->a.clb = perda;
+       matom("lpar")->a.clb = lpara;
+       matom("rpar")->a.clb = rpara;
+       matom("lbkt")->a.clb = lbkta;
+       matom("rbkt")->a.clb = rbkta;
 
        noptop = matom("noptop");
 
 
        noptop = matom("noptop");
 
@@ -145,9 +196,18 @@ makevals()
        lexpr_atom = matom("last lexpr binding\7");
        lexpr = matom("lexpr");
 
        lexpr_atom = matom("last lexpr binding\7");
        lexpr = matom("lexpr");
 
+       /* the following atom is used to reference the bind stack for eval */
+       bptr_atom = matom("eval1 binding pointer\7");
+       bptr_atom->a.clb = nil;
+
+       /* the following atoms are used for evalhook hackery */
+       evalhatom = matom("evalhook");
+       evalhatom->a.clb = nil;
+       evalhcall = matom("evalhook call flag\7");
+
        sysa = matom("sys");
        plima = matom("pagelimit");     /*  max number of pages  */
        sysa = matom("sys");
        plima = matom("pagelimit");     /*  max number of pages  */
-       Veval = MK("eval",Leval,lambda);
+       Veval = MK("eval",Leval1,lambda);
        MK("asin",Lasin,lambda);
        MK("acos",Lacos,lambda);
        MK("atan",Latan,lambda);
        MK("asin",Lasin,lambda);
        MK("acos",Lacos,lambda);
        MK("atan",Latan,lambda);
@@ -156,13 +216,15 @@ makevals()
        MK("sqrt",Lsqrt,lambda);
        MK("exp",Lexp,lambda);
        MK("log",Llog,lambda);
        MK("sqrt",Lsqrt,lambda);
        MK("exp",Lexp,lambda);
        MK("log",Llog,lambda);
+       MK("lsh",Llsh,lambda);
+       MK("rot",Lrot,lambda);
        MK("random",Lrandom,lambda);
        MK("atom",Latom,lambda);
        MK("apply",Lapply,lambda);
        MK("funcall",Lfuncal,lambda);
        MK("return",Lreturn,lambda);
        MK("retbrk",Lretbrk,lambda);
        MK("random",Lrandom,lambda);
        MK("atom",Latom,lambda);
        MK("apply",Lapply,lambda);
        MK("funcall",Lfuncal,lambda);
        MK("return",Lreturn,lambda);
        MK("retbrk",Lretbrk,lambda);
-       MK("cont",Lreturn,lambda);
+/*     MK("cont",Lreturn,lambda);  */
        MK("cons",Lcons,lambda);
        MK("scons",Lscons,lambda);
        MK("cadr",Lcadr,lambda);
        MK("cons",Lcons,lambda);
        MK("scons",Lscons,lambda);
        MK("cadr",Lcadr,lambda);
@@ -176,6 +238,7 @@ makevals()
        MK("nthelem",Lnthelem,lambda);
        MK("eq",Leq,lambda);
        MK("equal",Lequal,lambda);
        MK("nthelem",Lnthelem,lambda);
        MK("eq",Leq,lambda);
        MK("equal",Lequal,lambda);
+       MK("zqual",Zequal,lambda);
        MK("numberp",Lnumberp,lambda);
        MK("dtpr",Ldtpr,lambda);
        MK("bcdp",Lbcdp,lambda);
        MK("numberp",Lnumberp,lambda);
        MK("dtpr",Ldtpr,lambda);
        MK("bcdp",Lbcdp,lambda);
@@ -183,6 +246,7 @@ makevals()
        MK("arrayp",Larrayp,lambda);
        MK("valuep",Lvaluep,lambda);
        MK("get_pname",Lpname,lambda);
        MK("arrayp",Larrayp,lambda);
        MK("valuep",Lvaluep,lambda);
        MK("get_pname",Lpname,lambda);
+       MK("ptr",Lptr,lambda);
        MK("arrayref",Larrayref,lambda);
        MK("marray",Lmarray,lambda);
        MK("getlength",Lgetl,lambda);
        MK("arrayref",Larrayref,lambda);
        MK("marray",Lmarray,lambda);
        MK("getlength",Lgetl,lambda);
@@ -193,9 +257,12 @@ makevals()
        MK("putdelta",Lputdel,lambda);
        MK("getaux",Lgetaux,lambda);
        MK("putaux",Lputaux,lambda);
        MK("putdelta",Lputdel,lambda);
        MK("getaux",Lgetaux,lambda);
        MK("putaux",Lputaux,lambda);
+       MK("getdata",Lgetdata,lambda);
+       MK("putdata",Lputdata,lambda);
        MK("mfunction",Lmfunction,lambda);
        MK("getentry",Lgetentry,lambda);
        MK("getdisc",Lgetdisc,lambda);
        MK("mfunction",Lmfunction,lambda);
        MK("getentry",Lgetentry,lambda);
        MK("getdisc",Lgetdisc,lambda);
+       MK("putdisc",Lputdisc,lambda);
        MK("segment",Lsegment,lambda);
        MK("rplaca",Lrplaca,lambda);
        MK("rplacd",Lrplacd,lambda);
        MK("segment",Lsegment,lambda);
        MK("rplaca",Lrplaca,lambda);
        MK("rplacd",Lrplacd,lambda);
@@ -216,6 +283,7 @@ makevals()
        MK("concat",Lconcat,lambda);
        MK("uconcat",Luconcat,lambda);
        MK("putprop",Lputprop,lambda);
        MK("concat",Lconcat,lambda);
        MK("uconcat",Luconcat,lambda);
        MK("putprop",Lputprop,lambda);
+       MK("monitor",Lmonitor,lambda);
        MK("get",Lget,lambda);
        MK("getd",Lgetd,lambda);
        MK("putd",Lputd,lambda);
        MK("get",Lget,lambda);
        MK("getd",Lgetd,lambda);
        MK("putd",Lputd,lambda);
@@ -229,7 +297,7 @@ makevals()
        MK("sstatus",Nsstatus,nlambda);
        MK("err",Lerr,lambda);
        MK("*throw",Nthrow,lambda);     /* this is a lambda now !! */
        MK("sstatus",Nsstatus,nlambda);
        MK("err",Lerr,lambda);
        MK("*throw",Nthrow,lambda);     /* this is a lambda now !! */
-       MK("reset",Nreset,nlambda);
+       reseta = MK("reset",Nreset,nlambda);
        MK("break",Nbreak,nlambda);
        MK("exit",Lexit,lambda);
        MK("def",Ndef,nlambda);
        MK("break",Nbreak,nlambda);
        MK("exit",Lexit,lambda);
        MK("def",Ndef,nlambda);
@@ -244,7 +312,12 @@ makevals()
        MK("process",Nprocess,nlambda); /*  execute a shell command  */
        MK("allocate",Lalloc,lambda);   /*  allocate a page  */
        MK("sizeof",Lsizeof,lambda);    /*  size of one item of a data type  */
        MK("process",Nprocess,nlambda); /*  execute a shell command  */
        MK("allocate",Lalloc,lambda);   /*  allocate a page  */
        MK("sizeof",Lsizeof,lambda);    /*  size of one item of a data type  */
-       MK("dumplisp",Ndumpli,nlambda); /*  save the world  */
+       MK("odumplisp",Ndumplisp,nlambda);      /*  OLD save the world  */
+       MK("dumplisp",Nndumplisp,nlambda);      /*  NEW save the world  */
+#ifdef VMS
+       MK("savelisp",Lsavelsp,lambda); /*  save lisp data      */
+       MK("restorelisp",Lrestlsp,lambda);
+#endif
        MK("top-level",Ntpl,nlambda);   /*  top level eval-print read loop  */
        startup = matom("startup");     /*  used by save and restore  */
        MK("mapcar",Lmapcar,lambda);
        MK("top-level",Ntpl,nlambda);   /*  top level eval-print read loop  */
        startup = matom("startup");     /*  used by save and restore  */
        MK("mapcar",Lmapcar,lambda);
@@ -254,7 +327,7 @@ makevals()
        MK("assq",Lassq,lambda);
        MK("mapc",Lmapc,lambda);
        MK("map",Lmap,lambda);
        MK("assq",Lassq,lambda);
        MK("mapc",Lmapc,lambda);
        MK("map",Lmap,lambda);
-       MK("flatsize",Lflatsi,lambda);
+       MK("flatc",Lflatsi,lambda);
        MK("alphalessp",Lalfalp,lambda);
        MK("drain",Ldrain,lambda);
        MK("killcopy",Lkilcopy,lambda); /*  forks aand aborts for adb */
        MK("alphalessp",Lalfalp,lambda);
        MK("drain",Ldrain,lambda);
        MK("killcopy",Lkilcopy,lambda); /*  forks aand aborts for adb */
@@ -276,6 +349,7 @@ makevals()
        MK("sub1",Lsub1,lambda);
        MK("greaterp",Lgreaterp,lambda);
        MK("lessp",Llessp,lambda);
        MK("sub1",Lsub1,lambda);
        MK("greaterp",Lgreaterp,lambda);
        MK("lessp",Llessp,lambda);
+       MK("any-zerop",Lzerop,lambda);   /* used when bignum arg possible */
        MK("zerop",Lzerop,lambda);
        MK("minusp",Lnegp,lambda);
        MK("onep",Lonep,lambda);
        MK("zerop",Lzerop,lambda);
        MK("minusp",Lnegp,lambda);
        MK("onep",Lonep,lambda);
@@ -286,20 +360,30 @@ makevals()
        MK("progn",Nprogn,nlambda);
        MK("prog2",Nprog2,nlambda);
        MK("oblist",Loblist,lambda);
        MK("progn",Nprogn,nlambda);
        MK("prog2",Nprog2,nlambda);
        MK("oblist",Loblist,lambda);
-       MK("baktrace",Lbaktra,lambda);
+       MK("baktrace",Lbaktrace,lambda);
        MK("tyi",Ltyi,lambda);
        MK("tyipeek",Ltyipeek,lambda);
        MK("tyo",Ltyo,lambda);
        MK("setsyntax",Lsetsyn,lambda);
        MK("makereadtable",Lmakertbl,lambda);
        MK("tyi",Ltyi,lambda);
        MK("tyipeek",Ltyipeek,lambda);
        MK("tyo",Ltyo,lambda);
        MK("setsyntax",Lsetsyn,lambda);
        MK("makereadtable",Lmakertbl,lambda);
-       MK("zapline",Lzaplin,lambda);
+       MK("zapline",Lzapline,lambda);
        MK("aexplode",Lexplda,lambda);
        MK("aexplodec",Lexpldc,lambda);
        MK("aexploden",Lexpldn,lambda);
        MK("aexplode",Lexplda,lambda);
        MK("aexplodec",Lexpldc,lambda);
        MK("aexploden",Lexpldn,lambda);
+       MK("hashtabstat",Lhashst,lambda);
+#ifdef METER
+       MK("gcstat",Lgcstat,lambda);
+#endif
        MK("argv",Largv,lambda);
        MK("arg",Larg,lambda);
        MK("argv",Largv,lambda);
        MK("arg",Larg,lambda);
+       MK("setarg",Lsetarg,lambda);
        MK("showstack",Lshostk,lambda);
        MK("showstack",Lshostk,lambda);
-       MK("resetio",Nreseti,nlambda);
+       MK("freturn",Lfretn,lambda);
+       MK("*rset",Lrset,lambda);
+       MK("eval1",Leval1,lambda);
+       MK("evalframe",Levalf,lambda);
+       MK("evalhook",Levalhook,lambda);
+       MK("resetio",Nresetio,nlambda);
        MK("chdir",Lchdir,lambda);
        MK("ascii",Lascii,lambda);
        MK("boole",Lboole,lambda);
        MK("chdir",Lchdir,lambda);
        MK("ascii",Lascii,lambda);
        MK("boole",Lboole,lambda);
@@ -314,15 +398,16 @@ makevals()
        MK("plist",Lplist,lambda);      /* gives the plist of an atom */
        MK("setplist",Lsetpli,lambda);  /* get plist of an atom  */
        MK("eval-when",Nevwhen,nlambda);
        MK("plist",Lplist,lambda);      /* gives the plist of an atom */
        MK("setplist",Lsetpli,lambda);  /* get plist of an atom  */
        MK("eval-when",Nevwhen,nlambda);
-       MK("syscall",Nsyscall,nlambda);
+       MK("syscall",Lsyscall,lambda);
+       MK("intern",Lintern,lambda);
        MK("ptime",Lptime,lambda);      /* return process user time */
 /*
        MK("fork",Lfork,lambda);
        MK("wait",Lwait,lambda);
        MK("pipe",Lpipe,lambda);
        MK("fdopen",Lfdopen,lambda);
        MK("ptime",Lptime,lambda);      /* return process user time */
 /*
        MK("fork",Lfork,lambda);
        MK("wait",Lwait,lambda);
        MK("pipe",Lpipe,lambda);
        MK("fdopen",Lfdopen,lambda);
+*/
        MK("exece",Lexece,lambda);
        MK("exece",Lexece,lambda);
- */
        MK("gensym",Lgensym,lambda);
        MK("remprop",Lremprop,lambda);
        MK("bcdad",Lbcdad,lambda);
        MK("gensym",Lgensym,lambda);
        MK("remprop",Lremprop,lambda);
        MK("bcdad",Lbcdad,lambda);
@@ -331,34 +416,63 @@ makevals()
        MK("rematom",Lrematom,lambda);
        MK("prname",Lprname,lambda);
        MK("getenv",Lgetenv,lambda);
        MK("rematom",Lrematom,lambda);
        MK("prname",Lprname,lambda);
        MK("getenv",Lgetenv,lambda);
+       MK("I-throw-err",Lctcherr,lambda); /* directly force a throw or error */
        MK("makunbound",Lmakunb,lambda);
        MK("haipart",Lhaipar,lambda);
        MK("haulong",Lhau,lambda);
        MK("signal",Lsignal,lambda);
        MK("makunbound",Lmakunb,lambda);
        MK("haipart",Lhaipar,lambda);
        MK("haulong",Lhau,lambda);
        MK("signal",Lsignal,lambda);
-       MK("fasl",Lfasl,lambda);        /* read in compiled file */
-       MK("bind",Lbind,lambda);        /* like fasl but for functions
-                                          loaded in when the lisp system
-                                          was constructed by ld */
+       MK("fasl",Lnfasl,lambda);       /* NEW - new fasl loader */
+       MK("cfasl",Lcfasl,lambda);      /* read in compiled C file */
+       MK("getaddress",Lgetaddress,lambda);
+                                       /* bind symbols without doing cfasl */
        MK("boundp",Lboundp,lambda);    /* tells if an atom is bound */
        MK("fake",Lfake,lambda);        /* makes a fake lisp pointer */
        MK("od",Lod,lambda);            /* dumps info */
        MK("boundp",Lboundp,lambda);    /* tells if an atom is bound */
        MK("fake",Lfake,lambda);        /* makes a fake lisp pointer */
        MK("od",Lod,lambda);            /* dumps info */
-       MK("what",Lwhat,lambda);        /* converts a pointer to an integer */
+       MK("maknum",Lmaknum,lambda);    /* converts a pointer to an integer */
+       MK("*mod",LstarMod,lambda);             /* return fixnum modulus */
+
+       MK("fseek",Lfseek,lambda);      /* seek to a specific byte in a file */
+       MK("fileopen", Lfileopen, lambda);
+                                       /* open a file for read/write/append */
+
        MK("pv%",Lpolyev,lambda);       /* polynomial evaluation instruction */
        MK("pv%",Lpolyev,lambda);       /* polynomial evaluation instruction */
+       MK("cprintf",Lcprintf,lambda);  /* formatted print                   */
+       MK("copyint*",Lcopyint,lambda); /* copyint*  */
+
+/*
+ * Hunk stuff
+ */
+
+       MK("*makhunk",LMakhunk,lambda);         /* special hunk creater */
+       MK("hunkp",Lhunkp,lambda);              /* test a hunk */
+       MK("cxr",Lcxr,lambda);                  /* cxr of a hunk */
+       MK("rplacx",Lrplacx,lambda);            /* replace element of a hunk */
+       MK("*rplacx",Lstarrpx,lambda);          /* rplacx used by hunk */
+       MK("hunksize",Lhunksize,lambda);        /* size of a hunk */
+
+       MK("probef",Lprobef,lambda);    /* test file existance */
+       MK("substring",Lsubstring,lambda);
+       MK("substringn",Lsubstringn,lambda);
        odform = matom("odformat");     /* format for printf's used in od */
        rdrsdot = newsdot();            /* used in io conversions of bignums */
        odform = matom("odformat");     /* format for printf's used in od */
        rdrsdot = newsdot();            /* used in io conversions of bignums */
+       rdrsdot2 = newsdot();           /* used in io conversions of bignums */
        rdrint = newint();              /* used as a temporary integer */
        rdrint = newint();              /* used as a temporary integer */
-       (nilplist = newdot())->cdr = newdot();
+       (nilplist = newdot())->d.cdr = newdot();
                                        /* used as property list for nil,
                                           since nil will eventually be put at
                                           0 (consequently in text and not
                                           writable) */
 
        /* error variables */
                                        /* used as property list for nil,
                                           since nil will eventually be put at
                                           0 (consequently in text and not
                                           writable) */
 
        /* error variables */
-       (Vererr = matom("ER%err"))->clb = nil;
-       (Vertpl = matom("ER%tpl"))->clb = nil;
-       (Verall = matom("ER%all"))->clb = nil;
-       (Vermisc = matom("ER%misc"))->clb = nil;
-       (Vlerall = newdot())->car = Verall;     /* list (ER%all) */
+       (Vererr = matom("ER%err"))->a.clb = nil;
+       (Vertpl = matom("ER%tpl"))->a.clb = nil;
+       (Verall = matom("ER%all"))->a.clb = nil;
+       (Vermisc = matom("ER%misc"))->a.clb = nil;
+       (Verbrk = matom("ER%brk"))->a.clb = nil;
+       (Verundef = matom("ER%undef"))->a.clb = nil;
+       (Vlerall = newdot())->d.car = Verall;   /* list (ER%all) */
+       (Veruwpt = matom("ER%unwind-protect"))->a.clb = nil;
+       (Verrset = matom("errset"))->a.clb = nil;
 
 
        /* set up the initial status list */
 
 
        /* set up the initial status list */
@@ -367,6 +481,10 @@ makevals()
        Iaddstat(matom("features"),ST_READ,ST_NO,nil);
        Iaddstat(matom("feature"),ST_FEATR,ST_FEATW,nil);
        Isstatus(matom("feature"),matom("franz"));
        Iaddstat(matom("features"),ST_READ,ST_NO,nil);
        Iaddstat(matom("feature"),ST_FEATR,ST_FEATW,nil);
        Isstatus(matom("feature"),matom("franz"));
+       Isstatus(matom("feature"),matom(OS));
+       Isstatus(matom("feature"),matom("string"));
+       Isstatus(matom("feature"),matom(MACHINE));
+       Isstatus(matom("feature"),matom(SITE));
 
        Iaddstat(matom("nofeature"),ST_NFETR,ST_NFETW,nil);
        Iaddstat(matom("syntax"),ST_SYNT,ST_NO,nil);
 
        Iaddstat(matom("nofeature"),ST_NFETR,ST_NFETW,nil);
        Iaddstat(matom("syntax"),ST_SYNT,ST_NO,nil);
@@ -376,19 +494,35 @@ makevals()
 
        Iaddstat(matom("chainatom"),ST_RINTB,ST_INTB,inewint(0));
        Iaddstat(matom("dumpmode"),ST_DMPR,ST_DMPW,nil);
 
        Iaddstat(matom("chainatom"),ST_RINTB,ST_INTB,inewint(0));
        Iaddstat(matom("dumpmode"),ST_DMPR,ST_DMPW,nil);
+       Iaddstat(matom("appendmap"),ST_READ,ST_SET,nil);  /* used by fasl */
+       Iaddstat(matom("debugging"),ST_READ,ST_SET,nil);  
+       Iaddstat(matom("evalhook"),ST_RINTB,ST_INTB,inewint(3));
+       Isstatus(matom("evalhook"),nil); /*evalhook switch off */
+       Iaddstat(matom("bcdtrace"),ST_READ,ST_BCDTR,nil);
+       Iaddstat(matom("ctime"),ST_CTIM,ST_NO,nil);
+       Iaddstat(matom("localtime"),ST_LOCT,ST_NO,nil);
+       Iaddstat(matom("isatty"),ST_ISTTY,ST_NO,nil);
+       Iaddstat(matom("ignoreeof"),ST_READ,ST_SET,nil);
+       Iaddstat(matom("version"),ST_READ,ST_NO,mstr("Franz Lisp, Opus 34"));
+       Iaddstat(matom("automatic-reset"),ST_READ,ST_AUTR,nil);
+       Iaddstat(matom("translink"),ST_READ,ST_TRAN,nil);
+       Isstatus(matom("translink"),tatom);             /* turn on tran links */
+       Iaddstat(matom("undeffunc"),ST_UNDEF,ST_NO,nil); /* list undef funcs */
+
        /* garbage collector things */
 
        MK("gc",Ngc,nlambda);
        gcafter = MK("gcafter",Ngcafter,nlambda);       /* garbage collection wind-up */
        gcport = matom("gcport");       /* port for gc dumping */
        gccheck = matom("gccheck");     /* flag for checking during gc */
        /* garbage collector things */
 
        MK("gc",Ngc,nlambda);
        gcafter = MK("gcafter",Ngcafter,nlambda);       /* garbage collection wind-up */
        gcport = matom("gcport");       /* port for gc dumping */
        gccheck = matom("gccheck");     /* flag for checking during gc */
-       gcdis = matom("gcdisable");     /* option for disabling the gc */
+       gcdis = matom("gcdisable");     /* variable for disabling the gc */
+       gcdis->a.clb = nil;
        gcload = matom("gcload");       /* option for gc while loading */
        loading = matom("loading");     /* flag--in loader if = t  */
        noautot = matom("noautotrace"); /* option to inhibit auto-trace */
        (gcthresh = newint())->i = tgcthresh;
        gccall1 = newdot();  gccall2 = newdot();  /* used to call gcafter */
        gcload = matom("gcload");       /* option for gc while loading */
        loading = matom("loading");     /* flag--in loader if = t  */
        noautot = matom("noautotrace"); /* option to inhibit auto-trace */
        (gcthresh = newint())->i = tgcthresh;
        gccall1 = newdot();  gccall2 = newdot();  /* used to call gcafter */
-       gccall1->car = gcafter;  /* start constructing a form for eval */
+       gccall1->d.car = gcafter;  /* start constructing a form for eval */
 
        arrayst = mstr("ARRAY");        /* array marker in name stack */
        bcdst = mstr("BINARY");         /* binary function marker */
 
        arrayst = mstr("ARRAY");        /* array marker in name stack */
        bcdst = mstr("BINARY");         /* binary function marker */
@@ -397,6 +531,7 @@ makevals()
        protst = mstr("PROTECTED");     /* protection marker */
        badst = mstr("BADPTR");         /* bad pointer marker */
        argst = mstr("ARGST");          /* argument marker */
        protst = mstr("PROTECTED");     /* protection marker */
        badst = mstr("BADPTR");         /* bad pointer marker */
        argst = mstr("ARGST");          /* argument marker */
+       hunkfree = mstr("EMPTY");       /* empty hunk cell value */
 
        /* type names */
 
 
        /* type names */
 
@@ -410,6 +545,14 @@ makevals()
        FIDDLE(val_name,val_items,val_pages,VALSPP);
        FIDDLE(funct_name,funct_items,funct_pages,BCDSPP);
 
        FIDDLE(val_name,val_items,val_pages,VALSPP);
        FIDDLE(funct_name,funct_items,funct_pages,BCDSPP);
 
+       FIDDLE(hunk_name[0], hunk_items[0], hunk_pages[0], HUNK2SPP);
+       FIDDLE(hunk_name[1], hunk_items[1], hunk_pages[1], HUNK4SPP);
+       FIDDLE(hunk_name[2], hunk_items[2], hunk_pages[2], HUNK8SPP);
+       FIDDLE(hunk_name[3], hunk_items[3], hunk_pages[3], HUNK16SPP);
+       FIDDLE(hunk_name[4], hunk_items[4], hunk_pages[4], HUNK32SPP);
+       FIDDLE(hunk_name[5], hunk_items[5], hunk_pages[5], HUNK64SPP);
+       FIDDLE(hunk_name[6], hunk_items[6], hunk_pages[6], HUNK128SPP);
+
        (plimit = newint())->i = PAGE_LIMIT;
        copval(plima,plimit);  /*  default value  */
 
        (plimit = newint())->i = PAGE_LIMIT;
        copval(plima,plimit);  /*  default value  */
 
@@ -434,7 +577,8 @@ lispval
 matom(string)
 char *string;
        {
 matom(string)
 char *string;
        {
-       strcpy(strbuf,string);
+       strbuf[0] = 0;
+       strcatn(strbuf,string,STRBLEN);
        return(getatom());
        }
 
        return(getatom());
        }
 
@@ -459,8 +603,8 @@ lispval mfun(string,entry,discip) char *string; lispval (*entry)(), discip;
        {
        lispval v;
        v = matom(string);
        {
        lispval v;
        v = matom(string);
-       v -> fnbnd = newfunct();
-       v->fnbnd->entry = entry;
-       v->fnbnd->discipline = discip;
+       v->a.fnbnd = newfunct();
+       v->a.fnbnd->bcd.entry = entry;
+       v->a.fnbnd->bcd.discipline = discip;
        return(v);
        }
        return(v);
        }