How the Skandha4 demos work

Client-side graphics

These demos run on the client side. This has the disadvantage that client has to be specially configured, and needs to have Skandha4 locally available, but the advantage that it runs at full local speed, loading the client rather than the server.

This configuration is appropriate for local use around the lab, but of course is not suitable for use by users on the Web at large.

The mechanics: .xS4 and application/x-skandha4

How does the client know when and how to invoke Skandha4?

The fundamental sequence of events is:

  1. When the httpd server reads a file, it classifies the file based on the file extension. This is driven by betz:/usr/local/www/conf/mime.types, to which I've added a line
        application/x-skandha4         xS4
    
    meaning that any file ending in ".xS4" will be assigned type application/x-skandha4. The server passes this classification to the client along with the file.

  2. When the Netscape client recieves a file, its treatment of the file is driven by the file type specified. (If no file type was specified by the server, Netscape will itself assign the file a type based again on file extension, using the file /usr/local/lib/netscape/mime.types, or your personal $HOME/.mime.types file.) The treatment is specified in /usr/local/lib/netscape/mailcap (or your personal $HOME/.mailcap) file. In this case, I've added a line
        application/x-skandha4; /usr/local/bin/x-skandha4 %s
    
    which results in Netscape copying the given file to a local file with a name like M174789.xS4 and then executing
    /usr/local/bin/x-skandha4 M174789.xS4
    

  3. x-skandha4 is a little convenience program I've written: The source is in /usr/local/src/x-skandha4. It creates a FIFO ("named pipe") skandha4-named-pipe in the client's home directory, if one does not already exist, and then starts up a copy of /usr/local/bin/skandha4 on that named pipe (if one is not already running), with stdin set to the FIFO, and stdout and stderr set to /dev/null. Finally, it copies the given file into the FIFO, and exits. (It does not kill the Skandha4 server before exiting. This is a feature, not a bug.)

  4. Skandha4 then simply reads and executes commands from stdin, blithely unaware of any of this.

How can I add more demos?

The demos are in /usr/local/shared_html/skandha4-demos, which is world-writable. The root demo document is /usr/local/shared_html/skandha4-demos/skandha4-demos.html.

To add a new demo, simply

  1. Add a new entry like
    <LI><a href="cool-demo.xS4">X-roll</a>
    
    to /usr/local/shared_html/skandha4-demos/skandha4-demos.html. and then

  2. Create an /usr/local/shared_html/skandha4-demos/cool-demo.xS4 file containing the desired lisp code. Make sure it is world-readable.
That's it!


Last modified: Tue Jan 21 14:14:05 PST 2003 by Kevin Hinshaw (khinshaw@u.washington.edu)