t/lib/MyTest_xsgen.cc

filter: Statementstmt 63.3% 19 / 30 Branchbran 50.0% 8 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 58.7% 27 / 46 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« src/xs/xlog.cc ↑ Summary xs/XLog.xsi »
1 /*
2 * This file was generated automatically by XS::Install::FrozenShit::ParseXS version 3.57 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/lib/MyTest.xs"
10 #include <xs.h>
11 #include <stdlib.h>
12  
13 using namespace xs;
14  
15 static peep_t prev_rpeepp;
16  
17 static int post = 0;
18  
19 OP* intercepted_entersub(pTHX) {
20 auto ret = PL_ppaddr[OP_ENTERSUB](aTHX);
21 ++post;
22 return ret;
23 }
24  
25 static void my_rpeep(pTHX_ OP *first)
26 {
27 auto mark = [] (OP* it) {
28 if (it->op_type == OP_ENTERSUB) {
29 it->op_ppaddr = &intercepted_entersub;
30 }
31 };
32 OP *o, *t;
33 for(t = o = first; o; o = o->op_next, t = t->op_next) {
34 mark(o);
35 o = o->op_next;
36 if(!o || o == t) break;
37 mark(o);
38 }
39 prev_rpeepp(aTHX_ first);
40 }
41  
42 #line 43 "t/lib/MyTest_xsgen.cc"
43 #ifndef PERL_UNUSED_VAR
44 # define PERL_UNUSED_VAR(var) if (0) var = var
45 #endif
46  
47 #ifndef dVAR
48 # define dVAR dNOOP
49 #endif
50  
51  
52 /* This stuff is not part of the API! You have been warned. */
53 #ifndef PERL_VERSION_DECIMAL
54 # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
55 #endif
56 #ifndef PERL_DECIMAL_VERSION
57 # define PERL_DECIMAL_VERSION \
58 PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
59 #endif
60 #ifndef PERL_VERSION_GE
61 # define PERL_VERSION_GE(r,v,s) \
62 (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
63 #endif
64 #ifndef PERL_VERSION_LE
65 # define PERL_VERSION_LE(r,v,s) \
66 (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
67 #endif
68  
69 /* XS_INTERNAL is the explicit static-linkage variant of the default
70 * XS macro.
71 *
72 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
73 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
74 * for anything but the BOOT XSUB.
75 *
76 * See XSUB.h in core!
77 */
78  
79  
80 /* TODO: This might be compatible further back than 5.10.0. */
81 #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
82 # undef XS_EXTERNAL
83 # undef XS_INTERNAL
84 # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
85 # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
86 # define XS_INTERNAL(name) STATIC XSPROTO(name)
87 # endif
88 # if defined(__SYMBIAN32__)
89 # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
90 # define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
91 # endif
92 # ifndef XS_EXTERNAL
93 # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
94 # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
95 # define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
96 # else
97 # ifdef __cplusplus
98 # define XS_EXTERNAL(name) extern "C" XSPROTO(name)
99 # define XS_INTERNAL(name) static XSPROTO(name)
100 # else
101 # define XS_EXTERNAL(name) XSPROTO(name)
102 # define XS_INTERNAL(name) STATIC XSPROTO(name)
103 # endif
104 # endif
105 # endif
106 #endif
107  
108 /* perl >= 5.10.0 && perl <= 5.15.1 */
109  
110  
111 /* The XS_EXTERNAL macro is used for functions that must not be static
112 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
113 * macro defined, the best we can do is assume XS is the same.
114 * Dito for XS_INTERNAL.
115 */
116 #ifndef XS_EXTERNAL
117 # define XS_EXTERNAL(name) XS(name)
118 #endif
119 #ifndef XS_INTERNAL
120 # define XS_INTERNAL(name) XS(name)
121 #endif
122  
123 /* Now, finally, after all this mess, we want an XS::Install::FrozenShit::ParseXS
124 * internal macro that we're free to redefine for varying linkage due
125 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
126 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
127 */
128  
129 #undef XS_EUPXS
130 #if defined(PERL_EUPXS_ALWAYS_EXPORT)
131 # define XS_EUPXS(name) XS_EXTERNAL(name)
132 #else
133 /* default to internal */
134 # define XS_EUPXS(name) XS_INTERNAL(name)
135 #endif
136  
137 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
138 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
139  
140 /* prototype to pass -Wmissing-prototypes */
141 STATIC void
142 S_croak_xs_usage(const CV *const cv, const char *const params);
143  
144 STATIC void
145 S_croak_xs_usage(const CV *const cv, const char *const params)
146 {
147 const GV *const gv = CvGV(cv);
148  
149 PERL_ARGS_ASSERT_CROAK_XS_USAGE;
150  
151 if (gv) {
152 const char *const gvname = GvNAME(gv);
153 const HV *const stash = GvSTASH(gv);
154 const char *const hvname = stash ? HvNAME(stash) : NULL;
155  
156 if (hvname)
157 Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
158 else
159 Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
160 } else {
161 /* Pants. I don't think that it should be possible to get here. */
162 Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
163 }
164 }
165 #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
166  
167 #define croak_xs_usage S_croak_xs_usage
168  
169 #endif
170  
171 /* NOTE: the prototype of newXSproto() is different in versions of perls,
172 * so we define a portable version of newXSproto()
173 */
174 #ifdef newXS_flags
175 #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
176 #else
177 #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
178 #endif /* !defined(newXS_flags) */
179  
180 #if PERL_VERSION_LE(5, 21, 5)
181 # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
182 #else
183 # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
184 #endif
185  
186 /* simple backcompat versions of the TARGx() macros with no optimisation */
187 #ifndef TARGi
188 # define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv)
189 # define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv)
190 # define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv)
191 #endif
192  
193 #line 194 "t/lib/MyTest_xsgen.cc"
194  
195  
196 120 ▶XS_EUPXS(XS_MyTest_marker) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest_marker) { xs::throw_guard(cv, [=]() 60 0 60
197 {
198 60 dVAR; dXSARGS;
199 60 ▶ if (items != 0)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 0) 0 60 60
200 0 croak_xs_usage(cv, "");
201 {
202 int RETVAL;
203 60 ▶ dXSTARG;
Branch: 2 branches
BranchTrueFalseTotal
dXSTARG; 60 0 60
dXSTARG; 58 2 60
204 #line 43 "t/lib/MyTest.xs"
205 RETVAL = post;
206 #line 207 "t/lib/MyTest_xsgen.cc"
207 60 ▶ TARGi((IV)RETVAL, 1);
Branch: 1 branch
BranchTrueFalseTotal
TARGi((IV)RETVAL, 1); 58 2 60
208 60 ST(0) = TARG;
209 }
210 60 XSRETURN(1);
211 60 }); }
212  
213  
214  
215 0 ▶XS_EUPXS(XS_MyTest_test) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest_test) { xs::throw_guard(cv, [=]() 0 0 0
216 {
217 0 dVAR; dXSARGS;
218 0 ▶ if (items != 0)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 0) 0 0 0
219 0 croak_xs_usage(cv, "");
220 PERL_UNUSED_VAR(ax); /* -Wall */
221 0 SP -= items;
222 {
223 #line 47 "t/lib/MyTest.xs"
224 // no-op
225 #line 226 "t/lib/MyTest_xsgen.cc"
226 0 PUTBACK;
227 0 return;
228 }
229 0 }); }
230  
231 #ifdef __cplusplus
232 extern "C" {
233 #endif
234  
235 16 ▶XS_EXTERNAL(boot_MyTest) { xs::throw_guard(cv, [=]() mutable
Branch: 1 branch
BranchTrueFalseTotal
XS_EXTERNAL(boot_MyTest) { xs::throw_guard(cv, [=]() mutable 8 0 8
236 {
237 #if PERL_VERSION_LE(5, 21, 5)
238 dVAR; dXSARGS;
239 #else
240 8 dVAR; dXSBOOTARGSXSAPIVERCHK;
241 #endif
242 #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
243 char* file = __FILE__;
244 #else
245 8 const char* file = __FILE__;
246 #endif
247  
248 PERL_UNUSED_VAR(file);
249  
250 PERL_UNUSED_VAR(cv); /* -W */
251 PERL_UNUSED_VAR(items); /* -W */
252 #if PERL_VERSION_LE(5, 21, 5)
253 XS_VERSION_BOOTCHECK;
254 # ifdef XS_APIVERSION_BOOTCHECK
255 XS_APIVERSION_BOOTCHECK;
256 # endif
257 #endif
258  
259 8 newXS_deffile("MyTest::marker", XS_MyTest_marker);
260 8 newXS_deffile("MyTest::test", XS_MyTest_test);
261  
262 /* Initialisation Section */
263  
264 #line 37 "t/lib/MyTest.xs"
265 {
266 prev_rpeepp = PL_rpeepp;
267 PL_rpeepp = my_rpeep;
268 }
269  
270 #line 271 "t/lib/MyTest_xsgen.cc"
271  
272 /* End of Initialisation Section */
273  
274 #if PERL_VERSION_LE(5, 21, 5)
275 # if PERL_VERSION_GE(5, 9, 0)
276 if (PL_unitcheckav)
277 call_list(PL_scopestack_ix, PL_unitcheckav);
278 # endif
279 XSRETURN_YES;
280 #else
281 8 Perl_xs_boot_epilog(aTHX_ ax);
282 #endif
283 8 }); }
284  
285 #ifdef __cplusplus
286 }
287 #endif
« src/xs/xlog.cc ↑ Summary xs/XLog.xsi »