nlswitchbuf(3X)
NAME
nlswitchbuf() − convert a string of characters between phonetic order and screen order using the MPE character set definition table
SYNOPSIS
#include <portnls.h>
void nlswitchbuf(
short int langid,
const char *instr,
char *outstr,
short int length,
unsigned short int lefttoright,
unsigned short int err[2]
);
DESCRIPTION
nlswitchbuf() is useful for handling data from languages written from right-to-left (e.g., Middle Eastern languages). It is used by a program to convert a buffer that is in phonetic order (i.e., the order in which the characters would be typed at a terminal or spoken by a person) to screen order (i.e., the order in which the characters are displayed on a terminal screen or piece of paper), or vice-versa. Screen order is defined as right-to-left if the primary mode of the terminal or printer is from right-to-left (as when it is used principally for entering or displaying data from a right-to-left language). Otherwise, screen order is defined as left-to-right.
Phonetic order and screen order are, in general, not the same if USASCII text is mixed with that from a right-to-left language. The relationship between phonetic order and screen order is further complicated by the Hindi digits in Arabic, which play a third role intermediate between ASCII characters and characters of the right-to-left language.
Note that this is a somewhat special-purpose native language support routine. nlswitchbuf() is useful only for languages that are written from right-to-left, and which may occasionally mix left-to-right text (e.g., English) with right-to-left. Nonetheless, it can be used by a general-purpose (not specifically for handling right-to-left data) program. Such a program calls nlswitchbuf() to convert data from phonetic order to screen order and back again (for example, an editor that wants to track cursor movement on a terminal against a buffer of text in memory needs to do this). If the data is not that of a right-to-left language, this routine simply returns the same text unchanged, since for all other languages phonetic order and screen order are the same.
Arguments to nlswitchbuf() are:
langid The ID number for the desired language.
instr The character buffer in phonetic order to be converted to screen order.
outstr The buffer in which the result of the conversion to screen order is returned. outstr and instr can reference the same address.
length The length, in characters, of the buffer to be converted.
lefttoright An unsigned short integer that specifies whether the implied primary mode of the data (i.e., the way it would be displayed on a terminal) is left-to-right (TRUE) or right-to-left (FALSE). This determines what the opposite language is and, therefore, strings of which characters get switched.
err The first element of this array contains the error number. The second element is always zero. If the call is successful, both elements contain zero.
Error # Meaning
2 Specified language is not configured.
3 Invalid string length.
WARNINGS
This routine is provided for compatibility with MPE, a proprietary HP operating system. See portnls(5) for more information on the use of this routine. Use the Native Language Support routines for C programmers described by hpnls(5) for HP-UX NLS support.
AUTHOR
nlswitchbuf() was developed by HP.
SEE ALSO
EXTERNAL INFLUENCES
International Code Set Support
Single- and multi-byte character code sets are supported.
Hewlett-Packard Company — HP-UX Release 9.10: April 1995