/* Unicode support */
-char *
-uv_to_utf8(unsigned char *d, UV uv)
+U8 *
+uv_to_utf8(U8 *d, UV uv)
{
if (uv < 0x80) {
*d++ = uv;
}
UV
-utf8_to_uv(unsigned char* s, I32* retlen)
+utf8_to_uv(U8* s, I32* retlen)
{
UV uv = *s;
int len;
/* utf8_distance(a,b) is intended to be a - b in pointer arithmetic */
I32
-utf8_distance(unsigned char *a, unsigned char *b)
+utf8_distance(U8 *a, U8 *b)
{
I32 off = 0;
if (a < b) {
/* WARNING: do not use the following unless you *know* off is within bounds */
U8 *
-utf8_hop(unsigned char *s, I32 off)
+utf8_hop(U8 *s, I32 off)
{
if (off >= 0) {
while (off--)
bool
is_uni_alnum(U32 c)
{
- char tmpbuf[10];
+ U8 tmpbuf[10];
uv_to_utf8(tmpbuf, (UV)c);
return is_utf8_alnum(tmpbuf);
}
bool
is_uni_idfirst(U32 c)
{
- char tmpbuf[10];
+ U8 tmpbuf[10];
uv_to_utf8(tmpbuf, (UV)c);
return is_utf8_idfirst(tmpbuf);
}
bool
is_uni_alpha(U32 c)
{
- char tmpbuf[10];
+ U8 tmpbuf[10];
uv_to_utf8(tmpbuf, (UV)c);
return is_utf8_alpha(tmpbuf);
}
bool
is_uni_space(U32 c)
{
- char tmpbuf[10];
+ U8 tmpbuf[10];
uv_to_utf8(tmpbuf, (UV)c);
return is_utf8_space(tmpbuf);
}
bool
is_uni_digit(U32 c)
{
- char tmpbuf[10];
+ U8 tmpbuf[10];
uv_to_utf8(tmpbuf, (UV)c);
return is_utf8_digit(tmpbuf);
}
bool
is_uni_upper(U32 c)
{
- char tmpbuf[10];
+ U8 tmpbuf[10];
uv_to_utf8(tmpbuf, (UV)c);
return is_utf8_upper(tmpbuf);
}
bool
is_uni_lower(U32 c)
{
- char tmpbuf[10];
+ U8 tmpbuf[10];
uv_to_utf8(tmpbuf, (UV)c);
return is_utf8_lower(tmpbuf);
}
bool
is_uni_print(U32 c)
{
- char tmpbuf[10];
+ U8 tmpbuf[10];
uv_to_utf8(tmpbuf, (UV)c);
return is_utf8_print(tmpbuf);
}
U32
to_uni_upper(U32 c)
{
- char tmpbuf[10];
+ U8 tmpbuf[10];
uv_to_utf8(tmpbuf, (UV)c);
return to_utf8_upper(tmpbuf);
}
U32
to_uni_title(U32 c)
{
- char tmpbuf[10];
+ U8 tmpbuf[10];
uv_to_utf8(tmpbuf, (UV)c);
return to_utf8_title(tmpbuf);
}
U32
to_uni_lower(U32 c)
{
- char tmpbuf[10];
+ U8 tmpbuf[10];
uv_to_utf8(tmpbuf, (UV)c);
return to_utf8_lower(tmpbuf);
}
bool
-is_utf8_alnum(unsigned char *p)
+is_utf8_alnum(U8 *p)
{
if (!PL_utf8_alnum)
PL_utf8_alnum = swash_init("utf8", "IsAlnum", &sv_undef, 0, 0);
}
bool
-is_utf8_idfirst(unsigned char *p)
+is_utf8_idfirst(U8 *p)
{
return *p == '_' || is_utf8_alpha(p);
}
bool
-is_utf8_alpha(unsigned char *p)
+is_utf8_alpha(U8 *p)
{
if (!PL_utf8_alpha)
PL_utf8_alpha = swash_init("utf8", "IsAlpha", &sv_undef, 0, 0);
}
bool
-is_utf8_space(unsigned char *p)
+is_utf8_space(U8 *p)
{
if (!PL_utf8_space)
PL_utf8_space = swash_init("utf8", "IsSpace", &sv_undef, 0, 0);
}
bool
-is_utf8_digit(unsigned char *p)
+is_utf8_digit(U8 *p)
{
if (!PL_utf8_digit)
PL_utf8_digit = swash_init("utf8", "IsDigit", &sv_undef, 0, 0);
}
bool
-is_utf8_upper(unsigned char *p)
+is_utf8_upper(U8 *p)
{
if (!PL_utf8_upper)
PL_utf8_upper = swash_init("utf8", "IsUpper", &sv_undef, 0, 0);
}
bool
-is_utf8_lower(unsigned char *p)
+is_utf8_lower(U8 *p)
{
if (!PL_utf8_lower)
PL_utf8_lower = swash_init("utf8", "IsLower", &sv_undef, 0, 0);
}
bool
-is_utf8_print(unsigned char *p)
+is_utf8_print(U8 *p)
{
if (!PL_utf8_print)
PL_utf8_print = swash_init("utf8", "IsPrint", &sv_undef, 0, 0);
}
bool
-is_utf8_mark(unsigned char *p)
+is_utf8_mark(U8 *p)
{
if (!PL_utf8_mark)
PL_utf8_mark = swash_init("utf8", "IsM", &sv_undef, 0, 0);
return swash_fetch(PL_utf8_mark, p);
}
-U32
-to_utf8_upper(unsigned char *p)
+UV
+to_utf8_upper(U8 *p)
{
UV uv;
return uv ? uv : utf8_to_uv(p,0);
}
-U32
-to_utf8_title(unsigned char *p)
+UV
+to_utf8_title(U8 *p)
{
UV uv;
return uv ? uv : utf8_to_uv(p,0);
}
-U32
-to_utf8_lower(unsigned char *p)
+UV
+to_utf8_lower(U8 *p)
{
UV uv;
}
UV
-swash_fetch(SV *sv, unsigned char *ptr)
+swash_fetch(SV *sv, U8 *ptr)
{
HV* hv = (HV*)SvRV(sv);
U32 klen = UTF8SKIP(ptr) - 1;
U32 off = ptr[klen] & 127; /* NB: 64 bit always 0 when len > 1 */
STRLEN slen;
STRLEN needents = (klen ? 64 : 128);
- unsigned char *tmps;
+ U8 *tmps;
U32 bit;
SV *retval;
}
else {
/* Try our second-level swatch cache, kept in a hash. */
- SV** svp = hv_fetch(hv, ptr, klen, FALSE);
+ SV** svp = hv_fetch(hv, (char*)ptr, klen, FALSE);
/* If not cached, generate it via utf8::SWASHGET */
- if (!svp || !SvPOK(*svp) || !(tmps = SvPV(*svp, slen))) {
+ if (!svp || !SvPOK(*svp) || !(tmps = (U8*)SvPV(*svp, slen))) {
dSP;
ENTER;
SAVETMPS;
if (curcop == &compiling)
curcop->op_private = PL_hints;
- svp = hv_store(hv, ptr, klen, retval, 0);
+ svp = hv_store(hv, (char*)ptr, klen, retval, 0);
- if (!svp || !(tmps = SvPV(*svp, slen)) || slen < 8)
+ if (!svp || !(tmps = (U8*)SvPV(*svp, slen)) || slen < 8)
croak("SWASHGET didn't return result of proper length");
}