Commit graph

145 commits

Author SHA1 Message Date
3318ca8167 Fix meson warnings 2024-08-21 18:18:18 +02:00
2c99251b27 Add support for returning a pre-existing foreign object from a foreign method
This is potentially subject to change in the near
future. This commit adds support for returning
an instance (currently wrapped in ForeignObject<>)
of a foreign object that is already instantiated.
The object returned this way simply gets selected
by handle into slot 0 of C Wren.
Conversely, returning just a naked object causes
wrenpp to make a Wren-accessible copy of it.
2024-05-28 08:25:19 +02:00
d2a1187ad5 Some fixes
Build fix in foreign_object.hpp
Wrong assert when a module contains
more than one class, dynafunc_maker.cpp
2024-05-26 20:36:31 +02:00
60a9392386 Version bump to 0.2.0 2024-05-25 01:49:45 +02:00
05298b6111 Add support for object parameters to Wren calls 2024-05-25 01:47:51 +02:00
b00bd59027 Don't fail when no default ctor is given 2024-05-24 17:12:22 +02:00
72da0b8d87 Fix build when std::string is a lone parameter
The "any tuple-like" thing was nice but
it was confusing when passing for example
a std::string, which is a typedef to a
tuple-like thing. Making a custom
ConstructorParameters struct is more clear
both to users and to the compiler.
2024-05-24 17:12:04 +02:00
ea19e35f85 Fix build when a single ctor is registered 2024-05-24 16:57:16 +02:00
40c24e28ac Buildfix for standalone wren 2024-05-24 12:48:55 +02:00
0636fd2249 Buildfix but only tested on amd64 2024-05-24 12:41:39 +02:00
ac8a84fc01 Build fix
Make sure nullchar is created in
a generic way. Also, for some
reason template argument deduction
was failing.
2024-05-24 04:10:27 +02:00
ebca413c0a Cleaning up the wren dependency 2024-05-24 01:25:13 +02:00
40c362f6da Update wren to tag 0.4.0 2024-05-24 01:05:49 +02:00
6ad20e5051 Call meson.override_dependency() 2022-06-06 16:10:25 +02:00
e1ccbeedc4 Fix operator== 2022-06-06 16:04:25 +02:00
576452a8ac Build fix for aarch64
But there is a bug in meson currently that makes it so that
neon is never detected on aarch64 so the generic crc32
implementation is always chosen. Not a big deal right now.
It will fix itself once meson fixes their bug.
2022-06-03 20:41:00 +02:00
730f4f45ef Tidy up hardware crc32 implementations 2022-06-03 15:54:45 +02:00
9566553856 Extract crc32 code into a separate static lib
Following what's been suggested on IRC libera.chat #mesonbuild,
this is so that the -march=generic+crc option only applies to
the code it should apply to and not to the entire code base.
2022-06-03 11:25:48 +02:00
d71229fc07 Create meson build file in src 2022-06-03 11:07:35 +02:00
f4b3600ee5 Possible build fix for aarch64 2022-06-03 10:52:26 +02:00
b3ecb69ec0 Keeping crc around, but cleaning up a bit
Crc is used as an optimisation for operator==, which is legit.
Either way, the struct's size would still be 16 even without
the crc (the variable would just became an always 0 "reserved").
Crc's use is limited to here anyways, so for now it's not
harming anyone.
2022-06-03 10:27:28 +02:00
09530e15c9 Use a better ID for identifying classes.
Upon testing (and reading), getting the address of a static
is safe even across .so boundaries. Moreover it doesn't incur
into the risk of collisions, unlike hashes, and also works
with different classes with the same name (for example from
two different unnamed namespaces). At this point the crc32
stuff is pretty much redundant, I'll try to remove it next.
2022-06-03 09:39:43 +02:00
616381516b New helper function for abort_fiber + message 2022-05-25 11:56:53 +02:00
b559f025e9 Report error to wren if an exception is thrown 2022-05-25 11:30:44 +02:00
e5d85e8f40 This can be consteval 2022-05-24 16:40:39 +02:00
742271ad09 Get rid of the iostream include in bt::string 2022-05-24 16:38:34 +02:00
b0422b73d6 Remove dummy 0, store the crc32 there 2022-05-24 16:38:34 +02:00
e8db08931a Add equality operators 2022-05-24 16:07:16 +02:00
e97c7bad10 Improve runtime crc32 code
Only check for sse4.2 once and store the best
crc32 implementation available into a static
function pointer.
Also other minor improvements.
2022-05-24 13:39:45 +02:00
e200288d06 Build fix, runtime_crc32c() should be in namespace detail 2022-05-24 13:21:56 +02:00
6a47be250f Replace crc32 implementation
This is a properly constexpr version for modern c++. Also
added a fast runtime version of it.
2022-05-23 04:19:54 +02:00
addb48822f Refactor so that make_method_bindable also accepts free functions now 2022-05-19 19:22:20 +02:00
c6d01f745a Fix off-by-one error
bt::string takes the full length of the buffer including
the terminating null-char
2022-05-19 19:22:12 +02:00
7770d67392 Build fix on gcc 12 2022-05-19 19:22:12 +02:00
ab595cc8aa Build fix on clang 2022-05-19 19:22:12 +02:00
1fa6d62f17 Add support for registering foreign methods that return foreign objects
Still a bit work in progress but functioning
2022-05-18 18:48:18 +02:00
9c147b1a6e Build fix for function that is not being used by any examples yet
Signature of `make_wren_object()` changed slightly
2022-05-17 02:22:14 +02:00
41692eb0bc Fix for aarch64 2022-05-17 01:33:51 +02:00
eadd25b827 Foreign function callbacks now receive a ModuleAndName parameter too.
This commit breaks the ARM64 version, I will fix it next.

Lots going on here. DynafuncMaker got updated to store strings
to back the ModuleAndName objects that get hardcoded in the
assembly glue function.
ModuleAndName is not a typedef to a tuple anymore, because I
discovered that tuples suck. They get always pushed on the stack
when passed as parameter, instead the new implementation gets
passed into 2 registers being it a standard layout type.

dhandy::bt::string got updated so it can be used as a literal
value for non-type template parameters, which allowed for a
really easy to use `wren::MN<>` helper. Code now fully requires
c++20.
2022-05-17 01:06:36 +02:00
b2c694c954 Split meson file for wren/detail directory 2022-05-17 00:42:11 +02:00
a17e49dd27 Version bump to 0.1.3 2022-05-15 23:09:49 +02:00
c59cc03f49 Update readme, still incomplete 2022-05-15 23:09:36 +02:00
0220529179 Fix typo 2022-05-15 20:20:28 +02:00
816a8af654 Fix memory leak, improve code 2022-05-15 20:17:42 +02:00
ce7be396d2 Improve error reporting 2022-05-15 20:17:07 +02:00
0e3e0ed506 Fix header 2022-05-15 20:16:28 +02:00
400adf50c6 Add build option wren_with_name_guessing 2022-05-15 20:14:34 +02:00
692393285d Fix memory leaks 2022-05-15 19:19:56 +02:00
4d3dfce93f Improve and cleanup make_foreign_class()
No need to have two versions of this.
Static assert when users specify ambiguous overloads.
Currently overloads are discriminated only by
parameter count, not types, so we need to enforce this.
2022-05-15 17:01:57 +02:00
a8cef95cb9 Rename function
I think this is the opposite of the code I'm working on
now, ie it's not called by wren to create a c++ object
but from c++ to create a wren object. I'll add an
example for this.
2022-05-15 16:19:42 +02:00