Skip to main content

libperl_sys/
perl_core.rs

1//! Auto-generated FFI declarations (bindgen + libperl-macrogen output).
2//!
3#![doc = concat!(
4    "Built against Perl ", env!("LIBPERL_SYS_PERL_VERSION"),
5    " (", env!("LIBPERL_SYS_PERL_THREADED"),
6    ", `", env!("LIBPERL_SYS_PERL_ARCHNAME"), "`).",
7)]
8//!
9//! See the [crate root](crate) for build-target details and version
10//! constants.
11#![allow(non_upper_case_globals)]
12#![allow(non_camel_case_types)]
13#![allow(non_snake_case)]
14#![allow(unnecessary_transmutes)]
15#![allow(unpredictable_function_pointer_comparisons)]
16#![allow(unused_imports)]
17#![allow(unused_mut)]
18#![allow(unused_unsafe)]
19#![allow(unused_variables)]
20
21include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
22
23include!(concat!(env!("OUT_DIR"), "/macro_bindings.rs"));
24
25#[cfg(perlapi_ver40)]
26pub type perl_stack_size_t = isize;
27
28#[cfg(not(perlapi_ver40))]
29pub type perl_stack_size_t = i32;
30
31// Compat: `Stack_off_t` first appeared in the perl 5.40 stack refactor;
32// before that the mark stack was plain `I32`. Alias it on older perls so
33// downstream code can use `Stack_off_t` uniformly across versions
34// (bindgen emits the real typedef on 5.40+).
35#[cfg(not(perlapi_ver40))]
36pub type Stack_off_t = I32;
37
38// Compat: perl 5.31.x renamed the inline refcount helper `S_SvREFCNT_dec`
39// to `Perl_SvREFCNT_dec`, so the `Perl_` name only exists from 5.32 on.
40// On 5.28/5.30 macrogen generates `S_SvREFCNT_dec` with the identical
41// signature (libperl-macrogen apidoc data 1.14); alias it so downstream
42// code can call `Perl_SvREFCNT_dec` uniformly across versions. Gated to
43// >= 5.28 because older perls don't generate `S_SvREFCNT_dec` yet.
44#[cfg(all(perlapi_ver28, not(perlapi_ver32)))]
45pub use self::S_SvREFCNT_dec as Perl_SvREFCNT_dec;
46
47// Compat: on perl 5.28/5.30 the current libperl-macrogen apidoc data
48// suppresses codegen for the Padname* / Padnamelist* accessors
49// ("[CODEGEN_SUPPRESSED] (apidoc patch)"), so they are missing from
50// macro_bindings.rs there. The underlying struct fields are identical
51// to 5.32+, so mirror the bodies macrogen emits on 5.32-5.44 until a
52// future unskip round lifts the suppression. `isize` matches the
53// generated `ssize_t` return type (that libc alias itself is absent
54// from the 5.28/5.30 bindgen output).
55#[cfg(all(perlapi_ver28, not(perlapi_ver32)))]
56pub unsafe fn PadnamelistMAX(pnl: *const PADNAMELIST) -> isize {
57    unsafe { (*pnl).xpadnl_fill }
58}
59
60#[cfg(all(perlapi_ver28, not(perlapi_ver32)))]
61pub unsafe fn PadnamelistARRAY(pnl: *const PADNAMELIST) -> *mut *mut PADNAME {
62    unsafe { (*pnl).xpadnl_alloc }
63}
64
65#[cfg(all(perlapi_ver28, not(perlapi_ver32)))]
66pub unsafe fn PadnamePV(pn: *mut PADNAME) -> *mut ::std::os::raw::c_char {
67    unsafe { (*pn).xpadn_pv }
68}
69
70#[cfg(all(perlapi_ver28, not(perlapi_ver32)))]
71pub unsafe fn PadnameLEN(pn: *mut PADNAME) -> STRLEN {
72    unsafe { (*pn).xpadn_len as STRLEN }
73}
74
75#[cfg(all(perlapi_ver28, not(perlapi_ver32)))]
76pub unsafe fn PadnameTYPE(pn: *mut PADNAME) -> *mut HV {
77    unsafe { (*pn).xpadn_type_u.xpadn_typestash }
78}