Commit Graph
92 Commits
Author SHA1 Message Date
Stephan Bergmann e68a159419 Fix cd static && make for emscripten build
...which failed with

> error: instdir/program/types/offapi.rdb does not exist

Change-Id: Ie9932960f6e0f6d76070dcdaef792764ac55f51b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165048
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-20 13:01:20 +01:00
Stephan Bergmann 2995a0e078 Embind construction of UNO Any sequence/struct/exception/interface
Change-Id: I43d924126f4d34e0efbcea61dd5f4bd9be235426
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164650
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-11 13:36:24 +01:00
Stephan Bergmann c35985a4b4 Embind construction of UNO Any enum
Change-Id: I1b2167e261f1020b228f8ca2618c7f0009ca1d3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164646
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-11 13:36:11 +01:00
Stephan Bergmann 20f1f529a2 Embind construction of UNO Any Type
Change-Id: Iac5ac8de7bfb19b90d54edc6f4b791d8c0e98977
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164594
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-08 22:45:26 +01:00
Stephan Bergmann 80bb8c666f Redesign Embind UNO Any construction
...taking a full UNO Type instead of just a UNO Type class (so that it will be
able to construct Any containing sequence, enum, struct, exception, and
interface, in later steps); moving the Type argument first (as that looks more
natural), and renaming from Any to uno_Any (in line with the other uno_Type,
uno_Sequence_..., etc.)

Change-Id: I154681c4b9187f5f5d037d503652fe7bcd41adcd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164593
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-08 22:45:11 +01:00
Stephan Bergmann ad7963f939 Directly go via std::u16string
Change-Id: I99d3322afc7876c37a7ace016c1c6af691f28406
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164591
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-08 22:44:50 +01:00
Stephan Bergmann 747cfc7a02 Improve Embind'ing of UNO Type
Change-Id: Id93d7f48dedb362206828b5e3bd946525f95ea77
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164590
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-08 22:44:37 +01:00
Stephan Bergmann da49e5edb2 Add Embind'ing of UNO Any getter for interfaces
Change-Id: Ia56439e0e99c193c7cc56676677df2c671278e24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164554
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-07 23:13:31 +01:00
Stephan Bergmann 2364e6d62d Add $equals to Embind'ing of UNO interfaces
...so one can write foo.$equals(bar.$query) to check for UNO object equality

Change-Id: I727386e833507c86573cf033a1364ff145ed31ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164544
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-07 21:21:24 +01:00
Stephan Bergmann ba70a87563 Fix Embind'ing of UNO Any getter for sequences
Change-Id: I5c53cb1d244731dac8f9e3f4797a7a155b9a9afa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164541
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-07 18:38:34 +01:00
Stephan Bergmann 98c42f7e96 Adapt to emsdk 3.1.46
...where it failed with

> In file included from static/source/unoembindhelpers/PrimaryBindings.cxx:13:
> In file included from ~/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/bind.h:23:
> ~/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:226:20: error: assigning to 'void *' from 'const void *' discards qualifiers
>   226 |   cursor->w[0].p = wt;
>       |                    ^~
> ~/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:248:3: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireType<const void>' requested here
>   248 |   writeGenericWireType(cursor, BindingType<First>::toWireType(std::forward<First>(first)));
>       |   ^
> ~/emsdk/upstream/emscripten/cache/sysroot/include/emscripten/val.h:256:5: note: in instantiation of function template specialization 'emscripten::internal::writeGenericWireTypes<const void *>' requested here
>   256 |     writeGenericWireTypes(cursor, std::forward<Args>(args)...);
>       |     ^
> static/source/unoembindhelpers/PrimaryBindings.cxx:309:56: note: in instantiation of member function 'emscripten::internal::WireTypePack<const void *>::WireTypePack' requested here
>   309 |                     emscripten::internal::WireTypePack argv(self.getValue());
>       |                                                        ^

see the comment at
<https://github.com/emscripten-core/emscripten/commit/0f83fd40533248cce42464e1b9b586281202f247#r139443236>
"[Wasm64] Fix embind with addresses over 4gb (#20071)"

Change-Id: I1f472e9dc57b3abfbe1ba8a0f3a3bd70c1c484f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164463
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-06 20:50:43 +01:00
Stephan Bergmann 3172945445 Update documented emsdk version
...to what is known-working at allotropia.  (Also, emsdk --embedded option is
redundant since
<https://github.com/emscripten-core/emsdk/commit/3e9f04d467ba300b43fc40dab657c56f39751c96>
"Remove support for non-embedded mode".)

