| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#include "Sv.h" |
|
2
|
|
|
|
|
|
|
#include "Sub.h" |
|
3
|
|
|
|
|
|
|
#include "Simple.h" |
|
4
|
|
|
|
|
|
|
#include |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
namespace xs { |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
static Sv::payload_marker_t _default_marker; |
|
9
|
98
|
|
|
|
|
|
Sv::payload_marker_t* Sv::default_marker() { return &_default_marker; } |
|
10
|
|
|
|
|
|
|
|
|
11
|
36
|
|
|
|
|
|
const Sv Sv::undef(&PL_sv_undef); |
|
12
|
36
|
|
|
|
|
|
const Sv Sv::yes(&PL_sv_yes); |
|
13
|
36
|
|
|
|
|
|
const Sv Sv::no(&PL_sv_no); |
|
14
|
|
|
|
|
|
|
|
|
15
|
45
|
|
|
|
|
|
MAGIC* Sv::payload_attach (void* ptr, SV* obj, const payload_marker_t* marker) { |
|
16
|
45
|
50
|
|
|
|
|
upgrade(SVt_PVMG); |
|
17
|
|
|
|
|
|
|
MAGIC* mg; |
|
18
|
45
|
50
|
|
|
|
|
Newx(mg, 1, MAGIC); |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
19
|
45
|
|
|
|
|
|
mg->mg_moremagic = SvMAGIC(sv); |
|
20
|
45
|
|
|
|
|
|
SvMAGIC_set(sv, mg); |
|
21
|
45
|
|
|
|
|
|
mg->mg_virtual = const_cast(marker); |
|
22
|
45
|
|
|
|
|
|
mg->mg_type = PERL_MAGIC_ext; |
|
23
|
45
|
|
|
|
|
|
mg->mg_len = 0; |
|
24
|
45
|
|
|
|
|
|
mg->mg_ptr = (char*)ptr; |
|
25
|
45
|
|
|
|
|
|
mg->mg_private = 0; |
|
26
|
|
|
|
|
|
|
|
|
27
|
45
|
100
|
|
|
|
|
if (obj) { |
|
28
|
8
|
|
|
|
|
|
mg->mg_obj = SvREFCNT_inc_simple_NN(obj); |
|
29
|
8
|
|
|
|
|
|
mg->mg_flags = MGf_REFCOUNTED; |
|
30
|
|
|
|
|
|
|
} else { |
|
31
|
37
|
|
|
|
|
|
mg->mg_obj = NULL; |
|
32
|
37
|
|
|
|
|
|
mg->mg_flags = 0; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
#ifdef USE_ITHREADS |
|
36
|
|
|
|
|
|
|
if (marker->svt_dup) mg->mg_flags |= MGf_DUP; |
|
37
|
|
|
|
|
|
|
#endif |
|
38
|
|
|
|
|
|
|
|
|
39
|
45
|
|
|
|
|
|
return mg; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
36
|
|
|
|
|
|
void Sv::__at_perl_destroy () { |
|
43
|
36
|
|
|
|
|
|
const_cast(&undef)->reset(); |
|
44
|
36
|
|
|
|
|
|
const_cast(&yes)->reset(); |
|
45
|
36
|
|
|
|
|
|
const_cast(&no)->reset(); |
|
46
|
36
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
1332
|
|
|
|
|
|
std::ostream& operator<< (std::ostream& os, const Sv& sv) { |
|
49
|
1332
|
|
|
|
|
|
SV* v = sv; |
|
50
|
1332
|
100
|
|
|
|
|
if (!v) return os << (void*)nullptr; |
|
|
|
50
|
|
|
|
|
|
|
51
|
1305
|
|
|
|
|
|
switch (sv.type()) { |
|
52
|
76
|
50
|
|
|
|
|
case SVt_NULL: return os << ""; |
|
53
|
133
|
50
|
|
|
|
|
case SVt_PVAV: return os << "array(" << (void*)v << ')'; |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
54
|
223
|
50
|
|
|
|
|
case SVt_PVHV: return os << "hash(" << (void*)v << ')'; |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
55
|
0
|
0
|
|
|
|
|
case SVt_PVFM: return os << "format(" << (void*)v << ')'; |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
default: |
|
57
|
|
|
|
|
|
|
STRLEN len; |
|
58
|
873
|
100
|
|
|
|
|
auto s = SvPV(v, len); |
|
|
|
50
|
|
|
|
|
|
|
59
|
1332
|
50
|
|
|
|
|
return os.write(s, len); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
144
|
50
|
|
|
|
|
} |
|
|
|
50
|
|
|
|
|
|