|
|
7af02c0 |
--- src/jrd/unicode_util.cpp 2011/04/21 19:57:57 52787
|
|
|
7af02c0 |
+++ src/jrd/unicode_util.cpp 2011/04/21 20:25:12 52788
|
|
|
7af02c0 |
@@ -57,8 +57,10 @@
|
|
|
7af02c0 |
ICU& operator =(const ICU&); // not implemented
|
|
|
7af02c0 |
|
|
|
7af02c0 |
public:
|
|
|
7af02c0 |
- ICU()
|
|
|
7af02c0 |
- : inModule(NULL),
|
|
|
7af02c0 |
+ ICU(int aMajorVersion, int aMinorVersion)
|
|
|
7af02c0 |
+ : majorVersion(aMajorVersion),
|
|
|
7af02c0 |
+ minorVersion(aMinorVersion),
|
|
|
7af02c0 |
+ inModule(NULL),
|
|
|
7af02c0 |
ucModule(NULL)
|
|
|
7af02c0 |
{
|
|
|
7af02c0 |
}
|
|
|
7af02c0 |
@@ -69,6 +71,21 @@
|
|
|
7af02c0 |
delete inModule;
|
|
|
7af02c0 |
}
|
|
|
7af02c0 |
|
|
|
7af02c0 |
+ template <typename T> void getEntryPoint(const char* name, ModuleLoader::Module* module, T& ptr)
|
|
|
7af02c0 |
+ {
|
|
|
7af02c0 |
+ string symbol;
|
|
|
7af02c0 |
+
|
|
|
7af02c0 |
+ symbol.printf("%s_%d_%d", name, majorVersion, minorVersion);
|
|
|
7af02c0 |
+ module->findSymbol(symbol, ptr);
|
|
|
7af02c0 |
+ if (ptr)
|
|
|
7af02c0 |
+ return;
|
|
|
7af02c0 |
+
|
|
|
7af02c0 |
+ symbol.printf("%s_%d%d", name, majorVersion, minorVersion);
|
|
|
7af02c0 |
+ module->findSymbol(symbol, ptr);
|
|
|
7af02c0 |
+ }
|
|
|
7af02c0 |
+
|
|
|
7af02c0 |
+ int majorVersion;
|
|
|
7af02c0 |
+ int minorVersion;
|
|
|
7af02c0 |
ModuleLoader::Module* inModule;
|
|
|
7af02c0 |
ModuleLoader::Module* ucModule;
|
|
|
7af02c0 |
UVersionInfo collVersion;
|
|
|
7af02c0 |
@@ -714,17 +731,17 @@
|
|
|
7af02c0 |
const Firebird::string& configInfo)
|
|
|
7af02c0 |
{
|
|
|
7af02c0 |
#if defined(WIN_NT)
|
|
|
7af02c0 |
- const char* const inTemplate = "icuin%s%s.dll";
|
|
|
7af02c0 |
- const char* const ucTemplate = "icuuc%s%s.dll";
|
|
|
7af02c0 |
+ const char* const inTemplate = "icuin%d%d.dll";
|
|
|
7af02c0 |
+ const char* const ucTemplate = "icuuc%d%d.dll";
|
|
|
7af02c0 |
#elif defined(DARWIN)
|
|
|
7af02c0 |
const char* const inTemplate = "/Library/Frameworks/Firebird.framework/Versions/A/Libraries/libicui18n.dylib";
|
|
|
7af02c0 |
const char* const ucTemplate = "/Library/Frameworks/Firebird.framework/versions/A/Libraries/libicuuc.dylib";
|
|
|
7af02c0 |
#elif defined(HPUX)
|
|
|
7af02c0 |
- const char* const inTemplate = "libicui18n.sl.%s%s";
|
|
|
7af02c0 |
- const char* const ucTemplate = "libicuuc.sl.%s%s";
|
|
|
7af02c0 |
+ const char* const inTemplate = "libicui18n.sl.%d%d";
|
|
|
7af02c0 |
+ const char* const ucTemplate = "libicuuc.sl.%d%d";
|
|
|
7af02c0 |
#else
|
|
|
7af02c0 |
- const char* const inTemplate = "libicui18n.so.%s%s";
|
|
|
7af02c0 |
- const char* const ucTemplate = "libicuuc.so.%s%s";
|
|
|
7af02c0 |
+ const char* const inTemplate = "libicui18n.so.%d%d";
|
|
|
7af02c0 |
+ const char* const ucTemplate = "libicuuc.so.%d%d";
|
|
|
7af02c0 |
#endif
|
|
|
7af02c0 |
|
|
|
7af02c0 |
ObjectsArray<string> versions;
|
|
|
7af02c0 |
@@ -736,25 +753,20 @@
|
|
|
7af02c0 |
|
|
|
7af02c0 |
for (ObjectsArray<string>::const_iterator i(versions.begin()); i != versions.end(); ++i)
|
|
|
7af02c0 |
{
|
|
|
7af02c0 |
- string majorVersion;
|
|
|
7af02c0 |
- string minorVersion;
|
|
|
7af02c0 |
+ int majorVersion, minorVersion;
|
|
|
7af02c0 |
|
|
|
7af02c0 |
if (*i == "default")
|
|
|
7af02c0 |
{
|
|
|
7af02c0 |
- majorVersion = STRINGIZE(U_ICU_VERSION_MAJOR_NUM);
|
|
|
7af02c0 |
- minorVersion = STRINGIZE(U_ICU_VERSION_MINOR_NUM);
|
|
|
7af02c0 |
+ majorVersion = U_ICU_VERSION_MAJOR_NUM;
|
|
|
7af02c0 |
+ minorVersion = U_ICU_VERSION_MINOR_NUM;
|
|
|
7af02c0 |
}
|
|
|
7af02c0 |
- else
|
|
|
7af02c0 |
- {
|
|
|
7af02c0 |
- size_t pos = i->find('.');
|
|
|
7af02c0 |
- if (pos == i->npos)
|
|
|
7af02c0 |
- continue;
|
|
|
7af02c0 |
+ else if (sscanf(i->c_str(), "%d.%d", &majorVersion, &minorVersion) != 2)
|
|
|
7af02c0 |
+ continue;
|
|
|
7af02c0 |
|
|
|
7af02c0 |
- majorVersion = i->substr(0, pos);
|
|
|
7af02c0 |
- minorVersion = i->substr(pos + 1);
|
|
|
7af02c0 |
- }
|
|
|
7af02c0 |
+ string configVersion;
|
|
|
7af02c0 |
+ configVersion.printf("%d.%d", majorVersion, minorVersion);
|
|
|
7af02c0 |
|
|
|
7af02c0 |
- if (version != majorVersion + "." + minorVersion)
|
|
|
7af02c0 |
+ if (version != configVersion)
|
|
|
7af02c0 |
continue;
|
|
|
7af02c0 |
|
|
|
7af02c0 |
ReadLockGuard readGuard(icuModules.lock);
|
|
|
7af02c0 |
@@ -764,9 +776,9 @@
|
|
|
7af02c0 |
return icu;
|
|
|
7af02c0 |
|
|
|
7af02c0 |
PathName filename;
|
|
|
7af02c0 |
- filename.printf(ucTemplate, majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
+ filename.printf(ucTemplate, majorVersion, minorVersion);
|
|
|
7af02c0 |
|
|
|
7af02c0 |
- icu = FB_NEW(*getDefaultMemoryPool()) ICU();
|
|
|
7af02c0 |
+ icu = FB_NEW(*getDefaultMemoryPool()) ICU(majorVersion, minorVersion);
|
|
|
7af02c0 |
|
|
|
7af02c0 |
icu->ucModule = ModuleLoader::loadModule(filename);
|
|
|
7af02c0 |
if (!icu->ucModule)
|
|
|
7af02c0 |
@@ -781,7 +793,7 @@
|
|
|
7af02c0 |
continue;
|
|
|
7af02c0 |
}
|
|
|
7af02c0 |
|
|
|
7af02c0 |
- filename.printf(inTemplate, majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
+ filename.printf(inTemplate, majorVersion, minorVersion);
|
|
|
7af02c0 |
|
|
|
7af02c0 |
icu->inModule = ModuleLoader::loadModule(filename);
|
|
|
7af02c0 |
if (!icu->inModule)
|
|
|
7af02c0 |
@@ -796,49 +808,21 @@
|
|
|
7af02c0 |
continue;
|
|
|
7af02c0 |
}
|
|
|
7af02c0 |
|
|
|
7af02c0 |
- string symbol;
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("u_versionToString_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->ucModule->findSymbol(symbol, icu->uVersionToString);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("uloc_countAvailable_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->ucModule->findSymbol(symbol, icu->ulocCountAvailable);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("uloc_getAvailable_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->ucModule->findSymbol(symbol, icu->ulocGetAvailable);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("uset_close_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->ucModule->findSymbol(symbol, icu->usetClose);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("uset_getItem_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->ucModule->findSymbol(symbol, icu->usetGetItem);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("uset_getItemCount_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->ucModule->findSymbol(symbol, icu->usetGetItemCount);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("uset_open_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->ucModule->findSymbol(symbol, icu->usetOpen);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("ucol_close_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->inModule->findSymbol(symbol, icu->ucolClose);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("ucol_getContractions_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->inModule->findSymbol(symbol, icu->ucolGetContractions);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("ucol_getSortKey_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->inModule->findSymbol(symbol, icu->ucolGetSortKey);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("ucol_open_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->inModule->findSymbol(symbol, icu->ucolOpen);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("ucol_setAttribute_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->inModule->findSymbol(symbol, icu->ucolSetAttribute);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("ucol_strcoll_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->inModule->findSymbol(symbol, icu->ucolStrColl);
|
|
|
7af02c0 |
-
|
|
|
7af02c0 |
- symbol.printf("ucol_getVersion_%s_%s", majorVersion.c_str(), minorVersion.c_str());
|
|
|
7af02c0 |
- icu->inModule->findSymbol(symbol, icu->ucolGetVersion);
|
|
|
7af02c0 |
+ icu->getEntryPoint("u_versionToString", icu->ucModule, icu->uVersionToString);
|
|
|
7af02c0 |
+ icu->getEntryPoint("uloc_countAvailable", icu->ucModule, icu->ulocCountAvailable);
|
|
|
7af02c0 |
+ icu->getEntryPoint("uloc_getAvailable", icu->ucModule, icu->ulocGetAvailable);
|
|
|
7af02c0 |
+ icu->getEntryPoint("uset_close", icu->ucModule, icu->usetClose);
|
|
|
7af02c0 |
+ icu->getEntryPoint("uset_getItem", icu->ucModule, icu->usetGetItem);
|
|
|
7af02c0 |
+ icu->getEntryPoint("uset_getItemCount", icu->ucModule, icu->usetGetItemCount);
|
|
|
7af02c0 |
+ icu->getEntryPoint("uset_open", icu->ucModule, icu->usetOpen);
|
|
|
7af02c0 |
+
|
|
|
7af02c0 |
+ icu->getEntryPoint("ucol_close", icu->inModule, icu->ucolClose);
|
|
|
7af02c0 |
+ icu->getEntryPoint("ucol_getContractions", icu->inModule, icu->ucolGetContractions);
|
|
|
7af02c0 |
+ icu->getEntryPoint("ucol_getSortKey", icu->inModule, icu->ucolGetSortKey);
|
|
|
7af02c0 |
+ icu->getEntryPoint("ucol_open", icu->inModule, icu->ucolOpen);
|
|
|
7af02c0 |
+ icu->getEntryPoint("ucol_setAttribute", icu->inModule, icu->ucolSetAttribute);
|
|
|
7af02c0 |
+ icu->getEntryPoint("ucol_strcoll", icu->inModule, icu->ucolStrColl);
|
|
|
7af02c0 |
+ icu->getEntryPoint("ucol_getVersion", icu->inModule, icu->ucolGetVersion);
|
|
|
7af02c0 |
|
|
|
7af02c0 |
if (!icu->uVersionToString || !icu->ulocCountAvailable || !icu->ulocGetAvailable ||
|
|
|
7af02c0 |
!icu->usetClose || !icu->usetGetItem || !icu->usetGetItemCount || !icu->usetOpen ||
|
|
|
7af02c0 |
|