Adding support for DTDs

Each GI, its attributes, subelements, and content in an ESIS file has to be processed by costwish. For mainly textual documents the deafult options may be OK, but frequently the installer will wish to customise this. Here, for example is the code to format a SCENE from the PLAY DTD from Jon Bosak:

"
        } elseif {$gi == "STAGEDIR"} {
            append htext "[STAGEDIR::formatContents $parentWin $address] 
" } elseif {$gi == "SPEECH"} { append htext "[SPEECH::formatContents $parentWin $address]" } else { GUI::errorMessage "SCENE: UNEXPECTED GI: $gi" } } return $htext } proc SCENE::displaySubtree {parentWin address {control ""}} { global PLAY set win $address if {$PLAY(DISPLAY,SCENE) == "WHOLE"} { Hypertext::display $parentWin $win \ [SCENE::formatContents $parentWin $address] $control } else { Node::displaySubnodes $parentWin $win "" $control } } ]]>

When a SCENE node is activated (with NodeAction='Show Subtree') the proc SCENE::displaySubtree is called (with the address of the node (address) and the name of its parent window (parentWin) if this exists. The code checks a (user-installed) global variable PLAY(DISPLAY,SCENE) (see play/local.tcl on how to create a menu item to set this) and if it's set to WHOLE, calls the SCENE::formatContents routine (listed above). This goes through every child node of SCENE (which are normally TITLE, STAGEDIR and SPEECH) and takes specific action for each of those. In this case it builds up the results into a single hypertext string (htext), which is returned. The calling routine then calls a display routine (Hypertext::display) to render this. (Note that if PLAY(DISPLAY,SCENE) != WHOLE, then the default set of recursive subnodes is displayed.)

Invisibly to the user, the PLAY routines are loaded into costwish (the source command and a new menu (PLAY) is loaded.

Peter Murray-Rust
April 1996