diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-12-03 09:05:05 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2010-12-03 09:05:05 +0000 |
commit | e04c6a878f5044d36eaa95d4c2318e0381a32998 (patch) | |
tree | 5b7c36578140e48c0114863004c8375ea55db21d /Build/source/libs/icu/icu-4.6/samples/break | |
parent | fa438554bd1a061515cd8f5f46fbe311ff08dcd6 (diff) |
icu 4.6
git-svn-id: svn://tug.org/texlive/trunk@20645 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/icu/icu-4.6/samples/break')
7 files changed, 662 insertions, 0 deletions
diff --git a/Build/source/libs/icu/icu-4.6/samples/break/Makefile b/Build/source/libs/icu/icu-4.6/samples/break/Makefile new file mode 100644 index 00000000000..3afd0c517bc --- /dev/null +++ b/Build/source/libs/icu/icu-4.6/samples/break/Makefile @@ -0,0 +1,22 @@ +# Copyright (c) 2000-2002 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=break + +# All object files (C or C++) +OBJECTS=break.o ubreak.o + +#### rules +# Load in standard makefile definitions +include ../defs.mk + +# the actual rules (this is a simple sample) +include ../rules.mk diff --git a/Build/source/libs/icu/icu-4.6/samples/break/break.cpp b/Build/source/libs/icu/icu-4.6/samples/break/break.cpp new file mode 100644 index 00000000000..90d77efad42 --- /dev/null +++ b/Build/source/libs/icu/icu-4.6/samples/break/break.cpp @@ -0,0 +1,143 @@ +/* +******************************************************************************* +* +* Copyright (C) 2002-2003, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +*/ + +#include <stdio.h> +#include <unicode/brkiter.h> +#include <stdlib.h> + +U_CFUNC int c_main(void); + + +void printUnicodeString(const UnicodeString &s) { + char charBuf[1000]; + s.extract(0, s.length(), charBuf, sizeof(charBuf)-1, 0); + charBuf[sizeof(charBuf)-1] = 0; + printf("%s", charBuf); +} + + +void printTextRange( BreakIterator& iterator, + int32_t start, int32_t end ) +{ + CharacterIterator *strIter = iterator.getText().clone(); + UnicodeString s; + strIter->getText(s); + + printf(" %ld %ld\t", (long)start, (long)end); + printUnicodeString(UnicodeString(s, 0, start)); + printf("|"); + printUnicodeString(UnicodeString(s, start, end-start)); + printf("|"); + printUnicodeString(UnicodeString(s, end)); + puts(""); + delete strIter; +} + + +/* Print each element in order: */ +void printEachForward( BreakIterator& boundary) +{ + int32_t start = boundary.first(); + for (int32_t end = boundary.next(); + end != BreakIterator::DONE; + start = end, end = boundary.next()) + { + printTextRange( boundary, start, end ); + } +} + +/* Print each element in reverse order: */ +void printEachBackward( BreakIterator& boundary) +{ + int32_t end = boundary.last(); + for (int32_t start = boundary.previous(); + start != BreakIterator::DONE; + end = start, start = boundary.previous()) + { + printTextRange( boundary, start, end ); + } +} + +/* Print the first element */ +void printFirst(BreakIterator& boundary) +{ + int32_t start = boundary.first(); + int32_t end = boundary.next(); + printTextRange( boundary, start, end ); +} + +/* Print the last element */ +void printLast(BreakIterator& boundary) +{ + int32_t end = boundary.last(); + int32_t start = boundary.previous(); + printTextRange( boundary, start, end ); +} + +/* Print the element at a specified position */ +void printAt(BreakIterator &boundary, int32_t pos ) +{ + int32_t end = boundary.following(pos); + int32_t start = boundary.previous(); + printTextRange( boundary, start, end ); +} + +/* Creating and using text boundaries */ +int main( void ) +{ + puts("ICU Break Iterator Sample Program\n"); + puts("C++ Break Iteration\n"); + BreakIterator* boundary; + UnicodeString stringToExamine("Aaa bbb ccc. Ddd eee fff."); + printf("Examining: "); + printUnicodeString(stringToExamine); + puts(""); + + //print each sentence in forward and reverse order + UErrorCode status = U_ZERO_ERROR; + boundary = BreakIterator::createSentenceInstance( + Locale::getUS(), status ); + if (U_FAILURE(status)) { + printf("failed to create sentence break iterator. status = %s", + u_errorName(status)); + exit(1); + } + + boundary->setText(stringToExamine); + puts("\n Sentence Boundaries... "); + puts("----- forward: -----------"); + printEachForward(*boundary); + puts("----- backward: ----------"); + printEachBackward(*boundary); + delete boundary; + + //print each word in order + printf("\n Word Boundaries... \n"); + boundary = BreakIterator::createWordInstance( + Locale::getUS(), status); + boundary->setText(stringToExamine); + puts("----- forward: -----------"); + printEachForward(*boundary); + //print first element + puts("----- first: -------------"); + printFirst(*boundary); + //print last element + puts("----- last: --------------"); + printLast(*boundary); + //print word at charpos 10 + puts("----- at pos 10: ---------"); + printAt(*boundary, 10 ); + + delete boundary; + + puts("\nEnd C++ Break Iteration"); + + // Call the C version + return c_main(); +} diff --git a/Build/source/libs/icu/icu-4.6/samples/break/break.sln b/Build/source/libs/icu/icu-4.6/samples/break/break.sln new file mode 100644 index 00000000000..672779ace0e --- /dev/null +++ b/Build/source/libs/icu/icu-4.6/samples/break/break.sln @@ -0,0 +1,25 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "break", "break.vcproj", "{DEEADF02-9C14-4854-A395-E505D2904D65}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DEEADF02-9C14-4854-A395-E505D2904D65}.Debug|Win32.ActiveCfg = Debug|Win32 + {DEEADF02-9C14-4854-A395-E505D2904D65}.Debug|Win32.Build.0 = Debug|Win32 + {DEEADF02-9C14-4854-A395-E505D2904D65}.Debug|x64.ActiveCfg = Debug|Win32 + {DEEADF02-9C14-4854-A395-E505D2904D65}.Debug|x64.Build.0 = Debug|Win32 + {DEEADF02-9C14-4854-A395-E505D2904D65}.Release|Win32.ActiveCfg = Release|Win32 + {DEEADF02-9C14-4854-A395-E505D2904D65}.Release|Win32.Build.0 = Release|Win32 + {DEEADF02-9C14-4854-A395-E505D2904D65}.Release|x64.ActiveCfg = Release|Win32 + {DEEADF02-9C14-4854-A395-E505D2904D65}.Release|x64.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Build/source/libs/icu/icu-4.6/samples/break/break.vcxproj b/Build/source/libs/icu/icu-4.6/samples/break/break.vcxproj new file mode 100644 index 00000000000..638469586c5 --- /dev/null +++ b/Build/source/libs/icu/icu-4.6/samples/break/break.vcxproj @@ -0,0 +1,259 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{DEEADF02-9C14-4854-A395-E505D2904D65}</ProjectGuid>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseOfMfc>false</UseOfMfc>
+ <CharacterSet>MultiByte</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\x86\Release\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\x86\Release\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\x64\Release\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\x64\Release\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\x86\Debug\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\x86\Debug\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\x64\Debug\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\x64\Debug\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\x86\Release/break.tlb</TypeLibraryName>
+ </Midl>
+ <ClCompile>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <PrecompiledHeaderOutputFile>.\x86\Release/break.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>.\x86\Release/</AssemblerListingLocation>
+ <ObjectFileName>.\x86\Release/</ObjectFileName>
+ <ProgramDataBaseFileName>.\x86\Release/</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>icuuc.lib;icuin.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>.\x86\Release/break.exe</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <AdditionalLibraryDirectories>..\..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>.\x86\Release/break.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <Midl>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>X64</TargetEnvironment>
+ <TypeLibraryName>.\x64\Release/break.tlb</TypeLibraryName>
+ </Midl>
+ <ClCompile>
+ <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+ <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <StringPooling>true</StringPooling>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <PrecompiledHeaderOutputFile>.\x64\Release/break.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>.\x64\Release/</AssemblerListingLocation>
+ <ObjectFileName>.\x64\Release/</ObjectFileName>
+ <ProgramDataBaseFileName>.\x64\Release/</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>icuuc.lib;icuin.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>.\x64\Release/break.exe</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <AdditionalLibraryDirectories>..\..\..\lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <ProgramDatabaseFile>.\x64\Release/break.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>Win32</TargetEnvironment>
+ <TypeLibraryName>.\x86\Debug/break.tlb</TypeLibraryName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <PrecompiledHeaderOutputFile>.\x86\Debug/break.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>.\x86\Debug/</AssemblerListingLocation>
+ <ObjectFileName>.\x86\Debug/</ObjectFileName>
+ <ProgramDataBaseFileName>.\x86\Debug/</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>icuucd.lib;icuind.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>.\x86\Debug/break.exe</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <AdditionalLibraryDirectories>..\..\..\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\x86\Debug/break.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <Midl>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MkTypLibCompatible>true</MkTypLibCompatible>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <TargetEnvironment>X64</TargetEnvironment>
+ <TypeLibraryName>.\x64\Debug/break.tlb</TypeLibraryName>
+ </Midl>
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <AdditionalIncludeDirectories>..\..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <PrecompiledHeaderOutputFile>.\x64\Debug/break.pch</PrecompiledHeaderOutputFile>
+ <AssemblerListingLocation>.\x64\Debug/</AssemblerListingLocation>
+ <ObjectFileName>.\x64\Debug/</ObjectFileName>
+ <ProgramDataBaseFileName>.\x64\Debug/</ProgramDataBaseFileName>
+ <WarningLevel>Level3</WarningLevel>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <CompileAs>Default</CompileAs>
+ </ClCompile>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <Culture>0x0409</Culture>
+ </ResourceCompile>
+ <Link>
+ <AdditionalDependencies>icuucd.lib;icuind.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <OutputFile>.\x64\Debug/break.exe</OutputFile>
+ <SuppressStartupBanner>true</SuppressStartupBanner>
+ <AdditionalLibraryDirectories>..\..\..\lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <ProgramDatabaseFile>.\x64\Debug/break.pdb</ProgramDatabaseFile>
+ <SubSystem>Console</SubSystem>
+ <RandomizedBaseAddress>false</RandomizedBaseAddress>
+ <DataExecutionPrevention>
+ </DataExecutionPrevention>
+ <TargetMachine>MachineX64</TargetMachine>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="break.cpp" />
+ <ClCompile Include="ubreak.c" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> diff --git a/Build/source/libs/icu/icu-4.6/samples/break/break.vcxproj.filters b/Build/source/libs/icu/icu-4.6/samples/break/break.vcxproj.filters new file mode 100644 index 00000000000..c9271f8ecae --- /dev/null +++ b/Build/source/libs/icu/icu-4.6/samples/break/break.vcxproj.filters @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{3cfd1084-1652-4648-bb97-9b38a2780005}</UniqueIdentifier>
+ <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{34cb1edc-aa5a-4702-b867-a867ebe8496c}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{6aea4120-7995-4705-b3b7-7013af485c18}</UniqueIdentifier>
+ <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="break.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="ubreak.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+</Project>
\ No newline at end of file diff --git a/Build/source/libs/icu/icu-4.6/samples/break/readme.txt b/Build/source/libs/icu/icu-4.6/samples/break/readme.txt new file mode 100644 index 00000000000..de76e2df356 --- /dev/null +++ b/Build/source/libs/icu/icu-4.6/samples/break/readme.txt @@ -0,0 +1,60 @@ +Copyright (c) 2002-2010, International Business Machines Corporation and others. All Rights Reserved. +break: Boundary Analysis + +This sample demonstrates + Using ICU to determine the linguistic boundaries within text + + +Files: + break.cpp Main source file in C++ + ubreak.c Main source file in C + break.sln Windows MSVC workspace. Double-click this to get started. + break.vcproj Windows MSVC project file + +To Build break on Windows + 1. Install and build ICU + 2. In MSVC, open the workspace file icu\samples\break\break.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 break directory, e.g. + cd c:\icu\source\samples\break\debug + 4. Run it (Warning: Be careful, 'break' is also a system command on many systems) + .\break + +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/break + gmake ICU_PREFIX=<icu install directory) + + To Run on Unixes + cd <icu directory>/source/samples/break + + gmake ICU_PREFIX=<icu install directory> check + -or- + + export LD_LIBRARY_PATH=<icu install directory>/lib:.:$LD_LIBRARY_PATH + break + + + 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/icu-4.6/samples/break/ubreak.c b/Build/source/libs/icu/icu-4.6/samples/break/ubreak.c new file mode 100644 index 00000000000..e70d877b303 --- /dev/null +++ b/Build/source/libs/icu/icu-4.6/samples/break/ubreak.c @@ -0,0 +1,128 @@ +/* +******************************************************************************* +* +* Copyright (C) 2002, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <unicode/ustring.h> +#include <unicode/ubrk.h> + +U_CFUNC int c_main(void); + +void printTextRange(UChar* str, int32_t start, int32_t end) +{ + char charBuf[1000]; + UChar savedEndChar; + + savedEndChar = str[end]; + str[end] = 0; + u_austrncpy(charBuf, str+start, sizeof(charBuf)-1); + charBuf[sizeof(charBuf)-1]=0; + printf("string[%2d..%2d] \"%s\"\n", start, end-1, charBuf); + str[end] = savedEndChar; +} + + + +/* Print each element in order: */ +void printEachForward( UBreakIterator* boundary, UChar* str) { + int32_t end; + int32_t start = ubrk_first(boundary); + for (end = ubrk_next(boundary); end != UBRK_DONE; start = end, end = + ubrk_next(boundary)) { + printTextRange(str, start, end ); + } +} + + +/* Print each element in reverse order: */ +void printEachBackward( UBreakIterator* boundary, UChar* str) { + int32_t start; + int32_t end = ubrk_last(boundary); + for (start = ubrk_previous(boundary); start != UBRK_DONE; end = start, + start =ubrk_previous(boundary)) { + printTextRange( str, start, end ); + } +} + +/* Print first element */ +void printFirst(UBreakIterator* boundary, UChar* str) { + int32_t end; + int32_t start = ubrk_first(boundary); + end = ubrk_next(boundary); + printTextRange( str, start, end ); +} + +/* Print last element */ +void printLast(UBreakIterator* boundary, UChar* str) { + int32_t start; + int32_t end = ubrk_last(boundary); + start = ubrk_previous(boundary); + printTextRange(str, start, end ); +} + +/* Print the element at a specified position */ + +void printAt(UBreakIterator* boundary, int32_t pos , UChar* str) { + int32_t start; + int32_t end = ubrk_following(boundary, pos); + start = ubrk_previous(boundary); + printTextRange(str, start, end ); +} + +/* Creating and using text boundaries*/ + +int c_main( void ) { + UBreakIterator *boundary; + char cStringToExamine[] = "Aaa bbb ccc. Ddd eee fff."; + UChar stringToExamine[sizeof(cStringToExamine)+1]; + UErrorCode status = U_ZERO_ERROR; + + printf("\n\n" + "C Boundary Analysis\n" + "-------------------\n\n"); + + printf("Examining: %s\n", cStringToExamine); + u_uastrcpy(stringToExamine, cStringToExamine); + + /*print each sentence in forward and reverse order*/ + boundary = ubrk_open(UBRK_SENTENCE, "en_us", stringToExamine, + -1, &status); + if (U_FAILURE(status)) { + printf("ubrk_open error: %s\n", u_errorName(status)); + exit(1); + } + + printf("\n----- Sentence Boundaries, forward: -----------\n"); + printEachForward(boundary, stringToExamine); + printf("\n----- Sentence Boundaries, backward: ----------\n"); + printEachBackward(boundary, stringToExamine); + ubrk_close(boundary); + + /*print each word in order*/ + boundary = ubrk_open(UBRK_WORD, "en_us", stringToExamine, + u_strlen(stringToExamine), &status); + printf("\n----- Word Boundaries, forward: -----------\n"); + printEachForward(boundary, stringToExamine); + printf("\n----- Word Boundaries, backward: ----------\n"); + printEachBackward(boundary, stringToExamine); + /*print first element*/ + printf("\n----- first: -------------\n"); + printFirst(boundary, stringToExamine); + /*print last element*/ + printf("\n----- last: --------------\n"); + printLast(boundary, stringToExamine); + /*print word at charpos 10 */ + printf("\n----- at pos 10: ---------\n"); + printAt(boundary, 10 , stringToExamine); + + ubrk_close(boundary); + + printf("\nEnd of C boundary analysis\n"); + return 0; +} |