dev-serveez
[Top][All Lists]
Advanced

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

[dev-serveez] Guile switch


From: Raimund 'Raimi' Jacob
Subject: [dev-serveez] Guile switch
Date: Thu, 8 Mar 2001 23:19:02 +0100 (CET)

hello!

Ela and I had another 'brainstorming' about the guile syntax for serveez
configuration. We need your help on the scheme end since i do not
understand all that list stuff %-).

First, we agreed on 3-call schema for creating servers:
(ignore scheme errors for now, i think you get the idea)
---
(define-port! http-port (
                         (ipaddr . "127.0.0.1")
                         (port . 80)
                         (proto . tcp)
                         ))

(define-server! http-server (
                             ( docdir . "/" )
                             ( logfile . "/dev/null")
                             ))

(define-server!
  ctrl-server (
               (password . "secret")
               ))

(bind! http-port (http-server ctrl-server))
---

'define-port!', 'define-server!' and 'bind!' are procedures to be
implemented in C and exported to guile. As you can see it is easy to bind
multiple servers to the same port.

we are not sure yet whether we want to write the server's name in
quotes (string vs. symbol). we are also not sure wether the server type
should be extracted from the [symbol] name (as we do with sizzle) or given
explicitly. Any opinion ?

Now, serveez does not understand strings and ints as values only, there
are also those:
---
;; string array
(define-port! zwei-interfaces (
                               (port . 42420)
                               (ipaddr . ("127.0.0.1"
                                          "192.168.2.2"))
                               (proto . tcp)))
;; int array
(define-server! bla-server (
                            (numbers . (1 2 3 4 5))))
;; hash
(define-server!
  http-server (
               (content-types . (
                                 ("gif" . "image/gif")
                                 ("jpg" . "image/jpeg")
                                 ("wav" . "audio/x-wav")))))
---

ok, now the questions:
Is it at all possible to write something like that in guile? Can you add
single quotes (or function calls) at appropriete places so that is valid
scheme?
  ( As you remember we already agreed to use those alist thingies
    which are something like ( (key1 . val1 ) . ( (key2 . val2) . ... )..).
    Ela decided (and convinced me) that this is too much parenthesis.
    the gnutella client has 39 config options which would result in more
    than 40 closing parenthesises!. The above syntax uses much less
    parenthesis but we dont know wether that can work somehow )

Can you show me (or point me to an example) how to acces variable argument
lists in a C-defined function ?

How are the above constructs represented in scheme? Can you explain the
terminology (list, vector to name 2 that confuse us)? I hope to be able
to figure out how to traverse that in C once i understand the structure...

Thank you very much in advance :-)

Bye,
    Raimi

--
      __/\     _/\    _____/\.___/\
     /   /    /  /___/   ____/  __/\     Name    : Raimi
    /   /  __/    __/   / __/  / _\/     Contact : address@hidden
   /   /__/ /     \/   /_/_/  /_/        Visit   : http://www.lkcc.org
  /________/___/\._\._____/_____/\       3.141592653589793238462643383
  \._______\.__\/__/\.____\.____\/       27950288419716939937510582097





reply via email to

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