Some package utilities. License: AGPL3 Copyright Pascal J. Bourguignon 2003 - 2012 This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>
*package-verbose* |
variable |
Whether some package operation defined in this package shall issue some verbosity. SEE ALSO: REGISTER, LOAD-PACKAGE, ADD-NICKNAME.
Initial value: NIL
*packages* |
variable |
We cannot use COMMON-LISP:*MODULES* since it's deprecated, so here is our own. This is an a-list (file-pathname . (package-name)). Note: the main data item is the file-pathname; the package-name is kept as a human readable item; caveat: packages can be renamed!
Initial value: NIL
(add-nickname package nickname &key steal force) |
function |
DO: Add the NICKNAME to the PACKAGE. STEAL: If another package has already this nickname, then steal it. FORCE: If another package has this nickname as package name, then steal it. RETURN: The package designated by PACKAGE.
(add-translations &rest translations) |
function |
DO: Prepend the TRANSLATIONS to the list of logical pathname translations of the PACKAGES: logical host. These translations may concern either the long names of package: the package COM.INFORMATIMAGO.COMMON-LIST.CESARUM.UTILITY is loaded from PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;CESARUM;UTILITY which could be translated to: /usr/share/lisp/packages/com/informatimago/common-lisp/cesarum/utility.lisp or abstract, short nicknames: the package nicknamed DICTIONARY would be loaded from PACKAGES:DICTIONARY which could be translated to: PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;HASH-DICT or to: PACKAGES:COM;INFORMATIMAGO;COMMON-LISP;BIN-TREE-DICT
(copy-package old-package new-name) |
function |
RETURN: A new package that exports all the external symbols of the OLD-PACKAGE. OLD-PACKAGE: A package designator. NEW-NAME: A package name (string designator)
(crack-open-package package) |
function |
NOTE: USE-PACKAGE only imports exported symbols. This function imports into the current package all the symbols present in the PACKAGE.
(delete-packages root-package) |
function |
Delete the package designated by the package designator ROOT-PACKAGE, and all the packages that depend on it (but CL-USER).
KEYWORD-PREPARE-TOKEN
(list-all-symbols package &key sorted) |
function |
RETURN: A list of all the symbols present in the PACKAGE. PACKAGE: A package designator. SORTED: Whether the result list is sorted (default T).
(list-external-symbols package &key sorted) |
function |
RETURN: A list of all the symbols exported from the PACKAGE. PACKAGE: A package designator. SORTED: Whether the result list is sorted (default T).
(list-symbols package &key sorted homely exported shadowing all) |
function |
PACKAGE: A package designator. SORTED: (boolean) Whether the resulting list is sorted on symbol-names. HOMELY: (boolean) selects the symbols whose home package is PACKAGE. EXPORTED: (boolean) selects the exported symbols. SHADOWING: (boolean) selects the symbols on the shadowing list. ALL: (boolean) selects all the symbols interned in the PACKAGE. RETURN: A list of the selected symbols. By default, only the HOMELY symbols.
(load-package package-name &key verbose print if-does-not-exist external-format) |
function |
DO: Unless it's already loaded (listed in *PACKAGES* or found by FIND-PACKAGE), loads the package named PACKAGE-NAME. NOTE: We both use REGISTER in DEFINE-PACKAGE and in PACKAGE::LOAD because we may be loading a nickname. RETURN: The package named PACKAGE-NAME if found, or NIL.
(package-exports package) |
function |
RETURN: A new list of exported symbols from PACKAGE.
(package-pathname package) |
function |
RETURN: The logical pathname to the given package. NOTE: If a nickname is given, then a nickname pathname is returned.
(package-system-definition system) |
function |
This is a system definition search function for ASDF. It will map a system such as :com.informatimago.common-lisp to the package path: PACKAGE:COM;INFORMATIMAGO;COMMON-LISP;SYSTEM.ASD
(sexp-for-package package-designator &optional prepare-token) |
function |
RETURN: A defpackage form corresponding to the package given by PACKAGE-DESIGNATOR. PREPARE-TOKEN: A function taking a kind (member :package :symbol) and a package name or symbol, and returning a string designator corresponding to that name. The functions STRING-PREPARE-TOKEN, UNINTERNED-PREPARE-TOKEN or KEYWORD-PREPARE-TOKEN may be used, or other custom functions if different kind of string designators are required for package names than for symbol names.
STRING-PREPARE-TOKEN
UNINTERNED-PREPARE-TOKEN