Fixed ctype table and functions.

svn path=/trunk/; revision=918
This commit is contained in:
Eric Kohl 2000-01-05 19:42:56 +00:00
parent 57919a833e
commit 453f513ed3
6 changed files with 304 additions and 303 deletions

View file

@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of * DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* $Author: ariadne $ * $Author: ekohl $
* $Date: 1999/04/14 07:10:15 $ * $Date: 2000/01/05 19:42:56 $
* *
*/ */
#ifndef _LINUX_CTYPE_H #ifndef _LINUX_CTYPE_H
@ -46,9 +46,8 @@
#define _CONTROL 0x0020 #define _CONTROL 0x0020
#define _BLANK 0x0040 #define _BLANK 0x0040
#define _HEX 0x0080 #define _HEX 0x0080
#define _ALPHA 0x0103 #define _ALPHA 0x0103
#define _GRAPH 0x0200 // added
#define _PRINT 0x0400 // added
#define _LEADBYTE 0x8000 #define _LEADBYTE 0x8000

View file

@ -1,150 +1,136 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/ctype.h> #include <crtdll/ctype.h>
unsigned short _ctype[] = {
#define __dj_ISUPPER _UPPER 0, /* <EOF>, 0xFFFF */
#define __dj_ISLOWER _LOWER _CONTROL, /* CTRL+@, 0x00 */
#define __dj_ISDIGIT _DIGIT _CONTROL, /* CTRL+A, 0x01 */
#define __dj_ISSPACE _SPACE _CONTROL, /* CTRL+B, 0x02 */
#define __dj_ISPUNCT _PUNCT _CONTROL, /* CTRL+C, 0x03 */
#define __dj_ISCNTRL _CONTROL _CONTROL, /* CTRL+D, 0x04 */
#define __dj_ISBLANK _BLANK _CONTROL, /* CTRL+E, 0x05 */
#define __dj_ISXDIGIT _HEX _CONTROL, /* CTRL+F, 0x06 */
#define __dj_ISALPHA _ALPHA _CONTROL, /* CTRL+G, 0x07 */
#define __dj_ISPRINT _PRINT _CONTROL, /* CTRL+H, 0x08 */
#define __dj_ISGRAPH _GRAPH _CONTROL | _SPACE, /* CTRL+I, 0x09 */
_CONTROL | _SPACE, /* CTRL+J, 0x0a */
// removed the first value _CONTROL | _SPACE, /* CTRL+K, 0x0b */
_CONTROL | _SPACE, /* CTRL+L, 0x0c */
unsigned short _pctype_dll[] = { _CONTROL | _SPACE, /* CTRL+M, 0x0d */
__dj_ISCNTRL, /* CTRL+@, 0x00 */ _CONTROL, /* CTRL+N, 0x0e */
__dj_ISCNTRL, /* CTRL+A, 0x01 */ _CONTROL, /* CTRL+O, 0x0f */
__dj_ISCNTRL, /* CTRL+B, 0x02 */ _CONTROL, /* CTRL+P, 0x10 */
__dj_ISCNTRL, /* CTRL+C, 0x03 */ _CONTROL, /* CTRL+Q, 0x11 */
__dj_ISCNTRL, /* CTRL+D, 0x04 */ _CONTROL, /* CTRL+R, 0x12 */
__dj_ISCNTRL, /* CTRL+E, 0x05 */ _CONTROL, /* CTRL+S, 0x13 */
__dj_ISCNTRL, /* CTRL+F, 0x06 */ _CONTROL, /* CTRL+T, 0x14 */
__dj_ISCNTRL, /* CTRL+G, 0x07 */ _CONTROL, /* CTRL+U, 0x15 */
__dj_ISCNTRL, /* CTRL+H, 0x08 */ _CONTROL, /* CTRL+V, 0x16 */
__dj_ISCNTRL | __dj_ISSPACE, /* CTRL+I, 0x09 */ _CONTROL, /* CTRL+W, 0x17 */
__dj_ISCNTRL | __dj_ISSPACE, /* CTRL+J, 0x0a */ _CONTROL, /* CTRL+X, 0x18 */
__dj_ISCNTRL | __dj_ISSPACE, /* CTRL+K, 0x0b */ _CONTROL, /* CTRL+Y, 0x19 */
__dj_ISCNTRL | __dj_ISSPACE, /* CTRL+L, 0x0c */ _CONTROL, /* CTRL+Z, 0x1a */
__dj_ISCNTRL | __dj_ISSPACE, /* CTRL+M, 0x0d */ _CONTROL, /* CTRL+[, 0x1b */
__dj_ISCNTRL, /* CTRL+N, 0x0e */ _CONTROL, /* CTRL+\, 0x1c */
__dj_ISCNTRL, /* CTRL+O, 0x0f */ _CONTROL, /* CTRL+], 0x1d */
__dj_ISCNTRL, /* CTRL+P, 0x10 */ _CONTROL, /* CTRL+^, 0x1e */
__dj_ISCNTRL, /* CTRL+Q, 0x11 */ _CONTROL, /* CTRL+_, 0x1f */
__dj_ISCNTRL, /* CTRL+R, 0x12 */ _SPACE | _BLANK, /* ` ', 0x20 */
__dj_ISCNTRL, /* CTRL+S, 0x13 */ _PUNCT, /* `!', 0x21 */
__dj_ISCNTRL, /* CTRL+T, 0x14 */ _PUNCT, /* 0x22 */
__dj_ISCNTRL, /* CTRL+U, 0x15 */ _PUNCT, /* `#', 0x23 */
__dj_ISCNTRL, /* CTRL+V, 0x16 */ _PUNCT, /* `$', 0x24 */
__dj_ISCNTRL, /* CTRL+W, 0x17 */ _PUNCT, /* `%', 0x25 */
__dj_ISCNTRL, /* CTRL+X, 0x18 */ _PUNCT, /* `&', 0x26 */
__dj_ISCNTRL, /* CTRL+Y, 0x19 */ _PUNCT, /* 0x27 */
__dj_ISCNTRL, /* CTRL+Z, 0x1a */ _PUNCT, /* `(', 0x28 */
__dj_ISCNTRL, /* CTRL+[, 0x1b */ _PUNCT, /* `)', 0x29 */
__dj_ISCNTRL, /* CTRL+\, 0x1c */ _PUNCT, /* `*', 0x2a */
__dj_ISCNTRL, /* CTRL+], 0x1d */ _PUNCT, /* `+', 0x2b */
__dj_ISCNTRL, /* CTRL+^, 0x1e */ _PUNCT, /* `,', 0x2c */
__dj_ISCNTRL, /* CTRL+_, 0x1f */ _PUNCT, /* `-', 0x2d */
__dj_ISPRINT | __dj_ISSPACE, /* ` ', 0x20 */ _PUNCT, /* `.', 0x2e */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `!', 0x21 */ _PUNCT, /* `/', 0x2f */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* 0x22 */ _DIGIT | _HEX, /* `0', 0x30 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `#', 0x23 */ _DIGIT | _HEX, /* `1', 0x31 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `$', 0x24 */ _DIGIT | _HEX, /* `2', 0x32 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `%', 0x25 */ _DIGIT | _HEX, /* `3', 0x33 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `&', 0x26 */ _DIGIT | _HEX, /* `4', 0x34 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* 0x27 */ _DIGIT | _HEX, /* `5', 0x35 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `(', 0x28 */ _DIGIT | _HEX, /* `6', 0x36 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `)', 0x29 */ _DIGIT | _HEX, /* `7', 0x37 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `*', 0x2a */ _DIGIT | _HEX, /* `8', 0x38 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `+', 0x2b */ _DIGIT | _HEX, /* `9', 0x39 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `,', 0x2c */ _PUNCT, /* `:', 0x3a */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `-', 0x2d */ _PUNCT, /* `;', 0x3b */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `.', 0x2e */ _PUNCT, /* `<', 0x3c */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `/', 0x2f */ _PUNCT, /* `=', 0x3d */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `0', 0x30 */ _PUNCT, /* `>', 0x3e */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `1', 0x31 */ _PUNCT, /* `?', 0x3f */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `2', 0x32 */ _PUNCT, /* `@', 0x40 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `3', 0x33 */ _UPPER | _HEX, /* `A', 0x41 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `4', 0x34 */ _UPPER | _HEX, /* `B', 0x42 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `5', 0x35 */ _UPPER | _HEX, /* `C', 0x43 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `6', 0x36 */ _UPPER | _HEX, /* `D', 0x44 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `7', 0x37 */ _UPPER | _HEX, /* `E', 0x45 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `8', 0x38 */ _UPPER | _HEX, /* `F', 0x46 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `9', 0x39 */ _UPPER, /* `G', 0x47 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `:', 0x3a */ _UPPER, /* `H', 0x48 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `;', 0x3b */ _UPPER, /* `I', 0x49 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `<', 0x3c */ _UPPER, /* `J', 0x4a */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `=', 0x3d */ _UPPER, /* `K', 0x4b */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `>', 0x3e */ _UPPER, /* `L', 0x4c */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `?', 0x3f */ _UPPER, /* `M', 0x4d */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `@', 0x40 */ _UPPER, /* `N', 0x4e */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `A', 0x41 */ _UPPER, /* `O', 0x4f */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `B', 0x42 */ _UPPER, /* `P', 0x50 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `C', 0x43 */ _UPPER, /* `Q', 0x51 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `D', 0x44 */ _UPPER, /* `R', 0x52 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `E', 0x45 */ _UPPER, /* `S', 0x53 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `F', 0x46 */ _UPPER, /* `T', 0x54 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `G', 0x47 */ _UPPER, /* `U', 0x55 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `H', 0x48 */ _UPPER, /* `V', 0x56 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `I', 0x49 */ _UPPER, /* `W', 0x57 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `J', 0x4a */ _UPPER, /* `X', 0x58 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `K', 0x4b */ _UPPER, /* `Y', 0x59 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `L', 0x4c */ _UPPER, /* `Z', 0x5a */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `M', 0x4d */ _PUNCT, /* `[', 0x5b */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `N', 0x4e */ _PUNCT, /* 0x5c */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `O', 0x4f */ _PUNCT, /* `]', 0x5d */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `P', 0x50 */ _PUNCT, /* `^', 0x5e */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Q', 0x51 */ _PUNCT, /* `_', 0x5f */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `R', 0x52 */ _PUNCT, /* 0x60 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `S', 0x53 */ _LOWER | _HEX, /* `a', 0x61 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `T', 0x54 */ _LOWER | _HEX, /* `b', 0x62 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `U', 0x55 */ _LOWER | _HEX, /* `c', 0x63 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `V', 0x56 */ _LOWER | _HEX, /* `d', 0x64 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `W', 0x57 */ _LOWER | _HEX, /* `e', 0x65 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `X', 0x58 */ _LOWER | _HEX, /* `f', 0x66 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Y', 0x59 */ _LOWER, /* `g', 0x67 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Z', 0x5a */ _LOWER, /* `h', 0x68 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `[', 0x5b */ _LOWER, /* `i', 0x69 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* 0x5c */ _LOWER, /* `j', 0x6a */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `]', 0x5d */ _LOWER, /* `k', 0x6b */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `^', 0x5e */ _LOWER, /* `l', 0x6c */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `_', 0x5f */ _LOWER, /* `m', 0x6d */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* 0x60 */ _LOWER, /* `n', 0x6e */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `a', 0x61 */ _LOWER, /* `o', 0x6f */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `b', 0x62 */ _LOWER, /* `p', 0x70 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `c', 0x63 */ _LOWER, /* `q', 0x71 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `d', 0x64 */ _LOWER, /* `r', 0x72 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `e', 0x65 */ _LOWER, /* `s', 0x73 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `f', 0x66 */ _LOWER, /* `t', 0x74 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `g', 0x67 */ _LOWER, /* `u', 0x75 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `h', 0x68 */ _LOWER, /* `v', 0x76 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `i', 0x69 */ _LOWER, /* `w', 0x77 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `j', 0x6a */ _LOWER, /* `x', 0x78 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `k', 0x6b */ _LOWER, /* `y', 0x79 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `l', 0x6c */ _LOWER, /* `z', 0x7a */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `m', 0x6d */ _PUNCT, /* `{', 0x7b */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `n', 0x6e */ _PUNCT, /* `|', 0x7c */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `o', 0x6f */ _PUNCT, /* `}', 0x7d */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `p', 0x70 */ _PUNCT, /* `~', 0x7e */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `q', 0x71 */ _CONTROL, /* 0x7f */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `r', 0x72 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `s', 0x73 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `t', 0x74 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `u', 0x75 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `v', 0x76 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `w', 0x77 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `x', 0x78 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `y', 0x79 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `z', 0x7a */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `{', 0x7b */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `|', 0x7c */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `}', 0x7d */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `~', 0x7e */
__dj_ISCNTRL, /* 0x7f */
0, /* 0x80 */ 0, /* 0x80 */
0, /* 0x81 */ 0, /* 0x81 */
0, /* 0x82 */ 0, /* 0x82 */
@ -272,29 +258,26 @@ unsigned short _pctype_dll[] = {
0, /* 0xfc */ 0, /* 0xfc */
0, /* 0xfd */ 0, /* 0xfd */
0, /* 0xfe */ 0, /* 0xfe */
0, /* 0xff */ 0 /* 0xff */
}; };
unsigned short *_ctype = _pctype_dll -1; // unused unsigned short *_pctype_dll = _ctype + 1;
unsigned short *_pwctype_dll = _pctype_dll; unsigned short *_pwctype_dll = _ctype + 1;
int _isctype (unsigned int c, int ctypeFlags) int _isctype (unsigned int c, int ctypeFlags)
{ {
return (_pctype_dll[(unsigned char)(c & 0xFF)] & ctypeFlags);
return ((_pctype_dll[(unsigned char)(c & 0xFF)]&ctypeFlags) == ctypeFlags );
} }
int iswctype(wint_t wc, wctype_t wctypeFlags) int iswctype(wint_t wc, wctype_t wctypeFlags)
{ {
return (_pwctype_dll[(unsigned char)(wc & 0xFF)] & wctypeFlags);
return ((_pwctype_dll[(unsigned char)(wc & 0xFF)]&wctypeFlags) == wctypeFlags );
} }
// obsolete // obsolete
int is_wctype(wint_t wc, wctype_t wctypeFlags) int is_wctype(wint_t wc, wctype_t wctypeFlags)
{ {
return (_pwctype_dll[(unsigned char)(wc & 0xFF)] & wctypeFlags);
return ((_pwctype_dll[(unsigned char)(wc & 0xFF)]&wctypeFlags) == wctypeFlags );
} }
/* EOF */

View file

@ -4,11 +4,11 @@
#undef isgraph #undef isgraph
int isgraph(int c) int isgraph(int c)
{ {
return _isctype(c,_GRAPH); return _isctype(c,_PUNCT | _ALPHA | _DIGIT);
} }
#undef iswgraph #undef iswgraph
int iswgraph(wint_t c) int iswgraph(wint_t c)
{ {
return iswctype(c,_GRAPH); return iswctype(c,_PUNCT | _ALPHA | _DIGIT);
} }

View file

@ -4,10 +4,10 @@
#undef isprint #undef isprint
int isprint(int c) int isprint(int c)
{ {
return _isctype(c,_PRINT); return _isctype(c,_BLANK | _PUNCT | _ALPHA | _DIGIT);
} }
int iswprint(wint_t c) int iswprint(wint_t c)
{ {
return iswctype((unsigned short)c,_PRINT); return iswctype((unsigned short)c,_BLANK | _PUNCT | _ALPHA | _DIGIT);
} }

View file

@ -1,24 +1,34 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <crtdll/ctype.h> #include <crtdll/ctype.h>
#undef tolower #undef tolower
int tolower(int c) int tolower(int c)
{ {
return (c >= 'A' && c <= 'Z') ? c - ( 'A' - 'a' ) : c; if (_isctype (c, _UPPER))
return (c - ('A' - 'a'));
return(c);
} }
#undef towlower #undef towlower
wchar_t towlower(wchar_t c) wchar_t towlower(wchar_t c)
{ {
return (c >= 'A' && c <= 'Z') ? c - ( 'A' - 'a' ) : c; if (iswctype (c, _UPPER))
return (c - (L'A' - L'a'));
return(c);
} }
int _tolower(int c) int _tolower(int c)
{ {
return (c >= 'A' && c <= 'Z') ? c - ( 'A' - 'a' ) : c; if (_isctype (c, _UPPER))
return (c - ('A' - 'a'));
return(c);
} }
wchar_t _towlower(wchar_t c) wchar_t _towlower(wchar_t c)
{ {
return (c >= 'A' && c <= 'Z') ? c - ( 'A' - 'a' ) : c; if (iswctype (c, _UPPER))
return (c - (L'A' - L'a'));
return(c);
} }

View file

@ -5,20 +5,29 @@
#undef toupper #undef toupper
int toupper(int c) int toupper(int c)
{ {
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c; if (_isctype (c, _LOWER))
return (c + ('A' - 'a'));
return(c);
} }
#undef towupper #undef towupper
wchar_t towupper(wchar_t c) wchar_t towupper(wchar_t c)
{ {
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c; if (iswctype (c, _LOWER))
return (c + (L'A' - L'a'));
return(c);
} }
int _toupper(int c) int _toupper(int c)
{ {
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c; if (_isctype (c, _LOWER))
return (c + ('A' - 'a'));
return(c);
} }
wchar_t _towupper(wchar_t c) wchar_t _towupper(wchar_t c)
{ {
return (c >= 'a' && c <= 'z') ? c + 'A' - 'a' : c; if (iswctype (c, _LOWER))
return (c + (L'A' - L'a'));
return(c);
} }