home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
i18nv104.zip
/
SAMPLE
/
COLLATE
/
READ.ME
< prev
Wrap
Text File
|
1996-02-13
|
4KB
|
114 lines
===============================================================================
Internationalization (I18N) For OS/2
===============================================================================
Copyright IBM Corporation -- 1993, 1994, 1995
DISCLAIMER: This package is not a full implementation of the X/Open XPG4
specification and does not make any claims of XPG4 branding. It implements
only the portions of the XPG4 specification which deal with
internationalization.
X/Open is a trademark of the X/Open Company Limited.
===============================================================================
/************************/
/*** Contents ***/
/************************/
1. Overview
2. Files in this directory
3. How to run the sample program
4. How to compile the sample program
1. Overview
============
The sample program in this directory demonstrates the use of culturally-based
collation. Collation MUST be culturally-based, or your data will be sorted
in the wrong order for the users of the program. Using a traditional English
(ASCII) based collation will result in incorrect data for many reasons,
including the fact that english has no accent marks, many other languages do
not have capital letters, and multi-byte characters (such as in Ja_JP locale)
have their own sort order.
Thus, using the simple "strcmp" routine is insufficient for sorting.
The XPG4 model provides collation functions for both char and wchar_t data
types.
2. Files in this directory
===========================
File Purpose
------------------------------------------------------------------------------
collate.c Source code for the collate sample program.
collate.def Definition file needed for compiling the program.
collate.mak Make file used to compile the sample.
collate.exe Compiled version of the collate sample.
build.cmd A command file which will compile and link the sample program.
read.me This file.
3. How to run the sample program
=================================
This sample program shows how one can perform culturally-based collation and
comparisons, for both char and wchar_t data types. The following steps show
how the program can be run.
1) Run the \i18n\bin\new_vars command file (or have the environment
variables already set).
2) Set the value of either LC_ALL or LANG to: En_US (US English).
Ex: set LANG=En_US
4) Execute the collate.exe program.
Ex: collate
5) The output from the program should be:
Locale setting: ENUS437
Functions with multibyte strings:
---------------------------------
Initial array: côte côté coté cote
After sorting: cote coté côte côté
strxfrm on string: 'côté' is: 0x63937482
Functions with wide strings:
----------------------------
Two strings are: 'hello' and 'Hello'
Collation on those two strings is: 1
wcsxfrm on string: 'hello' is 0x: 6a0167016e016e0171010101
6) Experiment with changing the values of the LANG environment
variable. Try the Fr_FR.IBM-850 locale to see the difference in the
wide character collation results. Try the Ja_JP.IBM-932 locale to see
a difference in the string sort order.
4. How to compile the sample program
=====================================
NOTE: The sample program is already compiled for you. If you want to see the
behavior of the program, you can just run it. The following instructions
are needed only if you want to modify the program and recompile it.
To compile the sample application:
1) Make sure that the CSET/2 compiler and OS/2 toolkit are installed
correctly on your system.
2) cd to the directory which contains the collate source files.
3) Type "build" at the command prompt.