PM_PROC_NR shouldn't be hardcoded as the caller.
[minix.git] / include / ctype.h
blobf9d16e1fa8e53d71425e9262016cb1b00ff28769
1 /* The <ctype.h> header file defines some macros used to identify characters.
2 * It works by using a table stored in chartab.c. When a character is presented
3 * to one of these macros, the character is used as an index into the table
4 * (__ctype) to retrieve a byte. The relevant bit is then extracted.
5 */
7 #ifndef _CTYPE_H
8 #define _CTYPE_H
10 #ifndef _ANSI_H
11 #include <ansi.h>
12 #endif
14 extern char __ctype[]; /* property array defined in chartab.c */
16 #define _U 0x01 /* this bit is for upper-case letters [A-Z] */
17 #define _L 0x02 /* this bit is for lower-case letters [a-z] */
18 #define _N 0x04 /* this bit is for numbers [0-9] */
19 #define _S 0x08 /* this bit is for white space \t \n \f etc */
20 #define _P 0x10 /* this bit is for punctuation characters */
21 #define _C 0x20 /* this bit is for control characters */
22 #define _X 0x40 /* this bit is for hex digits [a-f] and [A-F]*/
24 /* Function Prototypes (have to go before the macros). */
25 _PROTOTYPE( int isalnum, (int _c) ); /* alphanumeric [a-z], [A-Z], [0-9] */
26 _PROTOTYPE( int isalpha, (int _c) ); /* alphabetic */
27 _PROTOTYPE( int iscntrl, (int _c) ); /* control characters */
28 _PROTOTYPE( int isdigit, (int _c) ); /* digit [0-9] */
29 _PROTOTYPE( int isgraph, (int _c) ); /* graphic character */
30 _PROTOTYPE( int islower, (int _c) ); /* lower-case letter [a-z] */
31 _PROTOTYPE( int isprint, (int _c) ); /* printable character */
32 _PROTOTYPE( int ispunct, (int _c) ); /* punctuation mark */
33 _PROTOTYPE( int isspace, (int _c) ); /* white space sp, \f, \n, \r, \t, \v*/
34 _PROTOTYPE( int isupper, (int _c) ); /* upper-case letter [A-Z] */
35 _PROTOTYPE( int isxdigit,(int _c) ); /* hex digit [0-9], [a-f], [A-F] */
36 _PROTOTYPE( int tolower, (int _c) ); /* convert to lower-case */
37 _PROTOTYPE( int toupper, (int _c) ); /* convert to upper-case */
38 _PROTOTYPE( int toascii, (int _c) ); /* convert to 7-bit ASCII */
40 /* Macros for identifying character classes. */
41 #define isalnum(c) ((__ctype+1)[c]&(_U|_L|_N))
42 #define isalpha(c) ((__ctype+1)[c]&(_U|_L))
43 #define iscntrl(c) ((__ctype+1)[c]&_C)
44 #define isgraph(c) ((__ctype+1)[c]&(_P|_U|_L|_N))
45 #define ispunct(c) ((__ctype+1)[c]&_P)
46 #define isspace(c) ((__ctype+1)[c]&_S)
47 #define isxdigit(c) ((__ctype+1)[c]&(_N|_X))
49 #define isdigit(c) ((unsigned) ((c)-'0') < 10)
50 #define islower(c) ((unsigned) ((c)-'a') < 26)
51 #define isupper(c) ((unsigned) ((c)-'A') < 26)
52 #define isprint(c) ((unsigned) ((c)-' ') < 95)
53 #define isascii(c) ((unsigned) (c) < 128)
55 #define toascii(c) ((c) & 0x7f)
57 #endif /* _CTYPE_H */