line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ExtUtils::ParseXS::Eval; |
2
|
18
|
|
|
18
|
|
157
|
use strict; |
|
18
|
|
|
|
|
37
|
|
|
18
|
|
|
|
|
593
|
|
3
|
18
|
|
|
18
|
|
97
|
use warnings; |
|
18
|
|
|
|
|
33
|
|
|
18
|
|
|
|
|
4994
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '3.43_02'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
ExtUtils::ParseXS::Eval - Clean package to evaluate code in |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use ExtUtils::ParseXS::Eval; |
14
|
|
|
|
|
|
|
my $rv = ExtUtils::ParseXS::Eval::eval_typemap_code( |
15
|
|
|
|
|
|
|
$parsexs_obj, "some Perl code" |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SUBROUTINES |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 $pxs->eval_output_typemap_code($typemapcode, $other_hashref) |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Sets up various bits of previously global state |
23
|
|
|
|
|
|
|
(formerly ExtUtils::ParseXS package variables) |
24
|
|
|
|
|
|
|
for eval'ing output typemap code that may refer to these |
25
|
|
|
|
|
|
|
variables. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Warns the contents of C<$@> if any. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Not all these variables are necessarily considered "public" wrt. use in |
30
|
|
|
|
|
|
|
typemaps, so beware. Variables set up from the ExtUtils::ParseXS object: |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$Package $ALIAS $func_name $Full_func_name $pname |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Variables set up from C<$other_hashref>: |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$var $type $ntype $subtype $arg |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub eval_output_typemap_code { |
41
|
66
|
|
|
66
|
1
|
133
|
my ($_pxs, $_code, $_other) = @_; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my ($Package, $ALIAS, $func_name, $Full_func_name, $pname) |
44
|
66
|
|
|
|
|
111
|
= @{$_pxs}{qw(Package ALIAS func_name Full_func_name pname)}; |
|
66
|
|
|
|
|
219
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my ($var, $type, $ntype, $subtype, $arg) |
47
|
66
|
|
|
|
|
145
|
= @{$_other}{qw(var type ntype subtype arg)}; |
|
66
|
|
|
|
|
159
|
|
48
|
|
|
|
|
|
|
|
49
|
66
|
|
|
|
|
4484
|
my $rv = eval $_code; |
50
|
66
|
50
|
|
|
|
354
|
warn $@ if $@; |
51
|
66
|
|
|
|
|
241
|
return $rv; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 $pxs->eval_input_typemap_code($typemapcode, $other_hashref) |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Sets up various bits of previously global state |
57
|
|
|
|
|
|
|
(formerly ExtUtils::ParseXS package variables) |
58
|
|
|
|
|
|
|
for eval'ing output typemap code that may refer to these |
59
|
|
|
|
|
|
|
variables. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Warns the contents of C<$@> if any. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Not all these variables are necessarily considered "public" wrt. use in |
64
|
|
|
|
|
|
|
typemaps, so beware. Variables set up from the ExtUtils::ParseXS object: |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$Package $ALIAS $func_name $Full_func_name $pname |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Variables set up from C<$other_hashref>: |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$var $type $ntype $subtype $num $init $printed_name $arg $argoff |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub eval_input_typemap_code { |
75
|
53
|
|
|
53
|
1
|
108
|
my ($_pxs, $_code, $_other) = @_; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my ($Package, $ALIAS, $func_name, $Full_func_name, $pname) |
78
|
53
|
|
|
|
|
98
|
= @{$_pxs}{qw(Package ALIAS func_name Full_func_name pname)}; |
|
53
|
|
|
|
|
198
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my ($var, $type, $num, $init, $printed_name, $arg, $ntype, $argoff, $subtype) |
81
|
53
|
|
|
|
|
96
|
= @{$_other}{qw(var type num init printed_name arg ntype argoff subtype)}; |
|
53
|
|
|
|
|
182
|
|
82
|
|
|
|
|
|
|
|
83
|
53
|
|
|
|
|
4531
|
my $rv = eval $_code; |
84
|
53
|
50
|
|
|
|
537
|
warn $@ if $@; |
85
|
53
|
|
|
|
|
337
|
return $rv; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 TODO |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Eventually, with better documentation and possible some cleanup, |
91
|
|
|
|
|
|
|
this could be part of C. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# vim: ts=2 sw=2 et: |