t/typemap/callback_dispatcher_xsgen.cc

filter: Statementstmt 69.0% 127 / 184 Branchbran 37.3% 47 / 126 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 56.1% 174 / 310 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« src/xs/Object.cc ↑ Summary t/svapi/scalar.cc »
1 /*
2 * This file was generated automatically by XS::Install::FrozenShit::ParseXS version 3.57 from the
3 * contents of callback_dispatcher.xs. Do not edit this file, edit callback_dispatcher.xs instead.
4 *
5 * ANY CHANGES MADE HERE WILL BE LOST!
6 *
7 */
8  
9 #line 1 "t/typemap/callback_dispatcher.xs"
10 #include <xs.h>
11 #include <xs/CallbackDispatcher.h>
12  
13 using namespace xs;
14  
15 using panda::string;
16 using panda::string_view;
17 using panda::CallbackDispatcher;
18 template <class T> using iptr = panda::iptr<T>;
19  
20 struct NoTmStruct {
21 string val;
22 };
23  
24 struct SomeClass : panda::Refcnt {};
25 struct SomeClass2 : panda::Refcnt {};
26  
27 using cdVS = CallbackDispatcher<void(string)>;
28 using cdIS = CallbackDispatcher<int(string)>;
29 using cdIV = CallbackDispatcher<int(void)>;
30 using cdVIref = CallbackDispatcher<void(const int&)>;
31 using cdVPtrref = CallbackDispatcher<void(const panda::iptr<SomeClass>&)>;
32 using cdVV = CallbackDispatcher<void()>;
33 using cdPtrPtr = CallbackDispatcher<void(iptr<SomeClass>, iptr<SomeClass2>)>;
34 using cdNoTm = CallbackDispatcher<NoTmStruct(NoTmStruct)>;
35  
36 struct DispatchingObject {
37 cdVS vs;
38 cdIV iv;
39 cdVIref viref;
40 cdVPtrref vptrref;
41 cdIS is;
42 cdVV vv;
43 cdNoTm notm;
44 cdPtrPtr ptrptr;
45 };
46  
47 namespace xs {
48 template <class TYPE> struct Typemap<DispatchingObject*,TYPE> : TypemapObject<DispatchingObject*, TYPE, ObjectTypePtr, ObjectStorageMG> {
49 static panda::string_view package () { return "MyTest::DispatchingObject"; }
50 };
51  
52 template <class TYPE> struct Typemap<SomeClass*,TYPE> : TypemapObject<SomeClass*, TYPE, ObjectTypePtr, ObjectStorageMG> {
53 static panda::string_view package () { return "MyTest::SomeClass"; }
54 };
55  
56 template <class TYPE> struct Typemap<SomeClass2*,TYPE> : TypemapObject<SomeClass2*, TYPE, ObjectTypePtr, ObjectStorageMG> {
57 static panda::string_view package () { return "MyTest::SomeClass2"; }
58 };
59 }
60  
61 #line 62 "t/typemap/callback_dispatcher_xsgen.cc"
62 #ifndef PERL_UNUSED_VAR
63 # define PERL_UNUSED_VAR(var) if (0) var = var
64 #endif
65  
66 #ifndef dVAR
67 # define dVAR dNOOP
68 #endif
69  
70  
71 /* This stuff is not part of the API! You have been warned. */
72 #ifndef PERL_VERSION_DECIMAL
73 # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
74 #endif
75 #ifndef PERL_DECIMAL_VERSION
76 # define PERL_DECIMAL_VERSION \
77 PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
78 #endif
79 #ifndef PERL_VERSION_GE
80 # define PERL_VERSION_GE(r,v,s) \
81 (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
82 #endif
83 #ifndef PERL_VERSION_LE
84 # define PERL_VERSION_LE(r,v,s) \
85 (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
86 #endif
87  
88 /* XS_INTERNAL is the explicit static-linkage variant of the default
89 * XS macro.
90 *
91 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
92 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
93 * for anything but the BOOT XSUB.
94 *
95 * See XSUB.h in core!
96 */
97  
98  
99 /* TODO: This might be compatible further back than 5.10.0. */
100 #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
101 # undef XS_EXTERNAL
102 # undef XS_INTERNAL
103 # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
104 # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
105 # define XS_INTERNAL(name) STATIC XSPROTO(name)
106 # endif
107 # if defined(__SYMBIAN32__)
108 # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
109 # define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
110 # endif
111 # ifndef XS_EXTERNAL
112 # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
113 # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
114 # define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
115 # else
116 # ifdef __cplusplus
117 # define XS_EXTERNAL(name) extern "C" XSPROTO(name)
118 # define XS_INTERNAL(name) static XSPROTO(name)
119 # else
120 # define XS_EXTERNAL(name) XSPROTO(name)
121 # define XS_INTERNAL(name) STATIC XSPROTO(name)
122 # endif
123 # endif
124 # endif
125 #endif
126  
127 /* perl >= 5.10.0 && perl <= 5.15.1 */
128  
129  
130 /* The XS_EXTERNAL macro is used for functions that must not be static
131 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
132 * macro defined, the best we can do is assume XS is the same.
133 * Dito for XS_INTERNAL.
134 */
135 #ifndef XS_EXTERNAL
136 # define XS_EXTERNAL(name) XS(name)
137 #endif
138 #ifndef XS_INTERNAL
139 # define XS_INTERNAL(name) XS(name)
140 #endif
141  
142 /* Now, finally, after all this mess, we want an XS::Install::FrozenShit::ParseXS
143 * internal macro that we're free to redefine for varying linkage due
144 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
145 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
146 */
147  
148 #undef XS_EUPXS
149 #if defined(PERL_EUPXS_ALWAYS_EXPORT)
150 # define XS_EUPXS(name) XS_EXTERNAL(name)
151 #else
152 /* default to internal */
153 # define XS_EUPXS(name) XS_INTERNAL(name)
154 #endif
155  
156 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
157 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
158  
159 /* prototype to pass -Wmissing-prototypes */
160 STATIC void
161 S_croak_xs_usage(const CV *const cv, const char *const params);
162  
163 STATIC void
164 S_croak_xs_usage(const CV *const cv, const char *const params)
165 {
166 const GV *const gv = CvGV(cv);
167  
168 PERL_ARGS_ASSERT_CROAK_XS_USAGE;
169  
170 if (gv) {
171 const char *const gvname = GvNAME(gv);
172 const HV *const stash = GvSTASH(gv);
173 const char *const hvname = stash ? HvNAME(stash) : NULL;
174  
175 if (hvname)
176 Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
177 else
178 Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
179 } else {
180 /* Pants. I don't think that it should be possible to get here. */
181 Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
182 }
183 }
184 #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
185  
186 #define croak_xs_usage S_croak_xs_usage
187  
188 #endif
189  
190 /* NOTE: the prototype of newXSproto() is different in versions of perls,
191 * so we define a portable version of newXSproto()
192 */
193 #ifdef newXS_flags
194 #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
195 #else
196 #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
197 #endif /* !defined(newXS_flags) */
198  
199 #if PERL_VERSION_LE(5, 21, 5)
200 # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
201 #else
202 # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
203 #endif
204  
205 /* simple backcompat versions of the TARGx() macros with no optimisation */
206 #ifndef TARGi
207 # define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv)
208 # define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv)
209 # define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv)
210 #endif
211  
212 #line 213 "t/typemap/callback_dispatcher_xsgen.cc"
213  
214  
215 16 ▶XS_EUPXS(XS_MyTest__DispatchingObject_new) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest__DispatchingObject_new) { xs::throw_guard(cv, [=]() 8 0 8
216 {
217 8 dVAR; dXSARGS;
218 8 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 8 8
219 0 croak_xs_usage(cv, "_____unused1");
220 {
221 DispatchingObject * RETVAL;
222 #line 55 "t/typemap/callback_dispatcher.xs"
223 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
224 RETVAL = new DispatchingObject();
225 #line 226 "t/typemap/callback_dispatcher_xsgen.cc"
226 {
227 SV * RETVALSV;
228 8 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 8 0 8
229 8 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 8 0 8
230 8 ST(0) = RETVALSV;
231 }
232 8 }
233 8 XSRETURN(1);
234 8 }); }
235  
236  
237  
238 110 ▶XS_EUPXS(XS_MyTest__DispatchingObject_vs) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest__DispatchingObject_vs) { xs::throw_guard(cv, [=]() 55 0 55
239 {
240 55 dVAR; dXSARGS;
241 55 ▶ if (items < 1 || items > 2)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 2) 55 0 55
if (items < 1 || items > 2) 0 55 55
242 0 croak_xs_usage(cv, "THIS, type= string_view()");
243 {
244 XSCallbackDispatcher * RETVAL;
245 55 ▶ DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 55 0 55
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 55 55
246 ;
247 55 string_view type;
248  
249 55 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 48 7 55
250 48 type = string_view();
251 else {
252 { STRLEN __type_len;
253 7 const char* __type_buf = SvPV(ST(1), __type_len);
254 7 type = decltype(type)(__type_buf, __type_len); }
255 ;
256 }
257 #line 58 "t/typemap/callback_dispatcher.xs"
258 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
259 if (type == "")
260 RETVAL = XSCallbackDispatcher::create(THIS->vs);
261 else if (type == "nullptr")
262 RETVAL = XSCallbackDispatcher::create(THIS->vs, nullptr);
263 else if (type == "pair_inout")
264 RETVAL = XSCallbackDispatcher::create(THIS->vs, std::make_pair(
265 [](string str) { return Simple(str + " custom_out"); },
266 [](const Sv& sv) { return xs::in<string>(sv) + " custom_in"; }
267 ));
268 else if (type == "pair_out")
269 RETVAL = XSCallbackDispatcher::create(THIS->vs, std::make_pair(
270 [](string str) { return Simple(str + " custom_out"); },
271 nullptr
272 ));
273 else if (type == "pair_in")
274 RETVAL = XSCallbackDispatcher::create(THIS->vs, std::make_pair(
275 nullptr,
276 [](const Sv& sv) { return xs::in<string>(sv) + " custom_in"; }
277 ));
278 else throw "wtf";
279 #line 280 "t/typemap/callback_dispatcher_xsgen.cc"
280 {
281 SV * RETVALSV;
282 55 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 55 0 55
283 55 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 55 0 55
284 55 ST(0) = RETVALSV;
285 }
286 55 }
287 55 XSRETURN(1);
288 55 }); }
289  
290  
291  
292 36 ▶XS_EUPXS(XS_MyTest__DispatchingObject_iv) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest__DispatchingObject_iv) { xs::throw_guard(cv, [=]() 18 0 18
293 {
294 18 dVAR; dXSARGS;
295 18 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 18 18
296 0 croak_xs_usage(cv, "THIS");
297 {
298 cdIV * RETVAL;
299 18 ▶ DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 18 0 18
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 18 18
300 ;
301 #line 81 "t/typemap/callback_dispatcher.xs"
302 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
303 RETVAL = &THIS->iv;
304 #line 305 "t/typemap/callback_dispatcher_xsgen.cc"
305 {
306 SV * RETVALSV;
307 18 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 18 0 18
308 18 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 18 0 18
309 18 ST(0) = RETVALSV;
310 }
311 18 }
312 18 XSRETURN(1);
313 18 }); }
314  
315  
316  
317 4 ▶XS_EUPXS(XS_MyTest__DispatchingObject_viref) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest__DispatchingObject_viref) { xs::throw_guard(cv, [=]() 2 0 2
318 {
319 2 dVAR; dXSARGS;
320 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
321 0 croak_xs_usage(cv, "THIS");
322 {
323 XSCallbackDispatcher * RETVAL;
324 2 ▶ DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 2 0 2
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 2 2
325 ;
326 #line 85 "t/typemap/callback_dispatcher.xs"
327 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
328 RETVAL = XSCallbackDispatcher::create(THIS->viref, std::make_pair(
329 [](const int& v) { return xs::out<int>(v); },
330 [](const Sv& sv) { return xs::in<int>(sv); }
331 ));
332 #line 333 "t/typemap/callback_dispatcher_xsgen.cc"
333 {
334 SV * RETVALSV;
335 2 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 2 0 2
336 2 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 2 0 2
337 2 ST(0) = RETVALSV;
338 }
339 2 }
340 2 XSRETURN(1);
341 2 }); }
342  
343  
344  
345 0 ▶XS_EUPXS(XS_MyTest__DispatchingObject_vptrref) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest__DispatchingObject_vptrref) { xs::throw_guard(cv, [=]() 0 0 0
346 {
347 0 dVAR; dXSARGS;
348 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
349 0 croak_xs_usage(cv, "THIS");
350 {
351 cdVPtrref * RETVAL;
352 0 ▶ DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 0 0
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 0 0
353 ;
354 #line 92 "t/typemap/callback_dispatcher.xs"
355 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
356 RETVAL = &THIS->vptrref;
357 #line 358 "t/typemap/callback_dispatcher_xsgen.cc"
358 {
359 SV * RETVALSV;
360 0 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 0 0 0
361 0 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 0 0 0
362 0 ST(0) = RETVALSV;
363 }
364 0 }
365 0 XSRETURN(1);
366 0 }); }
367  
368  
369  
370 28 ▶XS_EUPXS(XS_MyTest__DispatchingObject_is) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest__DispatchingObject_is) { xs::throw_guard(cv, [=]() 14 0 14
371 {
372 14 dVAR; dXSARGS;
373 14 ▶ if (items < 1 || items > 2)
Branch: 2 branches
BranchTrueFalseTotal
if (items < 1 || items > 2) 14 0 14
if (items < 1 || items > 2) 0 14 14
374 0 croak_xs_usage(cv, "THIS, type= string_view()");
375 {
376 XSCallbackDispatcher * RETVAL;
377 14 ▶ DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 14 0 14
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 14 14
378 ;
379 14 string_view type;
380  
381 14 ▶ if (items < 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items < 2) 8 6 14
382 8 type = string_view();
383 else {
384 { STRLEN __type_len;
385 6 const char* __type_buf = SvPV(ST(1), __type_len);
386 6 type = decltype(type)(__type_buf, __type_len); }
387 ;
388 }
389 #line 96 "t/typemap/callback_dispatcher.xs"
390 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
391 if (type == "")
392 RETVAL = XSCallbackDispatcher::create(THIS->is);
393 else if (type == "nullptr")
394 RETVAL = XSCallbackDispatcher::create(THIS->is, nullptr);
395 else if (type == "ret_inout")
396 RETVAL = XSCallbackDispatcher::create(THIS->is, std::make_pair(
397 [](panda::optional<int> val) { return val ? Simple(*val + 100) : Simple::undef; },
398 [](const Sv& sv) { return xs::in<int>(sv) + 10; }
399 ));
400 else if (type == "ret_arg_inout")
401 RETVAL = XSCallbackDispatcher::create(THIS->is, std::make_pair(
402 [](panda::optional<int> val) { return val ? Simple(*val + 100) : Simple::undef; },
403 [](const Sv& sv) { return xs::in<int>(sv) + 10; }
404 ), std::make_pair(
405 [](string str) { return Simple(str + " custom_out"); },
406 [](const Sv& sv) { return xs::in<string>(sv) + " custom_in"; }
407 ));
408 else throw "wtf";
409 #line 410 "t/typemap/callback_dispatcher_xsgen.cc"
410 {
411 SV * RETVALSV;
412 14 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 14 0 14
413 14 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 14 0 14
414 14 ST(0) = RETVALSV;
415 }
416 14 }
417 14 XSRETURN(1);
418 14 }); }
419  
420  
421  
422 36 ▶XS_EUPXS(XS_MyTest__DispatchingObject_vv) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest__DispatchingObject_vv) { xs::throw_guard(cv, [=]() 18 0 18
423 {
424 18 dVAR; dXSARGS;
425 18 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 18 18
426 0 croak_xs_usage(cv, "THIS");
427 {
428 cdVV * RETVAL;
429 18 ▶ DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 18 0 18
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 18 18
430 ;
431 #line 117 "t/typemap/callback_dispatcher.xs"
432 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
433 RETVAL = &THIS->vv;
434 #line 435 "t/typemap/callback_dispatcher_xsgen.cc"
435 {
436 SV * RETVALSV;
437 18 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 18 0 18
438 18 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 18 0 18
439 18 ST(0) = RETVALSV;
440 }
441 18 }
442 18 XSRETURN(1);
443 18 }); }
444  
445  
446  
447 8 ▶XS_EUPXS(XS_MyTest__DispatchingObject_notm) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest__DispatchingObject_notm) { xs::throw_guard(cv, [=]() 4 0 4
448 {
449 4 dVAR; dXSARGS;
450 4 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 4 4
451 0 croak_xs_usage(cv, "THIS");
452 {
453 XSCallbackDispatcher * RETVAL;
454 4 ▶ DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 4 0 4
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 4 4
455 ;
456 #line 121 "t/typemap/callback_dispatcher.xs"
457 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
458 auto caster = std::make_pair(
459 [](panda::optional<NoTmStruct> a) { return a ? Simple(a.value().val + "o") : Simple::undef; },
460 [](const Sv& arg) { return NoTmStruct { xs::in<string>(arg) + "i" }; }
461 );
462 RETVAL = XSCallbackDispatcher::create(THIS->notm, caster, caster);
463 #line 464 "t/typemap/callback_dispatcher_xsgen.cc"
464 {
465 SV * RETVALSV;
466 4 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 4 0 4
467 4 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 4 0 4
468 4 ST(0) = RETVALSV;
469 }
470 4 }
471 4 XSRETURN(1);
472 4 }); }
473  
474  
475  
476 0 ▶XS_EUPXS(XS_MyTest__DispatchingObject_ptrptr) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest__DispatchingObject_ptrptr) { xs::throw_guard(cv, [=]() 0 0 0
477 {
478 0 dVAR; dXSARGS;
479 0 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 0 0
480 0 croak_xs_usage(cv, "THIS");
481 {
482 cdPtrPtr * RETVAL;
483 0 ▶ DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 2 branches
BranchTrueFalseTotal
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 0 0
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 0 0
484 ;
485 #line 129 "t/typemap/callback_dispatcher.xs"
486 xs::Sv PROTO; PERL_UNUSED_VAR(PROTO);
487 RETVAL = &THIS->ptrptr;
488 #line 489 "t/typemap/callback_dispatcher_xsgen.cc"
489 {
490 SV * RETVALSV;
491 0 ▶ RETVALSV = xs::out(RETVAL, PROTO).detach();
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = xs::out(RETVAL, PROTO).detach(); 0 0 0
492 0 ▶ RETVALSV = sv_2mortal(RETVALSV);
Branch: 1 branch
BranchTrueFalseTotal
RETVALSV = sv_2mortal(RETVALSV); 0 0 0
493 0 ST(0) = RETVALSV;
494 }
495 0 }
496 0 XSRETURN(1);
497 0 }); }
498  
499  
500  
501 0 ▶XS_EUPXS(XS_MyTest__DispatchingObject_call_vv) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest__DispatchingObject_call_vv) { xs::throw_guard(cv, [=]() 0 0 0
502 {
503 0 dVAR; dXSARGS;
504 0 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 0 0
505 0 croak_xs_usage(cv, "THIS, cnt");
506 PERL_UNUSED_VAR(ax); /* -Wall */
507 0 SP -= items;
508 {
509 0 ▶ DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 1 branch
BranchTrueFalseTotal
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 0 0
510 ;
511 0 size_t cnt = (size_t)SvUV(ST(1))
512 ;
513 #line 133 "t/typemap/callback_dispatcher.xs"
514 for (size_t i = 0; i < cnt; ++i) THIS->vv();
515 #line 516 "t/typemap/callback_dispatcher_xsgen.cc"
516 0 PUTBACK;
517 0 return;
518 }
519 0 }); }
520  
521  
522  
523 0 ▶XS_EUPXS(XS_MyTest__DispatchingObject_call_vs) { xs::throw_guard(cv, [=]()
Branch: 1 branch
BranchTrueFalseTotal
XS_EUPXS(XS_MyTest__DispatchingObject_call_vs) { xs::throw_guard(cv, [=]() 0 0 0
524 {
525 0 dVAR; dXSARGS;
526 0 ▶ if (items != 2)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 2) 0 0 0
527 0 croak_xs_usage(cv, "THIS, cnt");
528 PERL_UNUSED_VAR(ax); /* -Wall */
529 0 SP -= items;
530 {
531 0 ▶ DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS";
Branch: 1 branch
BranchTrueFalseTotal
DispatchingObject* THIS = xs::in<DispatchingObject *>(ST(0)); if (!SvOK(ST(0))) throw "undef not allowed as THIS"; 0 0 0
532 ;
533 0 size_t cnt = (size_t)SvUV(ST(1))
534 ;
535 #line 137 "t/typemap/callback_dispatcher.xs"
536 for (size_t i = 0; i < cnt; ++i) THIS->vs("hello");
537 #line 538 "t/typemap/callback_dispatcher_xsgen.cc"
538 0 PUTBACK;
539 0 return;
540 }
541 0 }); }
542  
543 #ifdef __cplusplus
544 extern "C" {
545 #endif
546  
547 70 ▶XS_EXTERNAL(boot_MyTest__Typemap__CD) { xs::throw_guard(cv, [=]() mutable
Branch: 1 branch
BranchTrueFalseTotal
XS_EXTERNAL(boot_MyTest__Typemap__CD) { xs::throw_guard(cv, [=]() mutable 35 0 35
548 {
549 #if PERL_VERSION_LE(5, 21, 5)
550 dVAR; dXSARGS;
551 #else
552 35 dVAR; dXSBOOTARGSXSAPIVERCHK;
553 #endif
554 #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
555 char* file = __FILE__;
556 #else
557 35 const char* file = __FILE__;
558 #endif
559  
560 PERL_UNUSED_VAR(file);
561  
562 PERL_UNUSED_VAR(cv); /* -W */
563 PERL_UNUSED_VAR(items); /* -W */
564 #if PERL_VERSION_LE(5, 21, 5)
565 XS_VERSION_BOOTCHECK;
566 # ifdef XS_APIVERSION_BOOTCHECK
567 XS_APIVERSION_BOOTCHECK;
568 # endif
569 #endif
570  
571 35 newXS_deffile("MyTest::DispatchingObject::new", XS_MyTest__DispatchingObject_new);
572 35 newXS_deffile("MyTest::DispatchingObject::vs", XS_MyTest__DispatchingObject_vs);
573 35 newXS_deffile("MyTest::DispatchingObject::iv", XS_MyTest__DispatchingObject_iv);
574 35 newXS_deffile("MyTest::DispatchingObject::viref", XS_MyTest__DispatchingObject_viref);
575 35 newXS_deffile("MyTest::DispatchingObject::vptrref", XS_MyTest__DispatchingObject_vptrref);
576 35 newXS_deffile("MyTest::DispatchingObject::is", XS_MyTest__DispatchingObject_is);
577 35 newXS_deffile("MyTest::DispatchingObject::vv", XS_MyTest__DispatchingObject_vv);
578 35 newXS_deffile("MyTest::DispatchingObject::notm", XS_MyTest__DispatchingObject_notm);
579 35 newXS_deffile("MyTest::DispatchingObject::ptrptr", XS_MyTest__DispatchingObject_ptrptr);
580 35 newXS_deffile("MyTest::DispatchingObject::call_vv", XS_MyTest__DispatchingObject_call_vv);
581 35 newXS_deffile("MyTest::DispatchingObject::call_vs", XS_MyTest__DispatchingObject_call_vs);
582 #if PERL_VERSION_LE(5, 21, 5)
583 # if PERL_VERSION_GE(5, 9, 0)
584 if (PL_unitcheckav)
585 call_list(PL_scopestack_ix, PL_unitcheckav);
586 # endif
587 XSRETURN_YES;
588 #else
589 35 Perl_xs_boot_epilog(aTHX_ ax);
590 #endif
591 70 }); }
592  
593 #ifdef __cplusplus
594 }
595 #endif
« src/xs/Object.cc ↑ Summary t/svapi/scalar.cc »