unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Thien-Thi Nguyen <ttn@giblet.glug.org>
Cc: guile-devel@gnu.org
Subject: Re: how authors of add-on modules can package documentation
Date: Tue, 02 Apr 2002 21:29:14 -0800	[thread overview]
Message-ID: <E16sdKc-0002S5-00@giblet> (raw)
In-Reply-To: 877koa3a2v.fsf@gaff.bad-people-of-the-future.san-francisco.ca.us

   From: Evan Prodromou <evan@glug.org>
   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


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


  reply	other threads:[~2002-04-03  5:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-17  4:18 how authors of add-on modules can package documentation Neil W. Van Dyke
2002-03-17 16:41 ` Evan Prodromou
2002-03-17 23:35   ` Neil Jerram
2002-03-17 23:45     ` Neil Jerram
2002-03-18  2:04     ` Evan Prodromou
2002-04-03  5:29       ` Thien-Thi Nguyen [this message]
2002-04-03  3:52 ` Thien-Thi Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E16sdKc-0002S5-00@giblet \
    --to=ttn@giblet.glug.org \
    --cc=guile-devel@gnu.org \
    --cc=ttn@glug.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).