Add record <docs>
Add docs-in-module The new <docs> record is how we can pass around information associated with a particular symbol. It stores the symbol, module, and documentation right now, but could be extended later. docs-in-module will let us grab a list of <doc> from a specified module.
This commit is contained in:
parent
f59d7eff68
commit
713f88c1c3
2 changed files with 27 additions and 1 deletions
24
guile-docs/docs.scm
Normal file
24
guile-docs/docs.scm
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
(define-module (guile-docs docs)
|
||||||
|
#:use-module (srfi srfi-9)
|
||||||
|
#:export (docs-in-module))
|
||||||
|
|
||||||
|
(define-record-type <doc>
|
||||||
|
(make-doc module symbol documentation)
|
||||||
|
doc?
|
||||||
|
(module doc-module)
|
||||||
|
(symbol doc-symbol)
|
||||||
|
(documentation doc-documentation))
|
||||||
|
|
||||||
|
|
||||||
|
(define (docs-in-module module)
|
||||||
|
"Returns a list of <doc> for each symbol in module mod"
|
||||||
|
(module-map
|
||||||
|
(lambda (sym var)
|
||||||
|
(let* ((binding (variable-ref var))
|
||||||
|
(proc (cond
|
||||||
|
((procedure? binding) binding)
|
||||||
|
((macro? binding) (macro-binding binding))
|
||||||
|
(else #f)))
|
||||||
|
(docs (when (procedure? proc) (procedure-documentation proc))))
|
||||||
|
(make-doc (module-name module) sym docs)))
|
||||||
|
module))
|
4
hall.scm
4
hall.scm
|
@ -11,7 +11,9 @@
|
||||||
(dependencies `())
|
(dependencies `())
|
||||||
(skip ())
|
(skip ())
|
||||||
(files (libraries
|
(files (libraries
|
||||||
((directory "guile-docs" ((scheme-file "reflection")))
|
((directory
|
||||||
|
"guile-docs"
|
||||||
|
((scheme-file "docs") (scheme-file "reflection")))
|
||||||
(scheme-file "guile-docs")))
|
(scheme-file "guile-docs")))
|
||||||
(tests ())
|
(tests ())
|
||||||
(programs ())
|
(programs ())
|
||||||
|
|
Loading…
Reference in a new issue