Perl_xsgen.cc

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