1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: uno2cpp.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_bridges.hxx"
36 #include <com/sun/star/uno/genfunc.hxx>
39 #include "bridges/cpp_uno/shared/bridge.hxx"
40 #include "bridges/cpp_uno/shared/types.hxx"
41 #include "bridges/cpp_uno/shared/unointerfaceproxy.hxx"
42 #include "bridges/cpp_uno/shared/vtables.hxx"
50 using namespace ::rtl
;
51 using namespace ::com::sun::star::uno
;
53 void MapReturn(const ia64::RegReturn
&rRet
, double dret
, typelib_TypeDescription
* pReturnTypeDescr
, bool bSimpleReturn
, sal_uInt64
*pRegisterReturn
)
55 switch (pReturnTypeDescr
->eTypeClass
)
57 case typelib_TypeClass_HYPER
:
58 case typelib_TypeClass_UNSIGNED_HYPER
:
59 case typelib_TypeClass_LONG
:
60 case typelib_TypeClass_UNSIGNED_LONG
:
61 case typelib_TypeClass_ENUM
:
62 *pRegisterReturn
= rRet
.r8
;
64 case typelib_TypeClass_CHAR
:
65 case typelib_TypeClass_SHORT
:
66 case typelib_TypeClass_UNSIGNED_SHORT
:
67 *pRegisterReturn
= (unsigned short)rRet
.r8
;
69 case typelib_TypeClass_BOOLEAN
:
70 case typelib_TypeClass_BYTE
:
71 *pRegisterReturn
= (unsigned char)rRet
.r8
;
73 case typelib_TypeClass_FLOAT
:
74 *reinterpret_cast<float *>( pRegisterReturn
) = dret
;
76 case typelib_TypeClass_DOUBLE
:
77 *reinterpret_cast<double *>( pRegisterReturn
) = dret
;
79 case typelib_TypeClass_STRUCT
:
80 case typelib_TypeClass_EXCEPTION
:
82 sal_uInt32 nRetSize
= pReturnTypeDescr
->nSize
;
83 if (bSimpleReturn
&& nRetSize
<= 32 && nRetSize
> 0)
84 memcpy(pRegisterReturn
, (void*)&rRet
, nRetSize
);
94 bool is_complex_struct( typelib_TypeDescriptionReference
*pTypeRef
)
96 if (pTypeRef
->eTypeClass
== typelib_TypeClass_STRUCT
|| pTypeRef
->eTypeClass
== typelib_TypeClass_EXCEPTION
)
98 typelib_TypeDescription
* pTypeDescr
= 0;
99 TYPELIB_DANGER_GET( &pTypeDescr
, pTypeRef
);
101 bool bRet
= bridges::cpp_uno::shared::relatesToInterfaceType( pTypeDescr
);
102 TYPELIB_DANGER_RELEASE( pTypeDescr
);
109 bool return_via_r8_buffer( typelib_TypeDescriptionReference
*pTypeRef
)
111 if (pTypeRef
->eTypeClass
== typelib_TypeClass_STRUCT
|| pTypeRef
->eTypeClass
== typelib_TypeClass_EXCEPTION
)
113 if (is_complex_struct( pTypeRef
)) return false;
115 typelib_TypeDescription
* pTypeDescr
= 0;
116 TYPELIB_DANGER_GET( &pTypeDescr
, pTypeRef
);
118 /* If the struct is larger than 32 bytes, then there is a buffer at r8 to stick the return value into */
119 bool bRet
= pTypeDescr
->nSize
> 32;
120 TYPELIB_DANGER_RELEASE( pTypeDescr
);
126 bool return_in_hidden_param( typelib_TypeDescriptionReference
*pTypeRef
)
128 if (bridges::cpp_uno::shared::isSimpleType(pTypeRef
))
130 else if (pTypeRef
->eTypeClass
== typelib_TypeClass_STRUCT
|| pTypeRef
->eTypeClass
== typelib_TypeClass_EXCEPTION
)
131 return is_complex_struct( pTypeRef
);
140 //==================================================================================================
141 static void callVirtualMethod(void * pThis
, sal_uInt32 nVtableIndex
,
142 void * pRegisterReturn
, typelib_TypeDescription
* pReturnTypeDescr
, bool bSimpleReturn
,
143 sal_uInt64
*pStack
, sal_uInt32 nStack
,
144 sal_uInt64
*pGPR
, sal_uInt32 nGPR
,
145 double *pFPR
, sal_uInt32 nFPR
)
147 // Stack, if used, must be 16-bytes aligned
149 nStack
= ( nStack
+ 1 ) & ~1;
151 // Should not happen, but...
152 if ( nFPR
> ia64::MAX_SSE_REGS
)
153 nFPR
= ia64::MAX_SSE_REGS
;
154 if ( nGPR
> ia64::MAX_GPR_REGS
)
155 nGPR
= ia64::MAX_GPR_REGS
;
158 // Let's figure out what is really going on here
160 fprintf( stderr
, "= callVirtualMethod() =\nGPR's (%d): ", nGPR
);
161 for ( unsigned int i
= 0; i
< nGPR
; ++i
)
162 fprintf( stderr
, "0x%lx, ", pGPR
[i
] );
163 fprintf( stderr
, "\nFPR's (%d): ", nFPR
);
164 for ( unsigned int i
= 0; i
< nFPR
; ++i
)
165 fprintf( stderr
, "0x%lx (%f), ", pFPR
[i
], pFPR
[i
] );
166 fprintf( stderr
, "\nStack (%d): ", nStack
);
167 for ( unsigned int i
= 0; i
< nStack
; ++i
)
168 fprintf( stderr
, "0x%lx, ", pStack
[i
] );
169 fprintf( stderr
, "\n" );
170 fprintf( stderr
, "pRegisterReturn is %p\n", pRegisterReturn
);
174 // Load parameters to stack, if necessary
175 sal_uInt64
*stack
= (sal_uInt64
*) __builtin_alloca( nStack
* 8 );
176 memcpy( stack
, pStack
, nStack
* 8 );
178 // To get pointer to method
179 // a) get the address of the vtable
180 sal_uInt64 pMethod
= *((sal_uInt64
*)pThis
);
181 // b) get the address from the vtable entry at offset, each entry is 16bytes,
182 // 8 for function pointer, and 8 for global pointer
183 pMethod
+= 16 * nVtableIndex
;
185 typedef void (* FunctionCall
)( sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
, sal_uInt64
);
186 FunctionCall pFunc
= (FunctionCall
)pMethod
;
188 switch (nFPR
) //deliberate fall through
191 asm volatile("ldfd f15=%0" : : "m"(pFPR
[7]) : "f15");
193 asm volatile("ldfd f14=%0" : : "m"(pFPR
[6]) : "f14");
195 asm volatile("ldfd f13=%0" : : "m"(pFPR
[5]) : "f13");
197 asm volatile("ldfd f12=%0" : : "m"(pFPR
[4]) : "f12");
199 asm volatile("ldfd f11=%0" : : "m"(pFPR
[3]) : "f11");
201 asm volatile("ldfd f10=%0" : : "m"(pFPR
[2]) : "f10");
203 asm volatile("ldfd f9=%0" : : "m"(pFPR
[1]) : "f9");
205 asm volatile("ldfd f8=%0" : : "m"(pFPR
[0]) : "f8");
210 //stick the return area into r8 for big struct returning
211 asm volatile("ld8 r8=%0" : : "m"(pRegisterReturn
) : "r8");
213 (*pFunc
)(pGPR
[0], pGPR
[1], pGPR
[2], pGPR
[3], pGPR
[4], pGPR
[5], pGPR
[6], pGPR
[7]);
215 register double f8
asm("f8");
218 register long r8
asm("r8"); ret
.r8
= r8
;
219 register long r9
asm("r9"); ret
.r9
= r9
;
220 register long r10
asm("r10"); ret
.r10
= r10
;
221 register long r11
asm("r11"); ret
.r11
= r11
;
224 MapReturn(ret
, f8
, pReturnTypeDescr
, bSimpleReturn
, (sal_uInt64
*)pRegisterReturn
);
227 // Macros for easier insertion of values to registers or stack
228 // pSV - pointer to the source
229 // nr - order of the value [will be increased if stored to register]
230 // pFPR, pGPR - pointer to the registers
231 // pDS - pointer to the stack [will be increased if stored here]
233 // The value in %xmm register is already prepared to be retrieved as a float,
234 // thus we treat float and double the same
235 #define INSERT_FLOAT( pSV, nfr, pFPR, ngr, pGPR, pDS, bOverflow ) \
236 if ( nfr < ia64::MAX_SSE_REGS && ngr < ia64::MAX_GPR_REGS ) \
237 pFPR[nfr++] = *reinterpret_cast<float *>( pSV ); \
238 if ( ngr < ia64::MAX_GPR_REGS ) \
239 pGPR[ngr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \
243 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
245 #define INSERT_DOUBLE( pSV, nfr, pFPR, ngr, pGPR, pDS, bOverflow ) \
246 if ( nfr < ia64::MAX_SSE_REGS && ngr < ia64::MAX_GPR_REGS ) \
247 pFPR[nfr++] = *reinterpret_cast<double *>( pSV ); \
248 if ( ngr < ia64::MAX_GPR_REGS ) \
249 pGPR[ngr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \
253 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
255 #define INSERT_INT64( pSV, nr, pGPR, pDS, bOverflow ) \
256 if ( nr < ia64::MAX_GPR_REGS ) \
257 pGPR[nr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \
261 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV );
263 #define INSERT_INT32( pSV, nr, pGPR, pDS, bOverflow ) \
264 if ( nr < ia64::MAX_GPR_REGS ) \
265 pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \
269 *pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV );
271 #define INSERT_INT16( pSV, nr, pGPR, pDS, bOverflow ) \
272 if ( nr < ia64::MAX_GPR_REGS ) \
273 pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \
277 *pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV );
279 #define INSERT_INT8( pSV, nr, pGPR, pDS, bOverflow ) \
280 if ( nr < ia64::MAX_GPR_REGS ) \
281 pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \
285 *pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV );
287 //==================================================================================================
288 static void cpp_call(
289 bridges::cpp_uno::shared::UnoInterfaceProxy
* pThis
,
290 bridges::cpp_uno::shared::VtableSlot aVtableSlot
,
291 typelib_TypeDescriptionReference
* pReturnTypeRef
,
292 sal_Int32 nParams
, typelib_MethodParameter
* pParams
,
293 void * pUnoReturn
, void * pUnoArgs
[], uno_Any
** ppUnoExc
)
295 // max space for: [complex ret ptr], values|ptr ...
296 sal_uInt64
* pStack
= (sal_uInt64
*)alloca( (nParams
+3) * sizeof(sal_Int64
) );
297 sal_uInt64
* pStackStart
= pStack
;
299 sal_uInt64 pGPR
[ia64::MAX_GPR_REGS
];
302 double pFPR
[ia64::MAX_SSE_REGS
];
306 typelib_TypeDescription
* pReturnTypeDescr
= 0;
307 TYPELIB_DANGER_GET( &pReturnTypeDescr
, pReturnTypeRef
);
308 OSL_ENSURE( pReturnTypeDescr
, "### expected return type description!" );
310 void * pCppReturn
= 0; // if != 0 && != pUnoReturn, needs reconversion
312 bool bOverFlow
= false;
314 bool bSimpleReturn
= true;
315 if (pReturnTypeDescr
)
318 fprintf(stderr
, "return type is %d\n", pReturnTypeDescr
->eTypeClass
);
320 if ( ia64::return_in_hidden_param(pReturnTypeRef
) || ia64::return_via_r8_buffer(pReturnTypeRef
) )
321 bSimpleReturn
= false;
325 pCppReturn
= pUnoReturn
; // direct way for simple types
327 fprintf(stderr
, "simple return\n");
332 // complex return via ptr
333 pCppReturn
= (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr
)
334 ? alloca( pReturnTypeDescr
->nSize
) : pUnoReturn
);
336 fprintf(stderr
, "pCppReturn/pUnoReturn is %lx/%lx", pCppReturn
, pUnoReturn
);
338 if (!ia64::return_via_r8_buffer(pReturnTypeRef
))
339 INSERT_INT64( &pCppReturn
, nGPR
, pGPR
, pStack
, bOverFlow
);
342 // push "this" pointer
343 void * pAdjustedThisPtr
= reinterpret_cast< void ** >( pThis
->getCppI() ) + aVtableSlot
.offset
;
346 fprintf(stderr
, "this pointer is %p\n", pAdjustedThisPtr
);
348 INSERT_INT64( &pAdjustedThisPtr
, nGPR
, pGPR
, pStack
, bOverFlow
);
351 void ** pCppArgs
= (void **)alloca( 3 * sizeof(void *) * nParams
);
352 // indizes of values this have to be converted (interface conversion cpp<=>uno)
353 sal_Int32
* pTempIndizes
= (sal_Int32
*)(pCppArgs
+ nParams
);
354 // type descriptions for reconversions
355 typelib_TypeDescription
** ppTempParamTypeDescr
= (typelib_TypeDescription
**)(pCppArgs
+ (2 * nParams
));
357 sal_Int32 nTempIndizes
= 0;
360 fprintf(stderr
, "n params is %d\n", nParams
);
363 for ( sal_Int32 nPos
= 0; nPos
< nParams
; ++nPos
)
365 const typelib_MethodParameter
& rParam
= pParams
[nPos
];
366 typelib_TypeDescription
* pParamTypeDescr
= 0;
367 TYPELIB_DANGER_GET( &pParamTypeDescr
, rParam
.pTypeRef
);
370 fprintf(stderr
, "param %d is %d %d %d\n", nPos
, rParam
.bOut
, bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr
),
371 pParamTypeDescr
->eTypeClass
);
374 if (!rParam
.bOut
&& bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr
))
376 // uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr,
377 uno_copyAndConvertData( pCppArgs
[nPos
] = pStack
, pUnoArgs
[nPos
], pParamTypeDescr
,
378 pThis
->getBridge()->getUno2Cpp() );
379 switch (pParamTypeDescr
->eTypeClass
)
381 case typelib_TypeClass_HYPER
:
382 case typelib_TypeClass_UNSIGNED_HYPER
:
384 fprintf(stderr
, "hyper is %lx\n", *(unsigned long*)(pCppArgs
[nPos
]));
386 INSERT_INT64( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverFlow
);
388 case typelib_TypeClass_LONG
:
389 case typelib_TypeClass_UNSIGNED_LONG
:
390 case typelib_TypeClass_ENUM
:
392 fprintf(stderr
, "long is %lx\n", *(unsigned int*)(pCppArgs
[nPos
]));
394 INSERT_INT32( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverFlow
);
396 case typelib_TypeClass_SHORT
:
397 case typelib_TypeClass_CHAR
:
398 case typelib_TypeClass_UNSIGNED_SHORT
:
400 fprintf(stderr
, "short is %x\n", *(unsigned short*)(pCppArgs
[nPos
]));
402 INSERT_INT16( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverFlow
);
404 case typelib_TypeClass_BOOLEAN
:
405 case typelib_TypeClass_BYTE
:
407 fprintf(stderr
, "byte is %x\n", *(unsigned char*)(pCppArgs
[nPos
]));
409 INSERT_INT8( pCppArgs
[nPos
], nGPR
, pGPR
, pStack
, bOverFlow
);
411 case typelib_TypeClass_FLOAT
:
413 fprintf(stderr
, "a float is %f\n", *(float*)(pCppArgs
[nPos
]));
414 fprintf(stderr
, "b float is %f\n", *(double*)(pCppArgs
[nPos
]));
416 INSERT_FLOAT( pCppArgs
[nPos
], nFPR
, pFPR
, nGPR
, pGPR
, pStack
, bOverFlow
);
418 case typelib_TypeClass_DOUBLE
:
420 fprintf(stderr
, "double is %f\n", *(double*)(pCppArgs
[nPos
]));
422 INSERT_DOUBLE( pCppArgs
[nPos
], nFPR
, pFPR
, nGPR
, pGPR
, pStack
, bOverFlow
);
429 TYPELIB_DANGER_RELEASE( pParamTypeDescr
);
432 else // ptr to complex value | ref
435 fprintf(stderr
, "complex type again %d\n", rParam
.bIn
);
437 if (! rParam
.bIn
) // is pure out
440 fprintf(stderr
, "complex size is %d\n", pParamTypeDescr
->nSize
);
442 // cpp out is constructed mem, uno out is not!
444 pCppArgs
[nPos
] = alloca( pParamTypeDescr
->nSize
),
446 pTempIndizes
[nTempIndizes
] = nPos
; // default constructed for cpp call
447 // will be released at reconversion
448 ppTempParamTypeDescr
[nTempIndizes
++] = pParamTypeDescr
;
451 else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr
))
454 fprintf(stderr
, "this one\n");
456 uno_copyAndConvertData(
457 pCppArgs
[nPos
] = alloca( pParamTypeDescr
->nSize
),
458 pUnoArgs
[nPos
], pParamTypeDescr
, pThis
->getBridge()->getUno2Cpp() );
460 pTempIndizes
[nTempIndizes
] = nPos
; // has to be reconverted
461 // will be released at reconversion
462 ppTempParamTypeDescr
[nTempIndizes
++] = pParamTypeDescr
;
467 fprintf(stderr
, "that one, passing %lx through\n", pUnoArgs
[nPos
]);
469 pCppArgs
[nPos
] = pUnoArgs
[nPos
];
471 TYPELIB_DANGER_RELEASE( pParamTypeDescr
);
473 INSERT_INT64( &(pCppArgs
[nPos
]), nGPR
, pGPR
, pStack
, bOverFlow
);
480 pAdjustedThisPtr
, aVtableSlot
.index
,
481 pCppReturn
, pReturnTypeDescr
, bSimpleReturn
,
482 pStackStart
, ( pStack
- pStackStart
),
485 // NO exception occured...
488 // reconvert temporary params
489 for ( ; nTempIndizes
--; )
491 sal_Int32 nIndex
= pTempIndizes
[nTempIndizes
];
492 typelib_TypeDescription
* pParamTypeDescr
= ppTempParamTypeDescr
[nTempIndizes
];
494 if (pParams
[nIndex
].bIn
)
496 if (pParams
[nIndex
].bOut
) // inout
498 uno_destructData( pUnoArgs
[nIndex
], pParamTypeDescr
, 0 ); // destroy uno value
499 uno_copyAndConvertData( pUnoArgs
[nIndex
], pCppArgs
[nIndex
], pParamTypeDescr
,
500 pThis
->getBridge()->getCpp2Uno() );
505 uno_copyAndConvertData( pUnoArgs
[nIndex
], pCppArgs
[nIndex
], pParamTypeDescr
,
506 pThis
->getBridge()->getCpp2Uno() );
508 // destroy temp cpp param => cpp: every param was constructed
509 uno_destructData( pCppArgs
[nIndex
], pParamTypeDescr
, cpp_release
);
511 TYPELIB_DANGER_RELEASE( pParamTypeDescr
);
514 if (pCppReturn
&& pUnoReturn
!= pCppReturn
)
516 uno_copyAndConvertData( pUnoReturn
, pCppReturn
, pReturnTypeDescr
,
517 pThis
->getBridge()->getCpp2Uno() );
518 uno_destructData( pCppReturn
, pReturnTypeDescr
, cpp_release
);
523 // fill uno exception
524 fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions
,
525 *ppUnoExc
, pThis
->getBridge()->getCpp2Uno() );
528 for ( ; nTempIndizes
--; )
530 sal_Int32 nIndex
= pTempIndizes
[nTempIndizes
];
531 // destroy temp cpp param => cpp: every param was constructed
532 uno_destructData( pCppArgs
[nIndex
], ppTempParamTypeDescr
[nTempIndizes
], cpp_release
);
533 TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr
[nTempIndizes
] );
536 if (pReturnTypeDescr
)
537 TYPELIB_DANGER_RELEASE( pReturnTypeDescr
);
543 namespace bridges
{ namespace cpp_uno
{ namespace shared
{
545 void unoInterfaceProxyDispatch(
546 uno_Interface
* pUnoI
, const typelib_TypeDescription
* pMemberDescr
,
547 void * pReturn
, void * pArgs
[], uno_Any
** ppException
)
550 bridges::cpp_uno::shared::UnoInterfaceProxy
* pThis
551 = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy
*> (pUnoI
);
553 switch (pMemberDescr
->eTypeClass
)
555 case typelib_TypeClass_INTERFACE_ATTRIBUTE
:
558 VtableSlot
aVtableSlot(
561 typelib_InterfaceAttributeTypeDescription
const * >(
566 // dependent dispatch
569 ((typelib_InterfaceAttributeTypeDescription
*)pMemberDescr
)->pAttributeTypeRef
,
571 pReturn
, pArgs
, ppException
);
576 typelib_MethodParameter aParam
;
578 ((typelib_InterfaceAttributeTypeDescription
*)pMemberDescr
)->pAttributeTypeRef
;
579 aParam
.bIn
= sal_True
;
580 aParam
.bOut
= sal_False
;
582 typelib_TypeDescriptionReference
* pReturnTypeRef
= 0;
583 OUString
aVoidName( RTL_CONSTASCII_USTRINGPARAM("void") );
584 typelib_typedescriptionreference_new(
585 &pReturnTypeRef
, typelib_TypeClass_VOID
, aVoidName
.pData
);
587 // dependent dispatch
588 aVtableSlot
.index
+= 1; //get then set method
593 pReturn
, pArgs
, ppException
);
595 typelib_typedescriptionreference_release( pReturnTypeRef
);
600 case typelib_TypeClass_INTERFACE_METHOD
:
603 VtableSlot
aVtableSlot(
606 typelib_InterfaceMethodTypeDescription
const * >(
608 switch (aVtableSlot
.index
)
611 case 1: // acquire uno interface
612 (*pUnoI
->acquire
)( pUnoI
);
615 case 2: // release uno interface
616 (*pUnoI
->release
)( pUnoI
);
619 case 0: // queryInterface() opt
621 typelib_TypeDescription
* pTD
= 0;
622 TYPELIB_DANGER_GET( &pTD
, reinterpret_cast< Type
* >( pArgs
[0] )->getTypeLibType() );
625 uno_Interface
* pInterface
= 0;
626 (*pThis
->pBridge
->getUnoEnv()->getRegisteredInterface
)(
627 pThis
->pBridge
->getUnoEnv(),
628 (void **)&pInterface
, pThis
->oid
.pData
, (typelib_InterfaceTypeDescription
*)pTD
);
633 reinterpret_cast< uno_Any
* >( pReturn
),
634 &pInterface
, pTD
, 0 );
635 (*pInterface
->release
)( pInterface
);
636 TYPELIB_DANGER_RELEASE( pTD
);
640 TYPELIB_DANGER_RELEASE( pTD
);
642 } // else perform queryInterface()
644 // dependent dispatch
647 ((typelib_InterfaceMethodTypeDescription
*)pMemberDescr
)->pReturnTypeRef
,
648 ((typelib_InterfaceMethodTypeDescription
*)pMemberDescr
)->nParams
,
649 ((typelib_InterfaceMethodTypeDescription
*)pMemberDescr
)->pParams
,
650 pReturn
, pArgs
, ppException
);
656 ::com::sun::star::uno::RuntimeException
aExc(
657 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal member type description!") ),
658 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XInterface
>() );
660 Type
const & rExcType
= ::getCppuType( &aExc
);
661 // binary identical null reference
662 ::uno_type_any_construct( *ppException
, &aExc
, rExcType
.getTypeLibType(), 0 );
668 /* vi:set tabstop=4 shiftwidth=4 expandtab: */