[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how authors of add-on modules can package documentation
From: |
Thien-Thi Nguyen |
Subject: |
Re: how authors of add-on modules can package documentation |
Date: |
Tue, 02 Apr 2002 21:29:14 -0800 |
From: Evan Prodromou <address@hidden>
Date: Sun, 17 Mar 2002 18:04:40 -0800
OK, but as I mentioned before, there doesn't seem to be much provision
for doc'ing variables, classes, methods, etc. with docstrings.
below is (ttn defvar). is this what you mean?
thi
________________________________
;;; ID: $Id: defvar.scm,v 1.3 2000/09/11 01:13:41 ttn Rel $
;;;
;;; Description: Provide `defvar' and some doc-access procedures.
(define-module (ttn defvar))
(defmacro defvar (name value docstring)
`(let ((var (make-variable ,value ',name)))
(module-add! (current-module) ',name var)
(set-object-property! var 'documentation ,docstring)
,value))
(define (documentation-property obj)
"Return, as a string, documentation on OBJ, or #f.
OBJ may be a pair of the form (MODULE . SYM), where MODULE is in list
form as in `define-module', in which case MODULE is consulted instead of
the current-module."
(cond ((variable? obj)
(object-property obj 'documentation))
((procedure? obj)
(procedure-documentation obj))
((symbol? obj)
(documentation-property (module-variable (current-module) obj)))
((pair? obj)
(save-module-excursion
(lambda ()
(set-current-module (resolve-module (car obj)))
(documentation-property (cdr obj)))))
(else #f)))
(export defvar
documentation-property)
;;; $RCSfile: defvar.scm,v $$Revision: 1.3 $ ends here