Changeset 2058
- Timestamp:
- Jun 23, 2005, 7:58:05 AM (20 years ago)
- Location:
- trunk/src/emx
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/ChangeLog.LIBC
-
Property cvs2svn:cvs-rev
changed from
1.59
to1.60
r2057 r2058 1 1 /* $Id$ */ 2 3 2005-06-23: knut st. osmundsen <bird-gccos2-spam@anduin.net> 4 - libc: 5 o Fixed some more incorrectness of the 'C' locale, it only 6 defines the first 128 chars. 2 7 3 8 2005-06-19: knut st. osmundsen <bird-gccos2-spam@anduin.net> -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/InnoTekLIBC/locale.h
-
Property cvs2svn:cvs-rev
changed from
1.3
to1.4
r2057 r2058 90 90 /** MBCS prefixes. Two bits per character. */ 91 91 unsigned char au2MBCSPrefixs[256/4]; 92 /** Unicode translation. (0xffff means no ttranslation.) */92 /** Unicode translation. (0xffff means no translation.) */ 93 93 unsigned short aucUnicode[256]; 94 94 /** Unicode -> SBCS conversion: 0..128. */ … … 136 136 /** Bit flags for every character (for iswXXX() function series). */ 137 137 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; 138 142 } __LIBC_LOCALEWCTYPE; 139 143 /** Pointer to the Ctype unicode struct. */ … … 217 221 extern const __LIBC_LOCALECTYPE __libc_GLocaleCtypeDefault; 218 222 /** Cached Unicode (__wchar_t) case conversion tables and flags. */ 219 extern const__LIBC_LOCALEWCTYPE __libc_GLocaleWCtype;223 extern __LIBC_LOCALEWCTYPE __libc_GLocaleWCtype; 220 224 /** Locale information structure. */ 221 225 extern __LIBC_LOCALELCONV __libc_gLocaleLconv; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/_ctype.h
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r2057 r2058 71 71 /** Bit flags for every character (for iswXXX() function series). */ 72 72 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; 73 77 } __libc_GLocaleWCtype; 74 78 __END_DECLS … … 160 164 */ 161 165 __BEGIN_DECLS 162 static inlineunsigned __ctype(__ct_rune_t __ch, unsigned __f)163 { 164 return !( (__ch)& ~0xffU)165 ? __libc_GLocaleCtype.aufType[ (__ch)/* & 0xff*/] & (__f)166 static __inline__ unsigned __ctype(__ct_rune_t __ch, unsigned __f) 167 { 168 return !(__ch & ~0xffU) 169 ? __libc_GLocaleCtype.aufType[__ch] & __f 166 170 : 0; 167 171 } 168 172 169 static inlineint __istype(__ct_rune_t __ch, unsigned __f)170 { 171 return !!__ctype( (__ch), (__f));172 } 173 174 static inlineint __isctype(__ct_rune_t __ch, unsigned __f)175 { 176 return !( (__ch)& ~0xffU)177 ? !!(__libc_GLocaleCtypeDefault.aufType[ (__ch)/* & 0xff*/] & (__f))173 static __inline__ int __istype(__ct_rune_t __ch, unsigned __f) 174 { 175 return !!__ctype(__ch, __f); 176 } 177 178 static __inline__ int __isctype(__ct_rune_t __ch, unsigned __f) 179 { 180 return !(__ch & ~0xffU) 181 ? !!(__libc_GLocaleCtypeDefault.aufType[__ch] & __f) 178 182 : 0; 179 183 } 180 184 181 static inline__ct_rune_t __toupper(__ct_rune_t __ch)182 { 183 return !( (__ch)& ~0xffU)184 ? __libc_GLocaleCtype.auchUpper[ (__ch)/* & 0xff*/]185 static __inline__ __ct_rune_t __toupper(__ct_rune_t __ch) 186 { 187 return !(__ch & ~0xffU) 188 ? __libc_GLocaleCtype.auchUpper[__ch] 185 189 : (__ch); 186 190 } 187 191 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 inlineunsigned __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 inlineint __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)]192 static __inline__ __ct_rune_t __tolower(__ct_rune_t __ch) 193 { 194 return !(__ch & ~0xffU) 195 ? __libc_GLocaleCtype.auchLower[__ch] 196 : __ch; 197 } 198 199 200 static __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 207 static __inline__ int __iswtype(__wint_t __wc, unsigned __f) 208 { 209 return !!__wctype(__wc, __f); 210 } 211 212 static __inline__ __wint_t __towupper(__wint_t __wc) 213 { 214 return !(__wc & __libc_GLocaleWCtype.uMask) 215 ? __libc_GLocaleWCtype.awcUpper[__wc] 212 216 : ___towupper(__wc); 213 217 } 214 218 215 static inline__wint_t __towlower(__wint_t __wc)216 { 217 return !( (__wc) & ~0xffU)218 ? __libc_GLocaleWCtype.awcLower[ (__wc)]219 static __inline__ __wint_t __towlower(__wint_t __wc) 220 { 221 return !(__wc & __libc_GLocaleWCtype.uMask) 222 ? __libc_GLocaleWCtype.awcLower[__wc] 219 223 : ___towlower(__wc); 220 224 } 221 225 222 223 static inline int __wcwidth(__wint_t __wc) 224 { 225 if ((__wc) != 0) 226 static __inline__ int __wcwidth(__wint_t __wc) 227 { 228 if (__wc != 0) 226 229 { 227 unsigned __f = __wctype( (__wc), __CT_SCRW_MASK | __CT_PRINT);228 return ( (__f)& __CT_SCRW_MASK)229 ? ( (__f)& __CT_SCRW_MASK) >> __CT_SCRW_SHIFT230 : ( (__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; 231 234 } 232 235 else … … 250 253 unsigned __wctype(__wint_t, unsigned); 251 254 int __iswtype(__wint_t, unsigned); 252 __wint_t 253 __wint_t 255 __wint_t __towupper(__wint_t); 256 __wint_t __towlower(__wint_t); 254 257 int __wcwidth(__wint_t); 255 258 __END_DECLS -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/include/math.h
-
Property cvs2svn:cvs-rev
changed from
1.7
to1.8
r2057 r2058 97 97 : (sizeof (x) == sizeof (double)) ? __isfinite(x) \ 98 98 : __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 99 111 #define isinf(x) \ 100 112 ((sizeof (x) == sizeof (float)) ? __isinff(x) \ … … 105 117 : (sizeof (x) == sizeof (double)) ? isnan(x) \ 106 118 : __isnanl(x)) 119 #endif 107 120 #define isnormal(x) \ 108 121 ((sizeof (x) == sizeof (float)) ? __isnormalf(x) \ … … 234 247 double hypot(double, double); 235 248 int ilogb(double) __pure2; 249 #ifdef IN_INNOTEK_LIBC 250 int _STD(isinf)(double) __pure2; 251 int _STD(isnan)(double) __pure2; 252 #else 236 253 int (isinf)(double) __pure2; 237 254 int (isnan)(double) __pure2; 255 #endif 238 256 double lgamma(double); 239 257 long long llrint(double); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/bsd/locale/utf8.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r2057 r2058 71 71 return (0); 72 72 } 73 #endif /* !__INNOTEK_LIBC__ */ 73 #else 74 void __libc_localeFuncsUTF8(__LIBC_PLOCALECTYPEFUNCS pFuncs) 75 { 76 pFuncs->pfnmbsinit = _UTF8_mbsinit; 77 pFuncs->pfnmbrtowc = _UTF8_mbrtowc; 78 pFuncs->pfnmbsnrtowcs = _UTF8_mbsnrtowcs; 79 pFuncs->pfnwcrtomb = _UTF8_wcrtomb; 80 pFuncs->pfnwcsnrtombs = _UTF8_wcsnrtombs; 81 } 82 #endif /* __INNOTEK_LIBC__ */ 74 83 75 84 int -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/locale_ctype.c
-
Property cvs2svn:cvs-rev
changed from
1.13
to1.14
r2057 r2058 247 247 248 248 /** Cached Unicode (__wchar_t) case conversion tables and flags. */ 249 const__LIBC_LOCALEWCTYPE __libc_GLocaleWCtype =249 __LIBC_LOCALEWCTYPE __libc_GLocaleWCtype = 250 250 { 251 251 .awcLower = … … 355 355 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 0x000f0200, 356 356 }, 357 .uMask = ~0x7fU, 357 358 }; 358 359 359 360 360 361 361 unsigned __wctype(__wint_t __wc, unsigned __f) 362 362 { 363 return !( (__wc) & ~0xffU)364 ? __libc_GLocaleWCtype.aufType[ (__wc)] & (__f)365 : ___wctype(__wc) & (__f);363 return !(__wc & __libc_GLocaleWCtype.uMask) 364 ? __libc_GLocaleWCtype.aufType[__wc] & __f 365 : ___wctype(__wc) & __f; 366 366 } 367 367 368 368 int __iswtype(__wint_t __wc, unsigned __f) 369 369 { 370 return !!__wctype( (__wc), (__f));370 return !!__wctype(__wc, __f); 371 371 } 372 372 373 373 __wint_t __towupper(__wint_t __wc) 374 374 { 375 return !( (__wc) & ~0xffU)376 ? __libc_GLocaleWCtype.awcUpper[ (__wc)]375 return !(__wc & __libc_GLocaleWCtype.uMask) 376 ? __libc_GLocaleWCtype.awcUpper[__wc] 377 377 : ___towupper(__wc); 378 378 } … … 380 380 __wint_t __towlower(__wint_t __wc) 381 381 { 382 return !( (__wc) & ~0xffU)383 ? __libc_GLocaleWCtype.awcLower[ (__wc)]382 return !(__wc & __libc_GLocaleWCtype.uMask) 383 ? __libc_GLocaleWCtype.awcLower[__wc] 384 384 : ___towlower(__wc); 385 385 } 386 386 387 388 387 int __wcwidth(__wint_t __wc) 389 388 { 390 if ((__wc) != 0) 391 { 392 unsigned __f = __wctype((__wc), __CT_SCRW_MASK | __CT_PRINT); 393 return ((__f) & __CT_SCRW_MASK) 394 ? ((__f) & __CT_SCRW_MASK) >> __CT_SCRW_SHIFT 395 : ((__f) & __CT_PRINT) ? 1 : -1; 396 } 397 else 398 return 0; 389 if (__wc != 0) 390 { 391 unsigned __f = __wctype(__wc, __CT_SCRW_MASK | __CT_PRINT); 392 return (__f & __CT_SCRW_MASK) 393 ? (__f & __CT_SCRW_MASK) >> __CT_SCRW_SHIFT 394 : (__f & __CT_PRINT) ? 1 : -1; 395 } 396 return 0; 399 397 } 400 398 … … 404 402 * ASSUMES that none of the locals differs from the unicode spec 405 403 */ 406 unsigned ___wctype(__wchar_t uc)404 unsigned ___wctype(__wchar_t wc) 407 405 { 408 406 unsigned ufType = 0; 409 UNICTYPE *pUniType = UniQueryCharType(uc); 410 if (pUniType) 411 { 412 /* ASSUMES CT_* << 8 == __* ! */ 413 ufType = ((unsigned)pUniType->itype << 8) 414 & (__CT_UPPER | __CT_LOWER | __CT_DIGIT | __CT_SPACE | 415 __CT_PUNCT | __CT_CNTRL | __CT_BLANK | __CT_XDIGIT | 416 __CT_ALPHA | __CT_ALNUM | __CT_GRAPH | __CT_PRINT | 417 __CT_NUMBER | __CT_SYMBOL | __CT_ASCII); 418 if (pUniType->extend & C3_IDEOGRAPH) 419 ufType |= __CT_IDEOGRAM; 420 if (ufType & (__CT_XDIGIT | __CT_DIGIT)) 407 if ( __libc_GLocaleWCtype.uMask != ~0x7f 408 || wc <= 127) 409 { 410 UNICTYPE *pUniType = UniQueryCharType(wc); 411 if (pUniType) 421 412 { 422 if ( (unsigned)uc - 0x30U <= (0x39 - 0x30)) 423 ufType |= (unsigned)uc - 0x30; 424 else if ((unsigned)uc - 0x41U <= (0x46 - 0x41)) 425 ufType |= (unsigned)uc - 0x41 + 0xa; 426 else 413 /* ASSUMES CT_* << 8 == __* ! */ 414 ufType = ((unsigned)pUniType->itype << 8) 415 & (__CT_UPPER | __CT_LOWER | __CT_DIGIT | __CT_SPACE | 416 __CT_PUNCT | __CT_CNTRL | __CT_BLANK | __CT_XDIGIT | 417 __CT_ALPHA | __CT_ALNUM | __CT_GRAPH | __CT_PRINT | 418 __CT_NUMBER | __CT_SYMBOL | __CT_ASCII); 419 if (pUniType->extend & C3_IDEOGRAPH) 420 ufType |= __CT_IDEOGRAM; 421 if (ufType & (__CT_XDIGIT | __CT_DIGIT)) 427 422 { 428 unsigned uVal = UniQueryNumericValue(uc); 429 if (!(uVal & ~0xffU)) 430 ufType |= uVal; 423 if ( (unsigned)wc - 0x30U <= (0x39 - 0x30)) 424 ufType |= (unsigned)wc - 0x30; 425 else if ((unsigned)wc - 0x41U <= (0x46 - 0x41)) 426 ufType |= (unsigned)wc - 0x41 + 0xa; 427 else 428 { 429 unsigned uVal = UniQueryNumericValue(wc); 430 if (!(uVal & ~0xffU)) 431 ufType |= uVal; 432 } 431 433 } 434 ufType |= (pUniType->bidi & 0xf << 24); 435 436 /** @todo screen width. */ 432 437 } 433 ufType |= (pUniType->bidi & 0xf << 24);434 435 /** @todo screen width. */436 438 } 437 439 return ufType; … … 444 446 __wchar_t ___towlower(__wchar_t wc) 445 447 { 448 if ( __libc_GLocaleWCtype.uMask == ~0x7f 449 && wc > 127) 450 return wc; 446 451 FS_VAR_SAVE_LOAD(); 447 452 UniChar ucRet = UniTolower(wc); … … 456 461 __wchar_t ___towupper(__wchar_t wc) 457 462 { 463 if ( __libc_GLocaleWCtype.uMask == ~0x7f 464 && wc > 127) 465 return wc; 458 466 FS_VAR_SAVE_LOAD(); 459 467 UniChar ucRet = UniToupper(wc); … … 646 654 } 647 655 printf("\n" 648 " },\n"); 656 " },\n" 657 " .uMask = ~0x7f,\n"); 649 658 650 659 /* done */ -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/mb_libuni.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r2057 r2058 93 93 return ((size_t)-2); 94 94 95 96 95 /* 97 96 * Try the conversion table first. 98 97 */ 99 __wchar_t wc ;98 __wchar_t wc = -1; 100 99 unsigned char uch = *(const unsigned char *)s; 101 #ifndef NO_CONVERSION_TABLES102 100 if ( !pState->chState 103 && (wc = __libc_GLocaleCtype.aucUnicode[uch]) != 0xffff) 101 && ( (wc = __libc_GLocaleCtype.aucUnicode[uch]) != 0xffff 102 || !IS_MBCS_PREFIX(&__libc_GLocaleCtype, uch))) 103 104 104 { 105 105 if (pwc != NULL) … … 107 107 return wc != 0; 108 108 } 109 #endif /* !NO_CONVERSION_TABLES */ 109 if (!__libc_GLocaleCtype.uobj) /* no possible conversion */ 110 { 111 errno = EILSEQ; 112 return ((size_t)-1); 113 } 110 114 111 115 /* … … 120 124 size_t cIgnore = 0; 121 125 uconv_attribute_t attr; 126 LOCALE_LOCK(); 127 if (!__libc_GLocaleCtype.uobj) 128 { 129 LOCALE_UNLOCK(); 130 errno = EILSEQ; 131 return ((size_t)-1); 132 } 122 133 FS_VAR_SAVE_LOAD(); 123 LOCALE_LOCK(); 124 int rc = 0; 125 if (!__libc_GLocaleCtype.uobj) 126 rc = __libc_localeCreateObjects("C", NULL, NULL, &__libc_GLocaleCtype.lobj, &__libc_GLocaleCtype.uobj); 127 if (!rc) 128 rc = UniQueryUconvObject(__libc_GLocaleCtype.uobj, &attr, sizeof(attr), NULL, NULL, NULL); 134 int rc = UniQueryUconvObject(__libc_GLocaleCtype.uobj, &attr, sizeof(attr), NULL, NULL, NULL); 129 135 if (!rc) 130 136 { … … 140 146 || (rc == UCONV_E2BIG && !cwcOutLeft)) 141 147 { 148 if (wc == 0xfffd) 149 wc = -1; /* this seems to make sense sometimes... */ 142 150 if (pwc) 143 151 *pwc = wc; … … 177 185 */ 178 186 char ch; 179 #ifndef NO_CONVERSION_TABLES180 187 if (!pState->chState) 181 188 { … … 212 219 /* not found */ 213 220 } 214 #endif /* !NO_CONVERSION_TABLES */ 221 if (!__libc_GLocaleCtype.uobj) /* no possible conversion */ 222 { 223 errno = EILSEQ; 224 return ((size_t)-1); 225 } 215 226 216 227 /* … … 224 235 UniChar *pucIn = &wc; 225 236 uconv_attribute_t attr; 226 FS_VAR_SAVE_LOAD();227 LOCALE_LOCK();228 237 size_t cchMbCurMax = MB_CUR_MAX; 229 238 size_t cchOutLeft = cchMbCurMax; 230 int rc = 0;239 LOCALE_LOCK(); 231 240 if (!__libc_GLocaleCtype.uobj) 232 rc = __libc_localeCreateObjects("C", NULL, NULL, &__libc_GLocaleCtype.lobj, &__libc_GLocaleCtype.uobj); 233 if (!rc) 234 rc = UniQueryUconvObject(__libc_GLocaleCtype.uobj, &attr, sizeof(attr), NULL, NULL, NULL); 241 { 242 LOCALE_UNLOCK(); 243 errno = EILSEQ; 244 return ((size_t)-1); 245 } 246 FS_VAR_SAVE_LOAD(); 247 int rc = UniQueryUconvObject(__libc_GLocaleCtype.uobj, &attr, sizeof(attr), NULL, NULL, NULL); 235 248 if (!rc) 236 249 { … … 453 466 } 454 467 455 /* later */456 void __libc_localeFuncsUTF8(__LIBC_PLOCALECTYPEFUNCS pFuncs)457 {458 __libc_localeFuncsDefault(pFuncs);459 }460 -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/emx/src/lib/locale/setlocale.c
-
Property cvs2svn:cvs-rev
changed from
1.19
to1.20
r2057 r2058 1299 1299 case LC_CTYPE: 1300 1300 rc = localeCtypeDo(&pTemp->Ctype, uobj, lobj, pszLocale, &szCodepageActual[0]); 1301 fFree = rc != 0 ;1301 fFree = rc != 0 || IS_C_LOCALE(pszLocale) || IS_POSIX_LOCALE(pszLocale); 1302 1302 break; 1303 1303 … … 1538 1538 memcpy(&__libc_GLocaleCtype, &pTemp->Ctype, sizeof(__libc_GLocaleCtype)); 1539 1539 MB_CUR_MAX = pTemp->Ctype.mbcs ? pTemp->Ctype.mbcs : 1; 1540 if ( IS_C_LOCALE(pTemp->Global.apszNames[LC_CTYPE + 1]) 1541 || IS_POSIX_LOCALE(pTemp->Global.apszNames[LC_CTYPE + 1])) 1542 __libc_GLocaleWCtype.uMask = ~0x7fU; 1543 else 1544 __libc_GLocaleWCtype.uMask = ~0xffU; 1540 1545 pTemp->afProcessed[LC_CTYPE + 1] = 0; 1541 1546 gLocale.apszNames[LC_CTYPE + 1] = pTemp->Global.apszNames[LC_CTYPE + 1]; -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.