1 /*
2  * "streamable kanji code filter and converter"
3  * Copyright (c) 1998-2002 HappySize, Inc. All rights reserved.
4  *
5  * LICENSE NOTICES
6  *
7  * This file is part of "streamable kanji code filter and converter",
8  * which is distributed under the terms of GNU Lesser General Public
9  * License (version 2) as published by the Free Software Foundation.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with "streamable kanji code filter and converter";
18  * if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19  * Suite 330, Boston, MA  02111-1307  USA
20  *
21  * The authors of this file: PHP3 Internationalization team
22  *
23  */
24 
25 /* character property table */
26 #define MBFL_CHP_CTL		0x01
27 #define MBFL_CHP_DIGIT		0x02
28 #define MBFL_CHP_UALPHA		0x04
29 #define MBFL_CHP_LALPHA		0x08
30 #define MBFL_CHP_MMHQENC	0x10	/* must Q-encoding in MIME Header encoded-word */
31 #define MBFL_CHP_MSPECIAL	0x20	/* RFC822 Special characters */
32 
33 /*
34  * Unicode table
35  */
36 
37 static const unsigned char mbfl_charprop_table[] = {
38 /* NUL	0 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC,
39 /* SCH	1 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
40 /* SIX	2 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
41 /* EIX	3 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
42 /* EOT	4 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
43 /* ENQ	5 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
44 /* ACK	6 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
45 /* BEL	7 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
46 /* BS	8 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
47 /* HI	9 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
48 /* LF	10 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
49 /* VI	11 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
50 /* FF	12 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
51 /* CR	13 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
52 /* SO	14 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
53 /* SI	15 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
54 /* SLE	16 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
55 /* CSI	17 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
56 /* DC2	18 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
57 /* DC3	19 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
58 /* DC4	20 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
59 /* NAK	21 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
60 /* SYN	22 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
61 /* EIB	23 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
62 /* CAN	24 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
63 /* EM	25 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
64 /* SLB	26 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
65 /* ESC	27 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
66 /* FS	28 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
67 /* GS	29 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
68 /* RS	30 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
69 /* US	31 */	MBFL_CHP_CTL | MBFL_CHP_MMHQENC ,
70 /* SP	32 */	MBFL_CHP_MMHQENC ,
71 /* !	33 */	0 ,
72 /* "	34 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
73 /* #	35 */	MBFL_CHP_MMHQENC ,
74 /* $	36 */	MBFL_CHP_MMHQENC ,
75 /* %	37 */	MBFL_CHP_MMHQENC ,
76 /* &	38 */	MBFL_CHP_MMHQENC ,
77 /* '	39 */	MBFL_CHP_MMHQENC ,
78 /* (	40 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
79 /* )	41 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
80 /* *	42 */	0 ,
81 /* +	43 */	0 ,
82 /* ,	44 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
83 /* -	45 */	0 ,
84 /* .	46 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
85 /* /	47 */	0 ,
86 /* 0	48 */	MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
87 /* 1	49 */	MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
88 /* 2	50 */	MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
89 /* 3	51 */	MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
90 /* 4	52 */	MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
91 /* 5	53 */	MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
92 /* 6	54 */	MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
93 /* 7	55 */	MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
94 /* 8	56 */	MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
95 /* 9	57 */	MBFL_CHP_DIGIT | MBFL_CHP_MMHQENC ,
96 /* :	58 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
97 /* ;	59 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
98 /* <	60 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
99 /* =	61 */	0 ,
100 /* >	62 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
101 /* ?	63 */	MBFL_CHP_MMHQENC ,
102 /* @	64 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
103 /* A	65 */	MBFL_CHP_UALPHA ,
104 /* B	66 */	MBFL_CHP_UALPHA ,
105 /* C	67 */	MBFL_CHP_UALPHA ,
106 /* D	68 */	MBFL_CHP_UALPHA ,
107 /* E	69 */	MBFL_CHP_UALPHA ,
108 /* F	70 */	MBFL_CHP_UALPHA ,
109 /* G	71 */	MBFL_CHP_UALPHA ,
110 /* H	72 */	MBFL_CHP_UALPHA ,
111 /* I	73 */	MBFL_CHP_UALPHA ,
112 /* J	74 */	MBFL_CHP_UALPHA ,
113 /* K	75 */	MBFL_CHP_UALPHA ,
114 /* L	76 */	MBFL_CHP_UALPHA ,
115 /* M	77 */	MBFL_CHP_UALPHA ,
116 /* N	78 */	MBFL_CHP_UALPHA ,
117 /* O	79 */	MBFL_CHP_UALPHA ,
118 /* P	80 */	MBFL_CHP_UALPHA ,
119 /* Q	81 */	MBFL_CHP_UALPHA ,
120 /* R	82 */	MBFL_CHP_UALPHA ,
121 /* S	83 */	MBFL_CHP_UALPHA ,
122 /* T	84 */	MBFL_CHP_UALPHA ,
123 /* U	85 */	MBFL_CHP_UALPHA ,
124 /* V	86 */	MBFL_CHP_UALPHA ,
125 /* W	87 */	MBFL_CHP_UALPHA ,
126 /* X	88 */	MBFL_CHP_UALPHA ,
127 /* Y	89 */	MBFL_CHP_UALPHA ,
128 /* Z	90 */	MBFL_CHP_UALPHA ,
129 /* [	91 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
130 /* \	92 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
131 /* ]	93 */	MBFL_CHP_MMHQENC | MBFL_CHP_MSPECIAL ,
132 /* ^	94 */	MBFL_CHP_MMHQENC ,
133 /* _	95 */	MBFL_CHP_MMHQENC ,
134 /* `	96 */	MBFL_CHP_MMHQENC ,
135 /* a	97 */	MBFL_CHP_LALPHA ,
136 /* b	98 */	MBFL_CHP_LALPHA ,
137 /* c	99 */	MBFL_CHP_LALPHA ,
138 /* d	100 */	MBFL_CHP_LALPHA ,
139 /* e	101 */	MBFL_CHP_LALPHA ,
140 /* f	102 */	MBFL_CHP_LALPHA ,
141 /* g	103 */	MBFL_CHP_LALPHA ,
142 /* h	104 */	MBFL_CHP_LALPHA ,
143 /* i	105 */	MBFL_CHP_LALPHA ,
144 /* j	106 */	MBFL_CHP_LALPHA ,
145 /* k	107 */	MBFL_CHP_LALPHA ,
146 /* l	108 */	MBFL_CHP_LALPHA ,
147 /* m	109 */	MBFL_CHP_LALPHA ,
148 /* n	110 */	MBFL_CHP_LALPHA ,
149 /* o	111 */	MBFL_CHP_LALPHA ,
150 /* p	112 */	MBFL_CHP_LALPHA ,
151 /* q	113 */	MBFL_CHP_LALPHA ,
152 /* r	114 */	MBFL_CHP_LALPHA ,
153 /* s	115 */	MBFL_CHP_LALPHA ,
154 /* t	116 */	MBFL_CHP_LALPHA ,
155 /* u	117 */	MBFL_CHP_LALPHA ,
156 /* v	118 */	MBFL_CHP_LALPHA ,
157 /* w	119 */	MBFL_CHP_LALPHA ,
158 /* x	120 */	MBFL_CHP_LALPHA ,
159 /* y	121 */	MBFL_CHP_LALPHA ,
160 /* z	122 */	MBFL_CHP_LALPHA ,
161 /* {	123 */	MBFL_CHP_MMHQENC ,
162 /* |	124 */	MBFL_CHP_MMHQENC ,
163 /* }	125 */	MBFL_CHP_MMHQENC ,
164 /* ~	126 */	MBFL_CHP_MMHQENC ,
165 /* DEL	127 */	MBFL_CHP_MMHQENC
166 };
167