From f9c9b95e86c05a63192533e2d57050ae48a62472 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Mon, 31 May 2004 21:47:06 +0000 Subject: [PATCH] 0.8.10.72: One more piece of unsupported speculative functionality: merge CSR's deboostrap idea for find-package to better support tools which want to reason about source code. ... I believe this should be enough to allow SLIME & friends to present a seamless editing environment for sbcl source code. Maybe. --- package-data-list.lisp-expr | 5 +++++ src/code/target-package.lisp | 23 ++++++++++++++++++++--- version.lisp-expr | 2 +- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/package-data-list.lisp-expr b/package-data-list.lisp-expr index 9315fca..3c64ce4 100644 --- a/package-data-list.lisp-expr +++ b/package-data-list.lisp-expr @@ -799,6 +799,11 @@ retained, possibly temporariliy, because it might be used internally." ;; ..and CONDITIONs.. "BUG" "UNSUPPORTED-OPERATOR" + + "BOOTSTRAP-PACKAGE-NAME" + "BOOTSTRAP-PACKAGE-NOT-FOUND" + "DEBOOTSTRAP-PACKAGE" + "REFERENCE-CONDITION" "REFERENCE-CONDITION-REFERENCES" "*PRINT-CONDITION-REFERENCES*" diff --git a/src/code/target-package.lisp b/src/code/target-package.lisp index 5caa525..ab640e9 100644 --- a/src/code/target-package.lisp +++ b/src/code/target-package.lisp @@ -130,12 +130,29 @@ (!cold-init-forms (setf *!deferred-use-packages* nil)) -;;; FIXME: I rewrote this. Test it and the stuff that calls it. +(define-condition bootstrap-package-not-found (condition) + ((name :initarg :name :reader bootstrap-package-name))) +(defun debootstrap-package (&optional condition) + (invoke-restart + (find-restart-or-control-error 'debootstrap-package condition))) + (defun find-package (package-designator) (flet ((find-package-from-string (string) (declare (type string string)) - (values (gethash string *package-names*)))) - (declare (inline find-package-from-string)) + (let ((packageoid (gethash string *package-names*))) + (when (and (null packageoid) + (not *in-package-init*) ; KLUDGE + (let ((mismatch (mismatch "SB!" string))) + (and mismatch (= mismatch 3)))) + (restart-case + (signal 'bootstrap-package-not-found :name string) + (debootstrap-package () + (return-from find-package + (if (string= string "SB!XC") + (find-package "COMMON-LISP") + (find-package + (substitute #\- #\! string :count 1))))))) + packageoid))) (typecase package-designator (package package-designator) (symbol (find-package-from-string (symbol-name package-designator))) diff --git a/version.lisp-expr b/version.lisp-expr index e10b284..6571c7f 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.10.71" +"0.8.10.72" -- 1.7.10.4