     1			/*
     2			 * This file was generated automatically by ExtUtils::ParseXS version 2.10 from the
     3			 * contents of Encode.xs. Do not edit this file, edit Encode.xs instead.
     4			 *
     5			 *	ANY CHANGES MADE HERE WILL BE LOST! 
     6			 *
     7			 */
     8			
     9			#line 1 "Encode.xs"
    10			/*
    11			 $Id: Encode.xs,v 2.4 2005/05/16 18:46:36 dankogai Exp dankogai $
    12			 */
    13			
    14			#define PERL_NO_GET_CONTEXT
    15			#include "EXTERN.h"
    16			#include "perl.h"
    17			#include "XSUB.h"
    18			#define U8 U8
    19			#include "encode.h"
    20			
    21			# define PERLIO_MODNAME  "PerlIO::encoding"
    22			# define PERLIO_FILENAME "PerlIO/encoding.pm"
    23			
    24			/* set 1 or more to profile.  t/encoding.t dumps core because of
    25			   Perl_warner and PerlIO don't work well */
    26			#define ENCODE_XS_PROFILE 0
    27			
    28			/* set 0 to disable floating point to calculate buffer size for
    29			   encode_method().  1 is recommended. 2 restores NI-S original */
    30			#define ENCODE_XS_USEFP   1
    31			
    32			#define UNIMPLEMENTED(x,y) y x (SV *sv, char *encoding) {dTHX;   \
    33			                         Perl_croak(aTHX_ "panic_unimplemented"); \
    34						 return (y)0; /* fool picky compilers */ \
    35			                         }
    36			/**/
    37			
    38			UNIMPLEMENTED(_encoded_utf8_to_bytes, I32)
    39			UNIMPLEMENTED(_encoded_bytes_to_utf8, I32)
    40			
    41			#define UTF8_ALLOW_STRICT 0
    42			#define UTF8_ALLOW_NONSTRICT (UTF8_ALLOW_ANY &                    \
    43			                              ~(UTF8_ALLOW_CONTINUATION |         \
    44			                                UTF8_ALLOW_NON_CONTINUATION |     \
    45			                                UTF8_ALLOW_LONG))
    46			
    47			void
    48			Encode_XSEncoding(pTHX_ encode_t * enc)
    49			{
    50			    dSP;
    51			    HV *stash = gv_stashpv("Encode::XS", TRUE);
    52			    SV *sv = sv_bless(newRV_noinc(newSViv(PTR2IV(enc))), stash);
    53			    int i = 0;
    54			    PUSHMARK(sp);
    55			    XPUSHs(sv);
    56			    while (enc->name[i]) {
    57				const char *name = enc->name[i++];
    58				XPUSHs(sv_2mortal(newSVpvn(name, strlen(name))));
    59			    }
    60			    PUTBACK;
    61			    call_pv("Encode::define_encoding", G_DISCARD);
    62			    SvREFCNT_dec(sv);
    63			}
    64			
    65			void
    66			call_failure(SV * routine, U8 * done, U8 * dest, U8 * orig)
    67			{
    68			    /* Exists for breakpointing */
    69			}
    70			
    71			
    72			#define ERR_ENCODE_NOMAP "\"\\x{%04" UVxf "}\" does not map to %s"
    73			#define ERR_DECODE_NOMAP "%s \"\\x%02" UVXf "\" does not map to Unicode"
    74			
    75			static SV *
    76			encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src,
    77				      int check, STRLEN * offset, SV * term, int * retcode)
    78			{
    79			    STRLEN slen;
    80			    U8 *s = (U8 *) SvPV(src, slen);
    81			    STRLEN tlen  = slen;
    82			    STRLEN ddone = 0;
    83			    STRLEN sdone = 0;
    84			
    85			    /* We allocate slen+1.
    86			       PerlIO dumps core if this value is smaller than this. */
    87			    SV *dst = sv_2mortal(newSV(slen+1));
    88			    U8 *d = (U8 *)SvPVX(dst);
    89			    STRLEN dlen = SvLEN(dst)-1;
    90			    int code = 0;
    91			    STRLEN trmlen = 0;
    92			    U8 *trm = term ? (U8*) SvPV(term, trmlen) : NULL;
    93			
    94			    if (offset) {
    95			      s += *offset;
    96			      if (slen > *offset){ /* safeguard against slen overflow */
    97				  slen -= *offset;
    98			      }else{
    99				  slen = 0;
   100			      }
   101			      tlen = slen;
   102			    }
   103			
   104			    if (slen == 0){
   105				SvCUR_set(dst, 0);
   106				SvPOK_only(dst);
   107				goto ENCODE_END;
   108			    }
   109			
   110			    while( (code = do_encode(dir, s, &slen, d, dlen, &dlen, !check,
   111						     trm, trmlen)) ) 
   112			    {
   113				SvCUR_set(dst, dlen+ddone);
   114				SvPOK_only(dst);
   115				
   116				if (code == ENCODE_FALLBACK || code == ENCODE_PARTIAL ||
   117				    code == ENCODE_FOUND_TERM) {
   118				    break;
   119				}
   120				switch (code) {
   121				case ENCODE_NOSPACE:
   122				{	
   123				    STRLEN more = 0; /* make sure you initialize! */
   124				    STRLEN sleft;
   125				    sdone += slen;
   126				    ddone += dlen;
   127				    sleft = tlen - sdone;
   128			#if ENCODE_XS_PROFILE >= 2
   129				    Perl_warn(aTHX_
   130					      "more=%d, sdone=%d, sleft=%d, SvLEN(dst)=%d\n",
   131					      more, sdone, sleft, SvLEN(dst));
   132			#endif
   133				    if (sdone != 0) { /* has src ever been processed ? */
   134			#if   ENCODE_XS_USEFP == 2
   135					more = (1.0*tlen*SvLEN(dst)+sdone-1)/sdone
   136					    - SvLEN(dst);
   137			#elif ENCODE_XS_USEFP
   138					more = (STRLEN)((1.0*SvLEN(dst)+1)/sdone * sleft);
   139			#else
   140					/* safe until SvLEN(dst) == MAX_INT/16 */
   141					more = (16*SvLEN(dst)+1)/sdone/16 * sleft;
   142			#endif
   143				    }
   144				    more += UTF8_MAXLEN; /* insurance policy */
   145				    d = (U8 *) SvGROW(dst, SvLEN(dst) + more);
   146				    /* dst need to grow need MORE bytes! */
   147				    if (ddone >= SvLEN(dst)) {
   148					Perl_croak(aTHX_ "Destination couldn't be grown.");
   149				    }
   150				    dlen = SvLEN(dst)-ddone-1;
   151				    d   += ddone;
   152				    s   += slen;
   153				    slen = tlen-sdone;
   154				    continue;
   155				}
   156				case ENCODE_NOREP:
   157				    /* encoding */	
   158				    if (dir == enc->f_utf8) {
   159					STRLEN clen;
   160					UV ch =
   161					    utf8n_to_uvuni(s+slen, (SvCUR(src)-slen),
   162							   &clen, UTF8_ALLOW_ANY|UTF8_CHECK_ONLY);
   163					if (check & ENCODE_DIE_ON_ERR) {
   164					    Perl_croak(aTHX_ ERR_ENCODE_NOMAP,
   165						       (UV)ch, enc->name[0]);
   166					    return &PL_sv_undef; /* never reaches but be safe */
   167					}
   168					if (check & ENCODE_WARN_ON_ERR){
   169					    Perl_warner(aTHX_ packWARN(WARN_UTF8),
   170							ERR_ENCODE_NOMAP, (UV)ch, enc->name[0]);
   171					}
   172					if (check & ENCODE_RETURN_ON_ERR){
   173					    goto ENCODE_SET_SRC;
   174					}
   175					if (check & (ENCODE_PERLQQ|ENCODE_HTMLCREF|ENCODE_XMLCREF)){
   176					    SV* subchar = 
   177						newSVpvf(check & ENCODE_PERLQQ ? "\\x{%04"UVxf"}" :
   178							 check & ENCODE_HTMLCREF ? "&#%" UVuf ";" :
   179							 "&#x%" UVxf ";", (UV)ch);
   180					    sdone += slen + clen;
   181					    ddone += dlen + SvCUR(subchar);
   182					    sv_catsv(dst, subchar);
   183					    SvREFCNT_dec(subchar);
   184					} else {
   185					    /* fallback char */
   186					    sdone += slen + clen;
   187					    ddone += dlen + enc->replen;
   188					    sv_catpvn(dst, (char*)enc->rep, enc->replen);
   189					}
   190				    }
   191				    /* decoding */
   192				    else {
   193					if (check & ENCODE_DIE_ON_ERR){
   194					    Perl_croak(aTHX_ ERR_DECODE_NOMAP,
   195			                              enc->name[0], (UV)s[slen]);
   196					    return &PL_sv_undef; /* never reaches but be safe */
   197					}
   198					if (check & ENCODE_WARN_ON_ERR){
   199					    Perl_warner(
   200						aTHX_ packWARN(WARN_UTF8),
   201						ERR_DECODE_NOMAP,
   202			               	        enc->name[0], (UV)s[slen]);
   203					}
   204					if (check & ENCODE_RETURN_ON_ERR){
   205					    goto ENCODE_SET_SRC;
   206					}
   207					if (check &
   208					    (ENCODE_PERLQQ|ENCODE_HTMLCREF|ENCODE_XMLCREF)){
   209					    SV* subchar = newSVpvf("\\x%02" UVXf, (UV)s[slen]);
   210					    sdone += slen + 1;
   211					    ddone += dlen + SvCUR(subchar);
   212					    sv_catsv(dst, subchar);
   213					    SvREFCNT_dec(subchar);
   214					} else {
   215					    sdone += slen + 1;
   216					    ddone += dlen + strlen(FBCHAR_UTF8);
   217					    sv_catpv(dst, FBCHAR_UTF8);
   218					}
   219				    }
   220				    /* settle variables when fallback */
   221				    d    = (U8 *)SvEND(dst);
   222			            dlen = SvLEN(dst) - ddone - 1;
   223				    s    = (U8*)SvPVX(src) + sdone;
   224				    slen = tlen - sdone;
   225				    break;
   226			
   227				default:
   228				    Perl_croak(aTHX_ "Unexpected code %d converting %s %s",
   229					       code, (dir == enc->f_utf8) ? "to" : "from",
   230					       enc->name[0]);
   231				    return &PL_sv_undef;
   232				}
   233			    }
   234			 ENCODE_SET_SRC:
   235			    if (check && !(check & ENCODE_LEAVE_SRC)){
   236				sdone = SvCUR(src) - (slen+sdone);
   237				if (sdone) {
   238				    sv_setpvn(src, (char*)s+slen, sdone);
   239				}
   240				SvCUR_set(src, sdone);
   241			    }
   242			    /* warn("check = 0x%X, code = 0x%d\n", check, code); */
   243			
   244			    SvCUR_set(dst, dlen+ddone);
   245			    SvPOK_only(dst);
   246			
   247			#if ENCODE_XS_PROFILE
   248			    if (SvCUR(dst) > SvCUR(src)){
   249				Perl_warn(aTHX_
   250					  "SvLEN(dst)=%d, SvCUR(dst)=%d. %d bytes unused(%f %%)\n",
   251					  SvLEN(dst), SvCUR(dst), SvLEN(dst) - SvCUR(dst),
   252					  (SvLEN(dst) - SvCUR(dst))*1.0/SvLEN(dst)*100.0);
   253			    }
   254			#endif
   255			
   256			    if (offset) 
   257			      *offset += sdone + slen;
   258			
   259			 ENCODE_END:
   260			    *SvEND(dst) = '\0';
   261			    if (retcode) *retcode = code;
   262			    return dst;
   263			}
   264			
   265			static bool
   266			strict_utf8(pTHX_ SV* sv)
   267			{
   268			    HV* hv;
   269			    SV** svp;
   270			    sv = SvRV(sv);
   271			    if (!sv || SvTYPE(sv) != SVt_PVHV)
   272			        return 0;
   273			    hv = (HV*)sv;
   274			    svp = hv_fetch(hv, "strict_utf8", 11, 0);
   275			    if (!svp)
   276			        return 0;
   277			    return SvTRUE(*svp);
   278			}
   279			
   280			static U8*
   281			process_utf8(pTHX_ SV* dst, U8* s, U8* e, int check,
   282			             bool encode, bool strict, bool stop_at_partial)
   283			{
   284			    UV uv;
   285			    STRLEN ulen;
   286			
   287			    SvPOK_only(dst);
   288			    SvCUR_set(dst,0);
   289			
   290			    while (s < e) {
   291			        if (UTF8_IS_INVARIANT(*s)) {
   292			            sv_catpvn(dst, (char *)s, 1);
   293			            s++;
   294			            continue;
   295			        }
   296			
   297			        if (UTF8_IS_START(*s)) {
   298			            U8 skip = UTF8SKIP(s);
   299			            if ((s + skip) > e) {
   300			                /* Partial character */
   301			                /* XXX could check that rest of bytes are UTF8_IS_CONTINUATION(ch) */
   302			                if (stop_at_partial)
   303			                    break;
   304			
   305			                goto malformed_byte;
   306			            }
   307			
   308			            uv = utf8n_to_uvuni(s, e - s, &ulen,
   309			                                UTF8_CHECK_ONLY | (strict ? UTF8_ALLOW_STRICT :
   310			                                                            UTF8_ALLOW_NONSTRICT)
   311			                               );
   312			#if 1 /* perl-5.8.6 and older do not check UTF8_ALLOW_LONG */
   313				    if (strict && uv > PERL_UNICODE_MAX)
   314					ulen = -1;
   315			#endif
   316			            if (ulen == -1) {
   317			                if (strict) {
   318			                    uv = utf8n_to_uvuni(s, e - s, &ulen,
   319			                                        UTF8_CHECK_ONLY | UTF8_ALLOW_NONSTRICT);
   320			                    if (ulen == -1)
   321			                        goto malformed_byte;
   322			                    goto malformed;
   323			                }
   324			                goto malformed_byte;
   325			            }
   326			
   327			
   328			             /* Whole char is good */
   329			             sv_catpvn(dst,(char *)s,skip);
   330			             s += skip;
   331			             continue;
   332			        }
   333			
   334			        /* If we get here there is something wrong with alleged UTF-8 */
   335			    malformed_byte:
   336			        uv = (UV)*s;
   337			        ulen = 1;
   338			
   339			    malformed:
   340			        if (check & ENCODE_DIE_ON_ERR){
   341			            if (encode)
   342			                Perl_croak(aTHX_ ERR_ENCODE_NOMAP, uv, "utf8");
   343			            else
   344			                Perl_croak(aTHX_ ERR_DECODE_NOMAP, "utf8", uv);
   345			        }
   346			        if (check & ENCODE_WARN_ON_ERR){
   347			            if (encode)
   348			                Perl_warner(aTHX_ packWARN(WARN_UTF8),
   349			                            ERR_ENCODE_NOMAP, uv, "utf8");
   350			            else
   351			                Perl_warner(aTHX_ packWARN(WARN_UTF8),
   352			                            ERR_DECODE_NOMAP, "utf8", uv);
   353			        }
   354			        if (check & ENCODE_RETURN_ON_ERR) {
   355			                break;
   356			        }
   357			        if (check & (ENCODE_PERLQQ|ENCODE_HTMLCREF|ENCODE_XMLCREF)){
   358			            SV* subchar = newSVpvf(check & ENCODE_PERLQQ ? (ulen == 1 ? "\\x%02" UVXf : "\\x{%04" UVXf "}"):
   359			                                   check & ENCODE_HTMLCREF ? "&#%" UVuf ";" :
   360			                                   "&#x%" UVxf ";", uv);
   361			            sv_catsv(dst, subchar);
   362			            SvREFCNT_dec(subchar);
   363			        } else {
   364			            sv_catpv(dst, FBCHAR_UTF8);
   365			        }
   366			        s += ulen;
   367			    }
   368			    *SvEND(dst) = '\0';
   369			
   370			    return s;
   371			}
   372			
   373			
   374			#ifndef PERL_UNUSED_VAR
   375			#  define PERL_UNUSED_VAR(var) if (0) var = var
   376			#endif
   377			
   378			#line 379 "Encode.c"
   379			
   380			XS(XS_Encode__utf8_decode_xs); /* prototype to pass -Wmissing-prototypes */
   381			XS(XS_Encode__utf8_decode_xs)
   382	         297    {
   383	         297        dXSARGS;
   384	         297        if (items < 2 || items > 3)
   385	      ######    	Perl_croak(aTHX_ "Usage: Encode::utf8::decode_xs(obj, src, check = 0)");
   386	         297        PERL_UNUSED_VAR(cv); /* -W */
   387			    {
   388	         297    	SV *	obj = ST(0);
   389	         297    	SV *	src = ST(1);
   390	         297    	int	check;
   391			
   392	         297    	if (items < 3)
   393	         188    	    check = 0;
   394				else {
   395	         109    	    check = (int)SvIV(ST(2));
   396				}
   397			#line 375 "Encode.xs"
   398			{
   399			    STRLEN slen;
   400			    U8 *s = (U8 *) SvPV(src, slen);
   401			    U8 *e = (U8 *) SvEND(src);
   402			    SV *dst = newSV(slen>0?slen:1); /* newSV() abhors 0 -- inaba */
   403			
   404			    /* 
   405			     * PerlIO check -- we assume the object is of PerlIO if renewed
   406			     */
   407			    int renewed = 0;
   408			    dSP; ENTER; SAVETMPS;
   409			    PUSHMARK(sp);
   410			    XPUSHs(obj);
   411			    PUTBACK;
   412			    if (call_method("renewed",G_SCALAR) == 1) {
   413				SPAGAIN;
   414				renewed = POPi;
   415				PUTBACK; 
   416			#if 0
   417				fprintf(stderr, "renewed == %d\n", renewed);
   418			#endif
   419			    }
   420			    FREETMPS; LEAVE;
   421			    /* end PerlIO check */
   422			
   423			    if (SvUTF8(src)) {
   424				s = utf8_to_bytes(s,&slen);
   425				if (s) {
   426				    SvCUR_set(src,slen);
   427				    SvUTF8_off(src);
   428				    e = s+slen;
   429				}
   430				else {
   431				    croak("Cannot decode string with wide characters");
   432				}
   433			    }
   434			
   435			    s = process_utf8(aTHX_ dst, s, e, check, 0, strict_utf8(aTHX_ obj), renewed);
   436			
   437			    /* Clear out translated part of source unless asked not to */
   438			    if (check && !(check & ENCODE_LEAVE_SRC)){
   439				slen = e-s;
   440				if (slen) {
   441				    sv_setpvn(src, (char*)s, slen);
   442				}
   443				SvCUR_set(src, slen);
   444			    }
   445			    SvUTF8_on(dst);
   446			    ST(0) = sv_2mortal(dst);
   447			    XSRETURN(1);
   448			}
   449			#line 450 "Encode.c"
   450			    }
   451			    XSRETURN(1);
   452			}
   453			
   454			
   455			XS(XS_Encode__utf8_encode_xs); /* prototype to pass -Wmissing-prototypes */
   456			XS(XS_Encode__utf8_encode_xs)
   457	          64    {
   458	          64        dXSARGS;
   459	          64        if (items < 2 || items > 3)
   460	      ######    	Perl_croak(aTHX_ "Usage: Encode::utf8::encode_xs(obj, src, check = 0)");
   461	          64        PERL_UNUSED_VAR(cv); /* -W */
   462			    {
   463	          64    	SV *	obj = ST(0);
   464	          64    	SV *	src = ST(1);
   465	          64    	int	check;
   466			
   467	          64    	if (items < 3)
   468	          15    	    check = 0;
   469				else {
   470	          49    	    check = (int)SvIV(ST(2));
   471				}
   472			#line 433 "Encode.xs"
   473			{
   474			    STRLEN slen;
   475			    U8 *s = (U8 *) SvPV(src, slen);
   476			    U8 *e = (U8 *) SvEND(src);
   477			    SV *dst = newSV(slen>0?slen:1); /* newSV() abhors 0 -- inaba */
   478			    if (SvUTF8(src)) {
   479				/* Already encoded */
   480				if (strict_utf8(aTHX_ obj)) {
   481				    s = process_utf8(aTHX_ dst, s, e, check, 1, 1, 0);
   482				}
   483			        else {
   484			            /* trust it and just copy the octets */
   485			    	    sv_setpvn(dst,(char *)s,(e-s));
   486				    s = e;
   487			        }
   488			    }
   489			    else {
   490			    	/* Native bytes - can always encode */
   491				U8 *d = (U8 *) SvGROW(dst, 2*slen+1); /* +1 or assertion will botch */
   492			    	while (s < e) {
   493			    	    UV uv = NATIVE_TO_UNI((UV) *s++);
   494			            if (UNI_IS_INVARIANT(uv))
   495			            	*d++ = (U8)UTF_TO_NATIVE(uv);
   496			            else {
   497			    	        *d++ = (U8)UTF8_EIGHT_BIT_HI(uv);
   498			                *d++ = (U8)UTF8_EIGHT_BIT_LO(uv);
   499			            }
   500				}
   501			        SvCUR_set(dst, d- (U8 *)SvPVX(dst));
   502			    	*SvEND(dst) = '\0';
   503			    }
   504			
   505			    /* Clear out translated part of source unless asked not to */
   506			    if (check && !(check & ENCODE_LEAVE_SRC)){
   507				slen = e-s;
   508				if (slen) {
   509				    sv_setpvn(src, (char*)s, slen);
   510				}
   511				SvCUR_set(src, slen);
   512			    }
   513			    SvPOK_only(dst);
   514			    SvUTF8_off(dst);
   515			    ST(0) = sv_2mortal(dst);
   516			    XSRETURN(1);
   517			}
   518			#line 519 "Encode.c"
   519			    }
   520			    XSRETURN(1);
   521			}
   522			
   523			
   524			XS(XS_Encode__XS_renew); /* prototype to pass -Wmissing-prototypes */
   525			XS(XS_Encode__XS_renew)
   526	          53    {
   527	          53        dXSARGS;
   528	          53        if (items != 1)
   529	      ######    	Perl_croak(aTHX_ "Usage: Encode::XS::renew(obj)");
   530	          53        PERL_UNUSED_VAR(cv); /* -W */
   531			    {
   532	          53    	SV *	obj = ST(0);
   533			#line 487 "Encode.xs"
   534			{
   535			    XSRETURN(1);
   536			}
   537			#line 538 "Encode.c"
   538			    }
   539			    XSRETURN_EMPTY;
   540			}
   541			
   542			
   543			XS(XS_Encode__XS_renewed); /* prototype to pass -Wmissing-prototypes */
   544			XS(XS_Encode__XS_renewed)
   545	      ######    {
   546	      ######        dXSARGS;
   547	      ######        if (items != 1)
   548	      ######    	Perl_croak(aTHX_ "Usage: Encode::XS::renewed(obj)");
   549	      ######        PERL_UNUSED_VAR(cv); /* -W */
   550			    {
   551	      ######    	SV *	obj = ST(0);
   552	      ######    	int	RETVAL;
   553	      ######    	dXSTARG;
   554			#line 495 "Encode.xs"
   555			    RETVAL = 0;
   556			#line 557 "Encode.c"
   557	      ######    	XSprePUSH; PUSHi((IV)RETVAL);
   558			    }
   559	      ######        XSRETURN(1);
   560			}
   561			
   562			
   563			XS(XS_Encode__XS_name); /* prototype to pass -Wmissing-prototypes */
   564			XS(XS_Encode__XS_name)
   565	         984    {
   566	         984        dXSARGS;
   567	         984        if (items != 1)
   568	      ######    	Perl_croak(aTHX_ "Usage: Encode::XS::name(obj)");
   569	         984        PERL_UNUSED_VAR(cv); /* -W */
   570			    {
   571	         984    	SV *	obj = ST(0);
   572			#line 503 "Encode.xs"
   573			{
   574			    encode_t *enc = INT2PTR(encode_t *, SvIV(SvRV(obj)));
   575			    ST(0) = sv_2mortal(newSVpvn(enc->name[0],strlen(enc->name[0])));
   576			    XSRETURN(1);
   577			}
   578			#line 579 "Encode.c"
   579			    }
   580			    XSRETURN(1);
   581			}
   582			
   583			
   584			XS(XS_Encode__XS_cat_decode); /* prototype to pass -Wmissing-prototypes */
   585			XS(XS_Encode__XS_cat_decode)
   586	         223    {
   587	         223        dXSARGS;
   588	         223        if (items < 5 || items > 6)
   589	      ######    	Perl_croak(aTHX_ "Usage: Encode::XS::cat_decode(obj, dst, src, off, term, check = 0)");
   590	         223        PERL_UNUSED_VAR(cv); /* -W */
   591			    {
   592	         223    	SV *	obj = ST(0);
   593	         223    	SV *	dst = ST(1);
   594	         223    	SV *	src = ST(2);
   595	         223    	SV *	off = ST(3);
   596	         223    	SV *	term = ST(4);
   597	         223    	int	check;
   598			
   599	         223    	if (items < 6)
   600	         223    	    check = 0;
   601				else {
   602	      ######    	    check = (int)SvIV(ST(5));
   603				}
   604			#line 518 "Encode.xs"
   605			{
   606			    encode_t *enc = INT2PTR(encode_t *, SvIV(SvRV(obj)));
   607			    STRLEN offset = (STRLEN)SvIV(off);
   608			    int code = 0;
   609			    if (SvUTF8(src)) {
   610			    	sv_utf8_downgrade(src, FALSE);
   611			    }
   612			    sv_catsv(dst, encode_method(aTHX_ enc, enc->t_utf8, src, check,
   613							&offset, term, &code));
   614			    SvIV_set(off, (IV)offset);
   615			    if (code == ENCODE_FOUND_TERM) {
   616				ST(0) = &PL_sv_yes;
   617			    }else{
   618				ST(0) = &PL_sv_no;
   619			    }
   620			    XSRETURN(1);
   621			}
   622			#line 623 "Encode.c"
   623			    }
   624			    XSRETURN(1);
   625			}
   626			
   627			
   628			XS(XS_Encode__XS_decode); /* prototype to pass -Wmissing-prototypes */
   629			XS(XS_Encode__XS_decode)
   630	        4410    {
   631	        4410        dXSARGS;
   632	        4410        if (items < 2 || items > 3)
   633	      ######    	Perl_croak(aTHX_ "Usage: Encode::XS::decode(obj, src, check = 0)");
   634	        4410        PERL_UNUSED_VAR(cv); /* -W */
   635			    {
   636	        4410    	SV *	obj = ST(0);
   637	        4410    	SV *	src = ST(1);
   638	        4410    	int	check;
   639			
   640	        4410    	if (items < 3)
   641	         976    	    check = 0;
   642				else {
   643	        3434    	    check = (int)SvIV(ST(2));
   644				}
   645			#line 542 "Encode.xs"
   646			{
   647			    encode_t *enc = INT2PTR(encode_t *, SvIV(SvRV(obj)));
   648			    if (SvUTF8(src)) {
   649			    	sv_utf8_downgrade(src, FALSE);
   650			    }
   651			    ST(0) = encode_method(aTHX_ enc, enc->t_utf8, src, check,
   652						  NULL, Nullsv, NULL);
   653			    SvUTF8_on(ST(0));
   654			    XSRETURN(1);
   655			}
   656			#line 657 "Encode.c"
   657			    }
   658			    XSRETURN(1);
   659			}
   660			
   661			
   662			XS(XS_Encode__XS_encode); /* prototype to pass -Wmissing-prototypes */
   663			XS(XS_Encode__XS_encode)
   664	       34573    {
   665	       34573        dXSARGS;
   666	       34573        if (items < 2 || items > 3)
   667	      ######    	Perl_croak(aTHX_ "Usage: Encode::XS::encode(obj, src, check = 0)");
   668	       34573        PERL_UNUSED_VAR(cv); /* -W */
   669			    {
   670	       34573    	SV *	obj = ST(0);
   671	       34573    	SV *	src = ST(1);
   672	       34573    	int	check;
   673			
   674	       34573    	if (items < 3)
   675	           7    	    check = 0;
   676				else {
   677	       34566    	    check = (int)SvIV(ST(2));
   678				}
   679			#line 559 "Encode.xs"
   680			{
   681			    encode_t *enc = INT2PTR(encode_t *, SvIV(SvRV(obj)));
   682			    sv_utf8_upgrade(src);
   683			    ST(0) = encode_method(aTHX_ enc, enc->f_utf8, src, check,
   684						  NULL, Nullsv, NULL);
   685			    XSRETURN(1);
   686			}
   687			#line 688 "Encode.c"
   688			    }
   689			    XSRETURN(1);
   690			}
   691			
   692			
   693			XS(XS_Encode__XS_needs_lines); /* prototype to pass -Wmissing-prototypes */
   694			XS(XS_Encode__XS_needs_lines)
   695	          53    {
   696	          53        dXSARGS;
   697	          53        if (items != 1)
   698	      ######    	Perl_croak(aTHX_ "Usage: Encode::XS::needs_lines(obj)");
   699	          53        PERL_UNUSED_VAR(cv); /* -W */
   700			    {
   701	          53    	SV *	obj = ST(0);
   702			#line 571 "Encode.xs"
   703			{
   704			    /* encode_t *enc = INT2PTR(encode_t *, SvIV(SvRV(obj))); */
   705			    ST(0) = &PL_sv_no;
   706			    XSRETURN(1);
   707			}
   708			#line 709 "Encode.c"
   709			    }
   710			    XSRETURN(1);
   711			}
   712			
   713			
   714			XS(XS_Encode__XS_perlio_ok); /* prototype to pass -Wmissing-prototypes */
   715			XS(XS_Encode__XS_perlio_ok)
   716	           8    {
   717	           8        dXSARGS;
   718	           8        if (items != 1)
   719	      ######    	Perl_croak(aTHX_ "Usage: Encode::XS::perlio_ok(obj)");
   720	           8        PERL_UNUSED_VAR(cv); /* -W */
   721			    {
   722	           8    	SV *	obj = ST(0);
   723			#line 581 "Encode.xs"
   724			{
   725			    /* encode_t *enc = INT2PTR(encode_t *, SvIV(SvRV(obj))); */
   726			    /* require_pv(PERLIO_FILENAME); */
   727			
   728			    eval_pv("require PerlIO::encoding", 0);
   729			
   730			    if (SvTRUE(get_sv("@", 0))) {
   731				ST(0) = &PL_sv_no;
   732			    }else{
   733				ST(0) = &PL_sv_yes;
   734			    }
   735			    XSRETURN(1);
   736			}
   737			#line 738 "Encode.c"
   738			    }
   739			    XSRETURN(1);
   740			}
   741			
   742			
   743			XS(XS_Encode__bytes_to_utf8); /* prototype to pass -Wmissing-prototypes */
   744			XS(XS_Encode__bytes_to_utf8)
   745	      ######    {
   746	      ######        dXSARGS;
   747	      ######        if (items < 1)
   748	      ######    	Perl_croak(aTHX_ "Usage: Encode::_bytes_to_utf8(sv, ...)");
   749	      ######        PERL_UNUSED_VAR(cv); /* -W */
   750			    {
   751	      ######    	SV *	sv = ST(0);
   752	      ######    	I32	RETVAL;
   753	      ######    	dXSTARG;
   754			#line 603 "Encode.xs"
   755			{
   756			    SV * encoding = items == 2 ? ST(1) : Nullsv;
   757			
   758			    if (encoding)
   759			    RETVAL = _encoded_bytes_to_utf8(sv, SvPV_nolen(encoding));
   760			    else {
   761				STRLEN len;
   762				U8*    s = (U8*)SvPV(sv, len);
   763				U8*    converted;
   764			
   765				converted = bytes_to_utf8(s, &len); /* This allocs */
   766				sv_setpvn(sv, (char *)converted, len);
   767				SvUTF8_on(sv); /* XXX Should we? */
   768				Safefree(converted);                /* ... so free it */
   769				RETVAL = len;
   770			    }
   771			}
   772			#line 773 "Encode.c"
   773	      ######    	XSprePUSH; PUSHi((IV)RETVAL);
   774			    }
   775	      ######        XSRETURN(1);
   776			}
   777			
   778			
   779			XS(XS_Encode__utf8_to_bytes); /* prototype to pass -Wmissing-prototypes */
   780			XS(XS_Encode__utf8_to_bytes)
   781	      ######    {
   782	      ######        dXSARGS;
   783	      ######        if (items < 1)
   784	      ######    	Perl_croak(aTHX_ "Usage: Encode::_utf8_to_bytes(sv, ...)");
   785	      ######        PERL_UNUSED_VAR(cv); /* -W */
   786			    {
   787	      ######    	SV *	sv = ST(0);
   788	      ######    	I32	RETVAL;
   789	      ######    	dXSTARG;
   790			#line 627 "Encode.xs"
   791			{
   792			    SV * to    = items > 1 ? ST(1) : Nullsv;
   793			    SV * check = items > 2 ? ST(2) : Nullsv;
   794			
   795			    if (to) {
   796				RETVAL = _encoded_utf8_to_bytes(sv, SvPV_nolen(to));
   797			    } else {
   798				STRLEN len;
   799				U8 *s = (U8*)SvPV(sv, len);
   800			
   801				RETVAL = 0;
   802				if (SvTRUE(check)) {
   803				    /* Must do things the slow way */
   804				    U8 *dest;
   805			            /* We need a copy to pass to check() */
   806				    U8 *src  = (U8*)savepv((char *)s);
   807				    U8 *send = s + len;
   808			
   809				    New(83, dest, len, U8); /* I think */
   810			
   811				    while (s < send) {
   812			                if (*s < 0x80){
   813					    *dest++ = *s++;
   814			                } else {
   815					    STRLEN ulen;
   816					    UV uv = *s++;
   817			
   818					    /* Have to do it all ourselves because of error routine,
   819					       aargh. */
   820					    if (!(uv & 0x40)){ goto failure; }
   821					    if      (!(uv & 0x20)) { ulen = 2;  uv &= 0x1f; }
   822					    else if (!(uv & 0x10)) { ulen = 3;  uv &= 0x0f; }
   823					    else if (!(uv & 0x08)) { ulen = 4;  uv &= 0x07; }
   824					    else if (!(uv & 0x04)) { ulen = 5;  uv &= 0x03; }
   825					    else if (!(uv & 0x02)) { ulen = 6;  uv &= 0x01; }
   826					    else if (!(uv & 0x01)) { ulen = 7;  uv = 0; }
   827					    else                   { ulen = 13; uv = 0; }
   828			
   829					    /* Note change to utf8.c variable naming, for variety */
   830					    while (ulen--) {
   831						if ((*s & 0xc0) != 0x80){
   832						    goto failure;
   833						} else {
   834						    uv = (uv << 6) | (*s++ & 0x3f);
   835						}
   836					  }
   837					  if (uv > 256) {
   838					  failure:
   839					      call_failure(check, s, dest, src);
   840					      /* Now what happens? */
   841					  }
   842					  *dest++ = (U8)uv;
   843					}
   844				    }
   845				} else {
   846				    RETVAL = (utf8_to_bytes(s, &len) ? len : 0);
   847				}
   848			    }
   849			}
   850			#line 851 "Encode.c"
   851	      ######    	XSprePUSH; PUSHi((IV)RETVAL);
   852			    }
   853	      ######        XSRETURN(1);
   854			}
   855			
   856			
   857			XS(XS_Encode_is_utf8); /* prototype to pass -Wmissing-prototypes */
   858			XS(XS_Encode_is_utf8)
   859	         545    {
   860	         545        dXSARGS;
   861	         545        if (items < 1 || items > 2)
   862	      ######    	Perl_croak(aTHX_ "Usage: Encode::is_utf8(sv, check = 0)");
   863	         545        PERL_UNUSED_VAR(cv); /* -W */
   864			    {
   865	         545    	SV *	sv = ST(0);
   866	         545    	int	check;
   867	         545    	bool	RETVAL;
   868			
   869	         545    	if (items < 2)
   870	         545    	    check = 0;
   871				else {
   872	      ######    	    check = (int)SvIV(ST(1));
   873				}
   874			#line 694 "Encode.xs"
   875			{
   876			    if (SvGMAGICAL(sv)) /* it could be $1, for example */
   877				sv = newSVsv(sv); /* GMAGIG will be done */
   878			    if (SvPOK(sv)) {
   879				RETVAL = SvUTF8(sv) ? TRUE : FALSE;
   880				if (RETVAL &&
   881				    check  &&
   882				    !is_utf8_string((U8*)SvPVX(sv), SvCUR(sv)))
   883				    RETVAL = FALSE;
   884			    } else {
   885				RETVAL = FALSE;
   886			    }
   887			    if (sv != ST(0))
   888				SvREFCNT_dec(sv); /* it was a temp copy */
   889			}
   890			#line 891 "Encode.c"
   891	         545    	ST(0) = boolSV(RETVAL);
   892	         545    	sv_2mortal(ST(0));
   893			    }
   894	         545        XSRETURN(1);
   895			}
   896			
   897			
   898			XS(XS_Encode__utf8_on); /* prototype to pass -Wmissing-prototypes */
   899			XS(XS_Encode__utf8_on)
   900	           1    {
   901	           1        dXSARGS;
   902	           1        if (items != 1)
   903	      ######    	Perl_croak(aTHX_ "Usage: Encode::_utf8_on(sv)");
   904	           1        PERL_UNUSED_VAR(cv); /* -W */
   905			    {
   906	           1    	SV *	sv = ST(0);
   907	           1    	SV *	RETVAL;
   908			#line 716 "Encode.xs"
   909			{
   910			    if (SvPOK(sv)) {
   911				SV *rsv = newSViv(SvUTF8(sv));
   912				RETVAL = rsv;
   913				SvUTF8_on(sv);
   914			    } else {
   915				RETVAL = &PL_sv_undef;
   916			    }
   917			}
   918			#line 919 "Encode.c"
   919	           1    	ST(0) = RETVAL;
   920	           1    	sv_2mortal(ST(0));
   921			    }
   922	           1        XSRETURN(1);
   923			}
   924			
   925			
   926			XS(XS_Encode__utf8_off); /* prototype to pass -Wmissing-prototypes */
   927			XS(XS_Encode__utf8_off)
   928	           1    {
   929	           1        dXSARGS;
   930	           1        if (items != 1)
   931	      ######    	Perl_croak(aTHX_ "Usage: Encode::_utf8_off(sv)");
   932	           1        PERL_UNUSED_VAR(cv); /* -W */
   933			    {
   934	           1    	SV *	sv = ST(0);
   935	           1    	SV *	RETVAL;
   936			#line 732 "Encode.xs"
   937			{
   938			    if (SvPOK(sv)) {
   939				SV *rsv = newSViv(SvUTF8(sv));
   940				RETVAL = rsv;
   941				SvUTF8_off(sv);
   942			    } else {
   943				RETVAL = &PL_sv_undef;
   944			    }
   945			}
   946			#line 947 "Encode.c"
   947	           1    	ST(0) = RETVAL;
   948	           1    	sv_2mortal(ST(0));
   949			    }
   950	           1        XSRETURN(1);
   951			}
   952			
   953			
   954			XS(XS_Encode_DIE_ON_ERR); /* prototype to pass -Wmissing-prototypes */
   955			XS(XS_Encode_DIE_ON_ERR)
   956	      ######    {
   957	      ######        dXSARGS;
   958	      ######        if (items != 0)
   959	      ######    	Perl_croak(aTHX_ "Usage: Encode::DIE_ON_ERR()");
   960	      ######        PERL_UNUSED_VAR(cv); /* -W */
   961			    {
   962	      ######    	int	RETVAL;
   963	      ######    	dXSTARG;
   964			#line 747 "Encode.xs"
   965			    RETVAL = ENCODE_DIE_ON_ERR;
   966			#line 967 "Encode.c"
   967	      ######    	XSprePUSH; PUSHi((IV)RETVAL);
   968			    }
   969	      ######        XSRETURN(1);
   970			}
   971			
   972			
   973			XS(XS_Encode_WARN_ON_ERR); /* prototype to pass -Wmissing-prototypes */
   974			XS(XS_Encode_WARN_ON_ERR)
   975	          19    {
   976	          19        dXSARGS;
   977	          19        if (items != 0)
   978	      ######    	Perl_croak(aTHX_ "Usage: Encode::WARN_ON_ERR()");
   979	          19        PERL_UNUSED_VAR(cv); /* -W */
   980			    {
   981	          19    	int	RETVAL;
   982	          19    	dXSTARG;
   983			#line 754 "Encode.xs"
   984			    RETVAL = ENCODE_WARN_ON_ERR;
   985			#line 986 "Encode.c"
   986	          19    	XSprePUSH; PUSHi((IV)RETVAL);
   987			    }
   988	          19        XSRETURN(1);
   989			}
   990			
   991			
   992			XS(XS_Encode_LEAVE_SRC); /* prototype to pass -Wmissing-prototypes */
   993			XS(XS_Encode_LEAVE_SRC)
   994	        1489    {
   995	        1489        dXSARGS;
   996	        1489        if (items != 0)
   997	      ######    	Perl_croak(aTHX_ "Usage: Encode::LEAVE_SRC()");
   998	        1489        PERL_UNUSED_VAR(cv); /* -W */
   999			    {
  1000	        1489    	int	RETVAL;
  1001	        1489    	dXSTARG;
  1002			#line 761 "Encode.xs"
  1003			    RETVAL = ENCODE_LEAVE_SRC;
  1004			#line 1005 "Encode.c"
  1005	        1489    	XSprePUSH; PUSHi((IV)RETVAL);
  1006			    }
  1007	        1489        XSRETURN(1);
  1008			}
  1009			
  1010			
  1011			XS(XS_Encode_RETURN_ON_ERR); /* prototype to pass -Wmissing-prototypes */
  1012			XS(XS_Encode_RETURN_ON_ERR)
  1013	      ######    {
  1014	      ######        dXSARGS;
  1015	      ######        if (items != 0)
  1016	      ######    	Perl_croak(aTHX_ "Usage: Encode::RETURN_ON_ERR()");
  1017	      ######        PERL_UNUSED_VAR(cv); /* -W */
  1018			    {
  1019	      ######    	int	RETVAL;
  1020	      ######    	dXSTARG;
  1021			#line 768 "Encode.xs"
  1022			    RETVAL = ENCODE_RETURN_ON_ERR;
  1023			#line 1024 "Encode.c"
  1024	      ######    	XSprePUSH; PUSHi((IV)RETVAL);
  1025			    }
  1026	      ######        XSRETURN(1);
  1027			}
  1028			
  1029			
  1030			XS(XS_Encode_PERLQQ); /* prototype to pass -Wmissing-prototypes */
  1031			XS(XS_Encode_PERLQQ)
  1032	          35    {
  1033	          35        dXSARGS;
  1034	          35        if (items != 0)
  1035	      ######    	Perl_croak(aTHX_ "Usage: Encode::PERLQQ()");
  1036	          35        PERL_UNUSED_VAR(cv); /* -W */
  1037			    {
  1038	          35    	int	RETVAL;
  1039	          35    	dXSTARG;
  1040			#line 775 "Encode.xs"
  1041			    RETVAL = ENCODE_PERLQQ;
  1042			#line 1043 "Encode.c"
  1043	          35    	XSprePUSH; PUSHi((IV)RETVAL);
  1044			    }
  1045	          35        XSRETURN(1);
  1046			}
  1047			
  1048			
  1049			XS(XS_Encode_HTMLCREF); /* prototype to pass -Wmissing-prototypes */
  1050			XS(XS_Encode_HTMLCREF)
  1051	           1    {
  1052	           1        dXSARGS;
  1053	           1        if (items != 0)
  1054	      ######    	Perl_croak(aTHX_ "Usage: Encode::HTMLCREF()");
  1055	           1        PERL_UNUSED_VAR(cv); /* -W */
  1056			    {
  1057	           1    	int	RETVAL;
  1058	           1    	dXSTARG;
  1059			#line 782 "Encode.xs"
  1060			    RETVAL = ENCODE_HTMLCREF;
  1061			#line 1062 "Encode.c"
  1062	           1    	XSprePUSH; PUSHi((IV)RETVAL);
  1063			    }
  1064	           1        XSRETURN(1);
  1065			}
  1066			
  1067			
  1068			XS(XS_Encode_XMLCREF); /* prototype to pass -Wmissing-prototypes */
  1069			XS(XS_Encode_XMLCREF)
  1070	      ######    {
  1071	      ######        dXSARGS;
  1072	      ######        if (items != 0)
  1073	      ######    	Perl_croak(aTHX_ "Usage: Encode::XMLCREF()");
  1074	      ######        PERL_UNUSED_VAR(cv); /* -W */
  1075			    {
  1076	      ######    	int	RETVAL;
  1077	      ######    	dXSTARG;
  1078			#line 789 "Encode.xs"
  1079			    RETVAL = ENCODE_XMLCREF;
  1080			#line 1081 "Encode.c"
  1081	      ######    	XSprePUSH; PUSHi((IV)RETVAL);
  1082			    }
  1083	      ######        XSRETURN(1);
  1084			}
  1085			
  1086			
  1087			XS(XS_Encode_FB_DEFAULT); /* prototype to pass -Wmissing-prototypes */
  1088			XS(XS_Encode_FB_DEFAULT)
  1089	           2    {
  1090	           2        dXSARGS;
  1091	           2        if (items != 0)
  1092	      ######    	Perl_croak(aTHX_ "Usage: Encode::FB_DEFAULT()");
  1093	           2        PERL_UNUSED_VAR(cv); /* -W */
  1094			    {
  1095	           2    	int	RETVAL;
  1096	           2    	dXSTARG;
  1097			#line 796 "Encode.xs"
  1098			    RETVAL = ENCODE_FB_DEFAULT;
  1099			#line 1100 "Encode.c"
  1100	           2    	XSprePUSH; PUSHi((IV)RETVAL);
  1101			    }
  1102	           2        XSRETURN(1);
  1103			}
  1104			
  1105			
  1106			XS(XS_Encode_FB_CROAK); /* prototype to pass -Wmissing-prototypes */
  1107			XS(XS_Encode_FB_CROAK)
  1108	          10    {
  1109	          10        dXSARGS;
  1110	          10        if (items != 0)
  1111	      ######    	Perl_croak(aTHX_ "Usage: Encode::FB_CROAK()");
  1112	          10        PERL_UNUSED_VAR(cv); /* -W */
  1113			    {
  1114	          10    	int	RETVAL;
  1115	          10    	dXSTARG;
  1116			#line 803 "Encode.xs"
  1117			    RETVAL = ENCODE_FB_CROAK;
  1118			#line 1119 "Encode.c"
  1119	          10    	XSprePUSH; PUSHi((IV)RETVAL);
  1120			    }
  1121	          10        XSRETURN(1);
  1122			}
  1123			
  1124			
  1125			XS(XS_Encode_FB_QUIET); /* prototype to pass -Wmissing-prototypes */
  1126			XS(XS_Encode_FB_QUIET)
  1127	         204    {
  1128	         204        dXSARGS;
  1129	         204        if (items != 0)
  1130	      ######    	Perl_croak(aTHX_ "Usage: Encode::FB_QUIET()");
  1131	         204        PERL_UNUSED_VAR(cv); /* -W */
  1132			    {
  1133	         204    	int	RETVAL;
  1134	         204    	dXSTARG;
  1135			#line 810 "Encode.xs"
  1136			    RETVAL = ENCODE_FB_QUIET;
  1137			#line 1138 "Encode.c"
  1138	         204    	XSprePUSH; PUSHi((IV)RETVAL);
  1139			    }
  1140	         204        XSRETURN(1);
  1141			}
  1142			
  1143			
  1144			XS(XS_Encode_FB_WARN); /* prototype to pass -Wmissing-prototypes */
  1145			XS(XS_Encode_FB_WARN)
  1146	           2    {
  1147	           2        dXSARGS;
  1148	           2        if (items != 0)
  1149	      ######    	Perl_croak(aTHX_ "Usage: Encode::FB_WARN()");
  1150	           2        PERL_UNUSED_VAR(cv); /* -W */
  1151			    {
  1152	           2    	int	RETVAL;
  1153	           2    	dXSTARG;
  1154			#line 817 "Encode.xs"
  1155			    RETVAL = ENCODE_FB_WARN;
  1156			#line 1157 "Encode.c"
  1157	           2    	XSprePUSH; PUSHi((IV)RETVAL);
  1158			    }
  1159	           2        XSRETURN(1);
  1160			}
  1161			
  1162			
  1163			XS(XS_Encode_FB_PERLQQ); /* prototype to pass -Wmissing-prototypes */
  1164			XS(XS_Encode_FB_PERLQQ)
  1165	        1518    {
  1166	        1518        dXSARGS;
  1167	        1518        if (items != 0)
  1168	      ######    	Perl_croak(aTHX_ "Usage: Encode::FB_PERLQQ()");
  1169	        1518        PERL_UNUSED_VAR(cv); /* -W */
  1170			    {
  1171	        1518    	int	RETVAL;
  1172	        1518    	dXSTARG;
  1173			#line 824 "Encode.xs"
  1174			    RETVAL = ENCODE_FB_PERLQQ;
  1175			#line 1176 "Encode.c"
  1176	        1518    	XSprePUSH; PUSHi((IV)RETVAL);
  1177			    }
  1178	        1518        XSRETURN(1);
  1179			}
  1180			
  1181			
  1182			XS(XS_Encode_FB_HTMLCREF); /* prototype to pass -Wmissing-prototypes */
  1183			XS(XS_Encode_FB_HTMLCREF)
  1184	           2    {
  1185	           2        dXSARGS;
  1186	           2        if (items != 0)
  1187	      ######    	Perl_croak(aTHX_ "Usage: Encode::FB_HTMLCREF()");
  1188	           2        PERL_UNUSED_VAR(cv); /* -W */
  1189			    {
  1190	           2    	int	RETVAL;
  1191	           2    	dXSTARG;
  1192			#line 831 "Encode.xs"
  1193			    RETVAL = ENCODE_FB_HTMLCREF;
  1194			#line 1195 "Encode.c"
  1195	           2    	XSprePUSH; PUSHi((IV)RETVAL);
  1196			    }
  1197	           2        XSRETURN(1);
  1198			}
  1199			
  1200			
  1201			XS(XS_Encode_FB_XMLCREF); /* prototype to pass -Wmissing-prototypes */
  1202			XS(XS_Encode_FB_XMLCREF)
  1203	           2    {
  1204	           2        dXSARGS;
  1205	           2        if (items != 0)
  1206	      ######    	Perl_croak(aTHX_ "Usage: Encode::FB_XMLCREF()");
  1207	           2        PERL_UNUSED_VAR(cv); /* -W */
  1208			    {
  1209	           2    	int	RETVAL;
  1210	           2    	dXSTARG;
  1211			#line 838 "Encode.xs"
  1212			    RETVAL = ENCODE_FB_XMLCREF;
  1213			#line 1214 "Encode.c"
  1214	           2    	XSprePUSH; PUSHi((IV)RETVAL);
  1215			    }
  1216	           2        XSRETURN(1);
  1217			}
  1218			
  1219			#ifdef __cplusplus
  1220			extern "C"
  1221			#endif
  1222			XS(boot_Encode); /* prototype to pass -Wmissing-prototypes */
  1223			XS(boot_Encode)
  1224	          37    {
  1225	          37        dXSARGS;
  1226	          37        char* file = __FILE__;
  1227			
  1228	          37        PERL_UNUSED_VAR(cv); /* -W */
  1229	          37        PERL_UNUSED_VAR(items); /* -W */
  1230	          37        XS_VERSION_BOOTCHECK ;
  1231			
  1232	          37            newXS("Encode::utf8::decode_xs", XS_Encode__utf8_decode_xs, file);
  1233	          37            newXS("Encode::utf8::encode_xs", XS_Encode__utf8_encode_xs, file);
  1234	          37            newXSproto("Encode::XS::renew", XS_Encode__XS_renew, file, "$");
  1235	          37            newXSproto("Encode::XS::renewed", XS_Encode__XS_renewed, file, "$");
  1236	          37            newXSproto("Encode::XS::name", XS_Encode__XS_name, file, "$");
  1237	          37            newXSproto("Encode::XS::cat_decode", XS_Encode__XS_cat_decode, file, "$$$$$;$");
  1238	          37            newXSproto("Encode::XS::decode", XS_Encode__XS_decode, file, "$$;$");
  1239	          37            newXSproto("Encode::XS::encode", XS_Encode__XS_encode, file, "$$;$");
  1240	          37            newXSproto("Encode::XS::needs_lines", XS_Encode__XS_needs_lines, file, "$");
  1241	          37            newXSproto("Encode::XS::perlio_ok", XS_Encode__XS_perlio_ok, file, "$");
  1242	          37            newXSproto("Encode::_bytes_to_utf8", XS_Encode__bytes_to_utf8, file, "$;@");
  1243	          37            newXSproto("Encode::_utf8_to_bytes", XS_Encode__utf8_to_bytes, file, "$;@");
  1244	          37            newXSproto("Encode::is_utf8", XS_Encode_is_utf8, file, "$;$");
  1245	          37            newXSproto("Encode::_utf8_on", XS_Encode__utf8_on, file, "$");
  1246	          37            newXSproto("Encode::_utf8_off", XS_Encode__utf8_off, file, "$");
  1247	          37            newXSproto("Encode::DIE_ON_ERR", XS_Encode_DIE_ON_ERR, file, "");
  1248	          37            newXSproto("Encode::WARN_ON_ERR", XS_Encode_WARN_ON_ERR, file, "");
  1249	          37            newXSproto("Encode::LEAVE_SRC", XS_Encode_LEAVE_SRC, file, "");
  1250	          37            newXSproto("Encode::RETURN_ON_ERR", XS_Encode_RETURN_ON_ERR, file, "");
  1251	          37            newXSproto("Encode::PERLQQ", XS_Encode_PERLQQ, file, "");
  1252	          37            newXSproto("Encode::HTMLCREF", XS_Encode_HTMLCREF, file, "");
  1253	          37            newXSproto("Encode::XMLCREF", XS_Encode_XMLCREF, file, "");
  1254	          37            newXSproto("Encode::FB_DEFAULT", XS_Encode_FB_DEFAULT, file, "");
  1255	          37            newXSproto("Encode::FB_CROAK", XS_Encode_FB_CROAK, file, "");
  1256	          37            newXSproto("Encode::FB_QUIET", XS_Encode_FB_QUIET, file, "");
  1257	          37            newXSproto("Encode::FB_WARN", XS_Encode_FB_WARN, file, "");
  1258	          37            newXSproto("Encode::FB_PERLQQ", XS_Encode_FB_PERLQQ, file, "");
  1259	          37            newXSproto("Encode::FB_HTMLCREF", XS_Encode_FB_HTMLCREF, file, "");
  1260	          37            newXSproto("Encode::FB_XMLCREF", XS_Encode_FB_XMLCREF, file, "");
  1261			
  1262			    /* Initialisation Section */
  1263			
  1264			#line 843 "Encode.xs"
  1265			{
  1266			#include "def_t.h"
  1267			#include "def_t.exh"
  1268			}
  1269			
  1270			#line 1271 "Encode.c"
  1271			
  1272			    /* End of Initialisation Section */
  1273			
  1274	          37        XSRETURN_YES;
  1275			}
  1276			
