00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "nsCodingStateMachine.h"
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 namespace kencodingprober {
00037 static unsigned int BIG5_cls [ 256 / 8 ] = {
00038
00039 PCK4BITS(1,1,1,1,1,1,1,1),
00040 PCK4BITS(1,1,1,1,1,1,0,0),
00041 PCK4BITS(1,1,1,1,1,1,1,1),
00042 PCK4BITS(1,1,1,0,1,1,1,1),
00043 PCK4BITS(1,1,1,1,1,1,1,1),
00044 PCK4BITS(1,1,1,1,1,1,1,1),
00045 PCK4BITS(1,1,1,1,1,1,1,1),
00046 PCK4BITS(1,1,1,1,1,1,1,1),
00047 PCK4BITS(2,2,2,2,2,2,2,2),
00048 PCK4BITS(2,2,2,2,2,2,2,2),
00049 PCK4BITS(2,2,2,2,2,2,2,2),
00050 PCK4BITS(2,2,2,2,2,2,2,2),
00051 PCK4BITS(2,2,2,2,2,2,2,2),
00052 PCK4BITS(2,2,2,2,2,2,2,2),
00053 PCK4BITS(2,2,2,2,2,2,2,2),
00054 PCK4BITS(2,2,2,2,2,2,2,1),
00055 PCK4BITS(4,4,4,4,4,4,4,4),
00056 PCK4BITS(4,4,4,4,4,4,4,4),
00057 PCK4BITS(4,4,4,4,4,4,4,4),
00058 PCK4BITS(4,4,4,4,4,4,4,4),
00059 PCK4BITS(4,3,3,3,3,3,3,3),
00060 PCK4BITS(3,3,3,3,3,3,3,3),
00061 PCK4BITS(3,3,3,3,3,3,3,3),
00062 PCK4BITS(3,3,3,3,3,3,3,3),
00063 PCK4BITS(3,3,3,3,3,3,3,3),
00064 PCK4BITS(3,3,3,3,3,3,3,3),
00065 PCK4BITS(3,3,3,3,3,3,3,3),
00066 PCK4BITS(3,3,3,3,3,3,3,3),
00067 PCK4BITS(3,3,3,3,3,3,3,3),
00068 PCK4BITS(3,3,3,3,3,3,3,3),
00069 PCK4BITS(3,3,3,3,3,3,3,3),
00070 PCK4BITS(3,3,3,3,3,3,3,0)
00071 };
00072
00073
00074 static unsigned int BIG5_st [ 3] = {
00075 PCK4BITS(eError,eStart,eStart, 3,eError,eError,eError,eError),
00076 PCK4BITS(eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError),
00077 PCK4BITS(eError,eStart,eStart,eStart,eStart,eStart,eStart,eStart)
00078 };
00079
00080 static const unsigned int Big5CharLenTable[] = {0, 1, 1, 2, 0};
00081
00082 SMModel Big5SMModel = {
00083 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, BIG5_cls },
00084 5,
00085 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, BIG5_st },
00086 Big5CharLenTable,
00087 "Big5",
00088 };
00089
00090 static unsigned int EUCJP_cls [ 256 / 8 ] = {
00091
00092 PCK4BITS(4,4,4,4,4,4,4,4),
00093 PCK4BITS(4,4,4,4,4,4,5,5),
00094 PCK4BITS(4,4,4,4,4,4,4,4),
00095 PCK4BITS(4,4,4,5,4,4,4,4),
00096 PCK4BITS(4,4,4,4,4,4,4,4),
00097 PCK4BITS(4,4,4,4,4,4,4,4),
00098 PCK4BITS(4,4,4,4,4,4,4,4),
00099 PCK4BITS(4,4,4,4,4,4,4,4),
00100 PCK4BITS(4,4,4,4,4,4,4,4),
00101 PCK4BITS(4,4,4,4,4,4,4,4),
00102 PCK4BITS(4,4,4,4,4,4,4,4),
00103 PCK4BITS(4,4,4,4,4,4,4,4),
00104 PCK4BITS(4,4,4,4,4,4,4,4),
00105 PCK4BITS(4,4,4,4,4,4,4,4),
00106 PCK4BITS(4,4,4,4,4,4,4,4),
00107 PCK4BITS(4,4,4,4,4,4,4,4),
00108 PCK4BITS(5,5,5,5,5,5,5,5),
00109 PCK4BITS(5,5,5,5,5,5,1,3),
00110 PCK4BITS(5,5,5,5,5,5,5,5),
00111 PCK4BITS(5,5,5,5,5,5,5,5),
00112 PCK4BITS(5,2,2,2,2,2,2,2),
00113 PCK4BITS(2,2,2,2,2,2,2,2),
00114 PCK4BITS(2,2,2,2,2,2,2,2),
00115 PCK4BITS(2,2,2,2,2,2,2,2),
00116 PCK4BITS(2,2,2,2,2,2,2,2),
00117 PCK4BITS(2,2,2,2,2,2,2,2),
00118 PCK4BITS(2,2,2,2,2,2,2,2),
00119 PCK4BITS(2,2,2,2,2,2,2,2),
00120 PCK4BITS(0,0,0,0,0,0,0,0),
00121 PCK4BITS(0,0,0,0,0,0,0,0),
00122 PCK4BITS(0,0,0,0,0,0,0,0),
00123 PCK4BITS(0,0,0,0,0,0,0,5)
00124 };
00125
00126
00127 static unsigned int EUCJP_st [ 5] = {
00128 PCK4BITS( 3, 4, 3, 5,eStart,eError,eError,eError),
00129 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),
00130 PCK4BITS(eItsMe,eItsMe,eStart,eError,eStart,eError,eError,eError),
00131 PCK4BITS(eError,eError,eStart,eError,eError,eError, 3,eError),
00132 PCK4BITS( 3,eError,eError,eError,eStart,eStart,eStart,eStart)
00133 };
00134
00135 static const unsigned int EUCJPCharLenTable[] = {2, 2, 2, 3, 1, 0};
00136
00137 SMModel EUCJPSMModel = {
00138 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCJP_cls },
00139 6,
00140 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCJP_st },
00141 EUCJPCharLenTable,
00142 "EUC-JP",
00143 };
00144
00145 static unsigned int EUCKR_cls [ 256 / 8 ] = {
00146
00147 PCK4BITS(1,1,1,1,1,1,1,1),
00148 PCK4BITS(1,1,1,1,1,1,0,0),
00149 PCK4BITS(1,1,1,1,1,1,1,1),
00150 PCK4BITS(1,1,1,0,1,1,1,1),
00151 PCK4BITS(1,1,1,1,1,1,1,1),
00152 PCK4BITS(1,1,1,1,1,1,1,1),
00153 PCK4BITS(1,1,1,1,1,1,1,1),
00154 PCK4BITS(1,1,1,1,1,1,1,1),
00155 PCK4BITS(1,1,1,1,1,1,1,1),
00156 PCK4BITS(1,1,1,1,1,1,1,1),
00157 PCK4BITS(1,1,1,1,1,1,1,1),
00158 PCK4BITS(1,1,1,1,1,1,1,1),
00159 PCK4BITS(1,1,1,1,1,1,1,1),
00160 PCK4BITS(1,1,1,1,1,1,1,1),
00161 PCK4BITS(1,1,1,1,1,1,1,1),
00162 PCK4BITS(1,1,1,1,1,1,1,1),
00163 PCK4BITS(0,0,0,0,0,0,0,0),
00164 PCK4BITS(0,0,0,0,0,0,0,0),
00165 PCK4BITS(0,0,0,0,0,0,0,0),
00166 PCK4BITS(0,0,0,0,0,0,0,0),
00167 PCK4BITS(0,2,2,2,2,2,2,2),
00168 PCK4BITS(2,2,2,2,2,3,3,3),
00169 PCK4BITS(2,2,2,2,2,2,2,2),
00170 PCK4BITS(2,2,2,2,2,2,2,2),
00171 PCK4BITS(2,2,2,2,2,2,2,2),
00172 PCK4BITS(2,3,2,2,2,2,2,2),
00173 PCK4BITS(2,2,2,2,2,2,2,2),
00174 PCK4BITS(2,2,2,2,2,2,2,2),
00175 PCK4BITS(2,2,2,2,2,2,2,2),
00176 PCK4BITS(2,2,2,2,2,2,2,2),
00177 PCK4BITS(2,2,2,2,2,2,2,2),
00178 PCK4BITS(2,2,2,2,2,2,2,0)
00179 };
00180
00181
00182 static unsigned int EUCKR_st [ 2] = {
00183 PCK4BITS(eError,eStart, 3,eError,eError,eError,eError,eError),
00184 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eError,eError,eStart,eStart)
00185 };
00186
00187 static const unsigned int EUCKRCharLenTable[] = {0, 1, 2, 0};
00188
00189 SMModel EUCKRSMModel = {
00190 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCKR_cls },
00191 4,
00192 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCKR_st },
00193 EUCKRCharLenTable,
00194 "EUC-KR",
00195 };
00196
00197 static unsigned int EUCTW_cls [ 256 / 8 ] = {
00198
00199 PCK4BITS(2,2,2,2,2,2,2,2),
00200 PCK4BITS(2,2,2,2,2,2,0,0),
00201 PCK4BITS(2,2,2,2,2,2,2,2),
00202 PCK4BITS(2,2,2,0,2,2,2,2),
00203 PCK4BITS(2,2,2,2,2,2,2,2),
00204 PCK4BITS(2,2,2,2,2,2,2,2),
00205 PCK4BITS(2,2,2,2,2,2,2,2),
00206 PCK4BITS(2,2,2,2,2,2,2,2),
00207 PCK4BITS(2,2,2,2,2,2,2,2),
00208 PCK4BITS(2,2,2,2,2,2,2,2),
00209 PCK4BITS(2,2,2,2,2,2,2,2),
00210 PCK4BITS(2,2,2,2,2,2,2,2),
00211 PCK4BITS(2,2,2,2,2,2,2,2),
00212 PCK4BITS(2,2,2,2,2,2,2,2),
00213 PCK4BITS(2,2,2,2,2,2,2,2),
00214 PCK4BITS(2,2,2,2,2,2,2,2),
00215 PCK4BITS(0,0,0,0,0,0,0,0),
00216 PCK4BITS(0,0,0,0,0,0,6,0),
00217 PCK4BITS(0,0,0,0,0,0,0,0),
00218 PCK4BITS(0,0,0,0,0,0,0,0),
00219 PCK4BITS(0,3,4,4,4,4,4,4),
00220 PCK4BITS(5,5,1,1,1,1,1,1),
00221 PCK4BITS(1,1,1,1,1,1,1,1),
00222 PCK4BITS(1,1,1,1,1,1,1,1),
00223 PCK4BITS(1,1,3,1,3,3,3,3),
00224 PCK4BITS(3,3,3,3,3,3,3,3),
00225 PCK4BITS(3,3,3,3,3,3,3,3),
00226 PCK4BITS(3,3,3,3,3,3,3,3),
00227 PCK4BITS(3,3,3,3,3,3,3,3),
00228 PCK4BITS(3,3,3,3,3,3,3,3),
00229 PCK4BITS(3,3,3,3,3,3,3,3),
00230 PCK4BITS(3,3,3,3,3,3,3,0)
00231 };
00232
00233
00234 static unsigned int EUCTW_st [ 6] = {
00235 PCK4BITS(eError,eError,eStart, 3, 3, 3, 4,eError),
00236 PCK4BITS(eError,eError,eError,eError,eError,eError,eItsMe,eItsMe),
00237 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eStart,eError),
00238 PCK4BITS(eStart,eStart,eStart,eError,eError,eError,eError,eError),
00239 PCK4BITS( 5,eError,eError,eError,eStart,eError,eStart,eStart),
00240 PCK4BITS(eStart,eError,eStart,eStart,eStart,eStart,eStart,eStart)
00241 };
00242
00243 static const unsigned int EUCTWCharLenTable[] = {0, 0, 1, 2, 2, 2, 3};
00244
00245 SMModel EUCTWSMModel = {
00246 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCTW_cls },
00247 7,
00248 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, EUCTW_st },
00249 EUCTWCharLenTable,
00250 "x-euc-tw",
00251 };
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309 static unsigned int GB18030_cls [ 256 / 8 ] = {
00310 PCK4BITS(1,1,1,1,1,1,1,1),
00311 PCK4BITS(1,1,1,1,1,1,0,0),
00312 PCK4BITS(1,1,1,1,1,1,1,1),
00313 PCK4BITS(1,1,1,0,1,1,1,1),
00314 PCK4BITS(1,1,1,1,1,1,1,1),
00315 PCK4BITS(1,1,1,1,1,1,1,1),
00316 PCK4BITS(3,3,3,3,3,3,3,3),
00317 PCK4BITS(3,3,1,1,1,1,1,1),
00318 PCK4BITS(2,2,2,2,2,2,2,2),
00319 PCK4BITS(2,2,2,2,2,2,2,2),
00320 PCK4BITS(2,2,2,2,2,2,2,2),
00321 PCK4BITS(2,2,2,2,2,2,2,2),
00322 PCK4BITS(2,2,2,2,2,2,2,2),
00323 PCK4BITS(2,2,2,2,2,2,2,2),
00324 PCK4BITS(2,2,2,2,2,2,2,2),
00325 PCK4BITS(2,2,2,2,2,2,2,4),
00326 PCK4BITS(5,6,6,6,6,6,6,6),
00327 PCK4BITS(6,6,6,6,6,6,6,6),
00328 PCK4BITS(6,6,6,6,6,6,6,6),
00329 PCK4BITS(6,6,6,6,6,6,6,6),
00330 PCK4BITS(6,6,6,6,6,6,6,6),
00331 PCK4BITS(6,6,6,6,6,6,6,6),
00332 PCK4BITS(6,6,6,6,6,6,6,6),
00333 PCK4BITS(6,6,6,6,6,6,6,6),
00334 PCK4BITS(6,6,6,6,6,6,6,6),
00335 PCK4BITS(6,6,6,6,6,6,6,6),
00336 PCK4BITS(6,6,6,6,6,6,6,6),
00337 PCK4BITS(6,6,6,6,6,6,6,6),
00338 PCK4BITS(6,6,6,6,6,6,6,6),
00339 PCK4BITS(6,6,6,6,6,6,6,6),
00340 PCK4BITS(6,6,6,6,6,6,6,6),
00341 PCK4BITS(6,6,6,6,6,6,6,0)
00342 };
00343
00344
00345 static unsigned int GB18030_st [ 6] = {
00346 PCK4BITS(eError,eStart,eStart,eStart,eStart,eStart, 3,eError),
00347 PCK4BITS(eError,eError,eError,eError,eError,eError,eItsMe,eItsMe),
00348 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eError,eStart),
00349 PCK4BITS( 4,eError,eStart,eStart,eError,eError,eError,eError),
00350 PCK4BITS(eError,eError, 5,eError,eError,eError,eItsMe,eError),
00351 PCK4BITS(eError,eError,eStart,eStart,eStart,eStart,eStart,eStart)
00352 };
00353
00354
00355
00356
00357
00358
00359 static const unsigned int GB18030CharLenTable[] = {0, 1, 1, 1, 1, 1, 2};
00360
00361 SMModel GB18030SMModel = {
00362 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB18030_cls },
00363 7,
00364 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, GB18030_st },
00365 GB18030CharLenTable,
00366 "GB18030",
00367 };
00368
00369
00370
00371 static unsigned int SJIS_cls [ 256 / 8 ] = {
00372
00373 PCK4BITS(1,1,1,1,1,1,1,1),
00374 PCK4BITS(1,1,1,1,1,1,0,0),
00375 PCK4BITS(1,1,1,1,1,1,1,1),
00376 PCK4BITS(1,1,1,0,1,1,1,1),
00377 PCK4BITS(1,1,1,1,1,1,1,1),
00378 PCK4BITS(1,1,1,1,1,1,1,1),
00379 PCK4BITS(1,1,1,1,1,1,1,1),
00380 PCK4BITS(1,1,1,1,1,1,1,1),
00381 PCK4BITS(2,2,2,2,2,2,2,2),
00382 PCK4BITS(2,2,2,2,2,2,2,2),
00383 PCK4BITS(2,2,2,2,2,2,2,2),
00384 PCK4BITS(2,2,2,2,2,2,2,2),
00385 PCK4BITS(2,2,2,2,2,2,2,2),
00386 PCK4BITS(2,2,2,2,2,2,2,2),
00387 PCK4BITS(2,2,2,2,2,2,2,2),
00388 PCK4BITS(2,2,2,2,2,2,2,1),
00389 PCK4BITS(3,3,3,3,3,3,3,3),
00390 PCK4BITS(3,3,3,3,3,3,3,3),
00391 PCK4BITS(3,3,3,3,3,3,3,3),
00392 PCK4BITS(3,3,3,3,3,3,3,3),
00393
00394
00395 PCK4BITS(2,2,2,2,2,2,2,2),
00396 PCK4BITS(2,2,2,2,2,2,2,2),
00397 PCK4BITS(2,2,2,2,2,2,2,2),
00398 PCK4BITS(2,2,2,2,2,2,2,2),
00399 PCK4BITS(2,2,2,2,2,2,2,2),
00400 PCK4BITS(2,2,2,2,2,2,2,2),
00401 PCK4BITS(2,2,2,2,2,2,2,2),
00402 PCK4BITS(2,2,2,2,2,2,2,2),
00403 PCK4BITS(3,3,3,3,3,3,3,3),
00404 PCK4BITS(3,3,3,3,3,4,4,4),
00405 PCK4BITS(4,4,4,4,4,4,4,4),
00406 PCK4BITS(4,4,4,4,4,0,0,0)
00407 };
00408
00409
00410 static unsigned int SJIS_st [ 3] = {
00411 PCK4BITS(eError,eStart,eStart, 3,eError,eError,eError,eError),
00412 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),
00413 PCK4BITS(eItsMe,eItsMe,eError,eError,eStart,eStart,eStart,eStart)
00414 };
00415
00416 static const unsigned int SJISCharLenTable[] = {0, 1, 1, 2, 0, 0};
00417
00418 SMModel SJISSMModel = {
00419 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, SJIS_cls },
00420 6,
00421 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, SJIS_st },
00422 SJISCharLenTable,
00423 "Shift_JIS",
00424 };
00425
00426
00427 static unsigned int UCS2BE_cls [ 256 / 8 ] = {
00428 PCK4BITS(0,0,0,0,0,0,0,0),
00429 PCK4BITS(0,0,1,0,0,2,0,0),
00430 PCK4BITS(0,0,0,0,0,0,0,0),
00431 PCK4BITS(0,0,0,3,0,0,0,0),
00432 PCK4BITS(0,0,0,0,0,0,0,0),
00433 PCK4BITS(0,3,3,3,3,3,0,0),
00434 PCK4BITS(0,0,0,0,0,0,0,0),
00435 PCK4BITS(0,0,0,0,0,0,0,0),
00436 PCK4BITS(0,0,0,0,0,0,0,0),
00437 PCK4BITS(0,0,0,0,0,0,0,0),
00438 PCK4BITS(0,0,0,0,0,0,0,0),
00439 PCK4BITS(0,0,0,0,0,0,0,0),
00440 PCK4BITS(0,0,0,0,0,0,0,0),
00441 PCK4BITS(0,0,0,0,0,0,0,0),
00442 PCK4BITS(0,0,0,0,0,0,0,0),
00443 PCK4BITS(0,0,0,0,0,0,0,0),
00444 PCK4BITS(0,0,0,0,0,0,0,0),
00445 PCK4BITS(0,0,0,0,0,0,0,0),
00446 PCK4BITS(0,0,0,0,0,0,0,0),
00447 PCK4BITS(0,0,0,0,0,0,0,0),
00448 PCK4BITS(0,0,0,0,0,0,0,0),
00449 PCK4BITS(0,0,0,0,0,0,0,0),
00450 PCK4BITS(0,0,0,0,0,0,0,0),
00451 PCK4BITS(0,0,0,0,0,0,0,0),
00452 PCK4BITS(0,0,0,0,0,0,0,0),
00453 PCK4BITS(0,0,0,0,0,0,0,0),
00454 PCK4BITS(0,0,0,0,0,0,0,0),
00455 PCK4BITS(0,0,0,0,0,0,0,0),
00456 PCK4BITS(0,0,0,0,0,0,0,0),
00457 PCK4BITS(0,0,0,0,0,0,0,0),
00458 PCK4BITS(0,0,0,0,0,0,0,0),
00459 PCK4BITS(0,0,0,0,0,0,4,5)
00460 };
00461
00462
00463 static unsigned int UCS2BE_st [ 7] = {
00464 PCK4BITS( 5, 7, 7,eError, 4, 3,eError,eError),
00465 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),
00466 PCK4BITS(eItsMe,eItsMe, 6, 6, 6, 6,eError,eError),
00467 PCK4BITS( 6, 6, 6, 6, 6,eItsMe, 6, 6),
00468 PCK4BITS( 6, 6, 6, 6, 5, 7, 7,eError),
00469 PCK4BITS( 5, 8, 6, 6,eError, 6, 6, 6),
00470 PCK4BITS( 6, 6, 6, 6,eError,eError,eStart,eStart)
00471 };
00472
00473 static const unsigned int UCS2BECharLenTable[] = {2, 2, 2, 0, 2, 2};
00474
00475 SMModel UCS2BESMModel = {
00476 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2BE_cls },
00477 6,
00478 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2BE_st },
00479 UCS2BECharLenTable,
00480 "UTF-16BE",
00481 };
00482
00483 static unsigned int UCS2LE_cls [ 256 / 8 ] = {
00484 PCK4BITS(0,0,0,0,0,0,0,0),
00485 PCK4BITS(0,0,1,0,0,2,0,0),
00486 PCK4BITS(0,0,0,0,0,0,0,0),
00487 PCK4BITS(0,0,0,3,0,0,0,0),
00488 PCK4BITS(0,0,0,0,0,0,0,0),
00489 PCK4BITS(0,3,3,3,3,3,0,0),
00490 PCK4BITS(0,0,0,0,0,0,0,0),
00491 PCK4BITS(0,0,0,0,0,0,0,0),
00492 PCK4BITS(0,0,0,0,0,0,0,0),
00493 PCK4BITS(0,0,0,0,0,0,0,0),
00494 PCK4BITS(0,0,0,0,0,0,0,0),
00495 PCK4BITS(0,0,0,0,0,0,0,0),
00496 PCK4BITS(0,0,0,0,0,0,0,0),
00497 PCK4BITS(0,0,0,0,0,0,0,0),
00498 PCK4BITS(0,0,0,0,0,0,0,0),
00499 PCK4BITS(0,0,0,0,0,0,0,0),
00500 PCK4BITS(0,0,0,0,0,0,0,0),
00501 PCK4BITS(0,0,0,0,0,0,0,0),
00502 PCK4BITS(0,0,0,0,0,0,0,0),
00503 PCK4BITS(0,0,0,0,0,0,0,0),
00504 PCK4BITS(0,0,0,0,0,0,0,0),
00505 PCK4BITS(0,0,0,0,0,0,0,0),
00506 PCK4BITS(0,0,0,0,0,0,0,0),
00507 PCK4BITS(0,0,0,0,0,0,0,0),
00508 PCK4BITS(0,0,0,0,0,0,0,0),
00509 PCK4BITS(0,0,0,0,0,0,0,0),
00510 PCK4BITS(0,0,0,0,0,0,0,0),
00511 PCK4BITS(0,0,0,0,0,0,0,0),
00512 PCK4BITS(0,0,0,0,0,0,0,0),
00513 PCK4BITS(0,0,0,0,0,0,0,0),
00514 PCK4BITS(0,0,0,0,0,0,0,0),
00515 PCK4BITS(0,0,0,0,0,0,4,5)
00516 };
00517
00518
00519 static unsigned int UCS2LE_st [ 7] = {
00520 PCK4BITS( 6, 6, 7, 6, 4, 3,eError,eError),
00521 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),
00522 PCK4BITS(eItsMe,eItsMe, 5, 5, 5,eError,eItsMe,eError),
00523 PCK4BITS( 5, 5, 5,eError, 5,eError, 6, 6),
00524 PCK4BITS( 7, 6, 8, 8, 5, 5, 5,eError),
00525 PCK4BITS( 5, 5, 5,eError,eError,eError, 5, 5),
00526 PCK4BITS( 5, 5, 5,eError, 5,eError,eStart,eStart)
00527 };
00528
00529 static const unsigned int UCS2LECharLenTable[] = {2, 2, 2, 2, 2, 2};
00530
00531 SMModel UCS2LESMModel = {
00532 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2LE_cls },
00533 6,
00534 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UCS2LE_st },
00535 UCS2LECharLenTable,
00536 "UTF-16LE",
00537 };
00538
00539
00540 static unsigned int UTF8_cls [ 256 / 8 ] = {
00541
00542 PCK4BITS(1,1,1,1,1,1,1,1),
00543 PCK4BITS(1,1,1,1,1,1,0,0),
00544 PCK4BITS(1,1,1,1,1,1,1,1),
00545 PCK4BITS(1,1,1,0,1,1,1,1),
00546 PCK4BITS(1,1,1,1,1,1,1,1),
00547 PCK4BITS(1,1,1,1,1,1,1,1),
00548 PCK4BITS(1,1,1,1,1,1,1,1),
00549 PCK4BITS(1,1,1,1,1,1,1,1),
00550 PCK4BITS(1,1,1,1,1,1,1,1),
00551 PCK4BITS(1,1,1,1,1,1,1,1),
00552 PCK4BITS(1,1,1,1,1,1,1,1),
00553 PCK4BITS(1,1,1,1,1,1,1,1),
00554 PCK4BITS(1,1,1,1,1,1,1,1),
00555 PCK4BITS(1,1,1,1,1,1,1,1),
00556 PCK4BITS(1,1,1,1,1,1,1,1),
00557 PCK4BITS(1,1,1,1,1,1,1,1),
00558 PCK4BITS(2,2,2,2,3,3,3,3),
00559 PCK4BITS(4,4,4,4,4,4,4,4),
00560 PCK4BITS(4,4,4,4,4,4,4,4),
00561 PCK4BITS(4,4,4,4,4,4,4,4),
00562 PCK4BITS(5,5,5,5,5,5,5,5),
00563 PCK4BITS(5,5,5,5,5,5,5,5),
00564 PCK4BITS(5,5,5,5,5,5,5,5),
00565 PCK4BITS(5,5,5,5,5,5,5,5),
00566 PCK4BITS(0,0,6,6,6,6,6,6),
00567 PCK4BITS(6,6,6,6,6,6,6,6),
00568 PCK4BITS(6,6,6,6,6,6,6,6),
00569 PCK4BITS(6,6,6,6,6,6,6,6),
00570 PCK4BITS(7,8,8,8,8,8,8,8),
00571 PCK4BITS(8,8,8,8,8,9,8,8),
00572 PCK4BITS(10,11,11,11,11,11,11,11),
00573 PCK4BITS(12,13,13,13,14,15,0,0)
00574 };
00575
00576
00577 static unsigned int UTF8_st [ 26] = {
00578 PCK4BITS(eError,eStart,eError,eError,eError,eError, 12, 10),
00579 PCK4BITS( 9, 11, 8, 7, 6, 5, 4, 3),
00580 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),
00581 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),
00582 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe),
00583 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe),
00584 PCK4BITS(eError,eError, 5, 5, 5, 5,eError,eError),
00585 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),
00586 PCK4BITS(eError,eError,eError, 5, 5, 5,eError,eError),
00587 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),
00588 PCK4BITS(eError,eError, 7, 7, 7, 7,eError,eError),
00589 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),
00590 PCK4BITS(eError,eError,eError,eError, 7, 7,eError,eError),
00591 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),
00592 PCK4BITS(eError,eError, 9, 9, 9, 9,eError,eError),
00593 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),
00594 PCK4BITS(eError,eError,eError,eError,eError, 9,eError,eError),
00595 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),
00596 PCK4BITS(eError,eError, 12, 12, 12, 12,eError,eError),
00597 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),
00598 PCK4BITS(eError,eError,eError,eError,eError, 12,eError,eError),
00599 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),
00600 PCK4BITS(eError,eError, 12, 12, 12,eError,eError,eError),
00601 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError),
00602 PCK4BITS(eError,eError,eStart,eStart,eStart,eStart,eError,eError),
00603 PCK4BITS(eError,eError,eError,eError,eError,eError,eError,eError)
00604 };
00605
00606 static const unsigned int UTF8CharLenTable[] = {0, 1, 0, 0, 0, 0, 2, 3,
00607 3, 3, 4, 4, 5, 5, 6, 6 };
00608
00609 SMModel UTF8SMModel = {
00610 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UTF8_cls },
00611 16,
00612 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, UTF8_st },
00613 UTF8CharLenTable,
00614 "UTF-8",
00615 };
00616 }
00617
00618