/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
if (pReturnTypeDescr)
{ if (!arm::return_in_hidden_param(pReturnTypeRef))
pUnoReturn = pRegisterReturn; // direct way for simple types else// complex return via ptr (pCppReturn)
{
pCppReturn = *reinterpret_cast<void **>(pCppStack);
pCppStack += sizeof(void *);
pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType(
pReturnTypeDescr )
? alloca( pReturnTypeDescr->nSize )
: pCppReturn); // direct way
}
} // pop this
pCppStack += sizeof( void* );
// stack space
static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!"); // parameters void ** pUnoArgs = static_cast<void **>(alloca( 4 * sizeof(void *) * nParams )); void ** pCppArgs = pUnoArgs + nParams; // indices of values this have to be converted (interface conversion // cpp<=>uno)
sal_Int32 * pTempIndices = reinterpret_cast<sal_Int32 *>(pUnoArgs + (2 * nParams)); // type descriptions for reconversions
typelib_TypeDescription ** ppTempParamTypeDescr = reinterpret_cast<typelib_TypeDescription **>(pUnoArgs + (3 * nParams));
if (!rParam.bOut &&
bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
{ #ifdef __ARM_EABI__ switch (pParamTypeDescr->eTypeClass)
{ case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: #ifndef __ARM_PCS_VFP case typelib_TypeClass_DOUBLE: #endif if ((pCppStack - pTopStack) % 8) pCppStack+=sizeof(sal_Int32); //align to 8 break; default: break;
} #endif
// For armhf we get the floating point arguments from a different area of the stack #ifdef __ARM_PCS_VFP if (pParamTypeDescr->eTypeClass == typelib_TypeClass_FLOAT)
{
pCppArgs[nPos] = pUnoArgs[nPos] = pFloatArgs;
pFloatArgs += sizeof(float);
} else if (pParamTypeDescr->eTypeClass == typelib_TypeClass_DOUBLE)
{ if ((pFloatArgs - pTopStack) % 8) pFloatArgs+=sizeof(float); //align to 8
pCppArgs[nPos] = pUnoArgs[nPos] = pFloatArgs;
pFloatArgs += sizeof(double); if (++dc == arm::MAX_FPR_REGS) { if (pCppStack - pTopStack < 16)
pCppStack = pTopStack + 16;
pFloatArgs = pCppStack;
}
} else #endif
pCppArgs[nPos] = pUnoArgs[nPos] = pCppStack;
switch (pParamTypeDescr->eTypeClass)
{ case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER: #ifndef __ARM_PCS_VFP case typelib_TypeClass_DOUBLE: #endif
pCppStack += sizeof(sal_Int32); // extra long break; default: break;
} // no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
} else// ptr to complex value | ref
{
pCppArgs[nPos] = *reinterpret_cast<void **>(pCppStack);
if (! rParam.bIn) // is pure out
{ // uno out is unconstructed mem!
pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
pTempIndices[nTempIndices] = nPos; // will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
} // is in/inout elseif (bridges::cpp_uno::shared::relatesToInterfaceType(
pParamTypeDescr ))
{
uno_copyAndConvertData( pUnoArgs[nPos] =
alloca( pParamTypeDescr->nSize ),
*reinterpret_cast<void **>(pCppStack), pParamTypeDescr,
pThis->getBridge()->getCpp2Uno() );
pTempIndices[nTempIndices] = nPos; // has to be reconverted // will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
} else// direct way
{
pUnoArgs[nPos] = *reinterpret_cast<void **>(pCppStack); // no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
} #ifdef __ARM_PCS_VFP // use the stack for output parameters or non floating point values if (rParam.bOut ||
((pParamTypeDescr->eTypeClass != typelib_TypeClass_DOUBLE)
&& (pParamTypeDescr->eTypeClass != typelib_TypeClass_FLOAT))
) #endif
pCppStack += sizeof(sal_Int32); // standard parameter length
}
// ExceptionHolder
uno_Any aUnoExc; // Any will be constructed by callee
uno_Any * pUnoExc = &aUnoExc;
// in case an exception occurred... if (pUnoExc)
{ // destruct temporary in/inout params for ( ; nTempIndices--; )
{
sal_Int32 nIndex = pTempIndices[nTempIndices];
if (pParams[nIndex].bIn) // is in/inout => was constructed
uno_destructData( pUnoArgs[nIndex],
ppTempParamTypeDescr[nTempIndices], nullptr );
TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
} if (pReturnTypeDescr)
TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
CPPU_CURRENT_NAMESPACE::raiseException( &aUnoExc,
pThis->getBridge()->getUno2Cpp() ); // has to destruct the any // is here for dummy return typelib_TypeClass_VOID;
} else// else no exception occurred...
{ // temporary params for ( ; nTempIndices--; )
{
sal_Int32 nIndex = pTempIndices[nTempIndices];
typelib_TypeDescription * pParamTypeDescr =
ppTempParamTypeDescr[nTempIndices];
switch( aType )
{ case typelib_TypeClass_BOOLEAN: case typelib_TypeClass_BYTE:
nRegReturn = static_cast<unsignedlong>(*reinterpret_cast<unsignedchar *>(&nRegReturn)); break; case typelib_TypeClass_CHAR: case typelib_TypeClass_UNSIGNED_SHORT: case typelib_TypeClass_SHORT:
nRegReturn = static_cast<unsignedlong>(*reinterpret_cast<unsignedshort *>(&nRegReturn)); break; case typelib_TypeClass_ENUM: case typelib_TypeClass_UNSIGNED_LONG: case typelib_TypeClass_LONG:
nRegReturn = static_cast<unsignedlong>(*reinterpret_cast<unsignedint *>(&nRegReturn)); break; case typelib_TypeClass_VOID: default: break;
}
namespace { // Some dummy type whose RTTI is used in the synthesized proxy vtables to make uses of dynamic_cast // on such proxy objects not crash: struct ProxyRtti {};
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.