;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:8; Patch-File:T -*-
;;; Patch file for System version 121.36
;;; Reason:
;;;  When IMPORT gets a name conflict, the ``import new'' and
;;;   ``retain old'' alternatives each get a separate user proceed
;;;   command, instead of sharing one and then choosing I or R.
;;;  Warn about too many else clauses for LISP:IF and rewrite if neccessary.
;;;   This is meant to catch losing callers in system code and will be
;;;   withdrawn all soon as all -*- Readtable: CL -*-  system source files
;;;   have been recompiled.
;;; Written 23-Feb-87 17:42:24 by RpK (Robert P. Krajewski) at site LMI Cambridge
;;; while running on I Never Promised You a Rose Garden from band 1
;;; with Experimental System 121.35, Experimental Lambda-Diag 15.0, Experimental ZMail 70.2, Experimental KERMIT 32.0, Experimental Unix-Interface 10.0, Experimental Local-File 72.0, Experimental FILE-Server 21.0, Experimental Tape 13.0, Experimental GRUNCH 4.5, microcode 1729, SDU Boot Tape 3.12, SDU ROM 102.



; From modified file DJ: L.SYS; CLPACK.LISP#221 at 23-Feb-87 17:42:24
#8R SYSTEM-INTERNALS#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "SYSTEM-INTERNALS")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: SYS; CLPACK  "

(defun import (symbols &optional (pkg *package*))
  "Makes SYMBOLS be present in package PKG.
They then belong to PKG directly, rather than by inheritance.
Error if this produces a name conflict
/(a distinct symbol with the same name is already accesible in PKG)."
  (setq pkg (pkg-find-package pkg))
  (dolist (sym (if (cl:listp symbols) symbols (list symbols)))
    (unless (symbolp sym)
      (ferror "The argument ~S to IMPORT was not a symbol" sym))
    (multiple-value-bind (tem foundp)
	(intern-soft (symbol-name sym) pkg)
      (when (and foundp
		 (neq tem sym))
	(let ((*query-io* *debug-io*))
	  (multiple-cerror '(symbol-name-conflict) ()
			   ("A symbol named ~S is already accessible in package ~A." (symbol-name sym) pkg)
	    ("Import the new symbol."
	     (unintern tem pkg))
	    ("Retain the old symbol."
	     (go punt))))))
    (intern sym pkg)
    punt)
  t)

))

; From modified file DJ: L.SYS; QCOPT.LISP#176 at 23-Feb-87 18:06:55
#8R COMPILER#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "COMPILER")))
  (PATCH-SOURCE-FILE "SYS: SYS; QCOPT  "

(defoptimizer fix-cli-if cli:if (form)
  (cond ((< (length form) 5)
	 form)
	(t
	 (warn 'improper-common-lisp :obsolete "~S used with ~D extra argument~:P."
	       'cli:if (- (length form) 4))
	 `(cond (,(cadr form) ,(caddr form)) (t ,@(cdddr form))))))

))
