Wolfgang Bumiller
2812f550d9
macro: pass 'cv' as Value
...
to reduce the amount of required unsafe blocks
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-01-07 15:59:33 +01:00
Wolfgang Bumiller
c25b213cc5
macro: use raw pointer for CV parameter
...
so generated xsubs are actually compatible with
Value::new_xsub
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-01-07 15:54:50 +01:00
Wolfgang Bumiller
e5c95f0414
macro: fix multiplicity parameter type
...
use ffi::Interpreter, same as what perlmod does via the
perl_fn macro
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-01-07 15:51:33 +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
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 5491907876
was incomplete, this fixes up the
remaining 2 cases
Fixes: 5491907876
("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
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
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
4b5b75f1d8
macro: implement prototypes
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-11-25 10:16:39 +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
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
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
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
Wolfgang Bumiller
83f19b9599
macro: implement bootstrap function in rust
...
with this, the generated .pm files don't contain any
exports anymore
when implementing a `perlmod-bindgen` utility to generate
.pm files, we can now also deprecate the `lib =` module
attribute on the `package` proc macro
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-21 11:28:29 +02:00
Wolfgang Bumiller
ebe0ba6487
bump perlmod version to 0.7.1
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-19 10:33:36 +02:00
Wolfgang Bumiller
449d746871
perlmod-macro: improve error handling
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-15 09:52:58 +02:00
Wolfgang Bumiller
f888c202cc
perlmod-macro: drop anyhow dependency
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-15 09:45:57 +02:00
Wolfgang Bumiller
b8ef338c1c
bump perlmod-macro to 0.4.0 and perlmod to 0.6.0
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-14 15:14:00 +02:00
Wolfgang Bumiller
814014b874
macro: support env vars in package attributes
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-13 12:52:02 +02:00
Wolfgang Bumiller
9de065545b
macro: use CARGO_PKG_NAME instead of reading Cargo.toml
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-13 11:28:16 +02:00
Wolfgang Bumiller
4c9f6c51d7
macro: different approach to clippy warning
...
currently this does in fact deduplicate code, so...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-07-02 11:54:33 +02:00
Wolfgang Bumiller
a2a884c13d
macro: clippy fixes
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-07-02 11:37:51 +02:00
Wolfgang Bumiller
726fa9b484
bump perlmod-macro to 0.3.2-1
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-06-30 09:48:00 +02:00
Wolfgang Bumiller
aa13c5c85b
macro: add newlines to errors
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-06-30 08:14:54 +02:00
Wolfgang Bumiller
0daaa90cf6
bump version to 0.5.0-1
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-06-21 12:40:56 +02:00
Wolfgang Bumiller
1bb53e8403
bump perlmod-macro to 0.3.1-1
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-22 14:18:26 +01:00
Wolfgang Bumiller
f2fb3f9604
check in control files
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-22 14:18:26 +01:00
Wolfgang Bumiller
740eda0643
adjust path for DynaLoader
...
We usually have multiple packages but only a single library,
so rather than making package look in subdirectories named
after them, just look in the toplevel `auto/` directory.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-22 14:12:25 +01:00
Wolfgang Bumiller
d870bc9bb3
bump perlmod-macro to 0.3.0-1
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-16 10:41:52 +01:00
Wolfgang Bumiller
705d6989ad
macro: support tuple return types in functions
...
These are now *list* return types in perl.
However, currently there is no support for 'wantarray' or
lists of dynamic length.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-16 10:39:37 +01:00
Wolfgang Bumiller
6dd6718b6e
bump perlmod and perlmod-macro to 0.2.3
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-15 14:56:17 +01:00
Wolfgang Bumiller
fa4d4a654c
macro: make generated helpers #[doc(hidden)]
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-15 14:05:02 +01:00
Wolfgang Bumiller
d7f59334ba
bump perlmod-macro to 0.2.2-1 as well
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-02-15 10:36:52 +01:00
Wolfgang Bumiller
7de9fdf07b
introduce try_from_ref argument attribute
...
and document attributes in the #[export] macro documentation
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-27 15:35:08 +01:00
Wolfgang Bumiller
0bab1226bb
bump perlmod-macro to 0.2.1-1
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-27 13:07:03 +01:00
Wolfgang Bumiller
241e69eed8
guard '-L./target/debug' lib path by debug_assertions
...
A release build shouldn't add the local search path for
libraries to the perl modules.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-27 13:03:46 +01:00
Wolfgang Bumiller
81e9f75763
clippy lints
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-27 12:06:01 +01:00
Wolfgang Bumiller
f483228623
bump perlmod and perlmod-macro to 0.2.0
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-26 13:58:17 +01:00
Wolfgang Bumiller
dd7f83c3ee
deserialize by reference
...
Allow deserializing things such as `&[u8]` to reference the
original data instead of requiring a `Vec<u8>` instead.
Introduces `perlmod::from_ref_value` next to
`perlmod::from_value` with a new signature.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-26 13:50:07 +01:00
Wolfgang Bumiller
8a062e94c3
more doc improvements
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-25 15:13:57 +01:00
Wolfgang Bumiller
2991a46a31
fix #[export(name=...)], drop deprecated make_package
...
The `make_package` macro is tedious to use. We now simply
depend on new-enough rustc for `package` to work.
The change to #[export] allows writing:
#[export(name = "DESTROY")]
fn destroy(#[raw] this: Value) { ... }
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-25 14:35:34 +01:00
Wolfgang Bumiller
3348e1b840
perl namespacing, since we can bless now
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-24 11:13:55 +01:00
Wolfgang Bumiller
913a8a72ce
support functions without return values
...
this makes for surprisingly ugly code
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-24 11:05:55 +01:00
Wolfgang Bumiller
0cdb12e277
add support for raw parameters
...
#[export]
fn foo(#[raw] this: Value) -> Result<(), Error>;
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-24 10:36:03 +01:00
Wolfgang Bumiller
29e61fa65e
add 'raw_return' function attribute
...
A function declared with a raw_return attribute like this:
#[export(raw_return)]
fn foo() -> Result<Value, Error>;
will not perform serialization on the 'Value', but return
the "raw" value to perl. This allows returning blessed
values.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-11-24 09:37:59 +01:00