;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:8; Patch-File:T -*-
;;; Patch file for System version 126.55
;;; Reason:
;;;  Improvements to READ-INTERN-SOFT:
;;;  
;;;  1) When a symbol was not found, it signalled an inappropriate error,
;;;  e.g. claiming the current package was auto-exporting merely if it wasn't
;;;  read-locked.
;;;  
;;;  2) This function is supposed to enforce the restriction that forbids
;;;  interning new symbols into read-locked and auto-exporting packages.
;;;  Generally, this worked; but things like the following generated a
;;;  continuable error:
;;;  
;;;   (read-from-string "GLOBAL:YOU-LOSE")
;;;  
;;;  Now, READ-INTERN-SOFT acts true to its name, and signals a fatal error.
;;;  If an uninterned symbol in a "normal" package is read, the resume option
;;;  is still allowed.  (The proceed message is somewhat misleading, though.)
;;;  
;;;  3) The name READ-INTERN-SOFT was somewhat of a misnomer, since it always
;;;  signalled some error or other when a symbol was not found.  Now, it
;;;  accepts an optional argument, ERROR-P. Now, when a symbol is not found,
;;;  if ERROR-P is non-NIL (the default), an appropriate error is signalled;
;;;  otherwise, NIL is returned.
;;; Written 16-Aug-88 21:50:29 by keith (Keith Corbett) at site Gigamos Cambridge
;;; while running on Breaking Glass from band 2
;;; with Experimental System 126.53, ZWEI 125.17, ZMail 73.2, Local-File 75.2, File-Server 24.1, Tape 24.2, Lambda-Diag 17.0, Experimental Unix-Interface 14.0, microcode 1762, SDU Boot Tape 3.14, SDU ROM 103.



; From modified file DJ: L.IO; READ.LISP#469 at 16-Aug-88 21:51:15
#8R SYSTEM-INTERNALS#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "SYSTEM-INTERNALS")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: IO; READ  "

(defun read-error (format-string &rest format-args)
  (declare (dbg:error-reporter))
  (apply #'cerror :no-action nil 'read-error-1 format-string format-args))

))

; From modified file DJ: L.IO; READ.LISP#469 at 16-Aug-88 21:51:20
#8R SYSTEM-INTERNALS#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "SYSTEM-INTERNALS")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: IO; READ  "

(defun read-fatal-error (format-string &rest format-args)
  (declare (dbg:error-reporter))
  (apply #'ferror 'read-error-1 format-string format-args))

))

; From modified file DJ: L.IO; READ.LISP#469 at 16-Aug-88 21:51:53
#8R SYSTEM-INTERNALS#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "SYSTEM-INTERNALS")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: IO; READ  "

;;;Used for interning in special packages.  This now signals fatal
;;;errors to avoid interning within read-locked and auto-exporting
;;;packages.  Note the old broken definition. -Keith
;;; (defun read-intern-soft (string)
;;;   (multiple-value-bind (sym flag pkg)
;;;       (find-symbol string)
;;;     (unless flag
;;;       (read-error "Package ~A is ~:[autoexporting~;read-locked~]; ~
;;;	 		the reader cannot make a symbol ~S there."
;;;		   *package* (pkg-read-lock-p *package*) string)
;;;       (multiple-value-setq (sym flag pkg) (intern string *package*)))  ;was pkg-keyword-package??
;;;     (values sym flag pkg)))
;;;
(defun read-intern-soft (string &optional (error-p t))
  (declare (values symbol actually-found-flag actual-package))
  (multiple-value-bind (ignore flag ignore)
      (find-symbol string)
    (cond
      (flag
       (intern string *package*))
      ((null error-p) nil)
      ((pkg-read-lock-p *package*)
       (read-fatal-error "Package ~A is read-locked; ~
			the reader cannot make a symbol ~S there."
		  *package* string))
      ((pkg-auto-export-p *package*)
       (read-fatal-error "Package ~A is auto-exporting; ~
			the reader cannot make a symbol ~S there."
		  *package* string))
      (t
       (read-error "The symbol ~S is not found in package ~A."
		   string *package*)))))

))
