home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
i18nv104.zip
/
SAMPLE
/
NUMCONV
/
READ.ME
< prev
Wrap
Text File
|
1996-02-13
|
4KB
|
117 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
5. Notes
1. Overview
============
The sample program in this directory shows how to convert wide strings (and
in one case, regular strings) to various numeric formats. APIs are provided
to convert wide strings to long integers, unsigned long integers, and doubles
(floating point). There is also a conversion routine to convert strings to
doubles.
The reason that these APIs are culturally sensitive is that the radix character
(what is called the "decimal point" in the US) is not always a period. Certain
locales (such as Fr_FR) use symbols such as a comma to separate numbers.
For example, the string: "123.45" could be converted to a floating point
number if the assumption is made about the radix character. In Fr_FR, however,
the string shown is not a legal number.
2. Files in this directory
===========================
File Purpose
------------------------------------------------------------------------------
numconv.c Source code for the numconv sample program.
numconv.def Definition file needed for compiling the program.
numconv.mak Make file used to compile the sample.
numconv.exe Compiled version of the numconv 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
=================================
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
3) Execute the numconv.exe program.
Ex: numconv
4) Experiment with changing the values of the LANG environment
variable. Try the Fr_FR locale to see the difference in the
results. Observe that the numbers converted are not the same
based on the radix character. Note: You should change
the codeset of OS/2 to 850 before running this program with
the french locale. This can be done with the 'chcp' command:
Ex: chcp 850
When you are finished, change the codepage back to 437.
5) Try to change the strings in the program to different radix
characters, and recompile. Try on differing locales.
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 is source files.
3) Type "build" at the command prompt.
5. Notes
=========
1. Each of the APIs in this sample program produce an "end" string. This
string contains all characters found after a legal number. For example,
the string "123.4ghi" *is* converted to: 123.4 and the end string is: "ghi".
2. The "strtod" function requires that the "stdlib" library be included, unlike
most of the I18N APIs.