summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bridges/source/cpp_uno/gcc3_wasm/abi.cxx43
-rw-r--r--bridges/source/cpp_uno/gcc3_wasm/abi.hxx13
-rw-r--r--bridges/source/cpp_uno/gcc3_wasm/cpp2uno.cxx66
-rw-r--r--bridges/source/cpp_uno/gcc3_wasm/uno2cpp.cxx67
4 files changed, 71 insertions, 118 deletions
diff --git a/bridges/source/cpp_uno/gcc3_wasm/abi.cxx b/bridges/source/cpp_uno/gcc3_wasm/abi.cxx
index 49d7762ea3c2..c2a1e9059c9d 100644
--- a/bridges/source/cpp_uno/gcc3_wasm/abi.cxx
+++ b/bridges/source/cpp_uno/gcc3_wasm/abi.cxx
@@ -16,12 +16,55 @@
#include <com/sun/star/uno/RuntimeException.hpp>
#include <cppu/unotype.hxx>
#include <rtl/ustring.hxx>
+#include <typelib/typeclass.h>
#include <typelib/typedescription.h>
#include <uno/any2.h>
#include <uno/mapping.h>
#include "abi.hxx"
+abi_wasm::StructKind abi_wasm::getKind(typelib_CompoundTypeDescription const* type)
+{
+ if (type->nMembers > 1)
+ {
+ return StructKind::General;
+ }
+ auto k = StructKind::Empty;
+ if (type->pBaseTypeDescription != nullptr)
+ {
+ k = getKind(type->pBaseTypeDescription);
+ }
+ if (type->nMembers == 0)
+ {
+ return k;
+ }
+ if (k != StructKind::Empty)
+ {
+ return StructKind::General;
+ }
+ switch (type->ppTypeRefs[0]->eTypeClass)
+ {
+ case typelib_TypeClass_BOOLEAN:
+ case typelib_TypeClass_BYTE:
+ case typelib_TypeClass_SHORT:
+ case typelib_TypeClass_UNSIGNED_SHORT:
+ case typelib_TypeClass_LONG:
+ case typelib_TypeClass_UNSIGNED_LONG:
+ case typelib_TypeClass_CHAR:
+ case typelib_TypeClass_ENUM:
+ return StructKind::I32;
+ case typelib_TypeClass_HYPER:
+ case typelib_TypeClass_UNSIGNED_HYPER:
+ return StructKind::I64;
+ case typelib_TypeClass_FLOAT:
+ return StructKind::F32;
+ case typelib_TypeClass_DOUBLE:
+ return StructKind::F64;
+ default:
+ return StructKind::General;
+ }
+}
+
void abi_wasm::mapException(__cxxabiv1::__cxa_exception* exception, std::type_info const* type,
uno_Any* any, uno_Mapping* mapping)
{
diff --git a/bridges/source/cpp_uno/gcc3_wasm/abi.hxx b/bridges/source/cpp_uno/gcc3_wasm/abi.hxx
index b60f6383fd1a..bc3637a55968 100644
--- a/bridges/source/cpp_uno/gcc3_wasm/abi.hxx
+++ b/bridges/source/cpp_uno/gcc3_wasm/abi.hxx
@@ -18,6 +18,7 @@
#include <bridges/emscriptencxxabi/cxxabi.hxx>
#include <config_cxxabi.h>
+#include <typelib/typedescription.h>
#include <uno/any2.h>
#include <uno/mapping.h>
@@ -121,6 +122,18 @@ extern "C" __cxa_eh_globals* __cxa_get_globals();
namespace abi_wasm
{
+enum class StructKind
+{
+ Empty,
+ I32,
+ I64,
+ F32,
+ F64,
+ General
+};
+
+StructKind getKind(typelib_CompoundTypeDescription const* type);
+
void mapException(__cxxabiv1::__cxa_exception* exception, std::type_info const* type, uno_Any* any,
uno_Mapping* mapping);
}
diff --git a/bridges/source/cpp_uno/gcc3_wasm/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_wasm/cpp2uno.cxx
index 2877a706a67a..921e2f23b551 100644
--- a/bridges/source/cpp_uno/gcc3_wasm/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_wasm/cpp2uno.cxx
@@ -73,58 +73,6 @@ VtableFactory::Slot* VtableFactory::initializeBlock(void* block, sal_Int32 slotC
namespace
{
-enum class StructKind
-{
- Empty,
- I32,
- I64,
- F32,
- F64,
- General
-};
-
-StructKind getKind(typelib_CompoundTypeDescription const* type)
-{
- if (type->nMembers > 1)
- {
- return StructKind::General;
- }
- auto k = StructKind::Empty;
- if (type->pBaseTypeDescription != nullptr)
- {
- k = getKind(type->pBaseTypeDescription);
- }
- if (type->nMembers == 0)
- {
- return k;
- }
- if (k != StructKind::Empty)
- {
- return StructKind::General;
- }
- switch (type->ppTypeRefs[0]->eTypeClass)
- {
- case typelib_TypeClass_BOOLEAN:
- case typelib_TypeClass_BYTE:
- case typelib_TypeClass_SHORT:
- case typelib_TypeClass_UNSIGNED_SHORT:
- case typelib_TypeClass_LONG:
- case typelib_TypeClass_UNSIGNED_LONG:
- case typelib_TypeClass_CHAR:
- case typelib_TypeClass_ENUM:
- return StructKind::I32;
- case typelib_TypeClass_HYPER:
- case typelib_TypeClass_UNSIGNED_HYPER:
- return StructKind::I64;
- case typelib_TypeClass_FLOAT:
- return StructKind::F32;
- case typelib_TypeClass_DOUBLE:
- return StructKind::F64;
- default:
- return StructKind::General;
- }
-}
-
class Rtti
{
public:
@@ -499,24 +447,24 @@ unsigned char* VtableFactory::addLocalFunctions(Slot** slots, unsigned char* cod
case typelib_TypeClass_STRUCT:
{
css::uno::TypeDescription rtd(mtd->pReturnTypeRef);
- switch (getKind(
+ switch (abi_wasm::getKind(
reinterpret_cast<typelib_CompoundTypeDescription const*>(rtd.get())))
{
- case StructKind::Empty:
+ case abi_wasm::StructKind::Empty:
break;
- case StructKind::I32:
+ case abi_wasm::StructKind::I32:
sig.append('i');
break;
- case StructKind::I64:
+ case abi_wasm::StructKind::I64:
sig.append('j');
break;
- case StructKind::F32:
+ case abi_wasm::StructKind::F32:
sig.append('f');
break;
- case StructKind::F64:
+ case abi_wasm::StructKind::F64:
sig.append('d');
break;
- case StructKind::General:
+ case abi_wasm::StructKind::General:
sig.append('I');
break;
}
diff --git a/bridges/source/cpp_uno/gcc3_wasm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_wasm/uno2cpp.cxx
index 7f83e2312c35..f3467c497460 100644
--- a/bridges/source/cpp_uno/gcc3_wasm/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_wasm/uno2cpp.cxx
@@ -39,58 +39,6 @@
namespace
{
-enum class StructKind
-{
- Empty,
- I32,
- I64,
- F32,
- F64,
- General
-};
-
-StructKind getKind(typelib_CompoundTypeDescription const* type)
-{
- if (type->nMembers > 1)
- {
- return StructKind::General;
- }
- auto k = StructKind::Empty;
- if (type->pBaseTypeDescription != nullptr)
- {
- k = getKind(type->pBaseTypeDescription);
- }
- if (type->nMembers == 0)
- {
- return k;
- }
- if (k != StructKind::Empty)
- {
- return StructKind::General;
- }
- switch (type->ppTypeRefs[0]->eTypeClass)
- {
- case typelib_TypeClass_BOOLEAN:
- case typelib_TypeClass_BYTE:
- case typelib_TypeClass_SHORT:
- case typelib_TypeClass_UNSIGNED_SHORT:
- case typelib_TypeClass_LONG:
- case typelib_TypeClass_UNSIGNED_LONG:
- case typelib_TypeClass_CHAR:
- case typelib_TypeClass_ENUM:
- return StructKind::I32;
- case typelib_TypeClass_HYPER:
- case typelib_TypeClass_UNSIGNED_HYPER:
- return StructKind::I64;
- case typelib_TypeClass_FLOAT:
- return StructKind::F32;
- case typelib_TypeClass_DOUBLE:
- return StructKind::F64;
- default:
- return StructKind::General;
- }
-}
-
void call(bridges::cpp_uno::shared::UnoInterfaceProxy* proxy,
bridges::cpp_uno::shared::VtableSlot slot, typelib_TypeDescriptionReference* returnType,
sal_Int32 count, typelib_MethodParameter* parameters, void* returnValue, void** arguments,
@@ -136,23 +84,24 @@ void call(bridges::cpp_uno::shared::UnoInterfaceProxy* proxy,
break;
case typelib_TypeClass_STRUCT:
{
- switch (getKind(reinterpret_cast<typelib_CompoundTypeDescription const*>(rtd.get())))
+ switch (abi_wasm::getKind(
+ reinterpret_cast<typelib_CompoundTypeDescription const*>(rtd.get())))
{
- case StructKind::Empty:
+ case abi_wasm::StructKind::Empty:
break;
- case StructKind::I32:
+ case abi_wasm::StructKind::I32:
sig.append('i');
break;
- case StructKind::I64:
+ case abi_wasm::StructKind::I64:
sig.append('j');
break;
- case StructKind::F32:
+ case abi_wasm::StructKind::F32:
sig.append('f');
break;
- case StructKind::F64:
+ case abi_wasm::StructKind::F64:
sig.append('d');
break;
- case StructKind::General:
+ case abi_wasm::StructKind::General:
sig.append("vi");
args.push_back(reinterpret_cast<sal_uInt32>(ret));
break;