An ARD description consists of a stream of fields, optionally separated by one or more spaces, or tabs. There are three types of fields:
Some keyword and statement fields require argument lists, and these are enclosed within parentheses following the keyword or statement. Arguments are delimited by commas.
keywords and statements can be abbreviated to three characters (operators cannot be abbreviated). ARD descriptions are case-insensitive, and white space (eg spaces, blank records in a file, blank group expressions) is ignored.
An ARD description is basically an algebraic expression in which the operators are logical operators (.AND., .OR., etc.) and the operands are represented by keywords (CIRCLE, BOX, etc.) which notionally take true or false values depending on whether or not the current pixel is inside or outside the specified region. Therefore, all the usual restrictions exist on the placing of operators and operands in algebraic expressions; binary operators (e.g. .AND.) must have an operand or bracketed expression on each side, unary operators (e.g. .NOT.) must be followed by an operand or bracketed expression, opening and closing parentheses must balance, etc.
There are, however, certain ways in which an ARD description can depart from this syntax:
This is effectively equivalent to:
The returned integer mask will contain positive values within the union of the three regions, and zero outside.
The returned mask will contain positive values for all pixels which are either within the polygon, or are not within the ellipse, or are not within the circle. It may need to be emphasised here that .OR. operators are inserted and not .AND. operators.
The following two sub-sections supply details of the interaction of ARD with the GRP package, and may safely be skipped over on an initial reading through this document.
The stream of ARD fields is supplied in the form of a GRP group expression (and stored in a normal GRP group) with the following control characters (see SUN/150):
A complete ARD description can be broken across several lines of an indirection file, or across several directly supplied group expressions (each one terminated with the flag character “-”). However, breaks must occur either between fields or between values in a keyword or statement argument list.
The GRP system provides a facility which allows a user to modify the contents of a group previously created by the calling application. To do this, a “modification element” is included in the supplied ARD description (or “group expression” to use GRP parlance). A GRP identifier for an existing group can be supplied to the routines ARD_GROUP and ARD_GRPEX (argument IGRP1). If the ARD description supplied by the user contains a modification element, then the contents of the group identified by IGRP1 will be modified according to the instructions in the modification element, and the results incorporated into the returned group. Note, the specified editing is applied separately to each element in the existing group, to produce the corresponding element for the new group. Elements are delimited in ARD descriptions by the “;” character, and by carriage returns.
For instance, suppose that the application has already created a group containing the following ARD description:
If the GRP identifier for this group is supplied as argument IGRP1 to routine ARD_GROUP, the user may supply an ARD description including a modification element such as:
The asterisk is replaced in turn by each element of the contents of the group identified by IGRP1 (the “basis” group). Thus, the above ARD description is equivalent to the following:
Note, the original ARD description was supplied on a single line, and was thus stored as a single element in the group. If it had spanned lines, then each line would have been edited separately. For instance, if the original ARD description had been supplied as follows, on two lines:
then the modified ARD description would be :
This group expression would not be accepted by ARD_WORK because of the missing operand after the .OR. operator.
If the user has supplied the ARD description on a single line, and then modified it using the following ARD description:
then the basis group would be edited by replacing all occurrences of the string “10” by the string “5”, before being included in the final ARD description. Thus the above would be equivalent to:
The syntax of such modification elements is described fully in SUN/150.