| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
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
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
SV* |
|
9
|
234
|
|
|
|
|
|
ffi_pl_custom_perl(SV *subref, SV *in_arg, int i) |
|
10
|
|
|
|
|
|
|
{ |
|
11
|
234
|
100
|
|
|
|
|
if(subref == NULL) |
|
12
|
|
|
|
|
|
|
{ |
|
13
|
37
|
|
|
|
|
|
return newSVsv(in_arg); |
|
14
|
|
|
|
|
|
|
} |
|
15
|
|
|
|
|
|
|
else |
|
16
|
|
|
|
|
|
|
{ |
|
17
|
197
|
|
|
|
|
|
dSP; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
int count; |
|
20
|
|
|
|
|
|
|
SV *out_arg; |
|
21
|
|
|
|
|
|
|
|
|
22
|
197
|
|
|
|
|
|
ENTER; |
|
23
|
197
|
|
|
|
|
|
SAVETMPS; |
|
24
|
197
|
50
|
|
|
|
|
PUSHMARK(SP); |
|
25
|
197
|
50
|
|
|
|
|
XPUSHs(in_arg); |
|
26
|
197
|
50
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(i))); |
|
27
|
197
|
|
|
|
|
|
PUTBACK; |
|
28
|
|
|
|
|
|
|
|
|
29
|
197
|
|
|
|
|
|
count = call_sv(subref, G_ARRAY); |
|
30
|
|
|
|
|
|
|
|
|
31
|
183
|
|
|
|
|
|
SPAGAIN; |
|
32
|
|
|
|
|
|
|
|
|
33
|
183
|
100
|
|
|
|
|
if(count >= 1) |
|
34
|
174
|
|
|
|
|
|
out_arg = SvREFCNT_inc(POPs); |
|
35
|
|
|
|
|
|
|
else |
|
36
|
9
|
|
|
|
|
|
out_arg = NULL; |
|
37
|
|
|
|
|
|
|
|
|
38
|
183
|
|
|
|
|
|
PUTBACK; |
|
39
|
183
|
50
|
|
|
|
|
FREETMPS; |
|
40
|
183
|
|
|
|
|
|
LEAVE; |
|
41
|
|
|
|
|
|
|
|
|
42
|
183
|
|
|
|
|
|
return out_arg; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
void |
|
47
|
85
|
|
|
|
|
|
ffi_pl_custom_perl_cb(SV *subref, SV *in_arg, int i) |
|
48
|
|
|
|
|
|
|
{ |
|
49
|
85
|
|
|
|
|
|
dSP; |
|
50
|
85
|
|
|
|
|
|
ENTER; |
|
51
|
85
|
|
|
|
|
|
SAVETMPS; |
|
52
|
85
|
50
|
|
|
|
|
PUSHMARK(SP); |
|
53
|
85
|
50
|
|
|
|
|
XPUSHs(in_arg); |
|
54
|
85
|
50
|
|
|
|
|
XPUSHs(sv_2mortal(newSViv(i))); |
|
55
|
85
|
|
|
|
|
|
PUTBACK; |
|
56
|
85
|
|
|
|
|
|
call_sv(subref, G_VOID|G_DISCARD); |
|
57
|
84
|
50
|
|
|
|
|
FREETMPS; |
|
58
|
84
|
|
|
|
|
|
LEAVE; |
|
59
|
84
|
|
|
|
|
|
} |