1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
26 #include <com/sun/star/uno/Exception.hpp>
27 #include <com/sun/star/uno/RuntimeException.hpp>
28 #include <com/sun/star/uno/genfunc.hxx>
29 #include <o3tl/runtimetooustring.hxx>
34 #include "unointerfaceproxy.hxx"
35 #include "vtables.hxx"
43 using namespace ::com::sun::star::uno
;
47 #if defined(_CALL_ELF) && _CALL_ELF == 2
48 bool is_complex_struct(const typelib_TypeDescription
* type
)
50 const typelib_CompoundTypeDescription
* p
51 = reinterpret_cast< const typelib_CompoundTypeDescription
* >(type
);
52 for (sal_Int32 i
= 0; i
< p
->nMembers
; ++i
)
54 if (p
->ppTypeRefs
[i
]->eTypeClass
== typelib_TypeClass_STRUCT
||
55 p
->ppTypeRefs
[i
]->eTypeClass
== typelib_TypeClass_EXCEPTION
)
57 typelib_TypeDescription
* t
= 0;
58 TYPELIB_DANGER_GET(&t
, p
->ppTypeRefs
[i
]);
59 bool b
= is_complex_struct(t
);
60 TYPELIB_DANGER_RELEASE(t
);
65 else if (!bridges::cpp_uno::shared::isSimpleType(p
->ppTypeRefs
[i
]->eTypeClass
))
68 if (p
->pBaseTypeDescription
!= 0)
69 return is_complex_struct(&p
->pBaseTypeDescription
->aBase
);
74 bool return_in_hidden_param( typelib_TypeDescriptionReference
*pTypeRef
)
76 if (bridges::cpp_uno::shared::isSimpleType(pTypeRef
))
78 #if defined(_CALL_ELF) && _CALL_ELF == 2
79 else if (pTypeRef
->eTypeClass
== typelib_TypeClass_STRUCT
|| pTypeRef
->eTypeClass
== typelib_TypeClass_EXCEPTION
)
81 typelib_TypeDescription
* pTypeDescr
= 0;
82 TYPELIB_DANGER_GET( &pTypeDescr
, pTypeRef
);
84 //A Composite Type not larger than 16 bytes is returned in up to two GPRs
85 bool bRet
= pTypeDescr
->nSize
> 16 || is_complex_struct(pTypeDescr
);
87 TYPELIB_DANGER_RELEASE( pTypeDescr
);
95 void MapReturn(long r3
, long r4
, double dret
, typelib_TypeDescriptionReference
* pReturnType
, void *pRegisterReturn
)
97 switch (pReturnType
->eTypeClass
)
99 case typelib_TypeClass_HYPER
:
100 case typelib_TypeClass_UNSIGNED_HYPER
:
101 *reinterpret_cast<sal_uInt64
*>( pRegisterReturn
) = r3
;
103 case typelib_TypeClass_LONG
:
104 case typelib_TypeClass_UNSIGNED_LONG
:
105 case typelib_TypeClass_ENUM
:
106 *reinterpret_cast<sal_uInt32
*>( pRegisterReturn
) = r3
;
108 case typelib_TypeClass_CHAR
:
109 case typelib_TypeClass_SHORT
:
110 case typelib_TypeClass_UNSIGNED_SHORT
:
111 *reinterpret_cast<sal_uInt16
*>( pRegisterReturn
) = (unsigned short)r3
;
113 case typelib_TypeClass_BOOLEAN
:
114 case typelib_TypeClass_BYTE
:
115 *reinterpret_cast<sal_uInt8
*>( pRegisterReturn
) = (unsigned char)r3
;
117 case typelib_TypeClass_FLOAT
:
118 *reinterpret_cast<float *>( pRegisterReturn
) = dret
;
120 case typelib_TypeClass_DOUBLE
:
121 *reinterpret_cast<double *>( pRegisterReturn
) = dret
;
123 #if defined(_CALL_ELF) && _CALL_ELF == 2
124 case typelib_TypeClass_STRUCT
:
125 case typelib_TypeClass_EXCEPTION
:
126 if (!ppc64::return_in_hidden_param(pReturnType
))
128 sal_uInt64
*pRegisters
= reinterpret_cast<sal_uInt64
*>(pRegisterReturn
);
130 if (pReturnType
->pType
->nSize
> 8)
144 static void callVirtualMethod(void * pThis
, sal_uInt32 nVtableIndex
,
145 void * pRegisterReturn
, typelib_TypeDescription
* pReturnTypeDescr
,
146 sal_uInt64
*pStack
, sal_uInt32 nStack
,
147 sal_uInt64
*pGPR
, sal_uInt32 nGPR
,
148 double *pFPR
, sal_uInt32 nFPR
)
150 // Stack, if used, must be 16-bytes aligned
152 nStack
= ( nStack
+ 1 ) & ~1;
154 // Should not happen, but...
155 if ( nFPR
> ppc64::MAX_SSE_REGS
)
156 nFPR
= ppc64::MAX_SSE_REGS
;
157 if ( nGPR
> ppc64::MAX_GPR_REGS
)
158 nGPR
= ppc64::MAX_GPR_REGS
;
160 #if OSL_DEBUG_LEVEL > 2
161 // Let's figure out what is really going on here
163 fprintf( stderr
, "= callVirtualMethod() =\nGPR's (%d): ", nGPR
);
164 for ( sal_uInt32 i
= 0; i
< nGPR
; ++i
)
165 fprintf( stderr
, "0x%lx, ", pGPR
[i
] );
166 fprintf( stderr
, "\nFPR's (%d): ", nFPR
);
167 for ( sal_uInt32 i
= 0; i
< nFPR
; ++i
)
168 fprintf( stderr
, "0x%lx (%lf), ", (sal_Int64
)pFPR
[i
], pFPR
[i
] );
169 fprintf( stderr
, "\nStack (%d): ", nStack
);
170 for ( sal_uInt32 i
= 0; i
< nStack
; ++i
)
171 fprintf( stderr
, "0x%lx, ", pStack
[i
] );
172 fprintf( stderr
, "\n" );
176 // Load parameters to stack, if necessary
177 sal_uInt64
*stack
= (sal_uInt64
*) __builtin_alloca( nStack
* 8 );
178 memcpy( stack
, pStack
, nStack
* 8 );
180 // Get pointer to method
181 sal_uInt64 pMethod
= *((sal_uInt64
*)pThis
);
182 pMethod
+= 8 * nVtableIndex
;
183 pMethod
= *((sal_uInt64
*)pMethod
);
185 #if defined(_CALL_ELF) && _CALL_ELF == 2
186 typedef void (* FunctionCall
)(...);
188 typedef void (* FunctionCall
)( sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
);
190 FunctionCall pFunc
= (FunctionCall
)pMethod
;
192 volatile double dret
;
195 __asm__
__volatile__ (
210 : "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", "fr8", "fr9",
211 "fr10", "fr11", "fr12", "fr13"
214 // tell gcc that r3 to r11 are not available to it for doing the TOC and exception munge on the func call
215 register sal_uInt64 r3
asm("r3");
216 register sal_uInt64 r4
asm("r4");
218 (*pFunc
)(pGPR
[0], pGPR
[1], pGPR
[2], pGPR
[3], pGPR
[4], pGPR
[5], pGPR
[6], pGPR
[7]);
221 __asm__
__volatile__ (
225 : "=f" (dret
), "=r" (r3
), "=r" (r4
) : );
227 MapReturn(r3
, r4
, dret
, reinterpret_cast<typelib_TypeDescriptionReference
*>(pReturnTypeDescr
), pRegisterReturn
);
230 // Macros for easier insertion of values to registers or stack
231 // pSV - pointer to the source
232 // nr - order of the value [will be increased if stored to register]
233 // pFPR, pGPR - pointer to the registers
234 // pDS - pointer to the stack [will be increased if stored here]
236 // The value in %xmm register is already prepared to be retrieved as a float,
237 // thus we treat float and double the same
238 #define INSERT_FLOAT( pSV, nr, pFPR, nGPR, pDS, bOverflow ) \
239 if ( nGPR < ppc64::MAX_GPR_REGS ) \
241 if ( nr < ppc64::MAX_SSE_REGS ) \
242 pFPR[nr++] = *reinterpret_cast<float *>( pSV ); \
246 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
248 #define INSERT_DOUBLE( pSV, nr, pFPR, nGPR, pDS, bOverflow ) \
249 if ( nGPR < ppc64::MAX_GPR_REGS ) \
251 if ( nr < ppc64::MAX_SSE_REGS ) \
252 pFPR[nr++] = *reinterpret_cast<double *>( pSV ); \
256 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
258 #define INSERT_INT64( pSV, nr, pGPR, pDS, bOverflow ) \
259 if ( nr < ppc64::MAX_GPR_REGS ) \
260 pGPR[nr++] = *reinterpret_cast<sal_Int64 *>( pSV ); \
264 *pDS++ = *reinterpret_cast<sal_Int64 *>( pSV );
266 #define INSERT_UINT64( pSV, nr, pGPR, pDS, bOverflow ) \
267 if ( nr < ppc64::MAX_GPR_REGS ) \
268 pGPR[nr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \
272 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV );
274 #define INSERT_INT32( pSV, nr, pGPR, pDS, bOverflow ) \
275 if ( nr < ppc64::MAX_GPR_REGS ) \
276 pGPR[nr++] = *reinterpret_cast<sal_Int32 *>( pSV ); \
280 *pDS++ = *reinterpret_cast<sal_Int32 *>( pSV );
282 #define INSERT_UINT32( pSV, nr, pGPR, pDS, bOverflow ) \
283 if ( nr < ppc64::MAX_GPR_REGS ) \
284 pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \
288 *pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV );
290 #define INSERT_INT16( pSV, nr, pGPR, pDS, bOverflow ) \
291 if ( nr < ppc64::MAX_GPR_REGS ) \
292 pGPR[nr++] = *reinterpret_cast<sal_Int16 *>( pSV ); \
296 *pDS++ = *reinterpret_cast<sal_Int16 *>( pSV );
298 #define INSERT_UINT16( pSV, nr, pGPR, pDS, bOverflow ) \
299 if ( nr < ppc64::MAX_GPR_REGS ) \
300 pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \
304 *pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV );
306 #define INSERT_INT8( pSV, nr, pGPR, pDS, bOverflow ) \
307 if ( nr < ppc64::MAX_GPR_REGS ) \
308 pGPR[nr++] = *reinterpret_cast<sal_Int8 *>( pSV ); \
312 *pDS++ = *reinterpret_cast<sal_Int8 *>( pSV );
314 #define INSERT_UINT8( pSV, nr, pGPR, pDS, bOverflow ) \
315 if ( nr < ppc64::MAX_GPR_REGS ) \
316 pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \
320 *pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV );
322 static void cpp_call(
323 bridges::cpp_uno::shared::UnoInterfaceProxy
* pThis
,
324 bridges::cpp_uno::shared::VtableSlot aVtableSlot
,
325 typelib_TypeDescriptionReference
* pReturnTypeRef
,
326 sal_Int32 nParams
, typelib_MethodParameter
* pParams
,
327 void * pUnoReturn
, void * pUnoArgs
[], uno_Any
** ppUnoExc
)
329 #if OSL_DEBUG_LEVEL > 2
330 fprintf( stderr
, "= cpp_call() =\n" );
333 // max space for: [complex ret ptr], values|ptr ...
334 sal_uInt64
* pStack
= (sal_uInt64
*)alloca( (nParams
+3) * sizeof(sal_Int64
) );
335 sal_uInt64
* pStackStart
= pStack
;
337 sal_uInt64 pGPR
[ppc64::MAX_GPR_REGS
];
340 double pFPR
[ppc64::MAX_SSE_REGS
];
344 typelib_TypeDescription
* pReturnTypeDescr
= 0;
345 TYPELIB_DANGER_GET( &pReturnTypeDescr
, pReturnTypeRef
);
346 assert(pReturnTypeDescr
);
348 void * pCppReturn
= 0; // if != 0 && != pUnoReturn, needs reconversion
350 bool bOverflow
= false;
352 if (pReturnTypeDescr
)
354 #if OSL_DEBUG_LEVEL > 2
355 fprintf(stderr
, "return type is %d\n", pReturnTypeDescr
->eTypeClass
);
357 bool bSimpleReturn
=!ppc64::return_in_hidden_param(pReturnTypeRef
);
361 pCppReturn
= pUnoReturn
; // direct way for simple types
362 #if OSL_DEBUG_LEVEL > 2
363 fprintf(stderr
, "simple return\n");
368 // complex return via ptr
369 pCppReturn
= (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr
)
370 ? alloca( pReturnTypeDescr
->nSize
) : pUnoReturn
);
371 #if OSL_DEBUG_LEVEL > 2
372 fprintf(stderr
, "pCppReturn/pUnoReturn is %p/%p\n", pCppReturn
, pUnoReturn
);
374 INSERT_UINT64( &pCppReturn
, nGPR
, pGPR
, pStack
, bOverflow
);
377 // push "this" pointer
378 void * pAdjustedThisPtr
= reinterpret_cast< void ** >( pThis
->getCppI() ) + aVtableSlot
.offset
;
379 #if OSL_DEBUG_LEVEL > 2
380 fprintf(stderr
, "this pointer is %p\n", pAdjustedThisPtr
);
382 INSERT_UINT64( &pAdjustedThisPtr
, nGPR
, pGPR
, pStack
, bOverflow
);
385 void ** pCppArgs
= (void **)alloca( 3 * sizeof(void *) * nParams
);
386 // indices of values this have to be converted (interface conversion cpp<=>uno)
387 sal_Int32
* pTempIndices
= (sal_Int32
*)(pCppArgs
+ nParams
);
388 // type descriptions for reconversions
389 typelib_TypeDescription
** ppTempParamTypeDescr
= (typelib_TypeDescription
**)(pCppArgs
+ (2 * nParams
));
391 sal_Int32 nTempIndices
= 0;
393 #if OSL_DEBUG_LEVEL > 2
394 fprintf(stderr
, "n params is %d\n", nParams
);
397 for ( sal_Int32 nPos
= 0; nPos
< nParams
; ++nPos
)
399 const typelib_MethodParameter
& rParam
= pParams
[nPos
];
400 typelib_TypeDescription
* pParamTypeDescr
= 0;
401 TYPELIB_DANGER_GET( &pParamTypeDescr
, rParam
.pTypeRef
);
403 #if OSL_DEBUG_LEVEL > 2
404 fprintf(stderr
, "param %d is %d %d %d\n", nPos
, rParam
.bOut
, bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr
),
405 pParamTypeDescr
->eTypeClass
);
408 if (!rParam
.bOut
&& bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr
))
410 uno_copyAndConvertData( pCppArgs
[nPos
] = pStack
, pUnoArgs
[nPos
], pParamTypeDescr
,
411 pThis
->getBridge()->getUno2Cpp() );
412 switch (pParamTypeDescr
->eTypeClass
)
414 case typelib_TypeClass_HYPER
:
415 #if OSL_DEBUG_LEVEL > 2
416 fprintf(stderr
, "hyper is 0x%lx\n", *(sal_Int64
*)pCppArgs
[nPos
]);
418 INSERT_INT64( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
420 case typelib_TypeClass_UNSIGNED_HYPER
:
421 #if OSL_DEBUG_LEVEL > 2
422 fprintf(stderr
, "uhyper is 0x%lx\n", *(sal_Int64
*)pCppArgs
[nPos
]);
424 INSERT_UINT64( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
426 case typelib_TypeClass_LONG
:
427 case typelib_TypeClass_ENUM
:
428 #if OSL_DEBUG_LEVEL > 2
429 fprintf(stderr
, "long is 0x%x\n", *(sal_Int32
*)pCppArgs
[nPos
]);
431 INSERT_INT32( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
433 case typelib_TypeClass_UNSIGNED_LONG
:
434 #if OSL_DEBUG_LEVEL > 2
435 fprintf(stderr
, "ulong is 0x%x\n", *(sal_Int32
*)pCppArgs
[nPos
]);
437 INSERT_UINT32( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
439 case typelib_TypeClass_SHORT
:
440 INSERT_INT16( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
442 case typelib_TypeClass_CHAR
:
443 case typelib_TypeClass_UNSIGNED_SHORT
:
444 INSERT_UINT16( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
446 case typelib_TypeClass_BOOLEAN
:
447 INSERT_UINT8( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
449 case typelib_TypeClass_BYTE
:
450 INSERT_INT8( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
452 case typelib_TypeClass_FLOAT
:
453 INSERT_FLOAT( pCppArgs
[nPos
], nFPR
, pFPR
, nGPR
, pStack
, bOverflow
);
455 case typelib_TypeClass_DOUBLE
:
456 INSERT_DOUBLE( pCppArgs
[nPos
], nFPR
, pFPR
, nGPR
, pStack
, bOverflow
);
463 TYPELIB_DANGER_RELEASE( pParamTypeDescr
);
466 else // ptr to complex value | ref
468 #if OSL_DEBUG_LEVEL > 2
469 fprintf(stderr
, "complex type again %d\n", rParam
.bIn
);
471 if (! rParam
.bIn
) // is pure out
473 #if OSL_DEBUG_LEVEL > 2
474 fprintf(stderr
, "complex size is %d\n", pParamTypeDescr
->nSize
);
476 // cpp out is constructed mem, uno out is not!
478 pCppArgs
[nPos
] = alloca( pParamTypeDescr
->nSize
),
480 pTempIndices
[nTempIndices
] = nPos
; // default constructed for cpp call
481 // will be released at reconversion
482 ppTempParamTypeDescr
[nTempIndices
++] = pParamTypeDescr
;
485 else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr
))
487 #if OSL_DEBUG_LEVEL > 2
488 fprintf(stderr
, "this one\n");
490 uno_copyAndConvertData(
491 pCppArgs
[nPos
] = alloca( pParamTypeDescr
->nSize
),
492 pUnoArgs
[nPos
], pParamTypeDescr
, pThis
->getBridge()->getUno2Cpp() );
494 pTempIndices
[nTempIndices
] = nPos
; // has to be reconverted
495 // will be released at reconversion
496 ppTempParamTypeDescr
[nTempIndices
++] = pParamTypeDescr
;
500 #if OSL_DEBUG_LEVEL > 2
501 fprintf(stderr
, "that one, passing %p through\n", pUnoArgs
[nPos
]);
503 pCppArgs
[nPos
] = pUnoArgs
[nPos
];
505 TYPELIB_DANGER_RELEASE( pParamTypeDescr
);
507 INSERT_UINT64( &(pCppArgs
[nPos
]), nGPR
, pGPR
, pStack
, bOverflow
);
515 pAdjustedThisPtr
, aVtableSlot
.index
,
516 pCppReturn
, pReturnTypeDescr
,
517 pStackStart
, ( pStack
- pStackStart
),
520 } catch (css::uno::Exception
&) {
522 } catch (std::exception
& e
) {
523 throw css::uno::RuntimeException(
524 "C++ code threw " + o3tl::runtimeToOUString(typeid(e
).name()) + ": "
525 + o3tl::runtimeToOUString(e
.what()));
527 throw css::uno::RuntimeException("C++ code threw unknown exception");
529 // NO exception occurred...
532 // reconvert temporary params
533 for ( ; nTempIndices
--; )
535 sal_Int32 nIndex
= pTempIndices
[nTempIndices
];
536 typelib_TypeDescription
* pParamTypeDescr
= ppTempParamTypeDescr
[nTempIndices
];
538 if (pParams
[nIndex
].bIn
)
540 if (pParams
[nIndex
].bOut
) // inout
542 uno_destructData( pUnoArgs
[nIndex
], pParamTypeDescr
, 0 ); // destroy uno value
543 uno_copyAndConvertData( pUnoArgs
[nIndex
], pCppArgs
[nIndex
], pParamTypeDescr
,
544 pThis
->getBridge()->getCpp2Uno() );
549 uno_copyAndConvertData( pUnoArgs
[nIndex
], pCppArgs
[nIndex
], pParamTypeDescr
,
550 pThis
->getBridge()->getCpp2Uno() );
552 // destroy temp cpp param => cpp: every param was constructed
553 uno_destructData( pCppArgs
[nIndex
], pParamTypeDescr
, cpp_release
);
555 TYPELIB_DANGER_RELEASE( pParamTypeDescr
);
558 if (pCppReturn
&& pUnoReturn
!= pCppReturn
)
560 uno_copyAndConvertData( pUnoReturn
, pCppReturn
, pReturnTypeDescr
,
561 pThis
->getBridge()->getCpp2Uno() );
562 uno_destructData( pCppReturn
, pReturnTypeDescr
, cpp_release
);
567 // fill uno exception
568 CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc
, pThis
->getBridge()->getCpp2Uno());
571 for ( ; nTempIndices
--; )
573 sal_Int32 nIndex
= pTempIndices
[nTempIndices
];
574 // destroy temp cpp param => cpp: every param was constructed
575 uno_destructData( pCppArgs
[nIndex
], ppTempParamTypeDescr
[nTempIndices
], cpp_release
);
576 TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr
[nTempIndices
] );
579 if (pReturnTypeDescr
)
580 TYPELIB_DANGER_RELEASE( pReturnTypeDescr
);
586 namespace bridges::cpp_uno::shared
{
588 void unoInterfaceProxyDispatch(
589 uno_Interface
* pUnoI
, const typelib_TypeDescription
* pMemberDescr
,
590 void * pReturn
, void * pArgs
[], uno_Any
** ppException
)
593 bridges::cpp_uno::shared::UnoInterfaceProxy
* pThis
594 = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy
*> (pUnoI
);
596 switch (pMemberDescr
->eTypeClass
)
598 case typelib_TypeClass_INTERFACE_ATTRIBUTE
:
601 VtableSlot
aVtableSlot(
604 typelib_InterfaceAttributeTypeDescription
const * >(
609 // dependent dispatch
612 ((typelib_InterfaceAttributeTypeDescription
*)pMemberDescr
)->pAttributeTypeRef
,
614 pReturn
, pArgs
, ppException
);
619 typelib_MethodParameter aParam
;
621 ((typelib_InterfaceAttributeTypeDescription
*)pMemberDescr
)->pAttributeTypeRef
;
622 aParam
.bIn
= sal_True
;
623 aParam
.bOut
= sal_False
;
625 typelib_TypeDescriptionReference
* pReturnTypeRef
= 0;
626 OUString
aVoidName("void");
627 typelib_typedescriptionreference_new(
628 &pReturnTypeRef
, typelib_TypeClass_VOID
, aVoidName
.pData
);
630 // dependent dispatch
631 aVtableSlot
.index
+= 1; //get then set method
636 pReturn
, pArgs
, ppException
);
638 typelib_typedescriptionreference_release( pReturnTypeRef
);
643 case typelib_TypeClass_INTERFACE_METHOD
:
646 VtableSlot
aVtableSlot(
649 typelib_InterfaceMethodTypeDescription
const * >(
651 switch (aVtableSlot
.index
)
654 case 1: // acquire uno interface
655 (*pUnoI
->acquire
)( pUnoI
);
658 case 2: // release uno interface
659 (*pUnoI
->release
)( pUnoI
);
662 case 0: // queryInterface() opt
664 typelib_TypeDescription
* pTD
= 0;
665 TYPELIB_DANGER_GET( &pTD
, reinterpret_cast< Type
* >( pArgs
[0] )->getTypeLibType() );
668 uno_Interface
* pInterface
= 0;
669 (*pThis
->pBridge
->getUnoEnv()->getRegisteredInterface
)(
670 pThis
->pBridge
->getUnoEnv(),
671 (void **)&pInterface
, pThis
->oid
.pData
, (typelib_InterfaceTypeDescription
*)pTD
);
676 reinterpret_cast< uno_Any
* >( pReturn
),
677 &pInterface
, pTD
, 0 );
678 (*pInterface
->release
)( pInterface
);
679 TYPELIB_DANGER_RELEASE( pTD
);
683 TYPELIB_DANGER_RELEASE( pTD
);
685 } // else perform queryInterface()
687 // dependent dispatch
690 ((typelib_InterfaceMethodTypeDescription
*)pMemberDescr
)->pReturnTypeRef
,
691 ((typelib_InterfaceMethodTypeDescription
*)pMemberDescr
)->nParams
,
692 ((typelib_InterfaceMethodTypeDescription
*)pMemberDescr
)->pParams
,
693 pReturn
, pArgs
, ppException
);
699 ::com::sun::star::uno::RuntimeException
aExc(
700 "illegal member type description!",
701 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>() );
703 Type
const & rExcType
= cppu::UnoType
<decltype(aExc
)>::get();
704 // binary identical null reference
705 ::uno_type_any_construct( *ppException
, &aExc
, rExcType
.getTypeLibType(), 0 );
712 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */