Newsgroups: comp.sources.misc
From: ijp@doc.ic.ac.uk (Ian Palmer)
Subject:  v26i025:  scamper - Cellular Automata Simulator, Part02/10
Message-ID: <1991Nov20.233731.14242@sparky.imd.sterling.com>
X-Md4-Signature: 5a015b0c5c29820704a12ad618a3d40c
Date: Wed, 20 Nov 1991 23:37:31 GMT
Approved: kent@sparky.imd.sterling.com

Submitted-by: ijp@doc.ic.ac.uk (Ian Palmer)
Posting-number: Volume 26, Issue 25
Archive-name: scamper/part02
Environment: X11R4, SunOS

---- CUT HERE -------- CUT HERE -------- CUT HERE -------- CUT HERE ----
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  text/cal.text text/scamper.text text/tech.text
# Wrapped by ijp@swan.doc.ic.ac.uk on Thu Nov  7 10:00:16 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'text/cal.text' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'text/cal.text'\"
else
echo shar: Extracting \"'text/cal.text'\" \(9526 characters\)
sed "s/^X//" >'text/cal.text' <<'END_OF_FILE'
XIntroduction to Cal 
X-------------------
X
XThis chapter describes the language that was designed for this project, known
Xas Cal. Cal, which stands for Cellular Automata Language, 
Xis a simple language and has a limited syntax and is thus quick to learn, and
Xyet powerful enough to allow any (simple) cellular automaton to be
Xdescribed. Scamper can be informed about Cal programs via text files,
Xwhich can also contain, what are called, Cal commands. These commands are
Xnot actually part of Cal itself, but instead can execute Scamper functions
X(such as `Load Bitmap', `Clear rules', etc.) These are described later on in
Xthe chapter.
X
XCal is a language allowing the user to inform Scamper about the 
Xrules that it should follow. Each rule is divided into two parts, 
Xeach part separated by a `:'.  The two parts are :
X
X  state change    Source and Destination states for the rule 
X  mask            Rule as to when the state change should take place 
X
XState Change
X------------
X
XEach `state change' specifies the source and destination states for a rule.
XThe source state informs Scamper to which cells the rule applies, whilst the
Xdestination state tells to which state these cells should be changes to if
Xthe mask is valid.
X
XThe state change takes the following syntax :
X
X source -> destination
X
XMask 
X----
X
XEach cell in the domain has either 4, 6 or 8 neighbours, numbered as follows :
X
X            1             1           8 1 5
X          4 * 2         6 * 2         4 * 2
X            3           5 * 3         7 3 6
X                          4
X
XEach rule must have a mask which will be matched to a cell's neighbours
Xduring execution of the rule. Thus, a rule of the form  0 -> 1 :  1,1,1,1 
Xtells Scamper that a cell in state 0 should change to state 1 if all it's four
Xsurround).
X
XFive special characters can be placed as elements of a mask instead of state
Xnumbers :
X
X    ?     Will match any state value 
X    !     Will match any non-zero state value 
X    o     Will match any odd state 
X    e     Will match any even state 
X    *     Will add neighbour's state value to State Counter (see below)
X
XCounters
X--------
X
XTwo counters are kept during matching of a mask, the state counter and the
Xmask counter . Each time a  * is encountered in the mask the value of
Xthat neighbour's state is added to the state counter, whilst each time a mask
Xvalue (or one of `!', `o' or `e') is matched to the
Xneighbour's state value the mask counter is incremented.
X
XBy default, when executing a rule, the state counter is ignored, and the mask 
Xcounter must equal the number of specified mask values. The rule can, however,
Xbe extended by adding a check on either, or both, of these counters. A check
Xtakes the syntax `operator value' for the state counter, and 
X`#operator value' for the mask counter.  
X
XThe four operators available are as follows :
X
X        Equals        (`=') 
X        Not equals    (`!')
X        Greater than  (`>')
X        Less than     (`<')
X
XShifting 
X--------
X
XYou can instruct Scamper to produce several versions of a particular Cal rule,
Xonly with the mask shifted round. This is done by placing a
X`>' after the `:' in the rule.  Thus :
X
X0 -> 1 : >  1,2,3,4
X
Xis the same as :
X
X0 -> 1 :  1,2,3,4 
X0 -> 1 :  2,3,4,1 
X0 -> 1 :  3,4,1,2 
X0 -> 1 :  4,1,2,3 
X
XIt is possible to include more than a single shift, thus to produce four
Xrules (under an 8 neighbourhood) each rotated by 90 degrees, then two
X'>'s should be included, thus :
X
X0 -> 1 : >>  1,2,3,4,5,6,7,8
X
Xis the same as :
X
X1) 0 -> 1 :  1,2,3,4,5,6,7,8 
X2) 0 -> 1 :  2,3,4,1,6,7,8,5
X3) 0 -> 1 :  3,4,1,2,7,8,5,6 
X4) 0 -> 1 :  4,1,2,3,8,5,6,7 
X
XIt may be required to produce shifted rules such that only one is applied in
Xeach generation, then the next (shifted rule) to be applied at the next
Xgeneration. This is possible by placing a `stop' after the shift. So
Xfor example :
X
X0 -> 1 : >>| 1,2,3,4,5,6,7,8
X
Xwill cause rule 1 (above) to be executed on the first, fifth, ninth, etc.
Xgeneration; rule 2 to be executed on the second, sixth, etc. generation;
Xand so on... This is particularly useful for skeletonization .
X
XCal commands 
X------------
X
XAs well as being able to specify rules (in files), many of the options
Xavailable in the main menu can be called from within the file. This allows
Xthe user to create files which perform complete operations, with no user
Xassistance required. Cal commands are not actually part of the   
Xlanguage, instead they are a feature of Scamper. The Cal program scanner
Xsimply reads in the commands and passes control to the relevant section, for
Xthis reason the error messages are a bit limited.
XA full list of Cal commands is given below, with any operands they take.
X
X  `Clear'               clears all previous rules. It is good practice to
X                        include this at the start of the file, unless there
X                        is a reason not to.
X  `message <message>'   displays the given message in Scamper's
X                        message window.
X  `shape n'             (should actually be called neighbours, but this is a
X                        bit long), sets the number of neighbours per cell,
X                        n should be 4, 6 or 8.
X  `run'                 triggers the run option from Scamper's menu.
X                        Execution will continue until a steady domain is
X                        reached (or the user presses `Stop').
X  `step  (n)'           steps once (if no n specified) or n times.
X  `display n'           if n is 1 then the domain display is shown, if 0 then
X                        the domain display will disappear. This command can
X                        be disabled by setting the `Display Off' option when
X                        the file is loaded.
X  `state n <colour>'    sets the colour of a state, where n is a
X                        state number, and colour is the colour that is
X                        required for that state. 
X  `stop n'              Normally a `run' will stop when there are no changes
X                        made to a domain in a single generation. This is not
X                        always convenient, especially when using the
X                        `Shift Stop'. If this command is called then a `run'
X                        will only be stopped after n generations where no
X                        changes are made to the domain. The value will be
X                        reset on a `clear' (rules) operation.
X  `save <file name>'    will save the current domain with file name as stated.
X  `load <file name>'    will load the current domain with file name as stated.
X  `bitmap <file name>'  as load, but load a bitmap file.
X  `bitsave <file name>' saves a bitmap file.
X  `add <file name>'     will insert a domain file, using the add operation.
X  `and <file name>'     will insert a domain file, using the and operation.
X  `or  <file name>'     will insert a domain file, using the or operation.
X  `not  +<file name>+'  will insert a domain file, using the not operation.
X  `torus'               sets the domain type to torus.
X  `flat'                sets the domain type to flat.
X
XCal's error messages
X--------------------
X
XCal will report any error messages when a rule file is loaded into Scamper.
XThe error will be displayed in a large window which appears in the top
Xhalf of the main window. To cancel the error (and the loading of the file)
Xsimply click on the window. The error messages are split into two sections,
Xthose that refer to Cal rules, and those that are for   commands.
XThe error message gives a message, the line number of the input file where
Xthe error occurs, and the line itself.
X
XError messages for Cal rules :
X
X  `Missing from state' This means that a rule has been encountered with
X          no from (or source) state number.
X
X  `Missing ->'] Cal has found a number, and assumed that a rule
X          was being specified, but there was no `becomes' marker.
X
X  `Missing to state' No destination state has been specified.
X
X  `Missing :' The separator between the two halves of the rule
X          has been omitted, or something illegal is before it.
X
X  `Can't SHIFT after a STOP' This means that a '>' (shift) has been
X          located after a '|' (stop). All shift's must be placed before a stop.
X
X  `Missing mask' Either the mask has been omitted, or something illegal
X          has occurred before the '{' of the mask.
X
X  `Bad mask value in position n' Whilst scanning the mask, an error was
X          located in the position. Only values, or one of
X          '?, !, o, e, *' can be in a mask position.
X
X  `Missing  +,+ or  + +' Whilst scanning the mask, something
X          has been placed after a mask element which is not expected.
X
X  `Mask too big' There can only be (up to) 8 elements in a mask.
X
X  `Bad counter operation *' Anything following a mask is assumed to be
X          an operator, and thus if it is not known
X          then there must be an error. In the
X          message the offending article is placed in place of the `*'.
X
X  `Missing mask counter's value' An operator has been located, but there
X          is no value associated with it.
X
XError messages for Cal commands :
X
X  `Shape unknown' The command `shape' can only be followed by 4, 6 or 8.
X
X  `Error: shape number' No value has been given for the shape (number
X          of neighbours).
X
X  `Missing colour name' The `state' command has no associated colour.
X
X  `Missing state number' The `state' command has no state number.
X
X  `Unknown command' There is an unknown command in the file.
X            description 
X
END_OF_FILE
if test 9526 -ne `wc -c <'text/cal.text'`; then
    echo shar: \"'text/cal.text'\" unpacked with wrong size!
fi
# end of 'text/cal.text'
fi
if test -f 'text/scamper.text' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'text/scamper.text'\"
else
echo shar: Extracting \"'text/scamper.text'\" \(16638 characters\)
sed "s/^X//" >'text/scamper.text' <<'END_OF_FILE'
XScamper : The User Guide
X------------------------
X
XScamper is a program which allows the user to simulate cellular automata 
Xon domains  which can either be created by the user, or loaded in from
Xfiles. It will then allows various sets of rules
Xto be applied over the domain, showing the results on the screen, and allows
Xthese results to be saved either for later use, or printing out on a printer.
X
XScamper has been designed to run under Unix.
XIt was created to run on a colour display, although it will work on
Xa monochrome display. It's main features are listed below, and full
Xdescriptions of all features follow.
X
X  The main features of Scamper :
X
X  - Two types of domain, torus or flat
X  - Huge range of domain sizes (from 25 to over 250,000 cells)
X  - Over 200 colours are available
X  - A 100 level grey scale is supported
X  - 3 different neighbourhoods (4, 6 or 8)
X  - Up to 256 states can exist
X  - Statistics are built up over generations
X  - Built in cellular automata functions
X      - Grey scaling of monochrome images
X      - Image sharpening
X      - Image softening
X
XScamper, the guided tour 
X------------------------
X
XWhen the user runs Scamper they are welcomed by the main menu. This 
Xcontains 34 options and two windows. The options are divided into three
Xsections (two groups of 12 options and one set of 10). In the top group
Xare situated options for selecting neighbourhoods, 
Xdomain to file options and the setting of mouse buttons. The middle group has
Xoptions for changing the size of the domain, colours of 
Xstates, and other
Xmiscellaneous functions. The final group of options are always visible and 
Xhandle the execution of rules, scaling and scrolling of the domain, and 
Xswitching to and from the main menu.
X
XThere are, in total, eight windows within Scamper, but not all of them are
Xvisible at any one time. A full list of the windows follows, with a description
Xof each one's function.
X
X  Main Window             This contains the 34 options described above.
X  Domain Window           Displays the current domain of cells on which the
X                          rules will be applied.
X  File Name Window        When the user types in a file name, it will appear
X                          in this window for the user to see.
X  File Options Window     Allows the user to select options for a file
X                          operation.
X  Message Window          Allows Scamper to inform the user of non-error
X                          information, for example the generation number.
X  Error Window            Displays any errors in a rules file.
X  Statistics Window       Displays statistics about a domain, or about past
X                          generations.
X  States' Colours Window  Allows the user to select the colours of each
X                          state.
X
XHow to view the domain 
X----------------------
X
XFrom the main menu the user can view the current domain of cells by simply
Xmoving the mouse pointer until it is over the bottom right option (marked
X`Swap ') and pressing any of the mouse buttons. At this stage most of the
Xmain menu should disappear behind the Domain Window .
X
XInitially the domain is clear (all cells are in state zero, dead). If the
Xmouse pointer is moved over the domain and the middle button pressed, then the
Xcell under the mouse pointer will come to life (change to state one). This
Xshould be shown by a white square in the domain window. If the mouse pointer is
Xmoved around the domain whilst the middle button is pressed, a trail of white
Xcells will be left behind. If the left mouse button is pressed whilst the mouse
Xpointer is over a white cell then it will revert to black (dead). This is the
Xmethod in which domains can be constructed. 
X
XCells of different sizes
X------------------------
X
XIt is possible to change the size of the displayed cells, allowing the user
Xto zoom in and out of the domain. To zoom out (make cells smaller) the mouse
Xpointer should be moved to the option marked `-', and any mouse
Xbutton pressed. The domain will then be redrawn, only smaller. This option
Xcan be repeated until the minimum size is reached. To zoom in (or enlarge
Xthe cells) the option marked `+' should be used. There is no maximum
Xsize specified for cells, so in fact each cell can be made larger then the
Xdomain window itself.
X
XOne of the options of the main menu is called `Auto Resize' and it
XAuto Resize will automatically resize a domain to a scale such that
Xmost of the domain just fits inside the domain window. To use this option
Xfirst the main menu must be called up. This is done be selecting the `Swap'
Xoption. The `Auto Resize' option is located in the middle set of
Xoptions, top of the second column from the left. Once this option has been
Xselected the domain will return to its original scale.
X
XDomains of different sizes
X--------------------------
X
XThe domain can be any size from a 5x5 square of cells, to a massive 512x512
Xsquare of cells (over a quarter of a million cells). Changing the size of the
Xdomain is simple, on the right hand side of the middle set of options are
Xtwo options, one marked `X = 20' and the other marked `Y = 20'.
XThese show the current dimensions of the domain (in cells). To change one
Xof these values the mouse pointer should be moved into the option box for that
Xvalue, then pressing the left mouse button will reduce that value, whilst
Xthe right mouse button will increase the value.
X
XThere is one thing to note at this stage, Scamper only requests memory for
Xcells when it is needed, thus initially only 400 (20x20) cells actually
Xhave memory. Thus for this reason it is advisable to only enlarge the domain
Xwhen the extra space is actually required, rather than just simply making the
Xdomain maximum size at the beginning as this would utilize a large amount
Xof memory.
X
XClearing the domain
X-------------------
X
XTo kill (change to state zero) all the cells in the domain, there is an
Xoption on the main menu marked `Clear Domain'.
X
XCells come in different shapes as well as sizes
X-----------------------------------------------
X
XThree different neighbourhoods for cells are available, as given below :
X
X  4 neighbours    Each cell is square in shape.
X  6 neighbours    Each cell is hexagonal in shape.
X  8 neighbours    Each cell is square in shape.
X
XIn order to change between the three neighbourhoods there are three options on
Xthe main menu, positioned at the top left. Selecting any of these options
Xwill cause all cells to change their neighbours accordingly, and if the 6
Xneighbours option is selected the cells become hexagonal when displayed.
X
XCells of many colours
X---------------------
X
XChanging the colour of a `state' allows cells to be in any of over 200 colours.
XTo change the colours of, say, state 1 to green then the following
Xprocedure should be followed :
X
XFrom the main menu, select the `Change Colours' option. The main
Xmenu should now disappear behind a list of states and colours. There should be
Xa highlighted bar in the middle left of the screen, highlighting the words
X"State 0 Black", and to the right of that a black square. This highlight
Xbar shows what can currently be changed by selecting the `Left' or
X`Right' options (at the bottom of the main window).
XSelecting the `Up' option moves the list up the screen, whilst the
X`Down' option moves the list down the screen. So to change state 1 the
X`Up' option should be selected.
X
XAt this stage the `Left' option will move through the colours
Xbackwards, whilst the `Right' option moves forwards through the colours.
X
XTo change from White to Green the `Right' button should be
Xpressed three times. The coloured block should then change through red and
Xyellow and settle on green.
X
XTo return to the main menu, simply select the `Swap' option. If the domain
Xis now viewed all the white live cells will have
Xchanged to green cells. Up until now only two states have been mentioned,
Xstate zero (dead) and state one (alive). Scamper, in fact, allows up to 256
Xdifferent states to exist. Initially all even numbered states are coloured
Xblack, and all odd numbered states are white. The colour for any state can be
Xchanged in the above manner, but so far it has only been described as to how
Xcells can be changed between states zero and one.
X
XIn fact when viewing the domain, cells can be changed to any of the 256
Xstates, but initially only three states can be created (one for each mouse
Xbutton).
X
X  Left Button     State zero (black)
X  Middle Button   State one (white)
X  Right Button    State two (black)
X
XThe action of each of the three mouse buttons can be changed from the main
Xmenu. Options situated at the top right of the main menu allow the user to
Xchange to which state each of the mouse buttons should change cells. Whilst
Xthe mouse pointer is inside any of these options, pressing the left mouse
Xbutton will decrease the state number, whilst pressing the right mouse button
Xwill increase the state number. If the user presses the middle button, this
Xtoggles the information displayed inside that option (normally state and colour,
Xbut toggles between that and to which mouse button the option refers).
X
XLoading, Saving and Inserting domains
X-------------------------------------
X
XScamper has it's own format for saving domains. This format holds the current
Xdomain, plus the colours of all states used in that domain. Thus when a domain
Xis saved and reloaded it will look the same as before it was saved.
X
XSaving domains :
X
XTo save a domain the `Save Domain' option should be selected from
Xthe main menu. Once this option has been selected the File Options Window 
Xwill appear above the File Name Window. This window is divided into
Xtwo halves, on the left are file formats and directory selection, on the
Xright are three options (Save, Cancel and Clear). 
X
XThe first two possible selections are that of where the file should be placed.
XThe choice is between the current directory and a sub-directory (called sca).
XTo select one of these the mouse pointer should be moved to within the block
Xto the left of the selection and any of the mouse buttons clicked. The 
Xcurrently selected option has a solid block, and the selection of the other
Xoption will clear the current selection.
X
XThe file format is also selectable, and here the choice is between Scamper's
Xown format and Postscript. The latter allows the domain to be printed on a 
Xprinter which supports Postscript. Only files using Scamper's own format
Xcan be read into Scamper.
X
XThe three options on the right of the File Options Window allow the
Xuser to confirm that the selections have been made (and the file name entered
X(see below)), cancel the whole operation or clear the currently displayed
Xfilename.
X
XIf you type at the keyboard whilst the mouse pointer is inside any of Scamper's
Xwindows, the characters will appear inside the `File Name Window'. Pressing
XReturn will be the same as selecting the `Save' option, whilst
Xtyping ctrl-U will perform the clear operation described above.
X
XLoading Domains :
X
XFor loading domains the procedure is similar to that of for saving domains,
Xexcept that the file selections are different. Here there is no selection of
Xdirectory (the  current directory will be searched first, if the file is not
Xthere then the sub-directory is searched), and no file type selection (as
XScamper can not read Postscript files). Instead there is a choice of loading
Xthe file at full size (normal, as saved), half size or double size. When
Xthe file is loaded the domain size will become the size of the saved domain.
X
XInserting Domains :
X
XThis option is similar to that of `Load Domain' only the image will be loaded
Xover the top of an existing image (mixing them). There are four ways in which
Xthe images can be mixed described below. When inserting images no attempt is
Xmade to match colours of the saved domain, and the domain must be large enough
Xto hold the inserted image.
X
XThe four ways of inserting a domain are :
X
X  Add     The state number of the cell is added to the current domain cell
X  And     The result is the Anding of the inserted domain cell and the current
X          domain cell
X  Or      The result is the Oring of the inserted domain cell and the current
X          domain cell
X  Not     The insert domain is only used where the current domain is dead
X          (in state zero)
X
XThe X Windows Bitmap :
X
XAs well as being able to load and save into Scamper's own full colour format,
Xit is possible to load and save bitmaps. Bitmaps are a standard X format
Xfor specifying two colour images (for example black and white). The methods
Xfor loading and saving bitmaps are similar to those described previously,
Xexcept that they have their own options on the main menu, load bitmap can
Xalso have normal or invert settings.
X
XBuilt in Cal programs 
X---------------------
X
XThere are three built in Cal programs, all related
Xto a particular area in which Cal programs become very large, that is `Grey
XScaling'. These programs perform the following functions :
X
X  - Grey scale a picture
X  - Sharpen a grey scale picture
X  - Soften a grey scale picture
X
XWhen using these programs it is best to use the `Flat' domain. This can be
Xselected in the same way as changing colours.
XOn the colours list exists a special entry for `Domain type' which by
Xdefault says `Torus'. This can be changed to `Flat' by using the `Left'
Xor `Right' option.
X
XThese programs can be executed by selecting either the `Small View' option
Xor the `View Stats' option from the main menu. When either of these are
Xselected six of the ten options on the bottom of the main menu will change.
XThis line of options will now read :
X
X   Run   Stop   Step   Grey   Sharp   Soft   Apply   Update   Undo   Swap
X
X`Run', `Step' and `Stop' refer to any resident Cal program (as before), and
X`Swap' still takes you back to the main menu. The other options will perform
Xthe functions described below.
X
X  `Grey'    will take the domain and increase the number of grey levels in it.
X  `Sharp'   will sharpen any grey scale domain.
X  `Soft'    will soften any grey scale domain.
X  `Apply'   will make sure that the `View Small' image is up to date. This
X            image is only changed when the state of a cell is changed, thus it
X            may show the wrong colours if the colour of any state is changed.
X            Selecting this option will make Scamper go through the whole
X            `View Small' image updating the colour of each cell.
X  `Update'  This option allows the user to change the `Grey Scale Graph'.
X  `Undo'    This option makes Scamper attempt to undo the last built
X            in Cal program. The colours may not be returned to that of the
X            original image.
X
XLoading and executing rules
X---------------------------
X
XScamper can read Cal files (which contain both Cal rules and Cal commands).
XThere is a special option on the main menu for loading
Xthese files, called `Load Rules'. This option works in a similar way to that
Xof loading domains. Once rules have been loaded, and assuming that they
Xdo not contain their own execution commands, they can be executed by
Xselecting the `Run' option of the main menu (bottom left). Generations can
Xalso be    stepped  through by selecting the `Step' option. To stop a `run'
Xsimply select the `Stop' option (next to the `Run' option).
X
XTo clear the rules contained within Scamper, select the `Clear Rules' option
Xfrom the main menu, and to reset time (generations number) select the
X`Reset Time' option.
X
XStatistics
X----------
X
XScamper builds up statistics about generations which the user can view. This
Xis achieved by selecting the `View Stats' option from the main menu. When this
Xis first selected a graph will be displayed, giving the number of cells which
Xwere non-dead (in a state other than zero) over the generations that have
Xtaken place. This graph will be updated as soon as another generation takes
Xplace, so the user can watch this as they run their Cal programs. There
Xare three different graphs that can be displayed, and these are :
X
X  Total History   Gives the number of non-dead cells over time.
X  Last n          Gives the number of non-dead cells over the last n generations
X  Colour Density  Gives the density of each state (colour) in the current
X                  domain.
X
XThese three graphs can be selected by pressing the `Toggle Graph' option
Xwhich appears when ever a graph is displayed. This option will cycle through
Xthe possible graphs. Graphs 1 and 2 will show (at maximum) the history back
Xto either when Scamper was initiated, or the last `Reset Time'. The
Xnumber of generations shown in the second graph can be selected from the
X`Change Colours' option, and is set initially to 25.
X
END_OF_FILE
if test 16638 -ne `wc -c <'text/scamper.text'`; then
    echo shar: \"'text/scamper.text'\" unpacked with wrong size!
fi
# end of 'text/scamper.text'
fi
if test -f 'text/tech.text' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'text/tech.text'\"
else
echo shar: Extracting \"'text/tech.text'\" \(7343 characters\)
sed "s/^X//" >'text/tech.text' <<'END_OF_FILE'
XTechnical Information 
X---------------------
X
XThis chapter contains both technical information about Scamper and Cal, and
Xinstructions on how to change many of the features (for example the maximum
Xsize of the domain, the colours of menus, etc.).
X
XStructure of Scamper 
X--------------------
X
XScamper is written in C, and comes in 7 sections :
X
X  automata    The main section, contains main loop and most of the `options'
X              code.
X  domain      Loads and saves bitmaps and domains.
X  calscan     All procedures to scan a line of input text from a Cal file.
X  colour      Performs user selection of colours, and built in Cal programs.
X  rules       Adds, removes, and executes the Cal rules.
X  stats       Displays statistics about history of domain, and density of
X              domain.
X  windows     Creates and opens windows, performs colour allocation, font
X              selection, window selection, etc.
X
XEach section has a .c file and a .h file, and windows.c also has a non
Xexported header file (called curtains.h).
X
XChanging window colours 
X-----------------------
X
XA simple way exists to change the colours of all of Scamper's windows'
Xcolours (foreground and background) to those that the user prefers. Scamper
Xhas 11 defined `resources' specifying these colours. A resource is an X
Xwindows item which allows the specification of the `characteristics' of
Xprograms running under it. They are usually placed in a file in the users
Xhome directory, called `.Xdefaults'. The 11 resources specify the
Xforeground and background of 5 main windows, and the title of Scamper.
XThe resources are as follows :
X
X    background        Main menu background colour. 
X    foreground        Main menu foreground colour. 
X    domainbackground  The domain display background colour. 
X    domainforeground  The domain display foreground colour. 
X    verbalbackground  The message window background colour. 
X    verbalforeground  The message window foreground colour. 
X    filebackground    The file name window background colour. 
X    fileforeground    The file name window foreground colour. 
X    errorbackground   The error window background colour. 
X    errorforeground   The error window foreground colour. 
X    title             The colour that the title will `fade' to. 
X
XIf the user does not have the resources set up, then defaults are used
X(listed below). To set up the resources then the simplest way is to edit
X(or create) the `.Xdefaults' file and add the resources (in the way shown
Xbelow), then to initiate the resources type `xrdb  /.Xdefaults'.
XBelow is an example of what the resource file might contain, the colours
Xshown are the actual defaults that Scamper will use in the absence of
Xuser resources being specified.
X
X        Scamper*background: mediumblue
X        Scamper*foreground: green
X        Scamper*domainbackground: midnightblue
X        Scamper*domainforeground: white
X        Scamper*verbalbackground: mediumblue
X        Scamper*verbalforeground: yellow
X        Scamper*filebackground: mediumblue
X        Scamper*fileforeground: white
X        Scamper*errorbackground: red
X        Scamper*errorforeground: yellow
X        Scamper*title: aliceblue
X
XMemory 
X------
X
XCare should be taken, when using Scamper, that you do not allocate more
Xmemory than you require. Allocation takes place when the domain is
Xenlarged, but there is no deallocation when the domain is reduced (mainly
Xbecause deallocation *never* works). The reason for this warning is that
Xthe domain can take up quite a but of memory if it is too large.
X
XThere is a simple formula for working out the size of the domain (in bytes),
Xand that is :
X
X          x_size * y_size * 40 
X
XJust a small calculation shows that at 512 by 512 this takes up almost
X10.5 megabytes. Thus it is advisable to only use large domains when (a) it
Xis strictly necessary, and (b) when no one else is using the machine. All
Xassuming that the computer can cope with this sort of usage.
X
XThe maximum size of the domain can be altered by recompiling, after altering
Xtwo constants held in `automata.h' (MAX_X and MAX_Y).
XThe maximum number states can also be changed (max_states). The
Xmaximum domain size should only be increased if the host computer can cope
Xwith the memory usage.
X
XDroppings and Moths 
X-------------------
X
XThis section deals with Scamper running under X windows, and some of the
Xproblems that can occur due to bugs within some versions of X. Scamper
Xhas been tested using four different versions of the X windows :
X
X  - Sun 256 colour display
X  - Sun 2 colour display
X  - HP 64 colour display
X  - HP 2 colour display
X
XThe best performance was obtained when using the Sun 256 colour display as
Xall the colours that Scamper requested could be supplied. One problem when
Xusing the HP 64 colour display was that a saved domain with more than, about,
X50 colours would not appear properly when loaded. This is due to the fact that
XScamper's `Load Domain' needed a more general colour allocation routine
Xto that of, say, the grey scale colour allocation routine. The effect is that
Xa grey scale saved domain, when reloaded, may be displayed using colours
Xsuch as greens, yellows, etc. This problem can be overcome by `re-grey scaling'
Xthe image.
X
XTo avoid delays caused by repeated redraw events (X requesting Scamper's
Xwindows to be redrawn), the windows used are `backed up'. This can cause
Xproblems under older versions of HP-X as `droppings' can appear on the window
Xwhich can not be cleared. To get over this problem Scamper understands one
Xspecial key press (ctrl-R), and upon receiving this will redraw all
Xit's windows.
X
XAs with many X programs, Scamper does not scroll the domain properly
X(through no fault of it's own). The problem only occurs under HP-X (of the
Xones tested), and then only when any part of the domain is obscured by
Xanother window. To get over this problem it is advised to only use the domain
Xscrolling options when Scamper's window is at the front of the stack of
Xwindows.
X
XSpeed
X-----
X
XFor some applications Scamper may perform operations which the user does
Xnot necessarily require, which may slow down it's operation. The main operation
Xwhich Scamper performs which can delay operations (making them take up to
Xten times as long) is updating the `Small View' image. This image is stored
Xin a special X structure (called a pixmap) so that it can be displayed very
Xquickly (hence the reason for it being displayed much faster then simply
Xviewing the domain). The problem is that with every operation which changes
Xthe domain (running, grey scaling, loading domains, etc.) this structure
Xneeds to be updated, and this is takes some time.
X
XFor many operations the user may not wish to use the `Small View' image, and
Xthus this feature is unnecessary. It is, however, possible to switch off the
Xupdating of the image (the option is called `Update Small Image' on the
X`Change Colours' option of the main menu) and hence speed up the operation
Xof Scamper. It is always possible to `force' an update of the image by
Xselecting the `Apply' option. Thus it is possible to perform all intermediate
Xoperations at the fast speed, and then (only at the end) view the results.
X
XAnother place where speed is reduced is updating the `domain image'. To
Xavoid this delay simply run the rules without viewing the domain (ie. have the
Xfull main menu visible).
X
END_OF_FILE
if test 7343 -ne `wc -c <'text/tech.text'`; then
    echo shar: \"'text/tech.text'\" unpacked with wrong size!
fi
# end of 'text/tech.text'
fi
echo shar: End of shell archive.
exit 0
---- CUT HERE -------- CUT HERE -------- CUT HERE -------- CUT HERE ----


-- 
   _____            _____________________        Ian Palmer
  /_  _/           |                     |       Department of Computing,
   / /  ___        |                     |       Imperial College, 
  / /  / __\       | This space for rent |       180 Queen's Gate,
 /_/  / /          |                     |       London SW7 2BZ.
      \ \__        |_____________________|       
       \___/                 | |                 ijp@doc.ic.ac.uk
                            \|_|/                ijp=ack@doc.ic.ac.uk
  PANIC NOW
  and avoid       23. Add to Celt's pub meal and produce utter turmoil. (6,8)
  the rush.       -----------------------------------------------------------
"Benson, you are so free of the ravages of intelligence"
		-- Time Bandits

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.
