VMS Help  —  MACRO  /ALPHA  Directives  .IRP
    Indefinite repeat argument directive

    Format

      .IRP  symbol,<argument list>

         .

         .

         .

      range

         .

         .

         .

      .ENDR

1  –  Parameters

 symbol

    A formal argument that is successively replaced with the
    specified actual arguments enclosed in angle brackets (<>).  If
    no formal argument is specified, the assembler displays an error
    message.

 <argument list>

    A list of actual arguments enclosed in angle brackets and used
    in expanding the indefinite repeat range. An actual argument
    can consist of one or more characters. Multiple arguments must
    be separated by a legal separator (comma, space, or tab). If no
    actual arguments are specified, no action is taken.

 range

    The block of source text to be repeated once for each occurrence
    of an actual argument in the list. The range can contain macro
    definitions and repeat ranges. .MEXIT is legal within the range
    and causes the current and remaining repetitions to be aborted.

2  –  Description

    .IRP replaces a formal argument with successive actual arguments
    specified in an argument list. This replacement process occurs
    during the expansion of the indefinite repeat block range. The
    .ENDR directive specifies the end of the range.

    .IRP is similar to a macro definition with only one formal
    argument. At each successive expansion of the repeat block, this
    formal argument is replaced with successive elements from the
    argument list. The directive and its range are coded in line
    within the source program. This type of macro definition and
    its range do not require calling the macro by name, as do other
    macros described in this section.

    .IRP can appear either inside or outside another macro
    definition, indefinite repeat block, or repeat block (see the
    description of .REPEAT). The rules for specifying .IRP arguments
    are the same as those for specifying macro arguments.

3  –  Example

      The macro definition is as follows:

        .macro CHECK_PROCEDURE_KIND PROCEDURE_KIND
            OK = 0      ; Assume procedure_kind is unknown
            .irp REFERENCE_KIND,BOUND,NULL, REGISTER,STACK
                .if identical, <PROCEDURE_KIND>, <REFERENCE_KIND>
                    OK = 1 ; Procedure_kind is known
                    .mexit ; No need to look further
                .endc
            .endr
            .if eq, OK  ; If unknown procedure kind
                .error "Unknown procedure kind: PROCEDURE_KIND"
            .endc
        .endm CHECK_PROCEDURE_KIND

        CHECK_PROCEDURE_KIND REGISTER
        CHECK_PROCEDURE_KIND FOOZLE

      The macro call and expansion of the previously defined macro is
      as follows:

        CHECK_PROCEDURE_KIND REGISTER
            OK = 0      ; Assume procedure kind is unknown
            .if identical,<REGISTER>,<BOUND>
            .endc
            .if identical,<REGISTER>,<NULL>
            .endc
            .if identical,<REGISTER>,<REGISTER>
                OK = 1 ; Procedure kind is known
                .mexit ; No need to look further
            .if eq, OK  ; If unknown procedure kind
            .endc

        CHECK_PROCEDURE_KIND FOOZLE
            OK = 0      ; Assume procedure kind is unknown
            .if identical,<FOOZLE>,<BOUND>
            .endc
            .if identical,<FOOZLE>,<NULL>
            .endc
            .if identical,<FOOZLE>,<REGISTER>
            .endc
            .if identical,<FOOZLE>,<STACK>
            .endc
            .if eq, OK  ; If unknown procedure kind
                .error "Unknown procedure kind: FOOZLE"
            .endc

      In this example the CHECK_PROCEDURE_KIND macro uses the
      .IRP directive to iterate over a list of reference keywords
      to determine if its argument matches one of the reference
      keywords. If a match is not found, the macro displays an error
      message.
Close Help