Kaydet (Commit) 2ef9d5de authored tarafından jan iversen's avatar jan iversen

genlang, update to satisfy clang.

changes due a log from clang tinderbox.

minor changes to interpret more files

Change-Id: I3821aab91dc21e74c870628a4f2265ab61d37cca
üst 3ada44f6
...@@ -63,7 +63,7 @@ class convert_gen ...@@ -63,7 +63,7 @@ class convert_gen
// utility functions for converters // utility functions for converters
void writeSourceFile(const string& line); void writeSourceFile(const string& line);
bool createDir(const string& sDir, const string& sFile); static bool createDir(const string& sDir, const string& sFile);
private: private:
ofstream mcOutputFile; ofstream mcOutputFile;
static bool checkAccess(string& sFile); static bool checkAccess(string& sFile);
......
...@@ -54,6 +54,7 @@ class convert_po : public convert_gen ...@@ -54,6 +54,7 @@ class convert_po : public convert_gen
const string& sText, const string& sText,
const string& sComment, const string& sComment,
const string& sResource, const string& sResource,
const string& sGroup,
bool bFuzzy); bool bFuzzy);
void endSave(); void endSave();
......
...@@ -52,6 +52,7 @@ class convert_src : public convert_gen ...@@ -52,6 +52,7 @@ class convert_src : public convert_gen
string msName; string msName;
string msTextName; string msTextName;
string msCmd; string msCmd;
string msGroup;
bool mbEnUs; bool mbEnUs;
bool mbExpectName; bool mbExpectName;
bool mbExpectMacro; bool mbExpectMacro;
...@@ -62,7 +63,7 @@ class convert_src : public convert_gen ...@@ -62,7 +63,7 @@ class convert_src : public convert_gen
int miListCount; int miListCount;
int miMacroLevel; int miMacroLevel;
void doExecute() override; void doExecute() override;
void trim(string& sText); static void trim(string& sText);
void buildKey(string& sKey); void buildKey(string& sKey);
void insertLanguagePart(string& sKey, string& sTextType); void insertLanguagePart(string& sKey, string& sTextType);
}; };
......
...@@ -57,6 +57,7 @@ class l10nMem ...@@ -57,6 +57,7 @@ class l10nMem
const string& sText, const string& sText,
const string& sComment, const string& sComment,
const string& sResource, const string& sResource,
const string& sGroup,
bool bIsFuzzy); bool bIsFuzzy);
void setSourceKey(int iLineNo, void setSourceKey(int iLineNo,
const string& sFilename, const string& sFilename,
...@@ -64,6 +65,7 @@ class l10nMem ...@@ -64,6 +65,7 @@ class l10nMem
const string& sText, const string& sText,
const string& sComment, const string& sComment,
const string& sResource, const string& sResource,
const string& sGroup,
bool bMustExist); bool bMustExist);
void saveTemplates(const string& sTargetDir, void saveTemplates(const string& sTargetDir,
...@@ -88,7 +90,6 @@ class l10nMem ...@@ -88,7 +90,6 @@ class l10nMem
int miCurFileInx; int miCurFileInx;
int miCurLangInx; int miCurLangInx;
int miCurENUSinx; int miCurENUSinx;
bool mbNeedWrite;
bool mbConvertMode; bool mbConvertMode;
bool mbStrictMode; bool mbStrictMode;
vector<l10nMem_enus_entry> mcENUSlist; vector<l10nMem_enus_entry> mcENUSlist;
...@@ -111,7 +112,8 @@ class l10nMem ...@@ -111,7 +112,8 @@ class l10nMem
const string& sKey, const string& sKey,
const string& sMsgId, const string& sMsgId,
const string& sComment, const string& sComment,
const string& sResource); const string& sResource,
const string& sGroup);
void loadLangKey(int iLineNo, void loadLangKey(int iLineNo,
const string& sSourceFile, const string& sSourceFile,
const string& sKey, const string& sKey,
...@@ -130,6 +132,7 @@ class l10nMem ...@@ -130,6 +132,7 @@ class l10nMem
const string& sMsgId, const string& sMsgId,
const string& sComment, const string& sComment,
const string& sResource, const string& sResource,
const string& sGroup,
l10nMem::ENTRY_STATE eStat); l10nMem::ENTRY_STATE eStat);
bool findFileName(const string& sSourceFile); bool findFileName(const string& sSourceFile);
}; };
......
...@@ -48,7 +48,7 @@ std::unique_ptr< Export > exporter; ...@@ -48,7 +48,7 @@ std::unique_ptr< Export > exporter;
} }
OString lcl_GetListTyp( const sal_uInt16 nTyp, const bool bUpperCamelCase ) static OString lcl_GetListTyp( const sal_uInt16 nTyp, const bool bUpperCamelCase )
{ {
OString sType; OString sType;
switch (nTyp) switch (nTyp)
...@@ -176,7 +176,7 @@ bool ResData::SetId( const OString& rId, sal_uInt16 nLevel ) ...@@ -176,7 +176,7 @@ bool ResData::SetId( const OString& rId, sal_uInt16 nLevel )
namespace namespace
{ {
sal_Int32 lcl_countOccurrences(const OString& text, char c) static sal_Int32 lcl_countOccurrences(const OString& text, char c)
{ {
sal_Int32 n = 0; sal_Int32 n = 0;
for (sal_Int32 i = 0;; ++i) { for (sal_Int32 i = 0;; ++i) {
......
...@@ -178,7 +178,7 @@ bool convert_gen::prepareFile() ...@@ -178,7 +178,7 @@ bool convert_gen::prepareFile()
if (mcOutputFile.is_open()) if (mcOutputFile.is_open())
return true; return true;
if (convert_gen::createDir(msTargetPath, msSourceFile)) { if (createDir(msTargetPath, msSourceFile)) {
mcOutputFile.open((msTargetPath+msSourceFile).c_str(), ios::binary); mcOutputFile.open((msTargetPath+msSourceFile).c_str(), ios::binary);
if (mcOutputFile.is_open()) if (mcOutputFile.is_open())
return true; return true;
......
...@@ -67,7 +67,7 @@ void convert_po::startLook() ...@@ -67,7 +67,7 @@ void convert_po::startLook()
// load in db // load in db
if (msId.size()) if (msId.size())
mcMemory.loadEntryKey(miLineNo, sFileName, sNewKey, msId, msStr, "", "", mbFuzzy); mcMemory.loadEntryKey(miLineNo, sFileName, sNewKey, msId, msStr, "", "", "", mbFuzzy);
// and prepare for new entry // and prepare for new entry
msKey.clear(); msKey.clear();
...@@ -178,9 +178,9 @@ void convert_po::startSave(const string& sName, ...@@ -178,9 +178,9 @@ void convert_po::startSave(const string& sName,
<< "msgstr \"\"" << endl << "msgstr \"\"" << endl
<< "\"Project-Id-Version: PACKAGE VERSION\\n\"" << endl << "\"Project-Id-Version: PACKAGE VERSION\\n\"" << endl
<< "\"Report-Msgid-Bugs-To: " << "\"Report-Msgid-Bugs-To: "
<< "https://bugs.libreoffice.org/enter_bug.cgi?" "https://bugs.libreoffice.org/enter_bug.cgi?"
<< "product=LibreOffice&bug_status=UNCONFIRMED" "product=LibreOffice&bug_status=UNCONFIRMED"
<< "&component=UI\\n\"" << endl "&component=UI\\n\"" << endl
<< "\"POT-Creation-Date: " << "\"POT-Creation-Date: "
<< std::put_time(&tm, "%Y-%m-%d %H:%M%z") << "\\n\"" << endl << std::put_time(&tm, "%Y-%m-%d %H:%M%z") << "\\n\"" << endl
<< "\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"" << endl << "\"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n\"" << endl
...@@ -201,6 +201,7 @@ void convert_po::save(const string& sFileName, ...@@ -201,6 +201,7 @@ void convert_po::save(const string& sFileName,
const string& sText, const string& sText,
const string& sComment, const string& sComment,
const string& sResource, const string& sResource,
const string& sGroup,
bool bFuzzy) bool bFuzzy)
{ {
string sName; string sName;
...@@ -211,14 +212,16 @@ void convert_po::save(const string& sFileName, ...@@ -211,14 +212,16 @@ void convert_po::save(const string& sFileName,
newPos = sFileName.find_last_of("/\\", sFileName.length()); newPos = sFileName.find_last_of("/\\", sFileName.length());
sName = sFileName.substr(newPos + 1, sFileName.length()); sName = sFileName.substr(newPos + 1, sFileName.length());
outFile << endl << "#. " << genKeyId(sName + sKey + sResource + sENUStext) << endl; outFile << endl << "#. " << genKeyId(sName + sKey + sGroup + sResource + sENUStext) << endl;
if (sComment.length()) if (sComment.length())
outFile << "#. " << sComment << endl; outFile << "#. " << sComment << endl;
outFile << "#: " << sName << endl outFile << "#: " << sName << endl
<< "msgctxt \"\"" << endl << "msgctxt \"\"" << endl
<< "\"" << sName << "\\n\"" << endl << "\"" << sName << "\\n\"" << endl
<< "\"" << sKey << "\\n\"" << endl << "\"" << sKey << "\\n\"" << endl;
<< "\"" << sResource << ".text\"" << endl; if (sGroup.length())
outFile << "\"" << sGroup << "\\n\"" << endl;
outFile << "\"" << sResource << ".text\"" << endl;
if (bFuzzy) if (bFuzzy)
outFile << "#, fuzzy" << endl; outFile << "#, fuzzy" << endl;
outFile << "msgid \"" << sENUStext << "\"" << endl outFile << "msgid \"" << sENUStext << "\"" << endl
......
...@@ -59,6 +59,8 @@ void convert_src::setValue(char *syyText, char *sbuildValue) ...@@ -59,6 +59,8 @@ void convert_src::setValue(char *syyText, char *sbuildValue)
setListItem("", false); setListItem("", false);
} }
msValue = sbuildValue; msValue = sbuildValue;
if (mbInListItem)
msGroup = msValue;
mbValuePresent = true; mbValuePresent = true;
mbExpectValue = false; mbExpectValue = false;
} }
...@@ -102,8 +104,12 @@ void convert_src::setName(char *syyText) ...@@ -102,8 +104,12 @@ void convert_src::setName(char *syyText)
trim(useText); trim(useText);
if (mbExpectName) { if (mbExpectName) {
mbExpectName = false; mbExpectName = false;
if (!mbAutoPush) if (!mbAutoPush) {
msName = useText; if (msName.length())
msGroup = useText;
else
msName = useText;
}
else { else {
mbAutoPush = false; mbAutoPush = false;
if (mcStack.size()) if (mcStack.size())
...@@ -145,6 +151,7 @@ void convert_src::setList(char *syyText) ...@@ -145,6 +151,7 @@ void convert_src::setList(char *syyText)
miListCount = 0; miListCount = 0;
mbInList = true; mbInList = true;
trim(msCmd); trim(msCmd);
l10nMem::keyToLower(msCmd);
} }
...@@ -158,7 +165,7 @@ void convert_src::setNL(char *syyText, bool bMacro) ...@@ -158,7 +165,7 @@ void convert_src::setNL(char *syyText, bool bMacro)
if (msTextName.size() && mbValuePresent && mbEnUs) { if (msTextName.size() && mbValuePresent && mbEnUs) {
// locate key and extract it // locate key and extract it
buildKey(x); buildKey(sKey);
for (nL = -1;;) { for (nL = -1;;) {
nL = msValue.find("\\\"", nL+1); nL = msValue.find("\\\"", nL+1);
...@@ -175,10 +182,11 @@ void convert_src::setNL(char *syyText, bool bMacro) ...@@ -175,10 +182,11 @@ void convert_src::setNL(char *syyText, bool bMacro)
//FIX sKey += "." + msCmd + "." + msTextName; //FIX sKey += "." + msCmd + "." + msTextName;
if (msValue.size() && msValue != "-") { if (msValue.size() && msValue != "-") {
mcMemory.setSourceKey(miLineNo, msSourceFile, sKey, msValue, "", msCmd, mbMergeMode); mcMemory.setSourceKey(miLineNo, msSourceFile, sKey, msValue, "", msCmd, msGroup, mbMergeMode);
if (mbMergeMode) if (mbMergeMode)
insertLanguagePart(sKey, msTextName); insertLanguagePart(sKey, msTextName);
} }
msGroup.clear();
} }
if (!bMacro && mbExpectMacro) { if (!bMacro && mbExpectMacro) {
...@@ -202,7 +210,6 @@ void convert_src::startBlock(char *syyText) ...@@ -202,7 +210,6 @@ void convert_src::startBlock(char *syyText)
copySource(syyText); copySource(syyText);
mcStack.push_back(msName); mcStack.push_back(msName);
msName.clear();
} }
...@@ -217,6 +224,7 @@ void convert_src::stopBlock(char *syyText) ...@@ -217,6 +224,7 @@ void convert_src::stopBlock(char *syyText)
mbInList = mbInList =
mbEnUs = false; mbEnUs = false;
msName.clear();
} }
...@@ -285,6 +293,9 @@ void convert_src::buildKey(string& sKey) ...@@ -285,6 +293,9 @@ void convert_src::buildKey(string& sKey)
for (nL = 0; nL < (int)mcStack.size(); ++nL) for (nL = 0; nL < (int)mcStack.size(); ++nL)
if (mcStack[nL].size()) if (mcStack[nL].size())
sKey += (sKey.size() ? "." : "") + mcStack[nL]; sKey += (sKey.size() ? "." : "") + mcStack[nL];
// FIX jan
sKey = mcStack[0];
} }
......
...@@ -67,7 +67,7 @@ void convert_tree::doExecute() ...@@ -67,7 +67,7 @@ void convert_tree::doExecute()
sFile = msTargetPath + sFile2; sFile = msTargetPath + sFile2;
mcOutputFiles[i].open(sFile.c_str(), ios::binary); mcOutputFiles[i].open(sFile.c_str(), ios::binary);
if (!mcOutputFiles[i].is_open()) { if (!mcOutputFiles[i].is_open()) {
if (!convert_gen::createDir(msTargetPath, sFile2)) if (!createDir(msTargetPath, sFile2))
throw l10nMem::showError("Cannot create missing directories (" + sFile + ") for writing"); throw l10nMem::showError("Cannot create missing directories (" + sFile + ") for writing");
mcOutputFiles[i].open(sFile.c_str(), ios::binary); mcOutputFiles[i].open(sFile.c_str(), ios::binary);
...@@ -105,7 +105,7 @@ void convert_tree::setString(char *yytext) ...@@ -105,7 +105,7 @@ void convert_tree::setString(char *yytext)
case STATE_VAL_TITLE: case STATE_VAL_TITLE:
string sText = copySourceSpecial(yytext, 1); string sText = copySourceSpecial(yytext, 1);
sText.erase(sText.size()-1); sText.erase(sText.size()-1);
mcMemory.setSourceKey(miLineNo, msSourceFile, msId, sText, "", "", mbMergeMode); mcMemory.setSourceKey(miLineNo, msSourceFile, msId, sText, "", "", "", mbMergeMode);
break; break;
} }
meStateVal = STATE_VAL_NONE; meStateVal = STATE_VAL_NONE;
...@@ -127,7 +127,7 @@ void convert_tree::setState(char *yytext, STATE_TAG eNewStateTag, STATE_VAL eNew ...@@ -127,7 +127,7 @@ void convert_tree::setState(char *yytext, STATE_TAG eNewStateTag, STATE_VAL eNew
void convert_tree::setValue(char *yytext) void convert_tree::setValue(char *yytext)
{ {
mcMemory.setSourceKey(miLineNo, msSourceFile, msId, msCollector, "", msModule, mbMergeMode); mcMemory.setSourceKey(miLineNo, msSourceFile, msId, msCollector, "", msModule, "", mbMergeMode);
copySourceSpecial(yytext, 2); copySourceSpecial(yytext, 2);
meStateTag = STATE_TAG_NONE; meStateTag = STATE_TAG_NONE;
......
...@@ -62,7 +62,7 @@ void convert_ulf::setValue(char *syyText) ...@@ -62,7 +62,7 @@ void convert_ulf::setValue(char *syyText)
nL = sText.rfind("\""); nL = sText.rfind("\"");
sText.erase(nL); sText.erase(nL);
mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, sText, "", "", mbMergeMode); mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, sText, "", "", "", mbMergeMode);
if (mbMergeMode) { if (mbMergeMode) {
// prepare to read all languages // prepare to read all languages
......
...@@ -123,6 +123,6 @@ void convert_xcs::stopCollectData(char *syyText) ...@@ -123,6 +123,6 @@ void convert_xcs::stopCollectData(char *syyText)
#endif #endif
} }
mcMemory.setSourceKey(miLineNo, msSourceFile, sKey, sText, "", "", mbMergeMode); mcMemory.setSourceKey(miLineNo, msSourceFile, sKey, sText, "", "", "", mbMergeMode);
mbCollectingData = false; mbCollectingData = false;
} }
...@@ -125,9 +125,9 @@ void convert_xcu::stopCollectData(char *syyText) ...@@ -125,9 +125,9 @@ void convert_xcu::stopCollectData(char *syyText)
if (useText.size()) { if (useText.size()) {
// locate key and extract it // locate key and extract it
for (nL = 0; nL < (int)mcStack.size(); ++nL) for (nL = 0; nL < (int)mcStack.size() -1; ++nL)
useKey += (useKey.size() ? "." : "" ) + mcStack[nL]; useKey += "." + mcStack[nL];
mcMemory.setSourceKey(miLineNo, msSourceFile, useKey, useText, "", "", mbMergeMode); mcMemory.setSourceKey(miLineNo, msSourceFile, useKey, useText, "", "value", mcStack[nL], mbMergeMode);
} }
if (mbMergeMode) { if (mbMergeMode) {
......
...@@ -67,7 +67,7 @@ void convert_xhp::doExecute() ...@@ -67,7 +67,7 @@ void convert_xhp::doExecute()
sFile = msTargetPath + sFile2; sFile = msTargetPath + sFile2;
mcOutputFiles[i].open(sFile.c_str(), ios::binary); mcOutputFiles[i].open(sFile.c_str(), ios::binary);
if (!mcOutputFiles[i].is_open()) { if (!mcOutputFiles[i].is_open()) {
if (!convert_gen::createDir(msTargetPath, sFile2)) if (!createDir(msTargetPath, sFile2))
throw l10nMem::showError("Cannot create missing directories (" + sFile + ") for writing"); throw l10nMem::showError("Cannot create missing directories (" + sFile + ") for writing");
mcOutputFiles[i].open(sFile.c_str(), ios::binary); mcOutputFiles[i].open(sFile.c_str(), ios::binary);
...@@ -251,7 +251,7 @@ void convert_xhp::closeTransTag(char *yytext) ...@@ -251,7 +251,7 @@ void convert_xhp::closeTransTag(char *yytext)
string newString(msCollector); string newString(msCollector);
if (newString[newString.length() - 1] == ' ') if (newString[newString.length() - 1] == ' ')
newString = newString.substr(0, newString.length() - 1); newString = newString.substr(0, newString.length() - 1);
mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, newString, "", "help", mbMergeMode); mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, newString, "", "help", "", mbMergeMode);
} }
msKey.clear(); msKey.clear();
iType = 2; iType = 2;
......
...@@ -116,7 +116,7 @@ void convert_xrm::stopCollectData(char *yytext) ...@@ -116,7 +116,7 @@ void convert_xrm::stopCollectData(char *yytext)
copySource(yytext); copySource(yytext);
if (!mbNoCollectingData) { if (!mbNoCollectingData) {
mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, sText, "", "readmeitem", mbMergeMode); mcMemory.setSourceKey(miLineNo, msSourceFile, msKey, sText, "", "readmeitem", "", mbMergeMode);
mbNoCollectingData = true; mbNoCollectingData = true;
if (mbMergeMode) { if (mbMergeMode) {
sTagEnd = "</" + msTag.substr(1,msTag.size()-2) + ">\n"; sTagEnd = "</" + msTag.substr(1,msTag.size()-2) + ">\n";
......
#!/bin/bash
cd workdir/jan
for i in `find . -name \*.pot`
do
echo ">>>>>>>> " $i
diff ../pot/$i $i | sed '/^6c6$/,/^16c16$/d'
done
...@@ -93,6 +93,7 @@ class l10nMem_enus_entry ...@@ -93,6 +93,7 @@ class l10nMem_enus_entry
const string& sMsgId, const string& sMsgId,
const string& sComment, const string& sComment,
const string& sResource, const string& sResource,
const string& sGroup,
int iLineNo, int iLineNo,
int iFileInx, int iFileInx,
int iLangSize, int iLangSize,
...@@ -100,6 +101,7 @@ class l10nMem_enus_entry ...@@ -100,6 +101,7 @@ class l10nMem_enus_entry
: msMsgId(sMsgId), : msMsgId(sMsgId),
msComment(sComment), msComment(sComment),
msResource(sResource), msResource(sResource),
msGroup(sGroup),
meState(eState), meState(eState),
miFileInx(iFileInx), miFileInx(iFileInx),
miLineNo(iLineNo) miLineNo(iLineNo)
...@@ -121,6 +123,7 @@ class l10nMem_enus_entry ...@@ -121,6 +123,7 @@ class l10nMem_enus_entry
string msMsgId; // en-US text from source file string msMsgId; // en-US text from source file
string msComment; // Comment (to be used in msgcstr) string msComment; // Comment (to be used in msgcstr)
string msResource; // Resource Id (to be used in msgcstr) string msResource; // Resource Id (to be used in msgcstr)
string msGroup; // Group Id (to be used in msgcstr)
l10nMem::ENTRY_STATE meState; // status information l10nMem::ENTRY_STATE meState; // status information
int miFileInx; // index of file name int miFileInx; // index of file name
int miLineNo; // line number int miLineNo; // line number
...@@ -136,7 +139,6 @@ l10nMem::l10nMem() ...@@ -136,7 +139,6 @@ l10nMem::l10nMem()
miCurFileInx(0), miCurFileInx(0),
miCurLangInx(0), miCurLangInx(0),
miCurENUSinx(0), miCurENUSinx(0),
mbNeedWrite(false),
mbConvertMode(false), mbConvertMode(false),
mbStrictMode(false) mbStrictMode(false)
{ {
...@@ -144,7 +146,7 @@ l10nMem::l10nMem() ...@@ -144,7 +146,7 @@ l10nMem::l10nMem()
msModuleName = "default"; msModuleName = "default";
mcFileList.push_back(l10nMem_file_entry("-genLang-", 0)); mcFileList.push_back(l10nMem_file_entry("-genLang-", 0));
mcLangList.push_back(l10nMem_lang_list_entry("-genLang-")); mcLangList.push_back(l10nMem_lang_list_entry("-genLang-"));
mcENUSlist.push_back(l10nMem_enus_entry("-genLang-", "-genLang-", "", "", 0, 0, 0, l10nMem::ENTRY_DELETED)); mcENUSlist.push_back(l10nMem_enus_entry("-genLang-", "-genLang-", "", "", "", 0, 0, 0, l10nMem::ENTRY_DELETED));
} }
...@@ -281,12 +283,13 @@ void l10nMem::loadEntryKey(int iLineNo, ...@@ -281,12 +283,13 @@ void l10nMem::loadEntryKey(int iLineNo,
const string& sMsgStr, const string& sMsgStr,
const string& sComment, const string& sComment,
const string& sResource, const string& sResource,
const string& sGroup,
bool bIsFuzzy) bool bIsFuzzy)
{ {
if (mbConvertMode) if (mbConvertMode)
convEntryKey(iLineNo, sSourceFile, sKey, sMsgId, sMsgStr, bIsFuzzy); convEntryKey(iLineNo, sSourceFile, sKey, sMsgId, sMsgStr, bIsFuzzy);
else if (!miCurLangInx) else if (!miCurLangInx)
loadENUSkey(iLineNo, sSourceFile, sKey, sMsgId, sComment, sResource); loadENUSkey(iLineNo, sSourceFile, sKey, sMsgId, sComment, sResource, sGroup);
else else
loadLangKey(iLineNo, sSourceFile, sKey, sMsgId, sMsgStr, bIsFuzzy); loadLangKey(iLineNo, sSourceFile, sKey, sMsgId, sMsgStr, bIsFuzzy);
} }
...@@ -299,6 +302,7 @@ void l10nMem::setSourceKey(int iLineNo, ...@@ -299,6 +302,7 @@ void l10nMem::setSourceKey(int iLineNo,
const string& sMsgId, const string& sMsgId,
const string& sComment, const string& sComment,
const string& sResource, const string& sResource,
const string& sGroup,
bool bMustExist) bool bMustExist)
{ {
string newText(sMsgId); string newText(sMsgId);
...@@ -330,7 +334,7 @@ void l10nMem::setSourceKey(int iLineNo, ...@@ -330,7 +334,7 @@ void l10nMem::setSourceKey(int iLineNo,
throw showError("key " + sKey + " does not exist"); throw showError("key " + sKey + " does not exist");
// add key, if changed text, this is wrong but handled in reorganize // add key, if changed text, this is wrong but handled in reorganize
addKey(iLineNo, sSourceFile, sKey, newText, sComment, sResource, ENTRY_ADDED); addKey(iLineNo, sSourceFile, sKey, newText, sComment, sResource, sGroup, ENTRY_ADDED);
} }
} }
...@@ -360,7 +364,7 @@ void l10nMem::saveTemplates(const string& sTargetDir, bool bForce) ...@@ -360,7 +364,7 @@ void l10nMem::saveTemplates(const string& sTargetDir, bool bForce)
if (cE.meState == ENTRY_DELETED) if (cE.meState == ENTRY_DELETED)
continue; continue;
savePo.save(mcFileList[cE.miFileInx].msFileName, cE.msKey, cE.msMsgId, "", cE.msComment, cE.msResource, false); savePo.save(mcFileList[cE.miFileInx].msFileName, cE.msKey, cE.msMsgId, "", cE.msComment, cE.msResource, cE.msGroup, false);
} }
savePo.endSave(); savePo.endSave();
} }
...@@ -607,7 +611,7 @@ bool l10nMem::convFilterWarning(const string& sSourceFile, ...@@ -607,7 +611,7 @@ bool l10nMem::convFilterWarning(const string& sSourceFile,
(sSourceFile == "registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu" && (sSourceFile == "registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu" &&
sKey == "ImpressWindowState.UIElements.States.private:resource/toolpanel/DrawingFramework/Layouts.UIName") || sKey == "ImpressWindowState.UIElements.States.private:resource/toolpanel/DrawingFramework/Layouts.UIName") ||
(sSourceFile == "registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu" && (sSourceFile == "registry/data/org/openoffice/Office/UI/ImpressWindowState.xcu" &&
sKey == "ImpressWindowState.UIElements.States.private:resource/toolpanel/DrawingFramework/TableDesign.UIName") || sKey == "ImpressWindowState.UIElements.States.private:resource/toolpanel/DrawingFramework/TableDesign.UIName") )
return true; return true;
} }
if (msModuleName == "readlicense_oo") { if (msModuleName == "readlicense_oo") {
...@@ -768,10 +772,11 @@ void l10nMem::loadENUSkey(int iLineNo, ...@@ -768,10 +772,11 @@ void l10nMem::loadENUSkey(int iLineNo,
const string& sKey, const string& sKey,
const string& sMsgId, const string& sMsgId,
const string& sComment, const string& sComment,
const string& sResource) const string& sResource,
const string& sGroup)
{ {
// add it to vector and update file pointer // add it to vector and update file pointer
addKey(iLineNo, sSourceFile, sKey, sMsgId, sComment, sResource, ENTRY_DELETED); addKey(iLineNo, sSourceFile, sKey, sMsgId, sComment, sResource, sGroup, ENTRY_DELETED);
} }
...@@ -898,6 +903,7 @@ void l10nMem::addKey(int iLineNo, ...@@ -898,6 +903,7 @@ void l10nMem::addKey(int iLineNo,
const string& sMsgId, const string& sMsgId,
const string& sComment, const string& sComment,
const string& sResource, const string& sResource,
const string& sGroup,
l10nMem::ENTRY_STATE eStat) l10nMem::ENTRY_STATE eStat)
{ {
// check file // check file
...@@ -910,7 +916,7 @@ void l10nMem::addKey(int iLineNo, ...@@ -910,7 +916,7 @@ void l10nMem::addKey(int iLineNo,
mcFileList.push_back(l10nMem_file_entry(sSourceFile, miCurENUSinx)); mcFileList.push_back(l10nMem_file_entry(sSourceFile, miCurENUSinx));
// and add entry at the back (no problem since it is a new file) // and add entry at the back (no problem since it is a new file)
mcENUSlist.push_back(l10nMem_enus_entry(sKey, sMsgId, sComment, sResource, iLineNo, miCurFileInx, mcENUSlist.push_back(l10nMem_enus_entry(sKey, sMsgId, sComment, sResource, sGroup, iLineNo, miCurFileInx,
mcLangList.size(), eStat)); mcLangList.size(), eStat));
mcFileList[miCurFileInx].miEnd = miCurENUSinx; mcFileList[miCurFileInx].miEnd = miCurENUSinx;
} }
...@@ -923,7 +929,7 @@ void l10nMem::addKey(int iLineNo, ...@@ -923,7 +929,7 @@ void l10nMem::addKey(int iLineNo,
curF.miEnd++; curF.miEnd++;
miCurENUSinx = curF.miEnd; miCurENUSinx = curF.miEnd;
mcENUSlist.insert(it + curF.miEnd, mcENUSlist.insert(it + curF.miEnd,
l10nMem_enus_entry(sKey, sMsgId, sComment, sResource, iLineNo, miCurFileInx, l10nMem_enus_entry(sKey, sMsgId, sComment, sResource, sGroup, iLineNo, miCurFileInx,
mcLangList.size(), eStat)); mcLangList.size(), eStat));
for (int i = miCurFileInx + 1; i < iFsize; ++i) { for (int i = miCurFileInx + 1; i < iFsize; ++i) {
l10nMem_file_entry& curF2 = mcFileList[i]; l10nMem_file_entry& curF2 = mcFileList[i];
......
...@@ -45,7 +45,7 @@ class handler ...@@ -45,7 +45,7 @@ class handler
vector<string> mvSourceFiles; vector<string> mvSourceFiles;
l10nMem mcMemory; l10nMem mcMemory;
void showManual(); static void showManual();
void loadL10MEM(bool onlyTemplates); void loadL10MEM(bool onlyTemplates);
void runConvert(); void runConvert();
void runExtract(); void runExtract();
...@@ -392,13 +392,13 @@ int main(int argc, char *argv[]) ...@@ -392,13 +392,13 @@ int main(int argc, char *argv[])
try { try {
cHandler.checkCommandLine(argc, argv); cHandler.checkCommandLine(argc, argv);
} }
catch(const char *pErr) { catch(const char *sErr) {
string myErr(pErr); string myErr(sErr);
cHandler.showUsage(myErr); handler::showUsage(myErr);
exit(-1); exit(-1);
} }
catch(const string& rErr) { catch(string sErr) {
cHandler.showUsage(rErr); handler::showUsage(sErr);
exit(-1); exit(-1);
} }
...@@ -406,13 +406,13 @@ int main(int argc, char *argv[]) ...@@ -406,13 +406,13 @@ int main(int argc, char *argv[])
try { try {
cHandler.run(); cHandler.run();
} }
catch(const char *pErr) { catch(const char *sErr) {
string myErr(pErr); string myErr(sErr);
cHandler.showRunTimeError(myErr); handler::showRunTimeError(myErr);
exit(-1); exit(-1);
} }
catch(const string& rErr) { catch(string sErr) {
cHandler.showRunTimeError(rErr); handler::showRunTimeError(sErr);
exit(-1); exit(-1);
} }
} }
#!/bin/bash
S=C:/Users/jani/opensource/libreoffice/lode/dev/work
I=$S/instdir
W=$S/workdir
PATH="C:\Users\jani\opensource\libreoffice\lode\dev\work\instdir\program;C:\Users\jani\opensource\libreoffice\lode\dev\work\instdir\program;$PATH"
./workdir/LinkTarget/Executable/xrmex.exe -i readlicense_oo/docs/readme.xrm -o workdir/jan2/docs
...@@ -33,7 +33,7 @@ OString getBracketedContent(const OString& text) { ...@@ -33,7 +33,7 @@ OString getBracketedContent(const OString& text) {
return text.getToken(1, '[').getToken(0, ']'); return text.getToken(1, '[').getToken(0, ']');
} }
void lcl_RemoveUTF8ByteOrderMarker( OString &rString ) static void lcl_RemoveUTF8ByteOrderMarker( OString &rString )
{ {
if( rString.getLength() >= 3 && rString[0] == '\xEF' && if( rString.getLength() >= 3 && rString[0] == '\xEF' &&
rString[1] == '\xBB' && rString[2] == '\xBF' ) rString[1] == '\xBB' && rString[2] == '\xBF' )
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
namespace namespace
{ {
OString lcl_NormalizeFilename(const OString& rFilename) static OString lcl_NormalizeFilename(const OString& rFilename)
{ {
return rFilename.copy( return rFilename.copy(
std::max( std::max(
...@@ -37,7 +37,7 @@ namespace ...@@ -37,7 +37,7 @@ namespace
rFilename.lastIndexOf( '/' ))+1); rFilename.lastIndexOf( '/' ))+1);
}; };
bool lcl_ReadPoChecked( static bool lcl_ReadPoChecked(
PoEntry& o_rPoEntry, PoIfstream& rPoFile, PoEntry& o_rPoEntry, PoIfstream& rPoFile,
const OString& rFileName) const OString& rFileName)
{ {
......
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
namespace namespace
{ {
// Convert a normal string to msg/po output string // Convert a normal string to msg/po output string
OString lcl_GenMsgString(const OString& rString) static OString lcl_GenMsgString(const OString& rString)
{ {
if ( rString.isEmpty() ) if ( rString.isEmpty() )
return "\"\""; return "\"\"";
...@@ -114,7 +114,7 @@ namespace ...@@ -114,7 +114,7 @@ namespace
} }
// Convert msg string to normal form // Convert msg string to normal form
OString lcl_GenNormString(const OString& rString) static OString lcl_GenNormString(const OString& rString)
{ {
return return
helper::unEscapeAll( helper::unEscapeAll(
...@@ -406,7 +406,7 @@ OString PoEntry::genKeyId(const OString& rGenerator) ...@@ -406,7 +406,7 @@ OString PoEntry::genKeyId(const OString& rGenerator)
namespace namespace
{ {
// Get actual time in "YEAR-MO-DA HO:MI+ZONE" form // Get actual time in "YEAR-MO-DA HO:MI+ZONE" form
OString lcl_GetTime() static OString lcl_GetTime()
{ {
time_t aNow = time(nullptr); time_t aNow = time(nullptr);
struct tm* pNow = localtime(&aNow); struct tm* pNow = localtime(&aNow);
...@@ -511,7 +511,7 @@ namespace ...@@ -511,7 +511,7 @@ namespace
{ {
// Check the validity of read entry // Check the validity of read entry
bool lcl_CheckInputEntry(const GenPoEntry& rEntry) static bool lcl_CheckInputEntry(const GenPoEntry& rEntry)
{ {
const OString sMsgCtxt = rEntry.getMsgCtxt(); const OString sMsgCtxt = rEntry.getMsgCtxt();
const sal_Int32 nFirstEndLine = sMsgCtxt.indexOf('\n'); const sal_Int32 nFirstEndLine = sMsgCtxt.indexOf('\n');
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
namespace namespace
{ {
// Extract strings from nodes on all level recursively // Extract strings from nodes on all level recursively
void lcl_ExtractLevel( static void lcl_ExtractLevel(
const xmlDocPtr pSource, const xmlNodePtr pRoot, const xmlDocPtr pSource, const xmlNodePtr pRoot,
const xmlChar* pNodeName, PoOfstream& rPOStream ) const xmlChar* pNodeName, PoOfstream& rPOStream )
{ {
...@@ -59,7 +59,7 @@ namespace ...@@ -59,7 +59,7 @@ namespace
} }
// Update id and content of the topic // Update id and content of the topic
xmlNodePtr lcl_UpdateTopic( static xmlNodePtr lcl_UpdateTopic(
const xmlNodePtr pCurrent, const OString& rXhpRoot ) const xmlNodePtr pCurrent, const OString& rXhpRoot )
{ {
xmlNodePtr pReturn = pCurrent; xmlNodePtr pReturn = pCurrent;
...@@ -139,7 +139,7 @@ namespace ...@@ -139,7 +139,7 @@ namespace
return pReturn; return pReturn;
} }
// Localize title attribute of help_section and node tags // Localize title attribute of help_section and node tags
void lcl_MergeLevel( static void lcl_MergeLevel(
xmlDocPtr io_pSource, const xmlNodePtr pRoot, xmlDocPtr io_pSource, const xmlNodePtr pRoot,
const xmlChar * pNodeName, MergeDataFile* pMergeDataFile, const xmlChar * pNodeName, MergeDataFile* pMergeDataFile,
const OString& rLang, const OString& rXhpRoot ) const OString& rLang, const OString& rXhpRoot )
......
...@@ -764,7 +764,7 @@ void XMLElement::Print(XMLNode *pCur, OStringBuffer& rBuffer, bool bRootelement ...@@ -764,7 +764,7 @@ void XMLElement::Print(XMLNode *pCur, OStringBuffer& rBuffer, bool bRootelement
namespace namespace
{ {
OUString lcl_pathnameToAbsoluteUrl(const OString& rPathname) static OUString lcl_pathnameToAbsoluteUrl(const OString& rPathname)
{ {
OUString sPath = OStringToOUString(rPathname, RTL_TEXTENCODING_UTF8 ); OUString sPath = OStringToOUString(rPathname, RTL_TEXTENCODING_UTF8 );
OUString sUrl; OUString sUrl;
...@@ -1034,7 +1034,7 @@ XMLFile *SimpleXMLParser::Execute( const OString &rFileName, XMLFile* pXMLFileIn ...@@ -1034,7 +1034,7 @@ XMLFile *SimpleXMLParser::Execute( const OString &rFileName, XMLFile* pXMLFileIn
namespace namespace
{ {
icu::UnicodeString lcl_QuotRange( static icu::UnicodeString lcl_QuotRange(
const icu::UnicodeString& rString, const sal_Int32 nStart, const icu::UnicodeString& rString, const sal_Int32 nStart,
const sal_Int32 nEnd, bool bInsideTag = false ) const sal_Int32 nEnd, bool bInsideTag = false )
{ {
...@@ -1072,7 +1072,7 @@ icu::UnicodeString lcl_QuotRange( ...@@ -1072,7 +1072,7 @@ icu::UnicodeString lcl_QuotRange(
return sReturn; return sReturn;
} }
bool lcl_isTag( const icu::UnicodeString& rString ) static bool lcl_isTag( const icu::UnicodeString& rString )
{ {
static const int nSize = 13; static const int nSize = 13;
static const icu::UnicodeString vTags[nSize] = { static const icu::UnicodeString vTags[nSize] = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment