summaryrefslogtreecommitdiff
path: root/cppu
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
committerMathias Bauer <mba@openoffice.org>2009-09-09 11:45:13 +0200
commitc617ecebd7e6f5b5ec29f32ca54decf649c00d7a (patch)
treef4dbae1cc849da6ad5e2fb454ffa8542eaf97920 /cppu
parent5518e93f0d8c739938783054082eeda4c1c0d06b (diff)
parent1f5e32262c475444b09293e7e7b78141a1704696 (diff)
merge commit to DEV300_m57
Diffstat (limited to 'cppu')
-rw-r--r--cppu/inc/uno/lbnames.h7
-rw-r--r--cppu/prj/build.lst3
-rw-r--r--cppu/prj/d.lst3
-rw-r--r--cppu/source/LogBridge/LogBridge.cxx280
-rw-r--r--cppu/source/LogBridge/makefile.mk48
-rw-r--r--cppu/util/extra.mk15
6 files changed, 350 insertions, 6 deletions
diff --git a/cppu/inc/uno/lbnames.h b/cppu/inc/uno/lbnames.h
index 27a6f1094a0a..481180fda953 100644
--- a/cppu/inc/uno/lbnames.h
+++ b/cppu/inc/uno/lbnames.h
@@ -46,12 +46,9 @@
#endif /* (_MSC_VER < 1000) */
/* sunpro cc */
#elif defined (__SUNPRO_CC)
-#if (__SUNPRO_CC < 0x500)
-#error "sunpro cc must be at least 5.x"
-provoking error here, because PP ignores #error
-#elif (__SUNPRO_CC < 0x600)
+#if ((__SUNPRO_CC >= 0x5000 && __SUNPRO_CC < 0x6000) || (__SUNPRO_CC >= 0x500 && __SUNPRO_CC < 0x600))
#define TMP_CPPU_ENV sunpro5
-#else
+#elif
#error "sunpro cc version must be 5.x"
provoking error here, because PP ignores #error
#endif /* defined (__SUNPRO_CC) */
diff --git a/cppu/prj/build.lst b/cppu/prj/build.lst
index a0caa14cbd9d..a22ca9ec8b66 100644
--- a/cppu/prj/build.lst
+++ b/cppu/prj/build.lst
@@ -8,4 +8,5 @@ cu cppu\source\cppu nmake - all cu_cppu cu_inc NULL
cu cppu\source\helper\purpenv nmake - all cu_helper_purpenv cu_inc NULL
cu cppu\source\UnsafeBridge nmake - all cu_UnsafeBridge cu_inc NULL
cu cppu\source\AffineBridge nmake - all cu_AffineBridge cu_inc NULL
-cu cppu\util nmake - all cu_util cu_thpool cu_typelib cu_cppu cu_uno cu_helper_purpenv cu_UnsafeBridge cu_AffineBridge NULL
+cu cppu\source\LogBridge nmake - all cu_LogBridge cu_inc NULL
+cu cppu\util nmake - all cu_util cu_thpool cu_typelib cu_cppu cu_uno cu_helper_purpenv cu_UnsafeBridge cu_AffineBridge cu_LogBridge NULL
diff --git a/cppu/prj/d.lst b/cppu/prj/d.lst
index 3355b6dc2c52..411a51cf2518 100644
--- a/cppu/prj/d.lst
+++ b/cppu/prj/d.lst
@@ -67,5 +67,8 @@ mkdir: %_DEST%\inc%_EXT%\uno
..\%__SRC%\bin\affine_u*.dll %_DEST%\bin%_EXT%\*
..\%__SRC%\lib\libaffine_uno_uno.* %_DEST%\lib%_EXT%\*
+..\%__SRC%\bin\log_u*.dll %_DEST%\bin%_EXT%\*
+..\%__SRC%\lib\liblog_uno_uno.* %_DEST%\lib%_EXT%\*
+
linklib: libuno_cppu.*.*
linklib: libuno_purpenvhelper*.*.*
diff --git a/cppu/source/LogBridge/LogBridge.cxx b/cppu/source/LogBridge/LogBridge.cxx
new file mode 100644
index 000000000000..6bb32e4f0666
--- /dev/null
+++ b/cppu/source/LogBridge/LogBridge.cxx
@@ -0,0 +1,280 @@
+/*************************************************************************
+ *
+ * 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: LogBridge.cxx,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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppu.hxx"
+
+#include "osl/mutex.hxx"
+#include "osl/thread.h"
+#include "uno/dispatcher.h"
+#include "typelib/typedescription.hxx"
+#include "cppu/helper/purpenv/Environment.hxx"
+#include "cppu/helper/purpenv/Mapping.hxx"
+#include "cppu/EnvDcp.hxx"
+#include "rtl/logfile.hxx"
+#include "uno/environment.hxx"
+#include <com/sun/star/uno/Type.hxx>
+#include <hash_map>
+#include <memory>
+
+namespace
+{
+class LogBridge : public cppu::Enterable
+{
+ osl::Mutex m_mutex;
+ sal_Int32 m_count;
+ oslThreadIdentifier m_threadId;
+
+ virtual ~LogBridge(void);
+
+public:
+ explicit LogBridge(void);
+
+ virtual void v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam);
+ virtual void v_callOut_v (uno_EnvCallee * pCallee, va_list * pParam);
+
+ virtual void v_enter(void);
+ virtual void v_leave(void);
+
+ virtual int v_isValid(rtl::OUString * pReason);
+};
+
+LogBridge::LogBridge(void)
+ : m_count (0)
+ ,m_threadId(0)
+{
+}
+
+LogBridge::~LogBridge(void)
+{
+ OSL_ASSERT(m_count >= 0);
+}
+
+void LogBridge::v_callInto_v(uno_EnvCallee * pCallee, va_list * pParam)
+{
+ enter();
+ pCallee(pParam);
+ leave();
+}
+
+void LogBridge::v_callOut_v(uno_EnvCallee * pCallee, va_list * pParam)
+{
+ OSL_ASSERT(m_count > 0);
+
+ -- m_count;
+ pCallee(pParam);
+ ++ m_count;
+
+ if (!m_threadId)
+ m_threadId = osl_getThreadIdentifier(NULL);
+}
+
+void LogBridge::v_enter(void)
+{
+ m_mutex.acquire();
+
+ OSL_ASSERT(m_count >= 0);
+
+ if (m_count == 0)
+ m_threadId = osl_getThreadIdentifier(NULL);
+
+ ++ m_count;
+}
+
+void LogBridge::v_leave(void)
+{
+ OSL_ASSERT(m_count > 0);
+
+ -- m_count;
+ if (!m_count)
+ m_threadId = 0;
+
+
+ m_mutex.release();
+}
+
+int LogBridge::v_isValid(rtl::OUString * pReason)
+{
+ int result = 1;
+
+ result = m_count > 0;
+ if (!result)
+ *pReason = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("not entered"));
+
+ else
+ {
+ result = m_threadId == osl_getThreadIdentifier(NULL);
+
+ if (!result)
+ *pReason = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("wrong thread"));
+ }
+
+ if (result)
+ *pReason = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OK"));
+
+ return result;
+}
+
+ void traceValue(typelib_TypeDescriptionReference* _pTypeRef,void* pArg)
+ {
+ switch(_pTypeRef->eTypeClass)
+ {
+ case typelib_TypeClass_STRING:
+ {
+ const ::rtl::OString sValue( ::rtl::OUStringToOString(*static_cast< ::rtl::OUString*>(pArg),osl_getThreadTextEncoding()));
+ rtl_logfile_trace( "%s", sValue.getStr());
+ }
+ break;
+ case typelib_TypeClass_BOOLEAN:
+ rtl_logfile_trace( "%d", *static_cast<sal_Bool*>(pArg));
+ break;
+ case typelib_TypeClass_BYTE:
+ rtl_logfile_trace( "%d", *static_cast<sal_Int8*>(pArg));
+ break;
+ case typelib_TypeClass_CHAR:
+ rtl_logfile_trace( "%c", *static_cast<sal_Char*>(pArg));
+ break;
+ case typelib_TypeClass_SHORT:
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ rtl_logfile_trace( "%d", *static_cast<sal_Int16*>(pArg));
+ break;
+ case typelib_TypeClass_LONG:
+ case typelib_TypeClass_UNSIGNED_LONG:
+ case typelib_TypeClass_ENUM:
+ rtl_logfile_trace( "%d", *static_cast<sal_Int32*>(pArg));
+ break;
+ case typelib_TypeClass_HYPER:
+ case typelib_TypeClass_UNSIGNED_HYPER:
+ rtl_logfile_trace( "%d", *static_cast<sal_Int64*>(pArg));
+ break;
+ case typelib_TypeClass_FLOAT:
+ rtl_logfile_trace( "%f", *static_cast<float*>(pArg));
+ break;
+ case typelib_TypeClass_DOUBLE:
+ rtl_logfile_trace( "%f", *static_cast<double*>(pArg));
+ break;
+ case typelib_TypeClass_TYPE:
+ {
+ const ::rtl::OString sValue( ::rtl::OUStringToOString(((com::sun::star::uno::Type*)pArg)->getTypeName(),osl_getThreadTextEncoding()));
+ rtl_logfile_trace( "%s", sValue.getStr());
+ }
+ break;
+ case typelib_TypeClass_ANY:
+ if ( static_cast<uno_Any*>(pArg)->pData )
+ traceValue(static_cast<uno_Any*>(pArg)->pType,static_cast<uno_Any*>(pArg)->pData);
+ else
+ rtl_logfile_trace( "void");
+ break;
+ case typelib_TypeClass_EXCEPTION:
+ rtl_logfile_trace( "exception");
+ break;
+ case typelib_TypeClass_INTERFACE:
+ {
+ const ::rtl::OString sValue( ::rtl::OUStringToOString(_pTypeRef->pTypeName,osl_getThreadTextEncoding()));
+ rtl_logfile_trace( "%s 0x%p", sValue.getStr(),pArg);
+ }
+ break;
+ case typelib_TypeClass_VOID:
+ rtl_logfile_trace( "void");
+ break;
+ default:
+ rtl_logfile_trace( "0x%p", pArg);
+ break;
+ } // switch(pParams[i].pTypeRef->eTypeClass)
+ }
+}
+
+void LogProbe(
+ bool pre,
+ void * /*pThis*/,
+ void * /*pContext*/,
+ typelib_TypeDescriptionReference * pReturnTypeRef,
+ typelib_MethodParameter * pParams,
+ sal_Int32 nParams,
+ typelib_TypeDescription const * pMemberType,
+ void * pReturn,
+ void * pArgs[],
+ uno_Any ** ppException )
+{
+ static ::std::auto_ptr< ::rtl::Logfile> pLogger;
+ ::rtl::OString sTemp;
+ if ( pMemberType && pMemberType->pTypeName )
+ sTemp = ::rtl::OUStringToOString(pMemberType->pTypeName,RTL_TEXTENCODING_ASCII_US);
+ if ( pre )
+ {
+ rtl_logfile_longTrace( "{ LogBridge () %s", sTemp.getStr() );
+ if ( nParams )
+ {
+ rtl_logfile_trace( "\n| : ( LogBridge ");
+ for(sal_Int32 i = 0;i < nParams;++i)
+ {
+ if ( i > 0 )
+ rtl_logfile_trace( ",");
+ traceValue(pParams[i].pTypeRef,pArgs[i]);
+
+ }
+ rtl_logfile_trace( ")");
+ } // if ( nParams )
+ rtl_logfile_trace( "\n");
+ }
+ else if ( !pre )
+ {
+ rtl_logfile_longTrace( "} LogBridge () %s",sTemp.getStr());
+ if ( ppException && *ppException )
+ {
+ rtl_logfile_trace( " excption occured : ");
+ typelib_TypeDescription * pElementTypeDescr = 0;
+ TYPELIB_DANGER_GET( &pElementTypeDescr, (*ppException)->pType );
+ const ::rtl::OString sValue( ::rtl::OUStringToOString(pElementTypeDescr->pTypeName,osl_getThreadTextEncoding()));
+ rtl_logfile_trace( "%s", sValue.getStr());
+ TYPELIB_DANGER_RELEASE( pElementTypeDescr );
+ }
+ else if ( pReturnTypeRef )
+ {
+ rtl_logfile_trace( " return : ");
+ traceValue(pReturnTypeRef,pReturn);
+ } // if ( pReturn && pReturnTypeRef )
+
+ rtl_logfile_trace( "\n");
+ }
+}
+
+extern "C" void SAL_DLLPUBLIC_EXPORT SAL_CALL uno_initEnvironment(uno_Environment * pEnv)
+ SAL_THROW_EXTERN_C()
+{
+ cppu::helper::purpenv::Environment_initWithEnterable(pEnv, new LogBridge());
+}
+
+extern "C" void SAL_DLLPUBLIC_EXPORT SAL_CALL uno_ext_getMapping(uno_Mapping ** ppMapping,
+ uno_Environment * pFrom,
+ uno_Environment * pTo )
+{
+ cppu::helper::purpenv::createMapping(ppMapping, pFrom, pTo,LogProbe);
+}
diff --git a/cppu/source/LogBridge/makefile.mk b/cppu/source/LogBridge/makefile.mk
new file mode 100644
index 000000000000..c7bc5e5172f6
--- /dev/null
+++ b/cppu/source/LogBridge/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+#
+# 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.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.
+#
+#*************************************************************************
+
+PRJ := ..$/..
+PRJNAME := cppu
+TARGET := LogBridge
+
+ENABLE_EXCEPTIONS := TRUE
+NO_BSYMBOLIC := TRUE
+USE_DEFFILE := FALSE
+
+
+.INCLUDE: settings.mk
+
+
+SLOFILES := $(SLO)$/LogBridge.obj
+
+
+.INCLUDE: target.mk
+
diff --git a/cppu/util/extra.mk b/cppu/util/extra.mk
index dc06e9284e72..3aac0524218b 100644
--- a/cppu/util/extra.mk
+++ b/cppu/util/extra.mk
@@ -72,6 +72,21 @@ SHL4DEF := empty.def
SHL4OBJS := $(SLO)$/AffineBridge.obj
SHL4RPATH := URELIB
+
+SHL5TARGET := log_uno_uno
+SHL5IMPLIB := i$(SHL5TARGET)
+SHL5STDLIBS := $(purpenv_helper_LIB) $(SALLIB) $(CPPULIB)
+SHL5OBJS := $(SLO)$/LogBridge.obj
+
+.IF "$(GUI)"=="OS2"
+SHL5VERSIONMAP=unsafe_os2.map
+SHL5DEF=$(MISC)$/$(SHL5TARGET).def
+DEF5NAME=LogMapping.def
+.ELSE
+SHL5DEF := empty.def
+.ENDIF
+SHL5RPATH := URELIB
+
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk