HP-UX Reference (11i v2 03/08) - 4 File Formats (vol 8)

t
terminfo(4) terminfo(4)
(ENHANCED CURSES)
%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
tabs are never expanded, so \t is safe to send. This turns out to be essential for the Ann Arbor 4080.)
A final example is the LSI ADM-3a, which uses row and column offset by a blank character, thus:
cup=\E=%p1%’\s’%+%c%p2%’\s’%+%c
After sending "\E=", this pushes the first argument, pushes the ASCII decimal value for a space (32),
adds them (pushing the sum on the stack in place of the two previous values), and outputs that value as a
character. Then the same is done for the second argument. More complex arithmetic is possible using
the stack.
Cursor Motions
If the terminal has a fast way to home the cursor (to very upper left corner of screen) then this can be
given as home; similarly a fast way of getting to the lower left-hand corner can be given as ll; this may
involve going up with cuu1 from the home position, but a program should never do this itself (unless ll
does) because it can make no assumption about the effect of moving up from the home position. Note that
the home position is the same as addressing to (0,0): to the top left corner of the screen, not of memory.
(Thus, the \EH sequence on Hewlett-Packard terminals cannot be used for home without losing some of
the other features on the terminal.)
If the device has row or column absolute-cursor addressing, these can be given as single argument capa-
bilities hpa (horizontal position absolute) and vpa (vertical position absolute). Sometimes these are
shorter than the more general two-argument sequence (as with the Hewlett-Packard 2645) and can be
used in preference to cup. If there are argumentised local motions (such as "move n spaces to the right"),
Section 4326 Hewlett-Packard Company 15 HP-UX 11i Version 2: August 2003