Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


On Sun, 2012-02-19 at 18:49 +0100, Gert van Valkenhoef wrote:
Thanks again for the help. Attached a new series of patches (cumulative 
with the previously sent ones and Caolan's), in which (I think) all the 
Java invocations have been removed in favor of using the C++ components:

Attached is an additional patch to stick together the code to date with
internal clucene and the "missing link" to use the OUString ctor that
takes UCS-4 strings. So with this applied additionally you should now be
able to type stuff help's search and see a list of results, so vital bit
apparently works :-)

I'll integrate all of this to master in the next day or two.

C.
From 1c6d7e36f8511e7987b006f9f08d82a87a5d0418 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Mon, 20 Feb 2012 20:42:19 +0000
Subject: [PATCH] use different OUString ctor for RTL_TEXTENCODING_UCS4

---
 clucene/Package_source.mk                          |    1 +
 configure.in                                       |   34 ++++++++++++++++++++
 l10ntools/prj/build.lst                            |    2 +-
 l10ntools/source/help/LuceneHelper.cxx             |   19 ++++-------
 l10ntools/source/help/makefile.mk                  |    7 +---
 scp2/source/ooo/file_library_ooo.scp               |   13 +++++++
 scp2/source/ooo/makefile.mk                        |    4 ++
 scp2/source/ooo/module_hidden_ooo.scp              |    3 ++
 solenv/inc/libs.mk                                 |    6 +++
 xmlhelp/source/cxxhelp/provider/makefile.mk        |    3 --
 .../source/helpcomponent/CLuceneHelpWrapper.cxx    |    5 ++-
 xmlhelp/source/helpcomponent/makefile.mk           |    5 +--
 12 files changed, 75 insertions(+), 27 deletions(-)

diff --git a/clucene/Package_source.mk b/clucene/Package_source.mk
index c51dbce..afafa18 100644
--- a/clucene/Package_source.mk
+++ b/clucene/Package_source.mk
@@ -46,6 +46,7 @@ $(eval $(call gb_CustomTarget_add_outdir_dependencies,clucene/source,\
        $(FIXED_TARFILE_LOCATION)/48d647fbd8ef8889e5a7f422c1bfda94-clucene-core-2.3.3.4.tar.gz \
 ))
 
+$(eval $(call 
gb_Package_add_file,clucene_source,inc/CLucene/clucene-config.h,src/shared/CLucene/clucene-config.h))
 $(eval $(call 
gb_Package_add_file,clucene_source,inc/CLucene/SharedHeader.h,src/shared/CLucene/SharedHeader.h))
 $(eval $(call 
gb_Package_add_file,clucene_source,inc/CLucene/index/DirectoryIndexReader.h,src/core/CLucene/index/DirectoryIndexReader.h))
 $(eval $(call 
gb_Package_add_file,clucene_source,inc/CLucene/index/Terms.h,src/core/CLucene/index/Terms.h))
diff --git a/configure.in b/configure.in
index e28e588..cf45a08 100644
--- a/configure.in
+++ b/configure.in
@@ -1110,6 +1110,10 @@ AC_ARG_WITH(system-jpeg,
     with_system_jpeg="$with_system_libs"
   fi])
 
