INTEGRATION: CWS s390port01 (1.4.92); FILE MERGED

2008/02/29 14:56:00 cmc 1.4.92.1: #i86425# fix up s390
This commit is contained in:
Vladimir Glazounov
2008-03-18 15:06:42 +00:00
parent 922ef67778
commit 4974be9dd6

View File

@@ -4,9 +4,9 @@
*
* $RCSfile: uno2cpp.cxx,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: obo $ $Date: 2006-09-16 15:49:15 $
* last change: $Author: vg $ $Date: 2008-03-18 16:06:42 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -37,23 +37,26 @@
#include "precompiled_bridges.hxx"
#include <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/shared/bridge.hxx"
#include "bridges/cpp_uno/shared/types.hxx"
#include "bridges/cpp_uno/shared/unointerfaceproxy.hxx"
#include "bridges/cpp_uno/shared/vtables.hxx"
#include "share.hxx"
#include <stdio.h>
#include <string.h>
using namespace ::rtl;
using namespace ::com::sun::star::uno;
namespace CPPU_CURRENT_NAMESPACE
namespace
{
void dummy_can_throw_anything( char const * );
static sal_Int32
invoke_count_words(char * pPT)
{
@@ -209,7 +212,7 @@ static void callVirtualMethod(
volatile float fret;
volatile int iret, iret2;
char * dummy = alloca(32); // dummy alloca to force r11 usage for exception handling
void * dummy = alloca(32); // dummy alloca to force r11 usage for exception handling
__asm__ __volatile__
(
@@ -287,11 +290,11 @@ static void callVirtualMethod(
}
//==================================================================================================
//============================================================================
static void cpp_call(
cppu_unoInterfaceProxy * pThis,
sal_Int32 nVtableCall,
typelib_TypeDescriptionReference * pReturnTypeRef,
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 )
{
@@ -313,22 +316,23 @@ 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 )
pCppReturn = *(void **)pCppStack = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
? alloca( pReturnTypeDescr->nSize )
: pUnoReturn); // direct way
*pPT++ = 'I'; //signify that a complex return type on stack
pCppStack += sizeof(void *);
}
}
// push this
*(void**)pCppStack = pThis->pCppI;
// push "this" pointer
void * pAdjustedThisPtr = reinterpret_cast< void ** >( pThis->getCppI() ) + aVtableSlot.offset;
*(void**)pCppStack = pAdjustedThisPtr;
pCppStack += sizeof( void* );
*pPT++ = 'I';
@@ -349,10 +353,10 @@ 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)
{
@@ -414,11 +418,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
@@ -444,7 +448,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...
@@ -462,13 +466,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 );
@@ -479,14 +483,16 @@ 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--; )
@@ -501,33 +507,40 @@ static void cpp_call(
TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
}
}
}
namespace bridges { namespace cpp_uno { namespace shared {
//==================================================================================================
void SAL_CALL cppu_unoInterfaceProxy_dispatch(
void unoInterfaceProxyDispatch(
uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
void * pReturn, void * pArgs[], uno_Any ** ppException ) throw ()
void * pReturn, void * pArgs[], uno_Any ** ppException )
{
#ifdef CMC_DEBUG
fprintf(stderr, "unoInterfaceProxyDispatch\n");
#endif
// 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 );
@@ -547,8 +560,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 );
@@ -560,14 +574,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
@@ -585,8 +598,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)
@@ -605,7 +618,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,
@@ -626,5 +639,5 @@ void SAL_CALL cppu_unoInterfaceProxy_dispatch(
}
}
}
} } }
/* vi:set tabstop=4 shiftwidth=4 expandtab: */