This commit is contained in:
ftang%netscape.com 1999-06-08 23:13:06 +00:00
Родитель 6df53083ce
Коммит 8714e2d50e
7 изменённых файлов: 134 добавлений и 15 удалений

Просмотреть файл

@ -31,6 +31,7 @@ CSRCS = \
CPPSRCS = \ CPPSRCS = \
nsBIG5ToUnicode.cpp \ nsBIG5ToUnicode.cpp \
nsUnicodeToBIG5.cpp \ nsUnicodeToBIG5.cpp \
nsUnicodeToBIG5NoAscii.cpp \
nsUCvTWSupport.cpp \ nsUCvTWSupport.cpp \
nsUCvTWDll.cpp \ nsUCvTWDll.cpp \
$(NULL) $(NULL)

Просмотреть файл

@ -18,16 +18,11 @@
*/ */
#include "nsBIG5ToUnicode.h" #include "nsBIG5ToUnicode.h"
#include "nsUCvTWDll.h"
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Global functions and data [declaration] // Global functions and data [declaration]
static PRUint16 g_BIG5MappingTable[] = {
#include "big5.ut"
};
static PRUint16 g_ASCIIMappingTable[] = {
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
};
static PRInt16 g_BIG5ShiftTable[] = { static PRInt16 g_BIG5ShiftTable[] = {
0, u2BytesCharset, 0, u2BytesCharset,
@ -45,8 +40,8 @@ static PRInt16 *g_BIG5ShiftTableSet [] = {
}; };
static PRUint16 *g_BIG5MappingTableSet [] ={ static PRUint16 *g_BIG5MappingTableSet [] ={
g_ASCIIMappingTable, g_ASCIIMapping,
g_BIG5MappingTable g_utBIG5Mapping
}; };
static uRange g_BIG5Ranges[] = { static uRange g_BIG5Ranges[] = {

Просмотреть файл

@ -48,6 +48,16 @@ static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
PRInt32 g_InstanceCount = 0; PRInt32 g_InstanceCount = 0;
PRInt32 g_LockCount = 0; PRInt32 g_LockCount = 0;
PRUint16 g_ufBig5Mapping[] = {
#include "big5.uf"
};
PRUint16 g_utBIG5Mapping[] = {
#include "big5.ut"
};
PRUint16 g_ASCIIMapping[] = {
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
};
typedef nsresult (* fpCreateInstance) (nsISupports **); typedef nsresult (* fpCreateInstance) (nsISupports **);
struct FactoryData struct FactoryData

Просмотреть файл

@ -24,5 +24,8 @@
extern "C" PRInt32 g_InstanceCount; extern "C" PRInt32 g_InstanceCount;
extern "C" PRInt32 g_LockCount; extern "C" PRInt32 g_LockCount;
extern "C" PRUint16 g_ufBig5Mapping[];
extern "C" PRUint16 g_utBIG5Mapping[];
extern "C" PRUint16 g_ASCIIMapping[];
#endif /* nsUCvTWDll_h___ */ #endif /* nsUCvTWDll_h___ */

Просмотреть файл

@ -18,13 +18,11 @@
*/ */
#include "nsUnicodeToBIG5.h" #include "nsUnicodeToBIG5.h"
#include "nsUCvTWDll.h"
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Global functions and data [declaration] // Global functions and data [declaration]
static PRUint16 g_ufBig5Mapping[] = {
#include "big5.uf"
};
static PRUint16 gAsciiShiftTable[] = { static PRUint16 gAsciiShiftTable[] = {
0, u1ByteCharset, 0, u1ByteCharset,
@ -36,12 +34,9 @@ static PRUint16 gBig5ShiftTable[] = {
ShiftCell(0, 0, 0, 0, 0, 0, 0, 0), ShiftCell(0, 0, 0, 0, 0, 0, 0, 0),
}; };
static PRUint16 g_AsciiMapping[] = {
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
};
static PRUint16 *g_Big5MappingTable[2] = { static PRUint16 *g_Big5MappingTable[2] = {
g_AsciiMapping, g_ASCIIMapping,
g_ufBig5Mapping g_ufBig5Mapping
}; };

Просмотреть файл

@ -0,0 +1,60 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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/NPL/
*
* 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 Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#include "nsUnicodeToBIG5NoAscii.h"
#include "nsUCvTWDll.h"
//----------------------------------------------------------------------
// Global functions and data [declaration]
static PRUint16 gBig5ShiftTable[] = {
0, u2BytesCharset,
ShiftCell(0, 0, 0, 0, 0, 0, 0, 0),
};
//----------------------------------------------------------------------
// Class nsUnicodeToBIG5NoAscii [implementation]
nsUnicodeToBIG5NoAscii::nsUnicodeToBIG5NoAscii()
: nsTableEncoderSupport( (uShiftTable*) &gBig5ShiftTable,
(uMappingTable*) &g_ufBig5Mapping)
{
}
nsresult nsUnicodeToBIG5NoAscii::CreateInstance(nsISupports ** aResult)
{
nsIUnicodeEncoder *p = new nsUnicodeToBIG5NoAscii();
if(p) {
*aResult = p;
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
}
//----------------------------------------------------------------------
// Subclassing of nsTableEncoderSupport class [implementation]
NS_IMETHODIMP nsUnicodeToBIG5NoAscii::GetMaxLength(const PRUnichar * aSrc,
PRInt32 aSrcLength,
PRInt32 * aDestLength)
{
*aDestLength = 2 * aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

Просмотреть файл

@ -0,0 +1,55 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (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/NPL/
*
* 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 Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are Copyright (C) 1998
* Netscape Communications Corporation. All Rights Reserved.
*/
#ifndef nsUnicodeToBIG5NoAscii_h___
#define nsUnicodeToBIG5NoAscii_h___
#include "nsUCvTWSupport.h"
//----------------------------------------------------------------------
// Class nsUnicodeToBIG5NoAscii [declaration]
/**
* A character set converter from Unicode to BIG5NoAscii.
*
*/
class nsUnicodeToBIG5NoAscii : public nsTableEncoderSupport
{
public:
/**
* Class constructor.
*/
nsUnicodeToBIG5NoAscii();
/**
* Static class constructor.
*/
static nsresult CreateInstance(nsISupports **aResult);
protected:
//--------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [declaration]
NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength,
PRInt32 * aDestLength);
};
#endif /* nsUnicodeToBIG5NoAscii_h___ */