w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

myctype.h (1205B)


      1 /* $Id$ */
      2 #ifndef _MYCTYPE_H
      3 #define _MYCTYPE_H
      4 
      5 #define MYCTYPE_CNTRL 1
      6 #define MYCTYPE_SPACE 2
      7 #define MYCTYPE_ALPHA 4
      8 #define MYCTYPE_DIGIT 8
      9 #define MYCTYPE_PRINT 16
     10 #define MYCTYPE_HEX   32
     11 #define MYCTYPE_INTSPACE 64
     12 #define MYCTYPE_ASCII (MYCTYPE_CNTRL|MYCTYPE_PRINT)
     13 #define MYCTYPE_ALNUM (MYCTYPE_ALPHA|MYCTYPE_DIGIT)
     14 #define MYCTYPE_XDIGIT (MYCTYPE_HEX|MYCTYPE_DIGIT)
     15 
     16 #define GET_MYCTYPE(x) (MYCTYPE_MAP[(int)(unsigned char)(x)])
     17 #define GET_MYCDIGIT(x) (MYCTYPE_DIGITMAP[(int)(unsigned char)(x)])
     18 
     19 #define IS_CNTRL(x) (GET_MYCTYPE(x) & MYCTYPE_CNTRL)
     20 #define IS_SPACE(x) (GET_MYCTYPE(x) & MYCTYPE_SPACE)
     21 #define IS_ALPHA(x) (GET_MYCTYPE(x) & MYCTYPE_ALPHA)
     22 #define IS_DIGIT(x) (GET_MYCTYPE(x) & MYCTYPE_DIGIT)
     23 #define IS_PRINT(x) (GET_MYCTYPE(x) & MYCTYPE_PRINT)
     24 #define IS_ASCII(x) (GET_MYCTYPE(x) & MYCTYPE_ASCII)
     25 #define IS_ALNUM(x) (GET_MYCTYPE(x) & MYCTYPE_ALNUM)
     26 #define IS_XDIGIT(x) (GET_MYCTYPE(x) & MYCTYPE_XDIGIT)
     27 #define IS_INTSPACE(x) (MYCTYPE_MAP[(unsigned char)(x)] & MYCTYPE_INTSPACE)
     28 
     29 extern unsigned char MYCTYPE_MAP[];
     30 extern unsigned char MYCTYPE_DIGITMAP[];
     31 
     32 #define	TOLOWER(x)	(IS_ALPHA(x) ? ((x)|0x20) : (x))
     33 #define	TOUPPER(x)	(IS_ALPHA(x) ? ((x)&~0x20) : (x))
     34 
     35 #endif