Change-Id: I7d3f3b72f131301ddc92fcf22503b575f30e7086
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164464
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-06 20:48:18 +01:00
Stephan Bergmann 567a10caef Add Embind'ing of UNO Any getter for exceptions
Change-Id: Ief3cdebc1ee7c7b9f012741c9db8637dba9bbd07
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164433
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-06 00:02:36 +01:00
Stephan Bergmann 893af92ae9 Add Embind'ing of UNO Any getter for sequences
Change-Id: I5b81ad3d5f1351062aef43105ea7ec4678045a90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164360
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-04 21:43:18 +01:00
Stephan Bergmann 0bab5cda21 Add Embing'ing of UNO Any getter for enums
...which taps into the internals of emscripten::val, which is based on
std::type_info identifiers, so we need an additional statically-built mapping
between UNO (enum, for now) types and std::type_info

Change-Id: I9fc1ff33fe31a1e1052504905de446ed2193e014
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164359
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-04 21:43:09 +01:00
Stephan Bergmann 8428368d79 Improve Embing'ing of UNO Any somewhat
Change-Id: I82e38ac815765b62601076cf61745fe9889451b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164358
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-03-04 21:42:58 +01:00
Stephan Bergmann 41feb036b4 Some minimal Embind support for UNO type
...which should be rare enough in practical use that it should be sufficient to
only have toString-functionality for instances mapped from C++ to JS, but no
constructor for new instances on the JS side.  (The natural choice for the
latter would be a mapping of the C++

>     inline Type( TypeClass eTypeClass, const ::rtl::OUString & rTypeName );

constructor, but which requires a mapping for the css::uno::TypeClass UNOIDL
enum, which is only provided "later" through CustomTarget_static/unoembind, so
would at least conceptually be a bit dirty.)

This Embind mapping treats css::uno::Type as a smart pointer for the underlying
typelib_TypeDescriptionReference, to benefit from the fallback garbage
collection (in more recent Emscripten versions, at least) for smart pointers,
obviating the need to call .delete() on each instance mapped to JS.

Change-Id: Ic113967c264c28641dfd1fe159012c85519f4a9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164140
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-29 16:19:19 +01:00
Stephan Bergmann f1a47d476a Improve sample code, missing delete()
Change-Id: I26ddbfb8b6742d816290d122d22c3c6c3ceabcc0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164143
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-29 13:25:54 +01:00
Stephan Bergmann 6064939d40 Embind support for constant groups
The constants are only reflected directly as JS values in the generated *.js
file.  Reflecting them via emscripten::constant in the generated *.cxx did not
work well:  Most importantly, emscripten::constant (and its underlying
_embind_register_constant) coerce all values to double, so UNO (unsigned) hyper
would not survive as JS BigInt, which would then cause e.g.

>     console.assert(test.isHyper(uno.org.libreoffice.embindtest.Constants.Hyper));

passing such a (JS number, not BigInt) value into the
org.libreoffice.embindtest.XTest::isHyper method (which expects a UNO hyper) to
fail.  (Also, constants of UNO boolean type would be represented as numbers 0/1
rather than as false/true.)

Change-Id: I056db0ccce0bf40eb53728fd439cc74964eb6951
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164097
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-29 07:53:54 +01:00
Stephan Bergmann 621322b6ac Generate slightly more flexible JS init_unoembind_* functions
...that return the "hierarchical object", rather than setting it as a member of
the passed-in instance

Change-Id: I17ad7dd426114c7979f1ba6edaebe83b43eedfed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164064
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-28 07:53:41 +01:00
Stephan Bergmann c7664f12a9 Init Embind-ings manually, once UNO is set up
Upcoming code that changes the Embind'ing of UNO sequences will require
availability of the UNO type manager during that Embind init code, so only call
that after UNO has been bootstrapped (rather than as part of the initialization
of global static data, which is what EMSCRIPTEN_BINDINGS does).

