зеркало из https://github.com/mozilla/pjs.git
Latin1 -> ISO88591
This commit is contained in:
Родитель
20533c9765
Коммит
861397f47a
|
@ -20,7 +20,7 @@
|
|||
mDecSize = 20;
|
||||
mDecArray = new ConverterInfo [mDecSize];
|
||||
|
||||
mDecArray[0].mCID = &kLatin1ToUnicodeCID;
|
||||
mDecArray[0].mCID = &kISO88591ToUnicodeCID;
|
||||
mDecArray[1].mCID = &kISO88592ToUnicodeCID;
|
||||
mDecArray[2].mCID = &kISO88597ToUnicodeCID;
|
||||
mDecArray[3].mCID = &kISO88599ToUnicodeCID;
|
||||
|
@ -46,7 +46,7 @@
|
|||
mEncSize = 19;
|
||||
mEncArray = new ConverterInfo [mEncSize];
|
||||
|
||||
mEncArray[0].mCID = &kUnicodeToLatin1CID;
|
||||
mEncArray[0].mCID = &kUnicodeToISO88591CID;
|
||||
mEncArray[1].mCID = &kUnicodeToISO88592CID;
|
||||
mEncArray[2].mCID = &kUnicodeToISO88597CID;
|
||||
mEncArray[3].mCID = &kUnicodeToISO88599CID;
|
||||
|
|
|
@ -29,7 +29,7 @@ CSRCS = \
|
|||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
nsLatin1ToUnicode.cpp \
|
||||
nsISO88591ToUnicode.cpp \
|
||||
nsISO88592ToUnicode.cpp \
|
||||
nsISO88597ToUnicode.cpp \
|
||||
nsISO88599ToUnicode.cpp \
|
||||
|
@ -42,7 +42,7 @@ CPPSRCS = \
|
|||
nsMacGreekToUnicode.cpp \
|
||||
nsMacTurkishToUnicode.cpp \
|
||||
nsUTF8ToUnicode.cpp \
|
||||
nsUnicodeToLatin1.cpp \
|
||||
nsUnicodeToISO88591.cpp \
|
||||
nsUnicodeToISO88592.cpp \
|
||||
nsUnicodeToISO88597.cpp \
|
||||
nsUnicodeToISO88599.cpp \
|
||||
|
|
|
@ -27,7 +27,7 @@ DLLNAME = ucvlatin
|
|||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
CPPSRCS = \
|
||||
nsLatin1ToUnicode.cpp \
|
||||
nsISO88591ToUnicode.cpp \
|
||||
nsISO88592ToUnicode.cpp \
|
||||
nsISO88597ToUnicode.cpp \
|
||||
nsISO88599ToUnicode.cpp \
|
||||
|
@ -40,7 +40,7 @@ CPPSRCS = \
|
|||
nsMacGreekToUnicode.cpp \
|
||||
nsMacTurkishToUnicode.cpp \
|
||||
nsUTF8ToUnicode.cpp \
|
||||
nsUnicodeToLatin1.cpp \
|
||||
nsUnicodeToISO88591.cpp \
|
||||
nsUnicodeToISO88592.cpp \
|
||||
nsUnicodeToISO88597.cpp \
|
||||
nsUnicodeToISO88599.cpp \
|
||||
|
@ -59,7 +59,7 @@ CPPSRCS = \
|
|||
$(NULL)
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsLatin1ToUnicode.obj \
|
||||
.\$(OBJDIR)\nsISO88591ToUnicode.obj \
|
||||
.\$(OBJDIR)\nsISO88592ToUnicode.obj \
|
||||
.\$(OBJDIR)\nsISO88597ToUnicode.obj \
|
||||
.\$(OBJDIR)\nsISO88599ToUnicode.obj \
|
||||
|
@ -72,7 +72,7 @@ CPP_OBJS= \
|
|||
.\$(OBJDIR)\nsMacGreekToUnicode.obj \
|
||||
.\$(OBJDIR)\nsMacTurkishToUnicode.obj \
|
||||
.\$(OBJDIR)\nsUTF8ToUnicode.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToLatin1.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToISO88591.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToISO88592.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToISO88597.obj \
|
||||
.\$(OBJDIR)\nsUnicodeToISO88599.obj \
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- 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 "nsISO88591ToUnicode.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_utMappingTable[] = {
|
||||
#include "cp1252.ut"
|
||||
};
|
||||
|
||||
static PRInt16 g_utShiftTable[] = {
|
||||
0, u1ByteCharset ,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsISO88591ToUnicode [implementation]
|
||||
|
||||
nsISO88591ToUnicode::nsISO88591ToUnicode()
|
||||
: nsOneByteDecoderSupport((uShiftTable*) &g_utShiftTable,
|
||||
(uMappingTable*) &g_utMappingTable)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsISO88591ToUnicode::CreateInstance(nsISupports ** aResult)
|
||||
{
|
||||
*aResult = new nsISO88591ToUnicode();
|
||||
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/* -*- 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 nsISO88591ToUnicode_h___
|
||||
#define nsISO88591ToUnicode_h___
|
||||
|
||||
#include "nsUCvLatinSupport.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsISO88591ToUnicode [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from ISO88591 to Unicode.
|
||||
*
|
||||
* @created 23/Nov/1998
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsISO88591ToUnicode : public nsOneByteDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsISO88591ToUnicode();
|
||||
|
||||
/**
|
||||
* Static class constructor.
|
||||
*/
|
||||
static nsresult CreateInstance(nsISupports **aResult);
|
||||
};
|
||||
|
||||
#endif /* nsISO88591ToUnicode_h___ */
|
|
@ -22,9 +22,9 @@
|
|||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// Class ID for our Latin1ToUnicode charset converter
|
||||
// Class ID for our ISO88591ToUnicode charset converter
|
||||
// {A3254CB0-8E20-11d2-8A98-00600811A836}
|
||||
NS_DECLARE_ID(kLatin1ToUnicodeCID,
|
||||
NS_DECLARE_ID(kISO88591ToUnicodeCID,
|
||||
0xa3254cb0, 0x8e20, 0x11d2, 0x8a, 0x98, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
|
||||
// Class ID for our ISO88592ToUnicode charset converter
|
||||
|
@ -87,9 +87,9 @@ NS_DECLARE_ID(kMacTurkishToUnicodeCID,
|
|||
NS_DECLARE_ID(kUTF8ToUnicodeCID,
|
||||
0x5534ddc0, 0xdd96, 0x11d2, 0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
|
||||
// Class ID for our UnicodeToLatin1 charset converter
|
||||
// Class ID for our UnicodeToISO88591 charset converter
|
||||
// {920307B0-C6E8-11d2-8AA8-00600811A836}
|
||||
NS_DECLARE_ID(kUnicodeToLatin1CID,
|
||||
NS_DECLARE_ID(kUnicodeToISO88591CID,
|
||||
0x920307b0, 0xc6e8, 0x11d2, 0x8a, 0xa8, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36);
|
||||
|
||||
// Class ID for our UnicodeToISO88592 charset converter
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "nsICharsetConverterInfo.h"
|
||||
#include "nsUCvLatinCID.h"
|
||||
#include "nsUCvLatinDll.h"
|
||||
#include "nsLatin1ToUnicode.h"
|
||||
#include "nsISO88591ToUnicode.h"
|
||||
#include "nsISO88592ToUnicode.h"
|
||||
#include "nsISO88597ToUnicode.h"
|
||||
#include "nsISO88599ToUnicode.h"
|
||||
|
@ -40,7 +40,7 @@
|
|||
#include "nsMacGreekToUnicode.h"
|
||||
#include "nsMacTurkishToUnicode.h"
|
||||
#include "nsUTF8ToUnicode.h"
|
||||
#include "nsUnicodeToLatin1.h"
|
||||
#include "nsUnicodeToISO88591.h"
|
||||
#include "nsUnicodeToISO88592.h"
|
||||
#include "nsUnicodeToISO88597.h"
|
||||
#include "nsUnicodeToISO88599.h"
|
||||
|
@ -85,8 +85,8 @@ struct FactoryData
|
|||
FactoryData g_FactoryData[] =
|
||||
{
|
||||
{
|
||||
&kLatin1ToUnicodeCID,
|
||||
nsLatin1ToUnicode::CreateInstance,
|
||||
&kISO88591ToUnicodeCID,
|
||||
nsISO88591ToUnicode::CreateInstance,
|
||||
"ISO-8859-1",
|
||||
"Unicode"
|
||||
},
|
||||
|
@ -163,8 +163,8 @@ FactoryData g_FactoryData[] =
|
|||
"Unicode"
|
||||
},
|
||||
{
|
||||
&kUnicodeToLatin1CID,
|
||||
nsUnicodeToLatin1::CreateInstance,
|
||||
&kUnicodeToISO88591CID,
|
||||
nsUnicodeToISO88591::CreateInstance,
|
||||
"Unicode",
|
||||
"ISO-8859-1"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/* -*- 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 "nsUnicodeToISO88591.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static PRUint16 g_ufMappingTable[] = {
|
||||
#include "8859-1.uf"
|
||||
};
|
||||
|
||||
static PRInt16 g_ufShiftTable[] = {
|
||||
0, u1ByteCharset ,
|
||||
ShiftCell(0,0,0,0,0,0,0,0)
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToISO88591 [implementation]
|
||||
|
||||
nsUnicodeToISO88591::nsUnicodeToISO88591()
|
||||
: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable,
|
||||
(uMappingTable*) &g_ufMappingTable)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsUnicodeToISO88591::CreateInstance(nsISupports ** aResult)
|
||||
{
|
||||
*aResult = new nsUnicodeToISO88591();
|
||||
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsTableEncoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToISO88591::GetMaxLength(const PRUnichar * aSrc,
|
||||
PRInt32 aSrcLength,
|
||||
PRInt32 * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK_UENC_EXACTLENGTH;
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/* -*- 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 nsUnicodeToISO88591_h___
|
||||
#define nsUnicodeToISO88591_h___
|
||||
|
||||
#include "nsUCvLatinSupport.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToISO88591 [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to ISO88591.
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeToISO88591 : public nsTableEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUnicodeToISO88591();
|
||||
|
||||
/**
|
||||
* 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 /* nsUnicodeToISO88591_h___ */
|
Загрузка…
Ссылка в новой задаче