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: enum_names |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# WRITTEN BY: Marcus Holland-Moritz ON: Jan 2002 |
15
|
|
|
|
|
|
|
# CHANGED BY: ON: |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
################################################################################ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
void |
20
|
|
|
|
|
|
|
CBC::enum_names() |
21
|
|
|
|
|
|
|
PREINIT: |
22
|
58
|
|
|
|
|
|
CBC_METHOD(enum_names); |
23
|
|
|
|
|
|
|
ListIterator li; |
24
|
|
|
|
|
|
|
EnumSpecifier *pEnumSpec; |
25
|
58
|
|
|
|
|
|
int count = 0; |
26
|
|
|
|
|
|
|
U32 context; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
PPCODE: |
29
|
|
|
|
|
|
|
CT_DEBUG_METHOD; |
30
|
|
|
|
|
|
|
|
31
|
58
|
100
|
|
|
|
|
CHECK_PARSE_DATA; |
32
|
52
|
100
|
|
|
|
|
CHECK_VOID_CONTEXT; |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
46
|
50
|
|
|
|
|
context = GIMME_V; |
35
|
|
|
|
|
|
|
|
36
|
292
|
100
|
|
|
|
|
LL_foreach(pEnumSpec, li, THIS->cpi.enums) |
|
|
100
|
|
|
|
|
|
37
|
246
|
100
|
|
|
|
|
if (pEnumSpec->identifier[0] && pEnumSpec->enumerators) |
|
|
100
|
|
|
|
|
|
38
|
|
|
|
|
|
|
{ |
39
|
34
|
100
|
|
|
|
|
if (context == G_ARRAY) |
40
|
27
|
50
|
|
|
|
|
XPUSHs(sv_2mortal(newSVpv(pEnumSpec->identifier, 0))); |
41
|
34
|
|
|
|
|
|
count++; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
46
|
100
|
|
|
|
|
if (context == G_ARRAY) |
45
|
39
|
|
|
|
|
|
XSRETURN(count); |
46
|
|
|
|
|
|
|
else |
47
|
52
|
|
|
|
|
|
XSRETURN_IV(count); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
################################################################################ |
51
|
|
|
|
|
|
|
# |
52
|
|
|
|
|
|
|
# METHOD: enum |
53
|
|
|
|
|
|
|
# |
54
|
|
|
|
|
|
|
# WRITTEN BY: Marcus Holland-Moritz ON: Jan 2002 |
55
|
|
|
|
|
|
|
# CHANGED BY: ON: |
56
|
|
|
|
|
|
|
# |
57
|
|
|
|
|
|
|
################################################################################ |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
void |
60
|
|
|
|
|
|
|
CBC::enum(...) |
61
|
|
|
|
|
|
|
PREINIT: |
62
|
88
|
|
|
|
|
|
CBC_METHOD(enum); |
63
|
|
|
|
|
|
|
EnumSpecifier *pEnumSpec; |
64
|
|
|
|
|
|
|
U32 context; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
PPCODE: |
67
|
|
|
|
|
|
|
CT_DEBUG_METHOD; |
68
|
|
|
|
|
|
|
|
69
|
88
|
100
|
|
|
|
|
CHECK_PARSE_DATA; |
70
|
82
|
100
|
|
|
|
|
CHECK_VOID_CONTEXT; |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
76
|
50
|
|
|
|
|
context = GIMME_V; |
73
|
|
|
|
|
|
|
|
74
|
76
|
100
|
|
|
|
|
if (context == G_SCALAR && items != 2) |
|
|
100
|
|
|
|
|
|
75
|
7
|
50
|
|
|
|
|
XSRETURN_IV(items > 1 ? items-1 : LL_count(THIS->cpi.enums)); |
76
|
|
|
|
|
|
|
|
77
|
69
|
100
|
|
|
|
|
if (items > 1) |
78
|
|
|
|
|
|
|
{ |
79
|
|
|
|
|
|
|
int i; |
80
|
|
|
|
|
|
|
|
81
|
80
|
100
|
|
|
|
|
for (i = 1; i < items; i++) |
82
|
|
|
|
|
|
|
{ |
83
|
44
|
50
|
|
|
|
|
const char *name = SvPV_nolen(ST(i)); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
/* skip optional enum */ |
86
|
44
|
100
|
|
|
|
|
if (name[0] == 'e' && |
|
|
50
|
|
|
|
|
|
87
|
20
|
50
|
|
|
|
|
name[1] == 'n' && |
88
|
20
|
100
|
|
|
|
|
name[2] == 'u' && |
89
|
13
|
50
|
|
|
|
|
name[3] == 'm' && |
90
|
13
|
|
|
|
|
|
isSPACE(name[4])) |
91
|
13
|
|
|
|
|
|
name += 5; |
92
|
|
|
|
|
|
|
|
93
|
49
|
100
|
|
|
|
|
while (isSPACE(*name)) |
94
|
5
|
|
|
|
|
|
name++; |
95
|
|
|
|
|
|
|
|
96
|
44
|
|
|
|
|
|
pEnumSpec = HT_get(THIS->cpi.htEnums, name, 0, 0); |
97
|
|
|
|
|
|
|
|
98
|
44
|
100
|
|
|
|
|
if (pEnumSpec) |
99
|
24
|
|
|
|
|
|
PUSHs(sv_2mortal(get_enum_spec_def(aTHX_ &THIS->cfg, pEnumSpec))); |
100
|
|
|
|
|
|
|
else |
101
|
20
|
|
|
|
|
|
PUSHs(&PL_sv_undef); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
36
|
|
|
|
|
|
XSRETURN(items-1); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
else |
107
|
|
|
|
|
|
|
{ |
108
|
|
|
|
|
|
|
ListIterator li; |
109
|
33
|
|
|
|
|
|
int size = LL_count(THIS->cpi.enums); |
110
|
|
|
|
|
|
|
|
111
|
33
|
100
|
|
|
|
|
if (size <= 0) |
112
|
12
|
|
|
|
|
|
XSRETURN_EMPTY; |
113
|
|
|
|
|
|
|
|
114
|
21
|
50
|
|
|
|
|
EXTEND(SP, size); |
|
|
50
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
86
|
100
|
|
|
|
|
LL_foreach(pEnumSpec, li, THIS->cpi.enums) |
|
|
100
|
|
|
|
|
|
117
|
65
|
|
|
|
|
|
PUSHs(sv_2mortal(get_enum_spec_def(aTHX_ &THIS->cfg, pEnumSpec))); |
118
|
|
|
|
|
|
|
|
119
|
33
|
|
|
|
|
|
XSRETURN(size); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|