merge the formfield patch from ooo-build
[ooovba.git] / bridges / source / cpp_uno / gcc3_linux_s390 / cpp2uno.cxx
blob623b4a9c280e959cd10bd3c3edc8c33440e04bb7
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.6 $
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>
45 #include <string.h>
47 using namespace ::com::sun::star::uno;
49 namespace
52 static typelib_TypeClass cpp2uno_call(
53 bridges::cpp_uno::shared::CppInterfaceProxy * pThis,
54 const typelib_TypeDescription * pMemberTypeDescr,
55 typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return
56 sal_Int32 nParams, typelib_MethodParameter * pParams,
57 void ** gpreg, void ** fpreg, void ** ovrflw,
58 sal_Int64 * pRegisterReturn /* space for register return */ )
60 int ng = 0; //number of gpr registers used
61 int nf = 0; //number of fpr regsiters used
62 void ** pCppStack; //temporary stack pointer
64 // gpreg: [ret *], this, [gpr params]
65 // fpreg: [fpr params]
66 // ovrflw: [gpr or fpr params (properly aligned)]
68 // return
69 typelib_TypeDescription * pReturnTypeDescr = 0;
70 if (pReturnTypeRef)
71 TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
73 void * pUnoReturn = 0;
74 void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need
76 if (pReturnTypeDescr)
78 if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
80 pUnoReturn = pRegisterReturn; // direct way for simple types
82 else // complex return via ptr (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
93 // pop this
94 gpreg++;
95 ng++;
97 // stack space
98 OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" );
99 // parameters
100 void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
101 void ** pCppArgs = pUnoArgs + nParams;
102 // indizes of values this have to be converted (interface conversion cpp<=>uno)
103 sal_Int32 * pTempIndizes = (sal_Int32 *)(pUnoArgs + (2 * nParams));
104 // type descriptions for reconversions
105 typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
107 sal_Int32 nTempIndizes = 0;
109 for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
111 const typelib_MethodParameter & rParam = pParams[nPos];
112 typelib_TypeDescription * pParamTypeDescr = 0;
113 TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
115 if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) // value
118 switch (pParamTypeDescr->eTypeClass)
121 case typelib_TypeClass_DOUBLE:
122 if (nf < 2) {
123 pCppArgs[nPos] = fpreg;
124 pUnoArgs[nPos] = fpreg;
125 nf++;
126 fpreg += 2;
127 } else {
128 pCppArgs[nPos] = ovrflw;
129 pUnoArgs[nPos] = ovrflw;
130 ovrflw += 2;
132 break;
134 case typelib_TypeClass_FLOAT:
135 // fpreg are all double values so need to
136 // modify fpreg to be a single word float value
137 if (nf < 2) {
138 // float tmp = (float) (*((double *)fpreg));
139 // (*((float *) fpreg)) = tmp;
140 pCppArgs[nPos] = fpreg;
141 pUnoArgs[nPos] = fpreg;
142 nf++;
143 fpreg += 2;
144 } else {
145 pCppArgs[nPos] = ovrflw;
146 pUnoArgs[nPos] = ovrflw;
147 ovrflw += 1;
149 break;
151 case typelib_TypeClass_HYPER:
152 case typelib_TypeClass_UNSIGNED_HYPER:
153 if (ng < 4) {
154 pCppArgs[nPos] = gpreg;
155 pUnoArgs[nPos] = gpreg;
156 ng += 2;
157 gpreg += 2;
158 } else {
159 pCppArgs[nPos] = ovrflw;
160 pUnoArgs[nPos] = ovrflw;
161 ovrflw += 2;
163 break;
165 case typelib_TypeClass_BYTE:
166 case typelib_TypeClass_BOOLEAN:
167 if (ng < 5) {
168 pCppArgs[nPos] = (((char *)gpreg) + 3);
169 pUnoArgs[nPos] = (((char *)gpreg) + 3);
170 ng++;
171 gpreg++;
172 } else {
173 pCppArgs[nPos] = (((char *)ovrflw) + 3);
174 pUnoArgs[nPos] = (((char *)ovrflw) + 3);
175 ovrflw++;
177 break;
180 case typelib_TypeClass_CHAR:
181 case typelib_TypeClass_SHORT:
182 case typelib_TypeClass_UNSIGNED_SHORT:
183 if (ng < 5) {
184 pCppArgs[nPos] = (((char *)gpreg)+ 2);
185 pUnoArgs[nPos] = (((char *)gpreg)+ 2);
186 ng++;
187 gpreg++;
188 } else {
189 pCppArgs[nPos] = (((char *)ovrflw) + 2);
190 pUnoArgs[nPos] = (((char *)ovrflw) + 2);
191 ovrflw++;
193 break;
196 default:
197 if (ng < 5) {
198 pCppArgs[nPos] = gpreg;
199 pUnoArgs[nPos] = gpreg;
200 ng++;
201 gpreg++;
202 } else {
203 pCppArgs[nPos] = ovrflw;
204 pUnoArgs[nPos] = ovrflw;
205 ovrflw++;
207 break;
210 // no longer needed
211 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
213 else // ptr to complex value | ref
216 if (ng < 5) {
217 pCppArgs[nPos] = *(void **)gpreg;
218 pCppStack = gpreg;
219 ng++;
220 gpreg++;
221 } else {
222 pCppArgs[nPos] = *(void **)ovrflw;
223 pCppStack = ovrflw;
224 ovrflw++;
227 if (! rParam.bIn) // is pure out
229 // uno out is unconstructed mem!
230 pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
231 pTempIndizes[nTempIndizes] = nPos;
232 // will be released at reconversion
233 ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
235 // is in/inout
236 else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
238 uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
239 *(void **)pCppStack, pParamTypeDescr,
240 pThis->getBridge()->getCpp2Uno() );
241 pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
242 // will be released at reconversion
243 ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
245 else // direct way
247 pUnoArgs[nPos] = *(void **)pCppStack;
248 // no longer needed
249 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
254 // ExceptionHolder
255 uno_Any aUnoExc; // Any will be constructed by callee
256 uno_Any * pUnoExc = &aUnoExc;
258 // invoke uno dispatch call
259 (*pThis->getUnoI()->pDispatcher)( pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
261 // in case an exception occured...
262 if (pUnoExc)
264 // destruct temporary in/inout params
265 for ( ; nTempIndizes--; )
267 sal_Int32 nIndex = pTempIndizes[nTempIndizes];
269 if (pParams[nIndex].bIn) // is in/inout => was constructed
270 uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], 0 );
271 TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] );
273 if (pReturnTypeDescr)
274 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
276 CPPU_CURRENT_NAMESPACE::raiseException( &aUnoExc, pThis->getBridge()->getUno2Cpp() ); // has to destruct the any
277 // is here for dummy
278 return typelib_TypeClass_VOID;
280 else // else no exception occured...
282 // temporary params
283 for ( ; nTempIndizes--; )
285 sal_Int32 nIndex = pTempIndizes[nTempIndizes];
286 typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];
288 if (pParams[nIndex].bOut) // inout/out
290 // convert and assign
291 uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
292 uno_copyAndConvertData( pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
293 pThis->getBridge()->getUno2Cpp() );
295 // destroy temp uno param
296 uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
298 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
300 // return
301 if (pCppReturn) // has complex return
303 if (pUnoReturn != pCppReturn) // needs reconversion
305 uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr,
306 pThis->getBridge()->getUno2Cpp() );
307 // destroy temp uno return
308 uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
310 // complex return ptr is set to return reg
311 *(void **)pRegisterReturn = pCppReturn;
313 if (pReturnTypeDescr)
315 typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
316 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
317 return eRet;
319 else
320 return typelib_TypeClass_VOID;
325 //============================================================================
326 static typelib_TypeClass cpp_mediate(
327 sal_uInt32 nOffsetAndIndex,
328 void ** gpreg, void ** fpreg, void ** ovrflw,
329 sal_Int64 * pRegisterReturn /* space for register return */ )
331 OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" );
333 sal_Int16 nVtableOffset = (nOffsetAndIndex >> 16);
334 sal_Int16 nFunctionIndex = (nOffsetAndIndex & 0xFFFF);
336 // gpreg: [ret *], this, [other gpr params]
337 // fpreg: [fpr params]
338 // ovrflw: [gpr or fpr params (properly aligned)]
340 // _this_ ptr is patched cppu_XInterfaceProxy object
341 void * pThis;
342 if( nFunctionIndex & 0x8000 )
344 nFunctionIndex &= 0x7fff;
345 pThis = gpreg[1];
347 else
349 pThis = gpreg[0];
352 pThis = static_cast< char * >(pThis) - nVtableOffset;
354 bridges::cpp_uno::shared::CppInterfaceProxy * pCppI
355 = bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy(
356 pThis);
358 typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
361 OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" );
362 if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
364 throw RuntimeException(
365 rtl::OUString::createFromAscii("illegal vtable index!"),
366 (XInterface *)pCppI );
369 // determine called method
370 OSL_ENSURE( nVtableCall < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" );
371 sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
372 OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" );
374 TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
376 typelib_TypeClass eRet;
377 switch (aMemberDescr.get()->eTypeClass)
379 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
381 if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
383 // is GET method
384 eRet = cpp2uno_call(
385 pCppI, aMemberDescr.get(),
386 ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef,
387 0, 0, // no params
388 gpreg, fpreg, ovrflw, pRegisterReturn );
390 else
392 // is SET method
393 typelib_MethodParameter aParam;
394 aParam.pTypeRef =
395 ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef;
396 aParam.bIn = sal_True;
397 aParam.bOut = sal_False;
399 eRet = cpp2uno_call(
400 pCppI, aMemberDescr.get(),
401 0, // indicates void return
402 1, &aParam,
403 gpreg, fpreg, ovrflw, pRegisterReturn );
405 break;
407 case typelib_TypeClass_INTERFACE_METHOD:
409 // is METHOD
410 switch (nFunctionIndex)
412 case 1: // acquire()
413 pCppI->acquireProxy(); // non virtual call!
414 eRet = typelib_TypeClass_VOID;
415 break;
416 case 2: // release()
417 pCppI->releaseProxy(); // non virtual call!
418 eRet = typelib_TypeClass_VOID;
419 break;
420 case 0: // queryInterface() opt
422 typelib_TypeDescription * pTD = 0;
423 TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( gpreg[2] )->getTypeLibType() );
424 if (pTD)
426 XInterface * pInterface = 0;
427 (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)(
428 pCppI->getBridge()->getCppEnv(),
429 (void **)&pInterface, pCppI->getOid().pData,
430 (typelib_InterfaceTypeDescription *)pTD );
432 if (pInterface)
434 ::uno_any_construct(
435 reinterpret_cast< uno_Any * >( gpreg[0] ),
436 &pInterface, pTD, cpp_acquire );
437 pInterface->release();
438 TYPELIB_DANGER_RELEASE( pTD );
439 *(void **)pRegisterReturn = gpreg[0];
440 eRet = typelib_TypeClass_ANY;
441 break;
443 TYPELIB_DANGER_RELEASE( pTD );
445 } // else perform queryInterface()
446 default:
447 eRet = cpp2uno_call(
448 pCppI, aMemberDescr.get(),
449 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef,
450 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams,
451 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams,
452 gpreg, fpreg, ovrflw, pRegisterReturn );
454 break;
456 default:
458 throw RuntimeException(
459 rtl::OUString::createFromAscii("no member description found!"),
460 (XInterface *)pCppI );
461 // is here for dummy
462 eRet = typelib_TypeClass_VOID;
466 return eRet;
469 //==================================================================================================
471 * is called on incoming vtable calls
472 * (called by asm snippets)
474 static void privateSnippetExecutor( sal_uInt32 nOffsetAndIndex, void** gpregptr, void** fpregptr, void** ovrflw)
476 #ifdef CMC_DEBUG
477 fprintf(stderr, "privateSnippetExecutor\n");
478 #endif
481 sal_Int32 gpreg[8];
482 double fpreg[8];
484 memcpy( gpreg, gpregptr, 32);
485 memcpy( fpreg, fpregptr, 64);
487 volatile long nRegReturn[2];
489 typelib_TypeClass aType =
490 cpp_mediate( nOffsetAndIndex, (void**)gpreg, (void**)fpreg, ovrflw,
491 (sal_Int64*)nRegReturn );
493 switch( aType )
496 // move return value into register space
497 // (will be loaded by machine code snippet)
499 case typelib_TypeClass_BOOLEAN:
501 unsigned long tmp = (unsigned long)(*(unsigned char *)nRegReturn);
502 __asm__ volatile ( "l 2,%0\n\t" : :
503 "m"(tmp) : "2" );
504 break;
506 case typelib_TypeClass_BYTE:
508 long tmp = (long)(*(signed char *)nRegReturn);
509 __asm__ volatile ( "l 2,%0\n\t" : :
510 "m"(tmp) : "2" );
511 break;
513 case typelib_TypeClass_CHAR:
514 case typelib_TypeClass_UNSIGNED_SHORT:
516 unsigned long tmp = (unsigned long)(*(unsigned short *)nRegReturn);
517 __asm__ volatile ( "l 2,%0\n\t" : :
518 "m"(tmp) : "2" );
519 break;
521 case typelib_TypeClass_SHORT:
523 long tmp = (long)(*(short *)nRegReturn);
524 __asm__ volatile ( "l 2,%0\n\t" : :
525 "m"(tmp) : "2" );
526 break;
528 case typelib_TypeClass_FLOAT:
529 __asm__ volatile ( "le 0,%0\n\t" : :
530 "m" (*((float*)nRegReturn)) : "16" );
531 break;
533 case typelib_TypeClass_DOUBLE:
534 __asm__ volatile ( "ld 0,%0\n\t" : :
535 "m" (*((double*)nRegReturn)) : "16" );
536 break;
538 case typelib_TypeClass_HYPER:
539 case typelib_TypeClass_UNSIGNED_HYPER:
540 __asm__ volatile ( "lm 2,3,%0\n\t" : :
541 "m"(nRegReturn[0]) : "2", "3" );
542 break;
544 default:
545 __asm__ volatile ( "l 2,%0\n\t" : :
546 "m"(nRegReturn[0]) : "2" );
547 break;
551 const int codeSnippetSize = 50;
553 unsigned char* codeSnippet( unsigned char * code, sal_Int16 nFunctionIndex, sal_Int16 nVtableOffset, bool simple_ret_type )
555 sal_uInt32 nOffsetAndIndex = ( ( nVtableOffset ) << 16 ) | ( nFunctionIndex );
557 if (! simple_ret_type)
558 nOffsetAndIndex |= 0x8000;
560 OSL_ASSERT( sizeof (long) == 4 );
562 /* generate this code */
563 // lr %r0,%r13
564 // bras %r13,0x6
565 // .long privateSnippetExecutor
566 // .long nOffsetAndIndex
567 // stm %r2,%r6,8(%r15)
568 // std %f0,64(%r15)
569 // std %f2,72(%r15)
571 // l %r2,4(%r13)
572 // la %r3,8(%r15)
573 // la %r4,64(%r15)
574 // la %r5,96(%r15)
575 // l %r1,0(%r13)
576 // lr %r13,%r0
577 // br %r1
579 unsigned char * p = code;
580 *reinterpret_cast< sal_Int16 * >(p) = 0x180d;
581 p += sizeof(sal_Int16);
582 *reinterpret_cast< sal_Int32 * >(p) = 0xa7d50006;
583 p += sizeof(sal_Int32);
584 *reinterpret_cast< sal_Int32 * >(p) =
585 reinterpret_cast< sal_Int32 >(privateSnippetExecutor);
586 p += sizeof(sal_Int32);
587 *reinterpret_cast< sal_Int32 * >(p) = nOffsetAndIndex;
588 p += sizeof(sal_Int32);
589 *reinterpret_cast< sal_Int32 * >(p) = 0x9026f008;
590 p += sizeof(sal_Int32);
591 *reinterpret_cast< sal_Int32 * >(p) = 0x6000f040;
592 p += sizeof(sal_Int32);
593 *reinterpret_cast< sal_Int32 * >(p) = 0x6020f048;
594 p += sizeof(sal_Int32);
595 *reinterpret_cast< sal_Int32 * >(p) = 0x5820d004;
596 p += sizeof(sal_Int32);
597 *reinterpret_cast< sal_Int32 * >(p) = 0x4130f008;
598 p += sizeof(sal_Int32);
599 *reinterpret_cast< sal_Int32 * >(p) = 0x4140f040;
600 p += sizeof(sal_Int32);
601 *reinterpret_cast< sal_Int32 * >(p) = 0x4150f060;
602 p += sizeof(sal_Int32);
603 *reinterpret_cast< sal_Int32 * >(p) = 0x5810d000;
604 p += sizeof(sal_Int32);
605 *reinterpret_cast< sal_Int16 * >(p) = 0x18d0;
606 p += sizeof(sal_Int16);
607 *reinterpret_cast< sal_Int16 * >(p) = 0x07f1;
608 p += sizeof(sal_Int16);
610 return (code + codeSnippetSize);
614 void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const *, unsigned char const *)
618 struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; };
620 bridges::cpp_uno::shared::VtableFactory::Slot *
621 bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
623 return static_cast< Slot * >(block) + 2;
626 sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize(
627 sal_Int32 slotCount)
629 return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
632 bridges::cpp_uno::shared::VtableFactory::Slot *
633 bridges::cpp_uno::shared::VtableFactory::initializeBlock(
634 void * block, sal_Int32 slotCount)
636 Slot * slots = mapBlockToVtable(block);
637 slots[-2].fn = 0;
638 slots[-1].fn = 0;
639 return slots + slotCount;
642 unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
643 Slot ** slots, unsigned char * code, sal_PtrDiff writetoexecdiff,
644 typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
645 sal_Int32 functionCount, sal_Int32 vtableOffset)
647 (*slots) -= functionCount;
648 Slot * s = *slots;
649 #ifdef CMC_DEBUG
650 fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
651 fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
652 #endif
654 for (sal_Int32 i = 0; i < type->nMembers; ++i) {
655 typelib_TypeDescription * member = 0;
656 TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
657 OSL_ASSERT(member != 0);
658 switch (member->eTypeClass) {
659 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
660 // Getter:
661 (s++)->fn = code + writetoexecdiff;
662 code = codeSnippet(
663 code, functionOffset++, vtableOffset,
664 bridges::cpp_uno::shared::isSimpleType(
665 reinterpret_cast<
666 typelib_InterfaceAttributeTypeDescription * >(
667 member)->pAttributeTypeRef));
669 // Setter:
670 if (!reinterpret_cast<
671 typelib_InterfaceAttributeTypeDescription * >(
672 member)->bReadOnly)
674 (s++)->fn = code + writetoexecdiff;
675 code = codeSnippet(code, functionOffset++, vtableOffset, true);
677 break;
679 case typelib_TypeClass_INTERFACE_METHOD:
680 (s++)->fn = code + writetoexecdiff;
681 code = codeSnippet(
682 code, functionOffset++, vtableOffset,
683 bridges::cpp_uno::shared::isSimpleType(
684 reinterpret_cast<
685 typelib_InterfaceMethodTypeDescription * >(
686 member)->pReturnTypeRef));
687 break;
689 default:
690 OSL_ASSERT(false);
691 break;
693 TYPELIB_DANGER_RELEASE(member);
695 return code;
698 /* vi:set tabstop=4 shiftwidth=4 expandtab: */