Making a Task

Program Structure

An SPP source file may contain any number of procedure declarations, zero or one task statements, any number of define or include statements, and any number of help text segments. By convention, global definitions and include file references should appear at the beginning of the file, followed by the task statement, if any, and the procedure declarations.

The task Statement

The task statement is used to make an IRAF task. That is, a command recognized in the cl as an executable program. Primarily, this is accomplished with the task statement, part of the SPP code. A file need not contain a task statement, and may not contain more than a single task statement. Files without task statements are separately compiled to produce object modules, which may subsequently be linked together to make a task, or which may be installed in a library. A single physical task (ptask) may contain one or more logical tasks (ltasks). These tasks need not be related. Several ltasks may be grouped together into a single ptask merely to save disk storage, or to minimize the overhead of task execution. Logical tasks should communicate with one another only via disk files, even if they reside in the same physical task.

task  ltask1, ltask2, ltask3 = proc3 
The task statement defines a set of ltasks, and associates each with a compiled procedure (see
Example 4.1). If only the name of the ltask is given in the task statement, the associated procedure is assumed to have the same name. A file may contain any number of ordinary procedures which are not associated (directly) with an ltask. The source for the procedure associated with a given ltask need not reside in the same file as the task statement. An ltask associated procedure must not have any arguments. An ltask procedure gets its parameters from the cl via the cl interface. Most commonly used are the clgetT() procedures. The clputT() procedures may be used to change the values of parameters.

An IRAF task be run by the cl or called from the command interpreter provided by the host operating system (the shell or DCL for example) without change. Parameter requests and I/O to the standard input and output will function properly in both cases. When running without the cl, of course, the interface is much more primitive. To run an IRAF task directly, without the cl begin by simply running the program. Such stand-alone operation is especially useful when debugging. The task will sense that it is being run without the cl and issue a prompt, see Example 4.2.

Every IRAF task has some special commands built in. The command ? will list the names of the ltasks recognized by the interpreter. The command bye is used to exit the interpreter, returning to the host command interpreter. To execute a host command at the > prompt, precede the command by an exclamation point (!).

The task Statement

Generated with CERN WebMaker