line |
stmt |
bran |
cond |
sub |
time |
code |
1
|
|
|
|
|
|
BOOT: |
2
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
#ifdef dTHX |
4
|
|
|
|
|
|
dTHX; |
5
|
|
|
|
|
|
#endif |
6
|
176
|
|
|
|
|
HV *symbol_table = get_hv("XS::APItest::", GV_ADD); |
7
|
|
|
|
|
|
|
8
|
|
|
|
|
|
static const struct iv_s values_for_iv[] = |
9
|
|
|
|
|
|
{ |
10
|
|
|
|
|
|
#ifdef HV_DELETE |
11
|
|
|
|
|
|
{ "HV_DELETE", 9, HV_DELETE }, |
12
|
|
|
|
|
|
#endif |
13
|
|
|
|
|
|
#ifdef HV_DISABLE_UVAR_XKEY |
14
|
|
|
|
|
|
{ "HV_DISABLE_UVAR_XKEY", 20, HV_DISABLE_UVAR_XKEY }, |
15
|
|
|
|
|
|
#endif |
16
|
|
|
|
|
|
#ifdef HV_FETCH_ISSTORE |
17
|
|
|
|
|
|
{ "HV_FETCH_ISSTORE", 16, HV_FETCH_ISSTORE }, |
18
|
|
|
|
|
|
#endif |
19
|
|
|
|
|
|
#ifdef HV_FETCH_ISEXISTS |
20
|
|
|
|
|
|
{ "HV_FETCH_ISEXISTS", 17, HV_FETCH_ISEXISTS }, |
21
|
|
|
|
|
|
#endif |
22
|
|
|
|
|
|
#ifdef HV_FETCH_LVALUE |
23
|
|
|
|
|
|
{ "HV_FETCH_LVALUE", 15, HV_FETCH_LVALUE }, |
24
|
|
|
|
|
|
#endif |
25
|
|
|
|
|
|
#ifdef HV_FETCH_JUST_SV |
26
|
|
|
|
|
|
{ "HV_FETCH_JUST_SV", 16, HV_FETCH_JUST_SV }, |
27
|
|
|
|
|
|
#endif |
28
|
|
|
|
|
|
#ifdef G_SCALAR |
29
|
|
|
|
|
|
{ "G_SCALAR", 8, G_SCALAR }, |
30
|
|
|
|
|
|
#endif |
31
|
|
|
|
|
|
#ifdef G_ARRAY |
32
|
|
|
|
|
|
{ "G_ARRAY", 7, G_ARRAY }, |
33
|
|
|
|
|
|
#endif |
34
|
|
|
|
|
|
#ifdef G_VOID |
35
|
|
|
|
|
|
{ "G_VOID", 6, G_VOID }, |
36
|
|
|
|
|
|
#endif |
37
|
|
|
|
|
|
#ifdef G_DISCARD |
38
|
|
|
|
|
|
{ "G_DISCARD", 9, G_DISCARD }, |
39
|
|
|
|
|
|
#endif |
40
|
|
|
|
|
|
#ifdef G_EVAL |
41
|
|
|
|
|
|
{ "G_EVAL", 6, G_EVAL }, |
42
|
|
|
|
|
|
#endif |
43
|
|
|
|
|
|
#ifdef G_NOARGS |
44
|
|
|
|
|
|
{ "G_NOARGS", 8, G_NOARGS }, |
45
|
|
|
|
|
|
#endif |
46
|
|
|
|
|
|
#ifdef G_KEEPERR |
47
|
|
|
|
|
|
{ "G_KEEPERR", 9, G_KEEPERR }, |
48
|
|
|
|
|
|
#endif |
49
|
|
|
|
|
|
#ifdef G_NODEBUG |
50
|
|
|
|
|
|
{ "G_NODEBUG", 9, G_NODEBUG }, |
51
|
|
|
|
|
|
#endif |
52
|
|
|
|
|
|
#ifdef G_METHOD |
53
|
|
|
|
|
|
{ "G_METHOD", 8, G_METHOD }, |
54
|
|
|
|
|
|
#endif |
55
|
|
|
|
|
|
#ifdef G_FAKINGEVAL |
56
|
|
|
|
|
|
{ "G_FAKINGEVAL", 12, G_FAKINGEVAL }, |
57
|
|
|
|
|
|
#endif |
58
|
|
|
|
|
|
#ifdef IS_NUMBER_IN_UV |
59
|
|
|
|
|
|
{ "IS_NUMBER_IN_UV", 15, IS_NUMBER_IN_UV }, |
60
|
|
|
|
|
|
#endif |
61
|
|
|
|
|
|
#ifdef IS_NUMBER_GREATER_THAN_UV_MAX |
62
|
|
|
|
|
|
{ "IS_NUMBER_GREATER_THAN_UV_MAX", 29, IS_NUMBER_GREATER_THAN_UV_MAX }, |
63
|
|
|
|
|
|
#endif |
64
|
|
|
|
|
|
#ifdef IS_NUMBER_NOT_INT |
65
|
|
|
|
|
|
{ "IS_NUMBER_NOT_INT", 17, IS_NUMBER_NOT_INT }, |
66
|
|
|
|
|
|
#endif |
67
|
|
|
|
|
|
#ifdef IS_NUMBER_NEG |
68
|
|
|
|
|
|
{ "IS_NUMBER_NEG", 13, IS_NUMBER_NEG }, |
69
|
|
|
|
|
|
#endif |
70
|
|
|
|
|
|
#ifdef IS_NUMBER_INFINITY |
71
|
|
|
|
|
|
{ "IS_NUMBER_INFINITY", 18, IS_NUMBER_INFINITY }, |
72
|
|
|
|
|
|
#endif |
73
|
|
|
|
|
|
#ifdef IS_NUMBER_NAN |
74
|
|
|
|
|
|
{ "IS_NUMBER_NAN", 13, IS_NUMBER_NAN }, |
75
|
|
|
|
|
|
#endif |
76
|
|
|
|
|
|
#ifdef G_WANT |
77
|
|
|
|
|
|
{ "G_WANT", 6, G_WANT }, |
78
|
|
|
|
|
|
#endif |
79
|
|
|
|
|
|
{ "fallback_amg", 12, fallback_amg }, |
80
|
|
|
|
|
|
{ "to_sv_amg", 9, to_sv_amg }, |
81
|
|
|
|
|
|
{ "to_av_amg", 9, to_av_amg }, |
82
|
|
|
|
|
|
{ "to_hv_amg", 9, to_hv_amg }, |
83
|
|
|
|
|
|
{ "to_gv_amg", 9, to_gv_amg }, |
84
|
|
|
|
|
|
{ "to_cv_amg", 9, to_cv_amg }, |
85
|
|
|
|
|
|
{ "inc_amg", 7, inc_amg }, |
86
|
|
|
|
|
|
{ "dec_amg", 7, dec_amg }, |
87
|
|
|
|
|
|
{ "bool__amg", 9, bool__amg }, |
88
|
|
|
|
|
|
{ "numer_amg", 9, numer_amg }, |
89
|
|
|
|
|
|
{ "string_amg", 10, string_amg }, |
90
|
|
|
|
|
|
{ "not_amg", 7, not_amg }, |
91
|
|
|
|
|
|
{ "copy_amg", 8, copy_amg }, |
92
|
|
|
|
|
|
{ "abs_amg", 7, abs_amg }, |
93
|
|
|
|
|
|
{ "neg_amg", 7, neg_amg }, |
94
|
|
|
|
|
|
{ "iter_amg", 8, iter_amg }, |
95
|
|
|
|
|
|
{ "int_amg", 7, int_amg }, |
96
|
|
|
|
|
|
{ "lt_amg", 6, lt_amg }, |
97
|
|
|
|
|
|
{ "le_amg", 6, le_amg }, |
98
|
|
|
|
|
|
{ "gt_amg", 6, gt_amg }, |
99
|
|
|
|
|
|
{ "ge_amg", 6, ge_amg }, |
100
|
|
|
|
|
|
{ "eq_amg", 6, eq_amg }, |
101
|
|
|
|
|
|
{ "ne_amg", 6, ne_amg }, |
102
|
|
|
|
|
|
{ "slt_amg", 7, slt_amg }, |
103
|
|
|
|
|
|
{ "sle_amg", 7, sle_amg }, |
104
|
|
|
|
|
|
{ "sgt_amg", 7, sgt_amg }, |
105
|
|
|
|
|
|
{ "sge_amg", 7, sge_amg }, |
106
|
|
|
|
|
|
{ "seq_amg", 7, seq_amg }, |
107
|
|
|
|
|
|
{ "sne_amg", 7, sne_amg }, |
108
|
|
|
|
|
|
{ "nomethod_amg", 12, nomethod_amg }, |
109
|
|
|
|
|
|
{ "add_amg", 7, add_amg }, |
110
|
|
|
|
|
|
{ "add_ass_amg", 11, add_ass_amg }, |
111
|
|
|
|
|
|
{ "subtr_amg", 9, subtr_amg }, |
112
|
|
|
|
|
|
{ "subtr_ass_amg", 13, subtr_ass_amg }, |
113
|
|
|
|
|
|
{ "mult_amg", 8, mult_amg }, |
114
|
|
|
|
|
|
{ "mult_ass_amg", 12, mult_ass_amg }, |
115
|
|
|
|
|
|
{ "div_amg", 7, div_amg }, |
116
|
|
|
|
|
|
{ "div_ass_amg", 11, div_ass_amg }, |
117
|
|
|
|
|
|
{ "modulo_amg", 10, modulo_amg }, |
118
|
|
|
|
|
|
{ "modulo_ass_amg", 14, modulo_ass_amg }, |
119
|
|
|
|
|
|
{ "pow_amg", 7, pow_amg }, |
120
|
|
|
|
|
|
{ "pow_ass_amg", 11, pow_ass_amg }, |
121
|
|
|
|
|
|
{ "lshift_amg", 10, lshift_amg }, |
122
|
|
|
|
|
|
{ "lshift_ass_amg", 14, lshift_ass_amg }, |
123
|
|
|
|
|
|
{ "rshift_amg", 10, rshift_amg }, |
124
|
|
|
|
|
|
{ "rshift_ass_amg", 14, rshift_ass_amg }, |
125
|
|
|
|
|
|
{ "band_amg", 8, band_amg }, |
126
|
|
|
|
|
|
{ "band_ass_amg", 12, band_ass_amg }, |
127
|
|
|
|
|
|
{ "bor_amg", 7, bor_amg }, |
128
|
|
|
|
|
|
{ "bor_ass_amg", 11, bor_ass_amg }, |
129
|
|
|
|
|
|
{ "bxor_amg", 8, bxor_amg }, |
130
|
|
|
|
|
|
{ "bxor_ass_amg", 12, bxor_ass_amg }, |
131
|
|
|
|
|
|
{ "ncmp_amg", 8, ncmp_amg }, |
132
|
|
|
|
|
|
{ "scmp_amg", 8, scmp_amg }, |
133
|
|
|
|
|
|
{ "compl_amg", 9, compl_amg }, |
134
|
|
|
|
|
|
{ "atan2_amg", 9, atan2_amg }, |
135
|
|
|
|
|
|
{ "cos_amg", 7, cos_amg }, |
136
|
|
|
|
|
|
{ "sin_amg", 7, sin_amg }, |
137
|
|
|
|
|
|
{ "exp_amg", 7, exp_amg }, |
138
|
|
|
|
|
|
{ "log_amg", 7, log_amg }, |
139
|
|
|
|
|
|
{ "sqrt_amg", 8, sqrt_amg }, |
140
|
|
|
|
|
|
{ "repeat_amg", 10, repeat_amg }, |
141
|
|
|
|
|
|
{ "repeat_ass_amg", 14, repeat_ass_amg }, |
142
|
|
|
|
|
|
{ "concat_amg", 10, concat_amg }, |
143
|
|
|
|
|
|
{ "concat_ass_amg", 14, concat_ass_amg }, |
144
|
|
|
|
|
|
{ "smart_amg", 9, smart_amg }, |
145
|
|
|
|
|
|
{ "ftest_amg", 9, ftest_amg }, |
146
|
|
|
|
|
|
{ "regexp_amg", 10, regexp_amg }, |
147
|
|
|
|
|
|
#ifndef G_WANT |
148
|
|
|
|
|
|
/* This is the default value: */ |
149
|
|
|
|
|
|
{ "G_WANT", 6, G_ARRAY|G_VOID }, |
150
|
|
|
|
|
|
#endif |
151
|
|
|
|
|
|
{ NULL, 0, 0 } }; |
152
|
|
|
|
|
|
const struct iv_s *value_for_iv = values_for_iv; |
153
|
16368
|
|
|
|
|
while (value_for_iv->name) { |
154
|
16016
|
|
|
|
|
constant_add_symbol(aTHX_ symbol_table, value_for_iv->name, |
155
|
|
|
|
|
|
value_for_iv->namelen, newSViv(value_for_iv->value)); |
156
|
16016
|
|
|
|
|
++value_for_iv; |
157
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
if (C_ARRAY_LENGTH(values_for_notfound) > 1) { |
159
|
|
|
|
|
|
#ifndef SYMBIAN |
160
|
|
|
|
|
|
HV *const constant_missing = get_missing_hash(aTHX); |
161
|
|
|
|
|
|
#endif |
162
|
|
|
|
|
|
const struct notfound_s *value_for_notfound = values_for_notfound; |
163
|
|
|
|
|
|
do { |
164
|
|
|
|
|
|
|
165
|
|
|
|
|
|
/* Need to add prototypes, else parsing will vary by platform. */ |
166
|
|
|
|
|
|
HE *he = (HE*) hv_common_key_len(symbol_table, |
167
|
|
|
|
|
|
value_for_notfound->name, |
168
|
|
|
|
|
|
value_for_notfound->namelen, |
169
|
|
|
|
|
|
HV_FETCH_LVALUE, NULL, 0); |
170
|
|
|
|
|
|
SV *sv; |
171
|
|
|
|
|
|
#ifndef SYMBIAN |
172
|
|
|
|
|
|
HEK *hek; |
173
|
|
|
|
|
|
#endif |
174
|
|
|
|
|
|
if (!he) { |
175
|
|
|
|
|
|
Perl_croak(aTHX_ |
176
|
|
|
|
|
|
"Couldn't add key '%s' to %%XS::APItest::", |
177
|
|
|
|
|
|
value_for_notfound->name); |
178
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
sv = HeVAL(he); |
180
|
|
|
|
|
|
if (!SvOK(sv) && SvTYPE(sv) != SVt_PVGV) { |
181
|
|
|
|
|
|
/* Nothing was here before, so mark a prototype of "" */ |
182
|
|
|
|
|
|
sv_setpvn(sv, "", 0); |
183
|
|
|
|
|
|
} else if (SvPOK(sv) && SvCUR(sv) == 0) { |
184
|
|
|
|
|
|
/* There is already a prototype of "" - do nothing */ |
185
|
|
|
|
|
|
} else { |
186
|
|
|
|
|
|
/* Someone has been here before us - have to make a real |
187
|
|
|
|
|
|
typeglob. */ |
188
|
|
|
|
|
|
/* It turns out to be incredibly hard to deal with all the |
189
|
|
|
|
|
|
corner cases of sub foo (); and reporting errors correctly, |
190
|
|
|
|
|
|
so lets cheat a bit. Start with a constant subroutine */ |
191
|
|
|
|
|
|
CV *cv = newCONSTSUB(symbol_table, |
192
|
|
|
|
|
|
value_for_notfound->name, |
193
|
|
|
|
|
|
&PL_sv_yes); |
194
|
|
|
|
|
|
/* and then turn it into a non constant declaration only. */ |
195
|
|
|
|
|
|
SvREFCNT_dec(CvXSUBANY(cv).any_ptr); |
196
|
|
|
|
|
|
CvCONST_off(cv); |
197
|
|
|
|
|
|
CvXSUB(cv) = NULL; |
198
|
|
|
|
|
|
CvXSUBANY(cv).any_ptr = NULL; |
199
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
#ifndef SYMBIAN |
201
|
|
|
|
|
|
hek = HeKEY_hek(he); |
202
|
|
|
|
|
|
if (!hv_common(constant_missing, NULL, HEK_KEY(hek), |
203
|
|
|
|
|
|
HEK_LEN(hek), HEK_FLAGS(hek), HV_FETCH_ISSTORE, |
204
|
|
|
|
|
|
&PL_sv_yes, HEK_HASH(hek))) |
205
|
|
|
|
|
|
Perl_croak(aTHX_ "Couldn't add key '%s' to missing_hash", |
206
|
|
|
|
|
|
value_for_notfound->name); |
207
|
|
|
|
|
|
#endif |
208
|
|
|
|
|
|
} while ((++value_for_notfound)->name); |
209
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
/* As we've been creating subroutines, we better invalidate any cached |
211
|
|
|
|
|
|
methods */ |
212
|
176
|
|
|
|
|
mro_method_changed_in(symbol_table); |
213
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
215
|
|
|
|
|
|
void |
216
|
|
|
|
|
|
constant(sv) |
217
|
|
|
|
|
|
INPUT: |
218
|
|
|
|
|
|
SV * sv; |
219
|
|
|
|
|
|
PPCODE: |
220
|
|
|
|
|
|
#ifndef SYMBIAN |
221
|
|
|
|
|
|
/* It's not obvious how to calculate this at C pre-processor time. |
222
|
|
|
|
|
|
However, any compiler optimiser worth its salt should be able to |
223
|
|
|
|
|
|
remove the dead code, and hopefully the now-obviously-unused static |
224
|
|
|
|
|
|
function too. */ |
225
|
|
|
|
|
|
HV *constant_missing = (C_ARRAY_LENGTH(values_for_notfound) > 1) |
226
|
|
|
|
|
|
? get_missing_hash(aTHX) : NULL; |
227
|
|
|
|
|
|
if ((C_ARRAY_LENGTH(values_for_notfound) > 1) |
228
|
|
|
|
|
|
? hv_exists_ent(constant_missing, sv, 0) : 0) { |
229
|
|
|
|
|
|
sv = newSVpvf("Your vendor has not defined XS::APItest macro %" SVf |
230
|
|
|
|
|
|
", used", sv); |
231
|
|
|
|
|
|
} else |
232
|
|
|
|
|
|
#endif |
233
|
|
|
|
|
|
{ |
234
|
0
|
|
|
|
|
sv = newSVpvf("%"SVf" is not a valid XS::APItest macro", |
235
|
|
|
|
|
|
sv); |
236
|
|
|
|
|
|
} |
237
|
0
|
|
|
|
|
PUSHs(sv_2mortal(sv)); |