Tasks
Tasks in GIPSY are the application programs which do useful work for the user.
They consist of one or more processes (usually one) which communicate with
the user through a formalized collection of interface routines.
Because of the use of these interface routines, tasks can be run from any
version of Hermes. COLA- and
Python-scripts can also be started as tasks.
A list of currently available tasks can be found in a
separate document.
Running tasks
Tasks can be started with or without specifying parameters.
To start a task without parameters, only the name of the task needs to be
supplied.
taskname
To specify parameters, any number of keyword-value pairs separated
by blanks can be added to the taskname:
taskname keyword1=value1 keyword2=value2 ....
When running interactively, this format can also be used to supply
parameters to an already running task.
Tasknames may be preceded by an explicit directory. In this case, the task must
be present in the specified directory; the task path is not searched.
The directory may contain one or more environment variables
(indicated by a leading $-character).
If no explicit directory is specified, Hermes will search its
task path to find it.
Run again with same parameters (``macro'')
Tasks can be run again with (partly) the same parameters by prefixing the
task start command with an exclamation mark (!).
Any explicitly specified parameters will supersede the corresponding old
parameters. In this case the default file is not used.
For historical reasons the previous parameters of a task are called the
task's macro.
Run under a different name (``alias'')
Tasks can be run under a different name (``alias''). The command to do this is:
aliasname(filename) ...
Aliasname is the taskname under which the task will run and
filename is the name of the task's executable file, specified in the
correct case (lowercase for standard GIPSY tasks).
Parameters for a task are passed to it via keywords.
A keyword is a character string followed by an equal sign, e.g. INSET=.
Keyword names are case-insensitive, i.e. uppercase and lowercase letters
have the same meaning.
Parameters for a task can be specified in the command that starts the task and
thereafter at any moment while the task is active.
A task requiring input from the user causes Hermes to find out whether it has
already been specified and if not, prompt the user.
Before a parameter value is passed to a task, Hermes first checks whether it
meets the task's request and if not, Hermes rejects that value and prompts
again.
As the execution of the task
proceeds, Hermes builds up a table of the task's keywords and associated
values.
At task termination this table is saved in order to allow the user to
run the task again with (partly) the same parameters.
When running interactively, a task's set of user inputs can be
monitored,
saved to a file, or
edited.
Three classes of keywords are recognized:
-
Forced, which are keywords for which no task default is allowed.
The user must respond to the prompt with a correct value.
-
Defaulted,
which are keywords which have a default value defined by the
task. If the keyword has not already been specified then the user
will be prompted.
If on this occasion the user types only a RETURN, this
signifies that the task default is acceptable and should be used. Any
other input will override the default.
-
Hidden,
which are keywords for which the user is not prompted and
which have a default value defined by the task.
They can be specified by unprompted input by the user.
The documentation of a task must be read to find out if it uses
hidden keywords.
The user can set a parameter in the task context to change requests
for hidden keywords into requests for defaulted keywords.
(``Unhide'' hidden
keywords.)
Hidden keywords are sometimes used to control looping in a task.
Each cycle round the loop, the task requests the value of a hidden keyword.
If it has not been specified, the task takes the default and looping continues.
If the user defines the keyword then that value is sent to the task which
could cause the task to terminate the loop.
It is possible to pre-specify the input for
a keyword that is requested repeatedly.
This can be done on the command line or by using a `recall file'.
Keywords can be prespecified in a text file with a name like
``name.def'', where name is the name of a task.
This default file can contain any
number of keyword= value pairs.
Any user supplied parameters will supersede those obtained from a default file.
The name of the task determines which default file will be read, not
the name of the executable. This has consequences (and possibilities) for tasks
which are run under an alias name.
It is also possible to specify defaults to be used by every task. For this
purpose the file tasks.def us used. Such global defaults have
a limited use. The keyword GGIOPT=, used by tasks with a graphical user
interface, is an example.
Default files can reside in both the current working directory and
the directory .gipsy under the user's
login directory. Keywords from default files in the working directory supersede
identical keywords from the .gipsy directory.
And keywords from task-specific
default files supersede identical global keywords.
User input formats
Basically Hermes is capable of providing tasks with the following types of
parameters:
numbers (integers, reals and double precision reals),
logicals and
character strings.
Tasks may however request input in the form of character strings and perform
their own decoding to obtain numerical information.
One parameter value can contain one or more elements.
Tasks all run in a context. This context consists of a number of
user-settable parameters:
-
Error level. If a task generates an error at or above the current error level,
Hermes will abort the task. Default: 4.
-
Message level. If a task generates an error at or above the current message
level,
Hermes will display the associated error message. Default: 1.
-
Output mode. This parameter determines whether test messages from tasks will be
displayed and whether messages unnecessary for experienced users will be
suppressed. Default: ``NORMAL''.
-
Device status. Two parameters indicating whether messages sent to either the
screen or the log file will actually be written.
Default: screen ``ON'' and log file ``ON''.
-
Hide status. This parameter determines whether ``hidden'' user input requests
from the task will cause the user to be prompted anyway. Default: ``ON'',
i.e. the user will not be prompted for hidden keywords.
-
Working directory. Default: the directory from which Hermes was started.
The directory of running tasks cannot be changed.
Tasks normally inherit their context from a template context. If a task is
started by an other task, it inherits the context of that task.
When running interactively,
both the template context and the context of any running task can be
changed by the user.
When Hermes is started, the template context contains the sensible defaults
listed above, possibly modified by parameters from the Hermes
defaults file.