next up previous 204
Next: Comments Within Group Expressions
Up: Group Expressions
Previous: Nesting Within Group Expressions


Flagging a Group Expression

GRP allows a group expression to be flagged by terminating it with a ``flag'' character (usually a minus sign although this can be changed, see section [*]). If the last character in the group expression is a flag character, then the FLAG argument of routine GRP_GROUP is returned true. The flag character is stripped off the group expression before it is split up into elements, so the flag character itself does not get included in any of the names stored in the group.

A typical use of this facility might be to allow the user to request a further prompt for more names. For instance, in the example of section [*], the user may wish to specify more input file names than will fit on a single line. To allow this, the call to GRP_GROUP would be replaced with the following:

*  Loop round, prompting the user for group expressions
*  until one is found without a minus sign at the end, or an
*  error occurs.
      FLAG = .TRUE.
      DO WHILE( FLAG .AND. STATUS .EQ. SAI__OK )
         CALL GRP_GROUP( 'IN_FILES', GRP__NOID, IGRP1, SIZE1,
     :                   ADDED, FLAG, STATUS )

*  Cancel the parameter association to get a new group
*  expression on the next call to GRP_GROUP.
         CALL PAR_CANCL( 'IN_FILES', STATUS )

      END DO

The user could then request a further prompt by appending a minus sign to the end of the group expression, as follows:

      NEW_FILE,A_*2|RAW|FLAT|,^LIST.DAT-

The names obtained at each prompt are appended to the end of the group, which expands as necessary.

Note, if the final element in a group expression is an indirection element, the flag character may be placed at the end of the last record in the indicated text file. For instance, instead of giving:

      ^LIST.DAT-

where the file LIST.DAT contains the single record

      RED,GREEN,BLUE

a user could ``hard-wire'' a flag character on to the end of LIST.DAT so that it contains:

      RED,GREEN,BLUE-


next up previous 204
Next: Comments Within Group Expressions
Up: Group Expressions
Previous: Nesting Within Group Expressions

GRP Routines for Managing Groups of Objects
Starlink User Note 150
D.S. Berry
21st October 2009
E-mail:ussc@star.rl.ac.uk

Copyright © 2009 Science and Technology Facilities Council