You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ja...@apache.org on 2013/02/06 23:41:40 UTC
svn commit: r1443252 - in /openoffice/branches/l10n/main/l10ntools/source:
gConHrc.cxx gConHrc.hxx gConHrcWrap.cxx gConHrclex.l gConSrc.cxx
gConSrc.hxx gConSrcWrap.cxx gConSrclex.l gConXcu.cxx gConXcu.hxx
gConXcuWrap.cxx
Author: jani
Date: Wed Feb 6 22:41:39 2013
New Revision: 1443252
URL: http://svn.apache.org/viewvc?rev=1443252&view=rev
Log:
final conversion, ready for test
Modified:
openoffice/branches/l10n/main/l10ntools/source/gConHrc.cxx
openoffice/branches/l10n/main/l10ntools/source/gConHrc.hxx
openoffice/branches/l10n/main/l10ntools/source/gConHrcWrap.cxx
openoffice/branches/l10n/main/l10ntools/source/gConHrclex.l
openoffice/branches/l10n/main/l10ntools/source/gConSrc.cxx
openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx
openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx
openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l
openoffice/branches/l10n/main/l10ntools/source/gConXcu.cxx
openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx
openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx
Modified: openoffice/branches/l10n/main/l10ntools/source/gConHrc.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConHrc.cxx?rev=1443252&r1=1443251&r2=1443252&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConHrc.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConHrc.cxx Wed Feb 6 22:41:39 2013
@@ -49,9 +49,7 @@ void convert_hrc::insert() {mcpImpl->in
/********************** I M P L E M E N T A T I O N **********************/
convert_hrc_impl::convert_hrc_impl(const string& srSourceFile, l10nMem& crMemory)
- : convert_gen(srSourceFile, crMemory),
- mbCollectingData(false)
-
+ : convert_gen(srSourceFile, crMemory)
{
}
@@ -67,10 +65,10 @@ convert_hrc_impl::~convert_hrc_impl()
/********************** I M P L E M E N T A T I O N **********************/
void convert_hrc_impl::extract()
{
+ mbMergeMode = false;
+
// run lex parser and build token tree
runLex();
-
- //JIX
}
@@ -78,5 +76,8 @@ void convert_hrc_impl::extract()
/********************** I M P L E M E N T A T I O N **********************/
void convert_hrc_impl::insert()
{
- //JIX
+ mbMergeMode = true;
+
+ // run lex parser and build token tree
+ runLex();
}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConHrc.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConHrc.hxx?rev=1443252&r1=1443251&r2=1443252&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConHrc.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConHrc.hxx Wed Feb 6 22:41:39 2013
@@ -32,53 +32,27 @@
-/***************** T E M P L A T E D E F I N I T I O N *****************/
-#if 0
-template<typename T>
- void RemoveChars(std::basic_string<T> & Str, const T *CharsToRemove)
- {
- std::basic_string<T>::size_type pos = 0;
- while ( (pos = Str.find_first_of(CharsToRemove, pos)) != std::basic_string<T>::npos)
- Str.erase(pos, 1);
- }
-#endif
-
-
-
/******************** C L A S S D E F I N I T I O N ********************/
class convert_hrc_impl : public convert_gen
{
public:
- typedef enum
- {
- IGNORED = 400,
- COMMEND, DEFINEDRES, ANYTOKEN, UNKNOWNTOKEN, UNKNOWNCONSTRUCTION, UNKNOWNCHAR,
- FILTER_LEVEL = 500,
- CONDITION, EMPTYLINE, RESSOURCE, RESSOURCEEXPR, SMALRESSOURCE, TEXTLINE,
- LONGTEXTLINE, TEXT, LEVELUP, LEVELDOWN, APPFONTMAPPING, ASSIGNMENT,
- LISTASSIGNMENT, LISTTEXT, RSCDEFINE, RSCDEFINELEND, NEWTEXTINRES, UIENTRIES,
- PRAGMA, _LISTTEXT, TEXTREFID, LISTRESID, _LISTRESID, NORMDEFINE
- } LEX_TOKENS;
-
convert_hrc_impl(const string& srSourceFile, l10nMem& crMemory);
~convert_hrc_impl();
- void addTokenToSet(LEX_TOKENS nToken, string srYYtext);
- void addCommentToSet(LEX_TOKENS nToken, string srYYtext);
+ void setKey(string &sText);
+ void saveData(string& sText);
+ void copyData(string& sText);
private:
- class tokenStorageEntry
- {
- public:
- tokenStorageEntry(LEX_TOKENS nToken, string& sYYtext): mnToken(nToken), msYYtext(sYYtext){};
- LEX_TOKENS mnToken;
- string msYYtext;
- };
+ vector<string> mcStack;
+ string msCollector;
+ string msKey;
+
- void runLex();
void extract();
void insert();
- bool mbCollectingData;
+ void runLex();
+
friend class convert_hrc;
};
#endif
Modified: openoffice/branches/l10n/main/l10ntools/source/gConHrcWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConHrcWrap.cxx?rev=1443252&r1=1443251&r2=1443252&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConHrcWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConHrcWrap.cxx Wed Feb 6 22:41:39 2013
@@ -43,63 +43,77 @@ namespace HrcWrap
/********************** I M P L E M E N T A T I O N **********************/
-void convert_hrc_impl::addTokenToSet(LEX_TOKENS nToken, string srYYtext)
+void convert_hrc_impl::runLex()
{
-//JIX
-#if 0
- tokenStorage newToken;
+ HrcWrap::genHrc_lex();
+}
+
- newToken.mnToken = nToken;
- newToken.msYYtext = srYYtext;
- mcTokenSet.push_back(newToken);
-#endif
+/********************** I M P L E M E N T A T I O N **********************/
+void convert_hrc_impl::setKey(string &sText)
+{
+ int nL, nE;
+
+ // write text for merge
+ if (mbMergeMode)
+ writeSourceFile(msCollector + sText);
+ msCollector.clear();
+
+ // locate id
+ for (nL = 0; sText[nL] != ' ' && sText[nL] != '\t' && sText[nL] != '\n'; ++nL) ;
+ for (; sText[nL] == ' ' || sText[nL] == '\t'; ++nL) ;
+ for (nE = nL; sText[nE] != ' ' && sText[nE] != '\t' && sText[nE] != '\n'; ++nE) ;
+ msKey = sText.substr(nL, nE - nL);
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_hrc_impl::addCommentToSet(LEX_TOKENS nToken, string srYYtext)
+void convert_hrc_impl::saveData(string &sText)
{
- char buf[2];
- bool check_comment_terminate;
+ int nL, nE;
+ string sUseText;
+ // write text for merge
+ if (mbMergeMode)
+ writeSourceFile(msCollector + sText);
+ msCollector.clear();
+
+ // locate id
+ for (nL = 0; sText[nL] != '=' && sText[nL] != '\n'; ++nL) ;
+ for (; sText[nL] != '\"'; ++nL) ;
+ for (nE = nL+1; sText[nE] != '\"'; ++nE) ;
+ sUseText = sText.substr(nL+1, nE - nL -1);
- // loop and collect whole comment
- for (check_comment_terminate = false, buf[1] = '\0';;)
+ if (mbMergeMode)
{
- buf[0] = HrcWrap::yyinput();
-
- // end of file ?
- if (!buf[0])
- break;
+ // get all languages (includes en-US)
+ vector<l10nMem_entry *>& cExtraLangauges = mcMemory.getLanguagesForKey(msKey);
+ string sNewLine;
+ int nL = cExtraLangauges.size();
- // remember byte
- srYYtext.append(buf);
-
- // did we receive ยด*' ?
- if (check_comment_terminate)
+ for (int i = 0; i < nL; ++i)
{
- // end of comment ?
- if (buf[0] == '/')
- break;
-
- // it was not the end of comment
- check_comment_terminate = false;
+ sNewLine = "<value xml:lang=\"" + cExtraLangauges[i]->msLanguage + "\">" +
+ cExtraLangauges[i]->msText + "</value>";
+ writeSourceFile(sNewLine);
}
- else
- // Start on end of comment ?
- if (buf[0] == '*')
- check_comment_terminate = true;
}
-
- addTokenToSet(COMMEND, srYYtext);
+ else
+ mcMemory.setEnUsKey(msKey, sUseText);
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_hrc_impl::runLex()
+void convert_hrc_impl::copyData(string &sText)
{
- HrcWrap::genHrc_lex();
+ msCollector += sText;
+ if (sText == "\n")
+ {
+ if (mbMergeMode)
+ writeSourceFile(msCollector);
+ msCollector.clear();
+ }
}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConHrclex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConHrclex.l?rev=1443252&r1=1443251&r2=1443252&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConHrclex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConHrclex.l Wed Feb 6 22:41:39 2013
@@ -59,96 +59,29 @@
/******************* R U L E S D E F I N I T I O N S *******************/
%%
-^[\t ]*"#pragma".* {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::PRAGMA, string(yytext)); }
-
-^[ \t]*\n {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::EMPTYLINE, string(yytext)); }
-
-[\t ]+ |
-^[\t ]*"#include".* |
-^[\t ]*"#undef".* |
-"//".* |
-";" |
-"<" |
-">" |
-\n {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::IGNORED, string(yytext)); }
-
-"/*" {
- convert_hrc::mcpImpl->addCommentToSet(convert_hrc_impl::COMMEND, string(yytext)); }
-
-^[\t ]*"#ifndef".+$ |
-^[\t ]*"#ifdef".+$ |
-^[\t ]*"#if".+$ |
-^[\t ]*"#elif".+$ |
-^[\t ]*"#else".+$ |
-^[\t ]*"#endif".+$ {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::CONDITION, string(yytext)); }
-
-[a-zA-Z]+[\t ]+[^={\n]+[\t ] {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::DEFINEDRES, string(yytext)); /* defined Res */ }
-
-[a-zA-Z]+[ \t]+[^={;\n]+\n[ \t]*"#".*\n[ \t]*"{" |
-[a-zA-Z]+[ \t]+[^={;\n]+\n?([ \t]*"//".*\n)*[ \t]*"{" {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::RESSOURCE, string(yytext)); /* RESSOURCE // String TTT_XX ... */ }
-
-^[\t ]*[a-zA-Z_]+[\t ]*"\\"?[\t ]*\n?[ \t]*"{"[\t ]*"\\"? {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::SMALRESSOURCE, string(yytext)); /* SMALRESSOURCE // String ... */ }
-
-[\t ]*[a-zA-Z0-9_]+[ \t]*("["[ \t]*[a-zA-Z0-9_\-]+[ \t]*"]"[ \t]*)?=[ \t]*L?\".*\".*\n? {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::TEXTLINE, string(yytext)); /* TEXTLINE // TextTyp = "A Text" */ }
-
-[\t ]*[a-zA-Z0-9_]+[ \t]*("["[ \t]*[a-zA-Z0-9_\-]+[ \t]*"]"[ \t]*)?(\n[ \t]*)?=([ \t]*\n)?(([a-zA-Z0-9_]+)|(\".*\")|([ \t\n]*))*\".*\"(([a-zA-Z0-9_]+)|(\".*\")|([ \t\n]*))*; {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::LONGTEXTLINE, string(yytext)); /* LONGTEXTLINE // TextTyp = "A Text" HHH_XXX "A Text" ZZZ_TTT ... */ }
-
-\".*\" {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::TEXT, string(yytext)); /* TEXT // "A Text" */ }
-
-"{"[ \t]*\\? {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::LEVELUP, string(yytext)); /* LEVELUP */ }
-
-"}"[ \t]*;([ \t]*\\)? {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::LEVELDOWN, string(yytext)); /* LEVELDOWN */ }
-
-[a-zA-Z0-9_]+[ \t]*"="[ \t]*"MAP_APPFONT"[ \t]*"(".+")".* {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::APPFONTMAPPING, string(yytext)); /* APPFONTMAPPING Typ = MAP_APPFONT( ... ) */ }
-
-[ \t]*[a-zA-Z0-9_]+[ \t]*=[ \t]*[0123456789]{1,5}[ \t]*";"?\\? {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::TEXTREFID, string(yytext)); /* TEXTREFID // TextTyp = 12345 */ }
-
-[a-zA-Z0-9_]+[ \t]*"=".* |
-[a-zA-Z0-9_]+[ \t]*"="[\t ]*([ \t]*"//".*\n)*.* {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::ASSIGNMENT, string(yytext)); /* ASSIGNMENT Typ = ... */ }
-
-[a-zA-Z0-9_]+[ \t]*("["[ \t]*[a-zA-Z0-9_\-]+[ \t]*"]"[ \t]*)?"="[ \t]*(\\[ \t]*)?\n?[ \t]*"{"[ \t]*(\\[ \t]*)?\n?[ \t]*"<" {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::LISTASSIGNMENT, string(yytext)); /* LISTASSIGNMENT Typ [ ... ] = ... */ }
-
-"StringList"+[ \t]*("["[ \t]*[a-zA-Z0-9_\-]+[ \t]*"]"[ \t]*)?"="[ \t]*(\\[ \t]*)?\n?[ \t]*"{"[ \t]*(\\[ \t]*)?\n?[ \t]* {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::LISTASSIGNMENT, string(yytext)); /* LISTASSIGNMENT Typ [ ... ] = ... */ }
-
-"UIEntries"[ \t]*("["[ \t]*[a-zA-Z0-9_\-]+[ \t]*"]"[ \t]*)?"="[ \t]*(\\[ \t]*)?\n?[ \t]*"{" {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::UIENTRIES, string(yytext)); /* UIENTRIES */ }
-
-"<"?[ \t]*L?\".*\".*">" {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::LISTTEXT, string(yytext)); /* LISTTEXT */ }
-
-[ \t]*"#define"[ \t]+[a-zA-Z0-9_]+.*"\\" {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::RSCDEFINE, string(yytext)); /* RSCDEFINE #define ... */ }
-
-[ \t]*"#define"[ \t]+[a-zA-Z0-9_]+.+ {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::NORMDEFINE, string(yytext)); /* #define ... */ }
-
-"\\" {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::RSCDEFINELEND, string(yytext)); /* RSCDEFINELEND */ }
-
-[a-zA-Z0-9_]+[ \t]*; {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::ANYTOKEN, string(yytext)); /* allowed other tokens like "49 ;" or "SFX_... ;" */ }
-
-. {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::UNKNOWNCHAR, string(yytext)); /* YYWarning( "Unknown Char" ); */ }
-
-"{"?[ \t]*\".*\"[ \t]*";"[ \t]*"}" {
- convert_hrc::mcpImpl->addTokenToSet(convert_hrc_impl::_LISTTEXT, string(yytext)); /* _LISTTEXT */ }
+[fF][iI][xX][eE][dD][lL][iI][nN][eE][^\{]* {
+ string text(yytext);
+ convert_hrc::mcpImpl->setKey(text);
+}
+
+[rR][aA][dD][iI][oO][bB][uU][tT][tT][oO][nM][^\{]* {
+ string text(yytext);
+ convert_hrc::mcpImpl->setKey(text);
+}
+
+[cC][hH][eE][cC][kK][bB][oO][xX][^\{]* {
+ string text(yytext);
+ convert_hrc::mcpImpl->setKey(text);
+}
+
+[tT][eE][xX][tT][^\"]*"\""[^\"]*"\";" {
+ string text(yytext);
+ convert_hrc::mcpImpl->saveData(text);
+}
+
+.|\n {
+ string text(yytext);
+ convert_hrc::mcpImpl->copyData(text);
+}
%%
Modified: openoffice/branches/l10n/main/l10ntools/source/gConSrc.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConSrc.cxx?rev=1443252&r1=1443251&r2=1443252&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConSrc.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConSrc.cxx Wed Feb 6 22:41:39 2013
@@ -48,25 +48,8 @@ void convert_src::insert() {mcpImpl->in
/********************** I M P L E M E N T A T I O N **********************/
-src_stack_entry::src_stack_entry(string& sName)
- : msName (sName)
-{
-}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-src_stack_entry::~src_stack_entry()
-{
-}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
convert_src_impl::convert_src_impl(const string& srSourceFile, l10nMem& crMemory)
- : convert_gen(srSourceFile, crMemory),
- mbCollectingData(false)
-
+ : convert_gen(srSourceFile, crMemory)
{
}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx?rev=1443252&r1=1443251&r2=1443252&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx Wed Feb 6 22:41:39 2013
@@ -21,7 +21,7 @@
#ifndef GCONSRCHXX
#define GCONSRCHXX
#include "gLang.hxx"
-#include <stack>
+#include <vector>
@@ -34,19 +34,6 @@
/******************** C L A S S D E F I N I T I O N ********************/
-class src_stack_entry
-{
- public:
- src_stack_entry(string& sName);
- ~src_stack_entry();
-
- string msName;
-};
-
-
-
-
-/******************** C L A S S D E F I N I T I O N ********************/
class convert_src_impl : public convert_gen
{
public:
@@ -56,16 +43,14 @@ class convert_src_impl : public convert_
void pushKey(string &sText);
void popKey (string &sText);
void pushNoKey(string &sText);
- void registerPushKey(string &sText);
- void pushRegistredKey(string &sText);
+ void registerKey(string &sText);
- void saveData(string& sCollectedText);
- void copyData(string& sCollectedText);
+ void saveData(string& sText);
+ void copyData(string& sText);
private:
- stack<src_stack_entry> mcStack;
- bool mbCollectingData;
- string msCollector;
+ vector<string> mcStack;
+ string msCollector;
void extract();
void insert();
Modified: openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx?rev=1443252&r1=1443251&r2=1443252&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx Wed Feb 6 22:41:39 2013
@@ -53,10 +53,21 @@ void convert_src_impl::runLex()
/********************** I M P L E M E N T A T I O N **********************/
void convert_src_impl::pushKey(string &sText)
{
+ string sKey;
+ int nL, nE;
+
// write text for merge
if (mbMergeMode)
writeSourceFile(msCollector + sText);
msCollector.clear();
+
+ // locate id
+ for (nL = 0; sText[nL] != ' ' && sText[nL] != '\t' && sText[nL] != '\n'; ++nL) ;
+ for (; sText[nL] == ' ' || sText[nL] == '\t'; ++nL) ;
+ for (nE = nL; sText[nE] != ' ' && sText[nE] != '\t' && sText[nE] != '\n'; ++nE) ;
+ sKey = sText.substr(nL, nE - nL);
+
+ mcStack.push_back(sKey);
}
@@ -68,6 +79,10 @@ void convert_src_impl::popKey(string &sT
if (mbMergeMode)
writeSourceFile(msCollector + sText);
msCollector.clear();
+
+ // check for correct node/prop relations
+ if (mcStack.size())
+ mcStack.pop_back();
}
@@ -84,34 +99,63 @@ void convert_src_impl::pushNoKey(string
/********************** I M P L E M E N T A T I O N **********************/
-void convert_src_impl::registerPushKey(string &sText)
+void convert_src_impl::registerKey(string &sText)
{
+ string sKey;
+ int nL, nE;
+
// write text for merge
if (mbMergeMode)
writeSourceFile(msCollector + sText);
msCollector.clear();
+
+ // locate id
+ for (nL = 0; sText[nL] != '=' && sText[nL] != '\n'; ++nL) ;
+ for (++nL; sText[nL] == ' ' || sText[nL] == '\t'; ++nL) ;
+ for (nE = nL; sText[nE] != ' ' && sText[nE] != '\t' && sText[nE] != '\n' && nE < (int)sText.size(); ++nE) ;
+ sKey = sText.substr(nL, nE - nL);
+ mcStack.push_back(sKey);
}
/********************** I M P L E M E N T A T I O N **********************/
-void convert_src_impl::pushRegistredKey(string &sText)
+void convert_src_impl::saveData(string &sText)
{
+ int nL, nE;
+ string sKey, sUseText;
+
// write text for merge
if (mbMergeMode)
writeSourceFile(msCollector + sText);
msCollector.clear();
-}
+ // locate key and extract it
+ for (nL = 0; nL < (int)mcStack.size(); ++nL)
+ sKey += (nL > 0 ? "." : "") + mcStack[nL];
+ // locate id
+ for (nL = 0; sText[nL] != '=' && sText[nL] != '\n'; ++nL) ;
+ for (; sText[nL] != '\"'; ++nL) ;
+ for (nE = nL+1; sText[nE] != '\"'; ++nE) ;
+ sUseText = sText.substr(nL+1, nE - nL -1);
-/********************** I M P L E M E N T A T I O N **********************/
-void convert_src_impl::saveData(string &sText)
-{
- // write text for merge
if (mbMergeMode)
- writeSourceFile(msCollector + sText);
- msCollector.clear();
+ {
+ // get all languages (includes en-US)
+ vector<l10nMem_entry *>& cExtraLangauges = mcMemory.getLanguagesForKey(sKey);
+ string sNewLine;
+ int nL = cExtraLangauges.size();
+
+ for (int i = 0; i < nL; ++i)
+ {
+ sNewLine = "<value xml:lang=\"" + cExtraLangauges[i]->msLanguage + "\">" +
+ cExtraLangauges[i]->msText + "</value>";
+ writeSourceFile(sNewLine);
+ }
+ }
+ else
+ mcMemory.setEnUsKey(sKey, sUseText);
}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l?rev=1443252&r1=1443251&r2=1443252&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l Wed Feb 6 22:41:39 2013
@@ -59,47 +59,47 @@
/******************* R U L E S D E F I N I T I O N S *******************/
%%
-"TabDialog "[^\{]* {
+[tT][aA][bB][dD][iI][aA][lL][oO][gG][^\{]* {
string text(yytext);
convert_src::mcpImpl->pushKey(text);
}
-"TabControl "[^\{]* {
+[tT][aA][bB][cC][oO][nN][tT][rR][oO][lL][^\{]* {
string text(yytext);
convert_src::mcpImpl->pushKey(text);
}
-"TabPage "[^\{]* {
+[tT][aA][bB][pP][aA][gG][eE][^\{]* {
string text(yytext);
convert_src::mcpImpl->pushKey(text);
}
-"FixedText "[^\{]* {
+[fF][iI][xX][eE][dD][tT][eE][xX][tT][^\{]* {
string text(yytext);
convert_src::mcpImpl->pushKey(text);
}
-"String "[^\{]* {
+[sS][tT][rR][iI][nN][gG][^\{]* {
string text(yytext);
convert_src::mcpImpl->pushKey(text);
}
-"PageList "[^\{]* {
+[pP][aA][gG][eE][lL][iI][sS][tT][^\{]* {
string text(yytext);
convert_src::mcpImpl->pushNoKey(text);
}
-"PageItem "[^\{]* {
+[pP][aA][gG][eE][iI][tT][eE][mM][^\{]* {
string text(yytext);
- convert_src::mcpImpl->registerPushKey(text);
+ convert_src::mcpImpl->pushNoKey(text);
}
-"Identifier "[^;]* {
+[iI][dD][eE][nN][tT][iI][fF][iI][eE][rR][^;]* {
string text(yytext);
- convert_src::mcpImpl->pushRegistredKey(text);
+ convert_src::mcpImpl->registerKey(text);
}
-"Text "[^\"]*[^\"]*"\";" {
+[tT][eE][xX][tT][^\"]*"\""[^\"]*"\";" {
string text(yytext);
convert_src::mcpImpl->saveData(text);
}
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcu.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcu.cxx?rev=1443252&r1=1443251&r2=1443252&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcu.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcu.cxx Wed Feb 6 22:41:39 2013
@@ -47,22 +47,6 @@ void convert_xcu::insert() {mcpImpl->in
/********************** I M P L E M E N T A T I O N **********************/
-xcu_stack_entry::xcu_stack_entry(TAG_TYPE sIsNode, string& sName)
- : mbIsNode (sIsNode),
- msName (sName)
-{
-}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
-xcu_stack_entry::~xcu_stack_entry()
-{
-}
-
-
-
-/********************** I M P L E M E N T A T I O N **********************/
convert_xcu_impl::convert_xcu_impl(const string& srSourceFile, l10nMem& crMemory)
: convert_gen (srSourceFile, crMemory),
mbCollectingData(false)
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx?rev=1443252&r1=1443251&r2=1443252&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx Wed Feb 6 22:41:39 2013
@@ -21,7 +21,7 @@
#ifndef GCONXCU_HXX
#define GCONXCU_HXX
#include "gLang.hxx"
-#include <stack>
+#include <vector>
@@ -35,20 +35,6 @@ typedef enum {TAG_COMPONENT, TAG_PROP, T
/******************** C L A S S D E F I N I T I O N ********************/
-class xcu_stack_entry
-{
- public:
- xcu_stack_entry(TAG_TYPE sIsNode, string& sName);
- ~xcu_stack_entry();
-
- TAG_TYPE mbIsNode;
- string msName;
-};
-
-
-
-
-/******************** C L A S S D E F I N I T I O N ********************/
class xcu_stack_entry;
class convert_xcu_impl : public convert_gen
{
@@ -64,9 +50,9 @@ class convert_xcu_impl : public convert_
void collectData(string& sCollectedText);
private:
- stack<xcu_stack_entry> mcStack;
- bool mbCollectingData;
- string msCollector;
+ vector<string> mcStack;
+ bool mbCollectingData;
+ string msCollector;
void extract();
void insert();
Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx?rev=1443252&r1=1443251&r2=1443252&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx Wed Feb 6 22:41:39 2013
@@ -71,9 +71,7 @@ void convert_xcu_impl::pushKeyPart(TAG_T
return;
sKey = sTag.substr(nL, nE - nL);
- xcu_stack_entry newTag(bIsNode, sKey);
-
- mcStack.push(newTag);
+ mcStack.push_back(sKey);
}
@@ -88,7 +86,7 @@ void convert_xcu_impl::popKeyPart(TAG_TY
// check for correct node/prop relations
if (mcStack.size())
- mcStack.pop();
+ mcStack.pop_back();
}
@@ -108,6 +106,7 @@ void convert_xcu_impl::startCollectData(
/********************** I M P L E M E N T A T I O N **********************/
void convert_xcu_impl::stopCollectData(string& sCollectedText)
{
+ int nL;
string useKey;
// time to do something ?
@@ -116,12 +115,8 @@ void convert_xcu_impl::stopCollectData(s
mbCollectingData = false;
// locate key and extract it
- while (mcStack.size())
- {
- xcu_stack_entry nowEntry = mcStack.top();
- mcStack.pop();
- useKey = nowEntry.msName + "." + useKey;
- }
+ for (nL = 0; nL < (int)mcStack.size(); ++nL)
+ useKey += (nL > 0 ? "." : "") + mcStack[nL];
if (mbMergeMode)
{