(FILECREATED " 9-Sep-86 13:51:45" {ERIS}<LISPCORE>NEWERR>AERROR.;3 6997   

      changes to:  (VARS AERRORCOMS)
                   (VARIABLES *LAST-CONDITION*)
                   (OPTIMIZERS LISPERROR)

      previous date: " 4-Sep-86 14:19:08" {ERIS}<LISPCORE>NEWERR>AERROR.;1)


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

(PRETTYCOMPRINT AERRORCOMS)

(RPAQQ AERRORCOMS ((FNS ERRORM ERRORN ERRORSTRING SETERRORN LISPERROR \LISPERROR \ILLEGAL.ARG 
                        \ARG.NOT.LITATOM)
                   (EXPORT (DECLARE: EVAL@COMPILE (VARS \ERRORMESSAGELIST)
                                  DONTCOPY
                                  (OPTIMIZERS LISPERROR)))
                   (VARIABLES *LAST-CONDITION*)
                   (GLOBALVARS \ERRORMESSAGELIST)
                   (FUNCTIONS CONDITION-TO-ERRN ERRM-TO-CONDITION)
                   (PROP FILETYPE AERROR)
                   (LOCALVARS . T)))
(DEFINEQ

(ERRORM
  (LAMBDA (X)                                                (* amd "30-Jul-86 15:31")
    (CL:UNLESS (OR (CONDITION-TYPEP X (QUOTE CONDITION))
                   (CL:LISTP X))
           (CL:SETQ X (LIST 17 X)))
    (COND
       ((CONDITION-TYPEP X (QUOTE CONDITION))
        (CL:TERPRI T)
        (REPORT-CONDITION X T)
        (CL:TERPRI T))
       (T (PROG NIL
                (TERPRI T)
                (PRIN1 (OR (CAR (NTH \ERRORMESSAGELIST (ADD1 (OR (NUMBERP (CAR X))
                                                                 17))))
                           (QUOTE "ERROR"))
                       T T)
                (TERPRI T)
                (RETURN (PRINT (CAR (OR (LISTP (CDR X))
                                        (RETURN)))
                               T T)))))))

(ERRORN
  (LAMBDA NIL                                                (* amd "30-Jul-86 17:58")
                                                             (* lmm: 26 JUN 75 655)
    (COND
       ((NULL *LAST-CONDITION*)
        NIL)
       ((CONDITION-TYPEP *LAST-CONDITION* (QUOTE OLD-INTERLISP-ERROR))
        (CONS (OLD-INTERLISP-ERROR-NUMBER *LAST-CONDITION*)
              (COND
                 ((OLD-INTERLISP-ERROR-MESSAGE *LAST-CONDITION*)
                  (LIST (OLD-INTERLISP-ERROR-MESSAGE *LAST-CONDITION*)))
                 (T NIL))))
       (T *LAST-CONDITION*))))

(ERRORSTRING
  (LAMBDA (X)                                                (* lmm "21-APR-80 15:46")
    (CAR (NTH \ERRORMESSAGELIST (ADD1 (OR (NUMBERP X)
                                          17))))))

(SETERRORN
  (LAMBDA (NUM MESS)                                         (* amd "30-Jul-86 17:00")
    (CL:SETQ *LAST-CONDITION* (ERRM-TO-CONDITION NUM MESS))))

(LISPERROR
  (LAMBDA (N X CONTINUEOKFLG)                                (* lmm " 6-MAY-80 21:30")
                                                             (* compiles open as call to \LISPERROR)
    (\LISPERROR X N CONTINUEOKFLG)))

(\LISPERROR
  (LAMBDA (X N CONTINUEOKFLG)                                (* bvm: " 1-NOV-83 21:07")
    (DECLARE (USEDFREE \INTERRUPTABLE))
    (PROG NIL
          (SELECTQ N
              ((5 22)                                        (* File errors that can happen to 
                                                             files open for output)
                   (\STOP.DRIBBLE? X))
              NIL)
          (OR \INTERRUPTABLE (\MP.ERROR \MP.UNINTERRUPTABLE 
                          "Error in uninterruptable system code -- ↑N to continue into error handler" 
                                    X))
      RET (RETURN (PROG1 (COND
                            ((SMALLP N)
                             (ERRORX (LIST N X)))
                            (T (ERROR N X)))
                         (OR CONTINUEOKFLG (GO RET)))))))

(\ILLEGAL.ARG
  (LAMBDA (X)                                                (* lmm "25-APR-80 18:02")
    (LISPERROR "ILLEGAL ARG" X)))

(\ARG.NOT.LITATOM
  (LAMBDA (X)                                                (* lmm "25-APR-80 18:02")
    (LISPERROR "ARG NOT LITATOM" X)))
)
(* FOLLOWING DEFINITIONS EXPORTED)


(DECLARE: EVAL@COMPILE 

(RPAQQ \ERRORMESSAGELIST 
       ("SYSTEM ERROR" " " "STACK OVERFLOW" "ILLEGAL RETURN" "ARG NOT LIST" "HARD DISK ERROR" 
              "ATTEMPT TO SET NIL OR T" "ATTEMPT TO RPLAC NIL" "UNDEFINED OR ILLEGAL GO" 
              "FILE WON'T OPEN" "NON-NUMERIC ARG" "ATOM TOO LONG" "ATOM HASH TABLE FULL" 
              "FILE NOT OPEN" "ARG NOT LITATOM" "! too many files open" "END OF FILE" "ERROR" "BREAK" 
              "ILLEGAL STACK ARG" "FAULT IN EVAL" "ARRAYS FULL" "FILE SYSTEM RESOURCES EXCEEDED" 
              "FILE NOT FOUND" "BAD SYSOUT FILE" "UNUSUAL CDR ARG LIST" "HASH TABLE FULL" 
              "ILLEGAL ARG" "ARG NOT ARRAY" "ILLEGAL OR IMPOSSIBLE BLOCK" 
              "STACK PTR HAS BEEN RELEASED" "STORAGE FULL" "ATTEMPT TO USE ITEM OF INCORRECT TYPE" 
              "ILLEGAL DATA TYPE NUMBER" "DATA TYPES FULL" "ATTEMPT TO BIND NIL OR T" 
              "! too many user interrupt characters" "! read-macro context error" "ILLEGAL READTABLE" 
              "ILLEGAL TERMINAL TABLE" "! swapblock too big for buffer" "PROTECTION VIOLATION" 
              "BAD FILE NAME" "USER BREAK" "UNBOUND ATOM" "UNDEFINED CAR OF FORM" 
              "UNDEFINED FUNCTION" "CONTROL-E" "FLOATING UNDERFLOW" "FLOATING OVERFLOW" "OVERFLOW" 
              "ARG NOT HARRAY" "TOO MANY ARGUMENTS"))
DONTCOPY 
(DEFOPTIMIZER LISPERROR (MESSAGE ARG)
   (BQUOTE (\LISPERROR (\, ARG)
                  (\, (CL:IF (CL:STRINGP MESSAGE)
                             (FOR X IN \ERRORMESSAGELIST AS I FROM 0 WHEN (CL:EQUAL X MESSAGE)
                                DO (RETURN I) FINALLY (RETURN (HELP "Unknown error message"
                                                                    (LIST MESSAGE ARG))))
                             MESSAGE)))))

)


(* END EXPORTED DEFINITIONS)

(DEFVAR *LAST-CONDITION* NIL "Last condition signalled. This gets rebound to itself in nested execs.")

(DECLARE: DOEVAL@COMPILE DONTCOPY

(GLOBALVARS \ERRORMESSAGELIST)
)
(DEFUN CONDITION-TO-ERRN (CONDITION) (CL:IF (CONDITION-TYPEP CONDITION (QUOTE OLD-INTERLISP-ERROR))
                                            (OLD-INTERLISP-ERROR-NUMBER CONDITION)
                                            NIL))

(DEFUN ERRM-TO-CONDITION (NUM MESSAGE) (CL:IF (CONDITION-TYPEP NUM (QUOTE CONDITION))
                                              NUM
                                              (MAKE-CONDITION (QUOTE OLD-INTERLISP-ERROR)
                                                     :NUMBER NUM :MESSAGE MESSAGE)))


(PUTPROPS AERROR FILETYPE COMPILE-FILE)
(DECLARE: DOEVAL@COMPILE DONTCOPY

(LOCALVARS . T)
)
(PUTPROPS AERROR COPYRIGHT ("Xerox Corporation" 1982 1983 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (958 4209 (ERRORM 968 . 1782) (ERRORN 1784 . 2381) (ERRORSTRING 2383 . 2599) (SETERRORN 
2601 . 2772) (LISPERROR 2774 . 3029) (\LISPERROR 3031 . 3895) (\ILLEGAL.ARG 3897 . 4047) (
\ARG.NOT.LITATOM 4049 . 4207)))))
STOP