merge the formfield patch from ooo-build
[ooovba.git] / bridges / source / cpp_uno / gcc3_linux_ia64 / cpp2uno.cxx
blob81b9d8d1972583e973c175f8bcfff4412eba390f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cpp2uno.cxx,v $
10 * $Revision: 1.3 $
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"
34 #include <com/sun/star/uno/genfunc.hxx>
35 #include <uno/data.h>
36 #include <typelib/typedescription.hxx>
38 #include "bridges/cpp_uno/shared/bridge.hxx"
39 #include "bridges/cpp_uno/shared/cppinterfaceproxy.hxx"
40 #include "bridges/cpp_uno/shared/types.hxx"
41 #include "bridges/cpp_uno/shared/vtablefactory.hxx"
43 #include "share.hxx"
44 #include <stdio.h>
46 extern "C" { extern void (*privateSnippetExecutor)(); }
48 using namespace ::com::sun::star::uno;
50 namespace
52 //==================================================================================================
53 static typelib_TypeClass cpp2uno_call(
54 bridges::cpp_uno::shared::CppInterfaceProxy * pThis,
55 const typelib_TypeDescription * pMemberTypeDescr,
56 typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return
57 sal_Int32 nParams, typelib_MethodParameter * pParams, long r8,
58 void ** gpreg, void ** fpreg, void ** ovrflw,
59 sal_Int64 * pRegisterReturn /* space for register return */ )
61 #ifdef CMC_DEBUG
62 fprintf(stderr, "as far as cpp2uno_call\n");
63 #endif
65 int ng = 0; //number of gpr registers used
66 int nf = 0; //number of fpr regsiters used
68 // gpreg: [ret *], this, [gpr params]
69 // fpreg: [fpr params]
70 // ovrflw: [gpr or fpr params (properly aligned)]
72 // return
73 typelib_TypeDescription * pReturnTypeDescr = 0;
74 if (pReturnTypeRef)
75 TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
77 void * pUnoReturn = 0;
78 void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need
80 if (pReturnTypeDescr)
82 if ( ia64::return_in_hidden_param( pReturnTypeRef ) ) // complex return via ptr passed as hidden parameter reg (pCppReturn)
84 pCppReturn = *(void **)gpreg;
85 gpreg++;
86 ng++;
88 pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
89 ? alloca( pReturnTypeDescr->nSize )
90 : pCppReturn); // direct way
92 else if ( ia64::return_via_r8_buffer( pReturnTypeRef ) ) // complex return via ptr passed in r8
94 pCppReturn = (void *)r8;
96 pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
97 ? alloca( pReturnTypeDescr->nSize )
98 : pCppReturn); // direct way
101 else
102 pUnoReturn = pRegisterReturn; // direct way for simple types
104 // pop this
105 gpreg++;
106 ng++;
108 // stack space
109 OSL_ENSURE( sizeof(void *) == sizeof(sal_Int64), "### unexpected size!" );
110 // parameters
111 void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
112 void ** pCppArgs = pUnoArgs + nParams;
113 // indizes of values this have to be converted (interface conversion cpp<=>uno)
114 sal_Int32 * pTempIndizes = (sal_Int32 *)(pUnoArgs + (2 * nParams));
115 // type descriptions for reconversions
116 typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
118 sal_Int32 nTempIndizes = 0;
119 bool bOverFlowUsed = false;
120 for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
122 const typelib_MethodParameter & rParam = pParams[nPos];
123 typelib_TypeDescription * pParamTypeDescr = 0;
124 TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
126 #ifdef CMC_DEBUG
127 fprintf(stderr, "arg %d of %d\n", nPos, nParams);
128 #endif
130 //I think it is impossible to get UNO to pass structs as parameters by copy
131 if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
133 #ifdef CMC_DEBUG
134 fprintf(stderr, "simple\n");
135 #endif
137 switch (pParamTypeDescr->eTypeClass)
139 case typelib_TypeClass_FLOAT:
140 if (nf < ia64::MAX_SSE_REGS && ng < ia64::MAX_GPR_REGS)
142 float tmp = (float) (*((double *)fpreg));
143 (*((float *) fpreg)) = tmp;
144 pCppArgs[nPos] = pUnoArgs[nPos] = fpreg++;
145 nf++;
146 gpreg++;
147 ng++;
149 else
151 pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
152 bOverFlowUsed = true;
154 if (bOverFlowUsed) ovrflw++;
155 break;
156 case typelib_TypeClass_DOUBLE:
157 if (nf < ia64::MAX_SSE_REGS && ng < ia64::MAX_GPR_REGS)
159 pCppArgs[nPos] = pUnoArgs[nPos] = fpreg++;
160 nf++;
161 gpreg++;
162 ng++;
164 else
166 pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
167 bOverFlowUsed = true;
169 if (bOverFlowUsed) ovrflw++;
170 break;
171 case typelib_TypeClass_BYTE:
172 case typelib_TypeClass_BOOLEAN:
173 case typelib_TypeClass_CHAR:
174 case typelib_TypeClass_SHORT:
175 case typelib_TypeClass_UNSIGNED_SHORT:
176 case typelib_TypeClass_ENUM:
177 case typelib_TypeClass_LONG:
178 case typelib_TypeClass_UNSIGNED_LONG:
179 default:
180 if (ng < ia64::MAX_GPR_REGS)
182 pCppArgs[nPos] = pUnoArgs[nPos] = gpreg++;
183 ng++;
185 else
187 pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
188 bOverFlowUsed = true;
190 if (bOverFlowUsed) ovrflw++;
191 break;
194 // no longer needed
195 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
197 else // ptr to complex value | ref
199 #ifdef CMC_DEBUG
200 fprintf(stderr, "complex, ng is %d\n", ng);
201 #endif
202 void *pCppStack; //temporary stack pointer
204 if (ng < ia64::MAX_GPR_REGS)
206 pCppArgs[nPos] = pCppStack = *gpreg++;
207 ng++;
209 else
211 pCppArgs[nPos] = pCppStack = *ovrflw;
212 bOverFlowUsed = true;
214 if (bOverFlowUsed) ovrflw++;
216 if (! rParam.bIn) // is pure out
218 // uno out is unconstructed mem!
219 pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
220 pTempIndizes[nTempIndizes] = nPos;
221 // will be released at reconversion
222 ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
224 // is in/inout
225 else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
227 uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
228 pCppStack, pParamTypeDescr,
229 pThis->getBridge()->getCpp2Uno() );
230 pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
231 // will be released at reconversion
232 ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
234 else // direct way
236 pUnoArgs[nPos] = pCppStack;
237 // no longer needed
238 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
243 #ifdef CMC_DEBUG
244 fprintf(stderr, "end of params\n");
245 #endif
247 // ExceptionHolder
248 uno_Any aUnoExc; // Any will be constructed by callee
249 uno_Any * pUnoExc = &aUnoExc;
251 // invoke uno dispatch call
252 (*pThis->getUnoI()->pDispatcher)( pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
254 // in case an exception occured...
255 if (pUnoExc)
257 // destruct temporary in/inout params
258 for ( ; nTempIndizes--; )
260 sal_Int32 nIndex = pTempIndizes[nTempIndizes];
262 if (pParams[nIndex].bIn) // is in/inout => was constructed
263 uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], 0 );
264 TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] );
266 if (pReturnTypeDescr)
267 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
269 CPPU_CURRENT_NAMESPACE::raiseException( &aUnoExc, pThis->getBridge()->getUno2Cpp() );
270 // has to destruct the any
271 // is here for dummy
272 return typelib_TypeClass_VOID;
274 else // else no exception occured...
276 // temporary params
277 for ( ; nTempIndizes--; )
279 sal_Int32 nIndex = pTempIndizes[nTempIndizes];
280 typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];
282 if (pParams[nIndex].bOut) // inout/out
284 // convert and assign
285 uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
286 uno_copyAndConvertData( pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
287 pThis->getBridge()->getUno2Cpp() );
289 // destroy temp uno param
290 uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
292 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
294 // return
295 if (pCppReturn) // has complex return
297 if (pUnoReturn != pCppReturn) // needs reconversion
299 uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr,
300 pThis->getBridge()->getUno2Cpp() );
301 // destroy temp uno return
302 uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
304 // complex return ptr is set to return reg
305 *(void **)pRegisterReturn = pCppReturn;
307 if (pReturnTypeDescr)
309 typelib_TypeClass eRet = ia64::return_via_r8_buffer(pReturnTypeRef) ? typelib_TypeClass_VOID : (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
310 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
311 return eRet;
313 else
314 return typelib_TypeClass_VOID;
319 //==================================================================================================
320 static typelib_TypeClass cpp_mediate(
321 sal_uInt64 nOffsetAndIndex,
322 void ** gpreg, void ** fpreg, long sp, long r8,
323 sal_Int64 * pRegisterReturn /* space for register return */ )
325 OSL_ENSURE( sizeof(sal_Int64)==sizeof(void *), "### unexpected!" );
327 sal_Int32 nVtableOffset = (nOffsetAndIndex >> 32);
328 sal_Int32 nFunctionIndex = (nOffsetAndIndex & 0xFFFFFFFF);
330 void ** ovrflw = (void**)(sp);
332 // gpreg: [ret *], this, [other gpr params]
333 // fpreg: [fpr params]
334 // ovrflw: [gpr or fpr params (properly aligned)]
336 void * pThis;
337 if (nFunctionIndex & 0x80000000 )
339 nFunctionIndex &= 0x7fffffff;
340 pThis = gpreg[1];
341 #ifdef CMC_DEBUG
342 fprintf(stderr, "pThis is gpreg[1]\n");
343 #endif
345 else
347 pThis = gpreg[0];
348 #ifdef CMC_DEBUG
349 fprintf(stderr, "pThis is gpreg[0]\n");
350 #endif
353 #ifdef CMC_DEBUG
354 fprintf(stderr, "pThis is %p\n", pThis);
355 #endif
357 pThis = static_cast< char * >(pThis) - nVtableOffset;
359 #ifdef CMC_DEBUG
360 fprintf(stderr, "pThis is now %p\n", pThis);
361 #endif
363 bridges::cpp_uno::shared::CppInterfaceProxy * pCppI
364 = bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy(
365 pThis);
367 typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
369 #ifdef CMC_DEBUG
370 fprintf(stderr, "indexes are %d %d\n", nFunctionIndex, pTypeDescr->nMapFunctionIndexToMemberIndex);
371 #endif
373 OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" );
374 if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
376 throw RuntimeException(
377 rtl::OUString::createFromAscii("illegal vtable index!"),
378 (XInterface *)pThis );
381 // determine called method
382 sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
383 OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" );
385 #ifdef CMC_DEBUG
386 fprintf(stderr, "members are %d %d\n", nMemberPos, pTypeDescr->nAllMembers);
387 #endif
389 TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
391 typelib_TypeClass eRet;
392 switch (aMemberDescr.get()->eTypeClass)
394 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
396 if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
398 // is GET method
399 eRet = cpp2uno_call(
400 pCppI, aMemberDescr.get(),
401 ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef,
402 0, 0, // no params
403 r8, gpreg, fpreg, ovrflw, pRegisterReturn );
405 else
407 // is SET method
408 typelib_MethodParameter aParam;
409 aParam.pTypeRef =
410 ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef;
411 aParam.bIn = sal_True;
412 aParam.bOut = sal_False;
414 eRet = cpp2uno_call(
415 pCppI, aMemberDescr.get(),
416 0, // indicates void return
417 1, &aParam,
418 r8, gpreg, fpreg, ovrflw, pRegisterReturn );
420 break;
422 case typelib_TypeClass_INTERFACE_METHOD:
424 // is METHOD
425 switch (nFunctionIndex)
427 case 1: // acquire()
428 pCppI->acquireProxy(); // non virtual call!
429 eRet = typelib_TypeClass_VOID;
430 break;
431 case 2: // release()
432 pCppI->releaseProxy(); // non virtual call!
433 eRet = typelib_TypeClass_VOID;
434 break;
435 case 0: // queryInterface() opt
437 typelib_TypeDescription * pTD = 0;
438 TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( gpreg[2] )->getTypeLibType() );
439 if (pTD)
441 XInterface * pInterface = 0;
442 (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)(
443 pCppI->getBridge()->getCppEnv(),
444 (void **)&pInterface, pCppI->getOid().pData,
445 (typelib_InterfaceTypeDescription *)pTD );
447 if (pInterface)
449 ::uno_any_construct(
450 reinterpret_cast< uno_Any * >( gpreg[0] ),
451 &pInterface, pTD, cpp_acquire );
452 pInterface->release();
453 TYPELIB_DANGER_RELEASE( pTD );
454 *(void **)pRegisterReturn = gpreg[0];
455 eRet = typelib_TypeClass_ANY;
456 break;
458 TYPELIB_DANGER_RELEASE( pTD );
460 } // else perform queryInterface()
461 default:
462 eRet = cpp2uno_call(
463 pCppI, aMemberDescr.get(),
464 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef,
465 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams,
466 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams,
467 r8, gpreg, fpreg, ovrflw, pRegisterReturn );
469 break;
471 default:
473 #ifdef CMC_DEBUG
474 fprintf(stderr, "screwed\n");
475 #endif
477 throw RuntimeException(
478 rtl::OUString::createFromAscii("no member description found!"),
479 (XInterface *)pThis );
480 // is here for dummy
481 eRet = typelib_TypeClass_VOID;
485 #ifdef CMC_DEBUG
486 fprintf(stderr, "end of cpp_mediate\n");
487 #endif
488 return eRet;
492 extern "C" ia64::RegReturn cpp_vtable_call(
493 long in0, long in1, long in2, long in3, long in4, long in5, long in6, long in7,
494 long firstonstack
497 register long r15 asm("r15");
498 long r8 = r15;
500 register long r14 asm("r14");
501 long nOffsetAndIndex = r14;
503 long sp = (long)&firstonstack;
505 sal_uInt64 gpreg[ia64::MAX_GPR_REGS];
506 gpreg[0] = in0;
507 gpreg[1] = in1;
508 gpreg[2] = in2;
509 gpreg[3] = in3;
510 gpreg[4] = in4;
511 gpreg[5] = in5;
512 gpreg[6] = in6;
513 gpreg[7] = in7;
515 double fpreg[ia64::MAX_SSE_REGS];
516 register double f8 asm("f8"); fpreg[0] = f8;
517 register double f9 asm("f9"); fpreg[1] = f9;
518 register double f10 asm("f10"); fpreg[2] = f10;
519 register double f11 asm("f11"); fpreg[3] = f11;
520 register double f12 asm("f12"); fpreg[4] = f12;
521 register double f13 asm("f13"); fpreg[5] = f13;
522 register double f14 asm("f14"); fpreg[6] = f14;
523 register double f15 asm("f15"); fpreg[7] = f15;
525 #ifdef CMC_DEBUG
526 fprintf(stderr, "cpp_vtable_call called with %lx\n", nOffsetAndIndex);
527 fprintf(stderr, "adump is %lx %lx %lx %lx %lx %lx %lx %lx\n", in0, in1, in2, in3, in4, in5, in6, in7);
528 fprintf(stderr, "bdump is %f %f %f %f %f %f %f %f\n", f8, f9, f10, f11, f12, f13, f14, f15);
529 #endif
531 volatile long nRegReturn[4] = { 0 };
533 typelib_TypeClass aType =
534 cpp_mediate( nOffsetAndIndex, (void**)gpreg, (void**)fpreg, sp, r8, (sal_Int64*)&nRegReturn[0]);
536 ia64::RegReturn ret;
537 switch( aType )
539 case typelib_TypeClass_VOID:
540 break;
541 case typelib_TypeClass_BOOLEAN:
542 case typelib_TypeClass_BYTE:
543 case typelib_TypeClass_CHAR:
544 case typelib_TypeClass_UNSIGNED_SHORT:
545 case typelib_TypeClass_SHORT:
546 case typelib_TypeClass_ENUM:
547 case typelib_TypeClass_UNSIGNED_LONG:
548 case typelib_TypeClass_LONG:
549 case typelib_TypeClass_UNSIGNED_HYPER:
550 case typelib_TypeClass_HYPER:
551 ret.r8 = nRegReturn[0];
552 break;
553 case typelib_TypeClass_FLOAT:
554 asm volatile("ldfs f8=%0" : : "m"((*((float*)&nRegReturn))) : "f8");
555 break;
556 case typelib_TypeClass_DOUBLE:
557 asm volatile("ldfd f8=%0" : : "m"((*((double*)&nRegReturn))) : "f8");
558 break;
559 case typelib_TypeClass_STRUCT:
560 case typelib_TypeClass_EXCEPTION:
562 ret.r8 = nRegReturn[0];
563 ret.r9 = nRegReturn[1];
564 ret.r10 = nRegReturn[2];
565 ret.r11 = nRegReturn[3];
566 break;
568 default:
569 break;
571 return ret;
574 namespace
576 const int codeSnippetSize = 40;
578 bridges::cpp_uno::shared::VtableFactory::Slot codeSnippet( unsigned char * code, sal_PtrDiff writetoexecdiff, sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
579 bool bHasHiddenParam )
581 #ifdef CMC_DEBUG
582 fprintf(stderr, "size is %d\n", codeSnippetSize);
583 fprintf(stderr,"in codeSnippet functionIndex is %x\n", nFunctionIndex);
584 fprintf(stderr,"in codeSnippet vtableOffset is %x\n", nVtableOffset);
585 #endif
587 sal_uInt64 nOffsetAndIndex = ( ( (sal_uInt64) nVtableOffset ) << 32 ) | ( (sal_uInt64) nFunctionIndex );
589 if ( bHasHiddenParam )
590 nOffsetAndIndex |= 0x80000000;
592 long *raw = (long *)code;
594 bridges::cpp_uno::shared::VtableFactory::Slot* destination = (bridges::cpp_uno::shared::VtableFactory::Slot*)cpp_vtable_call;
596 raw[0] = (long)&privateSnippetExecutor;
597 raw[1] = (long)&raw[2];
598 raw[2] = nOffsetAndIndex;
599 raw[3] = destination->gp_value;
601 return *(bridges::cpp_uno::shared::VtableFactory::Slot*)(code+writetoexecdiff);
605 void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const *, unsigned char const *)
609 bridges::cpp_uno::shared::VtableFactory::Slot * bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
611 return static_cast< Slot * >(block) + 2;
615 sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize(
616 sal_Int32 slotCount)
618 return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
621 bridges::cpp_uno::shared::VtableFactory::Slot* bridges::cpp_uno::shared::VtableFactory::initializeBlock(void * block, sal_Int32 slotCount)
623 Slot * slots = mapBlockToVtable(block);
624 Slot foo = {0,0};
625 slots[-2] = foo;
626 slots[-1] = foo;
627 return slots + slotCount;
630 unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
631 Slot ** in_slots, unsigned char * code, sal_PtrDiff writetoexecdiff,
632 typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
633 sal_Int32 functionCount, sal_Int32 vtableOffset)
635 (*in_slots) -= functionCount;
636 Slot * slots = *in_slots;
637 #ifdef CMC_DEBUG
638 fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
639 fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
640 #endif
642 for (sal_Int32 i = 0; i < type->nMembers; ++i) {
643 typelib_TypeDescription * member = 0;
644 TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
645 OSL_ASSERT(member != 0);
646 switch (member->eTypeClass) {
647 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
648 // Getter:
649 *slots++ = codeSnippet(
650 code, writetoexecdiff, functionOffset++, vtableOffset,
651 ia64::return_in_hidden_param(
652 reinterpret_cast<
653 typelib_InterfaceAttributeTypeDescription * >(
654 member)->pAttributeTypeRef));
655 code += codeSnippetSize;
658 // Setter:
659 if (!reinterpret_cast<
660 typelib_InterfaceAttributeTypeDescription * >(
661 member)->bReadOnly)
663 *slots++ = codeSnippet(code, writetoexecdiff, functionOffset++, vtableOffset, false);
664 code += codeSnippetSize;
666 break;
668 case typelib_TypeClass_INTERFACE_METHOD:
669 *slots++ = codeSnippet(
670 code, writetoexecdiff, functionOffset++, vtableOffset,
671 ia64::return_in_hidden_param(
672 reinterpret_cast<
673 typelib_InterfaceMethodTypeDescription * >(
674 member)->pReturnTypeRef));
675 code += codeSnippetSize;
676 break;
678 default:
679 OSL_ASSERT(false);
680 break;
682 TYPELIB_DANGER_RELEASE(member);
684 return code;
687 /* vi:set tabstop=4 shiftwidth=4 expandtab: */