NLchar
Purpose
Handles data type NLchar.
Library
Standard C Library (libc.a)
Syntax
#include <NLchar.h>
typedef unsigned short NLchar;
int NCdecode (c, x) | int NCencode (x, c)
char *c; | char *x;
NLchar *x; | char *c;
|
int NCdecstr (c, x, len) | int NCencstr (x, c, len)
char *c; | NLchar *x;
NLchar *x; | char *c;
int len; | int len;
|
int NCdec (c, x) | int NCenc (x, c)
char *c; | NLchar *x;
NLchar *x; | char *c;
|
int NCdechr (c) | int NLisNLcp (c)
char *c; | char *c;
|
int NCchrlen (nlchr) | int NLchrlen (c)
NLchar nlchr; | char *c;
Description
Characters for international character support can be
either one or two bytes in length, while all ASCII char-
acters are one byte long. The NLchar data type repres-
ents both ASCII and extended characters as single units
of storage. The NLchar subroutines and macros listed
here convert between character types char and NLchar and
provide information about a given character of either
type.
The NCdecode subroutine converts a character starting at
c into an NLchar at x, and returns the number of bytes
read from c. The NCencode subroutine makes the inverse
translation from type NLchar to type char and returns the
number of bytes written to c.
The NCdecstr subroutine converts a string of characters
from type char to type NLchar, and the NCencstr does the
reverse translation. Both subroutines require the
address of the source and destination strings and the
total number of elements available for the destination
string. The destination string terminates with a zero
(0) element, which is included in the string length. The
destination length should include space for the termi-
nator. If insufficient space is left for the destination
string, a portion of it is not converted. The subrou-
tines return the length of the string in elements,
including the terminating 0.
The NCdec and NCenc macros are equivalent to NCdecode and
NCencode respectively. You can use them to avoid the
overhead of function calls in situations where the param-
eters have no side effects.
The NCdechr macro is like NCdecode except that NCdechr
simply returns the value of NLchar rather than writing
the NLchar into memory.
The NLisNLcp, NCchrlen, and NLchrlen macros return infor-
mation about a given character. NLisNLcp returns a zero
if the character at c is not an extended character, but
returns the length of the character if it is an extended
character. NCchrlen returns the length in bytes that an
NLchar would have if it were converted into an extended
or an ASCII character by NCencode. NLcharlen returns the
length in bytes of the extended or ASCII character
starting at c.
Related Information
In this book: "conv," "ctype," and "NCctype."
"Overview of International Character Support" in Managing
the AIX Operating System.