1*61dff127SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*61dff127SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*61dff127SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*61dff127SAndrew Rist * distributed with this work for additional information
6*61dff127SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*61dff127SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*61dff127SAndrew Rist * "License"); you may not use this file except in compliance
9*61dff127SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*61dff127SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*61dff127SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*61dff127SAndrew Rist * software distributed under the License is distributed on an
15*61dff127SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*61dff127SAndrew Rist * KIND, either express or implied. See the License for the
17*61dff127SAndrew Rist * specific language governing permissions and limitations
18*61dff127SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*61dff127SAndrew Rist *************************************************************/
21*61dff127SAndrew Rist
22*61dff127SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_bridges.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <sal/alloca.h>
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include <com/sun/star/uno/genfunc.hxx>
30cdf0e10cSrcweir #include "com/sun/star/uno/RuntimeException.hpp"
31cdf0e10cSrcweir #include <uno/data.h>
32cdf0e10cSrcweir
33cdf0e10cSrcweir #include "bridges/cpp_uno/shared/bridge.hxx"
34cdf0e10cSrcweir #include "bridges/cpp_uno/shared/types.hxx"
35cdf0e10cSrcweir #include "bridges/cpp_uno/shared/unointerfaceproxy.hxx"
36cdf0e10cSrcweir #include "bridges/cpp_uno/shared/vtables.hxx"
37cdf0e10cSrcweir
38cdf0e10cSrcweir #include "cc50_solaris_intel.hxx"
39cdf0e10cSrcweir
40cdf0e10cSrcweir using namespace rtl;
41cdf0e10cSrcweir using namespace com::sun::star::uno;
42cdf0e10cSrcweir
43cdf0e10cSrcweir namespace
44cdf0e10cSrcweir {
45cdf0e10cSrcweir
46cdf0e10cSrcweir extern "C" {
47cdf0e10cSrcweir void callVirtualMethod(
48cdf0e10cSrcweir void * pAdjustedThisPtr,
49cdf0e10cSrcweir sal_Int32 nVtableIndex,
50cdf0e10cSrcweir void * pRegisterReturn,
51cdf0e10cSrcweir typelib_TypeClass eReturnType,
52cdf0e10cSrcweir sal_Int32 * pStackLongs,
53cdf0e10cSrcweir sal_Int32 nStackLongs
54cdf0e10cSrcweir );
55cdf0e10cSrcweir }
56cdf0e10cSrcweir
57cdf0e10cSrcweir //==================================================================================================
cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,bridges::cpp_uno::shared::VtableSlot aVtableSlot,typelib_TypeDescriptionReference * pReturnTypeRef,sal_Int32 nParams,typelib_MethodParameter * pParams,void * pUnoReturn,void * pUnoArgs[],uno_Any ** ppUnoExc)58cdf0e10cSrcweir static inline void cpp_call(
59cdf0e10cSrcweir bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
60cdf0e10cSrcweir bridges::cpp_uno::shared::VtableSlot aVtableSlot,
61cdf0e10cSrcweir typelib_TypeDescriptionReference * pReturnTypeRef,
62cdf0e10cSrcweir sal_Int32 nParams, typelib_MethodParameter * pParams,
63cdf0e10cSrcweir void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc )
64cdf0e10cSrcweir {
65cdf0e10cSrcweir // max space for: [complex ret ptr], values|ptr ...
66cdf0e10cSrcweir char * pCppStack = (char *)alloca( ((nParams+3) * sizeof(sal_Int64)) );
67cdf0e10cSrcweir char * pCppStackStart = pCppStack;
68cdf0e10cSrcweir
69cdf0e10cSrcweir // return
70cdf0e10cSrcweir typelib_TypeDescription * pReturnTypeDescr = 0;
71cdf0e10cSrcweir TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
72cdf0e10cSrcweir OSL_ENSURE( pReturnTypeDescr, "### expected return type description!" );
73cdf0e10cSrcweir
74cdf0e10cSrcweir void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion
75cdf0e10cSrcweir
76cdf0e10cSrcweir void * pReturnSpace = 0;
77cdf0e10cSrcweir
78cdf0e10cSrcweir if (pReturnTypeDescr)
79cdf0e10cSrcweir {
80cdf0e10cSrcweir if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
81cdf0e10cSrcweir {
82cdf0e10cSrcweir pCppReturn = pUnoReturn; // direct way for simple types
83cdf0e10cSrcweir }
84cdf0e10cSrcweir else
85cdf0e10cSrcweir {
86cdf0e10cSrcweir // complex return via ptr
87cdf0e10cSrcweir pCppReturn = *(void **)pCppStack
88cdf0e10cSrcweir = (bridges::cpp_uno::shared::relatesToInterfaceType(
89cdf0e10cSrcweir pReturnTypeDescr )
90cdf0e10cSrcweir ? alloca( pReturnTypeDescr->nSize )
91cdf0e10cSrcweir : pUnoReturn); // direct way
92cdf0e10cSrcweir pCppStack += sizeof(void *);
93cdf0e10cSrcweir }
94cdf0e10cSrcweir }
95cdf0e10cSrcweir // push this
96cdf0e10cSrcweir void * pAdjustedThisPtr = reinterpret_cast< void ** >(pThis->getCppI())
97cdf0e10cSrcweir + aVtableSlot.offset;
98cdf0e10cSrcweir *(void**)pCppStack = pAdjustedThisPtr;
99cdf0e10cSrcweir pCppStack += sizeof( void* );
100cdf0e10cSrcweir
101cdf0e10cSrcweir const int nMaxParams = 32;
102cdf0e10cSrcweir // args
103cdf0e10cSrcweir void * args_buffer[3 * nMaxParams];
104cdf0e10cSrcweir void ** pCppArgs = (void **)(nParams > nMaxParams ? rtl_allocateMemory( 3 * sizeof(void *) * nParams ) : args_buffer);
105cdf0e10cSrcweir // indizes of values this have to be converted (interface conversion cpp<=>uno)
106cdf0e10cSrcweir sal_Int32 * pTempIndizes = (sal_Int32 *)(pCppArgs + nParams);
107cdf0e10cSrcweir // type descriptions for reconversions
108cdf0e10cSrcweir typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
109cdf0e10cSrcweir
110cdf0e10cSrcweir sal_Int32 nTempIndizes = 0;
111cdf0e10cSrcweir
112cdf0e10cSrcweir const int nTempBufferSize = 256;
113cdf0e10cSrcweir sal_Int32 nTempBufferPos = 0;
114cdf0e10cSrcweir long params_buffer[nTempBufferSize];
115cdf0e10cSrcweir
116cdf0e10cSrcweir for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
117cdf0e10cSrcweir {
118cdf0e10cSrcweir const typelib_MethodParameter & rParam = pParams[nPos];
119cdf0e10cSrcweir typelib_TypeDescription * pParamTypeDescr = 0;
120cdf0e10cSrcweir TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
121cdf0e10cSrcweir
122cdf0e10cSrcweir if (!rParam.bOut
123cdf0e10cSrcweir && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
124cdf0e10cSrcweir {
125cdf0e10cSrcweir pCppArgs[ nPos ] = pCppStack;
126cdf0e10cSrcweir uno_copyAndConvertData( pCppArgs[nPos], pUnoArgs[nPos], pParamTypeDescr,
127cdf0e10cSrcweir pThis->getBridge()->getUno2Cpp() );
128cdf0e10cSrcweir
129cdf0e10cSrcweir switch (pParamTypeDescr->eTypeClass)
130cdf0e10cSrcweir {
131cdf0e10cSrcweir case typelib_TypeClass_HYPER:
132cdf0e10cSrcweir case typelib_TypeClass_UNSIGNED_HYPER:
133cdf0e10cSrcweir case typelib_TypeClass_DOUBLE:
134cdf0e10cSrcweir pCppStack += sizeof(sal_Int32); // extra long
135cdf0e10cSrcweir }
136cdf0e10cSrcweir // no longer needed
137cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pParamTypeDescr );
138cdf0e10cSrcweir }
139cdf0e10cSrcweir else // ptr to complex value | ref
140cdf0e10cSrcweir {
141cdf0e10cSrcweir if (! rParam.bIn) // is pure out
142cdf0e10cSrcweir {
143cdf0e10cSrcweir // cpp out is constructed mem, uno out is not!
144cdf0e10cSrcweir if (pParamTypeDescr->nSize > (sizeof(long) * (nTempBufferSize - nTempBufferPos)))
145cdf0e10cSrcweir {
146cdf0e10cSrcweir uno_constructData(
147cdf0e10cSrcweir *(void **)pCppStack = pCppArgs[nPos] = rtl_allocateMemory( pParamTypeDescr->nSize ),
148cdf0e10cSrcweir pParamTypeDescr );
149cdf0e10cSrcweir pTempIndizes[nTempIndizes] = nPos | 0x80000000; // default constructed for cpp call
150cdf0e10cSrcweir }
151cdf0e10cSrcweir else
152cdf0e10cSrcweir {
153cdf0e10cSrcweir uno_constructData(
154cdf0e10cSrcweir *(void **)pCppStack = pCppArgs[nPos] = (params_buffer + nTempBufferPos),
155cdf0e10cSrcweir pParamTypeDescr );
156cdf0e10cSrcweir pTempIndizes[nTempIndizes] = nPos; // default constructed for cpp call
157cdf0e10cSrcweir nTempBufferPos += (pParamTypeDescr->nSize / sizeof(long)) +1;
158cdf0e10cSrcweir }
159cdf0e10cSrcweir // will be released at reconversion
160cdf0e10cSrcweir ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
161cdf0e10cSrcweir }
162cdf0e10cSrcweir // is in/inout
163cdf0e10cSrcweir else if (bridges::cpp_uno::shared::relatesToInterfaceType(
164cdf0e10cSrcweir pParamTypeDescr ))
165cdf0e10cSrcweir {
166cdf0e10cSrcweir if (pParamTypeDescr->nSize > (sizeof(long)*(nTempBufferSize - nTempBufferPos)))
167cdf0e10cSrcweir {
168cdf0e10cSrcweir uno_copyAndConvertData(
169cdf0e10cSrcweir *(void **)pCppStack = pCppArgs[nPos] = rtl_allocateMemory( pParamTypeDescr->nSize ),
170cdf0e10cSrcweir pUnoArgs[nPos], pParamTypeDescr,
171cdf0e10cSrcweir pThis->getBridge()->getUno2Cpp() );
172cdf0e10cSrcweir pTempIndizes[nTempIndizes] = nPos | 0x80000000; // has to be reconverted
173cdf0e10cSrcweir }
174cdf0e10cSrcweir else
175cdf0e10cSrcweir {
176cdf0e10cSrcweir uno_copyAndConvertData(
177cdf0e10cSrcweir *(void **)pCppStack = pCppArgs[nPos] = (params_buffer + nTempBufferPos),
178cdf0e10cSrcweir pUnoArgs[nPos], pParamTypeDescr,
179cdf0e10cSrcweir pThis->getBridge()->getUno2Cpp() );
180cdf0e10cSrcweir pTempIndizes[nTempIndizes] = nPos; // has to be reconverted
181cdf0e10cSrcweir nTempBufferPos += (pParamTypeDescr->nSize / sizeof(long)) +1;
182cdf0e10cSrcweir }
183cdf0e10cSrcweir // will be released at reconversion
184cdf0e10cSrcweir ppTempParamTypeDescr[nTempIndizes++] = pParamTypeDescr;
185cdf0e10cSrcweir }
186cdf0e10cSrcweir else // direct way
187cdf0e10cSrcweir {
188cdf0e10cSrcweir *(void **)pCppStack = pCppArgs[nPos] = pUnoArgs[nPos];
189cdf0e10cSrcweir // no longer needed
190cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pParamTypeDescr );
191cdf0e10cSrcweir }
192cdf0e10cSrcweir }
193cdf0e10cSrcweir pCppStack += sizeof(sal_Int32); // standard parameter length
194cdf0e10cSrcweir }
195cdf0e10cSrcweir
196cdf0e10cSrcweir try
197cdf0e10cSrcweir {
198cdf0e10cSrcweir int nStackLongs = (pCppStack - pCppStackStart)/sizeof(sal_Int32);
199cdf0e10cSrcweir if( nStackLongs & 1 )
200cdf0e10cSrcweir // stack has to be 8 byte aligned
201cdf0e10cSrcweir nStackLongs++;
202cdf0e10cSrcweir
203cdf0e10cSrcweir callVirtualMethod(
204cdf0e10cSrcweir pAdjustedThisPtr, aVtableSlot.index,
205cdf0e10cSrcweir pCppReturn,
206cdf0e10cSrcweir pReturnTypeDescr->eTypeClass,
207cdf0e10cSrcweir (sal_Int32 *)pCppStackStart,
208cdf0e10cSrcweir nStackLongs
209cdf0e10cSrcweir );
210cdf0e10cSrcweir
211cdf0e10cSrcweir // NO exception occured...
212cdf0e10cSrcweir *ppUnoExc = 0;
213cdf0e10cSrcweir
214cdf0e10cSrcweir // reconvert temporary params
215cdf0e10cSrcweir for ( ; nTempIndizes--; )
216cdf0e10cSrcweir {
217cdf0e10cSrcweir sal_Int32 nIndex = pTempIndizes[nTempIndizes];
218cdf0e10cSrcweir sal_Bool bAllocated = (nIndex & 0x80000000) != 0;
219cdf0e10cSrcweir nIndex &= 0x7fffffff;
220cdf0e10cSrcweir typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];
221cdf0e10cSrcweir
222cdf0e10cSrcweir if (pParams[nIndex].bIn)
223cdf0e10cSrcweir {
224cdf0e10cSrcweir if (pParams[nIndex].bOut) // inout
225cdf0e10cSrcweir {
226cdf0e10cSrcweir uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value
227cdf0e10cSrcweir uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
228cdf0e10cSrcweir pThis->getBridge()->getCpp2Uno() );
229cdf0e10cSrcweir }
230cdf0e10cSrcweir }
231cdf0e10cSrcweir else // pure out
232cdf0e10cSrcweir {
233cdf0e10cSrcweir uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
234cdf0e10cSrcweir pThis->getBridge()->getCpp2Uno() );
235cdf0e10cSrcweir }
236cdf0e10cSrcweir // destroy temp cpp param => cpp: every param was constructed
237cdf0e10cSrcweir uno_destructData(
238cdf0e10cSrcweir pCppArgs[nIndex], pParamTypeDescr,
239cdf0e10cSrcweir reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
240cdf0e10cSrcweir
241cdf0e10cSrcweir if (bAllocated)
242cdf0e10cSrcweir rtl_freeMemory( pCppArgs[nIndex] );
243cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pParamTypeDescr );
244cdf0e10cSrcweir }
245cdf0e10cSrcweir // return value
246cdf0e10cSrcweir if (pCppReturn && pUnoReturn != pCppReturn)
247cdf0e10cSrcweir {
248cdf0e10cSrcweir uno_copyAndConvertData( pUnoReturn, pCppReturn, pReturnTypeDescr,
249cdf0e10cSrcweir pThis->getBridge()->getCpp2Uno() );
250cdf0e10cSrcweir uno_destructData(
251cdf0e10cSrcweir pCppReturn, pReturnTypeDescr,
252cdf0e10cSrcweir reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
253cdf0e10cSrcweir }
254cdf0e10cSrcweir }
255cdf0e10cSrcweir catch( ... )
256cdf0e10cSrcweir {
257cdf0e10cSrcweir void* pExc = __Crun::ex_get();
258cdf0e10cSrcweir const char* pName = __Cimpl::ex_name();
259cdf0e10cSrcweir
260cdf0e10cSrcweir // get exception
261cdf0e10cSrcweir CPPU_CURRENT_NAMESPACE::cc50_solaris_intel_fillUnoException(
262cdf0e10cSrcweir pExc, pName, *ppUnoExc,
263cdf0e10cSrcweir pThis->getBridge()->getCpp2Uno());
264cdf0e10cSrcweir
265cdf0e10cSrcweir // temporary params
266cdf0e10cSrcweir for ( ; nTempIndizes--; )
267cdf0e10cSrcweir {
268cdf0e10cSrcweir sal_Int32 nIndex = pTempIndizes[nTempIndizes];
269cdf0e10cSrcweir sal_Bool bAllocated = (nIndex & 0x80000000) != 0;
270cdf0e10cSrcweir nIndex &= 0x7fffffff;
271cdf0e10cSrcweir // destroy temp cpp param => cpp: every param was constructed
272cdf0e10cSrcweir uno_destructData(
273cdf0e10cSrcweir pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndizes],
274cdf0e10cSrcweir reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
275cdf0e10cSrcweir if (bAllocated)
276cdf0e10cSrcweir rtl_freeMemory( pCppArgs[nIndex] );
277cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndizes] );
278cdf0e10cSrcweir }
279cdf0e10cSrcweir // return type
280cdf0e10cSrcweir if (pReturnTypeDescr)
281cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
282cdf0e10cSrcweir }
283cdf0e10cSrcweir
284cdf0e10cSrcweir if (pCppArgs != (void **)args_buffer)
285cdf0e10cSrcweir rtl_freeMemory( pCppArgs );
286cdf0e10cSrcweir if (pReturnSpace)
287cdf0e10cSrcweir rtl_freeMemory( pReturnSpace );
288cdf0e10cSrcweir }
289cdf0e10cSrcweir
290cdf0e10cSrcweir }
291cdf0e10cSrcweir
292cdf0e10cSrcweir namespace bridges { namespace cpp_uno { namespace shared {
293cdf0e10cSrcweir
unoInterfaceProxyDispatch(uno_Interface * pUnoI,const typelib_TypeDescription * pMemberDescr,void * pReturn,void * pArgs[],uno_Any ** ppException)294cdf0e10cSrcweir void unoInterfaceProxyDispatch(
295cdf0e10cSrcweir uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
296cdf0e10cSrcweir void * pReturn, void * pArgs[], uno_Any ** ppException )
297cdf0e10cSrcweir {
298cdf0e10cSrcweir // is my surrogate
299cdf0e10cSrcweir bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
300cdf0e10cSrcweir = static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * >(pUnoI);
301cdf0e10cSrcweir typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr;
302cdf0e10cSrcweir
303cdf0e10cSrcweir switch (pMemberDescr->eTypeClass)
304cdf0e10cSrcweir {
305cdf0e10cSrcweir case typelib_TypeClass_INTERFACE_ATTRIBUTE:
306cdf0e10cSrcweir {
307cdf0e10cSrcweir VtableSlot aVtableSlot(
308cdf0e10cSrcweir getVtableSlot(
309cdf0e10cSrcweir reinterpret_cast<
310cdf0e10cSrcweir typelib_InterfaceAttributeTypeDescription const * >(
311cdf0e10cSrcweir pMemberDescr)));
312cdf0e10cSrcweir if (pReturn)
313cdf0e10cSrcweir {
314cdf0e10cSrcweir // dependent dispatch
315cdf0e10cSrcweir cpp_call(
316cdf0e10cSrcweir pThis, aVtableSlot,
317cdf0e10cSrcweir ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
318cdf0e10cSrcweir 0, 0, // no params
319cdf0e10cSrcweir pReturn, pArgs, ppException );
320cdf0e10cSrcweir }
321cdf0e10cSrcweir else
322cdf0e10cSrcweir {
323cdf0e10cSrcweir // is SET
324cdf0e10cSrcweir typelib_MethodParameter aParam;
325cdf0e10cSrcweir aParam.pTypeRef =
326cdf0e10cSrcweir ((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef;
327cdf0e10cSrcweir aParam.bIn = sal_True;
328cdf0e10cSrcweir aParam.bOut = sal_False;
329cdf0e10cSrcweir
330cdf0e10cSrcweir typelib_TypeDescriptionReference * pReturnTypeRef = 0;
331cdf0e10cSrcweir OUString aVoidName( RTL_CONSTASCII_USTRINGPARAM("void") );
332cdf0e10cSrcweir typelib_typedescriptionreference_new(
333cdf0e10cSrcweir &pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
334cdf0e10cSrcweir
335cdf0e10cSrcweir // dependent dispatch
336cdf0e10cSrcweir aVtableSlot.index += 1; // get, then set method
337cdf0e10cSrcweir cpp_call(
338cdf0e10cSrcweir pThis, aVtableSlot,
339cdf0e10cSrcweir pReturnTypeRef,
340cdf0e10cSrcweir 1, &aParam,
341cdf0e10cSrcweir pReturn, pArgs, ppException );
342cdf0e10cSrcweir
343cdf0e10cSrcweir typelib_typedescriptionreference_release( pReturnTypeRef );
344cdf0e10cSrcweir }
345cdf0e10cSrcweir
346cdf0e10cSrcweir break;
347cdf0e10cSrcweir }
348cdf0e10cSrcweir case typelib_TypeClass_INTERFACE_METHOD:
349cdf0e10cSrcweir {
350cdf0e10cSrcweir VtableSlot aVtableSlot(
351cdf0e10cSrcweir getVtableSlot(
352cdf0e10cSrcweir reinterpret_cast<
353cdf0e10cSrcweir typelib_InterfaceMethodTypeDescription const * >(
354cdf0e10cSrcweir pMemberDescr)));
355cdf0e10cSrcweir switch (aVtableSlot.index)
356cdf0e10cSrcweir {
357cdf0e10cSrcweir // standard calls
358cdf0e10cSrcweir case 1: // acquire uno interface
359cdf0e10cSrcweir (*pUnoI->acquire)( pUnoI );
360cdf0e10cSrcweir *ppException = 0;
361cdf0e10cSrcweir break;
362cdf0e10cSrcweir case 2: // release uno interface
363cdf0e10cSrcweir (*pUnoI->release)( pUnoI );
364cdf0e10cSrcweir *ppException = 0;
365cdf0e10cSrcweir break;
366cdf0e10cSrcweir case 0: // queryInterface() opt
367cdf0e10cSrcweir {
368cdf0e10cSrcweir typelib_TypeDescription * pTD = 0;
369cdf0e10cSrcweir TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() );
370cdf0e10cSrcweir if (pTD)
371cdf0e10cSrcweir {
372cdf0e10cSrcweir uno_Interface * pInterface = 0;
373cdf0e10cSrcweir (*pThis->pBridge->getUnoEnv()->getRegisteredInterface)(
374cdf0e10cSrcweir pThis->pBridge->getUnoEnv(),
375cdf0e10cSrcweir (void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD );
376cdf0e10cSrcweir
377cdf0e10cSrcweir if (pInterface)
378cdf0e10cSrcweir {
379cdf0e10cSrcweir ::uno_any_construct(
380cdf0e10cSrcweir reinterpret_cast< uno_Any * >( pReturn ),
381cdf0e10cSrcweir &pInterface, pTD, 0 );
382cdf0e10cSrcweir (*pInterface->release)( pInterface );
383cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pTD );
384cdf0e10cSrcweir *ppException = 0;
385cdf0e10cSrcweir break;
386cdf0e10cSrcweir }
387cdf0e10cSrcweir TYPELIB_DANGER_RELEASE( pTD );
388cdf0e10cSrcweir }
389cdf0e10cSrcweir } // else perform queryInterface()
390cdf0e10cSrcweir default:
391cdf0e10cSrcweir // dependent dispatch
392cdf0e10cSrcweir cpp_call(
393cdf0e10cSrcweir pThis, aVtableSlot,
394cdf0e10cSrcweir ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
395cdf0e10cSrcweir ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
396cdf0e10cSrcweir ((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
397cdf0e10cSrcweir pReturn, pArgs, ppException );
398cdf0e10cSrcweir }
399cdf0e10cSrcweir break;
400cdf0e10cSrcweir }
401cdf0e10cSrcweir default:
402cdf0e10cSrcweir {
403cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException aExc(
404cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM("illegal member type description!") ),
405cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
406cdf0e10cSrcweir
407cdf0e10cSrcweir Type const & rExcType = ::getCppuType( &aExc );
408cdf0e10cSrcweir // binary identical null reference
409cdf0e10cSrcweir ::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
410cdf0e10cSrcweir }
411cdf0e10cSrcweir }
412cdf0e10cSrcweir }
413cdf0e10cSrcweir
414cdf0e10cSrcweir } } }
415