Change-Id: Iba19851ffb82c055dcab10a28a8c1fafa9d2a414
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164065
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-28 07:53:21 +01:00
Stephan Bergmann 80e2c4e5b9 Fold InternalUnoApi_embindtest into UnoApi_udkapi
80d3f33876 "Library_embindtest should use
comprehensive InternalUnoApi_embindtest" was an attempt at making type
information about that library available at runtime.  Which worked for cases
where code directly called one of the types' cppu_detail_getUnoType function.
But it would still fail for cases where code indirectly wants to obtain one of
the types' information by type name---which is what upcoming code will do that
changes the Embind'ing of UNO sequences.

So InternalUnoApi_embindtest would need to become a UnoApi_embindtest whose
instdir/program/types/embindtest.rdb would be available at runtime.  But I'm too
dumb to convince gbuild to create that new UnoApi_embindtest.  So instead just
tack the embindtest UNOIDL entities onto the existing UnoApi_udkapi for the
EMSCRIPTEN-ENABLE_DBGUTIL case.  (Which requires that the single embindtest.idl
is split into individual per-entity files, sigh.)

Change-Id: Ie189b17213ac5b2de7a61ac5f97a143fa097337f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164057
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-28 07:52:11 +01:00
Stephan Bergmann dde9f306a2 Fix copy/paste error
Change-Id: I267d5a7fa9150b16e9625b36c032fa48199758e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163937
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-26 14:24:23 +01:00
Stephan Bergmann eb35b4293e Add a favicon to the Wasm build
...to avoid "GET http://localhost:6931/favicon.ico 404 (File not found:
instdir/program/favicon.ico)" errors in the browser console.  The checked-in
static/emscripten/favicon.ico is a copy of
<https://www.libreoffice.org/themes/libreofficenew/favicon.ico>.

Change-Id: Ib40b3f159879cc39244bd81d7fc8a36cc8c7184a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163827
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-24 00:06:13 +01:00
Stephan Bergmann 2c3121adb9 Embind: Add UNO char support
Change-Id: I4ced49774baafdf620ae167c53794932766aca86
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163741
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-22 15:45:51 +01:00
Stephan Bergmann d0cb804f7a Framework for some UNOIDL to test the Embind UNO binding with
It is only built for --enable-dbgutil builds.  Load
instdir/program/qt_soffice.html in a browser and see "Running embindtest" in its
console.  For now, it only contains a Test singleton with an empty XTest
interface, which is meant to grow additional methods over time.

(The code needs to reside in the unotest rather than in the static module, or
else the wasm build would run into cyclic dependencies.)

Change-Id: I6f65f0c904648a4fd96fc6215c8d59a1544f48a2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163693
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-22 08:15:30 +01:00
Stephan Bergmann a62436ff02 Remove stray code from example
...that had erroneously been added with 27ceca1996
"Rework the Embind mapping of UNO interfaces"

Change-Id: I421bf2aa7e9f96ce48b227f6f47058581b64d7b0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163692
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-21 16:17:13 +01:00
Stephan Bergmann 52a22b6863 Fold registeroustring.js into PrimaryBindings.cxx
Change-Id: I2e1aa828f194a104d354741518e8cb20015ac276
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163385
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-15 10:58:47 +01:00
Julien Nabet c4556bc19c Fix WASM TB following ace21b4b25
Change-Id: If881428bf69587ad9067378cde01caa87d56c1a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163211
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2024-02-10 15:09:29 +01:00
Stephan Bergmann 72056edca0 Embind: Allow UNO sequences to be constructed from JS arrays
...though

> let seq = new Module.uno_Sequence_string(["foo", "bar", "baz"]);
> // ...
> delete seq;

is still ugly.

And Embind only allows for overload resolution by number of parameters, not by
their type, so using the original sequence constructor had to be changed to

> let seq = new Module.uno_Sequence_string(3, Module.uno_Sequence.FromSize);
> seq.set(0, "foo");
> seq.set(1, "bar");
> seq.set(2, "baz");
> // ...
> delete seq;

Change-Id: If26ff4a485ba16b65cf24b6fe729d379c733c473
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163097
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-08 09:30:22 +01:00
Stephan Bergmann 578d9be504 Embind: Map UNO structs to emscripten::value_object
...so that it has a nicer integration into JS, at the expense of copying data
between C++ and JS

