Syck.c

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