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
;
45 void MapReturn(const ia64::RegReturn
&rRet
, double dret
, typelib_TypeDescription
* pReturnTypeDescr
, bool bSimpleReturn
, sal_uInt64
*pRegisterReturn
)
47 switch (pReturnTypeDescr
->eTypeClass
)
49 case typelib_TypeClass_HYPER
:
50 case typelib_TypeClass_UNSIGNED_HYPER
:
51 case typelib_TypeClass_LONG
:
52 case typelib_TypeClass_UNSIGNED_LONG
:
53 case typelib_TypeClass_ENUM
:
54 *pRegisterReturn
= rRet
.r8
;
56 case typelib_TypeClass_CHAR
:
57 case typelib_TypeClass_SHORT
:
58 case typelib_TypeClass_UNSIGNED_SHORT
:
59 *pRegisterReturn
= (unsigned short)rRet
.r8
;
61 case typelib_TypeClass_BOOLEAN
:
62 case typelib_TypeClass_BYTE
:
63 *pRegisterReturn
= (unsigned char)rRet
.r8
;
65 case typelib_TypeClass_FLOAT
:
66 *reinterpret_cast<float *>( pRegisterReturn
) = dret
;
68 case typelib_TypeClass_DOUBLE
:
69 *reinterpret_cast<double *>( pRegisterReturn
) = dret
;
71 case typelib_TypeClass_STRUCT
:
72 case typelib_TypeClass_EXCEPTION
:
74 sal_uInt32 nRetSize
= pReturnTypeDescr
->nSize
;
75 if (bSimpleReturn
&& nRetSize
<= 32 && nRetSize
> 0)
76 memcpy(pRegisterReturn
, (void*)&rRet
, nRetSize
);
86 bool is_complex_struct(const typelib_TypeDescription
* type
)
88 const typelib_CompoundTypeDescription
* p
89 = reinterpret_cast< const typelib_CompoundTypeDescription
* >(type
);
90 for (sal_Int32 i
= 0; i
< p
->nMembers
; ++i
)
92 if (p
->ppTypeRefs
[i
]->eTypeClass
== typelib_TypeClass_STRUCT
||
93 p
->ppTypeRefs
[i
]->eTypeClass
== typelib_TypeClass_EXCEPTION
)
95 typelib_TypeDescription
* t
= 0;
96 TYPELIB_DANGER_GET(&t
, p
->ppTypeRefs
[i
]);
97 bool b
= is_complex_struct(t
);
98 TYPELIB_DANGER_RELEASE(t
);
103 else if (!bridges::cpp_uno::shared::isSimpleType(p
->ppTypeRefs
[i
]->eTypeClass
))
106 if (p
->pBaseTypeDescription
!= 0)
107 return is_complex_struct(&p
->pBaseTypeDescription
->aBase
);
111 bool is_complex_struct( typelib_TypeDescriptionReference
*pTypeRef
)
113 if (pTypeRef
->eTypeClass
== typelib_TypeClass_STRUCT
|| pTypeRef
->eTypeClass
== typelib_TypeClass_EXCEPTION
)
115 typelib_TypeDescription
* pTypeDescr
= 0;
116 TYPELIB_DANGER_GET( &pTypeDescr
, pTypeRef
);
118 bool bRet
= is_complex_struct( pTypeDescr
);
119 TYPELIB_DANGER_RELEASE( pTypeDescr
);
126 bool return_via_r8_buffer( typelib_TypeDescriptionReference
*pTypeRef
)
128 if (pTypeRef
->eTypeClass
== typelib_TypeClass_STRUCT
|| pTypeRef
->eTypeClass
== typelib_TypeClass_EXCEPTION
)
130 if (is_complex_struct( pTypeRef
)) return false;
132 typelib_TypeDescription
* pTypeDescr
= 0;
133 TYPELIB_DANGER_GET( &pTypeDescr
, pTypeRef
);
135 /* If the struct is larger than 32 bytes, then there is a buffer at r8 to stick the return value into */
136 bool bRet
= pTypeDescr
->nSize
> 32;
137 TYPELIB_DANGER_RELEASE( pTypeDescr
);
143 bool return_in_hidden_param( typelib_TypeDescriptionReference
*pTypeRef
)
145 if (bridges::cpp_uno::shared::isSimpleType(pTypeRef
))
147 else if (pTypeRef
->eTypeClass
== typelib_TypeClass_STRUCT
|| pTypeRef
->eTypeClass
== typelib_TypeClass_EXCEPTION
)
148 return is_complex_struct( pTypeRef
);
158 static void callVirtualMethod(void * pThis
, sal_uInt32 nVtableIndex
,
159 void * pRegisterReturn
, typelib_TypeDescription
* pReturnTypeDescr
, bool bSimpleReturn
,
160 sal_uInt64
*pStack
, sal_uInt32 nStack
,
161 sal_uInt64
*pGPR
, sal_uInt32 nGPR
,
162 double *pFPR
, sal_uInt32 nFPR
)
164 // Stack, if used, must be 16-bytes aligned
166 nStack
= ( nStack
+ 1 ) & ~1;
168 // Should not happen, but...
169 if ( nFPR
> ia64::MAX_SSE_REGS
)
170 nFPR
= ia64::MAX_SSE_REGS
;
171 if ( nGPR
> ia64::MAX_GPR_REGS
)
172 nGPR
= ia64::MAX_GPR_REGS
;
174 #if OSL_DEBUG_LEVEL > 2
175 // Let's figure out what is really going on here
177 fprintf( stderr
, "= callVirtualMethod() =\nGPR's (%d): ", nGPR
);
178 for ( unsigned int i
= 0; i
< nGPR
; ++i
)
179 fprintf( stderr
, "0x%lx, ", pGPR
[i
] );
180 fprintf( stderr
, "\nFPR's (%d): ", nFPR
);
181 for ( unsigned int i
= 0; i
< nFPR
; ++i
)
182 fprintf( stderr
, "0x%lx (%f), ", pFPR
[i
], pFPR
[i
] );
183 fprintf( stderr
, "\nStack (%d): ", nStack
);
184 for ( unsigned int i
= 0; i
< nStack
; ++i
)
185 fprintf( stderr
, "0x%lx, ", pStack
[i
] );
186 fprintf( stderr
, "\n" );
187 fprintf( stderr
, "pRegisterReturn is %p\n", pRegisterReturn
);
191 // Load parameters to stack, if necessary
192 sal_uInt64
*stack
= (sal_uInt64
*) __builtin_alloca( nStack
* 8 );
193 memcpy( stack
, pStack
, nStack
* 8 );
195 // To get pointer to method
196 // a) get the address of the vtable
197 sal_uInt64 pMethod
= *((sal_uInt64
*)pThis
);
198 // b) get the address from the vtable entry at offset, each entry is 16bytes,
199 // 8 for function pointer, and 8 for global pointer
200 pMethod
+= 16 * nVtableIndex
;
202 typedef void (* FunctionCall
)( sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
);
203 FunctionCall pFunc
= (FunctionCall
)pMethod
;
205 switch (nFPR
) //deliberate fall through
208 asm volatile("ldfd f15=%0" : : "m"(pFPR
[7]) : "f15");
210 asm volatile("ldfd f14=%0" : : "m"(pFPR
[6]) : "f14");
212 asm volatile("ldfd f13=%0" : : "m"(pFPR
[5]) : "f13");
214 asm volatile("ldfd f12=%0" : : "m"(pFPR
[4]) : "f12");
216 asm volatile("ldfd f11=%0" : : "m"(pFPR
[3]) : "f11");
218 asm volatile("ldfd f10=%0" : : "m"(pFPR
[2]) : "f10");
220 asm volatile("ldfd f9=%0" : : "m"(pFPR
[1]) : "f9");
222 asm volatile("ldfd f8=%0" : : "m"(pFPR
[0]) : "f8");
227 //stick the return area into r8 for big struct returning
228 asm volatile("ld8 r8=%0" : : "m"(pRegisterReturn
) : "r8");
230 (*pFunc
)(pGPR
[0], pGPR
[1], pGPR
[2], pGPR
[3], pGPR
[4], pGPR
[5], pGPR
[6], pGPR
[7]);
232 register double f8
asm("f8");
235 register long r8
asm("r8"); ret
.r8
= r8
;
236 register long r9
asm("r9"); ret
.r9
= r9
;
237 register long r10
asm("r10"); ret
.r10
= r10
;
238 register long r11
asm("r11"); ret
.r11
= r11
;
241 MapReturn(ret
, f8
, pReturnTypeDescr
, bSimpleReturn
, (sal_uInt64
*)pRegisterReturn
);
244 // Macros for easier insertion of values to registers or stack
245 // pSV - pointer to the source
246 // nr - order of the value [will be increased if stored to register]
247 // pFPR, pGPR - pointer to the registers
248 // pDS - pointer to the stack [will be increased if stored here]
250 // The value in %xmm register is already prepared to be retrieved as a float,
251 // thus we treat float and double the same
252 #define INSERT_FLOAT( pSV, nfr, pFPR, ngr, pGPR, pDS, bOverflow ) \
253 if ( nfr < ia64::MAX_SSE_REGS && ngr < ia64::MAX_GPR_REGS ) \
254 pFPR[nfr++] = *reinterpret_cast<float *>( pSV ); \
255 if ( ngr < ia64::MAX_GPR_REGS ) \
256 pGPR[ngr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \
260 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
262 #define INSERT_DOUBLE( pSV, nfr, pFPR, ngr, pGPR, pDS, bOverflow ) \
263 if ( nfr < ia64::MAX_SSE_REGS && ngr < ia64::MAX_GPR_REGS ) \
264 pFPR[nfr++] = *reinterpret_cast<double *>( pSV ); \
265 if ( ngr < ia64::MAX_GPR_REGS ) \
266 pGPR[ngr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \
270 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
272 #define INSERT_INT64( pSV, nr, pGPR, pDS, bOverflow ) \
273 if ( nr < ia64::MAX_GPR_REGS ) \
274 pGPR[nr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \
278 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV );
280 #define INSERT_INT32( pSV, nr, pGPR, pDS, bOverflow ) \
281 if ( nr < ia64::MAX_GPR_REGS ) \
282 pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \
286 *pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV );
288 #define INSERT_INT16( pSV, nr, pGPR, pDS, bOverflow ) \
289 if ( nr < ia64::MAX_GPR_REGS ) \
290 pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \
294 *pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV );
296 #define INSERT_INT8( pSV, nr, pGPR, pDS, bOverflow ) \
297 if ( nr < ia64::MAX_GPR_REGS ) \
298 pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \
302 *pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV );
304 static void cpp_call(
305 bridges::cpp_uno::shared::UnoInterfaceProxy
* pThis
,
306 bridges::cpp_uno::shared::VtableSlot aVtableSlot
,
307 typelib_TypeDescriptionReference
* pReturnTypeRef
,
308 sal_Int32 nParams
, typelib_MethodParameter
* pParams
,
309 void * pUnoReturn
, void * pUnoArgs
[], uno_Any
** ppUnoExc
)
311 // max space for: [complex ret ptr], values|ptr ...
312 sal_uInt64
* pStack
= (sal_uInt64
*)alloca( (nParams
+3) * sizeof(sal_Int64
) );
313 sal_uInt64
* pStackStart
= pStack
;
315 sal_uInt64 pGPR
[ia64::MAX_GPR_REGS
];
318 double pFPR
[ia64::MAX_SSE_REGS
];
322 typelib_TypeDescription
* pReturnTypeDescr
= 0;
323 TYPELIB_DANGER_GET( &pReturnTypeDescr
, pReturnTypeRef
);
324 assert(pReturnTypeDescr
);
326 void * pCppReturn
= 0; // if != 0 && != pUnoReturn, needs reconversion
328 bool bOverflow
= false;
330 bool bSimpleReturn
= true;
331 if (pReturnTypeDescr
)
333 #if OSL_DEBUG_LEVEL > 2
334 fprintf(stderr
, "return type is %d\n", pReturnTypeDescr
->eTypeClass
);
336 if ( ia64::return_in_hidden_param(pReturnTypeRef
) || ia64::return_via_r8_buffer(pReturnTypeRef
) )
337 bSimpleReturn
= false;
341 pCppReturn
= pUnoReturn
; // direct way for simple types
342 #if OSL_DEBUG_LEVEL > 2
343 fprintf(stderr
, "simple return\n");
348 // complex return via ptr
349 pCppReturn
= (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr
)
350 ? alloca( pReturnTypeDescr
->nSize
) : pUnoReturn
);
351 #if OSL_DEBUG_LEVEL > 2
352 fprintf(stderr
, "pCppReturn/pUnoReturn is %lx/%lx", pCppReturn
, pUnoReturn
);
354 if (!ia64::return_via_r8_buffer(pReturnTypeRef
))
355 INSERT_INT64( &pCppReturn
, nGPR
, pGPR
, pStack
, bOverflow
);
358 // push "this" pointer
359 void * pAdjustedThisPtr
= reinterpret_cast< void ** >( pThis
->getCppI() ) + aVtableSlot
.offset
;
361 #if OSL_DEBUG_LEVEL > 2
362 fprintf(stderr
, "this pointer is %p\n", pAdjustedThisPtr
);
364 INSERT_INT64( &pAdjustedThisPtr
, nGPR
, pGPR
, pStack
, bOverflow
);
367 void ** pCppArgs
= (void **)alloca( 3 * sizeof(void *) * nParams
);
368 // indices of values this have to be converted (interface conversion cpp<=>uno)
369 sal_Int32
* pTempIndices
= (sal_Int32
*)(pCppArgs
+ nParams
);
370 // type descriptions for reconversions
371 typelib_TypeDescription
** ppTempParamTypeDescr
= (typelib_TypeDescription
**)(pCppArgs
+ (2 * nParams
));
373 sal_Int32 nTempIndices
= 0;
375 #if OSL_DEBUG_LEVEL > 2
376 fprintf(stderr
, "n params is %d\n", nParams
);
379 for ( sal_Int32 nPos
= 0; nPos
< nParams
; ++nPos
)
381 const typelib_MethodParameter
& rParam
= pParams
[nPos
];
382 typelib_TypeDescription
* pParamTypeDescr
= 0;
383 TYPELIB_DANGER_GET( &pParamTypeDescr
, rParam
.pTypeRef
);
385 #if OSL_DEBUG_LEVEL > 2
386 fprintf(stderr
, "param %d is %d %d %d\n", nPos
, rParam
.bOut
, bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr
),
387 pParamTypeDescr
->eTypeClass
);
390 if (!rParam
.bOut
&& bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr
))
392 // uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr,
393 uno_copyAndConvertData( pCppArgs
[nPos
] = pStack
, pUnoArgs
[nPos
], pParamTypeDescr
,
394 pThis
->getBridge()->getUno2Cpp() );
395 switch (pParamTypeDescr
->eTypeClass
)
397 case typelib_TypeClass_HYPER
:
398 case typelib_TypeClass_UNSIGNED_HYPER
:
399 #if OSL_DEBUG_LEVEL > 2
400 fprintf(stderr
, "hyper is %lx\n", *(unsigned long*)(pCppArgs
[nPos
]));
402 INSERT_INT64( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
404 case typelib_TypeClass_LONG
:
405 case typelib_TypeClass_UNSIGNED_LONG
:
406 case typelib_TypeClass_ENUM
:
407 #if OSL_DEBUG_LEVEL > 2
408 fprintf(stderr
, "long is %lx\n", *(unsigned int*)(pCppArgs
[nPos
]));
410 INSERT_INT32( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
412 case typelib_TypeClass_SHORT
:
413 case typelib_TypeClass_CHAR
:
414 case typelib_TypeClass_UNSIGNED_SHORT
:
415 #if OSL_DEBUG_LEVEL > 2
416 fprintf(stderr
, "short is %x\n", *(unsigned short*)(pCppArgs
[nPos
]));
418 INSERT_INT16( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
420 case typelib_TypeClass_BOOLEAN
:
421 case typelib_TypeClass_BYTE
:
422 #if OSL_DEBUG_LEVEL > 2
423 fprintf(stderr
, "byte is %x\n", *(unsigned char*)(pCppArgs
[nPos
]));
425 INSERT_INT8( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverflow
);
427 case typelib_TypeClass_FLOAT
:
428 #if OSL_DEBUG_LEVEL > 2
429 fprintf(stderr
, "a float is %f\n", *(float*)(pCppArgs
[nPos
]));
430 fprintf(stderr
, "b float is %f\n", *(double*)(pCppArgs
[nPos
]));
432 INSERT_FLOAT( pCppArgs
[nPos
], nFPR
, pFPR
, nGPR
, pGPR
, pStack
, bOverflow
);
434 case typelib_TypeClass_DOUBLE
:
435 #if OSL_DEBUG_LEVEL > 2
436 fprintf(stderr
, "double is %f\n", *(double*)(pCppArgs
[nPos
]));
438 INSERT_DOUBLE( pCppArgs
[nPos
], nFPR
, pFPR
, nGPR
, pGPR
, pStack
, bOverflow
);
445 TYPELIB_DANGER_RELEASE( pParamTypeDescr
);
448 else // ptr to complex value | ref
450 #if OSL_DEBUG_LEVEL > 2
451 fprintf(stderr
, "complex type again %d\n", rParam
.bIn
);
453 if (! rParam
.bIn
) // is pure out
455 #if OSL_DEBUG_LEVEL > 2
456 fprintf(stderr
, "complex size is %d\n", pParamTypeDescr
->nSize
);
458 // cpp out is constructed mem, uno out is not!
460 pCppArgs
[nPos
] = alloca( pParamTypeDescr
->nSize
),
462 pTempIndices
[nTempIndices
] = nPos
; // default constructed for cpp call
463 // will be released at reconversion
464 ppTempParamTypeDescr
[nTempIndices
++] = pParamTypeDescr
;
467 else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr
))
469 #if OSL_DEBUG_LEVEL > 2
470 fprintf(stderr
, "this one\n");
472 uno_copyAndConvertData(
473 pCppArgs
[nPos
] = alloca( pParamTypeDescr
->nSize
),
474 pUnoArgs
[nPos
], pParamTypeDescr
, pThis
->getBridge()->getUno2Cpp() );
476 pTempIndices
[nTempIndices
] = nPos
; // has to be reconverted
477 // will be released at reconversion
478 ppTempParamTypeDescr
[nTempIndices
++] = pParamTypeDescr
;
482 #if OSL_DEBUG_LEVEL > 2
483 fprintf(stderr
, "that one, passing %lx through\n", pUnoArgs
[nPos
]);
485 pCppArgs
[nPos
] = pUnoArgs
[nPos
];
487 TYPELIB_DANGER_RELEASE( pParamTypeDescr
);
489 INSERT_INT64( &(pCppArgs
[nPos
]), nGPR
, pGPR
, pStack
, bOverflow
);
497 pAdjustedThisPtr
, aVtableSlot
.index
,
498 pCppReturn
, pReturnTypeDescr
, bSimpleReturn
,
499 pStackStart
, ( pStack
- pStackStart
),
502 } catch (css::uno::Exception
&) {
504 } catch (std::exception
& e
) {
505 throw css::uno::RuntimeException(
506 "C++ code threw " + o3tl::runtimeToOUString(typeid(e
).name()) + ": "
507 + o3tl::runtimeToOUString(e
.what()));
509 throw css::uno::RuntimeException("C++ code threw unknown exception");
511 // NO exception occurred...
514 // reconvert temporary params
515 for ( ; nTempIndices
--; )
517 sal_Int32 nIndex
= pTempIndices
[nTempIndices
];
518 typelib_TypeDescription
* pParamTypeDescr
= ppTempParamTypeDescr
[nTempIndices
];
520 if (pParams
[nIndex
].bIn
)
522 if (pParams
[nIndex
].bOut
) // inout
524 uno_destructData( pUnoArgs
[nIndex
], pParamTypeDescr
, 0 ); // destroy uno value
525 uno_copyAndConvertData( pUnoArgs
[nIndex
], pCppArgs
[nIndex
], pParamTypeDescr
,
526 pThis
->getBridge()->getCpp2Uno() );
531 uno_copyAndConvertData( pUnoArgs
[nIndex
], pCppArgs
[nIndex
], pParamTypeDescr
,
532 pThis
->getBridge()->getCpp2Uno() );
534 // destroy temp cpp param => cpp: every param was constructed
535 uno_destructData( pCppArgs
[nIndex
], pParamTypeDescr
, cpp_release
);
537 TYPELIB_DANGER_RELEASE( pParamTypeDescr
);
540 if (pCppReturn
&& pUnoReturn
!= pCppReturn
)
542 uno_copyAndConvertData( pUnoReturn
, pCppReturn
, pReturnTypeDescr
,
543 pThis
->getBridge()->getCpp2Uno() );
544 uno_destructData( pCppReturn
, pReturnTypeDescr
, cpp_release
);
549 // fill uno exception
550 CPPU_CURRENT_NAMESPACE::fillUnoException(*ppUnoExc
, pThis
->getBridge()->getCpp2Uno());
553 for ( ; nTempIndices
--; )
555 sal_Int32 nIndex
= pTempIndices
[nTempIndices
];
556 // destroy temp cpp param => cpp: every param was constructed
557 uno_destructData( pCppArgs
[nIndex
], ppTempParamTypeDescr
[nTempIndices
], cpp_release
);
558 TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr
[nTempIndices
] );
561 if (pReturnTypeDescr
)
562 TYPELIB_DANGER_RELEASE( pReturnTypeDescr
);
568 namespace bridges::cpp_uno::shared
{
570 void unoInterfaceProxyDispatch(
571 uno_Interface
* pUnoI
, const typelib_TypeDescription
* pMemberDescr
,
572 void * pReturn
, void * pArgs
[], uno_Any
** ppException
)
575 bridges::cpp_uno::shared::UnoInterfaceProxy
* pThis
576 = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy
*> (pUnoI
);
578 switch (pMemberDescr
->eTypeClass
)
580 case typelib_TypeClass_INTERFACE_ATTRIBUTE
:
583 VtableSlot
aVtableSlot(
586 typelib_InterfaceAttributeTypeDescription
const * >(
591 // dependent dispatch
594 ((typelib_InterfaceAttributeTypeDescription
*)pMemberDescr
)->pAttributeTypeRef
,
596 pReturn
, pArgs
, ppException
);
601 typelib_MethodParameter aParam
;
603 ((typelib_InterfaceAttributeTypeDescription
*)pMemberDescr
)->pAttributeTypeRef
;
604 aParam
.bIn
= sal_True
;
605 aParam
.bOut
= sal_False
;
607 typelib_TypeDescriptionReference
* pReturnTypeRef
= 0;
608 OUString
aVoidName("void");
609 typelib_typedescriptionreference_new(
610 &pReturnTypeRef
, typelib_TypeClass_VOID
, aVoidName
.pData
);
612 // dependent dispatch
613 aVtableSlot
.index
+= 1; //get then set method
618 pReturn
, pArgs
, ppException
);
620 typelib_typedescriptionreference_release( pReturnTypeRef
);
625 case typelib_TypeClass_INTERFACE_METHOD
:
628 VtableSlot
aVtableSlot(
631 typelib_InterfaceMethodTypeDescription
const * >(
633 switch (aVtableSlot
.index
)
636 case 1: // acquire uno interface
637 (*pUnoI
->acquire
)( pUnoI
);
640 case 2: // release uno interface
641 (*pUnoI
->release
)( pUnoI
);
644 case 0: // queryInterface() opt
646 typelib_TypeDescription
* pTD
= 0;
647 TYPELIB_DANGER_GET( &pTD
, reinterpret_cast< Type
* >( pArgs
[0] )->getTypeLibType() );
650 uno_Interface
* pInterface
= 0;
651 (*pThis
->pBridge
->getUnoEnv()->getRegisteredInterface
)(
652 pThis
->pBridge
->getUnoEnv(),
653 (void **)&pInterface
, pThis
->oid
.pData
, (typelib_InterfaceTypeDescription
*)pTD
);
658 reinterpret_cast< uno_Any
* >( pReturn
),
659 &pInterface
, pTD
, 0 );
660 (*pInterface
->release
)( pInterface
);
661 TYPELIB_DANGER_RELEASE( pTD
);
665 TYPELIB_DANGER_RELEASE( pTD
);
667 } // else perform queryInterface()
669 // dependent dispatch
672 ((typelib_InterfaceMethodTypeDescription
*)pMemberDescr
)->pReturnTypeRef
,
673 ((typelib_InterfaceMethodTypeDescription
*)pMemberDescr
)->nParams
,
674 ((typelib_InterfaceMethodTypeDescription
*)pMemberDescr
)->pParams
,
675 pReturn
, pArgs
, ppException
);
681 ::com::sun::star::uno::RuntimeException
aExc(
682 "illegal member type description!",
683 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>() );
685 Type
const & rExcType
= cppu::UnoType
<decltype(aExc
)>::get();
686 // binary identical null reference
687 ::uno_type_any_construct( *ppException
, &aExc
, rExcType
.getTypeLibType(), 0 );
694 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */