[SESI logo]

Prisms Development Toolkit Documentation

Side Effects Software Inc. 1997

Custom SOPs

Sopbuild version 0.75

sopbuild takes an ascii control file, and produces the bare-bones of a sop c-code file. This c file is then modified by the programmer and used with the custom command to produce a custom sop.

The purpose of sopbuild is to speed up the process of creating custom sop code, and to eliminate common errors - it lets the sop builder concentrate on the sop itself, rather than the syntax.

To use it, the command is:
% sopbuild infile [outfile]

If outfile is present, the result of sopbuild is placed in outfile.c Otherwise, default behavior (defined below) holds. The syntax of the infile is:
command [-n name] [-l label] [-f flagchar] [-s string] [-d default values]
where command can be one of
name
help
geoinput
singlein
doublein
triplein
toggle
menu
file
localvar

Commands must occupy a single line each. The definition of each command is as follows:
if name is present, this sets the name of the sop, as well as the name of the output file. For example,
name -n wave
creates a file called wave.c, containing code for a sop called wave. For name, only the -n flag has meaning.

help tells sopbuild where to find another ascii file containg the text of the sop's help screen. The usage is help -n helpfile
where helpfile might contain the following (without quotes):
"This sop does wonderful things.
Center - the center of wonderfulness
Height - how wonderful it is"
For help, only the -n flag has meaning.

geoinput defines a geometric input to the sop. Most sops modify incoming geometry - this defines where that geometry comes from. Possible values are

-n name		This will name the input INTERNALLY TO THE SOP
		If no name is set, sopbuild supplies one.
-l label	This will label the input for the sop user
		If no label is set, it defaults to being a copy of
		the name string.
-d default	possible values are 	SOURCE_NULL
					SOURCE_PREV
				        SOURCE_2BACK
				        SOURCE_FIRST
-f flagchar	Sets the command line argument flag used with the sop.
		For example, the box sop has a -c flag, which defines
		the center of the box; it is used as sbox -c 0 0 0
		For the custom sop, the flagchar can be any of the
		legal characters. If an illegal character is chosen,
		sopbuild rejects it and supplies a legal one. 
		If no flag is set, sopbuild supplies one.
For geoinput, the -s flag has no meaning.

singlein doublein triplein define slider numeric inputs. Most sops allow the user to adjust certain parameters to alter the geometry. These can either be 1, 2 or 3 values on a 'line' in the sop. Possible arguments to these three are -n name as for geoinput -l label as for geoinput -d default followed by the appropriate number of default values. For example, triplein -d 1 2 3 -f flagchar as for geoinput For these inputs, the -s flag has no meaning.

toggle defines a clickbox which is either selected or not. This allows binary choices for the sop user. Possible values are -n name as for geoinput -l label as for geoinput -f flagchar as for geoinput -s string The string which appears in the checkbox. The string is a series of alphanumeric characters enclosed in double quotes ("). The string does not understand escape characters. For toggle, the -d flag has no meaning.

menu defines a multi-choice menu for the user. Possible values are -n name as for geoinput -l label as for geoinput -f flagchar as for geoinput -s string The string defines the possible menu choices. Each choice must be a single 'word', that is, contain no spaces. The choices are separated by spaces. The entire string is enclosed in double quotes ("). For menu, the -d flag has no meaning. The default menu choice is the first one listed in the string.

file defines a file input chooser for the user. Possible values are -n name as for geoinput -l label as for geoinput -f flagchar as for geoinput -d default followed by a string, representing the default file name. For this input, the -s flag has no meaning.

localvar defines a local variable for the sop. To have multiple local variables, use multiple calls to localvar. Possible values are -n name the internal name of the variable -l label the name the user sees (eg, PT in the point sop). The other flags have no meaning for localvar. Example:

Example: A file called input, containing the following lines:
name -n wave
help -n helpfile
geoinput -n source -l "Source Grid"
triplein -n center -f C -d 0 0 0
singlein -n amplitude -l "height" -d 1 -f a
singlein -n phase -l "frequency" -d 1 -f p
singlein -n offset -d $F/10 -f O
menu -n plane -s "xz xy zy"

and used as
sopbuild input
would produce a file called wave.c, which creates a sop which looks like this:

The sop would do nothing - the user still has to supply the code to actually create or modify geometry.


Tookit Overview
Expression Functions | User Functions | Custom SOPs
Prisms Internal Format | Programmer's Reference
Compiling SOPs | Using sopbuild | SOP Routine Reference
Dynamic SOPs | Prisms Types | Macros
Math Routines | Data Routines | Polygon Routines | Winged-edge Routines

Copyright © 1997 Side Effects Software Inc.
477 Richmond Street West, Toronto, Ontario, Canada M5V 3E7