Annotation of 43BSD/contrib/icon/tran/char.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Macros for determining character type.
                      3:  *
                      4:  * The table chrtype (in char.c) classifies each character
                      5:  *  in one of the categories defined below.
                      6:  */
                      7: 
                      8: #define _S      01             /* space */
                      9: #define _U      02             /* upper case */
                     10: #define _L      04             /* lower case */
                     11: #define _A     010             /* other alphabetic (e.g. "_") */
                     12: #define _N     020             /* digit */
                     13: 
                     14: #define _UL    (_U | _L)       /* letter */
                     15: #define _ULA   (_UL | _A)      /* alphabetic */
                     16: #define _ULAN  (_ULA | _N)     /* alphanumeric */
                     17: 
                     18: #define isspace(c)     (chrtype[c] & _S) 
                     19: #define isupper(c)     (chrtype[c] & _U) 
                     20: #define islower(c)     (chrtype[c] & _L) 
                     21: #define isletter(c)    (chrtype[c] & _UL) 
                     22: #define isalpha(c)     (chrtype[c] & _ULA) 
                     23: #define isdigit(c)     (chrtype[c] & _N) 
                     24: #define isalnum(c)     (chrtype[c] & _ULAN) 
                     25: 
                     26: #define toupper(c)     (islower(c)? (c - ('a'-'A')) : c) 
                     27: #define tolower(c)     (isupper(c)? (c + ('a'-'A')) : c) 
                     28: #define tonum(c)       (isdigit(c)? (c - '0') : ((c & 037) + 9)) 
                     29: 
                     30: extern char chrtype[];

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.