[ENHANCEMENT] Make files in uchardet folder conform with compiling warning level 4.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1197 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
11847747b5
commit
ffccd13944
@ -226,20 +226,18 @@ static const PRUint8 BulgarianLangModel[] =
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,
|
||||
};
|
||||
|
||||
const SequenceModel Latin5BulgarianModel =
|
||||
{
|
||||
const SequenceModel Latin5BulgarianModel(
|
||||
Latin5_BulgarianCharToOrderMap,
|
||||
BulgarianLangModel,
|
||||
(float)0.969392,
|
||||
PR_FALSE,
|
||||
"ISO-8859-5"
|
||||
};
|
||||
);
|
||||
|
||||
const SequenceModel Win1251BulgarianModel =
|
||||
{
|
||||
const SequenceModel Win1251BulgarianModel(
|
||||
win1251BulgarianCharToOrderMap,
|
||||
BulgarianLangModel,
|
||||
(float)0.969392,
|
||||
PR_FALSE,
|
||||
"windows-1251"
|
||||
};
|
||||
);
|
||||
|
@ -300,56 +300,50 @@ static const PRUint8 RussianLangModel[] =
|
||||
};
|
||||
|
||||
|
||||
const SequenceModel Koi8rModel =
|
||||
{
|
||||
const SequenceModel Koi8rModel(
|
||||
KOI8R_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
(float)0.976601,
|
||||
PR_FALSE,
|
||||
"KOI8-R"
|
||||
};
|
||||
);
|
||||
|
||||
const SequenceModel Win1251Model =
|
||||
{
|
||||
const SequenceModel Win1251Model(
|
||||
win1251_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
(float)0.976601,
|
||||
PR_FALSE,
|
||||
"windows-1251"
|
||||
};
|
||||
);
|
||||
|
||||
const SequenceModel Latin5Model =
|
||||
{
|
||||
const SequenceModel Latin5Model(
|
||||
latin5_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
(float)0.976601,
|
||||
PR_FALSE,
|
||||
"ISO-8859-5"
|
||||
};
|
||||
);
|
||||
|
||||
const SequenceModel MacCyrillicModel =
|
||||
{
|
||||
const SequenceModel MacCyrillicModel(
|
||||
macCyrillic_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
(float)0.976601,
|
||||
PR_FALSE,
|
||||
"x-mac-cyrillic"
|
||||
};
|
||||
);
|
||||
|
||||
const SequenceModel Ibm866Model =
|
||||
{
|
||||
const SequenceModel Ibm866Model(
|
||||
IBM866_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
(float)0.976601,
|
||||
PR_FALSE,
|
||||
"IBM866"
|
||||
};
|
||||
);
|
||||
|
||||
const SequenceModel Ibm855Model =
|
||||
{
|
||||
const SequenceModel Ibm855Model(
|
||||
IBM855_CharToOrderMap,
|
||||
RussianLangModel,
|
||||
(float)0.976601,
|
||||
PR_FALSE,
|
||||
"IBM855"
|
||||
};
|
||||
);
|
||||
|
@ -225,20 +225,18 @@ static const PRUint8 GreekLangModel[] =
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
const SequenceModel Latin7Model =
|
||||
{
|
||||
const SequenceModel Latin7Model (
|
||||
Latin7_CharToOrderMap,
|
||||
GreekLangModel,
|
||||
(float)0.982851,
|
||||
PR_FALSE,
|
||||
"ISO-8859-7"
|
||||
};
|
||||
);
|
||||
|
||||
const SequenceModel Win1253Model =
|
||||
{
|
||||
const SequenceModel Win1253Model(
|
||||
win1253_CharToOrderMap,
|
||||
GreekLangModel,
|
||||
(float)0.982851,
|
||||
PR_FALSE,
|
||||
"windows-1253"
|
||||
};
|
||||
);
|
||||
|
@ -208,12 +208,10 @@ static const PRUint8 HebrewLangModel[] =
|
||||
0,0,0,0,0,0,0,0,0,0,1,2,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,1,0,0,
|
||||
};
|
||||
|
||||
const SequenceModel Win1255Model =
|
||||
{
|
||||
const SequenceModel Win1255Model(
|
||||
win1255_CharToOrderMap,
|
||||
HebrewLangModel,
|
||||
(float)0.984004,
|
||||
PR_FALSE,
|
||||
"windows-1255"
|
||||
};
|
||||
"windows-1255");
|
||||
|
||||
|
@ -223,20 +223,16 @@ static const PRUint8 HungarianLangModel[] =
|
||||
0,1,1,1,1,1,1,0,1,1,0,1,0,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
const SequenceModel Latin2HungarianModel =
|
||||
{
|
||||
const SequenceModel Latin2HungarianModel(
|
||||
Latin2_HungarianCharToOrderMap,
|
||||
HungarianLangModel,
|
||||
(float)0.947368,
|
||||
PR_TRUE,
|
||||
"ISO-8859-2"
|
||||
};
|
||||
"ISO-8859-2");
|
||||
|
||||
const SequenceModel Win1250HungarianModel =
|
||||
{
|
||||
const SequenceModel Win1250HungarianModel(
|
||||
win1250HungarianCharToOrderMap,
|
||||
HungarianLangModel,
|
||||
(float)0.947368,
|
||||
PR_TRUE,
|
||||
"windows-1250"
|
||||
};
|
||||
"windows-1250");
|
||||
|
@ -208,14 +208,13 @@ static const PRUint8 ThaiLangModel[] =
|
||||
0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
|
||||
const SequenceModel TIS620ThaiModel =
|
||||
{
|
||||
TIS620CharToOrderMap,
|
||||
ThaiLangModel,
|
||||
(float)0.926386,
|
||||
PR_FALSE,
|
||||
"TIS-620"
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
const SequenceModel TIS620ThaiModel(
|
||||
TIS620CharToOrderMap,
|
||||
ThaiLangModel,
|
||||
(float)0.926386,
|
||||
PR_FALSE,
|
||||
"TIS-620"
|
||||
);
|
||||
|
@ -1,104 +1,107 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsCodingStateMachine_h__
|
||||
#define nsCodingStateMachine_h__
|
||||
|
||||
#include "nsPkgInt.h"
|
||||
|
||||
typedef enum {
|
||||
eStart = 0,
|
||||
eError = 1,
|
||||
eItsMe = 2
|
||||
} nsSMState;
|
||||
|
||||
#define GETCLASS(c) GETFROMPCK(((unsigned char)(c)), mModel->classTable)
|
||||
|
||||
//state machine model
|
||||
typedef struct
|
||||
{
|
||||
nsPkgInt classTable;
|
||||
PRUint32 classFactor;
|
||||
nsPkgInt stateTable;
|
||||
const PRUint32* charLenTable;
|
||||
const char* name;
|
||||
} SMModel;
|
||||
|
||||
class nsCodingStateMachine {
|
||||
public:
|
||||
nsCodingStateMachine(const SMModel* sm) : mModel(sm) { mCurrentState = eStart; }
|
||||
nsSMState NextState(char c){
|
||||
//for each byte we get its class , if it is first byte, we also get byte length
|
||||
PRUint32 byteCls = GETCLASS(c);
|
||||
if (mCurrentState == eStart)
|
||||
{
|
||||
mCurrentBytePos = 0;
|
||||
mCurrentCharLen = mModel->charLenTable[byteCls];
|
||||
}
|
||||
//from byte's class and stateTable, we get its next state
|
||||
mCurrentState=(nsSMState)GETFROMPCK(mCurrentState*(mModel->classFactor)+byteCls,
|
||||
mModel->stateTable);
|
||||
mCurrentBytePos++;
|
||||
return mCurrentState;
|
||||
}
|
||||
PRUint32 GetCurrentCharLen(void) {return mCurrentCharLen;}
|
||||
void Reset(void) {mCurrentState = eStart;}
|
||||
const char * GetCodingStateMachine() {return mModel->name;}
|
||||
|
||||
protected:
|
||||
nsSMState mCurrentState;
|
||||
PRUint32 mCurrentCharLen;
|
||||
PRUint32 mCurrentBytePos;
|
||||
|
||||
const SMModel *mModel;
|
||||
};
|
||||
|
||||
extern const SMModel UTF8SMModel;
|
||||
extern const SMModel Big5SMModel;
|
||||
extern const SMModel EUCJPSMModel;
|
||||
extern const SMModel EUCKRSMModel;
|
||||
extern const SMModel EUCTWSMModel;
|
||||
extern const SMModel GB18030SMModel;
|
||||
extern const SMModel SJISSMModel;
|
||||
|
||||
|
||||
extern const SMModel HZSMModel;
|
||||
extern const SMModel ISO2022CNSMModel;
|
||||
extern const SMModel ISO2022JPSMModel;
|
||||
extern const SMModel ISO2022KRSMModel;
|
||||
|
||||
#endif /* nsCodingStateMachine_h__ */
|
||||
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
#ifndef nsCodingStateMachine_h__
|
||||
#define nsCodingStateMachine_h__
|
||||
|
||||
#include "nsPkgInt.h"
|
||||
|
||||
typedef enum {
|
||||
eStart = 0,
|
||||
eError = 1,
|
||||
eItsMe = 2
|
||||
} nsSMState;
|
||||
|
||||
#define GETCLASS(c) GETFROMPCK(((unsigned char)(c)), mModel->classTable)
|
||||
|
||||
//state machine model
|
||||
struct SMModel
|
||||
{
|
||||
nsPkgInt classTable;
|
||||
PRUint32 classFactor;
|
||||
nsPkgInt stateTable;
|
||||
const PRUint32* charLenTable;
|
||||
const char* name;
|
||||
SMModel(){};
|
||||
SMModel(nsPkgInt a,PRUint32 b,nsPkgInt c,const PRUint32* d, const char* e):
|
||||
classTable(a), classFactor(b), stateTable(c), charLenTable(d), name(e){};
|
||||
} ;
|
||||
|
||||
class nsCodingStateMachine {
|
||||
public:
|
||||
nsCodingStateMachine(const SMModel* sm) : mModel(sm) { mCurrentState = eStart; }
|
||||
nsSMState NextState(char c){
|
||||
//for each byte we get its class , if it is first byte, we also get byte length
|
||||
PRUint32 byteCls = GETCLASS(c);
|
||||
if (mCurrentState == eStart)
|
||||
{
|
||||
mCurrentBytePos = 0;
|
||||
mCurrentCharLen = mModel->charLenTable[byteCls];
|
||||
}
|
||||
//from byte's class and stateTable, we get its next state
|
||||
mCurrentState=(nsSMState)GETFROMPCK(mCurrentState*(mModel->classFactor)+byteCls,
|
||||
mModel->stateTable);
|
||||
mCurrentBytePos++;
|
||||
return mCurrentState;
|
||||
}
|
||||
PRUint32 GetCurrentCharLen(void) {return mCurrentCharLen;}
|
||||
void Reset(void) {mCurrentState = eStart;}
|
||||
const char * GetCodingStateMachine() {return mModel->name;}
|
||||
|
||||
protected:
|
||||
nsSMState mCurrentState;
|
||||
PRUint32 mCurrentCharLen;
|
||||
PRUint32 mCurrentBytePos;
|
||||
|
||||
const SMModel *mModel;
|
||||
};
|
||||
|
||||
extern const SMModel UTF8SMModel;
|
||||
extern const SMModel Big5SMModel;
|
||||
extern const SMModel EUCJPSMModel;
|
||||
extern const SMModel EUCKRSMModel;
|
||||
extern const SMModel EUCTWSMModel;
|
||||
extern const SMModel GB18030SMModel;
|
||||
extern const SMModel SJISSMModel;
|
||||
|
||||
|
||||
extern const SMModel HZSMModel;
|
||||
extern const SMModel ISO2022CNSMModel;
|
||||
extern const SMModel ISO2022JPSMModel;
|
||||
extern const SMModel ISO2022KRSMModel;
|
||||
|
||||
#endif /* nsCodingStateMachine_h__ */
|
||||
|
||||
|
@ -83,13 +83,12 @@ PCK4BITS( 4,eItsMe,eStart,eStart,eStart,eStart,eStart,eStart) //28-2f
|
||||
|
||||
static const PRUint32 HZCharLenTable[] = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
const SMModel HZSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_cls },
|
||||
const SMModel HZSMModel(
|
||||
nsPkgInt(eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_cls),
|
||||
6,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_st },
|
||||
nsPkgInt(eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, HZ_st),
|
||||
HZCharLenTable,
|
||||
"HZ-GB-2312",
|
||||
};
|
||||
"HZ-GB-2312");
|
||||
|
||||
|
||||
static const PRUint32 ISO2022CN_cls [ 256 / 8 ] = {
|
||||
@ -141,13 +140,12 @@ PCK4BITS(eError,eError,eError,eError,eError,eItsMe,eError,eStart) //38-3f
|
||||
|
||||
static const PRUint32 ISO2022CNCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
const SMModel ISO2022CNSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_cls },
|
||||
const SMModel ISO2022CNSMModel(
|
||||
nsPkgInt(eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_cls),
|
||||
9,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_st },
|
||||
nsPkgInt(eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022CN_st),
|
||||
ISO2022CNCharLenTable,
|
||||
"ISO-2022-CN",
|
||||
};
|
||||
"ISO-2022-CN");
|
||||
|
||||
static const PRUint32 ISO2022JP_cls [ 256 / 8 ] = {
|
||||
PCK4BITS(2,0,0,0,0,0,0,0), // 00 - 07
|
||||
@ -199,13 +197,12 @@ PCK4BITS(eError,eError,eError,eError,eItsMe,eError,eStart,eStart) //40-47
|
||||
|
||||
static const PRUint32 ISO2022JPCharLenTable[] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
const SMModel ISO2022JPSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_cls },
|
||||
const SMModel ISO2022JPSMModel(
|
||||
nsPkgInt(eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_cls),
|
||||
10,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_st },
|
||||
nsPkgInt(eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022JP_st),
|
||||
ISO2022JPCharLenTable,
|
||||
"ISO-2022-JP",
|
||||
};
|
||||
"ISO-2022-JP");
|
||||
|
||||
static const PRUint32 ISO2022KR_cls [ 256 / 8 ] = {
|
||||
PCK4BITS(2,0,0,0,0,0,0,0), // 00 - 07
|
||||
@ -253,11 +250,10 @@ PCK4BITS(eError,eError,eError,eItsMe,eStart,eStart,eStart,eStart) //20-27
|
||||
|
||||
static const PRUint32 ISO2022KRCharLenTable[] = {0, 0, 0, 0, 0, 0};
|
||||
|
||||
const SMModel ISO2022KRSMModel = {
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_cls },
|
||||
const SMModel ISO2022KRSMModel(
|
||||
nsPkgInt(eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_cls),
|
||||
6,
|
||||
{eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_st },
|
||||
nsPkgInt(eIdxSft4bits, eSftMsk4bits, eBitSft4bits, eUnitMsk4bits, ISO2022KR_st),
|
||||
ISO2022KRCharLenTable,
|
||||
"ISO-2022-KR",
|
||||
};
|
||||
"ISO-2022-KR");
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -60,19 +60,23 @@ typedef enum {
|
||||
typedef enum {
|
||||
eUnitMsk4bits = 0x0000000FL,
|
||||
eUnitMsk8bits = 0x000000FFL,
|
||||
eUnitMsk16bits = 0x0000FFFFL
|
||||
} nsUnitMsk;
|
||||
|
||||
typedef struct nsPkgInt {
|
||||
nsIdxSft idxsft;
|
||||
nsSftMsk sftmsk;
|
||||
nsBitSft bitsft;
|
||||
nsUnitMsk unitmsk;
|
||||
const PRUint32* const data;
|
||||
} nsPkgInt;
|
||||
|
||||
|
||||
#define PCK16BITS(a,b) ((PRUint32)(((b) << 16) | (a)))
|
||||
eUnitMsk16bits = 0x0000FFFFL
|
||||
} nsUnitMsk;
|
||||
|
||||
struct nsPkgInt {
|
||||
nsIdxSft idxsft;
|
||||
nsSftMsk sftmsk;
|
||||
nsBitSft bitsft;
|
||||
nsUnitMsk unitmsk;
|
||||
const PRUint32* const data;
|
||||
nsPkgInt(nsIdxSft a,nsSftMsk b, nsBitSft c,nsUnitMsk d,const PRUint32* const e)
|
||||
:idxsft(a), sftmsk(b), bitsft(c), unitmsk(d), data(e){}
|
||||
nsPkgInt();
|
||||
nsPkgInt operator= (const nsPkgInt&);
|
||||
};
|
||||
|
||||
|
||||
#define PCK16BITS(a,b) ((PRUint32)(((b) << 16) | (a)))
|
||||
|
||||
#define PCK8BITS(a,b,c,d) PCK16BITS( ((PRUint32)(((b) << 8) | (a))), \
|
||||
((PRUint32)(((d) << 8) | (c))))
|
||||
|
@ -46,29 +46,33 @@
|
||||
#define NEGATIVE_SHORTCUT_THRESHOLD (float)0.05
|
||||
#define SYMBOL_CAT_ORDER 250
|
||||
#define NUMBER_OF_SEQ_CAT 4
|
||||
#define POSITIVE_CAT (NUMBER_OF_SEQ_CAT-1)
|
||||
#define NEGATIVE_CAT 0
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const unsigned char* const charToOrderMap; // [256] table use to find a char's order
|
||||
const PRUint8* const precedenceMatrix; // [SAMPLE_SIZE][SAMPLE_SIZE]; table to find a 2-char sequence's frequency
|
||||
float mTypicalPositiveRatio; // = freqSeqs / totalSeqs
|
||||
PRBool keepEnglishLetter; // says if this script contains English characters (not implemented)
|
||||
const char* const charsetName;
|
||||
} SequenceModel;
|
||||
|
||||
|
||||
class nsSingleByteCharSetProber : public nsCharSetProber{
|
||||
#define POSITIVE_CAT (NUMBER_OF_SEQ_CAT-1)
|
||||
#define NEGATIVE_CAT 0
|
||||
|
||||
struct SequenceModel
|
||||
{
|
||||
const unsigned char* const charToOrderMap; // [256] table use to find a char's order
|
||||
const PRUint8* const precedenceMatrix; // [SAMPLE_SIZE][SAMPLE_SIZE]; table to find a 2-char sequence's frequency
|
||||
float mTypicalPositiveRatio; // = freqSeqs / totalSeqs
|
||||
PRBool keepEnglishLetter; // says if this script contains English characters (not implemented)
|
||||
const char* const charsetName;
|
||||
SequenceModel(void);
|
||||
SequenceModel(const unsigned char* const a, const PRUint8* const b,float c,PRBool d,const char* const e)
|
||||
: charToOrderMap(a), precedenceMatrix(b), mTypicalPositiveRatio(c), keepEnglishLetter(d), charsetName(e){}
|
||||
SequenceModel& operator=(const SequenceModel&);
|
||||
} ;
|
||||
|
||||
|
||||
class nsSingleByteCharSetProber : public nsCharSetProber{
|
||||
public:
|
||||
nsSingleByteCharSetProber(const SequenceModel *model)
|
||||
:mModel(model), mReversed(PR_FALSE), mNameProber(0) { Reset(); }
|
||||
nsSingleByteCharSetProber(const SequenceModel *model, PRBool reversed, nsCharSetProber* nameProber)
|
||||
:mModel(model), mReversed(reversed), mNameProber(nameProber) { Reset(); }
|
||||
|
||||
virtual const char* GetCharSetName();
|
||||
virtual nsProbingState HandleData(const char* aBuf, PRUint32 aLen);
|
||||
virtual nsProbingState GetState(void) {return mState;}
|
||||
:mModel(model), mReversed(PR_FALSE), mNameProber(0) { Reset(); }
|
||||
nsSingleByteCharSetProber(const SequenceModel *model, PRBool reversed, nsCharSetProber* nameProber)
|
||||
:mModel(model), mReversed(reversed), mNameProber(nameProber) { Reset(); }
|
||||
nsSingleByteCharSetProber(): mModel(0), mReversed(0){};
|
||||
virtual const char* GetCharSetName();
|
||||
virtual nsProbingState HandleData(const char* aBuf, PRUint32 aLen);
|
||||
virtual nsProbingState GetState(void) {return mState;}
|
||||
virtual void Reset(void);
|
||||
virtual float GetConfidence(void);
|
||||
virtual void SetOpion() {}
|
||||
@ -77,12 +81,13 @@ public:
|
||||
// contain this parameter as PR_FALSE. No one is looking at this
|
||||
// parameter or calling this method.
|
||||
// Moreover, the nsSBCSGroupProber which calls the HandleData of this
|
||||
// prober has a hard-coded call to FilterWithoutEnglishLetters which gets rid
|
||||
// of the English letters.
|
||||
PRBool KeepEnglishLetters() {return mModel->keepEnglishLetter;} // (not implemented)
|
||||
|
||||
#ifdef DEBUG_chardet
|
||||
virtual void DumpStatus();
|
||||
// prober has a hard-coded call to FilterWithoutEnglishLetters which gets rid
|
||||
// of the English letters.
|
||||
PRBool KeepEnglishLetters() {return mModel->keepEnglishLetter;} // (not implemented)
|
||||
nsSingleByteCharSetProber operator=(const nsSingleByteCharSetProber&){};
|
||||
|
||||
#ifdef DEBUG_chardet
|
||||
virtual void DumpStatus();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@ -358,7 +358,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -367,7 +366,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -380,7 +378,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -389,7 +386,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -402,7 +398,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -411,7 +406,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -424,7 +418,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -433,7 +426,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -446,7 +438,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -455,7 +446,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -468,7 +458,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -477,7 +466,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -490,7 +478,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -499,7 +486,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -556,7 +542,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -565,7 +550,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -598,7 +582,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -607,7 +590,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -620,7 +602,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -629,7 +610,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -642,7 +622,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -651,7 +630,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -664,7 +642,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -673,7 +650,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -686,7 +662,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -695,7 +670,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -708,7 +682,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -717,7 +690,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -730,7 +702,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -739,7 +710,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -752,7 +722,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -761,7 +730,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -774,7 +742,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -783,7 +750,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -796,7 +762,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -805,7 +770,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -818,7 +782,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -827,7 +790,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -840,7 +802,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -849,7 +810,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -862,7 +822,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -871,7 +830,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -884,7 +842,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -893,7 +850,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -906,7 +862,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -915,7 +870,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
@ -1068,7 +1022,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
@ -1077,7 +1030,6 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
|
Loading…
Reference in New Issue
Block a user