File Coverage

PSGRAPH.c
Criterion Covered Total %
statement 14 15 93.3
branch 2 4 50.0
condition n/a
subroutine n/a
pod n/a
total 16 19 84.2


line stmt bran cond sub pod time code
1             /*
2             * This file was generated automatically by ExtUtils::ParseXS version 3.34 from the
3             * contents of PSGRAPH.xs. Do not edit this file, edit PSGRAPH.xs instead.
4             *
5             * ANY CHANGES MADE HERE WILL BE LOST!
6             *
7             */
8              
9             #line 1 "PSGRAPH.xs"
10             #include "EXTERN.h"
11             #include "perl.h"
12             #include "XSUB.h"
13              
14             #include "ppport.h"
15              
16             #include "const-c.inc"
17              
18             #line 19 "PSGRAPH.c"
19             #ifndef PERL_UNUSED_VAR
20             # define PERL_UNUSED_VAR(var) if (0) var = var
21             #endif
22              
23             #ifndef dVAR
24             # define dVAR dNOOP
25             #endif
26              
27              
28             /* This stuff is not part of the API! You have been warned. */
29             #ifndef PERL_VERSION_DECIMAL
30             # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
31             #endif
32             #ifndef PERL_DECIMAL_VERSION
33             # define PERL_DECIMAL_VERSION \
34             PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
35             #endif
36             #ifndef PERL_VERSION_GE
37             # define PERL_VERSION_GE(r,v,s) \
38             (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
39             #endif
40             #ifndef PERL_VERSION_LE
41             # define PERL_VERSION_LE(r,v,s) \
42             (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
43             #endif
44              
45             /* XS_INTERNAL is the explicit static-linkage variant of the default
46             * XS macro.
47             *
48             * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
49             * "STATIC", ie. it exports XSUB symbols. You probably don't want that
50             * for anything but the BOOT XSUB.
51             *
52             * See XSUB.h in core!
53             */
54              
55              
56             /* TODO: This might be compatible further back than 5.10.0. */
57             #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
58             # undef XS_EXTERNAL
59             # undef XS_INTERNAL
60             # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
61             # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
62             # define XS_INTERNAL(name) STATIC XSPROTO(name)
63             # endif
64             # if defined(__SYMBIAN32__)
65             # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
66             # define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
67             # endif
68             # ifndef XS_EXTERNAL
69             # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
70             # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
71             # define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
72             # else
73             # ifdef __cplusplus
74             # define XS_EXTERNAL(name) extern "C" XSPROTO(name)
75             # define XS_INTERNAL(name) static XSPROTO(name)
76             # else
77             # define XS_EXTERNAL(name) XSPROTO(name)
78             # define XS_INTERNAL(name) STATIC XSPROTO(name)
79             # endif
80             # endif
81             # endif
82             #endif
83              
84             /* perl >= 5.10.0 && perl <= 5.15.1 */
85              
86              
87             /* The XS_EXTERNAL macro is used for functions that must not be static
88             * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
89             * macro defined, the best we can do is assume XS is the same.
90             * Dito for XS_INTERNAL.
91             */
92             #ifndef XS_EXTERNAL
93             # define XS_EXTERNAL(name) XS(name)
94             #endif
95             #ifndef XS_INTERNAL
96             # define XS_INTERNAL(name) XS(name)
97             #endif
98              
99             /* Now, finally, after all this mess, we want an ExtUtils::ParseXS
100             * internal macro that we're free to redefine for varying linkage due
101             * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
102             * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
103             */
104              
105             #undef XS_EUPXS
106             #if defined(PERL_EUPXS_ALWAYS_EXPORT)
107             # define XS_EUPXS(name) XS_EXTERNAL(name)
108             #else
109             /* default to internal */
110             # define XS_EUPXS(name) XS_INTERNAL(name)
111             #endif
112              
113             #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
114             #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
115              
116             /* prototype to pass -Wmissing-prototypes */
117             STATIC void
118             S_croak_xs_usage(const CV *const cv, const char *const params);
119              
120             STATIC void
121             S_croak_xs_usage(const CV *const cv, const char *const params)
122             {
123             const GV *const gv = CvGV(cv);
124              
125             PERL_ARGS_ASSERT_CROAK_XS_USAGE;
126              
127             if (gv) {
128             const char *const gvname = GvNAME(gv);
129             const HV *const stash = GvSTASH(gv);
130             const char *const hvname = stash ? HvNAME(stash) : NULL;
131              
132             if (hvname)
133             Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
134             else
135             Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
136             } else {
137             /* Pants. I don't think that it should be possible to get here. */
138             Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
139             }
140             }
141             #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
142              
143             #define croak_xs_usage S_croak_xs_usage
144              
145             #endif
146              
147             /* NOTE: the prototype of newXSproto() is different in versions of perls,
148             * so we define a portable version of newXSproto()
149             */
150             #ifdef newXS_flags
151             #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
152             #else
153             #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
154             #endif /* !defined(newXS_flags) */
155              
156             #if PERL_VERSION_LE(5, 21, 5)
157             # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
158             #else
159             # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
160             #endif
161              
162             #line 163 "PSGRAPH.c"
163              
164             /* INCLUDE: Including 'const-xs.inc' from 'PSGRAPH.xs' */
165              
166              
167             XS_EUPXS(XS_PSGRAPH_constant); /* prototype to pass -Wmissing-prototypes */
168 1           XS_EUPXS(XS_PSGRAPH_constant)
169             {
170 1           dVAR; dXSARGS;
171 1 50         if (items != 1)
172 0           croak_xs_usage(cv, "sv");
173             PERL_UNUSED_VAR(ax); /* -Wall */
174 1           SP -= items;
175             {
176             #line 4 "./const-xs.inc"
177             #ifdef dXSTARG
178             dXSTARG; /* Faster if we have it. */
179             #else
180             dTARGET;
181             #endif
182             STRLEN len;
183             int type;
184             /* IV iv; Uncomment this if you need to return IVs */
185             /* NV nv; Uncomment this if you need to return NVs */
186             /* const char *pv; Uncomment this if you need to return PVs */
187             #line 188 "PSGRAPH.c"
188 1           SV * sv = ST(0)
189             ;
190 1 50         const char * s = SvPV(sv, len);
191             #line 18 "./const-xs.inc"
192             type = constant(aTHX_ s, len);
193             /* Return 1 or 2 items. First is error message, or undef if no error.
194             Second, if present, is found value */
195             switch (type) {
196             case PERL_constant_NOTFOUND:
197             sv =
198             sv_2mortal(newSVpvf("%s is not a valid PSGRAPH macro", s));
199             PUSHs(sv);
200             break;
201             case PERL_constant_NOTDEF:
202             sv = sv_2mortal(newSVpvf(
203             "Your vendor has not defined PSGRAPH macro %s, used",
204             s));
205             PUSHs(sv);
206             break;
207             /* Uncomment this if you need to return IVs
208             case PERL_constant_ISIV:
209             EXTEND(SP, 1);
210             PUSHs(&PL_sv_undef);
211             PUSHi(iv);
212             break; */
213             /* Uncomment this if you need to return NOs
214             case PERL_constant_ISNO:
215             EXTEND(SP, 1);
216             PUSHs(&PL_sv_undef);
217             PUSHs(&PL_sv_no);
218             break; */
219             /* Uncomment this if you need to return NVs
220             case PERL_constant_ISNV:
221             EXTEND(SP, 1);
222             PUSHs(&PL_sv_undef);
223             PUSHn(nv);
224             break; */
225             /* Uncomment this if you need to return PVs
226             case PERL_constant_ISPV:
227             EXTEND(SP, 1);
228             PUSHs(&PL_sv_undef);
229             PUSHp(pv, strlen(pv));
230             break; */
231             /* Uncomment this if you need to return PVNs
232             case PERL_constant_ISPVN:
233             EXTEND(SP, 1);
234             PUSHs(&PL_sv_undef);
235             PUSHp(pv, iv);
236             break; */
237             /* Uncomment this if you need to return SVs
238             case PERL_constant_ISSV:
239             EXTEND(SP, 1);
240             PUSHs(&PL_sv_undef);
241             PUSHs(sv);
242             break; */
243             /* Uncomment this if you need to return UNDEFs
244             case PERL_constant_ISUNDEF:
245             break; */
246             /* Uncomment this if you need to return UVs
247             case PERL_constant_ISUV:
248             EXTEND(SP, 1);
249             PUSHs(&PL_sv_undef);
250             PUSHu((UV)iv);
251             break; */
252             /* Uncomment this if you need to return YESs
253             case PERL_constant_ISYES:
254             EXTEND(SP, 1);
255             PUSHs(&PL_sv_undef);
256             PUSHs(&PL_sv_yes);
257             break; */
258             default:
259             sv = sv_2mortal(newSVpvf(
260             "Unexpected return type %d while processing PSGRAPH macro %s, used",
261             type, s));
262             PUSHs(sv);
263             }
264             #line 265 "PSGRAPH.c"
265 1           PUTBACK;
266 1           return;
267             }
268             }
269              
270              
271             /* INCLUDE: Returning to 'PSGRAPH.xs' from 'const-xs.inc' */
272              
273             #ifdef __cplusplus
274             extern "C"
275             #endif
276             XS_EXTERNAL(boot_PSGRAPH); /* prototype to pass -Wmissing-prototypes */
277 1           XS_EXTERNAL(boot_PSGRAPH)
278             {
279             #if PERL_VERSION_LE(5, 21, 5)
280             dVAR; dXSARGS;
281             #else
282 1           dVAR; dXSBOOTARGSXSAPIVERCHK;
283             #endif
284             #if (PERL_REVISION == 5 && PERL_VERSION < 9)
285             char* file = __FILE__;
286             #else
287 1           const char* file = __FILE__;
288             #endif
289              
290             PERL_UNUSED_VAR(file);
291              
292             PERL_UNUSED_VAR(cv); /* -W */
293             PERL_UNUSED_VAR(items); /* -W */
294             #if PERL_VERSION_LE(5, 21, 5)
295             XS_VERSION_BOOTCHECK;
296             # ifdef XS_APIVERSION_BOOTCHECK
297             XS_APIVERSION_BOOTCHECK;
298             # endif
299             #endif
300              
301 1           newXS_deffile("PSGRAPH::constant", XS_PSGRAPH_constant);
302             #if PERL_VERSION_LE(5, 21, 5)
303             # if PERL_VERSION_GE(5, 9, 0)
304             if (PL_unitcheckav)
305             call_list(PL_scopestack_ix, PL_unitcheckav);
306             # endif
307             XSRETURN_YES;
308             #else
309 1           Perl_xs_boot_epilog(aTHX_ ax);
310             #endif
311 1           }
312