uno2cpp.cxx (61dff127) uno2cpp.cxx (942d46e3)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 10 unchanged lines hidden (view full) ---

19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_bridges.hxx"
26
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 10 unchanged lines hidden (view full) ---

19 *
20 *************************************************************/
21
22
23
24// MARKER(update_precomp.py): autogen include statement, do not remove
25#include "precompiled_bridges.hxx"
26
27#include <exception>
28#include <typeinfo>
27#include <stdio.h>
28#include <stdlib.h>
29#include <string.h>
29#include <stdio.h>
30#include <stdlib.h>
31#include <string.h>
30#include <rtl/alloc.h>
31
32
33#include "rtl/alloc.h"
34#include "rtl/ustrbuf.hxx"
35
32#include <com/sun/star/uno/genfunc.hxx>
33#include "com/sun/star/uno/RuntimeException.hpp"
34#include <uno/data.h>
35
36#include <bridges/cpp_uno/shared/bridge.hxx>
37#include <bridges/cpp_uno/shared/types.hxx>
38#include "bridges/cpp_uno/shared/unointerfaceproxy.hxx"
39#include "bridges/cpp_uno/shared/vtables.hxx"

--- 188 unchanged lines hidden (view full) ---

228#define INSERT_INT8( pSV, nr, pGPR, pDS ) \
229 if ( nr < x86_64::MAX_GPR_REGS ) \
230 pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \
231 else \
232 *pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV );
233
234//==================================================================================================
235
36#include <com/sun/star/uno/genfunc.hxx>
37#include "com/sun/star/uno/RuntimeException.hpp"
38#include <uno/data.h>
39
40#include <bridges/cpp_uno/shared/bridge.hxx>
41#include <bridges/cpp_uno/shared/types.hxx>
42#include "bridges/cpp_uno/shared/unointerfaceproxy.hxx"
43#include "bridges/cpp_uno/shared/vtables.hxx"

--- 188 unchanged lines hidden (view full) ---

232#define INSERT_INT8( pSV, nr, pGPR, pDS ) \
233 if ( nr < x86_64::MAX_GPR_REGS ) \
234 pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \
235 else \
236 *pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV );
237
238//==================================================================================================
239
240namespace {
241
242void appendCString(OUStringBuffer & buffer, char const * text) {
243 if (text != 0) {
244 buffer.append(
245 OStringToOUString(OString(text), RTL_TEXTENCODING_ISO_8859_1));
246 // use 8859-1 to avoid conversion failure
247 }
248}
249
250}
251
236static void cpp_call(
237 bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
238 bridges::cpp_uno::shared::VtableSlot aVtableSlot,
239 typelib_TypeDescriptionReference * pReturnTypeRef,
240 sal_Int32 nParams, typelib_MethodParameter * pParams,
241 void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc )
242{
243 // Maxium space for [complex ret ptr], values | ptr ...

--- 116 unchanged lines hidden (view full) ---

360 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
361 }
362 INSERT_INT64( &(pCppArgs[nPos]), nGPR, pGPR, pStack );
363 }
364 }
365
366 try
367 {
252static void cpp_call(
253 bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
254 bridges::cpp_uno::shared::VtableSlot aVtableSlot,
255 typelib_TypeDescriptionReference * pReturnTypeRef,
256 sal_Int32 nParams, typelib_MethodParameter * pParams,
257 void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc )
258{
259 // Maxium space for [complex ret ptr], values | ptr ...

--- 116 unchanged lines hidden (view full) ---

376 TYPELIB_DANGER_RELEASE( pParamTypeDescr );
377 }
378 INSERT_INT64( &(pCppArgs[nPos]), nGPR, pGPR, pStack );
379 }
380 }
381
382 try
383 {
368 callVirtualMethod(
369 pAdjustedThisPtr, aVtableSlot.index,
370 pCppReturn, pReturnTypeRef, bSimpleReturn,
371 pStackStart, ( pStack - pStackStart ),
372 pGPR, nGPR,
373 pFPR, nFPR );
384 try {
385 callVirtualMethod(
386 pAdjustedThisPtr, aVtableSlot.index,
387 pCppReturn, pReturnTypeRef, bSimpleReturn,
388 pStackStart, ( pStack - pStackStart ),
389 pGPR, nGPR,
390 pFPR, nFPR );
391 } catch (Exception &) {
392 throw;
393 } catch (std::exception & e) {
394 OUStringBuffer buf;
395 buf.appendAscii(RTL_CONSTASCII_STRINGPARAM("C++ code threw "));
396 appendCString(buf, typeid(e).name());
397 buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(": "));
398 appendCString(buf, e.what());
399 throw RuntimeException(
400 buf.makeStringAndClear(), Reference< XInterface >());
401 } catch (...) {
402 throw RuntimeException(
403 OUString(
404 RTL_CONSTASCII_USTRINGPARAM(
405 "C++ code threw unknown exception")),
406 Reference< XInterface >());
407 }
408
374 // NO exception occured...
375 *ppUnoExc = 0;
376
377 // reconvert temporary params
378 for ( ; nTempIndizes--; )
379 {
380 sal_Int32 nIndex = pTempIndizes[nTempIndizes];
381 typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];

--- 186 unchanged lines hidden ---
409 // NO exception occured...
410 *ppUnoExc = 0;
411
412 // reconvert temporary params
413 for ( ; nTempIndizes--; )
414 {
415 sal_Int32 nIndex = pTempIndizes[nTempIndizes];
416 typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndizes];

--- 186 unchanged lines hidden ---