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 namespace kencodingprober {
00029 static unsigned int HZ_cls[ 256 / 8 ] = {
00030 PCK4BITS(1,0,0,0,0,0,0,0),
00031 PCK4BITS(0,0,0,0,0,0,0,0),
00032 PCK4BITS(0,0,0,0,0,0,0,0),
00033 PCK4BITS(0,0,0,1,0,0,0,0),
00034 PCK4BITS(0,0,0,0,0,0,0,0),
00035 PCK4BITS(0,0,0,0,0,0,0,0),
00036 PCK4BITS(0,0,0,0,0,0,0,0),
00037 PCK4BITS(0,0,0,0,0,0,0,0),
00038 PCK4BITS(0,0,0,0,0,0,0,0),
00039 PCK4BITS(0,0,0,0,0,0,0,0),
00040 PCK4BITS(0,0,0,0,0,0,0,0),
00041 PCK4BITS(0,0,0,0,0,0,0,0),
00042 PCK4BITS(0,0,0,0,0,0,0,0),
00043 PCK4BITS(0,0,0,0,0,0,0,0),
00044 PCK4BITS(0,0,0,0,0,0,0,0),
00045 PCK4BITS(0,0,0,4,0,5,2,0),
00046 PCK4BITS(1,1,1,1,1,1,1,1),
00047 PCK4BITS(1,1,1,1,1,1,1,1),
00048 PCK4BITS(1,1,1,1,1,1,1,1),
00049 PCK4BITS(1,1,1,1,1,1,1,1),
00050 PCK4BITS(1,1,1,1,1,1,1,1),
00051 PCK4BITS(1,1,1,1,1,1,1,1),
00052 PCK4BITS(1,1,1,1,1,1,1,1),
00053 PCK4BITS(1,1,1,1,1,1,1,1),
00054 PCK4BITS(1,1,1,1,1,1,1,1),
00055 PCK4BITS(1,1,1,1,1,1,1,1),
00056 PCK4BITS(1,1,1,1,1,1,1,1),
00057 PCK4BITS(1,1,1,1,1,1,1,1),
00058 PCK4BITS(1,1,1,1,1,1,1,1),
00059 PCK4BITS(1,1,1,1,1,1,1,1),
00060 PCK4BITS(1,1,1,1,1,1,1,1),
00061 PCK4BITS(1,1,1,1,1,1,1,1)
00062 };
00063
00064
00065 static unsigned int HZ_st [ 6] = {
00066 PCK4BITS(eStart,eError, 3,eStart,eStart,eStart,eError,eError),
00067 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),
00068 PCK4BITS(eItsMe,eItsMe,eError,eError,eStart,eStart, 4,eError),
00069 PCK4BITS( 5,eError, 6,eError, 5, 5, 4,eError),
00070 PCK4BITS( 4,eError, 4, 4, 4,eError, 4,eError),
00071 PCK4BITS( 4,eItsMe,eStart,eStart,eStart,eStart,eStart,eStart)
00072 };
00073
00074 static const unsigned int HZCharLenTable[] = {0, 0, 0, 0, 0, 0};
00075
00076 SMModel HZSMModel = {
00077 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_cls },
00078 6,
00079 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_st },
00080 HZCharLenTable,
00081 "HZ-GB-2312",
00082 };
00083
00084
00085 static unsigned int ISO2022CN_cls [ 256 / 8 ] = {
00086 PCK4BITS(2,0,0,0,0,0,0,0),
00087 PCK4BITS(0,0,0,0,0,0,0,0),
00088 PCK4BITS(0,0,0,0,0,0,0,0),
00089 PCK4BITS(0,0,0,1,0,0,0,0),
00090 PCK4BITS(0,0,0,0,0,0,0,0),
00091 PCK4BITS(0,3,0,0,0,0,0,0),
00092 PCK4BITS(0,0,0,0,0,0,0,0),
00093 PCK4BITS(0,0,0,0,0,0,0,0),
00094 PCK4BITS(0,0,0,4,0,0,0,0),
00095 PCK4BITS(0,0,0,0,0,0,0,0),
00096 PCK4BITS(0,0,0,0,0,0,0,0),
00097 PCK4BITS(0,0,0,0,0,0,0,0),
00098 PCK4BITS(0,0,0,0,0,0,0,0),
00099 PCK4BITS(0,0,0,0,0,0,0,0),
00100 PCK4BITS(0,0,0,0,0,0,0,0),
00101 PCK4BITS(0,0,0,0,0,0,0,0),
00102 PCK4BITS(2,2,2,2,2,2,2,2),
00103 PCK4BITS(2,2,2,2,2,2,2,2),
00104 PCK4BITS(2,2,2,2,2,2,2,2),
00105 PCK4BITS(2,2,2,2,2,2,2,2),
00106 PCK4BITS(2,2,2,2,2,2,2,2),
00107 PCK4BITS(2,2,2,2,2,2,2,2),
00108 PCK4BITS(2,2,2,2,2,2,2,2),
00109 PCK4BITS(2,2,2,2,2,2,2,2),
00110 PCK4BITS(2,2,2,2,2,2,2,2),
00111 PCK4BITS(2,2,2,2,2,2,2,2),
00112 PCK4BITS(2,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 };
00119
00120
00121 static unsigned int ISO2022CN_st [ 8] = {
00122 PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eStart,eStart),
00123 PCK4BITS(eStart,eError,eError,eError,eError,eError,eError,eError),
00124 PCK4BITS(eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe),
00125 PCK4BITS(eItsMe,eItsMe,eItsMe,eError,eError,eError, 4,eError),
00126 PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),
00127 PCK4BITS( 5, 6,eError,eError,eError,eError,eError,eError),
00128 PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),
00129 PCK4BITS(eError,eError,eError,eError,eError,eItsMe,eError,eStart)
00130 };
00131
00132 static const unsigned int ISO2022CNCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
00133
00134 SMModel ISO2022CNSMModel = {
00135 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_cls },
00136 9,
00137 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_st },
00138 ISO2022CNCharLenTable,
00139 "ISO-2022-CN",
00140 };
00141
00142 static unsigned int ISO2022JP_cls [ 256 / 8 ] = {
00143 PCK4BITS(2,0,0,0,0,0,0,0),
00144 PCK4BITS(0,0,0,0,0,0,2,2),
00145 PCK4BITS(0,0,0,0,0,0,0,0),
00146 PCK4BITS(0,0,0,1,0,0,0,0),
00147 PCK4BITS(0,0,0,0,7,0,0,0),
00148 PCK4BITS(3,0,0,0,0,0,0,0),
00149 PCK4BITS(0,0,0,0,0,0,0,0),
00150 PCK4BITS(0,0,0,0,0,0,0,0),
00151 PCK4BITS(6,0,4,0,8,0,0,0),
00152 PCK4BITS(0,9,5,0,0,0,0,0),
00153 PCK4BITS(0,0,0,0,0,0,0,0),
00154 PCK4BITS(0,0,0,0,0,0,0,0),
00155 PCK4BITS(0,0,0,0,0,0,0,0),
00156 PCK4BITS(0,0,0,0,0,0,0,0),
00157 PCK4BITS(0,0,0,0,0,0,0,0),
00158 PCK4BITS(0,0,0,0,0,0,0,0),
00159 PCK4BITS(2,2,2,2,2,2,2,2),
00160 PCK4BITS(2,2,2,2,2,2,2,2),
00161 PCK4BITS(2,2,2,2,2,2,2,2),
00162 PCK4BITS(2,2,2,2,2,2,2,2),
00163 PCK4BITS(2,2,2,2,2,2,2,2),
00164 PCK4BITS(2,2,2,2,2,2,2,2),
00165 PCK4BITS(2,2,2,2,2,2,2,2),
00166 PCK4BITS(2,2,2,2,2,2,2,2),
00167 PCK4BITS(2,2,2,2,2,2,2,2),
00168 PCK4BITS(2,2,2,2,2,2,2,2),
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,2,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 };
00176
00177
00178 static unsigned int ISO2022JP_st [ 9] = {
00179 PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eStart,eStart),
00180 PCK4BITS(eStart,eStart,eError,eError,eError,eError,eError,eError),
00181 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),
00182 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eError),
00183 PCK4BITS(eError, 5,eError,eError,eError, 4,eError,eError),
00184 PCK4BITS(eError,eError,eError, 6,eItsMe,eError,eItsMe,eError),
00185 PCK4BITS(eError,eError,eError,eError,eError,eError,eItsMe,eItsMe),
00186 PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),
00187 PCK4BITS(eError,eError,eError,eError,eItsMe,eError,eStart,eStart)
00188 };
00189
00190 static const unsigned int ISO2022JPCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0};
00191
00192 SMModel ISO2022JPSMModel = {
00193 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_cls },
00194 10,
00195 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_st },
00196 ISO2022JPCharLenTable,
00197 "ISO-2022-JP",
00198 };
00199
00200 static unsigned int ISO2022KR_cls [ 256 / 8 ] = {
00201 PCK4BITS(2,0,0,0,0,0,0,0),
00202 PCK4BITS(0,0,0,0,0,0,0,0),
00203 PCK4BITS(0,0,0,0,0,0,0,0),
00204 PCK4BITS(0,0,0,1,0,0,0,0),
00205 PCK4BITS(0,0,0,0,3,0,0,0),
00206 PCK4BITS(0,4,0,0,0,0,0,0),
00207 PCK4BITS(0,0,0,0,0,0,0,0),
00208 PCK4BITS(0,0,0,0,0,0,0,0),
00209 PCK4BITS(0,0,0,5,0,0,0,0),
00210 PCK4BITS(0,0,0,0,0,0,0,0),
00211 PCK4BITS(0,0,0,0,0,0,0,0),
00212 PCK4BITS(0,0,0,0,0,0,0,0),
00213 PCK4BITS(0,0,0,0,0,0,0,0),
00214 PCK4BITS(0,0,0,0,0,0,0,0),
00215 PCK4BITS(0,0,0,0,0,0,0,0),
00216 PCK4BITS(0,0,0,0,0,0,0,0),
00217 PCK4BITS(2,2,2,2,2,2,2,2),
00218 PCK4BITS(2,2,2,2,2,2,2,2),
00219 PCK4BITS(2,2,2,2,2,2,2,2),
00220 PCK4BITS(2,2,2,2,2,2,2,2),
00221 PCK4BITS(2,2,2,2,2,2,2,2),
00222 PCK4BITS(2,2,2,2,2,2,2,2),
00223 PCK4BITS(2,2,2,2,2,2,2,2),
00224 PCK4BITS(2,2,2,2,2,2,2,2),
00225 PCK4BITS(2,2,2,2,2,2,2,2),
00226 PCK4BITS(2,2,2,2,2,2,2,2),
00227 PCK4BITS(2,2,2,2,2,2,2,2),
00228 PCK4BITS(2,2,2,2,2,2,2,2),
00229 PCK4BITS(2,2,2,2,2,2,2,2),
00230 PCK4BITS(2,2,2,2,2,2,2,2),
00231 PCK4BITS(2,2,2,2,2,2,2,2),
00232 PCK4BITS(2,2,2,2,2,2,2,2)
00233 };
00234
00235
00236 static unsigned int ISO2022KR_st [ 5] = {
00237 PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eError,eError),
00238 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),
00239 PCK4BITS(eItsMe,eItsMe,eError,eError,eError, 4,eError,eError),
00240 PCK4BITS(eError,eError,eError,eError, 5,eError,eError,eError),
00241 PCK4BITS(eError,eError,eError,eItsMe,eStart,eStart,eStart,eStart)
00242 };
00243
00244 static const unsigned int ISO2022KRCharLenTable[] = {0, 0, 0, 0, 0, 0};
00245
00246 SMModel ISO2022KRSMModel = {
00247 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_cls },
00248 6,
00249 {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_st },
00250 ISO2022KRCharLenTable,
00251 "ISO-2022-KR",
00252 };
00253 }
00254
00255