guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What replaces scm_register_module_xxx (Doc update?)


From: rm
Subject: Re: What replaces scm_register_module_xxx (Doc update?)
Date: Mon, 19 Aug 2002 21:05:24 +0200
User-agent: Mutt/1.3.24i

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:

| <Location /blub>
|  ...
|  GuileSetHandler (foo bar)
| </Location>

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
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]