blob: c65d021c2eb2bc70ce5b56815c23fe5a089e6d74 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/***
*ctype.h - character conversion macros and ctype macros
*
* Copyright (c) 1985-1988, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Defines macros for character classification/conversion.
* [ANSI/System V]
*
*******************************************************************************/
#ifndef NO_EXT_KEYS /* extensions enabled */
#define _CDECL cdecl
#define _NEAR near
#else /* extensions not enabled */
#define _CDECL
#define _NEAR
#endif /* NO_EXT_KEYS */
/*
* This declaration allows the user access to the ctype look-up
* array _ctype defined in ctype.obj by simply including ctype.h
*/
extern unsigned char _NEAR _CDECL _ctype[];
/* set bit masks for the possible character types */
#define _UPPER 0x1 /* upper case letter */
#define _LOWER 0x2 /* lower case letter */
#define _DIGIT 0x4 /* digit[0-9] */
#define _SPACE 0x8 /* tab, carriage return, newline, */
/* vertical tab or form feed */
#define _PUNCT 0x10 /* punctuation character */
#define _CONTROL 0x20 /* control character */
#define _BLANK 0x40 /* space char */
#define _HEX 0x80 /* hexadecimal digit */
/* the character classification macro definitions */
#define isalpha(c) ( (_ctype+1)[c] & (_UPPER|_LOWER) )
#define isupper(c) ( (_ctype+1)[c] & _UPPER )
#define islower(c) ( (_ctype+1)[c] & _LOWER )
#define isdigit(c) ( (_ctype+1)[c] & _DIGIT )
#define isxdigit(c) ( (_ctype+1)[c] & _HEX )
#define isspace(c) ( (_ctype+1)[c] & _SPACE )
#define ispunct(c) ( (_ctype+1)[c] & _PUNCT )
#define isalnum(c) ( (_ctype+1)[c] & (_UPPER|_LOWER|_DIGIT) )
#define isprint(c) ( (_ctype+1)[c] & (_BLANK|_PUNCT|_UPPER|_LOWER|_DIGIT) )
#define isgraph(c) ( (_ctype+1)[c] & (_PUNCT|_UPPER|_LOWER|_DIGIT) )
#define iscntrl(c) ( (_ctype+1)[c] & _CONTROL )
#define toupper(c) ( (islower(c)) ? _toupper(c) : (c) )
#define tolower(c) ( (isupper(c)) ? _tolower(c) : (c) )
#define _tolower(c) ( (c)-'A'+'a' )
#define _toupper(c) ( (c)-'a'+'A' )
#define isascii(c) ( (unsigned)(c) < 0x80 )
#define toascii(c) ( (c) & 0x7f )
/* MS C version 2.0 extended ctype macros */
#define iscsymf(c) (isalpha(c) || ((c) == '_'))
#define iscsym(c) (isalnum(c) || ((c) == '_'))
|