mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed ctype table.
svn path=/trunk/; revision=917
This commit is contained in:
parent
e6b5c8bfc7
commit
57919a833e
1 changed files with 274 additions and 275 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: ctype.c,v 1.5 1999/12/29 17:13:14 ekohl Exp $
|
||||
/* $Id: ctype.c,v 1.6 2000/01/05 17:49:00 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -13,13 +13,12 @@
|
|||
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
#define upalpha ('A' - 'a')
|
||||
|
||||
#define _GRAPH 0x0200
|
||||
#define _PRINT 0x0400
|
||||
|
||||
|
||||
unsigned short _pctype_dll[] = {
|
||||
unsigned short _ctype[] = {
|
||||
0, /* <EOF>, 0xFFFF */
|
||||
_CONTROL, /* CTRL+@, 0x00 */
|
||||
_CONTROL, /* CTRL+A, 0x01 */
|
||||
_CONTROL, /* CTRL+B, 0x02 */
|
||||
|
@ -52,101 +51,101 @@ unsigned short _pctype_dll[] = {
|
|||
_CONTROL, /* CTRL+], 0x1d */
|
||||
_CONTROL, /* CTRL+^, 0x1e */
|
||||
_CONTROL, /* CTRL+_, 0x1f */
|
||||
_PRINT | _SPACE, /* ` ', 0x20 */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `!', 0x21 */
|
||||
_GRAPH | _PRINT | _PUNCT, /* 0x22 */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `#', 0x23 */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `$', 0x24 */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `%', 0x25 */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `&', 0x26 */
|
||||
_GRAPH | _PRINT | _PUNCT, /* 0x27 */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `(', 0x28 */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `)', 0x29 */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `*', 0x2a */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `+', 0x2b */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `,', 0x2c */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `-', 0x2d */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `.', 0x2e */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `/', 0x2f */
|
||||
_DIGIT | _GRAPH | _PRINT | _HEX, /* `0', 0x30 */
|
||||
_DIGIT | _GRAPH | _PRINT | _HEX, /* `1', 0x31 */
|
||||
_DIGIT | _GRAPH | _PRINT | _HEX, /* `2', 0x32 */
|
||||
_DIGIT | _GRAPH | _PRINT | _HEX, /* `3', 0x33 */
|
||||
_DIGIT | _GRAPH | _PRINT | _HEX, /* `4', 0x34 */
|
||||
_DIGIT | _GRAPH | _PRINT | _HEX, /* `5', 0x35 */
|
||||
_DIGIT | _GRAPH | _PRINT | _HEX, /* `6', 0x36 */
|
||||
_DIGIT | _GRAPH | _PRINT | _HEX, /* `7', 0x37 */
|
||||
_DIGIT | _GRAPH | _PRINT | _HEX, /* `8', 0x38 */
|
||||
_DIGIT | _GRAPH | _PRINT | _HEX, /* `9', 0x39 */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `:', 0x3a */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `;', 0x3b */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `<', 0x3c */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `=', 0x3d */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `>', 0x3e */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `?', 0x3f */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `@', 0x40 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER | _HEX, /* `A', 0x41 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER | _HEX, /* `B', 0x42 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER | _HEX, /* `C', 0x43 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER | _HEX, /* `D', 0x44 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER | _HEX, /* `E', 0x45 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER | _HEX, /* `F', 0x46 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `G', 0x47 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `H', 0x48 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `I', 0x49 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `J', 0x4a */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `K', 0x4b */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `L', 0x4c */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `M', 0x4d */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `N', 0x4e */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `O', 0x4f */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `P', 0x50 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `Q', 0x51 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `R', 0x52 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `S', 0x53 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `T', 0x54 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `U', 0x55 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `V', 0x56 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `W', 0x57 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `X', 0x58 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `Y', 0x59 */
|
||||
_ALPHA | _GRAPH | _PRINT | _UPPER, /* `Z', 0x5a */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `[', 0x5b */
|
||||
_GRAPH | _PRINT | _PUNCT, /* 0x5c */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `]', 0x5d */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `^', 0x5e */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `_', 0x5f */
|
||||
_GRAPH | _PRINT | _PUNCT, /* 0x60 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT | _HEX, /* `a', 0x61 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT | _HEX, /* `b', 0x62 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT | _HEX, /* `c', 0x63 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT | _HEX, /* `d', 0x64 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT | _HEX, /* `e', 0x65 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT | _HEX, /* `f', 0x66 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `g', 0x67 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `h', 0x68 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `i', 0x69 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `j', 0x6a */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `k', 0x6b */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `l', 0x6c */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `m', 0x6d */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `n', 0x6e */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `o', 0x6f */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `p', 0x70 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `q', 0x71 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `r', 0x72 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `s', 0x73 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `t', 0x74 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `u', 0x75 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `v', 0x76 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `w', 0x77 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `x', 0x78 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `y', 0x79 */
|
||||
_ALPHA | _GRAPH | _LOWER | _PRINT, /* `z', 0x7a */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `{', 0x7b */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `|', 0x7c */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `}', 0x7d */
|
||||
_GRAPH | _PRINT | _PUNCT, /* `~', 0x7e */
|
||||
_SPACE | _BLANK, /* ` ', 0x20 */
|
||||
_PUNCT, /* `!', 0x21 */
|
||||
_PUNCT, /* 0x22 */
|
||||
_PUNCT, /* `#', 0x23 */
|
||||
_PUNCT, /* `$', 0x24 */
|
||||
_PUNCT, /* `%', 0x25 */
|
||||
_PUNCT, /* `&', 0x26 */
|
||||
_PUNCT, /* 0x27 */
|
||||
_PUNCT, /* `(', 0x28 */
|
||||
_PUNCT, /* `)', 0x29 */
|
||||
_PUNCT, /* `*', 0x2a */
|
||||
_PUNCT, /* `+', 0x2b */
|
||||
_PUNCT, /* `,', 0x2c */
|
||||
_PUNCT, /* `-', 0x2d */
|
||||
_PUNCT, /* `.', 0x2e */
|
||||
_PUNCT, /* `/', 0x2f */
|
||||
_DIGIT | _HEX, /* `0', 0x30 */
|
||||
_DIGIT | _HEX, /* `1', 0x31 */
|
||||
_DIGIT | _HEX, /* `2', 0x32 */
|
||||
_DIGIT | _HEX, /* `3', 0x33 */
|
||||
_DIGIT | _HEX, /* `4', 0x34 */
|
||||
_DIGIT | _HEX, /* `5', 0x35 */
|
||||
_DIGIT | _HEX, /* `6', 0x36 */
|
||||
_DIGIT | _HEX, /* `7', 0x37 */
|
||||
_DIGIT | _HEX, /* `8', 0x38 */
|
||||
_DIGIT | _HEX, /* `9', 0x39 */
|
||||
_PUNCT, /* `:', 0x3a */
|
||||
_PUNCT, /* `;', 0x3b */
|
||||
_PUNCT, /* `<', 0x3c */
|
||||
_PUNCT, /* `=', 0x3d */
|
||||
_PUNCT, /* `>', 0x3e */
|
||||
_PUNCT, /* `?', 0x3f */
|
||||
_PUNCT, /* `@', 0x40 */
|
||||
_UPPER | _HEX, /* `A', 0x41 */
|
||||
_UPPER | _HEX, /* `B', 0x42 */
|
||||
_UPPER | _HEX, /* `C', 0x43 */
|
||||
_UPPER | _HEX, /* `D', 0x44 */
|
||||
_UPPER | _HEX, /* `E', 0x45 */
|
||||
_UPPER | _HEX, /* `F', 0x46 */
|
||||
_UPPER, /* `G', 0x47 */
|
||||
_UPPER, /* `H', 0x48 */
|
||||
_UPPER, /* `I', 0x49 */
|
||||
_UPPER, /* `J', 0x4a */
|
||||
_UPPER, /* `K', 0x4b */
|
||||
_UPPER, /* `L', 0x4c */
|
||||
_UPPER, /* `M', 0x4d */
|
||||
_UPPER, /* `N', 0x4e */
|
||||
_UPPER, /* `O', 0x4f */
|
||||
_UPPER, /* `P', 0x50 */
|
||||
_UPPER, /* `Q', 0x51 */
|
||||
_UPPER, /* `R', 0x52 */
|
||||
_UPPER, /* `S', 0x53 */
|
||||
_UPPER, /* `T', 0x54 */
|
||||
_UPPER, /* `U', 0x55 */
|
||||
_UPPER, /* `V', 0x56 */
|
||||
_UPPER, /* `W', 0x57 */
|
||||
_UPPER, /* `X', 0x58 */
|
||||
_UPPER, /* `Y', 0x59 */
|
||||
_UPPER, /* `Z', 0x5a */
|
||||
_PUNCT, /* `[', 0x5b */
|
||||
_PUNCT, /* 0x5c */
|
||||
_PUNCT, /* `]', 0x5d */
|
||||
_PUNCT, /* `^', 0x5e */
|
||||
_PUNCT, /* `_', 0x5f */
|
||||
_PUNCT, /* 0x60 */
|
||||
_LOWER | _HEX, /* `a', 0x61 */
|
||||
_LOWER | _HEX, /* `b', 0x62 */
|
||||
_LOWER | _HEX, /* `c', 0x63 */
|
||||
_LOWER | _HEX, /* `d', 0x64 */
|
||||
_LOWER | _HEX, /* `e', 0x65 */
|
||||
_LOWER | _HEX, /* `f', 0x66 */
|
||||
_LOWER, /* `g', 0x67 */
|
||||
_LOWER, /* `h', 0x68 */
|
||||
_LOWER, /* `i', 0x69 */
|
||||
_LOWER, /* `j', 0x6a */
|
||||
_LOWER, /* `k', 0x6b */
|
||||
_LOWER, /* `l', 0x6c */
|
||||
_LOWER, /* `m', 0x6d */
|
||||
_LOWER, /* `n', 0x6e */
|
||||
_LOWER, /* `o', 0x6f */
|
||||
_LOWER, /* `p', 0x70 */
|
||||
_LOWER, /* `q', 0x71 */
|
||||
_LOWER, /* `r', 0x72 */
|
||||
_LOWER, /* `s', 0x73 */
|
||||
_LOWER, /* `t', 0x74 */
|
||||
_LOWER, /* `u', 0x75 */
|
||||
_LOWER, /* `v', 0x76 */
|
||||
_LOWER, /* `w', 0x77 */
|
||||
_LOWER, /* `x', 0x78 */
|
||||
_LOWER, /* `y', 0x79 */
|
||||
_LOWER, /* `z', 0x7a */
|
||||
_PUNCT, /* `{', 0x7b */
|
||||
_PUNCT, /* `|', 0x7c */
|
||||
_PUNCT, /* `}', 0x7d */
|
||||
_PUNCT, /* `~', 0x7e */
|
||||
_CONTROL, /* 0x7f */
|
||||
0, /* 0x80 */
|
||||
0, /* 0x81 */
|
||||
|
@ -275,20 +274,20 @@ unsigned short _pctype_dll[] = {
|
|||
0, /* 0xfc */
|
||||
0, /* 0xfd */
|
||||
0, /* 0xfe */
|
||||
0, /* 0xff */
|
||||
0 /* 0xff */
|
||||
};
|
||||
|
||||
unsigned short *_pwctype_dll = _pctype_dll;
|
||||
|
||||
unsigned short *_pctype = _ctype + 1;
|
||||
unsigned short *_pwctype = _ctype + 1;
|
||||
|
||||
int _isctype (int c, int ctypeFlags)
|
||||
{
|
||||
return((_pctype_dll[(unsigned char)(c & 0xFF)]&ctypeFlags) == ctypeFlags);
|
||||
return (_pctype[(unsigned char)(c & 0xFF)] & ctypeFlags);
|
||||
}
|
||||
|
||||
int iswctype(wint_t wc, wctype_t wctypeFlags)
|
||||
{
|
||||
return((_pwctype_dll[(unsigned char)(wc & 0xFF)]&wctypeFlags) == wctypeFlags);
|
||||
return (_pwctype[(unsigned char)(wc & 0xFF)] & wctypeFlags);
|
||||
}
|
||||
|
||||
int isalpha(int c)
|
||||
|
@ -298,12 +297,12 @@ int isalpha(int c)
|
|||
|
||||
int isalnum(int c)
|
||||
{
|
||||
return(isalpha(c)||isdigit(c));
|
||||
return(_isctype(c, _ALPHA | _DIGIT));
|
||||
}
|
||||
|
||||
int __isascii(int c)
|
||||
{
|
||||
return(!((c)&(~0x7f)));
|
||||
return ((unsigned char)c <= 0x7f);
|
||||
}
|
||||
|
||||
int iscntrl(int c)
|
||||
|
@ -328,7 +327,7 @@ int isdigit(int c)
|
|||
|
||||
int isgraph(int c)
|
||||
{
|
||||
return(_isctype(c, _GRAPH));
|
||||
return (_isctype (c, _PUNCT | _ALPHA | _DIGIT));
|
||||
}
|
||||
|
||||
int islower(int c)
|
||||
|
@ -338,7 +337,7 @@ int islower(int c)
|
|||
|
||||
int isprint(int c)
|
||||
{
|
||||
return(_isctype(c, _PRINT));
|
||||
return (_isctype (c, _BLANK | _PUNCT | _ALPHA | _DIGIT));
|
||||
}
|
||||
|
||||
int ispunct(int c)
|
||||
|
|
Loading…
Reference in a new issue