Changeset 2058 for trunk/src/emx/include


Ignore:
Timestamp:
Jun 23, 2005, 7:58:05 AM (20 years ago)
Author:
bird
Message:

Fixed some more incorrectness of the 'C' locale, it only defines the first 128 chars.

Location:
trunk/src/emx/include
Files:
3 edited

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r2057 r2058  
    9090    /** MBCS prefixes. Two bits per character. */
    9191    unsigned char           au2MBCSPrefixs[256/4];
    92     /** Unicode translation. (0xffff means not translation.) */
     92    /** Unicode translation. (0xffff means no translation.) */
    9393    unsigned short          aucUnicode[256];
    9494    /** Unicode -> SBCS conversion: 0..128. */
     
    136136    /** Bit flags for every character (for iswXXX() function series). */
    137137    unsigned        aufType[256];
     138    /** Mask used to check if an index is within the above arrays.
     139     * This is required because 'C' doesn't do more than 0-127. So,
     140     * the mask is either ~0xff or ~0x7f. */
     141    unsigned        uMask;
    138142} __LIBC_LOCALEWCTYPE;
    139143/** Pointer to the Ctype unicode struct. */
     
    217221extern const __LIBC_LOCALECTYPE     __libc_GLocaleCtypeDefault;
    218222/** Cached Unicode (__wchar_t) case conversion tables and flags. */
    219 extern const __LIBC_LOCALEWCTYPE    __libc_GLocaleWCtype;
     223extern __LIBC_LOCALEWCTYPE    __libc_GLocaleWCtype;
    220224/** Locale information structure. */
    221225extern __LIBC_LOCALELCONV           __libc_gLocaleLconv;
  • trunk/src/emx/include/_ctype.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r2057 r2058  
    7171    /** Bit flags for every character (for iswXXX() function series). */
    7272    unsigned        aufType[256];
     73    /** Mask used to check if an index is within the above arrays.
     74     * This is required because 'C' doesn't do more than 0-127. So,
     75     * the mask is either ~0xff or ~0x7f. */
     76    unsigned        uMask;
    7377} __libc_GLocaleWCtype;
    7478__END_DECLS
     
    160164 */
    161165__BEGIN_DECLS
    162 static inline unsigned __ctype(__ct_rune_t __ch, unsigned __f)
    163 {
    164     return !((__ch) & ~0xffU)
    165         ? __libc_GLocaleCtype.aufType[(__ch)/* & 0xff*/] & (__f)
     166static __inline__ unsigned __ctype(__ct_rune_t __ch, unsigned __f)
     167{
     168    return !(__ch & ~0xffU)
     169        ? __libc_GLocaleCtype.aufType[__ch] & __f
    166170        : 0;
    167171}
    168172
    169 static inline int __istype(__ct_rune_t __ch, unsigned __f)
    170 {
    171     return !!__ctype((__ch), (__f));
    172 }
    173 
    174 static inline int __isctype(__ct_rune_t __ch, unsigned __f)
    175 {
    176     return !((__ch) & ~0xffU)
    177         ? !!(__libc_GLocaleCtypeDefault.aufType[(__ch)/* & 0xff*/] & (__f))
     173static __inline__ int __istype(__ct_rune_t __ch, unsigned __f)
     174{
     175    return !!__ctype(__ch, __f);
     176}
     177
     178static __inline__ int __isctype(__ct_rune_t __ch, unsigned __f)
     179{
     180    return !(__ch & ~0xffU)
     181        ? !!(__libc_GLocaleCtypeDefault.aufType[__ch] & __f)
    178182        : 0;
    179183}
    180184
    181 static inline __ct_rune_t __toupper(__ct_rune_t __ch)
    182 {
    183     return !((__ch) & ~0xffU)
    184         ? __libc_GLocaleCtype.auchUpper[(__ch)/* & 0xff*/]
     185static __inline__ __ct_rune_t __toupper(__ct_rune_t __ch)
     186{
     187    return !(__ch & ~0xffU)
     188        ? __libc_GLocaleCtype.auchUpper[__ch]
    185189        : (__ch);
    186190}
    187191
    188 static 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 
    196 static 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 
    203 static inline int __iswtype(__wint_t __wc, unsigned __f)
    204 {
    205     return !!__wctype((__wc), (__f));
    206 }
    207 
    208 static inline __wint_t __towupper(__wint_t __wc)
    209 {
    210     return !((__wc) & ~0xffU)
    211         ? __libc_GLocaleWCtype.awcUpper[(__wc)]
     192static __inline__ __ct_rune_t __tolower(__ct_rune_t __ch)
     193{
     194    return !(__ch & ~0xffU)
     195        ? __libc_GLocaleCtype.auchLower[__ch]
     196        : __ch;
     197}
     198
     199
     200static __inline__ unsigned __wctype(__wint_t __wc, unsigned __f)
     201{
     202    return !(__wc & __libc_GLocaleWCtype.uMask)
     203        ? __libc_GLocaleWCtype.aufType[__wc] & __f
     204        : ___wctype(__wc) & __f;
     205}
     206
     207static __inline__ int __iswtype(__wint_t __wc, unsigned __f)
     208{
     209    return !!__wctype(__wc, __f);
     210}
     211
     212static __inline__ __wint_t __towupper(__wint_t __wc)
     213{
     214    return !(__wc & __libc_GLocaleWCtype.uMask)
     215        ? __libc_GLocaleWCtype.awcUpper[__wc]
    212216        : ___towupper(__wc);
    213217}
    214218
    215 static inline __wint_t __towlower(__wint_t __wc)
    216 {
    217     return !((__wc) & ~0xffU)
    218         ? __libc_GLocaleWCtype.awcLower[(__wc)]
     219static __inline__ __wint_t __towlower(__wint_t __wc)
     220{
     221    return !(__wc & __libc_GLocaleWCtype.uMask)
     222        ? __libc_GLocaleWCtype.awcLower[__wc]
    219223        : ___towlower(__wc);
    220224}
    221225
    222 
    223 static inline int __wcwidth(__wint_t __wc)
    224 {
    225     if ((__wc) != 0)
     226static __inline__ int __wcwidth(__wint_t __wc)
     227{
     228    if (__wc != 0)
    226229    {
    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;
     230        unsigned __f = __wctype(__wc, __CT_SCRW_MASK | __CT_PRINT);
     231        return (__f & __CT_SCRW_MASK)
     232            ? (__f & __CT_SCRW_MASK) >> __CT_SCRW_SHIFT
     233            : (__f & __CT_PRINT) ? 1 : -1;
    231234    }
    232235    else
     
    250253unsigned    __wctype(__wint_t, unsigned);
    251254int         __iswtype(__wint_t, unsigned);
    252 __wint_t     __towupper(__wint_t);
    253 __wint_t     __towlower(__wint_t);
     255__wint_t    __towupper(__wint_t);
     256__wint_t    __towlower(__wint_t);
    254257int         __wcwidth(__wint_t);
    255258__END_DECLS
  • trunk/src/emx/include/math.h

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r2057 r2058  
    9797    : (sizeof (x) == sizeof (double)) ? __isfinite(x)   \
    9898    : __isfinitel(x))
     99#ifdef IN_INNOTEK_LIBC
     100#undef isinf
     101#define isinf(x)                                        \
     102    ((sizeof (x) == sizeof (float)) ? __isinff(x)       \
     103    : (sizeof (x) == sizeof (double)) ? _STD(isinf)(x)  \
     104    : __isinfl(x))
     105#undef isnan
     106#define isnan(x)                                        \
     107    ((sizeof (x) == sizeof (float)) ? isnanf(x)         \
     108    : (sizeof (x) == sizeof (double)) ? _STD(isnan)(x)  \
     109    : __isnanl(x))
     110#else
    99111#define isinf(x)                                        \
    100112    ((sizeof (x) == sizeof (float)) ? __isinff(x)       \
     
    105117    : (sizeof (x) == sizeof (double)) ? isnan(x)        \
    106118    : __isnanl(x))
     119#endif
    107120#define isnormal(x)                                     \
    108121    ((sizeof (x) == sizeof (float)) ? __isnormalf(x)    \
     
    234247double  hypot(double, double);
    235248int     ilogb(double) __pure2;
     249#ifdef IN_INNOTEK_LIBC
     250int     _STD(isinf)(double) __pure2;
     251int     _STD(isnan)(double) __pure2;
     252#else
    236253int     (isinf)(double) __pure2;
    237254int     (isnan)(double) __pure2;
     255#endif
    238256double  lgamma(double);
    239257long long llrint(double);
Note: See TracChangeset for help on using the changeset viewer.