Changeset 1705


Ignore:
Timestamp:
Dec 6, 2004, 3:19:54 AM (21 years ago)
Author:
bird
Message:

wide-char and other locale stuff.

Location:
trunk/src/emx
Files:
6 added
1 deleted
40 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/include/InnoTekLIBC/locale.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    3131
    3232#include <sys/cdefs.h>
     33#include <sys/_types.h>
    3334#include <locale.h>
    3435#include <uconv.h>
     
    4546    /** MBCS prefixes. Two bits per character. */
    4647    unsigned char   au2MBCSPrefixs[256/4];
     48#ifdef __OS2__
    4749    /** The converter object to convert to and from selected codepage
    4850      (used with MBCS codepages only). */
     
    5052    /** The locale object. */
    5153    LocaleObject    lobj;
     54#endif
    5255    /** Non-zero if there are any MBCS prefix characters in codepage. */
    5356    char            mbcs;
     
    5659typedef __LIBC_LOCALECOLLATE *__LIBC_PLOCALECOLLATE;
    5760
     61/**
     62 * Multibyte to/from wide character conversion functions.
     63 */
     64typedef struct __libc_localeCTypeFuncs
     65{
     66    int     (*pfnmbsinit)(const __mbstate_t *);
     67    size_t  (*pfnmbrtowc)(__wchar_t * __restrict, const char * __restrict, size_t, __mbstate_t * __restrict);
     68    size_t  (*pfnmbsnrtowcs)(__wchar_t * __restrict, const char ** __restrict, size_t, size_t, __mbstate_t * __restrict);
     69    size_t  (*pfnwcrtomb)(char * __restrict, __wchar_t, __mbstate_t * __restrict);
     70    size_t  (*pfnwcsnrtombs)(char * __restrict, const __wchar_t ** __restrict, size_t, size_t, __mbstate_t * __restrict);
     71} __LIBC_LOCALECTYPEFUNCS;
     72/** Pointer to multibyte/wide character conversion functions. */
     73typedef __LIBC_LOCALECTYPEFUNCS *__LIBC_PLOCALECTYPEFUNCS;
     74/** Pointer to const multibyte/wide character conversion functions. */
     75typedef const __LIBC_LOCALECTYPEFUNCS *__LIBC_PCLOCALECTYPEFUNCS;
    5876
    5977/**
     
    6381{
    6482    /** All uppercased characters. */
    65     unsigned char   auchUpper[256];
     83    unsigned char           auchUpper[256];
    6684    /** All lowercased characters. */
    67     unsigned char   auchLower[256];
     85    unsigned char           auchLower[256];
    6886    /** Bit flags for every character (for isXXX() function series). */
    69     unsigned short  ausfType[256];
     87    unsigned                aufType[256];
     88
     89/* part which we don't 'expose': */
    7090    /** MBCS prefixes. Two bits per character. */
    71     unsigned char   au2MBCSPrefixs[256/4];
     91    unsigned char           au2MBCSPrefixs[256/4];
     92    /** Unicode translation. (0xffff means not translation.) */
     93    unsigned short          aucUnicode[256];
     94    /** Unicode -> SBCS conversion: 0..128. */
     95    unsigned char           auchToSBCS0To128[128];
     96    /** Unicode -> SBCS conversion: Custom regions. */
     97    struct
     98    {
     99        /** First unicode code point. */
     100        unsigned short      usStart;
     101        /** Number of entries used. */
     102        unsigned short      cChars;
     103        /** Array SBCS chars corresponding to (wc - usStart). 0 means no conversion. */
     104        unsigned char       auch[28];
     105    }                       aSBCSs[8];
     106    /** Number of aSBCS regions in use. */
     107    unsigned                cSBCSs;
     108    /** Conversion functions. */
     109    __LIBC_LOCALECTYPEFUNCS CtypeFuncs;
     110#ifdef __OS2__
    72111    /** The converter object to convert to and from selected codepage
    73112      (used with MBCS codepages only). */
    74     UconvObject     uobj;
     113    UconvObject             uobj;
    75114    /** The locale object. */
    76     LocaleObject    lobj;
     115    LocaleObject            lobj;
     116#endif
    77117    /** Non-zero if there are any MBCS prefix characters in codepage. */
    78     char            mbcs;
     118    char                    mbcs;
    79119} __LIBC_LOCALECTYPE;
    80120/** Pointer to the Ctype locale struct. */
     
    83123
    84124/**
    85  * This structure contains the flags for the default (C/POSIX) locale.
    86  */
    87 typedef struct __libc_LocaleCtypeDefault
    88 {
    89     /** Bit flags for every character (for isXXX() function series). */
    90     unsigned short  ausfType[256];
    91 } __LIBC_LOCALECTYPEDEFAULT;
    92 /** Pointer to the Ctype locale struct. */
    93 typedef __LIBC_LOCALECTYPEDEFAULT *__LIBC_PLOCALECTYPEDEFAULT;
    94 
     125 * Unicode CType data.
     126 * The structure contains information for the first 256 unicode chars.
     127 */
     128typedef struct __libc_localeWCType
     129{
     130    /** All uppercased characters. */
     131    __wchar_t       awcUpper[256];
     132    /** All lowercased characters. */
     133    __wchar_t       awcLower[256];
     134    /** Bit flags for every character (for iswXXX() function series). */
     135    unsigned        aufType[256];
     136} __LIBC_LOCALEWCTYPE;
     137/** Pointer to the Ctype unicode struct. */
     138typedef __LIBC_LOCALEWCTYPE *__LIBC_PLOCALEWCTYPE;
    95139
    96140/**
     
    101145{
    102146    /** Short month names. */
    103     char *smonths[12];
     147    char   *smonths[12];
    104148    /** Long month names. */
    105     char *lmonths[12];
     149    char   *lmonths[12];
    106150    /** Short weekday names. */
    107     char *swdays[7];
     151    char   *swdays[7];
    108152    /** Long weekday names. */
    109     char *lwdays[7];
     153    char   *lwdays[7];
    110154    /** Date and time format. */
    111     char *date_time_fmt;
     155    char   *date_time_fmt;
    112156    /** Date format. */
    113     char *date_fmt;
     157    char   *date_fmt;
    114158    /** Time format. */
    115     char *time_fmt;
     159    char   *time_fmt;
    116160    /** AM strings. */
    117     char *am;
     161    char   *am;
    118162    /** PM strings. */
    119     char *pm;
     163    char   *pm;
     164    /** AM/PM format. (T_FMT_AMPM) */
     165    char   *ampm_fmt;
     166    /** ERA */
     167    char   *era;
     168    /** ERA_D_FMT. */
     169    char   *era_date_fmt;
     170    /** ERA_D_T_FMT. */
     171    char   *era_date_time_fmt;
     172    /** ERA_T_FMT. */
     173    char   *era_time_fmt;
     174    /** ALT_DIGITS. */
     175    char   *alt_digits;
     176    /** DATESEP. */
     177    char   *datesep;
     178    /** TIMESEP. */
     179    char   *timesep;
     180    /** LISTSEP. */
     181    char   *listsep;
    120182    /** If set all the strings are consts and shall not be free()ed. */
    121     int             fConsts;
     183    int     fConsts;
    122184} __LIBC_LOCALETIME;
    123185/** Pointer to time locale data. */
     
    135197    /** The lconv structure. */
    136198    struct lconv    s;
     199    /** CRNCYSTR. */
     200    char           *pszCrncyStr;
    137201    /** Indicates that all the numeric members are readonly const strings. */
    138202    int             fNumericConsts;
     
    145209
    146210/** String collation information. */
    147 extern __LIBC_LOCALECOLLATE     __libc_gLocaleCollate;
     211extern __LIBC_LOCALECOLLATE         __libc_gLocaleCollate;
    148212/** Character case conversion tables. */
    149 extern __LIBC_LOCALECTYPE       __libc_GLocaleCtype;
     213extern __LIBC_LOCALECTYPE           __libc_GLocaleCtype;
    150214/** Character case conversion tables for the default 'C'/'POSIX' locale. */
    151 extern const __LIBC_LOCALECTYPEDEFAULT __libc_GLocaleCtypeDefault;
     215extern const __LIBC_LOCALECTYPE     __libc_GLocaleCtypeDefault;
     216/** Cached Unicode (__wchar_t) case conversion tables and flags. */
     217extern const __LIBC_LOCALEWCTYPE    __libc_GLocaleWCtype;
    152218/** Locale information structure. */
    153 extern __LIBC_LOCALELCONV       __libc_gLocaleLconv;
     219extern __LIBC_LOCALELCONV           __libc_gLocaleLconv;
    154220/** Date / time formatting rules. */
    155 extern __LIBC_LOCALETIME        __libc_gLocaleTime;
    156 
     221extern __LIBC_LOCALETIME            __libc_gLocaleTime;
     222
     223/** Macros to lock the different locale structures.
     224 * @{
     225 */
     226#define LOCALE_LOCK()               do {} while (0)
     227#define LOCALE_UNLOCK()             do {} while (0)
     228#define LOCALE_CTYPE_RW_LOCK()      do {} while (0)
     229#define LOCALE_CTYPE_RW_UNLOCK()    do {} while (0)
     230#define LOCALE_CTYPE_RW_LOCK()      do {} while (0)
     231#define LOCALE_CTYPE_RW_UNLOCK()    do {} while (0)
     232/** @} */
    157233
    158234/** Convert a string to Unicode, apply some transform and convert back. */
     
    165241extern void __libc_TranslateCodepage(const char *cp, UniChar *ucp);
    166242
     243extern int __libc_localeCreateObjects(const char *pszLocale, const char *pszCodepage, char *pszCodepageActual, LocaleObject *plobj, UconvObject *puobj);
     244
     245extern void __libc_localeFuncsSBCS(__LIBC_PLOCALECTYPEFUNCS pFuncs);
     246extern void __libc_localeFuncsDBCS(__LIBC_PLOCALECTYPEFUNCS pFuncs);
     247extern void __libc_localeFuncsMBCS(__LIBC_PLOCALECTYPEFUNCS pFuncs);
     248extern void __libc_localeFuncsUCS2(__LIBC_PLOCALECTYPEFUNCS pFuncs);
     249extern void __libc_localeFuncsUTF8(__LIBC_PLOCALECTYPEFUNCS pFuncs);
     250extern void __libc_localeFuncsDefault(__LIBC_PLOCALECTYPEFUNCS pFuncs);
     251
     252extern size_t  __libc_localeFuncsGeneric_mbsnrtowcs(size_t  (*pfnmbrtowc)(__wchar_t * __restrict, const char * __restrict, size_t, __mbstate_t * __restrict),
     253                                                    __wchar_t * __restrict dst, const char ** __restrict src, size_t nms, size_t len, __mbstate_t * __restrict ps);
     254extern size_t  __libc_localeFuncsGeneric_wcsnrtombs(size_t  (*pfnwcrtomb)(char * __restrict, __wchar_t, __mbstate_t * __restrict),
     255                                                    char * __restrict dst, const __wchar_t ** __restrict src, size_t nwc, size_t len, __mbstate_t * __restrict ps);
     256
     257extern void     __libc_localeFuncsNone(__LIBC_PLOCALECTYPEFUNCS pFuncs);
     258extern size_t   __libc_locale_none_mbrtowc(__wchar_t * __restrict, const char * __restrict, size_t, __mbstate_t * __restrict);
     259extern int      __libc_locale_none_mbsinit(const __mbstate_t *);
     260extern size_t   __libc_locale_none_mbsnrtowcs(__wchar_t * __restrict dst, const char ** __restrict src, size_t nms, size_t len, __mbstate_t * __restrict ps __unused);
     261extern size_t   __libc_locale_none_wcrtomb(char * __restrict, __wchar_t, __mbstate_t * __restrict);
     262extern size_t   __libc_locale_none_wcsnrtombs(char * __restrict, const __wchar_t ** __restrict, size_t, size_t, __mbstate_t * __restrict);
    167263
    168264
  • trunk/src/emx/include/_ctype.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    3434__BEGIN_DECLS
    3535/**
    36  * Simplified Ctype structure for inline functions.
     36 * Simplified Ctype structures for inline functions.
    3737 */
    3838extern struct
     
    4343    unsigned char   auchLower[256];
    4444    /** Bit flags for every character (for isXXX() function series). */
    45     unsigned short  ausfType[256];
     45    unsigned        aufType[256];
    4646} __libc_GLocaleCtype;
    4747
    4848/**
    49  * Simplified Default Ctype structure for inline functions.
     49 * Simplified Default Ctype structures for inline functions.
    5050 */
    5151extern const struct
    5252{
     53    /** All uppercased characters. */
     54    unsigned char   auchUpper[256];
     55    /** All lowercased characters. */
     56    unsigned char   auchLower[256];
    5357    /** Bit flags for every character (for isXXX() function series). */
    54     unsigned short  ausfType[256];
     58    unsigned        aufType[256];
    5559} __libc_GLocaleCtypeDefault;
     60
     61/**
     62 * Unicode CType data.
     63 * The structure contains information for the first 256 unicode chars.
     64 */
     65extern const struct __libc_localeWCType
     66{
     67    /** All uppercased characters. */
     68    __wchar_t       awcUpper[256];
     69    /** All lowercased characters. */
     70    __wchar_t       awcLower[256];
     71    /** Bit flags for every character (for iswXXX() function series). */
     72    unsigned        aufType[256];
     73} __libc_GLocaleWCtype;
    5674__END_DECLS
    5775#endif /* !__InnoTekLIBC_locale_h__ */
    5876
    5977
    60 /** Bit masks for the ausfType member of __libc_GLocaleCtype
     78/** Bit masks for the aufType member of __libc_GLocaleCtype
    6179 *  and __libc_GLocaleCtypeDefault
    6280 *
    63  * @remark These have identical values to the CT_* to speed up setlocale().
     81 * @remark These have values identical values to the CT_* << 8 to speed up
     82 *         setlocale() and to make us compatible with the BSD scheme. In addition
     83 *         values C3_IDEOGRAPH and the C2_* << 24 are converted into the value. The
     84 *         screen width stuff is attempted derived from other info provided by the
     85 *         unicode libraries.
    6486 * @{
    6587 */
    66 #define __UPPER     0x0001      /** Upper case alphabetic character. */
    67 #define __LOWER     0x0002      /** Lower case alphabetic character. */
    68 #define __DIGIT     0x0004      /** Digits 0-9. */
    69 #define __SPACE     0x0008      /** White space and line ends. */
    70 #define __PUNCT     0x0010      /** Punctuation marks. */
    71 #define __CNTRL     0x0020      /** Control and format characters. */
    72 #define __BLANK     0x0040      /** Space and tab. */
    73 #define __XDIGIT    0x0080      /** Hex digits. */
    74 #define __ALPHA     0x0100      /** Letters and linguistic marks. */
    75 #define __ALNUM     0x0200      /** Alphanumeric. */
    76 #define __GRAPH     0x0400      /** All except controls and space. */
    77 #define __PRINT     0x0800      /** Everything except controls. */
    78 #define __NUMBER    0x1000      /** Integral number. */
    79 #define __SYMBOL    0x2000      /** Symbol. */
    80 #define __ASCII     0x8000      /** In standard ASCII set. */
    81 
    82 /* BSD compatability */
    83 #define _CTYPE_A    __ALPHA
    84 #define _CTYPE_C    __CNTRL
    85 #define _CTYPE_D    __DIGIT
    86 #define _CTYPE_G    __GRAPH
    87 #define _CTYPE_L    __LOWER
    88 #define _CTYPE_P    __PUNCT
    89 #define _CTYPE_S    __SPACE
    90 #define _CTYPE_U    __UPPER
    91 #define _CTYPE_X    __XDIGIT
    92 #define _CTYPE_B    __BLANK
    93 #define _CTYPE_R    __PRINT
    94 #if 0 //later
    95 #define _CTYPE_I        0x00080000L             /* Ideogram */
    96 #define _CTYPE_T        0x00100000L             /* Special */
    97 #define _CTYPE_Q        0x00200000L             /* Phonogram */
    98 
    99 #define _CTYPE_SW0      0x20000000L             /* 0 width character */
    100 #define _CTYPE_SW1      0x40000000L             /* 1 width character */
    101 #define _CTYPE_SW2      0x80000000L             /* 2 width character */
    102 #define _CTYPE_SW3      0xc0000000L             /* 3 width character */
    103 #define _CTYPE_SWM      0xe0000000L             /* Mask for screen width data */
    104 #define _CTYPE_SWS      30                      /* Bits to shift to get width */
     88#define __CT_NUM_MASK   0x000000ffU     /** Numberic value for digit to int conversion. */
     89
     90#define __CT_UPPER      0x00000100U     /** Upper case alphabetic character. */
     91#define __CT_LOWER      0x00000200U     /** Lower case alphabetic character. */
     92#define __CT_DIGIT      0x00000400U     /** Digits 0-9. */
     93#define __CT_SPACE      0x00000800U     /** White space and line ends. */
     94#define __CT_PUNCT      0x00001000U     /** Punctuation marks. */
     95#define __CT_CNTRL      0x00002000U     /** Control and format characters. */
     96#define __CT_BLANK      0x00004000U     /** Space and tab. */
     97#define __CT_XDIGIT     0x00008000U     /** Hex digits. */
     98#define __CT_ALPHA      0x00010000U     /** Letters and linguistic marks. */
     99#define __CT_ALNUM      0x00020000U     /** Alphanumeric - obsolete (__CT_ALPHA | __CT_DIGIT) is the same. */
     100#define __CT_GRAPH      0x00040000U     /** All except controls and space. */
     101#define __CT_PRINT      0x00080000U     /** Everything except controls. */
     102#define __CT_NUMBER     0x00100000U     /** Integral number. */
     103#define __CT_SYMBOL     0x00200000U     /** Symbol. */
     104#define __CT_ASCII      0x00800000U     /** In standard ASCII set. */
     105
     106#define __CT_IDEOGRAM   0x00400000U     /** Ideogram. (C3_IDEOGRAPH?) (Unused/known CT_ bit.) */
     107
     108/* #define __CT_BIDI_MASK  0x0f000000U - not implemented */     /** Bidi mask C2_*. */
     109
     110#define __CT_SCRW0      0x20000000U     /** 0 width character. (Just indicator for SW data when width is 0.) */
     111#define __CT_SCRW1      0x40000000U     /** 1 width character. */
     112#define __CT_SCRW2      0x80000000U     /** 2 width character. */
     113#define __CT_SCRW3      0xc0000000U     /** 3 width character. */
     114#define __CT_SCRW_MASK  0xe0000000U     /** Mask for screen width data. */
     115#define __CT_SCRW_SHIFT 30              /** Bits to shift to get width. */
     116
     117/** BSD compatability.
     118 * @{ */
     119#define _CTYPE_A        __CT_ALPHA
     120#define _CTYPE_C        __CT_CNTRL
     121#define _CTYPE_D        __CT_DIGIT
     122#define _CTYPE_G        __CT_GRAPH
     123#define _CTYPE_L        __CT_LOWER
     124#define _CTYPE_P        __CT_PUNCT
     125#define _CTYPE_S        __CT_SPACE
     126#define _CTYPE_U        __CT_UPPER
     127#define _CTYPE_X        __CT_XDIGIT
     128#define _CTYPE_B        __CT_BLANK
     129#define _CTYPE_R        __CT_PRINT
     130#define _CTYPE_I        __CT_IDEOGRAM
     131#if 0 /* We don't have this info :/ */
     132#define _CTYPE_T        0x00100000L             /* Special */
     133#define _CTYPE_Q        0x00200000L             /* Phonogram */
    105134#endif
    106 
    107 /** @} */
    108 
    109 
    110 __BEGIN_DECLS
    111 int ___istype(__ct_rune_t, unsigned);
    112 __ct_rune_t ___tolower(__ct_rune_t);
    113 __ct_rune_t ___toupper(__ct_rune_t);
    114 __END_DECLS
     135#define _CTYPE_SW0      __CT_SCRW0
     136#define _CTYPE_SW1      __CT_SCRW1
     137#define _CTYPE_SW2      __CT_SCRW2
     138#define _CTYPE_SW3      __CT_SCRW3
     139#define _CTYPE_SWM      __CT_SCRW_MASK
     140#define _CTYPE_SWS      __CT_SCRW_SHIFT
     141/** @} */
     142/** @} */
     143
     144
     145/** Functions for handling runes outside the 0-255 range.
     146 * @{ */
     147__BEGIN_DECLS
     148unsigned ___wctype(__wchar_t);
     149__wchar_t ___towlower(__wchar_t);
     150__wchar_t ___towupper(__wchar_t);
     151__END_DECLS
     152/** @} */
     153
    115154
    116155#if !defined(_DONT_USE_CTYPE_INLINE_) && \
    117156    (defined(_USE_CTYPE_INLINE_) || defined(__GNUC__) || defined(__cplusplus))
    118157
    119 __BEGIN_DECLS
    120 static inline int __istype(__ct_rune_t _c, unsigned _f)
    121 {
    122     return !(_c & 0xffffff00) ? (__libc_GLocaleCtype.ausfType[_c & 0xff] & (_f)) != 0 : ___istype(_c, _f);
    123 }
    124 
    125 static inline int __isctype(__ct_rune_t _c, unsigned _f)
    126 {
    127     return (__libc_GLocaleCtypeDefault.ausfType[_c & 0xff] & (_f)) != 0;
    128 }
    129 
    130 static inline int __toupper(__ct_rune_t _c)
    131 {
    132     return !(_c & 0xffffff00) ? __libc_GLocaleCtype.auchUpper[_c & 0xff] : ___toupper(_c);
    133 }
    134 
    135 static inline int __tolower(__ct_rune_t _c)
    136 {
    137     return !(_c & 0xffffff00) ? __libc_GLocaleCtype.auchLower[_c & 0xff] : ___tolower(_c);
    138 }
    139 __END_DECLS
     158/** Inlined function versions.
     159 * @{
     160 */
     161__BEGIN_DECLS
     162static inline unsigned __ctype(__ct_rune_t __ch, unsigned __f)
     163{
     164    return !((__ch) & ~0xffU)
     165        ? __libc_GLocaleCtype.aufType[(__ch)/* & 0xff*/] & (__f)
     166        : 0;
     167}
     168
     169static inline int __istype(__ct_rune_t __ch, unsigned __f)
     170{
     171    return !!__ctype((__ch), (__f));
     172}
     173
     174static inline int __isctype(__ct_rune_t __ch, unsigned __f)
     175{
     176    return !((__ch) & ~0xffU)
     177        ? !!(__libc_GLocaleCtypeDefault.aufType[(__ch)/* & 0xff*/] & (__f))
     178        : 0;
     179}
     180
     181static inline __ct_rune_t __toupper(__ct_rune_t __ch)
     182{
     183    return !((__ch) & ~0xffU)
     184        ? __libc_GLocaleCtype.auchUpper[(__ch)/* & 0xff*/]
     185        : (__ch);
     186}
     187
     188static inline __ct_rune_t __tolower(__ct_rune_t __ch)
     189{
     190    return !((__ch) & ~0xffU)
     191        ? __libc_GLocaleCtype.auchLower[(__ch)/* & 0xff*/]
     192        : (__ch);
     193}
     194
     195
     196static inline unsigned __wctype(__wint_t __wc, unsigned __f)
     197{
     198    return !((__wc) & ~0xffU)
     199        ? __libc_GLocaleWCtype.aufType[(__wc)] & (__f)
     200        : ___wctype(__wc) & (__f);
     201}
     202
     203static inline int __iswtype(__wint_t __wc, unsigned __f)
     204{
     205    return !!__wctype((__wc), (__f));
     206}
     207
     208static inline __wint_t __towupper(__wint_t __wc)
     209{
     210    return !((__wc) & ~0xffU)
     211        ? __libc_GLocaleWCtype.awcUpper[(__wc)]
     212        : ___towupper(__wc);
     213}
     214
     215static inline __wint_t __towlower(__wint_t __wc)
     216{
     217    return !((__wc) & ~0xffU)
     218        ? __libc_GLocaleWCtype.awcLower[(__wc)]
     219        : ___towlower(__wc);
     220}
     221
     222
     223static inline int __wcwidth(__wint_t __wc)
     224{
     225    if ((__wc) != 0)
     226    {
     227        unsigned __f = __wctype((__wc), __CT_SCRW_MASK | __CT_PRINT);
     228        return ((__f) & __CT_SCRW_MASK)
     229            ? ((__f) & __CT_SCRW_MASK) >> __CT_SCRW_SHIFT
     230            : ((__f) & __CT_PRINT) ? 1 : -1;
     231    }
     232    else
     233        return 0;
     234}
     235__END_DECLS
     236/** @} */
    140237
    141238#else
    142239
    143 __BEGIN_DECLS
    144 int __istype(int, unsigned);
    145 int __isctype(int, unsigned);
    146 int __toupper(int);
    147 int __tolower(int);
    148 
    149 __END_DECLS
     240/** Non-inlined function versions.
     241 * @{
     242 */
     243__BEGIN_DECLS
     244unsigned    __ctype(__ct_rune_t, unsigned);
     245int         __istype(__ct_rune_t, unsigned);
     246__ct_rune_t __isctype(__ct_rune_t, unsigned);
     247__ct_rune_t __toupper(__ct_rune_t);
     248int         __tolower(__ct_rune_t);
     249
     250unsigned    __wctype(__wint_t, unsigned);
     251int         __iswtype(__wint_t, unsigned);
     252__wint_t     __towupper(__wint_t);
     253__wint_t     __towlower(__wint_t);
     254int         __wcwidth(__wint_t);
     255__END_DECLS
     256/** @} */
    150257
    151258#endif
  • trunk/src/emx/include/ctype.h

    • Property cvs2svn:cvs-rev changed from 1.15 to 1.16
    r1704 r1705  
    44 * InnoTek LIBC - Character type querying.
    55 *
    6  * Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>
     6 * Copyright (ch) 2004 knut st. osmundsen <bird@innotek.de>
    77 *
    88 *
     
    5353
    5454#if __BSD_VISIBLE
    55 /* @todo int    digittoint(int); */
     55int     digittoint(int);
    5656int     isblank(int);
    5757int     ishexnumber(int);
    58 /* @todo int    isideogram(int); */
     58int     isideogram(int);
    5959int     isnumber(int);
    6060/* @todo int    isphonogram(int); */
    61 /* @todo int    isrune(int); */
     61int     isrune(int);
    6262/* @todo int    isspecial(int); */
    6363#endif
    6464__END_DECLS
    6565
    66 #define isalnum(c)  __istype((c), (__UPPER)|(__LOWER)|(__DIGIT))
    67 #define isalpha(c)  __istype((c), (__UPPER)|(__LOWER))
    68 #define iscntrl(c)  __istype((c), (__CNTRL))
    69 #define isgraph(c)  __istype((c), (__PUNCT)|(__UPPER)|(__LOWER)|(__DIGIT))
    70 #define islower(c)  __istype((c), (__LOWER))
    71 #define isprint(c)  __istype((c), (__PRINT))
    72 #define ispunct(c)  __istype((c), (__PUNCT))
    73 #define isspace(c)  __istype((c), (__SPACE))
    74 #define isupper(c)  __istype((c), (__UPPER))
    75 #ifdef __UNIX_CHAR_CLASS__
    76 /* BSD and some other UNIXes have non-standard definitions of these two at least. */
    77 #define isdigit(c)  __isctype((c),(__DIGIT))
    78 #define isxdigit(c) __isctype((c),(__XDIGIT))
     66#define isalnum(ch)     __istype((ch), (__CT_ALPHA)|(__CT_DIGIT))
     67#define isalpha(ch)     __istype((ch), (__CT_ALPHA))
     68#define iscntrl(ch)     __istype((ch), (__CT_CNTRL))
     69#define isgraph(ch)     __istype((ch), (__CT_GRAPH))
     70#define islower(ch)     __istype((ch), (__CT_LOWER))
     71#define isprint(ch)     __istype((ch), (__CT_PRINT))
     72#define ispunct(ch)     __istype((ch), (__CT_PUNCT))
     73#define isspace(ch)     __istype((ch), (__CT_SPACE))
     74#define isupper(ch)     __istype((ch), (__CT_UPPER))
     75#ifdef __UNIX_CHAR_CLASS__ /* BSD and some other UNIXes have non-standard definitions of these two at least. */
     76#define isdigit(ch)     __isctype((ch),(__CT_DIGIT))
     77#define isxdigit(ch)    __isctype((ch),(__CT_XDIGIT))
    7978#else
    80 #define isdigit(c)  __istype((c),(__DIGIT))
    81 #define isxdigit(c) __istype((c),(__XDIGIT))
     79#define isdigit(ch)     __istype((ch), (__CT_DIGIT))
     80#define isxdigit(ch)    __istype((ch), (__CT_XDIGIT))
    8281#endif
    83 #define tolower(c)  __tolower(c)
    84 #define toupper(c)  __toupper(c)
     82#define tolower(ch)     __tolower(ch)
     83#define toupper(ch)     __toupper(ch)
    8584
    8685#if __XSI_VISIBLE
    87 #define _toupper(c) __toupper(c)
    88 #define _tolower(c) __tolower(c)
    89 #define isascii(c)   (((c) & ~0x7F) == 0)
    90 #define toascii(c)   ((c) & 0x7F)
     86#define _toupper(ch)    __toupper(ch)
     87#define _tolower(ch)    __tolower(ch)
     88#define isascii(ch)     (((ch) & ~0x7F) == 0)
     89#define toascii(ch)     ((ch) & 0x7F)
    9190#endif
    9291
    9392#if __BSD_VISIBLE
    94 #define isblank(c)      __istype((c), (__BLANK))
    95 #define ishexnumber(c)  __istype((c), (__XDIGIT))
    96 #define isnumber(c)     __istype((c), (__DIGIT))
     93#define isblank(ch)     __istype((ch), (__CT_BLANK))
     94#define ishexnumber(ch) __istype((ch), (__CT_XDIGIT))
     95#define isideogram(ch)  __istype((ch), (__CT_IDEOGRAM))
     96#define isnumber(ch)    __istype((ch), (__CT_DIGIT))
     97#define isrune(ch)      __istype((ch), ~(__CT_NUM_MASK))
     98#define digittoint(ch)  __ctype((ch), (__CT_NUM_MASK))
    9799#endif
    98100
  • trunk/src/emx/include/stdlib.h

    • Property cvs2svn:cvs-rev changed from 1.29 to 1.30
    r1704 r1705  
    8484#define RAND_MAX        0x7fffffff
    8585
    86 extern int _mb_cur_max;                 /* bird: one underscore, not two for us. */
    87 #define MB_CUR_MAX      _mb_cur_max     /* bird: one underscore, not two for us. */
     86extern int __mb_cur_max;
     87#define MB_CUR_MAX      __mb_cur_max
    8888
    8989__BEGIN_DECLS
  • trunk/src/emx/include/sys/cdefs.h

    • Property cvs2svn:cvs-rev changed from 1.10 to 1.11
    r1704 r1705  
    3131 *
    3232 *      @(#)cdefs.h     8.8 (Berkeley) 1/9/95
    33  * $FreeBSD: src/sys/sys/cdefs.h,v 1.81 2004/04/07 04:19:49 imp Exp $
     33 * $FreeBSD: src/sys/sys/cdefs.h,v 1.84 2004/08/13 00:53:40 julian Exp $
    3434 */
    3535
     
    155155#define __pure2         __attribute__((__const__))
    156156#define __unused        __attribute__((__unused__))
     157#define __used          __attribute__((__used__))
    157158#define __packed        __attribute__((__packed__))
    158159#define __aligned(x)    __attribute__((__aligned__(x)))
     
    163164#define __pure2         __attribute__((__const__))
    164165#define __unused        __attribute__((__unused__))
     166#define __used          __attribute__((__used__))
    165167#define __packed        __attribute__((__packed__))
    166168#define __aligned(x)    __attribute__((__aligned__(x)))
    167169#define __section(x)    __attribute__((__section__(x)))
    168170#endif
     171#endif
     172
     173#if __GNUC_PREREQ__(2, 96)
     174#define __pure          __attribute__((__pure__))
     175#else
     176#define __pure
    169177#endif
    170178
     
    245253 */
    246254#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
     255#define __rangeof(type, start, end) \
     256        (__offsetof(type, end) - __offsetof(type, start))
    247257
    248258/*
     
    310320 * more recent ELF binutils, we use .ident allowing the ID to be stripped.
    311321 * Usage:
    312  *      __FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.81 2004/04/07 04:19:49 imp Exp $");
     322 *      __FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.84 2004/08/13 00:53:40 julian Exp $");
    313323 */
    314324#ifndef __FBSDID
  • trunk/src/emx/include/wchar.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    11/** @file
    22 * FreeBSD 5.3
    3  * @changed bird: Disabled most of it.
     3 * @changed bird: Disabled all stream related and some other stuff we don't do yet.
    44 */
    55/*-
     
    7676#include <sys/_types.h>
    7777#include <machine/_limits.h>
    78 #if 0  /* bird */
    7978#include <_ctype.h>
    80 #endif /* bird */
    8179
    8280#ifndef _MBSTATE_T_DECLARED
     
    112110#endif
    113111
    114 #if 0 /* bird */
    115 struct __sFILE;
    116 #endif /* bird */
     112/** @todo struct __sFILE;  */
    117113struct tm;
    118114
    119115__BEGIN_DECLS
    120 #if 0 /* bird */
    121116wint_t  btowc(int);
    122 wint_t  fgetwc(struct __sFILE *);
    123 wchar_t *
    124         fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict);
    125 wint_t  fputwc(wchar_t, struct __sFILE *);
    126 int     fputws(const wchar_t * __restrict, struct __sFILE * __restrict);
    127 int     fwide(struct __sFILE *, int);
    128 int     fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
    129 int     fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...);
    130 wint_t  getwc(struct __sFILE *);
    131 wint_t  getwchar(void);
     117/** @todo wint_t        fgetwc(struct __sFILE *); */
     118/** @todo wchar_t       *
     119        fgetws(wchar_t * __restrict, int, struct __sFILE * __restrict); */
     120/** @todo wint_t        fputwc(wchar_t, struct __sFILE *); */
     121/** @todo int   fputws(const wchar_t * __restrict, struct __sFILE * __restrict); */
     122/** @todo int   fwide(struct __sFILE *, int); */
     123/** @todo int   fwprintf(struct __sFILE * __restrict, const wchar_t * __restrict, ...); */
     124/** @todo int   fwscanf(struct __sFILE * __restrict, const wchar_t * __restrict, ...); */
     125/** @todo wint_t        getwc(struct __sFILE *); */
     126/** @todo wint_t        getwchar(void); */
    132127size_t  mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
    133 #endif /* bird */
    134128size_t  mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
    135129            mbstate_t * __restrict);
    136 #if 0 /* bird */
    137130int     mbsinit(const mbstate_t *);
    138131size_t  mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
    139132            mbstate_t * __restrict);
    140 wint_t  putwc(wchar_t, struct __sFILE *);
    141 wint_t  putwchar(wchar_t);
    142 int     swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
    143             ...);
    144 int     swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
    145 wint_t  ungetwc(wint_t, struct __sFILE *);
    146 int     vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict,
    147             __va_list);
    148 int     vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
    149             __va_list);
    150 int     vwprintf(const wchar_t * __restrict, __va_list);
    151 #endif /* bird */
     133/** @todo wint_t        putwc(wchar_t, struct __sFILE *); */
     134/** @todo wint_t        putwchar(wchar_t); */
     135/** @todo int   swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
     136            ...); */
     137/** @todo int   swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...); */
     138/** @todo wint_t        ungetwc(wint_t, struct __sFILE *); */
     139/** @todo int   vfwprintf(struct __sFILE * __restrict, const wchar_t * __restrict,
     140            __va_list); */
     141/** @todo int   vswprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict,
     142            __va_list); */
     143/** @todo int   vwprintf(const wchar_t * __restrict, __va_list); */
    152144size_t  wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
    153 #if 0 /* bird */
    154145wchar_t *wcscat(wchar_t * __restrict, const wchar_t * __restrict);
    155146wchar_t *wcschr(const wchar_t *, wchar_t) __pure;
     
    185176wchar_t *wmemmove(wchar_t *, const wchar_t *, size_t);
    186177wchar_t *wmemset(wchar_t *, wchar_t, size_t);
    187 int     wprintf(const wchar_t * __restrict, ...);
    188 int     wscanf(const wchar_t * __restrict, ...);
    189 
    190 #ifndef _STDSTREAM_DECLARED
    191 extern struct __sFILE *__stdinp;
    192 extern struct __sFILE *__stdoutp;
    193 extern struct __sFILE *__stderrp;
    194 #define _STDSTREAM_DECLARED
    195 #endif
    196 
    197 #define getwc(fp)       fgetwc(fp)
    198 #define getwchar()      fgetwc(__stdinp)
    199 #define putwc(wc, fp)   fputwc(wc, fp)
    200 #define putwchar(wc)    fputwc(wc, __stdoutp)
     178/** @todo int   wprintf(const wchar_t * __restrict, ...); */
     179/** @todo int   wscanf(const wchar_t * __restrict, ...); */
     180
     181/** @todo #ifndef _STDSTREAM_DECLARED */
     182/** @todo extern struct __sFILE *__stdinp; */
     183/** @todo extern struct __sFILE *__stdoutp; */
     184/** @todo extern struct __sFILE *__stderrp; */
     185/** @todo #define       _STDSTREAM_DECLARED */
     186/** @todo #endif */
     187
     188/** @todo #define       getwc(fp)       fgetwc(fp) */
     189/** @todo #define       getwchar()      fgetwc(__stdinp) */
     190/** @todo #define       putwc(wc, fp)   fputwc(wc, fp) */
     191/** @todo #define       putwchar(wc)    fputwc(wc, __stdoutp) */
    201192
    202193#if __ISO_C_VISIBLE >= 1999
    203 int     vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict,
    204             __va_list);
    205 int     vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
    206             __va_list);
    207 int     vwscanf(const wchar_t * __restrict, __va_list);
     194/** @todo int   vfwscanf(struct __sFILE * __restrict, const wchar_t * __restrict,
     195            __va_list); */
     196/** @todo int   vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
     197            __va_list); */
     198/** @todo int   vwscanf(const wchar_t * __restrict, __va_list); */
    208199float   wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
    209200long double
     
    226217
    227218#if __BSD_VISIBLE
    228 wchar_t *fgetwln(struct __sFILE * __restrict, size_t * __restrict);
     219/** @todo wchar_t       *fgetwln(struct __sFILE * __restrict, size_t * __restrict); */
    229220size_t  mbsnrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
    230221            size_t, mbstate_t * __restrict);
     
    234225size_t  wcslcpy(wchar_t *, const wchar_t *, size_t);
    235226#endif
    236 #endif /* bird */
    237227__END_DECLS
    238228
  • trunk/src/emx/include/wctype.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1704 r1705  
    11/** @file
    22 * FreeBSD 5.3
    3  * @changed bird: Disabled most of it.
     3 * @changed bird: hid a few bsd things and changed it to __isw* & __tow*.
     4 *                No __iscwtype on OS/2 since it's all unicode.
     5 * @remark  Take greate care when merging new versions into this file.
    46 */
    57/*-
     
    6365int     iswalnum(wint_t);
    6466int     iswalpha(wint_t);
    65 #if 0 /* bird */
    6667int     iswblank(wint_t);
    6768int     iswcntrl(wint_t);
    68 #endif /* bird */
    6969int     iswctype(wint_t, wctype_t);
    70 #if 0 /* bird */
    7170int     iswdigit(wint_t);
    7271int     iswgraph(wint_t);
    73 #endif /* bird */
    7472int     iswlower(wint_t);
    75 #if 0 /* bird */
    7673int     iswprint(wint_t);
    7774int     iswpunct(wint_t);
    7875int     iswspace(wint_t);
    79 #endif /* bird */
    8076int     iswupper(wint_t);
    81 #if 0 /* bird */
    8277int     iswxdigit(wint_t);
    8378wint_t  towctrans(wint_t, wctrans_t);
    84 #endif /* bird */
    8579wint_t  towlower(wint_t);
    8680wint_t  towupper(wint_t);
    87 #if 0 /* bird */
    8881wctrans_t
    8982        wctrans(const char *);
    90 #endif /* bird */
    9183wctype_t
    9284        wctype(const char *);
    93 #if 0 /* bird */
    9485
    9586#if __BSD_VISIBLE
     
    9889wint_t  iswideogram(wint_t);
    9990wint_t  iswnumber(wint_t);
    100 wint_t  iswphonogram(wint_t);
     91/** @todo wint_t        iswphonogram(wint_t); */
    10192wint_t  iswrune(wint_t);
    102 wint_t  iswspecial(wint_t);
    103 wint_t  nextwctype(wint_t, wctype_t);
     93/** @todo wint_t        iswspecial(wint_t); */
     94/** @todo wint_t        nextwctype(wint_t, wctype_t); */
    10495#endif
    105 #endif /* bird */
    10696__END_DECLS
    10797
    108 #define iswalnum(wc)            __istype((wc), _CTYPE_A|_CTYPE_D)
    109 #define iswalpha(wc)            __istype((wc), _CTYPE_A)
    110 #if 0 /* bird */
    111 #define iswblank(wc)            __istype((wc), _CTYPE_B)
    112 #define iswcntrl(wc)            __istype((wc), _CTYPE_C)
    113 #endif /* bird */
    114 #define iswctype(wc, charclass) __istype((wc), (charclass))
    115 #if 0 /* bird */
    116 #define iswdigit(wc)            __isctype((wc), _CTYPE_D)
    117 #define iswgraph(wc)            __istype((wc), _CTYPE_G)
    118 #endif /* bird */
    119 #define iswlower(wc)            __istype((wc), _CTYPE_L)
    120 #if 0 /* bird */
    121 #define iswprint(wc)            __istype((wc), _CTYPE_R)
    122 #define iswpunct(wc)            __istype((wc), _CTYPE_P)
    123 #define iswspace(wc)            __istype((wc), _CTYPE_S)
    124 #endif /* bird */
    125 #define iswupper(wc)            __istype((wc), _CTYPE_U)
    126 #if 0 /* bird */
    127 #define iswxdigit(wc)           __isctype((wc), _CTYPE_X)
    128 #endif /* bird */
    129 #define towlower(wc)            __tolower(wc)
    130 #define towupper(wc)            __toupper(wc)
    131 #if 0 /* bird */
     98#define iswalnum(wc)            __iswtype((wc), _CTYPE_A|_CTYPE_D)
     99#define iswalpha(wc)            __iswtype((wc), _CTYPE_A)
     100#define iswblank(wc)            __iswtype((wc), _CTYPE_B)
     101#define iswcntrl(wc)            __iswtype((wc), _CTYPE_C)
     102#define iswctype(wc, charclass) __iswtype((wc), (charclass))
     103#define iswdigit(wc)            __iswtype((wc), _CTYPE_D)
     104#define iswgraph(wc)            __iswtype((wc), _CTYPE_G)
     105#define iswlower(wc)            __iswtype((wc), _CTYPE_L)
     106#define iswprint(wc)            __iswtype((wc), _CTYPE_R)
     107#define iswpunct(wc)            __iswtype((wc), _CTYPE_P)
     108#define iswspace(wc)            __iswtype((wc), _CTYPE_S)
     109#define iswupper(wc)            __iswtype((wc), _CTYPE_U)
     110
     111#define iswxdigit(wc)           __iswtype((wc), _CTYPE_X)
     112#define towlower(wc)            __towlower(wc)
     113#define towupper(wc)            __towupper(wc)
    132114
    133115#if __BSD_VISIBLE
    134116#define iswascii(wc)            (((wc) & ~0x7F) == 0)
    135 #define iswhexnumber(wc)        __istype((wc), _CTYPE_X)
    136 #define iswideogram(wc)         __istype((wc), _CTYPE_I)
    137 #define iswnumber(wc)           __istype((wc), _CTYPE_D)
    138 #define iswphonogram(wc)        __istype((wc), _CTYPE_Q)
    139 #define iswrune(wc)             __istype((wc), 0xFFFFFF00L)
    140 #define iswspecial(wc)          __istype((wc), _CTYPE_T)
     117#define iswhexnumber(wc)        __iswtype((wc), _CTYPE_X)
     118#define iswideogram(wc)         __iswtype((wc), _CTYPE_I)
     119#define iswnumber(wc)           __iswtype((wc), _CTYPE_D)
     120/** @todo #define       iswphonogram(wc)        __iswtype((wc), _CTYPE_Q) */
     121#define iswrune(wc)             __iswtype((wc), 0xFFFFFF00L)
     122/** @todo #define       iswspecial(wc)          __iswtype((wc), _CTYPE_T) */
    141123#endif
    142 #endif /* bird */
     124
    143125#endif          /* _WCTYPE_H_ */
  • trunk/src/emx/src/lib/bsd/locale/btowc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/btowc.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
     
    3335
    3436wint_t
    35 btowc(int c)
     37_STD(btowc)(int c)
    3638{
    3739        static const mbstate_t initial;
  • trunk/src/emx/src/lib/bsd/locale/mblen.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/mblen.c,v 1.9 2004/07/29 06:18:40 tjr Exp $");
     
    3335
    3436int
    35 mblen(const char *s, size_t n)
     37_STD(mblen)(const char *s, size_t n)
    3638{
    3739        static const mbstate_t initial;
  • trunk/src/emx/src/lib/bsd/locale/mblocal.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    3535 * Conversion function pointers for current encoding.
    3636 */
     37#ifndef __INNOTEK_LIBC__
    3738extern size_t (*__mbrtowc)(wchar_t * __restrict, const char * __restrict,
    3839    size_t, mbstate_t * __restrict);
     
    4344extern size_t (*__wcsnrtombs)(char * __restrict, const wchar_t ** __restrict,
    4445    size_t, size_t, mbstate_t * __restrict);
     46#else /* !__INNOTEK_LIBC__ */
     47#define __mbrtowc(a,b,c,d)      __libc_GLocaleCtype.CtypeFuncs.pfnmbrtowc(a,b,c,d)
     48#define __mbsinit(a)            __libc_GLocaleCtype.CtypeFuncs.pfnmbsinit(a)
     49#define __mbsnrtowcs(a,b,c,d,e) __libc_GLocaleCtype.CtypeFuncs.pfnmbsnrtowcs(a,b,c,d,e)
     50#define __wcrtomb(a,b,c)        __libc_GLocaleCtype.CtypeFuncs.pfnwcrtomb(a,b,c)
     51#define __wcsnrtombs(a,b,c,d,e) __libc_GLocaleCtype.CtypeFuncs.pfnwcsnrtombs(a,b,c,d,e)
     52#endif
    4553
    4654/*
  • trunk/src/emx/src/lib/bsd/locale/mbrlen.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/mbrlen.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
     
    3234
    3335size_t
    34 mbrlen(const char * __restrict s, size_t n, mbstate_t * __restrict ps)
     36_STD(mbrlen)(const char * __restrict s, size_t n, mbstate_t * __restrict ps)
    3537{
    3638        static mbstate_t mbs;
  • trunk/src/emx/src/lib/bsd/locale/mbrtowc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/mbrtowc.c,v 1.7 2004/05/12 14:09:04 tjr Exp $");
     
    3234
    3335size_t
    34 mbrtowc(wchar_t * __restrict pwc, const char * __restrict s,
     36_STD(mbrtowc)(wchar_t * __restrict pwc, const char * __restrict s,
    3537    size_t n, mbstate_t * __restrict ps)
    3638{
  • trunk/src/emx/src/lib/bsd/locale/mbsinit.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/mbsinit.c,v 1.3 2004/05/12 14:09:04 tjr Exp $");
     
    3234
    3335int
    34 mbsinit(const mbstate_t *ps)
     36_STD(mbsinit)(const mbstate_t *ps)
    3537{
    3638
  • trunk/src/emx/src/lib/bsd/locale/mbsnrtowcs.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/mbsnrtowcs.c,v 1.1 2004/07/21 10:54:57 tjr Exp $");
     
    3537
    3638size_t
    37 mbsnrtowcs(wchar_t * __restrict dst, const char ** __restrict src,
     39_STD(mbsnrtowcs)(wchar_t * __restrict dst, const char ** __restrict src,
    3840    size_t nms, size_t len, mbstate_t * __restrict ps)
    3941{
  • trunk/src/emx/src/lib/bsd/locale/mbsrtowcs.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/mbsrtowcs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $");
     
    3537
    3638size_t
    37 mbsrtowcs(wchar_t * __restrict dst, const char ** __restrict src, size_t len,
     39_STD(mbsrtowcs)(wchar_t * __restrict dst, const char ** __restrict src, size_t len,
    3840    mbstate_t * __restrict ps)
    3941{
  • trunk/src/emx/src/lib/bsd/locale/mbstowcs.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/mbstowcs.c,v 1.11 2004/07/21 10:54:57 tjr Exp $");
     
    3436
    3537size_t
    36 mbstowcs(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
     38_STD(mbstowcs)(wchar_t * __restrict pwcs, const char * __restrict s, size_t n)
    3739{
    3840        static const mbstate_t initial;
  • trunk/src/emx/src/lib/bsd/locale/mbtowc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/mbtowc.c,v 1.11 2004/07/29 06:18:40 tjr Exp $");
     
    3335
    3436int
    35 mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n)
     37_STD(mbtowc)(wchar_t * __restrict pwc, const char * __restrict s, size_t n)
    3638{
    3739        static const mbstate_t initial;
  • trunk/src/emx/src/lib/bsd/locale/utf8.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h"
    2728#include <sys/param.h>
    2829__FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.11 2004/07/27 06:29:48 tjr Exp $");
     
    3031#include <errno.h>
    3132#include <limits.h>
     33#ifdef __INNOTEK_LIBC__
     34#include <InnotekLIBC/locale.h>
     35#else
    3236#include <runetype.h>
     37#endif
    3338#include <stdlib.h>
    3439#include <string.h>
     
    5156} _UTF8State;
    5257
     58#ifndef __INNOTEK_LIBC__
    5359int
    5460_UTF8_init(_RuneLocale *rl)
     
    6571        return (0);
    6672}
     73#endif /* !__INNOTEK_LIBC__ */
    6774
    6875int
     
    7885{
    7986        _UTF8State *us;
    80         int ch, i, mask, want;
     87        int ch, i, mask = 0, want;      /* bird: gcc shut */
     88#ifdef __INNOTEK_LIBC__
     89        wint_t lbound, wch;
     90#else
    8191        wchar_t lbound, wch;
     92#endif
    8293
    8394        us = (_UTF8State *)ps;
     
    189200                return ((size_t)-1);
    190201        }
     202#ifdef __INNOTEK_LIBC__
     203        if (wch > 0xffff || wch < 0)
     204            wch = 0xffff;
     205#endif
    191206        if (pwc != NULL)
    192207                *pwc = wch;
     
    367382        if (dst == NULL) {
    368383                while (nwc-- > 0) {
    369                         if (0 <= *s && *s < 0x80)
     384                        if (/*0 <= *s &&*/ (unsigned)*s < 0x80)
    370385                                /* Fast path for plain ASCII characters. */
    371386                                nb = 1;
     
    383398
    384399        while (len > 0 && nwc-- > 0) {
    385                 if (0 <= *s && *s < 0x80) {
     400                if (/*0 <= *s &&*/ (unsigned)*s < 0x80) {
    386401                        /* Fast path for plain ASCII characters. */
    387402                        nb = 1;
  • trunk/src/emx/src/lib/bsd/locale/wcrtomb.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/wcrtomb.c,v 1.8 2004/05/12 14:09:04 tjr Exp $");
     
    3234
    3335size_t
    34 wcrtomb(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
     36_STD(wcrtomb)(char * __restrict s, wchar_t wc, mbstate_t * __restrict ps)
    3537{
    3638        static mbstate_t mbs;
  • trunk/src/emx/src/lib/bsd/locale/wcsftime.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
    2728#include <sys/cdefs.h>
    2829__FBSDID("$FreeBSD: src/lib/libc/locale/wcsftime.c,v 1.4 2004/04/07 09:47:56 tjr Exp $");
     
    4849 */
    4950size_t
    50 wcsftime(wchar_t * __restrict wcs, size_t maxsize,
     51_STD(wcsftime)(wchar_t * __restrict wcs, size_t maxsize,
    5152    const wchar_t * __restrict format, const struct tm * __restrict timeptr)
    5253{
  • trunk/src/emx/src/lib/bsd/locale/wcsnrtombs.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/wcsnrtombs.c,v 1.2 2004/07/22 02:57:29 tjr Exp $");
     
    3537
    3638size_t
    37 wcsnrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t nwc,
     39_STD(wcsnrtombs)(char * __restrict dst, const wchar_t ** __restrict src, size_t nwc,
    3840    size_t len, mbstate_t * __restrict ps)
    3941{
  • trunk/src/emx/src/lib/bsd/locale/wcsrtombs.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/wcsrtombs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $");
     
    3537
    3638size_t
    37 wcsrtombs(char * __restrict dst, const wchar_t ** __restrict src, size_t len,
     39_STD(wcsrtombs)(char * __restrict dst, const wchar_t ** __restrict src, size_t len,
    3840    mbstate_t * __restrict ps)
    3941{
  • trunk/src/emx/src/lib/bsd/locale/wcstod.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
    2728#include <sys/cdefs.h>
    2829__FBSDID("$FreeBSD: src/lib/libc/locale/wcstod.c,v 1.4 2004/04/07 09:47:56 tjr Exp $");
     
    4243 */
    4344double
    44 wcstod(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
     45_STD(wcstod)(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
    4546{
    4647        static const mbstate_t initial;
  • trunk/src/emx/src/lib/bsd/locale/wcstof.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
    2728#include <sys/cdefs.h>
    2829__FBSDID("$FreeBSD: src/lib/libc/locale/wcstof.c,v 1.3 2004/04/07 09:47:56 tjr Exp $");
     
    3637 */
    3738float
    38 wcstof(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
     39_STD(wcstof)(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
    3940{
    4041        static const mbstate_t initial;
  • trunk/src/emx/src/lib/bsd/locale/wcstoimax.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    3232 */
    3333
     34#include "namespace.h" /* bird */
    3435#include <sys/cdefs.h>
    3536#if 0
     
    5152 */
    5253intmax_t
    53 wcstoimax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
     54_STD(wcstoimax)(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
    5455    int base)
    5556{
     
    9495#ifdef notyet
    9596                if (iswdigit(c))
    96                         c = digittoint(c);
     97                        c = digittoint(c); /* bird: need w version. */
    9798                else
    9899#endif
  • trunk/src/emx/src/lib/bsd/locale/wcstol.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    3232 */
    3333
     34#include "namespace.h" /* bird */
    3435#include <sys/cdefs.h>
    3536__FBSDID("$FreeBSD: src/lib/libc/locale/wcstol.c,v 1.1 2002/09/08 13:27:26 tjr Exp $");
     
    4546 */
    4647long
    47 wcstol(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
     48_STD(wcstol)(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
    4849{
    4950        const wchar_t *s;
     
    8788#ifdef notyet
    8889                if (iswdigit(c))
    89                         c = digittoint(c);
     90                        c = digittoint(c); /* bird: need w version. */
    9091                else
    9192#endif
  • trunk/src/emx/src/lib/bsd/locale/wcstold.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
    2728#include <sys/cdefs.h>
    2829__FBSDID("$FreeBSD: src/lib/libc/locale/wcstold.c,v 1.4 2004/04/07 09:47:56 tjr Exp $");
     
    3637 */
    3738long double
    38 wcstold(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
     39_STD(wcstold)(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr)
    3940{
    4041        static const mbstate_t initial;
  • trunk/src/emx/src/lib/bsd/locale/wcstoll.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    3232 */
    3333
     34#include "namespace.h" /* bird */
    3435#include <sys/cdefs.h>
    3536#if 0
     
    5152 */
    5253long long
    53 wcstoll(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
     54_STD(wcstoll)(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
    5455{
    5556        const wchar_t *s;
     
    9394#ifdef notyet
    9495                if (iswdigit(c))
    95                         c = digittoint(c);
     96                        c = digittoint(c); /* bird: need w version! */
    9697                else
    9798#endif
  • trunk/src/emx/src/lib/bsd/locale/wcstombs.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/wcstombs.c,v 1.10 2004/07/21 10:54:57 tjr Exp $");
     
    3436
    3537size_t
    36 wcstombs(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
     38_STD(wcstombs)(char * __restrict s, const wchar_t * __restrict pwcs, size_t n)
    3739{
    3840        static const mbstate_t initial;
  • trunk/src/emx/src/lib/bsd/locale/wcstoul.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    3232 */
    3333
     34#include "namespace.h" /* bird */
    3435#include <sys/cdefs.h>
    3536__FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.1 2002/09/08 13:27:26 tjr Exp $");
     
    4546 */
    4647unsigned long
    47 wcstoul(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
     48_STD(wcstoul)(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int base)
    4849{
    4950        const wchar_t *s;
  • trunk/src/emx/src/lib/bsd/locale/wcstoull.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    3232 */
    3333
     34#include "namespace.h" /* bird */
    3435#include <sys/cdefs.h>
    3536#if 0
     
    5152 */
    5253unsigned long long
    53 wcstoull(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
     54_STD(wcstoull)(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
    5455    int base)
    5556{
  • trunk/src/emx/src/lib/bsd/locale/wcstoumax.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    3232 */
    3333
     34#include "namespace.h" /* bird */
    3435#include <sys/cdefs.h>
    3536#if 0
     
    5152 */
    5253uintmax_t
    53 wcstoumax(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
     54_STD(wcstoumax)(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
    5455    int base)
    5556{
  • trunk/src/emx/src/lib/bsd/locale/wctob.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h"
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/wctob.c,v 1.4 2004/05/12 14:26:54 tjr Exp $");
     
    3436
    3537int
    36 wctob(wint_t c)
     38_STD(wctob)(wint_t c)
    3739{
    3840        static const mbstate_t initial;
  • trunk/src/emx/src/lib/bsd/locale/wctomb.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h" /* bird */
     28#include <InnoTekLIBC/locale.h>
    2729#include <sys/cdefs.h>
    2830__FBSDID("$FreeBSD: src/lib/libc/locale/wctomb.c,v 1.8 2004/07/29 06:18:40 tjr Exp $");
     
    3335
    3436int
    35 wctomb(char *s, wchar_t wchar)
     37_STD(wctomb)(char *s, wchar_t wchar)
    3638{
    3739        static const mbstate_t initial;
  • trunk/src/emx/src/lib/bsd/locale/wctrans.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r1704 r1705  
    2525 */
    2626
     27#include "namespace.h"
    2728#include <sys/cdefs.h>
    2829__FBSDID("$FreeBSD: src/lib/libc/locale/wctrans.c,v 1.3 2003/11/01 08:20:58 tjr Exp $");
     
    3940
    4041wint_t
    41 towctrans(wint_t wc, wctrans_t desc)
     42_STD(towctrans)(wint_t wc, wctrans_t desc)
    4243{
    4344
     
    5960
    6061wctrans_t
    61 wctrans(const char *charclass)
     62_STD(wctrans)(const char *charclass)
    6263{
    6364        struct {
  • trunk/src/emx/src/lib/libc.def

    • Property cvs2svn:cvs-rev changed from 1.87 to 1.88
    r1704 r1705  
    4040    "__emx_optswchar" @18
    4141    "__fmode_bin" @19
    42     "__mb_cur_max" @20
     42    "___mb_cur_max" @20
    4343    "__org_environ" @21
    4444    "__osmajor" @22
     
    7171    "_optreset" @49
    7272    "_pwdb_versions" @50
     73    "___libc_GLocaleWCtype" @51
     74    "__std_suboptarg" @52
    7375
    7476
     
    12791281    "__std_getsubopt" @1296
    12801282    "__std_rand_r" @1297
    1281     "__std_suboptarg" @1298
     1283    "___wcwidth" @1298
    12821284    "__std_llabs" @1299
    12831285    "__std_lldiv" @1300
     
    12861288    "__std_pread" @1303
    12871289    "__std_pwrite" @1304
     1290    "__UTF8_mbrtowc" @1305
     1291    "__UTF8_mbsinit" @1306
     1292    "__UTF8_mbsnrtowcs" @1307
     1293    "__UTF8_wcrtomb" @1308
     1294    "__UTF8_wcsnrtombs" @1309
     1295    "___ctype" @1310
     1296    "_digittoint" @1311
     1297    "_isideogram" @1312
     1298    "_isrune" @1313
     1299    "_iswalnum" @1314
     1300    "_iswalpha" @1315
     1301    "_iswascii" @1316
     1302    "_iswblank" @1317
     1303    "_iswcntrl" @1318
     1304    "_iswctype" @1319
     1305    "_iswdigit" @1320
     1306    "_iswgraph" @1321
     1307    "_iswhexnumber" @1322
     1308    "_iswideogram" @1323
     1309    "_iswlower" @1324
     1310    "_iswnumber" @1325
     1311    "_iswprint" @1326
     1312    "_iswpunct" @1327
     1313    "_iswrune" @1328
     1314    "_iswspace" @1329
     1315    "___iswtype" @1330
     1316    "_iswupper" @1331
     1317    "_iswxdigit" @1332
     1318    "___mbsnrtowcs_std" @1333
     1319    "__std_btowc" @1334
     1320    "__std_mbrlen" @1335
     1321    "__std_mbrtowc" @1336
     1322    "__std_mbsinit" @1337
     1323    "__std_mbsnrtowcs" @1338
     1324    "__std_mbsrtowcs" @1339
     1325    "__std_nl_langinfo" @1340
     1326    "__std_towctrans" @1341
     1327    "__std_wcrtomb" @1342
     1328    "__std_wcsftime" @1343
     1329    "__std_wcsnrtombs" @1344
     1330    "__std_wcsrtombs" @1345
     1331    "__std_wcstod" @1346
     1332    "__std_wcstof" @1347
     1333    "__std_wcstoimax" @1348
     1334    "__std_wcstol" @1349
     1335    "__std_wcstold" @1350
     1336    "__std_wcstoll" @1351
     1337    "__std_wcstoul" @1352
     1338    "__std_wcstoull" @1353
     1339    "__std_wcstoumax" @1354
     1340    "__std_wctob" @1355
     1341    "__std_wctrans" @1356
     1342    "__std_wctype" @1357
     1343    "__tolower" @1358
     1344    "__toupper" @1359
     1345    "_towlower" @1360
     1346    "___towlower" @1361
     1347    "____towlower" @1362
     1348    "_towupper" @1363
     1349    "___towupper" @1364
     1350    "____towupper" @1365
     1351    "___wcsnrtombs_std" @1366
     1352    "___wctype" @1367
     1353    "____wctype" @1368
     1354    "main" @1369
     1355    "_main" @1370
  • trunk/src/emx/src/lib/locale/isxxx.c

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r1704 r1705  
    22/** @file
    33 *
    4  * ctype functions.
     4 * ctype and wctype simple query functions.
    55 *
    6  * Usually these routines are not needed (they are inline), but
    7  * for cases when a program instead of including ctype.h blindly
    8  * declares them with "extern", they will be linked in.
    9  *
    10  * Copyright (c) 2003 InnoTek Systemberatung GmbH
    11  * Copyright (c) 2003-2004 knut st. osmundsen <bird-srcspam@anduin.net>
     6 * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>
    127 *
    138 *
     
    3025 */
    3126
     27#include "libc-alias.h"
     28#include <sys/cdefs.h>
    3229#define _DONT_USE_CTYPE_INLINE_
    33 #include "libc-alias.h"
    3430#include <ctype.h>
     31#include <wctype.h>
    3532
    36 #undef isalnum
    37 int isalnum(int _c)
    38 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__UPPER|__LOWER|__DIGIT); }
     33int     (isalnum)(int ch)       { return isalnum(ch); }
     34int     (isalpha)(int ch)       { return isalpha(ch); }
     35int     (iscntrl)(int ch)       { return iscntrl(ch); }
     36int     (isdigit)(int ch)       { return isdigit(ch); }
     37int     (isgraph)(int ch)       { return isgraph(ch); }
     38int     (islower)(int ch)       { return islower(ch); }
     39int     (isprint)(int ch)       { return isprint(ch); }
     40int     (ispunct)(int ch)       { return ispunct(ch); }
     41int     (isspace)(int ch)       { return isspace(ch); }
     42int     (isupper)(int ch)       { return isupper(ch); }
     43int     (isxdigit)(int ch)      { return isxdigit(ch); }
     44int     (toupper)(int ch)       { return toupper(ch); }
     45int     (tolower)(int ch)       { return tolower(ch); }
     46int     (_toupper)(int ch)      { return _toupper(ch); }
     47int     (_tolower)(int ch)      { return _toupper(ch); }
     48int     (isascii)(int ch)       { return isascii(ch); }
     49int     (toascii)(int ch)       { return isascii(ch); }
     50int     (digittoint)(int ch)    { return digittoint(ch); }
     51int     (isblank)(int ch)       { return isblank(ch); }
     52int     (ishexnumber)(int ch)   { return ishexnumber(ch); }
     53int     (isideogram)(int ch)    { return isideogram(ch); }
     54int     (isnumber)(int ch)      { return isnumber(ch); }
     55int     (isrune)(int ch)        { return isrune(ch); }
    3956
    40 #undef isalpha
    41 int isalpha(int _c)
    42 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__UPPER|__LOWER); }
     57#if !defined(isalnum) \
     58 || !defined(isalpha) \
     59 || !defined(iscntrl) \
     60 || !defined(isdigit) \
     61 || !defined(isgraph) \
     62 || !defined(islower) \
     63 || !defined(isprint) \
     64 || !defined(ispunct) \
     65 || !defined(isspace) \
     66 || !defined(isupper) \
     67 || !defined(isxdigit) \
     68 || !defined(toupper) \
     69 || !defined(tolower) \
     70 || !defined(_toupper) \
     71 || !defined(_tolower) \
     72 || !defined(isascii) \
     73 || !defined(toascii) \
     74 || !defined(digittoint) \
     75 || !defined(isblank) \
     76 || !defined(ishexnumber) \
     77 || !defined(isideogram) \
     78 || !defined(isnumber) \
     79 || !defined(isrune)
     80#error "One or more of the ctype.h macros are undefined!"
     81#endif
    4382
    44 #undef iscntrl
    45 int iscntrl(int _c)
    46 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__CNTRL); }
    4783
    48 #undef isdigit
    49 int isdigit(int _c)
    50 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__DIGIT); }
     84int     (iswalnum)(int wc)       { return iswalnum(wc); }
     85int     (iswalpha)(int wc)       { return iswalpha(wc); }
     86int     (iswblank)(int wc)       { return iswblank(wc); }
     87int     (iswcntrl)(int wc)       { return iswcntrl(wc); }
     88int     (iswctype)(wint_t wc, wctype_t wctype)    { return iswctype(wc, wctype); }
     89int     (iswdigit)(int wc)       { return iswdigit(wc); }
     90int     (iswgraph)(int wc)       { return iswgraph(wc); }
     91int     (iswlower)(int wc)       { return iswlower(wc); }
     92int     (iswprint)(int wc)       { return iswprint(wc); }
     93int     (iswpunct)(int wc)       { return iswpunct(wc); }
     94int     (iswspace)(int wc)       { return iswspace(wc); }
     95int     (iswupper)(int wc)       { return iswupper(wc); }
     96int     (iswxdigit)(int wc)      { return iswxdigit(wc); }
     97wint_t  (towlower)(int wc)       { return towlower(wc); }
     98wint_t  (towupper)(int wc)       { return towupper(wc); }
     99wint_t  (iswascii)(int wc)       { return iswascii(wc); }
     100wint_t  (iswhexnumber)(int wc)   { return iswhexnumber(wc); }
     101wint_t  (iswideogram)(int wc)    { return iswideogram(wc); }
     102wint_t  (iswnumber)(int wc)      { return iswnumber(wc); }
     103wint_t  (iswrune)(int wc)        { return iswrune(wc); }
    51104
    52 #undef isgraph
    53 int isgraph(int _c)
    54 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__PUNCT|__UPPER|__LOWER|__DIGIT); }
     105#if !defined(iswalnum) \
     106 || !defined(iswalpha) \
     107 || !defined(iswblank) \
     108 || !defined(iswcntrl) \
     109 || !defined(iswctype) \
     110 || !defined(iswdigit) \
     111 || !defined(iswgraph) \
     112 || !defined(iswlower) \
     113 || !defined(iswprint) \
     114 || !defined(iswpunct) \
     115 || !defined(iswspace) \
     116 || !defined(iswupper) \
     117 || !defined(iswxdigit) \
     118 || !defined(towlower) \
     119 || !defined(towupper) \
     120 || !defined(iswascii) \
     121 || !defined(iswhexnumber) \
     122 || !defined(iswideogram) \
     123 || !defined(iswnumber) \
     124 || !defined(iswrune)
     125#error "One or more of the wctype.h macros are undefined!"
     126#endif
    55127
    56 #undef islower
    57 int islower(int _c)
    58 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__LOWER); }
    59 
    60 #undef isprint
    61 int isprint(int _c)
    62 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__PRINT); }
    63 
    64 #undef ispunct
    65 int ispunct(int _c)
    66 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__PUNCT); }
    67 
    68 #undef isspace
    69 int isspace(int _c)
    70 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__SPACE); }
    71 
    72 #undef isupper
    73 int isupper(int _c)
    74 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__UPPER); }
    75 
    76 #undef isxdigit
    77 int isxdigit(int _c)
    78 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__XDIGIT); }
    79 
    80 #undef isblank
    81 int isblank(int _c)
    82 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__BLANK); }
    83 
    84 #undef ishexnumber
    85 int ishexnumber(int _c)
    86 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__XDIGIT); }
    87 
    88 #undef isnumber
    89 int isnumber(int _c)
    90 { return __libc_GLocaleCtype.ausfType[_c & 0xff] & (__DIGIT); }
    91 
    92 #undef toascii
    93 int toascii(int _c)
    94 { return _c & 0x7f; }
    95 
    96 #undef isascii
    97 int isascii(int _c)
    98 { return (_c & 0x80) != 0; }
    99 
  • trunk/src/emx/src/lib/locale/locale_ctype.c

    • Property cvs2svn:cvs-rev changed from 1.9 to 1.10
    r1704 r1705  
    2828#define _DONT_USE_CTYPE_INLINE_
    2929#include "libc-alias.h"
     30#define INCL_FSMACROS
     31#include <os2emx.h>
    3032#include <InnoTekLIBC/locale.h>
    3133#include <ctype.h>
    3234
    3335
    34 /* Character case conversion tables. */
     36/** Character case conversion tables. */
    3537__LIBC_LOCALECTYPE       __libc_GLocaleCtype =
    3638{
     
    5153        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
    5254        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
    53         0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
    54         0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
     55        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
     56        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff,
    5557    },
    5658    .auchLower =
     
    6870        0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
    6971        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
    70         0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
    71         0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
     72        0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
     73        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf,
    7274        0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
    7375        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
    7476    },
    75     .ausfType =
    76     {
    77         0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020,
    78         0x8020, 0x8068, 0x8028, 0x8028, 0x8028, 0x8028, 0x8020, 0x8020,
    79         0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020,
    80         0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020,
    81         0x8848, 0x8c10, 0x8c10, 0x8c10, 0xac10, 0x8c10, 0x8c10, 0x8c10,
    82         0x8c10, 0x8c10, 0x8c10, 0xac10, 0x8c10, 0x8c10, 0x8c10, 0x8c10,
    83         0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84,
    84         0x9e84, 0x9e84, 0x8c10, 0x8c10, 0xac10, 0xac10, 0xac10, 0x8c10,
    85         0x8c10, 0x8f81, 0x8f81, 0x8f81, 0x8f81, 0x8f81, 0x8f81, 0x8f01,
    86         0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01,
    87         0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01,
    88         0x8f01, 0x8f01, 0x8f01, 0x8c10, 0x8c10, 0x8c10, 0xac10, 0x8c10,
    89         0xac10, 0x8f82, 0x8f82, 0x8f82, 0x8f82, 0x8f82, 0x8f82, 0x8f02,
    90         0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02,
    91         0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02,
    92         0x8f02, 0x8f02, 0x8f02, 0x8c10, 0xac10, 0x8c10, 0xac10, 0x8020,
     77    .aufType =
     78    {
     79        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     80        0x00802000, 0x00806800, 0x00802800, 0x00802800, 0x00802800, 0x00802800, 0x00802000, 0x00802000,
     81        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     82        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     83        0x00884800, 0x008c1000, 0x008c1000, 0x008c1000, 0x00ac1000, 0x008c1000, 0x008c1000, 0x008c1000,
     84        0x008c1000, 0x008c1000, 0x008c1000, 0x00ac1000, 0x008c1000, 0x008c1000, 0x008c1000, 0x008c1000,
     85        0x009e8400, 0x009e8401, 0x009e8402, 0x009e8403, 0x009e8404, 0x009e8405, 0x009e8406, 0x009e8407,
     86        0x009e8408, 0x009e8409, 0x008c1000, 0x008c1000, 0x00ac1000, 0x00ac1000, 0x00ac1000, 0x008c1000,
     87        0x008c1000, 0x008f810a, 0x008f810b, 0x008f810c, 0x008f810d, 0x008f810e, 0x008f810f, 0x008f0100,
     88        0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100,
     89        0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100,
     90        0x008f0100, 0x008f0100, 0x008f0100, 0x008c1000, 0x008c1000, 0x008c1000, 0x00ac1000, 0x008c1000,
     91        0x00ac1000, 0x008f820a, 0x008f820b, 0x008f820c, 0x008f820d, 0x008f820e, 0x008f820f, 0x008f0200,
     92        0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200,
     93        0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200,
     94        0x008f0200, 0x008f0200, 0x008f0200, 0x008c1000, 0x00ac1000, 0x008c1000, 0x00ac1000, 0x00802000,
    9395    },
    9496    .au2MBCSPrefixs =
     
    99101        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
    100102    },
     103    .aucUnicode =
     104    {
     105        0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
     106        0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
     107        0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
     108        0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
     109        0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
     110        0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
     111        0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
     112        0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
     113        0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
     114        0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
     115        0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
     116        0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
     117        0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
     118        0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
     119        0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
     120        0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
     121        0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
     122        0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
     123        0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
     124        0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
     125        0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
     126        0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
     127        0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
     128        0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
     129        0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
     130        0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
     131        0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
     132        0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
     133        0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
     134        0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
     135        0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
     136        0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
     137    },
     138    .auchToSBCS0To128 =
     139    {
     140        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     141        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
     142        0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
     143        0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
     144        0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
     145        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
     146        0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
     147        0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
     148    },
     149
     150    .aSBCSs[0] =
     151    {
     152        .usStart = 0x0080,
     153        .cChars = 28,
     154        .auch =
     155        {
     156
     157        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
     158        0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b,
     159        }
     160    },
     161    .aSBCSs[1] =
     162    {
     163        .usStart = 0x009c,
     164        .cChars = 28,
     165        .auch =
     166        {
     167
     168        0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab,
     169        0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
     170        }
     171    },
     172    .aSBCSs[2] =
     173    {
     174        .usStart = 0x00b8,
     175        .cChars = 28,
     176        .auch =
     177        {
     178
     179        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
     180        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3,
     181        }
     182    },
     183    .aSBCSs[3] =
     184    {
     185        .usStart = 0x00d4,
     186        .cChars = 28,
     187        .auch =
     188        {
     189
     190        0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
     191        0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
     192        }
     193    },
     194    .aSBCSs[4] =
     195    {
     196        .usStart = 0x00f0,
     197        .cChars = 16,
     198        .auch =
     199        {
     200
     201        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
     202        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     203        }
     204    },
     205    .cSBCSs = 5,
     206    .CtypeFuncs =
     207    {
     208        .pfnmbsinit    = __libc_locale_none_mbsinit,
     209        .pfnmbrtowc    = __libc_locale_none_mbrtowc,
     210        .pfnmbsnrtowcs = __libc_locale_none_mbsnrtowcs,
     211        .pfnwcrtomb    = __libc_locale_none_wcrtomb,
     212        .pfnwcsnrtombs = __libc_locale_none_wcsnrtombs,
     213    },
    101214    .uobj = 0,
    102215    .lobj = 0,
     
    105218
    106219
    107 
    108 #undef tolower
    109 int tolower(int _c)
    110 {
    111     return __libc_GLocaleCtype.auchLower[_c & 0xff];
    112 }
    113 #undef __tolower
    114 int __tolower(int _c)
    115 {
    116     return __libc_GLocaleCtype.auchLower[_c & 0xff];
    117 }
    118 
    119 #undef toupper
    120 int toupper(int _c)
    121 {
    122     return __libc_GLocaleCtype.auchUpper[_c & 0xff];
    123 }
    124 #undef __toupper
    125 int __toupper(int _c)
    126 {
    127     return __libc_GLocaleCtype.auchUpper[_c & 0xff];
    128 }
    129 
    130 #undef __istype
    131 int __istype(int _c, unsigned _f)
    132 {
    133     return (__libc_GLocaleCtype.ausfType[_c & 0xff] & (_f)) != 0;
    134 }
    135 
    136 
    137 
    138 
    139 
    140 #if 0 /* code for regenerating that table - link staticly! */
     220unsigned __ctype(__ct_rune_t __ch, unsigned __f)
     221{
     222    return !((__ch) & ~0xffU)
     223        ? __libc_GLocaleCtype.aufType[(__ch)/* & 0xff*/] & (__f)
     224        : 0;
     225}
     226
     227int __istype(__ct_rune_t __ch, unsigned __f)
     228{
     229    return !!__ctype((__ch), (__f));
     230}
     231
     232__ct_rune_t __toupper(__ct_rune_t __ch)
     233{
     234    return !((__ch) & ~0xffU)
     235        ? __libc_GLocaleCtype.auchUpper[(__ch)/* & 0xff*/]
     236        : (__ch);
     237}
     238
     239__ct_rune_t __tolower(__ct_rune_t __ch)
     240{
     241    return !((__ch) & ~0xffU)
     242        ? __libc_GLocaleCtype.auchLower[(__ch)/* & 0xff*/]
     243        : (__ch);
     244}
     245
     246
     247
     248/** Cached Unicode (__wchar_t) case conversion tables and flags. */
     249const __LIBC_LOCALEWCTYPE    __libc_GLocaleWCtype =
     250{
     251    .awcUpper =
     252    {
     253
     254        0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
     255        0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
     256        0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
     257        0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
     258        0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
     259        0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
     260        0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
     261        0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
     262        0x0040, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
     263        0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
     264        0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
     265        0x0078, 0x0079, 0x007a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
     266        0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
     267        0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
     268        0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
     269        0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
     270        0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
     271        0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
     272        0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
     273        0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
     274        0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
     275        0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
     276        0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
     277        0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
     278        0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
     279        0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
     280        0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00d7,
     281        0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00df,
     282        0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
     283        0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
     284        0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
     285        0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
     286    },
     287    .awcUpper =
     288    {
     289
     290        0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
     291        0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
     292        0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
     293        0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
     294        0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
     295        0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
     296        0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
     297        0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
     298        0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
     299        0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
     300        0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
     301        0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
     302        0x0060, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
     303        0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
     304        0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
     305        0x0058, 0x0059, 0x005a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
     306        0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
     307        0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
     308        0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
     309        0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
     310        0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
     311        0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
     312        0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
     313        0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
     314        0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
     315        0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
     316        0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
     317        0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
     318        0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
     319        0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
     320        0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00f7,
     321        0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x0178,
     322    },
     323    .aufType =
     324    {
     325
     326        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     327        0x00802000, 0x00806800, 0x00802800, 0x00802800, 0x00802800, 0x00802800, 0x00802000, 0x00802000,
     328        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     329        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     330        0x00884800, 0x008c1000, 0x008c1000, 0x008c1000, 0x00ac1000, 0x008c1000, 0x008c1000, 0x008c1000,
     331        0x008c1000, 0x008c1000, 0x008c1000, 0x00ac1000, 0x008c1000, 0x008c1000, 0x008c1000, 0x008c1000,
     332        0x009e8400, 0x009e8401, 0x009e8402, 0x009e8403, 0x009e8404, 0x009e8405, 0x009e8406, 0x009e8407,
     333        0x009e8408, 0x009e8409, 0x008c1000, 0x008c1000, 0x00ac1000, 0x00ac1000, 0x00ac1000, 0x008c1000,
     334        0x008c1000, 0x008f810a, 0x008f810b, 0x008f810c, 0x008f810d, 0x008f810e, 0x008f810f, 0x008f0100,
     335        0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100,
     336        0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100,
     337        0x008f0100, 0x008f0100, 0x008f0100, 0x008c1000, 0x008c1000, 0x008c1000, 0x00ac1000, 0x008c1000,
     338        0x00ac1000, 0x008f820a, 0x008f820b, 0x008f820c, 0x008f820d, 0x008f820e, 0x008f820f, 0x008f0200,
     339        0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200,
     340        0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200,
     341        0x008f0200, 0x008f0200, 0x008f0200, 0x008c1000, 0x00ac1000, 0x008c1000, 0x00ac1000, 0x00802000,
     342        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     343        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     344        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     345        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     346        0x002c1000, 0x000c1000, 0x002c1000, 0x002c1000, 0x002c1000, 0x002c1000, 0x002c1000, 0x002c1000,
     347        0x002c1000, 0x002c1000, 0x000f0200, 0x000c1000, 0x002c1000, 0x000c1000, 0x002c1000, 0x002c1000,
     348        0x002c1000, 0x002c1000, 0x002c1000, 0x002c1000, 0x002c1000, 0x000f0200, 0x002c1000, 0x000c1000,
     349        0x002c1000, 0x002c1000, 0x000f0200, 0x000c1000, 0x002c1000, 0x002c1000, 0x002c1000, 0x000c1000,
     350        0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100,
     351        0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100,
     352        0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x002c1000,
     353        0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0100, 0x000f0200,
     354        0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200,
     355        0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200,
     356        0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x002c1000,
     357        0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200,
     358    },
     359};
     360
     361
     362
     363unsigned __wctype(__wint_t __wc, unsigned __f)
     364{
     365    return !((__wc) & ~0xffU)
     366        ? __libc_GLocaleWCtype.aufType[(__wc)] & (__f)
     367        : ___wctype(__wc) & (__f);
     368}
     369
     370int __iswtype(__wint_t __wc, unsigned __f)
     371{
     372    return !!__wctype((__wc), (__f));
     373}
     374
     375__wint_t __towupper(__wint_t __wc)
     376{
     377    return !((__wc) & ~0xffU)
     378        ? __libc_GLocaleWCtype.awcUpper[(__wc)]
     379        : ___towupper(__wc);
     380}
     381
     382__wint_t __towlower(__wint_t __wc)
     383{
     384    return !((__wc) & ~0xffU)
     385        ? __libc_GLocaleWCtype.awcLower[(__wc)]
     386        : ___towlower(__wc);
     387}
     388
     389
     390int __wcwidth(__wint_t __wc)
     391{
     392    if ((__wc) != 0)
     393    {
     394        unsigned __f = __wctype((__wc), __CT_SCRW_MASK | __CT_PRINT);
     395        return ((__f) & __CT_SCRW_MASK)
     396            ? ((__f) & __CT_SCRW_MASK) >> __CT_SCRW_SHIFT
     397            : ((__f) & __CT_PRINT) ? 1 : -1;
     398    }
     399    else
     400        return 0;
     401}
     402
     403
     404/**
     405 * Get unicode type.
     406 * ASSUMES that none of the locals differs from the unicode spec
     407 */
     408unsigned ___wctype(__wchar_t uc)
     409{
     410    unsigned    ufType = 0;
     411    UNICTYPE   *pUniType = UniQueryCharType(uc);
     412    if (pUniType)
     413    {
     414        /* ASSUMES CT_* << 8 == __* ! */
     415        ufType = ((unsigned)pUniType->itype << 8)
     416               & (__CT_UPPER  | __CT_LOWER  | __CT_DIGIT | __CT_SPACE |
     417                  __CT_PUNCT  | __CT_CNTRL  | __CT_BLANK | __CT_XDIGIT |
     418                  __CT_ALPHA  | __CT_ALNUM  | __CT_GRAPH | __CT_PRINT |
     419                  __CT_NUMBER | __CT_SYMBOL | __CT_ASCII);
     420        if (pUniType->extend & C3_IDEOGRAPH)
     421            ufType |= __CT_IDEOGRAM;
     422        if (ufType & (__CT_XDIGIT | __CT_DIGIT))
     423        {
     424            if (     (unsigned)uc - 0x30U <= (0x39 - 0x30))
     425                ufType |= (unsigned)uc - 0x30;
     426            else if ((unsigned)uc - 0x41U <= (0x46 - 0x41))
     427                ufType |= (unsigned)uc - 0x41 + 0xa;
     428            else
     429            {
     430                unsigned uVal = UniQueryNumericValue(uc);
     431                if (!(uVal & ~0xffU))
     432                    ufType |= uVal;
     433            }
     434        }
     435        ufType |= (pUniType->bidi & 0xf << 24);
     436
     437        /** @todo screen width. */
     438    }
     439    return ufType;
     440}
     441
     442/**
     443 * Fold char to lowercase.
     444 * ASSUMES that none of the locals differs from the unicode spec.
     445 */
     446__wchar_t ___towlower(__wchar_t wc)
     447{
     448    FS_VAR_SAVE_LOAD();
     449    UniChar ucRet = UniTolower(wc);
     450    FS_RESTORE();
     451    return ucRet;
     452}
     453
     454/**
     455 * Fold char to lowercase.
     456 * ASSUMES that none of the locals differs from the unicode spec.
     457 */
     458__wchar_t ___towupper(__wchar_t wc)
     459{
     460    FS_VAR_SAVE_LOAD();
     461    UniChar ucRet = UniToupper(wc);
     462    FS_RESTORE();
     463    return ucRet;
     464}
     465
     466
     467
     468#if 1 /* code for regenerating that table - link staticly! */
    141469
    142470#include <InnoTekLIBC/locale.h>
    143471#include <stdio.h>
    144472
    145 int main()
     473int main(int argc, char **argv)
    146474{
    147475    int i;
    148     setlocale(LC_CTYPE, "en_US");
    149     setlocale(LC_CTYPE, "C");
     476    const int iMax = argc != 2 ? 128 : 256;
     477    if (!setlocale(LC_CTYPE, argc == 2 ? argv[1] : "en_US")) /* We use this because the "C" depends on the generated data! */
     478    {
     479        printf("setlocale failed!\n");
     480        return 1;
     481    }
     482
    150483    printf("{\n"
    151484           "    .auchUpper =\n"
     
    171504    printf("\n"
    172505           "    },\n"
    173            "    .ausfType = \n"
     506           "    .aufType = \n"
    174507           "    {");
    175     for (i = 0; i < 128; i++)
     508    for (i = 0; i < iMax; i++)
    176509    {
    177510        if (i % 8)
    178             printf("0x%04x, ", (int)__libc_GLocaleCtype.ausfType[i]);
    179         else
    180             printf("\n        0x%04x, ", (int)__libc_GLocaleCtype.ausfType[i]);
    181     }
    182     printf("\n"
    183            "    },\n"
     511            printf("0x%08x, ", (int)__libc_GLocaleCtype.aufType[i]);
     512        else
     513            printf("\n        0x%08x, ", (int)__libc_GLocaleCtype.aufType[i]);
     514    }
     515    printf("\n");
     516
     517    /* prefixed */
     518    printf("    },\n"
    184519           "    .au2MBCSPrefixs =\n"
    185520           "    {");
     
    189524            printf("0x%02x, ", (int)__libc_GLocaleCtype.au2MBCSPrefixs[i]);
    190525        else
    191             printf("\n    0x%02x, ", (int)__libc_GLocaleCtype.au2MBCSPrefixs[i]);
    192     }
    193     printf("\n"
    194            "    },\n"
    195            "    .uobj = 0,\n"
     526            printf("\n        0x%02x, ", (int)__libc_GLocaleCtype.au2MBCSPrefixs[i]);
     527    }
     528    printf("\n"
     529           "    },\n");
     530
     531    /* -> unicode translation */
     532    printf("    .aucUnicode =\n"
     533           "    {");
     534    for (i = 0; i < sizeof(__libc_GLocaleCtype.aucUnicode) / sizeof(__libc_GLocaleCtype.aucUnicode[0]); i++)
     535    {
     536        if (i % 8)
     537            printf("0x%04x, ", (int)__libc_GLocaleCtype.aucUnicode[i]);
     538        else
     539            printf("\n        0x%04x, ", (int)__libc_GLocaleCtype.aucUnicode[i]);
     540    }
     541    printf("\n"
     542           "    },\n");
     543
     544    /* <- unicode translation */
     545    printf("    .auchToSBCS0To128 =\n"
     546           "    {");
     547    for (i = 0; i < sizeof(__libc_GLocaleCtype.auchToSBCS0To128) / sizeof(__libc_GLocaleCtype.auchToSBCS0To128[0]); i++)
     548    {
     549        if (i % 16)
     550            printf("0x%02x, ", (int)__libc_GLocaleCtype.auchToSBCS0To128[i]);
     551        else
     552            printf("\n        0x%02x, ", (int)__libc_GLocaleCtype.auchToSBCS0To128[i]);
     553    }
     554    printf("\n"
     555           "    },\n");
     556
     557    printf("    .cSBCSs = %d,\n", __libc_GLocaleCtype.cSBCSs);
     558    int j;
     559    for (j = 0; j < __libc_GLocaleCtype.cSBCSs; j++)
     560    {
     561        printf("    .aSBCSs[%d] =\n"
     562               "    {\n"
     563               "        .usStart = 0x%04x,\n"
     564               "        .cChars = %d,\n"
     565               "        .auch =\n"
     566               "        {\n",
     567               j,
     568               __libc_GLocaleCtype.aSBCSs[j].usStart,
     569               __libc_GLocaleCtype.aSBCSs[j].cChars);
     570        for (i = 0; i < sizeof(__libc_GLocaleCtype.aSBCSs[j].auch) / sizeof(__libc_GLocaleCtype.aSBCSs[j].auch[0]); i++)
     571        {
     572            if (i % 16)
     573                printf("0x%02x, ", (int)__libc_GLocaleCtype.aSBCSs[j].auch[i]);
     574            else
     575                printf("\n        0x%02x, ", (int)__libc_GLocaleCtype.aSBCSs[j].auch[i]);
     576        }
     577        printf("\n"
     578               "        }\n"
     579               "    },\n");
     580    }
     581
     582    /* the functions. */
     583    printf("    .CtypeFuncs =\n"
     584           "    {\n"
     585           "        .pfnmbsinit    =  __libc_locale_none_mbsinit,\n"
     586           "        .pfnmbrtowc    =  __libc_locale_none_mbrtowc,\n"
     587           "        .pfnmbsnrtowcs =  __libc_locale_none_mbsnrtowcs,\n"
     588           "        .pfnwcrtomb    =  __libc_locale_none_wcrtomb,\n"
     589           "        .pfnwcsnrtombs =  __libc_locale_none_wcsnrtombs\n"
     590           "    },\n");
     591
     592
     593    /* the rest */
     594    printf("    .uobj = 0,\n"
    196595           "    .lobj = 0,\n"
    197596           "    .mbcs = %d\n"
    198            "};\n",
     597           "};\n"
     598           "\n"
     599           "\n"
     600           "\n",
    199601           (int)__libc_GLocaleCtype.mbcs);
    200602
     603
     604    /*
     605     * The unicode table.
     606     */
     607    printf("{\n");
     608
     609    /* Lower */
     610    printf("    .awcUpper =\n"
     611           "    {\n");
     612    for (i = 0; i < sizeof(__libc_GLocaleWCtype.awcLower) / sizeof(__libc_GLocaleWCtype.awcLower[0]); i++)
     613    {
     614        wchar_t wc = ___towlower(i);
     615        if (i % 8)
     616            printf("0x%04x, ", (int)wc);
     617        else
     618            printf("\n        0x%04x, ", (int)wc);
     619    }
     620    printf("\n"
     621           "    },\n");
     622
     623    /* Upper */
     624    printf("    .awcUpper =\n"
     625           "    {\n");
     626    for (i = 0; i < sizeof(__libc_GLocaleWCtype.awcUpper) / sizeof(__libc_GLocaleWCtype.awcUpper[0]); i++)
     627    {
     628        wchar_t wc = ___towupper(i);
     629        if (i % 8)
     630            printf("0x%04x, ", (int)wc);
     631        else
     632            printf("\n        0x%04x, ", (int)wc);
     633    }
     634    printf("\n"
     635           "    },\n");
     636
     637    /* Type */
     638    printf("    .aufType =\n"
     639           "    {\n");
     640    for (i = 0; i < sizeof(__libc_GLocaleWCtype.aufType) / sizeof(__libc_GLocaleWCtype.aufType[0]); i++)
     641    {
     642        unsigned ufType = ___wctype(i);
     643        if (i % 8)
     644            printf("0x%08x, ", ufType);
     645        else
     646            printf("\n        0x%08x, ", ufType);
     647    }
     648    printf("\n"
     649           "    },\n");
     650
     651    /* done */
     652    printf("};\n");
     653
    201654    return 0;
    202655}
  • trunk/src/emx/src/lib/locale/locale_ctype_default.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r1704 r1705  
    3131
    3232
    33 /* Character case conversion tables for the default 'C'/'POSIX' locale. */
    34 const __LIBC_LOCALECTYPEDEFAULT __libc_GLocaleCtypeDefault =
     33/** Character case conversion tables for the default 'C'/'POSIX' locale. */
     34const __LIBC_LOCALECTYPE    __libc_GLocaleCtypeDefault =
    3535{
    36     .ausfType =
    37     {
    38         0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020,
    39         0x8020, 0x8068, 0x8028, 0x8028, 0x8028, 0x8028, 0x8020, 0x8020,
    40         0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020,
    41         0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020, 0x8020,
    42         0x8848, 0x8c10, 0x8c10, 0x8c10, 0xac10, 0x8c10, 0x8c10, 0x8c10,
    43         0x8c10, 0x8c10, 0x8c10, 0xac10, 0x8c10, 0x8c10, 0x8c10, 0x8c10,
    44         0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84, 0x9e84,
    45         0x9e84, 0x9e84, 0x8c10, 0x8c10, 0xac10, 0xac10, 0xac10, 0x8c10,
    46         0x8c10, 0x8f81, 0x8f81, 0x8f81, 0x8f81, 0x8f81, 0x8f81, 0x8f01,
    47         0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01,
    48         0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01, 0x8f01,
    49         0x8f01, 0x8f01, 0x8f01, 0x8c10, 0x8c10, 0x8c10, 0xac10, 0x8c10,
    50         0xac10, 0x8f82, 0x8f82, 0x8f82, 0x8f82, 0x8f82, 0x8f82, 0x8f02,
    51         0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02,
    52         0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02, 0x8f02,
    53         0x8f02, 0x8f02, 0x8f02, 0x8c10, 0xac10, 0x8c10, 0xac10, 0x8020,
    54     }
     36    .auchUpper =
     37    {
     38        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     39        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
     40        0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
     41        0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
     42        0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
     43        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
     44        0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
     45        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
     46        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
     47        0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
     48        0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
     49        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
     50        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
     51        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
     52        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
     53        0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff,
     54    },
     55    .auchLower =
     56    {
     57        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     58        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
     59        0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
     60        0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
     61        0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
     62        0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
     63        0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
     64        0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
     65        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
     66        0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
     67        0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
     68        0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
     69        0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
     70        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf,
     71        0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
     72        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
     73    },
     74    .aufType =
     75    {
     76        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     77        0x00802000, 0x00806800, 0x00802800, 0x00802800, 0x00802800, 0x00802800, 0x00802000, 0x00802000,
     78        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     79        0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000, 0x00802000,
     80        0x00884800, 0x008c1000, 0x008c1000, 0x008c1000, 0x00ac1000, 0x008c1000, 0x008c1000, 0x008c1000,
     81        0x008c1000, 0x008c1000, 0x008c1000, 0x00ac1000, 0x008c1000, 0x008c1000, 0x008c1000, 0x008c1000,
     82        0x009e8400, 0x009e8401, 0x009e8402, 0x009e8403, 0x009e8404, 0x009e8405, 0x009e8406, 0x009e8407,
     83        0x009e8408, 0x009e8409, 0x008c1000, 0x008c1000, 0x00ac1000, 0x00ac1000, 0x00ac1000, 0x008c1000,
     84        0x008c1000, 0x008f810a, 0x008f810b, 0x008f810c, 0x008f810d, 0x008f810e, 0x008f810f, 0x008f0100,
     85        0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100,
     86        0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100, 0x008f0100,
     87        0x008f0100, 0x008f0100, 0x008f0100, 0x008c1000, 0x008c1000, 0x008c1000, 0x00ac1000, 0x008c1000,
     88        0x00ac1000, 0x008f820a, 0x008f820b, 0x008f820c, 0x008f820d, 0x008f820e, 0x008f820f, 0x008f0200,
     89        0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200,
     90        0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200, 0x008f0200,
     91        0x008f0200, 0x008f0200, 0x008f0200, 0x008c1000, 0x00ac1000, 0x008c1000, 0x00ac1000, 0x00802000,
     92    },
     93    .au2MBCSPrefixs =
     94    {
     95        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     96        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     97        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     98        0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
     99    },
     100    .aucUnicode =
     101    {
     102        0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
     103        0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
     104        0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
     105        0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
     106        0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
     107        0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
     108        0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
     109        0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
     110        0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
     111        0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
     112        0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
     113        0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
     114        0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
     115        0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
     116        0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077,
     117        0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f,
     118        0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
     119        0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f,
     120        0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
     121        0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f,
     122        0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7,
     123        0x00a8, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af,
     124        0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
     125        0x00b8, 0x00b9, 0x00ba, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf,
     126        0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7,
     127        0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf,
     128        0x00d0, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7,
     129        0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df,
     130        0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7,
     131        0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef,
     132        0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7,
     133        0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
     134    },
     135    .auchToSBCS0To128 =
     136    {
     137        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
     138        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
     139        0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
     140        0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
     141        0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
     142        0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
     143        0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
     144        0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
     145    },
     146    .cSBCSs = 5,
     147    .aSBCSs[0] =
     148    {
     149        .usStart = 0x0080,
     150        .cChars = 28,
     151        .auch =
     152        {
     153
     154        0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
     155        0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b,
     156        }
     157    },
     158    .aSBCSs[1] =
     159    {
     160        .usStart = 0x009c,
     161        .cChars = 28,
     162        .auch =
     163        {
     164
     165        0x9c, 0x9d, 0x9e, 0x9f, 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab,
     166        0xac, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
     167        }
     168    },
     169    .aSBCSs[2] =
     170    {
     171        .usStart = 0x00b8,
     172        .cChars = 28,
     173        .auch =
     174        {
     175
     176        0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
     177        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3,
     178        }
     179    },
     180    .aSBCSs[3] =
     181    {
     182        .usStart = 0x00d4,
     183        .cChars = 28,
     184        .auch =
     185        {
     186
     187        0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
     188        0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
     189        }
     190    },
     191    .aSBCSs[4] =
     192    {
     193        .usStart = 0x00f0,
     194        .cChars = 16,
     195        .auch =
     196        {
     197
     198        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
     199        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     200        }
     201    },
     202    .CtypeFuncs =
     203    {
     204        .pfnmbsinit    =  __libc_locale_none_mbsinit,
     205        .pfnmbrtowc    =  __libc_locale_none_mbrtowc,
     206        .pfnmbsnrtowcs =  __libc_locale_none_mbsnrtowcs,
     207        .pfnwcrtomb    =  __libc_locale_none_wcrtomb,
     208        .pfnwcsnrtombs =  __libc_locale_none_wcsnrtombs
     209    },
     210    .uobj = 0,
     211    .lobj = 0,
     212    .mbcs = 0
    55213};
    56 #undef __isctype
    57 int __isctype(int _c, unsigned _f)
     214
     215
     216int __isctype(__ct_rune_t __ch, unsigned __f)
    58217{
    59     return (__libc_GLocaleCtypeDefault.ausfType[_c & 0xff] & (_f)) != 0;
     218    return !((__ch) & ~0xffU)
     219        ? !!(__libc_GLocaleCtypeDefault.aufType[(__ch)/* & 0xff*/] & (__f))
     220        : 0;
    60221}
    61222
  • trunk/src/emx/src/lib/locale/setlocale.c

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r1704 r1705  
    118118    /** Ctype data. */
    119119    __LIBC_LOCALECTYPE          Ctype;
     120    /** Ctype conversion functions. */
     121    __LIBC_PCLOCALECTYPEFUNCS   pCtypeFuncs;
    120122    /** Time data. */
    121123    __LIBC_LOCALETIME           Time;
     
    220222static void localeMonetaryFree(__LIBC_PLOCALELCONV pLconv);
    221223static int localeNumericDo(__LIBC_PLOCALELCONV pLconv, UconvObject uobj, struct UniLconv *pULconv);
    222 static int localeMonetaryDo(__LIBC_PLOCALELCONV pLconv, UconvObject uobj, struct UniLconv *pULconv);
     224static int localeMonetaryDo(__LIBC_PLOCALELCONV pLconv, UconvObject uobj, LocaleObject lobj, struct UniLconv *pULconv);
    223225static void localeGlobalFree(__LIBC_PLOCALEGLOBAL pGlobal, int iCategory);
    224 static int localeCreateObjects(const char *pszLocale, const char *pszCodepage, char *pszCodepageActual, LocaleObject *plobj, UconvObject *puobj);
    225226static int localeParseLocale(char *pszLocale, const char **ppszCodepage);
    226227static int localeDoOne(struct temp_locale *pTemp, int iCategory, const char *pszLocale, const char *pszCodepage);
     
    467468}
    468469
    469 
    470470static inline unsigned char Transform(LocaleObject lobj, UconvObject uobj,
    471471                                      UniChar (* APIENTRY pfnTransFunc) (LocaleObject, UniChar),
     
    496496
    497497    /*
     498     * For "C" / "POSIX" we can just use the static default locale.
     499     */
     500    if (    IS_C_LOCALE(pszLocale)
     501        ||  IS_POSIX_LOCALE(pszLocale))
     502    {
     503        memcpy(pCtype, &__libc_GLocaleCtypeDefault, sizeof(*pCtype));
     504        return 0;
     505    }
     506
     507    /*
    498508     * Query multi-byte related stuff.
    499509     */
     
    501511    if (rc)
    502512        return rc;
     513
     514    /*
     515     * Query encoding.
     516     */
     517    uconv_attribute_t   attr;
     518    rc = UniQueryUconvObject(uobj, &attr, sizeof(attr), NULL, NULL, NULL);
     519    if (rc)
     520        return -unierr2errno(rc);
     521    switch (attr.esid)
     522    {
     523        case ESID_sbcs_data:
     524        case ESID_sbcs_pc:
     525        case ESID_sbcs_ebcdic:
     526        case ESID_sbcs_iso:
     527        case ESID_sbcs_windows:
     528        case ESID_sbcs_alt:
     529            __libc_localeFuncsSBCS(&pCtype->CtypeFuncs);
     530            break;
     531
     532        case ESID_dbcs_data:
     533        case ESID_dbcs_pc:
     534        case ESID_dbcs_ebcdic:
     535            __libc_localeFuncsDBCS(&pCtype->CtypeFuncs);
     536            break;
     537
     538        case ESID_mbcs_data:
     539        case ESID_mbcs_pc:
     540        case ESID_mbcs_ebcdic:
     541            __libc_localeFuncsMBCS(&pCtype->CtypeFuncs);
     542            break;
     543
     544        case ESID_ucs_2:
     545            __libc_localeFuncsUCS2(&pCtype->CtypeFuncs);
     546            break;
     547
     548        case ESID_utf_8:
     549            __libc_localeFuncsUTF8(&pCtype->CtypeFuncs);
     550            break;
     551
     552        case ESID_upf_8:
     553        case ESID_ugl:
     554        default:
     555            __libc_localeFuncsDefault(&pCtype->CtypeFuncs);
     556            break;
     557    }
    503558
    504559    /*
     
    510565     * Unicode - this would lead in a shift of the entire string.
    511566     */
     567    /** @todo Aren't there apis for getting all this at once? */
     568    bzero(pCtype->auchToSBCS0To128, sizeof(pCtype->auchToSBCS0To128));
     569    bzero(pCtype->aSBCSs, sizeof(pCtype->aSBCSs));
     570    pCtype->cSBCSs = 0;
    512571    for (i = 0; i < 256; i++)
    513572    {
    514         unsigned short  usfType = 0;
    515         unsigned char   uchUpper;
    516         unsigned char   uchLower;
    517         UniChar         ucs;
    518 
    519         if (!__libc_ucs2To(uobj, (unsigned char *)&i, 1, &ucs))
    520             ucs = i;
    521 
    522         /* isxxx() do not support DBCS characters at all */
    523         if (!IS_MBCS_PREFIX(pCtype, i))
     573        unsigned        ufType = 0;
     574        unsigned char   uchUpper = i;
     575        unsigned char   uchLower = i;
     576        UniChar         uc = 0xffff;
     577
     578        /* isxxx() do not support MBCS characters at all. */
     579        if (!pCtype->mbcs || !IS_MBCS_PREFIX(pCtype, i))
    524580        {
    525             /* ASSUMES CT_* == __* ! */
    526             UNICTYPE *pCtype = UniQueryCharType(ucs);
    527             if (pCtype)
    528                 usfType = (pCtype->itype) & (__UPPER  | __LOWER  | __DIGIT | __SPACE |
    529                                              __PUNCT  | __CNTRL  | __BLANK | __XDIGIT |
    530                                              __ALPHA  | __ALNUM  | __GRAPH | __PRINT |
    531                                              __NUMBER | __SYMBOL | __ASCII);
    532             uchUpper = Transform(lobj, uobj, UniTransUpper, ucs, i);
    533             uchLower = Transform(lobj, uobj, UniTransLower, ucs, i);
    534             /** @todo isn't there apis for getting all this at once? */
     581            if (__libc_ucs2To(uobj, (unsigned char *)&i, 1, &uc))
     582            {
     583                /* ASSUMES that lower/upper are paired! */
     584                /* ASSUMES that there are no difference between the locale and the unicode spec! */
     585                UNICTYPE *pUniType = UniQueryCharType(uc);
     586                if (pUniType)
     587                {
     588                    ufType = ___wctype(uc);
     589                    if (ufType & __CT_LOWER)
     590                        uchUpper = Transform(lobj, uobj, UniTransUpper, uc, i);
     591                    if (ufType & __CT_UPPER)
     592                        uchLower = Transform(lobj, uobj, UniTransLower, uc, i);
     593
     594                    /*
     595                     * Add to conversion table.
     596                     */
     597                    if (uc < 128)
     598                        pCtype->auchToSBCS0To128[uc] = i;
     599                    else
     600                    {
     601                        /*
     602                         * Try fit it into an existing chunk.
     603                         */
     604                        int iChunk;
     605                        for (iChunk = 0; iChunk < pCtype->cSBCSs; iChunk++)
     606                        {
     607                            int cFree = sizeof(pCtype->aSBCSs[iChunk].auch) / sizeof(pCtype->aSBCSs[iChunk].auch[0]) - pCtype->aSBCSs[iChunk].cChars;
     608                            if (cFree > 0)
     609                            {
     610                                int off = (int)uc - (int)pCtype->aSBCSs[iChunk].usStart;
     611                                if (off < sizeof(pCtype->aSBCSs[iChunk].auch) / sizeof(pCtype->aSBCSs[iChunk].auch[0]))
     612                                {
     613                                    if (off >= 0)
     614                                    {
     615                                        if (pCtype->aSBCSs[iChunk].cChars <= off)
     616                                            pCtype->aSBCSs[iChunk].cChars = off + 1;
     617                                        pCtype->aSBCSs[iChunk].auch[off] = i;
     618                                        break;
     619                                    }
     620                                    /* Relocate the chunk up to 3 bytes if that will help. (might cause overlapping areas!) */
     621                                    else if (off >= -3 && -off < cFree)
     622                                    {
     623                                        off = -off;
     624                                        memmove(&pCtype->aSBCSs[iChunk].auch[off], &pCtype->aSBCSs[iChunk].auch[0], pCtype->aSBCSs[iChunk].cChars * sizeof(pCtype->aSBCSs[iChunk].auch[0]));
     625
     626                                        pCtype->aSBCSs[iChunk].usStart -= off;
     627                                        pCtype->aSBCSs[iChunk].cChars  += off;
     628                                        pCtype->aSBCSs[iChunk].auch[0]  = i;
     629                                        switch (off)
     630                                        {
     631                                            case 3: pCtype->aSBCSs[iChunk].auch[2] = 0;
     632                                            case 2: pCtype->aSBCSs[iChunk].auch[1] = 0; break;
     633                                        }
     634                                        break;
     635                                    }
     636                                }
     637                            }
     638                        } /* foreach chunk */
     639
     640                        /*
     641                         * Add new chunk?
     642                         */
     643                        if (    iChunk == pCtype->cSBCSs
     644                            &&  iChunk < sizeof(pCtype->aSBCSs) / sizeof(pCtype->aSBCSs[0]))
     645                        {
     646                            pCtype->aSBCSs[iChunk].usStart = uc;
     647                            pCtype->aSBCSs[iChunk].cChars  = 1;
     648                            pCtype->aSBCSs[iChunk].auch[0] = i;
     649                            pCtype->cSBCSs++;
     650                        }
     651                    }
     652                } /* Unicode type data, ok. */
     653            }
     654            else
     655                uc = 0xffff;
    535656        }
    536         else
    537             uchUpper = uchLower = i;
    538 
    539         pCtype->ausfType[i]  = usfType;
    540         pCtype->auchUpper[i] = uchUpper;
    541         pCtype->auchLower[i] = uchLower;
    542     }
    543 
    544     /*
    545      * In the "C" pszLocale second half of the cflags table should be empty.
    546      */
    547     if (    IS_C_LOCALE(pszLocale)
    548         ||  IS_POSIX_LOCALE(pszLocale))
    549     {
    550         bzero(&pCtype->ausfType[128], 128 * sizeof(pCtype->ausfType[0]));
    551         for (i = 128; i < 255; i++)
    552         {
    553             pCtype->auchUpper[i] = i;
    554             pCtype->auchLower[i] = i;
    555         }
    556     }
     657
     658        /* Store the data in the locale structure. */
     659        pCtype->aufType[i]      = ufType;
     660        pCtype->auchUpper[i]    = uchUpper;
     661        pCtype->auchLower[i]    = uchLower;
     662        pCtype->aucUnicode[i]   = uc;
     663    } /* foreach char 0..255 */
    557664
    558665    /*
     
    650757
    651758    /* query the items. */
    652     if (    (rc = query_item( lobj, uobj,     D_T_FMT, &pTime->date_time_fmt))
    653         ||  (rc = query_item( lobj, uobj,     D_FMT,   &pTime->date_fmt))
    654         ||  (rc = query_item( lobj, uobj,     T_FMT,   &pTime->time_fmt))
    655         ||  (rc = query_item( lobj, uobj,     AM_STR,  &pTime->am))
    656         ||  (rc = query_item( lobj, uobj,     PM_STR,  &pTime->pm))
    657         ||  (rc = query_array(lobj, uobj,  7, DAY_1,   &pTime->lwdays[0]))
    658         ||  (rc = query_array(lobj, uobj,  7, ABDAY_1, &pTime->swdays[0]))
    659         ||  (rc = query_array(lobj, uobj, 12, MON_1,   &pTime->lmonths[0]))
    660         ||  (rc = query_array(lobj, uobj, 12, ABMON_1, &pTime->smonths[0]))
     759    if (    (rc = query_item( lobj, uobj,     D_T_FMT,      &pTime->date_time_fmt))
     760        ||  (rc = query_item( lobj, uobj,     D_FMT,        &pTime->date_fmt))
     761        ||  (rc = query_item( lobj, uobj,     T_FMT,        &pTime->time_fmt))
     762        ||  (rc = query_item( lobj, uobj,     AM_STR,       &pTime->am))
     763        ||  (rc = query_item( lobj, uobj,     PM_STR,       &pTime->pm))
     764        ||  (rc = query_item( lobj, uobj,     T_FMT_AMPM,   &pTime->ampm_fmt))
     765        ||  (rc = query_item( lobj, uobj,     ERA,          &pTime->era))
     766        ||  (rc = query_item( lobj, uobj,     ERA_D_FMT,    &pTime->era_date_fmt))
     767        ||  (rc = query_item( lobj, uobj,     ERA_D_T_FMT,  &pTime->era_date_time_fmt))
     768        ||  (rc = query_item( lobj, uobj,     ERA_T_FMT,    &pTime->era_time_fmt))
     769        ||  (rc = query_item( lobj, uobj,     ALT_DIGITS,   &pTime->alt_digits))
     770        ||  (rc = query_item( lobj, uobj,     DATESEP,      &pTime->datesep))
     771        ||  (rc = query_item( lobj, uobj,     TIMESEP,      &pTime->timesep))
     772        ||  (rc = query_item( lobj, uobj,     LISTSEP,      &pTime->listsep))
     773        ||  (rc = query_array(lobj, uobj,  7, DAY_1,        &pTime->lwdays[0]))
     774        ||  (rc = query_array(lobj, uobj,  7, ABDAY_1,      &pTime->swdays[0]))
     775        ||  (rc = query_array(lobj, uobj, 12, MON_1,        &pTime->lmonths[0]))
     776        ||  (rc = query_array(lobj, uobj, 12, ABMON_1,      &pTime->smonths[0]))
    661777            )
    662778    {
     
    714830static void localeMonetaryFree(__LIBC_PLOCALELCONV pLconv)
    715831{
    716 #define FREE(x) do { if (pLconv->s.x && !pLconv->fMonetaryConsts) free(pLconv->s.x); pLconv->s.x = NULL; } while (0)
    717     FREE(int_curr_symbol);
    718     FREE(currency_symbol);
    719     FREE(mon_decimal_point);
    720     FREE(mon_thousands_sep);
    721     FREE(mon_grouping);
    722     FREE(positive_sign);
    723     FREE(negative_sign);
     832#define FREE(x) do { if (pLconv->x && !pLconv->fMonetaryConsts) free(pLconv->x); pLconv->x = NULL; } while (0)
     833    FREE(s.int_curr_symbol);
     834    FREE(s.currency_symbol);
     835    FREE(s.mon_decimal_point);
     836    FREE(s.mon_thousands_sep);
     837    FREE(s.mon_grouping);
     838    FREE(s.positive_sign);
     839    FREE(s.negative_sign);
     840    FREE(pszCrncyStr);
     841
    724842    pLconv->fMonetaryConsts = 0;
    725843#undef FREE
     
    783901 * @param   pULconv     Pointer to the pULconv structure to get the data from.
    784902 */
    785 static int localeMonetaryDo(__LIBC_PLOCALELCONV pLconv, UconvObject uobj, struct UniLconv *pULconv)
     903static int localeMonetaryDo(__LIBC_PLOCALELCONV pLconv, UconvObject uobj, LocaleObject lobj, struct UniLconv *pULconv)
    786904{
    787905    int rc;
     
    809927    pLconv->s.n_sign_posn       = pULconv->n_sign_posn;
    810928#undef CONVERT_UCS
     929
     930    /*
     931     * Extra stuff (which I don't know which member corresponds to).
     932     */
     933    if ((rc = query_item(lobj, uobj, CRNCYSTR, &pLconv->pszCrncyStr)))
     934        return rc;
     935
    811936    return localeConvertGrouping(pULconv->mon_grouping, &pLconv->s.mon_grouping);
    812937}
     
    10051130 * Creates the libuni objects we need.
    10061131 */
    1007 static int localeCreateObjects(const char *pszLocale, const char *pszCodepage, char *pszCodepageActual, LocaleObject *plobj, UconvObject *puobj)
     1132int __libc_localeCreateObjects(const char *pszLocale, const char *pszCodepage, char *pszCodepageActual, LocaleObject *plobj, UconvObject *puobj)
    10081133{
    10091134    LIBCLOG_ENTER("pszLocale=%p:{%s} pszCodepage=%p:{%s} pszCodepageActual=%p plobj=%p puobj=%p\n",
     
    10681193     * Create the objects.
    10691194     */
    1070     rc = localeCreateObjects(pszLocale, pszCodepage, &szCodepageActual[0], &lobj, &uobj);
     1195    rc = __libc_localeCreateObjects(pszLocale, pszCodepage, &szCodepageActual[0], &lobj, &uobj);
    10711196    if (rc)
    10721197        return rc;
     
    11061231                    rc = localeNumericDo(&pTemp->Lconv, uobj, pULconv);
    11071232                else
    1108                     rc = localeMonetaryDo(&pTemp->Lconv, uobj, pULconv);
     1233                    rc = localeMonetaryDo(&pTemp->Lconv, uobj, lobj, pULconv);
    11091234                UniFreeLocaleInfo(pULconv);
    11101235            }
     
    13631488        __libc_gLocaleLconv.s.p_sign_posn        = pTemp->Lconv.s.p_sign_posn;
    13641489        __libc_gLocaleLconv.s.n_sign_posn        = pTemp->Lconv.s.n_sign_posn;
     1490        __libc_gLocaleLconv.pszCrncyStr          = pTemp->Lconv.pszCrncyStr;
    13651491        pTemp->afProcessed[LC_MONETARY + 1] = 0;
    13661492        gLocale.apszNames[LC_MONETARY + 1] = pTemp->Global.apszNames[LC_MONETARY + 1];
     
    15871713                    memcpy(psz, gLocale.apszNames[LC_CTYPE + 1], cch);
    15881714                    localeParseLocale(psz, &pszCodepage);
    1589                     rc = localeCreateObjects(psz, pszCodepage, NULL, &lobj, &uobj);
     1715                    rc = __libc_localeCreateObjects(psz, pszCodepage, NULL, &lobj, &uobj);
    15901716                    if (!rc)
    15911717                        LIBCLOG_RETURN_INT(rc);
     
    16071733                    memcpy(psz, gLocale.apszNames[LC_COLLATE + 1], cch);
    16081734                    localeParseLocale(psz, &pszCodepage);
    1609                     rc = localeCreateObjects(psz, pszCodepage, NULL, &lobj, &uobj);
     1735                    rc = __libc_localeCreateObjects(psz, pszCodepage, NULL, &lobj, &uobj);
    16101736                    if (!rc)
    16111737                        LIBCLOG_RETURN_INT(rc);
Note: See TracChangeset for help on using the changeset viewer.