+AC_ARG_WITH(system-clucene,
+    AS_HELP_STRING([--with-system-clucene],
+        [Use clucene already on system.]),,)
+
 AC_ARG_WITH(system-expat,
     AS_HELP_STRING([--with-system-expat],
         [Use expat already on system.]),,
@@ -5616,6 +5620,36 @@ fi
 AC_SUBST(SYSTEM_JPEG)
 
 dnl ===================================================================
+dnl Check for system clucene
+dnl ===================================================================
+AC_MSG_CHECKING([which clucene to use])
+if test "$with_system_clucene" = "yes"; then
+    AC_MSG_RESULT([external])
+    SYSTEM_CLUCENE=YES
+    PKG_CHECK_MODULES(LIBCLUCENE, libclucene-core)
+
+    AC_LANG_PUSH([C++])
+    save_CXXFLAGS=$CXXFLAGS
+    save_CPPFLAGS=$CPPFLAGS
+    CXXFLAGS="$CXXFLAGS $LIBCLUCENE_CFLAGS"
+    CPPFLAGS="$CPPFLAGS $LIBCLUCENE_CFLAGS"
+    AC_CHECK_HEADER([CLucene/analysis/cjk/CJKAnalyzer.h], [],
+                 [AC_MSG_ERROR([Your version of libclucene has contribs-lib missing.])], [])
+    CXXFLAGS=$save_CXXFLAGS
+    CPPFLAGS=$save_CPPFLAGS
+    AC_LANG_POP([C++])
+
+    LIBCLUCENE_LIBS="$LIBCLUCENE_LIBS -lclucene-contribs-lib"
+else
+    AC_MSG_RESULT([internal])
+    SYSTEM_CLUCENE=NO
+    BUILD_TYPE="$BUILD_TYPE CLUCENE"
+fi
+AC_SUBST(SYSTEM_CLUCENE)
+AC_SUBST(LIBCLUCENE_CFLAGS)
+AC_SUBST(LIBCLUCENE_LIBS)
+
+dnl ===================================================================
 dnl Check for system expat
 dnl ===================================================================
 AC_MSG_CHECKING([which expat to use])
diff --git a/l10ntools/prj/build.lst b/l10ntools/prj/build.lst
index 8e3ea70..372fcfe 100644
--- a/l10ntools/prj/build.lst
+++ b/l10ntools/prj/build.lst
@@ -1,4 +1,4 @@
-tr l10ntools : BERKELEYDB:berkeleydb EXPAT:expat LIBXSLT:libxslt sal NULL
+tr l10ntools : BERKELEYDB:berkeleydb EXPAT:expat LIBXSLT:libxslt CLUCENE:clucene sal NULL
 tr     l10ntools                                               usr1    -       all     tr_mkout 
NULL
 tr     l10ntools\inc                                   nmake   -       all     tr_inc NULL
 tr     l10ntools\source                                        nmake   -       all     tr_src 
tr_inc NULL
diff --git a/l10ntools/source/help/LuceneHelper.cxx b/l10ntools/source/help/LuceneHelper.cxx
index a88542f..762475b 100644
--- a/l10ntools/source/help/LuceneHelper.cxx
+++ b/l10ntools/source/help/LuceneHelper.cxx
@@ -8,26 +8,21 @@ std::vector<TCHAR> OUStringToTCHARVec(rtl::OUString const &rStr)
 
     //UTF-32
     std::vector<TCHAR> aRet;
-    for (sal_Int32 nStrIndex = 0; nStrIndex < rStr.getLength() + 1; )
+    for (sal_Int32 nStrIndex = 0; nStrIndex < rStr.getLength(); )
     {
         const sal_uInt32 nCode = rStr.iterateCodePoints(&nStrIndex);
         aRet.push_back(nCode);
     }
+    aRet.push_back(0);
     return aRet;
 }
 
-inline unsigned tstrlen(TCHAR const *str) {
-       unsigned i;
-       for (i = 0; str[i] != 0; ++i) {}
-       return i;
-}
-
 rtl::OUString TCHARArrayToOUString(TCHAR const *str)
 {
-       // UTF-16
-       if (sizeof(TCHAR) == sizeof(sal_Unicode))
-               return rtl::OUString((sal_Unicode*) str);
+    // UTF-16
+    if (sizeof(TCHAR) == sizeof(sal_Unicode))
+        return rtl::OUString((const sal_Unicode*)(str));
 
-       // UTF-32
-       return rtl::OUString((char*) str, tstrlen(str), RTL_TEXTENCODING_UCS4);
+    // UTF-32
+    return rtl::OUString((const sal_uInt32*)str, wcslen(str));
 }
diff --git a/l10ntools/source/help/makefile.mk b/l10ntools/source/help/makefile.mk
index a466e2c..2b7cdf3 100644
--- a/l10ntools/source/help/makefile.mk
+++ b/l10ntools/source/help/makefile.mk
@@ -77,9 +77,6 @@ NOOPTFILES=\
         $(SLO)$/HelpLinker.obj
 .ENDIF
 
-PKGCONFIG_MODULES=libclucene-core libclucene-contribs-lib
-.INCLUDE : pkg_config.mk
-
 APP1TARGET= $(TARGET)
 APP1OBJS=\
       $(OBJ)$/HelpLinker.obj \
@@ -93,7 +90,7 @@ APP2OBJS=\
       $(OBJ)$/HelpIndexer.obj \
       $(OBJ)$/HelpIndexer_main.obj
 APP2RPATH = NONE
-APP2STDLIBS+=$(SALLIB) $(PKGCONFIG_LIBS)
+APP2STDLIBS+=$(SALLIB) $(CLUCENELIB)
 
 SHL1TARGET     =$(LIBBASENAME)$(DLLPOSTFIX)
 SHL1LIBS=      $(SLB)$/$(TARGET).lib
@@ -103,7 +100,7 @@ SHL1IMPLIB  =i$(LIBBASENAME)
 SHL1IMPLIB     =$(LIBBASENAME)$(DLLPOSTFIX)
 .ENDIF
 SHL1DEF                =$(MISC)$/$(SHL1TARGET).def
-SHL1STDLIBS =$(SALLIB) $(BERKELEYLIB) $(XSLTLIB) $(EXPATASCII3RDLIB) $(PKGCONFIG_LIBS)
+SHL1STDLIBS =$(SALLIB) $(BERKELEYLIB) $(XSLTLIB) $(EXPATASCII3RDLIB) $(CLUCENELIB)
 SHL1USE_EXPORTS        =ordinal
 
 DEF1NAME       =$(SHL1TARGET) 
diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp
index b73ab3b..aa9a31fa 100644
--- a/scp2/source/ooo/file_library_ooo.scp
+++ b/scp2/source/ooo/file_library_ooo.scp
@@ -76,6 +76,19 @@ File gid_File_Lib_Cached1
   #endif
 End
 
+#ifndef SYSTEM_CLUCENE
+File gid_File_Lib_CLucene
+    LIB_FILE_BODY;
+    Styles = (PACKED);
+    Dir = SCP2_OOO_BIN_DIR;
+  #ifdef UNX
+    Name = STRING(CONCAT2(libclucene,UNXSUFFIX));
+  #else
+    Name = "clucene.dll";
+  #endif
+End
+#endif
+
 SPECIAL_COMPONENT_LIB_FILE(gid_File_Lib_Configmgr, configmgr.uno)
 
 #ifdef WITH_LDAP
diff --git a/scp2/source/ooo/makefile.mk b/scp2/source/ooo/makefile.mk
index bd1036b..e7e57db 100644
--- a/scp2/source/ooo/makefile.mk
+++ b/scp2/source/ooo/makefile.mk
@@ -101,6 +101,10 @@ SCPDEFS+=-DENABLE_CAIROCANVAS
 .ENDIF
 .ENDIF
 
+.IF "$(SYSTEM_LUCENE)" == "YES"
+SCPDEFS+=-DSYSTEM_LUCENE
+.ENDIF
+
 .IF "$(SYSTEM_EXPAT)" == "YES"
 SCPDEFS+=-DSYSTEM_EXPAT
 .ENDIF
diff --git a/scp2/source/ooo/module_hidden_ooo.scp b/scp2/source/ooo/module_hidden_ooo.scp
index de79930..63a5c9f 100644
--- a/scp2/source/ooo/module_hidden_ooo.scp
+++ b/scp2/source/ooo/module_hidden_ooo.scp
@@ -337,6 +337,9 @@ Module gid_Module_Root_Files_5
        gid_File_Lib_Stringresource,
        gid_File_Lib_Ldapbe2,
        gid_File_Lib_Cached1,
+#if ! defined SYSTEM_CLUCENE
+        gid_File_Lib_CLucene,
+#endif
         gid_File_Lib_CLuceneHelpWrapper,
        gid_File_Lib_Comphelper2,
        gid_File_Lib_Curl,
diff --git a/solenv/inc/libs.mk b/solenv/inc/libs.mk
index 12db54a..be93ae3 100644
--- a/solenv/inc/libs.mk
+++ b/solenv/inc/libs.mk
@@ -174,6 +174,11 @@ HM2LIBSH=-lhmwrpdll
 HM2LIBST=-lhmwrap
 LINGULIB=$(HM2LIBST)
 LNGLIB=-llng$(DLLPOSTFIX)
+.IF "$(SYSTEM_CLUCENE)"=="YES"
+CLUCENELIB=$(LIBCLUCENE_LIBS)
+.ELSE
+CLUCENELIB=-lclucene
+.ENDIF
 .IF "$(SYSTEM_EXPAT)"=="YES"
 EXPAT3RDLIB=-lexpat
 EXPATASCII3RDLIB=-lexpat
@@ -445,6 +450,7 @@ HM2LIBSH=hmwrpdll.lib
 HM2LIBST=hmwrap.lib
 LINGULIB=$(HM2LIBST)
 LNGLIB=ilng.lib
+CLUCENELIB=clucene.lib
 EXPAT3RDLIB=expat_xmltok.lib expat_xmlparse.lib
 EXPATASCII3RDLIB=expat_xmltok.lib ascii_expat_xmlparse.lib
 ZLIB3RDLIB=zlib.lib
diff --git a/xmlhelp/source/cxxhelp/provider/makefile.mk 
b/xmlhelp/source/cxxhelp/provider/makefile.mk
index 4c9a099..b709797 100644
--- a/xmlhelp/source/cxxhelp/provider/makefile.mk
+++ b/xmlhelp/source/cxxhelp/provider/makefile.mk
@@ -67,9 +67,6 @@ LIBXSLTINCDIR=external$/libxslt
 CFLAGS+= -I$(SOLARINCDIR)$/$(LIBXSLTINCDIR)
 .ENDIF
 
-PKGCONFIG_MODULES=libclucene-core libclucene-contribs-lib
-.INCLUDE : pkg_config.mk
-
 .IF "$(GUI)"=="WNT"
 .IF "$(COM)"=="MSC"
 CFLAGS+=-GR
diff --git a/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.cxx 
b/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.cxx
index fb53fab..40ee9be 100644
--- a/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.cxx
+++ b/xmlhelp/source/helpcomponent/CLuceneHelpWrapper.cxx
@@ -61,7 +61,7 @@ public:
     }
     virtual Any SAL_CALL invoke(const OUString& FunctionName, const Sequence< Any >& Params, 
Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam)
         throw( IllegalArgumentException, CannotConvertException, InvocationTargetException, 
RuntimeException );
-    virtual void SAL_CALL setValue(const OUString& PropertyName, const Any& Value)
+    virtual void SAL_CALL setValue(const OUString&, const Any&)
         throw( UnknownPropertyException, CannotConvertException, InvocationTargetException, 
RuntimeException )
     {
         throw UnknownPropertyException();
@@ -83,7 +83,7 @@ public:
 
 #include <stdio.h> // FIXME: remove once the fprintf() calls below are gone
 
-Any CLuceneHelpWrapper::invoke(const OUString& rFunctionName, const Sequence< Any >& Params, 
Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam)
+Any CLuceneHelpWrapper::invoke(const OUString& rFunctionName, const Sequence< Any >&, Sequence< 
sal_Int16 >&, Sequence< Any >& )
         throw( IllegalArgumentException, CannotConvertException, InvocationTargetException, 
RuntimeException )
 {
     fprintf(stderr, "invoke something or other, %s\n", rtl::OUStringToOString(rFunctionName, 
RTL_TEXTENCODING_UTF8).getStr());
@@ -93,6 +93,7 @@ Any CLuceneHelpWrapper::invoke(const OUString& rFunctionName, const Sequence< An
         fprintf(stderr, "implement me, do indexing thing for extensions with help, but without 
pre-created index, make need to split l10ntools HelpIndexer tool into a lib and header that we can 
link to here");
     else
         throw IllegalArgumentException();
+    return Any();
 }
 
 namespace
diff --git a/xmlhelp/source/helpcomponent/makefile.mk b/xmlhelp/source/helpcomponent/makefile.mk
index 50b635e..18cf4dc 100755
--- a/xmlhelp/source/helpcomponent/makefile.mk
+++ b/xmlhelp/source/helpcomponent/makefile.mk
@@ -37,9 +37,6 @@ ENABLE_EXCEPTIONS=TRUE
 SLOFILES=\
     $(SLO)$/CLuceneHelpWrapper.obj
 
-PKGCONFIG_MODULES=libclucene-core
-.INCLUDE : pkg_config.mk
-
 LIB1TARGET=$(SLB)$/_$(TARGET).lib
 LIB1OBJFILES=$(SLOFILES)
 
@@ -52,7 +49,7 @@ SHL1STDLIBS=\
     $(COMPHELPERLIB) \
     $(UNOTOOLSLIB) \
     $(SALLIB) \
-    $(PKGCONFIG_LIBS)
+    $(LIBCLUCENE_LIBS)
 SHL1VERSIONMAP=$(SOLARENV)/src/component.map
  
 .INCLUDE :  target.mk
-- 
1.7.7.6


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.