X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=internals%2F_PDCLIB_locale.h;h=3b2deced51b3f519eb01ed49f1a325da69183955;hb=6e6c4e6b52f2516e4bb6b9f37c1e2e18cb7448b5;hp=8d28f2d976d2f2c202231b966dc929168f5fd098;hpb=380b0fdfb5ad7cd23ff3d943f5cdf93a055da541;p=pdclib diff --git a/internals/_PDCLIB_locale.h b/internals/_PDCLIB_locale.h index 8d28f2d..3b2dece 100644 --- a/internals/_PDCLIB_locale.h +++ b/internals/_PDCLIB_locale.h @@ -59,6 +59,9 @@ #define _PDCLIB_CTYPE_DIGIT 256 #define _PDCLIB_CTYPE_XDIGT 512 +#define _PDCLIB_WCTRANS_TOLOWER 1 +#define _PDCLIB_WCTRANS_TOUPPER 2 + typedef struct _PDCLIB_ctype { _PDCLIB_uint16_t flags; @@ -69,12 +72,31 @@ typedef struct _PDCLIB_ctype typedef struct _PDCLIB_wcinfo { - _PDCLIB_uint32_t num; + _PDCLIB_wint_t num; _PDCLIB_uint16_t flags; - _PDCLIB_uint32_t lower; - _PDCLIB_uint32_t upper; + _PDCLIB_wint_t lower; + _PDCLIB_wint_t upper; } _PDCLIB_wcinfo_t; +extern _PDCLIB_wcinfo_t _PDCLIB_wcinfo[]; +extern size_t _PDCLIB_wcinfo_size; + +static inline int _PDCLIB_wcinfo_cmp( const void * _key, const void * _obj ) +{ + _PDCLIB_uint32_t * key = (_PDCLIB_uint32_t *) _key; + _PDCLIB_wcinfo_t * obj = (_PDCLIB_wcinfo_t *) _obj; + return *key - obj->num; +} + +static inline _PDCLIB_wcinfo_t * _PDCLIB_wcgetinfo( _PDCLIB_uint32_t num ) +{ + _PDCLIB_wcinfo_t *info = (_PDCLIB_wcinfo_t*) + bsearch( &num, _PDCLIB_wcinfo, _PDCLIB_wcinfo_size, + sizeof( _PDCLIB_wcinfo[0] ), _PDCLIB_wcinfo_cmp ); + + return info; +} + static inline _PDCLIB_wint_t _PDCLIB_unpackwint( _PDCLIB_wint_t wc ) { if( sizeof(_PDCLIB_wchar_t) == 2 && sizeof(_PDCLIB_wint_t) == 4 ) {