XS_xsgen.cc

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