DECDMAC—Define Macro
This device control string lets you define a macro consisting of a string of ANSI text and control functions. After you define the macro, you can execute it by using the invoke macro control function (DECINVM). The terminal processes the macro as normal input.
Available in: VT Level 4 mode only.
Programming Tip
You can find how much memory space you have available for macros by using a
device status report sequence.
Format
DCS 9/0 |
Pid 3/? |
; 3/11 |
Pdt 3/? |
; 3/11 |
Pen 3/? |
! 2/1 |
z 7/10 |
D . . . D ... |
ST 9/12 |
Parameters
Pid
is the macro ID number. Pid can be any number between 0 and 63, otherwise
the terminal ignores the command. If you give a macro an ID that already exists,
then DECDMAC deletes the old macro definition before using the new one.
Pdt
defines how the terminal treats new macro definitions.
Pdt | Meaning |
---|---|
0 or omitted | DECDMAC deletes the old macro with the same ID number before defining this new macro. |
1 | DECDMAC deletes all current macro definitions before defining this macro. |
Other | The terminal ignores the macro. |
Pen
selects the encoding format for the text of the macro definition.
Pen | Meaning |
---|---|
0 or omitted | Uses standard ASCII characters in the macro. |
1 | Uses hex pairs in the macro. Each pair of characters in the macro is the hex value for a single ASCII character. |
Other | The terminal ignores the macro. |
D...D
is the data of the control string. This data is the string of text and control
functions performed when an application invokes the macro. The data can consist
of ASCII text or hex pairs.
When you use ASCII text (Pen = 0 or omitted), the macro consists of the graphic characters that appear in the device control string. Only characters from positions 2/0 through 7/14 and 10/00 through 15/15 in the code table are valid.
When you use hex pairs (Pen = 1), the macro consists of pairs of hex numbers, each of which represents an ASCII character. When using hex pairs, you can also use a repeat introducer in the data string. The repeat introducer is the ! (2/1) character. The repeat introducer lets you repeat any hex pair within the definition string any number of times. You embed repeat sequences within the data string of the macro definition.
If ASCII text is specified as the encoding format, then you cannot use the repeat sequence.
Notes on DECDMAC
! is the repeat sequence introducer. The format of the hex string with the repeat introducer is as follows:
! Pn ; D...D ;
Pn is a numeric parameter that specifies the number of times to repeat the sequence. If Pn is omitted, then the macro repeats the sequence once.
D...D is the sequence of hex pairs to repeat Pn times.
A semicolon ; (3/11) separates the repeat count from the sequence of hex pairs. Another semicolon ends the sequence. If any characters are included before the first semicolon, then the terminal ignores the macro. If a string terminator is placed before the final semicolon, then the repeat string ends normally.
- The VT510 has 6 Kbytes of memory available for the storage of macros. The terminal ignores any macro definitions that cannot fit into this space.
- A reset to initial state (RIS) or secure reset (DECSR) operation clears all macro definitions. A soft terminal reset (DECSTR) has no effect on stored macro definitions.
- You can include characters from positions 0/8 through 0/13 to format the device control string, but these characters cannot be part of the macro definition.