unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* cmod-play 1 available + modsup.h additions
@ 2003-11-13 21:55 Thien-Thi Nguyen
  2003-11-14  8:26 ` Ludovic Courtès
  2003-11-14 14:17 ` Marius Vollmer
  0 siblings, 2 replies; 21+ messages in thread
From: Thien-Thi Nguyen @ 2003-11-13 21:55 UTC (permalink / raw)
  Cc: guile-user

folks,

libtool modules cannot depend on other libtool modules (according to the
documentation on libltdl), so we can't co-opt that strategy if we want
to design compiled modules that depend on other modules.  sure, we can
throw up our hands and relegate everything to the system linker/loader,
but why pass up a thorny question for others to play with?  i mean, to
do system programming you need to grab control of the system, and to do
module system programming you need to grab control of the module system.

so, this message actually presents two pieces of source code: (1) a
pointer to the documented exploratory process:

  http://www.glug.org/people/ttn/software/cmod-play/

and (2) a request for comments on the tentative conclusions of the above
exploration, as expressed by the additional <guile/modsup.h> interface
elements excerpted below.  if All Goes Well, they will appear in guile
1.4.1.97.

in other news, i will be using this new support immediately for
guile-sdl compiled modules (the motivation for all this, you see), so to
spare everyone the agony guile-sdl will not be released until 1.4.1.97
is out.  (however, everything works swimmingly from cvs, if you are
feeling adventurous. :-)

thi

_____________________________________________________________
/*:Return the @var{obj} given, but marked as "permanent".
   This means that it can never be garbage collected.
*/
#define GHSTONED(obj) \
  scm_permanent_object (obj)

/*:Declare and later arrange for @var{cvar} (type SCM) to hold a resolved
   module object for @var{fullname}, a C string such as "(ice-9 q)".  The
   string is saved in a C variable named by prefixing "s_" to @var{cvar}.
   You must use @var{cvar} as the second arg to @code{MUSEMODULEVAR}.
*/
#define MUSEMODULE(cvar,fullname) \
SCM_SNARF_HERE (static char * s_ ## cvar = fullname; static SCM cvar) \
SCM_SNARF_INIT (cvar = GHSTONED (gh_resolve_module (s_ ## cvar));)

/*:Declare and later arrange for @var{cvar} (type SCM) to have the
   same value as the imported module @var{m_cvar} variable @var{s_name}.
   @var{m_cvar} is the SCM object declared with @code{MUSEMODULE}, and
   @var{s_name} is a string such as "q-empty?".  If the imported value
   is a procedure, you can use @code{gh_apply} or @code{gh_call0} through
   @code{gh_call3} on it.
*/
#define MUSEMODULEVAR(cvar,m_cvar,s_name) \
SCM_SNARF_HERE (static SCM cvar) \
SCM_SNARF_INIT (cvar = GHSTONED (gh_module_lookup (m_cvar, s_name));)

/*:Declare and define a procedure @var{cvar} that takes 0 (zero) args,
   which returns the result of calling @code{gh_call0} on @var{proc_cvar}.
   @var{proc_cvar} is the SCM object declared with @code{MUSEMODULEVAR}.
*/
#define MUSEMODULEPROC0(cvar,proc_cvar) \
  static SCM cvar (void) \
  { return gh_call0 (proc_cvar); }

/*:Declare and define a procedure @var{cvar} that takes 1 (one) SCM arg,
   which returns the result of calling @code{gh_call1} on @var{proc_cvar}
   and this arg.  @var{proc_var} is the SCM object declared with
   @{MUSEMODULEVAR}.
*/
#define MUSEMODULEPROC1(cvar,proc_cvar) \
  static SCM cvar (SCM a1) \
  { return gh_call1 (proc_cvar, a1); }

/*:Declare and define a procedure @var{cvar} that takes 2 (two) SCM args,
   which returns the result of calling @code{gh_call2} on @var{proc_cvar}
   and the args.  @var{proc_var} is the SCM object declared with
   @{MUSEMODULEVAR}.
*/
#define MUSEMODULEPROC2(cvar,proc_cvar) \
  static SCM cvar (SCM a1, SCM a2) \
  { return gh_call2 (proc_cvar, a1, a2); }

/*:Declare and define a procedure @var{cvar} that takes 3 (three) SCM args,
   which returns the result of calling @code{gh_call3} on @var{proc_cvar}
   and the args.  @var{proc_var} is the SCM object declared with
   @{MUSEMODULEVAR}.
*/
#define MUSEMODULEPROC3(cvar,proc_cvar) \
  static SCM cvar (SCM a1, SCM a2, SCM a3) \
  { return gh_call3 (proc_cvar, a1, a2, a3); }

[modsup.h excerpt ends here]


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


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2003-11-19 15:02 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-13 21:55 cmod-play 1 available + modsup.h additions Thien-Thi Nguyen
2003-11-14  8:26 ` Ludovic Courtès
2003-11-14 13:10   ` Thien-Thi Nguyen
2003-11-14 13:37     ` Ludovic Courtès
2003-11-14 17:38       ` Thien-Thi Nguyen
2003-11-14 14:29   ` Marius Vollmer
2003-11-14 14:17 ` Marius Vollmer
2003-11-14 15:28   ` Does anyone have a better scm_string_hash ? Roland Orre
2003-11-14 15:51     ` Ludovic Courtès
2003-11-17  8:33       ` Roland Orre
2003-11-17 13:01         ` Ludovic Courtès
2003-11-17 15:42         ` Marius Vollmer
2003-11-17 16:02           ` Marius Vollmer
2003-11-17 16:29             ` Marius Vollmer
2003-11-17 16:48               ` Allister MacLeod
2003-11-17 17:57                 ` Marius Vollmer
2003-11-17 19:17                   ` OT: x86 assembly timings/size (was Re: Does anyone have a better scm_string_hash ?) Allister MacLeod
2003-11-17 21:27                     ` OT: x86 assembly timings/size Marius Vollmer
2003-11-19  9:04             ` Does anyone have a better scm_string_hash ? Ludovic Courtès
2003-11-19 15:02               ` Marius Vollmer
2003-11-14 17:40   ` cmod-play 1 available + modsup.h additions Thien-Thi Nguyen

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).