From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: rm@fabula.de Newsgroups: gmane.lisp.guile.devel Subject: Re: What replaces scm_register_module_xxx (Doc update?) Date: Mon, 19 Aug 2002 21:05:24 +0200 Sender: guile-devel-admin@gnu.org Message-ID: <20020819190524.GA21020@www> References: <20020808134824.GB23831@www> <20020808102103.021cdc0c.dsmith@altustech.com> <874re5mnfs.fsf@raven.i.defaultvalue.org> <20020808161958.GA24162@www> <20020809153645.GA25688@www> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1029783153 31607 127.0.0.1 (19 Aug 2002 18:52:33 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 19 Aug 2002 18:52:33 +0000 (UTC) Cc: rm@fabula.de, Rob Browning , "Dale P. Smith" , guile-devel@gnu.org Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17grdb-0008DN-00 for ; Mon, 19 Aug 2002 20:52:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17greY-0001ro-00; Mon, 19 Aug 2002 14:53:26 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17grdu-0001lZ-00 for guile-devel@gnu.org; Mon, 19 Aug 2002 14:52:46 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17grdk-0001j4-00 for guile-devel@gnu.org; Mon, 19 Aug 2002 14:52:42 -0400 Original-Received: from www.elogos.de ([212.18.192.92]) by monty-python.gnu.org with esmtp (Exim 4.10) id 17grdj-0001ih-00 for guile-devel@gnu.org; Mon, 19 Aug 2002 14:52:36 -0400 Original-Received: by www.elogos.de (Postfix, from userid 5001) id 6F213104902; Mon, 19 Aug 2002 21:05:24 +0200 (CEST) Original-To: Neil Jerram Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.24i Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:1122 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1122 On Sat, Aug 17, 2002 at 12:59:47PM +0100, Neil Jerram wrote: > OK, so the idea is: > > HTTP request for some URL ---> > mapped by Apache config file to generic mod_guile handler, > with parameters indicating the module in which the appropriate > handler proc lives, and perhaps the proc name as well (?) Yes, indeed. On can 'map' a request URL to an module/handler: | | ... | GuileSetHandler (foo bar) | or with an optional handler name: | GuileSetHanlder ((foo bar) . my-handler) > mod_guile handler uses the module and calls the handler proc from that > module (how do you handle handler procs with the same name in > different modules? perhaps by not actually importing them) Correct, i don't import the modules, i just use them as namespace compartments. > Now we're into Scheme code, that has a SMOB in its hand and wants to > use the utility functions defined in (apache request) etc. to play > with it, which it does using use-module in the usual way. > > And the problem was: how do you export the C definitions for (apache > request) etc. into their respective modules? > > I presume that Marius's docs for the C module API have given you one > answer, using scm_c_define, scm_c_with_module etc. Another > possibility would be to write a C function per module to register its > definitions as Guile primitives: > > void mg_register_apache_request_primitives () > { > scm_c_define_gsubr (...); > ... > } This is how i do it currently. An init function per functional unit/module. > > Then at the top of apache/request.scm, you can call this using either > load-extension or the dynamic-* functions: > > (define-module (apache request) > ...) > > (load-extension "libmg" "mg_register_apache_request_primitives") Currently i pass these init functions to 'scm_c_define_module', but that's probably equivalent to your solution. > Does this cover everything, and would you mind if I reworked this into > another example for the manual? Sounds fine to me. As soon as i get space on a server i'll put the code online (together with some samples ;-) Ralf > Regards, > Neil > _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel