summaryrefslogtreecommitdiff
path: root/offapi/org
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-05-08 09:46:55 +0200
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-05-08 13:01:04 +0200
commita469aea9c0b532d928cd41e389c9c51de1af06f0 (patch)
tree8a2f5ff87b20d601372c52d65db86b82b540e08a /offapi/org
parent90f19126fa405a0632eae4ee8525b66bbce12625 (diff)
Emscripten: Towards a working C++ UNO bridge
...by making the general UNO -> C++ function call case work (modulo handling exceptions, which I'll look into later). Wasm call_indirect unfortunately needs to statically know the call target's signature, so we statically need to know all possible signatures. So introduce wasmcallgen helper to scan the existing UNOIDL API upfront and generate the relevant callvirtualfunction-wrapper.cxx and callvirtualfunction-inst.s code. (The good thing is that the number of different signatures is somewhat limited, each parameter can only be one of i32, i64, f32, or f64. So even if 3rd-party extensions bring along new UNOIDL interface methods, chances are relatively high that the signatures needed for them would already be covered by the existing ones.) Testing this can nicely be done in unotest/source/embindtest/embindtest.js via css.script.Invocation (which internally exercises the relevant code). (Instead of adding individual org.libreoffice.embindtest.StructLong/String etc., it would be nicer to introduce some polymorphic StructOne<T>, but the Emind UNO binding does not support polymorphic structs, so the embindtest.js code would not work.) Change-Id: If829c9e3772bfd27561f3ad743d38a71d11545b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167308 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'offapi/org')
-rw-r--r--offapi/org/libreoffice/embindtest/StructLong.idl18
-rw-r--r--offapi/org/libreoffice/embindtest/StructString.idl18
-rw-r--r--offapi/org/libreoffice/embindtest/XTest.idl4
3 files changed, 40 insertions, 0 deletions
diff --git a/offapi/org/libreoffice/embindtest/StructLong.idl b/offapi/org/libreoffice/embindtest/StructLong.idl
new file mode 100644
index 000000000000..22447486b3f3
--- /dev/null
+++ b/offapi/org/libreoffice/embindtest/StructLong.idl
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+module org { module libreoffice { module embindtest {
+
+struct StructLong {
+ long m;
+};
+
+}; }; };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/offapi/org/libreoffice/embindtest/StructString.idl b/offapi/org/libreoffice/embindtest/StructString.idl
new file mode 100644
index 000000000000..e0c1464cfc84
--- /dev/null
+++ b/offapi/org/libreoffice/embindtest/StructString.idl
@@ -0,0 +1,18 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * 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/.
+ */
+
+module org { module libreoffice { module embindtest {
+
+struct StructString {
+ string m;
+};
+
+}; }; };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/offapi/org/libreoffice/embindtest/XTest.idl b/offapi/org/libreoffice/embindtest/XTest.idl
index b84753ebb8c6..ac8549d05397 100644
--- a/offapi/org/libreoffice/embindtest/XTest.idl
+++ b/offapi/org/libreoffice/embindtest/XTest.idl
@@ -40,6 +40,10 @@ interface XTest {
boolean isEnum([in] Enum value);
Struct getStruct();
boolean isStruct([in] Struct value);
+ StructLong getStructLong();
+ boolean isStructLong([in] StructLong value);
+ StructString getStructString();
+ boolean isStructString([in] StructString value);
any getAnyVoid();
boolean isAnyVoid([in] any value);
any getAnyBoolean();