27#include <com/sun/star/uno/genfunc.hxx>
28#include <com/sun/star/uno/RuntimeException.hpp>
54 void const * pSV, sal_uInt32 & nr,
double * pFPR, sal_uInt64 *& pDS)
57 pFPR[nr++] = *
static_cast<double const *
>( pSV );
59 *pDS++ = *
static_cast<sal_uInt64
const *
>( pSV );
63 void const * pSV, sal_uInt32 & nr, sal_uInt64 * pGPR, sal_uInt64 *& pDS)
66 pGPR[nr++] = *
static_cast<sal_uInt64
const *
>( pSV );
68 *pDS++ = *
static_cast<sal_uInt64
const *
>( pSV );
72 void const * pSV, sal_uInt32 & nr, sal_uInt64 * pGPR, sal_uInt64 *& pDS)
75 pGPR[nr++] = *
static_cast<sal_uInt32
const *
>( pSV );
77 *pDS++ = *
static_cast<sal_uInt32
const *
>( pSV );
81 void const * pSV, sal_uInt32 & nr, sal_uInt64 * pGPR, sal_uInt64 *& pDS)
84 pGPR[nr++] = *
static_cast<sal_uInt16
const *
>( pSV );
86 *pDS++ = *
static_cast<sal_uInt16
const *
>( pSV );
90 void const * pSV, sal_uInt32 & nr, sal_uInt64 * pGPR, sal_uInt64 *& pDS)
93 pGPR[nr++] = *
static_cast<sal_uInt8 const *
>( pSV );
95 *pDS++ = *
static_cast<sal_uInt8 const *
>( pSV );
103 typelib_TypeDescriptionReference * pReturnTypeRef,
104 sal_Int32 nParams, typelib_MethodParameter * pParams,
105 void * pUnoReturn,
void * pUnoArgs[],
uno_Any ** ppUnoExc )
109 sal_uInt64 *pStack =
static_cast<sal_uInt64 *
>(__builtin_alloca( (nParams + 3) *
sizeof(sal_uInt64) ));
110 sal_uInt64 *pStackStart = pStack;
120 TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
121 assert(pReturnTypeDescr);
123 void * pCppReturn =
nullptr;
125 bool bSimpleReturn =
true;
126 if ( pReturnTypeDescr )
129 bSimpleReturn =
false;
132 pCppReturn = pUnoReturn;
137 __builtin_alloca( pReturnTypeDescr->nSize ) : pUnoReturn;
143 void * pAdjustedThisPtr =
reinterpret_cast< void **
>( pThis->
getCppI() ) + aVtableSlot.
offset;
147 void ** pCppArgs =
static_cast<void **
>(alloca( 3 *
sizeof(
void *) * nParams ));
149 sal_Int32 * pTempIndices =
reinterpret_cast<sal_Int32 *
>(pCppArgs + nParams);
153 sal_Int32 nTempIndices = 0;
157 const typelib_MethodParameter & rParam = pParams[
nPos];
159 TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
163 pCppArgs[
nPos] = alloca( 8 );
167 switch (pParamTypeDescr->eTypeClass)
169 case typelib_TypeClass_HYPER:
170 case typelib_TypeClass_UNSIGNED_HYPER:
173 case typelib_TypeClass_LONG:
174 case typelib_TypeClass_UNSIGNED_LONG:
175 case typelib_TypeClass_ENUM:
178 case typelib_TypeClass_SHORT:
179 case typelib_TypeClass_CHAR:
180 case typelib_TypeClass_UNSIGNED_SHORT:
183 case typelib_TypeClass_BOOLEAN:
184 case typelib_TypeClass_BYTE:
187 case typelib_TypeClass_FLOAT:
188 case typelib_TypeClass_DOUBLE:
196 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
203 pCppArgs[
nPos] = alloca( pParamTypeDescr->nSize );
205 pTempIndices[nTempIndices] =
nPos;
207 ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
212 pCppArgs[
nPos] = alloca( pParamTypeDescr->nSize );
216 pTempIndices[nTempIndices] =
nPos;
218 ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
224 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
234 pAdjustedThisPtr, aVtableSlot.
index,
235 pCppReturn, pReturnTypeRef, bSimpleReturn,
236 pStackStart, ( pStack - pStackStart ),
240 }
catch (
const std::exception & e) {
251 for ( ; nTempIndices--; )
253 sal_Int32
nIndex = pTempIndices[nTempIndices];
273 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
276 if (pCppReturn && pUnoReturn != pCppReturn)
289 for ( ; nTempIndices--; )
291 sal_Int32
nIndex = pTempIndices[nTempIndices];
294 TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
297 if (pReturnTypeDescr)
298 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
307 void * pReturn,
void * pArgs[],
uno_Any ** ppException )
313 switch (pMemberDescr->eTypeClass)
315 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
318 (
reinterpret_cast<typelib_InterfaceMemberTypeDescription
const *
>(pMemberDescr)
321 VtableSlot aVtableSlot(
324 typelib_InterfaceAttributeTypeDescription
const *
>(
332 reinterpret_cast<typelib_InterfaceAttributeTypeDescription
const *
>(pMemberDescr)->pAttributeTypeRef,
334 pReturn, pArgs, ppException );
339 typelib_MethodParameter aParam;
341 reinterpret_cast<typelib_InterfaceAttributeTypeDescription
const *
>(pMemberDescr)->pAttributeTypeRef;
345 typelib_TypeDescriptionReference * pReturnTypeRef =
nullptr;
346 OUString aVoidName(
"void");
348 &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
351 aVtableSlot.index += 1;
356 pReturn, pArgs, ppException );
363 case typelib_TypeClass_INTERFACE_METHOD:
366 (
reinterpret_cast<typelib_InterfaceMemberTypeDescription
const *
>(pMemberDescr)
369 VtableSlot aVtableSlot(
372 typelib_InterfaceMethodTypeDescription
const *
>(
375 switch (aVtableSlot.index)
379 (*pUnoI->acquire)( pUnoI );
380 *ppException =
nullptr;
383 (*pUnoI->release)( pUnoI );
384 *ppException =
nullptr;
389 TYPELIB_DANGER_GET( &pTD,
static_cast< Type *
>( pArgs[0] )->getTypeLibType() );
392 uno_Interface * pInterface =
nullptr;
395 reinterpret_cast<void **
>(&pInterface), pThis->
oid.pData,
reinterpret_cast<typelib_InterfaceTypeDescription *
>(pTD) );
400 static_cast< uno_Any *
>( pReturn ),
401 &pInterface, pTD,
nullptr );
402 (*pInterface->release)( pInterface );
403 TYPELIB_DANGER_RELEASE( pTD );
404 *ppException =
nullptr;
407 TYPELIB_DANGER_RELEASE( pTD );
415 reinterpret_cast<typelib_InterfaceMethodTypeDescription
const *
>(pMemberDescr)->pReturnTypeRef,
416 reinterpret_cast<typelib_InterfaceMethodTypeDescription
const *
>(pMemberDescr)->nParams,
417 reinterpret_cast<typelib_InterfaceMethodTypeDescription
const *
>(pMemberDescr)->pParams,
418 pReturn, pArgs, ppException );
424 ::com::sun::star::uno::RuntimeException aExc(
425 "illegal member type description!",
430 ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(),
nullptr );
uno_Mapping * getUno2Cpp()
uno_ExtEnvironment * getUnoEnv()
uno_Mapping * getCpp2Uno()
A uno proxy wrapping a cpp interface.
com::sun::star::uno::XInterface * getCppI()
typelib_InterfaceTypeDescription * pTypeDescr
void SAL_CALL uno_destructData(void *pValue, typelib_TypeDescription *pTypeDescr, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
void SAL_CALL uno_constructData(void *pMem, typelib_TypeDescription *pTypeDescr) SAL_THROW_EXTERN_C()
void SAL_CALL uno_copyAndConvertData(void *pDest, void *pSource, typelib_TypeDescription *pTypeDescr, uno_Mapping *mapping) SAL_THROW_EXTERN_C()
#define INSERT_INT32(pSV, nr, pGPR, pDS)
#define INSERT_INT8(pSV, nr, pGPR, pDS)
#define INSERT_INT16(pSV, nr, pGPR, pDS)
#define INSERT_INT64(pSV, nr, pGPR, pDS)
#define INSERT_FLOAT_DOUBLE(pSV, nr, pFPR, pDS)
static void cpp_call(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)
struct _typelib_TypeDescription typelib_TypeDescription
void fillUnoException(uno_Any *pUnoExc, uno_Mapping *pCpp2Uno)
void callVirtualMethod(void *pAdjustedThisPtr, sal_Int32 nVtableIndex, void *pRegisterReturn, typelib_TypeDescription *pReturnTypeDescr, bool bSimpleReturn, sal_Int32 *pStackLongs, sal_Int32 nStackLongs)
void unoInterfaceProxyDispatch(uno_Interface *pUnoI, typelib_TypeDescription const *pMemberDescr, void *pReturn, void **pArgs, uno_Any **ppException)
VtableSlot getVtableSlot(typelib_InterfaceAttributeTypeDescription const *ifcMember)
Calculates the vtable slot associated with an interface attribute member.
bool isSimpleType(typelib_TypeClass typeClass)
Determines whether a type is a "simple" type (VOID, BOOLEAN, BYTE, SHORT, UNSIGNED SHORT,...
bool relatesToInterfaceType(typelib_TypeDescription const *type)
Determines whether a type relates to an interface type (is itself an interface type,...
OUString runtimeToOUString(char const *runtimeString)
bool return_in_hidden_param(typelib_TypeDescriptionReference *pTypeRef) noexcept
Does function that returns this type use a hidden parameter, or registers?
const sal_uInt32 MAX_SSE_REGS
const sal_uInt32 MAX_GPR_REGS
Represents a vtable slot of a C++ class.
sal_Int32 index
The index within the vtable.
sal_Int32 offset
The offset of the vtable.
void SAL_CALL typelib_typedescriptionreference_new(typelib_TypeDescriptionReference **ppTDR, typelib_TypeClass eTypeClass, rtl_uString *pTypeName) SAL_THROW_EXTERN_C()
void SAL_CALL typelib_typedescriptionreference_release(typelib_TypeDescriptionReference *pRef) SAL_THROW_EXTERN_C()