[Top][All Lists]

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

Re: [Axiom-developer] Re: Axiom HyperDoc Replacement

From: Martin Rubey
Subject: Re: [Axiom-developer] Re: Axiom HyperDoc Replacement
Date: 21 Apr 2007 21:37:56 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

"Bill Page" <address@hidden> writes:

> Or we could just add a couple of extra lisp commands to open
> and send the contents of the file ourselves. 

Well, that's what I have done now -- following the code in the sandboxsockets
page.  But it's nowhere as nice as the simple redirect.

> It's not a big deal. The main thing is that you found a way to call a Spad
> routine [...]

> Do you have an explanation why you want/need to use the *docfun* name format?

Oh, I didn't know that this was a problem.  Hm, you did it yourself with
MySort(L,<$Integer)$Lisp, so I do not really follow?

The only thing that was surprising is that the function needs to be compiled,
i.e., defining a function in the interpreter does not work, for some reason.

Thus, I modified bar as below. The only reason I made it a global was that I am
lazy.  You could just as well pass it to server as an argument.

;; try it with

;; )lisp (load "http-test.lisp")
;; BAR(8080, getDocumentation$HyperDoc)$Lisp

(defvar *docfun*)

;; file: http-test.lisp
(defun bar (p docfun)
  (setq *docfun* docfun)
  (let ((s (si::socket p :server #'server)))
    (tagbody l
             (when (si::listen s)
               (let ((w (si::accept s)))
                 (server w)))
             (sleep 0.1)
             (go l))))

(defun server (s)
  (let* ((get (read s nil 'eof))
         (fn (and (eq get 'get) (subseq (string-downcase (read s nil 'eof)) 
; subseq removes the leading "/"
    (format t "Got ~S~%~%" fn)
;;; NOTYET tested
    (when (string= (char fn 1) "?")
        (setq fn (SPADCALL fn *docfun*)))
; *docfun* should return the name of an html file
; in case of an error, it will also return the name of an html file, which will
; contain the error message
;;; END NOTYET tested

    (when (string= (subseq fn (- (length fn) 4)) "html")
        (format s "HTTP/1.1 ~S~%" (if fn 200 403)))

    (with-open-file  (q fn) (si::copy-stream q s))
    (close s)))

> I recall something about such mangled names being "global" or in some other
> way special in scope.

No, the stars are only a convention.  defvar makes a variable "global".

> Is that right? Is that why it works, incontrast to the lambda function I
> tried?

Huh? what lambda function did not work for you?

> There is a way to chage the configuration of FireFox:
> And Konqueror is supposed to just give a warning. Did you see that?

No, he says access denied.  But in any case, we cannot expect a user to fiddle
with security settings.

The "small" webservers, can they be installed without being root?


reply via email to

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