summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2004-02-03 11:45:41 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2004-02-03 11:45:41 +0000
commite2d7d0cb36092b998e9570a9329d1f80ebe5387c (patch)
tree1b0132f6d608041264ede0387a274e9d18a51394 /bridges
parente1513ba7255d740012c1a4974badb27d4b5f9915 (diff)
INTEGRATION: CWS sb10 (1.2.36); FILE MERGED
2004/01/18 01:53:31 khendricks 1.2.36.1: committing multinherit changes for gcc3_macosx_powerpc These changes should be correct except for typos I can not test this bridge since the 680 tree will not build on MacOSX yet until all of the changes from the cws_fix645_ooo111fix2 tree are merged into the 680 tree. As soon as the 680 tree gets buildable on MacOSX I will test the bridge and make any minor corrections
Diffstat (limited to 'bridges')
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_powerpc/share.hxx9
-rw-r--r--bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx104
2 files changed, 61 insertions, 52 deletions
diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/share.hxx b/bridges/source/cpp_uno/gcc3_macosx_powerpc/share.hxx
index a662b7205d67..d8db19de26e0 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/share.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: share.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: hr $ $Date: 2003-07-16 17:32:51 $
+ * last change: $Author: hr $ $Date: 2004-02-03 12:45:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,8 @@
*
************************************************************************/
+#include "uno/mapping.h"
+
#include <typeinfo>
#include <exception>
#include <cstddef>
@@ -66,6 +68,9 @@
namespace CPPU_CURRENT_NAMESPACE
{
+ void dummy_can_throw_anything( char const * );
+
+
// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
struct _Unwind_Exception
diff --git a/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
index 417cd5d2b1fc..4cbed1947cff 100644
--- a/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_macosx_powerpc/uno2cpp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: uno2cpp.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: hr $ $Date: 2003-07-16 17:33:00 $
+ * last change: $Author: hr $ $Date: 2004-02-03 12:45:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,11 +61,14 @@
#include <sys/types.h>
#include <sys/malloc.h>
-#include <rtl/alloc.h>
+#include <com/sun/star/uno/genfunc.hxx>
#include <uno/data.h>
-#include <bridges/cpp_uno/bridge.hxx>
-#include <bridges/cpp_uno/type_misc.hxx>
+
+#include "bridges/cpp_uno/share/bridge.hxx"
+#include "bridges/cpp_uno/share/types.hxx"
+#include "bridges/cpp_uno/share/unointerfaceproxy.hxx"
+#include "bridges/cpp_uno/share/vtables.hxx"
#include "share.hxx"
@@ -73,14 +76,12 @@
using namespace ::rtl;
using namespace ::com::sun::star::uno;
-namespace CPPU_CURRENT_NAMESPACE
+namespace
{
-void dummy_can_throw_anything( char const * );
-
//==================================================================================================
static void callVirtualMethod(
- void * pThis,
+ void * pAdjustedThisPtr,
sal_Int32 nVtableIndex,
void * pRegisterReturn,
typelib_TypeClass eReturnType,
@@ -138,9 +139,8 @@ static void callVirtualMethod(
__asm__ ( "addi %0,r1,24" : "=r" (p) : /* no inputs */ );
- // FIXME: why is this here at all?
// never called
- // if (! pThis) dummy_can_throw_anything("xxx"); // address something
+ // if (! pAdjustedThisPtr )CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
// now we need to parse the entire signature string
@@ -234,7 +234,7 @@ static void callVirtualMethod(
/* figure out the address of the function we need to invoke */
off = nVtableIndex;
off = off * 4; // 4 bytes per slot
- mfunc = *((unsigned long **)pThis); // get the address of the vtable
+ mfunc = *((unsigned long **)pAdjustedThisPtr); // get the address of the vtable
mfunc = (unsigned long *)((char *)mfunc + off); // get the address from the vtable entry at offset
mfunc = *((unsigned long **)mfunc); // the function is stored at the address
ptr = (void (*)())mfunc;
@@ -316,8 +316,8 @@ static void callVirtualMethod(
//==================================================================================================
static void cpp_call(
- cppu_unoInterfaceProxy * pThis,
- sal_Int32 nVtableCall,
+ bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
+ bridges::cpp_uno::shared::VtableSlot aVtableSlot,
typelib_TypeDescriptionReference * pReturnTypeRef,
sal_Int32 nParams, typelib_MethodParameter * pParams,
void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc )
@@ -340,22 +340,25 @@ static void cpp_call(
if (pReturnTypeDescr)
{
- if (cppu_isSimpleType( pReturnTypeDescr ))
+ if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
{
pCppReturn = pUnoReturn; // direct way for simple types
}
else
{
// complex return via ptr
- pCppReturn = *(void **)pCppStack = (cppu_relatesToInterface( pReturnTypeDescr )
- ? alloca( pReturnTypeDescr->nSize )
- : pUnoReturn); // direct way
+ pCppReturn = *(void **)pCppStack
+ = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
+ ? alloca( pReturnTypeDescr->nSize )
+ : pUnoReturn); // direct way
*pPT++ = 'C'; //signify that a complex return type on stack
pCppStack += sizeof(void *);
}
}
// push this
- *(void**)pCppStack = pThis->pCppI;
+ void * pAdjustedThisPtr = reinterpret_cast< void ** >(pThis->getCppI())
+ + aVtableSlot.offset;
+ *(void**)pCppStack = pAdjustedThisPtr;
pCppStack += sizeof( void* );
*pPT++ = 'I';
@@ -376,10 +379,11 @@ static void cpp_call(
typelib_TypeDescription * pParamTypeDescr = 0;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
- if (!rParam.bOut && cppu_isSimpleType( pParamTypeDescr ))
+ if (!rParam.bOut
+ && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
{
uno_copyAndConvertData( pCppArgs[nPos] = pCppStack, pUnoArgs[nPos], pParamTypeDescr,
- &pThis->pBridge->aUno2Cpp );
+ pThis->getBridge()->getUno2Cpp() );
switch (pParamTypeDescr->eTypeClass)
{
@@ -437,11 +441,11 @@ static void cpp_call(
ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
}
// is in/inout
- else if (cppu_relatesToInterface( pParamTypeDescr ))
+ else if (bridges:cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
{
uno_copyAndConvertData(
*(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
- pUnoArgs[nPos], pParamTypeDescr, &pThis->pBridge->aUno2Cpp );
+ pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
// will be released at reconversion
@@ -466,7 +470,7 @@ static void cpp_call(
{
OSL_ENSURE( !( (pCppStack - pCppStackStart ) & 3), "UNALIGNED STACK !!! (Please DO panic)" );
callVirtualMethod(
- pThis->pCppI, nVtableCall,
+ pAdjustedThisPtr, aVtableSlot.index,
pCppReturn, pReturnTypeDescr->eTypeClass, pParamType,
(sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) );
// NO exception occured...
@@ -484,13 +488,13 @@ static void cpp_call(
{
uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value
uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
- &pThis->pBridge->aCpp2Uno );
+ pThis->getBridge()->getCpp2Uno() );
}
}
else // pure out
{
uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
- &pThis->pBridge->aCpp2Uno );
+ pThis->getBridge()->getCpp2Uno() );
}
// destroy temp cpp param => cpp: every param was constructed
uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
@@ -501,14 +505,14 @@ static void cpp_call(
if (pCppReturn && pUnoReturn != pCppReturn)
{
uno_copyAndConvertData( pUnoReturn, pCppReturn, pReturnTypeDescr,
- &pThis->pBridge->aCpp2Uno );
+ pThis->getBridge()->getCpp2Uno() );
uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release );
}
}
catch (...)
{
// fill uno exception
- fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, &pThis->pBridge->aCpp2Uno );
+ fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
// temporary params
for ( ; nTempIndizes--; )
@@ -524,32 +528,34 @@ static void cpp_call(
}
}
+}
//==================================================================================================
-void SAL_CALL cppu_unoInterfaceProxy_dispatch(
+void bridges::cpp_uno::shared::UnoInterfaceProxy::dispatch(
uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
- void * pReturn, void * pArgs[], uno_Any ** ppException ) throw ()
+ void * pReturn, void * pArgs[], uno_Any ** ppException ) SAL_THROW(())
{
// is my surrogate
- cppu_unoInterfaceProxy * pThis = (cppu_unoInterfaceProxy *)pUnoI;
+ bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
+ = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * > (pUnoI);
typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr;
switch (pMemberDescr->eTypeClass)
{
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
- // determine vtable call index
- sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
- OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" );
- sal_Int32 nVtableCall = pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos];
- OSL_ENSURE( nVtableCall < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" );
+ VtableSlot aVtableSlot(
+ getVtableSlot(
+ reinterpret_cast<
+ typelib_InterfaceAttributeTypeDescription const * >(
+ pMemberDescr)));
if (pReturn)
{
// dependent dispatch
cpp_call(
- pThis, nVtableCall,
+ pThis, aVtableSlot,
((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
0, 0, // no params
pReturn, pArgs, ppException );
@@ -569,8 +575,9 @@ void SAL_CALL cppu_unoInterfaceProxy_dispatch(
&pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
// dependent dispatch
+ aVtableSlot.index += 1; //get then set method
cpp_call(
- pThis, nVtableCall +1, // get, then set method
+ pThis, aVtableSlot,
pReturnTypeRef,
1, &aParam,
pReturn, pArgs, ppException );
@@ -582,14 +589,13 @@ void SAL_CALL cppu_unoInterfaceProxy_dispatch(
}
case typelib_TypeClass_INTERFACE_METHOD:
{
- // determine vtable call index
- sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
- OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### member pos out of range!" );
- sal_Int32 nVtableCall = pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos];
- OSL_ENSURE( nVtableCall < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" );
-
- switch (nVtableCall)
+ VtableSlot aVtableSlot(
+ getVtableSlot(
+ reinterpret_cast<
+ typelib_InterfaceMethodTypeDescription const * >(
+ pMemberDescr)));
+ switch (aVtableSlot.index)
{
// standard calls
case 1: // acquire uno interface
@@ -607,8 +613,8 @@ void SAL_CALL cppu_unoInterfaceProxy_dispatch(
if (pTD)
{
uno_Interface * pInterface = 0;
- (*pThis->pBridge->pUnoEnv->getRegisteredInterface)(
- pThis->pBridge->pUnoEnv,
+ (*pThis->pBridge->getUnoEnv()->getRegisteredInterface)(
+ pThis->pBridge->getUnoEnv(),
(void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD );
if (pInterface)
@@ -627,7 +633,7 @@ void SAL_CALL cppu_unoInterfaceProxy_dispatch(
default:
// dependent dispatch
cpp_call(
- pThis, nVtableCall,
+ pThis, aVtableSlot,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
@@ -648,5 +654,3 @@ void SAL_CALL cppu_unoInterfaceProxy_dispatch(
}
}
-}
-