next up previous 210
Next: Interpretation of ARD Descriptions
Up: ARD Description Syntax
Previous: Group Expression Control Characters


Use of GRP Modification Elements

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:

      CIRCLE( 0, 10, 10 ) .OR. CIRCLE( 0, -10, 10 )

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:

      ( * ) .AND. BOX( 0, 0, 5, 5 )

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:

      ( CIRCLE( 0, 10, 10 ) .OR. CIRCLE( 0, -10, 10 ) ) .AND. BOX( 0, 0, 5, 5 )

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:

      CIRCLE( 0, 10, 10 ) .OR.
      CIRCLE( 0, -10, 10 )

then the modified ARD description would be :

      ( CIRCLE( 0, 10, 10 ) .OR. ) .AND. BOX( 0, 0, 5, 5 )
      ( CIRCLE( 0, -10, 10 ) ) .AND. BOX( 0, 0, 5, 5 )

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:

      ( *|10|5| ) .AND. BOX( 0, 0, 5, 5 )

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:

      ( CIRCLE( 0, 5, 5 ) .OR. CIRCLE( 0, -5, 5 ) ) .AND. BOX( 0, 0, 5, 5 )

The syntax of such modification elements is described fully in SUN/150.


next up previous 210
Next: Interpretation of ARD Descriptions
Up: ARD Description Syntax
Previous: Group Expression Control Characters

ARD A Textual Language for Describing Regions within a Data Array
Starlink User Note 183
D.S. Berry
2nd October 2007
E-mail:starlink@jiscmail.ac.uk

Copyright © 2013 Science and Technology Facilities Council