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: scm_* API extension? [was] scm_* API question Date: Mon, 5 Aug 2002 18:06:39 +0200 Sender: guile-devel-admin@gnu.org Message-ID: <20020805160639.GA19325@www> References: <20020730121436.GA4465@www> <20020730200929.A18106@kiwi.pyrotechnics.com> <20020731100300.GC5661@www> <20020731182124.GD6561@www> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1028562930 32107 127.0.0.1 (5 Aug 2002 15:55:30 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 5 Aug 2002 15:55:30 +0000 (UTC) Cc: rm@fabula.de, guile-devel@gnu.org Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17bkCY-0008LO-00 for ; Mon, 05 Aug 2002 17:55:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17bkDD-0008RX-00; Mon, 05 Aug 2002 11:56:03 -0400 Original-Received: from www.elogos.de ([212.18.192.92]) by fencepost.gnu.org with smtp (Exim 3.35 #1 (Debian)) id 17bkCD-0008Oi-00 for ; Mon, 05 Aug 2002 11:55:01 -0400 Original-Received: by www.elogos.de (Postfix, from userid 5001) id 0A85E1049A6; Mon, 5 Aug 2002 18:06:39 +0200 (CEST) Original-To: Marius Vollmer 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:982 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:982 On Mon, Aug 05, 2002 at 05:08:45PM +0200, Marius Vollmer wrote: > rm@fabula.de writes: > > Ok this is for my current (frankensteinish) hacking with Dave's mod_guile: > > i'm working on implementing a mod_guile mode in which URLs get mapped to > > so-called 'handlers' in modules - meaning i (ab?)use the hierarchical module > > space a namespace enclosures. > > That sounds rather reasonable to me. But do you need to invoke > 'use-modules' for this? As i just found out, no ;-) > What I would probably do is to have a single Scheme function that gets > called from C, and perform all the dispatching in Scheme. That > function would be called with different arguments for different > s. This is probably a matter of taste, but i'd like to reuse guiles allready existing dispatch mechanisms. > > I suppose, all Apache can really handle in its configuration file are > strings. Well, on one level, yes (since a configuration file _is_ a looong string). Currently i handle these configuration options as 'raw' options, i.e. Apache does no tokenisation at all -- the character stream gets fed to scm_read_string, so after reading of the configuration file i have all configuration settings as SCM structures. It would be trivial to extend the configuration process to actually have the handler defined in the configuration file: GuileContentLamda (lambda (request) (let ((user (req:remote-user request)) (hist (req:host request)) ..... ) > So I would make my Scheme function take a string as its > argument. When the function wants to interpret that string as a > Scheme form, it can do so. (Calling 'read' from Scheme is no less > efficient than calling it from C, but more convenient.) > > Maybe I would even require the Scheme code to register the dispatching > function with the C code before it can be used. That way, the C code > is completely independent from the Scheme code and the interactions > between the too are not via magic names but by explicit API calls. > > > I'll also plan to add something like > > > > GuileBind a-symbol '(arbitrary (guile data) structure) > > > > i.e. i want guile to 'read' from the configuration file and bind > > 'a-symbol' to whatever was read. > > I think I would pass extra information via the handler callback, not > as a variable, but of course I can't say whether that will be feasible > in your case. Hmmm, "filling up" the environment in which the handler executes with some predifined values can be rather handy. I wanted to implement this because it's a feature i often used in mod_perl projects. Imagine an online shop: ... GuileDefine bg-color "PapayaWhip" GuileDefine text-color "DarkSlateGey" ... GuileDefine bg-color "black" GuileDefine text-color "orange" > > I see. mod_guile should probably have a 'call a function per request' > kind of model. That is just as flexible but does not have to be slow. Right now, i try to get my hands on the actual handler function during configuration reading/parsing (as a side effect we can raise an error if there's a problem with the configuration). The SCM value gets stored in Apache's per-location configuration. Whenever a location (URL) that's handled by mod_guile gets requested the appropriate hander function gets appied to the request [scm_call_1(...)] (possibly after setting up the environment). Thank's for your input Ralf Mattes _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel