summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2008-12-30 13:32:01 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2008-12-30 13:32:01 +0000
commit76e1e28426639255b1d4d78d8fb65d12dfd1ad2c (patch)
tree167d6663963ea95c53b14a076f3e341d2a024da2
parent19a83a9d1bd4b6b12714df1ef3a7333666989aff (diff)
CWS-TOOLING: integrate CWS sb102
2008-12-11 16:18:12 +0100 sb r265332 : #i95065# cleanup, to make Windows linking work 2008-12-11 16:16:03 +0100 sb r265331 : #i95065# missing SAL_DLLPUBLIC_EXPORT 2008-12-09 17:40:28 +0100 sb r265122 : #i94469# move CJK specific configuration data to brand layer 2008-12-09 16:09:08 +0100 sb r265112 : #i96959# use PTHREAD_MUTEX_RECURSIVE on all platforms 2008-12-09 15:54:31 +0100 sb r265110 : #i95065# do not derive apphelper::LifeTimeGuard from osl::ResettableMutexGuard to avoid problems with VISIBILITY_HIDDEN=TRUE on MSC 2008-12-09 15:40:51 +0100 sb r265104 : #i95065# add VISIBILITY_HIDDEN=TRUE to connectivity/source/drivers/mozab 2008-12-09 15:36:21 +0100 sb r265102 : #i95501# updated SDK_HOME 2008-12-09 15:31:46 +0100 sb r265099 : typo (temppath vs. tmppath) 2008-12-08 11:48:08 +0100 sb r264979 : #i95065# removed spurious ExplicitCategoriesProvider.obj (ExplicitCategoriesProvider.cxx is not in this directory) 2008-12-07 19:41:07 +0100 sb r264960 : #i96994# erroneously doubled backslash caused visibility feature to be disabled for all GCC versions on Mac OS X 2008-12-06 23:54:49 +0100 sb r264948 : changes from trunk that CWS-TOOLING's rebase to DEV300:m37 (r264891) had missed, as files had been moved around on this CWS 2008-12-05 20:29:23 +0100 sb r264919 : #i85508# versions of flex apparently differ in whether input() resp. yyinput() returns zero or EOF upon end of file 2008-12-05 15:37:23 +0100 sb r264908 : #i95315# removed obsolete jut 2008-12-05 15:34:59 +0100 sb r264907 : #i95531# removed empty obsolete directories 2008-12-05 10:09:23 +0100 sb r264891 : CWS-TOOLING: rebase CWS sb102 to trunk@264807 (milestone: DEV300:m37) 2008-12-04 14:50:20 +0100 sb r264845 : #i95065# introduced VISIBILITY_HIDDEN makefile flag to reduce duplications; made additional libraries use VISIBILITY_HIDDEN=TRUE to avoid warnings with recent GCC 4 versions (had to split certain code directories to make changes that would otherwise erroneously affect multiple libraries built in the same makefile); changed connectivity::ORefVector to no longer derive from std::vector, as that caused problems with the MSC implementation of VISIBILITY_HIDDEN=TRUE; replaced uses of JNIEXPORT with SAL_DLLPUBLIC_EXPORT, as the former does not expand to visibility attributes on some platforms where the latter does 2008-12-03 11:29:38 +0100 sb r264759 : #i94583# remove unnecessary (and wrong) assertion check for rtl_getAppCommandArg return value (which is guaranteed to return osl_Process_E_None or not return at all) 2008-12-02 17:18:31 +0100 sb r264724 : #i96809# silenced GCC 4.3.2 warning 2008-12-02 13:29:34 +0100 sb r264695 : #i96797# make get_tmp_dir fail less often 2008-11-28 17:19:24 +0100 sb r264566 : #i95691# inadvertently missing from -c 264564 2008-11-28 17:07:50 +0100 sb r264564 : #i95691# only structs of exactly 1, 2, 4, or 8 bytes are returned through registers 2008-11-25 13:28:08 +0100 sb r264291 : #i96427# support for SAL_EXCEPTION_DLLPUBLIC_EXPORT (patch by np) 2008-11-21 14:45:22 +0100 sb r264140 : #i95428# added SAL_EXCEPTION_DLLPUBLIC_EXPORT and SAL_EXCEPTION_DLLPRIVATE 2008-11-19 13:19:37 +0100 sb r263984 : #i95525# removed erroneous application/octet-stream svn:mime-type properties
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_intel/share.hxx2
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx11
-rw-r--r--cppu/inc/cppu/macros.hxx9
-rw-r--r--jut/com/sun/star/tools/uno/DumpType.java122
-rw-r--r--jut/com/sun/star/tools/uno/DumpTypeDescription.java181
-rw-r--r--jut/com/sun/star/tools/uno/RegComp.java92
-rw-r--r--jut/com/sun/star/tools/uno/RegistryKey.java241
-rw-r--r--jut/com/sun/star/tools/uno/UnoApp.java894
-rw-r--r--jut/com/sun/star/tools/uno/makefile.mk53
-rw-r--r--jut/prj/build.lst4
-rw-r--r--jut/prj/d.lst3
-rw-r--r--jut/util/delzip0
-rw-r--r--jut/util/makefile.mk56
-rw-r--r--jut/util/makefile.pmk36
-rw-r--r--jut/util/manifest1
-rw-r--r--sal/inc/rtl/malformeduriexception.hxx18
-rw-r--r--sal/inc/sal/types.h14
-rw-r--r--sal/osl/unx/mutex.c280
-rw-r--r--ure/source/uretest/Makefile.pln2
19 files changed, 61 insertions, 1958 deletions
diff --git a/bridges/source/cpp_uno/gcc3_macosx_intel/share.hxx b/bridges/source/cpp_uno/gcc3_macosx_intel/share.hxx
index 477b885f4..9900220b3 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_intel/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_intel/share.hxx
@@ -37,7 +37,7 @@
namespace CPPU_CURRENT_NAMESPACE
{
-bool isSimpleReturnType(typelib_TypeDescription * pTD);
+bool isSimpleReturnType(typelib_TypeDescription * pTD, bool recursive = false);
void dummy_can_throw_anything( char const * );
diff --git a/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx
index 0c4485a0a..5a7f8b13e 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_intel/uno2cpp.cxx
@@ -347,17 +347,22 @@ static void cpp_call(
}
namespace CPPU_CURRENT_NAMESPACE {
-bool isSimpleReturnType(typelib_TypeDescription * pTD)
+bool isSimpleReturnType(typelib_TypeDescription * pTD, bool recursive)
{
if (bridges::cpp_uno::shared::isSimpleType( pTD ))
return true;
- if (pTD->eTypeClass == typelib_TypeClass_STRUCT && pTD->nSize <= 8) {
+ // Only structs of exactly 1, 2, 4, or 8 bytes are returned through
+ // registers, see <http://developer.apple.com/documentation/DeveloperTools/
+ // Conceptual/LowLevelABI/Articles/IA32.html>:
+ if (pTD->eTypeClass == typelib_TypeClass_STRUCT &&
+ (recursive || pTD->nSize <= 2 || pTD->nSize == 4 || pTD->nSize == 8))
+ {
typelib_CompoundTypeDescription *const pCompTD =
(typelib_CompoundTypeDescription *) pTD;
for ( sal_Int32 pos = pCompTD->nMembers; pos--; ) {
typelib_TypeDescription * pMemberTD = 0;
TYPELIB_DANGER_GET( &pMemberTD, pCompTD->ppTypeRefs[pos] );
- bool const b = isSimpleReturnType(pMemberTD);
+ bool const b = isSimpleReturnType(pMemberTD, true);
TYPELIB_DANGER_RELEASE( pMemberTD );
if (! b)
return false;
diff --git a/cppu/inc/cppu/macros.hxx b/cppu/inc/cppu/macros.hxx
index 18eaf16a6..0ae12a89a 100644
--- a/cppu/inc/cppu/macros.hxx
+++ b/cppu/inc/cppu/macros.hxx
@@ -61,13 +61,8 @@
@internal
*/
-#if defined __GNUC__
-#define CPPU_GCC_DLLPUBLIC_EXPORT SAL_DLLPUBLIC_EXPORT
-#define CPPU_GCC_DLLPRIVATE SAL_DLLPRIVATE
-#else
-#define CPPU_GCC_DLLPUBLIC_EXPORT
-#define CPPU_GCC_DLLPRIVATE
-#endif
+#define CPPU_GCC_DLLPUBLIC_EXPORT SAL_EXCEPTION_DLLPUBLIC_EXPORT
+#define CPPU_GCC_DLLPRIVATE SAL_EXCEPTION_DLLPRIVATE
#endif // _CPPU_MACROS_HXX_
diff --git a/jut/com/sun/star/tools/uno/DumpType.java b/jut/com/sun/star/tools/uno/DumpType.java
deleted file mode 100644
index cb63f3371..000000000
--- a/jut/com/sun/star/tools/uno/DumpType.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: DumpType.java,v $
- * $Revision: 1.6 $
- *
- * 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.
- *
- ************************************************************************/
-
-package com.sun.star.tools.uno;
-
-
-import com.sun.star.comp.helper.RegistryServiceFactory;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.registry.XImplementationRegistration;
-
-import com.sun.star.uno.Type;
-/** A command-line tool. Prints information about com.sun.star.uno.Type to error stream.
- */
-public class DumpType {
- static private final String[] __typeClassToTypeName = new String[]{
- "void",
- "char",
- "boolean",
- "byte",
- "short",
- "unsigned short",
- "long",
- "unsigned long",
- "hyper",
- "unsigned hyper",
- "float",
- "double",
- "string",
- "type",
- "any",
- "enum",
- "typedef",
- "struct",
- "union",
- "exception",
- "sequence",
- "array",
- "interface",
- "service",
- "module",
- "interface_method",
- "interface_attribute",
- "unknown"
- };
-
- /** Prints information about argument type to the standard error stream.
- The information consists of type name, type description, class name,
- as well as the type class.
- @param type the Type object whoose information are printed.
- */
- static public void dumpType(Type type) throws Exception {
- System.err.println("uno type name:" + type.getTypeName());
- System.err.println("description:" + type.getTypeDescription());
- System.err.println("java class:" + type.getZClass());
-
- System.err.println("type class:" + __typeClassToTypeName[type.getTypeClass().getValue()]);
- }
-
- /** Executes this tool.
- The command line arguments consist of an identifier followed by a type name.
- Identifiers can either be uno or java. Based on the type name, a com.sun.star.uno.Type
- object is constructed whose information are then printed out to the error stream.
- <br>
- usage: [uno &lt;type name&gt;]|[java &lt;class name&gt]* <br>
- Examples: <br>
- java com.sun.star.uno.tools.DumpType uno com.sun.star.lang.XMultiServiceFactory
- java com.sun.star.uno.tools.DumpType java java.lang.Byte java java.lang.String
- @param args command line arguments
- */
- static public void main(String args[]) throws Exception {
- if(args.length == 0)
- System.err.println("usage: [uno <type name>]|[java <class name>]*");
-
- else {
- int i = 0;
- while(i < args.length) {
- Type type = null;
-
- if(args[i].equals("uno"))
- type = new Type(args[i + 1]);
-
- else
- type = new Type(Class.forName(args[i + 1]));
-
- i += 2;
-
-
- dumpType(type);
- }
- }
- }
-}
-
-
diff --git a/jut/com/sun/star/tools/uno/DumpTypeDescription.java b/jut/com/sun/star/tools/uno/DumpTypeDescription.java
deleted file mode 100644
index 057a6e24f..000000000
--- a/jut/com/sun/star/tools/uno/DumpTypeDescription.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: DumpTypeDescription.java,v $
- * $Revision: 1.4 $
- *
- * 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.
- *
- ************************************************************************/
-
-package com.sun.star.tools.uno;
-
-
-import com.sun.star.comp.helper.RegistryServiceFactory;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.registry.XImplementationRegistration;
-
-
-import com.sun.star.lib.uno.typedesc.TypeDescription;
-
-import com.sun.star.uno.IFieldDescription;
-import com.sun.star.uno.IMethodDescription;
-import com.sun.star.uno.ITypeDescription;
-import com.sun.star.uno.Type;
-
-/** A command-line tool. Prints information of com.sun.star.lib.uno.typedesc.TypeDescription objects to the
- error stream.
- */
-public class DumpTypeDescription {
-
- /** Prints information about a TypeDescription object that has been constructed based
- on the argument <i>typeName</i>. The output is written to the error stream.
- The information consists of general as well as method and member information.
- These are:<br>
- <ul>
- <li>type name</li>
- <li>array type name</li>
- <li>type of the super class</li>
- <li>type class</li>
- <li>component type</li>
- <li>java.lang.Class object</li>
- </ul>
- Method information:
- <ul>
- <li>name</li>
- <li>index</li>
- <li>is one way</li>
- <li>is unsigned</li>
- <li>is Any</li>
- <li>is interface</li>
- <li>in signature</li>
- <li>out signature</li>
- <li>return signature</li>
- <li>java.lang.reflect.Method object</li>
- </ul>
-
- Field information:
- <ul>
- <li>name</li>
- <li>index</li>
- <li>is one way</li>
- <li>is unsigned</li>
- <li>is Any</li>
- <li>is interface</li>
- <li>com.sun.star.lib.uno.typedesc.TypeDescription object</li>
- </ul>
-
- @param typeName name of a type for which an TypeDescription object
- is constructed whoose information are printed.
- */
- static public void dumpTypeDescription(String typeName) throws Exception {
- ITypeDescription iTypeDescription = TypeDescription.getTypeDescription(typeName);
-
- System.err.println("TypeName:" + iTypeDescription.getTypeName());
- System.err.println("ArrayTypeName:" + iTypeDescription.getArrayTypeName());
- System.err.println("SuperType:" + iTypeDescription.getSuperType());
- System.err.println("TypeClass:" + iTypeDescription.getTypeClass());
- System.err.println("ComponentType:" + iTypeDescription.getComponentType());
- System.err.println("Class:" + iTypeDescription.getZClass());
-
- System.err.println("Methods:");
- IMethodDescription iMethodDescriptions[] = iTypeDescription.getMethodDescriptions();
- if(iMethodDescriptions != null)
- for(int i = 0; i < iMethodDescriptions.length; ++ i) {
- System.err.print("Name: " + iMethodDescriptions[i].getName());
- System.err.print(" index: " + iMethodDescriptions[i].getIndex());
- System.err.print(" isOneyWay: " + iMethodDescriptions[i].isOneway());
-// System.err.print(" isConst: " + iMethodDescriptions[i].isConst());
- System.err.print(" isUnsigned: " + iMethodDescriptions[i].isUnsigned());
- System.err.print(" isAny: " + iMethodDescriptions[i].isAny());
- System.err.println("\tisInterface: " + iMethodDescriptions[i].isInterface());
-
- System.err.print("\tgetInSignature: ");
- ITypeDescription in_sig[] = iMethodDescriptions[i].getInSignature();
- for(int j = 0; j < in_sig.length; ++ j)
- System.err.print("\t\t" + in_sig[j]);
- System.err.println();
-
- System.err.print("\tgetOutSignature: ");
- ITypeDescription out_sig[] = iMethodDescriptions[i].getOutSignature();
- for(int j = 0; j < out_sig.length; ++ j)
- System.err.print("\t\t" + out_sig[j]);
- System.err.println();
-
- System.err.println("\tgetReturnSig: " + iMethodDescriptions[i].getReturnSignature());
- System.err.println("\tgetMethod:" + iMethodDescriptions[i].getMethod());
- }
- System.err.println();
-
- System.err.println("Members:");
- IFieldDescription iFieldDescriptions[] = iTypeDescription.getFieldDescriptions();
- if(iFieldDescriptions != null)
- for(int i = 0; i < iFieldDescriptions.length; ++ i) {
- System.err.print("\tMember: " + iFieldDescriptions[i].getName());
-// System.err.print(" isConst: " + iMethodDescriptions[i].isConst());
- System.err.print(" isUnsigned: " + iFieldDescriptions[i].isUnsigned());
- System.err.print(" isAny: " + iFieldDescriptions[i].isAny());
- System.err.print("\tisInterface: " + iFieldDescriptions[i].isInterface());
- System.err.println("\tclass: " + iFieldDescriptions[i].getTypeDescription());
-
- }
- }
- /** Executes this tool.
- The command line arguments consist of an identifier followed by a type name.
- Identifiers can either be uno or java. Based on the type name, a
- com.sun.star.lib.uno.typedesc.TypeDescription
- object is constructed whose information are then printed out to the error stream.
- <br>
- usage: [uno &lt;type name&gt;]|[java &lt;class name&gt]* <br>
- Examples: <br>
- java com.sun.star.uno.tools.DumpTypeDescription uno com.sun.star.lang.XMultiServiceFactory
- java com.sun.star.uno.tools.DumpTypeDescription java java.lang.Byte java java.lang.String
- @param args command line arguments
-
- */
- static public void main(String args[]) throws Exception {
- if(args.length == 0)
- System.err.println("usage: [uno <type name>]|[java <class name>]*");
-
- else {
- int i = 0;
- while(i < args.length) {
- Type type = null;
-
- if(args[i].equals("uno"))
- type = new Type(args[i + 1]);
-
- else
- type = new Type(Class.forName(args[i + 1]));
-
- i += 2;
-
-
- dumpTypeDescription(type.getTypeName());
- }
- }
- }
-}
-
-
diff --git a/jut/com/sun/star/tools/uno/RegComp.java b/jut/com/sun/star/tools/uno/RegComp.java
deleted file mode 100644
index 58f404ce0..000000000
--- a/jut/com/sun/star/tools/uno/RegComp.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: RegComp.java,v $
- * $Revision: 1.4 $
- *
- * 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.
- *
- ************************************************************************/
-
-package com.sun.star.tools.uno;
-
-
-import com.sun.star.comp.helper.RegistryServiceFactory;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.registry.XImplementationRegistration;
-
-/** A command-line tool. It registers an UNO component with a registry database.
- During registration the component will be instantiated and be asked
- to write the necessary information to the database.
- Command line arguments:<br>
- database register|unregister locationURL loader
- <br>
- For example:
- <pre>
- java com.sun.star.tools.RegComp applicat.rdb register
- file:///e:/demos/InstanceInspector.jar com.sun.star.loader.Java2
- </pre>
-
- In order to examine the results of the registration use the regview.exe
- tool. For example:
- <pre>
- regview nameOfDatatbase /SERVICES/serviceName
- regview nameOfDataBase /IMPLEMENTATIONS/implementationName
- </pre>
- @see <a href="http://udk.openoffice.org/java/man/register_java_components.html">Registering Java Components</a>
- */
-public class RegComp {
-
- static public void main(String args[]) throws Exception {
- if(args.length != 0) {
- Object serviceManager = RegistryServiceFactory.create(args[0]);
- XMultiServiceFactory serviceManager_xMultiServiceFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, serviceManager);
-
- Object implementationRegistration = serviceManager_xMultiServiceFactory.createInstance("com.sun.star.registry.ImplementationRegistration");
- XImplementationRegistration implementationRegistration_xImplementationRegistration =
- (XImplementationRegistration)UnoRuntime.queryInterface(XImplementationRegistration.class, implementationRegistration);
-
- if(args[1].equals("register")) {
- System.err.println("------ registering " + args[2] + " with " + args[3] + " in " + args[0]);
-
- implementationRegistration_xImplementationRegistration.registerImplementation(args[3], args[2], null);
- }
- else {
- System.err.println("------ revoke " + args[2] + " of " + args[0]);
-
- implementationRegistration_xImplementationRegistration.revokeImplementation(args[2], null);
- }
- }
- else {
- System.err.println("usage: <applicat> ");
- System.err.println("\tregister <url> <loader>");
- System.err.println("\trevoke <url>");
- }
-
- System.exit(0);
-
- }
-
-}
-
diff --git a/jut/com/sun/star/tools/uno/RegistryKey.java b/jut/com/sun/star/tools/uno/RegistryKey.java
deleted file mode 100644
index 5b2e1fa71..000000000
--- a/jut/com/sun/star/tools/uno/RegistryKey.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: RegistryKey.java,v $
- * $Revision: 1.3 $
- *
- * 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.
- *
- ************************************************************************/
-
-package com.sun.star.tools.uno;
-
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-
-import com.sun.star.registry.InvalidRegistryException;
-import com.sun.star.registry.InvalidValueException;
-import com.sun.star.registry.RegistryKeyType;
-import com.sun.star.registry.RegistryValueType;
-import com.sun.star.registry.XRegistryKey;
-
-
-/**
- * This is a dummy registry implementation,
- * which only implmenets the needed methods.
- */
-class RegistryKey implements XRegistryKey {
- protected RegistryValueType _registryValueType = RegistryValueType.NOT_DEFINED;
-
- protected String _name;
- protected Hashtable _keys = new Hashtable();
-
- protected int _long;
- protected int _long_list[];
- protected String _ascii;
- protected String _ascii_list[];
- protected String _string;
- protected String _string_list[];
- protected byte _binary[];
-
- public RegistryKey(String name) {
- _name = name;
- }
-
-
- // XRegistryKey Attributes
- public String getKeyName() throws com.sun.star.uno.RuntimeException {
- return _name;
- }
-
- // XRegistryKey Methods
- public boolean isReadOnly() throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- return false;
- }
-
- public boolean isValid() throws com.sun.star.uno.RuntimeException {
- return true;
- }
-
- public RegistryKeyType getKeyType( /*IN*/String rKeyName ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- return RegistryKeyType.KEY;
- }
-
- public RegistryValueType getValueType() throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- return _registryValueType;
- }
-
- public int getLongValue() throws InvalidRegistryException, InvalidValueException, com.sun.star.uno.RuntimeException {
- if(_registryValueType != RegistryValueType.LONG)
- throw new InvalidValueException("long");
-
- return _long;
- }
-
- public void setLongValue( /*IN*/int value ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- _registryValueType = RegistryValueType.LONG;
-
- _long = value;
- }
-
- public int[] getLongListValue() throws InvalidRegistryException, InvalidValueException, com.sun.star.uno.RuntimeException {
- if(_registryValueType != RegistryValueType.LONGLIST)
- throw new InvalidValueException("longlist");
-
- return _long_list;
- }
-
- public void setLongListValue( /*IN*/int[] seqValue ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- _registryValueType = RegistryValueType.LONGLIST;
-
- _long_list = seqValue;
- }
-
- public String getAsciiValue() throws InvalidRegistryException, InvalidValueException, com.sun.star.uno.RuntimeException {
- if(_registryValueType != RegistryValueType.ASCII)
- throw new InvalidValueException("ascii");
-
- return _ascii;
- }
-
- public void setAsciiValue( /*IN*/String value ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- _registryValueType = RegistryValueType.ASCII;
-
- _ascii = value;
- }
-
- public String[] getAsciiListValue() throws InvalidRegistryException, InvalidValueException, com.sun.star.uno.RuntimeException {
- if(_registryValueType != RegistryValueType.ASCIILIST)
- throw new InvalidValueException("asciilist");
-
- return _ascii_list;
- }
-
- public void setAsciiListValue( /*IN*/String[] seqValue ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- _registryValueType = RegistryValueType.ASCIILIST;
-
- _ascii_list = seqValue;
- }
-
- public String getStringValue() throws InvalidRegistryException, InvalidValueException, com.sun.star.uno.RuntimeException {
- if(_registryValueType != RegistryValueType.STRING)
- throw new InvalidValueException("string");
-
- return _string;
- }
-
- public void setStringValue( /*IN*/String value ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- _registryValueType = RegistryValueType.STRING;
-
- _string = value;
- }
-
- public String[] getStringListValue() throws InvalidRegistryException, InvalidValueException, com.sun.star.uno.RuntimeException {
- if(_registryValueType != RegistryValueType.STRINGLIST)
- throw new InvalidValueException("string_list");
-
- return _string_list;
- }
-
- public void setStringListValue( /*IN*/String[] seqValue ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- _registryValueType = RegistryValueType.STRINGLIST;
-
- _string_list = seqValue;
- }
-
- public byte[] getBinaryValue() throws InvalidRegistryException, InvalidValueException, com.sun.star.uno.RuntimeException {
- if(_registryValueType != RegistryValueType.BINARY)
- throw new InvalidValueException("longlist");
-
- return _binary;
- }
-
- public void setBinaryValue( /*IN*/byte[] value ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- _registryValueType = RegistryValueType.BINARY;
-
- _binary = value;
- }
-
- public XRegistryKey openKey( /*IN*/String aKeyName ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- return (XRegistryKey)_keys.get(aKeyName);
- }
-
- public XRegistryKey createKey( /*IN*/String aKeyName ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- XRegistryKey xRegistryKey = openKey(aKeyName);
-
- if(xRegistryKey == null) {
- xRegistryKey = new RegistryKey(aKeyName);
- _keys.put(aKeyName, xRegistryKey);
- }
-
- return xRegistryKey;
- }
-
- public void closeKey() throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- }
-
- public void deleteKey( /*IN*/String rKeyName ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- _keys.remove(rKeyName);
- }
-
- public synchronized XRegistryKey[] openKeys() throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- RegistryKey registryKeys[] = new RegistryKey[_keys.size()];
-
- Enumeration elements = _keys.elements();
- int i = 0;
- while(elements.hasMoreElements()) {
- registryKeys[i ++] = (RegistryKey)elements.nextElement();
- }
-
- return registryKeys;
- }
-
- public synchronized String[] getKeyNames() throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- String strings[] = new String[_keys.size()];
-
- Enumeration elements = _keys.keys();
- int i = 0;
- while(elements.hasMoreElements()) {
- strings[i ++] = (String)elements.nextElement();
- }
-
- return strings;
- }
-
- public boolean createLink( /*IN*/String aLinkName, /*IN*/String aLinkTarget ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- return false;
- }
-
- public void deleteLink( /*IN*/String rLinkName ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- }
-
- public String getLinkTarget( /*IN*/String rLinkName ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- return null;
- }
-
- public String getResolvedName( /*IN*/String aKeyName ) throws InvalidRegistryException, com.sun.star.uno.RuntimeException {
- return null;
- }
-}
diff --git a/jut/com/sun/star/tools/uno/UnoApp.java b/jut/com/sun/star/tools/uno/UnoApp.java
deleted file mode 100644
index d165353c1..000000000
--- a/jut/com/sun/star/tools/uno/UnoApp.java
+++ /dev/null
@@ -1,894 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: UnoApp.java,v $
- * $Revision: 1.15 $
- *
- * 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.
- *
- ************************************************************************/
-
-package com.sun.star.tools.uno;
-
-
-import java.applet.Applet;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-
-import com.sun.star.bridge.XBridge;
-import com.sun.star.bridge.XBridgeFactory;
-import com.sun.star.bridge.XInstanceProvider;
-import com.sun.star.bridge.XUnoUrlResolver;
-
-import com.sun.star.comp.helper.RegistryServiceFactory;
-
-import com.sun.star.comp.loader.JavaLoader;
-
-import com.sun.star.connection.XAcceptor;
-import com.sun.star.connection.XConnection;
-import com.sun.star.connection.XConnectionBroadcaster;
-import com.sun.star.io.XStreamListener;
-
-import com.sun.star.container.XSet;
-
-import com.sun.star.lang.XInitialization;
-import com.sun.star.lang.XMain;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.lang.XSingleServiceFactory;
-
-import com.sun.star.loader.XImplementationLoader;
-
-import com.sun.star.registry.XRegistryKey;
-
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.Type;
-
-/* helper class for terminating an accepting UnoApp */
-class UnoAppHolder extends Thread
-{
- private int _nRef;
-
- public UnoAppHolder()
- { _nRef = 0; }
-
- public synchronized void acquire()
- { _nRef ++; }
-
- public synchronized void release()
- {
- _nRef --;
- if( 0 == _nRef )
- {
- // give the bridge some time do dispose ...
- this.start();
- }
- }
-
- public void run()
- {
- try {
- java.lang.Thread.currentThread().sleep( 1000 );
- }
- catch( InterruptedException e )
- {}
- System.exit( 0 );
- }
-}
-
-/* helper class for refcounting of incoming connections */
-class ConnectionListener implements XStreamListener
-{
- private UnoAppHolder _holder;
- public ConnectionListener( UnoAppHolder holder )
- {_holder = holder; _holder.acquire(); }
- public void disposing ( com.sun.star.lang.EventObject o)
- { closed(); }
- public void started( ) {}
- public void closed( )
- {
- UnoAppHolder holder = null;
- synchronized( this )
- {
- holder = _holder;
- _holder = null;
- }
- if( holder != null )
- holder.release();
- }
- public void terminated( )
- { closed(); }
- public void error( /*IN*/java.lang.Object aException )
- { closed(); }
-}
-
-/**
- * A command line tool. <code>UnoApp</code> is the generic UNO application for java.
- * It removes the need for writing UNO applications in Java. That is, it instantiates a service and runs it if it implements
- * <code>com.sun.star.lang.XMain</code>. <br>
- * In a remote scenario it is used to intantiate services and makes them accessible
- * via a network.
- * @see <a href="http://udk.openoffice.org/java/man/UnoApp.html">The Java Uno Application</a>
- *
- */
-public class UnoApp extends Applet {
- static public final boolean DEBUG = false;
-
- /**
- * Bootstraps a servicemanager with some base components registered.
- * <p>
- * @return a freshly boostrapped service manager
- * @see com.sun.star.lang.ServiceManager
- */
- static public XMultiServiceFactory createSimpleServiceManager() throws Exception {
- JavaLoader loader = new JavaLoader();
-
- XImplementationLoader xImpLoader = (XImplementationLoader)UnoRuntime.queryInterface(XImplementationLoader.class, loader);
-
- // Get the factory for the ServiceManager
- Object loaderobj = xImpLoader.activate("com.sun.star.comp.servicemanager.ServiceManager", null, null, null);
-
- // Ensure that we have got a factory
- XSingleServiceFactory xManagerFac = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, loaderobj);
- // Create an instance of the ServiceManager
- XMultiServiceFactory xMultiFac = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
- xManagerFac.createInstance());
-
- // set the ServiceManager at the JavaLoader with the XInitialization interface
- XInitialization xInit = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, xImpLoader);
- Object[] iniargs = { xMultiFac };
- xInit.initialize( iniargs );
-
-
- // now use the XSet interface at the ServiceManager to add the factory of the loader
- XSet xSet = (XSet) UnoRuntime.queryInterface(XSet.class, xMultiFac);
-
- // Get the factory of the loader
- XSingleServiceFactory xSingleServiceFactory = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class,
- xImpLoader.activate("com.sun.star.comp.loader.JavaLoader", null, null, null));
-
- // add the javaloader
- xSet.insert(xSingleServiceFactory);
-
- // add the service manager
- xSet.insert(xManagerFac);
-
- // Get the factory of the URLResolver
- xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
- xImpLoader.activate("com.sun.star.comp.urlresolver.UrlResolver", null, null, null));
- xSet.insert(xSingleServiceFactory);
-
- // add the bridgefactory
- xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
- xImpLoader.activate("com.sun.star.comp.bridgefactory.BridgeFactory", null, null, null));
- xSet.insert(xSingleServiceFactory);
-
- // add the connector
- xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
- xImpLoader.activate("com.sun.star.comp.connections.Connector", null, null, null));
- xSet.insert(xSingleServiceFactory);
-
- // add the acceptor
- xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
- xImpLoader.activate("com.sun.star.comp.connections.Acceptor", null, null, null));
- xSet.insert(xSingleServiceFactory);
-
- return xMultiFac;
- }
-
-
- static class DelegatorSingleServiceFactory implements XSingleServiceFactory, XServiceInfo {
- XMultiServiceFactory _xMultiServiceFactory;
- String _serviceName;
-
- DelegatorSingleServiceFactory(XMultiServiceFactory xMultiServiceFactory, String serviceName) {
- _xMultiServiceFactory = xMultiServiceFactory;
- _serviceName = serviceName;
- }
-
- public Object createInstance( ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- return _xMultiServiceFactory.createInstance(_serviceName);
- }
- public Object createInstanceWithArguments( /*IN*/java.lang.Object[] aArguments ) throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException {
- return _xMultiServiceFactory.createInstanceWithArguments(_serviceName, aArguments);
- }
-
- // Methods
- public String getImplementationName( ) throws com.sun.star.uno.RuntimeException {
- return getClass().getName() + _serviceName;
- }
-
- public boolean supportsService( /*IN*/String ServiceName ) throws com.sun.star.uno.RuntimeException {
- return _serviceName.equals(ServiceName);
- }
-
- public String[] getSupportedServiceNames( ) throws com.sun.star.uno.RuntimeException {
- return new String[]{_serviceName};
- }
- }
-
- /**
- * An XInstanceProvider implementation, which allows simple object export.
- * <p>
- * @see com.sun.star.bridge.XBridgeFactory
- * @see com.sun.star.bridge.XInstanceProvider
- */
- static class InstanceProvider implements XInstanceProvider {
- private String _name;
- private Object _object;
-
- InstanceProvider(String name, Object object) {
- _name = name;
- _object = object;
- }
-
- public Object getInstance(String sInstanceName) throws com.sun.star.container.NoSuchElementException, com.sun.star.uno.RuntimeException {
- Object object = null;
-
- if(_name.equals("__delegate")) { // ?is this a hack?
- XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, _object);
-
- String services[] = xMultiServiceFactory.getAvailableServiceNames();
- boolean hasService = false;
-
- for(int i = 0; i < services.length && !hasService; ++ i)
- hasService = services[i].equals(sInstanceName);
-
- if(hasService) {
- object = new DelegatorSingleServiceFactory(xMultiServiceFactory, sInstanceName);
- }
- }
- else
- if(sInstanceName.equals(_name))
- object = _object;
-
- return object;
- }
- }
-
-
- /**
- * Exports the given object via the given url while using
- * the <code>xMultiServiceFactory</code>.
- * <p>
- * @param xMultiServiceFactory the service manager to use
- * @param dcp a uno url, which describes how to export
- * @param object the object to export
- * @see com.sun.star.bridge.XBridge
- * @see com.sun.star.bridge.XBridgeFactory
- * @see com.sun.star.bridge.XInstanceProvider
- */
- static public void export(XMultiServiceFactory xMultiServiceFactory, String dcp, Object object, boolean singleAccept) throws Exception {
- String conDcp = null;
- String protDcp = null;
- String rootOid = null;
-
- // split the description into tokens
- int index = dcp.indexOf(':');
- String url = dcp.substring(0, index).trim();
- dcp = dcp.substring(index + 1).trim();
-
- index = dcp.indexOf(';');
- conDcp = dcp.substring(0, index).trim();
- dcp = dcp.substring(index + 1).trim();
-
- index = dcp.indexOf(';');
- protDcp = dcp.substring(0, index).trim();
- dcp = dcp.substring(index + 1).trim();
-
- rootOid = dcp.trim().trim();
-
- UnoAppHolder holder = new UnoAppHolder();
- holder.acquire();
- try {
- // get an acceptor
- XAcceptor xAcceptor = (XAcceptor)UnoRuntime.queryInterface(XAcceptor.class,
- xMultiServiceFactory.createInstance("com.sun.star.connection.Acceptor"));
-
- // get a bridgefactory
- XBridgeFactory xBridgeFactory = (XBridgeFactory)UnoRuntime.queryInterface(XBridgeFactory.class,
- xMultiServiceFactory.createInstance("com.sun.star.bridge.BridgeFactory"));
-
- int connect_count = 0;
-
- do {
- XConnection xConnection = null;
- try {
- System.err.println("waiting for connect [" + conDcp + "#" + connect_count + "]...");
- xConnection = xAcceptor.accept(conDcp);
- if(xConnection == null)
- break;
-
- XConnectionBroadcaster broadcaster = (XConnectionBroadcaster)
- UnoRuntime.queryInterface(
- XConnectionBroadcaster.class, xConnection );
- if( broadcaster != null )
- broadcaster.addStreamListener(
- new ConnectionListener( holder ) );
-
- // create the bridge
- XBridge xBridge = xBridgeFactory.createBridge(conDcp + ";" + protDcp + "#" + (connect_count ++), protDcp, xConnection, new InstanceProvider(rootOid, object));
- }
- catch(com.sun.star.uno.Exception exception) {
- System.err.println( "UnoApp acceptor: exeception occurred - " + exception);
- if(xConnection != null)
- xConnection.close();
- }
- }
- while(!singleAccept);
- }
- catch(com.sun.star.uno.Exception exception) {
- System.err.println("UnoApp acceptor: exeception occurred - " + exception);
- }
- finally
- {
- holder.release();
- }
- }
-
-
- /**
- * Parses the given string a makes words of according to the following rules:
- * - words embraced by " are recognized as one word
- * - charachters preceded by \ are quoted (e.g. " or spaces)
- * <p>
- * @return an array of words
- * @param string the string to parse
- */
- static String []parseString(String string) {
- Vector vector = new Vector();
-
- boolean inString = false;
- boolean quote = false;
- String word = "";
- int i = 0;
- while(i < string.length()) {
- if(string.charAt(i) == '\"' && !quote) {
- inString = !inString;
- }
- else if(string.charAt(i) == '\\' && !quote) {
- quote = true;
- }
- else if(Character.isSpace(string.charAt(i)) && !quote && !inString) {
- if(word.length() > 0) {
- vector.addElement(word);
- word = "";
- }
- }
- else {
- word += string.charAt(i);
- quote = false;
- }
-
- ++ i;
- }
-
- vector.addElement(word);
-
- String args[] = new String[vector.size()];
- for(i = 0; i < args.length; ++ i)
- args[i] = (String)vector.elementAt(i);
-
- return args;
- }
-
- /**
- * Takes a <code>String</code> array and concatenates the words
- * to one string.
- * <p>
- * @return the concatenated string
- * @param args the words to concatenate
- */
- static String mergeString(String args[]) {
- String string = "";
-
- for(int i = 0; i < args.length; ++ i)
- string += " " + args[i];
-
- return string;
- }
-
- /**
- * This is the base class for options for <code>UnoApp</code>.
- * Every option has to be derived from this class and has to implement
- * the <code>set</code> method, which is called while parsing the arguments.
- * <p>
- * Options which create the result object should also overwrite the
- * create method.
- */
- static abstract class Option {
- String _key;
- String _help;
-
- /**
- * Constructor, which has to be called with option key (e.g. -l)
- * and a description of the option.
- * <p>
- * @param key the key of this option
- * @param help a description of the option, which is printed when calling -h
- */
- protected Option(String key, String help) {
- _key = key;
- _help = help;
- }
-
- /**
- * <code>set</code> is called while parsing the arguments.
- * <p>
- * @param compContext the <code>compContext</code> to use for this option
- * @param args an <code>String</code> array with the arguments
- * @param index the index of the current argument
- */
- abstract void set(CompContext compContext, String args[], int index[]) throws Exception;
-
- /**
- * Create is called while trying to get the result object.
- * <p>
- * @param context the context for this create, should have been set by set
- * @param xMultiServiceFactory the service manager to use
- * @param args the args for the object instantiation
- */
- Object create(CompContext compContext) throws Exception {
- throw new Exception("not implemented");
- }
- }
-
- /**
- * The result of applying this option is an instance of
- * the named service.
- */
- static class Service_Option extends Option {
- static final String __key = "-s";
- static final String __help = "the service to instantiate";
-
- Service_Option() {
- super(__key, __help);
- }
-
- void set(CompContext compContext, String args[], int index[]) throws Exception {
- String serviceName = args[index[0] ++];
-
- compContext._context = serviceName;
- compContext._creator = this;
- }
-
- Object create(CompContext compContext) throws Exception {
- Object object = null;
-
- if(compContext._args != null && compContext._args.length != 0)
- object = compContext._xMultiServiceFactory.createInstanceWithArguments((String)compContext._context, compContext._args);
-
- else
- object = compContext._xMultiServiceFactory.createInstance((String)compContext._context);
-
- return object;
- }
- }
-
- /**
- * The result of applying this option is a registry
- * servicemanager. This option takes the rdb file name
- * as a paramter.
- */
- static class Registry_Option extends Option {
- static final String __key = "-r";
- static final String __help = "create a XMultiServiceFactory out of the registry file (e.g. -r applicat.rdb)";
-
- Registry_Option() {
- super(__key, __help);
- }
-
- void set(CompContext compContext, String args[], int index[]) throws Exception {
- compContext._context = RegistryServiceFactory.create(args[index[0] ++]);
- compContext._creator = this;
-
- if(DEBUG) System.err.println("##### " + getClass().getName() + " - got RegistryServiceFactory:" + compContext._context);
- }
-
- Object create(CompContext compContext) throws Exception {
- return compContext._context;
- }
-
- }
-
- /**
- * The result of applying this option is a registry
- * servicemanager. This option takes two rdb file names
- * as a paramters.
- */
- static class TwoRegistry_Option extends Option {
- static final String __key = "-tr";
- static final String __help = "create a XMultiServiceFactory out of two registry files (e.g. -tr applicat.rdb user.rdb";
-
- TwoRegistry_Option() {
- super(__key, __help);
- }
-
- void set(CompContext compContext, String args[], int index[]) throws Exception {
- compContext._context = RegistryServiceFactory.create(args[index[0] ++], args[index[0] ++]);
- compContext._creator = this;
-
- if(DEBUG) System.err.println("##### " + getClass().getName() + " - got RegistryServiceFactory:" + compContext._context);
- }
-
- Object create(CompContext compContext) throws Exception {
- return compContext._context;
- }
-
- }
-
- /**
- * The result of applying this option is the import
- * of the described object.
- */
- static class Import_Option extends Option {
- static final String __key = "-u";
- static final String __help = "import an object via the given url";
-
- Import_Option() {
- super(__key, __help);
- }
-
- void set(CompContext compContext, String args[], int index[]) throws Exception {
- compContext._context = args[index[0] ++];
- compContext._uno_url = (String)compContext._context;
- compContext._creator = this;
- }
-
- Object create(CompContext compContext) throws Exception {
- compContext._uno_url = null;
-
- XUnoUrlResolver urlResolver = (XUnoUrlResolver)UnoRuntime.queryInterface(XUnoUrlResolver.class,
- compContext._xMultiServiceFactory.createInstance("com.sun.star.bridge.UnoUrlResolver"));
-
- return urlResolver.resolve((String)compContext._context);
- }
- }
-
- /**
- * The result of applying this option is a multiservicefactory
- * for the given component.
- */
- static class Component_Option extends Option {
- static final String __key = "-c";
- static final String __help = "creates a XMultiServiceFactory out of the given component (via url or as classname)";
-
- Component_Option() {
- super(__key, __help);
- }
-
- void set(CompContext compContext, String args[], int index[]) throws Exception {
- if(DEBUG) System.err.println("##### " + getClass().getName() + ".set:" + args[0]);
-
- compContext._context = args[index[0] ++];
- compContext._creator = this;
- }
-
- Object create(CompContext compContext) throws Exception {
- String componentName = (String)compContext._context;
-
- XImplementationLoader loader = (XImplementationLoader)UnoRuntime.queryInterface(XImplementationLoader.class,
- compContext._xMultiServiceFactory.createInstance("com.sun.star.loader.Java"));
-
- Object serviceManager = compContext._xMultiServiceFactory.createInstance("com.sun.star.lang.ServiceManager");
- XSet serviceManager_xSet = (XSet)UnoRuntime.queryInterface(XSet.class, serviceManager);
-
- XRegistryKey xRegistryKey = new RegistryKey("ROOT");
-
- loader.writeRegistryInfo(xRegistryKey, null, componentName);
-
- String keys[] = xRegistryKey.getKeyNames();
- for(int j = 0; j < keys.length; ++ j) {
- String implName = keys[j].substring(1);
- implName = implName.substring(0, implName.length() - "/UNO/SERVICES".length());
-
- Object factory = loader.activate(implName, null, componentName, xRegistryKey);
- XSingleServiceFactory xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
- factory);
-
- if (xSingleServiceFactory == null)
- throw new com.sun.star.loader.CannotActivateFactoryException("Can not get factory for " + implName);
-
- serviceManager_xSet.insert(xSingleServiceFactory);
- }
-
- return serviceManager;
- }
- }
-
- /**
- * The -smgr option takes the given objects as <code>XSingleServiceFactory</code>
- * or as <code>XMultiServiceFactory</code> and inserts them into the given service manager.
- */
- static class ServiceManager_Option extends Option {
- static final String __key = "-smgr";
- static final String __help = "\"object[,object]*\" merges the given factorys into the result object factory";
-
- ServiceManager_Option() {
- super(__key, __help);
- }
-
- void set(CompContext compContext, String args[], int index[]) throws Exception {
- String arg = args[index[0] ++];
-
- if(DEBUG) System.err.println("##### " + getClass().getName() + ".set:" + arg);
-
- Vector comps = new Vector();
- int idx = arg.indexOf(',');
- while(idx != -1) {
- comps.addElement(arg.substring(0, idx));
-
- arg = arg.substring(idx + 1);
-
- idx = arg.indexOf(',');
- }
- comps.addElement(arg);
-
- // now use the XSet interface at the ServiceManager to add the factory of the loader
- XSet xSet = (XSet) UnoRuntime.queryInterface(XSet.class, compContext._xMultiServiceFactory);
-
- for(int i = 0; i < comps.size(); ++ i) {
- Object object = new CompContext((String)comps.elementAt(i)).getObject();
-
- XSingleServiceFactory xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
- object);
- if(xSingleServiceFactory == null) {
- XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,
- object);
-
- if(xMultiServiceFactory != null) {
- String services[] = xMultiServiceFactory.getAvailableServiceNames();
-
- for(int j = 0; j < services.length; ++ j)
- xSet.insert(new DelegatorSingleServiceFactory(xMultiServiceFactory, services[j]));
- }
- else
- System.err.println("warning! -- " + object + " is neither XSingleServiceFactory nor XMultiServiceFactory");
- }
- else
- xSet.insert(xSingleServiceFactory);
- }
- }
- }
-
- /**
- * The Args option puts the given objects into arg array,
- * which is used when instantiating the result object.
- */
- static class Args_Option extends Option {
- static final String __key = "--";
- static final String __help = "objects given to this option are passed via XInitialization to the result object";
-
- Args_Option() {
- super(__key, __help);
- }
-
- void set(CompContext compContext, String args[], int index[]) throws Exception {
- Object obj_args[] = new Object[args.length - index[0]];
-
- int i = 0;
- while(index[0] < args.length)
- obj_args[i ++] = new CompContext(args[index[0] ++]).getObject();
-
- compContext._args = obj_args;
- }
- }
-
- /**
- * If the object is to be exported, only export it once
- */
- static class SingleAccept_Option extends Option {
- static final String __key = "--singleaccept";
- static final String __help = "if the object is to be exported, only export it once";
-
- SingleAccept_Option() {
- super(__key, __help);
- }
-
- void set(CompContext compContext, String args[], int index[]) throws Exception {
- compContext._singleAccept = true;
- }
- }
-
- /**
- * The help option prints a help message.
- */
- static class Help_Option extends Option {
- static final String __key = "-h";
- static final String __help = "gives this help";
-
- Help_Option() {
- super(__key, __help);
- }
-
- void set(CompContext compContext, String args[], int index[]) {
- System.out.println("usage: UnoApp [option]*");
-
- Enumeration elements = __options.elements();
- while(elements.hasMoreElements()) {
- Option option = (Option)elements.nextElement();
- System.out.println("\t" + option._key + "\t" + option._help);
- }
- }
- }
-
-
- // All options have to be inserted into this table
- static final Hashtable __options = new Hashtable();
- static {
- __options.put(Service_Option.__key, new Service_Option());
- __options.put(Import_Option.__key, new Import_Option());
- __options.put(Registry_Option.__key, new Registry_Option());
- __options.put(TwoRegistry_Option.__key, new TwoRegistry_Option());
- __options.put(ServiceManager_Option.__key, new ServiceManager_Option());
- __options.put(Args_Option.__key, new Args_Option());
- __options.put(Component_Option.__key, new Component_Option());
- __options.put(SingleAccept_Option.__key, new SingleAccept_Option());
- __options.put(Help_Option.__key, new Help_Option());
- };
-
-
- /**
- * The is the main method, which is called from java.
- */
- static public void main(String args[]) throws Exception {
- if(args.length == 0)
- args = new String[]{"-h"};
-
- // We have to do this, cause the jdb under solaris does not allow to pass
- // arguments with included spaces.
- String arg = mergeString(args);
-
- CompContext compContext = new CompContext(arg);
-
- Object object = compContext.getObject();
-
- if(compContext._uno_url != null) // see, if we have to export the object
- export(compContext._xMultiServiceFactory, compContext._uno_url, object, compContext._singleAccept);
- else {
- XMain xMain = (XMain)UnoRuntime.queryInterface(XMain.class, object);
-
- if(xMain != null)
- xMain.run(new String[0]);
-
- System.out.println("result: " + object);
- }
- }
-
-
- static class CompContext {
- /* The membders of an CompContext */
- Option _creator = null; // the creator gets set by option which provide objects
- Object _context = null; // the context for object creation
- Object _args[] = null; // the args for object creation
- String _uno_url = null; // the url for object export
- XMultiServiceFactory _xMultiServiceFactory; // the service manager for object creation
- boolean _singleAccept = false; // if export object, only export once
-
- /**
- * Initializes <code>CompContext</code>.
- * If string only is one word and the word does not start with "-"
- * set the context with string.
- * <p>
- * @param string the arguments
- */
- CompContext(String string) throws Exception {
- _xMultiServiceFactory = createSimpleServiceManager();
-
- String args[] = parseString(string);
-
- if(args.length == 1 && args[0].charAt(0) != '-')
- _context = string;
- else
- parseArgs(args);
- }
-
- /**
- * Initializes <code>CompContext</code>.
- * If args contains only one word and the word does not start with "-"
- * set the context with string.
- * <p>
- * @param string the arguments
- */
- CompContext(String args[]) throws Exception {
- _xMultiServiceFactory = createSimpleServiceManager();
-
- if(args.length == 1 && args[0].charAt(0) != '-')
- _context = args[0];
- else
- parseArgs(args);
- }
-
- /**
- * Interprets the args as a sequence of option names
- * followed by option parameters.
- * <p>
- * @param args the arguments
- */
- protected void parseArgs(String args[]) throws Exception {
- int i[] = new int[1];
- while(i[0] < args.length) {
- Option option = (Option)__options.get(args[i[0]]);
- if(option == null) {
- System.err.println("unknown option:" + args[i[0]]);
- return;
- }
-
- ++ i[0];
-
- option.set(this, args, i);
- }
- }
-
- /**
- * Gets the object described by this <code>compContext</code>.
- * If no creator is set, returns the context as object.
- * <p>
- * @return the object
- */
- Object getObject () throws Exception {
- Object object = null;
-
- if(_creator == null)
- object = _context;
-
- else
- object = _creator.create(this);
-
- return object;
- }
- }
-
-
- /** Calls the main method. The parameter of the applet are passed as arguments
- to the main method.
- */
- public void init() {
- System.err.println("##### " + getClass().getName() + ".init");
-
- try {
- String args = getParameter("params");
-
- main(new String[]{args});
- }
- catch(Exception exception) {
- System.err.println("error - " + exception);
- }
- }
-
- public void start() {
- System.err.println("##### " + getClass().getName() + ".start");
- }
-
- public void stop() {
- System.err.println("##### " + getClass().getName() + ".stop");
- }
-
- public void destroy() {
- System.err.println("##### " + getClass().getName() + ".init");
- }
-}
-
diff --git a/jut/com/sun/star/tools/uno/makefile.mk b/jut/com/sun/star/tools/uno/makefile.mk
deleted file mode 100644
index 44dfe7aff..000000000
--- a/jut/com/sun/star/tools/uno/makefile.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.8 $
-#
-# 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.
-#
-#*************************************************************************
-
-
-PRJ = ..$/..$/..$/..$/..
-PRJNAME = jurt
-PACKAGE = com$/sun$/star$/tools$/uno
-TARGET = com_sun_star_tools_uno
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : $(PRJ)$/util$/makefile.pmk
-
-# --- Files --------------------------------------------------------
-
-JAVAFILES = \
- DumpType.java \
- DumpTypeDescription.java \
- RegComp.java \
- RegistryKey.java \
- UnoApp.java
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
diff --git a/jut/prj/build.lst b/jut/prj/build.lst
deleted file mode 100644
index 548251e7b..000000000
--- a/jut/prj/build.lst
+++ /dev/null
@@ -1,4 +0,0 @@
-u2 jut : javaunohelper NULL
-u2 jut usr1 - all u2_mkout NULL
-u2 jut\com\sun\star\tools\uno nmake - all u2_csst_uno NULL
-u2 jut\util nmake - all u2_util u2_csst_uno NULL
diff --git a/jut/prj/d.lst b/jut/prj/d.lst
deleted file mode 100644
index 7259f34eb..000000000
--- a/jut/prj/d.lst
+++ /dev/null
@@ -1,3 +0,0 @@
-..\%__SRC%\class\jut.jar %_DEST%\bin%_EXT%\jut.jar
-
-..\%__SRC%\bin\jut_src.zip %COMMON_DEST%\bin%_EXT%\jut_src.zip
diff --git a/jut/util/delzip b/jut/util/delzip
deleted file mode 100644
index e69de29bb..000000000
--- a/jut/util/delzip
+++ /dev/null
diff --git a/jut/util/makefile.mk b/jut/util/makefile.mk
deleted file mode 100644
index 08742fce9..000000000
--- a/jut/util/makefile.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.mk,v $
-#
-# $Revision: 1.5 $
-#
-# 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.
-#
-#*************************************************************************
-
-PRJ = ..
-PRJNAME = jut
-TARGET = jut
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE: makefile.pmk
-
-JARCLASSDIRS = com
-JARTARGET = $(TARGET).jar
-JARCOMPRESS = TRUE
-JARCLASSPATH = $(JARFILES)
-CUSTOMMANIFESTFILE = manifest
-
-# Special work necessary for building java reference with javadoc.
-# The source of puplic APIs must be delivered and used later in the
-# odk module.
-ZIP1TARGET=$(TARGET)_src
-ZIP1FLAGS=-u -r
-ZIP1DIR=$(PRJ)
-ZIP1LIST=com -x "*makefile.mk"
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
diff --git a/jut/util/makefile.pmk b/jut/util/makefile.pmk
deleted file mode 100644
index 79560cdc1..000000000
--- a/jut/util/makefile.pmk
+++ /dev/null
@@ -1,36 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2008 by Sun Microsystems, Inc.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# $RCSfile: makefile.pmk,v $
-#
-# $Revision: 1.5 $
-#
-# 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.
-#
-#*************************************************************************
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-JARFILES = ridl.jar jurt.jar juh.jar
diff --git a/jut/util/manifest b/jut/util/manifest
deleted file mode 100644
index 7ad02e156..000000000
--- a/jut/util/manifest
+++ /dev/null
@@ -1 +0,0 @@
-Sealed: true
diff --git a/sal/inc/rtl/malformeduriexception.hxx b/sal/inc/rtl/malformeduriexception.hxx
index 98e291200..252ff3fc8 100644
--- a/sal/inc/rtl/malformeduriexception.hxx
+++ b/sal/inc/rtl/malformeduriexception.hxx
@@ -39,7 +39,7 @@ namespace rtl {
<P>Used when parsing (part of) a URI fails for syntactical reasons.</P>
*/
-class MalformedUriException
+class SAL_EXCEPTION_DLLPUBLIC_EXPORT MalformedUriException
{
public:
/** Create a MalformedUriException.
@@ -47,8 +47,17 @@ public:
@param rMessage
A message containing any details about the exception.
*/
- inline MalformedUriException(rtl::OUString const & rMessage):
- m_aMessage(rMessage) {}
+ inline SAL_EXCEPTION_DLLPRIVATE MalformedUriException(
+ rtl::OUString const & rMessage): m_aMessage(rMessage) {}
+
+ inline SAL_EXCEPTION_DLLPRIVATE MalformedUriException(
+ MalformedUriException const & other): m_aMessage(other.m_aMessage) {}
+
+ inline SAL_EXCEPTION_DLLPRIVATE ~MalformedUriException() {}
+
+ inline SAL_EXCEPTION_DLLPRIVATE MalformedUriException operator =(
+ MalformedUriException const & other)
+ { m_aMessage = other.m_aMessage; return *this; }
/** Get the message.
@@ -56,7 +65,8 @@ public:
A reference to the message. The reference is valid for the lifetime of
this MalformedUriException.
*/
- inline rtl::OUString const & getMessage() const { return m_aMessage; }
+ inline SAL_EXCEPTION_DLLPRIVATE rtl::OUString const & getMessage() const
+ { return m_aMessage; }
private:
rtl::OUString m_aMessage;
diff --git a/sal/inc/sal/types.h b/sal/inc/sal/types.h
index d7884f944..89a079409 100644
--- a/sal/inc/sal/types.h
+++ b/sal/inc/sal/types.h
@@ -281,6 +281,20 @@ typedef void * sal_Handle;
# error("unknown platform")
#endif
+/**
+ Exporting the symbols necessary for exception handling on GCC.
+
+ These macros are used for inline declarations of exception classes, as in
+ rtl/malformeduriexception.hxx.
+*/
+#if defined __GNUC__
+#define SAL_EXCEPTION_DLLPUBLIC_EXPORT SAL_DLLPUBLIC_EXPORT
+#define SAL_EXCEPTION_DLLPRIVATE SAL_DLLPRIVATE
+#else
+#define SAL_EXCEPTION_DLLPUBLIC_EXPORT
+#define SAL_EXCEPTION_DLLPRIVATE
+#endif
+
/** Use this for pure virtual classes, e.g. class SAL_NO_VTABLE Foo { ...
This hinders the compiler from setting a generic vtable stating that
a pure virtual function was called and thus slightly reduces code size.
diff --git a/sal/osl/unx/mutex.c b/sal/osl/unx/mutex.c
index cb65fffd0..db94eece8 100644
--- a/sal/osl/unx/mutex.c
+++ b/sal/osl/unx/mutex.c
@@ -34,6 +34,13 @@
#include <osl/diagnose.h>
#include <pthread.h>
+#include <stdlib.h>
+
+#if defined LINUX /* bad hack */
+int pthread_mutexattr_setkind_np(pthread_mutexattr_t *, int);
+#define pthread_mutexattr_settype pthread_mutexattr_setkind_np
+#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
+#endif
/*
Implementation notes:
@@ -42,19 +49,6 @@
*/
-
-/*#if defined(PTHREAD_MUTEX_RECURSIVE) && defined(USE_RECURSIVE_MUTEX)*/
-#ifdef LINUX
-
-// The obsolete pthread_mutex_setkind_np (used below in osl_createMutex) seems
-// to be missing from pthread.h on LINUX:
-int pthread_mutexattr_setkind_np(pthread_mutexattr_t *, int);
-
-/*
- * Linux fully supports recursive mutexes, but only with
- * a non-standard function. So we linux, we use system recursive mutexes.
- */
-
typedef struct _oslMutexImpl
{
pthread_mutex_t mutex;
@@ -79,8 +73,7 @@ oslMutex SAL_CALL osl_createMutex()
pthread_mutexattr_init(&aMutexAttr);
-// nRet = pthread_mutexattr_settype(&aMutexAttr, PTHREAD_MUTEX_RECURSIVE);
- nRet = pthread_mutexattr_setkind_np( &aMutexAttr, PTHREAD_MUTEX_RECURSIVE_NP );
+ nRet = pthread_mutexattr_settype(&aMutexAttr, PTHREAD_MUTEX_RECURSIVE);
nRet = pthread_mutex_init(&(pMutex->mutex), &aMutexAttr);
if ( nRet != 0 )
@@ -204,259 +197,28 @@ sal_Bool SAL_CALL osl_releaseMutex(oslMutex Mutex)
/* osl_getGlobalMutex */
/*****************************************************************************/
-oslMutex * SAL_CALL osl_getGlobalMutex()
-{
- /* the static global mutex instance */
- static oslMutexImpl globalMutexImpl = {
- PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
- };
-
- /* necessary to get a "oslMutex *" */
- static oslMutex globalMutex = (oslMutex) &globalMutexImpl;
-
- return &globalMutex;
-}
-
-#else /* SOLARIS and all other platforms, use an own implementation of
- resursive mutexes */
-/*
- * jbu: Currently not used for solaris. The default implementation is buggy,
- * the system needs to be patched to
- * SPARC X86
- * Solaris 7: 106980-17 106981-18
- * Solaris 8: 108827-11 108828-11
- *
- * As the performace advantage is not too high, it was decided to wait
- * some more time. Note also, that solaris 2.6 does not support
- * them at all.
- */
-
-#ifdef PTHREAD_NONE_INIT
-static pthread_t _pthread_none_ = PTHREAD_NONE_INIT;
-#endif
-
-typedef struct _oslMutexImpl
-{
- pthread_mutex_t mutex;
- pthread_t owner;
- sal_uInt32 locks;
-} oslMutexImpl;
-
-
-/*****************************************************************************/
-/* osl_createMutex */
-/*****************************************************************************/
-oslMutex SAL_CALL osl_createMutex()
-{
- oslMutexImpl* pMutex = (oslMutexImpl*) malloc(sizeof(oslMutexImpl));
- int nRet=0;
-
- OSL_ASSERT(pMutex);
-
- if ( pMutex == 0 )
- {
- return 0;
- }
-
- nRet = pthread_mutex_init(&(pMutex->mutex), PTHREAD_MUTEXATTR_DEFAULT);
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_createMutex : mutex init failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
-
- free(pMutex);
- return 0;
- }
-
- pMutex->owner = PTHREAD_NONE;
- pMutex->locks = 0;
-
- return (oslMutex) pMutex;
-}
-
-/*****************************************************************************/
-/* osl_destroyMutex */
-/*****************************************************************************/
-void SAL_CALL osl_destroyMutex(oslMutex Mutex)
-{
- oslMutexImpl* pMutex = (oslMutexImpl*) Mutex;
-
- OSL_ASSERT(pMutex);
-
- if ( pMutex != NULL )
- {
- int nRet=0;
-
- nRet = pthread_mutex_destroy(&(pMutex->mutex));
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_destroyMutex : mutex destroy failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- }
-
- free(pMutex);
- }
-
- return;
-}
-
-/*****************************************************************************/
-/* osl_acquireMutex */
-/*****************************************************************************/
-sal_Bool SAL_CALL osl_acquireMutex(oslMutex Mutex)
-{
- oslMutexImpl* pMutex = (oslMutexImpl*) Mutex;
-
- OSL_ASSERT(pMutex);
-
- if ( pMutex )
- {
- int nRet=0;
-
- pthread_t thread_id = pthread_self();
-
- if ( pthread_equal(pMutex->owner, thread_id ) )
- {
- pMutex->locks++;
-/* fprintf(stderr,"osl_acquireMutex 0x%08X (locks == %i) from %i to thread %i (lock inc)\n",
- pMutex,pMutex->locks,pMutex->owner,pthread_self());*/
- }
- else
- {
- nRet = pthread_mutex_lock(&(pMutex->mutex));
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_acquireMutex : mutex lock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- }
+static oslMutexImpl globalMutexImpl;
-/* fprintf(stderr,"osl_acquireMutex 0x%08X (locks == %i) from %i to thread %i\n",
- pMutex,pMutex->locks,pMutex->owner,thread_id);*/
- OSL_ASSERT( pMutex->locks == 0 );
-
- pMutex->owner = thread_id;
- }
-
- return sal_True;
- }
-
- /* not initialized */
- return sal_False;
-}
-
-/*****************************************************************************/
-/* osl_tryToAcquireMutex */
-/*****************************************************************************/
-sal_Bool SAL_CALL osl_tryToAcquireMutex(oslMutex Mutex)
-{
- oslMutexImpl* pMutex = (oslMutexImpl*) Mutex;
-
- OSL_ASSERT(pMutex);
-
- if ( pMutex )
+static void globalMutexInitImpl(void) {
+ pthread_mutexattr_t attr;
+ if (pthread_mutexattr_init(&attr) != 0 ||
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) ||
+ pthread_mutex_init(&globalMutexImpl.mutex, &attr) != 0 ||
+ pthread_mutexattr_destroy(&attr) != 0)
{
- int nRet = 0;
- if ( pthread_equal(pMutex->owner, pthread_self()) )
- {
- pMutex->locks++;
- }
- else
- {
- nRet = pthread_mutex_trylock(&(pMutex->mutex));
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_tryToacquireMutex : mutex trylock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- return sal_False;
- }
-
- OSL_ASSERT( pMutex->locks == 0 );
-
- pMutex->owner = pthread_self();
- }
- return sal_True;
+ abort();
}
-
- /* not initialized */
- return sal_False;
-}
-
-/*****************************************************************************/
-/* osl_releaseMutex */
-/*****************************************************************************/
-sal_Bool SAL_CALL osl_releaseMutex(oslMutex Mutex)
-{
- oslMutexImpl* pMutex = (oslMutexImpl*) Mutex;
- int nRet=0;
-
- OSL_ASSERT(pMutex);
-
- if ( pMutex )
- {
- if ( pthread_equal( pMutex->owner, pthread_self()) )
- {
- if ( pMutex->locks > 0 )
- {
- pMutex->locks--;
-/* fprintf(stderr,"osl_releaseMutex 0x%08X (locks == %i) from %i to thread %i (lock dec)\n",
- pMutex,pMutex->locks,pMutex->owner,pthread_self());*/
- }
- else
- {
-/* fprintf(stderr,"osl_releaseMutex 0x%08X (locks == %i) from %i to thread %i\n",
- pMutex,pMutex->locks,pMutex->owner,pthread_self());*/
-
- pMutex->owner = PTHREAD_NONE;
- nRet = pthread_mutex_unlock(&(pMutex->mutex));
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_releaseMutex : mutex unlock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- }
- }
-
- return (sal_True);
- }
- else
- {
-/* fprintf(stderr,"osl_releaseMutex 0x%08X (locks == %i) from %i to thread %i (not owner)\n",
- pMutex,pMutex->locks,pMutex->owner,pthread_self());*/
-
- nRet = pthread_mutex_unlock(&(pMutex->mutex));
- if ( nRet != 0 )
- {
- OSL_TRACE("osl_releaseMutex : mutex unlock failed. Errno: %d; %s\n",
- nRet, strerror(nRet));
- return sal_False;
- }
-
- return sal_True;
- }
- }
-
- /* not initialized */
- return sal_False;
}
-/*****************************************************************************/
-/* osl_getGlobalMutex */
-/*****************************************************************************/
-
oslMutex * SAL_CALL osl_getGlobalMutex()
{
- /* the static global mutex instance */
- static oslMutexImpl globalMutexImpl = {
- PTHREAD_MUTEX_INITIALIZER,
- PTHREAD_NONE_INIT,
- 0
- };
-
/* necessary to get a "oslMutex *" */
static oslMutex globalMutex = (oslMutex) &globalMutexImpl;
+
+ static pthread_once_t once = PTHREAD_ONCE_INIT;
+ if (pthread_once(&once, &globalMutexInitImpl) != 0) {
+ abort();
+ }
return &globalMutex;
}
-
-
-#endif /* #ifndef LINUX */
-
diff --git a/ure/source/uretest/Makefile.pln b/ure/source/uretest/Makefile.pln
index 62c95797a..8a46d00a1 100644
--- a/ure/source/uretest/Makefile.pln
+++ b/ure/source/uretest/Makefile.pln
@@ -30,7 +30,7 @@
#*************************************************************************
# The following variable must be set (see README):
-#SDK_HOME := /opt/OpenOffice.org2.0_SDK
+#SDK_HOME := /opt/openoffice.org/basis3.1/sdk
# The following variables can be set, if necessary (see README):
#URE_HOME := /opt/openoffice.org/ure