Menu

#27 MUF Documentation directive

open
nobody
5
2012-12-15
2002-06-02
sombre
No

A directive to create documentation on a program would
be useful (and pave the way to creating a MUF version
of "man" which would automatically list all documented
publics on any program listed in $lib/)

$doc : ( Clear _docs/ )
$doc <function name> ( Start documentation
for function )
$enddoc ( End documentation
for function )

In addition to documenting functions, it could also be
used for generic notes, etc.. about the library. For
example "$def __index ... $enddoc" for an index page,
__bug for known problems with the library, __license for
18 pages of stuff no one will ever read... ;>

For example:

@program TestLib.MUF
1 9999 d
i
$doc :
$doc foo_strlen

Foo_StrLen ( str -- int )
Foo_StrLen counts all non space characters in a string
and pushes the result onto the stack.

Example:
    "Hello World" foo\_strlen
Would push 10 into the stack.
$enddoc

foo_strlen ( str -- int )
"" " " subst strlen
;

public foo_strlen

$libdef foo_strlen
.
c
q

Would create

_docs/foo_strlen#:6
_docs/foo_strlen#/1:Foo_StrLen ( str -- int )
_docs/foo_strlen#/2:Foo_StrLen counts all non space
characters in a string and pushes the result onto the
stack.
_docs/foo_strlen#/3:
_docs/foo_strlen#/4: Example:
_docs/foo_strlen#/5: "Hello World" foo_strlen
_docs/foo_strlen#/6:Would push 10 into the stack.

on the library.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB