mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-6633 DLL plugin.. merge onto trunk from branches/srl/dll6633 and branches/srl/dll6633bis
(specifically, r26808:27031 of http://source.icu-project.org/repos/icu/icu/branches/srl/dll6633 and then r27117 r27118 r27119 r27121 r27137 r27139 r27159 r27160 r27172 r27173 r27181 r27182 ) X-SVN-Rev: 27195
This commit is contained in:
parent
282dba0dc7
commit
800da956b2
28 changed files with 4950 additions and 719 deletions
3
.gitattributes
vendored
3
.gitattributes
vendored
|
@ -62,6 +62,9 @@ icu4c/source/test/testdata/icu26e_testtypes.res -text
|
|||
icu4c/source/test/testdata/importtest.bin -text
|
||||
icu4c/source/test/testdata/iscii.bin -text
|
||||
icu4c/source/test/testdata/uni-text.bin -text
|
||||
icu4c/source/tools/icuinfo/icuinfo.vcproj -text
|
||||
icu4c/source/tools/icuinfo/icuplugins_windows_sample.txt -text
|
||||
icu4c/source/tools/icuinfo/testplug.vcproj -text
|
||||
icu4j/build.properties -text
|
||||
icu4j/demos/manifest.stub -text
|
||||
icu4j/icu-eclipse/misc/ICUConfig.properties -text
|
||||
|
|
9
.gitignore
vendored
9
.gitignore
vendored
|
@ -668,6 +668,15 @@ icu4c/source/tools/genuca/genuca.vcproj.*.*.user
|
|||
icu4c/source/tools/genuca/release
|
||||
icu4c/source/tools/genuca/x64
|
||||
icu4c/source/tools/genuca/x86
|
||||
icu4c/source/tools/icuinfo/*.d
|
||||
icu4c/source/tools/icuinfo/*.dylib
|
||||
icu4c/source/tools/icuinfo/*.o
|
||||
icu4c/source/tools/icuinfo/*.so
|
||||
icu4c/source/tools/icuinfo/Makefile
|
||||
icu4c/source/tools/icuinfo/Makefile.local
|
||||
icu4c/source/tools/icuinfo/icuinfo
|
||||
icu4c/source/tools/icuinfo/icuinfo.exe
|
||||
icu4c/source/tools/icuinfo/icuplugins*.txt
|
||||
icu4c/source/tools/icupkg/*.8
|
||||
icu4c/source/tools/icupkg/*.d
|
||||
icu4c/source/tools/icupkg/*.ncb
|
||||
|
|
|
@ -265,7 +265,25 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gennorm2", "..\tools\gennor
|
|||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icuinfo", "..\tools\icuinfo\icuinfo.vcproj", "{E7611F49-F088-4175-9446-6111444E72C8}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
|
||||
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47} = {ECA6B435-B4FA-4F9F-BF95-F451D078FC47}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testplug", "..\tools\icuinfo\testplug.vcproj", "{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47} = {ECA6B435-B4FA-4F9F-BF95-F451D078FC47}
|
||||
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SubversionScc) = preSolution
|
||||
Svn-Managed = True
|
||||
Manager = AnkhSVN - Subversion Support for Visual Studio
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
|
@ -569,6 +587,22 @@ Global
|
|||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Release|Win32.Build.0 = Release|Win32
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Release|x64.ActiveCfg = Release|x64
|
||||
{C7891A65-80AB-4245-912E-5F1E17B0E6C4}.Release|x64.Build.0 = Release|x64
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Debug|x64.Build.0 = Debug|x64
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Release|Win32.Build.0 = Release|Win32
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Release|x64.ActiveCfg = Release|x64
|
||||
{E7611F49-F088-4175-9446-6111444E72C8}.Release|x64.Build.0 = Release|x64
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Debug|x64.Build.0 = Debug|x64
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Release|Win32.Build.0 = Release|Win32
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Release|x64.ActiveCfg = Release|x64
|
||||
{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -61,9 +61,13 @@ ifneq ($(top_builddir),$(top_srcdir))
|
|||
CPPFLAGS += -I$(top_builddir)/common
|
||||
endif
|
||||
CPPFLAGS += -I$(srcdir) -I$(top_srcdir)/i18n $(LIBCPPFLAGS) $(CPPFLAGSICUUC)
|
||||
DEFS += -DU_COMMON_IMPLEMENTATION
|
||||
# we want DEFS here, because we want icucfg.h
|
||||
DEFS += -DU_COMMON_IMPLEMENTATION @DEFS@
|
||||
LDFLAGS += $(LDFLAGSICUUC)
|
||||
|
||||
# for plugin configuration
|
||||
CPPFLAGS += "-DDEFAULT_ICU_PLUGINS=\"$(libdir)/icu\" "
|
||||
|
||||
# $(LIBICUDT) is either stub data or the real DLL common data.
|
||||
LIBS = $(LIBICUDT) $(DEFAULT_LIBS)
|
||||
|
||||
|
@ -88,7 +92,7 @@ rbbi.o rbbidata.o rbbinode.o rbbirb.o rbbiscan.o rbbisetb.o rbbistbl.o rbbitblb.
|
|||
serv.o servnotf.o servls.o servlk.o servlkf.o servrbf.o servslkf.o \
|
||||
uidna.o usprep.o punycode.o \
|
||||
util.o util_props.o parsepos.o locbased.o cwchar.o wintz.o mutex.o dtintrv.o ucnvsel.o propsvec.o \
|
||||
ulist.o uloc_tag.o icudataver.o
|
||||
ulist.o uloc_tag.o icudataver.o icuplug.o
|
||||
|
||||
## Header files to install
|
||||
HEADERS = $(srcdir)/unicode/*.h unicode/*.h
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,61 +1,115 @@
|
|||
/* common/icucfg.h.in. Generated automatically from configure.in by autoheader. */
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
/* common/icucfg.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define if your processor stores words with the most significant
|
||||
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
/* Define if building universal (internal helper macro) */
|
||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||
|
||||
/* Copyright (c) 1999-2000, International Business Machines Corporation and
|
||||
others. All Rights Reserved. */
|
||||
/* Define to signed char if not in <sys/types.h> */
|
||||
#undef int8_t
|
||||
/* Define to 1 if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to unsigned char if not in <sys/types.h> */
|
||||
#undef uint8_t
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to signed short if not in <sys/types.h> */
|
||||
#undef int16_t
|
||||
/* Define to 1 if you have the `dlopen' function. */
|
||||
#undef HAVE_DLOPEN
|
||||
|
||||
/* Define to unsigned short if not in <sys/types.h> */
|
||||
#undef uint16_t
|
||||
|
||||
/* Define to signed long if not in <sys/types.h> */
|
||||
#undef int32_t
|
||||
|
||||
/* Define to unsigned long if not in <sys/types.h> */
|
||||
#undef uint32_t
|
||||
|
||||
/* Define to signed char if not in <sys/types.h> */
|
||||
#undef bool_t
|
||||
|
||||
/* Define if your system has <wchar.h> */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
/* Define to the size of wchar_t */
|
||||
#undef SIZEOF_WCHAR_T
|
||||
|
||||
/* Define if you have the <inttypes.h> header file. */
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define if you have the cma library (-lcma). */
|
||||
#undef HAVE_LIBCMA
|
||||
|
||||
/* Define if you have the dl library (-ldl). */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
/* Define if you have the dld library (-ldld). */
|
||||
#undef HAVE_LIBDLD
|
||||
|
||||
/* Define if you have the m library (-lm). */
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define if you have the pthread library (-lpthread). */
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#undef HAVE_LIBPTHREAD
|
||||
|
||||
/* Define if you have the pthreads library (-lpthreads). */
|
||||
#undef HAVE_LIBPTHREADS
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define if you have the wcs library (-lwcs). */
|
||||
#undef HAVE_LIBWCS
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Uncomment This to run Autoheader */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of `wchar_t', as computed by sizeof. */
|
||||
#undef SIZEOF_WCHAR_T
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
# undef WORDS_BIGENDIAN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define to `signed short' if <sys/types.h> does not define. */
|
||||
#undef int16_t
|
||||
|
||||
/* Define to `signed long' if <sys/types.h> does not define. */
|
||||
#undef int32_t
|
||||
|
||||
/* Define to `signed long long' if <sys/types.h> does not define. */
|
||||
#undef int64_t
|
||||
|
||||
/* Define to `signed char' if <sys/types.h> does not define. */
|
||||
#undef int8_t
|
||||
|
||||
/* Define to `unsigned short' if <sys/types.h> does not define. */
|
||||
#undef uint16_t
|
||||
|
||||
/* Define to `unsigned long' if <sys/types.h> does not define. */
|
||||
#undef uint32_t
|
||||
|
||||
/* Define to `unsigned long long' if <sys/types.h> does not define. */
|
||||
#undef uint64_t
|
||||
|
||||
/* Define to `unsigned char' if <sys/types.h> does not define. */
|
||||
#undef uint8_t
|
||||
|
|
831
icu4c/source/common/icuplug.c
Normal file
831
icu4c/source/common/icuplug.c
Normal file
|
@ -0,0 +1,831 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* FILE NAME : icuplug.c
|
||||
*
|
||||
* Date Name Description
|
||||
* 10/29/2009 sl New.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#include "unicode/icuplug.h"
|
||||
#include "icuplugimp.h"
|
||||
#include "cstring.h"
|
||||
#include "cmemory.h"
|
||||
#include "putilimp.h"
|
||||
#include "ucln.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef UPLUG_TRACE
|
||||
#define UPLUG_TRACE 0
|
||||
#endif
|
||||
|
||||
#if UPLUG_TRACE
|
||||
#include <stdio.h>
|
||||
#define DBG(x) printf("%s:%d: ",__FILE__,__LINE__); printf x;
|
||||
#else
|
||||
#define DBG(x)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Internal structure of an ICU plugin.
|
||||
*/
|
||||
|
||||
struct UPlugData {
|
||||
UPlugEntrypoint *entrypoint; /**< plugin entrypoint */
|
||||
uint32_t structSize; /**< initialized to the size of this structure */
|
||||
uint32_t token; /**< must be U_PLUG_TOKEN */
|
||||
void *lib; /**< plugin library, or NULL */
|
||||
char libName[UPLUG_NAME_MAX]; /**< library name */
|
||||
char sym[UPLUG_NAME_MAX]; /**< plugin symbol, or NULL */
|
||||
char config[UPLUG_NAME_MAX]; /**< configuration data */
|
||||
void *context; /**< user context data */
|
||||
char name[UPLUG_NAME_MAX]; /**< name of plugin */
|
||||
UPlugLevel level; /**< level of plugin */
|
||||
UBool awaitingLoad; /**< TRUE if the plugin is awaiting a load call */
|
||||
UBool dontUnload; /**< TRUE if plugin must stay resident (leak plugin and lib) */
|
||||
UErrorCode pluginStatus; /**< status code of plugin */
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define UPLUG_LIBRARY_INITIAL_COUNT 8
|
||||
#define UPLUG_PLUGIN_INITIAL_COUNT 12
|
||||
|
||||
|
||||
/*
|
||||
- have a callback to determine HIGH or LOW level
|
||||
- automatically run all LOW level then HIGH level plugins in order
|
||||
- have icuinfo give diagnostics and info
|
||||
- have icuinfo give sample config file and location.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Remove an item
|
||||
* @param list the full list
|
||||
* @param listSize the number of entries in the list
|
||||
* @param memberSize the size of one member
|
||||
* @param itemToRemove the item number of the member
|
||||
* @return the new listsize
|
||||
*/
|
||||
static int32_t uplug_removeEntryAt(void *list, int32_t listSize, int32_t memberSize, int32_t itemToRemove) {
|
||||
uint8_t *bytePtr = (uint8_t *)list;
|
||||
|
||||
/* get rid of some bad cases first */
|
||||
if(listSize<1) {
|
||||
return listSize;
|
||||
}
|
||||
|
||||
/* is there anything to move? */
|
||||
if(listSize > itemToRemove+1) {
|
||||
memmove(bytePtr+(itemToRemove*memberSize), bytePtr+((itemToRemove+1)*memberSize), memberSize);
|
||||
}
|
||||
|
||||
return listSize-1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if U_ENABLE_DYLOAD
|
||||
/**
|
||||
* Library management. Internal.
|
||||
* @internal
|
||||
*/
|
||||
struct UPlugLibrary;
|
||||
|
||||
/**
|
||||
* Library management. Internal.
|
||||
* @internal
|
||||
*/
|
||||
typedef struct UPlugLibrary {
|
||||
void *lib; /**< library ptr */
|
||||
char name[UPLUG_NAME_MAX]; /**< library name */
|
||||
uint32_t ref; /**< reference count */
|
||||
} UPlugLibrary;
|
||||
|
||||
UPlugLibrary staticLibraryList[UPLUG_LIBRARY_INITIAL_COUNT];
|
||||
UPlugLibrary * libraryList = staticLibraryList;
|
||||
int32_t libraryCount = 0;
|
||||
int32_t libraryMax = UPLUG_LIBRARY_INITIAL_COUNT;
|
||||
|
||||
/**
|
||||
* Search for a library. Doesn't lock
|
||||
* @param libName libname to search for
|
||||
* @return the library's struct
|
||||
*/
|
||||
static int32_t searchForLibraryName(const char *libName) {
|
||||
int32_t i;
|
||||
|
||||
for(i=0;i<libraryCount;i++) {
|
||||
if(!uprv_strcmp(libName, libraryList[i].name)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int32_t searchForLibrary(void *lib) {
|
||||
int32_t i;
|
||||
|
||||
for(i=0;i<libraryCount;i++) {
|
||||
if(lib==libraryList[i].lib) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
U_INTERNAL char * U_EXPORT2
|
||||
uplug_findLibrary(void *lib, UErrorCode *status) {
|
||||
int32_t libEnt;
|
||||
char *ret = NULL;
|
||||
if(U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
libEnt = searchForLibrary(lib);
|
||||
if(libEnt!=-1) {
|
||||
ret = libraryList[libEnt].name;
|
||||
} else {
|
||||
*status = U_MISSING_RESOURCE_ERROR;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
U_INTERNAL void * U_EXPORT2
|
||||
uplug_openLibrary(const char *libName, UErrorCode *status) {
|
||||
int32_t libEntry = -1;
|
||||
void *lib = NULL;
|
||||
|
||||
DBG(("uplug_openLibrary(%s,%s)\n", libName, u_errorName(*status)))
|
||||
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
|
||||
DBG(("uplug_openLibrary(%s,%s)\n", libName, u_errorName(*status)))
|
||||
|
||||
libEntry = searchForLibraryName(libName);
|
||||
DBG(("uplug_openLibrary(%s,%s) libEntry %d\n", libName, u_errorName(*status), libEntry))
|
||||
if(libEntry == -1) {
|
||||
libEntry = libraryCount++;
|
||||
|
||||
/* Some operating systems don't want
|
||||
DL operations from multiple threads. */
|
||||
libraryList[libEntry].lib = uprv_dl_open(libName, status);
|
||||
DBG(("uplug_openLibrary(%s,%s) libEntry %d, lib %p\n", libName, u_errorName(*status), libEntry, lib))
|
||||
|
||||
if(libraryList[libEntry].lib == NULL || U_FAILURE(*status)) {
|
||||
/* cleanup. */
|
||||
libraryList[libEntry].lib = NULL; /* failure with open */
|
||||
libraryList[libEntry].name[0] = 0;
|
||||
DBG(("uplug_openLibrary(%s,%s) libEntry %d, lib %p\n", libName, u_errorName(*status), libEntry, lib))
|
||||
/* no need to free - just won't increase the count. */
|
||||
DBG(("uplug_openLibrary(%s,%s) libEntry %d, lib %p\n", libName, u_errorName(*status), libEntry, lib))
|
||||
libraryCount--;
|
||||
} else { /* is it still there? */
|
||||
/* link it in */
|
||||
strncpy(libraryList[libEntry].name,libName,UPLUG_NAME_MAX);
|
||||
libraryList[libEntry].ref=1;
|
||||
lib = libraryList[libEntry].lib;
|
||||
}
|
||||
|
||||
} else {
|
||||
lib = libraryList[libEntry].lib;
|
||||
libraryList[libEntry].ref++;
|
||||
}
|
||||
DBG(("uplug_openLibrary(%s,%s) libEntry %d, lib %p, ref %d\n", libName, u_errorName(*status), libEntry, lib, libEntry?libraryList[libEntry].ref:-1))
|
||||
return lib;
|
||||
}
|
||||
|
||||
U_INTERNAL void U_EXPORT2
|
||||
uplug_closeLibrary(void *lib, UErrorCode *status) {
|
||||
int32_t i;
|
||||
|
||||
DBG(("uplug_closeLibrary(%p,%s) list %p\n", lib, u_errorName(*status), (void*)libraryList))
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
DBG(("uplug_closeLibrary(%p,%s) list %p\n", lib, u_errorName(*status), (void*)libraryList))
|
||||
for(i=0;i<libraryCount;i++) {
|
||||
if(lib==libraryList[i].lib) {
|
||||
DBG(("uplug_closeLibrary(%p,%s) found #%d %p ref %d\n", lib, u_errorName(*status), i, (void*)&libraryList[i], libraryList[i].ref))
|
||||
if(--(libraryList[i].ref) == 0) {
|
||||
DBG(("uplug_closeLibrary(%p,%s) entryToClose #%d %p ref %d\n", lib, u_errorName(*status), i, (void*)&libraryList[i], libraryList[i].ref))
|
||||
uprv_dl_close(libraryList[i].lib, status);
|
||||
libraryCount = uplug_removeEntryAt(libraryList, libraryCount, sizeof(*libraryList), i);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
*status = U_INTERNAL_PROGRAM_ERROR; /* could not find the entry! */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
UPlugData pluginList[UPLUG_PLUGIN_INITIAL_COUNT];
|
||||
int32_t pluginCount = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
static int32_t uplug_pluginNumber(UPlugData* d) {
|
||||
UPlugData *pastPlug = &pluginList[pluginCount];
|
||||
if(d<=pluginList) {
|
||||
return 0;
|
||||
} else if(d>=pastPlug) {
|
||||
return pluginCount;
|
||||
} else {
|
||||
return (d-pluginList)/sizeof(pluginList[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
U_CAPI UPlugData * U_EXPORT2
|
||||
uplug_nextPlug(UPlugData *prior) {
|
||||
if(prior==NULL) {
|
||||
return pluginList;
|
||||
} else {
|
||||
UPlugData *nextPlug = &prior[1];
|
||||
UPlugData *pastPlug = &pluginList[pluginCount];
|
||||
|
||||
if(nextPlug>=pastPlug) {
|
||||
return NULL;
|
||||
} else {
|
||||
return nextPlug;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Call the plugin with some params
|
||||
*/
|
||||
static void uplug_callPlug(UPlugData *plug, UPlugReason reason, UErrorCode *status) {
|
||||
UPlugTokenReturn token;
|
||||
if(plug==NULL||U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
token = (*(plug->entrypoint))(plug, reason, status);
|
||||
if(token!=UPLUG_TOKEN) {
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void uplug_unloadPlug(UPlugData *plug, UErrorCode *status) {
|
||||
if(plug->awaitingLoad) { /* shouldn't happen. Plugin hasn'tbeen loaded yet.*/
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
return;
|
||||
}
|
||||
if(U_SUCCESS(plug->pluginStatus)) {
|
||||
/* Don't unload a plug which has a failing load status - means it didn't actually load. */
|
||||
uplug_callPlug(plug, UPLUG_REASON_UNLOAD, status);
|
||||
}
|
||||
}
|
||||
|
||||
static void uplug_queryPlug(UPlugData *plug, UErrorCode *status) {
|
||||
if(!plug->awaitingLoad || !(plug->level == UPLUG_LEVEL_UNKNOWN) ) { /* shouldn't happen. Plugin hasn'tbeen loaded yet.*/
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
return;
|
||||
}
|
||||
plug->level = UPLUG_LEVEL_INVALID;
|
||||
uplug_callPlug(plug, UPLUG_REASON_QUERY, status);
|
||||
if(U_SUCCESS(*status)) {
|
||||
if(plug->level == UPLUG_LEVEL_INVALID) {
|
||||
plug->pluginStatus = U_PLUGIN_DIDNT_SET_LEVEL;
|
||||
plug->awaitingLoad = FALSE;
|
||||
}
|
||||
} else {
|
||||
plug->pluginStatus = U_INTERNAL_PROGRAM_ERROR;
|
||||
plug->awaitingLoad = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void uplug_loadPlug(UPlugData *plug, UErrorCode *status) {
|
||||
if(!plug->awaitingLoad || (plug->level < UPLUG_LEVEL_LOW) ) { /* shouldn't happen. Plugin hasn'tbeen loaded yet.*/
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
return;
|
||||
}
|
||||
uplug_callPlug(plug, UPLUG_REASON_LOAD, status);
|
||||
plug->awaitingLoad = FALSE;
|
||||
if(!U_SUCCESS(*status)) {
|
||||
plug->pluginStatus = U_INTERNAL_PROGRAM_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
static UPlugData *uplug_allocateEmptyPlug(UErrorCode *status)
|
||||
{
|
||||
UPlugData *plug = NULL;
|
||||
|
||||
if(U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(pluginCount == UPLUG_PLUGIN_INITIAL_COUNT) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
plug = &pluginList[pluginCount++];
|
||||
|
||||
plug->token = UPLUG_TOKEN;
|
||||
plug->structSize = sizeof(UPlugData);
|
||||
plug->name[0]=0;
|
||||
plug->level = UPLUG_LEVEL_UNKNOWN; /* initialize to null state */
|
||||
plug->awaitingLoad = TRUE;
|
||||
plug->dontUnload = FALSE;
|
||||
plug->pluginStatus = U_ZERO_ERROR;
|
||||
plug->libName[0] = 0;
|
||||
plug->config[0]=0;
|
||||
plug->sym[0]=0;
|
||||
plug->lib=NULL;
|
||||
plug->entrypoint=NULL;
|
||||
|
||||
|
||||
return plug;
|
||||
}
|
||||
|
||||
static UPlugData *uplug_allocatePlug(UPlugEntrypoint *entrypoint, const char *config, void *lib, const char *symName,
|
||||
UErrorCode *status) {
|
||||
UPlugData *plug;
|
||||
|
||||
if(U_FAILURE(*status)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
plug = uplug_allocateEmptyPlug(status);
|
||||
if(config!=NULL) {
|
||||
strncpy(plug->config, config, UPLUG_NAME_MAX);
|
||||
} else {
|
||||
plug->config[0] = 0;
|
||||
}
|
||||
|
||||
if(symName!=NULL) {
|
||||
strncpy(plug->sym, symName, UPLUG_NAME_MAX);
|
||||
} else {
|
||||
plug->sym[0] = 0;
|
||||
}
|
||||
|
||||
plug->entrypoint = entrypoint;
|
||||
plug->lib = lib;
|
||||
uplug_queryPlug(plug, status);
|
||||
|
||||
return plug;
|
||||
}
|
||||
|
||||
static void uplug_deallocatePlug(UPlugData *plug, UErrorCode *status) {
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
if(!plug->dontUnload) {
|
||||
#if U_ENABLE_DYLOAD
|
||||
uplug_closeLibrary(plug->lib, &subStatus);
|
||||
#endif
|
||||
}
|
||||
plug->lib = NULL;
|
||||
if(U_SUCCESS(*status) && U_FAILURE(subStatus)) {
|
||||
*status = subStatus;
|
||||
}
|
||||
/* shift plugins up and decrement count. */
|
||||
if(U_SUCCESS(*status)) {
|
||||
/* all ok- remove. */
|
||||
pluginCount = uplug_removeEntryAt(pluginList, pluginCount, sizeof(plug[0]), uplug_pluginNumber(plug));
|
||||
} else {
|
||||
/* not ok- leave as a message. */
|
||||
plug->awaitingLoad=FALSE;
|
||||
plug->entrypoint=0;
|
||||
plug->dontUnload=TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void uplug_doUnloadPlug(UPlugData *plugToRemove, UErrorCode *status) {
|
||||
if(plugToRemove != NULL) {
|
||||
uplug_unloadPlug(plugToRemove, status);
|
||||
uplug_deallocatePlug(plugToRemove, status);
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_removePlug(UPlugData *plug, UErrorCode *status) {
|
||||
UPlugData *cursor = NULL;
|
||||
UPlugData *plugToRemove = NULL;
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
for(cursor=pluginList;cursor!=NULL;) {
|
||||
if(cursor==plug) {
|
||||
plugToRemove = plug;
|
||||
cursor=NULL;
|
||||
} else {
|
||||
cursor = uplug_nextPlug(cursor);
|
||||
}
|
||||
}
|
||||
|
||||
uplug_doUnloadPlug(plugToRemove, status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_setPlugNoUnload(UPlugData *data, UBool dontUnload)
|
||||
{
|
||||
data->dontUnload = dontUnload;
|
||||
}
|
||||
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_setPlugLevel(UPlugData *data, UPlugLevel level) {
|
||||
data->level = level;
|
||||
}
|
||||
|
||||
|
||||
U_CAPI UPlugLevel U_EXPORT2
|
||||
uplug_getPlugLevel(UPlugData *data) {
|
||||
return data->level;
|
||||
}
|
||||
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_setPlugName(UPlugData *data, const char *name) {
|
||||
strncpy(data->name, name, UPLUG_NAME_MAX);
|
||||
}
|
||||
|
||||
|
||||
U_CAPI const char * U_EXPORT2
|
||||
uplug_getPlugName(UPlugData *data) {
|
||||
return data->name;
|
||||
}
|
||||
|
||||
|
||||
U_CAPI const char * U_EXPORT2
|
||||
uplug_getSymbolName(UPlugData *data) {
|
||||
return data->sym;
|
||||
}
|
||||
|
||||
U_CAPI const char * U_EXPORT2
|
||||
uplug_getLibraryName(UPlugData *data, UErrorCode *status) {
|
||||
if(data->libName[0]) {
|
||||
return data->libName;
|
||||
} else {
|
||||
#if U_ENABLE_DYLOAD
|
||||
return uplug_findLibrary(data->lib, status);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uplug_getLibrary(UPlugData *data) {
|
||||
return data->lib;
|
||||
}
|
||||
|
||||
U_CAPI void * U_EXPORT2
|
||||
uplug_getContext(UPlugData *data) {
|
||||
return data->context;
|
||||
}
|
||||
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_setContext(UPlugData *data, void *context) {
|
||||
data->context = context;
|
||||
}
|
||||
|
||||
U_CAPI const char* U_EXPORT2
|
||||
uplug_getConfiguration(UPlugData *data) {
|
||||
return data->config;
|
||||
}
|
||||
|
||||
U_INTERNAL UPlugData* U_EXPORT2
|
||||
uplug_getPlugInternal(int32_t n) {
|
||||
if(n <0 || n >= pluginCount) {
|
||||
return NULL;
|
||||
} else {
|
||||
return &(pluginList[n]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
U_CAPI UErrorCode U_EXPORT2
|
||||
uplug_getPlugLoadStatus(UPlugData *plug) {
|
||||
return plug->pluginStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initialize a plugin fron an entrypoint and library - but don't load it.
|
||||
*/
|
||||
static UPlugData* uplug_initPlugFromEntrypointAndLibrary(UPlugEntrypoint *entrypoint, const char *config, void *lib, const char *sym,
|
||||
UErrorCode *status) {
|
||||
UPlugData *plug = NULL;
|
||||
|
||||
plug = uplug_allocatePlug(entrypoint, config, lib, sym, status);
|
||||
|
||||
if(U_SUCCESS(*status)) {
|
||||
return plug;
|
||||
} else {
|
||||
uplug_deallocatePlug(plug, status);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
U_CAPI UPlugData* U_EXPORT2
|
||||
uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status) {
|
||||
UPlugData* plug = uplug_initPlugFromEntrypointAndLibrary(entrypoint, config, NULL, NULL, status);
|
||||
uplug_loadPlug(plug, status);
|
||||
return plug;
|
||||
}
|
||||
|
||||
|
||||
static UPlugData*
|
||||
uplug_initErrorPlug(const char *libName, const char *sym, const char *config, const char *nameOrError, UErrorCode loadStatus, UErrorCode *status)
|
||||
{
|
||||
UPlugData *plug = uplug_allocateEmptyPlug(status);
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
|
||||
plug->pluginStatus = loadStatus;
|
||||
plug->awaitingLoad = FALSE; /* Won't load. */
|
||||
plug->dontUnload = TRUE; /* cannot unload. */
|
||||
|
||||
if(sym!=NULL) {
|
||||
strncpy(plug->sym, sym, UPLUG_NAME_MAX);
|
||||
}
|
||||
|
||||
if(libName!=NULL) {
|
||||
strncpy(plug->libName, libName, UPLUG_NAME_MAX);
|
||||
}
|
||||
|
||||
if(nameOrError!=NULL) {
|
||||
strncpy(plug->name, nameOrError, UPLUG_NAME_MAX);
|
||||
}
|
||||
|
||||
if(config!=NULL) {
|
||||
strncpy(plug->config, config, UPLUG_NAME_MAX);
|
||||
}
|
||||
|
||||
return plug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a plugin from DLL, and then initialize it from a library- but don't load it.
|
||||
*/
|
||||
|
||||
#if U_ENABLE_DYLOAD
|
||||
|
||||
static UPlugData*
|
||||
uplug_initPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status) {
|
||||
void *lib = NULL;
|
||||
UPlugData *plug = NULL;
|
||||
void *entrypoint = NULL;
|
||||
if(U_FAILURE(*status)) { return NULL; }
|
||||
lib = uplug_openLibrary(libName, status);
|
||||
if(lib!=NULL && U_SUCCESS(*status)) {
|
||||
entrypoint = uprv_dl_sym(lib, sym, status);
|
||||
|
||||
if(entrypoint!=NULL&&U_SUCCESS(*status)) {
|
||||
/* TODO: warning on next line needs to be corrected by complex C syntax. */
|
||||
plug = uplug_initPlugFromEntrypointAndLibrary((UPlugEntrypoint*)entrypoint, config, lib, sym, status);
|
||||
if(plug!=NULL&&U_SUCCESS(*status)) {
|
||||
plug->lib = lib; /* plug takes ownership of library */
|
||||
lib = NULL; /* library is now owned by plugin. */
|
||||
}
|
||||
} else {
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
plug = uplug_initErrorPlug(libName,sym,config,"ERROR: Could not load entrypoint",(lib==NULL)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
|
||||
}
|
||||
if(lib!=NULL) { /* still need to close the lib */
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
uplug_closeLibrary(lib, &subStatus); /* don't care here */
|
||||
}
|
||||
} else {
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
plug = uplug_initErrorPlug(libName,sym,config,"ERROR: could not load library",(lib==NULL)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
|
||||
}
|
||||
return plug;
|
||||
}
|
||||
|
||||
U_CAPI UPlugData* U_EXPORT2
|
||||
uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status) {
|
||||
UPlugData *plug = NULL;
|
||||
if(U_FAILURE(*status)) { return NULL; }
|
||||
plug = uplug_initPlugFromLibrary(libName, sym, config, status);
|
||||
uplug_loadPlug(plug, status);
|
||||
|
||||
return plug;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
U_CAPI UPlugLevel U_EXPORT2 uplug_getCurrentLevel() {
|
||||
if(cmemory_inUse()) {
|
||||
return UPLUG_LEVEL_HIGH;
|
||||
} else {
|
||||
return UPLUG_LEVEL_LOW;
|
||||
}
|
||||
}
|
||||
|
||||
static UBool U_CALLCONV uplug_cleanup(void)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
UPlugData *pluginToRemove;
|
||||
/* cleanup plugs */
|
||||
for(i=0;i<pluginCount;i++) {
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
|
||||
pluginToRemove = &pluginList[i];
|
||||
|
||||
/* unload and deallocate */
|
||||
uplug_doUnloadPlug(pluginToRemove, &subStatus);
|
||||
}
|
||||
|
||||
/* close other held libs? */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void uplug_loadWaitingPlugs(UErrorCode *status) {
|
||||
int32_t i;
|
||||
UPlugLevel currentLevel = uplug_getCurrentLevel();
|
||||
|
||||
DBG(( "loadWaitingPlugs. Level: %d\n", currentLevel))
|
||||
/* pass #1: low level plugs */
|
||||
for(i=0;i<pluginCount;i++) {
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
UPlugData *pluginToLoad = &pluginList[i];
|
||||
|
||||
if(pluginToLoad->awaitingLoad) {
|
||||
if(pluginToLoad->level == UPLUG_LEVEL_LOW) {
|
||||
DBG(( "Low #%d: Awaiting load: %p. Level: %d\n", i, (void*)pluginToLoad,
|
||||
(int32_t)currentLevel))
|
||||
if(currentLevel > UPLUG_LEVEL_LOW) {
|
||||
pluginToLoad->pluginStatus = U_PLUGIN_TOO_HIGH;
|
||||
} else {
|
||||
UPlugLevel newLevel;
|
||||
uplug_loadPlug(pluginToLoad, &subStatus);
|
||||
newLevel = uplug_getCurrentLevel();
|
||||
if(newLevel > currentLevel) {
|
||||
pluginToLoad->pluginStatus = U_PLUGIN_CHANGED_LEVEL_WARNING;
|
||||
currentLevel = newLevel;
|
||||
DBG(( "Low #%d: Level change! %p\n", i, (void*)pluginToLoad))
|
||||
}
|
||||
}
|
||||
pluginToLoad->awaitingLoad = FALSE;
|
||||
DBG(( " %p -> %s, %s. Level: %d\n", (void*)pluginToLoad, u_errorName(subStatus), u_errorName(pluginToLoad->pluginStatus),
|
||||
(int32_t)currentLevel));
|
||||
}
|
||||
}
|
||||
}
|
||||
currentLevel = uplug_getCurrentLevel();
|
||||
|
||||
for(i=0;i<pluginCount;i++) {
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
UPlugData *pluginToLoad = &pluginList[i];
|
||||
|
||||
if(pluginToLoad->awaitingLoad) {
|
||||
DBG(( "High #%d: Awaiting load: %p. Level: %d\n", i, (void*)pluginToLoad,
|
||||
(int32_t)currentLevel))
|
||||
if(pluginToLoad->level == UPLUG_LEVEL_INVALID) {
|
||||
pluginToLoad->pluginStatus = U_PLUGIN_DIDNT_SET_LEVEL;
|
||||
} else if(pluginToLoad->level == UPLUG_LEVEL_UNKNOWN) {
|
||||
pluginToLoad->pluginStatus = U_INTERNAL_PROGRAM_ERROR;
|
||||
} else {
|
||||
uplug_loadPlug(pluginToLoad, &subStatus);
|
||||
}
|
||||
pluginToLoad->awaitingLoad = FALSE;
|
||||
DBG(( " %p -> %s, %s. Level: %d\n", (void*)pluginToLoad, u_errorName(subStatus), u_errorName(pluginToLoad->pluginStatus),
|
||||
(int32_t)currentLevel));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
DBG(( " Done Loading Plugs. Level: Level: %d\n", (int32_t)uplug_getCurrentLevel()));
|
||||
}
|
||||
|
||||
#if U_ENABLE_DYLOAD
|
||||
static char plugin_file[2048] = "";
|
||||
#endif
|
||||
|
||||
U_INTERNAL const char* U_EXPORT2
|
||||
uplug_getPluginFile() {
|
||||
#if U_ENABLE_DYLOAD
|
||||
return plugin_file;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_init(UErrorCode *status) {
|
||||
#if U_ENABLE_DYLOAD
|
||||
const char *plugin_dir;
|
||||
|
||||
plugin_dir = getenv("ICU_PLUGINS");
|
||||
DBG((">> ICU_PLUGINS=%s\n", plugin_dir))
|
||||
|
||||
#if defined(DEFAULT_ICU_PLUGINS)
|
||||
if(plugin_dir == NULL || !*plugin_dir) {
|
||||
plugin_dir = DEFAULT_ICU_PLUGINS;
|
||||
DBG((" (using DEFAULT_ICU_PLUGINS)\n"))
|
||||
}
|
||||
#endif
|
||||
|
||||
if(plugin_dir != NULL && *plugin_dir) {
|
||||
FILE *f;
|
||||
|
||||
|
||||
strncpy(plugin_file, plugin_dir, 2047);
|
||||
strncat(plugin_file, U_FILE_SEP_STRING,2047);
|
||||
strncat(plugin_file, "icuplugins",2047);
|
||||
strncat(plugin_file, U_ICU_VERSION_SHORT ,2047);
|
||||
strncat(plugin_file, ".txt" ,2047);
|
||||
|
||||
DBG((">> pluginfile [%s]\n", plugin_file))
|
||||
|
||||
f = fopen(plugin_file, "r");
|
||||
|
||||
if(f != NULL) {
|
||||
char linebuf[1024];
|
||||
char *p, *libName=NULL, *symName=NULL, *config=NULL;
|
||||
int32_t line = 0;
|
||||
|
||||
|
||||
while(fgets(linebuf,1023,f)) {
|
||||
line++;
|
||||
DBG(("#%d: %s",line,linebuf))
|
||||
|
||||
if(!*linebuf || *linebuf=='#') {
|
||||
continue;
|
||||
} else {
|
||||
p = linebuf;
|
||||
while(*p&&isspace(*p))
|
||||
p++;
|
||||
if(!*p || *p=='#') continue;
|
||||
libName = p;
|
||||
while(*p&&!isspace(*p)) {
|
||||
p++;
|
||||
}
|
||||
if(!*p || *p=='#') continue; /* no tab after libname */
|
||||
*p=0; /* end of libname */
|
||||
p++;
|
||||
while(*p&&isspace(*p)) {
|
||||
p++;
|
||||
}
|
||||
if(!*p||*p=='#') continue; /* no symname after libname +tab */
|
||||
symName = p;
|
||||
while(*p&&!isspace(*p)) {
|
||||
p++;
|
||||
}
|
||||
|
||||
if(*p) { /* has config */
|
||||
*p=0;
|
||||
++p;
|
||||
while(*p&&isspace(*p)) {
|
||||
p++;
|
||||
}
|
||||
if(*p) {
|
||||
config = p;
|
||||
}
|
||||
}
|
||||
|
||||
/* chop whitespace at the end of the config */
|
||||
if(config!=NULL&&*config!=0) {
|
||||
p = config+strlen(config);
|
||||
while(p>config&&isspace(*(--p))) {
|
||||
*p=0;
|
||||
}
|
||||
}
|
||||
|
||||
/* OK, we're good. */
|
||||
DBG(("PLUGIN libName=[%s], sym=[%s], config=[%s]\n", libName, symName, config))
|
||||
|
||||
{
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
UPlugData *plug = uplug_initPlugFromLibrary(libName, symName, config, &subStatus);
|
||||
DBG((" -> %p, %s\n", (void*)plug, u_errorName(subStatus)))
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
DBG(("Can't open plugin file %s\n", plugin_file))
|
||||
}
|
||||
}
|
||||
uplug_loadWaitingPlugs(status);
|
||||
#endif /* U_ENABLE_DYLOAD */
|
||||
ucln_registerCleanup(UCLN_UPLUG, uplug_cleanup);
|
||||
}
|
||||
|
||||
|
87
icu4c/source/common/icuplugimp.h
Normal file
87
icu4c/source/common/icuplugimp.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* FILE NAME : icuplugimp.h
|
||||
*
|
||||
* Internal functions for the ICU plugin system
|
||||
*
|
||||
* Date Name Description
|
||||
* 10/29/2009 sl New.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ICUPLUGIMP_H
|
||||
#define ICUPLUGIMP_H
|
||||
|
||||
#include "unicode/icuplug.h"
|
||||
|
||||
/*========================*/
|
||||
/** @{ Library Manipulation
|
||||
*/
|
||||
|
||||
/**
|
||||
* Open a library, adding a reference count if needed.
|
||||
* @param libName library name to load
|
||||
* @param status error code
|
||||
* @return the library pointer, or NULL
|
||||
* @internal internal use only
|
||||
*/
|
||||
U_INTERNAL void * U_EXPORT2
|
||||
uplug_openLibrary(const char *libName, UErrorCode *status);
|
||||
|
||||
/**
|
||||
* Close a library, if its reference count is 0
|
||||
* @param lib the library to close
|
||||
* @param status error code
|
||||
* @internal internal use only
|
||||
*/
|
||||
U_INTERNAL void U_EXPORT2
|
||||
uplug_closeLibrary(void *lib, UErrorCode *status);
|
||||
|
||||
/**
|
||||
* Get a library's name, or NULL if not found.
|
||||
* @param lib the library's name
|
||||
* @param status error code
|
||||
* @return the library name, or NULL if not found.
|
||||
* @internal internal use only
|
||||
*/
|
||||
U_INTERNAL char * U_EXPORT2
|
||||
uplug_findLibrary(void *lib, UErrorCode *status);
|
||||
|
||||
/** @} */
|
||||
|
||||
/*========================*/
|
||||
/** {@ ICU Plugin internal interfaces
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize the plugins
|
||||
* @param status error result
|
||||
* @internal - Internal use only.
|
||||
*/
|
||||
U_INTERNAL void U_EXPORT2
|
||||
uplug_init(UErrorCode *status);
|
||||
|
||||
/**
|
||||
* Get raw plug N
|
||||
* @internal - Internal use only
|
||||
*/
|
||||
U_INTERNAL UPlugData* U_EXPORT2
|
||||
uplug_getPlugInternal(int32_t n);
|
||||
|
||||
/**
|
||||
* Get the name of the plugin file.
|
||||
* @internal - Internal use only.
|
||||
*/
|
||||
U_INTERNAL const char* U_EXPORT2
|
||||
uplug_getPluginFile();
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif
|
|
@ -1960,6 +1960,168 @@ U_CAPI void U_EXPORT2
|
|||
u_getVersion(UVersionInfo versionArray) {
|
||||
u_versionFromString(versionArray, U_ICU_VERSION);
|
||||
}
|
||||
|
||||
/**
|
||||
* icucfg.h dependent code
|
||||
*/
|
||||
|
||||
#if U_ENABLE_DYLOAD
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "icucfg.h"
|
||||
#endif
|
||||
|
||||
#if defined(U_CHECK_DYLOAD)
|
||||
|
||||
#if defined(HAVE_DLOPEN)
|
||||
|
||||
#ifdef HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
U_INTERNAL void * U_EXPORT2
|
||||
uprv_dl_open(const char *libName, UErrorCode *status) {
|
||||
void *ret = NULL;
|
||||
if(U_FAILURE(*status)) return ret;
|
||||
ret = dlopen(libName, RTLD_NOW|RTLD_GLOBAL);
|
||||
if(ret==NULL) {
|
||||
perror("dlopen");
|
||||
*status = U_MISSING_RESOURCE_ERROR;
|
||||
/* TODO: read errno and translate. */
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
U_INTERNAL void U_EXPORT2
|
||||
uprv_dl_close(void *lib, UErrorCode *status) {
|
||||
if(U_FAILURE(*status)) return;
|
||||
dlclose(lib);
|
||||
/* TODO: translate errno? */
|
||||
}
|
||||
|
||||
U_INTERNAL void* U_EXPORT2
|
||||
uprv_dl_sym(void *lib, const char* sym, UErrorCode *status) {
|
||||
void *ret = NULL;
|
||||
if(U_FAILURE(*status)) return ret;
|
||||
ret = dlsym(lib, sym);
|
||||
if(ret == NULL) {
|
||||
*status = U_MISSING_RESOURCE_ERROR;
|
||||
/* TODO: translate errno? */
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* null (nonexistent) implementation. */
|
||||
|
||||
U_INTERNAL void * U_EXPORT2
|
||||
uprv_dl_open(const char *libName, UErrorCode *status) {
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U_INTERNAL void U_EXPORT2
|
||||
uprv_dl_close(void *lib, UErrorCode *status) {
|
||||
if(U_FAILURE(*status)) return;
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
U_INTERNAL void* U_EXPORT2
|
||||
uprv_dl_sym(void *lib, const char* sym, UErrorCode *status) {
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#elif defined U_WINDOWS
|
||||
|
||||
U_INTERNAL void * U_EXPORT2
|
||||
uprv_dl_open(const char *libName, UErrorCode *status) {
|
||||
HMODULE lib = NULL;
|
||||
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
|
||||
lib = LoadLibrary(libName);
|
||||
|
||||
if(lib==NULL) {
|
||||
*status = U_MISSING_RESOURCE_ERROR;
|
||||
}
|
||||
|
||||
return (void*)lib;
|
||||
}
|
||||
|
||||
U_INTERNAL void U_EXPORT2
|
||||
uprv_dl_close(void *lib, UErrorCode *status) {
|
||||
HMODULE handle = (HMODULE)lib;
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
FreeLibrary(handle);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
U_INTERNAL void* U_EXPORT2
|
||||
uprv_dl_sym(void *lib, const char* sym, UErrorCode *status) {
|
||||
HMODULE handle = (HMODULE)lib;
|
||||
void * addr = NULL;
|
||||
|
||||
if(U_FAILURE(*status) || lib==NULL) return NULL;
|
||||
|
||||
addr = GetProcAddress(handle, sym);
|
||||
|
||||
if(addr==NULL) {
|
||||
DWORD lastError = GetLastError();
|
||||
if(lastError == ERROR_PROC_NOT_FOUND) {
|
||||
*status = U_MISSING_RESOURCE_ERROR;
|
||||
} else {
|
||||
*status = U_UNSUPPORTED_ERROR; /* other unknown error. */
|
||||
}
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
/* No dynamic loading set. */
|
||||
|
||||
U_INTERNAL void * U_EXPORT2
|
||||
uprv_dl_open(const char *libName, UErrorCode *status) {
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
U_INTERNAL void U_EXPORT2
|
||||
uprv_dl_close(void *lib, UErrorCode *status) {
|
||||
if(U_FAILURE(*status)) return;
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
U_INTERNAL void* U_EXPORT2
|
||||
uprv_dl_sym(void *lib, const char* sym, UErrorCode *status) {
|
||||
if(U_FAILURE(*status)) return NULL;
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* U_ENABLE_DYLOAD */
|
||||
|
||||
/*
|
||||
* Hey, Emacs, please set the following:
|
||||
*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2008, International Business Machines
|
||||
* Copyright (C) 1997-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
|
@ -274,4 +274,27 @@ U_INTERNAL void * U_EXPORT2 uprv_maximumPtr(void *base);
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if U_ENABLE_DYLOAD
|
||||
/* Dynamic Library Functions */
|
||||
|
||||
/**
|
||||
* Load a library
|
||||
* @internal (ICU 4.4)
|
||||
*/
|
||||
U_INTERNAL void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status);
|
||||
|
||||
/**
|
||||
* Close a library
|
||||
* @internal (ICU 4.4)
|
||||
*/
|
||||
U_INTERNAL void U_EXPORT2 uprv_dl_close( void *lib, UErrorCode *status);
|
||||
|
||||
/**
|
||||
* Extract a symbol from a library
|
||||
* @internal (ICU 4.4)
|
||||
*/
|
||||
U_INTERNAL void * U_EXPORT2 uprv_dl_sym( void *lib, const char *symbolName, UErrorCode *status);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2001-2009, International Business Machines *
|
||||
* Copyright (C) 2001-2010, International Business Machines *
|
||||
* Corporation and others. All Rights Reserved. *
|
||||
* *
|
||||
******************************************************************************
|
||||
|
@ -52,6 +52,7 @@
|
|||
*/
|
||||
typedef enum ECleanupLibraryType {
|
||||
UCLN_START = -1,
|
||||
UCLN_UPLUG, /* ICU plugins */
|
||||
UCLN_CUSTOM, /* Custom is for anyone else. */
|
||||
UCLN_CTESTFW,
|
||||
UCLN_LAYOUTEX,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
* *
|
||||
* Copyright (C) 2001-2009, International Business Machines *
|
||||
* Copyright (C) 2001-2010, International Business Machines *
|
||||
* Corporation and others. All Rights Reserved. *
|
||||
* *
|
||||
******************************************************************************
|
||||
|
@ -25,6 +25,9 @@
|
|||
#include "ucln.h"
|
||||
#include "cmemory.h"
|
||||
#include "uassert.h"
|
||||
#include "unicode/icuplug.h"
|
||||
#include "icuplugimp.h"
|
||||
|
||||
|
||||
static UBool gICUInitialized = FALSE;
|
||||
static UMTX gICUInitMutex = NULL;
|
||||
|
@ -62,6 +65,9 @@ u_cleanup(void)
|
|||
U_CAPI void U_EXPORT2
|
||||
u_init(UErrorCode *status) {
|
||||
UTRACE_ENTRY_OC(UTRACE_U_INIT);
|
||||
/* initialize plugins */
|
||||
uplug_init(status);
|
||||
|
||||
umtx_lock(&gICUInitMutex);
|
||||
if (gICUInitialized || U_FAILURE(*status)) {
|
||||
umtx_unlock(&gICUInitMutex);
|
||||
|
@ -109,6 +115,7 @@ u_init(UErrorCode *status) {
|
|||
unorm_haveData(status);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
gICUInitialized = TRUE; /* TODO: don't set if U_FAILURE? */
|
||||
umtx_unlock(&gICUInitMutex);
|
||||
UTRACE_EXIT_STATUS(*status);
|
||||
|
|
363
icu4c/source/common/unicode/icuplug.h
Normal file
363
icu4c/source/common/unicode/icuplug.h
Normal file
|
@ -0,0 +1,363 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* FILE NAME : icuplug.h
|
||||
*
|
||||
* Date Name Description
|
||||
* 10/29/2009 sl New.
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* \brief C API: ICU Plugin API
|
||||
*
|
||||
* <h2>C API: ICU Plugin API</h2>
|
||||
*
|
||||
* <p>C API allowing run-time loadable modules that extend or modify ICU functionality.</p>
|
||||
*
|
||||
* <h3>Loading and Configuration</h3>
|
||||
*
|
||||
* <p>At ICU startup time, the environment variable "ICU_PLUGINS" will be
|
||||
* queried for a directory name. If it is not set, the preprocessor symbol
|
||||
* "DEFAULT_ICU_PLUGINS" will be checked for a default value.</p>
|
||||
*
|
||||
* <p>Within the above-named directory, the file "icuplugins##.txt" will be
|
||||
* opened, if present, where ## is the major+minor number of the currently
|
||||
* running ICU (such as, 44 for ICU 4.4, thus icuplugins44.txt)</p>
|
||||
*
|
||||
* <p>The configuration file has this format:</p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>Hash (#) begins a comment line</li>
|
||||
*
|
||||
* <li>Non-comment lines have two or three components:
|
||||
* LIBRARYNAME ENTRYPOINT [ CONFIGURATION .. ]</li>
|
||||
*
|
||||
* <li>Tabs or spaces separate the three items.</li>
|
||||
*
|
||||
* <li>LIBRARYNAME is the name of a shared library, either a short name if
|
||||
* it is on the loader path, or a full pathname.</li>
|
||||
*
|
||||
* <li>ENTRYPOINT is the short (undecorated) symbol name of the plugin's
|
||||
* entrypoint, as above.</li>
|
||||
*
|
||||
* <li>CONFIGURATION is the entire rest of the line . It's passed as-is to
|
||||
* the plugin.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>An example configuration file is, in its entirety:</p>
|
||||
*
|
||||
* \code
|
||||
* # this is icuplugins44.txt
|
||||
* testplug.dll myPlugin hello=world
|
||||
* \endcode
|
||||
* <p>Plugins are categorized as "high" or "low" level. Low level are those
|
||||
* which must be run BEFORE high level plugins, and before any operations
|
||||
* which cause ICU to be 'initialized'. If a plugin is low level but
|
||||
* causes ICU to allocate memory or become initialized, that plugin is said
|
||||
* to cause a 'level change'. </p>
|
||||
*
|
||||
* <p>At load time, ICU first queries all plugins to determine their level,
|
||||
* then loads all 'low' plugins first, and then loads all 'high' plugins.
|
||||
* Plugins are otherwise loaded in the order listed in the configuration file.</p>
|
||||
*
|
||||
* <h3>Implementing a Plugin</h3>
|
||||
* \code
|
||||
* U_CAPI UPlugTokenReturn U_EXPORT2
|
||||
* myPlugin (UPlugData *data, UPlugReason reason, UErrorCode *status) {
|
||||
* if(reason==UPLUG_REASON_QUERY) {
|
||||
* uplug_setPlugName(data, "Simple Plugin");
|
||||
* uplug_setPlugLevel(data, UPLUG_LEVEL_HIGH);
|
||||
* } else if(reason==UPLUG_REASON_LOAD) {
|
||||
* ... Set up some ICU things here....
|
||||
* } else if(reason==UPLUG_REASON_UNLOAD) {
|
||||
* ... unload, clean up ...
|
||||
* }
|
||||
* return UPLUG_TOKEN;
|
||||
* }
|
||||
* \endcode
|
||||
*
|
||||
* <p>The UPlugData* is an opaque pointer to the plugin-specific data, and is
|
||||
* used in all other API calls.</p>
|
||||
*
|
||||
* <p>The API contract is:</p>
|
||||
* <ol><li>The plugin MUST always return UPLUG_TOKEN as a return value- to
|
||||
* indicate that it is a valid plugin.</li>
|
||||
*
|
||||
* <li>When the 'reason' parameter is set to UPLUG_REASON_QUERY, the
|
||||
* plugin MUST call uplug_setPlugLevel() to indicate whether it is a high
|
||||
* level or low level plugin.</li>
|
||||
*
|
||||
* <li>When the 'reason' parameter is UPLUG_REASON_QUERY, the plugin
|
||||
* SHOULD call uplug_setPlugName to indicate a human readable plugin name.</li></ol>
|
||||
*
|
||||
*
|
||||
* \internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ICUPLUG_H
|
||||
#define ICUPLUG_H
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
|
||||
/* === Basic types === */
|
||||
|
||||
/**
|
||||
* Opaque structure passed to/from a plugin.
|
||||
* use the APIs to access it.
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
|
||||
struct UPlugData;
|
||||
typedef struct UPlugData UPlugData;
|
||||
|
||||
/**
|
||||
* Random Token to identify a valid ICU plugin. Plugins must return this
|
||||
* from the entrypoint.
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
#define UPLUG_TOKEN 0x54762486
|
||||
|
||||
/**
|
||||
* Max width of names, symbols, and configuration strings
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
#define UPLUG_NAME_MAX 100
|
||||
|
||||
|
||||
/**
|
||||
* Return value from a plugin entrypoint.
|
||||
* Must always be set to UPLUG_TOKEN
|
||||
* @see UPLUG_TOKEN
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
typedef uint32_t UPlugTokenReturn;
|
||||
|
||||
/**
|
||||
* Reason code for the entrypoint's call
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
typedef enum {
|
||||
UPLUG_REASON_QUERY = 0, /**< The plugin is being queried for info. **/
|
||||
UPLUG_REASON_LOAD = 1, /**< The plugin is being loaded. **/
|
||||
UPLUG_REASON_UNLOAD = 2, /**< The plugin is being unloaded. **/
|
||||
UPLUG_REASON_COUNT /**< count of known reasons **/
|
||||
} UPlugReason;
|
||||
|
||||
|
||||
/**
|
||||
* Level of plugin loading
|
||||
* INITIAL: UNKNOWN
|
||||
* QUERY: INVALID -> { LOW | HIGH }
|
||||
* ERR -> INVALID
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
typedef enum {
|
||||
UPLUG_LEVEL_INVALID = 0, /**< The plugin is invalid, hasn't called uplug_setLevel, or can't load. **/
|
||||
UPLUG_LEVEL_UNKNOWN = 1, /**< The plugin is waiting to be installed. **/
|
||||
UPLUG_LEVEL_LOW = 2, /**< The plugin must be called before u_init completes **/
|
||||
UPLUG_LEVEL_HIGH = 3, /**< The plugin can run at any time. **/
|
||||
UPLUG_LEVEL_COUNT /**< count of known reasons **/
|
||||
} UPlugLevel;
|
||||
|
||||
/**
|
||||
* Entrypoint for an ICU plugin.
|
||||
* @param data the UPlugData handle.
|
||||
* @param status the plugin's extended status code.
|
||||
* @return A valid plugin must return UPLUG_TOKEN
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) (
|
||||
UPlugData *data,
|
||||
UPlugReason reason,
|
||||
UErrorCode *status);
|
||||
|
||||
/* === Needed for Implementing === */
|
||||
|
||||
/**
|
||||
* Request that this plugin not be unloaded at cleanup time.
|
||||
* This is appropriate for plugins which cannot be cleaned up.
|
||||
* @see u_cleanup()
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_setPlugNoUnload(UPlugData *data, UBool dontUnload);
|
||||
|
||||
/**
|
||||
* Set the level of this plugin.
|
||||
* @param data plugin data handle
|
||||
* @param level the level of this plugin
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_setPlugLevel(UPlugData *data, UPlugLevel level);
|
||||
|
||||
/**
|
||||
* Get the level of this plugin.
|
||||
* @param data plugin data handle
|
||||
* @return the level of this plugin
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI UPlugLevel U_EXPORT2
|
||||
uplug_getPlugLevel(UPlugData *data);
|
||||
|
||||
/**
|
||||
* Get the lowest level of plug which can currently load.
|
||||
* For example, if UPLUG_LEVEL_LOW is returned, then low level plugins may load
|
||||
* if UPLUG_LEVEL_HIGH is returned, then only high level plugins may load.
|
||||
* @return the lowest level of plug which can currently load
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI UPlugLevel U_EXPORT2 uplug_getCurrentLevel();
|
||||
|
||||
|
||||
/**
|
||||
* Get plug load status
|
||||
* @return The error code of this plugin's load attempt.
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI UErrorCode U_EXPORT2
|
||||
uplug_getPlugLoadStatus(UPlugData *plug);
|
||||
|
||||
/**
|
||||
* Set the human-readable name of this plugin.
|
||||
* @param data plugin data handle
|
||||
* @param name the name of this plugin. The first UPLUG_NAME_MAX characters willi be copied into a new buffer.
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_setPlugName(UPlugData *data, const char *name);
|
||||
|
||||
/**
|
||||
* Get the human-readable name of this plugin.
|
||||
* @param data plugin data handle
|
||||
* @return the name of this plugin
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI const char * U_EXPORT2
|
||||
uplug_getPlugName(UPlugData *data);
|
||||
|
||||
/**
|
||||
* Return the symbol name for this plugin, if known.
|
||||
* @param data plugin data handle
|
||||
* @return the symbol name, or NULL
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI const char * U_EXPORT2
|
||||
uplug_getSymbolName(UPlugData *data);
|
||||
|
||||
/**
|
||||
* Return the library name for this plugin, if known.
|
||||
* @param data plugin data handle
|
||||
* @return the library name, or NULL
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI const char * U_EXPORT2
|
||||
uplug_getLibraryName(UPlugData *data, UErrorCode *status);
|
||||
|
||||
/**
|
||||
* Return the library used for this plugin, if known.
|
||||
* Plugins could use this to load data out of their
|
||||
* @param data plugin data handle
|
||||
* @return the library, or NULL
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI void * U_EXPORT2
|
||||
uplug_getLibrary(UPlugData *data);
|
||||
|
||||
/**
|
||||
* Return the plugin-specific context data.
|
||||
* @param data plugin data handle
|
||||
* @return the context, or NULL if not set
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI void * U_EXPORT2
|
||||
uplug_getContext(UPlugData *data);
|
||||
|
||||
/**
|
||||
* Set the plugin-specific context data.
|
||||
* @param data plugin data handle
|
||||
* @param context new context to set
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_setContext(UPlugData *data, void *context);
|
||||
|
||||
|
||||
/**
|
||||
* Get the configuration string, if available.
|
||||
* The string is in the platform default codepage.
|
||||
* @param data plugin data handle
|
||||
* @return configuration string, or else null.
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI const char * U_EXPORT2
|
||||
uplug_getConfiguration(UPlugData *data);
|
||||
|
||||
/**
|
||||
* Return all currently installed plugins, from newest to oldest
|
||||
* Usage Example:
|
||||
* \code
|
||||
* UPlugData *plug = NULL;
|
||||
* while(plug=uplug_nextPlug(plug)) {
|
||||
* ... do something with 'plug' ...
|
||||
* }
|
||||
* \endcode
|
||||
* Not thread safe- do not call while plugs are added or removed.
|
||||
* @param prior pass in 'NULL' to get the first (most recent) plug,
|
||||
* otherwise pass the value returned on a prior call to uplug_nextPlug
|
||||
* @param return the next oldest plugin, or NULL if no more.
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI UPlugData* U_EXPORT2
|
||||
uplug_nextPlug(UPlugData *prior);
|
||||
|
||||
/**
|
||||
* Inject a plugin as if it were loaded from a library.
|
||||
* This is useful for testing plugins.
|
||||
* Note that it will have a 'NULL' library pointer associated
|
||||
* with it, and therefore no llibrary will be closed at cleanup time.
|
||||
* Low level plugins may not be able to load, as ordering can't be enforced.
|
||||
* @param entrypoint entrypoint to install
|
||||
* @param config user specified configuration string, if available, or NULL.
|
||||
* @param status error result
|
||||
* @return the new UPlugData associated with this plugin, or NULL if error.
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI UPlugData* U_EXPORT2
|
||||
uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status);
|
||||
|
||||
|
||||
/**
|
||||
* Inject a plugin from a library, as if the information came from a config file.
|
||||
* Low level plugins may not be able to load, and ordering can't be enforced.
|
||||
* @param libName DLL name to load
|
||||
* @param sym symbol of plugin (UPlugEntrypoint function)
|
||||
* @param config configuration string, or NULL
|
||||
* @param status error result
|
||||
* @return the new UPlugData associated with this plugin, or NULL if error.
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI UPlugData* U_EXPORT2
|
||||
uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status);
|
||||
|
||||
/**
|
||||
* Remove a plugin.
|
||||
* Will request the plugin to be unloaded, and close the library if needed
|
||||
* @param data plugin handle to close
|
||||
* @param status error result
|
||||
* @internal ICU 4.4 Technology Preview
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
uplug_removePlug(UPlugData *plug, UErrorCode *status);
|
||||
|
||||
|
||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2009, International Business Machines
|
||||
* Copyright (C) 1997-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
|
@ -179,6 +179,16 @@
|
|||
#define U_ENABLE_TRACING @U_ENABLE_TRACING@
|
||||
#endif
|
||||
|
||||
/* dynamic loading */
|
||||
#ifndef U_ENABLE_DYLOAD
|
||||
#define U_ENABLE_DYLOAD @U_ENABLE_DYLOAD@
|
||||
#endif
|
||||
|
||||
#ifndef U_CHECK_DYLOAD
|
||||
#define U_CHECK_DYLOAD @U_CHECK_DYLOAD@
|
||||
#endif
|
||||
|
||||
|
||||
/* Do we allow ICU users to use the draft APIs by default? */
|
||||
#ifndef U_DEFAULT_SHOW_DRAFT
|
||||
#define U_DEFAULT_SHOW_DRAFT @U_DEFAULT_SHOW_DRAFT@
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2009, International Business Machines
|
||||
* Copyright (C) 1997-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
|
@ -299,6 +299,11 @@ Intel can define _M_IX86 or _M_X64
|
|||
#define U_HAVE_MMAP 0
|
||||
#define U_HAVE_POPEN 0
|
||||
|
||||
#ifndef U_ENABLE_DYLOAD
|
||||
#define U_ENABLE_DYLOAD 1
|
||||
#endif
|
||||
|
||||
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1996-2009, International Business Machines
|
||||
* Copyright (C) 1996-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
*
|
||||
|
@ -631,6 +631,8 @@ typedef enum UErrorCode {
|
|||
U_AMBIGUOUS_ALIAS_WARNING = -122, /**< This converter alias can go to different converter implementations */
|
||||
|
||||
U_DIFFERENT_UCA_VERSION = -121, /**< ucol_open encountered a mismatch between UCA version and collator image version, so the collator was constructed from rules. No impact to further function */
|
||||
|
||||
U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */
|
||||
|
||||
U_ERROR_WARNING_LIMIT, /**< This must always be the last warning value to indicate the limit for UErrorCode warnings (last warning code +1) */
|
||||
|
||||
|
@ -800,9 +802,16 @@ typedef enum UErrorCode {
|
|||
U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR,
|
||||
U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR,
|
||||
U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR,
|
||||
|
||||
/*
|
||||
* The error code in the range 0x10500-0x105ff are reserved for Plugin related error codes
|
||||
*/
|
||||
U_PLUGIN_ERROR_START=0x10500, /**< Start of codes indicating plugin failures */
|
||||
U_PLUGIN_TOO_HIGH=0x10500, /**< The plugin's level is too high to be loaded right now. */
|
||||
U_PLUGIN_DIDNT_SET_LEVEL, /**< The plugin didn't call uplug_setPlugLevel in response to a QUERY */
|
||||
U_PLUGIN_ERROR_LIMIT, /**< This must always be the last value to indicate the limit for plugin errors */
|
||||
|
||||
|
||||
U_ERROR_LIMIT=U_IDNA_ERROR_LIMIT /**< This must always be the last value to indicate the limit for UErrorCode (last error code +1) */
|
||||
U_ERROR_LIMIT=U_PLUGIN_ERROR_LIMIT /**< This must always be the last value to indicate the limit for UErrorCode (last error code +1) */
|
||||
} UErrorCode;
|
||||
|
||||
/* Use the following to determine if an UErrorCode represents */
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-2008, International Business Machines
|
||||
* Copyright (C) 1997-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
|
@ -26,7 +26,8 @@ _uErrorInfoName[U_ERROR_WARNING_LIMIT-U_ERROR_WARNING_START]={
|
|||
"U_STRING_NOT_TERMINATED_WARNING",
|
||||
"U_SORT_KEY_TOO_SHORT_WARNING",
|
||||
"U_AMBIGUOUS_ALIAS_WARNING",
|
||||
"U_DIFFERENT_UCA_VERSION"
|
||||
"U_DIFFERENT_UCA_VERSION",
|
||||
"U_PLUGIN_CHANGED_LEVEL_WARNING",
|
||||
};
|
||||
|
||||
static const char * const
|
||||
|
@ -175,6 +176,12 @@ _uIDNAErrorName[U_IDNA_ERROR_LIMIT - U_IDNA_ERROR_START] = {
|
|||
"U_IDNA_DOMAIN_NAME_TOO_LONG_ERROR"
|
||||
};
|
||||
|
||||
static const char * const
|
||||
_uPluginErrorName[U_PLUGIN_ERROR_LIMIT - U_PLUGIN_ERROR_START] = {
|
||||
"U_PLUGIN_TOO_HIGH",
|
||||
"U_PLUGIN_DIDNT_SET_LEVEL",
|
||||
};
|
||||
|
||||
U_CAPI const char * U_EXPORT2
|
||||
u_errorName(UErrorCode code) {
|
||||
if(U_ZERO_ERROR <= code && code < U_STANDARD_ERROR_LIMIT) {
|
||||
|
@ -191,6 +198,8 @@ u_errorName(UErrorCode code) {
|
|||
return _uRegexErrorName[code - U_REGEX_ERROR_START];
|
||||
} else if(U_IDNA_ERROR_START <= code && code < U_IDNA_ERROR_LIMIT) {
|
||||
return _uIDNAErrorName[code - U_IDNA_ERROR_START];
|
||||
} else if(U_PLUGIN_ERROR_START <= code && code < U_PLUGIN_ERROR_LIMIT) {
|
||||
return _uPluginErrorName[code - U_PLUGIN_ERROR_START];
|
||||
} else {
|
||||
return "[BOGUS UErrorCode]";
|
||||
}
|
||||
|
|
1483
icu4c/source/configure
vendored
1483
icu4c/source/configure
vendored
File diff suppressed because it is too large
Load diff
|
@ -11,7 +11,7 @@ AC_PREREQ(2.63)
|
|||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([common/unicode/utypes.h])
|
||||
|
||||
AC_CONFIG_HEADER(common/icucfg.h)
|
||||
AC_CONFIG_HEADERS(common/icucfg.h)
|
||||
PACKAGE="icu"
|
||||
AC_SUBST(PACKAGE)
|
||||
|
||||
|
@ -329,6 +329,35 @@ AC_ARG_ENABLE(tracing,
|
|||
AC_MSG_RESULT($enabled)
|
||||
AC_SUBST(U_ENABLE_TRACING)
|
||||
|
||||
|
||||
U_ENABLE_DYLOAD=1
|
||||
AC_MSG_CHECKING([whether to enable dynamic loading of plugins])
|
||||
enabled=check
|
||||
AC_ARG_ENABLE(dyload,
|
||||
[ --disable-dyload disable dynamic loading [default=no]],
|
||||
[ case "${enableval}" in
|
||||
yes|"")
|
||||
U_ENABLE_DYLOAD=1
|
||||
enabled=check ;;
|
||||
no)
|
||||
U_ENABLE_DYLOAD=0;
|
||||
enabled=disabled ;;
|
||||
*) ;;
|
||||
esac],
|
||||
)
|
||||
AC_SUBST(U_ENABLE_DYLOAD)
|
||||
|
||||
# goes into icucfg.h
|
||||
AC_CHECK_HEADERS([dlfcn.h])
|
||||
U_CHECK_DYLOAD=0
|
||||
#AC_MSG_RESULT($enabled)
|
||||
if test "$enabled" = "check"; then
|
||||
AC_SEARCH_LIBS([dlopen], [dl])
|
||||
AC_CHECK_FUNCS([dlopen])
|
||||
U_CHECK_DYLOAD=1
|
||||
fi
|
||||
AC_SUBST(U_CHECK_DYLOAD)
|
||||
|
||||
# Check whether to use the evil rpath or not
|
||||
AC_ARG_ENABLE(rpath,
|
||||
[ --enable-rpath use rpath when linking [default is only if necessary]],
|
||||
|
@ -867,6 +896,7 @@ HAVE_UINT64_T=1
|
|||
fi
|
||||
AC_SUBST(HAVE_UINT64_T)
|
||||
|
||||
#AC_DEFINE([HAVE_WCHAR_H], [], [Uncomment This to run Autoheader])
|
||||
# Do various wchar_t related checks
|
||||
AC_CHECK_HEADER(wchar.h)
|
||||
if test "$ac_cv_header_wchar_h" = no
|
||||
|
@ -1230,6 +1260,7 @@ AC_CONFIG_FILES([icudefs.mk \
|
|||
tools/genpname/Makefile \
|
||||
tools/genbrk/Makefile \
|
||||
tools/gensprep/Makefile \
|
||||
tools/icuinfo/Makefile \
|
||||
tools/icupkg/Makefile \
|
||||
tools/icuswap/Makefile \
|
||||
tools/pkgdata/Makefile \
|
||||
|
|
|
@ -14,7 +14,7 @@ include $(top_builddir)/icudefs.mk
|
|||
subdir = tools
|
||||
|
||||
SUBDIRS = toolutil ctestfw makeconv genrb genuca genbrk genctd \
|
||||
gennames genpname gencnval gensprep genccode gencmn icupkg pkgdata \
|
||||
gennames genpname gencnval gensprep icuinfo genccode gencmn icupkg pkgdata \
|
||||
gentest genprops gencase genbidi gennorm gennorm2 gencfu
|
||||
|
||||
## List of phony targets
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 2007-2009, International Business Machines Corporation and
|
||||
* Copyright (c) 2007-2010, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************/
|
||||
|
||||
|
@ -177,6 +177,26 @@ static const Field names_UColAttributeValue[] = {
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
#include "unicode/icuplug.h"
|
||||
|
||||
#define LEN_UPLUG_REASON 13 /* UPLUG_REASON_ */
|
||||
static const int32_t count_UPlugReason = UPLUG_REASON_COUNT;
|
||||
static const Field names_UPlugReason[] = {
|
||||
FIELD_NAME_STR( LEN_UPLUG_REASON, UPLUG_REASON_QUERY ),
|
||||
FIELD_NAME_STR( LEN_UPLUG_REASON, UPLUG_REASON_LOAD ),
|
||||
FIELD_NAME_STR( LEN_UPLUG_REASON, UPLUG_REASON_UNLOAD ),
|
||||
};
|
||||
|
||||
#define LEN_UPLUG_LEVEL 12 /* UPLUG_LEVEL_ */
|
||||
static const int32_t count_UPlugLevel = UPLUG_LEVEL_COUNT;
|
||||
static const Field names_UPlugLevel[] = {
|
||||
FIELD_NAME_STR( LEN_UPLUG_LEVEL, UPLUG_LEVEL_INVALID ),
|
||||
FIELD_NAME_STR( LEN_UPLUG_LEVEL, UPLUG_LEVEL_UNKNOWN ),
|
||||
FIELD_NAME_STR( LEN_UPLUG_LEVEL, UPLUG_LEVEL_LOW ),
|
||||
FIELD_NAME_STR( LEN_UPLUG_LEVEL, UPLUG_LEVEL_HIGH ),
|
||||
};
|
||||
|
||||
#define LEN_UDBG 5 /* "UDBG_" */
|
||||
static const int32_t count_UDebugEnumType = UDBG_ENUM_COUNT;
|
||||
static const Field names_UDebugEnumType[] =
|
||||
|
@ -187,6 +207,8 @@ static const Field names_UDebugEnumType[] =
|
|||
FIELD_NAME_STR( LEN_UDBG, UDBG_UCalendarMonths ),
|
||||
FIELD_NAME_STR( LEN_UDBG, UDBG_UDateFormatStyle ),
|
||||
#endif
|
||||
FIELD_NAME_STR( LEN_UDBG, UDBG_UPlugReason ),
|
||||
FIELD_NAME_STR( LEN_UDBG, UDBG_UPlugLevel ),
|
||||
FIELD_NAME_STR( LEN_UDBG, UDBG_UAcceptResult ),
|
||||
#if !UCONFIG_NO_COLLATION
|
||||
FIELD_NAME_STR( LEN_UDBG, UDBG_UColAttributeValue ),
|
||||
|
@ -216,6 +238,8 @@ static int32_t _udbg_enumCount(UDebugEnumType type, UBool actual) {
|
|||
COUNT_CASE(UCalendarMonths)
|
||||
COUNT_CASE(UDateFormatStyle)
|
||||
#endif
|
||||
COUNT_CASE(UPlugReason)
|
||||
COUNT_CASE(UPlugLevel)
|
||||
COUNT_CASE(UAcceptResult)
|
||||
#if !UCONFIG_NO_COLLATION
|
||||
COUNT_CASE(UColAttributeValue)
|
||||
|
@ -234,6 +258,8 @@ static const Field* _udbg_enumFields(UDebugEnumType type) {
|
|||
FIELD_CASE(UCalendarMonths)
|
||||
FIELD_CASE(UDateFormatStyle)
|
||||
#endif
|
||||
FIELD_CASE(UPlugReason)
|
||||
FIELD_CASE(UPlugLevel)
|
||||
FIELD_CASE(UAcceptResult)
|
||||
// FIELD_FAIL_CASE(UNonExistentEnum)
|
||||
#if !UCONFIG_NO_COLLATION
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
************************************************************************
|
||||
* Copyright (c) 2008-2009, International Business Machines
|
||||
* Copyright (c) 2008-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
************************************************************************
|
||||
*/
|
||||
|
@ -21,7 +21,8 @@ enum UDebugEnumType {
|
|||
UDBG_UCalendarMonths, /* UCalendarMonths. Count= (UCAL_UNDECIMBER+1) */
|
||||
UDBG_UDateFormatStyle, /* Count = UDAT_SHORT=1 */
|
||||
#endif
|
||||
|
||||
UDBG_UPlugReason, /* Count = UPLUG_REASON_COUNT */
|
||||
UDBG_UPlugLevel, /* COUNT = UPLUG_LEVEL_COUNT */
|
||||
UDBG_UAcceptResult, /* Count = ULOC_ACCEPT_FALLBACK+1=3 */
|
||||
|
||||
/* All following enums may be discontiguous. */
|
||||
|
|
109
icu4c/source/tools/icuinfo/Makefile.in
Normal file
109
icu4c/source/tools/icuinfo/Makefile.in
Normal file
|
@ -0,0 +1,109 @@
|
|||
## Makefile.in for ICU - tools/icuinfo
|
||||
## Copyright (c) 1999-2010, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
## Madhu Katragadda
|
||||
|
||||
## Source directory information
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
top_builddir = ../..
|
||||
|
||||
include $(top_builddir)/icudefs.mk
|
||||
|
||||
## Build directory information
|
||||
subdir = tools/icuinfo
|
||||
|
||||
## Extra files to remove for 'make clean'
|
||||
CLEANFILES = *~ $(DEPS) $(PLUGIN_OBJECTS) $(PLUGINFILE) $(PLUGIN)
|
||||
|
||||
## Target information
|
||||
TARGET = icuinfo$(EXEEXT)
|
||||
|
||||
ifneq ($(top_builddir),$(top_srcdir))
|
||||
CPPFLAGS += -I$(top_builddir)/common
|
||||
endif
|
||||
CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil -I$(top_srcdir)/tools/ctestfw
|
||||
CPPFLAGS+= -I$(top_srcdir)/i18n
|
||||
LIBS = $(LIBCTESTFW) $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M)
|
||||
|
||||
OBJECTS = icuinfo.o
|
||||
PLUGIN_OBJECTS = testplug.o
|
||||
|
||||
DEPS = $(OBJECTS:.o=.d)
|
||||
|
||||
# pass some information
|
||||
|
||||
CPPFLAGS+= -DU_PLATFORM=\"@platform@\" -DU_BUILD=\"@build@\" -DU_HOST=\"@host@\" -DU_CC=\"@CC@\" -DU_CXX=\"@CXX@\"
|
||||
# -DENABLE_RELEASE=@ENABLE_RELEASE@ -DENABLE_DEBUG=@ENABLE_DEBUG@ "
|
||||
|
||||
|
||||
## List of phony targets
|
||||
.PHONY : all all-local install install-local clean clean-local \
|
||||
distclean distclean-local dist dist-local check check-local plugin-check
|
||||
|
||||
## Clear suffix list
|
||||
.SUFFIXES :
|
||||
|
||||
## List of standard targets
|
||||
all: all-local
|
||||
install: install-local
|
||||
clean: clean-local
|
||||
distclean : distclean-local
|
||||
dist: dist-local
|
||||
check: all check-local
|
||||
|
||||
all-local: $(TARGET)
|
||||
|
||||
install-local: all-local
|
||||
|
||||
dist-local:
|
||||
|
||||
clean-local:
|
||||
test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
|
||||
$(RMV) $(TARGET) $(OBJECTS)
|
||||
|
||||
distclean-local: clean-local
|
||||
$(RMV) Makefile
|
||||
|
||||
check-local: $(TARGET)
|
||||
$(INVOKE) ./$(TARGET) $(ICUINFO_OPTS)
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
-include Makefile.local
|
||||
|
||||
$(TARGET) : $(OBJECTS)
|
||||
$(LINK.cc) $(OUTOPT)$@ $^ $(LIBS)
|
||||
$(POST_BUILD_STEP)
|
||||
|
||||
PLUGIN=$(LIBPREFIX)plugin.$(SO)
|
||||
SO_TARGET=$(PLUGIN)
|
||||
|
||||
PLUGINDIR=$(shell pwd)
|
||||
|
||||
PLUGINFILE=$(PLUGINDIR)/icuplugins$(SO_TARGET_VERSION_MAJOR).txt
|
||||
|
||||
$(PLUGINFILE): Makefile
|
||||
echo "$(CURR_FULL_DIR)/$(PLUGIN) myPlugin x=4" > $@
|
||||
|
||||
CFLAGS+=$(SHAREDLIBCFLAGS)
|
||||
|
||||
$(PLUGIN): $(PLUGIN_OBJECTS)
|
||||
$(SHLIB.cc) $(SHAREDLIBCFLAGS) $(LD_SONAME) $(OUTOPT)$@ $^ $(LIBS)
|
||||
|
||||
plugin: $(PLUGIN)
|
||||
|
||||
plugin-check: $(PLUGIN) $(PLUGINFILE)
|
||||
$(INVOKE) ICU_PLUGINS="$(CURR_FULL_DIR)" ./$(TARGET) -v -L
|
||||
|
||||
|
||||
ifeq (,$(MAKECMDGOALS))
|
||||
-include $(DEPS)
|
||||
else
|
||||
ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
|
||||
-include $(DEPS)
|
||||
endif
|
||||
endif
|
||||
|
696
icu4c/source/tools/icuinfo/icuinfo.cpp
Normal file
696
icu4c/source/tools/icuinfo/icuinfo.cpp
Normal file
|
@ -0,0 +1,696 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
* file name: icuinfo.cpp
|
||||
* encoding: US-ASCII
|
||||
* tab size: 8 (not used)
|
||||
* indentation:4
|
||||
*
|
||||
* created on: 2009-2010
|
||||
* created by: Steven R. Loomis
|
||||
*
|
||||
* This program shows some basic info about the current ICU.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "unicode/utypes.h"
|
||||
#include "unicode/putil.h"
|
||||
#include "unicode/uclean.h"
|
||||
#include "unicode/udata.h"
|
||||
#include "unicode/udbgutil.h"
|
||||
#include "unewdata.h"
|
||||
#include "cmemory.h"
|
||||
#include "cstring.h"
|
||||
#include "uoptions.h"
|
||||
#include "toolutil.h"
|
||||
#include "icuplugimp.h"
|
||||
#include <unicode/uloc.h>
|
||||
#include <unicode/ucnv.h>
|
||||
#include "unicode/ucal.h"
|
||||
#include <unicode/ulocdata.h>
|
||||
#include "putilimp.h"
|
||||
#include "unicode/uchar.h"
|
||||
|
||||
static UOption options[]={
|
||||
/*0*/ UOPTION_HELP_H,
|
||||
/*1*/ UOPTION_HELP_QUESTION_MARK,
|
||||
/*2*/ UOPTION_DEF("interactive", 'i', UOPT_NO_ARG),
|
||||
/*3*/ UOPTION_VERBOSE,
|
||||
/*4*/ UOPTION_DEF("list-plugins", 'L', UOPT_NO_ARG),
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Print the current platform
|
||||
*/
|
||||
static const char *getPlatform()
|
||||
{
|
||||
#if defined(U_PLATFORM)
|
||||
return U_PLATFORM;
|
||||
#elif defined(U_WINDOWS)
|
||||
return "Windows";
|
||||
#elif defined(U_PALMOS)
|
||||
return "PalmOS";
|
||||
#elif defined(_PLATFORM_H)
|
||||
return "Other (POSIX-like)";
|
||||
#else
|
||||
return "unknown"
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void *theLib = NULL;
|
||||
|
||||
|
||||
void printVersion(const uint8_t *v)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<4;i++)
|
||||
fprintf(stdout, "%3d%c", (int)v[i], (i==3?' ':'.'));
|
||||
|
||||
for(i=0;i<4;i++)
|
||||
fprintf(stdout, "%c", isprint(v[i])?v[i]:'_');
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
|
||||
void printInfo(const UDataInfo *info)
|
||||
{
|
||||
printf("Size: %d, Endianness: %c, Charset family: %c, ",
|
||||
(int)info->size,
|
||||
"lB?"[info->isBigEndian],
|
||||
"AE?"[info->charsetFamily]);
|
||||
|
||||
printf("UChar=%d bytes.\n", info->sizeofUChar);
|
||||
|
||||
printf("dataFormat =");
|
||||
printVersion(info->dataFormat);
|
||||
printf("formatVersion=");
|
||||
printVersion(info->formatVersion);
|
||||
printf("dataVersion =");
|
||||
printVersion(info->dataVersion);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void cmd_C(const char */*buf*/, UErrorCode *status)
|
||||
{
|
||||
if(theLib != NULL)
|
||||
{
|
||||
uplug_closeLibrary(theLib, status);
|
||||
if(U_FAILURE(*status))
|
||||
{
|
||||
fprintf(stderr, "Closed, with err %s\n", u_errorName(*status));
|
||||
} else {
|
||||
fprintf(stderr, "Closed.\n");
|
||||
}
|
||||
theLib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void cmd_O(const char *buf, UErrorCode *status)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if((buf[1]!=' ')||(buf[2]==0))
|
||||
{
|
||||
fprintf(stderr, "Usage: O library...\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* close the buffer if it is open. */
|
||||
cmd_C(buf, status);
|
||||
|
||||
fprintf(stderr, "Opening: [%s]\n", buf+2);
|
||||
p = uplug_openLibrary(buf+2, status);
|
||||
if(!p || U_FAILURE(*status)) {
|
||||
fprintf(stderr, "Didnt' open. %s\n", u_errorName(*status));
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, " -> %p\n", p);
|
||||
}
|
||||
|
||||
theLib = p;
|
||||
}
|
||||
|
||||
void cmd_S(char *buf, UErrorCode *status)
|
||||
{
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
char *equals = NULL;
|
||||
void *foo;
|
||||
const char *lib;
|
||||
|
||||
if(buf[0]=='S')
|
||||
{
|
||||
equals=strchr(buf, '=');
|
||||
|
||||
if(!equals||strlen(buf)<5)
|
||||
{
|
||||
fprintf(stderr, "usage: S myapp_dat=myapp\n");
|
||||
return;
|
||||
}
|
||||
*equals=0;
|
||||
equals++;
|
||||
}
|
||||
else if(buf[0]=='I')
|
||||
{
|
||||
if(strlen(buf)<5 || buf[1]!=' ')
|
||||
{
|
||||
fprintf(stderr, "Usage: I " U_ICUDATA_NAME "_dat\n");
|
||||
return;
|
||||
}
|
||||
equals=strdup("ICUDATA");
|
||||
}
|
||||
|
||||
lib = (buf + 2);
|
||||
|
||||
if(theLib == NULL)
|
||||
{
|
||||
fprintf(stderr, "loading global %s as package %s\n", lib, equals);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "loading %p's %s as package %s\n", theLib, lib, equals);
|
||||
}
|
||||
fflush(stderr);
|
||||
|
||||
foo = uprv_dl_sym(theLib, lib, status);
|
||||
if(!foo || U_FAILURE(*status)) {
|
||||
fprintf(stderr, " Couldn't dlsym(%p,%s) - %s\n", theLib, lib, u_errorName(*status));
|
||||
return;
|
||||
}
|
||||
if(buf[0]=='S') {
|
||||
udata_setAppData(equals, foo, &err);
|
||||
if(U_FAILURE(err))
|
||||
{
|
||||
fprintf(stderr, " couldn't setAppData(%s, %p, ...) - %s\n",
|
||||
equals, foo, u_errorName(err));
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, " Set app data - %s\n", u_errorName(err));
|
||||
|
||||
} else if(buf[0]=='I') {
|
||||
udata_setCommonData(foo, &err);
|
||||
if(U_FAILURE(err))
|
||||
{
|
||||
fprintf(stderr, " couldn't setCommonData(%s, %p, ...) - %s\n",
|
||||
equals, foo, u_errorName(err));
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, " Set cmn data - %s\n", u_errorName(err));
|
||||
|
||||
} else
|
||||
{
|
||||
fprintf(stderr, "Unknown cmd letter '%c'\n", buf[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#define CAN_DYNAMIC_LOAD 1
|
||||
|
||||
void
|
||||
cmd_help()
|
||||
{
|
||||
/*
|
||||
fprintf(stderr, "Options:\n");
|
||||
fprintf(stderr, "\th - print the top 256 bytes of the item\n");
|
||||
fprintf(stderr, "\ti - print info on current item\n");
|
||||
fprintf(stderr, "\tl %cpath%cpkg|name.type - load item of path, package, 'name' and 'type'\n", U_FILE_SEP_CHAR, U_FILE_SEP_CHAR);
|
||||
fprintf(stderr, "\tl name.type - load item of 'name' and 'type'\n");
|
||||
fprintf(stderr, "\tl pkg|name.type - load item of package, 'name' and 'type'\n");
|
||||
fprintf(stderr, "\tp - print the path\n");
|
||||
fprintf(stderr, "\tp= - set the path to empty\n");
|
||||
fprintf(stderr, "\tp=%ca%cb%c%cstuff%cmypkg.dat - set the path\n", U_FILE_SEP_CHAR,U_FILE_SEP_CHAR,U_PATH_SEP_CHAR,U_FILE_SEP_CHAR, U_FILE_SEP_CHAR,U_PATH_SEP_CHAR, U_FILE_SEP_CHAR, U_FILE_SEP_CHAR);
|
||||
fprintf(stderr, "\tq - quit the program\n");
|
||||
fprintf(stderr, "\tu - unload data item\n");
|
||||
fprintf(stderr, "\tv - print version and info (Loads data!)\n");
|
||||
fprintf(stderr, "\t? - show this help\n");
|
||||
#if CAN_DYNAMIC_LOAD
|
||||
fprintf(stderr, " Dynamic Load Functions:\n");
|
||||
fprintf(stderr, "\tO whatever.dll - DLL load\n");
|
||||
fprintf(stderr, "\tC - close DLL\n");
|
||||
fprintf(stderr, "\tS myapp_dat=myapp - load app data myapp from package myapp_dat\n");
|
||||
fprintf(stderr, "\tI icuwhatever_dat - load ICU data\n");
|
||||
fprintf(stderr, "\tI " U_ICUDATA_NAME " ( default for 'I')\n");
|
||||
#endif
|
||||
*/
|
||||
fprintf(stderr, "No help available yet, sorry. \n");
|
||||
}
|
||||
|
||||
const char *prettyDir(const char *d)
|
||||
{
|
||||
if(d == NULL) return "<NULL>";
|
||||
if(*d == 0) return "<EMPTY>";
|
||||
return d;
|
||||
}
|
||||
|
||||
void cmd_version(UBool noLoad)
|
||||
{
|
||||
UVersionInfo icu;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
char str[200];
|
||||
printf("<ICUINFO>\n");
|
||||
printf("International Components for Unicode for C/C++\n");
|
||||
printf("%s\n", U_COPYRIGHT_STRING);
|
||||
printf("Compiled-Version: %s\n", U_ICU_VERSION);
|
||||
u_getVersion(icu);
|
||||
u_versionToString(icu, str);
|
||||
printf("Runtime-Version: %s\n", str);
|
||||
printf("Compiled-Unicode-Version: %s\n", U_UNICODE_VERSION);
|
||||
u_getUnicodeVersion(icu);
|
||||
u_versionToString(icu, str);
|
||||
printf("Runtime-Unicode-Version: %s\n", U_UNICODE_VERSION);
|
||||
printf("Platform: %s\n", getPlatform());
|
||||
#if defined(U_BUILD)
|
||||
printf("Build: %s\n", U_BUILD);
|
||||
#if defined(U_HOST)
|
||||
if(strcmp(U_BUILD,U_HOST)) {
|
||||
printf("Host: %s\n", U_HOST);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#if defined(U_CC)
|
||||
printf("C compiler: %s\n", U_CC);
|
||||
#endif
|
||||
#if defined(U_CXX)
|
||||
printf("C++ compiler: %s\n", U_CXX);
|
||||
#endif
|
||||
#if defined(CYGWINMSVC)
|
||||
printf("Cygwin: CYGWINMSVC\n");
|
||||
#endif
|
||||
printf("ICUDATA: %s\n", U_ICUDATA_NAME);
|
||||
printf("Data Directory: %s\n", u_getDataDirectory());
|
||||
u_init(&status);
|
||||
printf("ICU Initialization returned: %s\n", u_errorName(status));
|
||||
printf( "Default locale: %s\n", uloc_getDefault());
|
||||
{
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
ulocdata_getCLDRVersion(icu, &subStatus);
|
||||
if(U_SUCCESS(subStatus)) {
|
||||
u_versionToString(icu, str);
|
||||
printf("CLDR-Version: %s\n", str);
|
||||
} else {
|
||||
printf("CLDR-Version: %s\n", u_errorName(subStatus));
|
||||
}
|
||||
}
|
||||
|
||||
#if !UCONFIG_NO_CONVERSION
|
||||
if(noLoad == FALSE)
|
||||
{
|
||||
printf("Default converter: %s\n", ucnv_getDefaultName());
|
||||
}
|
||||
#endif
|
||||
#if !UCONFIG_NO_FORMATTING
|
||||
{
|
||||
UChar buf[100];
|
||||
char buf2[100];
|
||||
UErrorCode subsubStatus= U_ZERO_ERROR;
|
||||
int32_t len;
|
||||
|
||||
len = ucal_getDefaultTimeZone(buf, 100, &subsubStatus);
|
||||
if(U_SUCCESS(subsubStatus)&&len>0) {
|
||||
u_UCharsToChars(buf, buf2, len+1);
|
||||
printf("Default TZ: %s\n", buf2);
|
||||
} else {
|
||||
printf("Default TZ: %s\n", u_errorName(subsubStatus));
|
||||
}
|
||||
}
|
||||
{
|
||||
UErrorCode subStatus = U_ZERO_ERROR;
|
||||
const char *tzVer = ucal_getTZDataVersion(&subStatus);
|
||||
if(U_FAILURE(subStatus)) {
|
||||
tzVer = u_errorName(subStatus);
|
||||
}
|
||||
printf("TZ data version: %s\n", tzVer);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if U_ENABLE_DYLOAD
|
||||
const char *pluginFile = uplug_getPluginFile();
|
||||
printf("Plugin file is: %s\n", (pluginFile&&*pluginFile)?pluginFile:"(not set. try setting ICU_PLUGINS to a directory.)");
|
||||
#else
|
||||
fprintf(stderr, "Dynamic Loading: is disabled. No plugins will be loaded at start-up.\n");
|
||||
#endif
|
||||
printf("</ICUINFO>\n\n");
|
||||
}
|
||||
|
||||
void cmd_cleanup(UBool noLoad)
|
||||
{
|
||||
u_cleanup();
|
||||
/* fprintf(stderr,"u_cleanup() returned.\n");*/
|
||||
}
|
||||
|
||||
|
||||
void cmd_listplugins() {
|
||||
int32_t i;
|
||||
UPlugData *plug;
|
||||
|
||||
printf("Plugins: \n");
|
||||
printf( "# %6s %s \n",
|
||||
"Level",
|
||||
"Name" );
|
||||
printf( " %10s:%-10s\n",
|
||||
"Library",
|
||||
"Symbol"
|
||||
);
|
||||
|
||||
|
||||
printf( " config| (configuration string)\n");
|
||||
printf( " >>> Error | Explanation \n");
|
||||
printf( "-----------------------------------\n");
|
||||
|
||||
for(i=0;(plug=uplug_getPlugInternal(i))!=NULL;i++) {
|
||||
UErrorCode libStatus = U_ZERO_ERROR;
|
||||
const char *name = uplug_getPlugName(plug);
|
||||
const char *sym = uplug_getSymbolName(plug);
|
||||
const char *lib = uplug_getLibraryName(plug, &libStatus);
|
||||
const char *config = uplug_getConfiguration(plug);
|
||||
UErrorCode loadStatus = uplug_getPlugLoadStatus(plug);
|
||||
const char *message = NULL;
|
||||
|
||||
printf("\n#%d %-6s %s \n",
|
||||
i+1,
|
||||
udbg_enumName(UDBG_UPlugLevel,(int32_t)uplug_getPlugLevel(plug)),
|
||||
name!=NULL?(*name?name:"this plugin did not call uplug_setPlugName()"):"(null)"
|
||||
);
|
||||
printf(" plugin| %10s:%-10s\n",
|
||||
(U_SUCCESS(libStatus)?(lib!=NULL?lib:"(null)"):u_errorName(libStatus)),
|
||||
sym!=NULL?sym:"(null)"
|
||||
);
|
||||
|
||||
if(config!=NULL&&*config) {
|
||||
printf(" config| %s\n", config);
|
||||
}
|
||||
|
||||
switch(loadStatus) {
|
||||
case U_PLUGIN_CHANGED_LEVEL_WARNING:
|
||||
message = "Note: This plugin changed the system level (by allocating memory or calling something which does). Later plugins may not load.";
|
||||
break;
|
||||
|
||||
case U_PLUGIN_DIDNT_SET_LEVEL:
|
||||
message = "Error: This plugin did not call uplug_setPlugLevel during QUERY.";
|
||||
break;
|
||||
|
||||
case U_PLUGIN_TOO_HIGH:
|
||||
message = "Error: This plugin couldn't load because the system level was too high. Try loading this plugin earlier.";
|
||||
break;
|
||||
|
||||
case U_ZERO_ERROR:
|
||||
message = NULL; /* no message */
|
||||
break;
|
||||
default:
|
||||
if(U_FAILURE(loadStatus)) {
|
||||
message = "error loading:";
|
||||
} else {
|
||||
message = "warning during load:";
|
||||
}
|
||||
}
|
||||
|
||||
if(message!=NULL) {
|
||||
printf("\\\\\\ status| %s\n"
|
||||
"/// %s\n", u_errorName(loadStatus), message);
|
||||
}
|
||||
|
||||
}
|
||||
if(i==0) {
|
||||
printf("No plugins loaded.\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void cmd_path(const char *buf)
|
||||
{
|
||||
if(buf[1]=='=')
|
||||
{
|
||||
fprintf(stderr, "ICU data path was %s\n", prettyDir(u_getDataDirectory()));
|
||||
if((buf[2]==0)||(buf[2]==' '))
|
||||
{
|
||||
u_setDataDirectory("");
|
||||
fprintf(stderr, "ICU data path set to EMPTY\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
u_setDataDirectory(buf+2);
|
||||
fprintf(stderr, "ICU data path set to %s\n", buf+2);
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "ICU data path is %s\n", prettyDir(u_getDataDirectory()));
|
||||
}
|
||||
|
||||
void cmd_unload(const char * /*buf*/, UDataMemory *old)
|
||||
{
|
||||
if(old)
|
||||
{
|
||||
fprintf(stderr, "Unloading data at %p\n", (void*)old);
|
||||
udata_close(old);
|
||||
}
|
||||
}
|
||||
|
||||
UDataMemory *cmd_load(char *buf, UDataMemory *old)
|
||||
{
|
||||
const char *pkg;
|
||||
char *name;
|
||||
char *type;
|
||||
UDataMemory *data;
|
||||
|
||||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
cmd_unload(buf, old);
|
||||
|
||||
|
||||
if((buf[1] != ' ')||(buf[2]==0))
|
||||
{
|
||||
fprintf(stderr, "Load: Load what?\n");
|
||||
fprintf(stderr, "Use ? for help.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
name = strchr(buf+2, '|');
|
||||
if(name == NULL) /* separator not found */
|
||||
{
|
||||
pkg = NULL;
|
||||
name = buf+2;
|
||||
}
|
||||
else
|
||||
{
|
||||
pkg = buf+2; /* starts with pkg name */
|
||||
*name = 0; /* zap | */
|
||||
name++;
|
||||
}
|
||||
|
||||
type = strchr(name, '.');
|
||||
if(type == NULL)
|
||||
{
|
||||
fprintf(stderr, "Bad type. Use ? for help.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*type = 0;
|
||||
type++;
|
||||
|
||||
if(*type == 0)
|
||||
{
|
||||
fprintf(stderr, "Bad type. Use ? for help.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(*name == 0)
|
||||
{
|
||||
fprintf(stderr, "Bad name. use ? for help.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Attempting to load:: %s | %s . %s ",
|
||||
prettyDir(pkg),
|
||||
name,
|
||||
type);
|
||||
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
data = udata_open(pkg, type, name, &errorCode);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
fprintf(stderr, " -> %s (%p)\n", u_errorName(errorCode), (void*)data);
|
||||
|
||||
if(U_FAILURE(errorCode) && data)
|
||||
{
|
||||
fprintf(stderr, "Forcing data %p to close.\n", (void*)data);
|
||||
udata_close(data);
|
||||
data = NULL;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void cmd_info(const char * /*buf*/, UDataMemory *data)
|
||||
{
|
||||
UDataInfo info;
|
||||
|
||||
if(data == NULL) {
|
||||
fprintf(stderr, "Err, no data loaded\n");
|
||||
return;
|
||||
}
|
||||
|
||||
info.size = sizeof(info);
|
||||
udata_getInfo(data, &info);
|
||||
|
||||
printInfo(&info);
|
||||
}
|
||||
|
||||
void
|
||||
doInteractive()
|
||||
{
|
||||
UDataMemory *data=NULL;
|
||||
|
||||
char linebuf[1024];
|
||||
char loaded[1024];
|
||||
#ifdef HAVE_READLINE
|
||||
char *rl;
|
||||
#endif
|
||||
|
||||
cmd_version(TRUE);
|
||||
cmd_path("p");
|
||||
fprintf(stderr, "\nEntering interactive mode. Typing ? gets help.\n");
|
||||
#if CAN_DYNAMIC_LOAD
|
||||
fprintf(stderr, "(Dynamic loading available.)");
|
||||
#endif
|
||||
#ifdef HAVE_READLINE
|
||||
fprintf(stderr, "(readline mode.)\n");
|
||||
while(rl=readline("==> "))
|
||||
{
|
||||
strcpy(linebuf, rl);
|
||||
#else
|
||||
fprintf(stderr, "==> ");
|
||||
while(!feof(stdin) && fgets(linebuf, 1024, stdin))
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
#endif
|
||||
if(linebuf[strlen(linebuf)-1]=='\n')
|
||||
{
|
||||
linebuf[strlen(linebuf)-1]=0;
|
||||
}
|
||||
|
||||
switch(linebuf[0])
|
||||
{
|
||||
#if 0 && CAN_DYNAMIC_LOAD
|
||||
case 'O':
|
||||
cmd_O(linebuf, &status);
|
||||
break;
|
||||
case 'C':
|
||||
cmd_C(linebuf, &status);
|
||||
break;
|
||||
case 'S':
|
||||
cmd_S(linebuf, &status);
|
||||
break;
|
||||
case 'I':
|
||||
cmd_S(linebuf, &status);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case '!':
|
||||
system(linebuf+1);
|
||||
break;
|
||||
|
||||
case '?':
|
||||
cmd_help();
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
cmd_info(linebuf, data);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
cmd_version(FALSE);
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
strcpy(loaded, linebuf);
|
||||
data = cmd_load(linebuf, data);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
cmd_path(linebuf);
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
fprintf(stderr, "Bye.\n");
|
||||
cmd_unload(linebuf, data);
|
||||
return;
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf(stderr, "Unknown option '%c' (use ? for help).\n", linebuf[0]);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
case ' ':
|
||||
;
|
||||
}
|
||||
|
||||
#ifndef HAVE_READLINE
|
||||
fprintf(stderr, "==> ");
|
||||
#else
|
||||
free(rl);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern int
|
||||
main(int argc, char* argv[]) {
|
||||
UErrorCode errorCode = U_ZERO_ERROR;
|
||||
UBool didSomething = FALSE;
|
||||
|
||||
/* preset then read command line options */
|
||||
argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
|
||||
|
||||
/* error handling, printing usage message */
|
||||
if(argc<0) {
|
||||
fprintf(stderr,
|
||||
"error in command line argument \"%s\"\n",
|
||||
argv[-argc]);
|
||||
}
|
||||
if( options[0].doesOccur || options[1].doesOccur) {
|
||||
fprintf(stderr,
|
||||
"usage: %s [-options]\n"
|
||||
"\toptions:\n"
|
||||
"\t\t-h or -? or --help this usage text\n",
|
||||
argv[0]);
|
||||
return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;
|
||||
}
|
||||
|
||||
if(options[2].doesOccur) {
|
||||
doInteractive();
|
||||
} else {
|
||||
if(options[3].doesOccur) {
|
||||
cmd_version(FALSE);
|
||||
didSomething = TRUE;
|
||||
}
|
||||
|
||||
if(options[4].doesOccur) {
|
||||
cmd_listplugins();
|
||||
didSomething = TRUE;
|
||||
}
|
||||
|
||||
if(options[3].doesOccur) { /* 2nd part of version: cleanup */
|
||||
cmd_cleanup(FALSE);
|
||||
didSomething = TRUE;
|
||||
}
|
||||
|
||||
if(!didSomething) {
|
||||
cmd_version(FALSE); /* at least print the version # */
|
||||
}
|
||||
}
|
||||
|
||||
return U_FAILURE(errorCode);
|
||||
}
|
395
icu4c/source/tools/icuinfo/icuinfo.vcproj
Normal file
395
icu4c/source/tools/icuinfo/icuinfo.vcproj
Normal file
|
@ -0,0 +1,395 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="icuinfo"
|
||||
ProjectGUID="{E7611F49-F088-4175-9446-6111444E72C8}"
|
||||
RootNamespace="icuinfo"
|
||||
SccProjectName="Svn"
|
||||
SccAuxPath="Svn"
|
||||
SccLocalPath="Svn"
|
||||
SccProvider="SubversionScc"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="x86\Release"
|
||||
IntermediateDirectory="x86\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="copy "$(TargetPath)" ..\..\..\bin
"
|
||||
Outputs="..\..\..\bin\$(TargetFileName)"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\common;..\..\i18n;..\toolutil;..\ctestfw"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DisableLanguageExtensions="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
PrecompiledHeaderFile="x86\Release/icuinfo.pch"
|
||||
AssemblerListingLocation="x86\Release/"
|
||||
ObjectFile="x86\Release/"
|
||||
ProgramDataBaseFileName="x86\Release/"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/icuinfo.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
ProgramDatabaseFile="x86\Release/icuinfo.pdb"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory=".\x64\Release"
|
||||
IntermediateDirectory=".\x64\Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="copy "$(TargetPath)" ..\..\..\bin64
"
|
||||
Outputs="..\..\..\bin64\$(TargetFileName)"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\common;..\..\i18n;..\toolutil;..\ctestfw"
|
||||
PreprocessorDefinitions="WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DisableLanguageExtensions="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
PrecompiledHeaderFile="x64\Release/icuinfo.pch"
|
||||
AssemblerListingLocation="x64\Release/"
|
||||
ObjectFile="x64\Release/"
|
||||
ProgramDataBaseFileName="x64\Release/"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/icuinfo.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
ProgramDatabaseFile="x64\Release/icuinfo.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="x86\Debug"
|
||||
IntermediateDirectory="x86\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="copy "$(TargetPath)" ..\..\..\bin
"
|
||||
Outputs="..\..\..\bin\$(TargetFileName)"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\common;..\..\i18n;..\toolutil;..\ctestfw"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
DisableLanguageExtensions="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
PrecompiledHeaderFile="Debug/icuinfo.pch"
|
||||
AssemblerListingLocation="Debug/"
|
||||
ObjectFile="Debug/"
|
||||
ProgramDataBaseFileName="Debug/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/icuinfo.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/icuinfo.pdb"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
UseFAT32Workaround="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory=".\x64\Debug"
|
||||
IntermediateDirectory=".\x64\Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
CommandLine="copy "$(TargetPath)" ..\..\..\bin64
"
|
||||
Outputs="..\..\..\bin64\$(TargetFileName)"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\common;..\..\i18n;..\toolutil;..\ctestfw"
|
||||
PreprocessorDefinitions="WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
DisableLanguageExtensions="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
PrecompiledHeaderFile="Debug/icuinfo.pch"
|
||||
AssemblerListingLocation="Debug/"
|
||||
ObjectFile="Debug/"
|
||||
ProgramDataBaseFileName="Debug/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="4"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/icuinfo.exe"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/icuinfo.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
UseFAT32Workaround="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\icuinfo.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\icuplugins_windows_sample.txt"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
57
icu4c/source/tools/icuinfo/icuplugins_windows_sample.txt
Normal file
57
icu4c/source/tools/icuinfo/icuplugins_windows_sample.txt
Normal file
|
@ -0,0 +1,57 @@
|
|||
# Copyright (C) 2009-2010 IBM Corporation and Others. All Rights Reserved.
|
||||
#
|
||||
# This is a sample ICU Plugins control file for Windows.
|
||||
# It's also an example control file for any platform.
|
||||
#
|
||||
# This file can be copied to, for example, C:\SOMEDIRECTORY\icuplugins##.txt
|
||||
# where ## is the major and minor ICU versions (i.e. just 96 for version 9.6.3)
|
||||
# and C:\SOMEDIRECTORY is any directory.
|
||||
#
|
||||
# Then, set the variable ICU_PLUGINS to C:\SOMEDIRECTORY
|
||||
#
|
||||
# Then, ICU will load the test plugin from either the debug or non-debug
|
||||
# plugin DLL (depending on whether ICU is in debug or non-debug state).
|
||||
#
|
||||
# To see the results, run the command "icuinfo -v -L"
|
||||
#
|
||||
# The format of this file is pretty simple.
|
||||
# These lines are comments.
|
||||
#
|
||||
# Non-comment lines have two or three elements in them, and look like this:
|
||||
#
|
||||
# LIBRARYNAME ENTRYPOINT [ CONFIGURATION .. ]
|
||||
#
|
||||
# Tabs or spaces separate the three items.
|
||||
#
|
||||
# LIBRARYNAME is the name of a shared library, either a short name if it is on the PATH,
|
||||
# or a full pathname.
|
||||
#
|
||||
# ENTRYPOINT is the short (undecorated) symbol name of the plugin's entrypoint.
|
||||
# see unicode/icuplug.h for information.
|
||||
#
|
||||
# CONFIGURATION is the entire rest of the line. It's passed as-is to the plugin.
|
||||
#
|
||||
#
|
||||
# This sample file tries to load 'myPlugin'.
|
||||
# It is in the testplug project. (You will need to rebuild either the debug or release version of this DLL.)
|
||||
# The configuration string isn't used, but is just an example
|
||||
|
||||
## A high level test plugin that does nothing.
|
||||
testplug.dll myPlugin hello=world
|
||||
|
||||
## A "bad" plugin that is low level but performs a malloc.
|
||||
## Sometimes this is desired, but, note that it may cause
|
||||
## later plugins to fail to load.
|
||||
#testplug.dll myPluginBad hello=world
|
||||
|
||||
## A "high-level" plugin that does nothing.
|
||||
## It will be loaded after the low level plugins.
|
||||
#testplug.dll myPluginHigh
|
||||
|
||||
## A "low-level" plugin that does nothing.
|
||||
## It will be loaded before the high level plugins.
|
||||
#testplug.dll myPluginLow
|
||||
|
||||
## A low level plugin that just prints a message when uprv_malloc and related functions are called
|
||||
## Note, it cannot be unloaded.
|
||||
#testplug.dll debugMemoryPlugin
|
186
icu4c/source/tools/icuinfo/testplug.c
Normal file
186
icu4c/source/tools/icuinfo/testplug.c
Normal file
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2009-2010, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
*
|
||||
* FILE NAME : testplug.c
|
||||
*
|
||||
* Date Name Description
|
||||
* 10/29/2009 srl New.
|
||||
******************************************************************************
|
||||
*
|
||||
*
|
||||
* This file implements a number of example ICU plugins.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "unicode/icuplug.h"
|
||||
#include <stdio.h> /* for fprintf */
|
||||
#include <stdlib.h> /* for malloc */
|
||||
#include "unicode/udbgutil.h"
|
||||
#include "unicode/uclean.h"
|
||||
#include "cmemory.h"
|
||||
|
||||
/**
|
||||
* A simple, trivial plugin.
|
||||
*/
|
||||
|
||||
U_CAPI
|
||||
UPlugTokenReturn U_EXPORT2 myPlugin (
|
||||
UPlugData *data,
|
||||
UPlugReason reason,
|
||||
UErrorCode *status) {
|
||||
/* Just print this for debugging */
|
||||
fprintf(stderr,"MyPlugin: data=%p, reason=%s, status=%s\n", (void*)data, udbg_enumName(UDBG_UPlugReason,(int32_t)reason), u_errorName(*status));
|
||||
|
||||
if(reason==UPLUG_REASON_QUERY) {
|
||||
uplug_setPlugName(data, "Just a Test High-Level Plugin"); /* This call is optional in response to UPLUG_REASON_QUERY, but is a good idea. */
|
||||
uplug_setPlugLevel(data, UPLUG_LEVEL_HIGH); /* This call is Mandatory in response to UPLUG_REASON_QUERY */
|
||||
}
|
||||
|
||||
return UPLUG_TOKEN; /* This must always be returned, to indicate that the entrypoint was actually a plugin. */
|
||||
}
|
||||
|
||||
|
||||
U_CAPI
|
||||
UPlugTokenReturn U_EXPORT2 myPluginLow (
|
||||
UPlugData *data,
|
||||
UPlugReason reason,
|
||||
UErrorCode *status) {
|
||||
fprintf(stderr,"MyPluginLow: data=%p, reason=%s, status=%s\n", (void*)data, udbg_enumName(UDBG_UPlugReason,(int32_t)reason), u_errorName(*status));
|
||||
|
||||
if(reason==UPLUG_REASON_QUERY) {
|
||||
uplug_setPlugName(data, "Low Plugin");
|
||||
uplug_setPlugLevel(data, UPLUG_LEVEL_LOW);
|
||||
}
|
||||
|
||||
return UPLUG_TOKEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Doesn't respond to QUERY properly.
|
||||
*/
|
||||
U_CAPI
|
||||
UPlugTokenReturn U_EXPORT2 myPluginFailQuery (
|
||||
UPlugData *data,
|
||||
UPlugReason reason,
|
||||
UErrorCode *status) {
|
||||
fprintf(stderr,"MyPluginFailQuery: data=%p, reason=%s, status=%s\n", (void*)data, udbg_enumName(UDBG_UPlugReason,(int32_t)reason), u_errorName(*status));
|
||||
|
||||
/* Should respond to UPLUG_REASON_QUERY here. */
|
||||
|
||||
return UPLUG_TOKEN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Doesn't return the proper token.
|
||||
*/
|
||||
U_CAPI
|
||||
UPlugTokenReturn U_EXPORT2 myPluginFailToken (
|
||||
UPlugData *data,
|
||||
UPlugReason reason,
|
||||
UErrorCode *status) {
|
||||
fprintf(stderr,"MyPluginFailToken: data=%p, reason=%s, status=%s\n", (void*)data, udbg_enumName(UDBG_UPlugReason,(int32_t)reason), u_errorName(*status));
|
||||
|
||||
if(reason==UPLUG_REASON_QUERY) {
|
||||
uplug_setPlugName(data, "myPluginFailToken Plugin");
|
||||
uplug_setPlugLevel(data, UPLUG_LEVEL_LOW);
|
||||
}
|
||||
|
||||
return 0; /* Wrong. */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Says it's low, but isn't.
|
||||
*/
|
||||
U_CAPI
|
||||
UPlugTokenReturn U_EXPORT2 myPluginBad (
|
||||
UPlugData *data,
|
||||
UPlugReason reason,
|
||||
UErrorCode *status) {
|
||||
fprintf(stderr,"MyPluginLow: data=%p, reason=%s, status=%s\n", (void*)data, udbg_enumName(UDBG_UPlugReason,(int32_t)reason), u_errorName(*status));
|
||||
|
||||
if(reason==UPLUG_REASON_QUERY) {
|
||||
uplug_setPlugName(data, "Bad Plugin");
|
||||
uplug_setPlugLevel(data, UPLUG_LEVEL_LOW);
|
||||
} else if(reason == UPLUG_REASON_LOAD) {
|
||||
void *ctx = uprv_malloc(12345);
|
||||
|
||||
uplug_setContext(data, ctx);
|
||||
fprintf(stderr,"I'm %p and I did a bad thing and malloced %p\n", (void*)data, (void*)ctx);
|
||||
} else if(reason == UPLUG_REASON_UNLOAD) {
|
||||
void * ctx = uplug_getContext(data);
|
||||
|
||||
uprv_free(ctx);
|
||||
}
|
||||
|
||||
|
||||
return UPLUG_TOKEN;
|
||||
}
|
||||
|
||||
U_CAPI
|
||||
UPlugTokenReturn U_EXPORT2 myPluginHigh (
|
||||
UPlugData *data,
|
||||
UPlugReason reason,
|
||||
UErrorCode *status) {
|
||||
fprintf(stderr,"MyPluginHigh: data=%p, reason=%s, status=%s\n", (void*)data, udbg_enumName(UDBG_UPlugReason,(int32_t)reason), u_errorName(*status));
|
||||
|
||||
if(reason==UPLUG_REASON_QUERY) {
|
||||
uplug_setPlugName(data, "High Plugin");
|
||||
uplug_setPlugLevel(data, UPLUG_LEVEL_HIGH);
|
||||
}
|
||||
|
||||
return UPLUG_TOKEN;
|
||||
}
|
||||
|
||||
|
||||
/* Debug Memory Plugin (see hpmufn.c) */
|
||||
static void * U_CALLCONV myMemAlloc(const void *context, size_t size) {
|
||||
void *retPtr = (void *)malloc(size);
|
||||
fprintf(stderr, "MEM: malloc(%d) = %p\n", size, retPtr);
|
||||
return retPtr;
|
||||
}
|
||||
|
||||
static void U_CALLCONV myMemFree(const void *context, void *mem) {
|
||||
free(mem);
|
||||
fprintf(stderr, "MEM: free(%p)\n", mem);
|
||||
}
|
||||
|
||||
static void * U_CALLCONV myMemRealloc(const void *context, void *mem, size_t size) {
|
||||
void *retPtr;
|
||||
|
||||
if(mem==NULL) {
|
||||
retPtr = NULL;
|
||||
} else {
|
||||
retPtr = realloc(mem, size);
|
||||
}
|
||||
fprintf(stderr, "MEM: realloc(%p, %d) = %p\n", mem, size, retPtr);
|
||||
return retPtr;
|
||||
}
|
||||
|
||||
U_CAPI
|
||||
UPlugTokenReturn U_EXPORT2 debugMemoryPlugin (
|
||||
UPlugData *data,
|
||||
UPlugReason reason,
|
||||
UErrorCode *status) {
|
||||
fprintf(stderr,"debugMemoryPlugin: data=%p, reason=%s, status=%s\n", (void*)data, udbg_enumName(UDBG_UPlugReason,(int32_t)reason), u_errorName(*status));
|
||||
|
||||
if(reason==UPLUG_REASON_QUERY) {
|
||||
uplug_setPlugLevel(data, UPLUG_LEVEL_LOW);
|
||||
uplug_setPlugName(data, "Memory Plugin");
|
||||
} else if(reason==UPLUG_REASON_LOAD) {
|
||||
u_setMemoryFunctions(uplug_getContext(data), &myMemAlloc, &myMemRealloc, &myMemFree, status);
|
||||
fprintf(stderr, "MEM: status now %s\n", u_errorName(*status));
|
||||
} else if(reason==UPLUG_REASON_UNLOAD) {
|
||||
fprintf(stderr, "MEM: not possible to unload this plugin (no way to reset memory functions)...\n");
|
||||
uplug_setPlugNoUnload(data, TRUE);
|
||||
}
|
||||
|
||||
return UPLUG_TOKEN;
|
||||
}
|
||||
|
424
icu4c/source/tools/icuinfo/testplug.vcproj
Normal file
424
icu4c/source/tools/icuinfo/testplug.vcproj
Normal file
|
@ -0,0 +1,424 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="testplug"
|
||||
ProjectGUID="{659D0C08-D4ED-4BF3-B02B-2D8D4B5A7A7A}"
|
||||
SccProjectName="Svn"
|
||||
SccAuxPath="Svn"
|
||||
SccLocalPath="Svn"
|
||||
SccProvider="SubversionScc"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\..\..\..\lib"
|
||||
IntermediateDirectory=".\x86\Release"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\..\..\..\lib\testplug.tlb"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\common;..\toolutil;..\ctestfw"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;T_CTEST_IMPLEMENTATION"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DisableLanguageExtensions="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
PrecompiledHeaderFile=".\x86\Release/testplug.pch"
|
||||
AssemblerListingLocation=".\x86\Release/"
|
||||
ObjectFile=".\x86\Release/"
|
||||
ProgramDataBaseFileName=".\x86\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\..\bin\testplug.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
ProgramDatabaseFile=".\..\..\..\lib\testplug.pdb"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary=".\..\..\..\lib\testplug.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory=".\x64\Release"
|
||||
IntermediateDirectory=".\x64\Release"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="3"
|
||||
TypeLibraryName=".\..\..\..\lib64\testplug.tlb"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\common;..\toolutil;..\ctestfw"
|
||||
PreprocessorDefinitions="WIN64;WIN32;NDEBUG;_CRT_SECURE_NO_DEPRECATE;T_CTEST_IMPLEMENTATION"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
DisableLanguageExtensions="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
PrecompiledHeaderFile=".\x64\Release/testplug.pch"
|
||||
AssemblerListingLocation=".\x64\Release/"
|
||||
ObjectFile=".\x64\Release/"
|
||||
ProgramDataBaseFileName=".\x64\Release/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\..\bin64\testplug.dll"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
ProgramDatabaseFile=".\..\..\..\lib64\testplug.pdb"
|
||||
EnableCOMDATFolding="2"
|
||||
LinkTimeCodeGeneration="1"
|
||||
ImportLibrary=".\..\..\..\lib64\testplug.lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\..\..\..\lib"
|
||||
IntermediateDirectory=".\x86\Debug"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\..\..\..\lib\testplugd.tlb"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\common;..\toolutil;..\ctestfw"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;T_CTEST_IMPLEMENTATION"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
DisableLanguageExtensions="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
PrecompiledHeaderFile=".\x86\Debug/testplug.pch"
|
||||
AssemblerListingLocation=".\x86\Debug/"
|
||||
ObjectFile=".\x86\Debug/"
|
||||
ProgramDataBaseFileName=".\x86\Debug/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\..\bin\testplug.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\..\..\..\lib\testplugd.pdb"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary=".\..\..\..\lib\testplugd.lib"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
UseFAT32Workaround="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory=".\x64\Debug"
|
||||
IntermediateDirectory=".\x64\Debug"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="true"
|
||||
SuppressStartupBanner="true"
|
||||
TargetEnvironment="3"
|
||||
TypeLibraryName=".\..\..\..\lib64\testplugd.tlb"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\common;..\toolutil;..\ctestfw"
|
||||
PreprocessorDefinitions="WIN64;WIN32;_DEBUG;_CRT_SECURE_NO_DEPRECATE;T_CTEST_IMPLEMENTATION"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
BufferSecurityCheck="true"
|
||||
DisableLanguageExtensions="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
PrecompiledHeaderFile=".\x64\Debug/testplug.pch"
|
||||
AssemblerListingLocation=".\x64\Debug/"
|
||||
ObjectFile=".\x64\Debug/"
|
||||
ProgramDataBaseFileName=".\x64\Debug/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="true"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="..\..\..\bin64\testplug.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\..\..\..\lib64\testplugd.pdb"
|
||||
ImportLibrary=".\..\..\..\lib64\testplugd.lib"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
UseFAT32Workaround="true"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\testplug.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>
|
Loading…
Add table
Reference in a new issue