Hi Tomas,

thanks for your ideas and extensions! I'm a bit late with my reply, as
I'm travelling through the south of Japan since almost two weeks, and
have only infrequent (and unreliable) access to the internet.

You can easily circumvent the access problems of a transient symbol, if
you make use of 'loc' to get the transient symbol via some internal
symbol that refers to it, and then import it into your extensions with

   (==== (loc "*Cookies" http))

This clears the transient symbol table, and inserts the "*Cookies"
symbol from the 'http' function. Then "*Cookies" can be used in the rest
of the source file as if it were a local symbol.

To just redefine 'httpStat' in the way you suggested, there is an even
more dirty way ;-)

   : (setq httpStat (insert 6 httpStat (assoc 'for httpHead)))

This takes the expression (for L "*Cookies" ...)  from 'httpHead',
and builds it into 'httpStat', giving:

   : (pp 'httpStat)                                          
   (de httpStat (N Str . @)
      (prinl "HTTP/1.0 " N " " Str "^M")
      (prinl "Server: PicoLisp^M")
      (while (args) (prinl (next) "^M"))
      (prinl "Content-Type: text/html^M")
      (for L "*Cookies"
            "Set-Cookie: "
            (ht:Fmt (car L))
            (ht:Fmt (cdr L))
            "; path=/" ) )
         "Content-Length: "
         (+ 68 (length N) (* 2 (length Str)))
         "^M" )
      (prinl "^M")
      (prinl "<HTML>")
      (prinl "<HEAD><TITLE>" N " " Str "</TITLE></HEAD>")
      (prinl "<BODY><H1>" Str "</H1></BODY>")
      (prinl "</HTML>") )
   -> httpStat

- Alex
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to