This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Scwm docstrings change


I just implemented the change to use literal strings as the final
argument to the SCWM_*PROC macros instead of using an embedded comment
following the complete macro invocation.  E.g., whereas Scwm used to use 
this:

SCWM_PROC(X_store_bytes, "X-store-bytes", 1, 0, 0,
	  (SCM string))
/** Set the cut buffer to STRING by calling XStoreBytes. */
#define FUNC_NAME s_X_store_bytes
{
  VALIDATE_ARG_STR_NEWCOPY(1,string,sz);
 // body removed
}
#undef FUNC_NAME

we now use:

SCWM_PROC(X_store_bytes, "X-store-bytes", 1, 0, 0,
	  (SCM string),
"Set the cut buffer to STRING by calling XStoreBytes.")
#define FUNC_NAME s_X_store_bytes
{
  VALIDATE_ARG_STR_NEWCOPY(1,string,sz);
 // body removed
}
#undef FUNC_NAME

This change makes it easier to more robustly extract the docstrings,
and, perhaps more importantly, makes the extracted-docstrings
represented the selected-for conditional-compilation version of the
source artifact (e.g., if a primitive is ifdef-ed out, it will not have
a docstring saved for it).  See `scwm-snarf' and `scwm-doc-snarf', as
well as the ./Makefile.common in the Scwm distribution for details on
how these are pulled out into a foo.doc file from foo.c or foo.cc.
Right now the scwmdoc script still statically scans the source artifact
and the .doc files are unused, but that's largely irrelevant for
starting to add the docstrings to guile.

The above is roughly the format I think guile procedures should take.
Note that the scwmdoc tool also statically verifies some source-code
invariants that result in nasty and sometimes hard to find bugs (e.g.,
that the integer arguments match the formal argument list).  I'll be
adding a GUILE_PROC macro to guile that mirrors SCWM_PROC and eliminates 
the separate SCM_PROC macro uses.  At the same time, I'll ANSI-Cify the
function headers that I touch.

Comments are appreciated as they'll be far more useful now than in 10
days or so when I start making these changes to Guile.

Greg

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]