
===============================================================================
                  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 demonstrates the use of the scanf and
printf family of functions for.  The functions (scanf, sscanf, fscanf,
printf, sprintf, and fprintf) have been augmented in three ways.

     1. They allow for the scanning/printing of wide characters and strings.
        Use the %C for wide characters and the %S for wide strings.

     2. Formatters (such as %f for floating point) have been augmented to
         use the program's locale (set with setlocale).

     3. They support positional parameters.  Inserting a string of the form:
        n$ after a '%' in a format string will cause the formatter to be
        positional.  Consider the following printf statement:

             printf("%2$s %1$s", "world", "hello");

        will print out the string "hello world", because the first formatter
        uses (because of the 2$) the second argument from the argument list.

        Positional formatters are crucial for multi-locale programs, since the
        message strings (when translated) often have to move the arguments
        around in the string.  An example of this can be seen in the sample
        program.


2.  Files in this directory
===========================

File            Purpose
------------------------------------------------------------------------------
scan.c          Source code for the scan sample program.
scan.def        Definition file needed for compiling the program.
scan.mak        Make file used to compile the sample.
scan.exe        Compiled version of the scan sample.

INPUT           Input for the scan sample program.
OUTPUT          Output from executing the program.
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 current locale to US English

          Ex: set LANG=En_US

     3) Execute the scan.exe program.

          Ex:   scan

     4) This program requires you to enter a character and a wide character.
        Assuming that you enter the character 'a' and wide character L'b',
        the output from the program should be:

          Enter a character and a wide character:
          You entered: 'a' and 'b'

          This is a culturally formatted floating point: 123.456

          Scanned strings are: 'is' and 'a'

     5) The contents of the 'OUTPUT' file should be:

          Output of positional string: second_string third_string first_string

     6) Alter the program as desired to see how the APIs work.


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 info source files.

     3) Type "build" at the command prompt.


5.  Notes
=========

1. Note that this sample program is compiled with the /Gm option.  This is a
   requirement of the APIs involved.  Make sure that your programs are compiled
   with this option when needed.
