scmdoc.scm
VERSION | 0.1 |
CREATED | Fri Jun 13 10:22:30 1997 |
MODIFIED | Thu Mar 5 15:29:37 1998 |
COPYRIGHT | Dominique Boucher |
scmdoc
is a documentation generation program for
Scheme. It takes as input a standard Scheme file containing
documentation declarations enclosed in comments, and generates HTML
documentation based on these declarations. These comments are of the
form:
;! @directive [ident] text ... [!;]Text that span more than a single line can continue on the next lines, given that these lines begin with
;!
.
The valid directives that can appear at the very beginning of the file are:
;! @file name of the file ;! @created date of creation ;! @modified date of last modification ;! @version current version number ;! @copyright the owner of the file ;! @include path of file to includeThe last directive,
@include
, is useful to include some
HTML text right before the definitions produced by the program.
The directives that can appear just before a Scheme definition are:
;! @description Description of the variable/function/macro/structure ;! @param arg Description of the formal argument arg of a function/macro ;! @field fld Description of the field fld of a structure ;! @return Description of the return value
The program can output documentation for definitions of the form:
(define variable expression) (define (function args ...) ...) (define-macro (macro args ...) ...) (define-structure name fields ...)For example, the documentation for the function
SCM->HTML
has been generated by
the following documentation comments:
;! @description ;! This is the documentation generation function. ;! @param iport The input port (where to read the source program). ;! @param oport The output port (where to put the documentation text). ;! @return No return value, i.e. returns <CODE>#f</CODE>. (define (scm->html iport oport) ...
In the case of a function definition which looks like a variable
definition (like (define foo (let (..) (lambda (...)
...)))
, for example), one can explicitly inform
scmdoc
that it IS a function definition by using the
@function
directive:
;! @function (foo arg1 arg2)The prototype must be valid. The program can abruptly terminate if it's not the case.
Finally, the special directive @ignore
inhibits the
generation of documentation for the definition that follows the
directive. Note also that scmdoc
does not generate documentation
for definition which are not preceded by documentation comments.
To invoke scmdoc
, type the following at the
command-line:
% scmdoc -if foo.scm -of foo.htmlwhere
foo.scm
is the Scheme input file and
foo.html
is the HTML output file. If the input file is
not specified on the command-line, the input is taken from the
standard input. Conversely, the HTML file will be sent to the standard
output if the output file is not specified.
HREF
tag in a documentation comment which refers to one
of the defined variables, functions, etc. Just use its name as it
appears in the HTML file. For example,
SCM->HTML
is the function which reads a Scheme file from a port and formats the
documentation to another port.
Dominique Boucher,
June 20th, 1997.
MAIN
(MAIN ARGS)
ARGS
:
The command-line arguments (a list of strings).
PARSE-ARGS!
(PARSE-ARGS! ARGS)
ARGS
:
The command-line arguments (minus the program name).
SIGNAL-ERROR
(SIGNAL-ERROR MSG . ARGS)
SCM->HTML
(SCM->HTML IPORT OPORT)
IPORT
:
The input port (where to read the source program).
OPORT
:
The output port (where to put the documentation text).
#f
.
MAIN
: Function
PARSE-ARGS!
: Function
SCM->HTML
: Function
SIGNAL-ERROR
: Function