1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_bridges.hxx" 26 27 #include <malloc.h> 28 29 #include <com/sun/star/uno/genfunc.hxx> 30 #include <uno/data.h> 31 32 #include "bridges/cpp_uno/shared/bridge.hxx" 33 #include "bridges/cpp_uno/shared/types.hxx" 34 #include "bridges/cpp_uno/shared/unointerfaceproxy.hxx" 35 #include "bridges/cpp_uno/shared/vtables.hxx" 36 37 #include "share.hxx" 38 39 #include <stdio.h> 40 #include <string.h> 41 42 43 using namespace ::rtl; 44 using namespace ::com::sun::star::uno; 45 46 void MapReturn(long r3, double dret, typelib_TypeClass eTypeClass, void *pRegisterReturn) 47 { 48 switch (eTypeClass) 49 { 50 case typelib_TypeClass_HYPER: 51 case typelib_TypeClass_UNSIGNED_HYPER: 52 *reinterpret_cast<sal_uInt64 *>( pRegisterReturn ) = r3; 53 break; 54 case typelib_TypeClass_LONG: 55 case typelib_TypeClass_UNSIGNED_LONG: 56 case typelib_TypeClass_ENUM: 57 *reinterpret_cast<sal_uInt32 *>( pRegisterReturn ) = r3; 58 break; 59 case typelib_TypeClass_CHAR: 60 case typelib_TypeClass_SHORT: 61 case typelib_TypeClass_UNSIGNED_SHORT: 62 *reinterpret_cast<sal_uInt16 *>( pRegisterReturn ) = (unsigned short)r3; 63 break; 64 case typelib_TypeClass_BOOLEAN: 65 case typelib_TypeClass_BYTE: 66 *reinterpret_cast<sal_uInt8 *>( pRegisterReturn ) = (unsigned char)r3; 67 break; 68 case typelib_TypeClass_FLOAT: 69 *reinterpret_cast<float *>( pRegisterReturn ) = dret; 70 break; 71 case typelib_TypeClass_DOUBLE: 72 *reinterpret_cast<double *>( pRegisterReturn ) = dret; 73 break; 74 default: 75 break; 76 } 77 } 78 79 namespace 80 { 81 //================================================================================================== 82 static void callVirtualMethod(void * pThis, sal_uInt32 nVtableIndex, 83 void * pRegisterReturn, typelib_TypeDescription * pReturnTypeDescr, 84 sal_uInt64 *pStack, sal_uInt32 nStack, 85 sal_uInt64 *pGPR, sal_uInt32 nGPR, 86 double *pFPR, sal_uInt32 nFPR) 87 { 88 // Stack, if used, must be 16-bytes aligned 89 if ( nStack ) 90 nStack = ( nStack + 1 ) & ~1; 91 92 // Should not happen, but... 93 if ( nFPR > ppc64::MAX_SSE_REGS ) 94 nFPR = ppc64::MAX_SSE_REGS; 95 if ( nGPR > ppc64::MAX_GPR_REGS ) 96 nGPR = ppc64::MAX_GPR_REGS; 97 98 #ifdef CMC_DEBUG 99 // Let's figure out what is really going on here 100 { 101 fprintf( stderr, "= callVirtualMethod() =\nGPR's (%d): ", nGPR ); 102 for ( int i = 0; i < nGPR; ++i ) 103 fprintf( stderr, "0x%lx, ", pGPR[i] ); 104 fprintf( stderr, "\nFPR's (%d): ", nFPR ); 105 for ( int i = 0; i < nFPR; ++i ) 106 fprintf( stderr, "0x%lx (%f), ", pFPR[i], pFPR[i] ); 107 fprintf( stderr, "\nStack (%d): ", nStack ); 108 for ( int i = 0; i < nStack; ++i ) 109 fprintf( stderr, "0x%lx, ", pStack[i] ); 110 fprintf( stderr, "\n" ); 111 } 112 #endif 113 114 // Load parameters to stack, if necessary 115 sal_uInt64 *stack = (sal_uInt64 *) __builtin_alloca( nStack * 8 ); 116 memcpy( stack, pStack, nStack * 8 ); 117 118 // Get pointer to method 119 sal_uInt64 pMethod = *((sal_uInt64 *)pThis); 120 pMethod += 8 * nVtableIndex; 121 pMethod = *((sal_uInt64 *)pMethod); 122 123 typedef void (* FunctionCall )( sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64, sal_uInt64 ); 124 FunctionCall pFunc = (FunctionCall)pMethod; 125 126 volatile double dret; 127 128 // fill registers 129 __asm__ __volatile__ ( 130 "ld 3, 0(%0)\n\t" 131 "ld 4, 8(%0)\n\t" 132 "ld 5, 16(%0)\n\t" 133 "ld 6, 24(%0)\n\t" 134 "ld 7, 32(%0)\n\t" 135 "ld 8, 40(%0)\n\t" 136 "ld 9, 48(%0)\n\t" 137 "ld 10, 56(%0)\n\t" 138 "lfd 1, 0(%1)\n\t" 139 "lfd 2, 8(%1)\n\t" 140 "lfd 3, 16(%1)\n\t" 141 "lfd 4, 24(%1)\n\t" 142 "lfd 5, 32(%1)\n\t" 143 "lfd 6, 40(%1)\n\t" 144 "lfd 7, 48(%1)\n\t" 145 "lfd 8, 56(%1)\n\t" 146 "lfd 9, 64(%1)\n\t" 147 "lfd 10, 72(%1)\n\t" 148 "lfd 11, 80(%1)\n\t" 149 "lfd 12, 88(%1)\n\t" 150 "lfd 13, 96(%1)\n\t" 151 : : "r" (pGPR), "r" (pFPR) 152 : "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", 153 "fr1", "fr2", "fr3", "fr4", "fr5", "fr6", "fr7", "fr8", "fr9", 154 "fr10", "fr11", "fr12", "fr13" 155 ); 156 157 // tell gcc that r3 to r11 are not available to it for doing the TOC and exception munge on the func call 158 register sal_uInt64 r3 asm("r3"); 159 register sal_uInt64 r4 asm("r4"); 160 register sal_uInt64 r5 asm("r5"); 161 register sal_uInt64 r6 asm("r6"); 162 register sal_uInt64 r7 asm("r7"); 163 register sal_uInt64 r8 asm("r8"); 164 register sal_uInt64 r9 asm("r9"); 165 register sal_uInt64 r10 asm("r10"); 166 register sal_uInt64 r11 asm("r11"); 167 168 (*pFunc)(r3, r4, r5, r6, r7, r8, r9, r10); 169 170 // get return value 171 __asm__ __volatile__ ( 172 "mr %1, 3\n\t" 173 "mr %2, 4\n\t" 174 "fmr %0, 1\n\t" 175 : "=f" (dret), "=r" (r3), "=r" (r4) : ); 176 177 MapReturn(r3, dret, pReturnTypeDescr->eTypeClass, pRegisterReturn); 178 } 179 180 // Macros for easier insertion of values to registers or stack 181 // pSV - pointer to the source 182 // nr - order of the value [will be increased if stored to register] 183 // pFPR, pGPR - pointer to the registers 184 // pDS - pointer to the stack [will be increased if stored here] 185 186 // The value in %xmm register is already prepared to be retrieved as a float, 187 // thus we treat float and double the same 188 #define INSERT_FLOAT( pSV, nr, pFPR, pDS, bOverflow ) \ 189 if ( nr < ppc64::MAX_SSE_REGS ) \ 190 pFPR[nr++] = *reinterpret_cast<float *>( pSV ); \ 191 else \ 192 bOverFlow = true; \ 193 if (bOverFlow) \ 194 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim! 195 196 #define INSERT_DOUBLE( pSV, nr, pFPR, pDS, bOverflow ) \ 197 if ( nr < ppc64::MAX_SSE_REGS ) \ 198 pFPR[nr++] = *reinterpret_cast<double *>( pSV ); \ 199 else \ 200 bOverFlow = true; \ 201 if (bOverFlow) \ 202 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim! 203 204 #define INSERT_INT64( pSV, nr, pGPR, pDS, bOverflow ) \ 205 if ( nr < ppc64::MAX_GPR_REGS ) \ 206 pGPR[nr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \ 207 else \ 208 bOverFlow = true; \ 209 if (bOverFlow) \ 210 *pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); 211 212 #define INSERT_INT32( pSV, nr, pGPR, pDS, bOverflow ) \ 213 if ( nr < ppc64::MAX_GPR_REGS ) \ 214 pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \ 215 else \ 216 bOverFlow = true; \ 217 if (bOverFlow) \ 218 *pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV ); 219 220 #define INSERT_INT16( pSV, nr, pGPR, pDS, bOverflow ) \ 221 if ( nr < ppc64::MAX_GPR_REGS ) \ 222 pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \ 223 else \ 224 bOverFlow = true; \ 225 if (bOverFlow) \ 226 *pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV ); 227 228 #define INSERT_INT8( pSV, nr, pGPR, pDS, bOverflow ) \ 229 if ( nr < ppc64::MAX_GPR_REGS ) \ 230 pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \ 231 else \ 232 bOverFlow = true; \ 233 if (bOverFlow) \ 234 *pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV ); 235 236 //================================================================================================== 237 static void cpp_call( 238 bridges::cpp_uno::shared::UnoInterfaceProxy * pThis, 239 bridges::cpp_uno::shared::VtableSlot aVtableSlot, 240 typelib_TypeDescriptionReference * pReturnTypeRef, 241 sal_Int32 nParams, typelib_MethodParameter * pParams, 242 void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc ) 243 { 244 // max space for: [complex ret ptr], values|ptr ... 245 sal_uInt64 * pStack = (sal_uInt64 *)alloca( (nParams+3) * sizeof(sal_Int64) ); 246 sal_uInt64 * pStackStart = pStack; 247 248 sal_uInt64 pGPR[ppc64::MAX_GPR_REGS]; 249 sal_uInt32 nGPR = 0; 250 251 double pFPR[ppc64::MAX_SSE_REGS]; 252 sal_uInt32 nFPR = 0; 253 254 // return 255 typelib_TypeDescription * pReturnTypeDescr = 0; 256 TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef ); 257 OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" ); 258 259 void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion 260 261 bool bOverFlow = false; 262 263 if (pReturnTypeDescr) 264 { 265 #ifdef CMC_DEBUG 266 fprintf(stderr, "return type is %d\n", pReturnTypeDescr->eTypeClass); 267 #endif 268 if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr )) 269 { 270 pCppReturn = pUnoReturn; // direct way for simple types 271 #ifdef CMC_DEBUG 272 fprintf(stderr, "simple return\n"); 273 #endif 274 } 275 else 276 { 277 // complex return via ptr 278 pCppReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr ) 279 ? alloca( pReturnTypeDescr->nSize ) : pUnoReturn); 280 #ifdef CMC_DEBUG 281 fprintf(stderr, "pCppReturn/pUnoReturn is %lx/%lx", pCppReturn, pUnoReturn); 282 #endif 283 INSERT_INT64( &pCppReturn, nGPR, pGPR, pStack, bOverFlow ); 284 } 285 } 286 // push "this" pointer 287 void * pAdjustedThisPtr = reinterpret_cast< void ** >( pThis->getCppI() ) + aVtableSlot.offset; 288 #ifdef CMC_DEBUG 289 fprintf(stderr, "this pointer is %p\n", pAdjustedThisPtr); 290 #endif 291 INSERT_INT64( &pAdjustedThisPtr, nGPR, pGPR, pStack, bOverFlow ); 292 293 // Args 294 void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams ); 295 // indizes of values this have to be converted (interface conversion cpp<=>uno) 296 sal_Int32 * pTempIndizes = (sal_Int32 *)(pCppArgs + nParams); 297 // type descriptions for reconversions 298 typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams)); 299 300 sal_Int32 nTempIndizes = 0; 301 302 #ifdef CMC_DEBUG 303 fprintf(stderr, "n params is %d\n", nParams); 304 #endif 305 306 for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos ) 307 { 308 const typelib_MethodParameter & rParam = pParams[nPos]; 309 typelib_TypeDescription * pParamTypeDescr = 0; 310 TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef ); 311 312 #ifdef CMC_DEBUG 313 fprintf(stderr, "param %d is %d %d %d\n", nPos, rParam.bOut, bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ), 314 pParamTypeDescr->eTypeClass); 315 #endif 316 317 if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) 318 { 319 // uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr, 320 uno_copyAndConvertData( pCppArgs[nPos] = pStack, pUnoArgs[nPos], pParamTypeDescr, 321 pThis->getBridge()->getUno2Cpp() ); 322 switch (pParamTypeDescr->eTypeClass) 323 { 324 case typelib_TypeClass_HYPER: 325 case typelib_TypeClass_UNSIGNED_HYPER: 326 #ifdef CMC_DEBUG 327 fprintf(stderr, "hyper is %lx\n", pCppArgs[nPos]); 328 #endif 329 INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow ); 330 break; 331 case typelib_TypeClass_LONG: 332 case typelib_TypeClass_UNSIGNED_LONG: 333 case typelib_TypeClass_ENUM: 334 #ifdef CMC_DEBUG 335 fprintf(stderr, "long is %x\n", pCppArgs[nPos]); 336 #endif 337 INSERT_INT32( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow ); 338 break; 339 case typelib_TypeClass_SHORT: 340 case typelib_TypeClass_CHAR: 341 case typelib_TypeClass_UNSIGNED_SHORT: 342 INSERT_INT16( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow ); 343 break; 344 case typelib_TypeClass_BOOLEAN: 345 case typelib_TypeClass_BYTE: 346 INSERT_INT8( pCppArgs[nPos], nGPR, pGPR, pStack, bOverFlow ); 347 break; 348 case typelib_TypeClass_FLOAT: 349 INSERT_FLOAT( pCppArgs[nPos], nFPR, pFPR, pStack, bOverFlow ); 350 break; 351 case typelib_TypeClass_DOUBLE: 352 INSERT_DOUBLE( pCppArgs[nPos], nFPR, pFPR, pStack, bOverFlow ); 353 break; 354 } 355 356 // no longer needed 357 TYPELIB_DANGER_RELEASE( pParamTypeDescr ); 358 359 } 360 else // ptr to complex value | ref 361 { 362 #ifdef CMC_DEBUG 363 fprintf(stderr, "complex type again %d\n", rParam.bIn); 364 #endif 365 if (! rParam.bIn) // is pure out 366 { 367 #ifdef CMC_DEBUG 368 fprintf(stderr, "complex size is %d\n", pParamTypeDescr->nSize ); 369 #endif 370 // cpp out is constructed mem, uno out is not! 371 uno_constructData( 372 pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ), 373 pParamTypeDescr ); 374 pTempIndizes[nTempIndizes] = nPos; // default constructed for cpp call 375 // will be released at reconversion 376 ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr; 377 } 378 // is in/inout 379 else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr )) 380 { 381 #ifdef CMC_DEBUG 382 fprintf(stderr, "this one\n"); 383 #endif 384 uno_copyAndConvertData( 385 pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ), 386 pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() ); 387 388 pTempIndizes[nTempIndizes] = nPos; // has to be reconverted 389 // will be released at reconversion 390 ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr; 391 } 392 else // direct way 393 { 394 #ifdef CMC_DEBUG 395 fprintf(stderr, "that one, passing %lx through\n", pUnoArgs[nPos]); 396 #endif 397 pCppArgs[nPos] = pUnoArgs[nPos]; 398 // no longer needed 399 TYPELIB_DANGER_RELEASE( pParamTypeDescr ); 400 } 401 INSERT_INT64( &(pCppArgs[nPos]), nGPR, pGPR, pStack, bOverFlow ); 402 } 403 } 404 405 try 406 { 407 callVirtualMethod( 408 pAdjustedThisPtr, aVtableSlot.index, 409 pCppReturn, pReturnTypeDescr, 410 pStackStart, ( pStack - pStackStart ), 411 pGPR, nGPR, 412 pFPR, nFPR ); 413 // NO exception occured... 414 *ppUnoExc = 0; 415 416 // reconvert temporary params 417 for ( ; nTempIndizes--; ) 418 { 419 sal_Int32 nIndex = pTempIndizes[nTempIndizes]; 420 typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes]; 421 422 if (pParams[nIndex].bIn) 423 { 424 if (pParams[nIndex].bOut) // inout 425 { 426 uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value 427 uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr, 428 pThis->getBridge()->getCpp2Uno() ); 429 } 430 } 431 else // pure out 432 { 433 uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr, 434 pThis->getBridge()->getCpp2Uno() ); 435 } 436 // destroy temp cpp param => cpp: every param was constructed 437 uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release ); 438 439 TYPELIB_DANGER_RELEASE( pParamTypeDescr ); 440 } 441 // return value 442 if (pCppReturn && pUnoReturn != pCppReturn) 443 { 444 uno_copyAndConvertData( pUnoReturn, pCppReturn, pReturnTypeDescr, 445 pThis->getBridge()->getCpp2Uno() ); 446 uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release ); 447 } 448 } 449 catch (...) 450 { 451 // fill uno exception 452 fillUnoException( CPPU_CURRENT_NAMESPACE::__cxa_get_globals()->caughtExceptions, 453 *ppUnoExc, pThis->getBridge()->getCpp2Uno() ); 454 455 // temporary params 456 for ( ; nTempIndizes--; ) 457 { 458 sal_Int32 nIndex = pTempIndizes[nTempIndizes]; 459 // destroy temp cpp param => cpp: every param was constructed 460 uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], cpp_release ); 461 TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] ); 462 } 463 // return type 464 if (pReturnTypeDescr) 465 TYPELIB_DANGER_RELEASE( pReturnTypeDescr ); 466 } 467 } 468 469 } 470 471 namespace bridges { namespace cpp_uno { namespace shared { 472 473 void unoInterfaceProxyDispatch( 474 uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr, 475 void * pReturn, void * pArgs[], uno_Any ** ppException ) 476 { 477 // is my surrogate 478 bridges::cpp_uno::shared::UnoInterfaceProxy * pThis 479 = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy *> (pUnoI); 480 typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr; 481 482 switch (pMemberDescr->eTypeClass) 483 { 484 case typelib_TypeClass_INTERFACE_ATTRIBUTE: 485 { 486 487 VtableSlot aVtableSlot( 488 getVtableSlot( 489 reinterpret_cast< 490 typelib_InterfaceAttributeTypeDescription const * >( 491 pMemberDescr))); 492 493 if (pReturn) 494 { 495 // dependent dispatch 496 cpp_call( 497 pThis, aVtableSlot, 498 ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef, 499 0, 0, // no params 500 pReturn, pArgs, ppException ); 501 } 502 else 503 { 504 // is SET 505 typelib_MethodParameter aParam; 506 aParam.pTypeRef = 507 ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef; 508 aParam.bIn = sal_True; 509 aParam.bOut = sal_False; 510 511 typelib_TypeDescriptionReference * pReturnTypeRef = 0; 512 OUString aVoidName( RTL_CONSTASCII_USTRINGPARAM("void") ); 513 typelib_typedescriptionreference_new( 514 &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData ); 515 516 // dependent dispatch 517 aVtableSlot.index += 1; //get then set method 518 cpp_call( 519 pThis, aVtableSlot, 520 pReturnTypeRef, 521 1, &aParam, 522 pReturn, pArgs, ppException ); 523 524 typelib_typedescriptionreference_release( pReturnTypeRef ); 525 } 526 527 break; 528 } 529 case typelib_TypeClass_INTERFACE_METHOD: 530 { 531 532 VtableSlot aVtableSlot( 533 getVtableSlot( 534 reinterpret_cast< 535 typelib_InterfaceMethodTypeDescription const * >( 536 pMemberDescr))); 537 switch (aVtableSlot.index) 538 { 539 // standard calls 540 case 1: // acquire uno interface 541 (*pUnoI->acquire)( pUnoI ); 542 *ppException = 0; 543 break; 544 case 2: // release uno interface 545 (*pUnoI->release)( pUnoI ); 546 *ppException = 0; 547 break; 548 case 0: // queryInterface() opt 549 { 550 typelib_TypeDescription * pTD = 0; 551 TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() ); 552 if (pTD) 553 { 554 uno_Interface * pInterface = 0; 555 (*pThis->pBridge->getUnoEnv()->getRegisteredInterface)( 556 pThis->pBridge->getUnoEnv(), 557 (void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD ); 558 559 if (pInterface) 560 { 561 ::uno_any_construct( 562 reinterpret_cast< uno_Any * >( pReturn ), 563 &pInterface, pTD, 0 ); 564 (*pInterface->release)( pInterface ); 565 TYPELIB_DANGER_RELEASE( pTD ); 566 *ppException = 0; 567 break; 568 } 569 TYPELIB_DANGER_RELEASE( pTD ); 570 } 571 } // else perform queryInterface() 572 default: 573 // dependent dispatch 574 cpp_call( 575 pThis, aVtableSlot, 576 ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef, 577 ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams, 578 ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams, 579 pReturn, pArgs, ppException ); 580 } 581 break; 582 } 583 default: 584 { 585 ::com::sun::star::uno::RuntimeException aExc( 586 OUString( RTL_CONSTASCII_USTRINGPARAM("illegal member type description!") ), 587 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() ); 588 589 Type const & rExcType = ::getCppuType( &aExc ); 590 // binary identical null reference 591 ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 ); 592 } 593 } 594 } 595 596 } } } 597