Base2N_xsgen.cc

filter: Statementstmt 92.9% 79 / 85 Branchbran 50.0% 12 / 24 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 83.4% 91 / 109 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« Base2N.xs ↑ Summary blib/arch/Encode/Base2N.pm »
1 /*
2 * This file was generated automatically by XS::Install::FrozenShit::ParseXS version 3.57 from the
3 * contents of Base2N.xs. Do not edit this file, edit Base2N.xs instead.
4 *
5 * ANY CHANGES MADE HERE WILL BE LOST!
6 *
7 */
8  
9 #line 1 "Base2N.xs"
10 #include <xsheader.h>
11 #include <panda/encode/base2n.h>
12  
13 using namespace panda::encode;
14 using panda::string_view;
15  
16 #line 17 "Base2N_xsgen.cc"
17 #ifndef PERL_UNUSED_VAR
18 # define PERL_UNUSED_VAR(var) if (0) var = var
19 #endif
20  
21 #ifndef dVAR
22 # define dVAR dNOOP
23 #endif
24  
25  
26 /* This stuff is not part of the API! You have been warned. */
27 #ifndef PERL_VERSION_DECIMAL
28 # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
29 #endif
30 #ifndef PERL_DECIMAL_VERSION
31 # define PERL_DECIMAL_VERSION \
32 PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
33 #endif
34 #ifndef PERL_VERSION_GE
35 # define PERL_VERSION_GE(r,v,s) \
36 (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
37 #endif
38 #ifndef PERL_VERSION_LE
39 # define PERL_VERSION_LE(r,v,s) \
40 (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
41 #endif
42  
43 /* XS_INTERNAL is the explicit static-linkage variant of the default
44 * XS macro.
45 *
46 * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
47 * "STATIC", ie. it exports XSUB symbols. You probably don't want that
48 * for anything but the BOOT XSUB.
49 *
50 * See XSUB.h in core!
51 */
52  
53  
54 /* TODO: This might be compatible further back than 5.10.0. */
55 #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
56 # undef XS_EXTERNAL
57 # undef XS_INTERNAL
58 # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
59 # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
60 # define XS_INTERNAL(name) STATIC XSPROTO(name)
61 # endif
62 # if defined(__SYMBIAN32__)
63 # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
64 # define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
65 # endif
66 # ifndef XS_EXTERNAL
67 # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
68 # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
69 # define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
70 # else
71 # ifdef __cplusplus
72 # define XS_EXTERNAL(name) extern "C" XSPROTO(name)
73 # define XS_INTERNAL(name) static XSPROTO(name)
74 # else
75 # define XS_EXTERNAL(name) XSPROTO(name)
76 # define XS_INTERNAL(name) STATIC XSPROTO(name)
77 # endif
78 # endif
79 # endif
80 #endif
81  
82 /* perl >= 5.10.0 && perl <= 5.15.1 */
83  
84  
85 /* The XS_EXTERNAL macro is used for functions that must not be static
86 * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
87 * macro defined, the best we can do is assume XS is the same.
88 * Dito for XS_INTERNAL.
89 */
90 #ifndef XS_EXTERNAL
91 # define XS_EXTERNAL(name) XS(name)
92 #endif
93 #ifndef XS_INTERNAL
94 # define XS_INTERNAL(name) XS(name)
95 #endif
96  
97 /* Now, finally, after all this mess, we want an XS::Install::FrozenShit::ParseXS
98 * internal macro that we're free to redefine for varying linkage due
99 * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
100 * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
101 */
102  
103 #undef XS_EUPXS
104 #if defined(PERL_EUPXS_ALWAYS_EXPORT)
105 # define XS_EUPXS(name) XS_EXTERNAL(name)
106 #else
107 /* default to internal */
108 # define XS_EUPXS(name) XS_INTERNAL(name)
109 #endif
110  
111 #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
112 #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
113  
114 /* prototype to pass -Wmissing-prototypes */
115 STATIC void
116 S_croak_xs_usage(const CV *const cv, const char *const params);
117  
118 STATIC void
119 S_croak_xs_usage(const CV *const cv, const char *const params)
120 {
121 const GV *const gv = CvGV(cv);
122  
123 PERL_ARGS_ASSERT_CROAK_XS_USAGE;
124  
125 if (gv) {
126 const char *const gvname = GvNAME(gv);
127 const HV *const stash = GvSTASH(gv);
128 const char *const hvname = stash ? HvNAME(stash) : NULL;
129  
130 if (hvname)
131 Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
132 else
133 Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
134 } else {
135 /* Pants. I don't think that it should be possible to get here. */
136 Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
137 }
138 }
139 #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
140  
141 #define croak_xs_usage S_croak_xs_usage
142  
143 #endif
144  
145 /* NOTE: the prototype of newXSproto() is different in versions of perls,
146 * so we define a portable version of newXSproto()
147 */
148 #ifdef newXS_flags
149 #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
150 #else
151 #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
152 #endif /* !defined(newXS_flags) */
153  
154 #if PERL_VERSION_LE(5, 21, 5)
155 # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
156 #else
157 # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
158 #endif
159  
160 /* simple backcompat versions of the TARGx() macros with no optimisation */
161 #ifndef TARGi
162 # define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv)
163 # define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv)
164 # define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv)
165 #endif
166  
167 #line 168 "Base2N_xsgen.cc"
168  
169  
170 4 XS_EUPXS(XS_Encode__Base2N_encode_base64)
171 {
172 4 dVAR; dXSARGS;
173 4 dXSI32;
174 4 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 4 4
175 0 croak_xs_usage(cv, "input");
176 {
177 SV * RETVAL;
178 4 string_view input;
179  
180 { STRLEN __input_len;
181 4 const char* __input_buf = SvPV(ST(0), __input_len);
182 4 input = decltype(input)(__input_buf, __input_len); }
183 ;
184 #line 11 "Base2N.xs"
185 RETVAL = newSV(encode_base64_getlen(input.length()) + 1);
186 SvPOK_on(RETVAL);
187 size_t rlen = encode_base64(input, SvPVX(RETVAL), ix == 1 ? true : false, ix == 2 ? true : false);
188 SvPVX(RETVAL)[rlen] = 0;
189 SvCUR_set(RETVAL, rlen);
190 #line 191 "Base2N_xsgen.cc"
191 4 ▶ RETVAL = sv_2mortal(RETVAL);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = sv_2mortal(RETVAL); 4 0 4
192 4 ST(0) = RETVAL;
193 }
194 4 XSRETURN(1);
195 }
196  
197  
198  
199 4 XS_EUPXS(XS_Encode__Base2N_decode_base64)
200 {
201 4 dVAR; dXSARGS;
202 4 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 4 4
203 0 croak_xs_usage(cv, "input");
204 {
205 SV * RETVAL;
206 4 string_view input;
207  
208 { STRLEN __input_len;
209 4 const char* __input_buf = SvPV(ST(0), __input_len);
210 4 input = decltype(input)(__input_buf, __input_len); }
211 ;
212 #line 19 "Base2N.xs"
213 RETVAL = newSV(decode_base64_getlen(input.length()) + 1);
214 SvPOK_on(RETVAL);
215 size_t rlen = decode_base64(input, SvPVX(RETVAL));
216 SvPVX(RETVAL)[rlen] = 0;
217 SvCUR_set(RETVAL, rlen);
218 #line 219 "Base2N_xsgen.cc"
219 4 ▶ RETVAL = sv_2mortal(RETVAL);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = sv_2mortal(RETVAL); 4 0 4
220 4 ST(0) = RETVAL;
221 }
222 4 XSRETURN(1);
223 }
224  
225  
226  
227 2 XS_EUPXS(XS_Encode__Base2N_encode_base32)
228 {
229 2 dVAR; dXSARGS;
230 2 dXSI32;
231 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
232 0 croak_xs_usage(cv, "input");
233 {
234 SV * RETVAL;
235 2 string_view input;
236  
237 { STRLEN __input_len;
238 2 const char* __input_buf = SvPV(ST(0), __input_len);
239 2 input = decltype(input)(__input_buf, __input_len); }
240 ;
241 #line 27 "Base2N.xs"
242 RETVAL = newSV(encode_base32_getlen(input.length()) + 1);
243 SvPOK_on(RETVAL);
244 size_t rlen = encode_base32(input, SvPVX(RETVAL), ix == 1 ? false : true);
245 SvPVX(RETVAL)[rlen] = 0;
246 SvCUR_set(RETVAL, rlen);
247 #line 248 "Base2N_xsgen.cc"
248 2 ▶ RETVAL = sv_2mortal(RETVAL);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = sv_2mortal(RETVAL); 2 0 2
249 2 ST(0) = RETVAL;
250 }
251 2 XSRETURN(1);
252 }
253  
254  
255  
256 2 XS_EUPXS(XS_Encode__Base2N_decode_base32)
257 {
258 2 dVAR; dXSARGS;
259 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
260 0 croak_xs_usage(cv, "input");
261 {
262 SV * RETVAL;
263 2 string_view input;
264  
265 { STRLEN __input_len;
266 2 const char* __input_buf = SvPV(ST(0), __input_len);
267 2 input = decltype(input)(__input_buf, __input_len); }
268 ;
269 #line 35 "Base2N.xs"
270 RETVAL = newSV(decode_base32_getlen(input.length()) + 1);
271 SvPOK_on(RETVAL);
272 size_t rlen = decode_base32(input, SvPVX(RETVAL));
273 SvPVX(RETVAL)[rlen] = 0;
274 SvCUR_set(RETVAL, rlen);
275 #line 276 "Base2N_xsgen.cc"
276 2 ▶ RETVAL = sv_2mortal(RETVAL);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = sv_2mortal(RETVAL); 2 0 2
277 2 ST(0) = RETVAL;
278 }
279 2 XSRETURN(1);
280 }
281  
282  
283  
284 2 XS_EUPXS(XS_Encode__Base2N_encode_base16)
285 {
286 2 dVAR; dXSARGS;
287 2 dXSI32;
288 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
289 0 croak_xs_usage(cv, "input");
290 {
291 SV * RETVAL;
292 2 string_view input;
293  
294 { STRLEN __input_len;
295 2 const char* __input_buf = SvPV(ST(0), __input_len);
296 2 input = decltype(input)(__input_buf, __input_len); }
297 ;
298 #line 43 "Base2N.xs"
299 RETVAL = newSV(encode_base16_getlen(input.length()) + 1);
300 SvPOK_on(RETVAL);
301 size_t rlen = encode_base16(input, SvPVX(RETVAL), ix == 1 ? false : true);
302 SvPVX(RETVAL)[rlen] = 0;
303 SvCUR_set(RETVAL, rlen);
304 #line 305 "Base2N_xsgen.cc"
305 2 ▶ RETVAL = sv_2mortal(RETVAL);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = sv_2mortal(RETVAL); 2 0 2
306 2 ST(0) = RETVAL;
307 }
308 2 XSRETURN(1);
309 }
310  
311  
312  
313 2 XS_EUPXS(XS_Encode__Base2N_decode_base16)
314 {
315 2 dVAR; dXSARGS;
316 2 ▶ if (items != 1)
Branch: 1 branch
BranchTrueFalseTotal
if (items != 1) 0 2 2
317 0 croak_xs_usage(cv, "input");
318 {
319 SV * RETVAL;
320 2 string_view input;
321  
322 { STRLEN __input_len;
323 2 const char* __input_buf = SvPV(ST(0), __input_len);
324 2 input = decltype(input)(__input_buf, __input_len); }
325 ;
326 #line 51 "Base2N.xs"
327 RETVAL = newSV(decode_base16_getlen(input.length()) + 1);
328 SvPOK_on(RETVAL);
329 size_t rlen = decode_base16(input, SvPVX(RETVAL));
330 SvPVX(RETVAL)[rlen] = 0;
331 SvCUR_set(RETVAL, rlen);
332 #line 333 "Base2N_xsgen.cc"
333 2 ▶ RETVAL = sv_2mortal(RETVAL);
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = sv_2mortal(RETVAL); 2 0 2
334 2 ST(0) = RETVAL;
335 }
336 2 XSRETURN(1);
337 }
338  
339 #ifdef __cplusplus
340 extern "C" {
341 #endif
342  
343 4 XS_EXTERNAL(boot_Encode__Base2N)
344 {
345 #if PERL_VERSION_LE(5, 21, 5)
346 dVAR; dXSARGS;
347 #else
348 4 dVAR; dXSBOOTARGSXSAPIVERCHK;
349 #endif
350 #if PERL_VERSION_LE(5, 8, 999) /* PERL_VERSION_LT is 5.33+ */
351 char* file = __FILE__;
352 #else
353 4 const char* file = __FILE__;
354 #endif
355  
356 PERL_UNUSED_VAR(file);
357  
358 PERL_UNUSED_VAR(cv); /* -W */
359 PERL_UNUSED_VAR(items); /* -W */
360 #if PERL_VERSION_LE(5, 21, 5)
361 XS_VERSION_BOOTCHECK;
362 # ifdef XS_APIVERSION_BOOTCHECK
363 XS_APIVERSION_BOOTCHECK;
364 # endif
365 #endif
366  
367 4 cv = newXS_deffile("Encode::Base2N::encode_base64", XS_Encode__Base2N_encode_base64);
368 4 XSANY.any_i32 = 0;
369 4 cv = newXS_deffile("Encode::Base2N::encode_base64pad", XS_Encode__Base2N_encode_base64);
370 4 XSANY.any_i32 = 2;
371 4 cv = newXS_deffile("Encode::Base2N::encode_base64url", XS_Encode__Base2N_encode_base64);
372 4 XSANY.any_i32 = 1;
373 4 newXS_deffile("Encode::Base2N::decode_base64", XS_Encode__Base2N_decode_base64);
374 4 cv = newXS_deffile("Encode::Base2N::encode_base32", XS_Encode__Base2N_encode_base32);
375 4 XSANY.any_i32 = 0;
376 4 cv = newXS_deffile("Encode::Base2N::encode_base32low", XS_Encode__Base2N_encode_base32);
377 4 XSANY.any_i32 = 1;
378 4 newXS_deffile("Encode::Base2N::decode_base32", XS_Encode__Base2N_decode_base32);
379 4 cv = newXS_deffile("Encode::Base2N::encode_base16", XS_Encode__Base2N_encode_base16);
380 4 XSANY.any_i32 = 0;
381 4 cv = newXS_deffile("Encode::Base2N::encode_base16low", XS_Encode__Base2N_encode_base16);
382 4 XSANY.any_i32 = 1;
383 4 newXS_deffile("Encode::Base2N::decode_base16", XS_Encode__Base2N_decode_base16);
384 #if PERL_VERSION_LE(5, 21, 5)
385 # if PERL_VERSION_GE(5, 9, 0)
386 if (PL_unitcheckav)
387 call_list(PL_scopestack_ix, PL_unitcheckav);
388 # endif
389 XSRETURN_YES;
390 #else
391 4 Perl_xs_boot_epilog(aTHX_ ax);
392 #endif
393 4 }
394  
395 #ifdef __cplusplus
396 }
397 #endif
« Base2N.xs ↑ Summary blib/arch/Encode/Base2N.pm »