(rapid analyze-library)

Analyze R7RS library definitions.

Qualified identifiers

A qualified identifier is a triple consisting of a library name, an identifier naming a top-level binding of that library (before renaming), and a syntax object to locate syntax error messages.

(unwrap-library-name library-name-syntax)

Returns the Scheme datum representing the R7RS library name wrapped in the syntax object library-name-syntax. If library-name-syntax does not wrap a proper R7RS library name as a Scheme datum, a syntax error object is signaled. If the exception is continued, unwrap-library-name returns #f.

Procedures

(make-qualified-identifier context library-name symbol)

Returns a qualified identifier in the library library-name with name symbol and syntax object context.

(qualified-identifier? object)

Returns #t if object is a qualified identifier, and #f otherwise.

(qualified-identifier-library-name qualified-identifier)

Returns the library name of the qualified-identifier.

(qualified-identifier-symbol qualified-identifier)

Returns the name of the qualified-identifier.

(qualified-identifier-context qualified-identifier)

Returns the syntax object of the qualified-identifier.

(analyze-library library-name declarations)

Analyzes the library with name library-name and declarations declarations. The library-name is a Scheme datum representing an R7RS library name, and the declarations are a list of syntax objects each wrapping a Scheme datum representing an R7RS library declaration. Returns four values: The first value is a mapping that maps all the identifiers exported by the library to their original bindings, which are identified by qualified identifiers. The second value is a mapping that maps all the identifiers imported into the library to their original bindings, which are likewise identified by qualified identifiers. The third value is a set containing the library names of those libraries upon which this library is dependent, directly or indirectly. The fourth value is the library's body, a sequence of syntax objects each wrapping a top-level command or definition.

(feature-identifier? symbol)

Returns #t if symbol is a feature identifier in the current dynamic environment, and #f otherwise.

(library-importable? context library-name)

Returns #t if, in the current dynamic environment, the library with name library-name can be imported, and #f otherwise. Context is either #f or a syntax object that can be referred to if library-exports raises a syntax error object.

(library-exports context library-name)

Returns a mapping that maps all the identifiers exported by the library with name library-name to their original bindings, which are identified by qualified identifiers, or #f if there is no such library known. Context is either #f or a syntax object that can be referred to if library-exports raises a syntax error object.

(library-dependencies library-name)

Returns a set containing the library names of those libraries upon which, directly or indirectly the library with name library-name depends. It is an error to invoke library-dependencies on a library name before invoking library-exports upon that name.

Parameter objects

(feature-identifier-predicate)

Returns the current predicate queried when invoking feature-identifier?. This procedure is a parameter object. The initial binding is not specified.

(library-importability-predicate)

Returns the current predicate queried when invoking library-importable?. This procedure is a parameter object. The initial binding is not specified.

(library-exports-accessor)

Returns the current accessor queried when invoking library-exports. This procedure is a parameter object. The initial binding is not specified.

(library-dependencies-accessor)

Returns the current accessor queried when invoking library-dependencies. This procedure is a parameter object. The initial binding is not specified.

Comparators

symbol-comparator

Comparator for symbols. Has an ordering predicate and a hash function.

library-name-comparator

Comparator for R7RS library names as Scheme datums. Has an ordering predicate and a hash function.

(library-name? object)

Type-test predicate for library names. Returns #t if object is a Scheme datum representing a library name, and #f otherwise.