Copyright ã 1994 by Sean Luke

COWS.palette
COWS Version 1.4
May 20, 1994

The COWS Palette contains palettized objects common for setting up a COWS application.  You load the palette into Interface Builder and let it rip!  To use these or any COWS objects in an application, be sure to include the COWS subproject (in the Subprojects directory) in your project.

Interpreter

The COWS Interpreter is the central object in COWS, since it is the interpreter's job to interpret user-created COWS scripts.  On the palette, the interpreter doesn't fill a central role, thoughÐit's hooked into the system through one of the two controllers.

Controller

If you wanted to create an application that automatically ran some script without the user telling to start or stop, you'd use the Controller to control your interpreter.  The controller:

	´	Sets up the interpreter and libraries
	´	Runs a program.
	
To hook the controller up, connect the interpreter to its interpreter outlet and all of your libraries to its library outlets (which doesn't matter, though it loads them in order).  Then connect a scrollview containing a text object (one's provided in Interface Builder's standard palettes) to the controller's program outlet.  If you have a program you want to run (you're not running just a library function), put it in the text object.

In the controller's inspector, you can define what function you want to call, the arguments to the function, and whether you want to automatically load the program, or automatically load and run the function.  You can also indicate what mode you want the interpreter to run in (foreground or background), if you want the interpreter to be locked from outside IPC access, and how fast it should run in background mode (timed entries).

Controllers start up automatically when they receive the awakeFromNib: notification when an application launches.  But Interface Builder won't provide this notification in test mode, so you must jump-start a controller in IB test mode.  The controller provides the start: method to do thisÐyou could, for example, hook a button to this, and press the button while in test mode.  An example nib file is supplied to show how this jump-starting can work.

As an example, look at Mac.app's nib file.

User Controller and COWSControlPanel

If you want to set up a COWS program where the user can start and stop macros as he likes, you'd use the COWS User Controller and COWSControlPanel (the window below the User Controller on the palette).  You connect the User Controller exactly like a Controller (see above), except that you also need to connect a COWSControlPanel to the User Controller's controlPanel outlet.

Because the User Controller allows the user to set up and run functions, many options are moved from Interface Builder's inspector to the Control Panel.  But you can still define the default locked/unlocked state of the interpreter, what mode it runs in, and how fast it runs in background mode off a timed entry.

Like the Controller, the User Controller also needs a jump-start if you plan to use it in Interface Builder's test mode.

See COWS.app's nib file or Fred's nib file for examples on how to use the User Control and Control Panel.

Libraries

COWS is pretty useless without COWS function libraries.  The COWS Palette supplies six libraries:

	The Standard Library, a collection of fundamental COWS functions
	A simple Math Library
	A simple String Library
	An Array Library
	The COWS IPC Library, which allows inter-application communication
		using NeXT Distributed Objects
	An experimental System Library of common useful system functions.
	
These libraries are documented elsewhere.  Each is connected to a Controller or User Controller by hooking it directly to one of  the Controller's library outlets.