
Type Creation operators

Mark arg1 .. argn  *]* array	Create an array of the items popped off the
				stack down to the closest mark.
arg *expand* array		Convert points, vectors, xforms and
				surfaces to arrays of reals.
x y z *point* point		Create a point.
x y z w *point4* point		Create an homogeneous point
- *surface* surf		Create a default surface, with all values
				set to 0.
t11 t12 t13 t21 t22 t23 t31 t32 t33 t41 t42 t43 *xform* transform
				Create a transformation matrix.
x y z *vector* vector		Create a vector.


Arrays

array n *get* array value	Get the value at nth position in array.  First
				position is numbered 1.
array value n *put* array	Replace the entry at nth position in array
				with the value.

Blocks

d1 .. dk k "type" *block* block Create a block with k dimensions, of type
				"byte", "integer" or "real"
block *dims* d1 .. dk k		Get size info from a block
i1 .. ik block *fetch* value	Get a block entry
i1 .. ik value block *store*    Put a value into a block entry

Arithmetic

arg1 arg2 *add* result		Perform addition on points, reals, integers and
				vectors.
ratio *atan* angle		Calculate inverse tangent, return angle in 
				radians.
angle *cos* value		Compute the cosine of an angle.
arg1 arg2 *div* result		Divide things: ints, reals and vector by 
				scalars.
real *floor* int		Return closest integer less than the value.
v *length* value		Compute length of a vector.
arg1 arg2 *mod* result		Return arg1 integer mod arg2.
arg1 arg2 *mul* result		Multiply scalars and scalars times vectors.
v *normalize* vhat		Normalize a vector
base exp *pow* value		Raise a real to a real power.
- *random* value		Return uniform real random variate between
				0 and 1.
radians *sin* value		Compute sin function.
real *sqrt* value		Compute the square root.
arg1 arg2 *sub* result		Perform subtraction on points, reals, integers
				and vectors.


Boolean

bool1 bool2 *and* bool		Logical and on booleans.
arg1 arg2 *eq* bool		Compare two numbers for equality.
arg1 arg2 *ge* bool		Compare two numbers, return arg1 >= arg2.
arg1 arg2 *gt* bool		Compare two numbers, return arg1 >  arg2.
arg1 arg2 *le* bool		Compare two numbers, return arg1 <= arg2.
arg1 arg2 *lt* bool		Compare two numbers, return arg1 <  arg2.
arg1 arg2 *ne* bool		Compare two numbers for inequality.
bool1 *not* bool2		Logical not.
n *odd* bool			Return true if number is odd.
bool1 bool2 *or* bool		Logical or.

Lighting Parameters

real *ambient* -		Set the level of ambient lighting
r g b *background* -		Set the background color.
point intensity *lightsource* -	Create a point source with intensity i.

CSG

CSGObject transform codebody boolean *carve* CSGObject		
					Associate a CSG tree with a texture
					function and mapping into texture 
					space.  The boolean tells the lighting
					model whether to treat this object
					as an emitter.
CSGPrimitive *hollow* CSGPrimitive	Set flag that indicates that the
					primitive should be rendered as a 
					surface.
transform *cone* CSGObject		Create a CSG primitive object.
transform *cube* CSGObject		Create a CSG primitive object.
transform *cylinder* CSGObject		Create a CSG primitive object.
transform *halfspace* CSGObject		Create a CSG primitive object.
transform array mesh_option *mesh* CSGObject	
					Create a CSG primitive object.
transform *sphere* CSGObject		Create a CSG primitive object.
transform ratio *torus* CSGObject	Create a CSG primitive object.
transform CSGObject *apply* CSGObject	Change a CSG object's top level
					transformation matrix.


CSGObject CSGObject transform *difference* CSGObject
					Create a composite CSG object.
CSGObject CSGObject transform *intersection* CSGObject
					Create a composite CSG object.
CSGObject CSGObject transform *union* CSGObject
					Create a composite CSG object.

Files

"filename" "mode" *open* file		Just like fopen().
file *close*				Close a file.
file *readwff* block			Read I, RGB or RGBA wff files into
					2- or 3-dimensional byte blocks.
file block *writewff*			Write I, RGB or RGBA wff files.


Viewing Parameters and Scene creation

length *distance* -		Set the distance to the viewing plane
point *eyepoint* -		Set the view point.
CSGObject *instance* -		Copy the CSG tree onto the instance list.
number *lensfocallength* -	Set the lens focal length.
- *pscene* -			Print a scene description
vector *upvector* -		Set the up direction.
vector *viewdirection* -	Set the viewing direction.

Surfaces

real surf1 surf2 *combine* surf		Create a combination of two 
					surfaces.
surf *get-diffuse* r g b		Get the value of the diffuse surface 
					parameter.
surf *get-emittance* r g b		Ditto for emittance.
surf *get-reflectance* r g b		Ditto.
surf *get-transmittance* r g b		Ditto.
surf *get-specular* r g b		Ditto.
surf *get-phong* n			Get the phong coefficient.

surf r g b *set-diffuse* surf		Set the value of the diffuse param.
surf r g b *set-emittance* surf		Ditto for emittance.
surf r g b *set-reflectance* surf	Ditto.
surf r g b *set-transmittance* surf	Ditto.
surf r g b *set-specular* surf		Ditto.
surf n *set-phong* surf			Set the phong coefficient.

r g b *rgb-to-hsl* h s l		Convert from RGB to HSL color space.
h s l *hsl-to-rgb* r g b		Convert from HSL to RGB color space.

Miscellaneous

name any *def* -			Enter a name in the dictionary.
any *eval* depends			Evaluate token at top of stack.
string *evalstring* depends		Parse and evaluate a string.
any *exec* depends			Execute token at top of stack.
point *noise* value			Get noise value at point.
any *pop* -				Remove value from top of stack.
- *quit* -				Quit the interpreter.
string *run* depends			Parse and execute the named file.
point pixelsize *turbulence* value	Compute the value of the turbulence 
					function.

Output

string *print* -			Print a string, no newline
string *println* -			Print a string & newline.
- *prompt* -				Print the prompt.
- *pstack* - 				Print out what's on the stack.
- *ptop* -				Print what's on the top of the stack.


Control structures

bool codebody *if* depends	If bool is true, execute the code body.
bool cb1 cb2 *ifelse* depends	If bool is true, execute cb1.  Otherwise
				execute cb2.
testproc bodyproc *while* 	While testproc returns true, execute bodyproc.


Stack Operations

any *dup* any any			Duplicate the top of the stack, so
					you end up with two pointers to the
					same token.
any *copy* any any1			Duplicate the token at the top of
					the stack, so you get pointers to
					two tokens with identical contents.
any1 any2 *exch* any2 any1		Swap the two things at the top of the 
					stack.


