Author: jani Date: Tue Oct 1 15:57:58 2013 New Revision: 1528126 URL: http://svn.apache.org/r1528126 Log: cfgex (.xcu files) replaced by genLang in build system. using module officecfg as primary test, corrected several small merge errors. -This line, and those below, will be ignored--
M main/solenv/inc/target.mk M main/solenv/inc/tg_config.mk M main/l10ntools/source/gLang.hxx M main/l10ntools/source/gConXhpWrap.cxx M main/l10ntools/source/gL10nMem.cxx M main/l10ntools/source/gL10nMem.hxx M main/l10ntools/source/gL10nMemDB.cxx M main/l10ntools/source/gConXcuWrap.cxx Modified: openoffice/branches/l10n40/main/l10ntools/source/gConXcuWrap.cxx openoffice/branches/l10n40/main/l10ntools/source/gConXhpWrap.cxx openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.cxx openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.hxx openoffice/branches/l10n40/main/l10ntools/source/gL10nMemDB.cxx openoffice/branches/l10n40/main/l10ntools/source/gLang.hxx openoffice/branches/l10n40/main/solenv/inc/target.mk openoffice/branches/l10n40/main/solenv/inc/tg_config.mk Modified: openoffice/branches/l10n40/main/l10ntools/source/gConXcuWrap.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gConXcuWrap.cxx?rev=1528126&r1=1528125&r2=1528126&view=diff ============================================================================== --- openoffice/branches/l10n40/main/l10ntools/source/gConXcuWrap.cxx (original) +++ openoffice/branches/l10n40/main/l10ntools/source/gConXcuWrap.cxx Tue Oct 1 15:57:58 2013 @@ -173,6 +173,7 @@ void convert_xcu::stopCollectData(char * for (; mcMemory.getMergeLang(sLang, sText);) { sNewLine = "\n<value xml:lang=\"" + sLang + "\">" + sText + "</value>"; + mcMemory.convertToInetString(sNewLine); writeSourceFile(sNewLine); } } @@ -183,22 +184,14 @@ void convert_xcu::stopCollectData(char * /********************** I M P L E M E N T A T I O N **********************/ void convert_xcu::copySpecial(char *syyText) { - int nX = msCollector.size(); + int nx = msCollector.size(); std::string sText = copySource(syyText, mbNoCollectingData); if (!mbNoCollectingData) { - msCollector.erase(nX); - if (sText == "&") - msCollector += "&"; - else if (sText == "'") - msCollector += "\'"; - else if (sText == ">") - msCollector += ">"; - else if (sText == "<") - msCollector += "<"; - else if (sText == """) - msCollector += "\""; + msCollector.erase(nx); + mcMemory.convertFromInetString(sText); + msCollector += sText; } } Modified: openoffice/branches/l10n40/main/l10ntools/source/gConXhpWrap.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gConXhpWrap.cxx?rev=1528126&r1=1528125&r2=1528126&view=diff ============================================================================== --- openoffice/branches/l10n40/main/l10ntools/source/gConXhpWrap.cxx (original) +++ openoffice/branches/l10n40/main/l10ntools/source/gConXhpWrap.cxx Tue Oct 1 15:57:58 2013 @@ -321,14 +321,7 @@ void convert_xhp::handleSpecial(char *yy if (meExpectValue != VALUE_IS_VALUE || meExpectValue != VALUE_IS_VALUE_TAG) { msCollector.erase(nX); - if (sText == "&") - msCollector += "&"; - else if (sText == "<") - msCollector += "<"; - else if (sText == ">") - msCollector += ">"; - else if (sText == """) - msCollector += "\""; + mcMemory.convertFromInetString(sText); } } Modified: openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.cxx?rev=1528126&r1=1528125&r2=1528126&view=diff ============================================================================== --- openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.cxx (original) +++ openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.cxx Tue Oct 1 15:57:58 2013 @@ -101,6 +101,10 @@ void l10nMem::saveLanguages(const std::s { l10nMem_impl::mcImpl->saveLanguages(*this, sT, bF); } void l10nMem::showNOconvert () { l10nMem_impl::mcImpl->showNOconvert(); } +void l10nMem::convertToInetString(std::string& sT) + { l10nMem_impl::mcImpl->convertToInetString(sT); } +void l10nMem::convertFromInetString(std::string& sT) + { l10nMem_impl::mcImpl->convertFromInetString(sT); } int l10nMem::prepareMerge() { return l10nMem_impl::mcImpl->mcDb.prepareMerge(); } @@ -682,3 +686,39 @@ void l10nMem_impl::convEntryKey(int mcDb.mcLangList[mcDb.miCurLangInx].mbChanged = true; } } + + + +/********************** I M P L E M E N T A T I O N **********************/ +void l10nMem_impl::convertToInetString(std::string& sText) +{ +static const char *replacingStr[] = {"&", "\'", ">", "<", "\"", NULL }; +static const int replacingLen[] = {1, 1, 1, 1, 1, 0 }; +static const char *newStr[] = {"&", "'", ">", "<", """, NULL }; +static const int newLen[] = {5, 6, 4, 4, 6, 0 }; + int i, pos; + + for (i = pos = 0; replacingStr[i]; i++) + while((pos = sText.find(replacingStr[i], pos)) != std::string::npos) { + sText.replace(pos, replacingLen[i], newStr[i]); + pos += newLen[i]; + } +} + + + +/********************** I M P L E M E N T A T I O N **********************/ +void l10nMem_impl::convertFromInetString(std::string& sText) +{ +static const char *replacingStr[] = {"&", "'", ">", "<", """, NULL }; +static const int replacingLen[] = {5, 6, 4, 4, 6, 0 }; +static const char *newStr[] = {"&", "\'", ">", "<", "\"", NULL }; +static const int newLen[] = {1, 1, 1, 1, 1, 0 }; + int i, pos; + + for (i = pos = 0; replacingStr[i]; i++) + while((pos = sText.find(replacingStr[i], pos)) != std::string::npos) { + sText.replace(pos, replacingLen[i], newStr[i]); + pos += newLen[i]; + } +} Modified: openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.hxx?rev=1528126&r1=1528125&r2=1528126&view=diff ============================================================================== --- openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.hxx (original) +++ openoffice/branches/l10n40/main/l10ntools/source/gL10nMem.hxx Tue Oct 1 15:57:58 2013 @@ -189,6 +189,9 @@ class l10nMem_impl void dumpMem (const std::string& sTargetDir); void showNOconvert(); + void convertToInetString(std::string& sText); + void convertFromInetString(std::string& sText); + private: static bool mbVerbose; static bool mbDebug; Modified: openoffice/branches/l10n40/main/l10ntools/source/gL10nMemDB.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gL10nMemDB.cxx?rev=1528126&r1=1528125&r2=1528126&view=diff ============================================================================== --- openoffice/branches/l10n40/main/l10ntools/source/gL10nMemDB.cxx (original) +++ openoffice/branches/l10n40/main/l10ntools/source/gL10nMemDB.cxx Tue Oct 1 15:57:58 2013 @@ -226,13 +226,14 @@ bool l10nMem_db::findFileName(const std: int iSize = mcFileList.size(); // Check this or next file - if (mcFileList[miCurFileInx].msFileName == sSourceFile) + if (mcFileList[miCurFileInx].msFileName == sSourceFile || mcFileList[miCurFileInx].msPureName == sSourceFile) return true; if (++miCurFileInx < iSize && mcFileList[miCurFileInx].msFileName == sSourceFile) return true; for (miCurFileInx = 1; - miCurFileInx < iSize && mcFileList[miCurFileInx].msFileName != sSourceFile; + miCurFileInx < iSize && mcFileList[miCurFileInx].msFileName != sSourceFile && + mcFileList[miCurFileInx].msPureName != sSourceFile; ++miCurFileInx) ; if (miCurFileInx == iSize) { @@ -335,14 +336,6 @@ bool l10nMem_db::locateKey(int if (!findFileName(sSourceFile)) return false; - // Fast check, to see if next key is the one (normal with load and source without change) - if (++miCurENUSinx < (int)mcENUSlist.size()) - { - l10nMem_enus_entry& nowEntry = mcENUSlist[miCurENUSinx]; - if (nowEntry.msMsgId == sMsgId && nowEntry.msKey == sKey) - return true; - } - // convert key to upper case for (i = 0; i < iSize; ++i) { @@ -353,6 +346,14 @@ bool l10nMem_db::locateKey(int sUpperKey[i] = toupper(sUpperKey[i]); } + // Fast check, to see if next key is the one (normal with load and source without change) + if (++miCurENUSinx < (int)mcENUSlist.size()) + { + l10nMem_enus_entry& nowEntry = mcENUSlist[miCurENUSinx]; + if (nowEntry.msMsgId == sMsgId && nowEntry.msKey == sUpperKey) + return true; + } + // Start from beginning of file and to end l10nMem_file_entry& cCur = mcFileList[miCurFileInx]; Modified: openoffice/branches/l10n40/main/l10ntools/source/gLang.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/l10ntools/source/gLang.hxx?rev=1528126&r1=1528125&r2=1528126&view=diff ============================================================================== --- openoffice/branches/l10n40/main/l10ntools/source/gLang.hxx (original) +++ openoffice/branches/l10n40/main/l10ntools/source/gLang.hxx Tue Oct 1 15:57:58 2013 @@ -95,6 +95,9 @@ class l10nMem bool getMergeLang (std::string& sLang, std::string& sText); void showNOconvert (); + + void convertToInetString(std::string& sText); + void convertFromInetString(std::string& sText); }; Modified: openoffice/branches/l10n40/main/solenv/inc/target.mk URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/solenv/inc/target.mk?rev=1528126&r1=1528125&r2=1528126&view=diff ============================================================================== --- openoffice/branches/l10n40/main/solenv/inc/target.mk (original) +++ openoffice/branches/l10n40/main/solenv/inc/target.mk Tue Oct 1 15:57:58 2013 @@ -2092,7 +2092,7 @@ some_unique_variable_name:=1 .IF "$(LANGUAGE_FILELIST)" != "" $(SRC_ROOT)/languages/source/templates/$(PRJNAME).pot: $(LANGUAGE_FILELIST) - -$(SOLARBINDIR)/genLang extract $(PRJNAME) $(SRC_ROOT)/languages/source "" -v -f $(LANGUAGE_FILELIST) + $(SOLARBINDIR)/genLang extract $(PRJNAME) $(SRC_ROOT)/languages/source "" -v -f $(LANGUAGE_FILELIST) genPO: $(SRC_ROOT)/languages/source/templates/$(PRJNAME).pot .ELSE Modified: openoffice/branches/l10n40/main/solenv/inc/tg_config.mk URL: http://svn.apache.org/viewvc/openoffice/branches/l10n40/main/solenv/inc/tg_config.mk?rev=1528126&r1=1528125&r2=1528126&view=diff ============================================================================== --- openoffice/branches/l10n40/main/solenv/inc/tg_config.mk (original) +++ openoffice/branches/l10n40/main/solenv/inc/tg_config.mk Tue Oct 1 15:57:58 2013 @@ -133,7 +133,9 @@ $(XCU_LANG) : $(LOCALIZESDF) $(PROCESSOUT)/merge/$(PACKAGEDIR)/%.xcu : %.xcu @-$(MKDIRHIER) $(@:d) - $(COMMAND_ECHO)$(CFGEX) -p $(PRJNAME) -i $(@:f) -o $@ -m $(LOCALIZESDF) -l all + $(SOLARBINDIR)/genLang merge $(PRJNAME) $(SRC_ROOT)/languages/source "$(WITH_LANG)" -t $(PROCESSOUT)/merge/$(PACKAGEDIR) -v -d -f $< + + .IF "$(XCU_LANG)" != "" $(XCU_LANG) : $(XSLDIR)/alllang.xsl