Index

cancel name

Terminate a specified user-defined command.

Mandatory arguments:
Keyword name
The name of the user-defined command to be canceled.

Example:
In the following example, an observer uses the cancel command to terminate a user-defined command called foo. If such a command is currently running, then this makes the command end, as though the command had executed a return command. If the section of the script that was running foo is enclosed in a catch statement that uses the $aborted() function, then the rest of that section of the script is also terminated.
 cancel foo

Context:
It is sometimes useful to an observer to be able to interactively terminate part of a scheduling script, without aborting the whole script. The cancel command facilitates this, provided that the schedule is written such that the statements of each part that might need to be terminated interactively, are encapsulated in individual user-defined commands. In cases where terminating a particular command makes other surrounding commands meaningless, the schedule writer can also arrange to terminate those surrounding commands, by enclosing them within a catch statement whose termination clause returns true when the aborted() function returns true.

Note that any user-defined commands that are aborted in this way, run any termination cleanup statements that were previously registered to them by at_end commands.


Martin Shepherd (18-May-2010)