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: macro_names |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# WRITTEN BY: Marcus Holland-Moritz ON: Feb 2006 |
15
|
|
|
|
|
|
|
# CHANGED BY: ON: |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
################################################################################ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
void |
20
|
|
|
|
|
|
|
CBC::macro_names() |
21
|
|
|
|
|
|
|
PREINIT: |
22
|
25
|
|
|
|
|
|
CBC_METHOD(macro_names); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
PPCODE: |
25
|
|
|
|
|
|
|
CT_DEBUG_METHOD; |
26
|
|
|
|
|
|
|
|
27
|
25
|
100
|
|
|
|
|
CHECK_PARSE_DATA; |
28
|
19
|
100
|
|
|
|
|
CHECK_VOID_CONTEXT; |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
13
|
50
|
|
|
|
|
if (GIMME_V == G_ARRAY) |
|
|
100
|
|
|
|
|
|
31
|
|
|
|
|
|
|
{ |
32
|
7
|
|
|
|
|
|
LinkedList ll = macros_get_names(aTHX_ &THIS->cpi, NULL); |
33
|
7
|
|
|
|
|
|
int count = LL_count(ll); |
34
|
|
|
|
|
|
|
SV *sv; |
35
|
|
|
|
|
|
|
|
36
|
7
|
50
|
|
|
|
|
EXTEND(SP, count); |
|
|
50
|
|
|
|
|
|
37
|
2311
|
100
|
|
|
|
|
while ((sv = LL_pop(ll)) != NULL) |
38
|
2304
|
|
|
|
|
|
PUSHs(sv_2mortal(sv)); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
assert(LL_count(ll) == 0); |
41
|
7
|
|
|
|
|
|
LL_delete(ll); |
42
|
|
|
|
|
|
|
|
43
|
7
|
|
|
|
|
|
XSRETURN(count); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else |
46
|
|
|
|
|
|
|
{ |
47
|
|
|
|
|
|
|
size_t count; |
48
|
6
|
|
|
|
|
|
(void) macros_get_names(aTHX_ &THIS->cpi, &count); |
49
|
6
|
|
|
|
|
|
XSRETURN_IV((int)count); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
################################################################################ |
53
|
|
|
|
|
|
|
# |
54
|
|
|
|
|
|
|
# METHOD: macro |
55
|
|
|
|
|
|
|
# |
56
|
|
|
|
|
|
|
# WRITTEN BY: Marcus Holland-Moritz ON: Feb 2006 |
57
|
|
|
|
|
|
|
# CHANGED BY: ON: |
58
|
|
|
|
|
|
|
# |
59
|
|
|
|
|
|
|
################################################################################ |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
void |
62
|
|
|
|
|
|
|
CBC::macro(...) |
63
|
|
|
|
|
|
|
PREINIT: |
64
|
3095
|
|
|
|
|
|
CBC_METHOD(macro); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
PPCODE: |
67
|
|
|
|
|
|
|
CT_DEBUG_METHOD; |
68
|
|
|
|
|
|
|
|
69
|
3095
|
100
|
|
|
|
|
CHECK_PARSE_DATA; |
70
|
3089
|
100
|
|
|
|
|
CHECK_VOID_CONTEXT; |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
3083
|
50
|
|
|
|
|
if (GIMME_V == G_SCALAR && items != 2) |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
73
|
|
|
|
|
|
|
{ |
74
|
7
|
100
|
|
|
|
|
if (items > 1) |
75
|
|
|
|
|
|
|
{ |
76
|
1
|
|
|
|
|
|
XSRETURN_IV(items-1); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
else |
79
|
|
|
|
|
|
|
{ |
80
|
|
|
|
|
|
|
size_t count; |
81
|
6
|
|
|
|
|
|
(void) macros_get_names(aTHX_ &THIS->cpi, &count); |
82
|
6
|
|
|
|
|
|
XSRETURN_IV((int)count); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
3076
|
100
|
|
|
|
|
if (items > 1) |
87
|
|
|
|
|
|
|
{ |
88
|
|
|
|
|
|
|
int i; |
89
|
|
|
|
|
|
|
|
90
|
6160
|
100
|
|
|
|
|
for (i = 1; i < items; i++) |
91
|
|
|
|
|
|
|
{ |
92
|
3086
|
50
|
|
|
|
|
const char *name = SvPV_nolen(ST(i)); |
93
|
|
|
|
|
|
|
size_t len; |
94
|
3086
|
|
|
|
|
|
char *def = macro_get_def(&THIS->cpi, name, &len); |
95
|
|
|
|
|
|
|
|
96
|
3086
|
100
|
|
|
|
|
if (def) |
97
|
|
|
|
|
|
|
{ |
98
|
3066
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpvn(def, len))); |
99
|
3066
|
|
|
|
|
|
macro_free_def(def); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
else |
102
|
20
|
|
|
|
|
|
PUSHs(&PL_sv_undef); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
3074
|
|
|
|
|
|
XSRETURN(items-1); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
else |
108
|
|
|
|
|
|
|
{ |
109
|
2
|
|
|
|
|
|
LinkedList ll = macros_get_definitions(aTHX_ &THIS->cpi); |
110
|
2
|
|
|
|
|
|
int count = LL_count(ll); |
111
|
|
|
|
|
|
|
SV *sv; |
112
|
|
|
|
|
|
|
|
113
|
2
|
50
|
|
|
|
|
EXTEND(SP, count); |
|
|
50
|
|
|
|
|
|
114
|
8
|
100
|
|
|
|
|
while ((sv = LL_pop(ll)) != NULL) |
115
|
6
|
|
|
|
|
|
PUSHs(sv_2mortal(sv)); |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
assert(LL_count(ll) == 0); |
118
|
2
|
|
|
|
|
|
LL_delete(ll); |
119
|
|
|
|
|
|
|
|
120
|
2
|
|
|
|
|
|
XSRETURN(count); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|