source: trunk/j/src/org/armedbear/lisp/package.lisp @ 11292

Last change on this file since 11292 was 11292, checked in by ehuelsmann, 15 years ago

Add 'package.lisp' to hold package functions which signal continuable errors as required per the spec.

Resolves MAKE-PACKAGE.ERROR.x from the ansi-tests.

File size: 2.4 KB
Line 
1;;; package.lisp
2;;;
3;;; Copyright (C) 2008 Erik Huelsmann
4;;; $Id: parse-integer.lisp,v 1.4 2003-09-08 13:35:25 piso Exp $
5;;;
6;;; This program is free software; you can redistribute it and/or
7;;; modify it under the terms of the GNU General Public License
8;;; as published by the Free Software Foundation; either version 2
9;;; of the License, or (at your option) any later version.
10;;;
11;;; This program is distributed in the hope that it will be useful,
12;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with this program; if not, write to the Free Software
18;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
20(in-package "SYSTEM")
21
22;; Redefines make-package from boot.lisp
23
24(defun make-package (name &key nicknames use)
25  (restart-case
26      (progn
27        (when (find-package name)
28          (error 'simple-error "Package ~A already exists." name))
29        (dolist (nick nicknames)
30          (when (find-package nick)
31            (error 'package-error :package nick)))
32        (%make-package name nicknames use))
33    (use-existing-package ()
34      :report "Use existing package"
35      (return-from make-package (find-package name)))))
36
37(defun import (symbols &optional (package *package* package-supplied-p))
38  (if package-supplied-p
39      (%import symbols package)
40      (%import symbols)))
41;;attempt to fix the import failures IMPORT.ERROR.4 and .5
42;;   (dolist (symbol (if (listp symbols) symbols (list symbols)))
43;;     (let* ((sym-name (string symbol))
44;;            (local-sym (find-symbol sym-name package)))
45;;       (restart-case
46;;           (progn
47;;             (when (and local-sym (not (eql symbol local-sym)))
48;;               (error 'package-error (format nil "Symbol ~S already accessible in package ~S." local-sym (package-name package))))
49;;             (if package-supplied-p
50;;                 (%import symbol package)
51;;                 (%import symbol)))
52;;         (continue ()
53;;           :report (lambda (s) (format s "Unintern ~S and continue" local-sym))
54;;           (unintern local-sym)
55;;           (%import symbol))
56;;         (abort ()
57;;           :report "Skip symbol")))))
Note: See TracBrowser for help on using the repository browser.