line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
* This file was generated automatically by ExtUtils::ParseXS version 3.34 from the |
3
|
|
|
|
|
|
|
* contents of MyTest.xs. Do not edit this file, edit MyTest.xs instead. |
4
|
|
|
|
|
|
|
* |
5
|
|
|
|
|
|
|
* ANY CHANGES MADE HERE WILL BE LOST! |
6
|
|
|
|
|
|
|
* |
7
|
|
|
|
|
|
|
*/ |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#line 1 "t/MyTest.xs" |
10
|
|
|
|
|
|
|
#include |
11
|
|
|
|
|
|
|
#include |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
using namespace xs; |
14
|
|
|
|
|
|
|
using namespace panda; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
template static inline void fn_1() { |
18
|
|
|
|
|
|
|
throw panda::exception("my-error"); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
template static inline void fn_2() { |
22
|
|
|
|
|
|
|
fn_1(); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#line 26 "t/MyTest_xsgen.cc" |
26
|
|
|
|
|
|
|
#ifndef PERL_UNUSED_VAR |
27
|
|
|
|
|
|
|
# define PERL_UNUSED_VAR(var) if (0) var = var |
28
|
|
|
|
|
|
|
#endif |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#ifndef dVAR |
31
|
|
|
|
|
|
|
# define dVAR dNOOP |
32
|
|
|
|
|
|
|
#endif |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
/* This stuff is not part of the API! You have been warned. */ |
36
|
|
|
|
|
|
|
#ifndef PERL_VERSION_DECIMAL |
37
|
|
|
|
|
|
|
# define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) |
38
|
|
|
|
|
|
|
#endif |
39
|
|
|
|
|
|
|
#ifndef PERL_DECIMAL_VERSION |
40
|
|
|
|
|
|
|
# define PERL_DECIMAL_VERSION \ |
41
|
|
|
|
|
|
|
PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) |
42
|
|
|
|
|
|
|
#endif |
43
|
|
|
|
|
|
|
#ifndef PERL_VERSION_GE |
44
|
|
|
|
|
|
|
# define PERL_VERSION_GE(r,v,s) \ |
45
|
|
|
|
|
|
|
(PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) |
46
|
|
|
|
|
|
|
#endif |
47
|
|
|
|
|
|
|
#ifndef PERL_VERSION_LE |
48
|
|
|
|
|
|
|
# define PERL_VERSION_LE(r,v,s) \ |
49
|
|
|
|
|
|
|
(PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s)) |
50
|
|
|
|
|
|
|
#endif |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
/* XS_INTERNAL is the explicit static-linkage variant of the default |
53
|
|
|
|
|
|
|
* XS macro. |
54
|
|
|
|
|
|
|
* |
55
|
|
|
|
|
|
|
* XS_EXTERNAL is the same as XS_INTERNAL except it does not include |
56
|
|
|
|
|
|
|
* "STATIC", ie. it exports XSUB symbols. You probably don't want that |
57
|
|
|
|
|
|
|
* for anything but the BOOT XSUB. |
58
|
|
|
|
|
|
|
* |
59
|
|
|
|
|
|
|
* See XSUB.h in core! |
60
|
|
|
|
|
|
|
*/ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
/* TODO: This might be compatible further back than 5.10.0. */ |
64
|
|
|
|
|
|
|
#if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1) |
65
|
|
|
|
|
|
|
# undef XS_EXTERNAL |
66
|
|
|
|
|
|
|
# undef XS_INTERNAL |
67
|
|
|
|
|
|
|
# if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING) |
68
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name) |
69
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC XSPROTO(name) |
70
|
|
|
|
|
|
|
# endif |
71
|
|
|
|
|
|
|
# if defined(__SYMBIAN32__) |
72
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) EXPORT_C XSPROTO(name) |
73
|
|
|
|
|
|
|
# define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name) |
74
|
|
|
|
|
|
|
# endif |
75
|
|
|
|
|
|
|
# ifndef XS_EXTERNAL |
76
|
|
|
|
|
|
|
# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus) |
77
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__) |
78
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__) |
79
|
|
|
|
|
|
|
# else |
80
|
|
|
|
|
|
|
# ifdef __cplusplus |
81
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) extern "C" XSPROTO(name) |
82
|
|
|
|
|
|
|
# define XS_INTERNAL(name) static XSPROTO(name) |
83
|
|
|
|
|
|
|
# else |
84
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) XSPROTO(name) |
85
|
|
|
|
|
|
|
# define XS_INTERNAL(name) STATIC XSPROTO(name) |
86
|
|
|
|
|
|
|
# endif |
87
|
|
|
|
|
|
|
# endif |
88
|
|
|
|
|
|
|
# endif |
89
|
|
|
|
|
|
|
#endif |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
/* perl >= 5.10.0 && perl <= 5.15.1 */ |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
/* The XS_EXTERNAL macro is used for functions that must not be static |
95
|
|
|
|
|
|
|
* like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL |
96
|
|
|
|
|
|
|
* macro defined, the best we can do is assume XS is the same. |
97
|
|
|
|
|
|
|
* Dito for XS_INTERNAL. |
98
|
|
|
|
|
|
|
*/ |
99
|
|
|
|
|
|
|
#ifndef XS_EXTERNAL |
100
|
|
|
|
|
|
|
# define XS_EXTERNAL(name) XS(name) |
101
|
|
|
|
|
|
|
#endif |
102
|
|
|
|
|
|
|
#ifndef XS_INTERNAL |
103
|
|
|
|
|
|
|
# define XS_INTERNAL(name) XS(name) |
104
|
|
|
|
|
|
|
#endif |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
/* Now, finally, after all this mess, we want an ExtUtils::ParseXS |
107
|
|
|
|
|
|
|
* internal macro that we're free to redefine for varying linkage due |
108
|
|
|
|
|
|
|
* to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use |
109
|
|
|
|
|
|
|
* XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to! |
110
|
|
|
|
|
|
|
*/ |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
#undef XS_EUPXS |
113
|
|
|
|
|
|
|
#if defined(PERL_EUPXS_ALWAYS_EXPORT) |
114
|
|
|
|
|
|
|
# define XS_EUPXS(name) XS_EXTERNAL(name) |
115
|
|
|
|
|
|
|
#else |
116
|
|
|
|
|
|
|
/* default to internal */ |
117
|
|
|
|
|
|
|
# define XS_EUPXS(name) XS_INTERNAL(name) |
118
|
|
|
|
|
|
|
#endif |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
121
|
|
|
|
|
|
|
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
/* prototype to pass -Wmissing-prototypes */ |
124
|
|
|
|
|
|
|
STATIC void |
125
|
|
|
|
|
|
|
S_croak_xs_usage(const CV *const cv, const char *const params); |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
STATIC void |
128
|
|
|
|
|
|
|
S_croak_xs_usage(const CV *const cv, const char *const params) |
129
|
|
|
|
|
|
|
{ |
130
|
|
|
|
|
|
|
const GV *const gv = CvGV(cv); |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
PERL_ARGS_ASSERT_CROAK_XS_USAGE; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
if (gv) { |
135
|
|
|
|
|
|
|
const char *const gvname = GvNAME(gv); |
136
|
|
|
|
|
|
|
const HV *const stash = GvSTASH(gv); |
137
|
|
|
|
|
|
|
const char *const hvname = stash ? HvNAME(stash) : NULL; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
if (hvname) |
140
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); |
141
|
|
|
|
|
|
|
else |
142
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: %s(%s)", gvname, params); |
143
|
|
|
|
|
|
|
} else { |
144
|
|
|
|
|
|
|
/* Pants. I don't think that it should be possible to get here. */ |
145
|
|
|
|
|
|
|
Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params); |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
#define croak_xs_usage S_croak_xs_usage |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
#endif |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
/* NOTE: the prototype of newXSproto() is different in versions of perls, |
155
|
|
|
|
|
|
|
* so we define a portable version of newXSproto() |
156
|
|
|
|
|
|
|
*/ |
157
|
|
|
|
|
|
|
#ifdef newXS_flags |
158
|
|
|
|
|
|
|
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0) |
159
|
|
|
|
|
|
|
#else |
160
|
|
|
|
|
|
|
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv) |
161
|
|
|
|
|
|
|
#endif /* !defined(newXS_flags) */ |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
164
|
|
|
|
|
|
|
# define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file) |
165
|
|
|
|
|
|
|
#else |
166
|
|
|
|
|
|
|
# define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b) |
167
|
|
|
|
|
|
|
#endif |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
#line 170 "t/MyTest_xsgen.cc" |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
6
|
|
|
|
|
|
XS_EUPXS(XS_MyTest_default_trace_depth) { xs::throw_guard(cv, [=]() |
173
|
|
|
|
|
|
|
{ |
174
|
3
|
|
|
|
|
|
dVAR; dXSARGS; |
175
|
3
|
50
|
|
|
|
|
if (items != 0) |
176
|
0
|
|
|
|
|
|
croak_xs_usage(cv, ""); |
177
|
|
|
|
|
|
|
{ |
178
|
|
|
|
|
|
|
size_t RETVAL; |
179
|
3
|
50
|
|
|
|
|
dXSTARG; |
|
|
0
|
|
|
|
|
|
180
|
|
|
|
|
|
|
#line 20 "t/MyTest.xs" |
181
|
|
|
|
|
|
|
RETVAL = Backtrace().get_backtrace_info()->frames.size(); |
182
|
|
|
|
|
|
|
#line 183 "t/MyTest_xsgen.cc" |
183
|
3
|
50
|
|
|
|
|
XSprePUSH; PUSHu((UV)RETVAL); |
|
|
50
|
|
|
|
|
|
184
|
|
|
|
|
|
|
} |
185
|
3
|
|
|
|
|
|
XSRETURN(1); |
186
|
3
|
50
|
|
|
|
|
}); } |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
2
|
|
|
|
|
|
XS_EUPXS(XS_MyTest_call) { xs::throw_guard(cv, [=]() |
191
|
|
|
|
|
|
|
{ |
192
|
1
|
|
|
|
|
|
dVAR; dXSARGS; |
193
|
1
|
50
|
|
|
|
|
if (items != 1) |
194
|
0
|
|
|
|
|
|
croak_xs_usage(cv, "cb"); |
195
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
196
|
1
|
|
|
|
|
|
SP -= items; |
197
|
|
|
|
|
|
|
{ |
198
|
2
|
50
|
|
|
|
|
Sub cb = ST(0); |
199
|
1
|
50
|
|
|
|
|
if (!cb && SvOK(ST(0))) throw "arg is not a 'Sub' reference" |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
200
|
0
|
|
|
|
|
|
; |
201
|
|
|
|
|
|
|
#line 24 "t/MyTest.xs" |
202
|
|
|
|
|
|
|
cb(); |
203
|
|
|
|
|
|
|
#line 204 "t/MyTest_xsgen.cc" |
204
|
0
|
|
|
|
|
|
PUTBACK; |
205
|
0
|
|
|
|
|
|
return; |
206
|
|
|
|
|
|
|
} |
207
|
1
|
0
|
|
|
|
|
}); } |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
|
211
|
2
|
|
|
|
|
|
XS_EUPXS(XS_MyTest_throw_logic_error) { xs::throw_guard(cv, [=]() |
212
|
|
|
|
|
|
|
{ |
213
|
1
|
|
|
|
|
|
dVAR; dXSARGS; |
214
|
1
|
50
|
|
|
|
|
if (items != 0) |
215
|
0
|
|
|
|
|
|
croak_xs_usage(cv, ""); |
216
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
217
|
1
|
|
|
|
|
|
SP -= items; |
218
|
|
|
|
|
|
|
{ |
219
|
|
|
|
|
|
|
#line 28 "t/MyTest.xs" |
220
|
|
|
|
|
|
|
throw std::logic_error("my-logic-error"); |
221
|
|
|
|
|
|
|
#line 222 "t/MyTest_xsgen.cc" |
222
|
|
|
|
|
|
|
PUTBACK; |
223
|
|
|
|
|
|
|
return; |
224
|
|
|
|
|
|
|
} |
225
|
1
|
0
|
|
|
|
|
}); } |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
|
229
|
4
|
|
|
|
|
|
XS_EUPXS(XS_MyTest_throw_backtrace) { xs::throw_guard(cv, [=]() |
230
|
|
|
|
|
|
|
{ |
231
|
2
|
|
|
|
|
|
dVAR; dXSARGS; |
232
|
2
|
50
|
|
|
|
|
if (items != 0) |
233
|
0
|
|
|
|
|
|
croak_xs_usage(cv, ""); |
234
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
235
|
2
|
|
|
|
|
|
SP -= items; |
236
|
|
|
|
|
|
|
{ |
237
|
|
|
|
|
|
|
#line 32 "t/MyTest.xs" |
238
|
|
|
|
|
|
|
auto fn = []() { fn_2(); }; |
239
|
|
|
|
|
|
|
fn(); |
240
|
|
|
|
|
|
|
#line 241 "t/MyTest_xsgen.cc" |
241
|
0
|
|
|
|
|
|
PUTBACK; |
242
|
0
|
|
|
|
|
|
return; |
243
|
|
|
|
|
|
|
} |
244
|
2
|
0
|
|
|
|
|
}); } |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
|
248
|
2
|
|
|
|
|
|
XS_EUPXS(XS_MyTest_throw_with_newline) { xs::throw_guard(cv, [=]() |
249
|
|
|
|
|
|
|
{ |
250
|
1
|
|
|
|
|
|
dVAR; dXSARGS; |
251
|
1
|
50
|
|
|
|
|
if (items != 0) |
252
|
0
|
|
|
|
|
|
croak_xs_usage(cv, ""); |
253
|
|
|
|
|
|
|
PERL_UNUSED_VAR(ax); /* -Wall */ |
254
|
1
|
|
|
|
|
|
SP -= items; |
255
|
|
|
|
|
|
|
{ |
256
|
|
|
|
|
|
|
#line 37 "t/MyTest.xs" |
257
|
|
|
|
|
|
|
throw std::logic_error("my-error\n"); |
258
|
|
|
|
|
|
|
#line 259 "t/MyTest_xsgen.cc" |
259
|
|
|
|
|
|
|
PUTBACK; |
260
|
|
|
|
|
|
|
return; |
261
|
|
|
|
|
|
|
} |
262
|
1
|
0
|
|
|
|
|
}); } |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
#ifdef __cplusplus |
265
|
|
|
|
|
|
|
extern "C" |
266
|
|
|
|
|
|
|
#endif |
267
|
|
|
|
|
|
|
|
268
|
10
|
|
|
|
|
|
XS_EXTERNAL(boot_MyTest) { xs::throw_guard(cv, [=]() mutable |
269
|
|
|
|
|
|
|
{ |
270
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
271
|
|
|
|
|
|
|
dVAR; dXSARGS; |
272
|
|
|
|
|
|
|
#else |
273
|
5
|
50
|
|
|
|
|
dVAR; dXSBOOTARGSXSAPIVERCHK; |
|
|
50
|
|
|
|
|
|
274
|
|
|
|
|
|
|
#endif |
275
|
|
|
|
|
|
|
#if (PERL_REVISION == 5 && PERL_VERSION < 9) |
276
|
|
|
|
|
|
|
char* file = __FILE__; |
277
|
|
|
|
|
|
|
#else |
278
|
5
|
|
|
|
|
|
const char* file = __FILE__; |
279
|
|
|
|
|
|
|
#endif |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
PERL_UNUSED_VAR(file); |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
PERL_UNUSED_VAR(cv); /* -W */ |
284
|
|
|
|
|
|
|
PERL_UNUSED_VAR(items); /* -W */ |
285
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
286
|
|
|
|
|
|
|
XS_VERSION_BOOTCHECK; |
287
|
|
|
|
|
|
|
# ifdef XS_APIVERSION_BOOTCHECK |
288
|
|
|
|
|
|
|
XS_APIVERSION_BOOTCHECK; |
289
|
|
|
|
|
|
|
# endif |
290
|
|
|
|
|
|
|
#endif |
291
|
|
|
|
|
|
|
|
292
|
5
|
|
|
|
|
|
newXS_deffile("MyTest::default_trace_depth", XS_MyTest_default_trace_depth); |
293
|
5
|
|
|
|
|
|
newXS_deffile("MyTest::call", XS_MyTest_call); |
294
|
5
|
|
|
|
|
|
newXS_deffile("MyTest::throw_logic_error", XS_MyTest_throw_logic_error); |
295
|
5
|
|
|
|
|
|
newXS_deffile("MyTest::throw_backtrace", XS_MyTest_throw_backtrace); |
296
|
5
|
|
|
|
|
|
newXS_deffile("MyTest::throw_with_newline", XS_MyTest_throw_with_newline); |
297
|
|
|
|
|
|
|
#if PERL_VERSION_LE(5, 21, 5) |
298
|
|
|
|
|
|
|
# if PERL_VERSION_GE(5, 9, 0) |
299
|
|
|
|
|
|
|
if (PL_unitcheckav) |
300
|
|
|
|
|
|
|
call_list(PL_scopestack_ix, PL_unitcheckav); |
301
|
|
|
|
|
|
|
# endif |
302
|
|
|
|
|
|
|
XSRETURN_YES; |
303
|
|
|
|
|
|
|
#else |
304
|
5
|
|
|
|
|
|
Perl_xs_boot_epilog(aTHX_ ax); |
305
|
|
|
|
|
|
|
#endif |
306
|
5
|
50
|
|
|
|
|
}); } |
307
|
|
|
|
|
|
|
|