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/28 20:21:39 UTC

svn commit: r1451299 - /openoffice/branches/l10n/main/l10ntools/source/

Author: jani
Date: Thu Feb 28 19:21:39 2013
New Revision: 1451299

URL: http://svn.apache.org/r1451299
Log:
sw running

Modified:
    openoffice/branches/l10n/main/l10ntools/source/gCon.cxx
    openoffice/branches/l10n/main/l10ntools/source/gCon.hxx
    openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx
    openoffice/branches/l10n/main/l10ntools/source/gConPolex.l
    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/gConUlfWrap.cxx
    openoffice/branches/l10n/main/l10ntools/source/gConUlflex.l
    openoffice/branches/l10n/main/l10ntools/source/gConXcsWrap.cxx
    openoffice/branches/l10n/main/l10ntools/source/gConXcslex.l
    openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx
    openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx
    openoffice/branches/l10n/main/l10ntools/source/gConXculex.l
    openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx
    openoffice/branches/l10n/main/l10ntools/source/gConXhplex.l
    openoffice/branches/l10n/main/l10ntools/source/gConXrmWrap.cxx
    openoffice/branches/l10n/main/l10ntools/source/gConXrmlex.l
    openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx
    openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx
    openoffice/branches/l10n/main/l10ntools/source/gLang.hxx

Modified: openoffice/branches/l10n/main/l10ntools/source/gCon.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gCon.cxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gCon.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gCon.cxx Thu Feb 28 19:21:39 2013
@@ -101,17 +101,8 @@ void convert_gen::execute()
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-bool convert_gen::isError()
-{
-  return convert_gen_impl::mcImpl->mbInError; 
-}
-
-
-
-/**********************   I M P L E M E N T A T I O N   **********************/
 convert_gen_impl::convert_gen_impl(l10nMem& crMemory)
                                 : mcMemory(crMemory),
-                                  mbInError(false),
                                   miLineNo(1)
 {
 }
@@ -230,7 +221,5 @@ std::string& convert_gen_impl::copySourc
 /**********************   I M P L E M E N T A T I O N   **********************/
 std::string convert_gen_impl::showError(char *sText)
 {
-  mbInError = true;
-  std::cerr << "ERROR in " << msSourceFile << ":" << miLineNo << ":  " << sText << std::endl;
-  return "ERROR";
+  return mcMemory.showError(miLineNo, sText);
 }
\ No newline at end of file

Modified: openoffice/branches/l10n/main/l10ntools/source/gCon.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gCon.hxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gCon.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gCon.hxx Thu Feb 28 19:21:39 2013
@@ -66,7 +66,6 @@ class convert_gen_impl
 
   private:
     std::string  msSourceBuffer, msCopyText;
-    bool         mbInError;
     int          mnSourceReadIndex;
 
     void prepareFile();

Modified: openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConPoWrap.cxx Thu Feb 28 19:21:39 2013
@@ -52,7 +52,7 @@ namespace PoWrap
 /**********************   I M P L E M E N T A T I O N   **********************/
 void convert_po::execute()
 {
-  PoWrap::genpo_lex();
+  PoWrap::yylex();
 }
 
 
@@ -91,7 +91,7 @@ void convert_po::stopCollectData(char *s
     }
   }
   else
-    mcMemory.setEnUsKey(useKey, std::string("dummy"), sCollectedText);
+    mcMemory.setEnUsKey(miLineNo, useKey, std::string("dummy"), sCollectedText);
 
 //  mbCollectingData = false;
   msCollector.clear();

Modified: openoffice/branches/l10n/main/l10ntools/source/gConPolex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConPolex.l?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConPolex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConPolex.l Thu Feb 28 19:21:39 2013
@@ -49,7 +49,8 @@
 /* --- The following options are for future use (maybe)                      */
 /* yyclass=           --> subClass yyFlexLexer to allow own functions        */
 /* c++                --> generate C++ classes                               */
-%option 8bit noyywrap never-interactive prefix="genpo_"
+%option 8bit noyywrap never-interactive
+%array
 %p 24000
 %e 1200
 %n 500

Modified: openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConSrc.hxx Thu Feb 28 19:21:39 2013
@@ -49,7 +49,6 @@ class convert_src : public convert_gen_i
     void setMacro      (char *syyText);
     void setList       (char *syyText);
     void setListItem   (char *syyText, bool bIsStart);
