summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu-xetex/samples/case
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2006-07-25 12:37:43 +0000
committerJonathan Kew <jfkthame@googlemail.com>2006-07-25 12:37:43 +0000
commit10c60368cd42904bd991453f02b684ebe02ef915 (patch)
treec6fb06ccf22a81c80af08f79df1b436120703de4 /Build/source/libs/icu-xetex/samples/case
parent4d8b2aac6036acbb6878236c27e2fb110dad8643 (diff)
adding ICU library sources used by xetex
git-svn-id: svn://tug.org/texlive/trunk@1915 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/icu-xetex/samples/case')
-rw-r--r--Build/source/libs/icu-xetex/samples/case/Makefile24
-rw-r--r--Build/source/libs/icu-xetex/samples/case/case.cpp84
-rw-r--r--Build/source/libs/icu-xetex/samples/case/case.sln21
-rw-r--r--Build/source/libs/icu-xetex/samples/case/case.vcproj157
-rw-r--r--Build/source/libs/icu-xetex/samples/case/readme.txt61
-rw-r--r--Build/source/libs/icu-xetex/samples/case/ucase.c85
6 files changed, 432 insertions, 0 deletions
diff --git a/Build/source/libs/icu-xetex/samples/case/Makefile b/Build/source/libs/icu-xetex/samples/case/Makefile
new file mode 100644
index 00000000000..36905e4b33a
--- /dev/null
+++ b/Build/source/libs/icu-xetex/samples/case/Makefile
@@ -0,0 +1,24 @@
+# Copyright (c) 2003 IBM, Inc. and others
+# sample code makefile
+
+# Usage:
+# - configure, build, install ICU (make install)
+# - make sure "icu-config" (in the ICU installed bin directory) is on
+# the path
+# - do 'make' in this directory
+
+#### definitions
+# Name of your target
+TARGET=case
+
+# All object files (C or C++)
+OBJECTS=case.o ucase.o
+
+#### rules
+# Load in standard makefile definitions
+include ../defs.mk
+
+LDFLAGS += $(LDFLAGS_USTDIO)
+
+# the actual rules (this is a simple sample)
+include ../rules.mk
diff --git a/Build/source/libs/icu-xetex/samples/case/case.cpp b/Build/source/libs/icu-xetex/samples/case/case.cpp
new file mode 100644
index 00000000000..fa2fab1a157
--- /dev/null
+++ b/Build/source/libs/icu-xetex/samples/case/case.cpp
@@ -0,0 +1,84 @@
+/*
+*******************************************************************************
+*
+* Copyright (C) 2003-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+*******************************************************************************
+*/
+
+#include <unicode/unistr.h>
+#include <unicode/ustdio.h>
+#include <unicode/brkiter.h>
+#include <stdlib.h>
+
+U_CFUNC int c_main(UFILE *out);
+
+void printUnicodeString(UFILE *out, const UnicodeString &s) {
+ UnicodeString other = s;
+ u_fprintf(out, "\"%S\"", other.getTerminatedBuffer());
+}
+
+
+int main( void )
+{
+ UFILE *out;
+ UErrorCode status = U_ZERO_ERROR;
+ out = u_finit(stdout, NULL, NULL);
+ if(!out) {
+ fprintf(stderr, "Could not initialize (finit()) over stdout! \n");
+ return 1;
+ }
+ ucnv_setFromUCallBack(u_fgetConverter(out), UCNV_FROM_U_CALLBACK_ESCAPE,
+ NULL, NULL, NULL, &status);
+ if(U_FAILURE(status)) {
+ u_fprintf(out, "Warning- couldn't set the substitute callback - err %s\n", u_errorName(status));
+ }
+
+ /* End Demo boilerplate */
+
+ u_fprintf(out,"ICU Case Mapping Sample Program\n\n");
+ u_fprintf(out, "C++ Case Mapping\n\n");
+
+ UnicodeString string("This is a test");
+ /* lowercase = "istanbul" */
+ UChar lowercase[] = {0x69, 0x73, 0x74, 0x61, 0x6e, 0x62, 0x75, 0x6c, 0};
+ /* uppercase = "LATIN CAPITAL I WITH DOT ABOVE STANBUL" */
+ UChar uppercase[] = {0x0130, 0x53, 0x54, 0x41, 0x4e, 0x42, 0x55, 0x4C, 0};
+
+ UnicodeString upper(uppercase);
+ UnicodeString lower(lowercase);
+
+ u_fprintf(out, "\nstring: ");
+ printUnicodeString(out, string);
+ string.toUpper(); /* string = "THIS IS A TEST" */
+ u_fprintf(out, "\ntoUpper(): ");
+ printUnicodeString(out, string);
+ string.toLower(); /* string = "this is a test" */
+ u_fprintf(out, "\ntoLower(): ");
+ printUnicodeString(out, string);
+
+ u_fprintf(out, "\n\nlowercase=%S, uppercase=%S\n", lowercase, uppercase);
+
+
+ string = upper;
+ string.toLower(Locale("tr", "TR")); /* Turkish lower case map string =
+ lowercase */
+ u_fprintf(out, "\nupper.toLower: ");
+ printUnicodeString(out, string);
+
+ string = lower;
+ string.toUpper(Locale("tr", "TR")); /* Turkish upper case map string =
+ uppercase */
+ u_fprintf(out, "\nlower.toUpper: ");
+ printUnicodeString(out, string);
+
+
+ u_fprintf(out, "\nEnd C++ sample\n\n");
+
+ // Call the C version
+ int rc = c_main(out);
+ u_fclose(out);
+ return rc;
+}
+
diff --git a/Build/source/libs/icu-xetex/samples/case/case.sln b/Build/source/libs/icu-xetex/samples/case/case.sln
new file mode 100644
index 00000000000..9a6f5080a38
--- /dev/null
+++ b/Build/source/libs/icu-xetex/samples/case/case.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 7.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "case", "case.vcproj", "{2316BE8C-189D-4C8B-B506-9D9EE25AC46D}"
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ ConfigName.0 = Debug
+ ConfigName.1 = Release
+ EndGlobalSection
+ GlobalSection(ProjectDependencies) = postSolution
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {2316BE8C-189D-4C8B-B506-9D9EE25AC46D}.Debug.ActiveCfg = Debug|Win32
+ {2316BE8C-189D-4C8B-B506-9D9EE25AC46D}.Debug.Build.0 = Debug|Win32
+ {2316BE8C-189D-4C8B-B506-9D9EE25AC46D}.Release.ActiveCfg = Release|Win32
+ {2316BE8C-189D-4C8B-B506-9D9EE25AC46D}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/Build/source/libs/icu-xetex/samples/case/case.vcproj b/Build/source/libs/icu-xetex/samples/case/case.vcproj
new file mode 100644
index 00000000000..23d8fd17231
--- /dev/null
+++ b/Build/source/libs/icu-xetex/samples/case/case.vcproj
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="case"
+ SccProjectName=""
+ SccLocalPath="">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..,..\..\..\include"
+ PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="5"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Debug/case.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ DebugInformationFormat="4"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="icuucd.lib icuind.lib icuiod.lib"
+ OutputFile=".\Debug/case.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="..\..\..\lib"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile=".\Debug/case.pdb"
+ SubSystem="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Debug/case.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="FALSE"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ InlineFunctionExpansion="1"
+ AdditionalIncludeDirectories="..\..\..\include"
+ PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
+ StringPooling="TRUE"
+ RuntimeLibrary="4"
+ EnableFunctionLevelLinking="TRUE"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderFile=".\Release/case.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ WarningLevel="3"
+ SuppressStartupBanner="TRUE"
+ CompileAs="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="icuuc.lib icuin.lib icuio.lib"
+ OutputFile=".\Release/case.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="TRUE"
+ AdditionalLibraryDirectories="..\..\..\lib"
+ ProgramDatabaseFile=".\Release/case.pdb"
+ SubSystem="1"/>
+ <Tool
+ Name="VCMIDLTool"
+ TypeLibraryName=".\Release/case.tlb"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
+ <File
+ RelativePath=".\case.cpp">
+ </File>
+ <File
+ RelativePath=".\ucase.c">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl">
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/Build/source/libs/icu-xetex/samples/case/readme.txt b/Build/source/libs/icu-xetex/samples/case/readme.txt
new file mode 100644
index 00000000000..893bb575fd5
--- /dev/null
+++ b/Build/source/libs/icu-xetex/samples/case/readme.txt
@@ -0,0 +1,61 @@
+Copyright (c) 2003-2005, International Business Machines Corporation and others. All Rights Reserved.
+case: case mapping
+
+This sample demonstrates
+ Using ICU to convert between different cases
+
+
+Files:
+ case.cpp Main source file in C++
+ ucase.c Main source file in C
+ case.sln Windows MSVC workspace. Double-click this to get started.
+ case.vcproj Windows MSVC project file
+
+To Build case on Windows
+ 1. Install and build ICU
+ 2. In MSVC, open the solution file icu\samples\case\case.sln
+ (or, use the workspace All, in icu\samples\all\all.sln )
+ 3. Choose a Debug or Release build.
+ 4. Build.
+
+To Run on Windows
+ 1. Start a command shell window
+ 2. Add ICU's bin directory to the path, e.g.
+ set PATH=c:\icu\bin;%PATH%
+ (Use the path to where ever ICU is on your system.)
+ 3. cd into the case directory, e.g.
+ cd c:\icu\source\samples\case\debug
+ 4. Run it
+ case
+
+To Build on Unixes
+ 1. Build ICU.
+ Specify an ICU install directory when running configure,
+ using the --prefix option. The steps to build ICU will look something
+ like this:
+ cd <icu directory>/source
+ runConfigureICU <platform-name> --prefix <icu install directory> [other options]
+ gmake all
+
+ 2. Install ICU,
+ gmake install
+
+ 3. Compile
+ cd <icu directory>/source/samples/case
+ gmake ICU_PREFIX=<icu install directory)
+
+ To Run on Unixes
+ cd <icu directory>/source/samples/case
+
+ gmake ICU_PREFIX=<icu install directory> check
+ -or-
+
+ export LD_LIBRARY_PATH=<icu install directory>/lib:.:$LD_LIBRARY_PATH
+ case
+
+
+ Note: The name of the LD_LIBRARY_PATH variable is different on some systems.
+ If in doubt, run the sample using "gmake check", and note the name of
+ the variable that is used there. LD_LIBRARY_PATH is the correct name
+ for Linux and Solaris.
+
diff --git a/Build/source/libs/icu-xetex/samples/case/ucase.c b/Build/source/libs/icu-xetex/samples/case/ucase.c
new file mode 100644
index 00000000000..585f49b7cf0
--- /dev/null
+++ b/Build/source/libs/icu-xetex/samples/case/ucase.c
@@ -0,0 +1,85 @@
+/*
+*******************************************************************************
+*
+* Copyright (C) 2003-2004, International Business Machines
+* Corporation and others. All Rights Reserved.
+*
+****
+*
+* Case folding examples, in C
+*
+*******************************************************************************
+*/
+
+#include "unicode/uchar.h"
+#include "unicode/ustring.h"
+#include "unicode/utypes.h"
+#include "unicode/ustdio.h"
+
+/* Note: don't use 'k' or 'K' because we might be on EBCDIC */
+
+int c_main(UFILE *out)
+{
+ UChar32 ch;
+ UErrorCode errorCode = U_ZERO_ERROR;
+ static const UChar upper[] = {0x61, 0x42, 0x49, 0}; /* upper = "aBI" */
+ static const UChar lower[] = {0x61, 0x42, 0x69, 0}; /* lower = "abi" */
+ /* unfold = "aB LATIN SMALL LETTER DOTLESS I" */
+ static const UChar unfold[] = {0x61, 0x42, 0x131, 0} ;
+ UChar buffer[32];
+ const UChar char_k = 0x006b; /* 'k' */
+ const UChar char_K = 0x004b; /* 'K' */
+
+ int length;
+
+ printf("** C Case Mapping Sample\n");
+
+ /* uchar.h APIs, single character case mapping */
+ ch = u_toupper(char_k); /* ch = 'K' */
+ u_fprintf(out, "toupper(%C) = %C\n", char_k, ch);
+ ch = u_tolower(ch); /* ch = 'k' */
+ u_fprintf(out, "tolower() = %C\n", ch);
+ ch = u_totitle(char_k); /* ch = 'K' */
+ u_fprintf(out, "totitle(%C) = %C\n", char_k, ch);
+ ch = u_foldCase(char_K, U_FOLD_CASE_DEFAULT); /* ch = 'k' */
+ u_fprintf(out, "u_foldCase(%C, U_FOLD_CASE_DEFAULT) = %C\n", char_K, (UChar) ch);
+
+ /* ustring.h APIs, UChar * string case mapping with a Turkish locale */
+ /* result buffer = "ab?" latin small letter a, latin small letter b, latin
+ small letter dotless i */
+ length = u_strToLower(buffer, sizeof(buffer)/sizeof(buffer[0]), upper,
+ sizeof(upper)/sizeof(upper[0]), "tr", &errorCode);
+ if(U_FAILURE(errorCode) || buffer[length]!=0) {
+ u_fprintf(out, "error in u_strToLower(Turkish locale)=%ld error=%s\n", length,
+ u_errorName(errorCode));
+ }
+
+ u_fprintf(out, "u_strToLower(%S, turkish) -> %S\n", upper, buffer);
+
+
+ /* ustring.h APIs, UChar * string case mapping with a Engish locale */
+ /* result buffer = "ABI" latin CAPITAL letter A, latin capital letter B,
+ latin capital letter I */
+ length = u_strToUpper(buffer, sizeof(buffer)/sizeof(buffer[0]), upper,
+ sizeof(upper)/sizeof(upper[0]), "en", &errorCode);
+ if(U_FAILURE(errorCode) || buffer[length]!=0) {
+ u_fprintf(out, "error in u_strToLower(English locale)=%ld error=%s\n", length,
+ u_errorName(errorCode));
+ }
+ u_fprintf(out, "u_strToUpper(%S, english) -> %S\n", lower, buffer);
+
+
+ /* ustring.h APIs, UChar * string case folding */
+ /* result buffer = "abi" */
+ length = u_strFoldCase(buffer, sizeof(buffer)/sizeof(buffer[0]), unfold,
+ sizeof(unfold)/sizeof(unfold[0]), U_FOLD_CASE_DEFAULT,
+ &errorCode);
+ if(U_FAILURE(errorCode) || buffer[length]!=0) {
+ u_fprintf(out, "error in u_strFoldCase()=%ld error=%s\n", length,
+ u_errorName(errorCode));
+ }
+ u_fprintf(out, "u_strFoldCase(%S, U_FOLD_CASE_DEFAULT) -> %S\n", unfold, buffer);
+ u_fprintf(out, "\n** end of C sample\n");
+
+ return 0;
+}