Page of 234

HP 9000 User Manual Page 153

Computers.
Hide thumbs

Advertisement

A
FIRSTof2
SECof2
BYTE_STATUS
C_COLWIDTH
Note
Table A-1. Multi-byte Macros
Evaluates a byte c and returns a non-zero value if c may be the first
byte of a 2-byte character according to the loaded NLS environment,
and zero if it cannot.
Evaluates a byte c and returns a non-zero value if c may be the
second byte of a 2-byte character according to the loaded NLS
environment, and zero if it cannot.
Reports whether a byte c represents a single-byte character, the first
byte of a 2-byte character, or the second byte of a 2-byte character
based on the value of the current byte in c and the status of the
previous byte interpreted in
laststatus
as returned by the last call
to
BYTE_STATUS.
Evaluates a byte which is assumed to be either a one byte character,
or the first byte of a 2-byte character, and returns the number of
columns the character would occupy on a terminal display.
These macros are undefined for values of c less than
-1
or
greater than
255.
Also note, these are Hewlett-Packard
proprietary routines; do not use them if portability is an
issue (Use
mblen
described in "WPI Interfaces" in Chapter 6
instead).
The following example illustrates how a program may be adapted to handle
multi-byte as well as single-byte characters. The program is offered in two
versions: the first works only for single-byte codesets, while the second is
codeset independent.
Version #1 (Single-Byte Codesets)
The following program folds characters strings. A field size is specified defining
the WIDTH for text displayed on the screen. As a given string is printed,
any character whose display would fall outside the designated text region is
"folded" onto the next line. For instance, if the
WIDTH = 5
and the string is
0123456789,
the result is:
01234
56789
A-6
Special Topics for HP's 16-bit Interfaces

Advertisement

   Related Manuals for HP 9000

Comments to this Manuals

Symbols: 0
Latest comments: