[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gcl-devel] Re: [Axiom-developer] Simple web server code for GCLfor Wind
From: |
Bill Page |
Subject: |
[Gcl-devel] Re: [Axiom-developer] Simple web server code for GCLfor Windows |
Date: |
Wed, 04 May 2005 13:18:51 -0400 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Windows/20050317) |
Camm Maguire wrote:
(if (pathname-name (pathname fn))
(with-open-file (q fn) (si::copy-stream q s))
(dolist (l (directory fn)) (format s "~a~%" (namestring l)))))
It would be nicer to make the result and the content type depend
on whether something was a directory or on the type of the file
etc instead of the syntax of the name, but I could not easily
discover how to do that in GCL. Specifically how can I tell a
directory from a file? Can anyone suggest a suitable "Getting
started in GCL" tutorial?
In lisp, the file system is accessed via a 'pathname' abstraction.
Think of this a sa structure with several components, name, directory,
type (e.g. suffix), device, even host and version if I recall.
Directories have nil in the name and type fields. The sample code
uses this to distinguish between them.
I guess the lisp code in the previous paragraph is intended to
distinquish between
directories and files, as you say but on Windows at least, all this code
succeeds
in doing is distinguishing syntactically between `/msys/home/' (which it
treats as a
directory because the "name" part is missing and '/msys/home' (which it
treats as a
file) apparently without asking the operating system. Does this work
properly
on linux?
Inside the (dolist (l (directory fn)) ... ) I would like to treat
sub-directories
and files differently, i.e. different color, different type of links,
etc. How can
I do that in GCL? I could not seem to get
(if (pathname-name (pathname l)) ...
to work. Is that right approach?
As for content-type analysis on files, you have the following options
in order of simplicity to performace:
1) Use an external utility via run-process:
I think that for content type I would be happy to try to interpret the file
extension as is done in most web servers, e.g. name.html is of
content-type: text/html and name.txt is of content-type: text/plaintext
etc.
As for tutorials, I'd suggest:
1) Practical Common Lisp:
http://www.gigamonkeys.com/book/
2) The Common Lisp Hyperspec:
http://www.lisp.org/HyperSpec/FrontMatter/index.html
Thanks!
Anyway, it seems clear that we could use this approach to develop
a portable HyperTex browser for Axiom if we decide to go that
root.
If I can delay the stdin/socket multiplexing, this might be
preferrable at this point. I need to know if blocking the axiom
process while serving the hyperdoc on Windows is a showstopper.
For most applications I think it would be fine to run only one Axiom
process,
so that if a user executes a long running command from the command window,
hypertex would have to wait (and vice versa).
Regards,
Bill Page.