[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [dev-serveez] changes (informational)
From: |
Martin Grabmueller |
Subject: |
Re: [dev-serveez] changes (informational) |
Date: |
Thu, 15 Mar 2001 09:00:17 +0100 |
> From: "Raimund 'Raimi' Jacob" <address@hidden>
> Date: Thu, 15 Mar 2001 00:24:39 +0100 (CET)
>
> ela and me had a discussion about changes required in libserveez so that
> the guile switch will be possible. here is a little summary because i made
> notes on paper and ela needs that stuff, too :-)
>
> * 1) port maintainance:
> - file: portcfg.c
> - the portcfg_t gets reorganized so that is a union of structs
> this reflects the nature of a port better. draft:
> typedef union portcfg {
> int type;
> char *name;
> struct tcp_t {
> int port;
> <something> localaddr;
> } tcp;
> struct pipe_t {
> char *in;
> char *out;
> } pipe;
> }
I suppose you mean something like this?
typedef struct portcfg {
int type;
char *name;
union {
struct tcp_t {
int port;
<something> localaddr;
} tcp;
struct pipe_t {
char *in;
char *out;
} pipe;
} u;
} portcfg;
switch (someportcfg.type) {
...
someportcfg.u.tcp.localaddr = ...
...
}
> another word on the guile switch: we decided to stay with the old
> mechanism of knowing which kind of server to instantiate on
> define-server!. we'll continue to require users to use 'http-someting' as
> the server (instance) name of a http server. that schema is IOHO straight
> forward :-)
Well, you have been warned ;-)
This could be accomplished by using the procedure `module-for-each',
which can enumerate all bindings in a module. You can play around
with the following:
==file: serveez.scm==
(define-module (serveez))
(define foo 1)
==end==
When you load this file with
guile> (use-modules (serveez))
you can inspect the definitions with
guile> (module-for-each (lambda (s v) (write-line s))
... (resolve-module '(serveez)))
foo
%module-public-interface
That means, that we should load the users configuration into a
serveez-specific module and then extract the bindings from that
module.
The alternative is to iterate over the symbol table `scm_symhash' (a
hash table, similar to those in Sizzle.
> thinking of dynamic reload there is another thing libserveez has to
> provide to the config file:
> something to add a path to the library search path.
> something to trigger the loading of a library given a short name (like
> 'http').
> ela wants to convice me that i should automagically load libraries when i
> encounter a short name i dont know yet. still undecided.
You could put the protocol code into something like
libserveez-http.so, and then load it when a http server is
instantiated. This leaves open the question from where Serveez should
get the information which protocols are available (needed to search
Guile's symbol table).
Regards,
'martin