1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: share.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include "uno/mapping.h"
34 namespace CPPU_CURRENT_NAMESPACE
36 void dummy_can_throw_anything( char const * );
37 // ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
39 struct _Unwind_Exception
41 unsigned exception_class
__attribute__((__mode__(__DI__
)));
42 void * exception_cleanup
;
43 unsigned private_1
__attribute__((__mode__(__word__
)));
44 unsigned private_2
__attribute__((__mode__(__word__
)));
45 } __attribute__((__aligned__
));
47 struct __cxa_exception
49 ::std::type_info
*exceptionType
;
50 void (*exceptionDestructor
)(void *);
52 ::std::unexpected_handler unexpectedHandler
;
53 ::std::terminate_handler terminateHandler
;
55 __cxa_exception
*nextException
;
59 int handlerSwitchValue
;
60 const unsigned char *actionRecord
;
61 const unsigned char *languageSpecificData
;
65 _Unwind_Exception unwindHeader
;
68 extern "C" void *__cxa_allocate_exception(
69 std::size_t thrown_size
) throw();
70 extern "C" void __cxa_throw (
71 void *thrown_exception
, std::type_info
*tinfo
, void (*dest
) (void *) ) __attribute__((noreturn
));
73 struct __cxa_eh_globals
75 __cxa_exception
*caughtExceptions
;
76 unsigned int uncaughtExceptions
;
78 extern "C" __cxa_eh_globals
*__cxa_get_globals () throw();
80 //==================================================================================================
82 uno_Any
* pUnoExc
, uno_Mapping
* pUno2Cpp
);
83 //==================================================================================================
84 void fillUnoException(
85 __cxa_exception
* header
, uno_Any
*, uno_Mapping
* pCpp2Uno
);
87 inline char* adjustPointer( char* pIn
, typelib_TypeDescription
* pType
)
89 switch( pType
->nSize
)
91 case 1: return pIn
+ 3;
92 case 2: return pIn
+ 2;
93 case 3: return pIn
+ 1;
94 // Huh ? perhaps a char[3] ? Though that would be a pointer
95 // well, we have it anyway for symmetry