unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: Rob Browning <rlb@defaultvalue.org>,
	"Dale P. Smith" <dsmith@altustech.com>,
	guile-devel@gnu.org
Subject: Re: What replaces scm_register_module_xxx (Doc update?)
Date: 17 Aug 2002 12:59:47 +0100	[thread overview]
Message-ID: <m37kipwv9o.fsf@laruns.ossau.uklinux.net> (raw)
In-Reply-To: 20020809153645.GA25688@www

>>>>> "rm" == rm  <rm@fabula.de> writes:

    rm> Apache (the application) loads mod_guile (an apache module). mod_guile
    rm> registers some callback functions with apache. Apache then calls theses
    rm> functions whenever it thinks that a certain part of a request (authrntication,
    rm> authorization, URL-rewrite, content delivery etc.) should be handled by
    rm> guile (as can be customized in apaches configuration file). mod_guile then
    rm> calls the function that is supposed to handle this part of a request
    rm> (again, the module and name of the function can be specified in the server
    rm> configuration files). To ba able to do something usefull, these functions
    rm> need to be able to access the data structures of the server/request.
    rm> Each hander function is passed a request-record structure (a SMOB arround
    rm> apaches 'real' datastructure) as a parameter - this structure has fields
    rm> that point to the server and connection record structures as well. 
    rm> Since all of these structures have quite a lot of fields we end up with
    rm> a lot of functions (getters/setters). All of these functions are defined
    rm> in mod_guile but of course should go into separate guile modules. Right
    rm> now (as you can see, i got it working ;-) the following modules are 
    rm> defined: (apache request), (apache server), (apache connection),
    rm> (apache tables), (mod-guile utils).

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 (?)

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)

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 (...);
  ...
}

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

Does this cover everything, and would you mind if I reworked this into
another example for the manual?

Regards,
        Neil



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


  reply	other threads:[~2002-08-17 11:59 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-08 13:48 What replaces scm_register_module_xxx (Doc update?) rm
2002-08-08 14:21 ` Dale P. Smith
2002-08-08 14:23   ` Dale P. Smith
2002-08-08 14:31   ` Rob Browning
2002-08-08 16:19     ` rm
2002-08-08 17:59       ` Dale P. Smith
2002-08-08 18:24         ` rm
2002-08-08 20:26       ` Marius Vollmer
2002-08-08 21:28       ` Neil Jerram
2002-08-09 15:36         ` rm
2002-08-17 11:59           ` Neil Jerram [this message]
2002-08-19 19:05             ` rm
2002-08-09  8:47       ` Matthias Koeppe
2002-08-09 10:00         ` rm
2002-08-09 11:29           ` Matthias Koeppe
2002-08-09 13:23             ` rm
2002-08-10 14:44           ` Marius Vollmer
2002-08-11 23:20             ` Marius Vollmer
2002-08-17  8:09               ` Dirk Herrmann
2002-08-17 11:05                 ` Neil Jerram
2002-08-24  8:08                   ` Dirk Herrmann
2002-08-26 21:45                     ` Neil Jerram
2002-08-26 22:04                     ` Marius Vollmer
2002-08-21 19:35                 ` Marius Vollmer
2002-08-13  0:40             ` Marius Vollmer
2002-08-17 22:37               ` Dale P. Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m37kipwv9o.fsf@laruns.ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=dsmith@altustech.com \
    --cc=guile-devel@gnu.org \
    --cc=rlb@defaultvalue.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).