scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

ctype.h (1325B)


      1 #ifndef _CTYPE_H
      2 #define _CTYPE_H
      3 
      4 extern int isalnum(int c);
      5 extern int isalpha(int c);
      6 extern int islower(int c);
      7 extern int isupper(int c);
      8 extern int isdigit(int c);
      9 extern int isxdigit(int c);
     10 extern int iscntrl(int c);
     11 extern int isgraph(int c);
     12 extern int isspace(int c);
     13 extern int isblank(int c);
     14 extern int isprint(int c);
     15 extern int ispunct(int c);
     16 extern int tolower(int c);
     17 extern int toupper(int c);
     18 
     19 
     20 #define _U	0x01	/* upper */
     21 #define _L	0x02	/* lower */
     22 #define _D	0x04	/* digit */
     23 #define _C	0x08	/* cntrl */
     24 #define _P	0x10	/* punct */
     25 #define _S	0x20	/* white space (space/lf/tab) */
     26 #define _X	0x40	/* hex char */
     27 #define _SP	0x80	/* hard space (0x20) */
     28 
     29 extern const unsigned char __ctype[];
     30 
     31 #define isalnum(c)  ((__ctype+1)[c] & (_U|_L|_D))
     32 #define isalpha(c)  ((__ctype+1)[c] & (_U|_L))
     33 #define iscntrl(c)  ((__ctype+1)[c] & (_C))
     34 #define isdigit(c)  ((__ctype+1)[c] & (_D))
     35 #define isgraph(c)  ((__ctype+1)[c] & (_P|_U|_L|_D))
     36 #define islower(c)  ((__ctype+1)[c] & (_L))
     37 #define isprint(c)  ((__ctype+1)[c] & (_P|_U|_L|_D|_SP))
     38 #define ispunct(c)  ((__ctype+1)[c] & (_P))
     39 #define isspace(c)  ((__ctype+1)[c] & (_S))
     40 #define isupper(c)  ((__ctype+1)[c] & (_U))
     41 #define isxdigit(c) ((__ctype+1)[c] & (_D|_X))
     42 
     43 #define isascii(c) ((unsigned)(c)<=0x7f)
     44 #define toascii(c) ((unsigned)(c)&0x7f)
     45 
     46 #endif