HP 9000 User Manual page 149

Computers
Hide thumbs Also See for 9000:
Table of Contents

Advertisement

A
Aspects of Program Design
Designing an international program with NLS is usually a straightforward
process. Nevertheless, there are a number of special considerations. For
example, make sure you reserve enough space in arrays and other data
structures to accommodate the needs of all your users. Since an international
program supports character sets that contain multi-byte characters, the number
of characters in a string is no longer equivalent to the number of bytes. You
must allocate additional space to accommodate the larger character size in the
codesets for certain languages.
The existence of multi-byte characters also affects your code in a number of
other areas:
• Scanning for a character match - Suppose that you are writing an assembler
and your code searches for the character ":". With the existence of two-byte
characters, it is no longer possible to simply scan a data stream looking for a
byte whose bit pattern matches that of ASCII":". The byte that you match
may be the second half of a two-byte character. Your program must search
for character matches, not byte matches .
• Reading characters - Suppose that you allocate an 80 byte buffer for reading
data. You must be careful to truncate excess input on character boundaries.
Suppose that the 80th byte read into the buffer is the first half of a two byte
character. When the contents of another buffer are appended, the first byte
of the appended buffer will interpreted as the second half of the two byte
character. Thus, data is corrupted.
A-2
Special Topics for HP's 16-bit Interfaces

Advertisement

Table of Contents
loading

Table of Contents