/* -*- 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 .
*/
//I think it is impossible to get UNO to pass structs as parameters by copy if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
{ #if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "simple\n"); #endif
switch (pParamTypeDescr->eTypeClass)
{ case typelib_TypeClass_FLOAT: if (nf < ia64::MAX_SSE_REGS && ng < ia64::MAX_GPR_REGS)
{ float tmp = (float) (*((double *)fpreg));
(*((float *) fpreg)) = tmp;
pCppArgs[nPos] = pUnoArgs[nPos] = fpreg++;
nf++;
gpreg++;
ng++;
} else
{
pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
bOverflowUsed = true;
} if (bOverflowUsed) ovrflw++; break; case typelib_TypeClass_DOUBLE: if (nf < ia64::MAX_SSE_REGS && ng < ia64::MAX_GPR_REGS)
{
pCppArgs[nPos] = pUnoArgs[nPos] = fpreg++;
nf++;
gpreg++;
ng++;
} else
{
pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
bOverflowUsed = true;
} if (bOverflowUsed) ovrflw++; break; case typelib_TypeClass_BYTE: case typelib_TypeClass_BOOLEAN: case typelib_TypeClass_CHAR: case typelib_TypeClass_SHORT: case typelib_TypeClass_UNSIGNED_SHORT: case typelib_TypeClass_ENUM: case typelib_TypeClass_LONG: case typelib_TypeClass_UNSIGNED_LONG: default: if (ng < ia64::MAX_GPR_REGS)
{
pCppArgs[nPos] = pUnoArgs[nPos] = gpreg++;
ng++;
} else
{
pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw;
bOverflowUsed = true;
} if (bOverflowUsed) ovrflw++; break;
}
// no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
} else// ptr to complex value | ref
{ #if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "complex, ng is %d\n", ng); #endif void *pCppStack; //temporary stack pointer
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 ),
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] = pCppStack; // no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
}
}
#if OSL_DEBUG_LEVEL > 2
fprintf(stderr, "end of params\n"); #endif
// 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], 0 );
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];
extern"C" ia64::RegReturn cpp_vtable_call( long in0, long in1, long in2, long in3, long in4, long in5, long in6, long in7, long firstonstack
)
{ registerlong r15 asm("r15"); long r8 = r15;
registerlong r14 asm("r14"); long nOffsetAndIndex = r14;
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 und die Messung sind noch experimentell.