| ... |
... |
@@ -191,10 +191,20 @@ |
|
191
|
191
|
|
|
192
|
192
|
;;; SIGNAL-PACKAGE-LOCKED-ERROR -- Internal
|
|
193
|
193
|
;;;
|
|
194
|
|
-;;; This encapsulates signaling of package locked errors.
|
|
|
194
|
+;;; This encapsulates signaling of package locked errors. LOCK-KIND
|
|
|
195
|
+;;; should be one of the following which will clear the corresponding
|
|
|
196
|
+;;; lock when the UNLOCK-PACKAGE restart is selected.
|
|
|
197
|
+;;;
|
|
|
198
|
+;;; :definition - resets package-definition-lock
|
|
|
199
|
+;;; :namespace - resets package-lock
|
|
|
200
|
+;;;
|
|
|
201
|
+;;; Error is signaled only if *ENABLE-PACKAGE-LOCKED-ERRORS* is non-NIL.
|
|
195
|
202
|
(defun signal-package-locked-error (package lock-kind message-control &rest message-args)
|
|
196
|
|
- (when (and (boundp 'lisp::*enable-package-locked-errors*)
|
|
197
|
|
- lisp::*enable-package-locked-errors*)
|
|
|
203
|
+ (declare (type (member :definition :namespace) lock-kind))
|
|
|
204
|
+ ;; During bootstrap, *ENABLE-PACKAGE-LOCKED-ERRORS* may not be
|
|
|
205
|
+ ;; bound. Treat that is if it were NIL, so nothing is signaled.
|
|
|
206
|
+ (when (and (boundp '*enable-package-locked-errors*)
|
|
|
207
|
+ *enable-package-locked-errors*)
|
|
198
|
208
|
(restart-case
|
|
199
|
209
|
(error 'lisp::package-locked-error
|
|
200
|
210
|
:package package
|
| ... |
... |
@@ -218,43 +228,8 @@ |
|
218
|
228
|
(write-string (intl:gettext "Unlock all packages, then continue") stream))
|
|
219
|
229
|
(unlock-all-packages)))))
|
|
220
|
230
|
|
|
221
|
|
-;; trap attempts to redefine a function in a locked package, and
|
|
|
231
|
+;; Trap attempts to redefine a function in a locked package, and
|
|
222
|
232
|
;; signal a continuable error.
|
|
223
|
|
-#+nil
|
|
224
|
|
-(defun redefining-function (function replacement)
|
|
225
|
|
- (declare (ignore replacement))
|
|
226
|
|
- (when *enable-package-locked-errors*
|
|
227
|
|
- (multiple-value-bind (valid block-name)
|
|
228
|
|
- (ext:valid-function-name-p function)
|
|
229
|
|
- (declare (ignore valid))
|
|
230
|
|
- (let ((package (symbol-package block-name)))
|
|
231
|
|
- (when package
|
|
232
|
|
- (when (package-definition-lock package)
|
|
233
|
|
- (when (and (consp function)
|
|
234
|
|
- (member (first function)
|
|
235
|
|
- '(pcl::slot-accessor
|
|
236
|
|
- pcl::method
|
|
237
|
|
- pcl::fast-method
|
|
238
|
|
- pcl::effective-method
|
|
239
|
|
- pcl::ctor)))
|
|
240
|
|
- (return-from redefining-function nil))
|
|
241
|
|
- (restart-case
|
|
242
|
|
- (error 'package-locked-error
|
|
243
|
|
- :package package
|
|
244
|
|
- :format-control (intl:gettext "redefining function ~A")
|
|
245
|
|
- :format-arguments (list function))
|
|
246
|
|
- (continue ()
|
|
247
|
|
- :report (lambda (stream)
|
|
248
|
|
- (write-string (intl:gettext "Ignore the lock and continue") stream)))
|
|
249
|
|
- (unlock-package ()
|
|
250
|
|
- :report (lambda (stream)
|
|
251
|
|
- (write-string (intl:gettext "Disable package's definition-lock, then continue") stream))
|
|
252
|
|
- (setf (ext:package-definition-lock package) nil))
|
|
253
|
|
- (unlock-all ()
|
|
254
|
|
- :report (lambda (stream)
|
|
255
|
|
- (write-string (intl:gettext "Disable all package locks, then continue") stream))
|
|
256
|
|
- (unlock-all-packages)))))))))
|
|
257
|
|
-
|
|
258
|
233
|
(defun redefining-function (function replacement)
|
|
259
|
234
|
(declare (ignore replacement))
|
|
260
|
235
|
(when *enable-package-locked-errors*
|
| ... |
... |
@@ -1491,25 +1466,6 @@ |
|
1491
|
1466
|
(signal-package-locked-error package :namespace
|
|
1492
|
1467
|
(intl:gettext "uninterning symbol ~A")
|
|
1493
|
1468
|
name))
|
|
1494
|
|
- #+nil
|
|
1495
|
|
- (when *enable-package-locked-errors*
|
|
1496
|
|
- (when (ext:package-lock package)
|
|
1497
|
|
- (restart-case
|
|
1498
|
|
- (error 'package-locked-error
|
|
1499
|
|
- :package package
|
|
1500
|
|
- :format-control (intl:gettext "uninterning symbol ~A")
|
|
1501
|
|
- :format-arguments (list name))
|
|
1502
|
|
- (continue ()
|
|
1503
|
|
- :report (lambda (stream)
|
|
1504
|
|
- (write-string (intl:gettext "Ignore the lock and continue") stream)))
|
|
1505
|
|
- (unlock-package ()
|
|
1506
|
|
- :report (lambda (stream)
|
|
1507
|
|
- (write-string (intl:gettext "Disable package's lock then continue") stream))
|
|
1508
|
|
- (setf (ext:package-lock package) nil))
|
|
1509
|
|
- (unlock-all ()
|
|
1510
|
|
- :report (lambda (stream)
|
|
1511
|
|
- (write-string (intl:gettext "Unlock all packages, then continue") stream))
|
|
1512
|
|
- (unlock-all-packages)))))
|
|
1513
|
1469
|
;;
|
|
1514
|
1470
|
;; If a name conflict is revealed, give use a chance to shadowing-import
|
|
1515
|
1471
|
;; one of the accessible symbols.
|
| ... |
... |
@@ -1678,25 +1634,7 @@ |
|
1678
|
1634
|
(signal-package-locked-error package :namespace
|
|
1679
|
1635
|
(intl:gettext "unexporting symbols ~A")
|
|
1680
|
1636
|
symbols))
|
|
1681
|
|
- #+nil
|
|
1682
|
|
- (when *enable-package-locked-errors*
|
|
1683
|
|
- (when (ext:package-lock package)
|
|
1684
|
|
- (restart-case
|
|
1685
|
|
- (error 'package-locked-error
|
|
1686
|
|
- :package package
|
|
1687
|
|
- :format-control (intl:gettext "unexporting symbols ~A")
|
|
1688
|
|
- :format-arguments (list symbols))
|
|
1689
|
|
- (continue ()
|
|
1690
|
|
- :report (lambda (stream)
|
|
1691
|
|
- (write-string (intl:gettext "Ignore the lock and continue") stream)))
|
|
1692
|
|
- (unlock-package ()
|
|
1693
|
|
- :report (lambda (stream)
|
|
1694
|
|
- (write-string (intl:gettext "Disable package's lock then continue") stream))
|
|
1695
|
|
- (setf (ext:package-lock package) nil))
|
|
1696
|
|
- (unlock-all ()
|
|
1697
|
|
- :report (lambda (stream)
|
|
1698
|
|
- (write-string (intl:gettext "Unlock all packages, then continue") stream))
|
|
1699
|
|
- (unlock-all-packages)))))
|
|
|
1637
|
+
|
|
1700
|
1638
|
(dolist (sym (symbol-listify symbols))
|
|
1701
|
1639
|
(multiple-value-bind (s w) (find-symbol (symbol-name sym) package)
|
|
1702
|
1640
|
(cond ((or (not w) (not (eq s sym)))
|