summaryrefslogtreecommitdiff
path: root/i18npool/source/breakiterator
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2012-04-18 01:21:31 +0300
committerTor Lillqvist <tml@iki.fi>2012-04-18 01:23:51 +0300
commitf06e6513a805d810d3ef8fc9ccf90d1b7cf48c3d (patch)
treecc24f18f066b0aa0f4f5c77ae4dfb052ce651397 /i18npool/source/breakiterator
parent4048a810a0c00af2bf94d24243ff02a832f63de3 (diff)
Use static linking when DISABLE_DYNLOADING (iOS)
Diffstat (limited to 'i18npool/source/breakiterator')
-rw-r--r--i18npool/source/breakiterator/gendict.cxx26
-rw-r--r--i18npool/source/breakiterator/xdictionary.cxx52
2 files changed, 69 insertions, 9 deletions
diff --git a/i18npool/source/breakiterator/gendict.cxx b/i18npool/source/breakiterator/gendict.cxx
index ce9137d54179..960dae63a763 100644
--- a/i18npool/source/breakiterator/gendict.cxx
+++ b/i18npool/source/breakiterator/gendict.cxx
@@ -73,13 +73,21 @@ static inline void printIncludes(FILE* source_fp)
fputs("#include <sal/types.h>\n\n", source_fp);
}
-static inline void printFunctions(FILE* source_fp)
+static inline void printFunctions(FILE* source_fp, const char *lang)
{
- fputs ("\tconst sal_uInt8* getExistMark() { return existMark; }\n", source_fp);
- fputs ("\tconst sal_Int16* getIndex1() { return index1; }\n", source_fp);
- fputs ("\tconst sal_Int32* getIndex2() { return index2; }\n", source_fp);
- fputs ("\tconst sal_Int32* getLenArray() { return lenArray; }\n", source_fp);
- fputs ("\tconst sal_Unicode* getDataArea() { return dataArea; }\n", source_fp);
+ fputs ("#ifndef DISABLE_DYNLOADING\n", source_fp);
+ fputs ("SAL_DLLPUBLIC_EXPORT const sal_uInt8* getExistMark() { return existMark; }\n", source_fp);
+ fputs ("SAL_DLLPUBLIC_EXPORT const sal_Int16* getIndex1() { return index1; }\n", source_fp);
+ fputs ("SAL_DLLPUBLIC_EXPORT const sal_Int32* getIndex2() { return index2; }\n", source_fp);
+ fputs ("SAL_DLLPUBLIC_EXPORT const sal_Int32* getLenArray() { return lenArray; }\n", source_fp);
+ fputs ("SAL_DLLPUBLIC_EXPORT const sal_Unicode* getDataArea() { return dataArea; }\n", source_fp);
+ fputs ("#else\n", source_fp);
+ fprintf (source_fp, "SAL_DLLPUBLIC_EXPORT const sal_uInt8* getExistMark_%s() { return existMark; }\n", lang);
+ fprintf (source_fp, "SAL_DLLPUBLIC_EXPORT const sal_Int16* getIndex1_%s() { return index1; }\n", lang);
+ fprintf (source_fp, "SAL_DLLPUBLIC_EXPORT const sal_Int32* getIndex2_%s() { return index2; }\n", lang);
+ fprintf (source_fp, "SAL_DLLPUBLIC_EXPORT const sal_Int32* getLenArray_%s() { return lenArray; }\n", lang);
+ fprintf (source_fp, "SAL_DLLPUBLIC_EXPORT const sal_Unicode* getDataArea_%s() { return dataArea; }\n", lang);
+ fputs ("#endif\n", source_fp);
}
static inline void printDataArea(FILE *dictionary_fp, FILE *source_fp, vector<sal_uInt32>& lenArray)
@@ -199,9 +207,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
{
FILE *dictionary_fp, *source_fp;
- if (argc == 1 || argc > 3)
+ if (argc == 1 || argc > 4)
{
- fputs("2 arguments required: dictionary_file_name source_file_name", stderr);
+ fputs("3 arguments required: dictionary_file_name source_file_name language_code", stderr);
exit(-1);
}
@@ -235,7 +243,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
printIndex1(source_fp, set);
printIndex2(source_fp, set);
printExistsMask(source_fp);
- printFunctions(source_fp);
+ printFunctions(source_fp, argv[3]);
fputs("}\n", source_fp);
fclose(dictionary_fp);
diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx
index 955cff4a043d..540bce8b3a91 100644
--- a/i18npool/source/breakiterator/xdictionary.cxx
+++ b/i18npool/source/breakiterator/xdictionary.cxx
@@ -49,19 +49,44 @@ using ::rtl::OUStringBuffer;
namespace com { namespace sun { namespace star { namespace i18n {
+#ifndef DISABLE_DYNLOADING
+
extern "C" { static void SAL_CALL thisModule() {} }
+#else
+
+extern "C" {
+
+sal_uInt8* getExistMark_ja();
+sal_Int16* getIndex1_ja();
+sal_Int32* getIndex2_ja();
+sal_Int32* getLenArray_ja();
+sal_Unicode* getDataArea_ja();
+
+sal_uInt8* getExistMark_zh();
+sal_Int16* getIndex1_zh();
+sal_Int32* getIndex2_zh();
+sal_Int32* getLenArray_zh();
+sal_Unicode* getDataArea_zh();
+
+}
+
+#endif
+
xdictionary::xdictionary(const sal_Char *lang) :
existMark( NULL ),
index1( NULL ),
index2( NULL ),
lenArray( NULL ),
dataArea( NULL ),
+#ifndef DISABLE_DYNLOADING
hModule( NULL ),
+#endif
boundary(),
japaneseWordBreak( sal_False )
{
index1 = 0;
+#ifndef DISABLE_DYNLOADING
#ifdef SAL_DLLPREFIX
OUStringBuffer aBuf( strlen(lang) + 7 + 6 ); // mostly "lib*.so" (with * == dict_zh)
aBuf.appendAscii( SAL_DLLPREFIX );
@@ -92,6 +117,31 @@ xdictionary::xdictionary(const sal_Char *lang) :
dataArea = NULL;
}
+#else
+ if( strcmp( lang, "ja" ) == 0 ) {
+ existMark = getExistMark_ja();
+ index1 = getIndex1_ja();
+ index2 = getIndex2_ja();
+ lenArray = getLenArray_ja();
+ dataArea = getDataArea_ja();
+ }
+ else if( strcmp( lang, "zh" ) == 0 ) {
+ existMark = getExistMark_zh();
+ index1 = getIndex1_zh();
+ index2 = getIndex2_zh();
+ lenArray = getLenArray_zh();
+ dataArea = getDataArea_zh();
+ }
+ else
+ {
+ existMark = NULL;
+ index1 = NULL;
+ index2 = NULL;
+ lenArray = NULL;
+ dataArea = NULL;
+ }
+#endif
+
for (sal_Int32 i = 0; i < CACHE_MAX; i++)
cache[i].size = 0;
@@ -99,7 +149,9 @@ xdictionary::xdictionary(const sal_Char *lang) :
}
xdictionary::~xdictionary() {
+#ifndef DISABLE_DYNLOADING
osl_unloadModule(hModule);
+#endif
for (sal_Int32 i = 0; i < CACHE_MAX; i++) {
if (cache[i].size > 0) {
delete [] cache[i].contents;