HP-UX Reference (11i v2 04/09) - 4 File Formats (vol 8)

t
terminfo(4) terminfo(4)
(ENHANCED CURSES)
Parameterized Strings
Cursor addressing and other strings requiring arguments are described by a argumentized string capabil-
ity with escapes in a form (%x) comparable to printf() (see printf (1)). For example, to address the cur-
sor, the cup capability is given, using two arguments: the row and column to address to. (Rows and
columns are numbered from zero and refer to the physical screen visible to the user, not to any unseen
memory.) If the terminal has memory relative cursor addressing, that can be indicated by mrcup.
The argument mechanism uses a stack and special "%" codes to manipulate the stack in the manner of
Reverse Polish Notation (postfix). Typically a sequence pushes one of the arguments onto the stack and
then prints it in some format. Often more complex operations are necessary. Operations are in postfix
form with the operands in the usual order. That is, to subtract 5 from the first argument, one would use
%p1%{5}%-.
The "%" encodings have the following meanings:
%% Outputs "%".
% [[: ] flags ][width [ .precision ]][doxXs ]
As in printf(); flags are [-+#] and space.
%c Print pop() gives %c.
%p[1-9] Push the ith argument.
%P[a-z] Set dynamic variable [a-z] to pop().
%g[a-z] Get dynamic variable [a-z] and push it.
%P[A-Z] Set static variable [a-z] to pop().
%g[A-Z] Get static variable [a-z] and push it.
%’c Push char constant c.
%{nn} Push decimal constant nn.
%l Push strlen(pop()).
%+ %- %* %/ %m
Arithmetic (%m is mod): push(pop integer2 op pop integer1) where integer1
represents the top of the stack
%& %| Bit operations: push(pop integer2 op pop integer1)
%= %> %< Logical operations: push(pop integer2 op pop integer1)
%A %O Logical operations: and, or
%! Unary operations: push(op pop())
%i (For ANSI terminals) add 1 to the first argument (if one argument present), or first
two arguments (if more than one argument present).
%? expr %t thenpart %e elsepart %;
If-then-else; %e elsepart is optional; else-if’s are possible as in Algol 68:
%? c
1
%t b
1
%e c
2
%t b
2
%e c
3
%t b
3
%e c
4
%t b
4
%e b
5
%;
c
i
are conditions; b
i
are bodies.
If the "-" flag is used with "%[doxXs]", then a colon must be placed between the "%" and the "-"to
differentiate the flag from the binary "%-" operator. For example: "%:-16.16s".
Consider the Hewlett-Packard 2645, which, to get to row 3 and column 12, needs to be sent \E&a12c03Y
padded for 6 milliseconds. Note that the order of the rows and columns is inverted here, and that the row
and column are zero-padded as two digits. Thus, its cup capability is:
cup=\E&a%p2%2.2dc%p1%2.2dY$<6>
The Micro-Term ACT-IV needs the current row and column sent preceded by a ˆT, with the row and
column simply encoded in binary:
cup=ˆT%p1%c%p2%c
Devices that use "%c" need to be able to backspace the cursor (cub1), and to move the cursor up one line
on the screen (cuu1). This is necessary because it is not always safe to transmit \n, ˆD, and \r, as the
system may change or discard them. (The library functions dealing with terminfo set tty modes so that
Section 4350 Hewlett-Packard Company 17 HP-UX 11i Version 2: September 2004