Common Lisp Package: COM.INFORMATIMAGO.COMMON-LISP.CESARUM.PACKAGE

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/>

README:

FUNCTION

Public

ADD-NICKNAME (PACKAGE NICKNAME &KEY STEAL FORCE)

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)

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)

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)

NOTE: USE-PACKAGE only imports exported symbols. This function imports into the current package all the symbols present in the PACKAGE.

LIST-ALL-SYMBOLS (PACKAGE &KEY (SORTED T))

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 T))

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 T) (HOMELY NIL) (EXPORTED NIL) (SHADOWING NIL) (ALL NIL))

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 *LOAD-VERBOSE*) (PRINT *LOAD-PRINT*) (IF-DOES-NOT-EXIST ERROR) (EXTERNAL-FORMAT DEFAULT))

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)

RETURN: A new list of exported symbols from PACKAGE.

PACKAGE-PATHNAME (PACKAGE)

RETURN: The logical pathname to the given package. NOTE: If a nickname is given, then a nickname pathname is returned.

PACKAGE-SYSTEM-DEFINITION (SYSTEM)

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

Private

CLOSE-PATH (PACKAGE)

RETURN: Closure of the translation of the package pathname of PACKAGE.

PARSE-PACKAGE-DECLARATIONS (DECLARATIONS)

DO: Parses and check somewhat the syntax of DECLARATIONS. RETURN: a list of dependencies (package names); a list of renames (package . nickname); arguments for DEFPACKAGE.

REGISTER (PACKAGE)

DO: Force registering the PACKAGE into the loaded *PACKAGES*.

REGISTEREDP (PACKAGE)

RETURN: Whether the PACKAGE is already registered.

REMOVE-NICKNAME (PACKAGE NICKNAME)

DO: Remove the NICKNAME from the list of nicknames of the package designated by PACKAGE. RETURN: The package designated by PACKAGE.

STRINGIFY (ITEMS)

ITEMS: A list of symbol, keyword or string. RETURN: A new list of strings, the symbol-names or the strings given in ITEMS.

Undocumented

BUILT-IN-P (PACKAGE)

GEN-OLD-NAME (PACKNAME)

IMPLEMENTATION-ID

IMPLEMENTATION-OBJECT-TYPE

INSERT-SHARP (STRING)

OBJECT-DIR (PATH)

MACRO

Private

DEFINE-PACKAGE (NAME &REST DECLARATIONS)

DO: Declares a package. This includes loading the packages depended on, adding nicknames to the packages used under these nicknames, defining the package, and going into it (with IN-PACKAGE).

Undocumented

VERBOSE (FCTRL &REST ARGS)

WHILE (CONDITION &BODY BODY)

VARIABLE

Public

*PACKAGE-VERBOSE*

Whether some package operation defined in this package shall issue some verbosity. SEE ALSO: REGISTER, LOAD-PACKAGE, ADD-NICKNAME.

*PACKAGES*

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!

Private

*VOUT*

Verbose output stream.

Undocumented

*BUILT-IN-PACKAGES*