line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
################################################################################ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 2002-2020 Marcus Holland-Moritz. All rights reserved. |
4
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify |
5
|
|
|
|
|
|
|
# it under the same terms as Perl itself. |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
################################################################################ |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
################################################################################ |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# METHOD: member |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# WRITTEN BY: Marcus Holland-Moritz ON: Jan 2002 |
15
|
|
|
|
|
|
|
# CHANGED BY: ON: |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
################################################################################ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
void |
20
|
|
|
|
|
|
|
CBC::member(type, offset = NULL) |
21
|
|
|
|
|
|
|
const char *type |
22
|
|
|
|
|
|
|
SV *offset |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
PREINIT: |
25
|
48702
|
|
|
|
|
|
CBC_METHOD(member); |
26
|
|
|
|
|
|
|
MemberInfo mi; |
27
|
|
|
|
|
|
|
int have_offset, off; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
PPCODE: |
30
|
48702
|
100
|
|
|
|
|
off = (have_offset = DEFINED(offset)) ? SvIV(offset) : 0; |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
CT_DEBUG_METHOD2("'%s', %d", type, off); |
33
|
|
|
|
|
|
|
|
34
|
48702
|
100
|
|
|
|
|
CHECK_PARSE_DATA; |
35
|
48690
|
100
|
|
|
|
|
CHECK_VOID_CONTEXT; |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
48678
|
50
|
|
|
|
|
NEED_PARSE_DATA; |
|
|
100
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
48678
|
100
|
|
|
|
|
if (!get_member_info(aTHX_ THIS, type, &mi, 0)) |
40
|
24
|
|
|
|
|
|
Perl_croak(aTHX_ "Cannot find '%s'", type); |
41
|
|
|
|
|
|
|
|
42
|
48606
|
|
|
|
|
|
check_allowed_types(aTHX_ &mi, method, ALLOW_STRUCTS |
43
|
|
|
|
|
|
|
| ALLOW_UNIONS |
44
|
|
|
|
|
|
|
| ALLOW_ARRAYS); |
45
|
|
|
|
|
|
|
|
46
|
48522
|
100
|
|
|
|
|
if (mi.flags) |
47
|
|
|
|
|
|
|
{ |
48
|
24
|
|
|
|
|
|
u_32 flags = mi.flags; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
/* bitfields are not a problem without offset given */ |
51
|
24
|
100
|
|
|
|
|
if (!have_offset) |
52
|
12
|
|
|
|
|
|
flags &= ~T_HASBITFIELD; |
53
|
|
|
|
|
|
|
|
54
|
24
|
100
|
|
|
|
|
WARN_FLAGS(type, flags); |
|
|
100
|
|
|
|
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
48522
|
100
|
|
|
|
|
if (have_offset) |
58
|
|
|
|
|
|
|
{ |
59
|
48430
|
100
|
|
|
|
|
if (off < 0 || off >= (int) mi.size) |
|
|
100
|
|
|
|
|
|
60
|
53
|
|
|
|
|
|
Perl_croak(aTHX_ "Offset %d out of range (0 <= offset < %d)", off, mi.size); |
61
|
|
|
|
|
|
|
|
62
|
48377
|
50
|
|
|
|
|
if (GIMME_V == G_ARRAY) |
|
|
100
|
|
|
|
|
|
63
|
|
|
|
|
|
|
{ |
64
|
|
|
|
|
|
|
ListIterator li; |
65
|
|
|
|
|
|
|
GMSInfo info; |
66
|
|
|
|
|
|
|
SV *member; |
67
|
|
|
|
|
|
|
int count; |
68
|
|
|
|
|
|
|
|
69
|
23154
|
|
|
|
|
|
info.hit = LL_new(); |
70
|
23154
|
|
|
|
|
|
info.off = LL_new(); |
71
|
23154
|
|
|
|
|
|
info.pad = LL_new(); |
72
|
|
|
|
|
|
|
|
73
|
23154
|
|
|
|
|
|
(void) get_member_string(aTHX_ &mi, off, &info); |
74
|
|
|
|
|
|
|
|
75
|
23154
|
|
|
|
|
|
count = LL_count(info.hit) |
76
|
23154
|
|
|
|
|
|
+ LL_count(info.off) |
77
|
23154
|
|
|
|
|
|
+ LL_count(info.pad); |
78
|
|
|
|
|
|
|
|
79
|
23154
|
50
|
|
|
|
|
EXTEND(SP, count); |
|
|
50
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
40233
|
100
|
|
|
|
|
LL_foreach(member, li, info.hit) |
|
|
100
|
|
|
|
|
|
82
|
17079
|
|
|
|
|
|
PUSHs(member); |
83
|
|
|
|
|
|
|
|
84
|
70596
|
100
|
|
|
|
|
LL_foreach(member, li, info.off) |
|
|
100
|
|
|
|
|
|
85
|
47442
|
|
|
|
|
|
PUSHs(member); |
86
|
|
|
|
|
|
|
|
87
|
27440
|
100
|
|
|
|
|
LL_foreach(member, li, info.pad) |
|
|
100
|
|
|
|
|
|
88
|
4286
|
|
|
|
|
|
PUSHs(member); |
89
|
|
|
|
|
|
|
|
90
|
23154
|
|
|
|
|
|
LL_destroy(info.hit, NULL); |
91
|
23154
|
|
|
|
|
|
LL_destroy(info.off, NULL); |
92
|
23154
|
|
|
|
|
|
LL_destroy(info.pad, NULL); |
93
|
|
|
|
|
|
|
|
94
|
23154
|
|
|
|
|
|
XSRETURN(count); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
else |
97
|
|
|
|
|
|
|
{ |
98
|
25223
|
|
|
|
|
|
SV *member = get_member_string(aTHX_ &mi, off, NULL); |
99
|
25223
|
|
|
|
|
|
PUSHs(member); |
100
|
25223
|
|
|
|
|
|
XSRETURN(1); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
else |
104
|
|
|
|
|
|
|
{ |
105
|
|
|
|
|
|
|
LinkedList list; |
106
|
|
|
|
|
|
|
SV *member; |
107
|
|
|
|
|
|
|
int count; |
108
|
|
|
|
|
|
|
|
109
|
92
|
50
|
|
|
|
|
list = GIMME_V == G_ARRAY ? LL_new() : NULL; |
|
|
100
|
|
|
|
|
|
110
|
92
|
|
|
|
|
|
count = get_all_member_strings(aTHX_ &mi, list); |
111
|
|
|
|
|
|
|
|
112
|
92
|
50
|
|
|
|
|
if (GIMME_V == G_ARRAY) |
|
|
100
|
|
|
|
|
|
113
|
|
|
|
|
|
|
{ |
114
|
|
|
|
|
|
|
ListIterator li; |
115
|
|
|
|
|
|
|
|
116
|
61
|
50
|
|
|
|
|
EXTEND(SP, count); |
|
|
50
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
17401
|
100
|
|
|
|
|
LL_foreach(member, li, list) |
|
|
100
|
|
|
|
|
|
119
|
17340
|
|
|
|
|
|
PUSHs(member); |
120
|
|
|
|
|
|
|
|
121
|
61
|
|
|
|
|
|
LL_destroy(list, NULL); |
122
|
|
|
|
|
|
|
|
123
|
61
|
|
|
|
|
|
XSRETURN(count); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
else |
126
|
48481
|
|
|
|
|
|
XSRETURN_IV(count); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|