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