172 Commits

Author SHA1 Message Date
Wolfgang Bumiller
fb27e167ba doc updates
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-01-07 09:12:00 +01:00
Wolfgang Bumiller
77171723e3 macro: expose the 'cv' as parameter on exports
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-01-07 09:12:00 +01:00
Wolfgang Bumiller
c7882155cf cleanup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-01-07 09:11:41 +01:00
Wolfgang Bumiller
ebd82cb7ac perlmod: ffi: support visibility in perl_fn
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-01-04 09:55:53 +01:00
Wolfgang Bumiller
9bf583ca64 macro: export: copy use chosen visibility
when using the export macro directly without a package we
previously always used
    #[no_mangle]
    pub extern "C"
now instead of 'pub' we copy the original function's
visibility

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-23 10:40:59 +01:00
Wolfgang Bumiller
100414d678 macro: fixup export visibility
commi 54919078765f was incomplete, this fixes up the
remaining 2 cases

Fixes: 54919078765f ("don't export xs wrappers from modules")
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-23 10:40:59 +01:00
Wolfgang Bumiller
577f68753f perlmod: doc fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-23 10:40:59 +01:00
Wolfgang Bumiller
3e1adbd039 bump d/control
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-17 14:24:44 +01:00
Wolfgang Bumiller
44c4c44b4e bump perlmod to 0.10.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-17 09:22:58 +01:00
Wolfgang Bumiller
c0afdc3a97 perlmod: deny unsafe_op_in_unsafe_fn
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-17 09:20:58 +01:00
Wolfgang Bumiller
25d21384ae perlmod: add Value::new_xsub as an unsafe fn
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-17 09:17:09 +01:00
Wolfgang Bumiller
af31038b48 perlmod: perl_fn for fn types w/o body
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-17 09:16:53 +01:00
Wolfgang Bumiller
f8b00d2b6b fixup RSPL_newXS_flags to return the CV
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-16 14:57:03 +01:00
Wolfgang Bumiller
020bb8f6d9 doc updates
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-16 14:06:31 +01:00
Wolfgang Bumiller
e5a46a38ef clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-15 10:45:15 +01:00
Wolfgang Bumiller
86f538fe3f bump perlmod to 0.10.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-14 13:53:54 +01:00
Wolfgang Bumiller
d17087df54 perlmod: introduce MagicValue
It turns out that using `const` for the `MagicSpec` can lead
to multiple instances of it and the `TryFrom` accessing a
different vtable address than the instantiating functions.

This particularly happened when using `declare_magic!`
directly for a `Box<T>` where `T` is not declared in the
same module and is `!Sync`.

Instead, `declare_magic!()` now creates `static`s,
`MagicSpec` loses the associated value so we can safely
force it to be `Send + Sync`, and `MagicValue` is introduced
as the result of the `.with_value()` method call.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-14 13:33:07 +01:00
Wolfgang Bumiller
7922272173 perlmod: actually use provided magic var
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-14 13:27:40 +01:00
Wolfgang Bumiller
8c587b3bf3 doc fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-14 12:13:28 +01:00
Wolfgang Bumiller
e68855945d drop imports already in 2021 prelude
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-01 14:13:44 +01:00
Wolfgang Bumiller
381751a4e8 upgrade to edition 2021
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-01 13:48:40 +01:00
Wolfgang Bumiller
b44db4281d bump perlmod to 0.9.0 and perlmod-macro to 0.6.0
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-26 14:05:44 +01:00
Wolfgang Bumiller
b78b6ceb94 documentation update
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-25 10:24:10 +01:00
Wolfgang Bumiller
0044cdcef4 test trailing-optional parameters
we'll need proper tests to check that too few and too many
parameters actually trigger errors

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-25 10:17:34 +01:00
Wolfgang Bumiller
4b5b75f1d8 macro: implement prototypes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-25 10:16:39 +01:00
Wolfgang Bumiller
80472d9b98 perlmod: always use opt_level 3
since debug mode on some systems warns about _FORTIFY_SOURCE
requiring optimizations...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-24 20:59:49 +01:00
Wolfgang Bumiller
4dc236a2d4 macro: allow optional option parameters
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-24 20:59:27 +01:00
Wolfgang Bumiller
5491907876 don't export xs wrappers from modules
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-24 20:45:11 +01:00
Wolfgang Bumiller
d6b0097481 macro: fix missing parameter name in error message
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-24 11:57:36 +01:00
Wolfgang Bumiller
0202cffe88 Update the 1.0 todo list
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-24 09:32:12 +01:00
Wolfgang Bumiller
1f483df2dd README.md update
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-17 13:10:32 +01:00
Wolfgang Bumiller
78e2b8b233 bump perlmod to 0.8.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-05 10:16:44 +01:00
Wolfgang Bumiller
8932eaeb6b test enum serialization
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-05 10:14:26 +01:00
Wolfgang Bumiller
96f5ad7534 perlmod: add enum deserialization support
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-05 10:14:09 +01:00
Wolfgang Bumiller
2089f78cbe perlmod: doc fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-03 13:06:13 +01:00
Wolfgang Bumiller
fa8cf13497 bump perlmod to 0.8.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-02 14:32:41 +01:00
Wolfgang Bumiller
ce25d8eb26 perlmod: add as_array/as_object + mut to Value
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-02 14:31:37 +01:00
Wolfgang Bumiller
5be6fc8362 bump perlmod-macro to 0.5.0-1 and perlmod to 0.8.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-28 09:22:39 +02:00
Wolfgang Bumiller
1e46bfbe81 perlmod: magically call Drop handlers
magic classes now don't need to manually implement DESTROY
anymore

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-28 09:01:32 +02:00
Wolfgang Bumiller
4632042632 perlmod, macro: detect perl's MULTIPLICITY flag
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-27 15:41:51 +02:00
Wolfgang Bumiller
4a0e18d9b3 calling convention 'fixup'
if we ever want to support mgvtbl methods we may need to add
support for detecting the pTHX_ parameter into our build.rs
scripts

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-27 13:47:58 +02:00
Wolfgang Bumiller
3464d8b054 more documentation
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-27 13:17:51 +02:00
Wolfgang Bumiller
1521415be3 magic tests
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-27 12:57:05 +02:00
Wolfgang Bumiller
69ebfc54a3 add instantiate_magic convenience macro
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-27 12:57:05 +02:00
Wolfgang Bumiller
083e82368d implement some crude magic helpers
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-27 12:57:05 +02:00
Wolfgang Bumiller
6f26c2da30 perlmod: add magic ffi and glue
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-27 12:57:05 +02:00
Wolfgang Bumiller
62f3c1eb74 add a comment noting an API cleanup todo
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-27 11:38:08 +02:00
Wolfgang Bumiller
fb26412b42 Value: add AsRef/AsMut<ScalarRef>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-27 11:38:08 +02:00
Wolfgang Bumiller
041e791032 add Value::new_hash for convenience
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-27 11:38:08 +02:00
Wolfgang Bumiller
35762913de bump perlmod to 0.7.2 and perlmod-macro to 0.4.1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-25 10:16:21 +02:00