Debian Codegraph @

lib/FFI/Platypus.xs

raw
1 #include "EXTERN.h"
2 #include "perl.h"
3 #include "XSUB.h"
4 #include "ppport.h"
5 #include "ffi_platypus.h"
6 #include "ffi_platypus_guts.h"
7 #include "perl_math_int64.h"
8
9 #define MY_CXT_KEY "FFI::Platypus::_guts" XS_VERSION
10
11 typedef struct {
12 ffi_pl_arguments *current_argv;
13 /*
14 * 0 not loaded
15 * 1 loaded ok
16 * 2 attempted load, but errored
17 */
18 int loaded_math_longdouble;
19 AV* custom_keepers;
20 } my_cxt_t;
21
22 START_MY_CXT
23
24 XS(ffi_pl_sub_call)
25 {
26 ffi_pl_function *self;
27 int i,n, perl_arg_index;
28 SV *arg;
29 ffi_pl_arguments *arguments;
30 void **argument_pointers;
31
32 dMY_CXT;
33 dVAR; dXSARGS;
34
35 self = (ffi_pl_function*) CvXSUBANY(cv).any_ptr;
36
37 {
38 #define EXTRA_ARGS 0
39 #define FFI_PL_CALL_NO_RECORD_VALUE 1
40 #include "ffi_platypus_call.h"
41 }
42 }
43
44 XS(ffi_pl_sub_call_rv)
45 {
46 ffi_pl_function *self;
47 int i,n, perl_arg_index;
48 SV *arg;
49 ffi_pl_arguments *arguments;
50 void **argument_pointers;
51
52 dMY_CXT;
53 dVAR; dXSARGS;
54
55 self = (ffi_pl_function*) CvXSUBANY(cv).any_ptr;
56
57 {
58 #define EXTRA_ARGS 0
59 #define FFI_PL_CALL_RET_NO_NORMAL 1
60 #include "ffi_platypus_call.h"
61 }
62 }
63
64 MODULE = FFI::Platypus PACKAGE = FFI::Platypus
65
66 BOOT:
67 {
68 HV *stash;
69 MY_CXT_INIT;
70 MY_CXT.current_argv = NULL;
71 MY_CXT.loaded_math_longdouble = 0;
72 MY_CXT.custom_keepers = get_av("FFI::Platypus::keep", GV_ADD);
73 PERL_MATH_INT64_LOAD_OR_CROAK;
74
75 stash = gv_stashpv("FFI::Platypus", TRUE);
76 newCONSTSUB(stash, "_cast0", newSVuv(PTR2UV(cast0)));
77 newCONSTSUB(stash, "_cast1", newSVuv(PTR2UV(cast1)));
78 }
79
80 void
81 CLONE(...)
82 CODE:
83 MY_CXT_CLONE;
84 MY_CXT.custom_keepers = get_av("FFI::Platypus::keep", GV_ADD);
85
86 INCLUDE: ../../xs/DL.xs
87 INCLUDE: ../../xs/Internal.xs
88 INCLUDE: ../../xs/Type.xs
89 INCLUDE: ../../xs/TypeParser.xs
90 INCLUDE: ../../xs/Function.xs
91 INCLUDE: ../../xs/ClosureData.xs
92 INCLUDE: ../../xs/API.xs
93 INCLUDE: ../../xs/ABI.xs
94 INCLUDE: ../../xs/Record.xs
95 INCLUDE: ../../xs/Closure.xs
96 INCLUDE: ../../xs/Buffer.xs
97