From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.sources Subject: cmod-play 1 available + modsup.h additions Date: Thu, 13 Nov 2003 22:55:53 +0100 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: Reply-To: ttn@glug.org NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1068760426 32312 80.91.224.253 (13 Nov 2003 21:53:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 13 Nov 2003 21:53:46 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Nov 13 22:53:44 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AKPPL-00035e-00 for ; Thu, 13 Nov 2003 22:53:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AKQMa-0008RF-A5 for guile-user@m.gmane.org; Thu, 13 Nov 2003 17:54:56 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AKQJZ-0007LS-EQ for guile-user@gnu.org; Thu, 13 Nov 2003 17:51:49 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AKQJ1-0006y3-5Q for guile-user@gnu.org; Thu, 13 Nov 2003 17:51:46 -0500 Original-Received: from [151.37.48.242] (helo=surf.glug.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AKQIT-0006Gu-Hf; Thu, 13 Nov 2003 17:50:41 -0500 Original-Received: from ttn by surf.glug.org with local (Exim 3.35 #1 (Debian)) id 1AKPRR-00036l-00; Thu, 13 Nov 2003 22:55:53 +0100 Original-To: guile-sources@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.user:2380 gmane.lisp.guile.sources:75 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:2380 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 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