From: Vladimir Zhbanov <vzhbanov@gmail.com>
To: guile-user@gnu.org
Subject: Re: extract documentation from (define ...
Date: Mon, 2 Sep 2019 21:01:57 +0300 [thread overview]
Message-ID: <20190902180157.GA1747@newvzh.lokolhoz> (raw)
In-Reply-To: <87y2z67fkf.fsf@gnu.org>
On Mon, Sep 02, 2019 at 07:50:40PM +0200, Jan Nieuwenhuizen wrote:
> Vladimir Zhbanov writes:
>
> >> For Emacsy[0] I have used a guild doc-snarf but am now switching to doc
> >> strings using. See the `wip-doc' branch and esp.
> >>
> >> https://git.savannah.nongnu.org/cgit/emacsy.git/tree/scripts/document-module.scm?h=wip-doc
> >>
> >> You may want to look at the Makefile.am as well for how it's used.
> >
> > Cool, thanks!
> >
> > The only issue i see is no docstrings found for C code
> > SCM_DEFINE'd Scheme procedures.
>
> You'll have to modify SCM_DEFINE, its last argument is the docstring.
> For another project, I am doing something like
>
> --8<---------------cut here---------------start------------->8---
> #undef SCM_DEFINE
> #define SCM_DEFINE(FNAME, PRIMNAME, REQ, OPT, VAR, ARGLIST, DOCSTRING) \
> SCM_SNARF_HERE( \
> SCM_UNUSED static const char s_ ## FNAME [] = PRIMNAME; \
> static SCM FNAME ARGLIST \
> ) \
> SCM_SNARF_INIT( \
> scm_c_define_gsubr (s_ ## FNAME, REQ, OPT, VAR, \
> (SCM_FUNC_CAST_ARBITRARY_ARGS) FNAME); \
> scm_c_set_procedure_properties (PRIMNAME, __FILE__, __LINE__, DOCSTRING);\
> ) \
> SCM_SNARF_DOCS(primitive, FNAME, PRIMNAME, ARGLIST, REQ, OPT, VAR, DOCSTRING)
>
> void
> scm_c_set_procedure_properties (char const* name, char const* file_name, int line, char const* doc_string)
> {
> SCM proc = scm_variable_ref (scm_c_lookup (name));
> scm_set_source_property_x (proc,
> scm_from_utf8_string ("documentation"),
> scm_from_utf8_string (doc_string));
> scm_set_source_property_x (proc,
> scm_from_utf8_symbol ("location"),
> scm_list_2 (scm_cons (scm_from_utf8_string ("file-name"),
> scm_from_utf8_string (file_name)),
> scm_cons (scm_from_utf8_string ("line"),
> scm_from_int (line))));
> }
> --8<---------------cut here---------------end--------------->8---
>
>
> The scm_c_set_procedure_properties could be more standard compliant,
> hopefully.
Thanks! Would be nice if the changes go to the guile code and the
`stexi` functions become even more nice :-)
--
Vladimir
(λ)επτόν EDA — https://github.com/lepton-eda
next prev parent reply other threads:[~2019-09-02 18:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-01 21:45 extract documentation from (define Jesse Gibbons
2019-09-02 4:20 ` sirgazil via General Guile related discussions
2019-09-02 5:19 ` Jan Nieuwenhuizen
2019-09-02 16:22 ` Vladimir Zhbanov
2019-09-02 17:50 ` Jan Nieuwenhuizen
2019-09-02 18:01 ` Vladimir Zhbanov [this message]
2019-09-04 20:02 ` Mark H Weaver
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=20190902180157.GA1747@newvzh.lokolhoz \
--to=vzhbanov@gmail.com \
--cc=guile-user@gnu.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).