The wild-package-inferred-system Reference Manual

This is the wild-package-inferred-system Reference Manual, version 0.2.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 18:17:21 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 wild-package-inferred-system

Introduces the wildcards ‘*’ and ‘**’ into package-inferred-system

Author

Hugo I.

License

MIT

Long Description

# wild-package-inferred-system

[![Build Status](https://github.com/privet-kitty/wild-package-inferred-system/workflows/CI/badge.svg)](https://github.com/privet-kitty/wild-package-inferred-system/actions) **This library is still in a alpha stage.**

‘wild-package-inferred-system‘ is an extension of ASDF ‘package-inferred-system‘ that interprets star ‘*‘ and globstar ‘**‘ in package (or system) names.

If you are not sure about ‘package-inferred-system‘, see [the section](https://common-lisp.net/project/asdf/asdf/The-package_002dinferred_002dsystem-extension.html) about it in the ASDF manual. In short, ‘wild-package-inferred-system‘ is aimed at elimininating the need for ‘foo/.../all‘-type subsystems, which have been manually written only for ‘use-reexport‘ing other .lisp files in the (sub)directories.

## Usage
You need to specify the ‘:defsystem-depends-on‘ and ‘:class‘ options to use ‘wild-package-inferred-system‘ as follows:

“‘lisp
;; foo-wild/foo-wild.asd
(defsystem "foo-wild"
:defsystem-depends-on ("wild-package-inferred-system")
:class "winfer:wild-package-inferred-system"
:depends-on ("foo-wild/baz/*"))
“‘

Each source file in the system ‘foo-wild‘ will begin with ‘defpackage‘ or ‘uiop:define-package‘ in the same way as ‘package-inferred-system‘:

“‘lisp
;; foo-wild/baz/hello.lisp
(uiop:define-package :foo-wild/baz/hello
(:use :cl :foo-wild/qux/*)
(:import-from :foo-wild/bar/**/* #:sym1 #:sym2)
(:export #:hello-world))
“‘

The only difference is that ‘wild-package-inferred-system‘ can interpret wildcards in a package name: ‘*‘ matches one directory or (if in the end) any .lisp files in the directory; ‘**‘ matches zero or more subdirectories. In the above example, the package ‘:foo-wild/qux/*‘ corresponds to the unix path ‘foo-wild/qux/*.lisp‘ and ‘:foo-wild/bar/**/*‘ to ‘foo-wild/bar/**/*.lisp‘. (The latter path matches all the recursively reachable .lisp files under ‘foo-wild/bar/‘.)

Since a wild package is just a standard CL package, you can apply ‘find-package‘, ‘use-package‘, ‘in-package‘ etc. to it if once generated. Likewise you can apply ‘find-system‘, ‘load-system‘ or other operations to the corresponding wild system.

You _can_ use any other combinations of wildcards, e.g. ‘foo/*/bar‘ or ‘foo/**/*/interface/*‘(, though I recommend that you think about if you really need such a complicated desigination).

## Dependencies
**ASDF version 3.3** or later is required.

‘wild-package-inferred-system‘ is tested on the (usually latest vesions of the) following implementations:
- SBCL
- Clozure CL
- Allegro CL
- ABCL

## Installation
‘wild-package-inferred-system‘ will be automatically fetched and loaded via quicklisp. If you want to install it from this repository, just run:

“‘
$ cd ~/common-lisp/ # , ~/quicklisp/local-projects/, ~/.roswell/local-projects/ etc.
$ git clone https://github.com/privet-kitty/wild-package-inferred-system.git
“‘

## Mechanism
To be edited

## FAQ
### How can I let a specific file be excluded from wildcard?
‘wild-package-inferred-system‘ ignores the files whose names begin with dot ‘.‘ or whose types are ‘.nosystem.lisp‘ or ‘.script.lisp‘ even if they match a given wild package.

### How can I make a wild package in REPL?
Just call ‘asdf:load-system‘. Evaluating a form like ‘(asdf:load-system "foo/bar/**/*")‘ will make the wild package and register the corresponding system simultaneously (only if the system ‘foo‘ is ‘wild-package-inferred-system‘, of course).

### Can I use the wildcard ‘*‘ as a part of file or directory name like ‘foo/bar-*-*/*baz‘?
No. See [the issue](https://github.com/privet-kitty/wild-package-inferred-system/issues/1).

### How can I nickname a wild package?
Of course you may manually give arbitrary nicknames to a wild package by e.g. ‘(uiop:ensure-package :foo/bar/* :nicknames ’(:foo/bar))‘.

In addition, ‘wild-package-inferred-system‘ provides an option to nickname a wild package automatically. If ‘:add-non-wild-nickname t‘ is specified in ‘defsystem‘ form, a nickname is given to each wild package, which is the prefix containing no wildcards: e.g. the nickname of ‘:foo/bar/**/baz/*‘ is ‘:foo/bar‘. Therefore you cannot make two packages with a common prefix (e.g. ‘:foo/bar/**/*‘ and ‘:foo/bar/*‘) if you enable this option.

## Copyright
Copyright (c) 2018 Hugo I.

Version

0.2.0

Source

wild-package-inferred-system.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 wild-package-inferred-system/src

Source

wild-package-inferred-system.asd.

Parent Component

wild-package-inferred-system (system).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


4.1 Lisp


4.1.1 wild-package-inferred-system/wild-package-inferred-system.asd

Source

wild-package-inferred-system.asd.

Parent Component

wild-package-inferred-system (system).

ASDF Systems

wild-package-inferred-system.


4.1.2 wild-package-inferred-system/src/package.lisp

Source

wild-package-inferred-system.asd.

Parent Component

src (module).

Packages

wild-package-inferred-system.


4.1.3 wild-package-inferred-system/src/internal-utilities.lisp

Source

wild-package-inferred-system.asd.

Parent Component

src (module).

Internals

4.1.4 wild-package-inferred-system/src/main.lisp

Source

wild-package-inferred-system.asd.

Parent Component

src (module).

Public Interface
Internals

5 Packages

Packages are listed by definition order.


5.1 wild-package-inferred-system

Source

package.lisp.

Nicknames
  • wpis
  • winfer
Use List
  • asdf/interface.
  • common-lisp.
  • uiop/driver.
Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


6.1 Public Interface


6.1.1 Standalone methods

Reader Method: component-name ((condition empty-wild-system))
Package

asdf/component.

Source

main.lisp.

Target Slot

name.

Reader Method: component-pathname ((condition empty-wild-system))
Package

asdf/component.

Source

main.lisp.

Target Slot

path.

Reader Method: error-pathname ((condition uninterpretable-file-pathname))
Package

asdf/find-system.

Source

main.lisp.

Target Slot

path.


6.1.2 Conditions

Condition: empty-wild-system
Package

wild-package-inferred-system.

Source

main.lisp.

Direct superclasses

warning.

Direct methods
Direct slots
Slot: name
Initargs

:name

Readers

component-name.

Writers

This slot is read-only.

Slot: path
Initargs

:pathname

Readers

component-pathname.

Writers

This slot is read-only.


6.1.3 Classes

Class: wild-package-inferred-system

Is almost the same as ASDF:PACKAGE-INFERRED-SYSTEM, except it
can interpret star ‘*’ and globstar ‘**’ in package names.

Package options given to :DEFAULT-PACKAGE-OPTION are merged into auto-generated wild package forms. The default is ((:USE :CL)). You can specify any options UIOP:DEFINE-PACKAGE accepts.

If :ADD-NON-WILD-NICKNAME is true, a nickname is given to each wild package, which is the prefix containing no wildcards: e.g. the nickname of :foo/bar/**/baz/* is :foo/bar. Therefore you cannot make packages with a common prefix (e.g. :foo/bar/**/baz* and :foo/bar/*) if you enable this option.

Package

wild-package-inferred-system.

Source

main.lisp.

Direct superclasses

package-inferred-system.

Direct methods
Direct slots
Slot: package-option
Initform

(quote ((:use :cl)))

Initargs

:default-package-option

Readers

default-package-option.

Writers

This slot is read-only.

Slot: add-non-wild-nickname
Initargs

:add-non-wild-nickname

Readers

non-wild-nickname-p.

Writers

This slot is read-only.


6.2 Internals


6.2.1 Ordinary functions

Function: calc-wild-package-directory-pathname (toplevel-system-directory)

CL source files for wild systems are put under the translated directory by ASDF-OUTPUT-TRANSLATIONS, which will be ASDF:*USER-CACHE* in the default configuration.

Package

wild-package-inferred-system.

Source

main.lisp.

Function: excluded-source-pathname-p (pathname)

WILD-PACKAGE-INFERRED-SYSTEM ignores the file names beginning with dot ‘.’ and file types .nosystem.lisp and .script.lisp even if they match a given wild-pathname.

Package

wild-package-inferred-system.

Source

main.lisp.

Function: extract-non-wild-prefix (system)

E.g. returns ’foo/bar’ for ’foo/bar/*’ and ’foo’ for ’foo/**/baz/*/*’.

Package

wild-package-inferred-system.

Source

main.lisp.

Function: gen-reexporting-form (system dependencies &key nickname default-option)

Generates the UIOP:DEFINE-PACKAGE form for use-reexporting matched packages.

Package

wild-package-inferred-system.

Source

main.lisp.

Function: gen-wild-package-filename (system)

Generates the filename for a given wild system.

Package

wild-package-inferred-system.

Source

main.lisp.

Function: make-keyword (string-designator &optional force-case)
Package

wild-package-inferred-system.

Source

internal-utilities.lisp.

Function: parse-unix-namestring** (name &rest keys &key type defaults dot-dot ensure-directory &allow-other-keys)

Is almost the same as UIOP:PARSE-UNIX-NAMESTRING but interprets star ‘*’ and globstar ‘**’.

Package

wild-package-inferred-system.

Source

internal-utilities.lisp.

Function: pathname-to-package-name (pathname primary-system)

Derives the package name of the source file at PATHNAME w.r.t. PRIMARY-SYSTEM.

Package

wild-package-inferred-system.

Source

main.lisp.

Function: reduce-all-wild-packages (primary-name &optional delete)

Reduces all wild packages beginning with PRIMARY-NAME. (experimental)

Package

wild-package-inferred-system.

Source

main.lisp.

Function: reduce-package (package-designator)

Reduces the package from the graph of user-usee relationship: for example, (A B) using C using (D E F) is transformed to A using (D E F) and B using (D E F) if package C is reduced.

Package

wild-package-inferred-system.

Source

internal-utilities.lisp.

Function: same-wild-package-inferred-system-p (system name directory subpath around-compile dependencies)

Is almost the same as ASDF/PACKAGE-INFERRED-SYSTEM::SAME-PACKAGE-INFERRED-SYSTEM-P that checks whether the system equals to the one specified by the other parameters

Package

wild-package-inferred-system.

Source

main.lisp.

Function: split-name-type** (filename)

Is almost the same as UIOP:SPLIT-NAME-TYPE but interprets star ‘*’.

Package

wild-package-inferred-system.

Source

internal-utilities.lisp.

Function: split-unix-namestring-directory-components** (unix-namestring &key ensure-directory dot-dot)

Is almost the same as UIOP:SPLIT-UNIX-NAMESTRING-DIRECTORY-COMPONENTS but interprets star ‘*’ and globstar ‘**’.

Package

wild-package-inferred-system.

Source

internal-utilities.lisp.

Function: subpathname** (pathname subpath &key type)

Is almost the same as UIOP:SUBPATHNAME but interprets star ‘*’ and ‘**’ globstar.

Package

wild-package-inferred-system.

Source

internal-utilities.lisp.

Function: sysdef-wild-package-inferred-system-search (system)

Will be pushed into ASDF:*SYSTEM-DEFINITION-SEARCH-FUNCTIONS*.

Package

wild-package-inferred-system.

Source

main.lisp.


6.2.2 Generic functions

Generic Reader: default-package-option (object)
Package

wild-package-inferred-system.

Methods
Reader Method: default-package-option ((wild-package-inferred-system wild-package-inferred-system))

automatically generated reader method

Source

main.lisp.

Target Slot

package-option.

Generic Reader: error-base-pathname (condition)
Package

wild-package-inferred-system.

Methods
Reader Method: error-base-pathname ((condition uninterpretable-file-pathname))
Source

main.lisp.

Target Slot

base.

Generic Reader: non-wild-nickname-p (object)
Package

wild-package-inferred-system.

Methods
Reader Method: non-wild-nickname-p ((wild-package-inferred-system wild-package-inferred-system))

automatically generated reader method

Source

main.lisp.

Target Slot

add-non-wild-nickname.


6.2.3 Conditions

Condition: uninterpretable-file-pathname
Package

wild-package-inferred-system.

Source

main.lisp.

Direct superclasses

system-definition-error.

Direct methods
Direct slots
Slot: path
Initargs

:pathname

Readers

error-pathname.

Writers

This slot is read-only.

Slot: base
Initargs

:base-pathname

Readers

error-base-pathname.

Writers

This slot is read-only.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   C   D   E   F   G   M   N   P   R   S  
Index Entry  Section

C
calc-wild-package-directory-pathname: Private ordinary functions
component-name: Public standalone methods
component-pathname: Public standalone methods

D
default-package-option: Private generic functions
default-package-option: Private generic functions

E
error-base-pathname: Private generic functions
error-base-pathname: Private generic functions
error-pathname: Public standalone methods
excluded-source-pathname-p: Private ordinary functions
extract-non-wild-prefix: Private ordinary functions

F
Function, calc-wild-package-directory-pathname: Private ordinary functions
Function, excluded-source-pathname-p: Private ordinary functions
Function, extract-non-wild-prefix: Private ordinary functions
Function, gen-reexporting-form: Private ordinary functions
Function, gen-wild-package-filename: Private ordinary functions
Function, make-keyword: Private ordinary functions
Function, parse-unix-namestring**: Private ordinary functions
Function, pathname-to-package-name: Private ordinary functions
Function, reduce-all-wild-packages: Private ordinary functions
Function, reduce-package: Private ordinary functions
Function, same-wild-package-inferred-system-p: Private ordinary functions
Function, split-name-type**: Private ordinary functions
Function, split-unix-namestring-directory-components**: Private ordinary functions
Function, subpathname**: Private ordinary functions
Function, sysdef-wild-package-inferred-system-search: Private ordinary functions

G
gen-reexporting-form: Private ordinary functions
gen-wild-package-filename: Private ordinary functions
Generic Function, default-package-option: Private generic functions
Generic Function, error-base-pathname: Private generic functions
Generic Function, non-wild-nickname-p: Private generic functions

M
make-keyword: Private ordinary functions
Method, component-name: Public standalone methods
Method, component-pathname: Public standalone methods
Method, default-package-option: Private generic functions
Method, error-base-pathname: Private generic functions
Method, error-pathname: Public standalone methods
Method, non-wild-nickname-p: Private generic functions

N
non-wild-nickname-p: Private generic functions
non-wild-nickname-p: Private generic functions

P
parse-unix-namestring**: Private ordinary functions
pathname-to-package-name: Private ordinary functions

R
reduce-all-wild-packages: Private ordinary functions
reduce-package: Private ordinary functions

S
same-wild-package-inferred-system-p: Private ordinary functions
split-name-type**: Private ordinary functions
split-unix-namestring-directory-components**: Private ordinary functions
subpathname**: Private ordinary functions
sysdef-wild-package-inferred-system-search: Private ordinary functions


A.4 Data types

Jump to:   C   E   F   I   M   P   S   U   W  
Index Entry  Section

C
Class, wild-package-inferred-system: Public classes
Condition, empty-wild-system: Public conditions
Condition, uninterpretable-file-pathname: Private conditions

E
empty-wild-system: Public conditions

F
File, internal-utilities.lisp: The wild-package-inferred-system/src/internal-utilities․lisp file
File, main.lisp: The wild-package-inferred-system/src/main․lisp file
File, package.lisp: The wild-package-inferred-system/src/package․lisp file
File, wild-package-inferred-system.asd: The wild-package-inferred-system/wild-package-inferred-system․asd file

I
internal-utilities.lisp: The wild-package-inferred-system/src/internal-utilities․lisp file

M
main.lisp: The wild-package-inferred-system/src/main․lisp file
Module, src: The wild-package-inferred-system/src module

P
Package, wild-package-inferred-system: The wild-package-inferred-system package
package.lisp: The wild-package-inferred-system/src/package․lisp file

S
src: The wild-package-inferred-system/src module
System, wild-package-inferred-system: The wild-package-inferred-system system

U
uninterpretable-file-pathname: Private conditions

W
wild-package-inferred-system: The wild-package-inferred-system system
wild-package-inferred-system: The wild-package-inferred-system package
wild-package-inferred-system: Public classes
wild-package-inferred-system.asd: The wild-package-inferred-system/wild-package-inferred-system․asd file