documentation experiment with api.spad and reStructruredText

9 views
Skip to first unread message

Ralf Hemmecke

unread,
Jul 11, 2019, 6:45:56 AM7/11/19
to Waldek Hebisch, fricas-devel
In order to experiment with reStructuredText as a format for the ++
docstrings, I need access to the raw docstrings.
Of course, it would be good, if they lived in the FriCAS database, but
it seems it's not really needed to change FriCAS so much.

(With the help of Waldek) I looked a bit through the Boot code.
It looks as if it would be enough for my purposes to add a hook too the
function

transDocList($constructorName,doclist) in c-doc.boot.

The hook would have to simply write out the content of doclist into a
file with name $constructorName and some extension (maybe .lsp).

1) What would be the boot code to write out doclist into a file?
2) Can FriCAS make it the default to write that file into the respective
.NRLIB directory?
3) How to read that file from within .spad code to optain an
SExpression?

Thanks in advance for any hints/help.

Ralf

Ralf Hemmecke

unread,
Jul 11, 2019, 4:44:00 PM7/11/19
to fricas...@googlegroups.com
Just for the record...

> 1) What would be the boot code to write out doclist into a file?
> 2) Can FriCAS make it the default to write that file into the respective
> .NRLIB directory?
> 3) How to read that file from within .spad code to optain an
> SExpression?

Obviously, it's easier than I first thought.

After

)read docprint.input
)compile fricas/src/algebra/catdef.spad
s := RHXREAD("SetCategory")$Lisp
destruct s

I get what I want.

Ralf

[
(constructor

("++ Author:" "++ Basic Functions:" "++ Related Constructors:"
"++ Also See:" "++ AMS Classifications:" "++ Keywords:"
"++ References:" "++ Description:"

"++ \spadtype{SetCategory} is the basic category for describing
a colle
ction"


"++ of elements with \spadop{=} (equality) and \spadfun{coerce}
to outp
ut form."

"++" "++ Conditional Attributes:"

"++ canonical\tab{15}data structure equality is the same as
\spadop{
=}"
)
)
,

((hash ((SingleInteger) %))
" ++ hash(s) calculates a hash code for s.")
,

((hashUpdate! ((HashState) (HashState) %))
" ++ hashUpdate!(hs, s) computes new HashState from old and s"
" ++ used for incremental computation of hash values."
" ++ hashUpdate! might destructively work on its first
argument.")
,

((latex ((String) %))
" ++ latex(s) returns a LaTeX-printable output"
" ++ representation of s.")
]
docprint.input
docprint.boot
Reply all
Reply to author
Forward
0 new messages