Traditional Chinese Solaris User's Guide

Appendix B Binary Compatibility Package

Applications compiled under Chinese OpenWindows 2.x or Solaris 1.x or SunOS 4.x systems have different binary formats than the current Chinese Solaris release. Older applications can nevertheless be run under the current Chinese release without being recompiled by using its included binary compatibility package (BCP).


Note -

SUNWowbcp must be included in your system configuration in order for you to run the following commands. See your system administrator for installation.


The following BCP command runs the compiled binary code of earlier SunOS4.x /Solaris 1.x /Chinese OpenWindows 2.x applications without recompilation, although OpenWindows V2 Chinese applications display no input server status region. As shown in the following examples, the command calls the application by its old name (old_application_name) and sets the basic locale, input language, and display language using the older version's specific locale name (oldlocale):


system% old_application_name -lc_basiclocale oldlocale -lc_inputlang oldlocale \
    -lc_displaylang oldlocale 

The following example shows the command for running the compiled binary code of an earlier version of the textedit application on a current Traditional Chinese Solaris release system:


system% textedit -lc_displaylang tchinese -lc_basiclocale tchinese \
    -lc_inputlang tchinese

Due to incompatibilities between Traditional Chinese Solaris 2.x and 1.x applications, you cannot cut and paste Chinese characters between them.

Traditional Chinese Test Utilities

Every utility listed in this section is supported, but for this version of Solaris, you are encouraged to use the XPG4 internationalization APIs as described in Solaris Internationalization Guide for Developers.

The utilities in the following table test various aspects of the Traditional Chinese (CNS 11643) national standard character set. They also assume that the character being tested is part of the national standard character set.

The arguments for the functions in the following table must be a character in WC, wchar_t. For more information, see the hctype(3x) man page.

Table B-1

Utility 

Description 

ishalpha

Returns true if it is a Roman character in the CNS 11643 character set. 

ishupper

Returns true if it is an uppercase Roman character as defined by the CNS 11643 character set. 

ishlower

Returns true if it is a lowercase Roman character in the CNS 11643 character set. 

ishdigit

Returns true if it is a number in the CNS 11643 character set. 

ishspace

Returns true if it is the space character in the CNS 11643 character set. 

ishpunct

Returns true if it is a punctuation character in the CNS 11643 character set. 

ishparen

Returns true if it is a left or right parenthesis in the CNS 11643 character set.  

ishphontone

Returns true if it is a Mandarin phonetic tone. 

ishradical

Returns true if it is a Chinese character radical. 

ishline

Returns true if it is a ruled line symbol in the CNS 11643 character set. 

ishunit

Returns true if it is a unit character in the CNS 11643 character set. 

ishsci

Returns true if it is a scientific symbol in the CNS 11643 character set. 

ishgen

Returns true if it is a general symbol in the CNS 11643 character set. 

ishgreek

Returns true if it is a Greek character in the CNS 11643 character set. 

Asian-Specific Utilities

This section describes functions for wide character and string input and output, character classification, and conversion functions for the Korean or Chinese character sets. Asian Solaris software implements a wide character library for handling Korean or Chinese character codes according to industry standards.

Routines that have Korean or Chinese language-specific dependency are in their own language-specific library, which is linked with the corresponding C compiler option. In Traditional Chinese Solaris, libhle is linked with -lhle. Refer to the appropriate man page for more information.

Asian Solaris software defines WC as a constant-width, four-byte code. WC uses the ANSI C data type wchar_t, which Solaris software defines in wchar.h as follows:


typedef long wchar_h;

In Solaris software, long is four bytes.

Conversion Utilities

The conversion utilities described in this section are available, but you should use iconv as a standard function.

Asian Solaris software provides facilities for various conversions, for example:

Programs using the general multibyte conversion utilities should include the header files widec.h and wctype.h. Traditional Chinese Solaris specific routines (such as ishxxx) are declared in zh_TW/xctype.h.

Programs using the general multibyte conversion utilities should include three header files: wctype.h, widec.h, and zh_TW/xctype.h.

As with classification functions described in the previous section, the use of these utilities can be controlled by the setlocale function. Locale-specific routines are contained in a locale-specific library. For Traditional Chinese, that library is libhle. The library can be linked during compilation using the C compiler option -lhle.

Conversion Within a Codeset

The multibyte conversion functions are similar to the one-byte conversion functions toupper() and tolower(). These functions convert wide-characters to other wide characters. For more information on conversion routines, see the man pages for wconv(3) for all locales and hconv(3) for Traditional Chinese.

The following routines are in the regular Chinese C library:

Table B-2

Function 

Description 

tohupper()

Converts codeset 1 Roman lowercase to uppercase.  

tohlower()

Converts codeset 1 Roman uppercase to lowercase.  

Conversion for Traditional Chinese Character Codes

The following routines perform character-based code conversion on the CNS-11643 character set. They convert characters in the set between CNS-11643, EUC, and Big5 formats. To use these routines, the library hle must be linked using the C compiler option -lhle. For more information, see the hconv(3x) man page.

Table B-3

Function 

Description 

cbig5toeuc()

Converts Big5 character to EUC. 

ccnstoeuc()

Converts CNS character to EUC. 

ceuctobig5()

Converts EUC character to Big5. 

ceuctocns()

Converts EUC character to CNS. 

Table B-4

Function 

Description 

big5toeuc()

Converts Big5 string to EUC. 

cnstoeuc()

Converts CNS string to EUC. 

euctobig5()

Converts EUC string to Big5. 

euctocns()

Converts EUC string to CNS.