-    void setStringList (char *syyText);
     void setNL         (char *syyText, bool bMacro);
     void startBlock    (char *syyText);
     void stopBlock     (char *syyText);
@@ -59,15 +58,18 @@ class convert_src : public convert_gen_i
     std::string              msValue;
     std::string              msName;
     std::string              msTextName;
-    std::string              msSaveTextName;
+    std::string              msCmd;
     bool                     mbEnUs;
     bool                     mbExpectName;
     bool                     mbExpectMacro;
-    bool                     mbExpectStringList;
     bool                     mbAutoPush;
     bool                     mbValuePresent;
+    bool                     mbInListItem;
+    bool                     mbInList;
     int                      miListCount;
     int                      miMacroLevel;
     void execute();
+    void trim(std::string& sText);
+    void buildKey(std::string& sKey);
 };
 #endif
\ No newline at end of file

Modified: openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConSrcWrap.cxx Thu Feb 28 19:21:39 2013
@@ -40,10 +40,11 @@ convert_src::convert_src(l10nMem& crMemo
                           mbEnUs(false),
                           mbExpectName(false),
                           mbExpectMacro(false),
-                          mbExpectStringList(false),
                           mbExpectValue(false),
                           mbAutoPush(false),
-                          mbValuePresent(false)
+                          mbValuePresent(false),
+                          mbInList(false),
+                          mbInListItem(false)
 {}
 convert_src::~convert_src()
 {}
@@ -71,20 +72,13 @@ void convert_src::execute()
 /**********************   I M P L E M E N T A T I O N   **********************/
 void convert_src::setValue(char *syyText, char *sbuildValue)
 {
-  if (mbExpectStringList)
-  {
-    std::stringstream ssBuf;
+  copySource(syyText);
 
-    msTextName   = msSaveTextName;
-    mbEnUs       = 
-    mbExpectName = true;
-    ssBuf        << ++miListCount;
-    msName       = ssBuf.str();
-    mcStack.pop_back();
-    mcStack.push_back(msName);
+  if (mbInList && !mbInListItem)
+  {
+    setListItem("", true);
+    setListItem("", false);
   }
-
-  copySource(syyText);
   msValue        = sbuildValue;
   mbValuePresent = true;
   mbExpectValue  = false;
@@ -120,6 +114,7 @@ void convert_src::setText(char *syyText)
   msTextName    = copySource(syyText);
   mbExpectValue = true;
   mbEnUs        = false;
+  trim(msTextName);
 }
 
 
@@ -129,6 +124,7 @@ void convert_src::setName(char *syyText)
 {
   std::string useText = copySource(syyText);
 
+  trim(useText);
   if (mbExpectName)
   {
     mbExpectName = false;
@@ -149,8 +145,10 @@ void convert_src::setName(char *syyText)
 /**********************   I M P L E M E N T A T I O N   **********************/
 void convert_src::setCmd(char *syyText)
 {
-  copySource(syyText);
+  msCmd        = copySource(syyText);
   mbExpectName = true;
+  mbInList     = false;
+  trim(msCmd);
 }
 
 
@@ -158,12 +156,13 @@ void convert_src::setCmd(char *syyText)
 /**********************   I M P L E M E N T A T I O N   **********************/
 void convert_src::setMacro(char *syyText)
 {
-  copySource(syyText);
+  msCmd         = copySource(syyText);
   mbExpectName  =
   mbExpectMacro =
   mbAutoPush    = true;
   miMacroLevel  = mcStack.size();
   mcStack.push_back("");
+  trim(msCmd);
 }
 
 
@@ -171,19 +170,10 @@ void convert_src::setMacro(char *syyText
 /**********************   I M P L E M E N T A T I O N   **********************/
 void convert_src::setList(char *syyText)
 {
-  msSaveTextName = msTextName  = copySource(syyText);
-  miListCount    = 0;
-}
-
-
-
-/**********************   I M P L E M E N T A T I O N   **********************/
-void convert_src::setStringList(char *syyText)
-{
-  msSaveTextName = msTextName  = copySource(syyText);
-  mbExpectStringList = true;
-
-  miListCount        = 0;
+  msCmd       = copySource(syyText);
+  miListCount = 0;
+  mbInList    = true;
+  trim(msCmd);
 }
 
 
@@ -192,18 +182,14 @@ void convert_src::setStringList(char *sy
 void convert_src::setNL(char *syyText, bool bMacro)
 {
   int         nL;
-  std::string sKey;
-
+  std::string sKey, sObject;
 
   copySource(syyText);
 
   if (msTextName.size() && mbValuePresent && mbEnUs)
   {
     // locate key and extract it
-    sKey.clear();
-    for (nL = 0; nL < (int)mcStack.size(); ++nL)
-      if (mcStack[nL].size())
-        sKey += (sKey.size() ? "." : "") + mcStack[nL];
+    buildKey(sKey);
 
     for (nL = -1;;)
     {
@@ -220,7 +206,9 @@ void convert_src::setNL(char *syyText, b
       msValue.erase(nL,1);
     }
 
-    mcMemory.setEnUsKey(sKey, msTextName, msValue);
+    sObject = msCmd + "." + msTextName;
+    if (msValue.size() && msValue != "-")
+      mcMemory.setEnUsKey(miLineNo, sKey, sObject, msValue);
   }
 
   if (!bMacro && mbExpectMacro)
@@ -259,8 +247,9 @@ void convert_src::stopBlock(char *syyTex
   // check for correct node/prop relations
   if (mcStack.size())
     mcStack.pop_back();
-  mbExpectStringList = false;
-  mbEnUs             = false;
+
+  mbInList =
+  mbEnUs   = false;
 }
 
 
@@ -269,25 +258,80 @@ void convert_src::stopBlock(char *syyTex
 void convert_src::setListItem(char *syyText, bool bIsStart)
 {
   copySource(syyText);
-  mbExpectStringList = false;
 
   if (bIsStart)
   {
-    msTextName   = msSaveTextName;
+    if (!miListCount)
+    {
+      mcStack.pop_back();
+      msName = "dummy";
+      mcStack.push_back(msName);
+    }
+    msTextName         = "item";
     mbExpectValue = 
-    mbExpectName  = true;
+    mbExpectName  = 
+    mbInListItem  = true;
     msName.clear();
   }
   else
   {
-    std::stringstream ssBuf;
+    if (mbInListItem)
+    {
+      std::stringstream ssBuf;
+      std::string       myKey;
 
-    mbExpectName = false;
-    mcStack.pop_back();
-    ssBuf << ++miListCount;
-//    if (msName.size())
-//      ssBuf << "." << msName;
-    msName = ssBuf.str();
-    mcStack.push_back(msName);
+
+      ++miListCount;
+      mcStack.pop_back();
+      if (mbExpectName)
+      {
+        std::stringstream ssBuf;
+
+        ssBuf  << miListCount;
+        msName  = "item" + ssBuf.str();
+      }
+      mcStack.push_back(msName);
+      mbInListItem =
+      mbExpectName = false;
+
+      // check key or add seq.
+      buildKey(myKey);
+      if (!mcMemory.checkKey(myKey, (msCmd + "." + msTextName)))
+      {
+        ssBuf  << miListCount;
+        msName  += ".uniq" + ssBuf.str();
+        mcStack.pop_back();
+        mcStack.push_back(msName);
+      }
+    }
   }
 }
+
+
+
+/**********************   I M P L E M E N T A T I O N   **********************/
+void convert_src::trim(std::string& sText)
+{
+  int nL;
+
+
+  while (sText[0] == ' ' || sText[0] == '\t')
+    sText.erase(0,1);
+  for (nL = sText.size(); sText[nL-1] == ' ' || sText[nL-1] == '\t'; --nL);
+  if (nL != (int)sText.size())
+    sText.erase(nL);
+}
+
+
+
+/**********************   I M P L E M E N T A T I O N   **********************/
+void convert_src::buildKey(std::string& sKey)
+{
+  int nL;
+
+
+  sKey.clear();
+  for (nL = 0; nL < (int)mcStack.size(); ++nL)
+    if (mcStack[nL].size())
+      sKey += (sKey.size() ? "." : "") + mcStack[nL];
+}

Modified: openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConSrclex.l Thu Feb 28 19:21:39 2013
@@ -36,7 +36,7 @@
 #define YYLMAX 64000
 
 /* change reader function (input) to our own version */
-#define YY_INPUT(buf,result,max_size) { IMPLptr->lexRead(buf, &result, max_size); }
+#define YY_INPUT(buf,result,max_size) {IMPLptr->lexRead(buf, &result, max_size);}
 %}
 
 
@@ -59,10 +59,10 @@
 /***********************   H E L P E R   M A C R O S   ***********************/
 %x CMD
 PRE   ^[ \t]*
-SUF   [ \t\r\n]
+SUF   [ \t\r\n\\]
 SUFT  [ \t\r\n\[]
 SPACE [ \t]*
-IDENT ([a-zA-Z0-9_][ a-zA-Z0-9_\-\+\*(,&]*[a-zA-Z0-9)]|[a-zA-Z0-9_])
+IDENT ([(a-zA-Z0-9_][ a-zA-Z0-9_\-\+\*(,&]*[a-zA-Z0-9)_]|[a-zA-Z0-9_])
 KEYID [a-zA-Z0-9_-]+
 
 /*******************   R U L E S   D E F I N I T I O N S   *******************/
@@ -74,17 +74,18 @@ KEYID [a-zA-Z0-9_-]+
   int i = 1;
   for (;;)
   {
-    while ((yytext[++i] = yyinput()) != '*') ;
-    if ((yytext[++i] = yyinput()) == '/')
-    break;
+    while (yytext[i] != '*')
+      yytext[++i] = yyinput();
+    yytext[++i] = yyinput();
+    if (yytext[i] == '/')
+      break;
   }
-  yytext[i] = '\0';
+  yytext[i+1] = '\0';
 
   IMPLptr->copySource(yytext);
 }
 
 
-
 "//".* {
   IMPLptr->copySource(yytext);
 }
@@ -179,6 +180,7 @@ KEYID [a-zA-Z0-9_-]+
 {PRE}[fF][iI][xX][eE][dD][tT][eE][xX][tT]{SUF}                                     |
 {PRE}[fF][iI][xX][eE][dD][lL][iI][nN][eE]{SUF}                                     |
 {PRE}[fF][lL][oO][aA][tT][iI][nN][gG][wW][iI][nN][dD][oO][wW]{SUF}                 |
+{PRE}[gG][rR][oO][uU][pP][bB][oO][xX]{SUF}                                         |
 {PRE}[hH][eE][lL][pP][bB][uU][tT][tT][oO][nN]{SUF}                                 |
 {PRE}[iI][dD][lL][iI][sS][tT]{SUF}                                                 |
 {PRE}[iI][mM][aA][gG][eE]{SUF}                                                     |
@@ -190,9 +192,11 @@ KEYID [a-zA-Z0-9_-]+
 {PRE}[mM][eE][nN][uU]{SUF}                                                         |
 {PRE}[mM][eE][nN][uU][bB][uU][tT][tT][oO][nN]{SUF}                                 |
 {PRE}[mM][eE][nN][uU][iI][tT][eE][mM]{SUF}                                         |
+{PRE}[mM][eE][sS][sS][bB][oO][xX]{SUF}                                             |
 {PRE}[mM][eE][tT][rR][iI][cC][fF][iI][eE][lL][dD]{SUF}                             |
 {PRE}[mM][oO][dD][aA][lL][dD][iI][aA][lL][oO][gG]{SUF}                             |
 {PRE}[mM][oO][dD][eE][lL][eE][sS][sS][dD][iI][aA][lL][oO][gG]{SUF}                 |
+{PRE}[mM][oO][rR][eE][bB][uU][tT][tT][oO][nN]{SUF}                                 |
 {PRE}[mM][uU][lL][tT][iI][lL][iI][nN][eE][eE][dD][iI][tT]{SUF}                     |
 {PRE}[nN][uU][mM][eE][rR][iI][cC][fF][iI][eE][lL][dD]{SUF}                         |
 {PRE}[oO][kK][bB][uU][tT][tT][oO][nN]{SUF}                                         |
@@ -210,6 +214,7 @@ KEYID [a-zA-Z0-9_-]+
 {PRE}[tT][aA][bB][cC][oO][nN][tT][rR][oO][lL]{SUF}                                 |
 {PRE}[tT][aA][bB][dD][iI][aA][lL][oO][gG]{SUF}                                     |
 {PRE}[tT][aA][bB][pP][aA][gG][eE]{SUF}                                             |
+{PRE}[tT][iI][mM][eE][fF][iI][eE][lL][dD]{SUF}                                     |
 {PRE}[tT][oO][oO][lL][bB][oO][xX]{SUF}                                             |
 {PRE}[tT][oO][oO][lL][bB][oO][xX][iI][tT][eE][mM]{SUF}                             |
 {PRE}[tT][rR][iI][sS][tT][aA][tT][eE][bB][oO][xX]{SUF}                             |
@@ -230,20 +235,11 @@ KEYID [a-zA-Z0-9_-]+
   IMPLptr->copySource(yytext);
 }
 
-<CMD>"{" {
-  LOCptr->startBlock(yytext);
+<CMD>.|\n|\r {
+  yyless(0);
   BEGIN(INITIAL);
 }
 
-<CMD>[\\\r\n/] {
-  yyless(1);
-  BEGIN(INITIAL);
-}
-
-<CMD>. {
-  IMPLptr->showError("gCon encountered a translation problem in .src module");
-}
-
 
 
 {PRE}[hH][eE][lL][pP][iI][dD]{SUF} {
@@ -253,7 +249,8 @@ KEYID [a-zA-Z0-9_-]+
 
 
 
-{PRE}[iI][dD][eE][nN][tT][iI][fF][iI][eE][rR]{SUF} {
+{PRE}[sS][tT][yY][lL][eE][fF][aA][mM][iI][lL][yY]{SUF}  |
+{PRE}[iI][dD][eE][nN][tT][iI][fF][iI][eE][rR]{SUF}      {
   yyless(strlen(yytext)-1);
   LOCptr->setId(yytext, true);
 }
@@ -261,6 +258,7 @@ KEYID [a-zA-Z0-9_-]+
 
 
 {PRE}[cC][uU][sS][tT][oO][mM][uU][nN][iI][tT][tT][eE][xX][tT]{SUFT} |
+{PRE}[hH][eE][lL][pP][tT][eE][xX][tT]{SUFT}                         |
 {PRE}[mM][eE][sS][sS][aA][gG][eE]{SUFT}                             |
 {PRE}[qQ][uU][iI][cC][kK][hH][eE][lL][pP][tT][eE][xX][tT]{SUFT}     |
 {PRE}[tT][eE][xX][tT]{SUFT}                                         |
@@ -271,6 +269,7 @@ KEYID [a-zA-Z0-9_-]+
 
 
 
+{PRE}[fF][iI][lL][tT][eE][rR][lL][iI][sS][tT]{SUFT}                     |
 {PRE}[iI][tT][eE][mM][lL][iI][sS][tT]{SUFT}                             |
 {PRE}[sS][tT][yY][lL][eE][fF][aA][mM][iI][lL][yY][lL][iI][sS][tT]{SUF}  {
   yyless(strlen(yytext)-1);
@@ -279,9 +278,10 @@ KEYID [a-zA-Z0-9_-]+
 
 
 
+{PRE}[pP][aA][iI][rR][eE][dD][lL][iI][sS][tT]{SUFT}  |
 {PRE}[sS][tT][rR][iI][nN][gG][lL][iI][sS][tT]{SUFT}  {
   yyless(strlen(yytext)-1);
-  LOCptr->setStringList(yytext);
+  LOCptr->setList(yytext);
 }
 
 

Modified: openoffice/branches/l10n/main/l10ntools/source/gConUlfWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConUlfWrap.cxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConUlfWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConUlfWrap.cxx Thu Feb 28 19:21:39 2013
@@ -89,5 +89,5 @@ void convert_ulf::setValue(char *syyText
   nL = sText.rfind("\"");
   sText.erase(nL);
 
-  mcMemory.setEnUsKey(msKey, std::string("LngText"), sText);
+  mcMemory.setEnUsKey(miLineNo, msKey, std::string("LngText"), sText);
 }

Modified: openoffice/branches/l10n/main/l10ntools/source/gConUlflex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConUlflex.l?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConUlflex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConUlflex.l Thu Feb 28 19:21:39 2013
@@ -50,6 +50,7 @@
 /* yyclass=           --> subClass yyFlexLexer to allow own functions        */
 /* c++                --> generate C++ classes                               */
 %option 8bit noyywrap never-interactive
+%array
 %p 24000
 %e 1200
 %n 500
@@ -70,11 +71,13 @@ KEYID [a-zA-Z0-9_-]+
   int i = 1;
   for (;;)
   {
-    while ((yytext[++i] = yyinput()) != '*') ;
-    if ((yytext[++i] = yyinput()) == '/')
-    break;
+    while (yytext[i] != '*')
+      yytext[++i] = yyinput();
+    yytext[++i] = yyinput();
+    if (yytext[i] == '/')
+      break;
   }
-  yytext[i] = '\0';
+  yytext[i+1] = '\0';
 
   IMPLptr->copySource(yytext);
 }

Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcsWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcsWrap.cxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcsWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcsWrap.cxx Thu Feb 28 19:21:39 2013
@@ -152,7 +152,7 @@ void convert_xcs::stopCollectData(char *
     }
   }
   else
-    mcMemory.setEnUsKey(sKey, std::string("dummy"), sText);
+    mcMemory.setEnUsKey(miLineNo, sKey, std::string("dummy"), sText);
 
   mbCollectingData = false;
 }  

Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcslex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcslex.l?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcslex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcslex.l Thu Feb 28 19:21:39 2013
@@ -50,6 +50,7 @@
 /* yyclass=           --> subClass yyFlexLexer to allow own functions        */
 /* c++                --> generate C++ classes                               */
 %option 8bit noyywrap never-interactive
+%array
 %p 24000
 %e 1200
 %n 500

Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcu.hxx Thu Feb 28 19:21:39 2013
@@ -48,6 +48,7 @@ class convert_xcu : public convert_gen_i
     void startCollectData(char *syyText);
     void stopCollectData(char *syyText);
     void copySpecial(char *syyText);
+    void copyNL(char *syyText);
     void addLevel();
 
   private:

Modified: openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXcuWrap.cxx Thu Feb 28 19:21:39 2013
@@ -136,6 +136,15 @@ void convert_xcu::stopCollectData(char *
   if (mbNoCollectingData)
     return;
 
+  // remove any newline
+  for (nL = 0;;)
+  {
+    nL = useText.find("\n");
+    if (nL == (int)std::string::npos)
+      break;
+    useText.erase(nL,1);
+  }
+
   mbNoCollectingData = true;
 
   // locate key and extract it
@@ -158,7 +167,8 @@ void convert_xcu::stopCollectData(char *
     }
   }
   else
-    mcMemory.setEnUsKey(useKey, "value", useText);
+    if (useText.size())
+      mcMemory.setEnUsKey(miLineNo, useKey, "value", useText);
 }  
 
 
@@ -188,6 +198,21 @@ void convert_xcu::copySpecial(char *syyT
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
+void convert_xcu::copyNL(char *syyText)
+{
+  int         nX    = msCollector.size();
+  std::string sText = copySource(syyText, mbNoCollectingData);
+
+  if (!mbNoCollectingData)
+  {
+    msCollector.erase(nX);
+    msCollector += ' ';
+  }
+}  
+
+
+
+/**********************   I M P L E M E N T A T I O N   **********************/
 void convert_xcu::addLevel()
 {
   ++miLevel;

Modified: openoffice/branches/l10n/main/l10ntools/source/gConXculex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXculex.l?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXculex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXculex.l Thu Feb 28 19:21:39 2013
@@ -50,6 +50,7 @@
 /* yyclass=           --> subClass yyFlexLexer to allow own functions        */
 /* c++                --> generate C++ classes                               */
 %option 8bit noyywrap never-interactive
+%array
 %p 24000
 %e 1200
 %n 500
@@ -115,10 +116,17 @@ FIN   [^/>]*">"
 
 
 
-.|\n {
+({SPACE}\n{SPACE})+ {
+  LOCptr->copyNL(yytext);
+}
+
+
+
+. {
   IMPLptr->copySource(yytext, LOCptr->mbNoCollectingData);
 }
 
 
 
+
 %%

Modified: openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXhpWrap.cxx Thu Feb 28 19:21:39 2013
@@ -222,7 +222,7 @@ void convert_xhp::closeTransTag(char *yy
   if (meExpectValue == VALUE_IS_VALUE || meExpectValue == VALUE_IS_VALUE_TAG)
   {
     if (msCollector.size() && msCollector != "-")
-      mcMemory.setEnUsKey(msKey, std::string("text"), msCollector);
+      mcMemory.setEnUsKey(miLineNo, msKey, std::string("text"), msCollector);
     msKey.clear();
   }
   copySource(yytext);

Modified: openoffice/branches/l10n/main/l10ntools/source/gConXhplex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXhplex.l?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXhplex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXhplex.l Thu Feb 28 19:21:39 2013
@@ -50,6 +50,7 @@
 /* yyclass=           --> subClass yyFlexLexer to allow own functions        */
 /* c++                --> generate C++ classes                               */
 %option 8bit noyywrap never-interactive
+%array
 %p 24000
 %e 1200
 %n 500

Modified: openoffice/branches/l10n/main/l10ntools/source/gConXrmWrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXrmWrap.cxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXrmWrap.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXrmWrap.cxx Thu Feb 28 19:21:39 2013
@@ -147,7 +147,7 @@ void convert_xrm::stopCollectData(char *
   if (!mbNoCollectingData)
   {
     msKey = msKey + "." + msKey;
-    mcMemory.setEnUsKey(msKey, std::string("text"), msCollector);
+    mcMemory.setEnUsKey(miLineNo, msKey, std::string("text"), msCollector);
     mbNoCollectingData = true;
     msKey.clear();
   }

Modified: openoffice/branches/l10n/main/l10ntools/source/gConXrmlex.l
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gConXrmlex.l?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gConXrmlex.l (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gConXrmlex.l Thu Feb 28 19:21:39 2013
@@ -50,6 +50,7 @@
 /* yyclass=           --> subClass yyFlexLexer to allow own functions        */
 /* c++                --> generate C++ classes                               */
 %option 8bit noyywrap never-interactive
+%array
 %p 24000
 %e 1200
 %n 500

Modified: openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gHandler.cxx Thu Feb 28 19:21:39 2013
@@ -211,8 +211,6 @@ void handler::run()
 /**********************   I M P L E M E N T A T I O N   **********************/
 void handler::runExtractMerge(bool bMerge)
 {
-  bool bDoNotSave = false;
-
   // prepare translation memory to module type
   mcMemory.setModuleName(msModuleName);
 
@@ -229,13 +227,10 @@ void handler::runExtractMerge(bool bMerg
     // get converter and extract files
     convert_gen convertObj(msSourceDir + *siSource, mcMemory, bMerge);
     convertObj.execute();
-    if (!bDoNotSave)
-      bDoNotSave = convertObj.isError();
   }
 
   // and generate language file
-  if (!bDoNotSave)
-    mcMemory.save(msTargetDir + msModuleName);
+  mcMemory.save(msTargetDir + msModuleName);
 }
 
 

Modified: openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gL10nMem.cxx Thu Feb 28 19:21:39 2013
@@ -20,7 +20,9 @@
  *************************************************************/
 #include "gLang.hxx"
 #include <algorithm>
+#include <iostream>
 #include <fstream>
+#include <sstream>
 
 
 
@@ -58,6 +60,9 @@ l10nMem_entry::~l10nMem_entry()
 
 /**********************   I M P L E M E N T A T I O N   **********************/
 l10nMem::l10nMem()
+                : mbInError(false),
+                  miStartInx(0),
+                  miLastUniqResort(0)
 {
 }
 
@@ -71,10 +76,53 @@ l10nMem::~l10nMem()
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
+std::string l10nMem::showError(int iLineNo, char *sText, bool bWarning)
+{
+  if (!bWarning)
+    mbInError = true;
+
+  std::cerr << "ERROR in " << msCurrentSourceFileName << ":" << iLineNo << ":  " << sText << std::endl;
+  return "ERROR";
+}
+
+
+
+/**********************   I M P L E M E N T A T I O N   **********************/
+bool l10nMem::isError()
+{
+  return mbInError; 
+}
+
+
+
+/**********************   I M P L E M E N T A T I O N   **********************/
+bool l10nMem::checkKey(const std::string& sKey, const std::string& sObjectType)
+{
+  int i;
+
+  for (i = miStartInx; i < (int)mcMemory.size(); ++i)
+    if (mcMemory[i].msModuleName == msCurrentModuleName     &&
+        mcMemory[i].msSourceFile == msCurrentSourceFileName &&
+        mcMemory[i].msObjectType == sObjectType             &&
+        mcMemory[i].msKey        == sKey                    )
+      return false;
+  return true;
+}
+
+
+
+/**********************   I M P L E M E N T A T I O N   **********************/
 void l10nMem::save(const std::string& srTargetFile)
 {
-  int           i, nL;
+  int           i;
   std::string   sFile = srTargetFile + ".cnv";
+
+  if (mbInError)
+  {
+    showError(0, (char *)"Cannot save file due to preceding errors");
+    return;
+  }
+ 
   std::ofstream outputFile(sFile.c_str(), std::ios::binary);
 
   if (!outputFile.is_open())
@@ -107,6 +155,7 @@ void l10nMem::clear()
 void l10nMem::setFileName(const std::string& srSourceFile)
 {
   msCurrentSourceFileName = srSourceFile;
+  miStartInx              = mcMemory.size();
 
   // modify to please current sdf format
   std::replace(msCurrentSourceFileName.begin(), msCurrentSourceFileName.end(), '/', '\\' );
@@ -123,11 +172,21 @@ void l10nMem::setModuleName(const std::s
 
 
 /**********************   I M P L E M E N T A T I O N   **********************/
-void l10nMem::setEnUsKey(const std::string& srKey, const std::string& srObjectType, const std::string& srText, int iIndex)
+void l10nMem::setEnUsKey(int iLineNo, const std::string& srKey, const std::string& srObjectType, const std::string& srText, int iIndex)
 {
   std::string baseLanguage = "en-US";
+  std::string myKey = srKey;
+
+  if (!checkKey(srKey, srObjectType))
+  {
+    std::stringstream ssBuf;
+
+    ++miLastUniqResort;
+    ssBuf  << miLastUniqResort;
+    myKey +=  ".globUniq" + ssBuf.str();
+  }
   mcMemory.push_back(l10nMem_entry(msCurrentSourceFileName, msCurrentModuleName,
-                                   srKey, srObjectType, baseLanguage, srText, iIndex));
+                                   myKey, srObjectType, baseLanguage, srText, iIndex));
 }
 
 

Modified: openoffice/branches/l10n/main/l10ntools/source/gLang.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/l10n/main/l10ntools/source/gLang.hxx?rev=1451299&r1=1451298&r2=1451299&view=diff
==============================================================================
--- openoffice/branches/l10n/main/l10ntools/source/gLang.hxx (original)
+++ openoffice/branches/l10n/main/l10ntools/source/gLang.hxx Thu Feb 28 19:21:39 2013
@@ -68,11 +68,17 @@ class l10nMem
     l10nMem();
     ~l10nMem();
 
-    void save         (const std::string& srTargetFile);
-    void clear();
-    void setFileName  (const std::string& srSourceFile);
-    void setModuleName(const std::string& srModuleName);
-    void setEnUsKey   (const std::string& srKey, const std::string& srObjectType, const std::string& srText, int iIndex = 0);
+    std::string                   showError         (int iLineNo, char *sText, bool bWarning = false);
+    bool                          isError           ();
+    bool                          checkKey          (const std::string& sKey,
+                                                     const std::string& sObjectType);
+    void                          save              (const std::string& srTargetFile);
+    void                          clear();
+    void                          setFileName       (const std::string& srSourceFile);
+    void                          setModuleName     (const std::string& srModuleName);
+    void                          setEnUsKey        (int        iLineNo,const std::string& srKey,
+                                                     const std::string& srObjectType,
+                                                     const std::string& srText, int iIndex = 0);
     std::vector<l10nMem_entry *>& getLanguagesForKey(const std::string& srKey);
 
   private:
@@ -80,6 +86,9 @@ class l10nMem
     std::string                  msCurrentSourceFileName;
     std::vector<l10nMem_entry *> mcCurrentSelection;
     std::vector<l10nMem_entry>   mcMemory;
+    bool                         mbInError;
+    int                          miStartInx;
+    int                          miLastUniqResort;
 };
 
 
@@ -93,7 +102,6 @@ class convert_gen
 
     // do extract/merge
     void execute();
-    bool isError();
 };