Mail to EE

EETransfer Programmer's Guide

Off-line documentation


On-line Documentation
An Introduction to the script engine

ConnectAppleTalk
ConnectIrDA
ConnectModem
ConnectSerial
For
ForEachItemRequest
ForEachReadyItem
ForEachRemoteItem
ReceiveRaw
ReceiveXModem


ReceiveZModem
Resume
SendATEscape
SendRaw
SendString
SendXModem
SendZModem
Try
WaitForLine
WaitForString

An Introduction to the script engine

An instruction can be either:

* a frame with a slot toolSymbol, whose value is a symbol which identifies the instruction
* an array of instructions, which indicates a sequence of instructions
* nil, which is a no-operation instruction
* a function with no argument which returns an instruction
* one of the following symbols: 'ok, 'warning, 'error, 'cancelled

'ok Indicates that the script has not encountered any problem (yet), so its execution can continue (same as nil).
'warning Indicates that a minor error has occured. The currently executing instruction sequence is aborted and the execution resumes at the first enclosing "Try" instruction with a "warning" option (see the "Try" instruction).
'error Indicates that a critical error has occured. the currently executing instruction sequence is aborted and the execution resumes at the first enclosing "Try" instruction with an "error" option (see the "Try" instruction).
'cancelled Indicates that the script execution has been cancelled. the currently executing instruction sequence is aborted and the execution resumes at the first enclosing "Try" instruction with an "cancelled" option (see the "Try" instruction).

When an instruction frame is executed, all the slots contained in the frame are used as parameters for the instruction. Each of the slot defined in the frame of global variables is also used as a parameter (unless a slot with the same name is already defined in the instruction frame).
When the instruction frame execution ends, all the slots defined in the frame of global variables are set to their new value.

An instruction frame can optionaly contain a special slot named "globalSymbols". This slot must be a frame of slots whose values are symbols. Each of these slots corresponds to a parameter for the instruction. The name of the parameter is the slot name; the value of the parameter is the global variable whose name is the slot value.
If the slot "globalSymbols" is defined, only the global variables whose name are in the "globalSymbols" frame are used as parameters for the instruction. The other global variables are not used as parameters. So, if an instruction contains a "globalSymbols" slot, it must contains all the global variables used by that instruction.

For an example of using global variables, consider the following script:

globals: {

	connectionTool: nil,	// Set by the ConnectSerial instruction

	endpoint: nil,			// Set by the ConnectSerial instruction

	transport: nil,			// Set by EETransfer at the script startup

	},

instruction: [

		{

		toolSymbol: 'ConnectSerial,

		bps: k9600bps,

		globalSymbols: {

					endpoint: 'endpoint,

					machine: 'connectionTool,

					transport: 'transport,

				},

		},

		...

		{

			toolSymbol: 'Resume,

			globalSymbols: {

					machine: 'connectionTool,

				},

		},

	]



The first instruction frame tells the transport defined in the global variable "transport" (ie EETransfer) to launch a serial connection at 9600 bps. When the Newton is connected, the instruction pauses, and the value of the "machine" slot (which contains the state of the instruction) is copied into the global variable "connectionTool". In the same way, the value of the "endpoint" slot (which contains the endpoint created for the connection) is copied into the global variable "endpoint".

The last instruction frame executes the "Resume" instruction with a single parameter. This parameter is named "machine" and its value is the value of the global variable "connectionTool". So this instruction resumes the previously paused "ConnectSerial" instruction, which has the effect of closing the serial connection.

Note: When a script execution ends, all the paused instructions are automatically resumed. So the following example is better way to do the same thing as the previous script.

globals: {

		endpoint: nil,			// Set by the ConnectSerial instruction

		transport: nil,			// Set by EETransfer at the script startup

		},

instruction: [

		{

		toolSymbol: 'ConnectSerial,

		bps: k9600bps,

		},

		...

	]

©1997 Easter-eggs
All trademarks mentioned are the property of their respective owners