MASK

Specify activation characters

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
MASK:act_char

Arguments

act_char

An array of integers with a total size of 32 bytes and which must start on an aligned i4 boundary. (i)

Discussion

The MASK qualifier specifies activation characters at the statement level, to enable you to replace those specified by the ACCHR, ACESC, DACHR, or DAESC subroutines if you have opened a serial or terminal device other than the console (TT:). MASK is used with the GETS statement.

The act_char argument is a series of 256 bits corresponding to the ASCII character codes 0-255. If a bit is set, that character is an activation character.

To terminate on a CR or LF, for example, do the following:

1. Create an array of 256 bits:
actchar         ,[32]i1

(Each i1 is 8 bits, and 8 x 32 = 256.)

2. Determine the values of CR and LF (13 and 10, respectively).
3. Because the lowest order bit corresponds to 0 rather than 1, subtract 1 from each value (resulting in 12 and 9, respectively).
4. Set bit 12 and bit 9 in the array (bits 5 and 2 of the second byte, or values 16 and 2, which makes 18).
5. Set actchar[2] = 18.

The non-interactive runtimes (dbs, dbssvc, and dbspriv) do not support the MASK qualifier, nor will MASK work on a detached program.

See also

GETS statement

Examples

The following routine sets the correct bit in the array for any specified character:

subroutine setchars
;
; Description:  Routine to set the appropriate bits in the activation
;               character mask for desired terminators
;
; Arguments:
;
    a_actchars          ,[32]i1         ;Array of activation bit characters
    a_char              ,n              ;0 or more character values
;
.define D_BITS_IN_CHAR          ,8      ;Number of bits in a character
.align
stack record
    argnm               ,i4                     ;Argument counter
    charval             ,i4                     ;Character value
    ndx                 ,i4                     ;Index into array
    group dbits         ,d D_BITS_IN_CHAR       ;"Bit flags" for a character
     dbit               ,[D_BITS_IN_CHAR]d1
    endgroup
    abits               ,a D_BITS_IN_CHAR @dbits           ;Union as alpha
proc
    for argnm from ^argnum(a_char) thru %numargs   ;For all "a_char" args
      if (^passed(^arg(argnm)))
      begin
        charval = ^argn(argnm)                          ;Get the character value
        decr charval                                    ;Make 1 = 0
        ndx = (charval / D_BITS_IN_CHAR)                ;Base 0 array index
        charval -= (ndx * D_BITS_IN_CHAR)               ;Modulo array element size
        clear dbits
        dbit[D_BITS_IN_CHAR - charval] = 1              ;Set the "bit"
        incr ndx                                        ;Make the array base 1
        a_actchars[ndx] = a_actchars[ndx] .bor. %b(abits)
                                                        ;Mask in the bit
      end
    xreturn
endsubroutine