Next: , Up: Reflection


36.1 Documentation

To use documentation procedures, evaluate the form:

     (use-modules (ice-9 documentation))

36.1.1 Docstrings

— Scheme Procedure: object-documentation object

Return the docstring for object.

— Scheme Procedure: search-documentation-files name [files...]

Return documentation for name (a symbol) if found in files. If files is not specified, use documentation-files.

— Module-Local Variable: documentation-files

A list of filenames. Used by search-documentation-files.

* Guile Documentation Format

Here is the complete and authoritative documentation for the Guile
Documentation Format Version 1:

HEADER
^L
(PROC1 PROC1-ARGS ...)
DOCUMENTATION1
^A[FILE:LINE]
^L
(PROC2 PROC2-ARGS ...)
DOCUMENTATION2
^A[FILE:LINE]
^L...

The HEADER is completely ignored.  The "^L" is a formfeed on a line of
its own (recognizable by "\f\n").  PROC1, PROC2 and so on are symbols
that name the element documented.  Likewise, PROC1-ARGS and so on are
components of the arglist, for the most part symbols, but also
including the tokens "[", "]" and "...".  If the arglist ends with a
vector #(REQ OPT VAR), then REQ, OPT, and VAR are integers specifying
the C-level counts of required, optional and variable args.  No such
vector means all args are required.

DOCUMENTATION1, DOCUMENTATION2 and so on are the related documentation,
which may span several lines.  The "^A" is a control-A (#\soh) at the
beginning of a line immediately followed by a left square bracket, the
name of the source file, a colon, a line number, a right square bracket
and finally a newline.

36.1.2 Commentary

— Scheme Procedure: file-commentary filename [start [stop [scrub]]]

Return the commentary extracted from filename, or an empty string. Normally, a file's commentary has the form:

          ;;; Commentary:
          
          ;; This text, sans leading semicolons,
          ;; is what is normally extracted.
          
          ;;; Code:

Optional second arg start is a regexp that overrides the default "^;;; Commentary:". Optional third arg stop is a regexp that overrides the default "^;;; Code:". These args may also be a compiled regexp, as returned by make-regexp, or #t to mean to use the default. Lines matched by start and stop are excluded from the return value.

Optional fourth arg scrub is a procedure that takes a single line and returns a new "clean" line. These lines are concatenated in order to form the return value. The default scrub procedure simply eliminates leading semicolons (optionally) followed by a single space char from its input line.

— Scheme Procedure: module-commentary module-name

Return the commentary associated with module module-name (a list of symbols), or the empty string.