ShiftJIS-String

 view release on metacpan or  search on metacpan

String.xsX  view on Meta::CPAN



MODULE = ShiftJIS::String	PACKAGE = ShiftJIS::String

void
issjis(...)
  PREINIT:
    I32 i;
    U8 *s;
    STRLEN byte;
  PPCODE:
    for (i = 0; i < items; i++) {
	s = (U8*)SvPV(ST(i), byte);
	if (!issjis(s, byte))
	    XSRETURN_NO;
    }
    XSRETURN_YES;


SV*
length(src)

String.xsX  view on Meta::CPAN

    SV *src
    I32 off
    I32 len
    SV *rep
  PROTOTYPE: $$;$$
  PREINIT:
    U8 *s, *e, *p, *p_ini, *p_fin;
    STRLEN sbyte;
    I32 slen, ini, fin, cnt;
    int except;
  PPCODE:
    s = SvROK(src)
	? (U8*)SvPV_force(SvRV(src), sbyte)
	: (U8*)SvPV(src, sbyte);

    slen = length(s,sbyte);
    except = FALSE;

    if (slen < off)
	except = TRUE;

String.xsX  view on Meta::CPAN

    SV *src
  PROTOTYPE: $
  ALIAS:
    hi2ka = 1
    ka2hi = 2
  PREINIT:
    U8 *s, *p, *e, *d;
    STRLEN byte;
    SV *dst;
    I32 cnt = 0;
  PPCODE:
    s = SvROK(src)
	? (U8*)SvPV_force(SvRV(src), byte)
	: (U8*)SvPV(src, byte);

    dst = byte ? newSV((ix == 1) ? byte : 2 * byte) : newSVpvn("",0);
    (void)SvPOK_only(dst);
    (void)sv_2mortal(dst);
    d = (U8*)SvPVX(dst);

    for (p = s, e = s + byte; p < e;) {

String.xsX  view on Meta::CPAN

  PROTOTYPE: $
  ALIAS:
    kataH2Z = 1
    hiraH2Z = 2
  PREINIT:
    U8 *s, *p, *e, *d;
    STRLEN byte;
    SV *dst;
    I32 cnt = 0;
    U8* trail;
  PPCODE:
    s = SvROK(src)
	? (U8*)SvPV_force(SvRV(src), byte)
	: (U8*)SvPV(src, byte);

    dst = byte ? newSV(2 * byte) : newSVpvn("",0);
    (void)SvPOK_only(dst);
    (void)sv_2mortal(dst);
    d = (U8*)SvPVX(dst);

    trail = (ix == 2) ? (U8*)SJIS_HHIRA_TRAIL : (U8*)SJIS_HKANA_TRAIL;

String.xsX  view on Meta::CPAN

  PROTOTYPE: $
  ALIAS:
    kataZ2H = 1
    hiraZ2H = 2
  PREINIT:
    U8 *s, *p, *e, *d;
    STRLEN byte;
    SV *dst;
    U16 uv;
    I32 cnt = 0;
  PPCODE:
    s = SvROK(src)
	? (U8*)SvPV_force(SvRV(src), byte)
	: (U8*)SvPV(src, byte);

    dst = byte ? newSV(byte) : newSVpvn("",0);
    (void)SvPOK_only(dst);
    (void)sv_2mortal(dst);
    d = (U8*)SvPVX(dst);

    for (p = s, e = s + byte; p < e; ) {

String.xsX  view on Meta::CPAN


void
spaceH2Z(src)
    SV *src
  PROTOTYPE: $
  PREINIT:
    U8 *s, *p, *e, *d;
    STRLEN byte;
    SV *dst;
    I32 cnt = 0;
  PPCODE:
    s = SvROK(src)
	? (U8*)SvPV_force(SvRV(src), byte)
	: (U8*)SvPV(src, byte);

    dst = byte ? newSV(2 * byte) : newSVpvn("",0);
    (void)SvPOK_only(dst);
    (void)sv_2mortal(dst);
    d = (U8*)SvPVX(dst);

    for (p = s, e = s + byte; p < e;) {

String.xsX  view on Meta::CPAN


void
spaceZ2H(src)
    SV *src
  PROTOTYPE: $
  PREINIT:
    U8 *s, *p, *e, *d;
    STRLEN byte;
    SV *dst;
    I32 cnt = 0;
  PPCODE:
    s = SvROK(src)
	? (U8*)SvPV_force(SvRV(src), byte)
	: (U8*)SvPV(src, byte);

    dst = byte ? newSV(byte) : newSVpvn("",0);
    (void)SvPOK_only(dst);
    (void)sv_2mortal(dst);
    d = (U8*)SvPVX(dst);

    for (p = s, e = s + byte; p < e; ) {

String.xsX  view on Meta::CPAN

toupper(src)
    SV * src
  PROTOTYPE: $
  ALIAS:
    tolower = 1
  PREINIT:
    U8 *s, *p, *e, *d;
    STRLEN byte;
    SV *dst;
    I32 cnt = 0;
  PPCODE:
    s = SvROK(src)
	? (U8*)SvPV_force(SvRV(src), byte)
	: (U8*)SvPV(src, byte);

    dst = byte ? newSV(byte) : newSVpvn("",0);
    (void)SvPOK_only(dst);
    (void)sv_2mortal(dst);
    d = (U8*)SvPVX(dst);

    for (p = s, e = s + byte; p < e; ) {

String.xsX  view on Meta::CPAN

    SV *src
    SV *rev
  PROTOTYPE: $;$
  PREINIT:
    U8 *s, *p, *e, *d;
    U8 lastL = 0, iniL, iniT, finL, finT;
    STRLEN sbyte, dbyte, dstcur;
    SV *dst;
    U16 fr, to;
    int isReverse, doReverse, isrange;
  PPCODE:
    isReverse = SvTRUE(rev);

    s = (U8*)SvPV(src, sbyte);

    dbyte = sbyte + 1;
    dst = sv_2mortal(newSV(dbyte));
    (void)SvPOK_only(dst);
    d = (U8*)SvPVX(dst);

    p = s;

String.xsX  view on Meta::CPAN

  PROTOTYPE: $$;$
  PREINIT:
    SV *dst;
    int mod_c, mod_d, mod_s, found;
    int modes, tlen, cnt;
    U8 *p, *e, *s, *d, *tr, *m;
    STRLEN idx;
    STRLEN byte, trbyte, modbyte;
    U8 fr[2], *to, tolast[2], pre[2], tmp[2];
    STRLEN fbyte, tbyte, lbyte, prebyte, tmpbyte;
  PPCODE:
    s = SvROK(src)
	? (U8*)SvPV_force(SvRV(src), byte)
	: (U8*)SvPV(src, byte);

    tr = (U8*)SvPV(trans, trbyte);

    if (trbyte < SJIS_TransIndexPad)
	croak(PkgName " Panic! too short trans string in strtr_light");
    idx = (trbyte - SJIS_TransIndexPad) / SJIS_TransBytesPerRow;

String.xsX  view on Meta::CPAN

strsplit (separator, src, lim = 0)
    SV *separator;
    SV *src;
    I32 lim;
  PROTOTYPE: $$;$
  PREINIT:
    U8 *s, *e, *p, *sep, *anc, *last;
    STRLEN byte, sepbyte, ch;
    int wantarray;
    I32 cnt = 0;
  PPCODE:
    wantarray = (GIMME_V == G_ARRAY);

    s = (U8*)SvPV(src, byte);

    if (!byte)
	if (wantarray)
	    XSRETURN_EMPTY;
	else
	    XSRETURN_IV(0);



( run in 0.812 second using v1.01-cache-2.11-cpan-5511b514fd6 )