diff options
Diffstat (limited to 'Build/source/libs/icu/icu-50.1/samples/csdet')
5 files changed, 370 insertions, 0 deletions
diff --git a/Build/source/libs/icu/icu-50.1/samples/csdet/Makefile b/Build/source/libs/icu/icu-50.1/samples/csdet/Makefile new file mode 100644 index 00000000000..410590a2c11 --- /dev/null +++ b/Build/source/libs/icu/icu-50.1/samples/csdet/Makefile @@ -0,0 +1,22 @@ +# Copyright (c) 2000-2007 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=csdet + +# All object files (C or C++) +OBJECTS=csdet.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-50.1/samples/csdet/csdet.c b/Build/source/libs/icu/icu-50.1/samples/csdet/csdet.c new file mode 100644 index 00000000000..b0c89f28599 --- /dev/null +++ b/Build/source/libs/icu/icu-50.1/samples/csdet/csdet.c @@ -0,0 +1,73 @@ +/* + ******************************************************************************** + * Copyright (C) 2005-2006, International Business Machines + * Corporation and others. All Rights Reserved. + ******************************************************************************** + */ + +#include "unicode/utypes.h" +#include "unicode/ucsdet.h" + +#include <string.h> +#include <stdio.h> + +#define BUFFER_SIZE 8192 + +int main(int argc, char *argv[]) +{ + static char buffer[BUFFER_SIZE]; + int32_t arg; + + if( argc <= 1 ) { + printf("Usage: %s [filename]...\n", argv[0]); + return -1; + } + + for(arg = 1; arg < argc; arg += 1) { + FILE *file; + char *filename = argv[arg]; + int32_t inputLength, match, matchCount = 0; + UCharsetDetector* csd; + const UCharsetMatch **csm; + UErrorCode status = U_ZERO_ERROR; + + if (arg > 1) { + printf("\n"); + } + + file = fopen(filename, "rb"); + + if (file == NULL) { + printf("Cannot open file \"%s\"\n\n", filename); + continue; + } + + printf("%s:\n", filename); + + inputLength = (int32_t) fread(buffer, 1, BUFFER_SIZE, file); + + fclose(file); + + csd = ucsdet_open(&status); + ucsdet_setText(csd, buffer, inputLength, &status); + + csm = ucsdet_detectAll(csd, &matchCount, &status); + + for(match = 0; match < matchCount; match += 1) { + const char *name = ucsdet_getName(csm[match], &status); + const char *lang = ucsdet_getLanguage(csm[match], &status); + int32_t confidence = ucsdet_getConfidence(csm[match], &status); + + if (lang == NULL || strlen(lang) == 0) { + lang = "**"; + } + + printf("%s (%s) %d\n", name, lang, confidence); + } + + ucsdet_close(csd); + } + + return 0; +} + diff --git a/Build/source/libs/icu/icu-50.1/samples/csdet/csdet.vcxproj b/Build/source/libs/icu/icu-50.1/samples/csdet/csdet.vcxproj new file mode 100644 index 00000000000..f9891a66ea8 --- /dev/null +++ b/Build/source/libs/icu/icu-50.1/samples/csdet/csdet.vcxproj @@ -0,0 +1,193 @@ +<?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>{683745AD-3BC2-4B89-898B-93490D7F2757}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </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|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|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)'=='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> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <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> + <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> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>icuucd.lib;icuind.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)csdet.exe</OutputFile> + <AdditionalLibraryDirectories>../../../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(OutDir)csdet.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> + <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>icuucd.lib;icuind.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)csdet.exe</OutputFile> + <AdditionalLibraryDirectories>../../../lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(OutDir)csdet.pdb</ProgramDatabaseFile> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>icuuc.lib;icuin.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)csdet.exe</OutputFile> + <AdditionalLibraryDirectories>../../../lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreaded</RuntimeLibrary> + <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>icuuc.lib;icuin.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)csdet.exe</OutputFile> + <AdditionalLibraryDirectories>../../../lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="csdet.c" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> diff --git a/Build/source/libs/icu/icu-50.1/samples/csdet/csdet.vcxproj.filters b/Build/source/libs/icu/icu-50.1/samples/csdet/csdet.vcxproj.filters new file mode 100644 index 00000000000..5db334a0be3 --- /dev/null +++ b/Build/source/libs/icu/icu-50.1/samples/csdet/csdet.vcxproj.filters @@ -0,0 +1,22 @@ +<?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>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="csdet.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Build/source/libs/icu/icu-50.1/samples/csdet/readme.txt b/Build/source/libs/icu/icu-50.1/samples/csdet/readme.txt new file mode 100644 index 00000000000..42f18092f8b --- /dev/null +++ b/Build/source/libs/icu/icu-50.1/samples/csdet/readme.txt @@ -0,0 +1,60 @@ +Copyright (c) 2001-2010 International Business Machines +Corporation and others. All Rights Reserved. +uresb: Resource Bundle + +This sample demonstrates + Using ICU's CharSet Detection API + + +Files: + csdet.c Main source file + *.txt Various sample .txt files + +To Build uresb on Windows + 1. Install and build ICU + 2. In MSVC, open the workspace file icu\samples\uresb\uresb.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 uresb directory, e.g. + cd c:\icu\source\samples\uresb\debug + 4. Run it (with a locale name, ex. english) + csdet eucJP.txt + WARNING: The .txt files must be in the same directory as the executable, which is not the case by default on some systems. + +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/uresb + gmake ICU_PREFIX=<icu install directory) ICU_PATH=<icu source directory> + + To Run on Unixes + cd <icu directory>/source/samples/uresb + + gmake ICU_PREFIX=<icu install directory> check + -or- + + export LD_LIBRARY_PATH=<icu install directory>/lib:.:$LD_LIBRARY_PATH + csdet eucJP.txt + + + 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. + |