Traditional Chinese Solaris User's Guide

Appendix A Binary Compatibility Package

Applications compiled under Chinese OpenWindowsTM 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 the application's included binary compatibility package (BCP).


Note –

SUNWowbcp must be included in your system configuration in order 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, or Chinese OpenWindows 2.x applications without recompilation, However, OpenWindows V2 Chinese applications will 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 (old-locale):


system% old_application_name -lc_basiclocale 
old-locale -lc_inputlang old-locale 
\ -lc_displaylang old-locale

The following example shows the command you use to run the compiled binary code of an earlier version of the textedit application on the current Traditional Chinese Solaris Operating 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 the International Language Environments Guide.

The utilities in the following table test various aspects of the Traditional Chinese (CNS 11643) national standard character set. These utilities also assume that the character being tested is part of the national standard character set. Each utility returns true if the character meets the test requirement referenced in the description.

The arguments for the functions in the following table must be characters in wide character code (WC), wchar_t. For more information, see Asian-Specific Utilities and the hctype(3x) man page.

Table A–1 Traditional Chinese Test Utilities

Utility 

Description 

ishalpha

Tests for a Roman character in the CNS 11643 character set. 

ishupper

Tests for an uppercase Roman character as defined by the CNS 11643 character set. 

ishlower

Tests for a lowercase Roman character in the CNS 11643 character set. 

ishdigit

Tests for a number in the CNS 11643 character set. 

ishspace

Tests for the space character in the CNS 11643 character set. 

ishpunct

Tests for a punctuation character in the CNS 11643 character set. 

ishparen

Tests for a left or right parenthesis in the CNS 11643 character set. 

ishphontone

Tests for a Mandarin phonetic tone. 

ishradical

Tests for a Chinese character radical. 

ishline

Tests for a ruled line symbol in the CNS 11643 character set. 

ishunit

Tests for a unit character in the CNS 11643 character set. 

ishsci

Tests for a scientific symbol in the CNS 11643 character set. 

ishgen

Tests for a general symbol in the CNS 11643 character set. 

ishgreek

Tests for 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 the Traditional Chinese Solaris software, 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 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 Code Set

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 routines listed in the following table are in the regular Chinese C library:

Table A–2 Chinese C Library Conversion Routines

Function 

Description 

tohupper()

Converts code set 1 Roman lowercase to uppercase 

tohlower()

Converts code set 1 Roman uppercase to lowercase 

Conversion for Traditional Chinese Character Codes

The routines listed in the following table 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 A–3 Character-Based Code Conversion Routines

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 A–4 Character-Based Code Conversion Routines (cont)

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.