Language Syntax

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.



Include Files

Include files permit an external file to be inserted into SPP code. They are referenced at the beginning of a file to include global definitions that must be shared among separately compiled files, and within procedures to reference common block definitions. Two forms allow for system-defined includes or user-defined includes. The include statement is effectively replaced by the contents of the named file. Includes may be nested at least five deep. The most common uses for include files are macro definitions and structure declarations to be shared by several source files comprising a task. The name of the file to be included must be delimited by either angle brackets (<file>) or quotation marks ("file"). The first form is used to reference the IRAF system include files. This includes external packages such as STSDAS if these are installed. The second, more general, form may be used to include any file. The file name may include an absolute or relative directory path. However, the safest and most portable method of accessing include files in SPP source is to have the source and include files in the same directory. You then need only refer to the file itself in the include statement without any absolute or relative directory information.

Help Text

Documentation may be embedded in an SPP source file either by commenting out the lines of text using the # character or by enclosing the lines of text within .help and .endhelp directives. If there are only a few lines of text, it is probably most convenient to comment them out. Large blocks of text should be enclosed by the help directives, making the text easier to edit, and accessible to the on-line documentation and text processing tools.

Figure 1.3: Commenting out Documentation Blocks.

The preprocessor ignores comments, and everything between .help and .endhelp directives. The directives must occur at the beginning of a line to be recognized. In both cases, the preprocessor ignores the remainder of the line. The arguments to .help are used by the help cl utility, but are ignored by SPP. Help text may be typed in as it is to appear on the terminal or printer, or it may contain text processing directives. See the cl lroff documentation for a description of the IRAF text processing directives. Manual pages (help text) for tasks may be stored either directly in the source file as help text segments, or in separate files. If separate source and help files are used, both files conventionally have the same root name, and the help text file should have the extension .hlp.

The task Statement

The task statement is used to make an IRAF task. 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. An executable program requires a task statement, although it may be in a file by itself. This is then linked with the other procedures making up the task.

task ltask1, ltask2, ltask3=proc3

If the task name is identical to the main procedure of the task, then only the task name needs to be in the task statement. The main procedure may have a different name, however. In this case, the procedure name must be specified in the task statement with an assignment.

Include Files
Help Text
Figure 1.3: - Commenting out Documentation Blocks.
The task Statement

Generated with CERN WebMaker