qwerty.lsp
Module: qwerty
Author: Jeff Ober
Version: 1.0
Original location: http://static.artfulcode.net/newlisp/qwerty.lsp
Source: qwerty.lsp
Provides a dependency-managing library loading mechanism (requires newlisp 10)
This module replaces nlmod, providing a simple mechanism for package dependencies. qwerty supports packages with multiple files and directories.
All Artful Code modules (apart from qwerty itself, which must be loaded manually) have a .qwerty package definition.
The provided macro, define-package, is used to register a package with qwerty. This should be saved in a file named module-name.qwerty, located in a directory in the list of registry paths (qwerty:registry-path).
A package must be located in one of the qwerty:module-path directories. If the package was defined without any files, qwerty assumes that the file's name is the same as the module's (e.g., my-module.lsp).
Version history
1.0 • initial release
example:(load "/path/to/qwerty.lsp") ; Load Artful Code libraries for a CGI application (push "/path/to/artfulcode/modules" qwerty:module-path) (push "/path/to/artfulcode/registry" qwerty:registry-path) (qwerty:load-package "request" "response" "element" "mysql")- § -
qwerty:load-package
syntax: (qwerty:load-package pkg-name [pkg-name-2 ...])
parameter: pkg-name - one or more package names to load
Loads a package and its dependencies. Throws an error if pkg-name, its component files, or any of its dependencies fail to load.
- § -
define-package
syntax: (define-package pkg-name (files file-1 file-2 ...) (depends dep-1 dep-2 ...))
parameter: files - a list of files that make up the package
parameter: depends - a list of packages on which this package depends
Defines a new package. The package will be named pkg-name. If a list of files is not provided, it is assumed that the package contains only one file that is named pkg-name.lsp. Otherwise, a list of file names may be provided that are assumed to be in the same directory (the first found in the path).
The files may be preceded by a sub-path, e.g. (files "/foo-package/foo1.lsp" "foo-package/foo2.lsp" "foo-package/sub-package/bar.lsp"), to permit an arbitrarly deeply structured package. Files are listed in the order in which they should be loaded.
Dependencies for the package are listed similarly, as a list beginning with the symbol 'depends. Both component files and dependencies are optional. File extensions are left off names in both lists.
example:(define-package "my-app" (files "my-app/lib" "my-app/macros" "my-app/main") (depends "cgi" "crypto"))- ∂ -
Artful Code
generated with newLISP and newLISPdoc