Author(s): Manuel Hermenegildo.
Version: 1.9#58 (2002/4/19, 20:59:33 CEST)
Version of last change: 1.9#35 (1999/12/9, 0:29:7 CET)
This library provides some predicates which generate documentation automatically for a given module or application, using the declarations and assertions used in the module itself as input (see the
assertions
library). By default, only the
exported predicates of the module appear in the documentation. The predicates will be documented in the order in which they appear in the
module/1
or
module/2
declaration.
The idea of this package is on one hand to reuse the information present in the assertions and on the other to help ensure that code and documentation are kept as coherent as possible. Hopefully, keeping them close together should help in this always difficult task. The resulting documentation is somewhat rigidly structured, but generally sufficient for a reference manual, provided a little effort is put into the assertions and comments. The end product understandably depends heavily on how much work is put into adding additional comments to the source. Some documentation will be generated in any case, but it is recommended that, at the minimum, a module title and a comment for each of the exported predicates be provided.
The exact format
in which the documentation is generated is defined in an imported module
autodocformats
. See the description of the imported predicates for more details and descriptions of the interface. A default definition of this module is provided in the
autodocformats
library. A simple example of the use of this library for generating a texinfo
reference manual (including a driver script, useful Makefiles, etc.) is included with the library source code. Other examples can be found in the Ciao documentation directory (i.e., the Ciao manuals themselves).
autodoc
):- use_module(library(autodoc)).
lpdoclib(autodocformats)
,
lpdoclib(comments)
.
streams
,
ttyout
,
format
,
aggregates
,
read
,
errhandle
,
dec10_io
,
compiler/compiler
,
assertions/assrt_lib
,
compiler/c_itf
,
assertions/assertions_props
,
messages
,
filenames
,
lists
,
terms
,
system
,
pretty_print
,
vndict
.
arithmetic
,
atomic_basic
,
attributes
,
basic_props
,
basiccontrol
,
data_facts
,
exceptions
,
io_aux
,
io_basic
,
prolog_flags
,
streams_basic
,
system_info
,
term_basic
,
term_compare
,
term_typing
.
autodoc
)
Usage: autodoc(Format,Main,LibPaths,SysLibPaths,Idxs,Components,PathAliasF,StartPage,PaperType,Opts)
Main
is the name of the source file being documented, and Components
is a list of other files to be documented in relation to this one (see below). The output is a file whose contents document the main file, based on any assertions present in that file. The documentation is produced in the format given by Format
(the name of the output file also depends on Format
). The formats supported are given by
supported_format/1
in library
autodocformats
.
If the manual should include other files (normally as chapters) Components
is nonempty and contains the complete names of the component files. These files will appear in the manual in the order
in which they appear in Components
. These files can be written manually or generated automatically, but must be in a format compatible with Format
. In particular, they can be also generated automatically with this same predicate by simply calling with '-component'
as one of the options in Options
.
LibPaths
is a list of
library paths where files used by the module being documented may be found. SysLibPaths
is similar to LibPaths
but provides paths to system libraries. PathAliasF
is the name of a module containing path aliases. Idxs
is a list of index names (the
indices generated automatically). StartPage
is the page number of the first page of the manual. This can be useful if the manual is to be included in a larger document or set of manuals.
Format
is a supported typesetting format.
(supported_format/1
)
Main
is the name of a file.
(filename/1
)
LibPaths
is a list of atm
s.
(list/2
)
SysLibPaths
is a list of atm
s.
(list/2
)
Idxs
is a list of atm
s.
(list/2
)
Components
is a list of filename
s.
(list/2
)
PathAliasF
is the name of a file.
(filename/1
)
StartPage
is an integer.
(int/1
)
PaperType
is an atom.
(atm/1
)
Opts
is a list of miscopt
s.
(list/2
)
Usage: generate_man_page(Main,LibPaths,SysLibPaths,PathAliasF,Opts)
Main
is the name of a the source file which is the main file of the application. LibPaths
is a list of
library paths the module being documented may be found. SysLibPaths
is similar to LibPaths
but provides paths to system libraries. PathAliasF
is the name of a module containing path aliases.
Main
is the name of a file.
(filename/1
)
LibPaths
is a list of atm
s.
(list/2
)
SysLibPaths
is a list of atm
s.
(list/2
)
PathAliasF
is an atom.
(atm/1
)
Opts
is a list of miscopt
s.
(list/2
)
Usage: generate_description(Format,Main,LibPaths,SysLibPaths,PathAliasF,Opts)
Format
. Main
is the name of a the source file which is the main file of the application. The name of the output file depends on Format
-- see see
supported_format/1
in library
autodocformats
. LibPaths
is a list of
library paths the module being documented may use. SysLibPaths
is similar to LibPaths
but provides paths to system libraries. PathAliasF
is the name of a module containing path aliases.
Format
is a supported typesetting format.
(supported_format/1
)
Main
is the name of a file.
(filename/1
)
LibPaths
is a list of atm
s.
(list/2
)
SysLibPaths
is a list of atm
s.
(list/2
)
PathAliasF
is the name of a file.
(filename/1
)
Opts
is a list of miscopt
s.
(list/2
)
Usage: generate_info_dir_entry(Main,LibPaths,SysLibPaths,PathAliasF,Opts)
emacs info
manuals. The file is produced in ascii. Main
is the name of a the source file which is the main file of the application. The name of the output file is Main
.infoindex
. LibPaths
is a list of
library paths the module being documented may use. SysLibPaths
is similar to LibPaths
but provides paths to system libraries. PathAliasF
is the name of a module containing path aliases.
Main
is the name of a file.
(filename/1
)
LibPaths
is a list of atm
s.
(list/2
)
SysLibPaths
is a list of atm
s.
(list/2
)
PathAliasF
is an atom.
(atm/1
)
Opts
is a list of miscopt
s.
(list/2
)
Usage: rewrite_docstring(Format,Idxs,S,RS)
S
into another one RS
, while processing any embedded commands, processing some directly and converting others into the appropriate commands for output format Format
. Also, eliminates any blanks or tabs that appear at the beginning of a line. This is needed for example in
texinfo
: although leading blanks are OK for the printed manuals, they produce weird info files.
Format
is a supported typesetting format.
(supported_format/1
)
Idxs
is a list of atm
s.
(list/2
)
S
is a documentation string.
(docstring/1
)
RS
is a documentation string.
(docstring/1
)
modtype(application). modtype(use_module). modtype(include). modtype(part).
Usage:
Imported from
autodocformats
(see the corresponding documentation for details).
Imported from
autodocformats
(see the corresponding documentation for details).
autodoc
)No further documentation available for this predicate.
The predicate is multifile.
The predicate is of type dynamic.
autodoc
)Go to the first, previous, next, last section, table of contents.