[Libreoffice-commits] core.git: i18npool/source

Tor Lillqvist tml at collabora.com
Fri Apr 25 09:01:15 PDT 2014


 i18npool/source/registerservices/registerservices.cxx |   81 ++++++++++++++++++
 1 file changed, 81 insertions(+)

New commits:
commit 0962f24a90961dfa0112a9fd8d7492371b78ddc6
Author: Tor Lillqvist <tml at collabora.com>
Date:   Fri Apr 25 18:49:18 2014 +0300

    Obey --with-locales here, too
    
    Avoid linking in various functions and potentially largish data
    objects if the corresponding locale is deliberatedly skipped by using
    the --with-locales configure option.
    
    Change-Id: I8ec8c2b6176972d048a3c0e180ac0e6e805f2378

diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx
index 9c8bb0f..634c711 100644
--- a/i18npool/source/registerservices/registerservices.cxx
+++ b/i18npool/source/registerservices/registerservices.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_locales.h>
+
 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/registry/XRegistryKey.hpp>
@@ -96,6 +98,15 @@ typedef uno::Reference<
 
 using namespace i18n;
 
+// At least for iOS it doesn't hurt if we have lots of functions here
+// generated by these lovely macros that get compiled, but then no
+// references to them thanks to the WITH_LOCALE ifdefs for the
+// aInstances table below. The -dead_strip linker option will take
+// care of not linking these functions in. Presumably the same holds
+// for Android, too, as we use -ffunction-sections and
+// -Wl,--gc_sections. It's mainly for iOS and Android that the
+// --with-locales option is intended anyway.
+
 IMPL_CREATEINSTANCE_CTX( IndexEntrySupplier )
 IMPL_CREATEINSTANCE_CTX( IndexEntrySupplier_asian )
 IMPL_CREATEINSTANCE_CTX( IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable )
@@ -251,6 +262,7 @@ static const struct InstancesArray {
     {   "com.sun.star.i18n.IndexEntrySupplier_asian",
         "com.sun.star.i18n.IndexEntrySupplier_asian",
         &IndexEntrySupplier_asian_CreateInstance },
+#if WITH_LOCALE_ALL || WITH_LOCALE_ja
     {   "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric first)",
         "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric first)",
         &IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable_CreateInstance },
@@ -269,6 +281,7 @@ static const struct InstancesArray {
     {   "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric last) (grouped by consonant)",
         "com.sun.star.i18n.IndexEntrySupplier_ja_phonetic (alphanumeric last) (grouped by consonant)",
         &IndexEntrySupplier_ja_phonetic_alphanumeric_last_by_consonant_CreateInstance },
+#endif
     {       "com.sun.star.i18n.IndexEntrySupplier_Unicode",
         "com.sun.star.i18n.IndexEntrySupplier_Unicode",
         &IndexEntrySupplier_Unicode_CreateInstance },
@@ -299,39 +312,55 @@ static const struct InstancesArray {
     {   "com.sun.star.i18n.Calendar_buddhist",
         "com.sun.star.i18n.Calendar_buddhist",
         &Calendar_buddhist_CreateInstance },
+#if WITH_LOCALE_ALL || WITH_LOCALE_ja
     {   "com.sun.star.i18n.BreakIterator_ja",
         "com.sun.star.i18n.BreakIterator_ja",
         &BreakIterator_ja_CreateInstance },
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_zh
     {   "com.sun.star.i18n.BreakIterator_zh",
         "com.sun.star.i18n.BreakIterator_zh",
         &BreakIterator_zh_CreateInstance },
     {   "com.sun.star.i18n.BreakIterator_zh_TW",
         "com.sun.star.i18n.BreakIterator_zh_TW",
         &BreakIterator_zh_TW_CreateInstance },
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ko
     {   "com.sun.star.i18n.BreakIterator_ko",
         "com.sun.star.i18n.BreakIterator_ko",
         &BreakIterator_ko_CreateInstance },
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_th
     {   "com.sun.star.i18n.BreakIterator_th",
         "com.sun.star.i18n.BreakIterator_th",
         &BreakIterator_th_CreateInstance },
+#endif
     {   "com.sun.star.i18n.ChapterCollator",
         "com.sun.star.i18n.ChapterCollator",
         &ChapterCollator_CreateInstance },
     {   "com.sun.star.i18n.Collator_Unicode",
         "com.sun.star.i18n.Collator_Unicode",
         &Collator_Unicode_CreateInstance },
+#if WITH_LOCALE_ALL || WITH_LOCALE_th
     {   "com.sun.star.i18n.InputSequenceChecker_th",
         "com.sun.star.i18n.InputSequenceChecker_th",
         &InputSequenceChecker_th_CreateInstance },
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_hi
     {   "com.sun.star.i18n.InputSequenceChecker_hi",
         "com.sun.star.i18n.InputSequenceChecker_hi",
         &InputSequenceChecker_hi_CreateInstance },
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ko
     {   "com.sun.star.i18n.TextConversion_ko",
         "com.sun.star.i18n.TextConversion_ko",
         &TextConversion_ko_CreateInstance },
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_zh
     {   "com.sun.star.i18n.TextConversion_zh",
         "com.sun.star.i18n.TextConversion_zh",
         &TextConversion_zh_CreateInstance },
+#endif
     {   TRLT_SERVICELNAME_L10N,
         TRLT_IMPLNAME_PREFIX  "UPPERCASE_LOWERCASE",
         &Transliteration_u2l_CreateInstance },
@@ -347,6 +376,7 @@ static const struct InstancesArray {
     {   TRLT_SERVICELNAME_L10N,
         TRLT_IMPLNAME_PREFIX  "TOGGLE_CASE",
         &Transliteration_togglecase_CreateInstance },
+#if WITH_LOCALE_ALL || WITH_LOCALE_ja
     {   TRLT_SERVICELNAME_L10N,
         TRLT_IMPLNAME_PREFIX  "HIRAGANA_KATAKANA",
         &hiraganaToKatakana_CreateInstance },
@@ -359,6 +389,8 @@ static const struct InstancesArray {
     {   TRLT_SERVICELNAME_L10N,
         TRLT_IMPLNAME_PREFIX  "HALFWIDTH_FULLWIDTH",
         &halfwidthToFullwidth_CreateInstance },
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ja
     IMPL_TRANSLITERATION_ITEM (smallToLarge_ja_JP),
     IMPL_TRANSLITERATION_ITEM (largeToSmall_ja_JP),
     IMPL_TRANSLITERATION_ITEM (ignoreTraditionalKanji_ja_JP),
@@ -377,87 +409,135 @@ static const struct InstancesArray {
     IMPL_TRANSLITERATION_ITEM (ignoreProlongedSoundMark_ja_JP),
     IMPL_TRANSLITERATION_ITEM (ignoreMiddleDot_ja_JP),
     IMPL_TRANSLITERATION_ITEM (ignoreSpace_ja_JP),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_zh
     IMPL_TRANSLITERATION_ITEM (TextToPinyin_zh_CN),
     IMPL_TRANSLITERATION_ITEM (TextToChuyin_zh_TW),
+#endif
     IMPL_TRANSLITERATION_ITEM( ignoreDiacritics_CTL),
     IMPL_TRANSLITERATION_ITEM (ignoreKashida_CTL),
 
+#if WITH_LOCALE_ALL || WITH_LOCALE_zh
     IMPL_TRANSLITERATION_ITEM (NumToCharUpper_zh_CN),
     IMPL_TRANSLITERATION_ITEM (NumToCharLower_zh_CN),
     IMPL_TRANSLITERATION_ITEM (NumToCharUpper_zh_TW),
     IMPL_TRANSLITERATION_ITEM (NumToCharLower_zh_TW),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ja
     IMPL_TRANSLITERATION_ITEM (NumToCharHalfwidth),
     IMPL_TRANSLITERATION_ITEM (NumToCharFullwidth),
     IMPL_TRANSLITERATION_ITEM (NumToCharKanjiShort_ja_JP),
     IMPL_TRANSLITERATION_ITEM (NumToCharKanjiTraditional_ja_JP),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ko
     IMPL_TRANSLITERATION_ITEM (NumToCharLower_ko),
     IMPL_TRANSLITERATION_ITEM (NumToCharUpper_ko),
     IMPL_TRANSLITERATION_ITEM (NumToCharHangul_ko),
+#endif
     IMPL_TRANSLITERATION_ITEM (NumToCharIndic_ar),
     IMPL_TRANSLITERATION_ITEM (NumToCharEastIndic_ar),
+#if WITH_LOCALE_ALL || WITH_LOCALE_hi
     IMPL_TRANSLITERATION_ITEM (NumToCharIndic_hi),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_th
     IMPL_TRANSLITERATION_ITEM (NumToChar_th),
+#endif
 
+#if WITH_LOCALE_ALL || WITH_LOCALE_zh
     IMPL_TRANSLITERATION_ITEM (CharToNumUpper_zh_CN),
     IMPL_TRANSLITERATION_ITEM (CharToNumLower_zh_CN),
     IMPL_TRANSLITERATION_ITEM (CharToNumUpper_zh_TW),
     IMPL_TRANSLITERATION_ITEM (CharToNumLower_zh_TW),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ja
     IMPL_TRANSLITERATION_ITEM (CharToNumFullwidth),
     IMPL_TRANSLITERATION_ITEM (CharToNumKanjiShort_ja_JP),
     IMPL_TRANSLITERATION_ITEM (CharToNumKanjiTraditional_ja_JP),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ko
     IMPL_TRANSLITERATION_ITEM (CharToNumLower_ko),
     IMPL_TRANSLITERATION_ITEM (CharToNumUpper_ko),
     IMPL_TRANSLITERATION_ITEM (CharToNumHangul_ko),
+#endif
     IMPL_TRANSLITERATION_ITEM (CharToNumIndic_ar),
     IMPL_TRANSLITERATION_ITEM (CharToNumEastIndic_ar),
+#if WITH_LOCALE_ALL || WITH_LOCALE_hi
     IMPL_TRANSLITERATION_ITEM (CharToNumIndic_hi),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_th
     IMPL_TRANSLITERATION_ITEM (CharToNum_th),
+#endif
 
+#if WITH_LOCALE_ALL || WITH_LOCALE_zh
     IMPL_TRANSLITERATION_ITEM (NumToTextUpper_zh_CN),
     IMPL_TRANSLITERATION_ITEM (NumToTextLower_zh_CN),
     IMPL_TRANSLITERATION_ITEM (NumToTextUpper_zh_TW),
     IMPL_TRANSLITERATION_ITEM (NumToTextLower_zh_TW),
     IMPL_TRANSLITERATION_ITEM (NumToTextFullwidth_zh_CN),
     IMPL_TRANSLITERATION_ITEM (NumToTextFullwidth_zh_TW),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ja
     IMPL_TRANSLITERATION_ITEM (NumToTextFullwidth_ja_JP),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ko
     IMPL_TRANSLITERATION_ITEM (NumToTextFullwidth_ko),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ja
     IMPL_TRANSLITERATION_ITEM (NumToTextKanjiLongModern_ja_JP),
     IMPL_TRANSLITERATION_ITEM (NumToTextKanjiLongTraditional_ja_JP),
     IMPL_TRANSLITERATION_ITEM (NumToTextKanjiShortModern_ja_JP),
     IMPL_TRANSLITERATION_ITEM (NumToTextKanjiShortTraditional_ja_JP),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ko
     IMPL_TRANSLITERATION_ITEM (NumToTextInformalHangul_ko),
     IMPL_TRANSLITERATION_ITEM (NumToTextInformalLower_ko),
     IMPL_TRANSLITERATION_ITEM (NumToTextInformalUpper_ko),
     IMPL_TRANSLITERATION_ITEM (NumToTextFormalHangul_ko),
     IMPL_TRANSLITERATION_ITEM (NumToTextFormalLower_ko),
     IMPL_TRANSLITERATION_ITEM (NumToTextFormalUpper_ko),
+#endif
 
+#if WITH_LOCALE_ALL || WITH_LOCALE_zh
     IMPL_TRANSLITERATION_ITEM (TextToNumUpper_zh_CN),
     IMPL_TRANSLITERATION_ITEM (TextToNumLower_zh_CN),
     IMPL_TRANSLITERATION_ITEM (TextToNumUpper_zh_TW),
     IMPL_TRANSLITERATION_ITEM (TextToNumLower_zh_TW),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ja
     IMPL_TRANSLITERATION_ITEM (TextToNumKanjiLongModern_ja_JP),
     IMPL_TRANSLITERATION_ITEM (TextToNumKanjiLongTraditional_ja_JP),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ko
     IMPL_TRANSLITERATION_ITEM (TextToNumInformalHangul_ko),
     IMPL_TRANSLITERATION_ITEM (TextToNumInformalLower_ko),
     IMPL_TRANSLITERATION_ITEM (TextToNumInformalUpper_ko),
     IMPL_TRANSLITERATION_ITEM (TextToNumFormalHangul_ko),
     IMPL_TRANSLITERATION_ITEM (TextToNumFormalLower_ko),
     IMPL_TRANSLITERATION_ITEM (TextToNumFormalUpper_ko),
+#endif
 
+#if WITH_LOCALE_ALL || WITH_LOCALE_zh
     IMPL_TRANSLITERATION_ITEM (NumToTextDate_zh),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_ja
     IMPL_TRANSLITERATION_ITEM (NumToTextAIUFullWidth_ja_JP),
     IMPL_TRANSLITERATION_ITEM (NumToTextAIUHalfWidth_ja_JP),
     IMPL_TRANSLITERATION_ITEM (NumToTextIROHAFullWidth_ja_JP),
     IMPL_TRANSLITERATION_ITEM (NumToTextIROHAHalfWidth_ja_JP),
+#endif
     IMPL_TRANSLITERATION_ITEM (NumToTextCircledNumber),
+#if WITH_LOCALE_ALL || WITH_LOCALE_ko
     IMPL_TRANSLITERATION_ITEM (NumToTextHangulJamo_ko),
     IMPL_TRANSLITERATION_ITEM (NumToTextHangulSyllable_ko),
     IMPL_TRANSLITERATION_ITEM (NumToTextHangulCircledJamo_ko),
     IMPL_TRANSLITERATION_ITEM (NumToTextHangulCircledSyllable_ko),
+#endif
+#if WITH_LOCALE_ALL || WITH_LOCALE_zh
     IMPL_TRANSLITERATION_ITEM (NumToTextTianGan_zh),
     IMPL_TRANSLITERATION_ITEM (NumToTextDiZi_zh),
+#endif
 
+#if WITH_LOCALE_ALL || WITH_LOCALE_ja
     {   TRLT_SERVICELNAME_L10N,
         TRLT_IMPLNAME_PREFIX  "FULLWIDTHKATAKANA_HALFWIDTHKATAKANA",
         &fullwidthKatakanaToHalfwidthKatakana_CreateInstance },
@@ -470,6 +550,7 @@ static const struct InstancesArray {
     {   TRLT_SERVICELNAME_L10N,
         TRLT_IMPLNAME_PREFIX  "HALFWIDTH_FULLWIDTH_LIKE_JIS",
         &halfwidthToFullwidthLikeJIS_CreateInstance },
+#endif
 // add here new services !!
     { 0, 0, 0 }
 };


More information about the Libreoffice-commits mailing list