aboutsummaryrefslogtreecommitdiffstats
path: root/myctype.h
blob: 512e6e8123d45753cf0a383ddfedb5c74a3c0ff9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef _MYCTYPE_H
#define _MYCTYPE_H

#define MYCTYPE_CNTRL 1
#define MYCTYPE_SPACE 2
#define MYCTYPE_ALPHA 4
#define MYCTYPE_DIGIT 8
#define MYCTYPE_PRINT 16
#define MYCTYPE_ALNUM (MYCTYPE_ALPHA|MYCTYPE_DIGIT)

#define GET_MYCTYPE(x) (MYCTYPE_MAP[(int)(unsigned char)(x)])

#define IS_CNTRL(x) (GET_MYCTYPE(x) & MYCTYPE_CNTRL)
#define IS_SPACE(x) (GET_MYCTYPE(x) & MYCTYPE_SPACE)
#define IS_ALPHA(x) (GET_MYCTYPE(x) & MYCTYPE_ALPHA)
#define IS_DIGIT(x) (GET_MYCTYPE(x) & MYCTYPE_DIGIT)
#define IS_PRINT(x) (GET_MYCTYPE(x) & MYCTYPE_PRINT)
#define IS_ALNUM(x) (GET_MYCTYPE(x) & MYCTYPE_ALNUM)

extern unsigned char MYCTYPE_MAP[];


#define INTCTYPE_ASCII   1
#define INTCTYPE_ISPACE  2
#define INTCTYPE_LATIN1  4
#define INTCTYPE_KANJI1  8
#define INTCTYPE_KANJI2  16
#define INTCTYPE_KANJI   (INTCTYPE_KANJI1|INTCTYPE_KANJI2)
#define INTCTYPE_INTRL   INTCTYPE_ISPACE

#define GET_INTCTYPE(x)  (INTCTYPE_MAP[(int)(unsigned char)(x)])

#define IS_ASCII(x)     (GET_INTCTYPE(x) & INTCTYPE_ASCII)
#define IS_INTSPACE(x)  (GET_INTCTYPE(x) & INTCTYPE_ISPACE)
#define IS_INTERNAL(x)  (GET_INTCTYPE(x) & INTCTYPE_INTRL)
#define IS_KANJI1(x)    (GET_INTCTYPE(x) & INTCTYPE_KANJI1)
#define IS_KANJI2(x)    (GET_INTCTYPE(x) & INTCTYPE_KANJI2)
#define IS_KANJI(x)     (GET_INTCTYPE(x) & INTCTYPE_KANJI)
#define IS_LATIN1(x)    (GET_INTCTYPE(x) & INTCTYPE_LATIN1)

extern unsigned char INTCTYPE_MAP[];

#include <ctype.h>

#endif