line |
stmt |
bran |
cond |
sub |
time |
code |
1
|
|
|
|
|
|
BOOT: |
2
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
#ifdef dTHX |
4
|
|
|
|
|
|
dTHX; |
5
|
|
|
|
|
|
#endif |
6
|
5640
|
|
|
|
|
HV *symbol_table = get_hv("File::Glob::", GV_ADD); |
7
|
|
|
|
|
|
|
8
|
|
|
|
|
|
static const struct iv_s values_for_iv[] = |
9
|
|
|
|
|
|
{ |
10
|
|
|
|
|
|
#ifdef GLOB_ABEND |
11
|
|
|
|
|
|
{ "GLOB_ABEND", 10, GLOB_ABEND }, |
12
|
|
|
|
|
|
#endif |
13
|
|
|
|
|
|
#ifdef GLOB_ALPHASORT |
14
|
|
|
|
|
|
{ "GLOB_ALPHASORT", 14, GLOB_ALPHASORT }, |
15
|
|
|
|
|
|
#endif |
16
|
|
|
|
|
|
#ifdef GLOB_ALTDIRFUNC |
17
|
|
|
|
|
|
{ "GLOB_ALTDIRFUNC", 15, GLOB_ALTDIRFUNC }, |
18
|
|
|
|
|
|
#endif |
19
|
|
|
|
|
|
#ifdef GLOB_BRACE |
20
|
|
|
|
|
|
{ "GLOB_BRACE", 10, GLOB_BRACE }, |
21
|
|
|
|
|
|
#endif |
22
|
|
|
|
|
|
#ifdef GLOB_ERR |
23
|
|
|
|
|
|
{ "GLOB_ERR", 8, GLOB_ERR }, |
24
|
|
|
|
|
|
#endif |
25
|
|
|
|
|
|
#ifdef GLOB_LIMIT |
26
|
|
|
|
|
|
{ "GLOB_LIMIT", 10, GLOB_LIMIT }, |
27
|
|
|
|
|
|
#endif |
28
|
|
|
|
|
|
#ifdef GLOB_MARK |
29
|
|
|
|
|
|
{ "GLOB_MARK", 9, GLOB_MARK }, |
30
|
|
|
|
|
|
#endif |
31
|
|
|
|
|
|
#ifdef GLOB_NOCASE |
32
|
|
|
|
|
|
{ "GLOB_NOCASE", 11, GLOB_NOCASE }, |
33
|
|
|
|
|
|
#endif |
34
|
|
|
|
|
|
#ifdef GLOB_NOCHECK |
35
|
|
|
|
|
|
{ "GLOB_NOCHECK", 12, GLOB_NOCHECK }, |
36
|
|
|
|
|
|
#endif |
37
|
|
|
|
|
|
#ifdef GLOB_NOMAGIC |
38
|
|
|
|
|
|
{ "GLOB_NOMAGIC", 12, GLOB_NOMAGIC }, |
39
|
|
|
|
|
|
#endif |
40
|
|
|
|
|
|
#ifdef GLOB_NOSORT |
41
|
|
|
|
|
|
{ "GLOB_NOSORT", 11, GLOB_NOSORT }, |
42
|
|
|
|
|
|
#endif |
43
|
|
|
|
|
|
#ifdef GLOB_NOSPACE |
44
|
|
|
|
|
|
{ "GLOB_NOSPACE", 12, GLOB_NOSPACE }, |
45
|
|
|
|
|
|
#endif |
46
|
|
|
|
|
|
#ifdef GLOB_QUOTE |
47
|
|
|
|
|
|
{ "GLOB_QUOTE", 10, GLOB_QUOTE }, |
48
|
|
|
|
|
|
#endif |
49
|
|
|
|
|
|
#ifdef GLOB_TILDE |
50
|
|
|
|
|
|
{ "GLOB_TILDE", 10, GLOB_TILDE }, |
51
|
|
|
|
|
|
#endif |
52
|
|
|
|
|
|
{ "GLOB_CSH", 8, GLOB_BRACE|GLOB_NOMAGIC|GLOB_QUOTE|GLOB_TILDE|GLOB_ALPHASORT }, |
53
|
|
|
|
|
|
{ NULL, 0, 0 } }; |
54
|
|
|
|
|
|
const struct iv_s *value_for_iv = values_for_iv; |
55
|
95880
|
|
|
|
|
while (value_for_iv->name) { |
56
|
84600
|
|
|
|
|
constant_add_symbol(aTHX_ symbol_table, value_for_iv->name, |
57
|
|
|
|
|
|
value_for_iv->namelen, newSViv(value_for_iv->value)); |
58
|
84600
|
|
|
|
|
++value_for_iv; |
59
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
if (C_ARRAY_LENGTH(values_for_notfound) > 1) { |
61
|
|
|
|
|
|
#ifndef SYMBIAN |
62
|
|
|
|
|
|
HV *const constant_missing = get_missing_hash(aTHX); |
63
|
|
|
|
|
|
#endif |
64
|
|
|
|
|
|
const struct notfound_s *value_for_notfound = values_for_notfound; |
65
|
|
|
|
|
|
do { |
66
|
|
|
|
|
|
|
67
|
|
|
|
|
|
/* Need to add prototypes, else parsing will vary by platform. */ |
68
|
|
|
|
|
|
HE *he = (HE*) hv_common_key_len(symbol_table, |
69
|
|
|
|
|
|
value_for_notfound->name, |
70
|
|
|
|
|
|
value_for_notfound->namelen, |
71
|
|
|
|
|
|
HV_FETCH_LVALUE, NULL, 0); |
72
|
|
|
|
|
|
SV *sv; |
73
|
|
|
|
|
|
#ifndef SYMBIAN |
74
|
|
|
|
|
|
HEK *hek; |
75
|
|
|
|
|
|
#endif |
76
|
|
|
|
|
|
if (!he) { |
77
|
|
|
|
|
|
Perl_croak(aTHX_ |
78
|
|
|
|
|
|
"Couldn't add key '%s' to %%File::Glob::", |
79
|
|
|
|
|
|
value_for_notfound->name); |
80
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
sv = HeVAL(he); |
82
|
|
|
|
|
|
if (!SvOK(sv) && SvTYPE(sv) != SVt_PVGV) { |
83
|
|
|
|
|
|
/* Nothing was here before, so mark a prototype of "" */ |
84
|
|
|
|
|
|
sv_setpvn(sv, "", 0); |
85
|
|
|
|
|
|
} else if (SvPOK(sv) && SvCUR(sv) == 0) { |
86
|
|
|
|
|
|
/* There is already a prototype of "" - do nothing */ |
87
|
|
|
|
|
|
} else { |
88
|
|
|
|
|
|
/* Someone has been here before us - have to make a real |
89
|
|
|
|
|
|
typeglob. */ |
90
|
|
|
|
|
|
/* It turns out to be incredibly hard to deal with all the |
91
|
|
|
|
|
|
corner cases of sub foo (); and reporting errors correctly, |
92
|
|
|
|
|
|
so lets cheat a bit. Start with a constant subroutine */ |
93
|
|
|
|
|
|
CV *cv = newCONSTSUB(symbol_table, |
94
|
|
|
|
|
|
value_for_notfound->name, |
95
|
|
|
|
|
|
&PL_sv_yes); |
96
|
|
|
|
|
|
/* and then turn it into a non constant declaration only. */ |
97
|
|
|
|
|
|
SvREFCNT_dec(CvXSUBANY(cv).any_ptr); |
98
|
|
|
|
|
|
CvCONST_off(cv); |
99
|
|
|
|
|
|
CvXSUB(cv) = NULL; |
100
|
|
|
|
|
|
CvXSUBANY(cv).any_ptr = NULL; |
101
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
#ifndef SYMBIAN |
103
|
|
|
|
|
|
hek = HeKEY_hek(he); |
104
|
|
|
|
|
|
if (!hv_common(constant_missing, NULL, HEK_KEY(hek), |
105
|
|
|
|
|
|
HEK_LEN(hek), HEK_FLAGS(hek), HV_FETCH_ISSTORE, |
106
|
|
|
|
|
|
&PL_sv_yes, HEK_HASH(hek))) |
107
|
|
|
|
|
|
Perl_croak(aTHX_ "Couldn't add key '%s' to missing_hash", |
108
|
|
|
|
|
|
value_for_notfound->name); |
109
|
|
|
|
|
|
#endif |
110
|
|
|
|
|
|
} while ((++value_for_notfound)->name); |
111
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
/* As we've been creating subroutines, we better invalidate any cached |
113
|
|
|
|
|
|
methods */ |
114
|
5640
|
|
|
|
|
mro_method_changed_in(symbol_table); |
115
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
117
|
|
|
|
|
|
void |
118
|
|
|
|
|
|
AUTOLOAD() |
119
|
|
|
|
|
|
PROTOTYPE: DISABLE |
120
|
|
|
|
|
|
PREINIT: |
121
|
0
|
|
|
|
|
SV *sv = newSVpvn_flags(SvPVX(cv), SvCUR(cv), SVs_TEMP | SvUTF8(cv)); |
122
|
0
|
|
|
|
|
const COP *cop = PL_curcop; |
123
|
|
|
|
|
|
PPCODE: |
124
|
|
|
|
|
|
#ifndef SYMBIAN |
125
|
|
|
|
|
|
/* It's not obvious how to calculate this at C pre-processor time. |
126
|
|
|
|
|
|
However, any compiler optimiser worth its salt should be able to |
127
|
|
|
|
|
|
remove the dead code, and hopefully the now-obviously-unused static |
128
|
|
|
|
|
|
function too. */ |
129
|
|
|
|
|
|
HV *constant_missing = (C_ARRAY_LENGTH(values_for_notfound) > 1) |
130
|
|
|
|
|
|
? get_missing_hash(aTHX) : NULL; |
131
|
|
|
|
|
|
if ((C_ARRAY_LENGTH(values_for_notfound) > 1) |
132
|
|
|
|
|
|
? hv_exists_ent(constant_missing, sv, 0) : 0) { |
133
|
|
|
|
|
|
sv = newSVpvf("Your vendor has not defined File::Glob macro %" SVf |
134
|
|
|
|
|
|
", used at %" COP_FILE_F " line %d\n", sv, |
135
|
|
|
|
|
|
COP_FILE(cop), CopLINE(cop)); |
136
|
|
|
|
|
|
} else |
137
|
|
|
|
|
|
#endif |
138
|
|
|
|
|
|
{ |
139
|
0
|
|
|
|
|
sv = newSVpvf("%"SVf" is not a valid File::Glob macro at %" |
140
|
0
|
|
|
|
|
COP_FILE_F " line %d\n", sv, COP_FILE(cop), CopLINE(cop)); |
141
|
|
|
|
|
|
} |
142
|
0
|
|
|
|
|
croak_sv(sv_2mortal(sv)); |