KDECore
nsEscSM.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 00002 /* -*- C++ -*- 00003 * Copyright (C) 1998 <developer@mozilla.org> 00004 * 00005 * 00006 * Permission is hereby granted, free of charge, to any person obtaining 00007 * a copy of this software and associated documentation files (the 00008 * "Software"), to deal in the Software without restriction, including 00009 * without limitation the rights to use, copy, modify, merge, publish, 00010 * distribute, sublicense, and/or sell copies of the Software, and to 00011 * permit persons to whom the Software is furnished to do so, subject to 00012 * the following conditions: 00013 * 00014 * The above copyright notice and this permission notice shall be included 00015 * in all copies or substantial portions of the Software. 00016 * 00017 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00018 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00019 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00020 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 00021 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 00022 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 00023 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 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), // 00 - 07 00031 PCK4BITS(0,0,0,0,0,0,0,0), // 08 - 0f 00032 PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17 00033 PCK4BITS(0,0,0,1,0,0,0,0), // 18 - 1f 00034 PCK4BITS(0,0,0,0,0,0,0,0), // 20 - 27 00035 PCK4BITS(0,0,0,0,0,0,0,0), // 28 - 2f 00036 PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37 00037 PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f 00038 PCK4BITS(0,0,0,0,0,0,0,0), // 40 - 47 00039 PCK4BITS(0,0,0,0,0,0,0,0), // 48 - 4f 00040 PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57 00041 PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f 00042 PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67 00043 PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f 00044 PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77 00045 PCK4BITS(0,0,0,4,0,5,2,0), // 78 - 7f 00046 PCK4BITS(1,1,1,1,1,1,1,1), // 80 - 87 00047 PCK4BITS(1,1,1,1,1,1,1,1), // 88 - 8f 00048 PCK4BITS(1,1,1,1,1,1,1,1), // 90 - 97 00049 PCK4BITS(1,1,1,1,1,1,1,1), // 98 - 9f 00050 PCK4BITS(1,1,1,1,1,1,1,1), // a0 - a7 00051 PCK4BITS(1,1,1,1,1,1,1,1), // a8 - af 00052 PCK4BITS(1,1,1,1,1,1,1,1), // b0 - b7 00053 PCK4BITS(1,1,1,1,1,1,1,1), // b8 - bf 00054 PCK4BITS(1,1,1,1,1,1,1,1), // c0 - c7 00055 PCK4BITS(1,1,1,1,1,1,1,1), // c8 - cf 00056 PCK4BITS(1,1,1,1,1,1,1,1), // d0 - d7 00057 PCK4BITS(1,1,1,1,1,1,1,1), // d8 - df 00058 PCK4BITS(1,1,1,1,1,1,1,1), // e0 - e7 00059 PCK4BITS(1,1,1,1,1,1,1,1), // e8 - ef 00060 PCK4BITS(1,1,1,1,1,1,1,1), // f0 - f7 00061 PCK4BITS(1,1,1,1,1,1,1,1) // f8 - ff 00062 }; 00063 00064 00065 static unsigned int HZ_st [ 6] = { 00066 PCK4BITS(eStart,eError, 3,eStart,eStart,eStart,eError,eError),//00-07 00067 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f 00068 PCK4BITS(eItsMe,eItsMe,eError,eError,eStart,eStart, 4,eError),//10-17 00069 PCK4BITS( 5,eError, 6,eError, 5, 5, 4,eError),//18-1f 00070 PCK4BITS( 4,eError, 4, 4, 4,eError, 4,eError),//20-27 00071 PCK4BITS( 4,eItsMe,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f 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), // 00 - 07 00087 PCK4BITS(0,0,0,0,0,0,0,0), // 08 - 0f 00088 PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17 00089 PCK4BITS(0,0,0,1,0,0,0,0), // 18 - 1f 00090 PCK4BITS(0,0,0,0,0,0,0,0), // 20 - 27 00091 PCK4BITS(0,3,0,0,0,0,0,0), // 28 - 2f 00092 PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37 00093 PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f 00094 PCK4BITS(0,0,0,4,0,0,0,0), // 40 - 47 00095 PCK4BITS(0,0,0,0,0,0,0,0), // 48 - 4f 00096 PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57 00097 PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f 00098 PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67 00099 PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f 00100 PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77 00101 PCK4BITS(0,0,0,0,0,0,0,0), // 78 - 7f 00102 PCK4BITS(2,2,2,2,2,2,2,2), // 80 - 87 00103 PCK4BITS(2,2,2,2,2,2,2,2), // 88 - 8f 00104 PCK4BITS(2,2,2,2,2,2,2,2), // 90 - 97 00105 PCK4BITS(2,2,2,2,2,2,2,2), // 98 - 9f 00106 PCK4BITS(2,2,2,2,2,2,2,2), // a0 - a7 00107 PCK4BITS(2,2,2,2,2,2,2,2), // a8 - af 00108 PCK4BITS(2,2,2,2,2,2,2,2), // b0 - b7 00109 PCK4BITS(2,2,2,2,2,2,2,2), // b8 - bf 00110 PCK4BITS(2,2,2,2,2,2,2,2), // c0 - c7 00111 PCK4BITS(2,2,2,2,2,2,2,2), // c8 - cf 00112 PCK4BITS(2,2,2,2,2,2,2,2), // d0 - d7 00113 PCK4BITS(2,2,2,2,2,2,2,2), // d8 - df 00114 PCK4BITS(2,2,2,2,2,2,2,2), // e0 - e7 00115 PCK4BITS(2,2,2,2,2,2,2,2), // e8 - ef 00116 PCK4BITS(2,2,2,2,2,2,2,2), // f0 - f7 00117 PCK4BITS(2,2,2,2,2,2,2,2) // f8 - ff 00118 }; 00119 00120 00121 static unsigned int ISO2022CN_st [ 8] = { 00122 PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eStart,eStart),//00-07 00123 PCK4BITS(eStart,eError,eError,eError,eError,eError,eError,eError),//08-0f 00124 PCK4BITS(eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe),//10-17 00125 PCK4BITS(eItsMe,eItsMe,eItsMe,eError,eError,eError, 4,eError),//18-1f 00126 PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),//20-27 00127 PCK4BITS( 5, 6,eError,eError,eError,eError,eError,eError),//28-2f 00128 PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),//30-37 00129 PCK4BITS(eError,eError,eError,eError,eError,eItsMe,eError,eStart) //38-3f 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), // 00 - 07 00144 PCK4BITS(0,0,0,0,0,0,2,2), // 08 - 0f 00145 PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17 00146 PCK4BITS(0,0,0,1,0,0,0,0), // 18 - 1f 00147 PCK4BITS(0,0,0,0,7,0,0,0), // 20 - 27 00148 PCK4BITS(3,0,0,0,0,0,0,0), // 28 - 2f 00149 PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37 00150 PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f 00151 PCK4BITS(6,0,4,0,8,0,0,0), // 40 - 47 00152 PCK4BITS(0,9,5,0,0,0,0,0), // 48 - 4f 00153 PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57 00154 PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f 00155 PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67 00156 PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f 00157 PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77 00158 PCK4BITS(0,0,0,0,0,0,0,0), // 78 - 7f 00159 PCK4BITS(2,2,2,2,2,2,2,2), // 80 - 87 00160 PCK4BITS(2,2,2,2,2,2,2,2), // 88 - 8f 00161 PCK4BITS(2,2,2,2,2,2,2,2), // 90 - 97 00162 PCK4BITS(2,2,2,2,2,2,2,2), // 98 - 9f 00163 PCK4BITS(2,2,2,2,2,2,2,2), // a0 - a7 00164 PCK4BITS(2,2,2,2,2,2,2,2), // a8 - af 00165 PCK4BITS(2,2,2,2,2,2,2,2), // b0 - b7 00166 PCK4BITS(2,2,2,2,2,2,2,2), // b8 - bf 00167 PCK4BITS(2,2,2,2,2,2,2,2), // c0 - c7 00168 PCK4BITS(2,2,2,2,2,2,2,2), // c8 - cf 00169 PCK4BITS(2,2,2,2,2,2,2,2), // d0 - d7 00170 PCK4BITS(2,2,2,2,2,2,2,2), // d8 - df 00171 PCK4BITS(2,2,2,2,2,2,2,2), // e0 - e7 00172 PCK4BITS(2,2,2,2,2,2,2,2), // e8 - ef 00173 PCK4BITS(2,2,2,2,2,2,2,2), // f0 - f7 00174 PCK4BITS(2,2,2,2,2,2,2,2) // f8 - ff 00175 }; 00176 00177 00178 static unsigned int ISO2022JP_st [ 9] = { 00179 PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eStart,eStart),//00-07 00180 PCK4BITS(eStart,eStart,eError,eError,eError,eError,eError,eError),//08-0f 00181 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//10-17 00182 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eError),//18-1f 00183 PCK4BITS(eError, 5,eError,eError,eError, 4,eError,eError),//20-27 00184 PCK4BITS(eError,eError,eError, 6,eItsMe,eError,eItsMe,eError),//28-2f 00185 PCK4BITS(eError,eError,eError,eError,eError,eError,eItsMe,eItsMe),//30-37 00186 PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),//38-3f 00187 PCK4BITS(eError,eError,eError,eError,eItsMe,eError,eStart,eStart) //40-47 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), // 00 - 07 00202 PCK4BITS(0,0,0,0,0,0,0,0), // 08 - 0f 00203 PCK4BITS(0,0,0,0,0,0,0,0), // 10 - 17 00204 PCK4BITS(0,0,0,1,0,0,0,0), // 18 - 1f 00205 PCK4BITS(0,0,0,0,3,0,0,0), // 20 - 27 00206 PCK4BITS(0,4,0,0,0,0,0,0), // 28 - 2f 00207 PCK4BITS(0,0,0,0,0,0,0,0), // 30 - 37 00208 PCK4BITS(0,0,0,0,0,0,0,0), // 38 - 3f 00209 PCK4BITS(0,0,0,5,0,0,0,0), // 40 - 47 00210 PCK4BITS(0,0,0,0,0,0,0,0), // 48 - 4f 00211 PCK4BITS(0,0,0,0,0,0,0,0), // 50 - 57 00212 PCK4BITS(0,0,0,0,0,0,0,0), // 58 - 5f 00213 PCK4BITS(0,0,0,0,0,0,0,0), // 60 - 67 00214 PCK4BITS(0,0,0,0,0,0,0,0), // 68 - 6f 00215 PCK4BITS(0,0,0,0,0,0,0,0), // 70 - 77 00216 PCK4BITS(0,0,0,0,0,0,0,0), // 78 - 7f 00217 PCK4BITS(2,2,2,2,2,2,2,2), // 80 - 87 00218 PCK4BITS(2,2,2,2,2,2,2,2), // 88 - 8f 00219 PCK4BITS(2,2,2,2,2,2,2,2), // 90 - 97 00220 PCK4BITS(2,2,2,2,2,2,2,2), // 98 - 9f 00221 PCK4BITS(2,2,2,2,2,2,2,2), // a0 - a7 00222 PCK4BITS(2,2,2,2,2,2,2,2), // a8 - af 00223 PCK4BITS(2,2,2,2,2,2,2,2), // b0 - b7 00224 PCK4BITS(2,2,2,2,2,2,2,2), // b8 - bf 00225 PCK4BITS(2,2,2,2,2,2,2,2), // c0 - c7 00226 PCK4BITS(2,2,2,2,2,2,2,2), // c8 - cf 00227 PCK4BITS(2,2,2,2,2,2,2,2), // d0 - d7 00228 PCK4BITS(2,2,2,2,2,2,2,2), // d8 - df 00229 PCK4BITS(2,2,2,2,2,2,2,2), // e0 - e7 00230 PCK4BITS(2,2,2,2,2,2,2,2), // e8 - ef 00231 PCK4BITS(2,2,2,2,2,2,2,2), // f0 - f7 00232 PCK4BITS(2,2,2,2,2,2,2,2) // f8 - ff 00233 }; 00234 00235 00236 static unsigned int ISO2022KR_st [ 5] = { 00237 PCK4BITS(eStart, 3,eError,eStart,eStart,eStart,eError,eError),//00-07 00238 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f 00239 PCK4BITS(eItsMe,eItsMe,eError,eError,eError, 4,eError,eError),//10-17 00240 PCK4BITS(eError,eError,eError,eError, 5,eError,eError,eError),//18-1f 00241 PCK4BITS(eError,eError,eError,eItsMe,eStart,eStart,eStart,eStart) //20-27 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
KDE 4.6 API Reference