[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: extract documentation from (define ...
From: |
Vladimir Zhbanov |
Subject: |
Re: extract documentation from (define ... |
Date: |
Mon, 2 Sep 2019 21:01:57 +0300 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
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