libc

A portable C Library
Log | Files | Refs | README

ctype.h (1157B)


      1 #ifndef _CTYPE
      2 #define _CTYPE
      3 
      4 #define _XA	0x200
      5 #define _XS	0x100
      6 #define _BB	0x80
      7 #define _CN	0x40
      8 #define _DI	0x20
      9 #define _LO	0x10
     10 #define _PU	0x08
     11 #define _SP	0x04
     12 #define _UP	0x02
     13 #define _XD	0x01
     14 
     15 extern const short *_Ctype;
     16 extern const short *_Tolower;
     17 extern const short *_Toupper;
     18 
     19 int isalnum(int), isalpha(int), iscntrl(int), isdigit(int);
     20 int isgraph(int), islower(int), isprint(int), ispunct(int);
     21 int isspace(int), isupper(int), isxdigit(int);
     22 int tolower(int), toupper(int);
     23 
     24 #define isalnum(c) (_Ctype[(int) (c)] & (_DI|_LO|_UP|_XA))
     25 #define isalpha(c) (_Ctype[(int) (c)] & (_LO|_UP|_XA))
     26 #define iscntrl(c) (_Ctype[(int) (c)] & (_BB|_CN))
     27 #define isdigit(c) (_Ctype[(int) (c)] & _DI)
     28 #define isgraph(c) (_Ctype[(int) (c)] & (_DI|_LO|_PU|_UP|_XA))
     29 #define islower(c) (_Ctype[(int) (c)] & _LO)
     30 #define isprint(c) \
     31 	(_Ctype[(int) (c)] & (_DI|_LO|_PU|_SP|_UP|_XA))
     32 #define ispunct(c) (_Ctype[(int) (c)] & _PU)
     33 #define isspace(c) (_Ctype[(int) (c)] & (_CN|_SP|_XS))
     34 #define isupper(c) (_Ctype[(int) (c)] & _UP)
     35 #define isxdigit(c) (_Ctype[(int) (c)] & _XD)
     36 #define tolower(c) _Tolower[(int) (c)]
     37 #define toupper(c) _Toupper[(int) (c)]
     38 #endif