127f654740f2a26ad62a5c155af9199af9e69b889clairehoCopyright (c) 2002-2010, International Business Machines Corporation and others. All Rights Reserved. 2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruudata: Low level ICU data 3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruThis sample demonstrates 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Using the low level ICU data handling interfaces (udata) to create 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru and later access user data. 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruFiles: 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru writer.c C source for Writer application, will generate data file to be read by Reader. 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru reader.c C source for Reader application, will read file created by Writer 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru udata.sln Windows MSVC workspace. Double-click this to get started. 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru udata.vcproj Windows MSVC project file 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruTo Build udata on Windows 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1. Install and build ICU 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2. In MSVC, open the workspace file icu\samples\udata\udata.sln 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 3. Choose a Debug or Release build. 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 4. Build. 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruTo Run on Windows 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1. Start a command shell window 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2. Add ICU's bin directory to the path, e.g. 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru set PATH=c:\icu\bin;%PATH% 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru (Use the path to where ever ICU is on your system.) 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 3. cd into the udata directory, e.g. 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru cd c:\icu\source\samples\udata\debug 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 4. Run it 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru writer 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru reader 3027f654740f2a26ad62a5c155af9199af9e69b889claireho IMPORTANT: On some systems, the reader and writer executables may not be in the same directory. If this is the case, this will likely cause a problem with reader looking for the .dat file in the wrong directory). 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruTo Build on Unixes 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 1. Build ICU. 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Specify an ICU install directory when running configure, 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru using the --prefix option. The steps to build ICU will look something 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru like this: 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru cd <icu directory>/source 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru runConfigureICU <platform-name> --prefix <icu install directory> [other options] 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru gmake all 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 2. Install ICU, 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru gmake install 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 3. Compile 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru You will need to set ICU_PATH to the location of your ICU source tree, for example ICU_PATH=/home/srl/icu (containing source, etc.) 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru cd <icu directory>/source/samples/udata 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru gmake ICU_PATH=<icu source directory> ICU_PREFIX=<icu install directory) 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru To Run on Unixes 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru cd <icu directory>/source/samples/udata 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru gmake ICU_PREFIX=<icu install directory> check 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru -or- 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru export LD_LIBRARY_PATH=<icu install directory>/lib:.:$LD_LIBRARY_PATH 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru writer 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru reader 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Note: The name of the LD_LIBRARY_PATH variable is different on some systems. 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru If in doubt, run the sample using "gmake check", and note the name of 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru the variable that is used there. LD_LIBRARY_PATH is the correct name 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru for Linux and Solaris. 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 63