File Coverage

cpan/Encode/TW/TW.c
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition n/a
subroutine n/a
total 19 19 100.0


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