nsEscSM.cpp

Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 #include "nsCodingStateMachine.h"
00038 
00039 static PRUint32 HZ_cls[ 256 / 8 ] = {
00040 PCK4BITS(1,0,0,0,0,0,0,0),  // 00 - 07 
00041 PCK4BITS(0,0,0,0,0,0,0,0),  // 08 - 0f 
00042 PCK4BITS(0,0,0,0,0,0,0,0),  // 10 - 17 
00043 PCK4BITS(0,0,0,1,0,0,0,0),  // 18 - 1f 
00044 PCK4BITS(0,0,0,0,0,0,0,0),  // 20 - 27 
00045 PCK4BITS(0,0,0,0,0,0,0,0),  // 28 - 2f 
00046 PCK4BITS(0,0,0,0,0,0,0,0),  // 30 - 37 
00047 PCK4BITS(0,0,0,0,0,0,0,0),  // 38 - 3f 
00048 PCK4BITS(0,0,0,0,0,0,0,0),  // 40 - 47 
00049 PCK4BITS(0,0,0,0,0,0,0,0),  // 48 - 4f 
00050 PCK4BITS(0,0,0,0,0,0,0,0),  // 50 - 57 
00051 PCK4BITS(0,0,0,0,0,0,0,0),  // 58 - 5f 
00052 PCK4BITS(0,0,0,0,0,0,0,0),  // 60 - 67 
00053 PCK4BITS(0,0,0,0,0,0,0,0),  // 68 - 6f 
00054 PCK4BITS(0,0,0,0,0,0,0,0),  // 70 - 77 
00055 PCK4BITS(0,0,0,4,0,5,2,0),  // 78 - 7f 
00056 PCK4BITS(1,1,1,1,1,1,1,1),  // 80 - 87 
00057 PCK4BITS(1,1,1,1,1,1,1,1),  // 88 - 8f 
00058 PCK4BITS(1,1,1,1,1,1,1,1),  // 90 - 97 
00059 PCK4BITS(1,1,1,1,1,1,1,1),  // 98 - 9f 
00060 PCK4BITS(1,1,1,1,1,1,1,1),  // a0 - a7 
00061 PCK4BITS(1,1,1,1,1,1,1,1),  // a8 - af 
00062 PCK4BITS(1,1,1,1,1,1,1,1),  // b0 - b7 
00063 PCK4BITS(1,1,1,1,1,1,1,1),  // b8 - bf 
00064 PCK4BITS(1,1,1,1,1,1,1,1),  // c0 - c7 
00065 PCK4BITS(1,1,1,1,1,1,1,1),  // c8 - cf 
00066 PCK4BITS(1,1,1,1,1,1,1,1),  // d0 - d7 
00067 PCK4BITS(1,1,1,1,1,1,1,1),  // d8 - df 
00068 PCK4BITS(1,1,1,1,1,1,1,1),  // e0 - e7 
00069 PCK4BITS(1,1,1,1,1,1,1,1),  // e8 - ef 
00070 PCK4BITS(1,1,1,1,1,1,1,1),  // f0 - f7 
00071 PCK4BITS(1,1,1,1,1,1,1,1)   // f8 - ff 
00072 };
00073 
00074 
00075 static PRUint32 HZ_st [ 6] = {
00076 PCK4BITS(eStart,eError,     3,eStart,eStart,eStart,eError,eError),//00-07 
00077 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f 
00078 PCK4BITS(eItsMe,eItsMe,eError,eError,eStart,eStart,     4,eError),//10-17 
00079 PCK4BITS(     5,eError,     6,eError,     5,     5,     4,eError),//18-1f 
00080 PCK4BITS(     4,eError,     4,     4,     4,eError,     4,eError),//20-27 
00081 PCK4BITS(     4,eItsMe,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f 
00082 };
00083 
00084 static const PRUint32 HZCharLenTable[] = {0, 0, 0, 0, 0, 0};
00085 
00086 SMModel HZSMModel = {
00087   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_cls },
00088    6,
00089   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_st },
00090   HZCharLenTable,
00091   "HZ-GB-2312",
00092 };
00093 
00094 
00095 static PRUint32 ISO2022CN_cls [ 256 / 8 ] = {
00096 PCK4BITS(2,0,0,0,0,0,0,0),  // 00 - 07 
00097 PCK4BITS(0,0,0,0,0,0,0,0),  // 08 - 0f 
00098 PCK4BITS(0,0,0,0,0,0,0,0),  // 10 - 17 
00099 PCK4BITS(0,0,0,1,0,0,0,0),  // 18 - 1f 
00100 PCK4BITS(0,0,0,0,0,0,0,0),  // 20 - 27 
00101 PCK4BITS(0,3,0,0,0,0,0,0),  // 28 - 2f 
00102 PCK4BITS(0,0,0,0,0,0,0,0),  // 30 - 37 
00103 PCK4BITS(0,0,0,0,0,0,0,0),  // 38 - 3f 
00104 PCK4BITS(0,0,0,4,0,0,0,0),  // 40 - 47 
00105 PCK4BITS(0,0,0,0,0,0,0,0),  // 48 - 4f 
00106 PCK4BITS(0,0,0,0,0,0,0,0),  // 50 - 57 
00107 PCK4BITS(0,0,0,0,0,0,0,0),  // 58 - 5f 
00108 PCK4BITS(0,0,0,0,0,0,0,0),  // 60 - 67 
00109 PCK4BITS(0,0,0,0,0,0,0,0),  // 68 - 6f 
00110 PCK4BITS(0,0,0,0,0,0,0,0),  // 70 - 77 
00111 PCK4BITS(0,0,0,0,0,0,0,0),  // 78 - 7f 
00112 PCK4BITS(2,2,2,2,2,2,2,2),  // 80 - 87 
00113 PCK4BITS(2,2,2,2,2,2,2,2),  // 88 - 8f 
00114 PCK4BITS(2,2,2,2,2,2,2,2),  // 90 - 97 
00115 PCK4BITS(2,2,2,2,2,2,2,2),  // 98 - 9f 
00116 PCK4BITS(2,2,2,2,2,2,2,2),  // a0 - a7 
00117 PCK4BITS(2,2,2,2,2,2,2,2),  // a8 - af 
00118 PCK4BITS(2,2,2,2,2,2,2,2),  // b0 - b7 
00119 PCK4BITS(2,2,2,2,2,2,2,2),  // b8 - bf 
00120 PCK4BITS(2,2,2,2,2,2,2,2),  // c0 - c7 
00121 PCK4BITS(2,2,2,2,2,2,2,2),  // c8 - cf 
00122 PCK4BITS(2,2,2,2,2,2,2,2),  // d0 - d7 
00123 PCK4BITS(2,2,2,2,2,2,2,2),  // d8 - df 
00124 PCK4BITS(2,2,2,2,2,2,2,2),  // e0 - e7 
00125 PCK4BITS(2,2,2,2,2,2,2,2),  // e8 - ef 
00126 PCK4BITS(2,2,2,2,2,2,2,2),  // f0 - f7 
00127 PCK4BITS(2,2,2,2,2,2,2,2)   // f8 - ff 
00128 };
00129 
00130 
00131 static PRUint32 ISO2022CN_st [ 8] = {
00132 PCK4BITS(eStart,     3,eError,eStart,eStart,eStart,eStart,eStart),//00-07 
00133 PCK4BITS(eStart,eError,eError,eError,eError,eError,eError,eError),//08-0f 
00134 PCK4BITS(eError,eError,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe),//10-17 
00135 PCK4BITS(eItsMe,eItsMe,eItsMe,eError,eError,eError,     4,eError),//18-1f 
00136 PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),//20-27 
00137 PCK4BITS(     5,     6,eError,eError,eError,eError,eError,eError),//28-2f 
00138 PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),//30-37 
00139 PCK4BITS(eError,eError,eError,eError,eError,eItsMe,eError,eStart) //38-3f 
00140 };
00141 
00142 static const PRUint32 ISO2022CNCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
00143 
00144 SMModel ISO2022CNSMModel = {
00145   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_cls },
00146   9,
00147   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_st },
00148   ISO2022CNCharLenTable,
00149   "ISO-2022-CN",
00150 };
00151 
00152 static PRUint32 ISO2022JP_cls [ 256 / 8 ] = {
00153 PCK4BITS(2,0,0,0,0,0,0,0),  // 00 - 07 
00154 PCK4BITS(0,0,0,0,0,0,2,2),  // 08 - 0f 
00155 PCK4BITS(0,0,0,0,0,0,0,0),  // 10 - 17 
00156 PCK4BITS(0,0,0,1,0,0,0,0),  // 18 - 1f 
00157 PCK4BITS(0,0,0,0,7,0,0,0),  // 20 - 27 
00158 PCK4BITS(3,0,0,0,0,0,0,0),  // 28 - 2f 
00159 PCK4BITS(0,0,0,0,0,0,0,0),  // 30 - 37 
00160 PCK4BITS(0,0,0,0,0,0,0,0),  // 38 - 3f 
00161 PCK4BITS(6,0,4,0,8,0,0,0),  // 40 - 47 
00162 PCK4BITS(0,9,5,0,0,0,0,0),  // 48 - 4f 
00163 PCK4BITS(0,0,0,0,0,0,0,0),  // 50 - 57 
00164 PCK4BITS(0,0,0,0,0,0,0,0),  // 58 - 5f 
00165 PCK4BITS(0,0,0,0,0,0,0,0),  // 60 - 67 
00166 PCK4BITS(0,0,0,0,0,0,0,0),  // 68 - 6f 
00167 PCK4BITS(0,0,0,0,0,0,0,0),  // 70 - 77 
00168 PCK4BITS(0,0,0,0,0,0,0,0),  // 78 - 7f 
00169 PCK4BITS(2,2,2,2,2,2,2,2),  // 80 - 87 
00170 PCK4BITS(2,2,2,2,2,2,2,2),  // 88 - 8f 
00171 PCK4BITS(2,2,2,2,2,2,2,2),  // 90 - 97 
00172 PCK4BITS(2,2,2,2,2,2,2,2),  // 98 - 9f 
00173 PCK4BITS(2,2,2,2,2,2,2,2),  // a0 - a7 
00174 PCK4BITS(2,2,2,2,2,2,2,2),  // a8 - af 
00175 PCK4BITS(2,2,2,2,2,2,2,2),  // b0 - b7 
00176 PCK4BITS(2,2,2,2,2,2,2,2),  // b8 - bf 
00177 PCK4BITS(2,2,2,2,2,2,2,2),  // c0 - c7 
00178 PCK4BITS(2,2,2,2,2,2,2,2),  // c8 - cf 
00179 PCK4BITS(2,2,2,2,2,2,2,2),  // d0 - d7 
00180 PCK4BITS(2,2,2,2,2,2,2,2),  // d8 - df 
00181 PCK4BITS(2,2,2,2,2,2,2,2),  // e0 - e7 
00182 PCK4BITS(2,2,2,2,2,2,2,2),  // e8 - ef 
00183 PCK4BITS(2,2,2,2,2,2,2,2),  // f0 - f7 
00184 PCK4BITS(2,2,2,2,2,2,2,2)   // f8 - ff 
00185 };
00186 
00187 
00188 static PRUint32 ISO2022JP_st [ 9] = {
00189 PCK4BITS(eStart,     3,eError,eStart,eStart,eStart,eStart,eStart),//00-07 
00190 PCK4BITS(eStart,eStart,eError,eError,eError,eError,eError,eError),//08-0f 
00191 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//10-17 
00192 PCK4BITS(eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eItsMe,eError,eError),//18-1f 
00193 PCK4BITS(eError,     5,eError,eError,eError,     4,eError,eError),//20-27 
00194 PCK4BITS(eError,eError,eError,     6,eItsMe,eError,eItsMe,eError),//28-2f 
00195 PCK4BITS(eError,eError,eError,eError,eError,eError,eItsMe,eItsMe),//30-37 
00196 PCK4BITS(eError,eError,eError,eItsMe,eError,eError,eError,eError),//38-3f 
00197 PCK4BITS(eError,eError,eError,eError,eItsMe,eError,eStart,eStart) //40-47 
00198 };
00199 
00200 static const PRUint32 ISO2022JPCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0};
00201 
00202 SMModel ISO2022JPSMModel = {
00203   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_cls },
00204   10,
00205   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_st },
00206   ISO2022JPCharLenTable,
00207   "ISO-2022-JP",
00208 };
00209 
00210 static PRUint32 ISO2022KR_cls [ 256 / 8 ] = {
00211 PCK4BITS(2,0,0,0,0,0,0,0),  // 00 - 07 
00212 PCK4BITS(0,0,0,0,0,0,0,0),  // 08 - 0f 
00213 PCK4BITS(0,0,0,0,0,0,0,0),  // 10 - 17 
00214 PCK4BITS(0,0,0,1,0,0,0,0),  // 18 - 1f 
00215 PCK4BITS(0,0,0,0,3,0,0,0),  // 20 - 27 
00216 PCK4BITS(0,4,0,0,0,0,0,0),  // 28 - 2f 
00217 PCK4BITS(0,0,0,0,0,0,0,0),  // 30 - 37 
00218 PCK4BITS(0,0,0,0,0,0,0,0),  // 38 - 3f 
00219 PCK4BITS(0,0,0,5,0,0,0,0),  // 40 - 47 
00220 PCK4BITS(0,0,0,0,0,0,0,0),  // 48 - 4f 
00221 PCK4BITS(0,0,0,0,0,0,0,0),  // 50 - 57 
00222 PCK4BITS(0,0,0,0,0,0,0,0),  // 58 - 5f 
00223 PCK4BITS(0,0,0,0,0,0,0,0),  // 60 - 67 
00224 PCK4BITS(0,0,0,0,0,0,0,0),  // 68 - 6f 
00225 PCK4BITS(0,0,0,0,0,0,0,0),  // 70 - 77 
00226 PCK4BITS(0,0,0,0,0,0,0,0),  // 78 - 7f 
00227 PCK4BITS(2,2,2,2,2,2,2,2),  // 80 - 87 
00228 PCK4BITS(2,2,2,2,2,2,2,2),  // 88 - 8f 
00229 PCK4BITS(2,2,2,2,2,2,2,2),  // 90 - 97 
00230 PCK4BITS(2,2,2,2,2,2,2,2),  // 98 - 9f 
00231 PCK4BITS(2,2,2,2,2,2,2,2),  // a0 - a7 
00232 PCK4BITS(2,2,2,2,2,2,2,2),  // a8 - af 
00233 PCK4BITS(2,2,2,2,2,2,2,2),  // b0 - b7 
00234 PCK4BITS(2,2,2,2,2,2,2,2),  // b8 - bf 
00235 PCK4BITS(2,2,2,2,2,2,2,2),  // c0 - c7 
00236 PCK4BITS(2,2,2,2,2,2,2,2),  // c8 - cf 
00237 PCK4BITS(2,2,2,2,2,2,2,2),  // d0 - d7 
00238 PCK4BITS(2,2,2,2,2,2,2,2),  // d8 - df 
00239 PCK4BITS(2,2,2,2,2,2,2,2),  // e0 - e7 
00240 PCK4BITS(2,2,2,2,2,2,2,2),  // e8 - ef 
00241 PCK4BITS(2,2,2,2,2,2,2,2),  // f0 - f7 
00242 PCK4BITS(2,2,2,2,2,2,2,2)   // f8 - ff 
00243 };
00244 
00245 
00246 static PRUint32 ISO2022KR_st [ 5] = {
00247 PCK4BITS(eStart,     3,eError,eStart,eStart,eStart,eError,eError),//00-07 
00248 PCK4BITS(eError,eError,eError,eError,eItsMe,eItsMe,eItsMe,eItsMe),//08-0f 
00249 PCK4BITS(eItsMe,eItsMe,eError,eError,eError,     4,eError,eError),//10-17 
00250 PCK4BITS(eError,eError,eError,eError,     5,eError,eError,eError),//18-1f 
00251 PCK4BITS(eError,eError,eError,eItsMe,eStart,eStart,eStart,eStart) //20-27 
00252 };
00253 
00254 static const PRUint32 ISO2022KRCharLenTable[] = {0, 0, 0, 0, 0, 0};
00255 
00256 SMModel ISO2022KRSMModel = {
00257   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_cls },
00258    6,
00259   {eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_st },
00260   ISO2022KRCharLenTable,
00261   "ISO-2022-KR",
00262 };
00263 
Generated by  doxygen 1.6.2-20100208