[Libreoffice-commits] .: l10ntools/inc l10ntools/prj l10ntools/scripts l10ntools/source solenv/bin solenv/inc

Stephan Bergmann sbergmann at kemper.freedesktop.org
Fri Feb 10 01:47:01 PST 2012


 l10ntools/inc/export.hxx             |    3 
 l10ntools/inc/srciter.hxx            |   59 --
 l10ntools/prj/d.lst                  |    4 
 l10ntools/scripts/propex             |    2 
 l10ntools/source/cfglex.l            |    8 
 l10ntools/source/common.hxx          |    8 
 l10ntools/source/export.cxx          |    6 
 l10ntools/source/gsicheck.cxx        |   11 
 l10ntools/source/help/HelpLinker.cxx |    4 
 l10ntools/source/helper.hxx          |    8 
 l10ntools/source/helpex.cxx          |   12 
 l10ntools/source/lngex.cxx           |   14 
 l10ntools/source/localize.cxx        |  951 ++++++++++++++---------------------
 l10ntools/source/makefile.mk         |   10 
 l10ntools/source/srciter.cxx         |  144 -----
 l10ntools/source/srclex.l            |    8 
 l10ntools/source/xrmlex.l            |   11 
 solenv/bin/localize                  |   16 
 solenv/inc/unitools.mk               |    2 
 19 files changed, 440 insertions(+), 841 deletions(-)

New commits:
commit 718ce84a06f18a3000d23287a2238a5a5299627a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Feb 10 10:44:37 2012 +0100

    Various more l10ntools clean up
    
    "localize" is now directly a C++ program w/o wrapper script.  Also,
    its command line has changed slightly, taking the source root as
    explicit argument (instead of implicitly as cwd).

diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index d8d2acd..e6d0057 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -126,7 +126,7 @@ public:
     ~ResData();
     sal_Bool SetId(const rtl::OString &rId, sal_uInt16 nLevel);
 
-    sal_uInt16 nWidth;
+    sal_Int32 nWidth;
     sal_uInt16 nChildIndex;
     sal_uInt16 nIdLevel;
     sal_Bool bChild;
@@ -202,6 +202,7 @@ public:
 
     ResData(const rtl::OString &rPF, const rtl::OString &rGId , const rtl::OString &rFilename)
             :
+            nWidth( 0 ),
             nChildIndex( 0 ),
             nIdLevel( ID_LEVEL_NULL ),
             bChild( sal_False ),
diff --git a/l10ntools/inc/srciter.hxx b/l10ntools/inc/srciter.hxx
deleted file mode 100644
index 237e7a0..0000000
--- a/l10ntools/inc/srciter.hxx
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef L10NTOOLS_DIRECTORY_HXX
-#define L10NTOOLS_DIRECTORY_HXX
-#include <l10ntools/directory.hxx>
-#endif
-
-// class SourceTreeIterator
-//
-
-class SourceTreeIterator
-{
-private:
-    transex::Directory aRootDirectory;
-    bool bInExecute;
-
-    void ExecuteDirectory( transex::Directory& pDirectory );
-
-protected:
-    bool bSkipLinks;
-
-public:
-    SourceTreeIterator(const rtl::OString &rRootDirectory);
-    virtual ~SourceTreeIterator();
-
-    sal_Bool StartExecute();
-    void EndExecute();
-
-    virtual void OnExecuteDirectory( const rtl::OUString &rDirectory );
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/prj/d.lst b/l10ntools/prj/d.lst
index 95675a7..eded848 100644
--- a/l10ntools/prj/d.lst
+++ b/l10ntools/prj/d.lst
@@ -12,8 +12,8 @@ mkdir: %_DEST%\bin\help\com\sun\star\help
 ..\%__SRC%\bin\transex3 %_DEST%\bin\transex3
 ..\%__SRC%\bin\lngex.exe %_DEST%\bin\lngex.exe
 ..\%__SRC%\bin\lngex %_DEST%\bin\lngex
-..\%__SRC%\bin\localize_sl.exe %_DEST%\bin\localize_sl.exe
-..\%__SRC%\bin\localize_sl %_DEST%\bin\localize_sl
+..\%__SRC%\bin\localize.exe %_DEST%\bin\localize.exe
+..\%__SRC%\bin\localize %_DEST%\bin\localize
 ..\%__SRC%\bin\xrmex.exe %_DEST%\bin\xrmex.exe
 ..\%__SRC%\bin\xrmex %_DEST%\bin\xrmex
 ..\%__SRC%\bin\gsicheck.exe %_DEST%\bin\gsicheck.exe
diff --git a/l10ntools/scripts/propex b/l10ntools/scripts/propex
index ba7a49d..d7135cf 100755
--- a/l10ntools/scripts/propex
+++ b/l10ntools/scripts/propex
@@ -38,7 +38,7 @@ use Cwd;
 my %options=();
 getopts("ep:r:i:o:l:", \%options);
 
-unless ( $options{i} =~ m/en_US/ ) {exit 1;}
+unless ( $options{i} =~ m/en_US/ ) {exit 0;}
 
 my $file = substr ( Cwd::abs_path($options{i}), length(Cwd::abs_path($options{r})) + 1 );
 $file =~ s|/|\\|g;
diff --git a/l10ntools/source/cfglex.l b/l10ntools/source/cfglex.l
index f1daee6..a8a01ad 100644
--- a/l10ntools/source/cfglex.l
+++ b/l10ntools/source/cfglex.l
@@ -22,6 +22,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#include "sal/main.h"
+
 #if defined __GNUC__
 #pragma GCC system_header
 #elif defined __SINPRO_CC
@@ -149,11 +151,7 @@ void yyerror ( const char *s )
 	exit(EXIT_FAILURE);
 }
 
-int
-#if defined WNT
-_cdecl
-#endif
-main(int argc, char ** argv) {
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
     yyin = init(argc, argv);
     yylex();
     return EXIT_SUCCESS;
diff --git a/l10ntools/source/common.hxx b/l10ntools/source/common.hxx
index 89808f7..fb11844 100644
--- a/l10ntools/source/common.hxx
+++ b/l10ntools/source/common.hxx
@@ -64,10 +64,16 @@ inline rtl::OString pathnameToken(char const * pathname, char const * root) {
         std::cerr << "Error: Cannot convert input pathname to UTF-16\n";
         std::exit(EXIT_FAILURE);
     }
+    if (osl::FileBase::getFileURLFromSystemPath(full, full)
+        != osl::FileBase::E_None)
+    {
+        std::cerr << "Error: Cannot convert input pathname to URL\n";
+        std::exit(EXIT_FAILURE);
+    }
     if (osl::FileBase::getAbsoluteFileURL(cwd, full, full)
         != osl::FileBase::E_None)
     {
-        std::cerr << "Error: Cannot convert input pathname to absolute URL\n";
+        std::cerr << "Error: Cannot convert input URL to absolute URL\n";
         std::exit(EXIT_FAILURE);
     }
     if (root == 0) {
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index 566dd87..f638a10 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -875,9 +875,9 @@ int Export::Execute( int nToken, const char * pToken )
             sMapping = replace(sMapping, rtl::OString('\t'), rtl::OString());
             sKey = sKey.toAsciiUpperCase();
             if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("SIZE")))
-                pResData->nWidth = ( sal_uInt16 ) getToken(sMapping, 0, ',').toInt32();
+                pResData->nWidth = getToken(sMapping, 0, ',').toInt32();
             else if (sKey.equalsL(RTL_CONSTASCII_STRINGPARAM("POSSIZE")))
-                pResData->nWidth = ( sal_uInt16 ) getToken(sMapping, 2, ',').toInt32();
+                pResData->nWidth = getToken(sMapping, 2, ',').toInt32();
         }
         break;
         case RSCDEFINELEND:
@@ -1058,7 +1058,7 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew )
                 sOutput += sLID; sOutput += "\t";
                 sOutput += pResData->sHelpId; sOutput   += "\t";
                 sOutput += pResData->sPForm; sOutput    += "\t";
-                sOutput += rtl::OString::valueOf(static_cast<sal_Int64>(pResData->nWidth)); sOutput += "\t";
+                sOutput += rtl::OString::valueOf(pResData->nWidth); sOutput += "\t";
                 sOutput += sCur; sOutput += "\t";
 
 
diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx
index 9405a91..11c9d83 100644
--- a/l10ntools/source/gsicheck.cxx
+++ b/l10ntools/source/gsicheck.cxx
@@ -37,6 +37,7 @@
 #include <stdio.h>
 
 #include <rtl/strbuf.hxx>
+#include "sal/main.h"
 #include "helper.hxx"
 #include "tagtest.hxx"
 #include "gsicheck.hxx"
@@ -684,15 +685,7 @@ void Help()
        fprintf( stdout, "\n" );
 }
 
-/*****************************************************************************/
-#if defined(UNX)
-int main( int argc, char *argv[] )
-#else
-int _cdecl main( int argc, char *argv[] )
-#endif
-/*****************************************************************************/
-{
-
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
     sal_Bool bError = sal_False;
     sal_Bool bPrintContext = sal_False;
     sal_Bool bCheckSourceLang = sal_False;
diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx
index bf237c0..8cbc214 100644
--- a/l10ntools/source/help/HelpLinker.cxx
+++ b/l10ntools/source/help/HelpLinker.cxx
@@ -43,6 +43,7 @@
 #include <libxslt/functions.h>
 #include <libxslt/extensions.h>
 
+#include <sal/main.h>
 #include <sal/types.h>
 #include <osl/time.h>
 #include <rtl/bootstrap.hxx>
@@ -1024,8 +1025,7 @@ void HelpLinker::main( std::vector<std::string> &args,
     link();
 }
 
-int main(int argc, char**argv)
-{
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
     std::vector<std::string> args;
     for (int i = 1; i < argc; ++i)
         args.push_back(std::string(argv[i]));
diff --git a/l10ntools/source/helper.hxx b/l10ntools/source/helper.hxx
index edd2d0f..48f74a5 100644
--- a/l10ntools/source/helper.hxx
+++ b/l10ntools/source/helper.hxx
@@ -79,6 +79,14 @@ inline bool endsWith(rtl::OString const & text, rtl::OString const & search) {
         && text.match(search, text.getLength() - search.getLength());
 }
 
+inline bool endsWithAsciiL(
+    rtl::OUString const & text, char const * search, sal_Int32 searchLength)
+{
+    return text.getLength() >= searchLength
+        && text.matchAsciiL(
+            search, searchLength, text.getLength() - searchLength);
+}
+
 inline rtl::OString trimAscii(rtl::OString const & text) {
     sal_Int32 i1 = 0;
     while (i1 != text.getLength() && isAsciiWhitespace(text[i1])) {
diff --git a/l10ntools/source/helpex.cxx b/l10ntools/source/helpex.cxx
index d966dc6..d7cf212 100644
--- a/l10ntools/source/helpex.cxx
+++ b/l10ntools/source/helpex.cxx
@@ -33,7 +33,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-// local includes
+#include "sal/main.h"
+
 #include "helpmerge.hxx"
 
 // defines to parse command line
@@ -185,14 +186,7 @@ void Help()
 /*****************************************************************************/
 #ifndef TESTDRIVER
 
-#if defined(UNX)
-int main( int argc, char *argv[] )
-#else
-int _cdecl main( int argc, char *argv[] )
-#endif
-/*****************************************************************************/
-{
-
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
     if ( !ParseCommandLine( argc, argv )) {
         Help();
         return 1;
diff --git a/l10ntools/source/lngex.cxx b/l10ntools/source/lngex.cxx
index 73d7221..5f8f8cd 100644
--- a/l10ntools/source/lngex.cxx
+++ b/l10ntools/source/lngex.cxx
@@ -26,9 +26,12 @@
  *
  ************************************************************************/
 
+#include "sal/config.h"
+
 #include <stdio.h>
 
-// local includes
+#include "sal/main.h"
+
 #include "lngmerge.hxx"
 
 // defines to parse command line
@@ -154,14 +157,7 @@ void Help()
     fprintf( stdout, " -L: Restrict the handled languages. l1,l2,... are elements of (de,en-US...)\n" );
 }
 
-/*****************************************************************************/
-#if defined(UNX)
-int main( int argc, char *argv[] )
-#else
-int _cdecl main( int argc, char *argv[] )
-#endif
-/*****************************************************************************/
-{
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
     if ( !ParseCommandLine( argc, argv ))
     {
         Help();
diff --git a/l10ntools/source/localize.cxx b/l10ntools/source/localize.cxx
index cdb4ae1..e259ef7 100644
--- a/l10ntools/source/localize.cxx
+++ b/l10ntools/source/localize.cxx
@@ -29,17 +29,26 @@
 #include "sal/config.h"
 
 #include <cstddef>
+#include <cstdlib>
 #include <fstream>
-
-#include "srciter.hxx"
-#include "export.hxx"
-#include <string>
-#include <vector>
-#include <stdio.h>
 #include <iostream>
-#include "tools/errcode.hxx"
-#include "tools/fsys.hxx"
-#include "tools/urlobj.hxx"
+#include <string>
+
+#include "boost/noncopyable.hpp"
+#include "osl/file.h"
+#include "osl/file.hxx"
+#include "osl/process.h"
+#include "osl/thread.h"
+#include "rtl/oustringostreaminserter.hxx"
+#include "rtl/string.h"
+#include "rtl/string.hxx"
+#include "rtl/textcvt.h"
+#include "rtl/ustrbuf.hxx"
+#include "rtl/ustring.h"
+#include "rtl/ustring.hxx"
+#include "sal/macros.h"
+#include "sal/main.h"
+#include "sal/types.h"
 
 #include "helper.hxx"
 
@@ -47,610 +56,436 @@ using namespace std;
 
 namespace {
 
-DirEntry GetTempFile()
-{
-    rtl::OUString* sTempFilename = new rtl::OUString();
-
-    // Create a temp file
-    int nRC = osl::FileBase::createTempFile( 0 , 0 , sTempFilename );
-    if( nRC ) printf(" osl::FileBase::createTempFile RC = %d",nRC);
-
-    rtl::OUString strTmp( *sTempFilename  );
-
-    INetURLObject::DecodeMechanism eMechanism = INetURLObject::DECODE_TO_IURI;
-    rtl::OUString sDecodedStr = INetURLObject::decode( strTmp , '%' , eMechanism );
-    rtl::OString sTmp(rtl::OUStringToOString(sDecodedStr , RTL_TEXTENCODING_UTF8));
-
-#if defined(WNT)
-    sTmp = comphelper::string::replace(sTmp,
-        rtl::OString(RTL_CONSTASCII_STRINGPARAM("file:///")),
-        rtl::OString());
-    sTmp = sTmp.replace('/', '\\');
-#else
-    // Set file permission to 644
-    const sal_uInt64 nPerm = osl_File_Attribute_OwnRead | osl_File_Attribute_OwnWrite |
-                             osl_File_Attribute_GrpRead | osl_File_Attribute_OthRead ;
+namespace global {
 
-    nRC = osl::File::setAttributes( *sTempFilename , nPerm );
-    if( nRC ) printf(" osl::File::setAttributes RC = %d",nRC);
+std::ofstream output;
 
-    sTmp = comphelper::string::replace(sTmp,
-        rtl::OString(RTL_CONSTASCII_STRINGPARAM("file://")),
-        rtl::OString());
-#endif
-    DirEntry aDirEntry( sTmp );
-    delete sTempFilename;
-    return aDirEntry;
 }
 
+rtl::OUString getEnvironment(rtl::OUString const & variable) {
+    rtl::OUString value;
+    if (osl_getEnvironment(variable.pData, &value.pData) != osl_Process_E_None)
+    {
+        std::cerr
+            << "Error: cannot get environment variable " << variable << '\n';
+        throw false; //TODO
+    }
+    return value;
 }
 
-namespace transex3
-{
-
-//
-// SourceTreeLocalizer
-//
-
-const char *ExeTable[][4] = {
-    { "src", "transex3", " -e", "negative" },
-    { "hrc", "transex3", " -e", "positive" },
-    { "ulf", "ulfex", " -e", "negative" },
-    { "xcu", "cfgex", " -e", "negative" },
-    { "xrm", "xrmex", " -e", "negative" },
-    { "xml", "xrmex", " -e", "positive" },
-    { "xhp", "helpex", " -e", "negative" },
-    { "properties", "propex", " -e", "negative" },
-    { "NULL", "NULL", "NULL", "NULL" }
-};
-
-const char *NegativeList[] = {
-    "officecfg/registry/data/org/openoffice/Office/Labels.xcu",
-    "officecfg/registry/data/org/openoffice/Office/SFX.xcu",
-    "officecfg/registry/data/org/openoffice/Office/Accelerators.xcu",
-    "dictionaries.xcu",
-    "hidother.src",
-    "dictionaries/da_DK/help/da/org.openoffice.da.hunspell.dictionaries/page1.xhp",
-    "dictionaries/hu_HU/help/hu/org.openoffice.hu.hunspell.dictionaries/page1.xhp",
-    "NULL"
-};
-
-const char *PositiveList[] = {
-    "description.xml",
-    "svx/inc/globlmn_tmpl.hrc",
-    "sw/source/ui/inc/swmn_tmpl.hrc",
-    "sw/source/ui/inc/swacc_tmpl.hrc",
-    "sw/source/ui/inc/toolbox_tmpl.hrc",
-    "offmgr/inc/offmenu_tmpl.hrc",
-    "offmgr/source/offapp/intro/intro_tmpl.hrc",
-    "dbaccess/source/ui/inc/toolbox_tmpl.hrc",
-    "svx/source/intro/intro_tmpl.hrc",
-    "dbaccess/source/ui/dlg/AutoControls_tmpl.hrc",
-    "svx/source/unodialogs/textconversiondlgs/chinese_direction_tmpl.hrc",
-    "chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc",
-    "chart2/source/controller/dialogs/res_LegendPosition_tmpl.hrc",
-    "chart2/source/controller/dialogs/res_Statistic_tmpl.hrc",
-    "chart2/source/controller/dialogs/res_Titlesx_tmpl.hrc",
-    "chart2/source/controller/dialogs/res_SecondaryAxisCheckBoxes_tmpl.hrc",
-    "chart2/source/controller/menu/MenuItems_tmpl.hrc",
-    "chart2/source/controller/dialogs/res_ErrorBar_tmpl.hrc",
-    "chart2/source/controller/dialogs/res_Trendline_tmpl.hrc",
-       "svx.link/inc/globlmn_tmpl.hrc",
-    "sw.link/source/ui/inc/swmn_tmpl.hrc",
-    "sw.link/source/ui/inc/swacc_tmpl.hrc",
-    "sw.link/source/ui/inc/toolbox_tmpl.hrc",
-    "offmgr.link/inc/offmenu_tmpl.hrc",
-    "offmgr.link/source/offapp/intro/intro_tmpl.hrc",
-    "dbaccess.link/source/ui/inc/toolbox_tmpl.hrc",
-    "svx.link/source/intro/intro_tmpl.hrc",
-    "dbaccess.link/source/ui/dlg/AutoControls_tmpl.hrc",
-    "svx.link/source/unodialogs/textconversiondlgs/chinese_direction_tmpl.hrc",
-    "chart2.link/source/controller/dialogs/res_DataLabel_tmpl.hrc",
-    "chart2.link/source/controller/dialogs/res_LegendPosition_tmpl.hrc",
-    "chart2.link/source/controller/dialogs/res_Statistic_tmpl.hrc",
-    "chart2.link/source/controller/dialogs/res_Titlesx_tmpl.hrc",
-    "chart2.link/source/controller/dialogs/res_SecondaryAxisCheckBoxes_tmpl.hrc",
-    "chart2.link/source/controller/menu/MenuItems_tmpl.hrc",
-    "chart2.link/source/controller/dialogs/res_ErrorBar_tmpl.hrc",
-    "chart2.link/source/controller/dialogs/res_Trendline_tmpl.hrc",
-    "NULL"
-};
-
-const char *ModuleList[] = {
-    "accessibility",
-    "avmedia",
-    "basctl",
-    "basic",
-    "chart2",
-    "connectivity",
-    "cui",
-    "dbaccess",
-    "desktop",
-    "dictionaries",
-    "editeng",
-    "extensions",
-    "filter",
-    "forms",
-    "formula",
-    "fpicker",
-    "framework",
-    "helpcontent2",
-    "instsetoo_native",
-    "mysqlc",
-    "nlpsolver",
-    "officecfg",
-    "padmin",
-    "readlicense_oo",
-    "reportbuilder",
-    "reportdesign",
-    "sc",
-    "scaddins",
-    "sccomp",
-    "scp2",
-    "scripting",
-    "sd",
-    "sdext",
-    "setup_native",
-    "sfx2",
-    "shell",
-    "starmath",
-    "svl",
-    "svtools",
-    "svx",
-    "sw",
-    "swext",
-    "sysui",
-    "uui",
-    "vcl",
-    "wizards",
-    "xmlsecurity",
-    "NULL",
-};
-
+class TempFile: private boost::noncopyable {
+public:
+    TempFile() {
+        if (osl::FileBase::createTempFile(0, 0, &url_) != osl::FileBase::E_None)
+        {
+            std::cerr << "osl::FileBase::createTempFile() failed\n";
+            throw false; //TODO
+        }
+    }
 
-const char PRJ_DIR_NAME[] = "prj";
-const char DLIST_NAME[] = "d.lst";
+    ~TempFile() {
+        if (osl::File::remove(url_) != osl::FileBase::E_None) {
+            std::cerr << "Warning: failure removing temporary " << url_ << '\n';
+        }
+    }
 
-#define LOCALIZE_NONE       0x0000
-#define LOCALIZE_EXTRACT    0x0001
+    rtl::OUString getUrl() const { return url_; }
 
-class SourceTreeLocalizer : public SourceTreeIterator
-{
 private:
-    std::ofstream aSDF;
-    sal_uInt16 nMode;
-
-    rtl::OString sLanguageRestriction;
-
-    rtl::OString sOutputFile;
-
-    int nFileCnt;
-
-    const rtl::OString GetProjectName( sal_Bool bAbs = sal_False );
-    const rtl::OString GetProjectRootRel();
-
-
-    sal_Bool CheckNegativeList( const rtl::OString &rFileName );
-    sal_Bool CheckPositiveList( const rtl::OString &rFileName );
-
-    void WorkOnFile(
-        const rtl::OString &rFileName,
-        const rtl::OString &rExecutable,
-        const rtl::OString &rParameter
-    );
-
-    void WorkOnFileType(
-        const rtl::OString &rDirectory,
-        const rtl::OString &rExtension,
-        const rtl::OString &rExecutable,
-        const rtl::OString &rParameter,
-        const rtl::OString &rCollectMode
-    );
-    void WorkOnDirectory(const rtl::OString &rDirectory);
-public:
-    SourceTreeLocalizer(const rtl::OString &rRoot, bool skip_links);
-    ~SourceTreeLocalizer();
-
-    void SetLanguageRestriction( const rtl::OString& rRestrictions )
-        { sLanguageRestriction = rRestrictions; }
-    int getFileCnt();
-    sal_Bool Extract(const rtl::OString &rDestinationFile);
-    int GetFileCnt();
-    virtual void OnExecuteDirectory( const rtl::OUString &rDirectory );
+    rtl::OUString url_;
 };
 
-SourceTreeLocalizer::SourceTreeLocalizer(const rtl::OString &rRoot, bool skip_links)
-    : SourceTreeIterator(rRoot)
-    , nMode( LOCALIZE_NONE )
-    , nFileCnt( 0 )
-{
-    bSkipLinks  = skip_links ;
-}
-
-/*****************************************************************************/
-SourceTreeLocalizer::~SourceTreeLocalizer()
-/*****************************************************************************/
-{
-}
+struct AsciiString {
+    char const * string;
+    sal_Int32 length;
+};
 
-/*****************************************************************************/
-const rtl::OString SourceTreeLocalizer::GetProjectName( sal_Bool bAbs )
-/*****************************************************************************/
+bool matchList(
+    rtl::OUString const & url, AsciiString const * list, std::size_t length)
 {
-    sal_Bool bFound = sal_False;
-    DirEntry aCur;
-    aCur.ToAbs();
-
-    for ( ; ! bFound && aCur.Level() > 1; aCur.CutName() )
-    {
-        DirEntry aTest = aCur + DirEntry(PRJ_DIR_NAME) + DirEntry(DLIST_NAME);
-        if ( aTest.Exists() )
-        {
-            if ( bAbs )
-                return rtl::OUStringToOString(aCur.GetFull(), RTL_TEXTENCODING_ASCII_US);
-            else
-                return rtl::OUStringToOString(aCur.GetName(), RTL_TEXTENCODING_ASCII_US);
+    for (std::size_t i = 0; i != length; ++i) {
+        if (helper::endsWithAsciiL(url, list[i].string, list[i].length)) {
+            return true;
         }
     }
-
-    return "";
-}
-/*****************************************************************************/
-int SourceTreeLocalizer::GetFileCnt(){
-/*****************************************************************************/
-    return nFileCnt;
+    return false;
 }
 
-/*****************************************************************************/
-const rtl::OString SourceTreeLocalizer::GetProjectRootRel()
-/*****************************************************************************/
-{
-    rtl::OString sProjectRoot( GetProjectName( sal_True ));
-    DirEntry aCur;
-    aCur.ToAbs();
-    rtl::OString sCur(rtl::OUStringToOString(aCur.GetFull(), RTL_TEXTENCODING_ASCII_US));
-
-    if (helper::searchAndReplace(&sCur, sProjectRoot, rtl::OString()) == -1)
-        return "";
-
-    rtl::OString sDelimiter(rtl::OUStringToOString(
-        DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US));
-
-    helper::searchAndReplaceAll(&sCur, sDelimiter, "/");
-    sCur = comphelper::string::stripStart(sCur, '/');
-    sal_Int32 nCount = comphelper::string::getTokenCount(sCur, '/');
-
-    rtl::OString sProjectRootRel;
-    for (sal_Int32 i = 0; i < nCount; ++i)
-    {
-        if (!sProjectRootRel.isEmpty())
-            sProjectRootRel += sDelimiter;
-        sProjectRootRel += "..";
-    }
-    if (!sProjectRootRel.isEmpty())
-        return sProjectRootRel;
-
-    return ".";
+bool passesNegativeList(rtl::OUString const & url) {
+    static AsciiString const list[] = {
+        { RTL_CONSTASCII_STRINGPARAM("/dictionaries.xcu") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/dictionaries/da_DK/help/da/"
+            "org.openoffice.da.hunspell.dictionaries/page1.xhp") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/dictionaries/hu_HU/help/hu/"
+            "org.openoffice.hu.hunspell.dictionaries/page1.xhp") },
+        { RTL_CONSTASCII_STRINGPARAM("/hidother.src") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/officecfg/registry/data/org/openoffice/Office/"
+            "Accelerators.xcu") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/officecfg/registry/data/org/openoffice/Office/Labels.xcu") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/officecfg/registry/data/org/openoffice/Office/SFX.xcu") }
+    };
+    return !matchList(url, list, SAL_N_ELEMENTS(list));
 }
 
-bool skipProject( rtl::OString sPrj )
-{
-    int nIndex = 0;
-    bool bReturn = true;
-    rtl::OString sModule( ModuleList[ nIndex ] );
-    while (!sModule.equalsL(RTL_CONSTASCII_STRINGPARAM("NULL")) && bReturn) {
-        if (sPrj == sModule)
-            bReturn = false;
-        nIndex++;
-        sModule = ModuleList[ nIndex ];
-    }
-    return bReturn;
+bool passesPositiveList(rtl::OUString const & url) {
+    static AsciiString const list[] = {
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/chart2/source/controller/dialogs/res_DataLabel_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/chart2/source/controller/dialogs/res_ErrorBar_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/chart2/source/controller/dialogs/res_LegendPosition_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/chart2/source/controller/dialogs/"
+            "res_SecondaryAxisCheckBoxes_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/chart2/source/controller/dialogs/res_Statistic_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/chart2/source/controller/dialogs/res_Titlesx_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/chart2/source/controller/dialogs/res_Trendline_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/chart2/source/controller/menu/MenuItems_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/dbaccess/source/ui/dlg/AutoControls_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/dbaccess/source/ui/inc/toolbox_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM("/description.xml") },
+        { RTL_CONSTASCII_STRINGPARAM("/offmgr/inc/offmenu_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/offmgr/source/offapp/intro/intro_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM("/svx/inc/globlmn_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM("/svx/source/intro/intro_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM(
+            "/svx/source/unodialogs/textconversiondlgs/"
+            "chinese_direction_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM("/sw/source/ui/inc/swacc_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM("/sw/source/ui/inc/swmn_tmpl.hrc") },
+        { RTL_CONSTASCII_STRINGPARAM("/sw/source/ui/inc/toolbox_tmpl.hrc") }
+    };
+    return matchList(url, list, SAL_N_ELEMENTS(list));
 }
 
-/*****************************************************************************/
-void SourceTreeLocalizer::WorkOnFile(
-    const rtl::OString &rFileName, const rtl::OString &rExecutable,
-    const rtl::OString &rParameter )
-/*****************************************************************************/
+void handleCommand(
+    rtl::OUString const & project, rtl::OUString const & projectRoot,
+    rtl::OUString const & url, rtl::OUString const & executable, bool positive)
 {
-    rtl::OUString sFull(
-        rtl::OStringToOUString(rFileName, RTL_TEXTENCODING_ASCII_US));
-        DirEntry aEntry( sFull );
-        rtl::OString sFileName(rtl::OUStringToOString(aEntry.GetName(), RTL_TEXTENCODING_ASCII_US));
-
-        // set current working directory
-        DirEntry aPath( aEntry.GetPath());
-        DirEntry aOldCWD;
-        aPath.SetCWD();
-
-        rtl::OString sPrj( GetProjectName());
-        if (!sPrj.isEmpty() && !skipProject( sPrj ) )
+    if (positive ? passesPositiveList(url) : passesNegativeList(url)) {
+        rtl::OUString inPath;
+        if (osl::FileBase::getSystemPathFromFileURL(url, inPath) !=
+            osl::FileBase::E_None)
         {
-            rtl::OString sRoot( GetProjectRootRel());
-
-            DirEntry aTemp(GetTempFile());
-            rtl::OString sTempFile(rtl::OUStringToOString(aTemp.GetFull(), RTL_TEXTENCODING_ASCII_US));
-
-            rtl::OString sDel;
-#if defined(WNT)
-            sDel=rtl::OString("\\");
-#else
-            sDel=rtl::OString("/");
-#endif
-            rtl::OString sPath1( Export::GetEnv("SOLARVER") );
-            rtl::OString sPath2( Export::GetEnv("INPATH_FOR_BUILD") );
-            rtl::OString sPath3( "bin" );
-            rtl::OString sExecutable( sPath1 );
-#if defined(WNT)
-            sExecutable = sExecutable.replace('/', '\\');
-#endif
-            sExecutable += sDel ;
-            sExecutable += sPath2 ;
-            sExecutable += sDel;
-            sExecutable += sPath3 ;
-            sExecutable += sDel ;
-            sExecutable += rExecutable ;
-
-
-        rtl::OString sCommand( sExecutable );
-        sCommand += " ";
-        sCommand += rParameter;
-        sCommand += " -p ";
-        sCommand += sPrj;
-        sCommand += " -r ";
-        sCommand += sRoot;
-        sCommand += " -i ";
-        sCommand += sFileName;
-        sCommand += " -o ";
-        sCommand += sTempFile;
-        if (!sLanguageRestriction.isEmpty()) {
-            sCommand += " -l ";
-            sCommand +=  sLanguageRestriction;
+            std::cerr
+                << "osl::FileBase::getSystemPathFromFileURL(" << url
+                << ") failed\n";
+            throw false; //TODO
         }
-
-            //printf("DBG: %s\n",sCommand.GetBuffer());
-            if (system(sCommand.getStr()) == -1)
-                fprintf(stderr, "%s failed\n", sCommand.getStr());
-            nFileCnt++;
-
-            ifstream aSDFIn(
-                rtl::OUStringToOString(
-                    aTemp.GetFull(), osl_getThreadTextEncoding()).
-                getStr());
-            while (aSDFIn.is_open() && !aSDFIn.eof())
-            {
-                std::string s;
-                std::getline(aSDFIn, s);
-                if (!s.empty())
-                    aSDF << s << '\n';
-            }
-            aSDFIn.close();
-
-            aTemp.Kill();
-
+        TempFile temp;
+        rtl::OUString outPath;
+        if (osl::FileBase::getSystemPathFromFileURL(temp.getUrl(), outPath)
+            != osl::FileBase::E_None)
+        {
+            std::cerr
+                << "osl::FileBase::getSystemPathFromFileURL(" << temp.getUrl()
+                << ") failed\n";
+            throw false; //TODO
         }
-        // reset current working directory
-        aOldCWD.SetCWD();
-}
-
-/*****************************************************************************/
-sal_Bool SourceTreeLocalizer::CheckNegativeList( const rtl::OString &rFileName )
-/*****************************************************************************/
-{
-    std::size_t nIndex = 0;
-    sal_Bool bReturn  = sal_True;
-
-    rtl::OString sDelimiter(rtl::OUStringToOString(
-        DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US));
-
-    rtl::OString sFileName(rFileName.toAsciiLowerCase());
-
-    rtl::OString sNegative( NegativeList[ nIndex ] );
-    while (!sNegative.equalsL(RTL_CONSTASCII_STRINGPARAM("NULL")) && bReturn) {
-        helper::searchAndReplaceAll(&sNegative, "\\", sDelimiter);
-        helper::searchAndReplaceAll(&sNegative, "/", sDelimiter);
-        sNegative = sNegative.toAsciiLowerCase();
-
-        if (sFileName.indexOf(sNegative)
-            == sFileName.getLength() - sNegative.getLength())
+        rtl::OUStringBuffer buf(
+            getEnvironment(
+                rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SOLARVER"))));
+        buf.append('/');
+        buf.append(
+            getEnvironment(
+                rtl::OUString(
+                    RTL_CONSTASCII_USTRINGPARAM("INPATH_FOR_BUILD"))));
+        buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("/bin/"));
+        buf.append(executable);
+        buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(" -e -p "));
+        buf.append(project);
+        buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(" -r "));
+        buf.append(projectRoot);
+        buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(" -i "));
+        buf.append(inPath);
+        buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(" -o "));
+        buf.append(outPath);
+        buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(" -l en-US"));
+        rtl::OString cmd;
+        if (!buf.makeStringAndClear().convertToString(
+                &cmd, osl_getThreadTextEncoding(),
+                (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
+                 | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
         {
-            bReturn = false;
+            std::cerr << "Error: Cannot convert command from UTF-16\n";
+            throw false; //TODO
         }
-
-        nIndex++;
-        sNegative = NegativeList[ nIndex ];
+        if (system(cmd.getStr()) != 0) {
+            std::cerr << "Error: Failed to execute " << cmd.getStr() << '\n';
+            throw false; //TODO
+        }
+        rtl::OString outPath8;
+        if (!outPath.convertToString(
+                &outPath8, osl_getThreadTextEncoding(),
+                (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR
+                 | RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+        {
+            std::cerr << "Error: Cannot convert pathname from UTF-16\n";
+            throw false; //TODO
+        }
+        std::ifstream in(outPath8.getStr());
+        if (!in.is_open()) {
+            std::cerr << "Error: Cannot open " << outPath.getStr() << "\n";
+            throw false; //TODO
+        }
+        while (!in.eof())
+        {
+            std::string s;
+            std::getline(in, s);
+            if (!s.empty())
+                global::output << s << '\n';
+        }
+        in.close();
     }
-
-    return bReturn;
 }
 
-/*****************************************************************************/
-sal_Bool SourceTreeLocalizer::CheckPositiveList( const rtl::OString &rFileName )
-/*****************************************************************************/
+void handleFile(
+    rtl::OUString const & project, rtl::OUString const & projectRoot,
+    rtl::OUString const & url)
 {
-    std::size_t nIndex = 0;
-    sal_Bool bReturn  = sal_False;
-
-    rtl::OString sDelimiter(rtl::OUStringToOString(
-        DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US));
-
-    rtl::OString sFileName(rFileName.toAsciiLowerCase());
-
-    rtl::OString sNegative( PositiveList[ nIndex ] );
-    while (!sNegative.equalsL(RTL_CONSTASCII_STRINGPARAM("NULL")) && !bReturn) {
-        helper::searchAndReplaceAll(&sNegative, "\\", sDelimiter);
-        helper::searchAndReplaceAll(&sNegative, "/", sDelimiter);
-        sNegative = sNegative.toAsciiLowerCase();
-
-        if (sFileName.indexOf(sNegative)
-            == sFileName.getLength() - sNegative.getLength())
+    struct Command {
+        char const * extension;
+        sal_Int32 extensionLength;
+        char const * executable;
+        bool positive;
+    };
+    static Command const commands[] = {
+        { RTL_CONSTASCII_STRINGPARAM(".src"), "transex3", false },
+        { RTL_CONSTASCII_STRINGPARAM(".hrc"), "transex3", true },
+        { RTL_CONSTASCII_STRINGPARAM(".ulf"), "ulfex", false },
+        { RTL_CONSTASCII_STRINGPARAM(".xcu"), "cfgex", false },
+        { RTL_CONSTASCII_STRINGPARAM(".xrm"), "xrmex", false },
+        { RTL_CONSTASCII_STRINGPARAM(".xml"), "xrmex", true },
+        { RTL_CONSTASCII_STRINGPARAM(".xhp"), "helpex", false },
+        { RTL_CONSTASCII_STRINGPARAM(".properties"), "propex", false } };
+    for (std::size_t i = 0; i != SAL_N_ELEMENTS(commands); ++i) {
+        if (helper::endsWithAsciiL(
+                url, commands[i].extension, commands[i].extensionLength))
         {
-            bReturn = true;
+            handleCommand(
+                project, projectRoot, url,
+                rtl::OUString::createFromAscii(commands[i].executable),
+                commands[i].positive);
+            break;
         }
-
-        nIndex++;
-        sNegative = PositiveList[ nIndex ];
     }
-
-    return bReturn;
 }
 
-/*****************************************************************************/
-void SourceTreeLocalizer::WorkOnFileType(
-    const rtl::OString &rDirectory, const rtl::OString &rExtension,
-    const rtl::OString &rExecutable, const rtl::OString &rParameter,
-    const rtl::OString &rCollectMode
-)
-/*****************************************************************************/
-{
-    rtl::OUString sWild(
-        rtl::OStringToOUString(rDirectory, RTL_TEXTENCODING_ASCII_US));
-    sWild += DirEntry::GetAccessDelimiter();
-    sWild += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("*."));
-    sWild += rtl::OStringToOUString(rExtension, RTL_TEXTENCODING_ASCII_US);
-
-    Dir aDir(DirEntry(sWild), FSYS_KIND_FILE);
-
-    for ( sal_uInt16 i = 0; i < aDir.Count(); i++ )
-    {
-        DirEntry aFile( aDir[ i ] );
-        rtl::OString sFile(rtl::OUStringToOString(aFile.GetFull(), RTL_TEXTENCODING_ASCII_US));
-
-        sal_Bool bAllowed = sal_True;
-
-        if (rCollectMode.equalsL(RTL_CONSTASCII_STRINGPARAM("negative")))
-            bAllowed = CheckNegativeList( sFile );
-        else if (rCollectMode.equalsL(RTL_CONSTASCII_STRINGPARAM("positive")))
-            bAllowed = CheckPositiveList( sFile );
-
-        if ( bAllowed )
-            WorkOnFile( sFile, rExecutable, rParameter );
+bool includeDirectory(rtl::OUString const & directory) {
+    // Cf. OUTPATH=* in configure.in:
+    static AsciiString const excluded[] = {
+        { RTL_CONSTASCII_STRINGPARAM("unxaig") },
+        { RTL_CONSTASCII_STRINGPARAM("unxand") },
+        { RTL_CONSTASCII_STRINGPARAM("unxdfly") },
+        { RTL_CONSTASCII_STRINGPARAM("unxfbsd") },
+        { RTL_CONSTASCII_STRINGPARAM("unxios") },
+        { RTL_CONSTASCII_STRINGPARAM("unxkfg") },
+        { RTL_CONSTASCII_STRINGPARAM("unxlng") },
+        { RTL_CONSTASCII_STRINGPARAM("unxmac") },
+        { RTL_CONSTASCII_STRINGPARAM("unxnbsd") },
+        { RTL_CONSTASCII_STRINGPARAM("unxobsd") },
+        { RTL_CONSTASCII_STRINGPARAM("unxsog") },
+        { RTL_CONSTASCII_STRINGPARAM("unxsol") },
+        { RTL_CONSTASCII_STRINGPARAM("unxubt") },
+        { RTL_CONSTASCII_STRINGPARAM("wntmsc") } };
+    for (std::size_t i = 0; i != SAL_N_ELEMENTS(excluded); ++i) {
+        if (directory.matchAsciiL(excluded[i].string, excluded[i].length)) {
+            return false;
+        }
     }
+    return true;
 }
 
-void SourceTreeLocalizer::WorkOnDirectory(const rtl::OString &rDirectory)
+void handleDirectory(
+    rtl::OUString const & project, rtl::OUString const & projectRoot,
+    rtl::OUString const & url)
 {
-    //printf("Working on Directory %s\n",rDirectory.getStr());
-    std::size_t nIndex = 0;
-    rtl::OString sExtension( ExeTable[ nIndex ][ 0 ] );
-    rtl::OString sExecutable( ExeTable[ nIndex ][ 1 ] );
-    rtl::OString sParameter( ExeTable[ nIndex ][ 2 ] );
-    rtl::OString sCollectMode( ExeTable[ nIndex ][ 3 ] );
-
-    while (!sExtension.equalsL(RTL_CONSTASCII_STRINGPARAM("NULL"))) {
-        WorkOnFileType(
-            rDirectory,
-            sExtension,
-            sExecutable,
-            sParameter,
-            sCollectMode
-        );
-
-        nIndex++;
-
-        sExtension = ExeTable[ nIndex ][ 0 ];
-        sExecutable = ExeTable[ nIndex ][ 1 ];
-        sParameter = ExeTable[ nIndex ][ 2 ];
-        sCollectMode = ExeTable[ nIndex ][ 3 ];
+    osl::Directory dir(url);
+    if (dir.open() != osl::FileBase::E_None) {
+        std::cerr << "Error: Cannot open directory\n";
+        throw false; //TODO
+    }
+    for (;;) {
+        osl::DirectoryItem item;
+        osl::FileBase::RC e = dir.getNextItem(item);
+        if (e == osl::FileBase::E_NOENT) {
+            break;
+        }
+        if (e != osl::FileBase::E_None) {
+            std::cerr << "Error: Cannot read directory\n";
+            throw false; //TODO
+        }
+        osl::FileStatus stat(
+            osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileName
+            | osl_FileStatus_Mask_FileURL);
+        if (item.getFileStatus(stat) != osl::FileBase::E_None) {
+            std::cerr << "Error: Cannot get file status\n";
+            throw false; //TODO
+        }
+        if (stat.getFileType() == osl::FileStatus::Directory) {
+            if (includeDirectory(stat.getFileName())) {
+                rtl::OUString pr(projectRoot);
+                if (!pr.isEmpty()) {
+                    pr += rtl::OUString('/');
+                }
+                pr += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".."));
+                handleDirectory(project, pr, stat.getFileURL());
+            }
+        } else {
+            handleFile(project, projectRoot, stat.getFileURL());
+        }
+    }
+    if (dir.close() != osl::FileBase::E_None) {
+        std::cerr << "Error: Cannot close directory\n";
+        throw false; //TODO
     }
 }
 
-void SourceTreeLocalizer::OnExecuteDirectory(const rtl::OUString &aDirectory)
-{
-    if ( nMode != LOCALIZE_NONE )
-    {
-        rtl::OString rDirectory(rtl::OUStringToOString(aDirectory, RTL_TEXTENCODING_UTF8));
-        WorkOnDirectory( rDirectory );
+bool includeProject(rtl::OUString const & project) {
+    static char const * projects[] = {
+        "accessibility",
+        "avmedia",
+        "basctl",
+        "basic",
+        "chart2",
+        "connectivity",
+        "cui",
+        "dbaccess",
+        "desktop",
+        "dictionaries",
+        "editeng",
+        "extensions",
+        "filter",
+        "forms",
+        "formula",
+        "fpicker",
+        "framework",
+        "helpcontent2",
+        "instsetoo_native",
+        "mysqlc",
+        "nlpsolver",
+        "officecfg",
+        "padmin",
+        "readlicense_oo",
+        "reportbuilder",
+        "reportdesign",
+        "sc",
+        "scaddins",
+        "sccomp",
+        "scp2",
+        "scripting",
+        "sd",
+        "sdext",
+        "setup_native",
+        "sfx2",
+        "shell",
+        "starmath",
+        "svl",
+        "svtools",
+        "svx",
+        "sw",
+        "swext",
+        "sysui",
+        "uui",
+        "vcl",
+        "wizards",
+        "xmlsecurity" };
+    for (std::size_t i = 0; i != SAL_N_ELEMENTS(projects); ++i) {
+        if (project.equalsAscii(projects[i])) {
+            return true;
+        }
     }
+    return false;
 }
 
-sal_Bool SourceTreeLocalizer::Extract(const rtl::OString &rDestinationFile)
-{
-    nMode = LOCALIZE_EXTRACT;
-
-    aSDF.open(
-        rDestinationFile.getStr(), std::ios_base::out | std::ios_base::app);
-
-    sal_Bool bReturn = aSDF.is_open();
-    if ( bReturn )
+void handleProjects(char const * root) {
+    rtl::OUString root16;
+    if (!rtl_convertStringToUString(
+            &root16.pData, root, rtl_str_getLength(root),
+            osl_getThreadTextEncoding(),
+            (RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_ERROR
+             | RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_ERROR
+             | RTL_TEXTTOUNICODE_FLAGS_INVALID_ERROR)))
     {
-        bReturn = StartExecute();
+        std::cerr << "Error: Cannot convert pathname to UTF-16\n";
+        throw false; //TODO
     }
-    else
+    rtl::OUString rootUrl;
+    if (osl::FileBase::getFileURLFromSystemPath(root16, rootUrl)
+        != osl::FileBase::E_None)
     {
-        printf("ERROR: Can't create file %s\n", rDestinationFile.getStr());
+        std::cerr << "Error: Cannot convert pathname to URL\n";
+        throw false; //TODO
+    }
+    osl::Directory dir(rootUrl);
+    if (dir.open() != osl::FileBase::E_None) {
+        std::cerr << "Error: Cannot open directory\n";
+        throw false; //TODO
+    }
+    for (;;) {
+        osl::DirectoryItem item;
+        osl::FileBase::RC e = dir.getNextItem(item);
+        if (e == osl::FileBase::E_NOENT) {
+            break;
+        }
+        if (e != osl::FileBase::E_None) {
+            std::cerr << "Error: Cannot read directory\n";
+            throw false; //TODO
+        }
+        osl::FileStatus stat(
+            osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_FileURL);
+        if (item.getFileStatus(stat) != osl::FileBase::E_None) {
+            std::cerr << "Error: Cannot get file status\n";
+            throw false; //TODO
+        }
+        rtl::OUString prj(stat.getFileName());
+        if (includeProject(prj)) {
+            handleDirectory(prj, rtl::OUString(), stat.getFileURL());
+        }
+    }
+    if (dir.close() != osl::FileBase::E_None) {
+        std::cerr << "Error: Cannot close directory\n";
+        throw false; //TODO
     }
-    nMode = LOCALIZE_NONE;
-    aSDF.close();
-    return bReturn;
-}
-
-}
-using namespace transex3;
-
-/*****************************************************************************/
-void Help()
-/*****************************************************************************/
-{
-    fprintf( stdout,
-        "localize (c)2001 by Sun Microsystems\n"
-        "====================================\n" );
-    fprintf( stdout,
-        "As part of the L10N framework, localize extracts en-US strings for\n"
-        "translation out of the toplevel modules defined in ModuleList array in\n"
-        "l10ntools/source/localize.cxx.\n\n"
-        "Syntax: localize -f FileName \n"
-        "Parameter:\n"
-        "\tFileName: Output file\n"
-    );
 }
 
-/*****************************************************************************/
-int Error()
-/*****************************************************************************/
-{
-    Help();
-    return 1;
 }
 
-/*****************************************************************************/
-#if defined(UNX)
-int main( int argc, char *argv[] )
-#else
-int _cdecl main( int argc, char *argv[] )
-#endif
-/*****************************************************************************/
-{
-    rtl::OUString sTempBase(RTL_CONSTASCII_USTRINGPARAM("loc"));
-    DirEntry::SetTempNameBase( sTempBase );
-
-    bool bSkipLinks = false;
-
-    rtl::OString sFileName;
-
-    rtl::OString sLanguages(RTL_CONSTASCII_STRINGPARAM("en-US"));
-
-    rtl::OString sSwitch(rtl::OString(argv[1]).toAsciiUpperCase());
-
-    if ( ( argc == 3 ) && sSwitch.equalsL(RTL_CONSTASCII_STRINGPARAM("-F")) )
-        sFileName = rtl::OString( argv[ 2 ] );
-    else
-        return Error();
-
-    DirEntry aEntry(rtl::OStringToOUString(sFileName, RTL_TEXTENCODING_ASCII_US));
-    aEntry.ToAbs();
-    rtl::OUString sFullEntry(aEntry.GetFull());
-    rtl::OString sFileABS(rtl::OUStringToOString(aEntry.GetFull(), osl_getThreadTextEncoding()));
-    sFileName = sFileABS;
-
-    string pwd;
-    Export::getCurrentDir( pwd );
-    cout << "Localizing directory " << pwd << "\n";
-    SourceTreeLocalizer aIter( rtl::OString( pwd.c_str() ) , bSkipLinks );
-    aIter.SetLanguageRestriction( sLanguages );
-    aIter.Extract( sFileName );
-    printf("\n%d files found!\n",aIter.GetFileCnt());
-    return 0;
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
+    if (argc != 3) {
+        std::cerr
+            << ("localize (c)2001 by Sun Microsystems\n\n"
+                "As part of the L10N framework, localize extracts en-US\n"
+                "strings for translation out of the toplevel modules defined\n"
+                "in projects array in l10ntools/source/localize.cxx.\n\n"
+                "Syntax: localize <source-root> <outfile>\n");
+        std::exit(EXIT_FAILURE);
+    }
+    global::output.open(argv[2], std::ios_base::out | std::ios_base::trunc);
+    if (!global::output.is_open()) {
+        std::cerr << "Error: Cannot append to " << argv[2] << '\n';
+        std::exit(EXIT_FAILURE);
+    }
+    try {
+        handleProjects(argv[1]);
+    } catch (bool) { //TODO
+        return EXIT_FAILURE;
+    }
+    global::output.close();
+    return EXIT_SUCCESS;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/makefile.mk b/l10ntools/source/makefile.mk
index 597b614..bd9780b 100644
--- a/l10ntools/source/makefile.mk
+++ b/l10ntools/source/makefile.mk
@@ -53,7 +53,6 @@ OBJFILES=   			\
     $(OBJ)$/export.obj	\
     $(OBJ)$/export2.obj	\
     $(OBJ)$/merge.obj   \
-    $(OBJ)$/srciter.obj		\
     $(OBJ)$/xmlparse.obj    \
     $(OBJ)$/helpmerge.obj   \
     $(OBJ)$/helpex.obj      \
@@ -66,7 +65,6 @@ LIB1ARCHIV= $(LB)$/libtransex.a
 LIB1OBJFILES=        $(OBJ)$/export.obj      \
         $(OBJ)$/export2.obj     \
         $(OBJ)$/merge.obj   \
-        $(OBJ)$/srciter.obj             \
         $(OBJ)$/file.obj \
         $(OBJ)$/directory.obj
 
@@ -128,16 +126,12 @@ APP7STDLIBS+= \
             $(SALLIB)
 
 # localizer for l10n framework
-APP9TARGET= localize_sl
+APP9TARGET= localize
 EXCEPTIONSFILES=                            \
                     $(OBJ)$/localize.obj
-APP9OBJS=   $(OBJ)$/localize.obj $(OBJ)$/srciter.obj $(OBJ)$/export2.obj $(OBJ)$/file.obj $(OBJ)$/directory.obj
+APP9OBJS=   $(OBJ)$/localize.obj
 APP9RPATH=  NONE
 APP9STDLIBS+= \
-            $(TOOLSLIB) \
-            $(COMPHELPERLIB) \
-            $(ICUINLIB) \
-            $(ICUUCLIB) \
             $(SALLIB)
 
 DEPOBJFILES=$(APP1OBJS) $(APP2OBJS) $(APP3OBJS) $(APP4OBJS) $(APP5OBJS) $(APP6OBJS) $(APP7OBJS) $(APP8OBJS) $(APP9OBJS)
diff --git a/l10ntools/source/srciter.cxx b/l10ntools/source/srciter.cxx
deleted file mode 100644
index 85475ca..0000000
--- a/l10ntools/source/srciter.cxx
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org.  If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "sal/config.h"
-
-#include <cstddef>
-
-#include "srciter.hxx"
-#include <stdio.h>
-#include <rtl/strbuf.hxx>
-#include <tools/fsys.hxx>
-
-//
-// class SourceTreeIterator
-//
-
-SourceTreeIterator::SourceTreeIterator(const rtl::OString &rRootDirectory)
-    : bInExecute( sal_False )
-{
-    rtl::OUString sRootDirectory(rtl::OStringToOUString(rRootDirectory, RTL_TEXTENCODING_UTF8));
-    aRootDirectory = transex::Directory( sRootDirectory );
-}
-
-/*****************************************************************************/
-SourceTreeIterator::~SourceTreeIterator()
-/*****************************************************************************/
-{
-}
-
-/*****************************************************************************/
-void SourceTreeIterator::ExecuteDirectory( transex::Directory& aDirectory )
-/*****************************************************************************/
-{
-    if ( bInExecute ) {
-        rtl::OUString sDirName = aDirectory.getDirectoryName();
-
-        static rtl::OUString WCARD1 ( RTL_CONSTASCII_USTRINGPARAM("unxlng") );
-        static rtl::OUString WCARD2 ( RTL_CONSTASCII_USTRINGPARAM("unxsol") );
-        static rtl::OUString WCARD3 ( RTL_CONSTASCII_USTRINGPARAM("wntmsc") );
-        static rtl::OUString WCARD4 ( RTL_CONSTASCII_USTRINGPARAM("common") );
-        static rtl::OUString WCARD5 ( RTL_CONSTASCII_USTRINGPARAM("unxmac") );
-        static rtl::OUString WCARD6 ( RTL_CONSTASCII_USTRINGPARAM("unxubt") );
-        static rtl::OUString WCARD7 ( RTL_CONSTASCII_USTRINGPARAM(".git") );
-        static rtl::OUString WCARD8 ( RTL_CONSTASCII_USTRINGPARAM("clone") );
-        static rtl::OUString WCARD9 ( RTL_CONSTASCII_USTRINGPARAM("install") );
-        static rtl::OUString WCARDA ( RTL_CONSTASCII_USTRINGPARAM("wntgcc") );
-
-
-        if( sDirName.indexOf( WCARD1 , 0 ) > -1 ||
-            sDirName.indexOf( WCARD2 , 0 ) > -1 ||
-            sDirName.indexOf( WCARD3 , 0 ) > -1 ||
-            sDirName.indexOf( WCARD4 , 0 ) > -1 ||
-            sDirName.indexOf( WCARD5 , 0 ) > -1 ||
-            sDirName.indexOf( WCARD6 , 0 ) > -1 ||
-            sDirName.indexOf( WCARD7 , 0 ) > -1 ||
-#ifndef WNT
-            sDirName.indexOf( WCARD8 , 0 ) > -1 ||
-#endif
-            sDirName.indexOf( WCARD9 , 0 ) > -1 ||
-            sDirName.indexOf( WCARDA , 0 ) > -1
-           )    return;
-        //printf("**** %s \n", OUStringToOString( sDirName , RTL_TEXTENCODING_UTF8 , sDirName.getLength() ).getStr() );
-
-        rtl::OUString sDirNameTmp = aDirectory.getFullName();
-        rtl::OStringBuffer sDirNameTmpB( rtl::OUStringToOString( sDirNameTmp , RTL_TEXTENCODING_UTF8 , sDirName.getLength() ).getStr() );
-
-#ifdef WNT
-        sDirNameTmpB.append(RTL_CONSTASCII_STRINGPARAM("\\no_localization"));
-#else
-        sDirNameTmpB.append(RTL_CONSTASCII_STRINGPARAM("/no_localization"));
-#endif
-        //printf("**** %s \n", OUStringToOString( sDirNameTmp , RTL_TEXTENCODING_UTF8 , sDirName.getLength() ).getStr() );
-
-        DirEntry aDE(sDirNameTmpB.getStr());
-        if( aDE.Exists() )
-        {
-            //printf("#### no_localization file found ... skipping");
-            return;
-        }
-
-        aDirectory.setSkipLinks( bSkipLinks );
-        aDirectory.readDirectory();
-        OnExecuteDirectory( aDirectory.getFullName() );
-        if ( aDirectory.getSubDirectories().size() )
-            for ( std::size_t i=0;i < aDirectory.getSubDirectories().size();i++ )
-                ExecuteDirectory( aDirectory.getSubDirectories()[ i ] );
-    }
-}
-
-/*****************************************************************************/
-sal_Bool SourceTreeIterator::StartExecute()
-/*****************************************************************************/
-{
-
-    bInExecute = sal_True;                  // FIXME
-    ExecuteDirectory( aRootDirectory );
-
-    if ( bInExecute ) {                 // FIXME
-        bInExecute = sal_False;
-        return sal_True;
-    }
-    return sal_False;
-}
-
-/*****************************************************************************/
-void SourceTreeIterator::EndExecute()
-/*****************************************************************************/
-{
-    bInExecute = sal_False;
-}
-
-/*****************************************************************************/
-void SourceTreeIterator::OnExecuteDirectory( const rtl::OUString &rDirectory )
-/*****************************************************************************/
-{
-    fprintf( stdout, "%s\n", rtl::OUStringToOString( rDirectory, RTL_TEXTENCODING_UTF8, rDirectory.getLength() ).getStr() );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/l10ntools/source/srclex.l b/l10ntools/source/srclex.l
index d65f33c..12de543 100644
--- a/l10ntools/source/srclex.l
+++ b/l10ntools/source/srclex.l
@@ -23,6 +23,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#include "sal/main.h"
+
 #if defined __GNUC__
 #pragma GCC system_header
 #elif defined __SINPRO_CC
@@ -230,11 +232,7 @@ void yyerror( char *s )
 	SetError();
 }
 
-int
-#if defined WNT
-_cdecl
-#endif
-main(int argc, char ** argv) {
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
     yyin = init(argc, argv);
     yylex();
     Close();
diff --git a/l10ntools/source/xrmlex.l b/l10ntools/source/xrmlex.l
index 60da7be..5a2170f 100644
--- a/l10ntools/source/xrmlex.l
+++ b/l10ntools/source/xrmlex.l
@@ -22,6 +22,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#include "sal/main.h"
+
 #if defined __GNUC__
 #pragma GCC system_header
 #elif defined __SINPRO_CC
@@ -190,14 +192,7 @@ void yyerror ( const char *s )
 	SetError();
 }
 
-/*****************************************************************************/
-int
-#ifdef WNT
-_cdecl
-#endif
-main( int argc, char* argv[])
-/*****************************************************************************/
-{
+SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) {
 	/* error level */
 	int nRetValue = 0;
 	char *pOutput;
diff --git a/solenv/bin/localize b/solenv/bin/localize
deleted file mode 100755
index 7cf035c..0000000
--- a/solenv/bin/localize
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-if [ x${SOLARENV}x = xx ]; then
-    echo No environment found, please use 'setsolar'
-exit 1
-fi
-
-if [ "${OS?}" = MACOSX ]; then
-    export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH:+${DYLD_LIBRARY_PATH}:}${SOLARVERSION?}/${INPATH_FOR_BUILD?}/lib
-else
-    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${SOLARVERSION?}/${INPATH_FOR_BUILD?}/lib
-fi
-
-pushd $(pwd)
-cd ${SRC_ROOT}
-exec $SOLARVERSION/$INPATH_FOR_BUILD/bin/localize_sl "$@"
-popd
diff --git a/solenv/inc/unitools.mk b/solenv/inc/unitools.mk
index a46e082..0418fc1 100644
--- a/solenv/inc/unitools.mk
+++ b/solenv/inc/unitools.mk
@@ -31,7 +31,7 @@ ULFEX*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/ulfex
 XRMEX*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/xrmex
 CFGEX*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/cfgex
 AUTODOC*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/autodoc
-LOCALIZE_SL*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/localize_sl
+LOCALIZE*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/localize
 GSICHECK*=$(AUGMENT_LIBRARY_PATH) $(SOLARBINDIR)/gsicheck
 
 .IF "$(XSLTPROC)"==""


More information about the Libreoffice-commits mailing list