(FILECREATED " 8-Sep-86 11:38:13" {ERIS}<LISPCORE>BVM>BOOTSTRAP.;2 47889  

      changes to:  (FNS LOAD PUTPROPS BOOTSTRAP-PUTPROPS)
                   (VARS BOOTSTRAPCOMS)

      previous date: "27-Aug-86 19:54:45" {ERIS}<LISPCORE>SOURCES>BOOTSTRAP.;17)


(* Copyright (c) 1983, 1984, 1985, 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT BOOTSTRAPCOMS)

(RPAQQ BOOTSTRAPCOMS 
       [(FNS GETPROP SETATOMVAL RPAQQ RPAQ RPAQ? MOVD MOVD? SELECTQ SELECTQ1 NCONC1 PUTPROP PROPNAMES 
             ADDPROP REMPROP MEMB CLOSEF?)
        (COMS (* "Need these in order to load even compiled files SYSLOAD")
              (FNS LOAD FILECREATED FILECREATED1 BOOTSTRAP-NAMEFIELD PUTPROPS DECLARE: DECLARE:1 
                   ROOTFILENAME DEFINE-FILE-INFO \DO-DEFINE-FILE-INFO))
        [INITVARS (EOLCHARCODE (CHCON1 (QUOTE %
)))
               (PRETTYHEADER)
               (DWIMFLG)
               (UPDATEMAPFLG)
               (DFNFLG)
               (ADDSPELLFLG)
               (BUILDMAPFLG)
               (FILEPKGFLG)
               (SYSFILES)
               (NOTCOMPILEDFILES)
               (RESETVARSLST)
               [LOADPARAMETERS (QUOTE ((SEQUENTIAL T]
               (LISPXHIST)
               (LISPXPRINTFLG T)
               (PRETTYHEADER "FILE CREATED ")
               (BELLS (QUOTE ""))
               (LOADOPTIONS (QUOTE (SYSLOAD NIL T PROP ALLPROP]
        (ADDVARS (LOADEDFILELST))
        (GLOBALVARS PRETTYHEADER DWIMFLG PRETTYHEADER UPDATEMAPFLG LOADOPTIONS LOADPARAMETERS 
               FILERDTBL SYSFILES)
        (DECLARE: DONTEVAL@LOAD DOCOPY
               [P [MAPC (QUOTE ((PUTD . /PUTD)
                                (PUTPROP . /PUTPROP)
                                (PUTPROP . PUT)
                                (PUTPROP . SAVEPUT)
                                (PUT . /PUT)
                                (PRIN1 . LISPXPRIN1)
                                (PRIN2 . LISPXPRIN2)
                                (PRINT . LISPXPRINT)
                                (TERPRI . LISPXTERPRI)
                                (SPACES . LISPXSPACES)
                                (GETPROP . GETP)
                                (SET . SAVESET)
                                (NILL . MISSPELLED?)
                                (SETTOPVAL . /SETTOPVAL)
                                (BOOTSTRAP-NAMEFIELD . NAMEFIELD)))
                        (FUNCTION (LAMBDA (X)
                                         (OR (CCODEP (CDR X))
                                             (MOVD (CAR X)
                                                   (CDR X)
                                                   NIL T]
                  (AND (CCODEP (QUOTE BOOTSTRAP-NAMEFIELD))
                       (PUTD (QUOTE BOOTSTRAP-NAMEFIELD)))
                  (AND (CCODEP (QUOTE BOOTSTRAP-PUTPROPS))
                       (PUTD (QUOTE BOOTSTRAP-PUTPROPS)))
                  (MAPC [QUOTE ([STRPOS (LAMBDA (X Y START SKIP ANCHOR TAIL)
                                               [COND [(LITATOM X)
                                                      (SETQ X (CDR (VAG (IPLUS (LOC X)
                                                                               2]
                                                     ((NULL (STRINGP X))
                                                      (SETQ X (MKSTRING X]
                                               [COND ((STRINGP Y))
                                                     [(LITATOM Y)
                                                      (SETQ Y (CDR (VAG (IPLUS (LOC Y)
                                                                               2]
                                                     (T (SETQ Y (MKSTRING Y]
                                               [COND (SKIP (SETQ SKIP (NTHCHAR SKIP 1]
                                               (COND [START (COND ((MINUSP START)
                                                                   (SETQ START (IPLUS START
                                                                                      (NCHARS Y)
                                                                                      1]
                                                     (T (SETQ START 1)))
                                               (SETQ Y (SUBSTRING Y START))
                                               (PROG ((N START)
                                                      W X1 Y1)
                                                     L2
                                                     (SETQ X1 (SUBSTRING X 1))
                                                     (SETQ Y1 (SUBSTRING Y 1))
                                                     LP
                                                     (COND [(SETQ W (GNC X1))
                                                            (COND ((EQ W (GNC Y1))
                                                                   (GO LP))
                                                                  ((EQ W SKIP)
                                                                   (GO LP))
                                                                  (T (GO NX]
                                                           (TAIL (RETURN (IPLUS (NCHARS X)
                                                                                N)))
                                                           (T (RETURN N)))
                                                     NX
                                                     (COND (ANCHOR (RETURN)))
                                                     (COND ((GNC Y)
                                                            (SETQ N (ADD1 N))
                                                            (GO L2))
                                                           (T (RETURN]
                                [PACKFILENAME (LAMBDA (X)
                                                     X]
                                [UNPACKFILENAME (LAMBDA (X)
                                                       X]
                                (RESETRESTORE (LAMBDA (RESETVARSLST0 RESETSTATE)
                                                     (PROG (RESETZ)
                                                           LP
                                                           (COND ((AND RESETVARSLST (NEQ RESETVARSLST 
                                                                                        RESETVARSLST0
                                                                                         ))
                                                                  (SETQ RESETZ (CAR RESETVARSLST))
                                                                  (SETQ RESETVARSLST (CDR 
                                                                                         RESETVARSLST
                                                                                          ))
                                                                  [COND ((LISTP (CAR RESETZ))
                                                                         (APPLY (CAAR RESETZ)
                                                                                (CDR (CAR RESETZ]
                                                                  (GO LP]
                        (FUNCTION (LAMBDA (X)
                                         (OR (GETD (CAR X))
                                             (PUTD (CAR X)
                                                   (CADR X]
               (P (PRINTLEVEL 1000)
                  (RADIX 10)))
        (DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS
               (ADDVARS (NLAMA DEFINE-FILE-INFO DECLARE: BOOTSTRAP-PUTPROPS FILECREATED SELECTQ)
                      (NLAML RPAQ? RPAQ RPAQQ)
                      (LAMA])
(DEFINEQ

(GETPROP
  [LAMBDA (ATM PROP)                                         (* lmm " 5-SEP-83 22:29")
                                                             (* Used to be called GETP)
    (AND (LITATOM ATM)
         (PROG ((PLIST (GETPROPLIST ATM)))
           LOOP
               [COND
                  ((OR (NLISTP PLIST)
                       (NLISTP (CDR PLIST)))
                   (RETURN NIL))
                  ((EQ (CAR PLIST)
                       PROP)
                   (RETURN (CADR PLIST]
               (SETQ PLIST (CDDR PLIST))
               (GO LOOP])

(SETATOMVAL
  [LAMBDA (X Y)                                              (* wt: 27-JAN-76 23 20)
                                                             (* dummy defiition so rpaqq will work.)
    (COND
       ((GETD (QUOTE VCTOAC))
        (SET X Y))
       (T (SETTOPVAL X Y])

(RPAQQ
  [NLAMBDA (X Y)
    (SETATOMVAL X Y])

(RPAQ
  [NLAMBDA (RPAQX RPAQY)                                     (* lmm "23-JUL-83 16:10")
                                                             (* RPAQ and RPAQQ are used by 
                                                             PRETTYDEF to save VARS.)
    (SETTOPVAL RPAQX (EVAL RPAQY])

(RPAQ?
  [NLAMBDA (RPAQX RPAQY)                                     (* lmm "23-JUL-83 16:12")
                                                             (* RPAQ? and RPAQQ are used by 
                                                             PRETTYDEF to save VARS.)
    (OR (NEQ (GETTOPVAL RPAQX)
             (QUOTE NOBIND))
        (SETTOPVAL RPAQX (EVAL RPAQY])

(MOVD
  [LAMBDA (FROM TO COPYFLG DONTCOPY)                         (* bvm: "10-Jul-85 12:59")
    (PROG [(NEWFLG (NULL (GETD TO]
          (PUTD TO (COND
                      (COPYFLG (COPY (VIRGINFN FROM)))
                      (T (GETD FROM)))
                DONTCOPY)
          (AND FILEPKGFLG (EXPRP TO)
               (MARKASCHANGED TO (QUOTE FNS)
                      NEWFLG))
          (RETURN TO])

(MOVD?
  [LAMBDA (FROM TO COPYFLG DONTCOPY)                         (* bvm: "10-Jul-85 13:00")
                                                             (* Like MOVD but only does it if TO is 
                                                             not defined.)
    (COND
       ((NULL (GETD TO))
        (PUTD TO (COND
                    (COPYFLG (COPY (VIRGINFN FROM)))
                    (T (GETD FROM)))
              DONTCOPY)
        (AND FILEPKGFLG (EXPRP TO)
             (MARKASCHANGED TO (QUOTE FNS)
                    T))
        TO])

(SELECTQ
  [NLAMBDA SELCQ
    (APPLY (QUOTE PROGN)
           (SELECTQ1 (EVAL (CAR SELCQ)
                           (QUOTE SELECTQ))
                  (CDR SELCQ))
           (QUOTE SELECTQ])

(SELECTQ1
  [LAMBDA (M L)
    (PROG (C)
      LP  (SETQ C L)
          [COND
             ((NULL (SETQ L (CDR L)))
              (RETURN C))
             ([OR (EQ (CAR (SETQ C (CAR C)))
                      M)
                  (AND (LISTP (CAR C))
                       (FMEMB M (CAR C]
              (RETURN (CDR C]
          (GO LP])

(NCONC1
  [LAMBDA (LST X)                                            (* included in wtmisc so can make the 
                                                             call to nconc be linked.
                                                             so that user can then break on nconc.)
    (NCONC LST (FRPLACD (CONS X LST])

(PUTPROP
  [LAMBDA (ATM PROP VAL)                                     (* Included because it must be defined 
                                                             before the MOVD's in BOOTSTRAPCOMS 
                                                             that initialize /PUTPROP are executed.)
    [COND
       [(NULL ATM)
        (ERRORX (LIST 7 (LIST ATM PROP]
       ((NOT (LITATOM ATM))
        (ERRORX (LIST 14 ATM]
    (PROG ((X (GETPROPLIST ATM))
           X0)
      LOOP
          (COND
             ((NLISTP X)
              (COND
                 ((AND (NULL X)
                       X0)                                   (* typical case. property list ran out 
                                                             on an even parity position.
                                                             e.g. (A B C D))
                  (FRPLACD (CDR X0)
                         (LIST PROP VAL))
                  (RETURN VAL)))
          
          (* propety list was initially NIL or a non-list, or else it ended in a non-list 
          following an even parity position, e.g. (A B . C) fall through and add new 
          property at beginning)

              )
             ((NLISTP (CDR X))
          
          (* property list runs out on an odd parity, or ends in an odd list following an 
          odd parity, e.g. (A B C) or (A B C . D) fall through and add at beginning)

              )
             ((EQ (CAR X)
                  PROP)
              (FRPLACA (CDR X)
                     VAL)
              (RETURN VAL))
             (T (SETQ X (CDDR (SETQ X0 X)))
                (GO LOOP)))
          [SETPROPLIST ATM (CONS PROP (CONS VAL (GETPROPLIST ATM]
          (RETURN VAL])

(PROPNAMES
  [LAMBDA (ATM)                                              (* wt: " 3-AUG-78 01:23")
    (MAPLIST (GETPROPLIST ATM)
           (FUNCTION CAR)
           (FUNCTION CDDR])

(ADDPROP
  [LAMBDA (ATM PROP NEW FLG)                                 (* If FLG is T, NEW is consed onto the 
                                                             front, otherwise NCONCED onto the end.)
                                                             (* Value is new PROP value.)
    [COND
       [(NULL ATM)
        (ERRORX (LIST 7 (LIST PROP NEW]
       ((NOT (LITATOM ATM))
        (ERRORX (LIST 14 ATM]
    (PROG ((X (GETPROPLIST ATM))
           X0)
      LOOP
          (COND
             ((NLISTP X)
              (COND
                 ((AND (NULL X)
                       X0)                                   (* typical case. property list ran out 
                                                             on an even parity position.)
                  [FRPLACD (CDR X0)
                         (LIST PROP (SETQ NEW (LIST NEW]
                  (RETURN NEW)))
          
          (* proprty list was initially NIL or a non-lit, or ele it ended in a non-list 
          following an even parity position, e.g. (A B . C) fall through and add property 
          at beginning of property list.)

              )
             ((NLISTP (CDR X))
          
          (* property list runs out on an odd parity, or else ends in a non-list 
          following an odd parity, e.g. (A B C) or
          (A B C . D) fall through and add at beginning)

              )
             ((EQ (CAR X)
                  PROP)                                      (* PROP found)
              [FRPLACA (CDR X)
                     (SETQ NEW (COND
                                  (FLG (CONS NEW (CADR X)))
                                  (T (NCONC1 (CADR X)
                                            NEW]
              (RETURN NEW))
             (T (SETQ X (CDDR (SETQ X0 X)))
                (GO LOOP)))                                  (* Add to beginning of property list.)
          [SETPROPLIST ATM (CONS PROP (CONS (SETQ NEW (LIST NEW))
                                            (GETPROPLIST ATM]
          (RETURN NEW])

(REMPROP
  [LAMBDA (ATM PROP)
    [COND
       ((NULL (LITATOM ATM))
        (ERRORX (LIST 14 ATM]
    (PROG ((X (GETPROPLIST ATM))
           X0 VAL)
      LP  [COND
             ((OR (NLISTP X)
                  (NLISTP (CDR X)))
              (RETURN VAL))
             ((EQ (CAR X)
                  PROP)
              (SETQ VAL PROP)
              [COND
                 (X0 (FRPLACD (CDR X0)
                            (CDDR X)))
                 (T (SETPROPLIST ATM (CDDR X]
              (SETQ X (CDDR X)))
             (T (SETQ X (CDDR (SETQ X0 X]
          (GO LP])

(MEMB
  [LAMBDA (X Y)
    (PROG NIL
      LP  (RETURN (COND
                     ((NLISTP Y)
                      NIL)
                     ((EQ X (CAR Y))
                      Y)
                     (T (SETQ Y (CDR Y))
                        (GO LP])

(CLOSEF?
  [LAMBDA (FL)                                               (* wt: 18-MAR-77 12 20)
                                                             (* useful for resetsaves, in case 
                                                             somebody else might close the file.)
    (AND FL (OPENP FL)
         (CLOSEF FL])
)



(* "Need these in order to load even compiled files SYSLOAD")

(DEFINEQ

(LOAD
  [LAMBDA (FILE LDFLG PRINTFLG)
    (DECLARE (SPECVARS FILE LDFLG PRINTFLG)
           (GLOBALVARS PRETTYHEADER))                        (* bvm: " 8-Sep-86 11:12")
    (RESETLST
     (PROG ((DFNFLG DFNFLG)
            (BUILDMAPFLG BUILDMAPFLG)
            (FILEPKGFLG FILEPKGFLG)
            (ADDSPELLFLG ADDSPELLFLG)
            (LISPXHIST LISPXHIST)
            (PRLST (AND FILEPKGFLG (FILEPKGCHANGES)))
            (FILECREATEDENV *OLD-INTERLISP-READ-ENVIRONMENT*)
            FILEMAP FNADRLST ROOTNAME TEM FILECREATEDLST LOADA STREAM MAYBEWANTFILEMAP FILECREATEDLOC
            )
           (DECLARE (SPECVARS *PACKAGE* *READ-BASE* DFNFLG BUILDMAPFLG FILEPKGFLG ADDSPELLFLG 
                           LISPXHIST FILECREATEDLST FILECREATEDENV FILECREATEDLOC))
       TOP (if (FMEMB LDFLG LOADOPTIONS)
               then (SETQ DFNFLG LDFLG)
             elseif (AND DWIMFLG (SETQ TEM (FIXSPELL LDFLG NIL LOADOPTIONS T)))
               then (SETQ LDFLG TEM)
                    (SETQ DFNFLG LDFLG)
             else (SETQ LDFLG (ERROR "unrecognized load option" LDFLG))
                  (GO TOP))
           [RESETSAVE NIL (LIST (QUOTE CLOSEF?)
                                (SETQ STREAM (OPENSTREAM FILE (QUOTE INPUT)
                                                    (QUOTE OLD)
                                                    NIL LOADPARAMETERS]
           (if (NEQ (GETFILEPTR STREAM)
                    0)
               then                                          (* "this can come out when MSPF")
                    (SETFILEPTR STREAM 0))
           (RESETSAVE (INPUT STREAM))
           (SETQ FILE (FULLNAME STREAM))
           (if PRETTYHEADER
               then (LISPXTERPRI T)
                    (LISPXPRINT FILE T))
           (if (EQ LDFLG (QUOTE SYSLOAD))
               then (SETQ DFNFLG T)
                    (SETQ ADDSPELLFLG NIL)
                    (SETQ BUILDMAPFLG NIL)
                    (SETQ FILEPKGFLG NIL)
                    (SETQ LISPXHIST NIL))
           (AND LISPXHIST (if (SETQ LOADA (FMEMB (QUOTE SIDE)
                                                 LISPXHIST))
                              then (FRPLACA (CADR LOADA)
                                          -1)
                            else (LISPXPUT (QUOTE SIDE)
                                        (LIST -1)
                                        NIL LISPXHIST)))     (* 
                    "So that UNDOSAVE will keep saving regardless of how many undosaves are involved")
           (if (AND BUILDMAPFLG (RANDACCESSP STREAM))
               then (SETQ MAYBEWANTFILEMAP T))
           (WITH-READER-ENVIRONMENT
            FILECREATEDENV
            (PROG (ADR)
              LP  (if FILEMAP
                      then                                   (* 
                                                             "need to build map, so read carefully")
                           (SETQ LOADA (SKIPSEPRCODES STREAM))
                           (if (OR (SYNTAXP LOADA (QUOTE LEFTPAREN))
                                   (SYNTAXP LOADA (QUOTE LEFTBRACKET)))
                               then                          (* "See if we have a DEFINEQ")
                                    (SETQ ADR (GETFILEPTR STREAM))
                                    (READCCODE STREAM)       (* "Eat paren")
                                    (if (EQ (RATOM STREAM)
                                            (QUOTE DEFINEQ))
                                        then (SETQ FNADRLST (TCONC NIL ADR))
                                             (TCONC FNADRLST NIL)
                                             (TCONC FILEMAP (CAR FNADRLST))
                                             (GO DEFQLP))    (* "Not a DEFINEQ, so back out")
                                    (SETFILEPTR STREAM ADR)))
                  (SELECTQ (SETQ LOADA (READ STREAM))
                      ((STOP NIL) 
                           (if (EQ LDFLG (QUOTE SYSLOAD))
                               then (AND (NOT (MEMB (SETQ ROOTNAME (ROOTFILENAME FILE (CDR 
                                                                                       FILECREATEDLST
                                                                                           )))
                                                    SYSFILES))
                                         (SETQ SYSFILES (NCONC1 SYSFILES ROOTNAME)))
                                    (SMASHFILECOMS ROOTNAME)
                             elseif FILEPKGFLG
                               then 
          
          (* * "Do not want any items that are added to FILEPKGCHANGES as a result of being mentioned in this file to remain on FILEPKGCHANGES.  Also, we want items mentioned earlier to be deleted if they are taken care of by this file.  The extra argument to ADDFILE allows it to restore FILEPKGCHANGES to the intersection of its current value and its previous value.")

                                    (ADDFILE FILE T PRLST FILECREATEDLST))
                           [if FILEMAP
                               then (PUTFILEMAP FILE (CAR FILEMAP)
                                           FILECREATEDLST FILECREATEDENV NIL FILECREATEDLOC)
                                    (if UPDATEMAPFLG
                                        then (SETFILEPTR STREAM ADR) 
                                                             (* 
                                    "address of last expression read.  good hint for finding filemap")
                                             (UPDATEFILEMAP STREAM (CAR FILEMAP]
                           (if (NOT (MEMB FILE LOADEDFILELST))
                               then (/SETTOPVAL (QUOTE LOADEDFILELST)
                                           (CONS FILE LOADEDFILELST)))
                           (RETURN))
                      NIL)
                  [if (LISTP LOADA)
                      then (if (AND (EQ (CAR LOADA)
                                        (QUOTE FILECREATED))
                                    MAYBEWANTFILEMAP)
                               then                          (* "See if we have a valid file map")
                                    (SETQ ADR (GETFILEPTR STREAM))
                                    (if [AND [SETQ TEM (CAR (NLSETQ (SETFILEPTR STREAM (CADDDR LOADA)
                                                                           )
                                                                   (READ STREAM]
                                             (EQ (CAR TEM)
                                                 (QUOTE FILEMAP))
                                             (NULL (CAR (SETQ TEM (CADR TEM]
                                        then                 (* "Has ok map")
                                             (PUTFILEMAP FILE TEM NIL FILECREATEDENV)
                                      else                   (* "Need to build a file map as we go")
                                           (SETQ FILEMAP (TCONC NIL NIL)))
                                    (SETFILEPTR STREAM ADR)
                                    (SETQ MAYBEWANTFILEMAP NIL))
                           (SETQ LOADA (EVAL LOADA))
                    else                                     (* 
                                                             "Atom found.  Compiled code definition.")
                         (if ADDSPELLFLG
                             then (ADDSPELL LOADA))
                         (AND FILEMAP (SETQ ADR (GETFILEPTR STREAM)))
                         (LAPRD LOADA) 
          
          (* * "The system readtable is not reset for entire load so that if user does a setbrk or setsepr as result of load, he wont clobber it.  instead we reset the readtable before calling laprd and then restoreit.  we are protected against control-d or eror by resetsave on setreadtable at top of function.  thus we dont have to do a resetform each time we go in and out of laprd.")

                         (AND FILEMAP (TCONC FILEMAP (CONS ADR (CONS (GETFILEPTR STREAM)
                                                                     LOADA]
              LP1 (if PRINTFLG
                      then (PRINT LOADA T T))
                  (GO LP)
              DEFQLP
                  (SELCHARQ (SKIPSEPRCODES STREAM)
                       ((%) %])                              (* "Closes DEFINEQ.")
                            (READCCODE STREAM)
                            (AND FNADRLST (RPLACA (CDAR FNADRLST)
                                                 (GETFILEPTR STREAM)))
                                                             (* 
                          "FNADRLST is a TCONC format list, hence want to RPLACA CDAR, not just CDR.")
                            (SETQ LOADA (DEFINE (DREVERSE LOADA)))
                            (GO LP1))
                       ((%( %[)                              (* "another function/definition pair")
                            (SETQ ADR (GETFILEPTR STREAM))
                            (SETQ LOADA (CONS (READ STREAM)
                                              LOADA))
                            [AND FNADRLST (TCONC FNADRLST (CONS (CAAR LOADA)
                                                                (CONS ADR (GETFILEPTR STREAM]
                            (GO DEFQLP))
                       NIL)
                  (ERROR "illegal argument in defineq")))
           (RETURN FILE])

(FILECREATED
  [NLAMBDA X                                                 (* lmm "12-AUG-84 15:06")
    (DECLARE (USEDFREE FILECREATEDLST))
    (PROG ((FILEDATE (CAR X))
           (FILE (CADR X))
           (MESS (FILECREATED1 X)))
          (SETQ FILECREATEDLST (NCONC1 FILECREATEDLST X))
          (COND
             (PRETTYHEADER                                   (* Presumably if user sets 
                                                             prettyheader to NIL, he doesnt want to 
                                                             see any file created messages, even 
                                                             those frm compiled files.)
                    (LISPXPRIN1 MESS T)
                    (LISPXPRIN1 FILEDATE T)
                    (LISPXTERPRI T)))
          (COND
             ((AND FILE (LITATOM FILE))
          
          (* This is just temporary, primarily for keeping dates of system files which 
          are loaded with FILEPKGFLG=NIL. The real setting up of file property lists is 
          done when ADDFILE is called.)

              (/PUT (ROOTFILENAME FILE)
                    (QUOTE FILEDATES)
                    (LIST (CONS FILEDATE FILE])

(FILECREATED1
  [LAMBDA (X)                                                (* rmk: "20-FEB-83 21:50")
                                                             (* performs error checking on 
                                                             filecreated expressions.
                                                             returns the thing to be printed.
                                                             used by filecreated, and loadfns)
    (PROG ((FILE (CADR X)))
          (RETURN (COND
                     ((STRINGP FILE)                         (* old way of doing COMPILED ON)
                      FILE)
                     ((LISTP FILE)                           (* New. also used for printing 
                                                             COMPILED ON message.
                                                             CDR is a list of files that were 
                                                             compiled.)
                      (CAR FILE))
                     (T                                      (* FILE is an atom, the name of the 
                                                             file)
                        PRETTYHEADER])

(BOOTSTRAP-NAMEFIELD
  [LAMBDA (FILE SUFFIXFLG)                                   (* bvm: " 2-Aug-86 14:50")
                                                             (* BOOTSTRAP VERSION --
                                                             this is replaced by real version from 
                                                             MACHINEINDEPENDENT)
    (PROG ((START 1)
           POS END)
          (while (SETQ POS (OR (STRPOS (QUOTE })
                                      FILE START)
                               (STRPOS (QUOTE >)
                                      FILE START)
                               (STRPOS (QUOTE /)
                                      FILE START))) do (SETQ START (ADD1 POS)))
          [COND
             ((SETQ POS (STRPOS (QUOTE ;)
                               FILE))
              (SETQ END (SUB1 POS))
              (COND
                 ((EQ (NTHCHARCODE FILE END)
                      (CHARCODE "."))                        (* eliminates null suffix)
                  (SETQ END (SUB1 END]
          [COND
             ((SETQ POS (STRPOS (QUOTE %.)
                               FILE START))
              (COND
                 ((NULL SUFFIXFLG)
                  (SETQ END (SUB1 POS]
          (RETURN (SUBATOM FILE START END])

(PUTPROPS
  [NLAMBDA X                                                 (* bvm: " 8-Sep-86 11:20")
                                                             (* Later in the loadup, the PUTPROP is 
                                                             changed to SAVEPUT)
    (MAP (CDR X)
         [FUNCTION (LAMBDA (Y)
                     (PUTPROP (CAR X)
                            (CAR Y)
                            (CADR Y]
         (FUNCTION CDDR])

(DECLARE:
  [NLAMBDA X                                                 (* wt: "20-OCT-77 13:00")
    (DECLARE:1 X T])

(DECLARE:1
  [LAMBDA (X EVALFLG)                                        (* wt: "20-OCT-77 13:09")
    (PROG NIL
      LP  (COND
             ((NLISTP X)
              (RETURN))
             [(LISTP (CAR X))
              (AND EVALFLG (COND
                              ((EQ (CAAR X)
                                   (QUOTE DECLARE:))
                               (DECLARE:1 (CDAR X)
                                      T))
                              (T (EVAL (CAR X]
             (T (SELECTQ (CAR X)
                    ((EVAL@LOAD DOEVAL@LOAD) 
                         (SETQ EVALFLG T))
                    (EVAL@LOADWHEN (SETQ EVALFLG (EVAL (CADR X)))
                                   (SETQ X (CDR X)))
                    (DONTEVAL@LOAD (SETQ EVALFLG NIL))
                    NIL)))
          (SETQ X (CDR X))
          (GO LP])

(ROOTFILENAME
  [LAMBDA (NAME COMPFLG)                                     (* rmk: "20-FEB-83 21:35")
          
          (* Returns the root of the filename NAME, the atom that all file package 
          properties will be associated with. If NAME names a compiled file, then 
          COMPFLG~=NIL and we assume that the extension is COMPILE.EXT, which is to be 
          stripped off. We thus have something of an anomaly: We can keep track of 2 
          symbolic files whose names differ only in extension, but we confuse them when 
          we deal with their compiled versions.)

    (NAMEFIELD NAME (NOT COMPFLG])

(DEFINE-FILE-INFO
  [NLAMBDA ARGS                                              (* bvm: "30-Aug-86 16:39")
    (DECLARE (USEDFREE FILECREATEDLOC))
    (SET-READER-ENVIRONMENT (\DO-DEFINE-FILE-INFO NIL ARGS))
    (SETQ FILECREATEDLOC (GETFILEPTR])

(\DO-DEFINE-FILE-INFO
  [LAMBDA (STREAM ARGS)                                      (* bvm: "28-Aug-86 16:32")
          
          (* * "Processes the (DEFINE-FILE-INFO . ARGS) at the front of STREAM")

    (LET (PACKAGE READTABLE BASE)
         (for TAIL on ARGS by (CDDR TAIL)
            do (SELECTQ (CAR TAIL)
                   (:PACKAGE [SETQ PACKAGE (OR (if (LISTP (CADR ARGS))
                                                   then (\DTEST (EVAL (CADR ARGS))
                                                               (QUOTE PACKAGE))
                                                 else (FIND-PACKAGE (CADR ARGS)))
                                               (ERROR "Can't find package for reader environment"
                                                      (CADR ARGS])
                   (:READTABLE [SETQ READTABLE (OR (if (LISTP (CADR ARGS))
                                                       then (\DTEST (EVAL (CADR ARGS))
                                                                   (QUOTE READTABLEP))
                                                     else (FIND-READTABLE (CADR ARGS)))
                                                   (ERROR 
                                                       "Can't find read table for reader environment"
                                                          (CADR ARGS])
                   (:BASE [SETQ BASE (OR (\CHECKRADIX (if (LISTP (CADR ARGS))
                                                          then (EVAL (CADR ARGS))
                                                        else (CADR ARGS)))
                                         (ERROR "Bad read base for reader environment" (CADR ARGS])
                   NIL))
         (create READER-ENVIRONMENT
                REPACKAGE ← (OR PACKAGE *INTERLISP-PACKAGE*)
                REREADTABLE ← (OR READTABLE FILERDTBL)
                REBASE ← (OR BASE 10)
                RESPEC ← ARGS])
)

(RPAQ? EOLCHARCODE (CHCON1 (QUOTE %
)))

(RPAQ? PRETTYHEADER )

(RPAQ? DWIMFLG )

(RPAQ? UPDATEMAPFLG )

(RPAQ? DFNFLG )

(RPAQ? ADDSPELLFLG )

(RPAQ? BUILDMAPFLG )

(RPAQ? FILEPKGFLG )

(RPAQ? SYSFILES )

(RPAQ? NOTCOMPILEDFILES )

(RPAQ? RESETVARSLST )

(RPAQ? LOADPARAMETERS (QUOTE ((SEQUENTIAL T))))

(RPAQ? LISPXHIST )

(RPAQ? LISPXPRINTFLG T)

(RPAQ? PRETTYHEADER "FILE CREATED ")

(RPAQ? BELLS (QUOTE ""))

(RPAQ? LOADOPTIONS (QUOTE (SYSLOAD NIL T PROP ALLPROP)))

(ADDTOVAR LOADEDFILELST )
(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS PRETTYHEADER DWIMFLG PRETTYHEADER UPDATEMAPFLG LOADOPTIONS LOADPARAMETERS FILERDTBL 
       SYSFILES)
)
(DECLARE: DONTEVAL@LOAD DOCOPY 
[MAPC (QUOTE ((PUTD . /PUTD)
              (PUTPROP . /PUTPROP)
              (PUTPROP . PUT)
              (PUTPROP . SAVEPUT)
              (PUT . /PUT)
              (PRIN1 . LISPXPRIN1)
              (PRIN2 . LISPXPRIN2)
              (PRINT . LISPXPRINT)
              (TERPRI . LISPXTERPRI)
              (SPACES . LISPXSPACES)
              (GETPROP . GETP)
              (SET . SAVESET)
              (NILL . MISSPELLED?)
              (SETTOPVAL . /SETTOPVAL)
              (BOOTSTRAP-NAMEFIELD . NAMEFIELD)))
      (FUNCTION (LAMBDA (X)
                       (OR (CCODEP (CDR X))
                           (MOVD (CAR X)
                                 (CDR X)
                                 NIL T]
(AND (CCODEP (QUOTE BOOTSTRAP-NAMEFIELD))
     (PUTD (QUOTE BOOTSTRAP-NAMEFIELD)))
(AND (CCODEP (QUOTE BOOTSTRAP-PUTPROPS))
     (PUTD (QUOTE BOOTSTRAP-PUTPROPS)))
[MAPC [QUOTE ([STRPOS (LAMBDA (X Y START SKIP ANCHOR TAIL)
                             [COND [(LITATOM X)
                                    (SETQ X (CDR (VAG (IPLUS (LOC X)
                                                             2]
                                   ((NULL (STRINGP X))
                                    (SETQ X (MKSTRING X]
                             [COND ((STRINGP Y))
                                   [(LITATOM Y)
                                    (SETQ Y (CDR (VAG (IPLUS (LOC Y)
                                                             2]
                                   (T (SETQ Y (MKSTRING Y]
                             [COND (SKIP (SETQ SKIP (NTHCHAR SKIP 1]
                             (COND [START (COND ((MINUSP START)
                                                 (SETQ START (IPLUS START (NCHARS Y)
                                                                    1]
                                   (T (SETQ START 1)))
                             (SETQ Y (SUBSTRING Y START))
                             (PROG ((N START)
                                    W X1 Y1)
                                   L2
                                   (SETQ X1 (SUBSTRING X 1))
                                   (SETQ Y1 (SUBSTRING Y 1))
                                   LP
                                   (COND [(SETQ W (GNC X1))
                                          (COND ((EQ W (GNC Y1))
                                                 (GO LP))
                                                ((EQ W SKIP)
                                                 (GO LP))
                                                (T (GO NX]
                                         (TAIL (RETURN (IPLUS (NCHARS X)
                                                              N)))
                                         (T (RETURN N)))
                                   NX
                                   (COND (ANCHOR (RETURN)))
                                   (COND ((GNC Y)
                                          (SETQ N (ADD1 N))
                                          (GO L2))
                                         (T (RETURN]
              [PACKFILENAME (LAMBDA (X)
                                   X]
              [UNPACKFILENAME (LAMBDA (X)
                                     X]
              (RESETRESTORE (LAMBDA (RESETVARSLST0 RESETSTATE)
                                   (PROG (RESETZ)
                                         LP
                                         (COND ((AND RESETVARSLST (NEQ RESETVARSLST RESETVARSLST0))
                                                (SETQ RESETZ (CAR RESETVARSLST))
                                                (SETQ RESETVARSLST (CDR RESETVARSLST))
                                                [COND ((LISTP (CAR RESETZ))
                                                       (APPLY (CAAR RESETZ)
                                                              (CDR (CAR RESETZ]
                                                (GO LP]
      (FUNCTION (LAMBDA (X)
                       (OR (GETD (CAR X))
                           (PUTD (CAR X)
                                 (CADR X]

(PRINTLEVEL 1000)
(RADIX 10)
)
(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS 

(ADDTOVAR NLAMA DEFINE-FILE-INFO DECLARE: BOOTSTRAP-PUTPROPS FILECREATED SELECTQ)

(ADDTOVAR NLAML RPAQ? RPAQ RPAQQ)

(ADDTOVAR LAMA )
)
(PRETTYCOMPRINT BOOTSTRAPCOMS)

(RPAQQ BOOTSTRAPCOMS 
       [(FNS GETPROP SETATOMVAL RPAQQ RPAQ RPAQ? MOVD MOVD? SELECTQ SELECTQ1 NCONC1 PUTPROP PROPNAMES 
             ADDPROP REMPROP MEMB CLOSEF?)
        (COMS (* "Need these in order to load even compiled files SYSLOAD")
              (FNS LOAD FILECREATED FILECREATED1 BOOTSTRAP-NAMEFIELD PUTPROPS DECLARE: DECLARE:1 
                   ROOTFILENAME DEFINE-FILE-INFO \DO-DEFINE-FILE-INFO))
        [INITVARS (EOLCHARCODE (CHCON1 (QUOTE %
)))
               (PRETTYHEADER)
               (DWIMFLG)
               (UPDATEMAPFLG)
               (DFNFLG)
               (ADDSPELLFLG)
               (BUILDMAPFLG)
               (FILEPKGFLG)
               (SYSFILES)
               (NOTCOMPILEDFILES)
               (RESETVARSLST)
               [LOADPARAMETERS (QUOTE ((SEQUENTIAL T]
               (LISPXHIST)
               (LISPXPRINTFLG T)
               (PRETTYHEADER "FILE CREATED ")
               (BELLS (QUOTE ""))
               (LOADOPTIONS (QUOTE (SYSLOAD NIL T PROP ALLPROP]
        (ADDVARS (LOADEDFILELST))
        (GLOBALVARS PRETTYHEADER DWIMFLG PRETTYHEADER UPDATEMAPFLG LOADOPTIONS LOADPARAMETERS 
               FILERDTBL SYSFILES)
        (DECLARE: DONTEVAL@LOAD DOCOPY
               [P [MAPC (QUOTE ((PUTD . /PUTD)
                                (PUTPROP . /PUTPROP)
                                (PUTPROP . PUT)
                                (PUTPROP . SAVEPUT)
                                (PUT . /PUT)
                                (PRIN1 . LISPXPRIN1)
                                (PRIN2 . LISPXPRIN2)
                                (PRINT . LISPXPRINT)
                                (TERPRI . LISPXTERPRI)
                                (SPACES . LISPXSPACES)
                                (GETPROP . GETP)
                                (SET . SAVESET)
                                (NILL . MISSPELLED?)
                                (SETTOPVAL . /SETTOPVAL)
                                (BOOTSTRAP-NAMEFIELD . NAMEFIELD)))
                        (FUNCTION (LAMBDA (X)
                                         (OR (CCODEP (CDR X))
                                             (MOVD (CAR X)
                                                   (CDR X)
                                                   NIL T]
                  (AND (CCODEP (QUOTE BOOTSTRAP-NAMEFIELD))
                       (PUTD (QUOTE BOOTSTRAP-NAMEFIELD)))
                  (AND (CCODEP (QUOTE BOOTSTRAP-PUTPROPS))
                       (PUTD (QUOTE BOOTSTRAP-PUTPROPS)))
                  (MAPC [QUOTE ([STRPOS (LAMBDA (X Y START SKIP ANCHOR TAIL)
                                               [COND [(LITATOM X)
                                                      (SETQ X (CDR (VAG (IPLUS (LOC X)
                                                                               2]
                                                     ((NULL (STRINGP X))
                                                      (SETQ X (MKSTRING X]
                                               [COND ((STRINGP Y))
                                                     [(LITATOM Y)
                                                      (SETQ Y (CDR (VAG (IPLUS (LOC Y)
                                                                               2]
                                                     (T (SETQ Y (MKSTRING Y]
                                               [COND (SKIP (SETQ SKIP (NTHCHAR SKIP 1]
                                               (COND [START (COND ((MINUSP START)
                                                                   (SETQ START (IPLUS START
                                                                                      (NCHARS Y)
                                                                                      1]
                                                     (T (SETQ START 1)))
                                               (SETQ Y (SUBSTRING Y START))
                                               (PROG ((N START)
                                                      W X1 Y1)
                                                     L2
                                                     (SETQ X1 (SUBSTRING X 1))
                                                     (SETQ Y1 (SUBSTRING Y 1))
                                                     LP
                                                     (COND [(SETQ W (GNC X1))
                                                            (COND ((EQ W (GNC Y1))
                                                                   (GO LP))
                                                                  ((EQ W SKIP)
                                                                   (GO LP))
                                                                  (T (GO NX]
                                                           (TAIL (RETURN (IPLUS (NCHARS X)
                                                                                N)))
                                                           (T (RETURN N)))
                                                     NX
                                                     (COND (ANCHOR (RETURN)))
                                                     (COND ((GNC Y)
                                                            (SETQ N (ADD1 N))
                                                            (GO L2))
                                                           (T (RETURN]
                                [PACKFILENAME (LAMBDA (X)
                                                     X]
                                [UNPACKFILENAME (LAMBDA (X)
                                                       X]
                                (RESETRESTORE (LAMBDA (RESETVARSLST0 RESETSTATE)
                                                     (PROG (RESETZ)
                                                           LP
                                                           (COND ((AND RESETVARSLST (NEQ RESETVARSLST 
                                                                                        RESETVARSLST0
                                                                                         ))
                                                                  (SETQ RESETZ (CAR RESETVARSLST))
                                                                  (SETQ RESETVARSLST (CDR 
                                                                                         RESETVARSLST
                                                                                          ))
                                                                  [COND ((LISTP (CAR RESETZ))
                                                                         (APPLY (CAAR RESETZ)
                                                                                (CDR (CAR RESETZ]
                                                                  (GO LP]
                        (FUNCTION (LAMBDA (X)
                                         (OR (GETD (CAR X))
                                             (PUTD (CAR X)
                                                   (CADR X]
               (P (PRINTLEVEL 1000)
                  (RADIX 10)))
        (DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS
               (ADDVARS (NLAMA DEFINE-FILE-INFO DECLARE: PUTPROPS FILECREATED SELECTQ)
                      (NLAML RPAQ? RPAQ RPAQQ)
                      (LAMA])
(DECLARE: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS 

(ADDTOVAR NLAMA DEFINE-FILE-INFO DECLARE: PUTPROPS FILECREATED SELECTQ)

(ADDTOVAR NLAML RPAQ? RPAQ RPAQQ)

(ADDTOVAR LAMA )
)
(PUTPROPS BOOTSTRAP COPYRIGHT ("Xerox Corporation" 1983 1984 1985 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (7901 16775 (GETPROP 7911 . 8500) (SETATOMVAL 8502 . 8797) (RPAQQ 8799 . 8852) (RPAQ 
8854 . 9179) (RPAQ? 9181 . 9572) (MOVD 9574 . 10003) (MOVD? 10005 . 10590) (SELECTQ 10592 . 10792) (
SELECTQ1 10794 . 11136) (NCONC1 11138 . 11485) (PUTPROP 11487 . 13269) (PROPNAMES 13271 . 13465) (
ADDPROP 13467 . 15579) (REMPROP 15581 . 16162) (MEMB 16164 . 16423) (CLOSEF? 16425 . 16773)) (16846 
34944 (LOAD 16856 . 26597) (FILECREATED 26599 . 27870) (FILECREATED1 27872 . 29150) (
BOOTSTRAP-NAMEFIELD 29152 . 30495) (PUTPROPS 30497 . 30985) (DECLARE: 30987 . 31120) (DECLARE:1 31122
 . 31987) (ROOTFILENAME 31989 . 32652) (DEFINE-FILE-INFO 32654 . 32919) (\DO-DEFINE-FILE-INFO 32921 . 
34942)))))
STOP