File Coverage

JIS2K.c
Criterion Covered Total %
statement 18 18 100.0
branch 5 8 62.5
condition n/a
subroutine n/a
pod n/a
total 23 26 88.4


line stmt bran cond sub pod time code
1             /*
2             * This file was generated automatically by ExtUtils::ParseXS version 3.57 from the
3             * contents of JIS2K.xs. Do not edit this file, edit JIS2K.xs instead.
4             *
5             * ANY CHANGES MADE HERE WILL BE LOST!
6             *
7             */
8              
9             #include
10             #include
11             #include
12             #define U8 U8
13             #include "encode.h"
14             #include "euc2k_t.h"
15             #include "raw_t.h"
16             #include "sjis2k_t.h"
17              
18             static void
19 4           Encode_XSEncoding(pTHX_ encode_t *enc)
20             {
21 4           dSP;
22 4           HV *stash = gv_stashpv("Encode::XS", TRUE);
23 4           SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))),stash);
24 4           int i = 0;
25 4 50         PUSHMARK(sp);
26 4 50         XPUSHs(sv);
27 8 100         while (enc->name[i])
28             {
29 4           const char *name = enc->name[i++];
30 4 50         XPUSHs(sv_2mortal(newSVpvn(name,strlen(name))));
31             }
32 4           PUTBACK;
33 4           call_pv("Encode::define_encoding",G_DISCARD);
34 4           SvREFCNT_dec(sv);
35 4           }
36              
37             #ifndef PERL_UNUSED_VAR
38             # define PERL_UNUSED_VAR(var) if (0) var = var
39             #endif
40              
41             #ifndef dVAR
42             # define dVAR dNOOP
43             #endif
44              
45              
46             /* This stuff is not part of the API! You have been warned. */
47             #ifndef PERL_VERSION_DECIMAL
48             # define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s)
49             #endif
50             #ifndef PERL_DECIMAL_VERSION
51             # define PERL_DECIMAL_VERSION \
52             PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION)
53             #endif
54             #ifndef PERL_VERSION_GE
55             # define PERL_VERSION_GE(r,v,s) \
56             (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s))
57             #endif
58             #ifndef PERL_VERSION_LE
59             # define PERL_VERSION_LE(r,v,s) \
60             (PERL_DECIMAL_VERSION <= PERL_VERSION_DECIMAL(r,v,s))
61             #endif
62              
63             /* XS_INTERNAL is the explicit static-linkage variant of the default
64             * XS macro.
65             *
66             * XS_EXTERNAL is the same as XS_INTERNAL except it does not include
67             * "STATIC", ie. it exports XSUB symbols. You probably don't want that
68             * for anything but the BOOT XSUB.
69             *
70             * See XSUB.h in core!
71             */
72              
73              
74             /* TODO: This might be compatible further back than 5.10.0. */
75             #if PERL_VERSION_GE(5, 10, 0) && PERL_VERSION_LE(5, 15, 1)
76             # undef XS_EXTERNAL
77             # undef XS_INTERNAL
78             # if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
79             # define XS_EXTERNAL(name) __declspec(dllexport) XSPROTO(name)
80             # define XS_INTERNAL(name) STATIC XSPROTO(name)
81             # endif
82             # if defined(__SYMBIAN32__)
83             # define XS_EXTERNAL(name) EXPORT_C XSPROTO(name)
84             # define XS_INTERNAL(name) EXPORT_C STATIC XSPROTO(name)
85             # endif
86             # ifndef XS_EXTERNAL
87             # if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
88             # define XS_EXTERNAL(name) void name(pTHX_ CV* cv __attribute__unused__)
89             # define XS_INTERNAL(name) STATIC void name(pTHX_ CV* cv __attribute__unused__)
90             # else
91             # ifdef __cplusplus
92             # define XS_EXTERNAL(name) extern "C" XSPROTO(name)
93             # define XS_INTERNAL(name) static XSPROTO(name)
94             # else
95             # define XS_EXTERNAL(name) XSPROTO(name)
96             # define XS_INTERNAL(name) STATIC XSPROTO(name)
97             # endif
98             # endif
99             # endif
100             #endif
101              
102             /* perl >= 5.10.0 && perl <= 5.15.1 */
103              
104              
105             /* The XS_EXTERNAL macro is used for functions that must not be static
106             * like the boot XSUB of a module. If perl didn't have an XS_EXTERNAL
107             * macro defined, the best we can do is assume XS is the same.
108             * Dito for XS_INTERNAL.
109             */
110             #ifndef XS_EXTERNAL
111             # define XS_EXTERNAL(name) XS(name)
112             #endif
113             #ifndef XS_INTERNAL
114             # define XS_INTERNAL(name) XS(name)
115             #endif
116              
117             /* Now, finally, after all this mess, we want an ExtUtils::ParseXS
118             * internal macro that we're free to redefine for varying linkage due
119             * to the EXPORT_XSUB_SYMBOLS XS keyword. This is internal, use
120             * XS_EXTERNAL(name) or XS_INTERNAL(name) in your code if you need to!
121             */
122              
123             #undef XS_EUPXS
124             #if defined(PERL_EUPXS_ALWAYS_EXPORT)
125             # define XS_EUPXS(name) XS_EXTERNAL(name)
126             #else
127             /* default to internal */
128             # define XS_EUPXS(name) XS_INTERNAL(name)
129             #endif
130              
131             #ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
132             #define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
133              
134             /* prototype to pass -Wmissing-prototypes */
135             STATIC void
136             S_croak_xs_usage(const CV *const cv, const char *const params);
137              
138             STATIC void
139             S_croak_xs_usage(const CV *const cv, const char *const params)
140             {
141             const GV *const gv = CvGV(cv);
142              
143             PERL_ARGS_ASSERT_CROAK_XS_USAGE;
144              
145             if (gv) {
146             const char *const gvname = GvNAME(gv);
147             const HV *const stash = GvSTASH(gv);
148             const char *const hvname = stash ? HvNAME(stash) : NULL;
149              
150             if (hvname)
151             Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
152             else
153             Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
154             } else {
155             /* Pants. I don't think that it should be possible to get here. */
156             Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
157             }
158             }
159             #undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
160              
161             #define croak_xs_usage S_croak_xs_usage
162              
163             #endif
164              
165             /* NOTE: the prototype of newXSproto() is different in versions of perls,
166             * so we define a portable version of newXSproto()
167             */
168             #ifdef newXS_flags
169             #define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
170             #else
171             #define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
172             #endif /* !defined(newXS_flags) */
173              
174             #if PERL_VERSION_LE(5, 21, 5)
175             # define newXS_deffile(a,b) Perl_newXS(aTHX_ a,b,file)
176             #else
177             # define newXS_deffile(a,b) Perl_newXS_deffile(aTHX_ a,b)
178             #endif
179              
180             /* simple backcompat versions of the TARGx() macros with no optimisation */
181             #ifndef TARGi
182             # define TARGi(iv, do_taint) sv_setiv_mg(TARG, iv)
183             # define TARGu(uv, do_taint) sv_setuv_mg(TARG, uv)
184             # define TARGn(nv, do_taint) sv_setnv_mg(TARG, nv)
185             #endif
186              
187             #ifdef __cplusplus
188             extern "C" {
189             #endif
190             XS_EXTERNAL(boot_Encode__JIS2K); /* prototype to pass -Wmissing-prototypes */
191 1           XS_EXTERNAL(boot_Encode__JIS2K)
192             {
193             #if PERL_VERSION_LE(5, 21, 5)
194             dVAR; dXSARGS;
195             #else
196 1           dVAR; dXSBOOTARGSXSAPIVERCHK;
197             #endif
198              
199             PERL_UNUSED_VAR(cv); /* -W */
200             PERL_UNUSED_VAR(items); /* -W */
201             #if PERL_VERSION_LE(5, 21, 5)
202             XS_VERSION_BOOTCHECK;
203             # ifdef XS_APIVERSION_BOOTCHECK
204             XS_APIVERSION_BOOTCHECK;
205             # endif
206             #endif
207              
208              
209             /* Initialisation Section */
210              
211             {
212             #include "euc2k_t.exh"
213             #include "raw_t.exh"
214             #include "sjis2k_t.exh"
215             }
216              
217              
218             /* End of Initialisation Section */
219              
220             #if PERL_VERSION_LE(5, 21, 5)
221             # if PERL_VERSION_GE(5, 9, 0)
222             if (PL_unitcheckav)
223             call_list(PL_scopestack_ix, PL_unitcheckav);
224             # endif
225             XSRETURN_YES;
226             #else
227 1           Perl_xs_boot_epilog(aTHX_ ax);
228             #endif
229 1           }
230              
231             #ifdef __cplusplus
232             }
233             #endif