Bump for 3.6-28
[LibreOffice.git] / bridges / source / cpp_uno / gcc3_linux_s390 / cpp2uno.cxx
blob46195402b1505b703a31bcda69ab8d2bfe2aece0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include <com/sun/star/uno/genfunc.hxx>
31 #include <uno/data.h>
32 #include <typelib/typedescription.hxx>
34 #include "bridges/cpp_uno/shared/bridge.hxx"
35 #include "bridges/cpp_uno/shared/cppinterfaceproxy.hxx"
36 #include "bridges/cpp_uno/shared/types.hxx"
37 #include "bridges/cpp_uno/shared/vtablefactory.hxx"
39 #include "share.hxx"
40 #include <stdio.h>
41 #include <string.h>
43 using namespace ::com::sun::star::uno;
45 namespace
48 static typelib_TypeClass cpp2uno_call(
49 bridges::cpp_uno::shared::CppInterfaceProxy * pThis,
50 const typelib_TypeDescription * pMemberTypeDescr,
51 typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return
52 sal_Int32 nParams, typelib_MethodParameter * pParams,
53 void ** gpreg, void ** fpreg, void ** ovrflw,
54 sal_Int64 * pRegisterReturn /* space for register return */ )
56 int ng = 0; //number of gpr registers used
57 int nf = 0; //number of fpr regsiters used
58 void ** pCppStack; //temporary stack pointer
60 // gpreg: [ret *], this, [gpr params]
61 // fpreg: [fpr params]
62 // ovrflw: [gpr or fpr params (properly aligned)]
64 // return
65 typelib_TypeDescription * pReturnTypeDescr = 0;
66 if (pReturnTypeRef)
67 TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
69 void * pUnoReturn = 0;
70 void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need
72 if (pReturnTypeDescr)
74 if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
76 pUnoReturn = pRegisterReturn; // direct way for simple types
78 else // complex return via ptr (pCppReturn)
80 pCppReturn = *(void **)gpreg;
81 gpreg++;
82 ng++;
84 pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
85 ? alloca( pReturnTypeDescr->nSize )
86 : pCppReturn); // direct way
89 // pop this
90 gpreg++;
91 ng++;
93 // stack space
94 OSL_ENSURE( sizeof(void *) == sizeof(sal_Int32), "### unexpected size!" );
95 // parameters
96 void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
97 void ** pCppArgs = pUnoArgs + nParams;
98 // indizes of values this have to be converted (interface conversion cpp<=>uno)
99 sal_Int32 * pTempIndizes = (sal_Int32 *)(pUnoArgs + (2 * nParams));
100 // type descriptions for reconversions
101 typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
103 sal_Int32 nTempIndizes = 0;
105 for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
107 const typelib_MethodParameter & rParam = pParams[nPos];
108 typelib_TypeDescription * pParamTypeDescr = 0;
109 TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
111 if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr )) // value
114 switch (pParamTypeDescr->eTypeClass)
117 case typelib_TypeClass_DOUBLE:
118 if (nf < 2) {
119 pCppArgs[nPos] = fpreg;
120 pUnoArgs[nPos] = fpreg;
121 nf++;
122 fpreg += 2;
123 } else {
124 pCppArgs[nPos] = ovrflw;
125 pUnoArgs[nPos] = ovrflw;
126 ovrflw += 2;
128 break;
130 case typelib_TypeClass_FLOAT:
131 // fpreg are all double values so need to
132 // modify fpreg to be a single word float value
133 if (nf < 2) {
134 // float tmp = (float) (*((double *)fpreg));
135 // (*((float *) fpreg)) = tmp;
136 pCppArgs[nPos] = fpreg;
137 pUnoArgs[nPos] = fpreg;
138 nf++;
139 fpreg += 2;
140 } else {
141 pCppArgs[nPos] = ovrflw;
142 pUnoArgs[nPos] = ovrflw;
143 ovrflw += 1;
145 break;
147 case typelib_TypeClass_HYPER:
148 case typelib_TypeClass_UNSIGNED_HYPER:
149 if (ng < 4) {
150 pCppArgs[nPos] = gpreg;
151 pUnoArgs[nPos] = gpreg;
152 ng += 2;
153 gpreg += 2;
154 } else {
155 pCppArgs[nPos] = ovrflw;
156 pUnoArgs[nPos] = ovrflw;
157 ovrflw += 2;
159 break;
161 case typelib_TypeClass_BYTE:
162 case typelib_TypeClass_BOOLEAN:
163 if (ng < 5) {
164 pCppArgs[nPos] = (((char *)gpreg) + 3);
165 pUnoArgs[nPos] = (((char *)gpreg) + 3);
166 ng++;
167 gpreg++;
168 } else {
169 pCppArgs[nPos] = (((char *)ovrflw) + 3);
170 pUnoArgs[nPos] = (((char *)ovrflw) + 3);
171 ovrflw++;
173 break;
176 case typelib_TypeClass_CHAR:
177 case typelib_TypeClass_SHORT:
178 case typelib_TypeClass_UNSIGNED_SHORT:
179 if (ng < 5) {
180 pCppArgs[nPos] = (((char *)gpreg)+ 2);
181 pUnoArgs[nPos] = (((char *)gpreg)+ 2);
182 ng++;
183 gpreg++;
184 } else {
185 pCppArgs[nPos] = (((char *)ovrflw) + 2);
186 pUnoArgs[nPos] = (((char *)ovrflw) + 2);
187 ovrflw++;
189 break;
192 default:
193 if (ng < 5) {
194 pCppArgs[nPos] = gpreg;
195 pUnoArgs[nPos] = gpreg;
196 ng++;
197 gpreg++;
198 } else {
199 pCppArgs[nPos] = ovrflw;
200 pUnoArgs[nPos] = ovrflw;
201 ovrflw++;
203 break;
206 // no longer needed
207 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
209 else // ptr to complex value | ref
212 if (ng < 5) {
213 pCppArgs[nPos] = *(void **)gpreg;
214 pCppStack = gpreg;
215 ng++;
216 gpreg++;
217 } else {
218 pCppArgs[nPos] = *(void **)ovrflw;
219 pCppStack = ovrflw;
220 ovrflw++;
223 if (! rParam.bIn) // is pure out
225 // uno out is unconstructed mem!
226 pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
227 pTempIndizes[nTempIndizes] = nPos;
228 // will be released at reconversion
229 ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
231 // is in/inout
232 else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
234 uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
235 *(void **)pCppStack, pParamTypeDescr,
236 pThis->getBridge()->getCpp2Uno() );
237 pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
238 // will be released at reconversion
239 ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
241 else // direct way
243 pUnoArgs[nPos] = *(void **)pCppStack;
244 // no longer needed
245 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
250 // ExceptionHolder
251 uno_Any aUnoExc; // Any will be constructed by callee
252 uno_Any * pUnoExc = &aUnoExc;
254 // invoke uno dispatch call
255 (*pThis->getUnoI()->pDispatcher)( pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
257 // in case an exception occurred...
258 if (pUnoExc)
260 // destruct temporary in/inout params
261 for ( ; nTempIndizes--; )
263 sal_Int32 nIndex = pTempIndizes[nTempIndizes];
265 if (pParams[nIndex].bIn) // is in/inout => was constructed
266 uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndizes], 0 );
267 TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] );
269 if (pReturnTypeDescr)
270 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
272 CPPU_CURRENT_NAMESPACE::raiseException( &aUnoExc, pThis->getBridge()->getUno2Cpp() ); // has to destruct the any
273 // is here for dummy
274 return typelib_TypeClass_VOID;
276 else // else no exception occurred...
278 // temporary params
279 for ( ; nTempIndizes--; )
281 sal_Int32 nIndex = pTempIndizes[nTempIndizes];
282 typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];
284 if (pParams[nIndex].bOut) // inout/out
286 // convert and assign
287 uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
288 uno_copyAndConvertData( pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
289 pThis->getBridge()->getUno2Cpp() );
291 // destroy temp uno param
292 uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
294 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
296 // return
297 if (pCppReturn) // has complex return
299 if (pUnoReturn != pCppReturn) // needs reconversion
301 uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr,
302 pThis->getBridge()->getUno2Cpp() );
303 // destroy temp uno return
304 uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
306 // complex return ptr is set to return reg
307 *(void **)pRegisterReturn = pCppReturn;
309 if (pReturnTypeDescr)
311 typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
312 TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
313 return eRet;
315 else
316 return typelib_TypeClass_VOID;
321 //============================================================================
322 static typelib_TypeClass cpp_mediate(
323 sal_uInt32 nOffsetAndIndex,
324 void ** gpreg, void ** fpreg, void ** ovrflw,
325 sal_Int64 * pRegisterReturn /* space for register return */ )
327 OSL_ENSURE( sizeof(sal_Int32)==sizeof(void *), "### unexpected!" );
329 sal_Int16 nVtableOffset = (nOffsetAndIndex >> 16);
330 sal_Int16 nFunctionIndex = (nOffsetAndIndex & 0xFFFF);
332 // gpreg: [ret *], this, [other gpr params]
333 // fpreg: [fpr params]
334 // ovrflw: [gpr or fpr params (properly aligned)]
336 // _this_ ptr is patched cppu_XInterfaceProxy object
337 void * pThis;
338 if( nFunctionIndex & 0x8000 )
340 nFunctionIndex &= 0x7fff;
341 pThis = gpreg[1];
343 else
345 pThis = gpreg[0];
348 pThis = static_cast< char * >(pThis) - nVtableOffset;
350 bridges::cpp_uno::shared::CppInterfaceProxy * pCppI
351 = bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy(
352 pThis);
354 typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
357 OSL_ENSURE( nFunctionIndex < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" );
358 if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
360 throw RuntimeException(
361 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "illegal vtable index!" )),
362 (XInterface *)pCppI );
365 // determine called method
366 OSL_ENSURE( nVtableCall < pTypeDescr->nMapFunctionIndexToMemberIndex, "### illegal vtable index!" );
367 sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
368 OSL_ENSURE( nMemberPos < pTypeDescr->nAllMembers, "### illegal member index!" );
370 TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
372 typelib_TypeClass eRet;
373 switch (aMemberDescr.get()->eTypeClass)
375 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
377 if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
379 // is GET method
380 eRet = cpp2uno_call(
381 pCppI, aMemberDescr.get(),
382 ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef,
383 0, 0, // no params
384 gpreg, fpreg, ovrflw, pRegisterReturn );
386 else
388 // is SET method
389 typelib_MethodParameter aParam;
390 aParam.pTypeRef =
391 ((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef;
392 aParam.bIn = sal_True;
393 aParam.bOut = sal_False;
395 eRet = cpp2uno_call(
396 pCppI, aMemberDescr.get(),
397 0, // indicates void return
398 1, &aParam,
399 gpreg, fpreg, ovrflw, pRegisterReturn );
401 break;
403 case typelib_TypeClass_INTERFACE_METHOD:
405 // is METHOD
406 switch (nFunctionIndex)
408 case 1: // acquire()
409 pCppI->acquireProxy(); // non virtual call!
410 eRet = typelib_TypeClass_VOID;
411 break;
412 case 2: // release()
413 pCppI->releaseProxy(); // non virtual call!
414 eRet = typelib_TypeClass_VOID;
415 break;
416 case 0: // queryInterface() opt
418 typelib_TypeDescription * pTD = 0;
419 TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( gpreg[2] )->getTypeLibType() );
420 if (pTD)
422 XInterface * pInterface = 0;
423 (*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)(
424 pCppI->getBridge()->getCppEnv(),
425 (void **)&pInterface, pCppI->getOid().pData,
426 (typelib_InterfaceTypeDescription *)pTD );
428 if (pInterface)
430 ::uno_any_construct(
431 reinterpret_cast< uno_Any * >( gpreg[0] ),
432 &pInterface, pTD, cpp_acquire );
433 pInterface->release();
434 TYPELIB_DANGER_RELEASE( pTD );
435 *(void **)pRegisterReturn = gpreg[0];
436 eRet = typelib_TypeClass_ANY;
437 break;
439 TYPELIB_DANGER_RELEASE( pTD );
441 } // else perform queryInterface()
442 default:
443 eRet = cpp2uno_call(
444 pCppI, aMemberDescr.get(),
445 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef,
446 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams,
447 ((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams,
448 gpreg, fpreg, ovrflw, pRegisterReturn );
450 break;
452 default:
454 throw RuntimeException(
455 rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "no member description found!" )),
456 (XInterface *)pCppI );
460 return eRet;
463 //==================================================================================================
465 * is called on incoming vtable calls
466 * (called by asm snippets)
468 static void privateSnippetExecutor( sal_uInt32 nOffsetAndIndex, void** gpregptr, void** fpregptr, void** ovrflw)
470 #if OSL_DEBUG_LEVEL > 2
471 fprintf(stderr, "privateSnippetExecutor\n");
472 #endif
475 sal_Int32 gpreg[8];
476 double fpreg[8];
478 memcpy( gpreg, gpregptr, 32);
479 memcpy( fpreg, fpregptr, 64);
481 volatile long nRegReturn[2];
483 typelib_TypeClass aType =
484 cpp_mediate( nOffsetAndIndex, (void**)gpreg, (void**)fpreg, ovrflw,
485 (sal_Int64*)nRegReturn );
487 switch( aType )
490 // move return value into register space
491 // (will be loaded by machine code snippet)
493 case typelib_TypeClass_BOOLEAN:
495 unsigned long tmp = (unsigned long)(*(unsigned char *)nRegReturn);
496 __asm__ volatile ( "l 2,%0\n\t" : :
497 "m"(tmp) : "2" );
498 break;
500 case typelib_TypeClass_BYTE:
502 long tmp = (long)(*(signed char *)nRegReturn);
503 __asm__ volatile ( "l 2,%0\n\t" : :
504 "m"(tmp) : "2" );
505 break;
507 case typelib_TypeClass_CHAR:
508 case typelib_TypeClass_UNSIGNED_SHORT:
510 unsigned long tmp = (unsigned long)(*(unsigned short *)nRegReturn);
511 __asm__ volatile ( "l 2,%0\n\t" : :
512 "m"(tmp) : "2" );
513 break;
515 case typelib_TypeClass_SHORT:
517 long tmp = (long)(*(short *)nRegReturn);
518 __asm__ volatile ( "l 2,%0\n\t" : :
519 "m"(tmp) : "2" );
520 break;
522 case typelib_TypeClass_FLOAT:
523 __asm__ volatile ( "le 0,%0\n\t" : :
524 "m" (*((float*)nRegReturn)) : "16" );
525 break;
527 case typelib_TypeClass_DOUBLE:
528 __asm__ volatile ( "ld 0,%0\n\t" : :
529 "m" (*((double*)nRegReturn)) : "16" );
530 break;
532 case typelib_TypeClass_HYPER:
533 case typelib_TypeClass_UNSIGNED_HYPER:
534 __asm__ volatile ( "lm 2,3,%0\n\t" : :
535 "m"(nRegReturn[0]) : "2", "3" );
536 break;
538 default:
539 __asm__ volatile ( "l 2,%0\n\t" : :
540 "m"(nRegReturn[0]) : "2" );
541 break;
545 const int codeSnippetSize = 50;
547 unsigned char* codeSnippet( unsigned char * code, sal_Int16 nFunctionIndex, sal_Int16 nVtableOffset, bool simple_ret_type )
549 sal_uInt32 nOffsetAndIndex = ( ( nVtableOffset ) << 16 ) | ( nFunctionIndex );
551 if (! simple_ret_type)
552 nOffsetAndIndex |= 0x8000;
554 OSL_ASSERT( sizeof (long) == 4 );
556 /* generate this code */
557 // lr %r0,%r13
558 // bras %r13,0x6
559 // .long privateSnippetExecutor
560 // .long nOffsetAndIndex
561 // stm %r2,%r6,8(%r15)
562 // std %f0,64(%r15)
563 // std %f2,72(%r15)
565 // l %r2,4(%r13)
566 // la %r3,8(%r15)
567 // la %r4,64(%r15)
568 // la %r5,96(%r15)
569 // l %r1,0(%r13)
570 // lr %r13,%r0
571 // br %r1
573 unsigned char * p = code;
574 *reinterpret_cast< sal_Int16 * >(p) = 0x180d;
575 p += sizeof(sal_Int16);
576 *reinterpret_cast< sal_Int32 * >(p) = 0xa7d50006;
577 p += sizeof(sal_Int32);
578 *reinterpret_cast< sal_Int32 * >(p) =
579 reinterpret_cast< sal_Int32 >(privateSnippetExecutor);
580 p += sizeof(sal_Int32);
581 *reinterpret_cast< sal_Int32 * >(p) = nOffsetAndIndex;
582 p += sizeof(sal_Int32);
583 *reinterpret_cast< sal_Int32 * >(p) = 0x9026f008;
584 p += sizeof(sal_Int32);
585 *reinterpret_cast< sal_Int32 * >(p) = 0x6000f040;
586 p += sizeof(sal_Int32);
587 *reinterpret_cast< sal_Int32 * >(p) = 0x6020f048;
588 p += sizeof(sal_Int32);
589 *reinterpret_cast< sal_Int32 * >(p) = 0x5820d004;
590 p += sizeof(sal_Int32);
591 *reinterpret_cast< sal_Int32 * >(p) = 0x4130f008;
592 p += sizeof(sal_Int32);
593 *reinterpret_cast< sal_Int32 * >(p) = 0x4140f040;
594 p += sizeof(sal_Int32);
595 *reinterpret_cast< sal_Int32 * >(p) = 0x4150f060;
596 p += sizeof(sal_Int32);
597 *reinterpret_cast< sal_Int32 * >(p) = 0x5810d000;
598 p += sizeof(sal_Int32);
599 *reinterpret_cast< sal_Int16 * >(p) = 0x18d0;
600 p += sizeof(sal_Int16);
601 *reinterpret_cast< sal_Int16 * >(p) = 0x07f1;
602 p += sizeof(sal_Int16);
604 return (code + codeSnippetSize);
608 void bridges::cpp_uno::shared::VtableFactory::flushCode(unsigned char const *, unsigned char const *)
612 struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; };
614 bridges::cpp_uno::shared::VtableFactory::Slot *
615 bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
617 return static_cast< Slot * >(block) + 2;
620 sal_Size bridges::cpp_uno::shared::VtableFactory::getBlockSize(
621 sal_Int32 slotCount)
623 return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
626 bridges::cpp_uno::shared::VtableFactory::Slot *
627 bridges::cpp_uno::shared::VtableFactory::initializeBlock(
628 void * block, sal_Int32 slotCount)
630 Slot * slots = mapBlockToVtable(block);
631 slots[-2].fn = 0;
632 slots[-1].fn = 0;
633 return slots + slotCount;
636 unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
637 Slot ** slots, unsigned char * code, sal_PtrDiff writetoexecdiff,
638 typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
639 sal_Int32 functionCount, sal_Int32 vtableOffset)
641 (*slots) -= functionCount;
642 Slot * s = *slots;
643 #if OSL_DEBUG_LEVEL > 2
644 fprintf(stderr, "in addLocalFunctions functionOffset is %x\n",functionOffset);
645 fprintf(stderr, "in addLocalFunctions vtableOffset is %x\n",vtableOffset);
646 #endif
648 for (sal_Int32 i = 0; i < type->nMembers; ++i) {
649 typelib_TypeDescription * member = 0;
650 TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
651 OSL_ASSERT(member != 0);
652 switch (member->eTypeClass) {
653 case typelib_TypeClass_INTERFACE_ATTRIBUTE:
654 // Getter:
655 (s++)->fn = code + writetoexecdiff;
656 code = codeSnippet(
657 code, functionOffset++, vtableOffset,
658 bridges::cpp_uno::shared::isSimpleType(
659 reinterpret_cast<
660 typelib_InterfaceAttributeTypeDescription * >(
661 member)->pAttributeTypeRef));
663 // Setter:
664 if (!reinterpret_cast<
665 typelib_InterfaceAttributeTypeDescription * >(
666 member)->bReadOnly)
668 (s++)->fn = code + writetoexecdiff;
669 code = codeSnippet(code, functionOffset++, vtableOffset, true);
671 break;
673 case typelib_TypeClass_INTERFACE_METHOD:
674 (s++)->fn = code + writetoexecdiff;
675 code = codeSnippet(
676 code, functionOffset++, vtableOffset,
677 bridges::cpp_uno::shared::isSimpleType(
678 reinterpret_cast<
679 typelib_InterfaceMethodTypeDescription * >(
680 member)->pReturnTypeRef));
681 break;
683 default:
684 OSL_ASSERT(false);
685 break;
687 TYPELIB_DANGER_RELEASE(member);
689 return code;
692 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */