7#include "nsCodingStateMachine.h"
9namespace kencodingprober
11static const unsigned int HZ_cls[256 / 8] = {
12 PCK4BITS(1, 0, 0, 0, 0, 0, 0, 0),
13 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
14 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
15 PCK4BITS(0, 0, 0, 1, 0, 0, 0, 0),
16 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
17 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
18 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
19 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
20 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
21 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
22 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
23 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
24 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
25 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
26 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
27 PCK4BITS(0, 0, 0, 4, 0, 5, 2, 0),
28 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
29 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
30 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
31 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
32 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
33 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
34 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
35 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
36 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
37 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
38 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
39 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
40 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
41 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
42 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1),
43 PCK4BITS(1, 1, 1, 1, 1, 1, 1, 1)
46static const unsigned int HZ_st[6] = {
47 PCK4BITS(eStart, eError, 3, eStart, eStart, eStart, eError, eError),
48 PCK4BITS(eError, eError, eError, eError, eItsMe, eItsMe, eItsMe, eItsMe),
49 PCK4BITS(eItsMe, eItsMe, eError, eError, eStart, eStart, 4, eError),
50 PCK4BITS(5, eError, 6, eError, 5, 5, 4, eError),
51 PCK4BITS(4, eError, 4, 4, 4, eError, 4, eError),
52 PCK4BITS(4, eItsMe, eStart, eStart, eStart, eStart, eStart, eStart)
55static const unsigned int HZCharLenTable[] = {0, 0, 0, 0, 0, 0};
57const SMModel HZSMModel = {
58 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_cls},
60 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_st},
65static const unsigned int ISO2022CN_cls[256 / 8] = {
66 PCK4BITS(2, 0, 0, 0, 0, 0, 0, 0),
67 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
68 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
69 PCK4BITS(0, 0, 0, 1, 0, 0, 0, 0),
70 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
71 PCK4BITS(0, 3, 0, 0, 0, 0, 0, 0),
72 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
73 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
74 PCK4BITS(0, 0, 0, 4, 0, 0, 0, 0),
75 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
76 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
77 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
78 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
79 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
80 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
81 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
82 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
83 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
84 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
85 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
86 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
87 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
88 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
89 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
90 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
91 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
92 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
93 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
94 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
95 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
96 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
97 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2)
100static const unsigned int ISO2022CN_st[8] = {
101 PCK4BITS(eStart, 3, eError, eStart, eStart, eStart, eStart, eStart),
102 PCK4BITS(eStart, eError, eError, eError, eError, eError, eError, eError),
103 PCK4BITS(eError, eError, eItsMe, eItsMe, eItsMe, eItsMe, eItsMe, eItsMe),
104 PCK4BITS(eItsMe, eItsMe, eItsMe, eError, eError, eError, 4, eError),
105 PCK4BITS(eError, eError, eError, eItsMe, eError, eError, eError, eError),
106 PCK4BITS(5, 6, eError, eError, eError, eError, eError, eError),
107 PCK4BITS(eError, eError, eError, eItsMe, eError, eError, eError, eError),
108 PCK4BITS(eError, eError, eError, eError, eError, eItsMe, eError, eStart)
111static const unsigned int ISO2022CNCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
113const SMModel ISO2022CNSMModel = {
114 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_cls},
116 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_st},
117 ISO2022CNCharLenTable,
121static const unsigned int ISO2022JP_cls[256 / 8] = {
122 PCK4BITS(2, 0, 0, 0, 0, 0, 0, 0),
123 PCK4BITS(0, 0, 0, 0, 0, 0, 2, 2),
124 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
125 PCK4BITS(0, 0, 0, 1, 0, 0, 0, 0),
126 PCK4BITS(0, 0, 0, 0, 7, 0, 0, 0),
127 PCK4BITS(3, 0, 0, 0, 0, 0, 0, 0),
128 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
129 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
130 PCK4BITS(6, 0, 4, 0, 8, 0, 0, 0),
131 PCK4BITS(0, 9, 5, 0, 0, 0, 0, 0),
132 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
133 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
134 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
135 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
136 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
137 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
138 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
139 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
140 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
141 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
142 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
143 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
144 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
145 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
146 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
147 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
148 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
149 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
150 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
151 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
152 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
153 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2)
156static const unsigned int ISO2022JP_st[9] = {
157 PCK4BITS(eStart, 3, eError, eStart, eStart, eStart, eStart, eStart),
158 PCK4BITS(eStart, eStart, eError, eError, eError, eError, eError, eError),
159 PCK4BITS(eError, eError, eError, eError, eItsMe, eItsMe, eItsMe, eItsMe),
160 PCK4BITS(eItsMe, eItsMe, eItsMe, eItsMe, eItsMe, eItsMe, eError, eError),
161 PCK4BITS(eError, 5, eError, eError, eError, 4, eError, eError),
162 PCK4BITS(eError, eError, eError, 6, eItsMe, eError, eItsMe, eError),
163 PCK4BITS(eError, eError, eError, eError, eError, eError, eItsMe, eItsMe),
164 PCK4BITS(eError, eError, eError, eItsMe, eError, eError, eError, eError),
165 PCK4BITS(eError, eError, eError, eError, eItsMe, eError, eStart, eStart)
168static const unsigned int ISO2022JPCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
170const SMModel ISO2022JPSMModel = {
171 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_cls},
173 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_st},
174 ISO2022JPCharLenTable,
178static const unsigned int ISO2022KR_cls[256 / 8] = {
179 PCK4BITS(2, 0, 0, 0, 0, 0, 0, 0),
180 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
181 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
182 PCK4BITS(0, 0, 0, 1, 0, 0, 0, 0),
183 PCK4BITS(0, 0, 0, 0, 3, 0, 0, 0),
184 PCK4BITS(0, 4, 0, 0, 0, 0, 0, 0),
185 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
186 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
187 PCK4BITS(0, 0, 0, 5, 0, 0, 0, 0),
188 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
189 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
190 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
191 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
192 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
193 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
194 PCK4BITS(0, 0, 0, 0, 0, 0, 0, 0),
195 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
196 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
197 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
198 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
199 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
200 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
201 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
202 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
203 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
204 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
205 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
206 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
207 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
208 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
209 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2),
210 PCK4BITS(2, 2, 2, 2, 2, 2, 2, 2)
213static const unsigned int ISO2022KR_st[5] = {
214 PCK4BITS(eStart, 3, eError, eStart, eStart, eStart, eError, eError),
215 PCK4BITS(eError, eError, eError, eError, eItsMe, eItsMe, eItsMe, eItsMe),
216 PCK4BITS(eItsMe, eItsMe, eError, eError, eError, 4, eError, eError),
217 PCK4BITS(eError, eError, eError, eError, 5, eError, eError, eError),
218 PCK4BITS(eError, eError, eError, eItsMe, eStart, eStart, eStart, eStart)
221static const unsigned int ISO2022KRCharLenTable[] = {0, 0, 0, 0, 0, 0};
223const SMModel ISO2022KRSMModel = {
224 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_cls},
226 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_st},
227 ISO2022KRCharLenTable,