Move more stuff out to XPG4
Handle negative chars inside runetype/tolower/toupper
This commit is contained in:
parent
5f00167641
commit
94bfe4fc2d
@ -41,12 +41,22 @@ unsigned long
|
||||
___runetype(c)
|
||||
_BSD_RUNE_T_ c;
|
||||
{
|
||||
#ifdef XPG4
|
||||
int x;
|
||||
_RuneRange *rr = &_CurrentRuneLocale->runetype_ext;
|
||||
_RuneEntry *re = rr->ranges;
|
||||
#endif
|
||||
|
||||
if (c == EOF)
|
||||
return(0);
|
||||
if (c < 0) {
|
||||
if (c >= -128) /* signed char */
|
||||
return(_CurrentRuneLocale->runetype[(unsigned char)c]);
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
#ifdef XPG4
|
||||
for (x = 0; x < rr->nranges; ++x, ++re) {
|
||||
if (c < re->min)
|
||||
return(0L);
|
||||
@ -57,6 +67,7 @@ ___runetype(c)
|
||||
return(re->map);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return(0L);
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ extern int _none_init __P((_RuneLocale *));
|
||||
#ifdef XPG4
|
||||
extern int _UTF2_init __P((_RuneLocale *));
|
||||
extern int _EUC_init __P((_RuneLocale *));
|
||||
extern int _xpg4_setrunelocale __P((char *));
|
||||
#endif
|
||||
extern _RuneLocale *_Read_RuneMagi __P((FILE *));
|
||||
|
||||
|
@ -41,18 +41,28 @@ _BSD_RUNE_T_
|
||||
___tolower(c)
|
||||
_BSD_RUNE_T_ c;
|
||||
{
|
||||
#ifdef XPG4
|
||||
int x;
|
||||
_RuneRange *rr = &_CurrentRuneLocale->maplower_ext;
|
||||
_RuneEntry *re = rr->ranges;
|
||||
#endif
|
||||
|
||||
if (c == EOF)
|
||||
return(EOF);
|
||||
if (c < 0) {
|
||||
if (c >= -128) /* signed char */
|
||||
return(_CurrentRuneLocale->maplower[(unsigned char)c]);
|
||||
else
|
||||
return(c);
|
||||
}
|
||||
#ifdef XPG4
|
||||
for (x = 0; x < rr->nranges; ++x, ++re) {
|
||||
if (c < re->min)
|
||||
return(c);
|
||||
if (c <= re->max)
|
||||
return(re->map + c - re->min);
|
||||
}
|
||||
#endif
|
||||
return(c);
|
||||
}
|
||||
|
||||
|
@ -41,18 +41,28 @@ _BSD_RUNE_T_
|
||||
___toupper(c)
|
||||
_BSD_RUNE_T_ c;
|
||||
{
|
||||
#ifdef XPG4
|
||||
int x;
|
||||
_RuneRange *rr = &_CurrentRuneLocale->mapupper_ext;
|
||||
_RuneEntry *re = rr->ranges;
|
||||
#endif
|
||||
|
||||
if (c == EOF)
|
||||
return(EOF);
|
||||
if (c < 0) {
|
||||
if (c >= -128) /* signed char */
|
||||
return(_CurrentRuneLocale->mapupper[(unsigned char)c]);
|
||||
else
|
||||
return(c);
|
||||
}
|
||||
#ifdef XPG4
|
||||
for (x = 0; x < rr->nranges; ++x, ++re) {
|
||||
if (c < re->min)
|
||||
return(c);
|
||||
if (c <= re->max)
|
||||
return(re->map + c - re->min);
|
||||
}
|
||||
#endif
|
||||
return(c);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user