VMS Help  —  MACRO  /ALPHA  Directives  .IRPC
    Indefinite repeat character directive

    Format

      .IRPC  symbol,<STRING>

         .

         .

         .

      range

         .

         .

         .

      .ENDR

1  –  Parameters

 symbol

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

 <STRING>

    A sequence of characters enclosed in angle brackets and used in
    the expansion of the indefinite repeat range. Although the angle
    brackets are required only when the string contains separating
    characters, their use is recommended for legibility.

 range

    The block of source text to be repeated once for each occurrence
    of a character in the list. The range can contain macro
    definitions and repeat ranges. .MEXIT is legal within the range.

2  –  Description

    .IRPC is similar to .IRP except that .IRPC permits single-
    character substitution rather than argument substitution. On each
    iteration of the indefinite repeat range, the formal argument is
    replaced with each successive character in the specified string.
    The .ENDR directive specifies the end of the range.

    .IRPC is similar to a macro definition with only one formal
    argument. At each expansion of the repeat block, this formal
    argument is replaced with successive characters from the actual
    argument string. The directive and its range are coded in line
    within the source program and do not require calling the macro by
    name.

    .IRPC can appear either inside or outside another macro
    definition, indefinite repeat block, or repeat block (see
    description of .REPEAT).

3  –  Example

      The macro definition is as follows:

            .macro X_COUNT ARG
                COUNT = 0
                .irpc CH,<ARG>
                    .iif identical,<CH>,<X>, COUNT = COUNT + 1
                .endr
            .endm X_COUNT

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

            X_COUNT XXFOOXBARXX
                COUNT = 0
                .irpc CH,<XXFOOXBARXX>
                    .iif identical,<CH>,<X>, COUNT = COUNT + 1
                .endr
                    .iif identical,<X>,<X>, COUNT = COUNT + 1
                    .iif identical,<X>,<X>, COUNT = COUNT + 1
                    .iif identical,<F>,<X>, COUNT = COUNT + 1
                    .iif identical,<O>,<X>, COUNT = COUNT + 1
                    .iif identical,<O>,<X>, COUNT = COUNT + 1
                    .iif identical,<X>,<X>, COUNT = COUNT + 1
                    .iif identical,<B>,<X>, COUNT = COUNT + 1
                    .iif identical,<A>,<X>, COUNT = COUNT + 1
                    .iif identical,<R>,<X>, COUNT = COUNT + 1
                    .iif identical,<X>,<X>, COUNT = COUNT + 1
                    .iif identical,<X>,<X>, COUNT = COUNT + 1

                .print "%integer(COUNT)"
        %MACRO64-I-GENPRINT, Generated PRINT: 5

      This example uses the .IRPC directive to iterate over the
      characters in the argument to the X_COUNT macro. Each time
      an argument character is X, the variable COUNT is incremented.
      After the X_COUNT macro has expanded, the example uses the
      %INTEGER() lexical operator to display the value of COUNT.
Close Help