Change-Id: I19af55e8db0c374dd7b0f58f74d1af19214175b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163098
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-08 08:36:06 +01:00
Stephan Bergmann 453049b93e First-class Embind JS support for OUString
Change-Id: Ic178737da802e17f87d0b5b09004a847b0fe91be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162956
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-03 23:44:14 +01:00
Stephan Bergmann 8869994d5e embindmaker: Add support for sequence types
Ideally, JS code would have a way to create instances of arbitrary UNO sequence
types (to e.g. put them into Anys), but that goes against the static nature of
Embind.  So at least register JS support for all those UNO sequence types that
are actually used in the UNO API.  (This would cause duplicate failures, though,
if we generated multiple separate .cxx files from embindmaker invocations, with
registration code for the same UNO sequence types.)

(Even more ideally, UNO sequence types could map to JS arrays, and/oror be
garbage-collected on the JS side rather than needing explicit delete().  The
resize/size/get/set interface in unoembindhelpers::registerSequence is modelled
after Embind's emscripten::register_vector.)

Change-Id: Icd38b2e03db442dd613b9222b9bd092f947f7bec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162849
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-02-01 08:46:47 +01:00
Stephan Bergmann efaf6218a2 embindmaker: Consistently spell out "::com::sun::star::"
Change-Id: I253236c908b1827479c1824cf01c707e48ef58c9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162832
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-31 21:52:48 +01:00
Stephan Bergmann 5a521daa68 embindmaker: Handle (plain) structs
Change-Id: I16ac3a6a2f42cf3054104a5ba90f4b75238e2ec4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162843
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-31 20:46:48 +01:00
Stephan Bergmann 4c288ac1f2 Rename UnoInOutParamXxx -> uno_InOutParam_xxx
...to harmonize with the other existing uno_Type_... etc. names, and with
upcoming uno_Sequence_... names.  (And template'ize the registration code.)

Change-Id: I5dace5bc643ab636977fde84fa51825efc5cafa5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162838
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-31 19:07:47 +01:00
Stephan Bergmann 702f420ab3 embindmaker: Handle enums
Change-Id: I07e068e52df2a838e76f32e691d23a47d7fcfdda
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162809
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-31 15:56:39 +01:00
Stephan Bergmann 7938c1e88d embindmaker: Handle new-style singletons
Change-Id: Icb3b179c95e1af8b12772401f58d4f4cf181e585
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162795
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-31 12:20:45 +01:00
Stephan Bergmann 077fa0a0d1 At least in its current form, embinding Any shouldn't need allow_raw_pointers
Change-Id: Ib66df92c17768a05a402135729a75992b4b83d64
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162789
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-31 10:52:51 +01:00
Stephan Bergmann e4cf6c324c Embind in-out/out params of primitive type apparently need a wrapper
> let translit = css.i18n.Transliteration.create(Module.getUnoComponentContext());
> let match1;
> let match2;
> let eq = translit.equals(new Module.OUString("test1"), 0, 5, match1, new Module.OUString("test2"), 0, 5, match2);
> console.log('match ' + eq + ', ' + match1 + ', ' + match2);

caused an uncaught UnboundTypeError with message "Cannot call
uno_Type_com$sun$star$i18n$XTransliteration.equals due to unbound types: Pl", so
use

> let translit = css.i18n.Transliteration.create(Module.getUnoComponentContext());
> let match1 = new Module.UnoInOutParamLong;
> let match2 = new Module.UnoInOutParamLong;
> let eq = translit.equals(new Module.OUString("test1"), 0, 5, match1, new Module.OUString("test2"), 0, 5, match2);
> console.log('match ' + eq + ', ' + match1.val + ', ' + match2.val);
> delete match1;
> delete match2;

instead

Change-Id: Ic5a0a9e37e884817158069702510eab0d29adefa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162784
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-31 09:33:11 +01:00
Stephan Bergmann 9c416f6704 Embind clean up, only pass in-out/out params by raw pointer
Change-Id: I141d3aace7b76182fe464626bbb8a336c8ec6a3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162783
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-31 08:04:28 +01:00
Stephan Bergmann 9f236a078c Pass the_self by const ref in Embind wrapper functions
Change-Id: Ie8bfec2a9fdd5f126fd2879d2ba06f1fa5c1019e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162781
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-30 23:57:16 +01:00
Stephan Bergmann 9a982f8cb6 Embinding OUString shouldn't need allow_raw_pointers
Change-Id: I92608ebe4edf65c7de96587aa39e990fb09c3e19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162779
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-30 22:46:36 +01:00
Stephan Bergmann 1b371a4e1f embindmaker: Handle new-style services
Change-Id: I41309a20666c17f0c8c8d456943b3c78d0273905
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162772
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-30 22:38:14 +01:00
Stephan Bergmann 4a806d6b02 Expose comphelper::getProcessComponentContext through Embind
Change-Id: I8b2cec04a1ffb99c33d39d8a63aa67778e960ab7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162773
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-30 22:37:34 +01:00
Stephan Bergmann 7e0a432214 embindmaker: Handle interface inheritance
Change-Id: I81e66666f8a60bd34a9a3807adfb15c341303b9a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162771
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-30 22:18:15 +01:00
Stephan Bergmann 27ceca1996 Rework the Embind mapping of UNO interfaces
...to make use of the automatic finalization clean-up of smart pointers
available with recent versions of Embind (so that explicitly calling delete() on
them should largely be optional now).  See the changes to static/README.wasm.md
for how code should look like now.  (The Module.uno_Reference.FromAny dummy
argument for the interface constructor converting from an Any is only necessary
to distinguish it from the other constructor, as otherwise Embind complains
because:  "Overload resolution is currently only performed using the parameter
count, not actual type info!")

Change-Id: Ia8a8c12e38af1093948bf8a20ecd31aa6591e912
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162697
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-30 07:40:02 +01:00
Stephan Bergmann 2df1dcc324 Some renaming of generated identifiers
uno_Type_com$sun$star$... and uno_Reference_com$sun$star$...

Change-Id: Ibc19f423a60c521c376172807b4d5a34cf0179a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162696
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-30 07:39:06 +01:00
Stephan Bergmann b476dccd11 Experimental support for latest Emscripten (and Qt6)
What I'm after in the context of our Embind-related code is the claim at
<https://emscripten.org/docs/porting/connecting_cpp_and_javascript/embind.html#memory-management>:
"JavaScript only gained support for finalizers in ECMAScript 2021, or ECMA-262
Edition 12.  The new API is called FinalizationRegistry and it still does not
offer any guarantees that the provided finalization callback will be called.
Embind uses this for cleanup if available, but only for smart pointers, and only
as a last resort."  However, with the recommended emsdk 2.0.31 my tests did not
show any use of that finalization support.  So I wanted to try with the latest
emsdk 3.1.51 instead.  But then, linking vcldemo failed with

> wasm-ld: error: ~/allotropia-qt5/lib/libQt5Core.a(qlogging.o): undefined symbol: std::__2::__vector_base_common<true>::__throw_length_error() const

etc., so I gave it a try to rather build against latest Qt6.7, with

> --with-distro=LibreOfficeWASM32
> --disable-qt5
> --enable-qt6
> QT6DIR=...

TODO: The result is highly experimental, and it uses ENABLE_QT5 (i.e., the
recommended setup with emsdk 2.0.31 and the
<https://github.com/allotropia/qt5.git> v5.15.2+wasm branch) vs. ENABLE_QT6
(i.e., my experimental setup with emsdk 3.1.51 and the
<https://github.com/qt/qt5.git> 6.7 branch) not only to distinguish between Qt5-
vs. Qt6-specific behavior, but also to distinguish between old- vs.
new-Emscripten-specific behavior.  Of note:

* The startup code appears to have changed substantially (and required setting
  -s MODULARIZE=1 and -s EXPORT_NAME=soffice_entry now, and telling emcc to
  build just soffice.js and not the wrapper soffice.html.  TODO: This also
  required hacking into qt_soffice.html:  (1) The command-line arguments
  (--norestore, --nologo, --writer, and the exammple.odt; all of which we should
  eventually get rid of, anyway).  (2) Saving the generated instance as
  window.Module (and adapting the embindmaker-generated code, cf. the changes to
  static/README.wasm.md).

* There were some symbol clashes between external/argon2 and
  libQt6Core.a(qcryptographichash.cpp.o, so renamed the problematic symbols in
  external/argon2.

Change-Id: I5420ab566d560b11954ac6613249bfc53d8acb31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162695
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-29 19:51:57 +01:00
Stephan Bergmann 8dc4a2e40b Hack to speed up compilation of generated UNO Embind source
...workdir/CustomTarget/static/unoembind/bindings_uno.cxx, reducing an otherwise
no-op build for me (against emcc 3.1.51) from multiple hours to "just" 3 min
wall-clock time.

Change-Id: Ic6477134b72f9d28cc3193fb514ceaa32b84209c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162666
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-28 21:30:21 +01:00