From 7228baf9bc513c1c4faa03b97ab6d9730415e116 Mon Sep 17 00:00:00 2001 From: "pkw%us.ibm.com" Date: Tue, 9 Mar 2004 14:14:55 +0000 Subject: [PATCH] Bug 210629 - Add encoder/decoder for (x-)IBM-1046 used for Arabic on AIX. r=jshin@mailaps.org, sr=roc@ocallahan.org --- gfx/src/gtk/nsFontMetricsGTK.cpp | 5 + gfx/src/xlib/nsFontMetricsXlib.cpp | 5 + intl/uconv/src/charsetData.properties | 4 + intl/uconv/src/nsUConvModule.cpp | 24 +++ intl/uconv/src/unixcharset.properties | 3 +- intl/uconv/ucvibm/Makefile.in | 7 + intl/uconv/ucvibm/cp1046.uf | 260 ++++++++++++++++++++++++ intl/uconv/ucvibm/cp1046.ut | 154 ++++++++++++++ intl/uconv/ucvibm/nsCP1046ToUnicode.cpp | 63 ++++++ intl/uconv/ucvibm/nsCP1046ToUnicode.h | 50 +++++ intl/uconv/ucvibm/nsUCvIBMCID.h | 13 ++ intl/uconv/ucvibm/nsUnicodeToCP1046.cpp | 61 ++++++ intl/uconv/ucvibm/nsUnicodeToCP1046.h | 52 +++++ 13 files changed, 700 insertions(+), 1 deletion(-) create mode 100644 intl/uconv/ucvibm/cp1046.uf create mode 100644 intl/uconv/ucvibm/cp1046.ut create mode 100644 intl/uconv/ucvibm/nsCP1046ToUnicode.cpp create mode 100644 intl/uconv/ucvibm/nsCP1046ToUnicode.h create mode 100644 intl/uconv/ucvibm/nsUnicodeToCP1046.cpp create mode 100644 intl/uconv/ucvibm/nsUnicodeToCP1046.h diff --git a/gfx/src/gtk/nsFontMetricsGTK.cpp b/gfx/src/gtk/nsFontMetricsGTK.cpp index 0403314dfea5..06af6dab12f2 100644 --- a/gfx/src/gtk/nsFontMetricsGTK.cpp +++ b/gfx/src/gtk/nsFontMetricsGTK.cpp @@ -25,6 +25,7 @@ * Brian Stell * Morten Nilsen * Jungshik Shin + * IBM Corporation * * * Alternatively, the contents of this file may be used under the terms of @@ -250,6 +251,9 @@ static nsFontCharSetInfo ISO885968x = static nsFontCharSetInfo ISO8859616 = { "x-iso-8859-6-16", SingleByteConvert, 0, TT_OS2_CPR1_ARABIC, TT_OS2_CPR2_ARABIC | TT_OS2_CPR2_ARABIC_708 }; +static nsFontCharSetInfo IBM1046 = + { "x-IBM1046", SingleByteConvert, 0, + TT_OS2_CPR1_ARABIC, TT_OS2_CPR2_ARABIC | TT_OS2_CPR2_ARABIC_708 }; static nsFontCharSetInfo ISO88597 = { "ISO-8859-7", SingleByteConvert, 0, TT_OS2_CPR1_GREEK, TT_OS2_CPR2_GREEK | TT_OS2_CPR2_GREEK_437G }; @@ -539,6 +543,7 @@ static nsFontCharSetMap gCharSetMap[] = { "hpbig5-", &FLG_ZHTW, &Big5 }, { "hphkbig5-", &FLG_ZHHK, &HKSCS }, { "hproc16-", &FLG_NONE, &Unknown }, + { "ibm-1046", &FLG_ARABIC, &IBM1046 }, { "ibm-1252", &FLG_NONE, &Unknown }, { "ibm-850", &FLG_NONE, &Unknown }, { "ibm-fontspecific", &FLG_NONE, &Unknown }, diff --git a/gfx/src/xlib/nsFontMetricsXlib.cpp b/gfx/src/xlib/nsFontMetricsXlib.cpp index 76ac9d0f0035..4378b6d56c9a 100644 --- a/gfx/src/xlib/nsFontMetricsXlib.cpp +++ b/gfx/src/xlib/nsFontMetricsXlib.cpp @@ -28,6 +28,7 @@ * Roland Mainz * Brian Stell * Jungshik Shin + * IBM Corporation * * * Alternatively, the contents of this file may be used under the terms of @@ -315,6 +316,9 @@ static nsFontCharSetInfoXlib ISO885968x = static nsFontCharSetInfoXlib ISO8859616 = { "x-iso-8859-6-16", SingleByteConvert, 0, TT_OS2_CPR1_ARABIC, TT_OS2_CPR2_ARABIC | TT_OS2_CPR2_ARABIC_708 }; +static nsFontCharSetInfoXlib IBM1046 = + { "x-IBM1046", SingleByteConvert, 0, + TT_OS2_CPR1_ARABIC, TT_OS2_CPR2_ARABIC | TT_OS2_CPR2_ARABIC_708 }; static nsFontCharSetInfoXlib ISO88597 = { "ISO-8859-7", SingleByteConvert, 0, TT_OS2_CPR1_GREEK, TT_OS2_CPR2_GREEK | TT_OS2_CPR2_GREEK_437G }; @@ -604,6 +608,7 @@ static const nsFontCharSetMapXlib gConstCharSetMap[] = { "hpbig5-", &FLG_ZHTW, &Big5 }, { "hphkbig5-", &FLG_ZHHK, &HKSCS }, { "hproc16-", &FLG_NONE, &Unknown }, + { "ibm-1046", &FLG_ARABIC, &IBM1046 }, { "ibm-1252", &FLG_NONE, &Unknown }, { "ibm-850", &FLG_NONE, &Unknown }, { "ibm-fontspecific", &FLG_NONE, &Unknown }, diff --git a/intl/uconv/src/charsetData.properties b/intl/uconv/src/charsetData.properties index 1cc26b2e76b2..d67428e7e7c4 100644 --- a/intl/uconv/src/charsetData.properties +++ b/intl/uconv/src/charsetData.properties @@ -17,6 +17,7 @@ ## Rights Reserved. ## ## Contributor(s): +## IBM Corporation ## Jungshik Shin ## Rule of this file: @@ -49,6 +50,7 @@ x-obsoleted-shift_jis.notForBrowser = true iso-8859-6-e.notForBrowser = true iso-8859-6-i.notForBrowser = true ibm864i.notForBrowser = true +x-ibm1046.notForBrowser = true iso-8859-8-e.notForBrowser = true t.61-8bit.notForOutgoing = true @@ -63,6 +65,7 @@ x-obsoleted-shift_jis.notForOutgoing = true iso-8859-6-e.notForOutgoing = true iso-8859-6-i.notForOutgoing = true ibm864i.notForOutgoing = true +x-ibm1046.notForOutgoing = true iso-8859-8-e.notForOutgoing = true iso-8859-8.notForOutgoing = true iso-2022-kr.notForOutgoing = true @@ -92,6 +95,7 @@ ibm857.LangGroup = tr ibm862.LangGroup = he ibm864.LangGroup = ar ibm866.LangGroup = x-cyrillic +x-ibm1046.LangGroup = ar iso-2022-cn.LangGroup = zh-CN iso-2022-jp.LangGroup = ja iso-2022-kr.LangGroup = ko diff --git a/intl/uconv/src/nsUConvModule.cpp b/intl/uconv/src/nsUConvModule.cpp index 364861206f2e..c4bb9cc3b23f 100644 --- a/intl/uconv/src/nsUConvModule.cpp +++ b/intl/uconv/src/nsUConvModule.cpp @@ -21,6 +21,7 @@ * * Contributor(s): * Pierre Phaneuf + * IBM Corporation * * * Alternatively, the contents of this file may be used under the terms of @@ -225,6 +226,9 @@ #include "nsCP862ToUnicode.h" #include "nsCP864ToUnicode.h" #include "nsCP864iToUnicode.h" +#ifdef MOZ_EXTRA_X11CONVERTERS +#include "nsCP1046ToUnicode.h" +#endif #include "nsUnicodeToCP850.h" #include "nsUnicodeToCP852.h" #include "nsUnicodeToCP855.h" @@ -232,6 +236,9 @@ #include "nsUnicodeToCP862.h" #include "nsUnicodeToCP864.h" #include "nsUnicodeToCP864i.h" +#ifdef MOZ_EXTRA_X11CONVERTERS +#include "nsUnicodeToCP1046.h" +#endif // ucvja #include "nsUCVJACID.h" @@ -402,6 +409,9 @@ NS_UCONV_REG_UNREG("IBM857", NS_CP857TOUNICODE_CID, NS_UNICODETOCP857_CID) NS_UCONV_REG_UNREG("IBM862", NS_CP862TOUNICODE_CID, NS_UNICODETOCP862_CID) NS_UCONV_REG_UNREG("IBM864", NS_CP864TOUNICODE_CID, NS_UNICODETOCP864_CID) NS_UCONV_REG_UNREG("IBM864i", NS_CP864ITOUNICODE_CID, NS_UNICODETOCP864I_CID) +#ifdef MOZ_EXTRA_X11CONVERTERS +NS_UCONV_REG_UNREG("x-IBM1046", NS_CP1046TOUNICODE_CID, NS_UNICODETOCP1046_CID) +#endif // ucvja NS_UCONV_REG_UNREG("Shift_JIS", NS_SJISTOUNICODE_CID, NS_UNICODETOSJIS_CID) @@ -1489,6 +1499,13 @@ static const nsModuleComponentInfo components[] = NS_UNICODEDECODER_CONTRACTID_BASE "IBM864i", nsCP864iToUnicodeConstructor , }, +#ifdef MOZ_EXTRA_X11CONVERTERS + { + DECODER_NAME_BASE "x-IBM1046" , NS_CP1046TOUNICODE_CID, + NS_UNICODEDECODER_CONTRACTID_BASE "x-IBM1046", + nsCP1046ToUnicodeConstructor , + }, +#endif { ENCODER_NAME_BASE "IBM850" , NS_UNICODETOCP850_CID, NS_UNICODEENCODER_CONTRACTID_BASE "IBM850", @@ -1524,6 +1541,13 @@ static const nsModuleComponentInfo components[] = NS_UNICODEENCODER_CONTRACTID_BASE "IBM864i", nsUnicodeToCP864iConstructor, }, +#ifdef MOZ_EXTRA_X11CONVERTERS + { + ENCODER_NAME_BASE "x-IBM1046" , NS_UNICODETOCP1046_CID, + NS_UNICODEENCODER_CONTRACTID_BASE "x-IBM1046", + nsUnicodeToCP1046Constructor, + }, +#endif // ucvja { DECODER_NAME_BASE "Shift_JIS" , NS_SJISTOUNICODE_CID, diff --git a/intl/uconv/src/unixcharset.properties b/intl/uconv/src/unixcharset.properties index bd5144dd584e..c8585aa40846 100644 --- a/intl/uconv/src/unixcharset.properties +++ b/intl/uconv/src/unixcharset.properties @@ -22,6 +22,7 @@ ## Rights Reserved. ## ## Contributor(s): +## IBM Corporation ## ## ## Platform specific section. @@ -68,7 +69,7 @@ locale.SCOOS5.0.japanese=Shift_JIS # AIX locale.all.ar_AA=ISO-8859-6 # AIX -#locale.all.Ar_AA=IBM-1046 +locale.all.Ar_AA=x-IBM1046 # Solaris locale.all.Ar_ARM=ISO-8859-6 locale.all.american.iso88591=ISO-8859-1 diff --git a/intl/uconv/ucvibm/Makefile.in b/intl/uconv/ucvibm/Makefile.in index f8bacef204a3..43e9495c673c 100644 --- a/intl/uconv/ucvibm/Makefile.in +++ b/intl/uconv/ucvibm/Makefile.in @@ -52,6 +52,13 @@ CPPSRCS = \ nsUnicodeToCP864i.cpp \ $(NULL) +ifdef MOZ_EXTRA_X11CONVERTERS +CPPSRCS += \ + nsCP1046ToUnicode.cpp \ + nsUnicodeToCP1046.cpp \ + $(NULL) +endif + EXPORTS = nsUCvIBMCID.h LOCAL_INCLUDES = -I$(srcdir)/../util diff --git a/intl/uconv/ucvibm/cp1046.uf b/intl/uconv/ucvibm/cp1046.uf new file mode 100644 index 000000000000..0794df2ac01d --- /dev/null +++ b/intl/uconv/ucvibm/cp1046.uf @@ -0,0 +1,260 @@ +/* ***** 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * IBM Corporation + * + * 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 ***** */ +/*======================================================== + This is a Generated file. Please don't edit it. + + The tool which used to generate this file is called umaptable. + You can find this tool under mozilla/intl/uconv/tools/umaptable.c. + If you have any problem of this file. Please contact + Netscape Client International Team or + ftang@netscape + + Table in Debug form +Begin of Item 0000 + Format 0 + srcBegin = 0000 + srcEnd = 007F + destBegin = 0000 +End of Item 0000 + +Begin of Item 0001 + Format 0 + srcBegin = 0621 + srcEnd = 063A + destBegin = 00C1 +End of Item 0001 + +Begin of Item 0002 + Format 0 + srcBegin = 0640 + srcEnd = 0652 + destBegin = 00E0 +End of Item 0002 + +Begin of Item 0003 + Format 0 + srcBegin = 0660 + srcEnd = 0669 + destBegin = 00B0 +End of Item 0003 + +Begin of Item 0004 + Format 0 + srcBegin = FF01 + srcEnd = FF5E + destBegin = 0021 +End of Item 0004 + +Begin of Item 0005 + Format 2 + srcBegin = 0088 + destBegin = 0088 +End of Item 0005 + +Begin of Item 0006 + Format 1 + srcBegin = 00A0 + srcEnd = 00AD + mappingOffset = 0000 + Mapping = + 00A0 FFFD FFFD FFFD 00A4 FFFD FFFD FFFD + FFFD FFFD FFFD FFFD FFFD 00AD +End of Item 0006 + +Begin of Item 0007 + Format 2 + srcBegin = 00D7 + destBegin = 0081 +End of Item 0007 + +Begin of Item 0008 + Format 2 + srcBegin = 00F7 + destBegin = 0082 +End of Item 0008 + +Begin of Item 0009 + Format 2 + srcBegin = 060C + destBegin = 00AC +End of Item 0009 + +Begin of Item 000A + Format 1 + srcBegin = 061B + srcEnd = 061F + mappingOffset = 000E + Mapping = + 00BB FFFD FFFD FFFD 00BF +End of Item 000A + +Begin of Item 000B + Format 1 + srcBegin = 066A + srcEnd = 066D + mappingOffset = 0013 + Mapping = + 0025 002C 002E 002A +End of Item 000B + +Begin of Item 000C + Format 2 + srcBegin = 200B + destBegin = 00F6 +End of Item 000C + +Begin of Item 000D + Format 1 + srcBegin = 2500 + srcEnd = 2518 + mappingOffset = 0017 + Mapping = + 008B FFFD 008A FFFD FFFD FFFD FFFD FFFD + FFFD FFFD FFFD FFFD 008D FFFD FFFD FFFD + 008C FFFD FFFD FFFD 008E FFFD FFFD FFFD + 008F +End of Item 000D + +Begin of Item 000E + Format 2 + srcBegin = 25A0 + destBegin = 0089 +End of Item 000E + +Begin of Item 000F + Format 1 + srcBegin = FE70 + srcEnd = FEFC + mappingOffset = 0030 + Mapping = + 00EB 0087 00EC FFFD 00ED FFFD 00EE 0094 + 00EF 0090 00F0 0091 00F1 0092 00F2 0093 + 00C1 00C2 00DC 00C3 00DD 00C4 00C4 00C5 + 0080 00C6 0095 00A6 00A6 00C7 00DE 00C8 + 00C8 00A7 00A7 00C9 00C9 00CA 00CA 00A8 + 00A8 00CB 00CB 00A9 00A9 00CC 00CC 00AA + 00AA 00CD 00CD 00AB 00AB 00CE 00CE 00AE + 00AE 00CF 00CF 00D0 00D0 00D1 00D1 00D2 + 00D2 00D3 00D3 00AF 00AF 00D4 00D4 00BA + 00BA 00D5 00D5 00BC 00BC 00D6 00D6 00BD + 00BD 00D7 00D7 00D7 00D7 00D8 00D8 00D8 + 00D8 00D9 00BE 00C0 00DB 00DA 0099 009A + 009B 00E1 00E1 00DF 00DF 00E2 00E2 00F3 + 00F3 00E3 00E3 00F4 00F4 00E4 00E4 00F5 + 00F5 00E5 00E5 00FB 00FB 00E6 00E6 00FC + 00FC 00FE 00FE 00E7 00FD 00E8 00E8 00E9 + 0096 00EA 0098 0097 0097 00F7 009C 00F8 + 009D 00F9 009E 00FA 009F +End of Item 000F + +Begin of Item 0010 + Format 1 + srcBegin = FFE8 + srcEnd = FFED + mappingOffset = 00BD + Mapping = + 008A FFFD FFFD FFFD FFFD 0089 +End of Item 0010 + +========================================================*/ +/* Offset=0x0000 ItemOfList */ + 0x0011, +/*-------------------------------------------------------*/ +/* Offset=0x0001 offsetToFormatArray */ + 0x0004, +/*-------------------------------------------------------*/ +/* Offset=0x0002 offsetToMapCellArray */ + 0x0009, +/*-------------------------------------------------------*/ +/* Offset=0x0003 offsetToMappingTable */ + 0x003C, +/*-------------------------------------------------------*/ +/* Offset=0x0004 Start of Format Array */ +/* Total of Format 0 : 0x0005 */ +/* Total of Format 1 : 0x0006 */ +/* Total of Format 2 : 0x0006 */ +/* Total of Format 3 : 0x0000 */ + +0x0000, 0x2120, 0x1122, 0x1212, 0x0001, +/*-------------------------------------------------------*/ +/* Offset=0x0009 Start of MapCell Array */ +/* 0000 */ 0x0000, 0x007F, 0x0000, +/* 0001 */ 0x0621, 0x063A, 0x00C1, +/* 0002 */ 0x0640, 0x0652, 0x00E0, +/* 0003 */ 0x0660, 0x0669, 0x00B0, +/* 0004 */ 0xFF01, 0xFF5E, 0x0021, +/* 0005 */ 0x0088, 0x0000, 0x0088, +/* 0006 */ 0x00A0, 0x00AD, 0x0000, +/* 0007 */ 0x00D7, 0x0000, 0x0081, +/* 0008 */ 0x00F7, 0x0000, 0x0082, +/* 0009 */ 0x060C, 0x0000, 0x00AC, +/* 000A */ 0x061B, 0x061F, 0x000E, +/* 000B */ 0x066A, 0x066D, 0x0013, +/* 000C */ 0x200B, 0x0000, 0x00F6, +/* 000D */ 0x2500, 0x2518, 0x0017, +/* 000E */ 0x25A0, 0x0000, 0x0089, +/* 000F */ 0xFE70, 0xFEFC, 0x0030, +/* 0010 */ 0xFFE8, 0xFFED, 0x00BD, +/*-------------------------------------------------------*/ +/* Offset=0x003C Start of MappingTable */ + +/* 0000 */ 0x00A0, 0xFFFD, 0xFFFD, 0xFFFD, 0x00A4, 0xFFFD, 0xFFFD, 0xFFFD, +/* 0008 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00AD, 0x00BB, 0xFFFD, +/* 0010 */ 0xFFFD, 0xFFFD, 0x00BF, 0x0025, 0x002C, 0x002E, 0x002A, 0x008B, +/* 0018 */ 0xFFFD, 0x008A, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, +/* 0020 */ 0xFFFD, 0xFFFD, 0xFFFD, 0x008D, 0xFFFD, 0xFFFD, 0xFFFD, 0x008C, +/* 0028 */ 0xFFFD, 0xFFFD, 0xFFFD, 0x008E, 0xFFFD, 0xFFFD, 0xFFFD, 0x008F, +/* 0030 */ 0x00EB, 0x0087, 0x00EC, 0xFFFD, 0x00ED, 0xFFFD, 0x00EE, 0x0094, +/* 0038 */ 0x00EF, 0x0090, 0x00F0, 0x0091, 0x00F1, 0x0092, 0x00F2, 0x0093, +/* 0040 */ 0x00C1, 0x00C2, 0x00DC, 0x00C3, 0x00DD, 0x00C4, 0x00C4, 0x00C5, +/* 0048 */ 0x0080, 0x00C6, 0x0095, 0x00A6, 0x00A6, 0x00C7, 0x00DE, 0x00C8, +/* 0050 */ 0x00C8, 0x00A7, 0x00A7, 0x00C9, 0x00C9, 0x00CA, 0x00CA, 0x00A8, +/* 0058 */ 0x00A8, 0x00CB, 0x00CB, 0x00A9, 0x00A9, 0x00CC, 0x00CC, 0x00AA, +/* 0060 */ 0x00AA, 0x00CD, 0x00CD, 0x00AB, 0x00AB, 0x00CE, 0x00CE, 0x00AE, +/* 0068 */ 0x00AE, 0x00CF, 0x00CF, 0x00D0, 0x00D0, 0x00D1, 0x00D1, 0x00D2, +/* 0070 */ 0x00D2, 0x00D3, 0x00D3, 0x00AF, 0x00AF, 0x00D4, 0x00D4, 0x00BA, +/* 0078 */ 0x00BA, 0x00D5, 0x00D5, 0x00BC, 0x00BC, 0x00D6, 0x00D6, 0x00BD, +/* 0080 */ 0x00BD, 0x00D7, 0x00D7, 0x00D7, 0x00D7, 0x00D8, 0x00D8, 0x00D8, +/* 0088 */ 0x00D8, 0x00D9, 0x00BE, 0x00C0, 0x00DB, 0x00DA, 0x0099, 0x009A, +/* 0090 */ 0x009B, 0x00E1, 0x00E1, 0x00DF, 0x00DF, 0x00E2, 0x00E2, 0x00F3, +/* 0098 */ 0x00F3, 0x00E3, 0x00E3, 0x00F4, 0x00F4, 0x00E4, 0x00E4, 0x00F5, +/* 00A0 */ 0x00F5, 0x00E5, 0x00E5, 0x00FB, 0x00FB, 0x00E6, 0x00E6, 0x00FC, +/* 00A8 */ 0x00FC, 0x00FE, 0x00FE, 0x00E7, 0x00FD, 0x00E8, 0x00E8, 0x00E9, +/* 00B0 */ 0x0096, 0x00EA, 0x0098, 0x0097, 0x0097, 0x00F7, 0x009C, 0x00F8, +/* 00B8 */ 0x009D, 0x00F9, 0x009E, 0x00FA, 0x009F, 0x008A, 0xFFFD, 0xFFFD, +/* 00C0 */ 0xFFFD, 0xFFFD, 0x0089, +/* End of table Total Length = 0x00FF * 2 */ diff --git a/intl/uconv/ucvibm/cp1046.ut b/intl/uconv/ucvibm/cp1046.ut new file mode 100644 index 000000000000..83fb474a0004 --- /dev/null +++ b/intl/uconv/ucvibm/cp1046.ut @@ -0,0 +1,154 @@ +/* ***** 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) 2001 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * IBM Corporation + * + * 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 ***** */ +/*======================================================== + This is a Generated file. Please don't edit it. + + The tool which used to generate this file is called umaptable. + You can find this tool under mozilla/intl/uconv/tools/umaptable.c. + If you have any problem of this file. Please contact + Netscape Client International Team or + ftang@netscape + + Table in Debug form +Begin of Item 0000 + Format 0 + srcBegin = 0000 + srcEnd = 007F + destBegin = 0000 +End of Item 0000 + +Begin of Item 0001 + Format 0 + srcBegin = 00B0 + srcEnd = 00B9 + destBegin = 0660 +End of Item 0001 + +Begin of Item 0002 + Format 0 + srcBegin = 00C1 + srcEnd = 00DA + destBegin = 0621 +End of Item 0002 + +Begin of Item 0003 + Format 0 + srcBegin = 00E0 + srcEnd = 00F2 + destBegin = 0640 +End of Item 0003 + +Begin of Item 0004 + Format 1 + srcBegin = 0080 + srcEnd = 00C0 + mappingOffset = 0000 + Mapping = + FE88 00D7 00F7 FFFD FFFD FFFD FFFD FE71 + 0088 25A0 2502 2500 2510 250C 2514 2518 + FE79 FE7B FE7D FE7F FE77 FE8A FEF0 FEF3 + FEF2 FECE FECF FED0 FEF6 FEF8 FEFA FEFC + 00A0 FFFD FFFD FFFD 00A4 FFFD FE8B FE91 + FE97 FE9B FE9F FEA3 060C 00AD FEA7 FEB3 + FFFD FFFD FFFD FFFD FFFD FFFD FFFD FFFD + FFFD FFFD FEB7 061B FEBB FEBF FECA 061F + FECB +End of Item 0004 + +Begin of Item 0005 + Format 1 + srcBegin = 00DB + srcEnd = 00DF + mappingOffset = 0041 + Mapping = + FECC FE82 FE84 FE8E FED3 +End of Item 0005 + +Begin of Item 0006 + Format 1 + srcBegin = 00F3 + srcEnd = 00FF + mappingOffset = 0046 + Mapping = + FED7 FEDB FEDF 200B FEF5 FEF7 FEF9 FEFB + FEE3 FEE7 FEEC FEE9 20AC +End of Item 0006 + +========================================================*/ +/* Offset=0x0000 ItemOfList */ + 0x0007, +/*-------------------------------------------------------*/ +/* Offset=0x0001 offsetToFormatArray */ + 0x0004, +/*-------------------------------------------------------*/ +/* Offset=0x0002 offsetToMapCellArray */ + 0x0006, +/*-------------------------------------------------------*/ +/* Offset=0x0003 offsetToMappingTable */ + 0x001B, +/*-------------------------------------------------------*/ +/* Offset=0x0004 Start of Format Array */ +/* Total of Format 0 : 0x0004 */ +/* Total of Format 1 : 0x0003 */ +/* Total of Format 2 : 0x0000 */ +/* Total of Format 3 : 0x0000 */ + +0x0000, 0x0111, +/*-------------------------------------------------------*/ +/* Offset=0x0006 Start of MapCell Array */ +/* 0000 */ 0x0000, 0x007F, 0x0000, +/* 0001 */ 0x00B0, 0x00B9, 0x0660, +/* 0002 */ 0x00C1, 0x00DA, 0x0621, +/* 0003 */ 0x00E0, 0x00F2, 0x0640, +/* 0004 */ 0x0080, 0x00C0, 0x0000, +/* 0005 */ 0x00DB, 0x00DF, 0x0041, +/* 0006 */ 0x00F3, 0x00FF, 0x0046, +/*-------------------------------------------------------*/ +/* Offset=0x001B Start of MappingTable */ + +/* 0000 */ 0xFE88, 0x00D7, 0x00F7, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFE71, +/* 0008 */ 0x0088, 0x25A0, 0x2502, 0x2500, 0x2510, 0x250C, 0x2514, 0x2518, +/* 0010 */ 0xFE79, 0xFE7B, 0xFE7D, 0xFE7F, 0xFE77, 0xFE8A, 0xFEF0, 0xFEF3, +/* 0018 */ 0xFEF2, 0xFECE, 0xFECF, 0xFED0, 0xFEF6, 0xFEF8, 0xFEFA, 0xFEFC, +/* 0020 */ 0x00A0, 0xFFFD, 0xFFFD, 0xFFFD, 0x00A4, 0xFFFD, 0xFE8B, 0xFE91, +/* 0028 */ 0xFE97, 0xFE9B, 0xFE9F, 0xFEA3, 0x060C, 0x00AD, 0xFEA7, 0xFEB3, +/* 0030 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, +/* 0038 */ 0xFFFD, 0xFFFD, 0xFEB7, 0x061B, 0xFEBB, 0xFEBF, 0xFECA, 0x061F, +/* 0040 */ 0xFECB, 0xFECC, 0xFE82, 0xFE84, 0xFE8E, 0xFED3, 0xFED7, 0xFEDB, +/* 0048 */ 0xFEDF, 0x200B, 0xFEF5, 0xFEF7, 0xFEF9, 0xFEFB, 0xFEE3, 0xFEE7, +/* 0050 */ 0xFEEC, 0xFEE9, 0x20AC, +/* End of table Total Length = 0x006E * 2 */ diff --git a/intl/uconv/ucvibm/nsCP1046ToUnicode.cpp b/intl/uconv/ucvibm/nsCP1046ToUnicode.cpp new file mode 100644 index 000000000000..7d3672796fc2 --- /dev/null +++ b/intl/uconv/ucvibm/nsCP1046ToUnicode.cpp @@ -0,0 +1,63 @@ +/* ***** 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 Communicator client 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): + * IBM Corporation + * + * 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 ***** */ + +#include "nsUCConstructors.h" +#include "nsCP1046ToUnicode.h" + +//---------------------------------------------------------------------- +// Global functions and data [declaration] + +static const PRUint16 g_utMappingTable[] = { +#include "cp1046.ut" +}; + +static const PRInt16 g_utShiftTable[] = { + 0, u1ByteCharset , + ShiftCell(0,0,0,0,0,0,0,0) +}; + +//---------------------------------------------------------------------- +// Class nsCP1046ToUnicode [implementation] + +NS_METHOD +nsCP1046ToUnicodeConstructor(nsISupports* aOuter, REFNSIID aIID, + void **aResult) +{ + return CreateOneByteDecoder((uShiftTable*) &g_utShiftTable, + (uMappingTable*) &g_utMappingTable, + aOuter, aIID, aResult); +} diff --git a/intl/uconv/ucvibm/nsCP1046ToUnicode.h b/intl/uconv/ucvibm/nsCP1046ToUnicode.h new file mode 100644 index 000000000000..225b3ddfbad2 --- /dev/null +++ b/intl/uconv/ucvibm/nsCP1046ToUnicode.h @@ -0,0 +1,50 @@ +/* ***** 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 Communicator client 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): + * IBM Corporation + * + * 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 nsCP1046ToUnicode_h___ +#define nsCP1046ToUnicode_h___ + +#include "nsISupports.h" +/** + * A character set converter from CP1046 to Unicode. + */ +NS_METHOD +nsCP1046ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, + void **aResult); + + +#endif /* !nsCP1046ToUnicode_h___ */ diff --git a/intl/uconv/ucvibm/nsUCvIBMCID.h b/intl/uconv/ucvibm/nsUCvIBMCID.h index 9a3e3c8a5bd9..749c65a80d74 100644 --- a/intl/uconv/ucvibm/nsUCvIBMCID.h +++ b/intl/uconv/ucvibm/nsUCvIBMCID.h @@ -30,6 +30,7 @@ * * Date Modified by Description of modification * 12/09/1999 IBM Corp. Support for IBM codepages - 850,852,55,857,862,864 + * 06/24/2003 IBM Corp. Support for IBM codepage 1046 * */ @@ -108,5 +109,17 @@ // {2D524FDD-AE74-11d3-ABF7-0004ACEEFA51} #define NS_UNICODETOCP864I_CID \ { 0x2d524fdd, 0xae74, 0x11d3, {0xab, 0xf7, 0x0, 0x4, 0xac, 0xee, 0xfa, 0x51}} + +#ifdef MOZ_EXTRA_X11CONVERTERS +// Class ID for our CP1046ToUnicode charset converter +// {2D524FDE-AE74-11d3-ABF7-0004ACEEFA51} +#define NS_CP1046TOUNICODE_CID \ + { 0x2d524fde, 0xae74, 0x11d3, {0xab, 0xf7, 0x0, 0x4, 0xac, 0xee, 0xfa, 0x51}} + +// Class ID for our UnicodeToCP1046 charset converter +// {2D524FDF-AE74-11d3-ABF7-0004ACEEFA51} +#define NS_UNICODETOCP1046_CID \ + { 0x2d524fdf, 0xae74, 0x11d3, {0xab, 0xf7, 0x0, 0x4, 0xac, 0xee, 0xfa, 0x51}} +#endif #endif /* nsUCvIBMCID_h___ */ diff --git a/intl/uconv/ucvibm/nsUnicodeToCP1046.cpp b/intl/uconv/ucvibm/nsUnicodeToCP1046.cpp new file mode 100644 index 000000000000..36d9f8590400 --- /dev/null +++ b/intl/uconv/ucvibm/nsUnicodeToCP1046.cpp @@ -0,0 +1,61 @@ +/* ***** 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 Communicator client 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): + * IBM Corporation + * + * 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 ***** */ + +#include "nsUCConstructors.h" +#include "nsUnicodeToCP1046.h" + +//---------------------------------------------------------------------- +// Global functions and data [declaration] + +static const PRUint16 g_ufMappingTable[] = { +#include "cp1046.uf" +}; + +static const PRInt16 g_ufShiftTable[] = { + 0, u1ByteCharset , + ShiftCell(0,0,0,0,0,0,0,0) +}; + +NS_METHOD +nsUnicodeToCP1046Constructor(nsISupports *aOuter, REFNSIID aIID, + void **aResult) +{ + return CreateTableEncoder((uShiftTable*) &g_ufShiftTable, + (uMappingTable*) &g_ufMappingTable, 1, + aOuter, aIID, aResult); +} + diff --git a/intl/uconv/ucvibm/nsUnicodeToCP1046.h b/intl/uconv/ucvibm/nsUnicodeToCP1046.h new file mode 100644 index 000000000000..808b6f3e89d9 --- /dev/null +++ b/intl/uconv/ucvibm/nsUnicodeToCP1046.h @@ -0,0 +1,52 @@ +/* ***** 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 Communicator client 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): + * IBM Corporation + * + * 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 nsUnicodeToCP1046_h___ +#define nsUnicodeToCP1046_h___ + +#include "nsISupports.h" + + +/** + * A character set converter from Unicode to CP1046. + */ +NS_METHOD +nsUnicodeToCP1046Constructor(nsISupports *aOuter, REFNSIID aIID, + void **aResult); + + +#endif /* !nsUnicodeToCP1046_h___ */