diff --git a/mozilla/intl/uconv/ucvcn/nsBIG5ToUnicode.cpp b/mozilla/intl/uconv/ucvcn/nsBIG5ToUnicode.cpp index 44f3ee3af8f..5c982fe77fc 100644 --- a/mozilla/intl/uconv/ucvcn/nsBIG5ToUnicode.cpp +++ b/mozilla/intl/uconv/ucvcn/nsBIG5ToUnicode.cpp @@ -25,19 +25,43 @@ static PRUint16 g_BIG5MappingTable[] = { #include "big5.ut" }; +static PRUint16 g_ASCIIMappingTable[] = { + 0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000 +}; static PRInt16 g_BIG5ShiftTable[] = { - 2, uMultibytesCharset, - ShiftCell(u1ByteChar, 1, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F), - ShiftCell(u2BytesChar, 2, 0xA1, 0xFE, 0xA1, 0x40, 0xFE, 0xFE) + 0, u2BytesCharset, + ShiftCell(0,0,0,0,0,0,0,0) +}; + +static PRInt16 g_ASCIIShiftTable[] = { + 0, u1ByteCharset, + ShiftCell(0,0,0,0,0,0,0,0) +}; + +static PRInt16 *g_BIG5ShiftTableSet [] = { + g_ASCIIShiftTable, + g_BIG5ShiftTable +}; + +static PRUint16 *g_BIG5MappingTableSet [] ={ + g_ASCIIMappingTable, + g_BIG5MappingTable +}; + +static uRange g_BIG5Ranges[] = { + { 0x00, 0x7E }, + { 0x81, 0xFC } }; //---------------------------------------------------------------------- // Class nsBIG5ToUnicode [implementation] nsBIG5ToUnicode::nsBIG5ToUnicode() -: nsTableDecoderSupport((uShiftTable*) &g_BIG5ShiftTable, - (uMappingTable*) &g_BIG5MappingTable) +: nsTablesDecoderSupport(2, + (uRange* ) &g_BIG5Ranges, + (uShiftTable**) &g_BIG5ShiftTableSet, + (uMappingTable**) &g_BIG5MappingTableSet) { } @@ -48,7 +72,7 @@ nsresult nsBIG5ToUnicode::CreateInstance(nsISupports ** aResult) } //---------------------------------------------------------------------- -// Subclassing of nsTableDecoderSupport class [implementation] +// Subclassing of nsTablesDecoderSupport class [implementation] NS_IMETHODIMP nsBIG5ToUnicode::GetMaxLength(const char * aSrc, PRInt32 aSrcLength, diff --git a/mozilla/intl/uconv/ucvcn/nsBIG5ToUnicode.h b/mozilla/intl/uconv/ucvcn/nsBIG5ToUnicode.h index edb5796494e..f66f71a8fab 100644 --- a/mozilla/intl/uconv/ucvcn/nsBIG5ToUnicode.h +++ b/mozilla/intl/uconv/ucvcn/nsBIG5ToUnicode.h @@ -31,7 +31,7 @@ * @created 06/Apr/1999 * @author Catalin Rotaru [CATA] */ -class nsBIG5ToUnicode : public nsTableDecoderSupport +class nsBIG5ToUnicode : public nsTablesDecoderSupport { public: diff --git a/mozilla/intl/uconv/ucvcn/nsEUCKRToUnicode.cpp b/mozilla/intl/uconv/ucvcn/nsEUCKRToUnicode.cpp index b7cf04ea919..4cd3d468ab5 100644 --- a/mozilla/intl/uconv/ucvcn/nsEUCKRToUnicode.cpp +++ b/mozilla/intl/uconv/ucvcn/nsEUCKRToUnicode.cpp @@ -22,22 +22,66 @@ //---------------------------------------------------------------------- // Global functions and data [declaration] +static PRUint16 g_ASCIIMappingTable[] = { + 0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000 +}; + +static PRInt16 g_ASCIIShiftTable[] = { + 0, u1ByteCharset, + ShiftCell(0,0,0,0,0,0,0,0) +}; + +#ifdef MS_EUCKR +static PRUint16 g_EUCKRMappingTable[] = { +#include "u20ksc.ut" +}; + +static PRInt16 g_EUCKRShiftTable[] = { + 0, u2BytesCharset, + ShiftCell(0, 0, 0, 0, 0, 0, 0, 0) +}; + +static uRange g_EUCKRRanges[] = { + { 0x00, 0x7E }, + { 0x81, 0xFE } +}; +#else + static PRUint16 g_EUCKRMappingTable[] = { #include "u20kscgl.ut" }; static PRInt16 g_EUCKRShiftTable[] = { - 2, uMultibytesCharset, - ShiftCell(u1ByteChar, 1, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F), - ShiftCell(u2BytesChar, 2, 0xA1, 0xFE, 0xA1, 0x40, 0xFE, 0xFE) + 0, u2BytesGRCharset, + ShiftCell(0, 0, 0, 0, 0, 0, 0, 0) }; +static uRange g_EUCKRRanges[] = { + { 0x00, 0x7E }, + { 0xA1, 0xFE } +}; +#endif + + +static PRInt16 *g_EUCKRShiftTableSet [] = { + g_ASCIIShiftTable, + g_EUCKRShiftTable +}; + +static PRUint16 *g_EUCKRMappingTableSet [] ={ + g_ASCIIMappingTable, + g_EUCKRMappingTable +}; + + //---------------------------------------------------------------------- // Class nsEUCKRToUnicode [implementation] nsEUCKRToUnicode::nsEUCKRToUnicode() -: nsTableDecoderSupport((uShiftTable*) &g_EUCKRShiftTable, - (uMappingTable*) &g_EUCKRMappingTable) +: nsTablesDecoderSupport(2, + (uRange*) &g_EUCKRRanges, + (uShiftTable**) &g_EUCKRShiftTableSet, + (uMappingTable**) &g_EUCKRMappingTableSet) { } @@ -48,7 +92,7 @@ nsresult nsEUCKRToUnicode::CreateInstance(nsISupports ** aResult) } //---------------------------------------------------------------------- -// Subclassing of nsTableDecoderSupport class [implementation] +// Subclassing of nsTablesDecoderSupport class [implementation] NS_IMETHODIMP nsEUCKRToUnicode::GetMaxLength(const char * aSrc, PRInt32 aSrcLength, diff --git a/mozilla/intl/uconv/ucvcn/nsEUCKRToUnicode.h b/mozilla/intl/uconv/ucvcn/nsEUCKRToUnicode.h index e88b04c37c6..bb63b2e17dd 100644 --- a/mozilla/intl/uconv/ucvcn/nsEUCKRToUnicode.h +++ b/mozilla/intl/uconv/ucvcn/nsEUCKRToUnicode.h @@ -31,7 +31,7 @@ * @created 06/Apr/1999 * @author Catalin Rotaru [CATA] */ -class nsEUCKRToUnicode : public nsTableDecoderSupport +class nsEUCKRToUnicode : public nsTablesDecoderSupport { public: diff --git a/mozilla/intl/uconv/ucvcn/nsEUCTWToUnicode.cpp b/mozilla/intl/uconv/ucvcn/nsEUCTWToUnicode.cpp index 304d9df669b..39bc167456d 100644 --- a/mozilla/intl/uconv/ucvcn/nsEUCTWToUnicode.cpp +++ b/mozilla/intl/uconv/ucvcn/nsEUCTWToUnicode.cpp @@ -22,22 +22,62 @@ //---------------------------------------------------------------------- // Global functions and data [declaration] -static PRUint16 g_EUCTWMappingTable[] = { +static PRUint16 g_ASCIIMappingTable[] = { + 0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000 +}; + +static PRUint16 g_CNS1MappingTable[] = { #include "cns_1.ut" }; -static PRInt16 g_EUCTWShiftTable[] = { - 2, uMultibytesCharset, - ShiftCell(u1ByteChar, 1, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F), - ShiftCell(u2BytesChar, 2, 0xA1, 0xFE, 0xA1, 0x40, 0xFE, 0xFE) +static PRUint16 g_CNS2MappingTable[] = { +#include "cns_2.ut" }; +static PRInt16 g_ASCIIShiftTable[] = { + 0, u1ByteCharset, + ShiftCell(0,0,0,0,0,0,0,0) +}; + +static PRInt16 g_CNS1ShiftTable[] = { + 0, u2BytesGRCharset, + ShiftCell(0, 0, 0, 0, 0, 0, 0, 0), +}; + + +static PRInt16 g_CNS2ShiftTable[] = { + 0, u2BytesGRPrefix8EA2Charset, + ShiftCell(0, 0, 0, 0, 0, 0, 0, 0), +}; + + +static PRInt16 *g_EUCTWShiftTableSet [] = { + g_ASCIIShiftTable, + g_CNS1ShiftTable, + g_CNS2ShiftTable +}; + +static PRUint16 *g_EUCTWMappingTableSet [] ={ + g_ASCIIMappingTable, + g_CNS1MappingTable, + g_CNS2MappingTable +}; + +static uRange g_EUCTWRanges[] = { + { 0x00, 0x7E }, + { 0xA1, 0xFE }, + { 0x8E, 0x8E } +}; + + //---------------------------------------------------------------------- // Class nsEUCTWToUnicode [implementation] nsEUCTWToUnicode::nsEUCTWToUnicode() -: nsTableDecoderSupport((uShiftTable*) &g_EUCTWShiftTable, - (uMappingTable*) &g_EUCTWMappingTable) +: nsTablesDecoderSupport(3, + (uRange*) &g_EUCTWRanges, + (uShiftTable**) &g_EUCTWShiftTableSet, + (uMappingTable**) &g_EUCTWMappingTableSet) { } @@ -48,7 +88,7 @@ nsresult nsEUCTWToUnicode::CreateInstance(nsISupports ** aResult) } //---------------------------------------------------------------------- -// Subclassing of nsTableDecoderSupport class [implementation] +// Subclassing of nsTablesDecoderSupport class [implementation] NS_IMETHODIMP nsEUCTWToUnicode::GetMaxLength(const char * aSrc, PRInt32 aSrcLength, diff --git a/mozilla/intl/uconv/ucvcn/nsEUCTWToUnicode.h b/mozilla/intl/uconv/ucvcn/nsEUCTWToUnicode.h index c96ff12e8e2..0000448be4e 100644 --- a/mozilla/intl/uconv/ucvcn/nsEUCTWToUnicode.h +++ b/mozilla/intl/uconv/ucvcn/nsEUCTWToUnicode.h @@ -31,7 +31,7 @@ * @created 06/Apr/1999 * @author Catalin Rotaru [CATA] */ -class nsEUCTWToUnicode : public nsTableDecoderSupport +class nsEUCTWToUnicode : public nsTablesDecoderSupport { public: diff --git a/mozilla/intl/uconv/ucvcn/nsGB2312ToUnicode.cpp b/mozilla/intl/uconv/ucvcn/nsGB2312ToUnicode.cpp index 67dc746abba..6ee85b945c6 100644 --- a/mozilla/intl/uconv/ucvcn/nsGB2312ToUnicode.cpp +++ b/mozilla/intl/uconv/ucvcn/nsGB2312ToUnicode.cpp @@ -19,25 +19,53 @@ #include "nsGB2312ToUnicode.h" + + //---------------------------------------------------------------------- // Global functions and data [declaration] +static PRUint16 g_ASCIIMappingTable[] = { + 0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000 +}; static PRUint16 g_GB2312MappingTable[] = { #include "gb2312.ut" }; -static PRInt16 g_GB2312ShiftTable[] = { - 2, uMultibytesCharset, - ShiftCell(u1ByteChar, 1, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F), - ShiftCell(u2BytesChar, 2, 0xA1, 0xFE, 0xA1, 0x40, 0xFE, 0xFE) + +static PRInt16 g_ASCIIShiftTable[] = { + 0, u1ByteCharset, + ShiftCell(0,0,0,0,0,0,0,0) }; +static PRInt16 g_GB2312ShiftTable[] = { + 0, u2BytesGRCharset, + ShiftCell(0,0,0,0,0,0,0,0) +}; + +static PRInt16 *g_GB2312ShiftTableSet [] = { + g_ASCIIShiftTable, + g_GB2312ShiftTable +}; + +static PRUint16 *g_GB2312MappingTableSet [] ={ + g_ASCIIMappingTable, + g_GB2312MappingTable +}; + +static uRange g_GB2312Ranges[] = { + { 0x00, 0x7E }, + { 0xA1, 0xFE } +}; + + //---------------------------------------------------------------------- // Class nsGB2312ToUnicode [implementation] nsGB2312ToUnicode::nsGB2312ToUnicode() -: nsTableDecoderSupport((uShiftTable*) &g_GB2312ShiftTable, - (uMappingTable*) &g_GB2312MappingTable) +: nsTablesDecoderSupport(2, + (uRange *) &g_GB2312Ranges, + (uShiftTable**) &g_GB2312ShiftTableSet, + (uMappingTable**) &g_GB2312MappingTableSet) { } @@ -48,7 +76,7 @@ nsresult nsGB2312ToUnicode::CreateInstance(nsISupports ** aResult) } //---------------------------------------------------------------------- -// Subclassing of nsTableDecoderSupport class [implementation] +// Subclassing of nsTablesDecoderSupport class [implementation] NS_IMETHODIMP nsGB2312ToUnicode::GetMaxLength(const char * aSrc, PRInt32 aSrcLength, diff --git a/mozilla/intl/uconv/ucvcn/nsGB2312ToUnicode.h b/mozilla/intl/uconv/ucvcn/nsGB2312ToUnicode.h index 04f7470923e..f6af46038b6 100644 --- a/mozilla/intl/uconv/ucvcn/nsGB2312ToUnicode.h +++ b/mozilla/intl/uconv/ucvcn/nsGB2312ToUnicode.h @@ -31,7 +31,7 @@ * @created 06/Apr/1999 * @author Catalin Rotaru [CATA] */ -class nsGB2312ToUnicode : public nsTableDecoderSupport +class nsGB2312ToUnicode : public nsTablesDecoderSupport { public: diff --git a/mozilla/intl/uconv/ucvcn/nsUCvCnDll.cpp b/mozilla/intl/uconv/ucvcn/nsUCvCnDll.cpp index 08668dd1683..4138b45a9ae 100644 --- a/mozilla/intl/uconv/ucvcn/nsUCvCnDll.cpp +++ b/mozilla/intl/uconv/ucvcn/nsUCvCnDll.cpp @@ -75,7 +75,7 @@ FactoryData g_FactoryData[] = { &kEUCTWToUnicodeCID, nsEUCTWToUnicode::CreateInstance, - "EUCTW", + "X-EUC-TW", "Unicode" }, { @@ -87,7 +87,7 @@ FactoryData g_FactoryData[] = { &kEUCKRToUnicodeCID, nsEUCKRToUnicode::CreateInstance, - "EUCKR", + "EUC-KR", "Unicode" }, { @@ -100,7 +100,7 @@ FactoryData g_FactoryData[] = &kUnicodeToEUCTWCID, nsUnicodeToEUCTW::CreateInstance, "Unicode", - "EUCTW" + "X-EUC-TW" }, { &kUnicodeToGB2312CID, @@ -112,7 +112,7 @@ FactoryData g_FactoryData[] = &kUnicodeToEUCKRCID, nsUnicodeToEUCKR::CreateInstance, "Unicode", - "EUCKR" + "EUC-KR" } };