/* -*- 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 .
*/
void MapReturn(sal_uInt64 *pGPR, double *pFPR, typelib_TypeDescriptionReference *pReturnType, sal_uInt64 *pRegisterReturn)
{ switch( pReturnType->eTypeClass )
{ case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER:
pRegisterReturn[1] = pGPR[1];
[[fallthrough]]; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: case typelib_TypeClass_ENUM: case typelib_TypeClass_CHAR: case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: case typelib_TypeClass_BOOLEAN: case typelib_TypeClass_BYTE:
pRegisterReturn[0] = pGPR[0]; break; case typelib_TypeClass_FLOAT:
*(float*)pRegisterReturn = *(float*)&pFPR[0]; break; case typelib_TypeClass_DOUBLE:
*(double*)pRegisterReturn = pFPR[0]; break; case typelib_TypeClass_STRUCT: case typelib_TypeClass_EXCEPTION: if (!arm::return_in_x8(pReturnType))
{
pRegisterReturn[0] = pGPR[0];
pRegisterReturn[1] = pGPR[1];
} break; default: break;
}
}
namespace
{ void callVirtualMethod( void *pThis,
sal_Int32 nVtableIndex, void *pRegisterReturn,
typelib_TypeDescriptionReference *pReturnType,
sal_uInt64 *pStack, int nStack,
sal_uInt64 *pGPR, double *pFPR)
{ // never called if (! pThis)
CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
switch (pParamTypeDescr->eTypeClass)
{ case typelib_TypeClass_HYPER: case typelib_TypeClass_UNSIGNED_HYPER:
INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack ); break; case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: case typelib_TypeClass_ENUM:
INSERT_INT32( pCppArgs[nPos], nGPR, pGPR, pStack ); break; case typelib_TypeClass_SHORT: case typelib_TypeClass_CHAR: case typelib_TypeClass_UNSIGNED_SHORT:
INSERT_INT16( pCppArgs[nPos], nGPR, pGPR, pStack ); break; case typelib_TypeClass_BOOLEAN: case typelib_TypeClass_BYTE:
INSERT_INT8( pCppArgs[nPos], nGPR, pGPR, pStack ); break; case typelib_TypeClass_FLOAT:
INSERT_FLOAT( pCppArgs[nPos], nFPR, pFPR, pStack ); break; case typelib_TypeClass_DOUBLE:
INSERT_DOUBLE( pCppArgs[nPos], nFPR, pFPR, pStack ); break; default: break;
} // no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
} else// ptr to complex value | ref
{ if (! rParam.bIn) // is pure out
{ // cpp out is constructed mem, uno out is not!
uno_constructData(
pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
pParamTypeDescr );
pTempIndices[nTempIndices] = nPos; // default constructed for cpp call // will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
} // is in/inout elseif (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
{
uno_copyAndConvertData(
pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
pTempIndices[nTempIndices] = nPos; // has to be reconverted // will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
} else// direct way
{
pCppArgs[nPos] = pUnoArgs[nPos]; // no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
INSERT_INT64( &(pCppArgs[nPos]), nGPR, pGPR, pStack );
}
}
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 und die Messung sind noch experimentell.