mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1261841 part 3 - Remove uconv files. r=emk.
MozReview-Commit-ID: Hf7MGstvwKe
This commit is contained in:
parent
432653453a
commit
d35d69cef8
@ -1,55 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 007E
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = 00A0
|
||||
srcEnd = 00FF
|
||||
destBegin = 00A0
|
||||
End of Item 0001
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0002,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0005,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x000B,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0002 */
|
||||
/* Total of Format 1 : 0x0000 */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0005 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x007E, 0x0000,
|
||||
/* 0001 */ 0x00A0, 0x00FF, 0x00A0,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x000B Start of MappingTable */
|
||||
|
||||
/* End of table Total Length = 0x000B * 2 */
|
@ -1,165 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
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 = 00A0
|
||||
srcEnd = 00FF
|
||||
destBegin = 00A0
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 2
|
||||
srcBegin = 0081
|
||||
destBegin = 0081
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 1
|
||||
srcBegin = 008D
|
||||
srcEnd = 0090
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
008D FFFD 008F 0090
|
||||
End of Item 0003
|
||||
|
||||
Begin of Item 0004
|
||||
Format 2
|
||||
srcBegin = 009D
|
||||
destBegin = 009D
|
||||
End of Item 0004
|
||||
|
||||
Begin of Item 0005
|
||||
Format 1
|
||||
srcBegin = 0152
|
||||
srcEnd = 0153
|
||||
mappingOffset = 0004
|
||||
Mapping =
|
||||
008C 009C
|
||||
End of Item 0005
|
||||
|
||||
Begin of Item 0006
|
||||
Format 1
|
||||
srcBegin = 0160
|
||||
srcEnd = 0161
|
||||
mappingOffset = 0006
|
||||
Mapping =
|
||||
008A 009A
|
||||
End of Item 0006
|
||||
|
||||
Begin of Item 0007
|
||||
Format 1
|
||||
srcBegin = 0178
|
||||
srcEnd = 017E
|
||||
mappingOffset = 0008
|
||||
Mapping =
|
||||
009F FFFD FFFD FFFD FFFD 008E 009E
|
||||
End of Item 0007
|
||||
|
||||
Begin of Item 0008
|
||||
Format 2
|
||||
srcBegin = 0192
|
||||
destBegin = 0083
|
||||
End of Item 0008
|
||||
|
||||
Begin of Item 0009
|
||||
Format 2
|
||||
srcBegin = 02C6
|
||||
destBegin = 0088
|
||||
End of Item 0009
|
||||
|
||||
Begin of Item 000A
|
||||
Format 2
|
||||
srcBegin = 02DC
|
||||
destBegin = 0098
|
||||
End of Item 000A
|
||||
|
||||
Begin of Item 000B
|
||||
Format 1
|
||||
srcBegin = 2013
|
||||
srcEnd = 203A
|
||||
mappingOffset = 000F
|
||||
Mapping =
|
||||
0096 0097 FFFD FFFD FFFD 0091 0092 0082
|
||||
FFFD 0093 0094 0084 FFFD 0086 0087 0095
|
||||
FFFD FFFD FFFD 0085 FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD 0089 FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD 008B 009B
|
||||
End of Item 000B
|
||||
|
||||
Begin of Item 000C
|
||||
Format 2
|
||||
srcBegin = 20AC
|
||||
destBegin = 0080
|
||||
End of Item 000C
|
||||
|
||||
Begin of Item 000D
|
||||
Format 2
|
||||
srcBegin = 2122
|
||||
destBegin = 0099
|
||||
End of Item 000D
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x000E,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0008,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x0032,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0002 */
|
||||
/* Total of Format 1 : 0x0005 */
|
||||
/* Total of Format 2 : 0x0007 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x1200, 0x1112, 0x1222, 0x0022,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0008 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x007F, 0x0000,
|
||||
/* 0001 */ 0x00A0, 0x00FF, 0x00A0,
|
||||
/* 0002 */ 0x0081, 0x0000, 0x0081,
|
||||
/* 0003 */ 0x008D, 0x0090, 0x0000,
|
||||
/* 0004 */ 0x009D, 0x0000, 0x009D,
|
||||
/* 0005 */ 0x0152, 0x0153, 0x0004,
|
||||
/* 0006 */ 0x0160, 0x0161, 0x0006,
|
||||
/* 0007 */ 0x0178, 0x017E, 0x0008,
|
||||
/* 0008 */ 0x0192, 0x0000, 0x0083,
|
||||
/* 0009 */ 0x02C6, 0x0000, 0x0088,
|
||||
/* 000A */ 0x02DC, 0x0000, 0x0098,
|
||||
/* 000B */ 0x2013, 0x203A, 0x000F,
|
||||
/* 000C */ 0x20AC, 0x0000, 0x0080,
|
||||
/* 000D */ 0x2122, 0x0000, 0x0099,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0032 Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x008D, 0xFFFD, 0x008F, 0x0090, 0x008C, 0x009C, 0x008A, 0x009A,
|
||||
/* 0008 */ 0x009F, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x008E, 0x009E, 0x0096,
|
||||
/* 0010 */ 0x0097, 0xFFFD, 0xFFFD, 0xFFFD, 0x0091, 0x0092, 0x0082, 0xFFFD,
|
||||
/* 0018 */ 0x0093, 0x0094, 0x0084, 0xFFFD, 0x0086, 0x0087, 0x0095, 0xFFFD,
|
||||
/* 0020 */ 0xFFFD, 0xFFFD, 0x0085, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0028 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0089, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0030 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x008B, 0x009B,
|
||||
/* End of table Total Length = 0x0069 * 2 */
|
@ -1,72 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
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 = 00A0
|
||||
srcEnd = 00FF
|
||||
destBegin = 00A0
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 1
|
||||
srcBegin = 0080
|
||||
srcEnd = 009F
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
20AC 0081 201A 0192 201E 2026 2020 2021
|
||||
02C6 2030 0160 2039 0152 008D 017D 008F
|
||||
0090 2018 2019 201C 201D 2022 2013 2014
|
||||
02DC 2122 0161 203A 0153 009D 017E 0178
|
||||
End of Item 0002
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0003,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0005,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x000E,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0002 */
|
||||
/* Total of Format 1 : 0x0001 */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0100,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0005 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x007F, 0x0000,
|
||||
/* 0001 */ 0x00A0, 0x00FF, 0x00A0,
|
||||
/* 0002 */ 0x0080, 0x009F, 0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x000E Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x20AC, 0x0081, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
/* 0008 */ 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008D, 0x017D, 0x008F,
|
||||
/* 0010 */ 0x0090, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
/* 0018 */ 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x009D, 0x017E, 0x0178,
|
||||
/* End of table Total Length = 0x002E * 2 */
|
@ -1,250 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
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 <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0020
|
||||
srcEnd = 007F
|
||||
destBegin = 0020
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 1
|
||||
srcBegin = 00A0
|
||||
srcEnd = 00FF
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
00CA 00C1 00A2 00A3 FFFD 00B4 FFFD 00A4
|
||||
00AC 00A9 00BB 00C7 00C2 FFFD 00A8 00F8
|
||||
00A1 00B1 FFFD FFFD 00AB 00B5 00A6 00E1
|
||||
00FC FFFD 00BC 00C8 FFFD FFFD FFFD 00C0
|
||||
00CB 00E7 00E5 00CC 0080 0081 00AE 0082
|
||||
00E9 0083 00E6 00E8 00ED 00EA 00EB 00EC
|
||||
FFFD 0084 00F1 00EE 00EF 00CD 0085 FFFD
|
||||
00AF 00F4 00F2 00F3 0086 FFFD FFFD 00A7
|
||||
0088 0087 0089 008B 008A 008C 00BE 008D
|
||||
008F 008E 0090 0091 0093 0092 0094 0095
|
||||
FFFD 0096 0098 0097 0099 009B 009A 00D6
|
||||
00BF 009D 009C 009E 009F FFFD FFFD 00D8
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 2
|
||||
srcBegin = 0131
|
||||
destBegin = 00F5
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 1
|
||||
srcBegin = 0152
|
||||
srcEnd = 0153
|
||||
mappingOffset = 0060
|
||||
Mapping =
|
||||
00CE 00CF
|
||||
End of Item 0003
|
||||
|
||||
Begin of Item 0004
|
||||
Format 2
|
||||
srcBegin = 0178
|
||||
destBegin = 00D9
|
||||
End of Item 0004
|
||||
|
||||
Begin of Item 0005
|
||||
Format 2
|
||||
srcBegin = 0192
|
||||
destBegin = 00C4
|
||||
End of Item 0005
|
||||
|
||||
Begin of Item 0006
|
||||
Format 1
|
||||
srcBegin = 02C6
|
||||
srcEnd = 02C7
|
||||
mappingOffset = 0062
|
||||
Mapping =
|
||||
00F6 00FF
|
||||
End of Item 0006
|
||||
|
||||
Begin of Item 0007
|
||||
Format 1
|
||||
srcBegin = 02D8
|
||||
srcEnd = 02DD
|
||||
mappingOffset = 0064
|
||||
Mapping =
|
||||
00F9 00FA 00FB 00FE 00F7 00FD
|
||||
End of Item 0007
|
||||
|
||||
Begin of Item 0008
|
||||
Format 2
|
||||
srcBegin = 03A9
|
||||
destBegin = 00BD
|
||||
End of Item 0008
|
||||
|
||||
Begin of Item 0009
|
||||
Format 2
|
||||
srcBegin = 03C0
|
||||
destBegin = 00B9
|
||||
End of Item 0009
|
||||
|
||||
Begin of Item 000A
|
||||
Format 1
|
||||
srcBegin = 2013
|
||||
srcEnd = 2044
|
||||
mappingOffset = 006A
|
||||
Mapping =
|
||||
00D0 00D1 FFFD FFFD FFFD 00D4 00D5 00E2
|
||||
FFFD 00D2 00D3 00E3 FFFD 00A0 00E0 00A5
|
||||
FFFD FFFD FFFD 00C9 FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD 00E4 FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD 00DC 00DD
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
FFFD 00DA
|
||||
End of Item 000A
|
||||
|
||||
Begin of Item 000B
|
||||
Format 2
|
||||
srcBegin = 20AC
|
||||
destBegin = 00DB
|
||||
End of Item 000B
|
||||
|
||||
Begin of Item 000C
|
||||
Format 2
|
||||
srcBegin = 2122
|
||||
destBegin = 00AA
|
||||
End of Item 000C
|
||||
|
||||
Begin of Item 000D
|
||||
Format 1
|
||||
srcBegin = 2202
|
||||
srcEnd = 221E
|
||||
mappingOffset = 009C
|
||||
Mapping =
|
||||
00B6 FFFD FFFD FFFD 00C6 FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD 00B8 FFFD 00B7
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
00C3 FFFD FFFD FFFD 00B0
|
||||
End of Item 000D
|
||||
|
||||
Begin of Item 000E
|
||||
Format 2
|
||||
srcBegin = 222B
|
||||
destBegin = 00BA
|
||||
End of Item 000E
|
||||
|
||||
Begin of Item 000F
|
||||
Format 2
|
||||
srcBegin = 2248
|
||||
destBegin = 00C5
|
||||
End of Item 000F
|
||||
|
||||
Begin of Item 0010
|
||||
Format 1
|
||||
srcBegin = 2260
|
||||
srcEnd = 2265
|
||||
mappingOffset = 00B9
|
||||
Mapping =
|
||||
00AD FFFD FFFD FFFD 00B2 00B3
|
||||
End of Item 0010
|
||||
|
||||
Begin of Item 0011
|
||||
Format 2
|
||||
srcBegin = 25CA
|
||||
destBegin = 00D7
|
||||
End of Item 0011
|
||||
|
||||
Begin of Item 0012
|
||||
Format 2
|
||||
srcBegin = F8FF
|
||||
destBegin = 00F0
|
||||
End of Item 0012
|
||||
|
||||
Begin of Item 0013
|
||||
Format 1
|
||||
srcBegin = FB01
|
||||
srcEnd = FB02
|
||||
mappingOffset = 00BF
|
||||
Mapping =
|
||||
00DE 00DF
|
||||
End of Item 0013
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0014,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x000A,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x0046,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0001 */
|
||||
/* Total of Format 1 : 0x0008 */
|
||||
/* Total of Format 2 : 0x000B */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x1210, 0x1122, 0x2122, 0x2212, 0x1221, 0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x000A Start of MapCell Array */
|
||||
/* 0000 */ 0x0020, 0x007F, 0x0020,
|
||||
/* 0001 */ 0x00A0, 0x00FF, 0x0000,
|
||||
/* 0002 */ 0x0131, 0x0000, 0x00F5,
|
||||
/* 0003 */ 0x0152, 0x0153, 0x0060,
|
||||
/* 0004 */ 0x0178, 0x0000, 0x00D9,
|
||||
/* 0005 */ 0x0192, 0x0000, 0x00C4,
|
||||
/* 0006 */ 0x02C6, 0x02C7, 0x0062,
|
||||
/* 0007 */ 0x02D8, 0x02DD, 0x0064,
|
||||
/* 0008 */ 0x03A9, 0x0000, 0x00BD,
|
||||
/* 0009 */ 0x03C0, 0x0000, 0x00B9,
|
||||
/* 000A */ 0x2013, 0x2044, 0x006A,
|
||||
/* 000B */ 0x20AC, 0x0000, 0x00DB,
|
||||
/* 000C */ 0x2122, 0x0000, 0x00AA,
|
||||
/* 000D */ 0x2202, 0x221E, 0x009C,
|
||||
/* 000E */ 0x222B, 0x0000, 0x00BA,
|
||||
/* 000F */ 0x2248, 0x0000, 0x00C5,
|
||||
/* 0010 */ 0x2260, 0x2265, 0x00B9,
|
||||
/* 0011 */ 0x25CA, 0x0000, 0x00D7,
|
||||
/* 0012 */ 0xF8FF, 0x0000, 0x00F0,
|
||||
/* 0013 */ 0xFB01, 0xFB02, 0x00BF,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0046 Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x00CA, 0x00C1, 0x00A2, 0x00A3, 0xFFFD, 0x00B4, 0xFFFD, 0x00A4,
|
||||
/* 0008 */ 0x00AC, 0x00A9, 0x00BB, 0x00C7, 0x00C2, 0xFFFD, 0x00A8, 0x00F8,
|
||||
/* 0010 */ 0x00A1, 0x00B1, 0xFFFD, 0xFFFD, 0x00AB, 0x00B5, 0x00A6, 0x00E1,
|
||||
/* 0018 */ 0x00FC, 0xFFFD, 0x00BC, 0x00C8, 0xFFFD, 0xFFFD, 0xFFFD, 0x00C0,
|
||||
/* 0020 */ 0x00CB, 0x00E7, 0x00E5, 0x00CC, 0x0080, 0x0081, 0x00AE, 0x0082,
|
||||
/* 0028 */ 0x00E9, 0x0083, 0x00E6, 0x00E8, 0x00ED, 0x00EA, 0x00EB, 0x00EC,
|
||||
/* 0030 */ 0xFFFD, 0x0084, 0x00F1, 0x00EE, 0x00EF, 0x00CD, 0x0085, 0xFFFD,
|
||||
/* 0038 */ 0x00AF, 0x00F4, 0x00F2, 0x00F3, 0x0086, 0xFFFD, 0xFFFD, 0x00A7,
|
||||
/* 0040 */ 0x0088, 0x0087, 0x0089, 0x008B, 0x008A, 0x008C, 0x00BE, 0x008D,
|
||||
/* 0048 */ 0x008F, 0x008E, 0x0090, 0x0091, 0x0093, 0x0092, 0x0094, 0x0095,
|
||||
/* 0050 */ 0xFFFD, 0x0096, 0x0098, 0x0097, 0x0099, 0x009B, 0x009A, 0x00D6,
|
||||
/* 0058 */ 0x00BF, 0x009D, 0x009C, 0x009E, 0x009F, 0xFFFD, 0xFFFD, 0x00D8,
|
||||
/* 0060 */ 0x00CE, 0x00CF, 0x00F6, 0x00FF, 0x00F9, 0x00FA, 0x00FB, 0x00FE,
|
||||
/* 0068 */ 0x00F7, 0x00FD, 0x00D0, 0x00D1, 0xFFFD, 0xFFFD, 0xFFFD, 0x00D4,
|
||||
/* 0070 */ 0x00D5, 0x00E2, 0xFFFD, 0x00D2, 0x00D3, 0x00E3, 0xFFFD, 0x00A0,
|
||||
/* 0078 */ 0x00E0, 0x00A5, 0xFFFD, 0xFFFD, 0xFFFD, 0x00C9, 0xFFFD, 0xFFFD,
|
||||
/* 0080 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00E4,
|
||||
/* 0088 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0090 */ 0x00DC, 0x00DD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0098 */ 0xFFFD, 0xFFFD, 0xFFFD, 0x00DA, 0x00B6, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00A0 */ 0x00C6, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00A8 */ 0xFFFD, 0x00B8, 0xFFFD, 0x00B7, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00B0 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00C3, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00B8 */ 0x00B0, 0x00AD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00B2, 0x00B3, 0x00DE,
|
||||
/* 00C0 */ 0x00DF,
|
||||
/* End of table Total Length = 0x0107 * 2 */
|
@ -1,89 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
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 <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0020
|
||||
srcEnd = 007F
|
||||
destBegin = 0020
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 1
|
||||
srcBegin = 0080
|
||||
srcEnd = 00FF
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
00C4 00C5 00C7 00C9 00D1 00D6 00DC 00E1
|
||||
00E0 00E2 00E4 00E3 00E5 00E7 00E9 00E8
|
||||
00EA 00EB 00ED 00EC 00EE 00EF 00F1 00F3
|
||||
00F2 00F4 00F6 00F5 00FA 00F9 00FB 00FC
|
||||
2020 00B0 00A2 00A3 00A7 2022 00B6 00DF
|
||||
00AE 00A9 2122 00B4 00A8 2260 00C6 00D8
|
||||
221E 00B1 2264 2265 00A5 00B5 2202 2211
|
||||
220F 03C0 222B 00AA 00BA 03A9 00E6 00F8
|
||||
00BF 00A1 00AC 221A 0192 2248 2206 00AB
|
||||
00BB 2026 00A0 00C0 00C3 00D5 0152 0153
|
||||
2013 2014 201C 201D 2018 2019 00F7 25CA
|
||||
00FF 0178 2044 20AC 2039 203A FB01 FB02
|
||||
2021 00B7 201A 201E 2030 00C2 00CA 00C1
|
||||
00CB 00C8 00CD 00CE 00CF 00CC 00D3 00D4
|
||||
F8FF 00D2 00DA 00DB 00D9 0131 02C6 02DC
|
||||
00AF 02D8 02D9 02DA 00B8 02DD 02DB 02C7
|
||||
End of Item 0001
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0002,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0005,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x000B,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0001 */
|
||||
/* Total of Format 1 : 0x0001 */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0010,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0005 Start of MapCell Array */
|
||||
/* 0000 */ 0x0020, 0x007F, 0x0020,
|
||||
/* 0001 */ 0x0080, 0x00FF, 0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x000B Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1,
|
||||
/* 0008 */ 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8,
|
||||
/* 0010 */ 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0x00F1, 0x00F3,
|
||||
/* 0018 */ 0x00F2, 0x00F4, 0x00F6, 0x00F5, 0x00FA, 0x00F9, 0x00FB, 0x00FC,
|
||||
/* 0020 */ 0x2020, 0x00B0, 0x00A2, 0x00A3, 0x00A7, 0x2022, 0x00B6, 0x00DF,
|
||||
/* 0028 */ 0x00AE, 0x00A9, 0x2122, 0x00B4, 0x00A8, 0x2260, 0x00C6, 0x00D8,
|
||||
/* 0030 */ 0x221E, 0x00B1, 0x2264, 0x2265, 0x00A5, 0x00B5, 0x2202, 0x2211,
|
||||
/* 0038 */ 0x220F, 0x03C0, 0x222B, 0x00AA, 0x00BA, 0x03A9, 0x00E6, 0x00F8,
|
||||
/* 0040 */ 0x00BF, 0x00A1, 0x00AC, 0x221A, 0x0192, 0x2248, 0x2206, 0x00AB,
|
||||
/* 0048 */ 0x00BB, 0x2026, 0x00A0, 0x00C0, 0x00C3, 0x00D5, 0x0152, 0x0153,
|
||||
/* 0050 */ 0x2013, 0x2014, 0x201C, 0x201D, 0x2018, 0x2019, 0x00F7, 0x25CA,
|
||||
/* 0058 */ 0x00FF, 0x0178, 0x2044, 0x20AC, 0x2039, 0x203A, 0xFB01, 0xFB02,
|
||||
/* 0060 */ 0x2021, 0x00B7, 0x201A, 0x201E, 0x2030, 0x00C2, 0x00CA, 0x00C1,
|
||||
/* 0068 */ 0x00CB, 0x00C8, 0x00CD, 0x00CE, 0x00CF, 0x00CC, 0x00D3, 0x00D4,
|
||||
/* 0070 */ 0xF8FF, 0x00D2, 0x00DA, 0x00DB, 0x00D9, 0x0131, 0x02C6, 0x02DC,
|
||||
/* 0078 */ 0x00AF, 0x02D8, 0x02D9, 0x02DA, 0x00B8, 0x02DD, 0x02DB, 0x02C7,
|
||||
/* End of table Total Length = 0x008B * 2 */
|
@ -1,22 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsUCConstructors.h"
|
||||
#include "nsCP1252ToUnicode.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
nsresult
|
||||
nsCP1252ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
static const uint16_t g_utMappingTable[] = {
|
||||
#include "cp1252.ut"
|
||||
};
|
||||
|
||||
return CreateOneByteDecoder((uMappingTable*) &g_utMappingTable,
|
||||
aOuter, aIID, aResult);
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsCP1252ToUnicode_h___
|
||||
#define nsCP1252ToUnicode_h___
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
class nsISupports;
|
||||
|
||||
// Class ID for our CP1252ToUnicode charset converter
|
||||
// {7C657D15-EC5E-11d2-8AAC-00600811A836}
|
||||
#define NS_CP1252TOUNICODE_CID \
|
||||
{ 0x7c657d15, 0xec5e, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_CP1252TOUNICODE_CONTRACTID "@mozilla.org/intl/unicode/decoder;1?charset=windows-1252"
|
||||
|
||||
/**
|
||||
* A character set converter from CP1252 to Unicode.
|
||||
*
|
||||
* @created 20/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
nsresult
|
||||
nsCP1252ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
#endif /* nsCP1252ToUnicode_h___ */
|
@ -1,29 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsEncoderDecoderUtils_h__
|
||||
#define nsEncoderDecoderUtils_h__
|
||||
|
||||
#define NS_UNICODEDECODER_NAME "Charset Decoders"
|
||||
#define NS_UNICODEENCODER_NAME "Charset Encoders"
|
||||
|
||||
#define NS_CONVERTER_REGISTRY_START \
|
||||
static const mozilla::Module::CategoryEntry kUConvCategories[] = {
|
||||
|
||||
#define NS_CONVERTER_REGISTRY_END \
|
||||
{ nullptr } \
|
||||
};
|
||||
|
||||
#define NS_UCONV_REG_UNREG_DECODER(_Charset, _CID) \
|
||||
{ NS_UNICODEDECODER_NAME, _Charset, "" },
|
||||
|
||||
#define NS_UCONV_REG_UNREG_ENCODER(_Charset, _CID) \
|
||||
{ NS_UNICODEENCODER_NAME, _Charset, "" },
|
||||
|
||||
#define NS_UCONV_REG_UNREG(_Charset, _DecoderCID, _EncoderCID) \
|
||||
NS_UCONV_REG_UNREG_DECODER(_Charset, *) \
|
||||
NS_UCONV_REG_UNREG_ENCODER(_Charset, *)
|
||||
|
||||
#endif
|
@ -1,16 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsISO88591ToUnicode_h___
|
||||
#define nsISO88591ToUnicode_h___
|
||||
|
||||
// Class ID for our ISO88591ToUnicode charset converter
|
||||
// {A3254CB0-8E20-11d2-8A98-00600811A836}
|
||||
#define NS_ISO88591TOUNICODE_CID \
|
||||
{ 0xa3254cb0, 0x8e20, 0x11d2, {0x8a, 0x98, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_ISO88591TOUNICODE_CONTRACTID "@mozilla.org/intl/unicode/decoder;1?charset=ISO-8859-1"
|
||||
|
||||
#endif /* nsISO88591ToUnicode_h___ */
|
@ -1,140 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsIUnicodeDecoder_h___
|
||||
#define nsIUnicodeDecoder_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// Interface ID for our Unicode Decoder interface
|
||||
// {25359602-FC70-4d13-A9AB-8086D3827C0D}
|
||||
//NS_DECLARE_ID(kIUnicodeDecoderIID,
|
||||
// 0x25359602, 0xfc70, 0x4d13, 0xa9, 0xab, 0x80, 0x86, 0xd3, 0x82, 0x7c, 0xd);
|
||||
|
||||
#define NS_IUNICODEDECODER_IID \
|
||||
{ 0x25359602, 0xfc70, 0x4d13, \
|
||||
{ 0xa9, 0xab, 0x80, 0x86, 0xd3, 0x82, 0x7c, 0xd }}
|
||||
|
||||
|
||||
#define NS_UNICODEDECODER_CONTRACTID_BASE "@mozilla.org/intl/unicode/decoder;1?charset="
|
||||
|
||||
/**
|
||||
* Interface for a Converter from a Charset into Unicode.
|
||||
*
|
||||
* @created 23/Nov/1998
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsIUnicodeDecoder : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IUNICODEDECODER_IID)
|
||||
|
||||
enum {
|
||||
kOnError_Recover, // on an error, recover and continue
|
||||
kOnError_Signal // on an error, stop and signal
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the data from one Charset to Unicode.
|
||||
*
|
||||
* About the byte ordering:
|
||||
* - For input, if the converter cares (that depends of the charset, for
|
||||
* example a singlebyte will ignore the byte ordering) it should assume
|
||||
* network order. If necessary and requested, we can add a method
|
||||
* SetInputByteOrder() so that the reverse order can be used, too. That
|
||||
* method would have as default the assumed network order.
|
||||
* - The output stream is Unicode, having the byte order which is internal
|
||||
* for the machine on which the converter is running on.
|
||||
*
|
||||
* Unless there is not enough output space, this method must consume all the
|
||||
* available input data! The eventual incomplete final character data will be
|
||||
* stored internally in the converter and used when the method is called
|
||||
* again for continuing the conversion. This way, the caller will not have to
|
||||
* worry about managing incomplete input data by mergeing it with the next
|
||||
* buffer.
|
||||
*
|
||||
* Error conditions:
|
||||
* If the read value does not belong to this character set, one should
|
||||
* replace it with the Unicode special 0xFFFD. When an actual input error is
|
||||
* encountered, like a format error, the converter stop and return error.
|
||||
* However, we should keep in mind that we need to be lax in decoding. When
|
||||
* a decoding error is returned to the caller, it is the caller's
|
||||
* responsibility to advance over the bad byte (unless aSrcLength is -1 in
|
||||
* which case the caller should call the decoder with 0 offset again) and
|
||||
* reset the decoder before trying to call the decoder again.
|
||||
*
|
||||
* Converter required behavior:
|
||||
* In this order: when output space is full - return right away. When input
|
||||
* data is wrong, return input pointer right after the wrong byte. When
|
||||
* partial input, it will be consumed and cached. All the time input pointer
|
||||
* will show how much was actually consumed and how much was actually
|
||||
* written.
|
||||
*
|
||||
* @param aSrc [IN] the source data buffer
|
||||
* @param aSrcLength [IN/OUT] the length of source data buffer; after
|
||||
* conversion will contain the number of bytes read or
|
||||
* -1 on error to indicate that the caller should re-push
|
||||
* the same buffer after resetting the decoder
|
||||
* @param aDest [OUT] the destination data buffer
|
||||
* @param aDestLength [IN/OUT] the length of the destination data buffer;
|
||||
* after conversion will contain the number of Unicode
|
||||
* characters written
|
||||
* @return NS_ERROR_UDEC_ILLEGALINPUT if an illegal input sequence
|
||||
* was encountered and the behavior was set to "signal";
|
||||
* the caller must skip over one byte, reset the decoder
|
||||
* and retry.
|
||||
* NS_OK_UDEC_MOREOUTPUT if only a partial conversion
|
||||
* was done; more output space is needed to continue
|
||||
* NS_OK_UDEC_MOREINPUT if the input ended in the middle
|
||||
* of an input code unit sequence. If this is the last
|
||||
* result the caller has at the end of the stream, the
|
||||
* caller must append one U+FFFD to the output.
|
||||
* NS_OK if the input ended after a complete input code
|
||||
* unit sequence.
|
||||
*/
|
||||
NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength,
|
||||
char16_t * aDest, int32_t * aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Returns a quick estimation of the size of the buffer needed to hold the
|
||||
* converted data. Remember: this estimation is >= with the actual size of
|
||||
* the buffer needed. It will be computed for the "worst case"
|
||||
*
|
||||
* @param aSrc [IN] the source data buffer
|
||||
* @param aSrcLength [IN] the length of source data buffer
|
||||
* @param aDestLength [OUT] the needed size of the destination buffer
|
||||
* @return NS_EXACT_LENGTH if an exact length was computed
|
||||
* NS_ERROR_OUT_OF_MEMORY if OOM
|
||||
* NS_OK is all we have is an approximation
|
||||
*/
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Resets the charset converter so it may be recycled for a completely
|
||||
* different and urelated buffer of data.
|
||||
*/
|
||||
NS_IMETHOD Reset() = 0;
|
||||
|
||||
/**
|
||||
* Specify what to do when a character cannot be mapped into unicode
|
||||
*
|
||||
* @param aBehavior [IN] the desired behavior
|
||||
* @see kOnError_Recover
|
||||
* @see kOnError_Signal
|
||||
*/
|
||||
virtual void SetInputErrorBehavior(int32_t aBehavior) = 0;
|
||||
|
||||
/**
|
||||
* return the UNICODE character for unmapped character
|
||||
*/
|
||||
virtual char16_t GetCharacterForUnMapped() = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIUnicodeDecoder, NS_IUNICODEDECODER_IID)
|
||||
|
||||
#endif /* nsIUnicodeDecoder_h___ */
|
@ -1,159 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsIUnicodeEncoder_h___
|
||||
#define nsIUnicodeEncoder_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsError.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// Interface ID for our Unicode Encoder interface
|
||||
// {2B2CA3D0-A4C9-11d2-8AA1-00600811A836}
|
||||
#define NS_IUNICODEENCODER_IID \
|
||||
{ 0x2b2ca3d0, 0xa4c9, 0x11d2, \
|
||||
{ 0x8a, 0xa1, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 }}
|
||||
|
||||
// Interface ID for our Unicode Character Encoder interface
|
||||
// {299BCCD0-C6DF-11d2-8AA8-00600811A836}
|
||||
#define NS_IUNICHARENCODER_IID \
|
||||
{ 0x299bccd0, 0xc6df, 0x11d2, \
|
||||
{0x8a, 0xa8, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36 }}
|
||||
|
||||
|
||||
#define NS_UNICODEENCODER_CONTRACTID_BASE "@mozilla.org/intl/unicode/encoder;1?charset="
|
||||
|
||||
/**
|
||||
* Interface which converts a single character from Unicode into a given
|
||||
* charset.
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsIUnicharEncoder : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IUNICHARENCODER_IID)
|
||||
|
||||
/**
|
||||
* Converts a character from Unicode to a Charset.
|
||||
*/
|
||||
NS_IMETHOD Convert(char16_t aChar, char * aDest, int32_t * aDestLength) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIUnicharEncoder, NS_IUNICHARENCODER_IID)
|
||||
|
||||
/**
|
||||
* Interface for a Converter from Unicode into a Charset.
|
||||
*
|
||||
* @created 23/Nov/1998
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsIUnicodeEncoder : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IUNICODEENCODER_IID)
|
||||
|
||||
enum {
|
||||
kOnError_Signal, // on an error, stop and signal
|
||||
kOnError_CallBack, // on an error, call the error handler
|
||||
kOnError_Replace // on an error, replace with a different character
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts the data from Unicode to a Charset.
|
||||
*
|
||||
* About the byte ordering:
|
||||
* - The input stream is Unicode, having the byte order which is internal
|
||||
* for the machine on which the converter is running on.
|
||||
* - For output, if the converter cares (that depends of the charset, for
|
||||
* example a singlebyte will ignore the byte ordering) it should assume
|
||||
* network order. If necessary and requested, we can add a method
|
||||
* SetOutputByteOrder() so that the reverse order can be used, too. That
|
||||
* method would have as default the assumed network order.
|
||||
*
|
||||
* For the last converted char, even if there is not enough output
|
||||
* space, a partial output must be done until all available space will be
|
||||
* used. The rest of the output should be buffered until more space becomes
|
||||
* available. But this is not also true about the error handling method!!!
|
||||
* So be very, very careful...
|
||||
*
|
||||
* @param aSrc [IN] the source data buffer
|
||||
* @param aSrcLength [IN/OUT] the length of source data buffer; after
|
||||
* conversion will contain the number of Unicode
|
||||
* characters read
|
||||
* @param aDest [OUT] the destination data buffer
|
||||
* @param aDestLength [IN/OUT] the length of the destination data buffer;
|
||||
* after conversion will contain the number of bytes
|
||||
* written
|
||||
* @return NS_OK_UENC_MOREOUTPUT if only a partial conversion
|
||||
* was done; more output space is needed to continue
|
||||
* NS_OK_UENC_MOREINPUT if only a partial conversion
|
||||
* was done; more input is needed to continue. This can
|
||||
* occur when the last UTF-16 code point in the input is
|
||||
* the first of a surrogate pair.
|
||||
* NS_ERROR_UENC_NOMAPPING if character without mapping
|
||||
* was encountered and the behavior was set to "signal".
|
||||
* In the case of an unmappable BMP character, aDestLength
|
||||
* must indicate that the unmappable character was
|
||||
* consumed by the encoder (unlike in the decode API!).
|
||||
* In the case of an unmappable astral character,
|
||||
* aDestLength must indicate that the high surrogate was
|
||||
* consumed by the encoder but the low surrogate was not.
|
||||
* NS_OK otherwise.
|
||||
*/
|
||||
NS_IMETHOD Convert(const char16_t * aSrc, int32_t * aSrcLength,
|
||||
char * aDest, int32_t * aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Finishes the conversion. The converter has the possibility to write some
|
||||
* extra data and flush its final state.
|
||||
*
|
||||
* @param aDest [OUT] the destination data buffer
|
||||
* @param aDestLength [IN/OUT] the length of destination data buffer; after
|
||||
* conversion it will contain the number of bytes written
|
||||
* @return NS_OK_UENC_MOREOUTPUT if only a partial conversion
|
||||
* was done; more output space is needed to continue.
|
||||
* NS_ERROR_UENC_NOMAPPING if input ended with an unpaired
|
||||
* high surrogate, the behavior was "signal" and the
|
||||
* encoding can't represent U+FFFD.
|
||||
* NS_OK otherwise.
|
||||
*/
|
||||
NS_IMETHOD Finish(char * aDest, int32_t * aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Returns a quick estimation of the size of the buffer needed to hold the
|
||||
* converted data. Remember: this estimation is >= with the actual size of
|
||||
* the buffer needed. It will be computed for the "worst case"
|
||||
*
|
||||
* @param aSrc [IN] the source data buffer
|
||||
* @param aSrcLength [IN] the length of source data buffer
|
||||
* @param aDestLength [OUT] the needed size of the destination buffer
|
||||
* @return NS_OK_UENC_EXACTLENGTH if an exact length was computed
|
||||
* NS_ERROR_OUT_OF_MEMORY if OOM
|
||||
* NS_OK if all we have is an approximation
|
||||
*/
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Resets the charset converter so it may be recycled for a completely
|
||||
* different and urelated buffer of data.
|
||||
*/
|
||||
NS_IMETHOD Reset() = 0;
|
||||
|
||||
/**
|
||||
* Specify what to do when a character cannot be mapped into the dest charset
|
||||
*
|
||||
* @param aOrder [IN] the behavior; taken from the enum
|
||||
*/
|
||||
NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior,
|
||||
nsIUnicharEncoder * aEncoder, char16_t aChar) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIUnicodeEncoder, NS_IUNICODEENCODER_IID)
|
||||
|
||||
#endif /* nsIUnicodeEncoder_h___ */
|
@ -1,23 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsUCConstructors.h"
|
||||
#include "nsMacRomanToUnicode.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
nsresult
|
||||
nsMacRomanToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
static const uint16_t g_MacRomanMappingTable[] = {
|
||||
#include "macroman.ut"
|
||||
};
|
||||
|
||||
return CreateOneByteDecoder((uMappingTable*) &g_MacRomanMappingTable,
|
||||
aOuter, aIID, aResult);
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsMacRomanToUnicode_h___
|
||||
#define nsMacRomanToUnicode_h___
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
class nsISupports;
|
||||
|
||||
// Class ID for our MacRomanToUnicode charset converter
|
||||
// {7B8556A1-EC79-11d2-8AAC-00600811A836}
|
||||
#define NS_MACROMANTOUNICODE_CID \
|
||||
{ 0x7b8556a1, 0xec79, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_MACROMANTOUNICODE_CONTRACTID "@mozilla.org/intl/unicode/decoder;1?charset=macintosh"
|
||||
|
||||
//#define NS_ERROR_UCONV_NOMACROMANTOUNICODE
|
||||
// NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
|
||||
|
||||
/**
|
||||
* A character set converter from MacRoman to Unicode.
|
||||
*
|
||||
* @created 05/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
nsresult
|
||||
nsMacRomanToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
#endif /* nsMacRomanToUnicode_h___ */
|
@ -1,156 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsNCRFallbackEncoderWrapper.h"
|
||||
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
nsNCRFallbackEncoderWrapper::nsNCRFallbackEncoderWrapper(const nsACString& aEncoding)
|
||||
: mEncoder(mozilla::dom::EncodingUtils::EncoderForEncoding(aEncoding))
|
||||
{
|
||||
}
|
||||
|
||||
nsNCRFallbackEncoderWrapper::~nsNCRFallbackEncoderWrapper()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
nsNCRFallbackEncoderWrapper::WriteNCR(nsACString& aBytes,
|
||||
uint32_t& aDstWritten,
|
||||
int32_t aUnmappable)
|
||||
{
|
||||
// To avoid potentially shrinking aBytes and then growing it back, use
|
||||
// another string for number formatting.
|
||||
nsAutoCString ncr("&#");
|
||||
ncr.AppendInt(aUnmappable);
|
||||
ncr.Append(';');
|
||||
uint32_t ncrLen = ncr.Length();
|
||||
uint32_t needed = aDstWritten + ncrLen;
|
||||
if (needed > INT32_MAX) {
|
||||
return false;
|
||||
}
|
||||
if (needed > aBytes.Length() && !aBytes.SetLength(needed,
|
||||
mozilla::fallible_t())) {
|
||||
return false;
|
||||
}
|
||||
memcpy(aBytes.BeginWriting() + aDstWritten,
|
||||
ncr.BeginReading(),
|
||||
ncrLen);
|
||||
aDstWritten += ncrLen;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsNCRFallbackEncoderWrapper::Encode(const nsAString& aUtf16,
|
||||
nsACString& aBytes)
|
||||
{
|
||||
// mozilla::dom::EncodingUtils::EncoderForEncoding fails during shutdown
|
||||
if (!mEncoder) {
|
||||
return false;
|
||||
}
|
||||
// nsIUnicodeEncoder uses int32_t for sizes :-(
|
||||
if (aUtf16.Length() > INT32_MAX) {
|
||||
return false;
|
||||
}
|
||||
const char16_t* src = aUtf16.BeginReading();
|
||||
const char16_t* srcEnd = aUtf16.EndReading();
|
||||
uint32_t dstWritten = 0;
|
||||
for (;;) {
|
||||
int32_t srcLen = srcEnd - src;
|
||||
int32_t dstLen = 0;
|
||||
nsresult rv = mEncoder->GetMaxLength(src, srcLen, &dstLen);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
uint32_t needed = dstWritten + dstLen;
|
||||
if (needed > INT32_MAX) {
|
||||
return false;
|
||||
}
|
||||
// Behind the scenes SetLength() makes the underlying allocation not have
|
||||
// slop, so we don't need to round up here.
|
||||
if (needed > aBytes.Length() && !aBytes.SetLength(needed,
|
||||
mozilla::fallible_t())) {
|
||||
return false;
|
||||
}
|
||||
// We need to re-obtain the destination pointer on every iteration, because
|
||||
// SetLength() invalidates it.
|
||||
char* dst = aBytes.BeginWriting() + dstWritten;
|
||||
dstLen = aBytes.Length() - dstWritten;
|
||||
mEncoder->Reset();
|
||||
rv = mEncoder->Convert(src, &srcLen, dst, &dstLen);
|
||||
// Update state tracking
|
||||
src += srcLen;
|
||||
dstWritten += dstLen;
|
||||
if (rv == NS_OK_UENC_MOREOUTPUT) {
|
||||
MOZ_ASSERT_UNREACHABLE("GetMaxLength must have returned a bogus length.");
|
||||
return false;
|
||||
}
|
||||
if (rv == NS_ERROR_UENC_NOMAPPING) {
|
||||
int32_t unmappable;
|
||||
// The unmappable code unit or the first half of an unmappable surrogate
|
||||
// pair is consumed by the encoder.
|
||||
MOZ_ASSERT(srcLen > 0, "Encoder should have consumed some input.");
|
||||
char16_t codeUnit = src[-1];
|
||||
// Let's see if it is a surrogate
|
||||
size_t highBits = (codeUnit & 0xFC00);
|
||||
if (highBits == 0xD800) {
|
||||
// high surrogate
|
||||
// Let's see if we actually have a surrogate pair.
|
||||
char16_t next;
|
||||
if (src < srcEnd && NS_IS_LOW_SURROGATE((next = *src))) {
|
||||
src++; // consume the low surrogate
|
||||
unmappable = SURROGATE_TO_UCS4(codeUnit, next);
|
||||
} else {
|
||||
// unpaired surrogate.
|
||||
unmappable = 0xFFFD;
|
||||
}
|
||||
} else if (highBits == 0xDC00) {
|
||||
// low surrogate
|
||||
// This must be an unpaired surrogate.
|
||||
unmappable = 0xFFFD;
|
||||
} else {
|
||||
// not a surrogate
|
||||
unmappable = codeUnit;
|
||||
}
|
||||
// If we are encoding to ISO-2022-JP, we need to let the encoder to
|
||||
// generate a transition to the ASCII state if not already there.
|
||||
dst = aBytes.BeginWriting() + dstWritten;
|
||||
dstLen = aBytes.Length() - dstWritten;
|
||||
rv = mEncoder->Finish(dst, &dstLen);
|
||||
dstWritten += dstLen;
|
||||
if (rv != NS_OK) {
|
||||
// Failures should be impossible if GetMaxLength works. Big5 is the
|
||||
// only case where Finish() may return NS_ERROR_UENC_NOMAPPING but
|
||||
// that should never happen right after Convert() has returned it.
|
||||
MOZ_ASSERT_UNREACHABLE("Broken encoder.");
|
||||
return false;
|
||||
}
|
||||
if (!WriteNCR(aBytes, dstWritten, unmappable)) {
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!(rv == NS_OK || rv == NS_OK_UENC_MOREINPUT)) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(src == srcEnd, "Converter did not consume all input.");
|
||||
dst = aBytes.BeginWriting() + dstWritten;
|
||||
dstLen = aBytes.Length() - dstWritten;
|
||||
rv = mEncoder->Finish(dst, &dstLen);
|
||||
dstWritten += dstLen;
|
||||
if (rv == NS_OK_UENC_MOREOUTPUT) {
|
||||
MOZ_ASSERT_UNREACHABLE("GetMaxLength must have returned a bogus length.");
|
||||
return false;
|
||||
}
|
||||
if (rv == NS_ERROR_UENC_NOMAPPING) {
|
||||
// Big5
|
||||
if (!WriteNCR(aBytes, dstWritten, 0xFFFD)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return aBytes.SetLength(dstWritten, mozilla::fallible_t());
|
||||
}
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsNCRFallbackEncoderWrapper_h_
|
||||
#define nsNCRFallbackEncoderWrapper_h_
|
||||
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
|
||||
class nsNCRFallbackEncoderWrapper
|
||||
{
|
||||
public:
|
||||
explicit nsNCRFallbackEncoderWrapper(const nsACString& aEncoding);
|
||||
~nsNCRFallbackEncoderWrapper();
|
||||
|
||||
/**
|
||||
* Convert text to bytes with decimal numeric character reference replacement
|
||||
* for unmappables.
|
||||
*
|
||||
* @param aUtf16 UTF-16 input
|
||||
* @param aBytes conversion output
|
||||
* @return true on success and false on failure (OOM)
|
||||
*/
|
||||
bool Encode(const nsAString& aUtf16,
|
||||
nsACString& aBytes);
|
||||
|
||||
private:
|
||||
bool WriteNCR(nsACString& aBytes, uint32_t& aDstWritten, int32_t aUnmappable);
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> mEncoder;
|
||||
};
|
||||
|
||||
#endif /* nsNCRFallbackEncoderWrapper_h_ */
|
@ -1,56 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsReplacementToUnicode.h"
|
||||
|
||||
nsReplacementToUnicode::nsReplacementToUnicode()
|
||||
: mSeenByte(false)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsReplacementToUnicode::Convert(const char* aSrc,
|
||||
int32_t* aSrcLength,
|
||||
char16_t* aDest,
|
||||
int32_t* aDestLength)
|
||||
{
|
||||
if (mSeenByte || !(*aSrcLength)) {
|
||||
*aDestLength = 0;
|
||||
return NS_PARTIAL_MORE_INPUT;
|
||||
}
|
||||
if (mErrBehavior == kOnError_Signal) {
|
||||
mSeenByte = true;
|
||||
*aSrcLength = 0;
|
||||
*aDestLength = 0;
|
||||
return NS_ERROR_ILLEGAL_INPUT;
|
||||
}
|
||||
if (!(*aDestLength)) {
|
||||
*aSrcLength = -1;
|
||||
return NS_PARTIAL_MORE_OUTPUT;
|
||||
}
|
||||
mSeenByte = true;
|
||||
*aDest = 0xFFFD;
|
||||
*aDestLength = 1;
|
||||
return NS_PARTIAL_MORE_INPUT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsReplacementToUnicode::GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength)
|
||||
{
|
||||
if (!mSeenByte && aSrcLength > 0) {
|
||||
*aDestLength = 1;
|
||||
} else {
|
||||
*aDestLength = 0;
|
||||
}
|
||||
return NS_EXACT_LENGTH;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsReplacementToUnicode::Reset()
|
||||
{
|
||||
mSeenByte = false;
|
||||
return NS_OK;
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsReplacementToUnicode_h_
|
||||
#define nsReplacementToUnicode_h_
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
|
||||
#define NS_REPLACEMENTTOUNICODE_CID \
|
||||
{ 0xd24b24da, 0xc607, 0x489a, \
|
||||
{ 0xb5, 0xf0, 0x67, 0x91, 0xf4, 0x45, 0x45, 0x6d } }
|
||||
|
||||
#define NS_REPLACEMENTTOUNICODE_CONTRACTID \
|
||||
"@mozilla.org/intl/unicode/decoder;1?charset=replacement"
|
||||
|
||||
class nsReplacementToUnicode : public nsBasicDecoderSupport
|
||||
{
|
||||
public:
|
||||
nsReplacementToUnicode();
|
||||
|
||||
NS_IMETHOD Convert(const char* aSrc,
|
||||
int32_t* aSrcLength,
|
||||
char16_t* aDest,
|
||||
int32_t* aDestLength) override;
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
|
||||
NS_IMETHOD Reset() override;
|
||||
|
||||
private:
|
||||
bool mSeenByte;
|
||||
};
|
||||
|
||||
#endif // nsReplacementToUnicode_h_
|
@ -1,425 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUCvJaSupport_h___
|
||||
#define nsUCvJaSupport_h___
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "uconvutil.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
|
||||
#define ONE_BYTE_TABLE_SIZE 256
|
||||
|
||||
inline bool WillOverrun(char16_t* aDest, char16_t* aDestEnd, uint32_t aLength)
|
||||
{
|
||||
NS_ASSERTION(aDest <= aDestEnd, "Pointer overrun even before check");
|
||||
return (uint32_t(aDestEnd - aDest) < aLength);
|
||||
}
|
||||
#define CHECK_OVERRUN(dest, destEnd, length) (WillOverrun(dest, destEnd, length))
|
||||
|
||||
#ifdef DEBUG
|
||||
// {7AFC9F0A-CFE1-44ea-A755-E3B86AB1226E}
|
||||
#define NS_IBASICDECODER_IID \
|
||||
{ 0x7afc9f0a, 0xcfe1, 0x44ea, { 0xa7, 0x55, 0xe3, 0xb8, 0x6a, 0xb1, 0x22, 0x6e } }
|
||||
|
||||
// {65968A7B-6467-4c4a-B50A-3E0C97A32F07}
|
||||
#define NS_IBASICENCODER_IID \
|
||||
{ 0x65968a7b, 0x6467, 0x4c4a, { 0xb5, 0xa, 0x3e, 0xc, 0x97, 0xa3, 0x2f, 0x7 } }
|
||||
|
||||
class nsIBasicDecoder : public nsISupports {
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IBASICDECODER_IID)
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIBasicDecoder, NS_IBASICDECODER_IID)
|
||||
|
||||
class nsIBasicEncoder : public nsISupports {
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IBASICENCODER_IID)
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIBasicEncoder, NS_IBASICENCODER_IID)
|
||||
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicDecoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for the Unicode decoders.
|
||||
*
|
||||
* The class source files for this class are in /ucvlatin/nsUCvJaSupport.
|
||||
* However, because these objects requires non-xpcom subclassing, local copies
|
||||
* will be made into the other directories using them. Just don't forget to
|
||||
* keep in sync with the master copy!
|
||||
*
|
||||
* This class implements:
|
||||
* - nsISupports
|
||||
* - nsIUnicodeDecoder
|
||||
*
|
||||
* @created 19/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsBasicDecoderSupport : public nsIUnicodeDecoder
|
||||
#ifdef DEBUG
|
||||
,public nsIBasicDecoder
|
||||
#endif
|
||||
{
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsBasicDecoderSupport();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Interface nsIUnicodeDecoder [declaration]
|
||||
|
||||
virtual void SetInputErrorBehavior(int32_t aBehavior) override;
|
||||
virtual char16_t GetCharacterForUnMapped() override;
|
||||
|
||||
protected:
|
||||
int32_t mErrBehavior;
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsBasicDecoderSupport();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBufferDecoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for the Unicode decoders.
|
||||
*
|
||||
* This class implements:
|
||||
* - the buffer management
|
||||
*
|
||||
* @created 15/Mar/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsBufferDecoderSupport : public nsBasicDecoderSupport
|
||||
{
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Internal buffer for partial conversions.
|
||||
*/
|
||||
char * mBuffer;
|
||||
int32_t mBufferCapacity;
|
||||
int32_t mBufferLength;
|
||||
|
||||
uint32_t mMaxLengthFactor;
|
||||
|
||||
/**
|
||||
* Convert method but *without* the buffer management stuff.
|
||||
*/
|
||||
NS_IMETHOD ConvertNoBuff(const char * aSrc, int32_t * aSrcLength,
|
||||
char16_t * aDest, int32_t * aDestLength) = 0;
|
||||
|
||||
void FillBuffer(const char ** aSrc, int32_t aSrcLength);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
explicit nsBufferDecoderSupport(uint32_t aMaxLengthFactor);
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsBufferDecoderSupport();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Interface nsIUnicodeDecoder [declaration]
|
||||
|
||||
NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength,
|
||||
char16_t * aDest, int32_t * aDestLength);
|
||||
NS_IMETHOD Reset();
|
||||
NS_IMETHOD GetMaxLength(const char *aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsMultiTableDecoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for a multi-table-driven Unicode decoder.
|
||||
*
|
||||
* @created 24/Mar/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsMultiTableDecoderSupport : public nsBufferDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsMultiTableDecoderSupport(int32_t aTableCount, const uRange * aRangeArray,
|
||||
uScanClassID * aScanClassArray,
|
||||
uMappingTable ** aMappingTable,
|
||||
uint32_t aMaxLengthFactor);
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsMultiTableDecoderSupport();
|
||||
|
||||
protected:
|
||||
|
||||
int32_t mTableCount;
|
||||
const uRange * mRangeArray;
|
||||
uScanClassID * mScanClassArray;
|
||||
uMappingTable ** mMappingTable;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsBufferDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD ConvertNoBuff(const char * aSrc, int32_t * aSrcLength,
|
||||
char16_t * aDest, int32_t * aDestLength);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBufferDecoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for a single-byte Unicode decoder.
|
||||
*
|
||||
* @created 19/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsOneByteDecoderSupport : public nsBasicDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
explicit nsOneByteDecoderSupport(uMappingTable * aMappingTable);
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsOneByteDecoderSupport();
|
||||
|
||||
protected:
|
||||
|
||||
uMappingTable * mMappingTable;
|
||||
char16_t mFastTable[ONE_BYTE_TABLE_SIZE];
|
||||
bool mFastTableCreated;
|
||||
mozilla::Mutex mFastTableMutex;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength,
|
||||
char16_t * aDest, int32_t * aDestLength);
|
||||
NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength,
|
||||
int32_t * aDestLength);
|
||||
NS_IMETHOD Reset();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsBasicEncoder [declaration]
|
||||
|
||||
class nsBasicEncoder : public nsIUnicodeEncoder
|
||||
#ifdef DEBUG
|
||||
,public nsIBasicEncoder
|
||||
#endif
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsBasicEncoder();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsBasicEncoder();
|
||||
|
||||
};
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsEncoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for the Unicode encoders.
|
||||
*
|
||||
* This class implements:
|
||||
* - nsISupports
|
||||
* - the buffer management
|
||||
* - error handling procedure(s)
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsEncoderSupport : public nsBasicEncoder
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* Internal buffer for partial conversions.
|
||||
*/
|
||||
char * mBuffer;
|
||||
int32_t mBufferCapacity;
|
||||
char * mBufferStart;
|
||||
char * mBufferEnd;
|
||||
|
||||
/**
|
||||
* Error handling stuff
|
||||
*/
|
||||
int32_t mErrBehavior;
|
||||
nsCOMPtr<nsIUnicharEncoder> mErrEncoder;
|
||||
char16_t mErrChar;
|
||||
uint32_t mMaxLengthFactor;
|
||||
|
||||
/**
|
||||
* Convert method but *without* the buffer management stuff and *with*
|
||||
* error handling stuff.
|
||||
*/
|
||||
NS_IMETHOD ConvertNoBuff(const char16_t * aSrc, int32_t * aSrcLength,
|
||||
char * aDest, int32_t * aDestLength);
|
||||
|
||||
/**
|
||||
* Convert method but *without* the buffer management stuff and *without*
|
||||
* error handling stuff.
|
||||
*/
|
||||
NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength,
|
||||
char * aDest, int32_t * aDestLength) = 0;
|
||||
|
||||
/**
|
||||
* Finish method but *without* the buffer management stuff.
|
||||
*/
|
||||
NS_IMETHOD FinishNoBuff(char * aDest, int32_t * aDestLength);
|
||||
|
||||
/**
|
||||
* Copy as much as possible from the internal buffer to the destination.
|
||||
*/
|
||||
nsresult FlushBuffer(char ** aDest, const char * aDestEnd);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
explicit nsEncoderSupport(uint32_t aMaxLengthFactor);
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsEncoderSupport();
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Interface nsIUnicodeEncoder [declaration]
|
||||
|
||||
NS_IMETHOD Convert(const char16_t * aSrc, int32_t * aSrcLength,
|
||||
char * aDest, int32_t * aDestLength);
|
||||
NS_IMETHOD Finish(char * aDest, int32_t * aDestLength);
|
||||
NS_IMETHOD Reset();
|
||||
NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior,
|
||||
nsIUnicharEncoder * aEncoder, char16_t aChar);
|
||||
NS_IMETHOD GetMaxLength(const char16_t * aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t * aDestLength);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsTableEncoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for a single-table-driven Unicode encoder.
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsTableEncoderSupport : public nsEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructors.
|
||||
*/
|
||||
nsTableEncoderSupport(uScanClassID aScanClass,
|
||||
uShiftOutTable * aShiftOutTable,
|
||||
uMappingTable * aMappingTable,
|
||||
uint32_t aMaxLengthFactor);
|
||||
|
||||
nsTableEncoderSupport(uScanClassID aScanClass,
|
||||
uMappingTable * aMappingTable,
|
||||
uint32_t aMaxLengthFactor);
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsTableEncoderSupport();
|
||||
|
||||
protected:
|
||||
|
||||
uScanClassID mScanClass;
|
||||
uShiftOutTable * mShiftOutTable;
|
||||
uMappingTable * mMappingTable;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength,
|
||||
char * aDest, int32_t * aDestLength);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsMultiTableEncoderSupport [declaration]
|
||||
|
||||
/**
|
||||
* Support class for a multi-table-driven Unicode encoder.
|
||||
*
|
||||
* @created 11/Mar/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsMultiTableEncoderSupport : public nsEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsMultiTableEncoderSupport(int32_t aTableCount,
|
||||
uScanClassID * aScanClassArray,
|
||||
uShiftOutTable ** aShiftOutTable,
|
||||
uMappingTable ** aMappingTable,
|
||||
uint32_t aMaxLengthFactor);
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsMultiTableEncoderSupport();
|
||||
|
||||
protected:
|
||||
|
||||
int32_t mTableCount;
|
||||
uScanClassID * mScanClassArray;
|
||||
uShiftOutTable ** mShiftOutTable;
|
||||
uMappingTable ** mMappingTable;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength,
|
||||
char * aDest, int32_t * aDestLength);
|
||||
};
|
||||
|
||||
|
||||
#endif /* nsUCvJaSupport_h___ */
|
@ -1,370 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsUTF8ToUnicode.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/SSE.h"
|
||||
#include "nsCharTraits.h"
|
||||
#include <algorithm>
|
||||
|
||||
#define UNICODE_BYTE_ORDER_MARK 0xFEFF
|
||||
|
||||
static char16_t* EmitSurrogatePair(uint32_t ucs4, char16_t* aDest)
|
||||
{
|
||||
NS_ASSERTION(ucs4 > 0xFFFF, "Should be a supplementary character");
|
||||
ucs4 -= 0x00010000;
|
||||
*aDest++ = 0xD800 | (0x000003FF & (ucs4 >> 10));
|
||||
*aDest++ = 0xDC00 | (0x000003FF & ucs4);
|
||||
return aDest;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUTF8ToUnicode [implementation]
|
||||
|
||||
nsUTF8ToUnicode::nsUTF8ToUnicode()
|
||||
: nsBasicDecoderSupport()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsTableDecoderSupport class [implementation]
|
||||
|
||||
/**
|
||||
* Normally the maximum length of the output of the UTF8 decoder in UTF16
|
||||
* code units is the same as the length of the input in UTF8 code units,
|
||||
* since 1-byte, 2-byte and 3-byte UTF-8 sequences decode to a single
|
||||
* UTF-16 character, and 4-byte UTF-8 sequences decode to a surrogate pair.
|
||||
*
|
||||
* However, there is an edge case where the output can be longer than the
|
||||
* input: if the previous buffer ended with an incomplete multi-byte
|
||||
* sequence and this buffer does not begin with a valid continuation
|
||||
* byte, we will return NS_ERROR_ILLEGAL_INPUT and the caller may insert a
|
||||
* replacement character in the output buffer which corresponds to no
|
||||
* character in the input buffer. So in the worst case the destination
|
||||
* will need to be one code unit longer than the source.
|
||||
* See bug 301797.
|
||||
*/
|
||||
NS_IMETHODIMP nsUTF8ToUnicode::GetMaxLength(const char * aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t * aDestLength)
|
||||
{
|
||||
mozilla::CheckedInt32 length = aSrcLength;
|
||||
length += 1;
|
||||
|
||||
if (!length.isValid()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
*aDestLength = length.value();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUTF8ToUnicode::Reset()
|
||||
{
|
||||
|
||||
mUcs4 = 0; // cached Unicode character
|
||||
mState = 0; // cached expected number of octets after the current octet
|
||||
// until the beginning of the next UTF8 character sequence
|
||||
mBytes = 1; // cached expected number of octets in the current sequence
|
||||
mFirst = true;
|
||||
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [implementation]
|
||||
|
||||
// Fast ASCII -> UTF16 inner loop implementations
|
||||
//
|
||||
// Convert_ascii_run will update src and dst to the new values, and
|
||||
// len must be the maximum number ascii chars that it would be valid
|
||||
// to take from src and place into dst. (That is, the minimum of the
|
||||
// number of bytes left in src and the number of unichars available in
|
||||
// dst.)
|
||||
|
||||
#if defined(__arm__) || defined(_M_ARM)
|
||||
|
||||
// on ARM, do extra work to avoid byte/halfword reads/writes by
|
||||
// reading/writing a word at a time for as long as we can
|
||||
static inline void
|
||||
Convert_ascii_run (const char *&src,
|
||||
char16_t *&dst,
|
||||
int32_t len)
|
||||
{
|
||||
const uint32_t *src32;
|
||||
uint32_t *dst32;
|
||||
|
||||
// with some alignments, we'd never actually break out of the slow loop, so
|
||||
// check and do the faster slow loop
|
||||
if ((((NS_PTR_TO_UINT32(dst) & 3) == 0) && ((NS_PTR_TO_UINT32(src) & 1) == 0)) ||
|
||||
(((NS_PTR_TO_UINT32(dst) & 3) == 2) && ((NS_PTR_TO_UINT32(src) & 1) == 1)))
|
||||
{
|
||||
while (((NS_PTR_TO_UINT32(src) & 3) ||
|
||||
(NS_PTR_TO_UINT32(dst) & 3)) &&
|
||||
len > 0)
|
||||
{
|
||||
if (*src & 0x80U)
|
||||
return;
|
||||
*dst++ = (char16_t) *src++;
|
||||
len--;
|
||||
}
|
||||
} else {
|
||||
goto finish;
|
||||
}
|
||||
|
||||
// then go 4 bytes at a time
|
||||
src32 = (const uint32_t*) src;
|
||||
dst32 = (uint32_t*) dst;
|
||||
|
||||
while (len > 4) {
|
||||
uint32_t in = *src32++;
|
||||
|
||||
if (in & 0x80808080U) {
|
||||
src32--;
|
||||
break;
|
||||
}
|
||||
|
||||
*dst32++ = ((in & 0x000000ff) >> 0) | ((in & 0x0000ff00) << 8);
|
||||
*dst32++ = ((in & 0x00ff0000) >> 16) | ((in & 0xff000000) >> 8);
|
||||
|
||||
len -= 4;
|
||||
}
|
||||
|
||||
src = (const char *) src32;
|
||||
dst = (char16_t *) dst32;
|
||||
|
||||
finish:
|
||||
while (len-- > 0 && (*src & 0x80U) == 0) {
|
||||
*dst++ = (char16_t) *src++;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifdef MOZILLA_MAY_SUPPORT_SSE2
|
||||
namespace mozilla {
|
||||
namespace SSE2 {
|
||||
|
||||
void Convert_ascii_run(const char *&src, char16_t *&dst, int32_t len);
|
||||
|
||||
} // namespace SSE2
|
||||
} // namespace mozilla
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
Convert_ascii_run (const char *&src,
|
||||
char16_t *&dst,
|
||||
int32_t len)
|
||||
{
|
||||
#ifdef MOZILLA_MAY_SUPPORT_SSE2
|
||||
if (mozilla::supports_sse2()) {
|
||||
mozilla::SSE2::Convert_ascii_run(src, dst, len);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
while (len-- > 0 && (*src & 0x80U) == 0) {
|
||||
*dst++ = (char16_t) *src++;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsUTF8ToUnicode::Convert(const char * aSrc,
|
||||
int32_t * aSrcLength,
|
||||
char16_t * aDest,
|
||||
int32_t * aDestLength)
|
||||
{
|
||||
uint32_t aSrcLen = (uint32_t) (*aSrcLength);
|
||||
uint32_t aDestLen = (uint32_t) (*aDestLength);
|
||||
|
||||
const char *in, *inend;
|
||||
inend = aSrc + aSrcLen;
|
||||
|
||||
char16_t *out, *outend;
|
||||
outend = aDest + aDestLen;
|
||||
|
||||
nsresult res = NS_OK; // conversion result
|
||||
|
||||
out = aDest;
|
||||
if (mState == 0xFF) {
|
||||
// Emit supplementary character left over from previous iteration. It is
|
||||
// caller's responsibility to keep a sufficient buffer.
|
||||
if (aDestLen < 2) {
|
||||
*aSrcLength = *aDestLength = 0;
|
||||
return NS_OK_UDEC_MOREOUTPUT;
|
||||
}
|
||||
out = EmitSurrogatePair(mUcs4, out);
|
||||
mUcs4 = 0;
|
||||
mState = 0;
|
||||
mBytes = 1;
|
||||
mFirst = false;
|
||||
}
|
||||
|
||||
// alias these locally for speed
|
||||
int32_t mUcs4 = this->mUcs4;
|
||||
uint8_t mState = this->mState;
|
||||
uint8_t mBytes = this->mBytes;
|
||||
bool mFirst = this->mFirst;
|
||||
|
||||
// Set mFirst to false now so we don't have to every time through the ASCII
|
||||
// branch within the loop.
|
||||
if (mFirst && aSrcLen && (0 == (0x80 & (*aSrc))))
|
||||
mFirst = false;
|
||||
|
||||
for (in = aSrc; ((in < inend) && (out < outend)); ++in) {
|
||||
uint8_t c = *in;
|
||||
if (0 == mState) {
|
||||
// When mState is zero we expect either a US-ASCII character or a
|
||||
// multi-octet sequence.
|
||||
if (c < 0x80) { // 00..7F
|
||||
int32_t max_loops = std::min(inend - in, outend - out);
|
||||
Convert_ascii_run(in, out, max_loops);
|
||||
--in; // match the rest of the cases
|
||||
mBytes = 1;
|
||||
} else if (c < 0xC2) { // C0/C1
|
||||
// Overlong 2 octet sequence
|
||||
if (mErrBehavior == kOnError_Signal) {
|
||||
res = NS_ERROR_ILLEGAL_INPUT;
|
||||
break;
|
||||
}
|
||||
*out++ = UCS2_REPLACEMENT_CHAR;
|
||||
mFirst = false;
|
||||
} else if (c < 0xE0) { // C2..DF
|
||||
// First octet of 2 octet sequence
|
||||
mUcs4 = c;
|
||||
mUcs4 = (mUcs4 & 0x1F) << 6;
|
||||
mState = 1;
|
||||
mBytes = 2;
|
||||
} else if (c < 0xF0) { // E0..EF
|
||||
// First octet of 3 octet sequence
|
||||
mUcs4 = c;
|
||||
mUcs4 = (mUcs4 & 0x0F) << 12;
|
||||
mState = 2;
|
||||
mBytes = 3;
|
||||
} else if (c < 0xF5) { // F0..F4
|
||||
// First octet of 4 octet sequence
|
||||
mUcs4 = c;
|
||||
mUcs4 = (mUcs4 & 0x07) << 18;
|
||||
mState = 3;
|
||||
mBytes = 4;
|
||||
} else { // F5..FF
|
||||
/* Current octet is neither in the US-ASCII range nor a legal first
|
||||
* octet of a multi-octet sequence.
|
||||
*/
|
||||
if (mErrBehavior == kOnError_Signal) {
|
||||
/* Return an error condition. Caller is responsible for flushing and
|
||||
* refilling the buffer and resetting state.
|
||||
*/
|
||||
res = NS_ERROR_ILLEGAL_INPUT;
|
||||
break;
|
||||
}
|
||||
*out++ = UCS2_REPLACEMENT_CHAR;
|
||||
mFirst = false;
|
||||
}
|
||||
} else {
|
||||
// When mState is non-zero, we expect a continuation of the multi-octet
|
||||
// sequence
|
||||
if (0x80 == (0xC0 & c)) {
|
||||
if (mState > 1) {
|
||||
// If we are here, all possibilities are:
|
||||
// mState == 2 && mBytes == 3 ||
|
||||
// mState == 2 && mBytes == 4 ||
|
||||
// mState == 3 && mBytes == 4
|
||||
if ((mBytes == 3 && ((!mUcs4 && c < 0xA0) || // E0 80..9F
|
||||
(mUcs4 == 0xD000 && c > 0x9F))) || // ED A0..BF
|
||||
(mState == 3 && ((!mUcs4 && c < 0x90) || // F0 80..8F
|
||||
(mUcs4 == 0x100000 && c > 0x8F)))) {// F4 90..BF
|
||||
// illegal sequences or sequences converted into illegal ranges.
|
||||
in--;
|
||||
if (mErrBehavior == kOnError_Signal) {
|
||||
res = NS_ERROR_ILLEGAL_INPUT;
|
||||
break;
|
||||
}
|
||||
*out++ = UCS2_REPLACEMENT_CHAR;
|
||||
mState = 0;
|
||||
mFirst = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Legal continuation.
|
||||
uint32_t shift = (mState - 1) * 6;
|
||||
uint32_t tmp = c;
|
||||
tmp = (tmp & 0x0000003FL) << shift;
|
||||
mUcs4 |= tmp;
|
||||
|
||||
if (0 == --mState) {
|
||||
/* End of the multi-octet sequence. mUcs4 now contains the final
|
||||
* Unicode codepoint to be output
|
||||
*/
|
||||
|
||||
if (mUcs4 > 0xFFFF) {
|
||||
// mUcs4 is in the range 0x10000 - 0x10FFFF. Output a UTF-16 pair
|
||||
if (out + 2 > outend) {
|
||||
// insufficient space left in the buffer. Keep mUcs4 for the
|
||||
// next iteration.
|
||||
mState = 0xFF;
|
||||
++in;
|
||||
res = NS_OK_UDEC_MOREOUTPUT;
|
||||
break;
|
||||
}
|
||||
out = EmitSurrogatePair(mUcs4, out);
|
||||
} else if (UNICODE_BYTE_ORDER_MARK != mUcs4 || !mFirst) {
|
||||
// Don't output the BOM only if it is the first character
|
||||
*out++ = mUcs4;
|
||||
}
|
||||
//initialize UTF8 cache
|
||||
mUcs4 = 0;
|
||||
mState = 0;
|
||||
mBytes = 1;
|
||||
mFirst = false;
|
||||
}
|
||||
} else {
|
||||
/* ((0xC0 & c != 0x80) && (mState != 0))
|
||||
*
|
||||
* Incomplete multi-octet sequence. Unconsume this
|
||||
* octet and return an error condition. Caller is responsible
|
||||
* for flushing and refilling the buffer and resetting state.
|
||||
*/
|
||||
in--;
|
||||
if (mErrBehavior == kOnError_Signal) {
|
||||
res = NS_ERROR_ILLEGAL_INPUT;
|
||||
break;
|
||||
}
|
||||
*out++ = UCS2_REPLACEMENT_CHAR;
|
||||
mState = 0;
|
||||
mFirst = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// output not finished, output buffer too short
|
||||
if ((NS_OK == res) && (in < inend) && (out >= outend))
|
||||
res = NS_OK_UDEC_MOREOUTPUT;
|
||||
|
||||
// last UCS4 is incomplete, make sure the caller
|
||||
// returns with properly aligned continuation of the buffer
|
||||
if ((NS_OK == res) && (mState != 0))
|
||||
res = NS_OK_UDEC_MOREINPUT;
|
||||
|
||||
*aSrcLength = in - aSrc;
|
||||
*aDestLength = out - aDest;
|
||||
|
||||
this->mUcs4 = mUcs4;
|
||||
this->mState = mState;
|
||||
this->mBytes = mBytes;
|
||||
this->mFirst = mFirst;
|
||||
|
||||
return(res);
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUTF8ToUnicode_h___
|
||||
#define nsUTF8ToUnicode_h___
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
|
||||
// Class ID for our UTF8ToUnicode charset converter
|
||||
// {5534DDC0-DD96-11d2-8AAC-00600811A836}
|
||||
#define NS_UTF8TOUNICODE_CID \
|
||||
{ 0x5534ddc0, 0xdd96, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_UTF8TOUNICODE_CONTRACTID "@mozilla.org/intl/unicode/decoder;1?charset=UTF-8"
|
||||
|
||||
//#define NS_ERROR_UCONV_NOUTF8TOUNICODE
|
||||
// NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUTF8ToUnicode [declaration]
|
||||
|
||||
|
||||
/**
|
||||
* A character set converter from UTF8 to Unicode.
|
||||
*
|
||||
* @created 18/Mar/1998
|
||||
* @modified 04/Feb/2000
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
|
||||
class nsUTF8ToUnicode : public nsBasicDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUTF8ToUnicode();
|
||||
|
||||
protected:
|
||||
|
||||
uint32_t mUcs4; // cached Unicode character
|
||||
uint8_t mState; // cached expected number of bytes per UTF8 character sequence
|
||||
uint8_t mBytes;
|
||||
bool mFirst;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsDecoderSupport class [declaration]
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength,
|
||||
char16_t * aDest, int32_t * aDestLength) override;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsBasicDecoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD Reset() override;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsUTF8ToUnicode_h___ */
|
||||
|
@ -1,96 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// This file should only be compiled if you're on x86 or x86_64. Additionally,
|
||||
// you'll need to compile this file with -msse2 if you're using gcc.
|
||||
|
||||
#include <emmintrin.h>
|
||||
#include "nscore.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace SSE2 {
|
||||
|
||||
void
|
||||
Convert_ascii_run(const char *&src,
|
||||
char16_t *&dst,
|
||||
int32_t len)
|
||||
{
|
||||
if (len > 15) {
|
||||
__m128i in, out1, out2;
|
||||
__m128d *outp1, *outp2;
|
||||
__m128i zeroes;
|
||||
uint32_t offset;
|
||||
|
||||
// align input to 16 bytes
|
||||
while ((NS_PTR_TO_UINT32(src) & 15) && len > 0) {
|
||||
if (*src & 0x80U)
|
||||
return;
|
||||
*dst++ = (char16_t) *src++;
|
||||
len--;
|
||||
}
|
||||
|
||||
zeroes = _mm_setzero_si128();
|
||||
|
||||
offset = NS_PTR_TO_UINT32(dst) & 15;
|
||||
|
||||
// Note: all these inner loops have to break, not return; we need
|
||||
// to let the single-char loop below catch any leftover
|
||||
// byte-at-a-time ASCII chars, since this function must consume
|
||||
// all available ASCII chars before it returns
|
||||
|
||||
if (offset == 0) {
|
||||
while (len > 15) {
|
||||
in = _mm_load_si128((__m128i *) src);
|
||||
if (_mm_movemask_epi8(in))
|
||||
break;
|
||||
out1 = _mm_unpacklo_epi8(in, zeroes);
|
||||
out2 = _mm_unpackhi_epi8(in, zeroes);
|
||||
_mm_stream_si128((__m128i *) dst, out1);
|
||||
_mm_stream_si128((__m128i *) (dst + 8), out2);
|
||||
dst += 16;
|
||||
src += 16;
|
||||
len -= 16;
|
||||
}
|
||||
} else if (offset == 8) {
|
||||
outp1 = (__m128d *) &out1;
|
||||
outp2 = (__m128d *) &out2;
|
||||
while (len > 15) {
|
||||
in = _mm_load_si128((__m128i *) src);
|
||||
if (_mm_movemask_epi8(in))
|
||||
break;
|
||||
out1 = _mm_unpacklo_epi8(in, zeroes);
|
||||
out2 = _mm_unpackhi_epi8(in, zeroes);
|
||||
_mm_storel_epi64((__m128i *) dst, out1);
|
||||
_mm_storel_epi64((__m128i *) (dst + 8), out2);
|
||||
_mm_storeh_pd((double *) (dst + 4), *outp1);
|
||||
_mm_storeh_pd((double *) (dst + 12), *outp2);
|
||||
src += 16;
|
||||
dst += 16;
|
||||
len -= 16;
|
||||
}
|
||||
} else {
|
||||
while (len > 15) {
|
||||
in = _mm_load_si128((__m128i *) src);
|
||||
if (_mm_movemask_epi8(in))
|
||||
break;
|
||||
out1 = _mm_unpacklo_epi8(in, zeroes);
|
||||
out2 = _mm_unpackhi_epi8(in, zeroes);
|
||||
_mm_storeu_si128((__m128i *) dst, out1);
|
||||
_mm_storeu_si128((__m128i *) (dst + 8), out2);
|
||||
src += 16;
|
||||
dst += 16;
|
||||
len -= 16;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// finish off a byte at a time
|
||||
|
||||
while (len-- > 0 && (*src & 0x80U) == 0) {
|
||||
*dst++ = (char16_t) *src++;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace SSE2
|
||||
} // namespace mozilla
|
@ -1,24 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsUCConstructors.h"
|
||||
#include "nsUnicodeToCP1252.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
nsresult
|
||||
nsUnicodeToCP1252Constructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
static const uint16_t g_ufMappingTable[] = {
|
||||
#include "cp1252.uf"
|
||||
};
|
||||
|
||||
return CreateTableEncoder(u1ByteCharset,
|
||||
(uMappingTable*) &g_ufMappingTable, 1,
|
||||
aOuter, aIID, aResult);
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUnicodeToCP1252_h___
|
||||
#define nsUnicodeToCP1252_h___
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
class nsISupports;
|
||||
|
||||
// Class ID for our UnicodeToCP1252 charset converter
|
||||
// {7B8556AC-EC79-11d2-8AAC-00600811A836}
|
||||
#define NS_UNICODETOCP1252_CID \
|
||||
{ 0x7b8556ac, 0xec79, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_UNICODETOCP1252_CONTRACTID "@mozilla.org/intl/unicode/encoder;1?charset=windows-1252"
|
||||
|
||||
//#define NS_ERROR_UCONV_NOUNICODETOCP1252
|
||||
// NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to CP1252.
|
||||
*
|
||||
* @created 20/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
nsresult
|
||||
nsUnicodeToCP1252Constructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
#endif /* nsUnicodeToCP1252_h___ */
|
@ -1,24 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsUCConstructors.h"
|
||||
#include "nsUnicodeToISO88591.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
nsresult
|
||||
nsUnicodeToISO88591Constructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
static const uint16_t g_ufMappingTable[] = {
|
||||
#include "8859-1.uf"
|
||||
};
|
||||
|
||||
return CreateTableEncoder(u1ByteCharset,
|
||||
(uMappingTable*) &g_ufMappingTable, 1,
|
||||
aOuter, aIID, aResult);
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUnicodeToISO88591_h___
|
||||
#define nsUnicodeToISO88591_h___
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
class nsISupports;
|
||||
|
||||
// {920307B0-C6E8-11d2-8AA8-00600811A836}
|
||||
#define NS_UNICODETOISO88591_CID \
|
||||
{ 0x920307b0, 0xc6e8, 0x11d2, {0x8a, 0xa8, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_UNICODETOISO88591_CONTRACTID "@mozilla.org/intl/unicode/encoder;1?charset=ISO-8859-1"
|
||||
|
||||
//#define NS_ERROR_UCONV_NOUNICODETOISO88591
|
||||
// NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
|
||||
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to ISO88591.
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
nsresult
|
||||
nsUnicodeToISO88591Constructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
#endif /* nsUnicodeToISO88591_h___ */
|
@ -1,24 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsUCConstructors.h"
|
||||
#include "nsUnicodeToMacRoman.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
nsresult
|
||||
nsUnicodeToMacRomanConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
static const uint16_t g_MacRomanMappingTable[] = {
|
||||
#include "macroman.uf"
|
||||
};
|
||||
|
||||
return CreateTableEncoder(u1ByteCharset,
|
||||
(uMappingTable*) &g_MacRomanMappingTable, 1,
|
||||
aOuter, aIID, aResult);
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUnicodeToMacRoman_h___
|
||||
#define nsUnicodeToMacRoman_h___
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
class nsISupports;
|
||||
|
||||
// Class ID for our UnicodeToMacRoman charset converter
|
||||
// {7B8556AF-EC79-11d2-8AAC-00600811A836}
|
||||
#define NS_UNICODETOMACROMAN_CID \
|
||||
{ 0x7b8556af, 0xec79, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_UNICODETOMACROMAN_CONTRACTID "@mozilla.org/intl/unicode/encoder;1?charset=macintosh"
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to MacRoman.
|
||||
*
|
||||
* @created 05/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
nsresult
|
||||
nsUnicodeToMacRomanConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
#endif /* nsUnicodeToMacRoman_h___ */
|
@ -1,165 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
#include "nsUnicodeToUTF8.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsUnicodeToUTF8, nsIUnicodeEncoder)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsUnicodeToUTF8 class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToUTF8::GetMaxLength(const char16_t* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength)
|
||||
{
|
||||
MOZ_ASSERT(aDestLength);
|
||||
|
||||
// aSrc is interpreted as UTF16, 3 is normally enough.
|
||||
// But when previous buffer only contains part of the surrogate pair, we
|
||||
// need to complete it here. If the first word in following buffer is not
|
||||
// in valid surrogate range, we need to convert the remaining of last buffer
|
||||
// to 3 bytes.
|
||||
mozilla::CheckedInt32 length = aSrcLength;
|
||||
length *= 3;
|
||||
length += 3;
|
||||
|
||||
if (!length.isValid()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
*aDestLength = length.value();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToUTF8::Convert(const char16_t* aSrc,
|
||||
int32_t* aSrcLength,
|
||||
char* aDest,
|
||||
int32_t* aDestLength)
|
||||
{
|
||||
const char16_t* src = aSrc;
|
||||
const char16_t* srcEnd = aSrc + *aSrcLength;
|
||||
char* dest = aDest;
|
||||
int32_t destLen = *aDestLength;
|
||||
uint32_t n;
|
||||
|
||||
//complete remaining of last conversion
|
||||
if (mHighSurrogate) {
|
||||
if (src < srcEnd) {
|
||||
*aDestLength = 0;
|
||||
return NS_OK_UENC_MOREINPUT;
|
||||
}
|
||||
if (*aDestLength < 4) {
|
||||
*aSrcLength = 0;
|
||||
*aDestLength = 0;
|
||||
return NS_OK_UENC_MOREOUTPUT;
|
||||
}
|
||||
if (*src < (char16_t)0xdc00 || *src > (char16_t)0xdfff) { //not a pair
|
||||
*dest++ = (char)0xef; //replacement character
|
||||
*dest++ = (char)0xbf;
|
||||
*dest++ = (char)0xbd;
|
||||
destLen -= 3;
|
||||
} else {
|
||||
n = ((mHighSurrogate - (char16_t)0xd800) << 10) +
|
||||
(*src - (char16_t)0xdc00) + 0x10000;
|
||||
*dest++ = (char)0xf0 | (n >> 18);
|
||||
*dest++ = (char)0x80 | ((n >> 12) & 0x3f);
|
||||
*dest++ = (char)0x80 | ((n >> 6) & 0x3f);
|
||||
*dest++ = (char)0x80 | (n & 0x3f);
|
||||
++src;
|
||||
destLen -= 4;
|
||||
}
|
||||
mHighSurrogate = 0;
|
||||
}
|
||||
|
||||
while (src < srcEnd) {
|
||||
if ( *src <= 0x007f) {
|
||||
if (destLen < 1)
|
||||
goto error_more_output;
|
||||
*dest++ = (char)*src;
|
||||
--destLen;
|
||||
} else if (*src <= 0x07ff) {
|
||||
if (destLen < 2)
|
||||
goto error_more_output;
|
||||
*dest++ = (char)0xc0 | (*src >> 6);
|
||||
*dest++ = (char)0x80 | (*src & 0x003f);
|
||||
destLen -= 2;
|
||||
} else if (*src >= (char16_t)0xd800 && *src <= (char16_t)0xdfff) {
|
||||
if (*src >= (char16_t)0xdc00) { //not a pair
|
||||
if (destLen < 3)
|
||||
goto error_more_output;
|
||||
*dest++ = (char)0xef; //replacement character
|
||||
*dest++ = (char)0xbf;
|
||||
*dest++ = (char)0xbd;
|
||||
destLen -= 3;
|
||||
++src;
|
||||
continue;
|
||||
}
|
||||
if ((src+1) >= srcEnd) {
|
||||
//we need another surrogate to complete this unicode char
|
||||
mHighSurrogate = *src;
|
||||
*aDestLength = dest - aDest;
|
||||
return NS_OK_UENC_MOREINPUT;
|
||||
}
|
||||
//handle surrogate
|
||||
if (destLen < 4)
|
||||
goto error_more_output;
|
||||
if (*(src+1) < (char16_t)0xdc00 || *(src+1) > 0xdfff) { //not a pair
|
||||
*dest++ = (char)0xef; //replacement character
|
||||
*dest++ = (char)0xbf;
|
||||
*dest++ = (char)0xbd;
|
||||
destLen -= 3;
|
||||
} else {
|
||||
n = ((*src - (char16_t)0xd800) << 10) + (*(src+1) - (char16_t)0xdc00) + (uint32_t)0x10000;
|
||||
*dest++ = (char)0xf0 | (n >> 18);
|
||||
*dest++ = (char)0x80 | ((n >> 12) & 0x3f);
|
||||
*dest++ = (char)0x80 | ((n >> 6) & 0x3f);
|
||||
*dest++ = (char)0x80 | (n & 0x3f);
|
||||
destLen -= 4;
|
||||
++src;
|
||||
}
|
||||
} else {
|
||||
if (destLen < 3)
|
||||
goto error_more_output;
|
||||
//treat rest of the character as BMP
|
||||
*dest++ = (char)0xe0 | (*src >> 12);
|
||||
*dest++ = (char)0x80 | ((*src >> 6) & 0x003f);
|
||||
*dest++ = (char)0x80 | (*src & 0x003f);
|
||||
destLen -= 3;
|
||||
}
|
||||
++src;
|
||||
}
|
||||
|
||||
*aDestLength = dest - aDest;
|
||||
return NS_OK;
|
||||
|
||||
error_more_output:
|
||||
*aSrcLength = src - aSrc;
|
||||
*aDestLength = dest - aDest;
|
||||
return NS_OK_UENC_MOREOUTPUT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToUTF8::Finish(char * aDest, int32_t * aDestLength)
|
||||
{
|
||||
char * dest = aDest;
|
||||
|
||||
if (mHighSurrogate) {
|
||||
if (*aDestLength < 3) {
|
||||
*aDestLength = 0;
|
||||
return NS_OK_UENC_MOREOUTPUT;
|
||||
}
|
||||
*dest++ = (char)0xef; //replacement character
|
||||
*dest++ = (char)0xbf;
|
||||
*dest++ = (char)0xbd;
|
||||
mHighSurrogate = 0;
|
||||
*aDestLength = 3;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aDestLength = 0;
|
||||
return NS_OK;
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUnicodeToUTF8_h___
|
||||
#define nsUnicodeToUTF8_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
|
||||
// Class ID for our UnicodeToUTF8 charset converter
|
||||
// {7C657D18-EC5E-11d2-8AAC-00600811A836}
|
||||
#define NS_UNICODETOUTF8_CID \
|
||||
{ 0x7c657d18, 0xec5e, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#define NS_UNICODETOUTF8_CONTRACTID "@mozilla.org/intl/unicode/encoder;1?charset=UTF-8"
|
||||
|
||||
//#define NS_ERROR_UCONV_NOUNICODETOUTF8
|
||||
// NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_UCONV, 0x31)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToUTF8 [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to UTF8.
|
||||
*
|
||||
* @created 05/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeToUTF8 final : public nsIUnicodeEncoder
|
||||
{
|
||||
~nsUnicodeToUTF8() {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUnicodeToUTF8() {mHighSurrogate = 0;}
|
||||
|
||||
NS_IMETHOD Convert(const char16_t*aSrc,
|
||||
int32_t* aSrcLength,
|
||||
char* aDest,
|
||||
int32_t* aDestLength) override;
|
||||
|
||||
NS_IMETHOD Finish(char* aDest, int32_t* aDestLength) override;
|
||||
|
||||
MOZ_MUST_USE NS_IMETHOD GetMaxLength(const char16_t* aSrc,
|
||||
int32_t aSrcLength,
|
||||
int32_t* aDestLength) override;
|
||||
|
||||
NS_IMETHOD Reset() override {mHighSurrogate = 0; return NS_OK;}
|
||||
|
||||
NS_IMETHOD SetOutputErrorBehavior(int32_t aBehavior,
|
||||
nsIUnicharEncoder* aEncoder, char16_t aChar) override {return NS_OK;}
|
||||
|
||||
protected:
|
||||
char16_t mHighSurrogate;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsUnicodeToUTF8_h___ */
|
@ -1,531 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIStringEnumerator.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
#define ARRAY_SIZE(_array) (sizeof(_array) / sizeof(_array[0]))
|
||||
#define SMALL_BUFFER_SIZE 512
|
||||
#define MED_BUFFER_SIZE 1024
|
||||
#define BIG_BUFFER_SIZE 2048
|
||||
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Class nsTestLog [declaration]
|
||||
|
||||
/**
|
||||
* A Logging class for test programs.
|
||||
*
|
||||
* This simple test program will not trigger a component registration. So
|
||||
* Mozilla has to be run once before running this, so that the necessary
|
||||
* components will be registered. Also, please observe that the ContractID's are
|
||||
* case sensitive now!
|
||||
*
|
||||
* @created 28/Mar/2000
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsTestLog
|
||||
{
|
||||
private:
|
||||
|
||||
static const char * kTraceDelimiter;
|
||||
|
||||
nsAutoCString mTrace;
|
||||
|
||||
public:
|
||||
|
||||
void AddTrace(const char * aTrace);
|
||||
void DelTrace(const char * aTrace);
|
||||
void PrintError(const char * aCall, const int aError);
|
||||
void PrintError(const char * aCall, const char * aMessage);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Class nsTestUConv [declaration]
|
||||
|
||||
/**
|
||||
* The main class of the program.
|
||||
*
|
||||
* XXX Create a very general set of "bug and regression" test cases and the
|
||||
* one in TestTempBug()
|
||||
* XXX Apply the new argument style (pointers) to the converters interfaces
|
||||
*
|
||||
* @created 28/Mar/2000
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsTestUConv
|
||||
{
|
||||
private:
|
||||
|
||||
nsTestLog mLog;
|
||||
|
||||
/**
|
||||
* Run the built-in set of self tests for encoders.
|
||||
*/
|
||||
nsresult TestEncoders();
|
||||
|
||||
/**
|
||||
* Run the built-in set of self tests for decoders.
|
||||
*/
|
||||
nsresult TestDecoders();
|
||||
|
||||
/**
|
||||
* Run the built-in set of self tests for the CharsetManager.
|
||||
*/
|
||||
nsresult TestCharsetManager();
|
||||
|
||||
/**
|
||||
* Display charset detectors and their attributes.
|
||||
*/
|
||||
nsresult DisplayDetectors();
|
||||
|
||||
/**
|
||||
* Display charsets and their attributes.
|
||||
*/
|
||||
nsresult DisplayCharsets();
|
||||
|
||||
/**
|
||||
* Run a temporary debug test. This method is ment as a placeholder when some
|
||||
* quick debugging is needed.
|
||||
*/
|
||||
nsresult TestTempBug();
|
||||
|
||||
nsresult Encode(char16_t ** aSrc, char16_t * aSrcEnd, char ** aDest,
|
||||
char * aDestEnd, const nsAFlatCString& aCharset);
|
||||
|
||||
/**
|
||||
* Bridge methods between the new argument style (poiters) and the old one
|
||||
* (lengths). To be removed when the converter interfaces will switch to the
|
||||
* new style.
|
||||
*
|
||||
* This wraps an encoder Convert() call.
|
||||
*/
|
||||
nsresult ConvertEncode(char16_t ** aSrc, char16_t * aSrcEnd, char ** aDest,
|
||||
char * aDestEnd, nsIUnicodeEncoder * aEncoder);
|
||||
|
||||
/**
|
||||
* This wraps an encoder Finish() call.
|
||||
*/
|
||||
nsresult FinishEncode(char ** aDest, char * aDestEnd,
|
||||
nsIUnicodeEncoder * aEncoder);
|
||||
|
||||
void PrintSpaces(int aCount);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Main method of the program.
|
||||
*/
|
||||
nsresult Main(int aArgC, char ** aArgV);
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Global functions and data [implementation]
|
||||
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
nsTestUConv testObj;
|
||||
nsresult res;
|
||||
|
||||
res = testObj.Main(argc, argv);
|
||||
return (NS_FAILED(res));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Class nsTestLog [implementation]
|
||||
|
||||
const char * nsTestLog::kTraceDelimiter = ".";
|
||||
|
||||
void nsTestLog::AddTrace(const char * aTrace)
|
||||
{
|
||||
mTrace.Append(aTrace);
|
||||
mTrace.Append(kTraceDelimiter);
|
||||
}
|
||||
|
||||
void nsTestLog::DelTrace(const char * aTrace)
|
||||
{
|
||||
mTrace.Truncate(mTrace.Length() - strlen(aTrace) - strlen(kTraceDelimiter));
|
||||
}
|
||||
|
||||
void nsTestLog::PrintError(const char * aCall, const int aError)
|
||||
{
|
||||
const char * trace = mTrace.get();
|
||||
printf("ERROR at %s%s code=0x%x.\n", trace, aCall, aError);
|
||||
}
|
||||
|
||||
void nsTestLog::PrintError(const char * aCall, const char * aMessage)
|
||||
{
|
||||
const char * trace = mTrace.get();
|
||||
printf("ERROR at %s%s reason: %s.\n", trace, aCall, aMessage);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Class nsTestUConv [implementation]
|
||||
|
||||
nsresult nsTestUConv::TestEncoders()
|
||||
{
|
||||
const char * trace = "TestEncoders";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager> ccMan =
|
||||
do_GetService(kCharsetConverterManagerCID, &res);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsIUTF8StringEnumerator> encoders;
|
||||
res = ccMan->GetEncoderList(getter_AddRefs(encoders));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
bool hasMore;
|
||||
encoders->HasMore(&hasMore);
|
||||
|
||||
nsAutoCString charset;
|
||||
while (hasMore) {
|
||||
encoders->GetNext(charset);
|
||||
|
||||
encoders->HasMore(&hasMore);
|
||||
}
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::TestDecoders()
|
||||
{
|
||||
const char * trace = "TestDecoders";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
// XXX write me
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::TestCharsetManager()
|
||||
{
|
||||
const char * trace = "TestCharsetManager";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
nsAutoString name;
|
||||
nsCOMPtr<nsIAtom> csAtom;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager> ccMan =
|
||||
do_GetService(kCharsetConverterManagerCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("NS_WITH_SERVICE", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::DisplayDetectors()
|
||||
{
|
||||
const char * trace = "DisplayDetectors";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager> ccMan =
|
||||
do_GetService(kCharsetConverterManagerCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("NS_WITH_SERVICE", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
// charset detectors
|
||||
nsCOMPtr<nsIUTF8StringEnumerator> detectors;
|
||||
|
||||
res = ccMan->GetCharsetDetectorList(getter_AddRefs(detectors));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetCharsetDetectorList()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
printf("***** Character Set Detectors *****\n");
|
||||
|
||||
bool hasMore;
|
||||
detectors->HasMore(&hasMore);
|
||||
while (hasMore) {
|
||||
nsAutoCString detectorName;
|
||||
res = detectors->GetNext(detectorName);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetNext()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
printf("%s", detectorName.get());
|
||||
PrintSpaces(36 - detectorName.Length()); // align to hard coded column number
|
||||
|
||||
nsAutoString title;
|
||||
res = ccMan->GetCharsetTitle(detectorName.get(), title);
|
||||
if (NS_FAILED(res)) title.SetLength(0);
|
||||
printf("\"%s\"\n", NS_LossyConvertUTF16toASCII(title).get());
|
||||
|
||||
detectors->HasMore(&hasMore);
|
||||
}
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::DisplayCharsets()
|
||||
{
|
||||
const char * trace = "DisplayCharsets";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager> ccMan =
|
||||
do_GetService(kCharsetConverterManagerCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("NS_WITH_SERVICE", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIUTF8StringEnumerator> decoders;
|
||||
nsCOMPtr<nsIUTF8StringEnumerator> encoders;
|
||||
|
||||
res = ccMan->GetDecoderList(getter_AddRefs(decoders));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetDecoderList()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = ccMan->GetEncoderList(getter_AddRefs(encoders));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetEncoderList()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
printf("***** Character Sets *****\n");
|
||||
|
||||
uint32_t encCount = 0, decCount = 0;
|
||||
uint32_t basicEncCount = 0, basicDecCount = 0;
|
||||
|
||||
nsTArray<nsCString> allCharsets;
|
||||
|
||||
nsAutoCString charset;
|
||||
bool hasMore;
|
||||
encoders->HasMore(&hasMore);
|
||||
while (hasMore) {
|
||||
res = encoders->GetNext(charset);
|
||||
if (NS_SUCCEEDED(res))
|
||||
allCharsets.AppendElement(charset);
|
||||
|
||||
encoders->HasMore(&hasMore);
|
||||
}
|
||||
|
||||
nsAutoString prop, str;
|
||||
uint32_t count = allCharsets.Length();
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
|
||||
const nsCString& charset = allCharsets[i];
|
||||
printf("%s", charset.get());
|
||||
PrintSpaces(24 - charset.Length()); // align to hard coded column number
|
||||
|
||||
|
||||
nsCOMPtr<nsIUnicodeDecoder> dec;
|
||||
res = ccMan->GetUnicodeDecoder(charset.get(), getter_AddRefs(dec));
|
||||
if (NS_FAILED(res)) printf (" ");
|
||||
else {
|
||||
printf("D");
|
||||
decCount++;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
// show the "basic" decoder classes
|
||||
if (dec) {
|
||||
nsCOMPtr<nsIBasicDecoder> isBasic = do_QueryInterface(dec);
|
||||
if (isBasic) {
|
||||
basicDecCount++;
|
||||
printf("b");
|
||||
}
|
||||
else printf(" ");
|
||||
}
|
||||
else printf(" ");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> enc;
|
||||
res = ccMan->GetUnicodeEncoder(charset.get(), getter_AddRefs(enc));
|
||||
if (NS_FAILED(res)) printf (" ");
|
||||
else {
|
||||
printf("E");
|
||||
encCount++;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (enc) {
|
||||
nsCOMPtr<nsIBasicEncoder> isBasic = do_QueryInterface(enc);
|
||||
if (isBasic) {
|
||||
basicEncCount++;
|
||||
printf("b");
|
||||
}
|
||||
else printf(" ");
|
||||
}
|
||||
else printf(" ");
|
||||
#endif
|
||||
|
||||
printf(" ");
|
||||
|
||||
prop.AssignLiteral(".notForBrowser");
|
||||
res = ccMan->GetCharsetData(charset.get(), prop.get(), str);
|
||||
if (dec && (NS_FAILED(res))) printf ("B");
|
||||
else printf("X");
|
||||
|
||||
prop.AssignLiteral(".notForComposer");
|
||||
res = ccMan->GetCharsetData(charset.get(), prop.get(), str);
|
||||
if (enc && (NS_FAILED(res))) printf ("C");
|
||||
else printf("X");
|
||||
|
||||
prop.AssignLiteral(".notForMailView");
|
||||
res = ccMan->GetCharsetData(charset.get(), prop.get(), str);
|
||||
if (dec && (NS_FAILED(res))) printf ("V");
|
||||
else printf("X");
|
||||
|
||||
prop.AssignLiteral(".notForMailEdit");
|
||||
res = ccMan->GetCharsetData(charset.get(), prop.get(), str);
|
||||
if (enc && (NS_FAILED(res))) printf ("E");
|
||||
else printf("X");
|
||||
|
||||
printf("(%3d, %3d) ", encCount, decCount);
|
||||
res = ccMan->GetCharsetTitle(charset.get(), str);
|
||||
if (NS_FAILED(res)) str.SetLength(0);
|
||||
NS_LossyConvertUTF16toASCII buff2(str);
|
||||
printf(" \"%s\"\n", buff2.get());
|
||||
}
|
||||
|
||||
printf("%u of %u decoders are basic (%d%%)\n",
|
||||
basicDecCount, decCount, (basicDecCount * 100) / decCount);
|
||||
|
||||
printf("%u of %u encoders are basic (%d%%)\n",
|
||||
basicEncCount, encCount, (basicEncCount * 100) / encCount);
|
||||
mLog.DelTrace(trace);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::TestTempBug()
|
||||
{
|
||||
const char * trace = "TestTempBug";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
NS_NAMED_LITERAL_CSTRING(charset, "ISO-2022-JP");
|
||||
char16_t src[] = {0x0043, 0x004e, 0x0045, 0x0054, 0x0020, 0x004A, 0x0061,
|
||||
0x0070, 0x0061, 0x006E, 0x0020, 0x7DE8, 0x96C6, 0x5C40};
|
||||
char16_t * srcEnd = src + ARRAY_SIZE(src);
|
||||
char dest[BIG_BUFFER_SIZE];
|
||||
char * destEnd = dest + BIG_BUFFER_SIZE;
|
||||
|
||||
char16_t * p = src;
|
||||
char * q = dest;
|
||||
res = Encode(&p, srcEnd, &q, destEnd, charset);
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::Encode(char16_t ** aSrc, char16_t * aSrcEnd,
|
||||
char ** aDest, char * aDestEnd,
|
||||
const nsAFlatCString& aCharset)
|
||||
{
|
||||
const char * trace = "Encode";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager> ccMan =
|
||||
do_GetService(kCharsetConverterManagerCID, &res);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("NS_WITH_SERVICE", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIUnicodeEncoder> enc;
|
||||
res = ccMan->GetUnicodeEncoder(aCharset.get(), getter_AddRefs(enc));
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("GetUnicodeEncoder()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = ConvertEncode(aSrc, aSrcEnd, aDest, aDestEnd, enc);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("Convert()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = FinishEncode(aDest, aDestEnd, enc);
|
||||
if (NS_FAILED(res)) {
|
||||
mLog.PrintError("Finish()", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::ConvertEncode(char16_t ** aSrc, char16_t * aSrcEnd,
|
||||
char ** aDest, char * aDestEnd,
|
||||
nsIUnicodeEncoder * aEncoder)
|
||||
{
|
||||
char16_t * src = (*aSrc);
|
||||
char * dest = (*aDest);
|
||||
int32_t srcLen = aSrcEnd - src;
|
||||
int32_t destLen = aDestEnd - dest;
|
||||
|
||||
nsresult res = aEncoder->Convert(src, &srcLen, dest, &destLen);
|
||||
|
||||
(*aSrc) = src + srcLen;
|
||||
(*aDest) = dest + destLen;
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::FinishEncode(char ** aDest, char * aDestEnd,
|
||||
nsIUnicodeEncoder * aEncoder)
|
||||
{
|
||||
char * dest = (*aDest);
|
||||
int32_t destLen = aDestEnd - dest;
|
||||
|
||||
nsresult res = aEncoder->Finish(dest, &destLen);
|
||||
|
||||
(*aDest) = dest + destLen;
|
||||
return res;
|
||||
}
|
||||
|
||||
void nsTestUConv::PrintSpaces(int aCount)
|
||||
{
|
||||
for (int i = 0; i < aCount; i++) printf(" ");
|
||||
}
|
||||
|
||||
nsresult nsTestUConv::Main(int aArgC, char ** aArgV)
|
||||
{
|
||||
const char * trace = "Main";
|
||||
mLog.AddTrace(trace);
|
||||
nsresult res = NS_OK;
|
||||
|
||||
if (aArgC < 2) {
|
||||
// no arguments were passed to the program, so we just run the self tests
|
||||
res = TestCharsetManager();
|
||||
if (NS_SUCCEEDED(res)) res = TestEncoders();
|
||||
if (NS_SUCCEEDED(res)) res = TestDecoders();
|
||||
} else if (!strcmp(aArgV[1], "-tempbug")) {
|
||||
// we are testing a temporary bug
|
||||
res = TestTempBug();
|
||||
} else if (!strcmp(aArgV[1], "-display")) {
|
||||
// display all the available data
|
||||
res = DisplayDetectors();
|
||||
if (NS_SUCCEEDED(res)) res = DisplayCharsets();
|
||||
}
|
||||
|
||||
mLog.DelTrace(trace);
|
||||
return res;
|
||||
}
|
@ -1,172 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include <windows.h>
|
||||
#include <winnls.h>
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
void usage()
|
||||
{
|
||||
printf(
|
||||
"convperf -f fromcode -t tocode [file]\n"
|
||||
);
|
||||
}
|
||||
int fromcodeind = 0;
|
||||
int tocodeind = 0;
|
||||
FILE* infile = 0;
|
||||
#define INBUFSIZE (1024*16)
|
||||
#define MEDBUFSIZE (1024*16*2)
|
||||
#define OUTBUFSIZE (1024*16*8)
|
||||
char inbuffer[INBUFSIZE];
|
||||
char outbuffer[OUTBUFSIZE];
|
||||
char16_t medbuffer[MEDBUFSIZE];
|
||||
nsIUnicodeEncoder* encoder = nullptr;
|
||||
nsIUnicodeDecoder* decoder = nullptr;
|
||||
UINT incp = 932;
|
||||
UINT outcp = 932;
|
||||
|
||||
void memcpyDecode(const char* src, int32_t srclen, char* dest)
|
||||
{
|
||||
::memcpy(dest, src, srclen);
|
||||
}
|
||||
void memcpyEncode(const char* src, int32_t srclen, char* dest)
|
||||
{
|
||||
::memcpy(dest, src, srclen);
|
||||
}
|
||||
|
||||
void WideDecode(const char* src,
|
||||
int32_t srclen, char16_t *dest, int32_t *destLen)
|
||||
{
|
||||
const char* end = src+srclen ;
|
||||
while(src < end)
|
||||
*dest++ = (char16_t) *src++;
|
||||
*destLen = srclen;
|
||||
}
|
||||
void NarrowEncode(const char16_t *src,
|
||||
int32_t srclen, char* dest, int32_t* destLen)
|
||||
{
|
||||
const char16_t* end = src+srclen ;
|
||||
while(src < end)
|
||||
*dest++ = (char) *src++;
|
||||
*destLen = srclen;
|
||||
}
|
||||
void msDecode(UINT cp, const char* src,
|
||||
int32_t srclen, char16_t *dest, int32_t *destLen)
|
||||
{
|
||||
*destLen = ::MultiByteToWideChar(cp, 0,src, srclen, (LPWSTR)dest, *destLen);
|
||||
if(*destLen <= 0)
|
||||
fprintf(stderr, "problem in ::MultiByteToWideChar\n");
|
||||
}
|
||||
void msEncode(UINT cp, const char16_t *src,
|
||||
int32_t srcLen, char* dest, int32_t* destLen)
|
||||
{
|
||||
*destLen = ::WideCharToMultiByte(cp, 0, src, srcLen, (LPSTR)dest, *destLen,
|
||||
(LPCSTR)" ", FALSE);
|
||||
if(*destLen <= 0)
|
||||
fprintf(stderr, "problem in ::WideCharToMultiByte\n");
|
||||
}
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
nsresult res;
|
||||
nsCOMPtr<nsICharsetConverterManager> ccMain =
|
||||
do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &res);
|
||||
if(NS_FAILED(res))
|
||||
{
|
||||
fprintf(stderr, "Cannot get Character Converter Manager %x\n", res);
|
||||
}
|
||||
int i;
|
||||
if(argc > 5)
|
||||
{
|
||||
for(i =0; i < argc; i++)
|
||||
{
|
||||
if(strcmp(argv[i], "-f") == 0)
|
||||
{
|
||||
tocodeind = i+1;
|
||||
res = ccMain->GetUnicodeDecoder(argv[tocodeind], &decoder);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "Cannot get Unicode decoder %s %x\n",
|
||||
argv[tocodeind],res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
if(strcmp(argv[i], "-t") == 0)
|
||||
{
|
||||
fromcodeind = i+1;
|
||||
res = ccMain->GetUnicodeEncoderRaw(argv[fromcodeind], &encoder);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "Cannot get Unicode encoder %s %x\n",
|
||||
argv[fromcodeind],res);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(argc == 6)
|
||||
{
|
||||
infile = fopen(argv[5], "rb");
|
||||
if (!infile)
|
||||
{
|
||||
usage();
|
||||
fprintf(stderr,"cannot open file %s\n", argv[5]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
infile = stdin;
|
||||
}
|
||||
|
||||
int32_t insize,medsize,outsize;
|
||||
while((insize=fread(inbuffer, 1,INBUFSIZE,infile)) > 0)
|
||||
{
|
||||
medsize=MEDBUFSIZE;
|
||||
|
||||
res = decoder->Convert(inbuffer,&insize, medbuffer, &medsize);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "failed in decoder->Convert %x\n",res);
|
||||
return -1;
|
||||
}
|
||||
outsize = OUTBUFSIZE;
|
||||
res = encoder->Convert(medbuffer, &medsize, outbuffer,&outsize);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "failed in encoder->Convert %x\n",res);
|
||||
return -1;
|
||||
}
|
||||
fwrite(outbuffer, 1, outsize, stdout);
|
||||
|
||||
memcpyDecode(inbuffer, insize, outbuffer);
|
||||
|
||||
memcpyEncode(inbuffer, insize, outbuffer);
|
||||
|
||||
medsize = MEDBUFSIZE;
|
||||
msDecode(incp, inbuffer, insize, medbuffer, &medsize);
|
||||
|
||||
outsize = OUTBUFSIZE;
|
||||
msEncode(outcp, medbuffer, medsize, outbuffer, &outsize);
|
||||
|
||||
medsize = MEDBUFSIZE;
|
||||
WideDecode( inbuffer, insize, medbuffer, &medsize);
|
||||
|
||||
outsize = OUTBUFSIZE;
|
||||
NarrowEncode( medbuffer, medsize, outbuffer, &outsize);
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
fclose(stdout);
|
||||
fprintf(stderr, "Done!\n");
|
||||
return 0;
|
||||
}
|
||||
usage();
|
||||
return -1;
|
||||
}
|
@ -1,985 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIPlatformCharset.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
static NS_DEFINE_CID(kPlatformCharsetCID, NS_PLATFORMCHARSET_CID);
|
||||
|
||||
/**
|
||||
* Test program for the Unicode Converters.
|
||||
*
|
||||
* Error messages format inside of a test.
|
||||
*
|
||||
* - silent while all is OK.
|
||||
*
|
||||
* - "ERROR at T001.easyConversion.Convert() code=0xfffd.\n"
|
||||
* - "ERROR at T001.easyConversion.ConvResLen expected=0x02 result=0x04.\n"
|
||||
*
|
||||
* - "Test Passed.\n" for a successful end.
|
||||
*
|
||||
* @created 01/Dec/1998
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global variables and macros
|
||||
|
||||
#define GENERAL_BUFFER 20000 // general purpose buffer; for Unicode divide by 2
|
||||
|
||||
#define ARRAY_SIZE(_array) \
|
||||
(sizeof(_array) / sizeof(_array[0]))
|
||||
|
||||
nsICharsetConverterManager * ccMan = nullptr;
|
||||
|
||||
/**
|
||||
* Test data for Latin1 charset.
|
||||
*/
|
||||
|
||||
char bLatin1_d0[] = {
|
||||
"\x00\x0d\x7f\x80\xff"
|
||||
};
|
||||
|
||||
char16_t cLatin1_d0[] = {
|
||||
0x0000,0x000d,0x007f,0x20ac,0x00ff
|
||||
};
|
||||
|
||||
int32_t bLatin1_s0 = ARRAY_SIZE(bLatin1_d0)-1;
|
||||
int32_t cLatin1_s0 = ARRAY_SIZE(cLatin1_d0);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Converter Manager test code
|
||||
|
||||
nsresult testCharsetConverterManager()
|
||||
{
|
||||
printf("\n[T001] CharsetConverterManager\n");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Helper functions and macros for testing decoders and encoders
|
||||
|
||||
#define CREATE_DECODER(_charset) \
|
||||
nsIUnicodeDecoder * dec; \
|
||||
nsAutoString str;str.AssignASCII(_charset); \
|
||||
nsresult res = ccMan->GetUnicodeDecoder(&str,&dec); \
|
||||
if (NS_FAILED(res)) { \
|
||||
printf("ERROR at GetUnicodeDecoder() code=0x%x.\n",res); \
|
||||
return res; \
|
||||
}
|
||||
|
||||
#define CREATE_ENCODER(_charset) \
|
||||
nsIUnicodeEncoder * enc; \
|
||||
nsAutoString str; str.AssignASCII(_charset); \
|
||||
nsresult res = ccMan->GetUnicodeEncoder(&str,&enc); \
|
||||
if (NS_FAILED(res)) { \
|
||||
printf("ERROR at GetUnicodeEncoder() code=0x%x.\n",res); \
|
||||
return res; \
|
||||
}
|
||||
|
||||
/**
|
||||
* Decoder test.
|
||||
*
|
||||
* This method will test the conversion only.
|
||||
*/
|
||||
nsresult testDecoder(nsIUnicodeDecoder * aDec,
|
||||
const char * aSrc, int32_t aSrcLength,
|
||||
const char16_t * aRes, int32_t aResLength,
|
||||
const char * aTestName)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
// prepare for conversion
|
||||
int32_t srcLen = aSrcLength;
|
||||
char16_t dest[GENERAL_BUFFER/2];
|
||||
int32_t destLen = GENERAL_BUFFER/2;
|
||||
|
||||
// conversion
|
||||
res = aDec->Convert(aSrc, &srcLen, dest, &destLen);
|
||||
// we want a perfect result here - the test data should be complete!
|
||||
if (res != NS_OK) {
|
||||
printf("ERROR at %s.easy.Decode() code=0x%x.\n",aTestName,res);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// compare results
|
||||
if (aResLength != destLen) {
|
||||
printf("ERROR at %s.easy.DecResLen expected=0x%x result=0x%x.\n",
|
||||
aTestName, aResLength, destLen);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
for (int32_t i=0; i<aResLength; i++) if (aRes[i] != dest[i]) {
|
||||
printf("ERROR at %s.easy.DecResChar[%d] expected=0x%x result=0x%x.\n",
|
||||
aTestName, i, aRes[i], dest[i]);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encoder test.
|
||||
*
|
||||
* This method will test the conversion only.
|
||||
*/
|
||||
nsresult testEncoder(nsIUnicodeEncoder * aEnc,
|
||||
const char16_t * aSrc, int32_t aSrcLength,
|
||||
const char * aRes, int32_t aResLength,
|
||||
const char * aTestName)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
// prepare for conversion
|
||||
int32_t srcLen = 0;
|
||||
char dest[GENERAL_BUFFER];
|
||||
int32_t destLen = 0;
|
||||
int32_t bcr, bcw;
|
||||
|
||||
// conversion
|
||||
bcr = aSrcLength;
|
||||
bcw = GENERAL_BUFFER;
|
||||
res = aEnc->Convert(aSrc, &bcr, dest, &bcw);
|
||||
srcLen += bcr;
|
||||
destLen += bcw;
|
||||
// we want a perfect result here - the test data should be complete!
|
||||
if (res != NS_OK) {
|
||||
printf("ERROR at %s.easy.Encode() code=0x%x.\n",aTestName,res);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// finish
|
||||
bcw = GENERAL_BUFFER - destLen;
|
||||
res = aEnc->Finish(dest + destLen, &bcw);
|
||||
destLen += bcw;
|
||||
// we want a perfect result here - the test data should be complete!
|
||||
if (res != NS_OK) {
|
||||
printf("ERROR at %s.easy.Finish() code=0x%x.\n",aTestName,res);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// compare results
|
||||
if (aResLength != destLen) {
|
||||
printf("ERROR at %s.easy.EncResLen expected=0x%x result=0x%x.\n",
|
||||
aTestName, aResLength, destLen);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
for (int32_t i=0; i<aResLength; i++) if (aRes[i] != dest[i]) {
|
||||
printf("ERROR at %s.easy.EncResChar[%d] expected=0x%x result=0x%x.\n",
|
||||
aTestName, i, aRes[i], dest[i]);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decoder test.
|
||||
*
|
||||
* This method will test a given converter under a given set of data and some
|
||||
* very stressful conditions.
|
||||
*/
|
||||
nsresult testStressDecoder(nsIUnicodeDecoder * aDec,
|
||||
const char * aSrc, int32_t aSrcLength,
|
||||
const char16_t * aRes, int32_t aResLength,
|
||||
const char * aTestName)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
// get estimated length
|
||||
int32_t estimatedLength;
|
||||
res = aDec->GetMaxLength(aSrc, aSrcLength, &estimatedLength);
|
||||
if (NS_FAILED(res)) {
|
||||
printf("ERROR at %s.stress.Length() code=0x%x.\n",aTestName,res);
|
||||
return res;
|
||||
}
|
||||
bool exactLength = (res == NS_EXACT_LENGTH);
|
||||
|
||||
// prepare for conversion
|
||||
int32_t srcLen = 0;
|
||||
int32_t srcOff = 0;
|
||||
char16_t dest[1024];
|
||||
int32_t destLen = 0;
|
||||
int32_t destOff = 0;
|
||||
|
||||
// controlled conversion
|
||||
for (;srcOff < aSrcLength;) {
|
||||
res = aDec->Convert(aSrc + srcOff, &srcLen, dest + destOff, &destLen);
|
||||
if (NS_FAILED(res)) {
|
||||
printf("ERROR at %s.stress.Convert() code=0x%x.\n",aTestName,res);
|
||||
return res;
|
||||
}
|
||||
|
||||
srcOff+=srcLen;
|
||||
destOff+=destLen;
|
||||
|
||||
// give a little input each time; it'll be consumed if enough output space
|
||||
srcLen = 1;
|
||||
// give output space only when requested: sadic!
|
||||
if (res == NS_PARTIAL_MORE_OUTPUT) {
|
||||
destLen = 1;
|
||||
} else {
|
||||
destLen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// we want perfect result here - the test data should be complete!
|
||||
if (res != NS_OK) {
|
||||
printf("ERROR at %s.stress.postConvert() code=0x%x.\n",aTestName,res);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
// compare lengths
|
||||
if (exactLength) {
|
||||
if (destOff != estimatedLength) {
|
||||
printf("ERROR at %s.stress.EstimatedLen expected=0x%x result=0x%x.\n",
|
||||
aTestName, estimatedLength, destOff);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
} else {
|
||||
if (destOff > estimatedLength) {
|
||||
printf("ERROR at %s.stress.EstimatedLen expected<=0x%x result=0x%x.\n",
|
||||
aTestName, estimatedLength, destOff);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
||||
// compare results
|
||||
if (aResLength != destOff) {
|
||||
printf("ERROR at %s.stress.ConvResLen expected=0x%x result=0x%x.\n",
|
||||
aTestName, aResLength, destOff);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
for (int32_t i=0; i<aResLength; i++) if (aRes[i] != dest[i]) {
|
||||
printf("ERROR at %s.stress.ConvResChar[%d] expected=0x%x result=0x%x.\n",
|
||||
aTestName, i, aRes[i], dest[i]);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encoder test.
|
||||
*
|
||||
* This method will test a given converter under a given set of data and some
|
||||
* very stressful conditions.
|
||||
*/
|
||||
nsresult testStressEncoder(nsIUnicodeEncoder * aEnc,
|
||||
const char16_t * aSrc, int32_t aSrcLength,
|
||||
const char * aRes, int32_t aResLength,
|
||||
const char * aTestName)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
// get estimated length
|
||||
int32_t estimatedLength;
|
||||
res = aEnc->GetMaxLength(aSrc, aSrcLength, &estimatedLength);
|
||||
if (NS_FAILED(res)) {
|
||||
printf("ERROR at %s.stress.Length() code=0x%x.\n",aTestName,res);
|
||||
return res;
|
||||
}
|
||||
bool exactLength = (res == NS_OK_UENC_EXACTLENGTH);
|
||||
|
||||
// prepare for conversion
|
||||
int32_t srcLen = 0;
|
||||
int32_t srcOff = 0;
|
||||
char dest[GENERAL_BUFFER];
|
||||
int32_t destLen = 0;
|
||||
int32_t destOff = 0;
|
||||
|
||||
// controlled conversion
|
||||
for (;srcOff < aSrcLength;) {
|
||||
res = aEnc->Convert(aSrc + srcOff, &srcLen, dest + destOff, &destLen);
|
||||
if (NS_FAILED(res)) {
|
||||
printf("ERROR at %s.stress.Convert() code=0x%x.\n",aTestName,res);
|
||||
return res;
|
||||
}
|
||||
|
||||
srcOff+=srcLen;
|
||||
destOff+=destLen;
|
||||
|
||||
// give a little input each time; it'll be consumed if enough output space
|
||||
srcLen = 1;
|
||||
// give output space only when requested: sadic!
|
||||
if (res == NS_OK_UENC_MOREOUTPUT) {
|
||||
destLen = 1;
|
||||
} else {
|
||||
destLen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (res != NS_OK) if (res != NS_OK_UENC_MOREOUTPUT) {
|
||||
printf("ERROR at %s.stress.postConvert() code=0x%x.\n",aTestName,res);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
res = aEnc->Finish(dest + destOff, &destLen);
|
||||
if (NS_FAILED(res)) {
|
||||
printf("ERROR at %s.stress.Finish() code=0x%x.\n",aTestName,res);
|
||||
return res;
|
||||
}
|
||||
|
||||
destOff+=destLen;
|
||||
|
||||
// give output space only when requested: sadic!
|
||||
if (res == NS_OK_UENC_MOREOUTPUT) {
|
||||
destLen = 1;
|
||||
} else break;
|
||||
}
|
||||
|
||||
// compare lengths
|
||||
if (exactLength) {
|
||||
if (destOff != estimatedLength) {
|
||||
printf("ERROR at %s.stress.EstimatedLen expected=0x%x result=0x%x.\n",
|
||||
aTestName, estimatedLength, destOff);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
} else {
|
||||
if (destOff > estimatedLength) {
|
||||
printf("ERROR at %s.stress.EstimatedLen expected<=0x%x result=0x%x.\n",
|
||||
aTestName, estimatedLength, destOff);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
||||
// compare results
|
||||
if (aResLength != destOff) {
|
||||
printf("ERROR at %s.stress.ConvResLen expected=0x%x result=0x%x.\n",
|
||||
aTestName, aResLength, destOff);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
for (int32_t i=0; i<aResLength; i++) if (aRes[i] != dest[i]) {
|
||||
printf("ERROR at %s.stress.ConvResChar[%d] expected=0x%x result=0x%x.\n",
|
||||
aTestName, i, aRes[i], dest[i]);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset decoder.
|
||||
*/
|
||||
nsresult resetDecoder(nsIUnicodeDecoder * aDec, const char * aTestName)
|
||||
{
|
||||
nsresult res = aDec->Reset();
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
printf("ERROR at %s.dec.Reset() code=0x%x.\n",aTestName,res);
|
||||
return res;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset encoder.
|
||||
*/
|
||||
nsresult resetEncoder(nsIUnicodeEncoder * aEnc, const char * aTestName)
|
||||
{
|
||||
nsresult res = aEnc->Reset();
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
printf("ERROR at %s.enc.Reset() code=0x%x.\n",aTestName,res);
|
||||
return res;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* A standard decoder test.
|
||||
*/
|
||||
nsresult standardDecoderTest(char * aTestName, char * aCharset, char * aSrc,
|
||||
int32_t aSrcLen, char16_t * aRes, int32_t aResLen)
|
||||
{
|
||||
printf("\n[%s] Unicode <- %s\n", aTestName, aCharset);
|
||||
|
||||
// create converter
|
||||
CREATE_DECODER(aCharset);
|
||||
|
||||
// test converter - easy test
|
||||
res = testDecoder(dec, aSrc, aSrcLen, aRes, aResLen, aTestName);
|
||||
|
||||
// reset converter
|
||||
if (NS_SUCCEEDED(res)) res = resetDecoder(dec, aTestName);
|
||||
|
||||
// test converter - stress test
|
||||
if (NS_SUCCEEDED(res))
|
||||
res = testStressDecoder(dec, aSrc, aSrcLen, aRes, aResLen, aTestName);
|
||||
|
||||
// release converter
|
||||
NS_RELEASE(dec);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
} else {
|
||||
printf("Test Passed.\n");
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult loadBinaryFile(char * aFile, char * aBuff, int32_t * aBuffLen)
|
||||
{
|
||||
FILE * f = fopen(aFile, "rb");
|
||||
if (!f) {
|
||||
printf("ERROR at opening file: \"%s\".\n", aFile);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
int32_t n = fread(aBuff, 1, *aBuffLen, f);
|
||||
if (n >= *aBuffLen) {
|
||||
printf("ERROR at reading from file \"%s\": too much input data.\n", aFile);
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
*aBuffLen = n;
|
||||
fclose(f);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult loadUnicodeFile(char * aFile, char16_t * aBuff, int32_t * aBuffLen)
|
||||
{
|
||||
int32_t buffLen = 2*(*aBuffLen);
|
||||
|
||||
nsresult res = loadBinaryFile(aFile, (char *)aBuff, &buffLen);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
*aBuffLen = buffLen/2;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult testDecoderFromFiles(char * aCharset, char * aSrcFile, char * aResultFile)
|
||||
{
|
||||
// create converter
|
||||
CREATE_DECODER(aCharset);
|
||||
|
||||
int32_t srcLen = GENERAL_BUFFER;
|
||||
char src[GENERAL_BUFFER];
|
||||
int32_t expLen = GENERAL_BUFFER/2;
|
||||
char16_t exp[GENERAL_BUFFER/2];
|
||||
|
||||
res = loadBinaryFile(aSrcFile, src, &srcLen);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = loadUnicodeFile(aResultFile, exp, &expLen);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// test converter - easy test
|
||||
res = testDecoder(dec, src, srcLen, exp, expLen, "dec");
|
||||
|
||||
// release converter
|
||||
NS_RELEASE(dec);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
} else {
|
||||
printf("Test Passed.\n");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult testEncoderFromFiles(char * aCharset, char * aSrcFile, char * aResultFile)
|
||||
{
|
||||
// XXX write me
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Decoders testing functions
|
||||
|
||||
/**
|
||||
* Test the ISO2022JP decoder.
|
||||
*/
|
||||
nsresult testISO2022JPDecoder()
|
||||
{
|
||||
char * testName = "T102";
|
||||
printf("\n[%s] Unicode <- ISO2022JP\n", testName);
|
||||
|
||||
// create converter
|
||||
CREATE_DECODER("iso-2022-jp");
|
||||
|
||||
// test data
|
||||
char src[] = {"\x0d\x7f\xdd" "\x1b(J\xaa\xdc\x41" "\x1b$B\x21\x21" "\x1b$@\x32\x37" "\x1b(J\x1b(B\xcc"};
|
||||
char16_t exp[] = {0x000d,0x007f,0xfffd, 0xff6a,0xFF9C,0x0041, 0x3000, 0x5378, 0xfffd};
|
||||
|
||||
// test converter - normal operation
|
||||
res = testDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName);
|
||||
|
||||
// reset converter
|
||||
if (NS_SUCCEEDED(res)) res = resetDecoder(dec, testName);
|
||||
|
||||
// test converter - stress test
|
||||
if (NS_SUCCEEDED(res))
|
||||
res = testStressDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName);
|
||||
|
||||
// release converter
|
||||
NS_RELEASE(dec);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
} else {
|
||||
printf("Test Passed.\n");
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the EUCJP decoder.
|
||||
*/
|
||||
nsresult testEUCJPDecoder()
|
||||
{
|
||||
char * testName = "T103";
|
||||
printf("\n[%s] Unicode <- EUCJP\n", testName);
|
||||
|
||||
// create converter
|
||||
CREATE_DECODER("euc-jp");
|
||||
|
||||
// test data
|
||||
char src[] = {"\x45"};
|
||||
char16_t exp[] = {0x0045};
|
||||
|
||||
// test converter - normal operation
|
||||
res = testDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName);
|
||||
|
||||
// reset converter
|
||||
if (NS_SUCCEEDED(res)) res = resetDecoder(dec, testName);
|
||||
|
||||
// test converter - stress test
|
||||
if (NS_SUCCEEDED(res))
|
||||
res = testStressDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName);
|
||||
|
||||
// release converter
|
||||
NS_RELEASE(dec);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
} else {
|
||||
printf("Test Passed.\n");
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the ISO88597 decoder.
|
||||
*/
|
||||
nsresult testISO88597Decoder()
|
||||
{
|
||||
char * testName = "T104";
|
||||
printf("\n[%s] Unicode <- ISO88597\n", testName);
|
||||
|
||||
// create converter
|
||||
CREATE_DECODER("iso-8859-7");
|
||||
|
||||
// test data
|
||||
char src[] = {
|
||||
"\x09\x0d\x20\x40"
|
||||
"\x80\x98\xa3\xaf"
|
||||
"\xa7\xb1\xb3\xc9"
|
||||
"\xd9\xe3\xf4\xff"
|
||||
};
|
||||
char16_t exp[] = {
|
||||
0x0009, 0x000d, 0x0020, 0x0040,
|
||||
0xfffd, 0xfffd, 0x00a3, 0x2015,
|
||||
0x00a7, 0x00b1, 0x00b3, 0x0399,
|
||||
0x03a9, 0x03b3, 0x03c4, 0xfffd
|
||||
};
|
||||
|
||||
// test converter - normal operation
|
||||
res = testDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName);
|
||||
|
||||
// reset converter
|
||||
if (NS_SUCCEEDED(res)) res = resetDecoder(dec, testName);
|
||||
|
||||
// test converter - stress test
|
||||
if (NS_SUCCEEDED(res))
|
||||
res = testStressDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName);
|
||||
|
||||
// release converter
|
||||
NS_RELEASE(dec);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
} else {
|
||||
printf("Test Passed.\n");
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the SJIS decoder.
|
||||
*/
|
||||
nsresult testSJISDecoder()
|
||||
{
|
||||
char * testName = "T105";
|
||||
printf("\n[%s] Unicode <- SJIS\n", testName);
|
||||
|
||||
// create converter
|
||||
CREATE_DECODER("Shift_JIS");
|
||||
|
||||
// test data
|
||||
char src[] = {
|
||||
"Japanese" /* English */
|
||||
"\x8a\xbf\x8e\x9a" /* Kanji */
|
||||
"\x83\x4a\x83\x5e\x83\x4a\x83\x69" /* Kantakana */
|
||||
"\x82\xd0\x82\xe7\x82\xaa\x82\xc8" /* Hiragana */
|
||||
"\x82\x50\x82\x51\x82\x52\x82\x60\x82\x61\x82\x62" /* full width 123ABC */
|
||||
};
|
||||
char16_t exp[] = {
|
||||
0x004A, 0x0061, 0x0070, 0x0061, 0x006E, 0x0065, 0x0073, 0x0065,
|
||||
0x6f22, 0x5b57,
|
||||
0x30ab, 0x30bf, 0x30ab, 0x30ca,
|
||||
0x3072, 0x3089, 0x304c, 0x306a,
|
||||
0xff11, 0xff12, 0xff13, 0xff21, 0xff22, 0xff23
|
||||
};
|
||||
|
||||
// test converter - normal operation
|
||||
res = testDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName);
|
||||
|
||||
// reset converter
|
||||
if (NS_SUCCEEDED(res)) res = resetDecoder(dec, testName);
|
||||
|
||||
// test converter - stress test
|
||||
if (NS_SUCCEEDED(res))
|
||||
res = testStressDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName);
|
||||
|
||||
// release converter
|
||||
NS_RELEASE(dec);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
} else {
|
||||
printf("Test Passed.\n");
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the UTF8 decoder.
|
||||
*/
|
||||
nsresult testUTF8Decoder()
|
||||
{
|
||||
char * testName = "T106";
|
||||
printf("\n[%s] Unicode <- UTF8\n", testName);
|
||||
|
||||
// create converter
|
||||
CREATE_DECODER("utf-8");
|
||||
|
||||
#ifdef NOPE // XXX decomment this when I have test data
|
||||
// test data
|
||||
char src[] = {};
|
||||
char16_t exp[] = {};
|
||||
|
||||
// test converter - normal operation
|
||||
res = testDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName);
|
||||
|
||||
// reset converter
|
||||
if (NS_SUCCEEDED(res)) res = resetDecoder(dec, testName);
|
||||
|
||||
// test converter - stress test
|
||||
if (NS_SUCCEEDED(res))
|
||||
res = testStressDecoder(dec, src, ARRAY_SIZE(src)-1, exp, ARRAY_SIZE(exp), testName);
|
||||
#endif
|
||||
|
||||
// release converter
|
||||
NS_RELEASE(dec);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
} else {
|
||||
printf("Test Passed.\n");
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Encoders testing functions
|
||||
|
||||
/**
|
||||
* Test the Latin1 encoder.
|
||||
*/
|
||||
nsresult testLatin1Encoder()
|
||||
{
|
||||
char * testName = "T201";
|
||||
printf("\n[%s] Unicode -> Latin1\n", testName);
|
||||
|
||||
// create converter
|
||||
CREATE_ENCODER("iso-8859-1");
|
||||
enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc);
|
||||
|
||||
// test data
|
||||
char16_t src[] = {0x0001,0x0002,0xffff,0x00e3};
|
||||
char exp[] = {"\x01\x02\xcc\xe3"};
|
||||
|
||||
// test converter - easy test
|
||||
res = testEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName);
|
||||
|
||||
// reset converter
|
||||
if (NS_SUCCEEDED(res)) res = resetEncoder(enc, testName);
|
||||
|
||||
// test converter - stress test
|
||||
if (NS_SUCCEEDED(res))
|
||||
res = testStressEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName);
|
||||
|
||||
// release converter
|
||||
NS_RELEASE(enc);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
} else {
|
||||
printf("Test Passed.\n");
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the Shift-JIS encoder.
|
||||
*/
|
||||
nsresult testSJISEncoder()
|
||||
{
|
||||
char * testName = "T202";
|
||||
printf("\n[%s] Unicode -> SJIS\n", testName);
|
||||
|
||||
// create converter
|
||||
CREATE_ENCODER("Shift_JIS");
|
||||
enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc);
|
||||
|
||||
// test data
|
||||
char16_t src[] = {
|
||||
0x004A, 0x0061, 0x0070, 0x0061, 0x006E, 0x0065, 0x0073, 0x0065,
|
||||
0x6f22, 0x5b57,
|
||||
0x30ab, 0x30bf, 0x30ab, 0x30ca,
|
||||
0x3072, 0x3089, 0x304c, 0x306a,
|
||||
0xff11, 0xff12, 0xff13, 0xff21, 0xff22, 0xff23
|
||||
};
|
||||
char exp[] = {
|
||||
"Japanese" /* English */
|
||||
"\x8a\xbf\x8e\x9a" /* Kanji */
|
||||
"\x83\x4a\x83\x5e\x83\x4a\x83\x69" /* Kantakana */
|
||||
"\x82\xd0\x82\xe7\x82\xaa\x82\xc8" /* Hiragana */
|
||||
"\x82\x50\x82\x51\x82\x52\x82\x60\x82\x61\x82\x62" /* full width 123ABC */
|
||||
};
|
||||
|
||||
// test converter - easy test
|
||||
res = testEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName);
|
||||
|
||||
// reset converter
|
||||
if (NS_SUCCEEDED(res)) res = resetEncoder(enc, testName);
|
||||
|
||||
// test converter - stress test
|
||||
if (NS_SUCCEEDED(res))
|
||||
res = testStressEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName);
|
||||
|
||||
// release converter
|
||||
NS_RELEASE(enc);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
} else {
|
||||
printf("Test Passed.\n");
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the EUC-JP encoder.
|
||||
*/
|
||||
nsresult testEUCJPEncoder()
|
||||
{
|
||||
char * testName = "T203";
|
||||
printf("\n[%s] Unicode -> EUCJP\n", testName);
|
||||
|
||||
// create converter
|
||||
CREATE_ENCODER("euc-jp");
|
||||
enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc);
|
||||
|
||||
// test data
|
||||
char16_t src[] = {0x0045, 0x0054};
|
||||
char exp[] = {"\x45\x54"};
|
||||
|
||||
// test converter - easy test
|
||||
res = testEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName);
|
||||
|
||||
// reset converter
|
||||
if (NS_SUCCEEDED(res)) res = resetEncoder(enc, testName);
|
||||
|
||||
// test converter - stress test
|
||||
if (NS_SUCCEEDED(res))
|
||||
res = testStressEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName);
|
||||
|
||||
// release converter
|
||||
NS_RELEASE(enc);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
} else {
|
||||
printf("Test Passed.\n");
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the ISO-2022-JP encoder.
|
||||
*/
|
||||
nsresult testISO2022JPEncoder()
|
||||
{
|
||||
char * testName = "T204";
|
||||
printf("\n[%s] Unicode -> ISO2022JP\n", testName);
|
||||
|
||||
// create converter
|
||||
CREATE_ENCODER("iso-2022-jp");
|
||||
enc->SetOutputErrorBehavior(enc->kOnError_Replace, nullptr, 0x00cc);
|
||||
|
||||
// test data
|
||||
char16_t src[] = {0x000d,0x007f, 0xff6a,0xFF9C, 0x3000, 0x5378};
|
||||
char exp[] = {"\x0d\x7f" "\x1b(J\xaa\xdc" "\x1b$@\x21\x21\x32\x37\x1b(B"};
|
||||
|
||||
// test converter - easy test
|
||||
res = testEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName);
|
||||
|
||||
// reset converter
|
||||
if (NS_SUCCEEDED(res)) res = resetEncoder(enc, testName);
|
||||
|
||||
// test converter - stress test
|
||||
if (NS_SUCCEEDED(res))
|
||||
res = testStressEncoder(enc, src, ARRAY_SIZE(src), exp, ARRAY_SIZE(exp)-1, testName);
|
||||
|
||||
// release converter
|
||||
NS_RELEASE(enc);
|
||||
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
} else {
|
||||
printf("Test Passed.\n");
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult testPlatformCharset()
|
||||
{
|
||||
nsIPlatformCharset *cinfo;
|
||||
nsresult res = CallGetService(kPlatformCharsetCID, &cinfo);
|
||||
if (NS_FAILED(res)) {
|
||||
printf("ERROR at GetService() code=0x%x.\n",res);
|
||||
return res;
|
||||
}
|
||||
|
||||
nsString value;
|
||||
res = cinfo->GetCharset(kPlatformCharsetSel_PlainTextInClipboard , value);
|
||||
printf("Clipboard plain text encoding = %s\n", NS_LossyConvertUTF16toASCII(value).get());
|
||||
|
||||
res = cinfo->GetCharset(kPlatformCharsetSel_FileName , value);
|
||||
printf("File Name encoding = %s\n", NS_LossyConvertUTF16toASCII(value).get());
|
||||
|
||||
res = cinfo->GetCharset(kPlatformCharsetSel_Menu , value);
|
||||
printf("Menu encoding = %s\n", NS_LossyConvertUTF16toASCII(value).get());
|
||||
|
||||
cinfo->Release();
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Testing functions
|
||||
|
||||
nsresult testAll()
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
// test the manager(s)
|
||||
res = testCharsetConverterManager();
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
testPlatformCharset();
|
||||
|
||||
// test decoders
|
||||
standardDecoderTest("T101", "ISO-8859-1", bLatin1_d0, bLatin1_s0, cLatin1_d0, cLatin1_s0);
|
||||
testISO2022JPDecoder();
|
||||
testEUCJPDecoder();
|
||||
testISO88597Decoder();
|
||||
testSJISDecoder();
|
||||
testUTF8Decoder();
|
||||
testMUTF7Decoder();
|
||||
testUTF7Decoder();
|
||||
|
||||
// test encoders
|
||||
testLatin1Encoder();
|
||||
testSJISEncoder();
|
||||
testEUCJPEncoder();
|
||||
testISO2022JPEncoder();
|
||||
testMUTF7Encoder();
|
||||
testUTF7Encoder();
|
||||
|
||||
// return
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult testFromArgs(int argc, char **argv)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
if ((argc == 5) && (!strcmp(argv[1], "-tdec"))) {
|
||||
res = testDecoderFromFiles(argv[2], argv[3], argv[4]);
|
||||
} else if ((argc == 5) && (!strcmp(argv[1], "-tenc"))) {
|
||||
res = testEncoderFromFiles(argv[2], argv[3], argv[4]);
|
||||
} else {
|
||||
printf("Usage:\n");
|
||||
printf(" TestUConv.exe\n");
|
||||
printf(" TestUConv.exe -tdec encoding inputEncodedFile expectedResultUnicodeFile\n");
|
||||
printf(" TestUConv.exe -tenc encoding inputUnicodeFile expectedResultEncodedFile\n");
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Main program functions
|
||||
|
||||
nsresult init()
|
||||
{
|
||||
nsresult rv = NS_InitXPCOM2(nullptr, nullptr, nullptr);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
return CallGetService(kCharsetConverterManagerCID, &ccMan);
|
||||
}
|
||||
|
||||
nsresult done()
|
||||
{
|
||||
NS_RELEASE(ccMan);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
res = init();
|
||||
if (NS_FAILED(res)) return -1;
|
||||
|
||||
if (argc <= 1) {
|
||||
printf("*** Unicode Converters Test ***\n");
|
||||
res = testAll();
|
||||
printf("\n***--------- Done --------***\n");
|
||||
} else {
|
||||
res = testFromArgs(argc, argv);
|
||||
}
|
||||
|
||||
done();
|
||||
|
||||
if (NS_FAILED(res)) return -1;
|
||||
else return 0;
|
||||
}
|
@ -1,188 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// Utility that converts file encoded in one charset codepage to
|
||||
// another encoding
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
|
||||
static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CID);
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
void usage()
|
||||
{
|
||||
printf(
|
||||
"nsconv -f fromcode -t tocode infile outfile\n"
|
||||
"nsconv -f fromcode -t tocode infile > outfile\n"
|
||||
"nsconv -f fromcode -t tocode < infile > outfile\n"
|
||||
);
|
||||
}
|
||||
|
||||
#define INBUFSIZE (1024*16)
|
||||
#define MEDBUFSIZE (1024*16*2)
|
||||
#define OUTBUFSIZE (1024*16*8)
|
||||
char inbuffer[INBUFSIZE];
|
||||
char outbuffer[OUTBUFSIZE];
|
||||
char16_t medbuffer[MEDBUFSIZE];
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
nsIUnicodeEncoder* encoder = nullptr;
|
||||
nsIUnicodeDecoder* decoder = nullptr;
|
||||
FILE* fin = 0;
|
||||
FILE* fout = 0;
|
||||
FILE* infile = 0;
|
||||
FILE* outfile = 0;
|
||||
nsresult res= NS_OK;
|
||||
|
||||
NS_InitXPCOM2(nullptr, nullptr, nullptr);
|
||||
|
||||
// get ccMain;
|
||||
nsCOMPtr<nsICharsetConverterManager> ccMain =
|
||||
do_GetService(kCharsetConverterManagerCID, &res);
|
||||
if(NS_FAILED(res))
|
||||
{
|
||||
fprintf(stderr, "Cannot get Character Converter Manager %x\n", res);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int i;
|
||||
if(argc > 4)
|
||||
{
|
||||
for(i =0; i < argc; i++)
|
||||
{
|
||||
if(strcmp(argv[i], "-f") == 0)
|
||||
{
|
||||
// User has specified the charset to convert from
|
||||
nsAutoCString str;
|
||||
|
||||
// First check if a charset alias was given,
|
||||
// and convert to the canonical name
|
||||
res = ccMain->GetCharsetAlias(argv[i+1], str);
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
fprintf(stderr, "Cannot get charset alias for %s %x\n",
|
||||
argv[i+1], res);
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
// Finally create the decoder
|
||||
res = ccMain->GetUnicodeDecoder(str.get(), &decoder);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "Cannot get Unicode decoder %s %x\n",
|
||||
argv[i+1],res);
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(strcmp(argv[i], "-t") == 0)
|
||||
{
|
||||
// User has specified which charset to convert to
|
||||
nsAutoCString str;
|
||||
|
||||
// First check if a charset alias was given,
|
||||
// and convert to the canonical name
|
||||
res = ccMain->GetCharsetAlias(argv[i+1], str);
|
||||
if (NS_FAILED(res))
|
||||
{
|
||||
fprintf(stderr, "Cannot get charset alias for %s %x\n",
|
||||
argv[i+1], res);
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
// Finally create the encoder
|
||||
res = ccMain->GetUnicodeEncoderRaw(str.get(), &encoder);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "Cannot get Unicode encoder %s %x\n",
|
||||
argv[i+1],res);
|
||||
goto error_exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (argc > 5)
|
||||
{
|
||||
// The user has specified an input file
|
||||
// if we have more than four arguments
|
||||
fin = infile = fopen(argv[5], "rb");
|
||||
if(!infile)
|
||||
{
|
||||
usage();
|
||||
fprintf(stderr,"cannot open input file %s\n", argv[5]);
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
if (argc > 6)
|
||||
{
|
||||
// The user has specified an output file
|
||||
// if we have more than four arguments
|
||||
fout = outfile = fopen(argv[6], "ab");
|
||||
if(!outfile)
|
||||
{
|
||||
usage();
|
||||
fprintf(stderr,"cannot open output file %s\n", argv[6]);
|
||||
goto error_exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
fout = stdout;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No inputfiles are given. Read and write
|
||||
// to/from standard in and standard out
|
||||
fin = stdin;
|
||||
fout = stdout;
|
||||
}
|
||||
|
||||
int32_t insize,medsize,outsize;
|
||||
while((insize=fread(inbuffer, 1,INBUFSIZE, fin)) > 0)
|
||||
{
|
||||
medsize=MEDBUFSIZE;
|
||||
|
||||
res = decoder->Convert(inbuffer,&insize, medbuffer, &medsize);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "failed in decoder->Convert %x\n",res);
|
||||
goto error_exit;
|
||||
}
|
||||
outsize = OUTBUFSIZE;
|
||||
res = encoder->Convert(medbuffer, &medsize, outbuffer,&outsize);
|
||||
if(NS_FAILED(res)) {
|
||||
fprintf(stderr, "failed in encoder->Convert %x\n",res);
|
||||
goto error_exit;
|
||||
}
|
||||
fwrite(outbuffer, 1, outsize, fout);
|
||||
|
||||
}
|
||||
|
||||
// Clean up
|
||||
if (infile != 0)
|
||||
fclose(infile);
|
||||
if (outfile != 0)
|
||||
fclose(outfile);
|
||||
fprintf(stderr, "Done!\n");
|
||||
NS_IF_RELEASE(encoder);
|
||||
NS_IF_RELEASE(decoder);
|
||||
return 0;
|
||||
}
|
||||
usage();
|
||||
error_exit:
|
||||
// Clean up after
|
||||
if (infile != 0)
|
||||
fclose(infile);
|
||||
if (outfile != 0)
|
||||
fclose(outfile);
|
||||
NS_IF_RELEASE(encoder);
|
||||
NS_IF_RELEASE(decoder);
|
||||
return -1;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#!/usr/local/bin/perl -w
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
while(<STDIN>)
|
||||
{
|
||||
if(/^#/)
|
||||
{
|
||||
print $_;
|
||||
}
|
||||
else
|
||||
{
|
||||
($a, $b, $c,$d) = /^(....)(.)(..)(.*)$/;
|
||||
print "0x" . $c . $b . "0x" . $a . $d . "\n";
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# umaptable -uf < cns1992p1.txt > ../ucvtw2/cns_1.uf
|
||||
# umaptable -uf < cns1992p2.txt > ../ucvtw2/cns_2.uf
|
||||
umaptable -uf < cnsIRGTp15.txt > ../ucvtw2/cns15.uf
|
||||
umaptable -uf < cnsIRGTp15ExtB.txt > ../ucvtw2/cns15extb.uf
|
||||
umaptable -uf < cnsIRGTp3.txt > ../ucvtw2/cns3.uf
|
||||
umaptable -uf < cnsIRGTp3ExtB.txt > ../ucvtw2/cns3extb.uf
|
||||
umaptable -uf < cnsIRGTp4.txt > ../ucvtw2/cns4.uf
|
||||
umaptable -uf < cnsIRGTp4ExtB.txt > ../ucvtw2/cns4extb.uf
|
||||
umaptable -uf < cnsIRGTp5.txt > ../ucvtw2/cns5.uf
|
||||
umaptable -uf < cnsIRGTp5ExtB.txt > ../ucvtw2/cns5extb.uf
|
||||
umaptable -uf < cnsIRGTp6.txt > ../ucvtw2/cns6.uf
|
||||
umaptable -uf < cnsIRGTp6ExtB.txt > ../ucvtw2/cns6extb.uf
|
||||
umaptable -uf < cnsIRGTp7.txt > ../ucvtw2/cns7.uf
|
||||
umaptable -uf < cnsIRGTp7ExtB.txt > ../ucvtw2/cns7extb.uf
|
||||
# umaptable -ut < cns1992p1.txt > ../ucvtw2/cns_1.ut
|
||||
# umaptable -ut < cns1992p2.txt > ../ucvtw2/cns_2.ut
|
||||
umaptable -ut < cnsIRGTp15.txt > ../ucvtw2/cns15.ut
|
||||
umaptable -ut < cnsIRGTp15ExtB.txt > ../ucvtw2/cns15extb.ut
|
||||
umaptable -ut < cnsIRGTp3.txt > ../ucvtw2/cns3.ut
|
||||
umaptable -ut < cnsIRGTp3ExtB.txt > ../ucvtw2/cns3extb.ut
|
||||
umaptable -ut < cnsIRGTp4.txt > ../ucvtw2/cns4.ut
|
||||
umaptable -ut < cnsIRGTp4ExtB.txt > ../ucvtw2/cns4extb.ut
|
||||
umaptable -ut < cnsIRGTp5.txt > ../ucvtw2/cns5.ut
|
||||
umaptable -ut < cnsIRGTp5ExtB.txt > ../ucvtw2/cns5extb.ut
|
||||
umaptable -ut < cnsIRGTp6.txt > ../ucvtw2/cns6.ut
|
||||
umaptable -ut < cnsIRGTp6ExtB.txt > ../ucvtw2/cns6extb.ut
|
||||
umaptable -ut < cnsIRGTp7.txt > ../ucvtw2/cns7.ut
|
||||
umaptable -ut < cnsIRGTp7ExtB.txt > ../ucvtw2/cns7extb.ut
|
@ -1,133 +0,0 @@
|
||||
#!/user/local/bin/perl
|
||||
# -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
$rowwidth = ((0xff - 0x80)+(0x7f - 0x40));
|
||||
sub cp936tonum()
|
||||
{
|
||||
my($cp936) = (@_);
|
||||
my($first,$second,$jnum);
|
||||
$first = hex(substr($cp936,2,2));
|
||||
$second = hex(substr($cp936,4,2));
|
||||
$jnum = ($first - 0x81 ) * $rowwidth;
|
||||
if($second >= 0x80)
|
||||
{
|
||||
$jnum += $second - 0x80 + (0x7f-0x40);
|
||||
}
|
||||
else
|
||||
{
|
||||
$jnum += $second - 0x40;
|
||||
}
|
||||
return $jnum;
|
||||
}
|
||||
|
||||
@map = {};
|
||||
sub readtable()
|
||||
{
|
||||
open(CP936, "<gbkcommon.txt") || die "cannot open gbkcommon.txt";
|
||||
while(<CP936>)
|
||||
{
|
||||
if(! /^#/) {
|
||||
chop();
|
||||
($j, $u, $r) = split(/\t/,$_);
|
||||
if(length($j) > 4)
|
||||
{
|
||||
$n = &cp936tonum($j);
|
||||
$map{$n} = $u;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub printtable()
|
||||
{
|
||||
for($i=0;$i<126;$i++)
|
||||
{
|
||||
printf ( "/* 0x%2XXX */\n", ( $i + 0x81));
|
||||
for($j=0;$j<(0x7f-0x40);$j++)
|
||||
{
|
||||
if("" eq ($map{($i * $rowwidth + $j)}))
|
||||
{
|
||||
printf "0xFFFD,"
|
||||
}
|
||||
else
|
||||
{
|
||||
printf $map{($i * $rowwidth + $j)} . ",";
|
||||
}
|
||||
if( 0 == (($j + 1) % 8))
|
||||
{
|
||||
printf "/* 0x%2X%1X%1X*/\n", $i+0x81, 4+($j/16), (7==($j%16))?0:8;
|
||||
}
|
||||
}
|
||||
|
||||
print "0xFFFD,";
|
||||
|
||||
printf "/* 0x%2X%1X%1X*/\n", $i+0x81, 4+($j/16),(7==($j%16))?0:8;
|
||||
for($j=0;$j < (0xff-0x80);$j++)
|
||||
{
|
||||
if("" eq ($map{($i * $rowwidth + $j + 0x3f)})) # user defined chars map to 0xFFFD
|
||||
{
|
||||
|
||||
if ( ( $i == 125 ) and ( $j == (0xff - 0x80 - 1 )))
|
||||
{
|
||||
printf "0xFFFD"; #has no ',' followed last item
|
||||
}
|
||||
else
|
||||
{
|
||||
printf "0xFFFD,";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ( $i == 125 ) and ( $j == (0xff - 0x80 - 1 )))
|
||||
{
|
||||
printf $map{($i * $rowwidth + $j + 0x3f)}; #has no ',' followed last item
|
||||
}
|
||||
else
|
||||
{
|
||||
printf $map{($i * $rowwidth + $j + 0x3f)} . ",";
|
||||
}
|
||||
}
|
||||
|
||||
if( 0 == (($j + 1) % 8))
|
||||
{
|
||||
printf "/* 0x%2X%1X%1X*/\n", $i+0x81, 8+($j/16), (7==($j%16))?0:8;
|
||||
}
|
||||
}
|
||||
printf " /* 0x%2X%1X%1X*/\n", $i+0x81, 8+($j/16),(7==($j%16))?0:8;
|
||||
}
|
||||
}
|
||||
sub printnpl()
|
||||
{
|
||||
$npl = <<END_OF_NPL;
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
END_OF_NPL
|
||||
print $npl;
|
||||
}
|
||||
sub printdontmodify()
|
||||
{
|
||||
$dont_modify = <<END_OF_DONT_MODIFY;
|
||||
/*
|
||||
This file is generated by mozilla/intl/uconv/tools/cp936tocdx.pl
|
||||
Please do not modify this file by hand
|
||||
Instead, you should download CP936.TXT from
|
||||
http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/
|
||||
and put under mozilla/intl/uconv/toools
|
||||
and run perl cp936tocdx.pl > ../ucvcn/cp936map.h
|
||||
If you have question, mailto:ftan\@netscape.com
|
||||
*/
|
||||
END_OF_DONT_MODIFY
|
||||
print $dont_modify;
|
||||
}
|
||||
|
||||
&readtable();
|
||||
&printnpl();
|
||||
&printdontmodify();
|
||||
&printtable();
|
||||
|
@ -1,253 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# Adapted from
|
||||
# https://hg.mozilla.org/projects/htmlparser/file/0d906fb1ab90/generate-encoding-data.py
|
||||
|
||||
# indexes.json comes from
|
||||
# https://encoding.spec.whatwg.org/indexes.json
|
||||
# i.e.
|
||||
# https://github.com/whatwg/encoding/blob/ce4e83d0df5b5efec0697fc76e66699737e033a3/indexes.json
|
||||
|
||||
import json
|
||||
|
||||
indexes = json.load(open("indexes.json", "r"))
|
||||
|
||||
def nullToZero(codePoint):
|
||||
if not codePoint:
|
||||
codePoint = 0
|
||||
return codePoint
|
||||
|
||||
index = []
|
||||
|
||||
for codePoint in indexes["big5"]:
|
||||
index.append(nullToZero(codePoint))
|
||||
|
||||
# There are four major gaps consisting of more than 4 consecutive invalid pointers
|
||||
gaps = []
|
||||
consecutive = 0
|
||||
consecutiveStart = 0
|
||||
offset = 0
|
||||
for codePoint in index:
|
||||
if codePoint == 0:
|
||||
if consecutive == 0:
|
||||
consecutiveStart = offset
|
||||
consecutive +=1
|
||||
else:
|
||||
if consecutive > 4:
|
||||
gaps.append((consecutiveStart, consecutiveStart + consecutive))
|
||||
consecutive = 0
|
||||
offset += 1
|
||||
|
||||
def invertRanges(ranges, cap):
|
||||
inverted = []
|
||||
invertStart = 0
|
||||
for (start, end) in ranges:
|
||||
if start != 0:
|
||||
inverted.append((invertStart, start))
|
||||
invertStart = end
|
||||
inverted.append((invertStart, cap))
|
||||
return inverted
|
||||
|
||||
cap = len(index)
|
||||
ranges = invertRanges(gaps, cap)
|
||||
|
||||
# Now compute a compressed lookup table for astralness
|
||||
|
||||
gaps = []
|
||||
consecutive = 0
|
||||
consecutiveStart = 0
|
||||
offset = 0
|
||||
for codePoint in index:
|
||||
if codePoint <= 0xFFFF:
|
||||
if consecutive == 0:
|
||||
consecutiveStart = offset
|
||||
consecutive +=1
|
||||
else:
|
||||
if consecutive > 40:
|
||||
gaps.append((consecutiveStart, consecutiveStart + consecutive))
|
||||
consecutive = 0
|
||||
offset += 1
|
||||
|
||||
astralRanges = invertRanges(gaps, cap)
|
||||
|
||||
|
||||
classFile = open("../ucvtw/nsBIG5Data.cpp", "w")
|
||||
classFile.write('''/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* THIS IS A GENERATED FILE. PLEASE DO NOT EDIT.
|
||||
* Instead, please regenerate using intl/uconv/tools/gen-big5-data.py
|
||||
*/
|
||||
|
||||
#include "nsBIG5Data.h"
|
||||
|
||||
static const char16_t kBig5LowBitsTable[] = {
|
||||
''')
|
||||
|
||||
for (low, high) in ranges:
|
||||
for i in xrange(low, high):
|
||||
classFile.write(' 0x%04X,\n' % (index[i] & 0xFFFF))
|
||||
|
||||
classFile.write('''};
|
||||
|
||||
static const uint32_t kBig5AstralnessTable[] = {
|
||||
''')
|
||||
|
||||
# An array of bool is inefficient per
|
||||
# http://stackoverflow.com/questions/4049156/1-bit-per-bool-in-array-c
|
||||
|
||||
bits = []
|
||||
for (low, high) in astralRanges:
|
||||
for i in xrange(low, high):
|
||||
bits.append(1 if index[i] > 0xFFFF else 0)
|
||||
# pad length to multiple of 32
|
||||
for i in xrange(32 - (len(bits) % 32)):
|
||||
bits.append(0)
|
||||
i = 0
|
||||
while i < len(bits):
|
||||
accu = 0
|
||||
for j in xrange(32):
|
||||
accu |= bits[i + j] << j
|
||||
classFile.write(' 0x%08X,\n' % accu)
|
||||
i += 32
|
||||
|
||||
classFile.write('''};
|
||||
|
||||
// static
|
||||
char16_t
|
||||
nsBIG5Data::LowBits(size_t aPointer)
|
||||
{
|
||||
''')
|
||||
|
||||
base = 0
|
||||
for (low, high) in ranges:
|
||||
classFile.write(''' if (aPointer < %d) {
|
||||
return 0;
|
||||
}
|
||||
if (aPointer < %d) {
|
||||
return kBig5LowBitsTable[%d + (aPointer - %d)];
|
||||
}
|
||||
''' % (low, high, base, low))
|
||||
base += (high - low)
|
||||
|
||||
classFile.write(''' return 0;
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsBIG5Data::IsAstral(size_t aPointer)
|
||||
{
|
||||
''')
|
||||
|
||||
base = 0
|
||||
for (low, high) in astralRanges:
|
||||
if high - low == 1:
|
||||
classFile.write(''' if (aPointer < %d) {
|
||||
return false;
|
||||
}
|
||||
if (aPointer == %d) {
|
||||
return true;
|
||||
}
|
||||
''' % (low, low))
|
||||
else:
|
||||
classFile.write(''' if (aPointer < %d) {
|
||||
return false;
|
||||
}
|
||||
if (aPointer < %d) {
|
||||
size_t index = %d + (aPointer - %d);
|
||||
return kBig5AstralnessTable[index >> 5] & (1 << (index & 0x1F));
|
||||
}
|
||||
''' % (low, high, base, low))
|
||||
base += (high - low)
|
||||
|
||||
classFile.write(''' return false;
|
||||
}
|
||||
|
||||
//static
|
||||
size_t
|
||||
nsBIG5Data::FindPointer(char16_t aLowBits, bool aIsAstral)
|
||||
{
|
||||
if (!aIsAstral) {
|
||||
switch (aLowBits) {
|
||||
''')
|
||||
|
||||
hkscsBound = (0xA1 - 0x81) * 157
|
||||
|
||||
preferLast = [
|
||||
0x2550,
|
||||
0x255E,
|
||||
0x2561,
|
||||
0x256A,
|
||||
0x5341,
|
||||
0x5345,
|
||||
]
|
||||
|
||||
for codePoint in preferLast:
|
||||
# Python lists don't have .rindex() :-(
|
||||
for i in xrange(len(index) - 1, -1, -1):
|
||||
candidate = index[i]
|
||||
if candidate == codePoint:
|
||||
classFile.write(''' case 0x%04X:
|
||||
return %d;
|
||||
''' % (codePoint, i))
|
||||
break
|
||||
|
||||
classFile.write(''' default:
|
||||
break;
|
||||
}
|
||||
}''')
|
||||
|
||||
base = 0
|
||||
start = 0
|
||||
for (low, high) in ranges:
|
||||
if low <= hkscsBound and hkscsBound < high:
|
||||
# This is the first range we don't ignore and the
|
||||
# range that contains the first non-HKSCS pointer.
|
||||
# Avoid searching HKSCS.
|
||||
start = base + hkscsBound - low
|
||||
break
|
||||
base += (high - low)
|
||||
|
||||
classFile.write('''
|
||||
for (size_t i = %d; i < MOZ_ARRAY_LENGTH(kBig5LowBitsTable); ++i) {
|
||||
if (kBig5LowBitsTable[i] == aLowBits) {
|
||||
size_t pointer;
|
||||
''' % start)
|
||||
|
||||
base = 0
|
||||
prevLow = 0
|
||||
prevHigh = 0
|
||||
prevBase = 0
|
||||
writing = False
|
||||
for (low, high) in ranges:
|
||||
if writing:
|
||||
classFile.write('''if (i < %d) {
|
||||
pointer = i + %d;
|
||||
} else ''' % ((prevBase + prevHigh - prevLow), (prevLow - prevBase)))
|
||||
prevLow = low
|
||||
prevHigh = high
|
||||
prevBase = base
|
||||
if high > hkscsBound:
|
||||
writing = True
|
||||
base += (high - low)
|
||||
|
||||
classFile.write('''{
|
||||
pointer = i + %d;
|
||||
}''' % (prevLow - prevBase))
|
||||
|
||||
classFile.write('''
|
||||
if (aIsAstral == IsAstral(pointer)) {
|
||||
return pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
''')
|
||||
classFile.close()
|
@ -1,228 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
# -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
%gb18030tounicode = {};
|
||||
%unicodetogb18030 = {};
|
||||
%unicodetocp936 = {};
|
||||
%cp936tounicode = {};
|
||||
%tounicodecommon = {};
|
||||
%gb18030tounicodeuniq = {};
|
||||
%gb180304btounicode = {};
|
||||
%cp936tounicodeuniq = {};
|
||||
|
||||
%map = {};
|
||||
$rowwidth = ((0xff - 0x80)+(0x7f - 0x40));
|
||||
sub cp936tonum()
|
||||
{
|
||||
my($cp936) = (@_);
|
||||
my($first,$second,$jnum);
|
||||
$first = hex(substr($cp936,2,2));
|
||||
$second = hex(substr($cp936,4,2));
|
||||
$jnum = ($first - 0x81 ) * $rowwidth;
|
||||
if($second >= 0x80)
|
||||
{
|
||||
$jnum += $second - 0x80 + (0x7f-0x40);
|
||||
}
|
||||
else
|
||||
{
|
||||
$jnum += $second - 0x40;
|
||||
}
|
||||
return $jnum;
|
||||
}
|
||||
sub addeudc()
|
||||
{
|
||||
my($l,$h,$hl,$us);
|
||||
|
||||
$u = 0xE000;
|
||||
$us = sprintf "%04X", $u;
|
||||
# For AAA1-AFFE
|
||||
for($h=0xAA; $h <=0xAF;$h++)
|
||||
{
|
||||
for($l=0xA1; $l <=0xFE;$l++,$u++)
|
||||
{
|
||||
$us = sprintf "%04X", $u;
|
||||
$hl = sprintf "%02X%02X", $h, $l;
|
||||
$unicodetocp936{$us} = $hl;
|
||||
}
|
||||
}
|
||||
|
||||
# For F8A1-FEFE
|
||||
$us = sprintf "%04X", $u;
|
||||
for($h=0xF8; $h <=0xFE;$h++)
|
||||
{
|
||||
for($l=0xA1; $l <=0xFE;$l++,$u++)
|
||||
{
|
||||
$us = sprintf "%04X", $u;
|
||||
$hl = sprintf "%02X%02X", $h, $l;
|
||||
$unicodetocp936{$us} = $hl;
|
||||
}
|
||||
}
|
||||
|
||||
# For A140-A7A0
|
||||
$us = sprintf "%04X", $u;
|
||||
for($h=0xA1; $h <=0xA7;$h++)
|
||||
{
|
||||
for($l=0x40; $l <=0x7E;$l++,$u++)
|
||||
{
|
||||
$us = sprintf "%04X", $u;
|
||||
$hl = sprintf "%02X%02X", $h, $l;
|
||||
$unicodetocp936{$us} = $hl;
|
||||
}
|
||||
# We need to skip 7F
|
||||
for($l=0x80; $l <=0xA0;$l++,$u++)
|
||||
{
|
||||
$us = sprintf "%04X", $u;
|
||||
$hl = sprintf "%02X%02X", $h, $l;
|
||||
$unicodetocp936{$us} = $hl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub readcp936()
|
||||
{
|
||||
open(CP936, "<CP936.txt") || die "Cannot open CP936 file";
|
||||
while(<CP936>)
|
||||
{
|
||||
if(! /^#/) {
|
||||
chop();
|
||||
($gb, $u) = split(/\t/, $_);
|
||||
if($u =~ /^0x/) {
|
||||
$u1 = substr($u, 2, 4);
|
||||
$gb1 = substr($gb, 2, 4);
|
||||
$cp936tounicode{$gb1} = $u1;
|
||||
if($unicodetocp936{$u1} == "") {
|
||||
$unicodetocp936{$u1} = $gb1;
|
||||
} else {
|
||||
"WARNING: Unicode " . $u1 . " already map to CP936 " .
|
||||
$unicodetocp936{$u1} . " when we try to map to " . $gb1 . "\n";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sub readgb18030()
|
||||
{
|
||||
open(GB18030, "<GB18030") || die "Cannot open GB18030 file";
|
||||
while(<GB18030>)
|
||||
{
|
||||
if(/^[0-9A-F]/) {
|
||||
chop();
|
||||
($u, $gb) = split(/\s/, $_);
|
||||
$gb18030tounicode{$gb} = $u;
|
||||
if( $unicodetogb18030{$u} == "" ) {
|
||||
$unicodetogb18030{$u} = $gb;
|
||||
} else {
|
||||
"WARNING: Unicode " . $u1 . " already map to CP936 " .
|
||||
$unicodetocp936{$u1} . " when we try to map to " . $gb1 . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sub splittable()
|
||||
{
|
||||
my($i, $u);
|
||||
for($i = 0; $i < 0x10000; $i++) {
|
||||
$u = sprintf "%04X", $i;
|
||||
if($unicodetogb18030{$u} eq $unicodetocp936{$u}) {
|
||||
if($unicodetogb18030{$u} ne "") {
|
||||
$tounicodecommon{$unicodetogb18030{$u}} = $u;
|
||||
} else {
|
||||
# print $u . "|" . $unicodetogb18030{$u} . "|" . $unicodetocp936{$u} . "\n";
|
||||
}
|
||||
} else {
|
||||
if($unicodetogb18030{$u} ne "" ) {
|
||||
if($unicodetogb18030{$u}.length > 4) {
|
||||
$gb180304btounicode{$unicodetogb18030{$u}} = $u;
|
||||
} else {
|
||||
$gb18030tounicodeuniq{$unicodetogb18030{$u}} = $u;
|
||||
}
|
||||
}
|
||||
if($unicodetocp936{$u} ne "" ) {
|
||||
$cp936tounicodeuniq{$unicodetocp936{$u}} = $u;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sub gb4bytestoidx()
|
||||
{
|
||||
my($gb) = @_;
|
||||
my($b1,$b2, $b3, $b4,$idx);
|
||||
$b1 = hex(substr($gb, 0, 2)) - 0x81;
|
||||
$b2 = hex(substr($gb, 2, 2)) - 0x30;
|
||||
$b3 = hex(substr($gb, 4, 2)) - 0x81;
|
||||
$b4 = hex(substr($gb, 6, 2)) - 0x30;
|
||||
$idx = sprintf "%04X" , ((($b1 * 10) + $b2 ) * 126 + $b3) * 10 + $b4;
|
||||
return $idx;
|
||||
}
|
||||
sub printcommontable()
|
||||
{
|
||||
open ( GBKCOMMON, ">gbkcommon.txt" ) || die "cannot open gbkcommon.txt";
|
||||
foreach $gb (sort(keys %tounicodecommon)) {
|
||||
print GBKCOMMON "0x" . $gb . "\t0x" . $tounicodecommon{$gb} . "\n";
|
||||
}
|
||||
close GBKCOMMON;
|
||||
}
|
||||
sub printcp936table()
|
||||
{
|
||||
open ( CP936UNIQ, ">cp936uniq.txt" ) || die "cannot open cp936uniq.txt";
|
||||
foreach $gb (sort(keys %cp936tounicodeuniq)) {
|
||||
print CP936UNIQ "0x" . $gb . "\t0x" . $cp936tounicodeuniq{$gb} . "\n";
|
||||
}
|
||||
close CP936UNIQ;
|
||||
}
|
||||
sub printgb180304btable()
|
||||
{
|
||||
open ( GB180304B, ">gb180304b.txt" ) || die "cannot open gb180304b.txt";
|
||||
foreach $gb (sort(keys %gb180304btounicode)) {
|
||||
if($gb180304btounicode{$gb} ne "FFFF" ) {
|
||||
print GB180304B "0x" . &gb4bytestoidx($gb) . "\t0x" . $gb180304btounicode{$gb} . "\t# 0x" . $gb . "\n";
|
||||
}
|
||||
}
|
||||
close GB180304B;
|
||||
}
|
||||
sub printgb18030table()
|
||||
{
|
||||
open ( GB18030UNIQ, ">gb18030uniq.txt" ) || die "cannot open gb18030uniq.txt";
|
||||
foreach $gb (sort(keys %gb18030tounicodeuniq)) {
|
||||
print GB18030UNIQ "0x" . $gb . "\t0x" . $gb18030tounicodeuniq{$gb} . "\n";
|
||||
}
|
||||
close GB18030UNIQ;
|
||||
}
|
||||
|
||||
sub genufut()
|
||||
{
|
||||
print ( "umaptable -uf < gb18030uniq.txt > gb18030uniq2b.uf\n");
|
||||
system( "umaptable -uf < gb18030uniq.txt > gb18030uniq2b.uf");
|
||||
|
||||
print ( "umaptable -ut < gb18030uniq.txt > gb18030uniq2b.ut\n");
|
||||
system( "umaptable -ut < gb18030uniq.txt > gb18030uniq2b.ut");
|
||||
|
||||
print ( "umaptable -uf < cp936uniq.txt > gbkuniq.uf\n") ;
|
||||
system( "umaptable -uf < cp936uniq.txt > gbkuniq.uf") ;
|
||||
|
||||
print ( "umaptable -ut < cp936uniq.txt > gbkuniq.ut\n") ;
|
||||
system( "umaptable -ut < cp936uniq.txt > gbkuniq.ut") ;
|
||||
|
||||
print ( "umaptable -uf < gb180304b.txt > gb180304bytes.uf\n") ;
|
||||
system( "umaptable -uf < gb180304b.txt > gb180304bytes.uf") ;
|
||||
|
||||
print ( "umaptable -ut < gb180304b.txt > gb180304bytes.ut\n") ;
|
||||
system( "umaptable -ut < gb180304b.txt > gb180304bytes.ut") ;
|
||||
|
||||
print ( "perl cp936tocdx.pl > cp936map.h\n");
|
||||
system( "perl cp936tocdx.pl > cp936map.h");
|
||||
}
|
||||
|
||||
&readgb18030();
|
||||
&readcp936();
|
||||
&addeudc();
|
||||
&splittable();
|
||||
&printcommontable();
|
||||
&printgb180304btable();
|
||||
&printgb18030table();
|
||||
&printcp936table();
|
||||
&genufut();
|
@ -1,53 +0,0 @@
|
||||
#!/user/local/bin/perl
|
||||
# -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
$name = "ucvlatin";
|
||||
$dir = "./";
|
||||
|
||||
sub printnpl()
|
||||
{
|
||||
$npl = <<END_OF_NPL;
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
END_OF_NPL
|
||||
print $npl;
|
||||
}
|
||||
|
||||
sub finddefine()
|
||||
{
|
||||
my($classname, $definename) = (@_);
|
||||
$cmd = 'egrep ' . $classname . ' ' . $dir . '*.h ' . $dir . '*.cpp | egrep "public" | egrep -v "Support[.]"' . '&> /dev/null';
|
||||
if( system($cmd)) {
|
||||
print "\/\/ ";
|
||||
}
|
||||
print "#define " . $definename . "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
&printnpl();
|
||||
print "\n";
|
||||
print "#ifndef " . $name . "config_h__\n";
|
||||
print "#define " . $name . "config_h__\n";
|
||||
print "\n";
|
||||
print "\/* This file is generated by running mozilla/intl/uconv/tools/genimpldefine.pl on unix */\n";
|
||||
|
||||
&finddefine( "nsBasicDecoderSupport", "IMPL_NSBASICDECODER");
|
||||
&finddefine( "nsBufferDecoderSupport", "IMPL_NSBUFFERDECODER");
|
||||
&finddefine( "nsTableDecoderSupport", "IMPL_NSTABLEDECODER");
|
||||
&finddefine( "nsMultiTableDecoderSupport", "IMPL_NSMULTITABLEDECODER");
|
||||
&finddefine( "nsOneByteDecoderSupport", "IMPL_NSONEBYTEDECODER");
|
||||
&finddefine( "nsBasicEncoder", "IMPL_NSBASICENCODER");
|
||||
&finddefine( "nsEncoderSupport", "IMPL_NSENCODER");
|
||||
&finddefine( "nsTableEncoderSupport", "IMPL_NSTABLEENCODER");
|
||||
&finddefine( "nsMultiTableEncoderSupport", "IMPL_NSMULTITABLEENCODER");
|
||||
print "\n";
|
||||
print "#include \"" . $name . "rules.h\"\n";
|
||||
print "\n";
|
||||
print "#endif \/*" . $name . "config_h__ *\/\n";
|
File diff suppressed because one or more lines are too long
@ -1,334 +0,0 @@
|
||||
#!/usr/local/bin/perl
|
||||
use strict;
|
||||
|
||||
my @source_files;
|
||||
|
||||
my @sjis_h;
|
||||
$sjis_h[0] = -1;
|
||||
@sjis_h[0x81..0x9f] = map { 0x2100 + $_ * 0x200 } (0 .. 30);
|
||||
@sjis_h[0xe0..0xef] = map { 0x5F00 + $_ * 0x200 } (0 .. 15);
|
||||
@sjis_h[0xf0..0xf9] = (-2) x 10;
|
||||
my @sjis_l;
|
||||
@sjis_l[0x40..0x7e] = (0x21..0x5f);
|
||||
@sjis_l[0x80..0xfc] = (0x60..0x7e, 0x121..0x17e);
|
||||
|
||||
sub sjis_to_jis {
|
||||
my ($s) = @_;
|
||||
my $j;
|
||||
my $type;
|
||||
|
||||
my $h = $sjis_h[($s>>8)&0xff];
|
||||
|
||||
if ( $h > 0 ) { # jis0208
|
||||
|
||||
my $l = $sjis_l[$s&0xff];
|
||||
if ( $l == 0 ) {
|
||||
$j = $s;
|
||||
$type = 'sjis2undef';
|
||||
} else {
|
||||
$j = $h + $l;
|
||||
if ( $j >= 0x3000 && $j < 0x7500 ) { # jis0208 kanji
|
||||
$type = 'jis0208';
|
||||
} elsif ( $j < 0x2900 ) { # jis0208
|
||||
$type = 'jis0208';
|
||||
} else {
|
||||
$type = 'jis0208undef';
|
||||
}
|
||||
}
|
||||
|
||||
} elsif ( $h == -1 ) { # single byte
|
||||
|
||||
$j = $s;
|
||||
if ( $s <= 0x7f ) { # jis0201 roman
|
||||
$type = 'jis0201';
|
||||
} elsif ( $s >= 0xa1 && $s <= 0xdf ) { # jis0201 kana
|
||||
$type = 'jis0201';
|
||||
} else { # sjis single byte undefined
|
||||
$type = 'sjis1undef';
|
||||
}
|
||||
|
||||
} elsif ( $h == -2 ) { # private use
|
||||
$j = $s;
|
||||
$type = 'private';
|
||||
|
||||
} else { # sjis undefined
|
||||
$j = $s;
|
||||
$type = 'sjis2undef';
|
||||
}
|
||||
|
||||
return ($j, $type);
|
||||
}
|
||||
|
||||
|
||||
sub read_sjis_map {
|
||||
my ($filename, $s_col, $u_col) = @_;
|
||||
my %map;
|
||||
open MAP, $filename or die $!;
|
||||
while (<MAP>) {
|
||||
my @cols = split /\s+/;
|
||||
my ($s, $u) = @cols[$s_col, $u_col];
|
||||
$s =~ /^0x[0-9A-Fa-f]+$/ && $u =~ /^0x[0-9A-Fa-f]+$/ or next;
|
||||
|
||||
$s = oct($s);
|
||||
$u = oct($u);
|
||||
|
||||
my ($j, $type) = sjis_to_jis($s);
|
||||
push @{$map{$type}}, [$j, $s, $u];
|
||||
|
||||
}
|
||||
close MAP or warn $!;
|
||||
push @source_files, $filename;
|
||||
return %map;
|
||||
}
|
||||
|
||||
sub read_0212_map {
|
||||
my ($filename, $j_col, $u_col) = @_;
|
||||
my $map;
|
||||
open MAP, $filename or die $!;
|
||||
while (<MAP>) {
|
||||
my @cols = split /\s+/;
|
||||
my ($j, $u) = @cols[$j_col, $u_col];
|
||||
$j =~ /^0x[0-9A-Fa-f]+$/ && $u =~ /^0x[0-9A-Fa-f]+$/ or next;
|
||||
|
||||
$j = oct($j);
|
||||
$u = oct($u);
|
||||
$u = 0xff5e if $u == 0x007e;
|
||||
|
||||
push @$map, [$j, 0, $u];
|
||||
}
|
||||
close MAP or warn $!;
|
||||
push @source_files, $filename;
|
||||
return $map;
|
||||
}
|
||||
|
||||
|
||||
my %printed;
|
||||
sub write_fromu_map {
|
||||
my ($filename, $code, @maps) = @_;
|
||||
open MAP, ">$filename" or die $!;
|
||||
foreach my $map (@maps) {
|
||||
foreach my $pair (@$map) {
|
||||
my ($j, $s, $u) = @$pair;
|
||||
if ( $code eq 'sjis' ) {
|
||||
$j = $s;
|
||||
}
|
||||
if ( defined($printed{$u}) ) {
|
||||
if ( $printed{$u} ne $j ) {
|
||||
printf "conflict 0x%04x to 0x%04x, 0x%04x\n", $u, $printed{$u}, $j;
|
||||
}
|
||||
} else {
|
||||
if ( $j < 0x100 ) {
|
||||
printf MAP "0x%02X\t0x%04X\n", $j, $u;
|
||||
} else {
|
||||
printf MAP "0x%04X\t0x%04X\n", $j, $u;
|
||||
}
|
||||
$printed{$u} = $j;
|
||||
}
|
||||
}
|
||||
}
|
||||
close MAP or warn $!;
|
||||
}
|
||||
|
||||
my @table;
|
||||
my %table;
|
||||
my $table_next_count = 0;
|
||||
|
||||
sub get_94table_index {
|
||||
my ($map_table) = @_;
|
||||
my $key = join ',', map {int($map_table->[$_])} (0 .. 93);
|
||||
my $table_index = $table{$key};
|
||||
if ( !defined($table_index) ) {
|
||||
$table_index = $table_next_count;
|
||||
$table_next_count += 94;
|
||||
$table[$table_index] = $map_table;
|
||||
$table{$key} = $table_index;
|
||||
}
|
||||
return $table_index;
|
||||
}
|
||||
|
||||
sub get_188table_index {
|
||||
my ($map_table) = @_;
|
||||
my $map_table1 = [ @{$map_table}[0 .. 93] ];
|
||||
my $map_table2 = [ @{$map_table}[94 .. 187] ];
|
||||
my $key = join ',', map {int($map_table->[$_])} (0 .. 187);
|
||||
my $key1 = join ',', map {int($map_table1->[$_])} (0 .. 93);
|
||||
my $key2 = join ',', map {int($map_table2->[$_])} (0 .. 93);
|
||||
my $table_index = $table{$key};
|
||||
if ( !defined($table_index) ) {
|
||||
$table_index = $table_next_count;
|
||||
$table_next_count += 188;
|
||||
$table[$table_index] = $map_table1;
|
||||
$table[$table_index + 94] = $map_table2;
|
||||
$table{$key} = $table_index;
|
||||
$table{$key1} = $table_index unless defined($table{$key1});
|
||||
$table{$key2} = $table_index + 94 unless defined($table{$key2});
|
||||
}
|
||||
return $table_index;
|
||||
}
|
||||
|
||||
get_188table_index([]);
|
||||
|
||||
sub print_sjis_table_index {
|
||||
my @maps = @_;
|
||||
my %map_table;
|
||||
foreach my $map (@maps) {
|
||||
foreach my $pair (@$map) {
|
||||
my ($j, $s, $u) = @$pair;
|
||||
my $row = $s >> 8;
|
||||
my $cell = $s&0xff;
|
||||
if ( $cell >= 0x40 && $cell <= 0x7e ) {
|
||||
$cell -= 0x40;
|
||||
} elsif ( $cell >= 0x80 && $cell <= 0xfc ) {
|
||||
$cell -= 0x41;
|
||||
} else {
|
||||
next;
|
||||
}
|
||||
if ( defined($map_table{$row}->[$cell]) && $map_table{$row}->[$cell] != $u ) {
|
||||
print "conflict!\n";
|
||||
}
|
||||
$map_table{$row}->[$cell] = $u;
|
||||
}
|
||||
}
|
||||
|
||||
for ( my $i = 0x80; $i < 0x100; $i++ ) {
|
||||
if ( ($i & 0x7) == 0 ) {
|
||||
print MAP "\n ";
|
||||
}
|
||||
if ( $i >= 0xa1 && $i <= 0xdf ) {
|
||||
printf MAP " 0x%04X,", $i + 0xfec0;
|
||||
} elsif ( $i >= 0xf0 && $i <= 0xf9 ) {
|
||||
printf MAP " 0x%04X,", 0xe000 + ($i - 0xf0) * 188;
|
||||
} elsif ( $i == 0x80 ) {
|
||||
print MAP " 0xFFFD,";
|
||||
} elsif ( $i == 0xa0 ) {
|
||||
print MAP " 0xF8F0,";
|
||||
} elsif ( $i >= 0xfd ) {
|
||||
printf MAP " 0x%04X,", $i + (0xf8f1 - 0xfd);
|
||||
} else {
|
||||
my $table_index = get_188table_index($map_table{$i});
|
||||
printf MAP " %6d,", $table_index;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub print_jis_table_index {
|
||||
my @maps = @_;
|
||||
my %map_table;
|
||||
foreach my $map (@maps) {
|
||||
foreach my $pair (@$map) {
|
||||
my ($j, $s, $u) = @$pair;
|
||||
my $row = $j >> 8;
|
||||
my $cell = ($j&0xff) - 0x21;
|
||||
if ( defined($map_table{$row}->[$cell]) && $map_table{$row}->[$cell] != $u ) {
|
||||
print "conflict!\n";
|
||||
}
|
||||
$map_table{$row}->[$cell] = $u;
|
||||
}
|
||||
}
|
||||
|
||||
for ( my $i = 0; $i < 0x80; $i++ ) {
|
||||
if ( ($i & 0x7) == 0 ) {
|
||||
print MAP "\n ";
|
||||
}
|
||||
if ( $i >= 0x21 && $i <= 0x7e ) {
|
||||
my $table_index = get_94table_index($map_table{$i});
|
||||
printf MAP " %6d,", $table_index;
|
||||
} else {
|
||||
print MAP " 0xFFFD,";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub print_table_index {
|
||||
my ($map_name, @maps) = @_;
|
||||
print MAP "static const uint16_t g${map_name}IndexShiftJis[] = {";
|
||||
print_sjis_table_index(@maps);
|
||||
print MAP "\n};\n";
|
||||
print MAP "static const uint16_t g${map_name}IndexJis0208[] = {";
|
||||
print_jis_table_index(@maps);
|
||||
print MAP "\n};\n";
|
||||
print MAP "static const uint16_t * const g${map_name}Index[] = {";
|
||||
print MAP "\n g${map_name}IndexShiftJis, g${map_name}IndexJis0208";
|
||||
print MAP "\n};\n\n";
|
||||
}
|
||||
|
||||
sub print_0212_table_index {
|
||||
my ($map_name, @maps) = @_;
|
||||
print MAP "static const uint16_t g${map_name}Index[] = {";
|
||||
print_jis_table_index(@maps);
|
||||
print MAP "\n};\n\n";
|
||||
}
|
||||
|
||||
|
||||
sub print_table {
|
||||
print MAP "static const uint16_t gJapaneseMap[] = {";
|
||||
for ( my $i = 0; $i < $table_next_count; $i += 94 ) {
|
||||
my $index = $i;
|
||||
print MAP "\n /* index $index */\n ";
|
||||
my $map_table = $table[$i];
|
||||
my $print_count = 1;
|
||||
for ( my $j = 0; $j < 94; $j++ ) {
|
||||
my $u = $map_table->[$j];
|
||||
if ( $u == 0 ) { $u = 0xfffd; }
|
||||
printf MAP " 0x%04X,", $u;
|
||||
if ( ++$print_count == 8 ) {
|
||||
print MAP "\n ";
|
||||
$print_count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
print MAP "\n};\n";
|
||||
}
|
||||
|
||||
|
||||
my %cp932 = read_sjis_map('CP932.TXT', 0, 1);
|
||||
my $jis0212 = read_0212_map('JIS0212.TXT', 0, 1);
|
||||
|
||||
%printed = ();
|
||||
write_fromu_map('jis0201-uf-unify', 'jis',
|
||||
$cp932{jis0201},
|
||||
);
|
||||
write_fromu_map('jis0208-uf-unify', 'jis',
|
||||
$cp932{jis0208},
|
||||
);
|
||||
|
||||
%printed = ();
|
||||
write_fromu_map('jis0208ext-uf-unify', 'jis',
|
||||
$cp932{jis0208undef},
|
||||
);
|
||||
|
||||
%printed = ();
|
||||
write_fromu_map('sjis-uf-unify', 'sjis',
|
||||
@cp932{'jis0201', 'jis0208', 'jis0208undef', 'sjis1undef', 'sjis2undef'},
|
||||
);
|
||||
|
||||
open MAP, ">japanese.map" or die $!;
|
||||
binmode MAP;
|
||||
|
||||
while (<DATA>) {
|
||||
if ( /^!/ ) { last; }
|
||||
print MAP;
|
||||
}
|
||||
print MAP "/* generated by jamap.pl @source_files */\n\n";
|
||||
print MAP <<EOM;
|
||||
// IE-compatible handling of undefined codepoints:
|
||||
// 0x80 --> U+0080
|
||||
// 0xa0 --> U+F8F0
|
||||
// 0xfd --> U+F8F1
|
||||
// 0xfe --> U+F8F2
|
||||
// 0xff --> U+F8F3
|
||||
EOM
|
||||
|
||||
print_table_index('CP932', @cp932{'jis0208', 'jis0208undef', 'sjis2undef'});
|
||||
print_0212_table_index('JIS0212', $jis0212);
|
||||
print_table();
|
||||
|
||||
close MAP or warn $!;
|
||||
|
||||
__DATA__
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
!
|
@ -1,62 +0,0 @@
|
||||
#!/user/local/bin/perl
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
sub jis0212tonum()
|
||||
{
|
||||
my($jis0212) = (@_);
|
||||
my($first,$second,$jnum);
|
||||
$first = hex(substr($jis0212,2,2));
|
||||
$second = hex(substr($jis0212,4,2));
|
||||
$jnum = (($first - 0x21) * 94);
|
||||
$jnum += $second - 0x21 ;
|
||||
return $jnum;
|
||||
}
|
||||
|
||||
@map = {};
|
||||
sub readtable()
|
||||
{
|
||||
open(JIS0212, "<JIS0212") || die "cannot open JIS0212";
|
||||
while(<JIS0212>)
|
||||
{
|
||||
if(! /^#/) {
|
||||
($j, $u, $r) = split(/\t/,$_);
|
||||
if(length($j) > 4)
|
||||
{
|
||||
$n = &jis0212tonum($j);
|
||||
$map{$n} = $u;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
## add eudc to $map here
|
||||
|
||||
sub printtable()
|
||||
{
|
||||
for($i=0;$i<94;$i++)
|
||||
{
|
||||
printf ( "/* 0x%2XXX */\n", ( $i + 0x21));
|
||||
printf " ";
|
||||
for($j=0;$j<94;$j++)
|
||||
{
|
||||
if("" == ($map{($i * 94 + $j)}))
|
||||
{
|
||||
print "0xFFFD,"
|
||||
}
|
||||
else
|
||||
{
|
||||
print $map{($i * 94 + $j)} . ",";
|
||||
}
|
||||
if( 7 == (($j + 1) % 8))
|
||||
{
|
||||
printf "/* 0x%2X%1X%1X*/\n", $i+0x21, 2+($j/16), (6==($j%16))?0:8;
|
||||
}
|
||||
}
|
||||
printf " /* 0x%2X%1X%1X*/\n", $i+0x21, 2+($j/16),(6==($j%16))?0:8;
|
||||
}
|
||||
}
|
||||
&readtable();
|
||||
&printtable();
|
||||
|
@ -1,323 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
$ID = "mkjpconv.pl @ARGV (Time-stamp: <2001-08-08 18:54:54 shom>)";
|
||||
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#
|
||||
# based on CP932.TXT from unicode.org
|
||||
# additional information from SHIFTJIS.TXT from unicode.org
|
||||
#
|
||||
# mapping policy:
|
||||
# jis0208 to unicode : based on CP932
|
||||
# unicode to jis0208 : based on CP932
|
||||
# the lowest code is used for dual mapping to jis0208
|
||||
# ascii region : based on ISO8859-1 ( same as CP932 ) IGNORE?
|
||||
# kana region : based on CP932
|
||||
# IBM Ext(0xFxxx>) : premap to NEC region ( mappable to JIS )
|
||||
|
||||
if ($ARGV[0] eq "") {
|
||||
print STDERR "usage: mkjpconv.pl SHIFTJIS.TXT <INFILE(ex:CP932.TXT)> [Another check]\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
open (SI, "SHIFTJIS.TXT") || die;
|
||||
while(<SI>) {
|
||||
($hi,$lo) = /^0x(..)?(..)\s/;
|
||||
if ($lo eq "") { next; }
|
||||
if ($hi eq "") { $hi=" " }
|
||||
$defined{"0x$hi$lo"} = 1;
|
||||
}
|
||||
close (SI);
|
||||
|
||||
shift(@ARGV);
|
||||
|
||||
$src = $ARGV[0];
|
||||
|
||||
$gendir = "$src.d";
|
||||
mkdir("$src.d");
|
||||
|
||||
$sufile = "sjis2ucs-$src.map";
|
||||
$usfile = "ucs2sjis-$src.map";
|
||||
$jufile = "jis2ucs-$src.map";
|
||||
$jeufile = "jisext2ucs-$src.map";
|
||||
$jaufile = "jisasc2ucs-$src.map";
|
||||
$jrkufile = "jiskana2ucs-$src.map";
|
||||
$ujfile = "ucs2jis-$src.map";
|
||||
$ujefile = "ucs2jisext-$src.map";
|
||||
$ujafile = "ucs2jisasc-$src.map";
|
||||
$ujrkfile = "ucs2jiskana-$src.map";
|
||||
$ibmnecfile = "$gendir/IBMNEC.map";
|
||||
$jdxfile = "$gendir/jis0208.ump";
|
||||
$jdxextfile = "jis0208ext.ump";
|
||||
$commentfile = "comment-$src.txt";
|
||||
|
||||
open (IN, "NPL.header") || die;
|
||||
while(<IN>) {
|
||||
$NPL .= $_;
|
||||
}
|
||||
close (IN);
|
||||
|
||||
foreach $infile ( @ARGV ) {
|
||||
|
||||
open (IN, "$infile") || die;
|
||||
|
||||
while(<IN>) {
|
||||
($from, $to, $seq, $dum, $comment) =
|
||||
/^\s*(0x[0-9a-fA-F]+)\s+(0x[0-9a-fA-F]+)(\+0x\S+)?(\s+\#\s*(\S.*))?$/;
|
||||
if ( $seq ne "" ) {
|
||||
print "Warning: Unicode Seq:\t$from\t$to$seq\t# $comment\n";
|
||||
}
|
||||
|
||||
if ( $from eq "" ) { next; }
|
||||
|
||||
if ( $from =~ /0x(..)$/ ) {
|
||||
$from = " 0x$1";
|
||||
}
|
||||
|
||||
if ( $fromto{$from} eq "" ) {
|
||||
push(@fromlist, $from);
|
||||
$fromto{$from} = $to;
|
||||
$commentbody{$from} = $comment;
|
||||
$commentseq{$from} = $seq
|
||||
} elsif ( $fromto{$from} ne $to ) {
|
||||
# another mappint SJIS:UCS2 = 1:N
|
||||
print "Another map in $infile\t$from\t$fromto{$from},$to\n";
|
||||
}
|
||||
|
||||
if ($checkanother==1) {
|
||||
next;
|
||||
}
|
||||
|
||||
if ( $tofrom{$to} eq "" ) {
|
||||
$tofrom{$to} = $from;
|
||||
} else {
|
||||
if ( $from !~ /$tofrom{$to}/ ){
|
||||
$tofrom{$to} = "$tofrom{$to},$from";
|
||||
}
|
||||
}
|
||||
|
||||
# print "$from $to\n";
|
||||
}
|
||||
|
||||
close (IN);
|
||||
|
||||
$checkanother == 1;
|
||||
}
|
||||
|
||||
open (COMMENT, ">$commentfile") || die;
|
||||
foreach $from (sort(@fromlist)) {
|
||||
print COMMENT "$from\t$fromto{$from}$commentseq{$from}\t$commentbody{$from}\n";
|
||||
}
|
||||
close (COMMENT);
|
||||
|
||||
|
||||
open(SU, ">$sufile") || die;
|
||||
open(US, ">$usfile") || die;
|
||||
open(JU, ">$jufile") || die;
|
||||
open(JEU, ">$jeufile") || die;
|
||||
open(JAU, ">$jaufile") || die;
|
||||
open(JRKU, ">$jrkufile") || die;
|
||||
open(UJ, ">$ujfile") || die;
|
||||
open(UJE, ">$ujefile") || die;
|
||||
open(UJA, ">$ujafile") || die;
|
||||
open(UJRK, ">$ujrkfile") || die;
|
||||
open(IBMNEC, ">$ibmnecfile") || die;
|
||||
|
||||
# print SU "/* generated from $src : SJIS UCS2 */\n";
|
||||
# print US "/* generated from $src : UCS2 SJIS */\n";
|
||||
print "Generated from $src\n";
|
||||
print "Command: mkjpconv.pl @ARGV\n";
|
||||
print "SJIS(JIS)\tUCS2\tSJIS\tS:U:S\tSJIS lower\n";
|
||||
|
||||
foreach $i (sort(@fromlist)) {
|
||||
|
||||
$ucs = "";
|
||||
|
||||
$sjis = $i;
|
||||
$sjis =~ s/\s+//;
|
||||
$jis = sjistojis($sjis);
|
||||
|
||||
print "$i($jis)\t$fromto{$i}\t$tofrom{$fromto{$i}}";
|
||||
$ucs = $fromto{$i};
|
||||
|
||||
if ( $i eq $tofrom{$fromto{$i}} ) {
|
||||
print "\t1:1:1";
|
||||
print "\t$i";
|
||||
} else {
|
||||
print "\t1:1:N";
|
||||
@tolist = split(/,/,$tofrom{$fromto{$i}});
|
||||
print "\t$tolist[0]";
|
||||
#$ucs = $tolist[0];
|
||||
if ( $sjis =~ /0xF[A-D]../ ) {
|
||||
$ibmnec{$sjis} = $tolist[0];
|
||||
#print IBMNEC "$sjis\t$tolist[0]\n";
|
||||
}
|
||||
|
||||
}
|
||||
print SU "$sjis\t$ucs\n";
|
||||
push(@uslist, "$ucs\t$sjis\n");
|
||||
|
||||
#print US "$ucs\t$sjis\n";
|
||||
if ( $jis ne "") {
|
||||
#if ($sjis =~ /^0x87../ || $sjis =~ /^0xED../ ) {
|
||||
# cp932 ext
|
||||
if ($sjis =~ /0x..../ && $defined{$sjis} != 1) {
|
||||
# jis not define
|
||||
print JEU "$jis\t$ucs\n";
|
||||
push(@ujelist, "$ucs\t$jis\n");
|
||||
$jisextucs{$jis} = $ucs;
|
||||
} else {
|
||||
print JU "$jis\t$ucs\n";
|
||||
push(@ujlist, "$ucs\t$jis\n");
|
||||
$jisucs{$jis} = $ucs;
|
||||
}
|
||||
|
||||
#print UJ "$ucs\t$jis\n";
|
||||
} elsif ( $sjis =~ /\s*0x([8-9A-D].)/ ) {
|
||||
$code = $1;
|
||||
print JRKU "0x00$code\t$ucs\n";
|
||||
push(@ujrklist, "$ucs\t0x00$code\n");
|
||||
} elsif ( $sjis =~ /\s*0x([0-7].)/ ) {
|
||||
$code = $1;
|
||||
print JAU "0x00$code\t$ucs\n";
|
||||
push(@ujalist, "$ucs\t0x00$code\n");
|
||||
}
|
||||
#print "\t# $comment{$i}\n";
|
||||
print "\n";
|
||||
}
|
||||
|
||||
print US sort(@uslist);
|
||||
print UJ sort(@ujlist);
|
||||
print UJE sort(@ujelist);
|
||||
print UJA sort(@ujalist);
|
||||
print UJRK sort(@ujrklist);
|
||||
|
||||
# make ibmnec mapping
|
||||
|
||||
print IBMNEC $NPL;
|
||||
print IBMNEC "/* generated by $ID */\n";
|
||||
print IBMNEC "/* IBM ext codes to NEC sel (in CP932) */\n\n";
|
||||
|
||||
foreach $i (0xFA, 0xFB, 0xFC) {
|
||||
for ($j=( ($i==0xFA) ? 0x40 : 0x00 ); $j<=0xFF; $j++) {
|
||||
$ibm = sprintf("0x%02X%02X", $i, $j);
|
||||
$raw = substr($ibm, 2,6);
|
||||
if ("" == $ibmnec{$ibm}) {
|
||||
print IBMNEC "/* $raw:UNDEF */ 0, \n";
|
||||
} else {
|
||||
print IBMNEC "/* $raw */ $ibmnec{$ibm}, \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(IBMNEC);
|
||||
|
||||
# make jdx
|
||||
|
||||
open (JDX, ">$jdxfile") || die;
|
||||
|
||||
print JDX $NPL;
|
||||
print JDX "/* generated by $ID */\n";
|
||||
print JDX "/* JIS X 0208 (with CP932 ext) to Unicode mapping */\n";
|
||||
|
||||
for ($i=0; $i<94; $i++) {
|
||||
printf JDX "/* 0x%2XXX */\n", ($i+0x21);
|
||||
printf JDX " ";
|
||||
for ($j=0; $j<94; $j++) {
|
||||
$jis = sprintf("0x%02X%02X", ($i+0x21), $j+0x21);
|
||||
# get JIS
|
||||
$ucs = $jisucs{$jis};
|
||||
if ("" == $ucs) {
|
||||
# try CP932 ext
|
||||
# try jis ext
|
||||
$ucs = $jisextucs{$jis}
|
||||
}
|
||||
if ("" == $ucs) {
|
||||
# undefined
|
||||
print JDX "0xFFFD,";
|
||||
} else {
|
||||
print JDX "$ucs,";
|
||||
}
|
||||
if (7 == ( ($j+1) % 8 )) {
|
||||
printf JDX "/* 0x%2X%1X%1X*/\n", $i+0x21, 2+($j/16), (6==($j%16))?0:8;
|
||||
}
|
||||
}
|
||||
printf JDX " /* 0x%2X%1X%1X*/\n", $i+0x21, 2+($j/16), (6==($j%16))?0:8;
|
||||
}
|
||||
|
||||
close (JDX);
|
||||
|
||||
|
||||
close(SU);
|
||||
close(US);
|
||||
close(JU);
|
||||
close(JEU);
|
||||
close(JAU);
|
||||
close(JRKU);
|
||||
close(UJ);
|
||||
close(UJE);
|
||||
close(UJA);
|
||||
close(UJRK);
|
||||
|
||||
# generate uf files
|
||||
|
||||
sub genuf {
|
||||
my ($infile, $outfile) = @_;
|
||||
my $com = "cat $infile | ./umaptable -uf > $gendir/$outfile";
|
||||
print "Executing $com\n";
|
||||
system($com);
|
||||
}
|
||||
|
||||
genuf($sufile, "sjis.uf");
|
||||
genuf($jufile, "jis0208.uf");
|
||||
if ( $#ujelist > 0 ) {
|
||||
genuf($jeufile, "jis0208ext.uf");
|
||||
} else {
|
||||
print "Extension is not found. jis0208ext.uf is not generated.\n";
|
||||
}
|
||||
genuf("$jaufile $jrkufile", "jis0201.uf");
|
||||
# genuf($jaufile, "jis0201.uf");
|
||||
# genuf($jrkufile, "jis0201gl.uf");
|
||||
|
||||
|
||||
# generate test page
|
||||
|
||||
|
||||
exit;
|
||||
|
||||
sub sjistojis {
|
||||
my($sjis) = (@_);
|
||||
my($first,$second,$h, $l, $j0208);
|
||||
|
||||
if ( $sjis !~ /^0x....$/ ) {
|
||||
return "";
|
||||
}
|
||||
|
||||
$first = hex(substr($sjis,2,2));
|
||||
$second = hex(substr($sjis,4,2));
|
||||
$jnum=0;
|
||||
|
||||
if($first < 0xE0)
|
||||
{
|
||||
$jnum = ($first - 0x81) * ((0xfd - 0x80)+(0x7f - 0x40));
|
||||
} else {
|
||||
$jnum = ($first - 0xe0 + (0xa0-0x81)) * ((0xfd - 0x80)+(0x7f - 0x40));
|
||||
}
|
||||
if($second >= 0x80)
|
||||
{
|
||||
$jnum += $second - 0x80 + (0x7f-0x40);
|
||||
}
|
||||
else
|
||||
{
|
||||
$jnum += $second - 0x40;
|
||||
}
|
||||
if(($jnum / 94 ) < 94) {
|
||||
return sprintf "0x%02X%02X", (($jnum / 94) + 0x21), (($jnum % 94)+0x21);
|
||||
} else {
|
||||
#return sprintf "# 0x%02X%02X", (($jnum / 94) + 0x21), (($jnum % 94)+0x21);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
SimplePrograms([
|
||||
'umaptable',
|
||||
], ext='.c')
|
@ -1,675 +0,0 @@
|
||||
0x2121 0x3000 # IDEOGRAPHIC SPACE
|
||||
0x2122 0xFF0C # FULLWIDTH COMMA
|
||||
0x2123 0x3001 # IDEOGRAPHIC COMMA
|
||||
0x2124 0x3002 # IDEOGRAPHIC FULL STOP
|
||||
0x2125 0xFF0E # FULLWIDTH FULL STOP
|
||||
0x2126 0x30FB # KATAKANA MIDDLE DOT
|
||||
0x2127 0xFF1B # FULLWIDTH SEMICOLON
|
||||
0x2128 0xFF1A # FULLWIDTH COLON
|
||||
0x2129 0xFF1F # FULLWIDTH QUESTION MARK
|
||||
0x212A 0xFF01 # FULLWIDTH EXCLAMATION MARK
|
||||
0x212B 0xFE30 # PRESENTATION FORM FOR VERTICAL TWO DOT LEADER
|
||||
0x212C 0x2026 # HORIZONTAL ELLIPSIS
|
||||
0x212D 0x2025 # TWO DOT LEADER
|
||||
0x212E 0xFE50 # SMALL COMMA
|
||||
0x212F 0xFE51 # SMALL IDEOGRAPHIC COMMA
|
||||
0x2130 0xFE52 # SMALL FULL STOP
|
||||
0x2131 0x00B7 # MIDDLE DOT
|
||||
0x2132 0xFE54 # SMALL SEMICOLON
|
||||
0x2133 0xFE55 # SMALL COLON
|
||||
0x2134 0xFE56 # SMALL QUESTION MARK
|
||||
0x2135 0xFE57 # SMALL EXCLAMATION MARK
|
||||
0x2136 0xFE31 # PRESENTATION FORM FOR VERTICAL EM DASH
|
||||
0x2137 0x2014 # EM DASH
|
||||
0x2138 0xFE32 # PRESENTATION FORM FOR VERTICAL EN DASH
|
||||
0x2139 0x2013 # EN DASH
|
||||
0x213A 0xFE33
|
||||
0x213B 0x2574
|
||||
0x213C 0xFE34
|
||||
0x213D 0xFE4F
|
||||
0x213E 0xFF08 # FULLWIDTH LEFT PARENTHESIS
|
||||
0x213F 0xFF09 # FULLWIDTH RIGHT PARENTHESIS
|
||||
0x2140 0xFE35 # PRESENTATION FORM FOR VERTICAL LEFT PARENTHESIS
|
||||
0x2141 0xFE36 # PRESENTATION FORM FOR VERTICAL RIGHT PARENTHESIS
|
||||
0x2142 0xFF5B # FULLWIDTH LEFT CURLY BRACKET
|
||||
0x2143 0xFF5D # FULLWIDTH RIGHT CURLY BRACKET
|
||||
0x2144 0xFE37 # PRESENTATION FORM FOR VERTICAL LEFT CURLY BRACKET
|
||||
0x2145 0xFE38 # PRESENTATION FORM FOR VERTICAL RIGHT CURLY BRACKET
|
||||
0x2146 0x3014 # LEFT TORTOISE SHELL BRACKET
|
||||
0x2147 0x3015 # RIGHT TORTOISE SHELL BRACKET
|
||||
0x2148 0xFE39 # PRESENTATION FORM FOR VERTICAL LEFT TORTOISE SHELL BRACKET
|
||||
0x2149 0xFE3A # PRESENTATION FORM FOR VERTICAL RIGHT TORTOISE SHELL BRACKET
|
||||
0x214A 0x3010 # LEFT BLACK LENTICULAR BRACKET
|
||||
0x214B 0x3011 # RIGHT BLACK LENTICULAR BRACKET
|
||||
0x214C 0xFE3B # PRESENTATION FORM FOR VERTICAL LEFT BLACK LENTICULAR BRACKET
|
||||
0x214D 0xFE3C # PRESENTATION FORM FOR VERTICAL RIGHT BLACK LENTICULAR BRACKET
|
||||
0x214E 0x300A # LEFT DOUBLE ANGLE BRACKET
|
||||
0x214F 0x300B # RIGHT DOUBLE ANGLE BRACKET
|
||||
0x2150 0xFE3D # PRESENTATION FORM FOR VERTICAL LEFT DOUBLE ANGLE BRACKET
|
||||
0x2151 0xFE3E # PRESENTATION FORM FOR VERTICAL RIGHT DOUBLE ANGLE BRACKET
|
||||
0x2152 0x3008 # LEFT ANGLE BRACKET
|
||||
0x2153 0x3009 # RIGHT ANGLE BRACKET
|
||||
0x2154 0xFE3F # PRESENTATION FORM FOR VERTICAL LEFT ANGLE BRACKET
|
||||
0x2155 0xFE40 # PRESENTATION FORM FOR VERTICAL RIGHT ANGLE BRACKET
|
||||
0x2156 0x300C # LEFT CORNER BRACKET
|
||||
0x2157 0x300D # RIGHT CORNER BRACKET
|
||||
0x2158 0xFE41 # PRESENTATION FORM FOR VERTICAL LEFT CORNER BRACKET
|
||||
0x2159 0xFE42 # PRESENTATION FORM FOR VERTICAL RIGHT CORNER BRACKET
|
||||
0x215A 0x300E # LEFT WHITE CORNER BRACKET
|
||||
0x215B 0x300F # RIGHT WHITE CORNER BRACKET
|
||||
0x215C 0xFE43 # PRESENTATION FORM FOR VERTICAL LEFT WHITE CORNER BRACKET
|
||||
0x215D 0xFE44 # PRESENTATION FORM FOR VERTICAL RIGHT WHITE CORNER BRACKET
|
||||
0x215E 0xFE59 # SMALL LEFT PARENTHESIS
|
||||
0x215F 0xFE5A # SMALL RIGHT PARENTHESIS
|
||||
0x2160 0xFE5B # SMALL LEFT CURLY BRACKET
|
||||
0x2161 0xFE5C # SMALL RIGHT CURLY BRACKET
|
||||
0x2162 0xFE5D # SMALL LEFT TORTOISE SHELL BRACKET
|
||||
0x2163 0xFE5E # SMALL RIGHT TORTOISE SHELL BRACKET
|
||||
0x2164 0x2018 # LEFT SINGLE QUOTATION MARK
|
||||
0x2165 0x2019 # RIGHT SINGLE QUOTATION MARK
|
||||
0x2166 0x201C # LEFT DOUBLE QUOTATION MARK
|
||||
0x2167 0x201D # RIGHT DOUBLE QUOTATION MARK
|
||||
0x2168 0x301D # REVERSED DOUBLE PRIME QUOTATION MARK
|
||||
0x2169 0x301E # DOUBLE PRIME QUOTATION MARK
|
||||
0x216A 0x2032 # PRIME
|
||||
0x216B 0x2035 # REVERSED PRIME
|
||||
0x216C 0xFF03 # FULLWIDTH NUMBER SIGN
|
||||
0x216D 0xFF06 # FULLWIDTH AMPERSAND
|
||||
0x216E 0xFF0A # FULLWIDTH ASTERISK
|
||||
0x216F 0x203B # REFERENCE MARK
|
||||
0x2170 0x00A7 # SECTION SIGN
|
||||
0x2171 0x3003 # DITTO MARK
|
||||
0x2172 0x25CB # WHITE CIRCLE
|
||||
0x2173 0x25CF # BLACK CIRCLE
|
||||
0x2174 0x25B3 # WHITE UP-POINTING TRIANGLE
|
||||
0x2175 0x25B2 # BLACK UP-POINTING TRIANGLE
|
||||
0x2176 0x25CE # BULLSEYE
|
||||
0x2177 0x2606 # WHITE STAR
|
||||
0x2178 0x2605 # BLACK STAR
|
||||
0x2179 0x25C7 # WHITE DIAMOND
|
||||
0x217A 0x25C6 # BLACK DIAMOND
|
||||
0x217B 0x25A1 # WHITE SQUARE
|
||||
0x217C 0x25A0 # BLACK SQUARE
|
||||
0x217D 0x25BD # WHITE DOWN-POINTING TRIANGLE
|
||||
0x217E 0x25BC # BLACK DOWN-POINTING TRIANGLE
|
||||
0x2221 0x32A3 # CIRCLED IDEOGRAPH CORRECT
|
||||
0x2222 0x2105 # CARE OF
|
||||
0x2223 0x203E # OVERLINE
|
||||
0x2224 0xFFE3
|
||||
0x2225 0xFF3F # FULLWIDTH LOW LINE
|
||||
0x2226 0x02CD
|
||||
0x2227 0xFE49 # DASHED OVERLINE
|
||||
0x2228 0xFE4A # CENTRELINE OVERLINE
|
||||
0x2229 0xFE4D # DASHED LOW LINE
|
||||
0x222A 0xFE4E # CENTRELINE LOW LINE
|
||||
0x222B 0xFE4B # WAVY OVERLINE
|
||||
0x222C 0xFE4C # DOUBLE WAVY OVERLINE
|
||||
0x222D 0xFE5F # SMALL NUMBER SIGN
|
||||
0x222E 0xFE60 # SMALL AMPERSAND
|
||||
0x222F 0xFE61 # SMALL ASTERISK
|
||||
0x2230 0xFF0B # FULLWIDTH PLUS SIGN
|
||||
0x2231 0xFF0D # FULLWIDTH HYPHEN-MINUS
|
||||
0x2232 0x00D7 # MULTIPLICATION SIGN
|
||||
0x2233 0x00F7 # DIVISION SIGN
|
||||
0x2234 0x00B1 # PLUS-MINUS SIGN
|
||||
0x2235 0x221A # SQUARE ROOT
|
||||
0x2236 0xFF1C # FULLWIDTH LESS-THAN SIGN
|
||||
0x2237 0xFF1E # FULLWIDTH GREATER-THAN SIGN
|
||||
0x2238 0xFF1D # FULLWIDTH EQUALS SIGN
|
||||
0x2239 0x2266 # LESS-THAN OVER EQUAL TO
|
||||
0x223A 0x2267 # GREATER-THAN OVER EQUAL TO
|
||||
0x223B 0x2260 # NOT EQUAL TO
|
||||
0x223C 0x221E # INFINITY
|
||||
0x223D 0x2252 # APPROXIMATELY EQUAL TO OR THE IMAGE OF
|
||||
0x223E 0x2261 # IDENTICAL TO
|
||||
0x223F 0xFE62 # SMALL PLUS SIGN
|
||||
0x2240 0xFE63 # SMALL HYPHEN-MINUS
|
||||
0x2241 0xFE64 # SMALL LESS-THAN SIGN
|
||||
0x2242 0xFE66 # SMALL EQUALS SIGN
|
||||
0x2243 0xFE65 # SMALL GREATER-THAN SIGN
|
||||
0x2244 0x223C # TILDE OPERATOR
|
||||
0x2245 0x2229 # INTERSECTION
|
||||
0x2246 0x222A # UNION
|
||||
0x2247 0x22A5 # UP TACK
|
||||
0x2248 0x2220 # ANGLE
|
||||
0x2249 0x221F # RIGHT ANGLE
|
||||
0x224A 0x22BF # RIGHT TRIANGLE
|
||||
0x224B 0x33D2 # SQUARE LOG
|
||||
0x224C 0x33D1 # SQUARE LN
|
||||
0x224D 0x222B # INTEGRAL
|
||||
0x224E 0x222E # CONTOUR INTEGRAL
|
||||
0x224F 0x2235 # BECAUSE
|
||||
0x2250 0x2234 # THEREFORE
|
||||
0x2251 0x2640 # FEMALE SIGN
|
||||
0x2252 0x2642 # MALE SIGN
|
||||
0x2253 0x2641 # EARTH
|
||||
0x2254 0x2609 # SUN
|
||||
0x2255 0x2191 # UPWARDS ARROW
|
||||
0x2256 0x2193 # DOWNWARDS ARROW
|
||||
0x2257 0x2192 # RIGHTWARDS ARROW
|
||||
0x2258 0x2190 # LEFTWARDS ARROW
|
||||
0x2259 0x2196 # NORTH WEST ARROW
|
||||
0x225A 0x2197 # NORTH EAST ARROW
|
||||
0x225B 0x2199 # SOUTH WEST ARROW
|
||||
0x225C 0x2198 # SOUTH EAST ARROW
|
||||
0x225D 0x2016 # DOUBLE VERTICAL LINE
|
||||
0x225E 0xFF5C # FULLWIDTH VERTICAL LINE
|
||||
0x225F 0xFF0F # FULLWIDTH SOLIDUS
|
||||
0x2260 0xFF3C # FULLWIDTH REVERSE SOLIDUS
|
||||
0x2261 0x2215 # DIVISION SLASH
|
||||
0x2262 0xFE68 # SMALL REVERSE SOLIDUS
|
||||
0x2263 0xFF04 # FULLWIDTH DOLLAR SIGN
|
||||
0x2264 0xFFE5 # FULLWIDTH YEN SIGN
|
||||
0x2265 0x3012 # POSTAL MARK
|
||||
0x2266 0xFFE0 # FULLWIDTH CENT SIGN
|
||||
0x2267 0xFFE1 # FULLWIDTH POUND SIGN
|
||||
0x2268 0xFF05 # FULLWIDTH PERCENT SIGN
|
||||
0x2269 0xFF20 # FULLWIDTH COMMERCIAL AT
|
||||
0x226A 0x2103 # DEGREE CELSIUS
|
||||
0x226B 0x2109 # DEGREE FAHRENHEIT
|
||||
0x226C 0xFE69 # SMALL DOLLAR SIGN
|
||||
0x226D 0xFE6A # SMALL PERCENT SIGN
|
||||
0x226E 0xFE6B # SMALL COMMERCIAL AT
|
||||
0x226F 0x33D5 # SQUARE MIL
|
||||
0x2270 0x339C # SQUARE MM
|
||||
0x2271 0x339D # SQUARE CM
|
||||
0x2272 0x339E # SQUARE KM
|
||||
0x2273 0x33CE # SQUARE KM CAPITAL
|
||||
0x2274 0x33A1 # SQUARE M SQUARED
|
||||
0x2275 0x338E # SQUARE MG
|
||||
0x2276 0x338F # SQUARE KG
|
||||
0x2277 0x33C4 # SQUARE CC
|
||||
0x2278 0x00B0 # DEGREE SIGN
|
||||
0x2324 0x2581 # LOWER ONE EIGHTH BLOCK
|
||||
0x2325 0x2582 # LOWER ONE QUARTER BLOCK
|
||||
0x2326 0x2583 # LOWER THREE EIGHTHS BLOCK
|
||||
0x2327 0x2584 # LOWER HALF BLOCK
|
||||
0x2328 0x2585 # LOWER FIVE EIGHTHS BLOCK
|
||||
0x2329 0x2586 # LOWER THREE QUARTERS BLOCK
|
||||
0x232A 0x2587 # LOWER SEVEN EIGHTHS BLOCK
|
||||
0x232B 0x2588 # FULL BLOCK
|
||||
0x232C 0x258F # LEFT ONE EIGHTH BLOCK
|
||||
0x232D 0x258E # LEFT ONE QUARTER BLOCK
|
||||
0x232E 0x258D # LEFT THREE EIGHTHS BLOCK
|
||||
0x232F 0x258C # LEFT HALF BLOCK
|
||||
0x2330 0x258B # LEFT FIVE EIGHTHS BLOCK
|
||||
0x2331 0x258A # LEFT THREE QUARTERS BLOCK
|
||||
0x2332 0x2589 # LEFT SEVEN EIGHTHS BLOCK
|
||||
0x2333 0x253C # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
|
||||
0x2334 0x2534 # BOX DRAWINGS LIGHT UP AND HORIZONTAL
|
||||
0x2335 0x252C # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
|
||||
0x2336 0x2524 # BOX DRAWINGS LIGHT VERTICAL AND LEFT
|
||||
0x2337 0x251C # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
|
||||
0x2338 0x2594 # UPPER ONE EIGHTH BLOCK
|
||||
0x2339 0x2500 # BOX DRAWINGS LIGHT HORIZONTAL
|
||||
0x233A 0x2502 # BOX DRAWINGS LIGHT VERTICAL
|
||||
0x233B 0x2595 # RIGHT ONE EIGHTH BLOCK
|
||||
0x233C 0x250C # BOX DRAWINGS LIGHT DOWN AND RIGHT
|
||||
0x233D 0x2510 # BOX DRAWINGS LIGHT DOWN AND LEFT
|
||||
0x233E 0x2514 # BOX DRAWINGS LIGHT UP AND RIGHT
|
||||
0x233F 0x2518 # BOX DRAWINGS LIGHT UP AND LEFT
|
||||
0x2340 0x256D # BOX DRAWINGS LIGHT ARC DOWN AND RIGHT
|
||||
0x2341 0x256E # BOX DRAWINGS LIGHT ARC DOWN AND LEFT
|
||||
0x2342 0x2570 # BOX DRAWINGS LIGHT ARC UP AND RIGHT
|
||||
0x2343 0x256F # BOX DRAWINGS LIGHT ARC UP AND LEFT
|
||||
0x2344 0x2550 # BOX DRAWINGS DOUBLE HORIZONTAL
|
||||
0x2345 0x255E # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
|
||||
0x2346 0x256A # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
|
||||
0x2347 0x2561 # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
|
||||
0x2348 0x25E2 # BLACK LOWER RIGHT TRIANGLE
|
||||
0x2349 0x25E3 # BLACK LOWER LEFT TRIANGLE
|
||||
0x234A 0x25E5 # BLACK UPPER RIGHT TRIANGLE
|
||||
0x234B 0x25E4 # BLACK UPPER LEFT TRIANGLE
|
||||
0x234C 0x2571 # BOX DRAWINGS LIGHT DIAGONAL UPPER RIGHT TO LOWER LEFT
|
||||
0x234D 0x2572 # BOX DRAWINGS LIGHT DIAGONAL UPPER LEFT TO LOWER RIGHT
|
||||
0x234E 0x2573 # BOX DRAWINGS LIGHT DIAGONAL CROSS
|
||||
0x2421 0xFF10 # FULLWIDTH DIGIT ZERO
|
||||
0x2422 0xFF11 # FULLWIDTH DIGIT ONE
|
||||
0x2423 0xFF12 # FULLWIDTH DIGIT TWO
|
||||
0x2424 0xFF13 # FULLWIDTH DIGIT THREE
|
||||
0x2425 0xFF14 # FULLWIDTH DIGIT FOUR
|
||||
0x2426 0xFF15 # FULLWIDTH DIGIT FIVE
|
||||
0x2427 0xFF16 # FULLWIDTH DIGIT SIX
|
||||
0x2428 0xFF17 # FULLWIDTH DIGIT SEVEN
|
||||
0x2429 0xFF18 # FULLWIDTH DIGIT EIGHT
|
||||
0x242A 0xFF19 # FULLWIDTH DIGIT NINE
|
||||
0x242B 0x2160 # ROMAN NUMERAL ONE
|
||||
0x242C 0x2161 # ROMAN NUMERAL TWO
|
||||
0x242D 0x2162 # ROMAN NUMERAL THREE
|
||||
0x242E 0x2163 # ROMAN NUMERAL FOUR
|
||||
0x242F 0x2164 # ROMAN NUMERAL FIVE
|
||||
0x2430 0x2165 # ROMAN NUMERAL SIX
|
||||
0x2431 0x2166 # ROMAN NUMERAL SEVEN
|
||||
0x2432 0x2167 # ROMAN NUMERAL EIGHT
|
||||
0x2433 0x2168 # ROMAN NUMERAL NINE
|
||||
0x2434 0x2169 # ROMAN NUMERAL TEN
|
||||
0x2435 0x3021 # HANGZHOU NUMERAL ONE
|
||||
0x2436 0x3022 # HANGZHOU NUMERAL TWO
|
||||
0x2437 0x3023 # HANGZHOU NUMERAL THREE
|
||||
0x2438 0x3024 # HANGZHOU NUMERAL FOUR
|
||||
0x2439 0x3025 # HANGZHOU NUMERAL FIVE
|
||||
0x243A 0x3026 # HANGZHOU NUMERAL SIX
|
||||
0x243B 0x3027 # HANGZHOU NUMERAL SEVEN
|
||||
0x243C 0x3028 # HANGZHOU NUMERAL EIGHT
|
||||
0x243D 0x3029 # HANGZHOU NUMERAL NINE
|
||||
0x243E 0x3038
|
||||
0x243F 0x3039
|
||||
0x2440 0x303A
|
||||
0x2441 0xFF21 # FULLWIDTH LATIN CAPITAL LETTER A
|
||||
0x2442 0xFF22 # FULLWIDTH LATIN CAPITAL LETTER B
|
||||
0x2443 0xFF23 # FULLWIDTH LATIN CAPITAL LETTER C
|
||||
0x2444 0xFF24 # FULLWIDTH LATIN CAPITAL LETTER D
|
||||
0x2445 0xFF25 # FULLWIDTH LATIN CAPITAL LETTER E
|
||||
0x2446 0xFF26 # FULLWIDTH LATIN CAPITAL LETTER F
|
||||
0x2447 0xFF27 # FULLWIDTH LATIN CAPITAL LETTER G
|
||||
0x2448 0xFF28 # FULLWIDTH LATIN CAPITAL LETTER H
|
||||
0x2449 0xFF29 # FULLWIDTH LATIN CAPITAL LETTER I
|
||||
0x244A 0xFF2A # FULLWIDTH LATIN CAPITAL LETTER J
|
||||
0x244B 0xFF2B # FULLWIDTH LATIN CAPITAL LETTER K
|
||||
0x244C 0xFF2C # FULLWIDTH LATIN CAPITAL LETTER L
|
||||
0x244D 0xFF2D # FULLWIDTH LATIN CAPITAL LETTER M
|
||||
0x244E 0xFF2E # FULLWIDTH LATIN CAPITAL LETTER N
|
||||
0x244F 0xFF2F # FULLWIDTH LATIN CAPITAL LETTER O
|
||||
0x2450 0xFF30 # FULLWIDTH LATIN CAPITAL LETTER P
|
||||
0x2451 0xFF31 # FULLWIDTH LATIN CAPITAL LETTER Q
|
||||
0x2452 0xFF32 # FULLWIDTH LATIN CAPITAL LETTER R
|
||||
0x2453 0xFF33 # FULLWIDTH LATIN CAPITAL LETTER S
|
||||
0x2454 0xFF34 # FULLWIDTH LATIN CAPITAL LETTER T
|
||||
0x2455 0xFF35 # FULLWIDTH LATIN CAPITAL LETTER U
|
||||
0x2456 0xFF36 # FULLWIDTH LATIN CAPITAL LETTER V
|
||||
0x2457 0xFF37 # FULLWIDTH LATIN CAPITAL LETTER W
|
||||
0x2458 0xFF38 # FULLWIDTH LATIN CAPITAL LETTER X
|
||||
0x2459 0xFF39 # FULLWIDTH LATIN CAPITAL LETTER Y
|
||||
0x245A 0xFF3A # FULLWIDTH LATIN CAPITAL LETTER Z
|
||||
0x245B 0xFF41 # FULLWIDTH LATIN SMALL LETTER A
|
||||
0x245C 0xFF42 # FULLWIDTH LATIN SMALL LETTER B
|
||||
0x245D 0xFF43 # FULLWIDTH LATIN SMALL LETTER C
|
||||
0x245E 0xFF44 # FULLWIDTH LATIN SMALL LETTER D
|
||||
0x245F 0xFF45 # FULLWIDTH LATIN SMALL LETTER E
|
||||
0x2460 0xFF46 # FULLWIDTH LATIN SMALL LETTER F
|
||||
0x2461 0xFF47 # FULLWIDTH LATIN SMALL LETTER G
|
||||
0x2462 0xFF48 # FULLWIDTH LATIN SMALL LETTER H
|
||||
0x2463 0xFF49 # FULLWIDTH LATIN SMALL LETTER I
|
||||
0x2464 0xFF4A # FULLWIDTH LATIN SMALL LETTER J
|
||||
0x2465 0xFF4B # FULLWIDTH LATIN SMALL LETTER K
|
||||
0x2466 0xFF4C # FULLWIDTH LATIN SMALL LETTER L
|
||||
0x2467 0xFF4D # FULLWIDTH LATIN SMALL LETTER M
|
||||
0x2468 0xFF4E # FULLWIDTH LATIN SMALL LETTER N
|
||||
0x2469 0xFF4F # FULLWIDTH LATIN SMALL LETTER O
|
||||
0x246A 0xFF50 # FULLWIDTH LATIN SMALL LETTER P
|
||||
0x246B 0xFF51 # FULLWIDTH LATIN SMALL LETTER Q
|
||||
0x246C 0xFF52 # FULLWIDTH LATIN SMALL LETTER R
|
||||
0x246D 0xFF53 # FULLWIDTH LATIN SMALL LETTER S
|
||||
0x246E 0xFF54 # FULLWIDTH LATIN SMALL LETTER T
|
||||
0x246F 0xFF55 # FULLWIDTH LATIN SMALL LETTER U
|
||||
0x2470 0xFF56 # FULLWIDTH LATIN SMALL LETTER V
|
||||
0x2471 0xFF57 # FULLWIDTH LATIN SMALL LETTER W
|
||||
0x2472 0xFF58 # FULLWIDTH LATIN SMALL LETTER X
|
||||
0x2473 0xFF59 # FULLWIDTH LATIN SMALL LETTER Y
|
||||
0x2474 0xFF5A # FULLWIDTH LATIN SMALL LETTER Z
|
||||
0x2475 0x0391 # GREEK CAPITAL LETTER ALPHA
|
||||
0x2476 0x0392 # GREEK CAPITAL LETTER BETA
|
||||
0x2477 0x0393 # GREEK CAPITAL LETTER GAMMA
|
||||
0x2478 0x0394 # GREEK CAPITAL LETTER DELTA
|
||||
0x2479 0x0395 # GREEK CAPITAL LETTER EPSILON
|
||||
0x247A 0x0396 # GREEK CAPITAL LETTER ZETA
|
||||
0x247B 0x0397 # GREEK CAPITAL LETTER ETA
|
||||
0x247C 0x0398 # GREEK CAPITAL LETTER THETA
|
||||
0x247D 0x0399 # GREEK CAPITAL LETTER IOTA
|
||||
0x247E 0x039A # GREEK CAPITAL LETTER KAPPA
|
||||
0x2521 0x039B # GREEK CAPITAL LETTER LAMDA
|
||||
0x2522 0x039C # GREEK CAPITAL LETTER MU
|
||||
0x2523 0x039D # GREEK CAPITAL LETTER NU
|
||||
0x2524 0x039E # GREEK CAPITAL LETTER XI
|
||||
0x2525 0x039F # GREEK CAPITAL LETTER OMICRON
|
||||
0x2526 0x03A0 # GREEK CAPITAL LETTER PI
|
||||
0x2527 0x03A1 # GREEK CAPITAL LETTER RHO
|
||||
0x2528 0x03A3 # GREEK CAPITAL LETTER SIGMA
|
||||
0x2529 0x03A4 # GREEK CAPITAL LETTER TAU
|
||||
0x252A 0x03A5 # GREEK CAPITAL LETTER UPSILON
|
||||
0x252B 0x03A6 # GREEK CAPITAL LETTER PHI
|
||||
0x252C 0x03A7 # GREEK CAPITAL LETTER CHI
|
||||
0x252D 0x03A8 # GREEK CAPITAL LETTER PSI
|
||||
0x252E 0x03A9 # GREEK CAPITAL LETTER OMEGA
|
||||
0x252F 0x03B1 # GREEK SMALL LETTER ALPHA
|
||||
0x2530 0x03B2 # GREEK SMALL LETTER BETA
|
||||
0x2531 0x03B3 # GREEK SMALL LETTER GAMMA
|
||||
0x2532 0x03B4 # GREEK SMALL LETTER DELTA
|
||||
0x2533 0x03B5 # GREEK SMALL LETTER EPSILON
|
||||
0x2534 0x03B6 # GREEK SMALL LETTER ZETA
|
||||
0x2535 0x03B7 # GREEK SMALL LETTER ETA
|
||||
0x2536 0x03B8 # GREEK SMALL LETTER THETA
|
||||
0x2537 0x03B9 # GREEK SMALL LETTER IOTA
|
||||
0x2538 0x03BA # GREEK SMALL LETTER KAPPA
|
||||
0x2539 0x03BB # GREEK SMALL LETTER LAMDA
|
||||
0x253A 0x03BC # GREEK SMALL LETTER MU
|
||||
0x253B 0x03BD # GREEK SMALL LETTER NU
|
||||
0x253C 0x03BE # GREEK SMALL LETTER XI
|
||||
0x253D 0x03BF # GREEK SMALL LETTER OMICRON
|
||||
0x253E 0x03C0 # GREEK SMALL LETTER PI
|
||||
0x253F 0x03C1 # GREEK SMALL LETTER RHO
|
||||
0x2540 0x03C3 # GREEK SMALL LETTER SIGMA
|
||||
0x2541 0x03C4 # GREEK SMALL LETTER TAU
|
||||
0x2542 0x03C5 # GREEK SMALL LETTER UPSILON
|
||||
0x2543 0x03C6 # GREEK SMALL LETTER PHI
|
||||
0x2544 0x03C7 # GREEK SMALL LETTER CHI
|
||||
0x2545 0x03C8 # GREEK SMALL LETTER PSI
|
||||
0x2546 0x03C9 # GREEK SMALL LETTER OMEGA
|
||||
0x2547 0x3105 # BOPOMOFO LETTER B
|
||||
0x2548 0x3106 # BOPOMOFO LETTER P
|
||||
0x2549 0x3107 # BOPOMOFO LETTER M
|
||||
0x254A 0x3108 # BOPOMOFO LETTER F
|
||||
0x254B 0x3109 # BOPOMOFO LETTER D
|
||||
0x254C 0x310A # BOPOMOFO LETTER T
|
||||
0x254D 0x310B # BOPOMOFO LETTER N
|
||||
0x254E 0x310C # BOPOMOFO LETTER L
|
||||
0x254F 0x310D # BOPOMOFO LETTER G
|
||||
0x2550 0x310E # BOPOMOFO LETTER K
|
||||
0x2551 0x310F # BOPOMOFO LETTER H
|
||||
0x2552 0x3110 # BOPOMOFO LETTER J
|
||||
0x2553 0x3111 # BOPOMOFO LETTER Q
|
||||
0x2554 0x3112 # BOPOMOFO LETTER X
|
||||
0x2555 0x3113 # BOPOMOFO LETTER ZH
|
||||
0x2556 0x3114 # BOPOMOFO LETTER CH
|
||||
0x2557 0x3115 # BOPOMOFO LETTER SH
|
||||
0x2558 0x3116 # BOPOMOFO LETTER R
|
||||
0x2559 0x3117 # BOPOMOFO LETTER Z
|
||||
0x255A 0x3118 # BOPOMOFO LETTER C
|
||||
0x255B 0x3119 # BOPOMOFO LETTER S
|
||||
0x255C 0x311A # BOPOMOFO LETTER A
|
||||
0x255D 0x311B # BOPOMOFO LETTER O
|
||||
0x255E 0x311C # BOPOMOFO LETTER E
|
||||
0x255F 0x311D # BOPOMOFO LETTER EH
|
||||
0x2560 0x311E # BOPOMOFO LETTER AI
|
||||
0x2561 0x311F # BOPOMOFO LETTER EI
|
||||
0x2562 0x3120 # BOPOMOFO LETTER AU
|
||||
0x2563 0x3121 # BOPOMOFO LETTER OU
|
||||
0x2564 0x3122 # BOPOMOFO LETTER AN
|
||||
0x2565 0x3123 # BOPOMOFO LETTER EN
|
||||
0x2566 0x3124 # BOPOMOFO LETTER ANG
|
||||
0x2567 0x3125 # BOPOMOFO LETTER ENG
|
||||
0x2568 0x3126 # BOPOMOFO LETTER ER
|
||||
0x2569 0x3127 # BOPOMOFO LETTER I
|
||||
0x256A 0x3128 # BOPOMOFO LETTER U
|
||||
0x256B 0x3129 # BOPOMOFO LETTER IU
|
||||
0x256C 0x02D9 # DOT ABOVE
|
||||
0x256D 0x02C9 # MODIFIER LETTER MACRON
|
||||
0x256E 0x02CA # MODIFIER LETTER ACUTE ACCENT
|
||||
0x256F 0x02C7 # CARON
|
||||
0x2570 0x02CB # MODIFIER LETTER GRAVE ACCENT
|
||||
0x2621 0x2460 # CIRCLED DIGIT ONE
|
||||
0x2622 0x2461 # CIRCLED DIGIT TWO
|
||||
0x2623 0x2462 # CIRCLED DIGIT THREE
|
||||
0x2624 0x2463 # CIRCLED DIGIT FOUR
|
||||
0x2625 0x2464 # CIRCLED DIGIT FIVE
|
||||
0x2626 0x2465 # CIRCLED DIGIT SIX
|
||||
0x2627 0x2466 # CIRCLED DIGIT SEVEN
|
||||
0x2628 0x2467 # CIRCLED DIGIT EIGHT
|
||||
0x2629 0x2468 # CIRCLED DIGIT NINE
|
||||
0x262A 0x2469 # CIRCLED NUMBER TEN
|
||||
0x262B 0x2474 # PARENTHESIZED DIGIT ONE
|
||||
0x262C 0x2475 # PARENTHESIZED DIGIT TWO
|
||||
0x262D 0x2476 # PARENTHESIZED DIGIT THREE
|
||||
0x262E 0x2477 # PARENTHESIZED DIGIT FOUR
|
||||
0x262F 0x2478 # PARENTHESIZED DIGIT FIVE
|
||||
0x2630 0x2479 # PARENTHESIZED DIGIT SIX
|
||||
0x2631 0x247A # PARENTHESIZED DIGIT SEVEN
|
||||
0x2632 0x247B # PARENTHESIZED DIGIT EIGHT
|
||||
0x2633 0x247C # PARENTHESIZED DIGIT NINE
|
||||
0x2634 0x247D # PARENTHESIZED NUMBER TEN
|
||||
0x2635 0x2170 # SMALL ROMAN NUMERAL ONE
|
||||
0x2636 0x2171 # SMALL ROMAN NUMERAL TWO
|
||||
0x2637 0x2172 # SMALL ROMAN NUMERAL THREE
|
||||
0x2638 0x2173 # SMALL ROMAN NUMERAL FOUR
|
||||
0x2639 0x2174 # SMALL ROMAN NUMERAL FIVE
|
||||
0x263A 0x2175 # SMALL ROMAN NUMERAL SIX
|
||||
0x263B 0x2176 # SMALL ROMAN NUMERAL SEVEN
|
||||
0x263C 0x2177 # SMALL ROMAN NUMERAL EIGHT
|
||||
0x263D 0x2178 # SMALL ROMAN NUMERAL NINE
|
||||
0x263E 0x2179 # SMALL ROMAN NUMERAL TEN
|
||||
0x2721 0x2F00 # cjk radical
|
||||
0x2722 0x2F01 # cjk radical
|
||||
0x2723 0x2F02 # cjk radical
|
||||
0x2724 0x2F03 # cjk radical
|
||||
0x2725 0x2F04 # cjk radical
|
||||
0x2726 0x2F05 # cjk radical
|
||||
0x2727 0x2F06 # cjk radical
|
||||
0x2728 0x2F07 # cjk radical
|
||||
0x2729 0x2F08 # cjk radical
|
||||
0x272A 0x2F09 # cjk radical
|
||||
0x272B 0x2F0A # cjk radical
|
||||
0x272C 0x2F0B # cjk radical
|
||||
0x272D 0x2F0C # cjk radical
|
||||
0x272E 0x2F0D # cjk radical
|
||||
0x272F 0x2F0E # cjk radical
|
||||
0x2730 0x2F0F # cjk radical
|
||||
0x2731 0x2F10 # cjk radical
|
||||
0x2732 0x2F11 # cjk radical
|
||||
0x2733 0x2F12 # cjk radical
|
||||
0x2734 0x2F13 # cjk radical
|
||||
0x2735 0x2F14 # cjk radical
|
||||
0x2736 0x2F15 # cjk radical
|
||||
0x2737 0x2F16 # cjk radical
|
||||
0x2738 0x2F17 # cjk radical
|
||||
0x2739 0x2F18 # cjk radical
|
||||
0x273A 0x2F19 # cjk radical
|
||||
0x273B 0x2F1A # cjk radical
|
||||
0x273C 0x2F1B # cjk radical
|
||||
0x273D 0x2F1C # cjk radical
|
||||
0x273E 0x2F1D # cjk radical
|
||||
0x273F 0x2F1E # cjk radical
|
||||
0x2740 0x2F1F # cjk radical
|
||||
0x2741 0x2F20 # cjk radical
|
||||
0x2742 0x2F22 # cjk radical
|
||||
0x2743 0x2F23 # cjk radical
|
||||
0x2744 0x2F24 # cjk radical
|
||||
0x2745 0x2F25 # cjk radical
|
||||
0x2746 0x2F26 # cjk radical
|
||||
0x2747 0x2F27 # cjk radical
|
||||
0x2748 0x2F28 # cjk radical
|
||||
0x2749 0x2F29 # cjk radical
|
||||
0x274A 0x2F2A # cjk radical
|
||||
0x274B 0x2F2B # cjk radical
|
||||
0x274C 0x2F2C # cjk radical
|
||||
0x274D 0x2F2D # cjk radical
|
||||
0x274E 0x2F2E # cjk radical
|
||||
0x274F 0x2F2F # cjk radical
|
||||
0x2750 0x2F30 # cjk radical
|
||||
0x2751 0x2F31 # cjk radical
|
||||
0x2752 0x2F32 # cjk radical
|
||||
0x2753 0x2F33 # cjk radical
|
||||
0x2754 0x2F34 # cjk radical
|
||||
0x2755 0x2F35 # cjk radical
|
||||
0x2756 0x2F36 # cjk radical
|
||||
0x2757 0x2F37 # cjk radical
|
||||
0x2758 0x2F38 # cjk radical
|
||||
0x2759 0x2F39 # cjk radical
|
||||
0x275A 0x2F3A # cjk radical
|
||||
0x275B 0x2F3B # cjk radical
|
||||
0x275C 0x2F3C # cjk radical
|
||||
0x275D 0x2F3D # cjk radical
|
||||
0x275E 0x2F3E # cjk radical
|
||||
0x275F 0x2F3F # cjk radical
|
||||
0x2760 0x2F40 # cjk radical
|
||||
0x2761 0x2F41 # cjk radical
|
||||
0x2762 0x2F42 # cjk radical
|
||||
0x2763 0x2F43 # cjk radical
|
||||
0x2764 0x2F44 # cjk radical
|
||||
0x2765 0x2F45 # cjk radical
|
||||
0x2766 0x2F46 # cjk radical
|
||||
0x2767 0x2F47 # cjk radical
|
||||
0x2768 0x2F48 # cjk radical
|
||||
0x2769 0x2F49 # cjk radical
|
||||
0x276A 0x2F4A # cjk radical
|
||||
0x276B 0x2F4B # cjk radical
|
||||
0x276C 0x2F4C # cjk radical
|
||||
0x276D 0x2F4D # cjk radical
|
||||
0x276E 0x2F4E # cjk radical
|
||||
0x276F 0x2F4F # cjk radical
|
||||
0x2770 0x2F50 # cjk radical
|
||||
0x2771 0x2F51 # cjk radical
|
||||
0x2772 0x2F52 # cjk radical
|
||||
0x2773 0x2F53 # cjk radical
|
||||
0x2774 0x2F54 # cjk radical
|
||||
0x2775 0x2F55 # cjk radical
|
||||
0x2776 0x2F56 # cjk radical
|
||||
0x2777 0x2F57 # cjk radical
|
||||
0x2778 0x2F58 # cjk radical
|
||||
0x2779 0x2F59 # cjk radical
|
||||
0x277A 0x2F5A # cjk radical
|
||||
0x277B 0x2F5B # cjk radical
|
||||
0x277C 0x2F5C # cjk radical
|
||||
0x277D 0x2F5D # cjk radical
|
||||
0x277E 0x2F5E # cjk radical
|
||||
0x2821 0x2F5F # cjk radical
|
||||
0x2822 0x2F60 # cjk radical
|
||||
0x2823 0x2F61 # cjk radical
|
||||
0x2824 0x2F62 # cjk radical
|
||||
0x2825 0x2F63 # cjk radical
|
||||
0x2826 0x2F64 # cjk radical
|
||||
0x2827 0x2F65 # cjk radical
|
||||
0x2828 0x2F66 # cjk radical
|
||||
0x2829 0x2F67 # cjk radical
|
||||
0x282A 0x2F68 # cjk radical
|
||||
0x282B 0x2F69 # cjk radical
|
||||
0x282C 0x2F6A # cjk radical
|
||||
0x282D 0x2F6B # cjk radical
|
||||
0x282E 0x2F6C # cjk radical
|
||||
0x282F 0x2F6D # cjk radical
|
||||
0x2830 0x2F6E # cjk radical
|
||||
0x2831 0x2F6F # cjk radical
|
||||
0x2832 0x2F70 # cjk radical
|
||||
0x2833 0x2F71 # cjk radical
|
||||
0x2834 0x2F72 # cjk radical
|
||||
0x2835 0x2F73 # cjk radical
|
||||
0x2836 0x2F74 # cjk radical
|
||||
0x2837 0x2F75 # cjk radical
|
||||
0x2838 0x2F76 # cjk radical
|
||||
0x2839 0x2F77 # cjk radical
|
||||
0x283A 0x2F78 # cjk radical
|
||||
0x283B 0x2F79 # cjk radical
|
||||
0x283C 0x2F7A # cjk radical
|
||||
0x283D 0x2F7B # cjk radical
|
||||
0x283E 0x2F7C # cjk radical
|
||||
0x283F 0x2F7D # cjk radical
|
||||
0x2840 0x2F7E # cjk radical
|
||||
0x2841 0x2F7F # cjk radical
|
||||
0x2842 0x2F80 # cjk radical
|
||||
0x2843 0x2F81 # cjk radical
|
||||
0x2844 0x2F82 # cjk radical
|
||||
0x2845 0x2F83 # cjk radical
|
||||
0x2846 0x2F84 # cjk radical
|
||||
0x2847 0x2F85 # cjk radical
|
||||
0x2848 0x2F86 # cjk radical
|
||||
0x2849 0x2F87 # cjk radical
|
||||
0x284A 0x2F88 # cjk radical
|
||||
0x284B 0x2F89 # cjk radical
|
||||
0x284C 0x2F8A # cjk radical
|
||||
0x284D 0x2F8B # cjk radical
|
||||
0x284E 0x2F8C # cjk radical
|
||||
0x284F 0x2F8D # cjk radical
|
||||
0x2850 0x2F8E # cjk radical
|
||||
0x2851 0x2F8F # cjk radical
|
||||
0x2852 0x2F90 # cjk radical
|
||||
0x2853 0x2F91 # cjk radical
|
||||
0x2854 0x2F92 # cjk radical
|
||||
0x2855 0x2F93 # cjk radical
|
||||
0x2856 0x2F94 # cjk radical
|
||||
0x2857 0x2F95 # cjk radical
|
||||
0x2858 0x2F96 # cjk radical
|
||||
0x2859 0x2F97 # cjk radical
|
||||
0x285A 0x2F98 # cjk radical
|
||||
0x285B 0x2F99 # cjk radical
|
||||
0x285C 0x2F9A # cjk radical
|
||||
0x285D 0x2F9B # cjk radical
|
||||
0x285E 0x2F9C # cjk radical
|
||||
0x285F 0x2F9D # cjk radical
|
||||
0x2860 0x2F9E # cjk radical
|
||||
0x2861 0x2F9F # cjk radical
|
||||
0x2862 0x2FA0 # cjk radical
|
||||
0x2863 0x2FA1 # cjk radical
|
||||
0x2864 0x2FA2 # cjk radical
|
||||
0x2865 0x2FA3 # cjk radical
|
||||
0x2866 0x2FA4 # cjk radical
|
||||
0x2867 0x2FA5 # cjk radical
|
||||
0x2868 0x2FA6 # cjk radical
|
||||
0x2869 0x2FA7 # cjk radical
|
||||
0x286A 0x2FA8 # cjk radical
|
||||
0x286B 0x2FA9 # cjk radical
|
||||
0x286C 0x2FAA # cjk radical
|
||||
0x286D 0x2FAB # cjk radical
|
||||
0x286E 0x2FAC # cjk radical
|
||||
0x286F 0x2FAD # cjk radical
|
||||
0x2870 0x2FAE # cjk radical
|
||||
0x2871 0x2FAF # cjk radical
|
||||
0x2872 0x2FB0 # cjk radical
|
||||
0x2873 0x2FB1 # cjk radical
|
||||
0x2874 0x2FB2 # cjk radical
|
||||
0x2875 0x2FB3 # cjk radical
|
||||
0x2876 0x2FB4 # cjk radical
|
||||
0x2877 0x2FB5 # cjk radical
|
||||
0x2878 0x2FB6 # cjk radical
|
||||
0x2879 0x2FB7 # cjk radical
|
||||
0x287A 0x2FB8 # cjk radical
|
||||
0x287B 0x2FB9 # cjk radical
|
||||
0x287C 0x2FBA # cjk radical
|
||||
0x287D 0x2FBB # cjk radical
|
||||
0x287E 0x2FBC # cjk radical
|
||||
0x2921 0x2FBD # cjk radical
|
||||
0x2922 0x2FBE # cjk radical
|
||||
0x2923 0x2FBF # cjk radical
|
||||
0x2924 0x2FC0 # cjk radical
|
||||
0x2925 0x2FC1 # cjk radical
|
||||
0x2926 0x2FC2 # cjk radical
|
||||
0x2927 0x2FC3 # cjk radical
|
||||
0x2928 0x2FC4 # cjk radical
|
||||
0x2929 0x2FC5 # cjk radical
|
||||
0x292A 0x2FC6 # cjk radical
|
||||
0x292B 0x2FC7 # cjk radical
|
||||
0x292C 0x2FC8 # cjk radical
|
||||
0x292D 0x2FC9 # cjk radical
|
||||
0x292E 0x2FCA # cjk radical
|
||||
0x292F 0x2FCB # cjk radical
|
||||
0x2930 0x2FCC # cjk radical
|
||||
0x2931 0x2FCD # cjk radical
|
||||
0x2932 0x2FCE # cjk radical
|
||||
0x2933 0x2FCF # cjk radical
|
||||
0x2934 0x2FD0 # cjk radical
|
||||
0x2935 0x2FD1 # cjk radical
|
||||
0x2936 0x2FD2 # cjk radical
|
||||
0x2937 0x2FD3 # cjk radical
|
||||
0x2938 0x2FD4 # cjk radical
|
||||
0x2939 0x2FD5 # cjk radical
|
||||
0x4221 0x2400 # SYMBOL FOR NULL
|
||||
0x4222 0x2401 # SYMBOL FOR START OF HEADING
|
||||
0x4223 0x2402 # SYMBOL FOR START OF TEXT
|
||||
0x4224 0x2403 # SYMBOL FOR END OF TEXT
|
||||
0x4225 0x2404 # SYMBOL FOR END OF TRANSMISSION
|
||||
0x4226 0x2405 # SYMBOL FOR ENQUIRY
|
||||
0x4227 0x2406 # SYMBOL FOR ACKNOWLEDGE
|
||||
0x4228 0x2407 # SYMBOL FOR BELL
|
||||
0x4229 0x2408 # SYMBOL FOR BACKSPACE
|
||||
0x422A 0x2409 # SYMBOL FOR HORIZONTAL TABULATION
|
||||
0x422B 0x240A # SYMBOL FOR LINE FEED
|
||||
0x422C 0x240B # SYMBOL FOR VERTICAL TABULATION
|
||||
0x422D 0x240C # SYMBOL FOR FORM FEED
|
||||
0x422E 0x240D # SYMBOL FOR CARRIAGE RETURN
|
||||
0x422F 0x240E # SYMBOL FOR SHIFT OUT
|
||||
0x4230 0x240F # SYMBOL FOR SHIFT IN
|
||||
0x4231 0x2410 # SYMBOL FOR DATA LINK ESCAPE
|
||||
0x4232 0x2411 # SYMBOL FOR DEVICE CONTROL ONE
|
||||
0x4233 0x2412 # SYMBOL FOR DEVICE CONTROL TWO
|
||||
0x4234 0x2413 # SYMBOL FOR DEVICE CONTROL THREE
|
||||
0x4235 0x2414 # SYMBOL FOR DEVICE CONTROL FOUR
|
||||
0x4236 0x2415 # SYMBOL FOR NEGATIVE ACKNOWLEDGE
|
||||
0x4237 0x2416 # SYMBOL FOR SYNCHRONOUS IDLE
|
||||
0x4238 0x2417 # SYMBOL FOR END OF TRANSMISSION BLOCK
|
||||
0x4239 0x2418 # SYMBOL FOR CANCEL
|
||||
0x423A 0x2419 # SYMBOL FOR END OF MEDIUM
|
||||
0x423B 0x241A # SYMBOL FOR SUBSTITUTE
|
||||
0x423C 0x241B # SYMBOL FOR ESCAPE
|
||||
0x423D 0x241C # SYMBOL FOR FILE SEPARATOR
|
||||
0x423E 0x241D # SYMBOL FOR GROUP SEPARATOR
|
||||
0x423F 0x241E # SYMBOL FOR RECORD SEPARATOR
|
||||
0x4240 0x241F # SYMBOL FOR UNIT SEPARATOR
|
||||
0x4241 0x2421 # SYMBOL FOR DELETE
|
@ -1,92 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# parse-mozilla-encoding-table.pl, version 0.6
|
||||
#
|
||||
# Script to deassemble existing Mozilla *.uf or *.ut files
|
||||
# back to source conversion tables.
|
||||
# by Anthony Fok <anthony@thizlinux.com>, ThizLinux Laboratory Ltd., 2002/11/27
|
||||
# License: GNU General Public License, version 2 or newer
|
||||
#
|
||||
# Used for verifying HKSCS-1999 hkscs.uf and hkscs.ut so that I can make
|
||||
# new ones for HKSCS-2001. This script is quick-and-dirty and not very
|
||||
# robust, so if the debug output of fromu/tou ever changes, this script
|
||||
# will need to be modified too. :-)
|
||||
|
||||
my %data = ();
|
||||
my $mappingPos = 0;
|
||||
my $filename = shift;
|
||||
my $mode;
|
||||
if ($filename =~ /\.(ut|uf)$/) {
|
||||
print $filename, "\n";
|
||||
$mode = $1;
|
||||
} else {
|
||||
die;
|
||||
}
|
||||
|
||||
open(INFILE, "<$filename") or die;
|
||||
|
||||
# Quick-and-dirty routine to populate %data
|
||||
while (<INFILE>) {
|
||||
if (/^Begin of Item ([[:xdigit:]]+)/) {
|
||||
die if defined($itemId) and hex($itemId) + 1 != hex($1);
|
||||
$itemId = $1;
|
||||
<INFILE> =~ /Format ([012])/ or die;
|
||||
$format = $1;
|
||||
<INFILE> =~ /srcBegin = ([[:xdigit:]]+)/ or die;
|
||||
$srcBegin = $1;
|
||||
|
||||
if ($format == 0) { # Range
|
||||
<INFILE> =~ /srcEnd = ([[:xdigit:]]+)/ or die;
|
||||
$srcEnd = $1;
|
||||
<INFILE> =~ /destBegin = ([[:xdigit:]]+)/ or die;
|
||||
$destBegin = $1;
|
||||
|
||||
for ($i = hex($srcBegin); $i <= hex($srcEnd); $i++) {
|
||||
$data{sprintf("%04X",$i)} = sprintf("%04X",
|
||||
hex($destBegin) + $i - hex($srcBegin));
|
||||
}
|
||||
|
||||
<INFILE> =~ /^End of Item $itemId\s*$/ or die;
|
||||
}
|
||||
elsif ($format == 1) { # Mapping
|
||||
<INFILE> =~ /srcEnd = ([[:xdigit:]]+)/ or die;
|
||||
$srcEnd = $1;
|
||||
<INFILE> =~ /mappingOffset = ([[:xdigit:]]+)/ or die;
|
||||
$mappingOffset = hex($1);
|
||||
die unless $mappingOffset == $mappingPos;
|
||||
<INFILE> =~ /Mapping =\s*$/ or die;
|
||||
until ($_ = <INFILE>, /^End of Item/) {
|
||||
chop;
|
||||
for $i (split ' ') {
|
||||
$key = sprintf("%04X", hex($srcBegin) - $mappingOffset + $mappingPos++);
|
||||
next if $i eq "FFFD";
|
||||
if (defined($data{$key})) {
|
||||
print "Error: doubly defined. $key was $data{$key}, and now $i.\n";
|
||||
} else {
|
||||
$data{$key} = $i;
|
||||
}
|
||||
}
|
||||
}
|
||||
die unless $mappingPos - $mappingOffset == hex($srcEnd) - hex($srcBegin) + 1;
|
||||
/^End of Item $itemId\s*$/ or die;
|
||||
}
|
||||
else { # Single ($format == 2)
|
||||
<INFILE> =~ /destBegin = ([[:xdigit:]]+)/ or die;
|
||||
$destBegin = $1;
|
||||
$data{$srcBegin} = $destBegin;
|
||||
<INFILE> =~ /^End of Item $itemId\s*$/ or die;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Generate conversion table
|
||||
for $key (sort keys %data) {
|
||||
if ($mode eq "ut") {
|
||||
print "0x$key\t0x$data{$key}\n";
|
||||
} elsif ($mode eq "uf") {
|
||||
print "0x$data{$key}\t0x$key\n";
|
||||
} else {
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
close INFILE;
|
@ -1,460 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define NOMAPPING 0xfffd
|
||||
|
||||
typedef struct {
|
||||
uint16_t srcBegin; /* 2 byte */
|
||||
uint16_t srcEnd; /* 2 byte */
|
||||
uint16_t destBegin; /* 2 byte */
|
||||
} uFormat0;
|
||||
|
||||
typedef struct {
|
||||
uint16_t srcBegin; /* 2 byte */
|
||||
uint16_t srcEnd; /* 2 byte */
|
||||
uint16_t mappingOffset; /* 2 byte */
|
||||
} uFormat1;
|
||||
|
||||
typedef struct {
|
||||
uint16_t srcBegin; /* 2 byte */
|
||||
uint16_t srcEnd; /* 2 byte -waste */
|
||||
uint16_t destBegin; /* 2 byte */
|
||||
} uFormat2;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
uFormat0 format0;
|
||||
uFormat1 format1;
|
||||
uFormat2 format2;
|
||||
} fmt;
|
||||
} uMapCell;
|
||||
|
||||
/* =================================================
|
||||
uTable
|
||||
================================================= */
|
||||
typedef struct {
|
||||
uint16_t itemOfList;
|
||||
uint16_t offsetToFormatArray;
|
||||
uint16_t offsetToMapCellArray;
|
||||
uint16_t offsetToMappingTable;
|
||||
uint16_t data[1];
|
||||
} uTable;
|
||||
|
||||
uint16_t umap[256][256];
|
||||
int bInitFromOrTo = 0;
|
||||
int bGenerateFromUnicodeTable = 0;
|
||||
|
||||
#define MAXCELLNUM 1000
|
||||
|
||||
static int numOfItem = 0;
|
||||
uMapCell cell[MAXCELLNUM];
|
||||
uint16_t format[MAXCELLNUM / 4];
|
||||
uint16_t mapping[256*256];
|
||||
static int mappinglen = 0;
|
||||
static int formatcount[4] = {0,0,0,0};
|
||||
|
||||
#define SetFormat(n,f) { format[(n >> 2)] |= ((f) << ((n & 0x0003) << 2)); formatcount[f]++; }
|
||||
#define GetFormat(n) ( format[(n >> 2)] >> ((n & 0x0003) << 2)) &0x00FF)
|
||||
#define MAPVALUE(i) (umap[(i >> 8) & 0xFF][(i) & 0xFF])
|
||||
|
||||
int FORMAT1CNST = 10 ;
|
||||
int FORMAT0CNST = 5 ;
|
||||
void initmaps()
|
||||
{
|
||||
int i,j;
|
||||
for(i=0;i<256;i++)
|
||||
for(j=0;j<256;j++)
|
||||
{
|
||||
umap[i][j]= NOMAPPING;
|
||||
}
|
||||
for(i=0;i<MAXCELLNUM / 4;i++)
|
||||
format[i]=0;
|
||||
}
|
||||
void SetMapValue(short u,short c)
|
||||
{
|
||||
if(NOMAPPING == MAPVALUE(u))
|
||||
MAPVALUE(u) = c & 0x0000FFFF;
|
||||
else {
|
||||
fprintf(stderr, "warning- duplicate mapping %x map to both %x and %x\n", u, MAPVALUE(u), c);
|
||||
}
|
||||
}
|
||||
void AddFormat2(uint16_t srcBegin)
|
||||
{
|
||||
uint16_t destBegin = MAPVALUE(srcBegin);
|
||||
printf("Begin of Item %04X\n",numOfItem);
|
||||
printf(" Format 2\n");
|
||||
printf(" srcBegin = %04X\n", srcBegin);
|
||||
printf(" destBegin = %04X\n", destBegin );
|
||||
SetFormat(numOfItem,2);
|
||||
cell[numOfItem].fmt.format2.srcBegin = srcBegin;
|
||||
cell[numOfItem].fmt.format2.srcEnd = 0;
|
||||
cell[numOfItem].fmt.format2.destBegin = destBegin;
|
||||
printf("End of Item %04X \n\n",numOfItem);
|
||||
numOfItem++;
|
||||
/* Unmark the umap */
|
||||
MAPVALUE(srcBegin) = NOMAPPING;
|
||||
}
|
||||
void AddFormat1(uint16_t srcBegin, uint16_t srcEnd)
|
||||
{
|
||||
uint16_t i;
|
||||
printf("Begin of Item %04X\n",numOfItem);
|
||||
printf(" Format 1\n");
|
||||
printf(" srcBegin = %04X\n", srcBegin);
|
||||
printf(" srcEnd = %04X\n", srcEnd );
|
||||
printf(" mappingOffset = %04X\n", mappinglen);
|
||||
printf(" Mapping = " );
|
||||
SetFormat(numOfItem,1);
|
||||
cell[numOfItem].fmt.format1.srcBegin = srcBegin;
|
||||
cell[numOfItem].fmt.format1.srcEnd = srcEnd;
|
||||
cell[numOfItem].fmt.format1.mappingOffset = mappinglen;
|
||||
for(i=srcBegin ; i <= srcEnd ; i++,mappinglen++)
|
||||
{
|
||||
if( ((i-srcBegin) % 8) == 0)
|
||||
printf("\n ");
|
||||
mapping[mappinglen]= MAPVALUE(i);
|
||||
printf("%04X ",(mapping[mappinglen] ));
|
||||
/* Unmark the umap */
|
||||
MAPVALUE(i) = NOMAPPING;
|
||||
}
|
||||
printf("\n");
|
||||
printf("End of Item %04X \n\n",numOfItem);
|
||||
numOfItem++;
|
||||
}
|
||||
void AddFormat0(uint16_t srcBegin, uint16_t srcEnd)
|
||||
{
|
||||
uint16_t i;
|
||||
uint16_t destBegin = MAPVALUE(srcBegin);
|
||||
printf("Begin of Item %04X\n",numOfItem);
|
||||
printf(" Format 0\n");
|
||||
printf(" srcBegin = %04X\n", srcBegin);
|
||||
printf(" srcEnd = %04X\n", srcEnd );
|
||||
printf(" destBegin = %04X\n", destBegin );
|
||||
SetFormat(numOfItem,0);
|
||||
cell[numOfItem].fmt.format0.srcBegin = srcBegin;
|
||||
cell[numOfItem].fmt.format0.srcEnd = srcEnd;
|
||||
cell[numOfItem].fmt.format0.destBegin = destBegin;
|
||||
for(i=srcBegin ; i <= srcEnd ; i++)
|
||||
{
|
||||
/* Unmark the umap */
|
||||
MAPVALUE(i) = NOMAPPING;
|
||||
}
|
||||
printf("End of Item %04X \n\n",numOfItem);
|
||||
numOfItem++;
|
||||
}
|
||||
void printnpl()
|
||||
{
|
||||
printf(
|
||||
"/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */\n"
|
||||
"/* This Source Code Form is subject to the terms of the Mozilla Public\n"
|
||||
" * License, v. 2.0. If a copy of the MPL was not distributed with this\n"
|
||||
" * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n");
|
||||
}
|
||||
void gentable()
|
||||
{
|
||||
/* OK! For now, we just use format 1 for each row */
|
||||
/* We need to chage this to use other format to save the space */
|
||||
uint16_t begin,end;
|
||||
uint16_t ss,gs,gp,state,gc;
|
||||
uint16_t diff, lastdiff;
|
||||
|
||||
printnpl();
|
||||
printf("/*========================================================\n");
|
||||
printf(" This is a Generated file. Please don't edit it.\n");
|
||||
printf("\n");
|
||||
printf(" The tool which used to generate this file is called umaptable.\n");
|
||||
printf(" You can find this tool under mozilla/intl/uconv/tools/umaptable.c.\n");
|
||||
|
||||
printf(" If you have any problems with this file, please file a bug\n");
|
||||
printf(" under the \"Internationalization\" component in\n");
|
||||
printf(" https://bugzilla.mozilla.org/enter_bug.cgi?product=Core\n");
|
||||
printf("\n");
|
||||
printf(" Table in Debug form \n");
|
||||
|
||||
for(begin = 0; MAPVALUE(begin) ==NOMAPPING; begin++)
|
||||
;
|
||||
for(end = 0xFFFF; MAPVALUE(end) ==NOMAPPING; end--)
|
||||
;
|
||||
if(end != begin)
|
||||
{
|
||||
lastdiff = MAPVALUE(begin) - begin;
|
||||
for(gp=begin+1,state = 0 ; gp<=end; gp++)
|
||||
{
|
||||
int input ;
|
||||
diff = MAPVALUE(gp) - gp;
|
||||
input = (diff == lastdiff);
|
||||
switch(state)
|
||||
{
|
||||
case 0:
|
||||
if(input)
|
||||
{
|
||||
state = 1;
|
||||
ss = gp -1;
|
||||
gc = 2;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(input)
|
||||
{
|
||||
if(gc++ >= FORMAT0CNST)
|
||||
{
|
||||
state = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state = 0;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if(input)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
AddFormat0(ss,gp-1);
|
||||
state = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
lastdiff = diff;
|
||||
}
|
||||
}
|
||||
if(state == 2)
|
||||
AddFormat0(ss,end);
|
||||
|
||||
for(;(MAPVALUE(begin) ==NOMAPPING) && (begin <= end); begin++)
|
||||
;
|
||||
if(begin <= end)
|
||||
{
|
||||
for(;(MAPVALUE(end)==NOMAPPING) && (end >= begin); end--)
|
||||
;
|
||||
for(ss=gp=begin,state = 0 ; gp<=end; gp++)
|
||||
{
|
||||
int input = (MAPVALUE(gp) == NOMAPPING);
|
||||
switch(state)
|
||||
{
|
||||
case 0:
|
||||
if(input)
|
||||
{
|
||||
gc = 1;
|
||||
gs = gp;
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if(input)
|
||||
{
|
||||
if(gc++ >= FORMAT1CNST)
|
||||
state = 2;
|
||||
}
|
||||
else
|
||||
state = 0;
|
||||
break;
|
||||
case 2:
|
||||
if(input)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
if(gs == (ss+1))
|
||||
AddFormat2(ss);
|
||||
else
|
||||
AddFormat1(ss ,gs-1);
|
||||
state = 0;
|
||||
ss = gp;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(end == ss)
|
||||
AddFormat2(ss );
|
||||
else
|
||||
AddFormat1(ss ,end );
|
||||
}
|
||||
printf("========================================================*/\n");
|
||||
}
|
||||
void writetable()
|
||||
{
|
||||
uint16_t i;
|
||||
uint16_t off1,off2,off3;
|
||||
uint16_t cur = 0;
|
||||
uint16_t formatitem = (((numOfItem)>>2) + 1);
|
||||
off1 = 4;
|
||||
off2 = off1 + formatitem ;
|
||||
off3 = off2 + numOfItem * sizeof(uMapCell) / sizeof(uint16_t);
|
||||
/* write itemOfList */
|
||||
printf("/* Offset=0x%04X ItemOfList */\n 0x%04X,\n", cur++, numOfItem);
|
||||
|
||||
/* write offsetToFormatArray */
|
||||
printf("/*-------------------------------------------------------*/\n");
|
||||
printf("/* Offset=0x%04X offsetToFormatArray */\n 0x%04X,\n", cur++,off1);
|
||||
|
||||
/* write offsetToMapCellArray */
|
||||
printf("/*-------------------------------------------------------*/\n");
|
||||
printf("/* Offset=0x%04X offsetToMapCellArray */ \n 0x%04X,\n", cur++,off2);
|
||||
|
||||
/* write offsetToMappingTable */
|
||||
printf("/*-------------------------------------------------------*/\n");
|
||||
printf("/* Offset=0x%04X offsetToMappingTable */ \n 0x%04X,\n", cur++,off3);
|
||||
|
||||
/* write FormatArray */
|
||||
printf("/*-------------------------------------------------------*/\n");
|
||||
printf("/* Offset=0x%04X Start of Format Array */ \n",cur);
|
||||
printf("/* Total of Format 0 : 0x%04X */\n"
|
||||
, formatcount[0]);
|
||||
printf("/* Total of Format 1 : 0x%04X */\n"
|
||||
, formatcount[1]);
|
||||
printf("/* Total of Format 2 : 0x%04X */\n"
|
||||
, formatcount[2]);
|
||||
printf("/* Total of Format 3 : 0x%04X */\n"
|
||||
, formatcount[3]);
|
||||
for(i=0;i<formatitem;i++,cur++)
|
||||
{
|
||||
if((i%8) == 0)
|
||||
printf("\n");
|
||||
printf("0x%04X, ",format[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
/* write MapCellArray */
|
||||
printf("/*-------------------------------------------------------*/\n");
|
||||
printf("/* Offset=0x%04X Start of MapCell Array */ \n",cur);
|
||||
for(i=0;i<numOfItem;i++,cur+=3)
|
||||
{
|
||||
printf("/* %04X */ 0x%04X, 0x%04X, 0x%04X, \n",
|
||||
i,
|
||||
cell[i].fmt.format0.srcBegin,
|
||||
cell[i].fmt.format0.srcEnd,
|
||||
cell[i].fmt.format0.destBegin
|
||||
);
|
||||
}
|
||||
|
||||
/* write MappingTable */
|
||||
printf("/*-------------------------------------------------------*/\n");
|
||||
printf("/* Offset=0x%04X Start of MappingTable */ \n",cur);
|
||||
for(i=0;i<mappinglen;i++,cur++)
|
||||
{
|
||||
if((i%8) == 0)
|
||||
printf("\n/* %04X */ ",i);
|
||||
printf("0x%04X, ",mapping[i] );
|
||||
}
|
||||
printf("\n");
|
||||
printf("/* End of table Total Length = 0x%04X * 2 */\n",cur);
|
||||
}
|
||||
|
||||
void usage()
|
||||
{
|
||||
fprintf(stderr, "please indicate what kind of mapping mapping table you want to generate:\n");
|
||||
fprintf(stderr, "\t-uf : generate *.uf (from unicode) table, or\n");
|
||||
fprintf(stderr, "\t-ut : generate *.ut (to unicode) table\n");
|
||||
}
|
||||
void parsearg(int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<argc;i++)
|
||||
{
|
||||
if(strncmp("-uf", argv[i],3) == 0) {
|
||||
if(! bInitFromOrTo) {
|
||||
bGenerateFromUnicodeTable = 1;
|
||||
bInitFromOrTo = 1;
|
||||
} else {
|
||||
usage();
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
if(strncmp("-ut", argv[i],3) == 0) {
|
||||
if(! bInitFromOrTo) {
|
||||
bGenerateFromUnicodeTable = 0;
|
||||
bInitFromOrTo = 1;
|
||||
} else {
|
||||
usage();
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
if((strncmp("-0", argv[i],2) == 0) && ((i+1) < argc))
|
||||
{
|
||||
int cnst0;
|
||||
if(sscanf(argv[i+1], "%d", &cnst0) == 1)
|
||||
{
|
||||
if(cnst0 > 0)
|
||||
{
|
||||
FORMAT0CNST = cnst0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "argc error !!!!\n");
|
||||
exit(-1);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if((strncmp("-1", argv[i],2) == 0) && ((i+1) < argc))
|
||||
{
|
||||
int cnst1;
|
||||
if(sscanf(argv[i+1], "%d", &cnst1) == 1)
|
||||
{
|
||||
if(cnst1 > 0)
|
||||
{
|
||||
FORMAT1CNST = cnst1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "argc error !!!!\n");
|
||||
exit(-1);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if(! bInitFromOrTo)
|
||||
{
|
||||
usage();
|
||||
exit(-1);
|
||||
}
|
||||
fprintf(stderr, "format 0 cnst = %d\n", FORMAT0CNST);
|
||||
fprintf(stderr, "format 1 cnst = %d\n", FORMAT1CNST);
|
||||
fprintf(stderr, "generate u%c table\n",
|
||||
bGenerateFromUnicodeTable ? 'f' : 't');
|
||||
}
|
||||
void getinput()
|
||||
{
|
||||
char buf[256];
|
||||
short c,u;
|
||||
for (; fgets(buf,sizeof(buf),stdin);)
|
||||
{
|
||||
if(buf[0]=='0' && buf[1] == 'x')
|
||||
{
|
||||
u=-1;
|
||||
sscanf(buf,"%hx %hx",&c,&u);
|
||||
if (u == -1 && 0x80 <= c && c <=0x9f)
|
||||
{
|
||||
u = c;
|
||||
}
|
||||
if (u != -1)
|
||||
{
|
||||
if(bGenerateFromUnicodeTable)
|
||||
SetMapValue(u, c);
|
||||
else
|
||||
SetMapValue(c, u);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
parsearg(argc, argv);
|
||||
initmaps();
|
||||
getinput();
|
||||
gentable();
|
||||
writetable();
|
||||
return 0;
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
#!/usr/local/bin/perl -w
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use IO::File;
|
||||
my(%tagtofilemap);
|
||||
$tagtofilemap{"kCNS1986-1" } = IO::File->new("|sort> cns1986p1.txt")
|
||||
or die "cannot open cns1986p1.txt";
|
||||
$tagtofilemap{"kCNS1986-2" } = IO::File->new("|sort> cns1986p2.txt")
|
||||
or die "cannot open cns1986p2.txt";
|
||||
$tagtofilemap{"kCNS1986-E" } = IO::File->new("|sort> cns1986p14.txt")
|
||||
or die "cannot open cns1986p14.txt";
|
||||
$tagtofilemap{"kCNS1992-1" } = IO::File->new("|sort> cns1992p1.txt")
|
||||
or die "cannot open cns1992p1.txt";
|
||||
$tagtofilemap{"kCNS1992-2" } = IO::File->new("|sort> cns1992p2.txt")
|
||||
or die "cannot open cns1992p2.txt";
|
||||
$tagtofilemap{"kCNS1992-3" } = IO::File->new("|sort> cns1992p3.txt")
|
||||
or die "cannot open cns1992p3.txt";
|
||||
$tagtofilemap{"kIRG_TSource-1" } = IO::File->new("|sort> cnsIRGTp1.txt")
|
||||
or die "cannot open cnsIRGTp1.txt";
|
||||
$tagtofilemap{"kIRG_TSource-2" } = IO::File->new("|sort> cnsIRGTp2.txt")
|
||||
or die "cannot open cnsIRGTp2.txt";
|
||||
$tagtofilemap{"kIRG_TSource-3" } = IO::File->new("|sort> cnsIRGTp3.txt")
|
||||
or die "cannot open cnsIRGTp3.txt";
|
||||
$tagtofilemap{"kIRG_TSource-4" } = IO::File->new("|sort> cnsIRGTp4.txt")
|
||||
or die "cannot open cnsIRGTp4.txt";
|
||||
$tagtofilemap{"kIRG_TSource-5" } = IO::File->new("|sort> cnsIRGTp5.txt")
|
||||
or die "cannot open cnsIRGTp5.txt";
|
||||
$tagtofilemap{"kIRG_TSource-6" } = IO::File->new("|sort> cnsIRGTp6.txt")
|
||||
or die "cannot open cnsIRGTp6.txt";
|
||||
$tagtofilemap{"kIRG_TSource-7" } = IO::File->new("|sort> cnsIRGTp7.txt")
|
||||
or die "cannot open cnsIRGTp7.txt";
|
||||
$tagtofilemap{"kIRG_TSource-F" } = IO::File->new("|sort> cnsIRGTp15.txt")
|
||||
or die "cannot open cnsIRGTp15.txt";
|
||||
$tagtofilemap{"kIRG_TSource-3ExtB" } = IO::File->new("|sort> cnsIRGTp3ExtB.txt")
|
||||
or die "cannot open cnsIRGTp3ExtB.txt";
|
||||
$tagtofilemap{"kIRG_TSource-4ExtB" } = IO::File->new("|sort> cnsIRGTp4ExtB.txt")
|
||||
or die "cannot open cnsIRGTp4ExtB.txt";
|
||||
$tagtofilemap{"kIRG_TSource-5ExtB" } = IO::File->new("|sort> cnsIRGTp5ExtB.txt")
|
||||
or die "cannot open cnsIRGTp5ExtB.txt";
|
||||
$tagtofilemap{"kIRG_TSource-6ExtB" } = IO::File->new("|sort> cnsIRGTp6ExtB.txt")
|
||||
or die "cannot open cnsIRGTp6ExtB.txt";
|
||||
$tagtofilemap{"kIRG_TSource-7ExtB" } = IO::File->new("|sort> cnsIRGTp7ExtB.txt")
|
||||
or die "cannot open cnsIRGTp7ExtB.txt";
|
||||
$tagtofilemap{"kIRG_TSource-FExtB" } = IO::File->new("|sort> cnsIRGTp15ExtB.txt")
|
||||
or die "cannot open cnsIRGTp15ExtB.txt";
|
||||
|
||||
$nonhan = IO::File->new("< nonhan.txt")
|
||||
or die "cannot open nonhan.txt";
|
||||
|
||||
while(defined($line = $nonhan->getline()))
|
||||
{
|
||||
$tagtofilemap{"kCNS1986-1"}->print($line);
|
||||
$tagtofilemap{"kCNS1992-1"}->print($line);
|
||||
$tagtofilemap{"kIRG_TSource-1"}->print($line);
|
||||
}
|
||||
|
||||
while(<STDIN>)
|
||||
{
|
||||
if(/^U/)
|
||||
{
|
||||
chop();
|
||||
($u,$tag,$value) = split(/\t/,$_);
|
||||
if($tag =~ m/(kCNS|kIRG_TSource)/)
|
||||
{
|
||||
($pnum, $cvalue) = split(/-/,$value);
|
||||
$tagkey = $tag . "-" . $pnum;
|
||||
if(length($u) > 6) {
|
||||
$tagkey .= "ExtB";
|
||||
}
|
||||
$fd = $tagtofilemap{$tagkey};
|
||||
if(length($u) > 6) {
|
||||
$mapping = substr($u,3,4); # trunkcate 0x2 from 0x2abcd
|
||||
} else {
|
||||
$mapping = substr($u,2,4); # trunkcate 0x from 0xabcd
|
||||
}
|
||||
$fd->print("0x" . $cvalue . "\t0x" . $mapping . "\t# <CJK>\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,98 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef __UCONV_TIL_H__
|
||||
#define __UCONV_TIL_H__
|
||||
|
||||
#include "prcpucfg.h"
|
||||
|
||||
|
||||
/*=====================================*/
|
||||
#define PACK(h,l) (int16_t)(( (h) << 8) | (l))
|
||||
|
||||
#if defined(IS_LITTLE_ENDIAN)
|
||||
#define ShiftInCell(sub,len,min,max) \
|
||||
PACK(len,sub), PACK(max,min)
|
||||
#define ShiftOutCell(sub,len,minh,minl,maxh,maxl) \
|
||||
PACK(len,sub), PACK(minl,minh), PACK(maxl,maxh)
|
||||
#else
|
||||
#define ShiftInCell(sub,len,min,max) \
|
||||
PACK(sub,len), PACK(min, max)
|
||||
#define ShiftOutCell(sub,len,minh,minl,maxh,maxl) \
|
||||
PACK(sub,len), PACK(minh,minl), PACK(maxh,maxl)
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
u1ByteCharset = 0,
|
||||
u2BytesCharset,
|
||||
u2BytesGRCharset,
|
||||
u2BytesGRPrefix8FCharset,
|
||||
u2BytesGRPrefix8EA2Charset,
|
||||
u2BytesGRPrefix8EA3Charset,
|
||||
u2BytesGRPrefix8EA4Charset,
|
||||
u2BytesGRPrefix8EA5Charset,
|
||||
u2BytesGRPrefix8EA6Charset,
|
||||
u2BytesGRPrefix8EA7Charset,
|
||||
uDecomposedHangulCharset,
|
||||
uJohabHangulCharset,
|
||||
uJohabSymbolCharset,
|
||||
u4BytesGB18030Charset,
|
||||
u2BytesGR128Charset,
|
||||
uMultibytesCharset,
|
||||
uNumOfCharsetType = uMultibytesCharset
|
||||
} uScanClassID;
|
||||
|
||||
typedef enum {
|
||||
u1ByteChar = 0,
|
||||
u2BytesChar,
|
||||
u2BytesGRChar,
|
||||
u1BytePrefix8EChar, /* Used by JIS0201 GR in EUC_JP */
|
||||
uNumOfCharType
|
||||
} uScanSubClassID;
|
||||
|
||||
typedef struct {
|
||||
unsigned char classID;
|
||||
unsigned char reserveLen;
|
||||
unsigned char shiftin_Min;
|
||||
unsigned char shiftin_Max;
|
||||
} uShiftInCell;
|
||||
|
||||
typedef struct {
|
||||
int16_t numOfItem;
|
||||
uShiftInCell shiftcell[1];
|
||||
} uShiftInTableMutable;
|
||||
|
||||
typedef const uShiftInTableMutable uShiftInTable;
|
||||
|
||||
typedef struct {
|
||||
unsigned char classID;
|
||||
unsigned char reserveLen;
|
||||
unsigned char shiftout_MinHB;
|
||||
unsigned char shiftout_MinLB;
|
||||
unsigned char shiftout_MaxHB;
|
||||
unsigned char shiftout_MaxLB;
|
||||
} uShiftOutCell;
|
||||
|
||||
typedef struct {
|
||||
int16_t numOfItem;
|
||||
uShiftOutCell shiftcell[1];
|
||||
} uShiftOutTableMutable;
|
||||
|
||||
typedef const uShiftOutTableMutable uShiftOutTable;
|
||||
|
||||
|
||||
/*=====================================*/
|
||||
|
||||
typedef struct {
|
||||
unsigned char min;
|
||||
unsigned char max;
|
||||
} uRange;
|
||||
|
||||
/*=====================================*/
|
||||
|
||||
typedef uint16_t* uMappingTableMutable;
|
||||
typedef const uint16_t uMappingTable;
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,537 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
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 <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 2FF0
|
||||
srcEnd = 2FFB
|
||||
destBegin = A98A
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = 4D13
|
||||
srcEnd = 4D19
|
||||
destBegin = FE98
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 0
|
||||
srcBegin = E766
|
||||
srcEnd = E76B
|
||||
destBegin = A2AB
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 0
|
||||
srcBegin = E772
|
||||
srcEnd = E77C
|
||||
destBegin = A4F4
|
||||
End of Item 0003
|
||||
|
||||
Begin of Item 0004
|
||||
Format 0
|
||||
srcBegin = E77D
|
||||
srcEnd = E784
|
||||
destBegin = A5F7
|
||||
End of Item 0004
|
||||
|
||||
Begin of Item 0005
|
||||
Format 0
|
||||
srcBegin = E785
|
||||
srcEnd = E78C
|
||||
destBegin = A6B9
|
||||
End of Item 0005
|
||||
|
||||
Begin of Item 0006
|
||||
Format 0
|
||||
srcBegin = E78D
|
||||
srcEnd = E793
|
||||
destBegin = A6D9
|
||||
End of Item 0006
|
||||
|
||||
Begin of Item 0007
|
||||
Format 0
|
||||
srcBegin = E797
|
||||
srcEnd = E79F
|
||||
destBegin = A6F6
|
||||
End of Item 0007
|
||||
|
||||
Begin of Item 0008
|
||||
Format 0
|
||||
srcBegin = E7A0
|
||||
srcEnd = E7AE
|
||||
destBegin = A7C2
|
||||
End of Item 0008
|
||||
|
||||
Begin of Item 0009
|
||||
Format 0
|
||||
srcBegin = E7AF
|
||||
srcEnd = E7BB
|
||||
destBegin = A7F2
|
||||
End of Item 0009
|
||||
|
||||
Begin of Item 000A
|
||||
Format 0
|
||||
srcBegin = E7BC
|
||||
srcEnd = E7C6
|
||||
destBegin = A896
|
||||
End of Item 000A
|
||||
|
||||
Begin of Item 000B
|
||||
Format 0
|
||||
srcBegin = E7CD
|
||||
srcEnd = E7E1
|
||||
destBegin = A8EA
|
||||
End of Item 000B
|
||||
|
||||
Begin of Item 000C
|
||||
Format 0
|
||||
srcBegin = E7F4
|
||||
srcEnd = E800
|
||||
destBegin = A997
|
||||
End of Item 000C
|
||||
|
||||
Begin of Item 000D
|
||||
Format 0
|
||||
srcBegin = E801
|
||||
srcEnd = E80F
|
||||
destBegin = A9F0
|
||||
End of Item 000D
|
||||
|
||||
Begin of Item 000E
|
||||
Format 2
|
||||
srcBegin = 01F9
|
||||
destBegin = A8BF
|
||||
End of Item 000E
|
||||
|
||||
Begin of Item 000F
|
||||
Format 2
|
||||
srcBegin = 20AC
|
||||
destBegin = A2E3
|
||||
End of Item 000F
|
||||
|
||||
Begin of Item 0010
|
||||
Format 1
|
||||
srcBegin = 2E81
|
||||
srcEnd = 2E97
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
FE50 FFFD FFFD FE54 FFFD FFFD FFFD FE57
|
||||
FFFD FFFD FE58 FE5D FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD FE5E
|
||||
End of Item 0010
|
||||
|
||||
Begin of Item 0011
|
||||
Format 1
|
||||
srcBegin = 2EA7
|
||||
srcEnd = 2EBB
|
||||
mappingOffset = 0017
|
||||
Mapping =
|
||||
FE6B FFFD FFFD FE6E FFFD FFFD FFFD FE71
|
||||
FFFD FFFD FFFD FFFD FE73 FFFD FFFD FE74
|
||||
FE75 FFFD FFFD FFFD FE79
|
||||
End of Item 0011
|
||||
|
||||
Begin of Item 0012
|
||||
Format 2
|
||||
srcBegin = 2ECA
|
||||
destBegin = FE84
|
||||
End of Item 0012
|
||||
|
||||
Begin of Item 0013
|
||||
Format 2
|
||||
srcBegin = 303E
|
||||
destBegin = A989
|
||||
End of Item 0013
|
||||
|
||||
Begin of Item 0014
|
||||
Format 2
|
||||
srcBegin = 3447
|
||||
destBegin = FE56
|
||||
End of Item 0014
|
||||
|
||||
Begin of Item 0015
|
||||
Format 2
|
||||
srcBegin = 3473
|
||||
destBegin = FE55
|
||||
End of Item 0015
|
||||
|
||||
Begin of Item 0016
|
||||
Format 2
|
||||
srcBegin = 359E
|
||||
destBegin = FE5A
|
||||
End of Item 0016
|
||||
|
||||
Begin of Item 0017
|
||||
Format 2
|
||||
srcBegin = 360E
|
||||
destBegin = FE5C
|
||||
End of Item 0017
|
||||
|
||||
Begin of Item 0018
|
||||
Format 2
|
||||
srcBegin = 361A
|
||||
destBegin = FE5B
|
||||
End of Item 0018
|
||||
|
||||
Begin of Item 0019
|
||||
Format 2
|
||||
srcBegin = 3918
|
||||
destBegin = FE60
|
||||
End of Item 0019
|
||||
|
||||
Begin of Item 001A
|
||||
Format 2
|
||||
srcBegin = 396E
|
||||
destBegin = FE5F
|
||||
End of Item 001A
|
||||
|
||||
Begin of Item 001B
|
||||
Format 1
|
||||
srcBegin = 39CF
|
||||
srcEnd = 39D0
|
||||
mappingOffset = 002C
|
||||
Mapping =
|
||||
FE62 FE65
|
||||
End of Item 001B
|
||||
|
||||
Begin of Item 001C
|
||||
Format 2
|
||||
srcBegin = 39DF
|
||||
destBegin = FE63
|
||||
End of Item 001C
|
||||
|
||||
Begin of Item 001D
|
||||
Format 2
|
||||
srcBegin = 3A73
|
||||
destBegin = FE64
|
||||
End of Item 001D
|
||||
|
||||
Begin of Item 001E
|
||||
Format 2
|
||||
srcBegin = 3B4E
|
||||
destBegin = FE68
|
||||
End of Item 001E
|
||||
|
||||
Begin of Item 001F
|
||||
Format 2
|
||||
srcBegin = 3C6E
|
||||
destBegin = FE69
|
||||
End of Item 001F
|
||||
|
||||
Begin of Item 0020
|
||||
Format 2
|
||||
srcBegin = 3CE0
|
||||
destBegin = FE6A
|
||||
End of Item 0020
|
||||
|
||||
Begin of Item 0021
|
||||
Format 2
|
||||
srcBegin = 4056
|
||||
destBegin = FE6F
|
||||
End of Item 0021
|
||||
|
||||
Begin of Item 0022
|
||||
Format 2
|
||||
srcBegin = 415F
|
||||
destBegin = FE70
|
||||
End of Item 0022
|
||||
|
||||
Begin of Item 0023
|
||||
Format 2
|
||||
srcBegin = 4337
|
||||
destBegin = FE72
|
||||
End of Item 0023
|
||||
|
||||
Begin of Item 0024
|
||||
Format 1
|
||||
srcBegin = 43AC
|
||||
srcEnd = 43B1
|
||||
mappingOffset = 002E
|
||||
Mapping =
|
||||
FE78 FFFD FFFD FFFD FFFD FE77
|
||||
End of Item 0024
|
||||
|
||||
Begin of Item 0025
|
||||
Format 2
|
||||
srcBegin = 43DD
|
||||
destBegin = FE7A
|
||||
End of Item 0025
|
||||
|
||||
Begin of Item 0026
|
||||
Format 2
|
||||
srcBegin = 44D6
|
||||
destBegin = FE7B
|
||||
End of Item 0026
|
||||
|
||||
Begin of Item 0027
|
||||
Format 2
|
||||
srcBegin = 464C
|
||||
destBegin = FE7D
|
||||
End of Item 0027
|
||||
|
||||
Begin of Item 0028
|
||||
Format 2
|
||||
srcBegin = 4661
|
||||
destBegin = FE7C
|
||||
End of Item 0028
|
||||
|
||||
Begin of Item 0029
|
||||
Format 1
|
||||
srcBegin = 4723
|
||||
srcEnd = 4729
|
||||
mappingOffset = 0034
|
||||
Mapping =
|
||||
FE80 FFFD FFFD FFFD FFFD FFFD FE81
|
||||
End of Item 0029
|
||||
|
||||
Begin of Item 002A
|
||||
Format 2
|
||||
srcBegin = 477C
|
||||
destBegin = FE82
|
||||
End of Item 002A
|
||||
|
||||
Begin of Item 002B
|
||||
Format 2
|
||||
srcBegin = 478D
|
||||
destBegin = FE83
|
||||
End of Item 002B
|
||||
|
||||
Begin of Item 002C
|
||||
Format 2
|
||||
srcBegin = 4947
|
||||
destBegin = FE85
|
||||
End of Item 002C
|
||||
|
||||
Begin of Item 002D
|
||||
Format 1
|
||||
srcBegin = 497A
|
||||
srcEnd = 4986
|
||||
mappingOffset = 003B
|
||||
Mapping =
|
||||
FE86 FFFD FFFD FE87 FFFD FFFD FFFD FFFD
|
||||
FE88 FE89 FFFD FE8A FE8B
|
||||
End of Item 002D
|
||||
|
||||
Begin of Item 002E
|
||||
Format 1
|
||||
srcBegin = 499B
|
||||
srcEnd = 499F
|
||||
mappingOffset = 0048
|
||||
Mapping =
|
||||
FE8D FFFD FFFD FFFD FE8C
|
||||
End of Item 002E
|
||||
|
||||
Begin of Item 002F
|
||||
Format 1
|
||||
srcBegin = 49B6
|
||||
srcEnd = 49B7
|
||||
mappingOffset = 004D
|
||||
Mapping =
|
||||
FE8F FE8E
|
||||
End of Item 002F
|
||||
|
||||
Begin of Item 0030
|
||||
Format 2
|
||||
srcBegin = 4C77
|
||||
destBegin = FE96
|
||||
End of Item 0030
|
||||
|
||||
Begin of Item 0031
|
||||
Format 1
|
||||
srcBegin = 4C9F
|
||||
srcEnd = 4CA3
|
||||
mappingOffset = 004F
|
||||
Mapping =
|
||||
FE93 FE94 FE95 FE97 FE92
|
||||
End of Item 0031
|
||||
|
||||
Begin of Item 0032
|
||||
Format 2
|
||||
srcBegin = 4DAE
|
||||
destBegin = FE9F
|
||||
End of Item 0032
|
||||
|
||||
Begin of Item 0033
|
||||
Format 1
|
||||
srcBegin = E76D
|
||||
srcEnd = E771
|
||||
mappingOffset = 0054
|
||||
Mapping =
|
||||
A2E4 A2EF A2F0 A2FD A2FE
|
||||
End of Item 0033
|
||||
|
||||
Begin of Item 0034
|
||||
Format 1
|
||||
srcBegin = E794
|
||||
srcEnd = E796
|
||||
mappingOffset = 0059
|
||||
Mapping =
|
||||
A6EC A6ED A6F3
|
||||
End of Item 0034
|
||||
|
||||
Begin of Item 0035
|
||||
Format 1
|
||||
srcBegin = E7C7
|
||||
srcEnd = E7CC
|
||||
mappingOffset = 005C
|
||||
Mapping =
|
||||
A8BC FFFD A8C1 A8C2 A8C3 A8C4
|
||||
End of Item 0035
|
||||
|
||||
Begin of Item 0036
|
||||
Format 1
|
||||
srcBegin = E7E2
|
||||
srcEnd = E7E6
|
||||
mappingOffset = 0062
|
||||
Mapping =
|
||||
A958 A95B A95D A95E A95F
|
||||
End of Item 0036
|
||||
|
||||
Begin of Item 0037
|
||||
Format 1
|
||||
srcBegin = E810
|
||||
srcEnd = E843
|
||||
mappingOffset = 0067
|
||||
Mapping =
|
||||
D7FA D7FB D7FC D7FD D7FE FFFD FE51 FE52
|
||||
FE53 FFFD FFFD FFFD FFFD FFFD FE59 FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD FE61 FFFD
|
||||
FFFD FFFD FFFD FE66 FE67 FFFD FFFD FFFD
|
||||
FFFD FE6C FE6D FFFD FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FE76 FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FE7E
|
||||
End of Item 0037
|
||||
|
||||
Begin of Item 0038
|
||||
Format 1
|
||||
srcBegin = E854
|
||||
srcEnd = E855
|
||||
mappingOffset = 009B
|
||||
Mapping =
|
||||
FE90 FE91
|
||||
End of Item 0038
|
||||
|
||||
Begin of Item 0039
|
||||
Format 2
|
||||
srcBegin = E864
|
||||
destBegin = FEA0
|
||||
End of Item 0039
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x003A,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0013,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x00C1,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x000E */
|
||||
/* Total of Format 1 : 0x000F */
|
||||
/* Total of Format 2 : 0x001D */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0000, 0x0000, 0x0000, 0x2200, 0x2211, 0x2222, 0x1222, 0x2222,
|
||||
0x2222, 0x2221, 0x2212, 0x1112, 0x1212, 0x1111, 0x0021,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0013 Start of MapCell Array */
|
||||
/* 0000 */ 0x2FF0, 0x2FFB, 0xA98A,
|
||||
/* 0001 */ 0x4D13, 0x4D19, 0xFE98,
|
||||
/* 0002 */ 0xE766, 0xE76B, 0xA2AB,
|
||||
/* 0003 */ 0xE772, 0xE77C, 0xA4F4,
|
||||
/* 0004 */ 0xE77D, 0xE784, 0xA5F7,
|
||||
/* 0005 */ 0xE785, 0xE78C, 0xA6B9,
|
||||
/* 0006 */ 0xE78D, 0xE793, 0xA6D9,
|
||||
/* 0007 */ 0xE797, 0xE79F, 0xA6F6,
|
||||
/* 0008 */ 0xE7A0, 0xE7AE, 0xA7C2,
|
||||
/* 0009 */ 0xE7AF, 0xE7BB, 0xA7F2,
|
||||
/* 000A */ 0xE7BC, 0xE7C6, 0xA896,
|
||||
/* 000B */ 0xE7CD, 0xE7E1, 0xA8EA,
|
||||
/* 000C */ 0xE7F4, 0xE800, 0xA997,
|
||||
/* 000D */ 0xE801, 0xE80F, 0xA9F0,
|
||||
/* 000E */ 0x01F9, 0x0000, 0xA8BF,
|
||||
/* 000F */ 0x20AC, 0x0000, 0xA2E3,
|
||||
/* 0010 */ 0x2E81, 0x2E97, 0x0000,
|
||||
/* 0011 */ 0x2EA7, 0x2EBB, 0x0017,
|
||||
/* 0012 */ 0x2ECA, 0x0000, 0xFE84,
|
||||
/* 0013 */ 0x303E, 0x0000, 0xA989,
|
||||
/* 0014 */ 0x3447, 0x0000, 0xFE56,
|
||||
/* 0015 */ 0x3473, 0x0000, 0xFE55,
|
||||
/* 0016 */ 0x359E, 0x0000, 0xFE5A,
|
||||
/* 0017 */ 0x360E, 0x0000, 0xFE5C,
|
||||
/* 0018 */ 0x361A, 0x0000, 0xFE5B,
|
||||
/* 0019 */ 0x3918, 0x0000, 0xFE60,
|
||||
/* 001A */ 0x396E, 0x0000, 0xFE5F,
|
||||
/* 001B */ 0x39CF, 0x39D0, 0x002C,
|
||||
/* 001C */ 0x39DF, 0x0000, 0xFE63,
|
||||
/* 001D */ 0x3A73, 0x0000, 0xFE64,
|
||||
/* 001E */ 0x3B4E, 0x0000, 0xFE68,
|
||||
/* 001F */ 0x3C6E, 0x0000, 0xFE69,
|
||||
/* 0020 */ 0x3CE0, 0x0000, 0xFE6A,
|
||||
/* 0021 */ 0x4056, 0x0000, 0xFE6F,
|
||||
/* 0022 */ 0x415F, 0x0000, 0xFE70,
|
||||
/* 0023 */ 0x4337, 0x0000, 0xFE72,
|
||||
/* 0024 */ 0x43AC, 0x43B1, 0x002E,
|
||||
/* 0025 */ 0x43DD, 0x0000, 0xFE7A,
|
||||
/* 0026 */ 0x44D6, 0x0000, 0xFE7B,
|
||||
/* 0027 */ 0x464C, 0x0000, 0xFE7D,
|
||||
/* 0028 */ 0x4661, 0x0000, 0xFE7C,
|
||||
/* 0029 */ 0x4723, 0x4729, 0x0034,
|
||||
/* 002A */ 0x477C, 0x0000, 0xFE82,
|
||||
/* 002B */ 0x478D, 0x0000, 0xFE83,
|
||||
/* 002C */ 0x4947, 0x0000, 0xFE85,
|
||||
/* 002D */ 0x497A, 0x4986, 0x003B,
|
||||
/* 002E */ 0x499B, 0x499F, 0x0048,
|
||||
/* 002F */ 0x49B6, 0x49B7, 0x004D,
|
||||
/* 0030 */ 0x4C77, 0x0000, 0xFE96,
|
||||
/* 0031 */ 0x4C9F, 0x4CA3, 0x004F,
|
||||
/* 0032 */ 0x4DAE, 0x0000, 0xFE9F,
|
||||
/* 0033 */ 0xE76D, 0xE771, 0x0054,
|
||||
/* 0034 */ 0xE794, 0xE796, 0x0059,
|
||||
/* 0035 */ 0xE7C7, 0xE7CC, 0x005C,
|
||||
/* 0036 */ 0xE7E2, 0xE7E6, 0x0062,
|
||||
/* 0037 */ 0xE810, 0xE843, 0x0067,
|
||||
/* 0038 */ 0xE854, 0xE855, 0x009B,
|
||||
/* 0039 */ 0xE864, 0x0000, 0xFEA0,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x00C1 Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0xFE50, 0xFFFD, 0xFFFD, 0xFE54, 0xFFFD, 0xFFFD, 0xFFFD, 0xFE57,
|
||||
/* 0008 */ 0xFFFD, 0xFFFD, 0xFE58, 0xFE5D, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0010 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFE5E, 0xFE6B,
|
||||
/* 0018 */ 0xFFFD, 0xFFFD, 0xFE6E, 0xFFFD, 0xFFFD, 0xFFFD, 0xFE71, 0xFFFD,
|
||||
/* 0020 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFE73, 0xFFFD, 0xFFFD, 0xFE74, 0xFE75,
|
||||
/* 0028 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFE79, 0xFE62, 0xFE65, 0xFE78, 0xFFFD,
|
||||
/* 0030 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFE77, 0xFE80, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0038 */ 0xFFFD, 0xFFFD, 0xFE81, 0xFE86, 0xFFFD, 0xFFFD, 0xFE87, 0xFFFD,
|
||||
/* 0040 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFE88, 0xFE89, 0xFFFD, 0xFE8A, 0xFE8B,
|
||||
/* 0048 */ 0xFE8D, 0xFFFD, 0xFFFD, 0xFFFD, 0xFE8C, 0xFE8F, 0xFE8E, 0xFE93,
|
||||
/* 0050 */ 0xFE94, 0xFE95, 0xFE97, 0xFE92, 0xA2E4, 0xA2EF, 0xA2F0, 0xA2FD,
|
||||
/* 0058 */ 0xA2FE, 0xA6EC, 0xA6ED, 0xA6F3, 0xA8BC, 0xFFFD, 0xA8C1, 0xA8C2,
|
||||
/* 0060 */ 0xA8C3, 0xA8C4, 0xA958, 0xA95B, 0xA95D, 0xA95E, 0xA95F, 0xD7FA,
|
||||
/* 0068 */ 0xD7FB, 0xD7FC, 0xD7FD, 0xD7FE, 0xFFFD, 0xFE51, 0xFE52, 0xFE53,
|
||||
/* 0070 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFE59, 0xFFFD, 0xFFFD,
|
||||
/* 0078 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFE61, 0xFFFD, 0xFFFD,
|
||||
/* 0080 */ 0xFFFD, 0xFFFD, 0xFE66, 0xFE67, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0088 */ 0xFE6C, 0xFE6D, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0090 */ 0xFFFD, 0xFFFD, 0xFE76, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0098 */ 0xFFFD, 0xFFFD, 0xFE7E, 0xFE90, 0xFE91,
|
||||
/* End of table Total Length = 0x015E * 2 */
|
@ -1,257 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
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 <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = A2AB
|
||||
srcEnd = A2B0
|
||||
destBegin = E766
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = A4F4
|
||||
srcEnd = A4FE
|
||||
destBegin = E772
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 0
|
||||
srcBegin = A5F7
|
||||
srcEnd = A5FE
|
||||
destBegin = E77D
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 0
|
||||
srcBegin = A6B9
|
||||
srcEnd = A6C0
|
||||
destBegin = E785
|
||||
End of Item 0003
|
||||
|
||||
Begin of Item 0004
|
||||
Format 0
|
||||
srcBegin = A6D9
|
||||
srcEnd = A6DF
|
||||
destBegin = E78D
|
||||
End of Item 0004
|
||||
|
||||
Begin of Item 0005
|
||||
Format 0
|
||||
srcBegin = A6F6
|
||||
srcEnd = A6FE
|
||||
destBegin = E797
|
||||
End of Item 0005
|
||||
|
||||
Begin of Item 0006
|
||||
Format 0
|
||||
srcBegin = A7C2
|
||||
srcEnd = A7D0
|
||||
destBegin = E7A0
|
||||
End of Item 0006
|
||||
|
||||
Begin of Item 0007
|
||||
Format 0
|
||||
srcBegin = A7F2
|
||||
srcEnd = A7FE
|
||||
destBegin = E7AF
|
||||
End of Item 0007
|
||||
|
||||
Begin of Item 0008
|
||||
Format 0
|
||||
srcBegin = A896
|
||||
srcEnd = A8A0
|
||||
destBegin = E7BC
|
||||
End of Item 0008
|
||||
|
||||
Begin of Item 0009
|
||||
Format 0
|
||||
srcBegin = A8EA
|
||||
srcEnd = A8FE
|
||||
destBegin = E7CD
|
||||
End of Item 0009
|
||||
|
||||
Begin of Item 000A
|
||||
Format 0
|
||||
srcBegin = A98A
|
||||
srcEnd = A995
|
||||
destBegin = 2FF0
|
||||
End of Item 000A
|
||||
|
||||
Begin of Item 000B
|
||||
Format 0
|
||||
srcBegin = A997
|
||||
srcEnd = A9A3
|
||||
destBegin = E7F4
|
||||
End of Item 000B
|
||||
|
||||
Begin of Item 000C
|
||||
Format 0
|
||||
srcBegin = A9F0
|
||||
srcEnd = A9FE
|
||||
destBegin = E801
|
||||
End of Item 000C
|
||||
|
||||
Begin of Item 000D
|
||||
Format 0
|
||||
srcBegin = FE98
|
||||
srcEnd = FE9E
|
||||
destBegin = 4D13
|
||||
End of Item 000D
|
||||
|
||||
Begin of Item 000E
|
||||
Format 1
|
||||
srcBegin = A2E3
|
||||
srcEnd = A2F0
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
20AC E76D FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD E76E E76F
|
||||
End of Item 000E
|
||||
|
||||
Begin of Item 000F
|
||||
Format 1
|
||||
srcBegin = A2FD
|
||||
srcEnd = A2FE
|
||||
mappingOffset = 000E
|
||||
Mapping =
|
||||
E770 E771
|
||||
End of Item 000F
|
||||
|
||||
Begin of Item 0010
|
||||
Format 1
|
||||
srcBegin = A6EC
|
||||
srcEnd = A6F3
|
||||
mappingOffset = 0010
|
||||
Mapping =
|
||||
E794 E795 FFFD FFFD FFFD FFFD FFFD E796
|
||||
End of Item 0010
|
||||
|
||||
Begin of Item 0011
|
||||
Format 1
|
||||
srcBegin = A8BC
|
||||
srcEnd = A8C4
|
||||
mappingOffset = 0018
|
||||
Mapping =
|
||||
E7C7 FFFD FFFD 01F9 FFFD E7C9 E7CA E7CB
|
||||
E7CC
|
||||
End of Item 0011
|
||||
|
||||
Begin of Item 0012
|
||||
Format 1
|
||||
srcBegin = A958
|
||||
srcEnd = A95F
|
||||
mappingOffset = 0021
|
||||
Mapping =
|
||||
E7E2 FFFD FFFD E7E3 FFFD E7E4 E7E5 E7E6
|
||||
End of Item 0012
|
||||
|
||||
Begin of Item 0013
|
||||
Format 2
|
||||
srcBegin = A989
|
||||
destBegin = 303E
|
||||
End of Item 0013
|
||||
|
||||
Begin of Item 0014
|
||||
Format 1
|
||||
srcBegin = D7FA
|
||||
srcEnd = D7FE
|
||||
mappingOffset = 0029
|
||||
Mapping =
|
||||
E810 E811 E812 E813 E814
|
||||
End of Item 0014
|
||||
|
||||
Begin of Item 0015
|
||||
Format 1
|
||||
srcBegin = FE50
|
||||
srcEnd = FEA0
|
||||
mappingOffset = 002E
|
||||
Mapping =
|
||||
2E81 E816 E817 E818 2E84 3473 3447 2E88
|
||||
2E8B E81E 359E 361A 360E 2E8C 2E97 396E
|
||||
3918 E826 39CF 39DF 3A73 39D0 E82B E82C
|
||||
3B4E 3C6E 3CE0 2EA7 E831 E832 2EAA 4056
|
||||
415F 2EAE 4337 2EB3 2EB6 2EB7 E83B 43B1
|
||||
43AC 2EBB 43DD 44D6 4661 464C E843 FFFD
|
||||
4723 4729 477C 478D 2ECA 4947 497A 497D
|
||||
4982 4983 4985 4986 499F 499B 49B7 49B6
|
||||
E854 E855 4CA3 4C9F 4CA0 4CA1 4C77 4CA2
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD FFFD 4DAE
|
||||
E864
|
||||
End of Item 0015
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0016,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x000A,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x004C,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x000E */
|
||||
/* Total of Format 1 : 0x0007 */
|
||||
/* Total of Format 2 : 0x0001 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0000, 0x0000, 0x0000, 0x1100, 0x2111, 0x0011,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x000A Start of MapCell Array */
|
||||
/* 0000 */ 0xA2AB, 0xA2B0, 0xE766,
|
||||
/* 0001 */ 0xA4F4, 0xA4FE, 0xE772,
|
||||
/* 0002 */ 0xA5F7, 0xA5FE, 0xE77D,
|
||||
/* 0003 */ 0xA6B9, 0xA6C0, 0xE785,
|
||||
/* 0004 */ 0xA6D9, 0xA6DF, 0xE78D,
|
||||
/* 0005 */ 0xA6F6, 0xA6FE, 0xE797,
|
||||
/* 0006 */ 0xA7C2, 0xA7D0, 0xE7A0,
|
||||
/* 0007 */ 0xA7F2, 0xA7FE, 0xE7AF,
|
||||
/* 0008 */ 0xA896, 0xA8A0, 0xE7BC,
|
||||
/* 0009 */ 0xA8EA, 0xA8FE, 0xE7CD,
|
||||
/* 000A */ 0xA98A, 0xA995, 0x2FF0,
|
||||
/* 000B */ 0xA997, 0xA9A3, 0xE7F4,
|
||||
/* 000C */ 0xA9F0, 0xA9FE, 0xE801,
|
||||
/* 000D */ 0xFE98, 0xFE9E, 0x4D13,
|
||||
/* 000E */ 0xA2E3, 0xA2F0, 0x0000,
|
||||
/* 000F */ 0xA2FD, 0xA2FE, 0x000E,
|
||||
/* 0010 */ 0xA6EC, 0xA6F3, 0x0010,
|
||||
/* 0011 */ 0xA8BC, 0xA8C4, 0x0018,
|
||||
/* 0012 */ 0xA958, 0xA95F, 0x0021,
|
||||
/* 0013 */ 0xA989, 0x0000, 0x303E,
|
||||
/* 0014 */ 0xD7FA, 0xD7FE, 0x0029,
|
||||
/* 0015 */ 0xFE50, 0xFEA0, 0x002E,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x004C Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x20AC, 0xE76D, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0008 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xE76E, 0xE76F, 0xE770, 0xE771,
|
||||
/* 0010 */ 0xE794, 0xE795, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xE796,
|
||||
/* 0018 */ 0xE7C7, 0xFFFD, 0xFFFD, 0x01F9, 0xFFFD, 0xE7C9, 0xE7CA, 0xE7CB,
|
||||
/* 0020 */ 0xE7CC, 0xE7E2, 0xFFFD, 0xFFFD, 0xE7E3, 0xFFFD, 0xE7E4, 0xE7E5,
|
||||
/* 0028 */ 0xE7E6, 0xE810, 0xE811, 0xE812, 0xE813, 0xE814, 0x2E81, 0xE816,
|
||||
/* 0030 */ 0xE817, 0xE818, 0x2E84, 0x3473, 0x3447, 0x2E88, 0x2E8B, 0xE81E,
|
||||
/* 0038 */ 0x359E, 0x361A, 0x360E, 0x2E8C, 0x2E97, 0x396E, 0x3918, 0xE826,
|
||||
/* 0040 */ 0x39CF, 0x39DF, 0x3A73, 0x39D0, 0xE82B, 0xE82C, 0x3B4E, 0x3C6E,
|
||||
/* 0048 */ 0x3CE0, 0x2EA7, 0xE831, 0xE832, 0x2EAA, 0x4056, 0x415F, 0x2EAE,
|
||||
/* 0050 */ 0x4337, 0x2EB3, 0x2EB6, 0x2EB7, 0xE83B, 0x43B1, 0x43AC, 0x2EBB,
|
||||
/* 0058 */ 0x43DD, 0x44D6, 0x4661, 0x464C, 0xE843, 0xFFFD, 0x4723, 0x4729,
|
||||
/* 0060 */ 0x477C, 0x478D, 0x2ECA, 0x4947, 0x497A, 0x497D, 0x4982, 0x4983,
|
||||
/* 0068 */ 0x4985, 0x4986, 0x499F, 0x499B, 0x49B7, 0x49B6, 0xE854, 0xE855,
|
||||
/* 0070 */ 0x4CA3, 0x4C9F, 0x4CA0, 0x4CA1, 0x4C77, 0x4CA2, 0xFFFD, 0xFFFD,
|
||||
/* 0078 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x4DAE, 0xE864,
|
||||
/* End of table Total Length = 0x00CB * 2 */
|
@ -1,55 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
// =======================================================================
|
||||
// Original Author: Yueheng Xu
|
||||
// email: yueheng.xu@intel.com
|
||||
// phone: (503)264-2248
|
||||
// Intel Corporation, Oregon, USA
|
||||
// Last Update: September 7, 1999
|
||||
// Revision History:
|
||||
// 09/07/1999 - initial version.
|
||||
// 09/28/1999 - changed leftbyte and rightbyte from char to unsigned char
|
||||
// in struct DByte
|
||||
// 04/10/1999 - changed leftbyte. rightbyte to uint8_t in struct DByte;
|
||||
// added table UnicodeToGBKTable[0x5200]
|
||||
//
|
||||
// 05/16/2000 - added gUnicodeToGBKTableInitialized flag for optimization
|
||||
// ======================================================================================
|
||||
// Table GBKToUnicode[] maps the GBK code to its unicode.
|
||||
// The mapping data of this GBK table is obtained from
|
||||
// ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP936.TXT
|
||||
// Frank Tang of Netscape wrote the original perl tool to re-align the
|
||||
// mapping data into an 8-item per line format ( i.e. file cp936map.txt ).
|
||||
//
|
||||
// The valid GBK charset range: left byte is [0x81, 0xfe], right byte are
|
||||
// [0x40, 0x7e] and [0x80, 0xfe]. But for the convenience of index
|
||||
// calculation, the table here has a single consecutive range of
|
||||
// [0x40, 0xfe] for the right byte. Those invalid chars whose right byte
|
||||
// is 0x7f will be mapped to undefined unicode 0xFFFF.
|
||||
//
|
||||
//
|
||||
// Table UnicodeToGBK[] maps the unicode to GBK code. To reduce memory usage, we
|
||||
// only do Unicode to GBK table mapping for unicode between 0x4E00 and 0xA000;
|
||||
// Others let converter to do search from table GBKToUnicode[]. If we want further
|
||||
// trade memory for performance, we can let more unicode to do table mapping to get
|
||||
// its GBK instead of searching table GBKToUnicode[].
|
||||
#ifndef _GBKU_H__
|
||||
#define _GBKU_H__
|
||||
|
||||
|
||||
#define UCS2_NO_MAPPING ((char16_t) 0xfffd)
|
||||
#define UINT8_IN_RANGE(a, b, c) \
|
||||
(((uint8_t)(a) <= (uint8_t)(b))&&((uint8_t)(b) <= (uint8_t)(c)))
|
||||
#define UNICHAR_IN_RANGE(a, b, c) \
|
||||
(((char16_t)(a) <= (char16_t)(b))&&((char16_t)(b) <= (char16_t)(c)))
|
||||
#define CAST_CHAR_TO_UNICHAR(a) ((char16_t)((unsigned char)(a)))
|
||||
#define CAST_UNICHAR_TO_CHAR(a) ((char)a)
|
||||
|
||||
#define IS_ASCII(a) (0==(0xff80 & (a)))
|
||||
#define IS_GBK_EURO(c) ((char)0x80 == (c))
|
||||
#define UCS2_EURO ((char16_t) 0x20ac)
|
||||
|
||||
#include "nsGBKConvUtil.h"
|
||||
|
||||
#endif /* _GBKU_H__ */
|
@ -1,47 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
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 <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 2
|
||||
srcBegin = 20AC
|
||||
destBegin = 0080
|
||||
End of Item 0000
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0001,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0005,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x0008,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0000 */
|
||||
/* Total of Format 1 : 0x0000 */
|
||||
/* Total of Format 2 : 0x0001 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0002,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0005 Start of MapCell Array */
|
||||
/* 0000 */ 0x20AC, 0x0000, 0x0080,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0008 Start of MappingTable */
|
||||
|
||||
/* End of table Total Length = 0x0008 * 2 */
|
@ -1,95 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsGBKConvUtil.h"
|
||||
#include "gbku.h"
|
||||
#include "nsDebug.h"
|
||||
#define MAX_GBK_LENGTH 24066 /* (0xfe-0x80)*(0xfe-0x3f) */
|
||||
//--------------------------------------------------------------------
|
||||
// nsGBKConvUtil
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
static const char16_t gGBKToUnicodeTable[MAX_GBK_LENGTH] = {
|
||||
#include "cp936map.h"
|
||||
};
|
||||
static const uint16_t gUnicodeToGBKTable[0xA000-0x4e00] = {
|
||||
#include "cp936invmap.h"
|
||||
};
|
||||
|
||||
bool nsGBKConvUtil::UnicodeToGBKChar(
|
||||
char16_t aChar, bool aToGL, char*
|
||||
aOutByte1, char* aOutByte2)
|
||||
{
|
||||
bool found=false;
|
||||
*aOutByte1 = *aOutByte2 = 0;
|
||||
if(UNICHAR_IN_RANGE(0xd800, aChar, 0xdfff))
|
||||
{
|
||||
// surrogate is not in here
|
||||
return false;
|
||||
}
|
||||
if(UNICHAR_IN_RANGE(0x4e00, aChar, 0x9FFF))
|
||||
{
|
||||
uint16_t item = gUnicodeToGBKTable[aChar - 0x4e00];
|
||||
if(item != 0)
|
||||
{
|
||||
*aOutByte1 = item >> 8;
|
||||
*aOutByte2 = item & 0x00FF;
|
||||
found = true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else if (aChar == UCS2_NO_MAPPING) {
|
||||
return false;
|
||||
} else {
|
||||
// ugly linear search
|
||||
for( int32_t i = 0; i < MAX_GBK_LENGTH; i++ )
|
||||
{
|
||||
if( aChar == gGBKToUnicodeTable[i])
|
||||
{
|
||||
*aOutByte1 = (i / 0x00BF + 0x0081) ;
|
||||
*aOutByte2 = (i % 0x00BF + 0x0040) ;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(! found)
|
||||
return false;
|
||||
|
||||
if(aToGL) {
|
||||
// to GL, we only return if it is in the range
|
||||
if(UINT8_IN_RANGE(0xA1, *aOutByte1, 0xFE) &&
|
||||
UINT8_IN_RANGE(0xA1, *aOutByte2, 0xFE))
|
||||
{
|
||||
// mask them to GL
|
||||
*aOutByte1 &= 0x7F;
|
||||
*aOutByte2 &= 0x7F;
|
||||
} else {
|
||||
// if it does not fit into 0xa1-0xfe 0xa1-0xfe range that mean
|
||||
// it is not a GB2312 character, we cannot map to GL
|
||||
*aOutByte1 = 0x00;
|
||||
*aOutByte2 = 0x00;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
char16_t nsGBKConvUtil::GBKCharToUnicode(char aByte1, char aByte2)
|
||||
{
|
||||
NS_ASSERTION(UINT8_IN_RANGE(0x81,aByte1, 0xFE), "first byte out of range");
|
||||
NS_ASSERTION(UINT8_IN_RANGE(0x40,aByte2, 0xFE), "second byte out of range");
|
||||
|
||||
uint8_t i1 = (uint8_t)aByte1;
|
||||
uint8_t i2 = (uint8_t)aByte2;
|
||||
uint16_t idx = (i1 - 0x0081) * 0x00bf + i2 - 0x0040 ;
|
||||
|
||||
NS_ASSERTION(idx < MAX_GBK_LENGTH, "ARB");
|
||||
// play it safe- add if statement here ot protect ARB
|
||||
// probably not necessary
|
||||
if(idx < MAX_GBK_LENGTH)
|
||||
return gGBKToUnicodeTable[ idx ];
|
||||
else
|
||||
return UCS2_NO_MAPPING;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef nsGBKConvUtil_h_
|
||||
#define nsGBKConvUtil_h_
|
||||
#include "nscore.h"
|
||||
class nsGBKConvUtil {
|
||||
public:
|
||||
nsGBKConvUtil() { }
|
||||
~nsGBKConvUtil() { }
|
||||
char16_t GBKCharToUnicode(char aByte1, char aByte2);
|
||||
bool UnicodeToGBKChar(char16_t aChar, bool aToGL,
|
||||
char* aOutByte1, char* aOutByte2);
|
||||
};
|
||||
#endif /* nsGBKConvUtil_h_ */
|
@ -1,244 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/**
|
||||
* A character set converter from GBK to Unicode.
|
||||
*
|
||||
*
|
||||
* @created 07/Sept/1999
|
||||
* @author Yueheng Xu, Yueheng.Xu@intel.com
|
||||
*/
|
||||
|
||||
#include "nsGBKToUnicode.h"
|
||||
#include "gbku.h"
|
||||
#include "nsUnicodeDecodeHelper.h"
|
||||
|
||||
static const uint16_t g_utGB18030Unique2Bytes[] = {
|
||||
#include "gb18030uniq2b.ut"
|
||||
};
|
||||
|
||||
static const uint16_t g_utGB18030Unique4Bytes[] = {
|
||||
#include "gb180304bytes.ut"
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsGB18030ToUnicode [implementation]
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsBufferDecoderSupport class [implementation]
|
||||
|
||||
#define LEGAL_GBK_MULTIBYTE_FIRST_BYTE(c) \
|
||||
(UINT8_IN_RANGE(0x81, (c), 0xFE))
|
||||
#define FIRST_BYTE_IS_SURROGATE(c) \
|
||||
(UINT8_IN_RANGE(0x90, (c), 0xFE))
|
||||
#define LEGAL_GBK_2BYTE_SECOND_BYTE(c) \
|
||||
(UINT8_IN_RANGE(0x40, (c), 0x7E)|| UINT8_IN_RANGE(0x80, (c), 0xFE))
|
||||
#define LEGAL_GBK_4BYTE_SECOND_BYTE(c) \
|
||||
(UINT8_IN_RANGE(0x30, (c), 0x39))
|
||||
#define LEGAL_GBK_4BYTE_THIRD_BYTE(c) \
|
||||
(UINT8_IN_RANGE(0x81, (c), 0xFE))
|
||||
#define LEGAL_GBK_4BYTE_FORTH_BYTE(c) \
|
||||
(UINT8_IN_RANGE(0x30, (c), 0x39))
|
||||
|
||||
NS_IMETHODIMP nsGB18030ToUnicode::ConvertNoBuff(const char* aSrc,
|
||||
int32_t * aSrcLength,
|
||||
char16_t *aDest,
|
||||
int32_t * aDestLength)
|
||||
{
|
||||
int32_t i=0;
|
||||
int32_t iSrcLength = (*aSrcLength);
|
||||
int32_t iDestlen = 0;
|
||||
nsresult rv=NS_OK;
|
||||
*aSrcLength = 0;
|
||||
|
||||
for (i=0;i<iSrcLength;i++)
|
||||
{
|
||||
if ( iDestlen >= (*aDestLength) )
|
||||
{
|
||||
rv = NS_OK_UDEC_MOREOUTPUT;
|
||||
break;
|
||||
}
|
||||
// The valid range for the 1st byte is [0x81,0xFE]
|
||||
if(LEGAL_GBK_MULTIBYTE_FIRST_BYTE(*aSrc))
|
||||
{
|
||||
if(i+1 >= iSrcLength)
|
||||
{
|
||||
rv = NS_OK_UDEC_MOREINPUT;
|
||||
break;
|
||||
}
|
||||
// To make sure, the second byte has to be checked as well.
|
||||
// In GBK, the second byte range is [0x40,0x7E] and [0x80,0XFE]
|
||||
if(LEGAL_GBK_2BYTE_SECOND_BYTE(aSrc[1]))
|
||||
{
|
||||
// Valid GBK code
|
||||
*aDest = mUtil.GBKCharToUnicode(aSrc[0], aSrc[1]);
|
||||
if(UCS2_NO_MAPPING == *aDest)
|
||||
{
|
||||
// We cannot map in the common mapping, let's call the
|
||||
// delegate 2 byte decoder to decode the gbk or gb18030 unique
|
||||
// 2 byte mapping
|
||||
if(! TryExtensionDecoder(aSrc, aDest))
|
||||
{
|
||||
*aDest = UCS2_NO_MAPPING;
|
||||
}
|
||||
}
|
||||
aSrc += 2;
|
||||
i++;
|
||||
}
|
||||
else if (LEGAL_GBK_4BYTE_SECOND_BYTE(aSrc[1]))
|
||||
{
|
||||
// from the first 2 bytes, it looks like a 4 byte GB18030
|
||||
if(i+3 >= iSrcLength) // make sure we got 4 bytes
|
||||
{
|
||||
rv = NS_OK_UDEC_MOREINPUT;
|
||||
break;
|
||||
}
|
||||
// 4 bytes patten
|
||||
// [0x81-0xfe][0x30-0x39][0x81-0xfe][0x30-0x39]
|
||||
// preset the
|
||||
|
||||
if (LEGAL_GBK_4BYTE_THIRD_BYTE(aSrc[2]) &&
|
||||
LEGAL_GBK_4BYTE_FORTH_BYTE(aSrc[3]))
|
||||
{
|
||||
if ( ! FIRST_BYTE_IS_SURROGATE(aSrc[0]))
|
||||
{
|
||||
// let's call the delegated 4 byte gb18030 converter to convert it
|
||||
if (!Try4BytesDecoder(aSrc, aDest)) {
|
||||
*aDest = UCS2_NO_MAPPING;
|
||||
}
|
||||
// Swapped character in GB18030-2005
|
||||
if (*aDest == 0x1E3F) {
|
||||
*aDest = 0xE7C7;
|
||||
}
|
||||
} else {
|
||||
// let's try supplement mapping
|
||||
if ( (iDestlen+1) < (*aDestLength) )
|
||||
{
|
||||
if(DecodeToSurrogate(aSrc, aDest))
|
||||
{
|
||||
// surrogte two char16_t
|
||||
iDestlen++;
|
||||
aDest++;
|
||||
} else {
|
||||
*aDest = UCS2_NO_MAPPING;
|
||||
}
|
||||
} else {
|
||||
if (*aDestLength < 2) {
|
||||
NS_ERROR("insufficient space in output buffer");
|
||||
*aDest = UCS2_NO_MAPPING;
|
||||
} else {
|
||||
rv = NS_OK_UDEC_MOREOUTPUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
aSrc += 4;
|
||||
i += 3;
|
||||
} else {
|
||||
*aDest = UCS2_NO_MAPPING;
|
||||
// If the third and fourth bytes are not in the legal ranges for
|
||||
// a four-byte sequnce, resynchronize on the second byte
|
||||
// (which we know is in the range of LEGAL_GBK_4BYTE_SECOND_BYTE,
|
||||
// 0x30-0x39)
|
||||
aSrc++;
|
||||
}
|
||||
}
|
||||
else if ((uint8_t) aSrc[0] == (uint8_t)0xA0 )
|
||||
{
|
||||
// stand-alone (not followed by a valid second byte) 0xA0 !
|
||||
// treat it as valid a la Netscape 4.x
|
||||
*aDest = CAST_CHAR_TO_UNICHAR(*aSrc);
|
||||
aSrc++;
|
||||
} else {
|
||||
// Invalid GBK code point (second byte should be 0x40 or higher)
|
||||
*aDest = UCS2_NO_MAPPING;
|
||||
aSrc++;
|
||||
}
|
||||
} else {
|
||||
if(IS_ASCII(*aSrc))
|
||||
{
|
||||
// The source is an ASCII
|
||||
*aDest = CAST_CHAR_TO_UNICHAR(*aSrc);
|
||||
aSrc++;
|
||||
} else {
|
||||
if(IS_GBK_EURO(*aSrc)) {
|
||||
*aDest = UCS2_EURO;
|
||||
} else {
|
||||
*aDest = UCS2_NO_MAPPING;
|
||||
}
|
||||
aSrc++;
|
||||
}
|
||||
}
|
||||
iDestlen++;
|
||||
aDest++;
|
||||
*aSrcLength = i+1;
|
||||
}
|
||||
*aDestLength = iDestlen;
|
||||
return rv;
|
||||
}
|
||||
|
||||
bool nsGB18030ToUnicode::DecodeToSurrogate(const char* aSrc, char16_t* aOut)
|
||||
{
|
||||
NS_ASSERTION(FIRST_BYTE_IS_SURROGATE(aSrc[0]), "illegal first byte");
|
||||
NS_ASSERTION(LEGAL_GBK_4BYTE_SECOND_BYTE(aSrc[1]), "illegal second byte");
|
||||
NS_ASSERTION(LEGAL_GBK_4BYTE_THIRD_BYTE(aSrc[2]), "illegal third byte");
|
||||
NS_ASSERTION(LEGAL_GBK_4BYTE_FORTH_BYTE(aSrc[3]), "illegal forth byte");
|
||||
if(! FIRST_BYTE_IS_SURROGATE(aSrc[0]))
|
||||
return false;
|
||||
if(! LEGAL_GBK_4BYTE_SECOND_BYTE(aSrc[1]))
|
||||
return false;
|
||||
if(! LEGAL_GBK_4BYTE_THIRD_BYTE(aSrc[2]))
|
||||
return false;
|
||||
if(! LEGAL_GBK_4BYTE_FORTH_BYTE(aSrc[3]))
|
||||
return false;
|
||||
|
||||
uint8_t a1 = (uint8_t) aSrc[0];
|
||||
uint8_t a2 = (uint8_t) aSrc[1];
|
||||
uint8_t a3 = (uint8_t) aSrc[2];
|
||||
uint8_t a4 = (uint8_t) aSrc[3];
|
||||
a1 -= (uint8_t)0x90;
|
||||
a2 -= (uint8_t)0x30;
|
||||
a3 -= (uint8_t)0x81;
|
||||
a4 -= (uint8_t)0x30;
|
||||
uint32_t idx = (((a1 * 10 + a2 ) * 126 + a3) * 10) + a4;
|
||||
// idx == ucs4Codepoint - 0x10000
|
||||
if (idx > 0x000FFFFF)
|
||||
return false;
|
||||
|
||||
*aOut++ = 0xD800 | (idx >> 10);
|
||||
*aOut = 0xDC00 | (0x000003FF & idx);
|
||||
|
||||
return true;
|
||||
}
|
||||
bool nsGB18030ToUnicode::TryExtensionDecoder(const char* aSrc, char16_t* aOut)
|
||||
{
|
||||
int32_t len = 2;
|
||||
int32_t dstlen = 1;
|
||||
nsresult res =
|
||||
nsUnicodeDecodeHelper::ConvertByTable(aSrc, &len, aOut, &dstlen,
|
||||
u2BytesCharset, nullptr,
|
||||
(uMappingTable*) &g_utGB18030Unique2Bytes,
|
||||
false);
|
||||
NS_ASSERTION(NS_FAILED(res) || ((len==2) && (dstlen == 1)),
|
||||
"some strange conversion result");
|
||||
// if we failed, we then just use the 0xfffd
|
||||
// therefore, we ignore the res here.
|
||||
return NS_SUCCEEDED(res);
|
||||
}
|
||||
|
||||
bool nsGB18030ToUnicode::Try4BytesDecoder(const char* aSrc, char16_t* aOut)
|
||||
{
|
||||
int32_t len = 4;
|
||||
int32_t dstlen = 1;
|
||||
nsresult res =
|
||||
nsUnicodeDecodeHelper::ConvertByTable(aSrc, &len, aOut, &dstlen,
|
||||
u4BytesGB18030Charset, nullptr,
|
||||
(uMappingTable*) &g_utGB18030Unique4Bytes,
|
||||
false);
|
||||
NS_ASSERTION(NS_FAILED(res) || ((len==4) && (dstlen == 1)),
|
||||
"some strange conversion result");
|
||||
// if we failed, we then just use the 0xfffd
|
||||
// therefore, we ignore the res here.
|
||||
return NS_SUCCEEDED(res);
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef nsGBKToUnicode_h___
|
||||
#define nsGBKToUnicode_h___
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIUnicodeDecoder.h"
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsGBKConvUtil.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsGB18030ToUnicode [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from GB18030 to Unicode.
|
||||
*
|
||||
*
|
||||
* @created 07/Sept/1999
|
||||
* @author Yueheng Xu, Yueheng.Xu@intel.com
|
||||
*/
|
||||
class nsGB18030ToUnicode : public nsBufferDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsGB18030ToUnicode() : nsBufferDecoderSupport(1)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsBufferDecoderSupport class [declaration]
|
||||
NS_IMETHOD ConvertNoBuff(const char* aSrc, int32_t * aSrcLength, char16_t *aDest, int32_t * aDestLength);
|
||||
|
||||
protected:
|
||||
nsGBKConvUtil mUtil;
|
||||
|
||||
bool TryExtensionDecoder(const char* aSrc, char16_t* aDest);
|
||||
bool Try4BytesDecoder(const char* aSrc, char16_t* aDest);
|
||||
bool DecodeToSurrogate(const char* aSrc, char16_t* aDest);
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsGBKToUnicode_h___ */
|
||||
|
@ -1,31 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUCvCnCID_h___
|
||||
#define nsUCvCnCID_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// Class ID for our GBKToUnicode charset converter
|
||||
// {BA61519E-1DFA-11d3-B3BF-00805F8A6670}
|
||||
#define NS_GBKTOUNICODE_CID \
|
||||
{ 0xba61519e, 0x1dfa, 0x11d3, {0xb3, 0xbf, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70}}
|
||||
|
||||
// Class ID for our UnicodeToGBK charset converter
|
||||
// {BA61519B-1DFA-11d3-B3BF-00805F8A6670}
|
||||
#define NS_UNICODETOGBK_CID \
|
||||
{ 0xba61519b, 0x1dfa, 0x11d3, {0xb3, 0xbf, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70}}
|
||||
|
||||
// Class ID for our UnicodeToGB18030 charset converter
|
||||
// {A59DA932-4091-11d5-A145-005004832142}
|
||||
#define NS_UNICODETOGB18030_CID \
|
||||
{ 0xa59da932, 0x4091, 0x11d5, { 0xa1, 0x45, 0x0, 0x50, 0x4, 0x83, 0x21, 0x42 } }
|
||||
|
||||
// Class ID for our GBKToUnicode charset converter
|
||||
// {A59DA935-4091-11d5-A145-005004832142}
|
||||
#define NS_GB18030TOUNICODE_CID \
|
||||
{ 0xa59da935, 0x4091, 0x11d5, { 0xa1, 0x45, 0x0, 0x50, 0x4, 0x83, 0x21, 0x42 } }
|
||||
|
||||
#endif /* nsUCvCnCID_h___ */
|
@ -1,256 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/**
|
||||
* A character set converter from Unicode to GBK.
|
||||
*
|
||||
*
|
||||
* @created 08/Sept/1999
|
||||
* @author Yueheng Xu, Yueheng.Xu@intel.com
|
||||
* Revision History
|
||||
* 04/Oct/1999. Yueheng Xu: used table gUnicodeToGBKTable[0x5200] to make
|
||||
* Unicode to GB mapping fast
|
||||
*/
|
||||
|
||||
#include "nsUnicodeToGBK.h"
|
||||
#include "gbku.h"
|
||||
#include "uconvutil.h"
|
||||
#include "nsCharTraits.h"
|
||||
#include "nsUnicodeEncodeHelper.h"
|
||||
|
||||
//-------------------------------------------------------------
|
||||
// Global table initialization function defined in gbku.h
|
||||
//-------------------------------------------------------------
|
||||
|
||||
static const uint16_t g_uf_gb18030_2bytes[] = {
|
||||
#include "gb18030uniq2b.uf"
|
||||
};
|
||||
static const uint16_t g_uf_gb18030_4bytes[] = {
|
||||
#include "gb180304bytes.uf"
|
||||
};
|
||||
static const uint16_t g_uf_gbk[] = {
|
||||
#include "gbkuniq.uf"
|
||||
};
|
||||
//-----------------------------------------------------------------------
|
||||
// nsUnicodeToGB18030
|
||||
//-----------------------------------------------------------------------
|
||||
nsresult nsUnicodeToGB18030::TryExtensionEncoder(char16_t aChar,
|
||||
char* aOut,
|
||||
int32_t *aOutLen)
|
||||
{
|
||||
int32_t len = 1;
|
||||
return nsUnicodeEncodeHelper::ConvertByTable(
|
||||
&aChar, &len, aOut, aOutLen, u2BytesCharset, nullptr,
|
||||
(uMappingTable*) &g_uf_gb18030_2bytes);
|
||||
}
|
||||
|
||||
nsresult nsUnicodeToGB18030::Try4BytesEncoder(char16_t aChar,
|
||||
char* aOut,
|
||||
int32_t *aOutLen)
|
||||
{
|
||||
int32_t len = 1;
|
||||
nsresult res = nsUnicodeEncodeHelper::ConvertByTable(
|
||||
&aChar, &len, aOut, aOutLen, u4BytesGB18030Charset, nullptr,
|
||||
(uMappingTable*) &g_uf_gb18030_4bytes);
|
||||
MOZ_ASSERT((res != NS_OK) || ((1 == len) && (4 == *aOutLen)),
|
||||
"unexpect conversion length");
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsUnicodeToGB18030::EncodeSurrogate(char16_t aSurrogateHigh,
|
||||
char16_t aSurrogateLow,
|
||||
char* aOut,
|
||||
int32_t aDestLength,
|
||||
int32_t aBufferLength)
|
||||
{
|
||||
if( NS_IS_HIGH_SURROGATE(aSurrogateHigh) &&
|
||||
NS_IS_LOW_SURROGATE(aSurrogateLow) )
|
||||
{
|
||||
// notice that idx does not include the 0x10000
|
||||
uint32_t idx = ((aSurrogateHigh - (char16_t)0xD800) << 10 ) |
|
||||
(aSurrogateLow - (char16_t) 0xDC00);
|
||||
|
||||
if (aDestLength + 4 > aBufferLength) {
|
||||
return NS_OK_UENC_MOREOUTPUT;
|
||||
}
|
||||
|
||||
unsigned char *out = (unsigned char*) aOut;
|
||||
// notice this is from 0x90 for supplementary planes
|
||||
out[0] = (idx / (10*126*10)) + 0x90;
|
||||
idx %= (10*126*10);
|
||||
out[1] = (idx / (10*126)) + 0x30;
|
||||
idx %= (10*126);
|
||||
out[2] = (idx / (10)) + 0x81;
|
||||
out[3] = (idx % 10) + 0x30;
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_UENC_NOMAPPING;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToGBK [implementation]
|
||||
|
||||
nsUnicodeToGBK::nsUnicodeToGBK(uint32_t aMaxLength) :
|
||||
nsEncoderSupport(aMaxLength), mSurrogateHigh(0)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsUnicodeToGBK::TryExtensionEncoder(char16_t aChar,
|
||||
char* aOut,
|
||||
int32_t *aOutLen)
|
||||
{
|
||||
int32_t len = 1;
|
||||
return nsUnicodeEncodeHelper::ConvertByTable(
|
||||
&aChar, &len, aOut, aOutLen, u1ByteCharset, nullptr,
|
||||
(uMappingTable*) &g_uf_gbk);
|
||||
}
|
||||
|
||||
nsresult nsUnicodeToGBK::Try4BytesEncoder(char16_t aChar,
|
||||
char* aOut,
|
||||
int32_t *aOutLen)
|
||||
{
|
||||
return NS_ERROR_UENC_NOMAPPING;
|
||||
}
|
||||
|
||||
nsresult nsUnicodeToGBK::EncodeSurrogate(char16_t aSurrogateHigh,
|
||||
char16_t aSurrogateLow,
|
||||
char* aOut,
|
||||
int32_t aDestLength,
|
||||
int32_t aBufferLength)
|
||||
{
|
||||
return NS_ERROR_UENC_NOMAPPING; // GBK cannot encode Surrogate, let the subclass encode it.
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToGBK::ConvertNoBuffNoErr(const char16_t * aSrc,
|
||||
int32_t * aSrcLength,
|
||||
char * aDest,
|
||||
int32_t * aDestLength)
|
||||
{
|
||||
int32_t iSrcLength = 0;
|
||||
int32_t iDestLength = 0;
|
||||
char16_t unicode;
|
||||
nsresult res = NS_OK;
|
||||
while (iSrcLength < *aSrcLength )
|
||||
{
|
||||
unicode = *aSrc;
|
||||
//if unicode's hi byte has something, it is not ASCII, must be a GB
|
||||
if (IS_ASCII(unicode)) {
|
||||
// make sure we still have 1 byte for output first
|
||||
if (iDestLength >= *aDestLength) {
|
||||
res = NS_OK_UENC_MOREOUTPUT;
|
||||
break;
|
||||
}
|
||||
// this is an ASCII
|
||||
*aDest = CAST_UNICHAR_TO_CHAR(*aSrc);
|
||||
aDest++; // increment 1 byte
|
||||
iDestLength +=1;
|
||||
} else {
|
||||
char byte1, byte2;
|
||||
if(mUtil.UnicodeToGBKChar( unicode, false, &byte1, &byte2))
|
||||
{
|
||||
// make sure we still have 2 bytes for output first
|
||||
if(iDestLength+2 > *aDestLength)
|
||||
{
|
||||
res = NS_OK_UENC_MOREOUTPUT;
|
||||
break;
|
||||
}
|
||||
aDest[0] = byte1;
|
||||
aDest[1] = byte2;
|
||||
aDest += 2; // increment 2 bytes
|
||||
iDestLength +=2;
|
||||
} else {
|
||||
// Swapped character in GB18030-2005
|
||||
if (unicode == 0xE7C7) {
|
||||
unicode = 0x1E3F;
|
||||
}
|
||||
// we cannot map in the common mapping. Let's try to
|
||||
// call the delegated 2 byte converter for the gbk or gb18030
|
||||
// unique 2 byte mapping
|
||||
int32_t outLen = *aDestLength - iDestLength;
|
||||
if (NS_IS_HIGH_SURROGATE(unicode) ||
|
||||
NS_IS_LOW_SURROGATE(unicode)) {
|
||||
// performance tune for surrogate characters
|
||||
res = NS_ERROR_UENC_NOMAPPING;
|
||||
} else {
|
||||
res = TryExtensionEncoder(unicode, aDest, &outLen);
|
||||
}
|
||||
if (res == NS_OK) {
|
||||
iDestLength += outLen;
|
||||
aDest += outLen;
|
||||
} else if (res == NS_OK_UENC_MOREOUTPUT) {
|
||||
break;
|
||||
} else {
|
||||
// we still cannot map. Let's try to
|
||||
// call the delegated GB18030 4 byte converter
|
||||
if( NS_IS_HIGH_SURROGATE(unicode) )
|
||||
{
|
||||
if((iSrcLength+1) < *aSrcLength ) {
|
||||
res = EncodeSurrogate(aSrc[0],aSrc[1], aDest,
|
||||
iDestLength, *aDestLength);
|
||||
if (res == NS_OK) {
|
||||
// since we got a surrogate pair, we need to increment src.
|
||||
iSrcLength++ ;
|
||||
aSrc++;
|
||||
iDestLength += 4;
|
||||
aDest += 4;
|
||||
} else {
|
||||
if (res == NS_ERROR_UENC_NOMAPPING) {
|
||||
// only get a high surrogate, but not a low surrogate
|
||||
iSrcLength++; // include length of the unmapped character
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
mSurrogateHigh = aSrc[0];
|
||||
res = NS_OK;
|
||||
break; // this will go to afterwhileloop
|
||||
}
|
||||
} else {
|
||||
if( NS_IS_LOW_SURROGATE(unicode) )
|
||||
{
|
||||
if(NS_IS_HIGH_SURROGATE(mSurrogateHigh)) {
|
||||
res = EncodeSurrogate(mSurrogateHigh, aSrc[0], aDest,
|
||||
iDestLength, *aDestLength);
|
||||
if (res == NS_OK) {
|
||||
iDestLength += 4;
|
||||
aDest += 4;
|
||||
} else {
|
||||
if (res == NS_ERROR_UENC_NOMAPPING) {
|
||||
// only get a high surrogate, but not a low surrogate
|
||||
iSrcLength++; // include length of the unmapped character
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
// only get a low surrogate, but not a low surrogate
|
||||
res = NS_ERROR_UENC_NOMAPPING;
|
||||
iSrcLength++; // include length of the unmapped character
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
outLen = *aDestLength - iDestLength;
|
||||
res = Try4BytesEncoder(unicode, aDest, &outLen);
|
||||
if (res == NS_OK) {
|
||||
iDestLength += outLen;
|
||||
aDest += outLen;
|
||||
} else {
|
||||
if (res == NS_ERROR_UENC_NOMAPPING) {
|
||||
iSrcLength++; // include length of the unmapped character
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
iSrcLength++ ; // Each unicode char just count as one in char16_t string;
|
||||
mSurrogateHigh = 0;
|
||||
aSrc++;
|
||||
}
|
||||
//afterwhileloop:
|
||||
*aDestLength = iDestLength;
|
||||
*aSrcLength = iSrcLength;
|
||||
return res;
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to GBK.
|
||||
*
|
||||
*
|
||||
* @created 08/Sept/1999
|
||||
* @author Yueheng Xu, Yueheng.Xu@intel.com
|
||||
*/
|
||||
|
||||
#ifndef nsUnicodeToGBK_h___
|
||||
#define nsUnicodeToGBK_h___
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIUnicodeEncoder.h"
|
||||
#include "nsGBKConvUtil.h"
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToGBK [declaration]
|
||||
|
||||
class nsUnicodeToGBK: public nsEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
explicit nsUnicodeToGBK(uint32_t aMaxLengthFactor = 2);
|
||||
virtual ~nsUnicodeToGBK() {}
|
||||
|
||||
protected:
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [declaration]
|
||||
NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc,
|
||||
int32_t * aSrcLength,
|
||||
char * aDest,
|
||||
int32_t * aDestLength);
|
||||
|
||||
protected:
|
||||
char16_t mSurrogateHigh;
|
||||
nsGBKConvUtil mUtil;
|
||||
virtual nsresult TryExtensionEncoder(char16_t aChar, char* aDest,
|
||||
int32_t* aOutLen);
|
||||
virtual nsresult Try4BytesEncoder(char16_t aChar, char* aDest,
|
||||
int32_t* aOutLen);
|
||||
virtual nsresult EncodeSurrogate(char16_t aSurrogateHigh,
|
||||
char16_t aSurrogateLow, char* aDest,
|
||||
int32_t aDestLength, int32_t aBufferLength);
|
||||
};
|
||||
|
||||
class nsUnicodeToGB18030: public nsUnicodeToGBK
|
||||
{
|
||||
public:
|
||||
nsUnicodeToGB18030() : nsUnicodeToGBK(4) {}
|
||||
virtual ~nsUnicodeToGB18030() {}
|
||||
protected:
|
||||
virtual nsresult TryExtensionEncoder(char16_t aChar, char* aDest,
|
||||
int32_t* aOutLen) override;
|
||||
virtual nsresult Try4BytesEncoder(char16_t aChar, char* aDest,
|
||||
int32_t* aOutLen) override;
|
||||
virtual nsresult EncodeSurrogate(char16_t aSurrogateHigh,
|
||||
char16_t aSurrogateLow, char* aDest,
|
||||
int32_t aDestLength,
|
||||
int32_t aBufferLength) override;
|
||||
};
|
||||
|
||||
#endif /* nsUnicodeToGBK_h___ */
|
||||
|
@ -1,2 +0,0 @@
|
||||
We should put GB2312, HZ, and ISO-2022-CN (Simplified Chinese one)
|
||||
converters into this directory/dll
|
File diff suppressed because it is too large
Load Diff
@ -1,70 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
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 <Frank Tang>
|
||||
|
||||
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 = FF61
|
||||
srcEnd = FF9F
|
||||
destBegin = 00A1
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 2
|
||||
srcBegin = 00A5
|
||||
destBegin = 005C
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 2
|
||||
srcBegin = 203E
|
||||
destBegin = 007E
|
||||
End of Item 0003
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0006,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x0012,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0002 */
|
||||
/* Total of Format 1 : 0x0000 */
|
||||
/* Total of Format 2 : 0x0002 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x2200, 0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0006 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x007F, 0x0000,
|
||||
/* 0001 */ 0xFF61, 0xFF9F, 0x00A1,
|
||||
/* 0002 */ 0x00A5, 0x0000, 0x005C,
|
||||
/* 0003 */ 0x203E, 0x0000, 0x007E,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0012 Start of MappingTable */
|
||||
|
||||
/* End of table Total Length = 0x0012 * 2 */
|
@ -1,70 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
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 <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0020
|
||||
srcEnd = 005B
|
||||
destBegin = 0020
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = 005D
|
||||
srcEnd = 007D
|
||||
destBegin = 005D
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 2
|
||||
srcBegin = 00A5
|
||||
destBegin = 005C
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 2
|
||||
srcBegin = 203E
|
||||
destBegin = 007E
|
||||
End of Item 0003
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0006,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x0012,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0002 */
|
||||
/* Total of Format 1 : 0x0000 */
|
||||
/* Total of Format 2 : 0x0002 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x2200, 0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0006 Start of MapCell Array */
|
||||
/* 0000 */ 0x0020, 0x005B, 0x0020,
|
||||
/* 0001 */ 0x005D, 0x007D, 0x005D,
|
||||
/* 0002 */ 0x00A5, 0x0000, 0x005C,
|
||||
/* 0003 */ 0x203E, 0x0000, 0x007E,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0012 Start of MappingTable */
|
||||
|
||||
/* End of table Total Length = 0x0012 * 2 */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,961 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "nsJapaneseToUnicode.h"
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
|
||||
#include "japanese.map"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
|
||||
using mozilla::dom::EncodingUtils;
|
||||
|
||||
// HTML5 says to use Windows-31J instead of the real Shift_JIS for decoding
|
||||
#define SJIS_INDEX gCP932Index[0]
|
||||
#define JIS0208_INDEX gCP932Index[1]
|
||||
|
||||
#define JIS0212_INDEX gJIS0212Index
|
||||
#define SJIS_UNMAPPED 0x30fb
|
||||
#define UNICODE_REPLACEMENT_CHARACTER 0xfffd
|
||||
#define IN_GR_RANGE(b) \
|
||||
((uint8_t(0xa1) <= uint8_t(b)) && (uint8_t(b) <= uint8_t(0xfe)))
|
||||
|
||||
NS_IMETHODIMP nsShiftJISToUnicode::Convert(
|
||||
const char * aSrc, int32_t * aSrcLen,
|
||||
char16_t * aDest, int32_t * aDestLen)
|
||||
{
|
||||
static const uint8_t sbIdx[256] =
|
||||
{
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x00 */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x08 */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x10 */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x18 */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x20 */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x28 */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x30 */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* 0x38 */
|
||||
0, 1, 2, 3, 4, 5, 6, 7, /* 0x40 */
|
||||
8, 9, 10, 11, 12, 13, 14, 15, /* 0x48 */
|
||||
16, 17, 18, 19, 20, 21, 22, 23, /* 0x50 */
|
||||
24, 25, 26, 27, 28, 29, 30, 31, /* 0x58 */
|
||||
32, 33, 34, 35, 36, 37, 38, 39, /* 0x60 */
|
||||
40, 41, 42, 43, 44, 45, 46, 47, /* 0x68 */
|
||||
48, 49, 50, 51, 52, 53, 54, 55, /* 0x70 */
|
||||
56, 57, 58, 59, 60, 61, 62, 0xFF, /* 0x78 */
|
||||
63, 64, 65, 66, 67, 68, 69, 70, /* 0x80 */
|
||||
71, 72, 73, 74, 75, 76, 77, 78, /* 0x88 */
|
||||
79, 80, 81, 82, 83, 84, 85, 86, /* 0x90 */
|
||||
87, 88, 89, 90, 91, 92, 93, 94, /* 0x98 */
|
||||
95, 96, 97, 98, 99, 100, 101, 102, /* 0xa0 */
|
||||
103, 104, 105, 106, 107, 108, 109, 110, /* 0xa8 */
|
||||
111, 112, 113, 114, 115, 116, 117, 118, /* 0xb0 */
|
||||
119, 120, 121, 122, 123, 124, 125, 126, /* 0xb8 */
|
||||
127, 128, 129, 130, 131, 132, 133, 134, /* 0xc0 */
|
||||
135, 136, 137, 138, 139, 140, 141, 142, /* 0xc8 */
|
||||
143, 144, 145, 146, 147, 148, 149, 150, /* 0xd0 */
|
||||
151, 152, 153, 154, 155, 156, 157, 158, /* 0xd8 */
|
||||
159, 160, 161, 162, 163, 164, 165, 166, /* 0xe0 */
|
||||
167, 168, 169, 170, 171, 172, 173, 174, /* 0xe8 */
|
||||
175, 176, 177, 178, 179, 180, 181, 182, /* 0xf0 */
|
||||
183, 184, 185, 186, 187, 0xFF, 0xFF, 0xFF, /* 0xf8 */
|
||||
};
|
||||
|
||||
const unsigned char* srcEnd = (unsigned char*)aSrc + *aSrcLen;
|
||||
const unsigned char* src =(unsigned char*) aSrc;
|
||||
char16_t* destEnd = aDest + *aDestLen;
|
||||
char16_t* dest = aDest;
|
||||
while (src < srcEnd) {
|
||||
switch (mState) {
|
||||
case 0:
|
||||
if (*src <= 0x80) {
|
||||
// ASCII
|
||||
*dest++ = (char16_t) *src;
|
||||
if (dest >= destEnd) {
|
||||
goto error1;
|
||||
}
|
||||
} else {
|
||||
mData = SJIS_INDEX[*src & 0x7F];
|
||||
if (mData < 0xE000) {
|
||||
mState = 1; // two bytes
|
||||
} else if (mData < 0xF000) {
|
||||
mState = 2; // EUDC
|
||||
} else {
|
||||
*dest++ = mData; // JIS 0201
|
||||
if (dest >= destEnd) {
|
||||
goto error1;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: // Index to table
|
||||
{
|
||||
MOZ_ASSERT(mData < 0xE000);
|
||||
uint8_t off = sbIdx[*src];
|
||||
|
||||
// Error handling: in the case where the second octet is not in the
|
||||
// valid ranges 0x40-0x7E 0x80-0xFC, unconsume the invalid octet and
|
||||
// interpret it as the ASCII value. In the case where the second
|
||||
// octet is in the valid range but there is no mapping for the
|
||||
// 2-octet sequence, do not unconsume.
|
||||
if(0xFF == off) {
|
||||
src--;
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error_invalidchar;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
char16_t ch = gJapaneseMap[mData+off];
|
||||
if(ch == 0xfffd) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error_invalidchar;
|
||||
ch = SJIS_UNMAPPED;
|
||||
}
|
||||
*dest++ = ch;
|
||||
}
|
||||
mState = 0;
|
||||
if(dest >= destEnd)
|
||||
goto error1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // EUDC
|
||||
{
|
||||
MOZ_ASSERT(0xE000 <= mData && mData < 0xF000);
|
||||
uint8_t off = sbIdx[*src];
|
||||
|
||||
// Error handling as in case 1
|
||||
if(0xFF == off) {
|
||||
src--;
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error_invalidchar;
|
||||
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
*dest++ = mData + off;
|
||||
}
|
||||
mState = 0;
|
||||
if(dest >= destEnd)
|
||||
goto error1;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
src++;
|
||||
}
|
||||
*aDestLen = dest - aDest;
|
||||
return NS_OK;
|
||||
error_invalidchar:
|
||||
*aDestLen = dest - aDest;
|
||||
*aSrcLen = src - (const unsigned char*)aSrc;
|
||||
return NS_ERROR_ILLEGAL_INPUT;
|
||||
error1:
|
||||
*aDestLen = dest - aDest;
|
||||
src++;
|
||||
if ((mState == 0) && (src == srcEnd)) {
|
||||
return NS_OK;
|
||||
}
|
||||
*aSrcLen = src - (const unsigned char*)aSrc;
|
||||
return NS_OK_UDEC_MOREOUTPUT;
|
||||
}
|
||||
|
||||
char16_t
|
||||
nsShiftJISToUnicode::GetCharacterForUnMapped()
|
||||
{
|
||||
return char16_t(SJIS_UNMAPPED);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsEUCJPToUnicodeV2::Convert(
|
||||
const char * aSrc, int32_t * aSrcLen,
|
||||
char16_t * aDest, int32_t * aDestLen)
|
||||
{
|
||||
static const uint8_t sbIdx[256] =
|
||||
{
|
||||
/* 0x0X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x1X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x2X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x3X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x4X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x5X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x6X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x7X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x8X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x9X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0xAX */
|
||||
0xFF, 0, 1, 2, 3, 4, 5, 6,
|
||||
7, 8 , 9, 10, 11, 12, 13, 14,
|
||||
/* 0xBX */
|
||||
15, 16, 17, 18, 19, 20, 21, 22,
|
||||
23, 24, 25, 26, 27, 28, 29, 30,
|
||||
/* 0xCX */
|
||||
31, 32, 33, 34, 35, 36, 37, 38,
|
||||
39, 40, 41, 42, 43, 44, 45, 46,
|
||||
/* 0xDX */
|
||||
47, 48, 49, 50, 51, 52, 53, 54,
|
||||
55, 56, 57, 58, 59, 60, 61, 62,
|
||||
/* 0xEX */
|
||||
63, 64, 65, 66, 67, 68, 69, 70,
|
||||
71, 72, 73, 74, 75, 76, 77, 78,
|
||||
/* 0xFX */
|
||||
79, 80, 81, 82, 83, 84, 85, 86,
|
||||
87, 88, 89, 90, 91, 92, 93, 0xFF,
|
||||
};
|
||||
|
||||
const unsigned char* srcEnd = (unsigned char*)aSrc + *aSrcLen;
|
||||
const unsigned char* src =(unsigned char*) aSrc;
|
||||
char16_t* destEnd = aDest + *aDestLen;
|
||||
char16_t* dest = aDest;
|
||||
while((src < srcEnd))
|
||||
{
|
||||
switch(mState)
|
||||
{
|
||||
case 0:
|
||||
if(*src & 0x80 && *src != (unsigned char)0xa0)
|
||||
{
|
||||
mData = JIS0208_INDEX[*src & 0x7F];
|
||||
if(mData != 0xFFFD )
|
||||
{
|
||||
mState = 1; // two byte JIS0208
|
||||
} else {
|
||||
if( 0x8e == *src) {
|
||||
// JIS 0201
|
||||
mState = 2; // JIS0201
|
||||
} else if(0x8f == *src) {
|
||||
// JIS 0212
|
||||
mState = 3; // JIS0212
|
||||
} else {
|
||||
// others
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error_invalidchar;
|
||||
*dest++ = 0xFFFD;
|
||||
if(dest >= destEnd)
|
||||
goto error1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// ASCII
|
||||
*dest++ = (char16_t) *src;
|
||||
if(dest >= destEnd)
|
||||
goto error1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1: // Index to table
|
||||
{
|
||||
uint8_t off = sbIdx[*src];
|
||||
if(0xFF == off) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error_invalidchar;
|
||||
*dest++ = 0xFFFD;
|
||||
// if the first byte is valid for EUC-JP but the second
|
||||
// is not while being a valid US-ASCII, save it
|
||||
// instead of eating it up !
|
||||
if ( (uint8_t)*src < (uint8_t)0x7f )
|
||||
--src;
|
||||
} else {
|
||||
*dest++ = gJapaneseMap[mData+off];
|
||||
}
|
||||
mState = 0;
|
||||
if(dest >= destEnd)
|
||||
goto error1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // JIS 0201
|
||||
{
|
||||
if((0xA1 <= *src) && (*src <= 0xDF)) {
|
||||
*dest++ = (0xFF61-0x00A1) + *src;
|
||||
} else {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error_invalidchar;
|
||||
*dest++ = 0xFFFD;
|
||||
// if 0x8e is not followed by a valid JIS X 0201 byte
|
||||
// but by a valid US-ASCII, save it instead of eating it up.
|
||||
if ( (uint8_t)*src < (uint8_t)0x7f )
|
||||
--src;
|
||||
}
|
||||
mState = 0;
|
||||
if(dest >= destEnd)
|
||||
goto error1;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: // JIS 0212
|
||||
{
|
||||
if (IN_GR_RANGE(*src))
|
||||
{
|
||||
mData = JIS0212_INDEX[*src & 0x7F];
|
||||
if(mData != 0xFFFD )
|
||||
{
|
||||
mState = 4;
|
||||
} else {
|
||||
mState = 5; // error
|
||||
}
|
||||
} else {
|
||||
// First "JIS 0212" byte is not in the valid GR range: save it
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error_invalidchar;
|
||||
*dest++ = 0xFFFD;
|
||||
--src;
|
||||
mState = 0;
|
||||
if(dest >= destEnd)
|
||||
goto error1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
uint8_t off = sbIdx[*src];
|
||||
if(0xFF != off) {
|
||||
*dest++ = gJapaneseMap[mData+off];
|
||||
mState = 0;
|
||||
if(dest >= destEnd)
|
||||
goto error1;
|
||||
break;
|
||||
}
|
||||
// else fall through to error handler
|
||||
MOZ_FALLTHROUGH;
|
||||
}
|
||||
case 5: // two bytes undefined
|
||||
{
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error_invalidchar;
|
||||
*dest++ = 0xFFFD;
|
||||
// Undefined JIS 0212 two byte sequence. If the second byte is in
|
||||
// the valid range for a two byte sequence (0xa1 - 0xfe) consume
|
||||
// both bytes. Otherwise resynchronize on the second byte.
|
||||
if (!IN_GR_RANGE(*src))
|
||||
--src;
|
||||
mState = 0;
|
||||
if(dest >= destEnd)
|
||||
goto error1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
src++;
|
||||
}
|
||||
*aDestLen = dest - aDest;
|
||||
return NS_OK;
|
||||
error_invalidchar:
|
||||
*aDestLen = dest - aDest;
|
||||
*aSrcLen = src - (const unsigned char*)aSrc;
|
||||
return NS_ERROR_ILLEGAL_INPUT;
|
||||
error1:
|
||||
*aDestLen = dest - aDest;
|
||||
src++;
|
||||
if ((mState == 0) && (src == srcEnd)) {
|
||||
return NS_OK;
|
||||
}
|
||||
*aSrcLen = src - (const unsigned char*)aSrc;
|
||||
return NS_OK_UDEC_MOREOUTPUT;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsISO2022JPToUnicodeV2::Convert(
|
||||
const char * aSrc, int32_t * aSrcLen,
|
||||
char16_t * aDest, int32_t * aDestLen)
|
||||
{
|
||||
static const uint16_t fbIdx[128] =
|
||||
{
|
||||
/* 0x8X */
|
||||
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0x9X */
|
||||
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0xAX */
|
||||
0xFFFD, 0, 94, 94* 2, 94* 3, 94* 4, 94* 5, 94* 6,
|
||||
94* 7, 94* 8 , 94* 9, 94*10, 94*11, 94*12, 94*13, 94*14,
|
||||
/* 0xBX */
|
||||
94*15, 94*16, 94*17, 94*18, 94*19, 94*20, 94*21, 94*22,
|
||||
94*23, 94*24, 94*25, 94*26, 94*27, 94*28, 94*29, 94*30,
|
||||
/* 0xCX */
|
||||
94*31, 94*32, 94*33, 94*34, 94*35, 94*36, 94*37, 94*38,
|
||||
94*39, 94*40, 94*41, 94*42, 94*43, 94*44, 94*45, 94*46,
|
||||
/* 0xDX */
|
||||
94*47, 94*48, 94*49, 94*50, 94*51, 94*52, 94*53, 94*54,
|
||||
94*55, 94*56, 94*57, 94*58, 94*59, 94*60, 94*61, 94*62,
|
||||
/* 0xEX */
|
||||
94*63, 94*64, 94*65, 94*66, 94*67, 94*68, 94*69, 94*70,
|
||||
94*71, 94*72, 94*73, 94*74, 94*75, 94*76, 94*77, 94*78,
|
||||
/* 0xFX */
|
||||
94*79, 94*80, 94*81, 94*82, 94*83, 94*84, 94*85, 94*86,
|
||||
94*87, 94*88, 94*89, 94*90, 94*91, 94*92, 94*93, 0xFFFD,
|
||||
};
|
||||
static const uint8_t sbIdx[256] =
|
||||
{
|
||||
/* 0x0X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x1X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x2X */
|
||||
0xFF, 0, 1, 2, 3, 4, 5, 6,
|
||||
7, 8 , 9, 10, 11, 12, 13, 14,
|
||||
/* 0x3X */
|
||||
15, 16, 17, 18, 19, 20, 21, 22,
|
||||
23, 24, 25, 26, 27, 28, 29, 30,
|
||||
/* 0x4X */
|
||||
31, 32, 33, 34, 35, 36, 37, 38,
|
||||
39, 40, 41, 42, 43, 44, 45, 46,
|
||||
/* 0x5X */
|
||||
47, 48, 49, 50, 51, 52, 53, 54,
|
||||
55, 56, 57, 58, 59, 60, 61, 62,
|
||||
/* 0x6X */
|
||||
63, 64, 65, 66, 67, 68, 69, 70,
|
||||
71, 72, 73, 74, 75, 76, 77, 78,
|
||||
/* 0x7X */
|
||||
79, 80, 81, 82, 83, 84, 85, 86,
|
||||
87, 88, 89, 90, 91, 92, 93, 0xFF,
|
||||
/* 0x8X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0x9X */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0xAX */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0xBX */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0xCX */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0xDX */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0xEX */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
/* 0xFX */
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
||||
};
|
||||
|
||||
const unsigned char* srcEnd = (unsigned char*)aSrc + *aSrcLen;
|
||||
const unsigned char* src =(unsigned char*) aSrc;
|
||||
char16_t* destEnd = aDest + *aDestLen;
|
||||
char16_t* dest = aDest;
|
||||
while((src < srcEnd))
|
||||
{
|
||||
|
||||
switch(mState)
|
||||
{
|
||||
case mState_ASCII:
|
||||
if(0x1b == *src)
|
||||
{
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ESC;
|
||||
} else if(*src & 0x80) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
*dest++ = (char16_t) *src;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_ESC:
|
||||
if( '(' == *src) {
|
||||
mState = mState_ESC_28;
|
||||
} else if ('$' == *src) {
|
||||
mState = mState_ESC_24;
|
||||
} else if ('.' == *src) { // for ISO-2022-JP-2
|
||||
mState = mState_ESC_2e;
|
||||
} else if ('N' == *src) { // for ISO-2022-JP-2
|
||||
mState = mState_ESC_4e;
|
||||
} else {
|
||||
if (CHECK_OVERRUN(dest, destEnd, 2))
|
||||
goto error1;
|
||||
*dest++ = (char16_t) 0x1b;
|
||||
if (0x80 & *src) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
*dest++ = (char16_t) *src;
|
||||
}
|
||||
mState = mLastLegalState;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_ESC_28: // ESC (
|
||||
if( 'B' == *src) {
|
||||
mState = mState_ASCII;
|
||||
if (mRunLength == 0) {
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
*dest++ = 0xFFFD;
|
||||
}
|
||||
mRunLength = 0;
|
||||
} else if ('J' == *src) {
|
||||
mState = mState_JISX0201_1976Roman;
|
||||
if (mRunLength == 0 && mLastLegalState != mState_ASCII) {
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = 0xFFFD;
|
||||
}
|
||||
mRunLength = 0;
|
||||
} else if ('I' == *src) {
|
||||
mState = mState_JISX0201_1976Kana;
|
||||
mRunLength = 0;
|
||||
} else {
|
||||
if (CHECK_OVERRUN(dest, destEnd, 3))
|
||||
goto error1;
|
||||
*dest++ = (char16_t) 0x1b;
|
||||
*dest++ = (char16_t) '(';
|
||||
if (0x80 & *src) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
*dest++ = (char16_t) *src;
|
||||
}
|
||||
mState = mLastLegalState;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_ESC_24: // ESC $
|
||||
if( '@' == *src) {
|
||||
mState = mState_JISX0208_1978;
|
||||
mRunLength = 0;
|
||||
} else if ('A' == *src) {
|
||||
mState = mState_GB2312_1980;
|
||||
mRunLength = 0;
|
||||
} else if ('B' == *src) {
|
||||
mState = mState_JISX0208_1983;
|
||||
mRunLength = 0;
|
||||
} else if ('(' == *src) {
|
||||
mState = mState_ESC_24_28;
|
||||
} else {
|
||||
if (CHECK_OVERRUN(dest, destEnd, 3))
|
||||
goto error1;
|
||||
*dest++ = (char16_t) 0x1b;
|
||||
*dest++ = (char16_t) '$';
|
||||
if (0x80 & *src) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
*dest++ = (char16_t) *src;
|
||||
}
|
||||
mState = mLastLegalState;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_ESC_24_28: // ESC $ (
|
||||
if( 'C' == *src) {
|
||||
mState = mState_KSC5601_1987;
|
||||
mRunLength = 0;
|
||||
} else if ('D' == *src) {
|
||||
mState = mState_JISX0212_1990;
|
||||
mRunLength = 0;
|
||||
} else {
|
||||
if (CHECK_OVERRUN(dest, destEnd, 4))
|
||||
goto error1;
|
||||
*dest++ = (char16_t) 0x1b;
|
||||
*dest++ = (char16_t) '$';
|
||||
*dest++ = (char16_t) '(';
|
||||
if (0x80 & *src) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
*dest++ = (char16_t) *src;
|
||||
}
|
||||
mState = mLastLegalState;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_JISX0201_1976Roman:
|
||||
if(0x1b == *src) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ESC;
|
||||
} else if(*src & 0x80) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
++mRunLength;
|
||||
} else {
|
||||
// XXX We need to decide how to handle \ and ~ here
|
||||
// we may need a if statement here for '\' and '~'
|
||||
// to map them to Yen and Overbar
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
*dest++ = (char16_t) *src;
|
||||
++mRunLength;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_JISX0201_1976Kana:
|
||||
if(0x1b == *src) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ESC;
|
||||
} else {
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
if((0x21 <= *src) && (*src <= 0x5F)) {
|
||||
*dest++ = (0xFF61-0x0021) + *src;
|
||||
} else {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
}
|
||||
++mRunLength;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_JISX0208_1978:
|
||||
if(0x1b == *src) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ESC;
|
||||
} else if(*src & 0x80) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ERROR;
|
||||
} else {
|
||||
mData = JIS0208_INDEX[*src & 0x7F];
|
||||
if (0xFFFD == mData) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
mState = mState_ERROR;
|
||||
} else {
|
||||
mState = mState_JISX0208_1978_2ndbyte;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_GB2312_1980:
|
||||
if(0x1b == *src) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ESC;
|
||||
} else if(*src & 0x80) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ERROR;
|
||||
} else {
|
||||
mData = fbIdx[*src & 0x7F];
|
||||
if (0xFFFD == mData) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
mState = mState_ERROR;
|
||||
} else {
|
||||
mState = mState_GB2312_1980_2ndbyte;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_JISX0208_1983:
|
||||
if(0x1b == *src) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ESC;
|
||||
} else if(*src & 0x80) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ERROR;
|
||||
} else {
|
||||
mData = JIS0208_INDEX[*src & 0x7F];
|
||||
if (0xFFFD == mData) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
mState = mState_ERROR;
|
||||
} else {
|
||||
mState = mState_JISX0208_1983_2ndbyte;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_KSC5601_1987:
|
||||
if(0x1b == *src) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ESC;
|
||||
} else if(*src & 0x80) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ERROR;
|
||||
} else {
|
||||
mData = fbIdx[*src & 0x7F];
|
||||
if (0xFFFD == mData) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
mState = mState_ERROR;
|
||||
} else {
|
||||
mState = mState_KSC5601_1987_2ndbyte;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_JISX0212_1990:
|
||||
if(0x1b == *src) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ESC;
|
||||
} else if(*src & 0x80) {
|
||||
mLastLegalState = mState;
|
||||
mState = mState_ERROR;
|
||||
} else {
|
||||
mData = JIS0212_INDEX[*src & 0x7F];
|
||||
if (0xFFFD == mData) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
mState = mState_ERROR;
|
||||
} else {
|
||||
mState = mState_JISX0212_1990_2ndbyte;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_JISX0208_1978_2ndbyte:
|
||||
{
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
uint8_t off = sbIdx[*src];
|
||||
if(0xFF == off) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
// XXX We need to map from JIS X 0208 1983 to 1987
|
||||
// in the next line before pass to *dest++
|
||||
*dest++ = gJapaneseMap[mData+off];
|
||||
}
|
||||
++mRunLength;
|
||||
mState = mState_JISX0208_1978;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_GB2312_1980_2ndbyte:
|
||||
{
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
uint8_t off = sbIdx[*src];
|
||||
if(0xFF == off) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
if (!mGB2312Decoder) {
|
||||
// creating a delegate converter (GB2312)
|
||||
mGB2312Decoder =
|
||||
EncodingUtils::DecoderForEncoding("gb18030");
|
||||
}
|
||||
if (!mGB2312Decoder) {// failed creating a delegate converter
|
||||
goto error2;
|
||||
} else {
|
||||
unsigned char gb[2];
|
||||
char16_t uni;
|
||||
int32_t gbLen = 2, uniLen = 1;
|
||||
// ((mData/94)+0x21) is the original 1st byte.
|
||||
// *src is the present 2nd byte.
|
||||
// Put 2 bytes (one character) to gb[] with GB2312 encoding.
|
||||
gb[0] = ((mData / 94) + 0x21) | 0x80;
|
||||
gb[1] = *src | 0x80;
|
||||
// Convert GB2312 to unicode.
|
||||
mGB2312Decoder->Convert((const char *)gb, &gbLen,
|
||||
&uni, &uniLen);
|
||||
*dest++ = uni;
|
||||
}
|
||||
}
|
||||
++mRunLength;
|
||||
mState = mState_GB2312_1980;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_JISX0208_1983_2ndbyte:
|
||||
{
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
uint8_t off = sbIdx[*src];
|
||||
if(0xFF == off) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
*dest++ = gJapaneseMap[mData+off];
|
||||
}
|
||||
++mRunLength;
|
||||
mState = mState_JISX0208_1983;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_KSC5601_1987_2ndbyte:
|
||||
{
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
uint8_t off = sbIdx[*src];
|
||||
if(0xFF == off) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
if (!mEUCKRDecoder) {
|
||||
// creating a delegate converter (EUC-KR)
|
||||
mEUCKRDecoder =
|
||||
EncodingUtils::DecoderForEncoding(NS_LITERAL_CSTRING("EUC-KR"));
|
||||
}
|
||||
if (!mEUCKRDecoder) {// failed creating a delegate converter
|
||||
goto error2;
|
||||
} else {
|
||||
unsigned char ksc[2];
|
||||
char16_t uni;
|
||||
int32_t kscLen = 2, uniLen = 1;
|
||||
// ((mData/94)+0x21) is the original 1st byte.
|
||||
// *src is the present 2nd byte.
|
||||
// Put 2 bytes (one character) to ksc[] with EUC-KR encoding.
|
||||
ksc[0] = ((mData / 94) + 0x21) | 0x80;
|
||||
ksc[1] = *src | 0x80;
|
||||
// Convert EUC-KR to unicode.
|
||||
mEUCKRDecoder->Convert((const char *)ksc, &kscLen,
|
||||
&uni, &uniLen);
|
||||
*dest++ = uni;
|
||||
}
|
||||
}
|
||||
++mRunLength;
|
||||
mState = mState_KSC5601_1987;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_JISX0212_1990_2ndbyte:
|
||||
{
|
||||
uint8_t off = sbIdx[*src];
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
if(0xFF == off) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
*dest++ = gJapaneseMap[mData+off];
|
||||
}
|
||||
++mRunLength;
|
||||
mState = mState_JISX0212_1990;
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_ESC_2e: // ESC .
|
||||
// "ESC ." will designate 96 character set to G2.
|
||||
mState = mLastLegalState;
|
||||
if( 'A' == *src) {
|
||||
G2charset = G2_ISO88591;
|
||||
} else if ('F' == *src) {
|
||||
G2charset = G2_ISO88597;
|
||||
} else {
|
||||
if (CHECK_OVERRUN(dest, destEnd, 3))
|
||||
goto error1;
|
||||
*dest++ = (char16_t) 0x1b;
|
||||
*dest++ = (char16_t) '.';
|
||||
if (0x80 & *src) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
*dest++ = (char16_t) *src;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_ESC_4e: // ESC N
|
||||
// "ESC N" is the SS2 sequence, that invoke a G2 designated
|
||||
// character set. Since SS2 is effective only for next one
|
||||
// character, mState should be returned to the last status.
|
||||
mState = mLastLegalState;
|
||||
if((0x20 <= *src) && (*src <= 0x7F)) {
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
if (G2_ISO88591 == G2charset) {
|
||||
*dest++ = *src | 0x80;
|
||||
} else if (G2_ISO88597 == G2charset) {
|
||||
if (!mISO88597Decoder) {
|
||||
// creating a delegate converter (ISO-8859-7)
|
||||
mISO88597Decoder =
|
||||
EncodingUtils::DecoderForEncoding(NS_LITERAL_CSTRING("ISO-8859-7"));
|
||||
}
|
||||
if (!mISO88597Decoder) {// failed creating a delegate converter
|
||||
goto error2;
|
||||
} else {
|
||||
// Put one character with ISO-8859-7 encoding.
|
||||
unsigned char gr = *src | 0x80;
|
||||
char16_t uni;
|
||||
int32_t grLen = 1, uniLen = 1;
|
||||
// Convert ISO-8859-7 to unicode.
|
||||
mISO88597Decoder->Convert((const char *)&gr, &grLen,
|
||||
&uni, &uniLen);
|
||||
*dest++ = uni;
|
||||
}
|
||||
} else {// G2charset is G2_unknown (not designated yet)
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
}
|
||||
++mRunLength;
|
||||
} else {
|
||||
if (CHECK_OVERRUN(dest, destEnd, 3))
|
||||
goto error1;
|
||||
*dest++ = (char16_t) 0x1b;
|
||||
*dest++ = (char16_t) 'N';
|
||||
if (0x80 & *src) {
|
||||
if (mErrBehavior == kOnError_Signal)
|
||||
goto error3;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
} else {
|
||||
*dest++ = (char16_t) *src;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case mState_ERROR:
|
||||
mState = mLastLegalState;
|
||||
if (mErrBehavior == kOnError_Signal) {
|
||||
mRunLength = 0;
|
||||
goto error3;
|
||||
}
|
||||
if (CHECK_OVERRUN(dest, destEnd, 1))
|
||||
goto error1;
|
||||
*dest++ = UNICODE_REPLACEMENT_CHARACTER;
|
||||
++mRunLength;
|
||||
break;
|
||||
|
||||
} // switch
|
||||
src++;
|
||||
}
|
||||
*aDestLen = dest - aDest;
|
||||
return NS_OK;
|
||||
error1:
|
||||
*aDestLen = dest - aDest;
|
||||
*aSrcLen = src - (const unsigned char*)aSrc;
|
||||
return NS_OK_UDEC_MOREOUTPUT;
|
||||
error2:
|
||||
*aDestLen = dest - aDest;
|
||||
*aSrcLen = src - (const unsigned char*)aSrc;
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
error3:
|
||||
*aDestLen = dest - aDest;
|
||||
*aSrcLen = src - (const unsigned char*)aSrc;
|
||||
return NS_ERROR_ILLEGAL_INPUT;
|
||||
}
|
@ -1,143 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef nsShiftJISToUnicode_h__
|
||||
#define nsShiftJISToUnicode_h__
|
||||
#include "nsUCSupport.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
||||
class nsShiftJISToUnicode : public nsBasicDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
nsShiftJISToUnicode()
|
||||
{
|
||||
mState=0; mData=0;
|
||||
}
|
||||
virtual ~nsShiftJISToUnicode() {}
|
||||
|
||||
NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength,
|
||||
char16_t * aDest, int32_t * aDestLength) ;
|
||||
NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength,
|
||||
int32_t * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD Reset()
|
||||
{
|
||||
mState = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
virtual char16_t GetCharacterForUnMapped();
|
||||
|
||||
private:
|
||||
|
||||
private:
|
||||
int32_t mState;
|
||||
int32_t mData;
|
||||
};
|
||||
|
||||
class nsEUCJPToUnicodeV2 : public nsBasicDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
nsEUCJPToUnicodeV2()
|
||||
{
|
||||
mState=0; mData=0;
|
||||
}
|
||||
virtual ~nsEUCJPToUnicodeV2() {}
|
||||
|
||||
NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength,
|
||||
char16_t * aDest, int32_t * aDestLength) ;
|
||||
NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength,
|
||||
int32_t * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD Reset()
|
||||
{
|
||||
mState = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
int32_t mState;
|
||||
int32_t mData;
|
||||
};
|
||||
|
||||
class nsISO2022JPToUnicodeV2 : public nsBasicDecoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
nsISO2022JPToUnicodeV2()
|
||||
{
|
||||
mState = mState_ASCII;
|
||||
mLastLegalState = mState_ASCII;
|
||||
mData = 0;
|
||||
mRunLength = 0;
|
||||
G2charset = G2_unknown;
|
||||
mGB2312Decoder = nullptr;
|
||||
mEUCKRDecoder = nullptr;
|
||||
mISO88597Decoder = nullptr;
|
||||
mozilla::Telemetry::Accumulate(
|
||||
mozilla::Telemetry::DECODER_INSTANTIATED_ISO2022JP, true);
|
||||
}
|
||||
virtual ~nsISO2022JPToUnicodeV2()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Convert(const char * aSrc, int32_t * aSrcLength,
|
||||
char16_t * aDest, int32_t * aDestLength) ;
|
||||
NS_IMETHOD GetMaxLength(const char * aSrc, int32_t aSrcLength,
|
||||
int32_t * aDestLength)
|
||||
{
|
||||
*aDestLength = aSrcLength;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD Reset()
|
||||
{
|
||||
mState = mState_ASCII;
|
||||
mLastLegalState = mState_ASCII;
|
||||
mRunLength = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
enum {
|
||||
mState_ASCII,
|
||||
mState_ESC,
|
||||
mState_ESC_28,
|
||||
mState_ESC_24,
|
||||
mState_ESC_24_28,
|
||||
mState_JISX0201_1976Roman,
|
||||
mState_JISX0201_1976Kana,
|
||||
mState_JISX0208_1978,
|
||||
mState_GB2312_1980,
|
||||
mState_JISX0208_1983,
|
||||
mState_KSC5601_1987,
|
||||
mState_JISX0212_1990,
|
||||
mState_JISX0208_1978_2ndbyte,
|
||||
mState_GB2312_1980_2ndbyte,
|
||||
mState_JISX0208_1983_2ndbyte,
|
||||
mState_KSC5601_1987_2ndbyte,
|
||||
mState_JISX0212_1990_2ndbyte,
|
||||
mState_ESC_2e,
|
||||
mState_ESC_4e,
|
||||
mState_ERROR
|
||||
} mState, mLastLegalState;
|
||||
int32_t mData;
|
||||
int32_t mRunLength; // the length of a non-ASCII run
|
||||
enum {
|
||||
G2_unknown,
|
||||
G2_ISO88591,
|
||||
G2_ISO88597
|
||||
} G2charset;
|
||||
nsCOMPtr<nsIUnicodeDecoder> mGB2312Decoder;
|
||||
nsCOMPtr<nsIUnicodeDecoder> mEUCKRDecoder;
|
||||
nsCOMPtr<nsIUnicodeDecoder> mISO88597Decoder;
|
||||
};
|
||||
#endif // nsShiftJISToUnicode_h__
|
@ -1,31 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUCVJA2CID_h___
|
||||
#define nsUCVJA2CID_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// Class ID for our EUCJPToUnicode charset converter
|
||||
// {3F6FE6A1-AC0A-11d2-B3AE-00805F8A6670}
|
||||
#define NS_EUCJPTOUNICODE_CID \
|
||||
{0x3f6fe6a1, 0xac0a, 0x11d2, {0xb3, 0xae, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70}}
|
||||
|
||||
// Class ID for our ISO2022JPToUnicode charset converter
|
||||
// {3F6FE6A2-AC0A-11d2-B3AE-00805F8A6670}
|
||||
#define NS_ISO2022JPTOUNICODE_CID \
|
||||
{0x3f6fe6a2, 0xac0a, 0x11d2, {0xb3, 0xae, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70}}
|
||||
|
||||
// Class ID for our UnicodeToEUCJP charset converter
|
||||
// {45C23A20-D71C-11d2-8AAC-00600811A836}
|
||||
#define NS_UNICODETOEUCJP_CID \
|
||||
{0x45c23a20, 0xd71c, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
// Class ID for our UnicodeToISO2022JP charset converter
|
||||
// {4F76E100-D71C-11d2-8AAC-00600811A836}
|
||||
#define NS_UNICODETOISO2022JP_CID \
|
||||
{0x4f76e100, 0xd71c, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#endif /* nsUCVJA2CID_h___ */
|
@ -1,21 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUCVJACID_h___
|
||||
#define nsUCVJACID_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// Class ID for our SJIS2Unicode charset converter
|
||||
// {0E6892C1-A9AD-11d2-B3AE-00805F8A6670}
|
||||
#define NS_SJISTOUNICODE_CID \
|
||||
{0xe6892c1, 0xa9ad, 0x11d2, {0xb3, 0xae, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70}}
|
||||
|
||||
// Class ID for our UnicodeToSJIS charset converter
|
||||
// {E28AB250-D66D-11d2-8AAC-00600811A836}
|
||||
#define NS_UNICODETOSJIS_CID \
|
||||
{0xe28ab250, 0xd66d, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#endif /* nsUCVJACID_h___ */
|
@ -1,18 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUCVJADll_h_
|
||||
#define nsUCVJADll_h_
|
||||
|
||||
extern const uint16_t g_ut0201Mapping[];
|
||||
extern const uint16_t g_ut0208Mapping[];
|
||||
extern const uint16_t g_ut0212Mapping[];
|
||||
|
||||
extern const uint16_t g_uf0201Mapping[];
|
||||
extern const uint16_t g_uf0201GLMapping[];
|
||||
extern const uint16_t g_uf0208Mapping[];
|
||||
extern const uint16_t g_uf0208extMapping[];
|
||||
|
||||
#endif /* nsUCVJADll_h_ */
|
@ -1,50 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsUnicodeToEUCJP.h"
|
||||
#include "nsUCVJADll.h"
|
||||
#include "nsUCConstructors.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
// Shift Table
|
||||
static const int16_t g0201ShiftOutTable[] = {
|
||||
2,
|
||||
ShiftOutCell(u1ByteChar, 1, 0x00, 0x00, 0x00, 0x7F),
|
||||
ShiftOutCell(u1BytePrefix8EChar, 2, 0x00, 0xA1, 0x00, 0xDF)
|
||||
};
|
||||
|
||||
#define SIZE_OF_EUCJP_TABLES 3
|
||||
static const uScanClassID gScanClassIDs[SIZE_OF_EUCJP_TABLES] = {
|
||||
u2BytesGRCharset,
|
||||
u2BytesGRCharset,
|
||||
uMultibytesCharset
|
||||
};
|
||||
|
||||
static const int16_t *gShiftTables[SIZE_OF_EUCJP_TABLES] = {
|
||||
0,
|
||||
0,
|
||||
g0201ShiftOutTable
|
||||
};
|
||||
|
||||
static const uint16_t *gMappingTables[SIZE_OF_EUCJP_TABLES] = {
|
||||
g_uf0208Mapping,
|
||||
g_uf0208extMapping,
|
||||
g_uf0201Mapping
|
||||
};
|
||||
|
||||
nsresult
|
||||
nsUnicodeToEUCJPConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
return CreateMultiTableEncoder(SIZE_OF_EUCJP_TABLES,
|
||||
(uScanClassID*) gScanClassIDs,
|
||||
(uShiftOutTable**) gShiftTables,
|
||||
(uMappingTable**) gMappingTables,
|
||||
3 /* max length = src * 3 */,
|
||||
aOuter, aIID, aResult);
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUnicodeToEUCJP_h___
|
||||
#define nsUnicodeToEUCJP_h___
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
class nsISupports;
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to EUCJP.
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
nsresult
|
||||
nsUnicodeToEUCJPConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
#endif /* nsUnicodeToEUCJP_h___ */
|
@ -1,271 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsUnicodeToISO2022JP.h"
|
||||
#include "nsUCVJADll.h"
|
||||
#include "nsUnicodeEncodeHelper.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
// Basic mapping from Hankaku to Zenkaku
|
||||
// Nigori and Maru are taken care of outside this basic mapping
|
||||
static const char16_t gBasicMapping[0x40] =
|
||||
{
|
||||
// 0xff60
|
||||
0xff60,0x3002,0x300c,0x300d,0x3001,0x30fb,0x30f2,0x30a1,
|
||||
// 0xff68
|
||||
0x30a3,0x30a5,0x30a7,0x30a9,0x30e3,0x30e5,0x30e7,0x30c3,
|
||||
// 0xff70
|
||||
0x30fc,0x30a2,0x30a4,0x30a6,0x30a8,0x30aa,0x30ab,0x30ad,
|
||||
// 0xff78
|
||||
0x30af,0x30b1,0x30b3,0x30b5,0x30b7,0x30b9,0x30bb,0x30bd,
|
||||
// 0xff80
|
||||
0x30bf,0x30c1,0x30c4,0x30c6,0x30c8,0x30ca,0x30cb,0x30cc,
|
||||
// 0xff88
|
||||
0x30cd,0x30ce,0x30cf,0x30d2,0x30d5,0x30d8,0x30db,0x30de,
|
||||
// 0xff90
|
||||
0x30df,0x30e0,0x30e1,0x30e2,0x30e4,0x30e6,0x30e8,0x30e9,
|
||||
// 0xff98
|
||||
0x30ea,0x30eb,0x30ec,0x30ed,0x30ef,0x30f3,0x309b,0x309c
|
||||
};
|
||||
|
||||
// Do we need to check for Nigori for the next unicode ?
|
||||
#define NEED_TO_CHECK_NIGORI(u) (((0xff76<=(u))&&((u)<=0xff84))||((0xff8a<=(u))&&((u)<=0xff8e)))
|
||||
|
||||
// Do we need to check for Maru for the next unicode ?
|
||||
#define NEED_TO_CHECK_MARU(u) ((0xff8a<=(u))&&((u)<=0xff8e))
|
||||
|
||||
// The unicode is in Katakana Hankaku block
|
||||
#define IS_HANKAKU(u) ((0xff61 <= (u)) && ((u) <= 0xff9f))
|
||||
#define IS_NIGORI(u) (0xff9e == (u))
|
||||
#define IS_MARU(u) (0xff9f == (u))
|
||||
#define NIGORI_MODIFIER 1
|
||||
#define MARU_MODIFIER 2
|
||||
|
||||
static const uint16_t g_ufAsciiMapping [] = {
|
||||
0x0001, 0x0004, 0x0005, 0x0008, 0x0000, 0x0000, 0x007F, 0x0000
|
||||
};
|
||||
|
||||
#define SIZE_OF_ISO2022JP_TABLES 5
|
||||
static const uint16_t * g_ufMappingTables[SIZE_OF_ISO2022JP_TABLES] = {
|
||||
g_ufAsciiMapping, // ASCII ISOREG 6
|
||||
g_uf0201GLMapping, // JIS X 0201-1976 ISOREG 14
|
||||
g_uf0208Mapping, // JIS X 0208-1983 ISOREG 87
|
||||
g_uf0208extMapping, // JIS X 0208 - cp932 ext
|
||||
g_uf0208Mapping, // JIS X 0208-1978 ISOREG 42
|
||||
};
|
||||
|
||||
static const uScanClassID g_ufScanClassIDs[SIZE_OF_ISO2022JP_TABLES] = {
|
||||
u1ByteCharset, // ASCII ISOREG 6
|
||||
u1ByteCharset, // JIS X 0201-1976 ISOREG 14
|
||||
u2BytesCharset, // JIS X 0208-1983 ISOREG 87
|
||||
u2BytesCharset, // JIS X 0208- cp932 ext
|
||||
u2BytesCharset, // JIS X 0208-1978 ISOREG 42
|
||||
};
|
||||
#define JIS_X_208_INDEX 2
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToISO2022JP [implementation]
|
||||
|
||||
// worst case max length:
|
||||
// 1 2 3 4 5 6 7 8
|
||||
// ESC $ B XX XX ESC ( B
|
||||
nsUnicodeToISO2022JP::nsUnicodeToISO2022JP()
|
||||
: nsEncoderSupport(8)
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
nsUnicodeToISO2022JP::~nsUnicodeToISO2022JP()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult nsUnicodeToISO2022JP::ChangeCharset(int32_t aCharset,
|
||||
char * aDest,
|
||||
int32_t * aDestLength)
|
||||
{
|
||||
// both 2 and 3 generate the same escape sequence. 2 is for
|
||||
// the standard JISx0208 table, and 3 is for theCP932 extensions
|
||||
// therefore, we treat them as the same one.
|
||||
if(((2 == aCharset) && ( 3 == mCharset)) ||
|
||||
((3 == aCharset) && ( 2 == mCharset)) )
|
||||
{
|
||||
mCharset = aCharset;
|
||||
}
|
||||
|
||||
if(aCharset == mCharset)
|
||||
{
|
||||
*aDestLength = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (*aDestLength < 3) {
|
||||
*aDestLength = 0;
|
||||
return NS_OK_UENC_MOREOUTPUT;
|
||||
}
|
||||
|
||||
switch (aCharset) {
|
||||
case 0: // ASCII ISOREG 6
|
||||
aDest[0] = 0x1b;
|
||||
aDest[1] = '(';
|
||||
aDest[2] = 'B';
|
||||
break;
|
||||
case 1: // JIS X 0201-1976 ("Roman" set) ISOREG 14
|
||||
aDest[0] = 0x1b;
|
||||
aDest[1] = '(';
|
||||
aDest[2] = 'J';
|
||||
break;
|
||||
case 2: // JIS X 0208-1983 ISOREG 87
|
||||
case 3: // JIS X 0208-1983
|
||||
// we currently use this for CP932 ext
|
||||
aDest[0] = 0x1b;
|
||||
aDest[1] = '$';
|
||||
aDest[2] = 'B';
|
||||
break;
|
||||
case 4: // JIS X 0201-1978 ISOREG 87-
|
||||
// we currently do not have a diff mapping for it.
|
||||
aDest[0] = 0x1b;
|
||||
aDest[1] = '$';
|
||||
aDest[2] = '@';
|
||||
break;
|
||||
}
|
||||
|
||||
mCharset = aCharset;
|
||||
*aDestLength = 3;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsUnicodeToISO2022JP::ConvertHankaku(const char16_t * aSrc,
|
||||
int32_t * aSrcLength,
|
||||
char * aDest,
|
||||
int32_t * aDestLength)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
const char16_t * src = aSrc;
|
||||
const char16_t * srcEnd = aSrc + *aSrcLength;
|
||||
char * dest = aDest;
|
||||
char * destEnd = aDest + *aDestLength;
|
||||
char16_t srcChar, tempChar;
|
||||
int32_t bcr, bcw;
|
||||
|
||||
bcw = destEnd - dest;
|
||||
res = ChangeCharset(JIS_X_208_INDEX, dest, &bcw);
|
||||
dest += bcw;
|
||||
if (res != NS_OK) {
|
||||
return res;
|
||||
}
|
||||
|
||||
while (src < srcEnd) {
|
||||
srcChar = *src;
|
||||
if (!IS_HANKAKU(srcChar)) {
|
||||
break;
|
||||
}
|
||||
++src;
|
||||
tempChar = gBasicMapping[(srcChar) - 0xff60];
|
||||
|
||||
if (src < srcEnd) {
|
||||
// if the character could take a modifier, and the next char
|
||||
// is a modifier, modify it and eat one char16_t
|
||||
if (NEED_TO_CHECK_NIGORI(srcChar) && IS_NIGORI(*src)) {
|
||||
tempChar += NIGORI_MODIFIER;
|
||||
++src;
|
||||
} else if (NEED_TO_CHECK_MARU(srcChar) && IS_MARU(*src)) {
|
||||
tempChar += MARU_MODIFIER;
|
||||
++src;
|
||||
}
|
||||
}
|
||||
bcr = 1;
|
||||
bcw = destEnd - dest;
|
||||
res = nsUnicodeEncodeHelper::ConvertByTable(
|
||||
&tempChar, &bcr, dest, &bcw, g_ufScanClassIDs[JIS_X_208_INDEX],
|
||||
nullptr, (uMappingTable *) g_ufMappingTables[JIS_X_208_INDEX]);
|
||||
dest += bcw;
|
||||
if (res != NS_OK)
|
||||
break;
|
||||
}
|
||||
*aDestLength = dest - aDest;
|
||||
*aSrcLength = src - aSrc;
|
||||
return res;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Subclassing of nsTableEncoderSupport class [implementation]
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToISO2022JP::ConvertNoBuffNoErr(
|
||||
const char16_t * aSrc,
|
||||
int32_t * aSrcLength,
|
||||
char * aDest,
|
||||
int32_t * aDestLength)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
const char16_t * src = aSrc;
|
||||
const char16_t * srcEnd = aSrc + *aSrcLength;
|
||||
char * dest = aDest;
|
||||
char * destEnd = aDest + *aDestLength;
|
||||
int32_t bcr, bcw;
|
||||
int32_t i;
|
||||
|
||||
while (src < srcEnd) {
|
||||
for (i=0; i< SIZE_OF_ISO2022JP_TABLES ; i++) {
|
||||
bcr = 1;
|
||||
bcw = destEnd - dest;
|
||||
res = nsUnicodeEncodeHelper::ConvertByTable(src, &bcr, dest, &bcw,
|
||||
g_ufScanClassIDs[i], nullptr,
|
||||
(uMappingTable *) g_ufMappingTables[i]);
|
||||
if (res != NS_ERROR_UENC_NOMAPPING) break;
|
||||
}
|
||||
|
||||
if ( i>= SIZE_OF_ISO2022JP_TABLES) {
|
||||
if (IS_HANKAKU(*src)) {
|
||||
bcr = srcEnd - src;
|
||||
bcw = destEnd - dest;
|
||||
res = ConvertHankaku(src, &bcr, dest, &bcw);
|
||||
dest += bcw;
|
||||
src += bcr;
|
||||
if (res == NS_OK) continue;
|
||||
} else {
|
||||
res = NS_ERROR_UENC_NOMAPPING;
|
||||
src++;
|
||||
}
|
||||
}
|
||||
if (res != NS_OK) break;
|
||||
|
||||
bcw = destEnd - dest;
|
||||
res = ChangeCharset(i, dest, &bcw);
|
||||
dest += bcw;
|
||||
if (res != NS_OK) break;
|
||||
|
||||
bcr = srcEnd - src;
|
||||
bcw = destEnd - dest;
|
||||
res = nsUnicodeEncodeHelper::ConvertByTable(src, &bcr, dest, &bcw,
|
||||
g_ufScanClassIDs[i], nullptr,
|
||||
(uMappingTable *) g_ufMappingTables[i]);
|
||||
src += bcr;
|
||||
dest += bcw;
|
||||
|
||||
if ((res != NS_OK) && (res != NS_ERROR_UENC_NOMAPPING)) break;
|
||||
if (res == NS_ERROR_UENC_NOMAPPING) src--;
|
||||
}
|
||||
|
||||
*aSrcLength = src - aSrc;
|
||||
*aDestLength = dest - aDest;
|
||||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToISO2022JP::FinishNoBuff(char * aDest,
|
||||
int32_t * aDestLength)
|
||||
{
|
||||
ChangeCharset(0, aDest, aDestLength);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsUnicodeToISO2022JP::Reset()
|
||||
{
|
||||
mCharset = 0;
|
||||
return nsEncoderSupport::Reset();
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUnicodeToISO2022JP_h___
|
||||
#define nsUnicodeToISO2022JP_h___
|
||||
|
||||
#include "nsUCSupport.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Class nsUnicodeToISO2022JP [declaration]
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to ISO2022JP.
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
class nsUnicodeToISO2022JP : public nsEncoderSupport
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
nsUnicodeToISO2022JP();
|
||||
|
||||
/**
|
||||
* Class destructor.
|
||||
*/
|
||||
virtual ~nsUnicodeToISO2022JP();
|
||||
|
||||
protected:
|
||||
|
||||
int32_t mCharset; // current character set
|
||||
|
||||
nsresult ChangeCharset(int32_t aCharset, char * aDest,
|
||||
int32_t * aDestLength);
|
||||
nsresult ConvertHankaku(const char16_t *aSrc, int32_t * aSrcLength,
|
||||
char *aDest, int32_t * aDestLength);
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Subclassing of nsEncoderSupport class [declaration]
|
||||
|
||||
NS_IMETHOD ConvertNoBuffNoErr(const char16_t * aSrc, int32_t * aSrcLength,
|
||||
char * aDest, int32_t * aDestLength);
|
||||
NS_IMETHOD FinishNoBuff(char * aDest, int32_t * aDestLength);
|
||||
NS_IMETHOD Reset();
|
||||
};
|
||||
|
||||
#endif /* nsUnicodeToISO2022JP_h___ */
|
@ -1,34 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsUCConstructors.h"
|
||||
#include "nsUnicodeToSJIS.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static const uint16_t g_SJISMappingTable[] = {
|
||||
#include "sjis.uf"
|
||||
};
|
||||
|
||||
static const int16_t g_SJISShiftOutTable[] = {
|
||||
4,
|
||||
ShiftOutCell(u1ByteChar, 1, 0x00, 0x00, 0x00, 0x7F),
|
||||
ShiftOutCell(u1ByteChar, 1, 0x00, 0xA1, 0x00, 0xDF),
|
||||
ShiftOutCell(u2BytesChar, 2, 0x81, 0x40, 0x9F, 0xFC),
|
||||
ShiftOutCell(u2BytesChar, 2, 0xE0, 0x40, 0xFC, 0xFC)
|
||||
};
|
||||
|
||||
nsresult
|
||||
nsUnicodeToSJISConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
return CreateTableEncoder(uMultibytesCharset,
|
||||
(uShiftOutTable*) &g_SJISShiftOutTable,
|
||||
(uMappingTable*) &g_SJISMappingTable,
|
||||
2 /* max length = src * 2 */,
|
||||
aOuter, aIID, aResult);
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUnicodeToSJIS_h___
|
||||
#define nsUnicodeToSJIS_h___
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
class nsISupports;
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to SJIS.
|
||||
*
|
||||
* @created 17/Feb/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
nsresult
|
||||
nsUnicodeToSJISConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
#endif /* nsUnicodeToSJIS_h___ */
|
File diff suppressed because it is too large
Load Diff
@ -1,491 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* The mapping table converting a sequence of 'basic' jamos to a cluster jamo.
|
||||
* There are 4 groups in the table. Group 1 and Group 2 are obtained by the
|
||||
* direct translation of Hangul Jamo compatibility decomposition mapping
|
||||
* found in Unicode 2.0 data table at
|
||||
* ftp://ftp.unicode.org/Public/2.0-update to
|
||||
* JamoNormMap type struct. Group 3 and Group 4 are derived from Group 1
|
||||
* entries mapping a sequence of three Jamos to a cluster Jamo. In Group 3 and
|
||||
* Group 4, the first two Jamos or the last two Jamos in Group 1 are combined
|
||||
* together, if possible, to form a new 'basic' Jamo that, in turn is mapped
|
||||
* along with the last Jamo (in case of Group 3) or the first Jamo (in Group 4)
|
||||
* to a cluster jamo.
|
||||
*
|
||||
* The full list is available at http://jshin.net/i18n/korean/jamocomp.html.
|
||||
*/
|
||||
|
||||
// To reduce memory footprint, array elements are shifted by 0x1100
|
||||
// from their actual positions at 0x1100.
|
||||
|
||||
// group 1: cluster jamos made of three basic jamos sorted for binary search
|
||||
|
||||
const static JamoNormMap gJamoClustersGroup1[] =
|
||||
{
|
||||
{{0x07, 0x07, 0x0b}, 0x2c},
|
||||
{{0x07, 0x09, 0x00}, 0x22},
|
||||
{{0x07, 0x09, 0x03}, 0x23},
|
||||
{{0x07, 0x09, 0x07}, 0x24},
|
||||
{{0x07, 0x09, 0x09}, 0x25},
|
||||
{{0x07, 0x09, 0x0c}, 0x26},
|
||||
{{0x09, 0x07, 0x00}, 0x33},
|
||||
{{0x09, 0x09, 0x09}, 0x34},
|
||||
{{0x69, 0x61, 0x75}, 0x6b},
|
||||
{{0x69, 0x65, 0x75}, 0x80},
|
||||
{{0x69, 0x67, 0x75}, 0x81},
|
||||
{{0x6d, 0x63, 0x75}, 0x85},
|
||||
{{0x6e, 0x61, 0x75}, 0x8a},
|
||||
{{0x6e, 0x65, 0x73}, 0x8b},
|
||||
{{0x6e, 0x65, 0x75}, 0x70},
|
||||
{{0x6e, 0x67, 0x75}, 0x8c},
|
||||
{{0x72, 0x65, 0x75}, 0x90},
|
||||
{{0x72, 0x67, 0x75}, 0x92},
|
||||
{{0x73, 0x75, 0x6e}, 0x97},
|
||||
{{0xa8, 0xba, 0xa8}, 0xc4},
|
||||
{{0xaf, 0xa8, 0xba}, 0xcc},
|
||||
{{0xaf, 0xae, 0xc2}, 0xcf},
|
||||
{{0xaf, 0xb7, 0xa8}, 0xd1},
|
||||
{{0xaf, 0xb7, 0xba}, 0xd2},
|
||||
{{0xaf, 0xb8, 0xba}, 0xd3},
|
||||
{{0xaf, 0xb8, 0xbc}, 0xd5},
|
||||
{{0xaf, 0xb8, 0xc2}, 0xd4},
|
||||
{{0xaf, 0xba, 0xba}, 0xd6},
|
||||
{{0xb7, 0xba, 0xba}, 0xde},
|
||||
{{0xbc, 0xa8, 0xa8}, 0xed}
|
||||
};
|
||||
|
||||
const static JamoNormMap gJamoClustersGroup234[] =
|
||||
{
|
||||
{{0x00, 0x00, 0}, 0x01},
|
||||
{{0x02, 0x00, 0}, 0x13},
|
||||
{{0x02, 0x02, 0}, 0x14},
|
||||
{{0x02, 0x03, 0}, 0x15},
|
||||
{{0x02, 0x07, 0}, 0x16},
|
||||
{{0x03, 0x00, 0}, 0x17},
|
||||
{{0x03, 0x03, 0}, 0x04},
|
||||
{{0x05, 0x02, 0}, 0x18},
|
||||
{{0x05, 0x05, 0}, 0x19},
|
||||
{{0x05, 0x0b, 0}, 0x1b},
|
||||
{{0x05, 0x12, 0}, 0x1a},
|
||||
{{0x06, 0x07, 0}, 0x1c},
|
||||
{{0x06, 0x0b, 0}, 0x1d},
|
||||
{{0x07, 0x00, 0}, 0x1e},
|
||||
{{0x07, 0x02, 0}, 0x1f},
|
||||
{{0x07, 0x03, 0}, 0x20},
|
||||
{{0x07, 0x07, 0}, 0x08},
|
||||
{{0x07, 0x09, 0}, 0x21},
|
||||
{{0x07, 0x0a, 0}, 0x25},
|
||||
{{0x07, 0x0b, 0}, 0x2b},
|
||||
{{0x07, 0x0c, 0}, 0x27},
|
||||
{{0x07, 0x0e, 0}, 0x28},
|
||||
{{0x07, 0x10, 0}, 0x29},
|
||||
{{0x07, 0x11, 0}, 0x2a},
|
||||
{{0x07, 0x2b, 0}, 0x2c},
|
||||
{{0x07, 0x2d, 0}, 0x22},
|
||||
{{0x07, 0x2f, 0}, 0x23},
|
||||
{{0x07, 0x32, 0}, 0x24},
|
||||
{{0x07, 0x36, 0}, 0x26},
|
||||
{{0x08, 0x0b, 0}, 0x2c},
|
||||
{{0x09, 0x00, 0}, 0x2d},
|
||||
{{0x09, 0x02, 0}, 0x2e},
|
||||
{{0x09, 0x03, 0}, 0x2f},
|
||||
{{0x09, 0x05, 0}, 0x30},
|
||||
{{0x09, 0x06, 0}, 0x31},
|
||||
{{0x09, 0x07, 0}, 0x32},
|
||||
{{0x09, 0x09, 0}, 0x0a},
|
||||
{{0x09, 0x0a, 0}, 0x34},
|
||||
{{0x09, 0x0b, 0}, 0x35},
|
||||
{{0x09, 0x0c, 0}, 0x36},
|
||||
{{0x09, 0x0e, 0}, 0x37},
|
||||
{{0x09, 0x0f, 0}, 0x38},
|
||||
{{0x09, 0x10, 0}, 0x39},
|
||||
{{0x09, 0x11, 0}, 0x3a},
|
||||
{{0x09, 0x12, 0}, 0x3b},
|
||||
{{0x09, 0x1e, 0}, 0x33},
|
||||
{{0x0a, 0x09, 0}, 0x34},
|
||||
{{0x0b, 0x00, 0}, 0x41},
|
||||
{{0x0b, 0x03, 0}, 0x42},
|
||||
{{0x0b, 0x06, 0}, 0x43},
|
||||
{{0x0b, 0x07, 0}, 0x44},
|
||||
{{0x0b, 0x09, 0}, 0x45},
|
||||
{{0x0b, 0x0b, 0}, 0x47},
|
||||
{{0x0b, 0x0c, 0}, 0x48},
|
||||
{{0x0b, 0x0e, 0}, 0x49},
|
||||
{{0x0b, 0x10, 0}, 0x4a},
|
||||
{{0x0b, 0x11, 0}, 0x4b},
|
||||
{{0x0b, 0x40, 0}, 0x46},
|
||||
{{0x0c, 0x0b, 0}, 0x4d},
|
||||
{{0x0c, 0x0c, 0}, 0x0d},
|
||||
{{0x0e, 0x0f, 0}, 0x52},
|
||||
{{0x0e, 0x12, 0}, 0x53},
|
||||
{{0x11, 0x07, 0}, 0x56},
|
||||
{{0x11, 0x0b, 0}, 0x57},
|
||||
{{0x12, 0x12, 0}, 0x58},
|
||||
{{0x21, 0x00, 0}, 0x22},
|
||||
{{0x21, 0x03, 0}, 0x23},
|
||||
{{0x21, 0x07, 0}, 0x24},
|
||||
{{0x21, 0x09, 0}, 0x25},
|
||||
{{0x21, 0x0c, 0}, 0x26},
|
||||
{{0x32, 0x00, 0}, 0x33},
|
||||
{{0x3c, 0x3c, 0}, 0x3d},
|
||||
{{0x3e, 0x3e, 0}, 0x3f},
|
||||
{{0x4e, 0x4e, 0}, 0x4f},
|
||||
{{0x50, 0x50, 0}, 0x51},
|
||||
{{0x61, 0x69, 0}, 0x76},
|
||||
{{0x61, 0x6e, 0}, 0x77},
|
||||
{{0x61, 0x75, 0}, 0x62},
|
||||
{{0x63, 0x69, 0}, 0x78},
|
||||
{{0x63, 0x6d, 0}, 0x79},
|
||||
{{0x63, 0x75, 0}, 0x64},
|
||||
{{0x65, 0x69, 0}, 0x7a},
|
||||
{{0x65, 0x6e, 0}, 0x7b},
|
||||
{{0x65, 0x73, 0}, 0x7c},
|
||||
{{0x65, 0x75, 0}, 0x66},
|
||||
{{0x67, 0x69, 0}, 0x7d},
|
||||
{{0x67, 0x6e, 0}, 0x7e},
|
||||
{{0x67, 0x75, 0}, 0x68},
|
||||
{{0x69, 0x61, 0}, 0x6a},
|
||||
{{0x69, 0x62, 0}, 0x6b},
|
||||
{{0x69, 0x65, 0}, 0x7f},
|
||||
{{0x69, 0x66, 0}, 0x80},
|
||||
{{0x69, 0x68, 0}, 0x81},
|
||||
{{0x69, 0x69, 0}, 0x82},
|
||||
{{0x69, 0x6e, 0}, 0x83},
|
||||
{{0x69, 0x75, 0}, 0x6c},
|
||||
{{0x6a, 0x75, 0}, 0x6b},
|
||||
{{0x6d, 0x63, 0}, 0x84},
|
||||
{{0x6d, 0x64, 0}, 0x85},
|
||||
{{0x6d, 0x67, 0}, 0x86},
|
||||
{{0x6d, 0x69, 0}, 0x87},
|
||||
{{0x6d, 0x75, 0}, 0x88},
|
||||
{{0x6e, 0x61, 0}, 0x89},
|
||||
{{0x6e, 0x62, 0}, 0x8a},
|
||||
{{0x6e, 0x65, 0}, 0x6f},
|
||||
{{0x6e, 0x66, 0}, 0x70},
|
||||
{{0x6e, 0x68, 0}, 0x8c},
|
||||
{{0x6e, 0x6e, 0}, 0x8d},
|
||||
{{0x6e, 0x75, 0}, 0x71},
|
||||
{{0x6e, 0x7c, 0}, 0x8b},
|
||||
{{0x6f, 0x73, 0}, 0x8b},
|
||||
{{0x6f, 0x75, 0}, 0x70},
|
||||
{{0x72, 0x61, 0}, 0x8e},
|
||||
{{0x72, 0x65, 0}, 0x8f},
|
||||
{{0x72, 0x66, 0}, 0x90},
|
||||
{{0x72, 0x67, 0}, 0x91},
|
||||
{{0x72, 0x68, 0}, 0x92},
|
||||
{{0x72, 0x6e, 0}, 0x93},
|
||||
{{0x72, 0x75, 0}, 0x94},
|
||||
{{0x73, 0x6e, 0}, 0x95},
|
||||
{{0x73, 0x73, 0}, 0x96},
|
||||
{{0x73, 0x75, 0}, 0x74},
|
||||
{{0x73, 0x9b, 0}, 0x97},
|
||||
{{0x74, 0x6e, 0}, 0x97},
|
||||
{{0x75, 0x61, 0}, 0x98},
|
||||
{{0x75, 0x63, 0}, 0x99},
|
||||
{{0x75, 0x69, 0}, 0x9a},
|
||||
{{0x75, 0x6e, 0}, 0x9b},
|
||||
{{0x75, 0x73, 0}, 0x9c},
|
||||
{{0x75, 0x9e, 0}, 0x9d},
|
||||
{{0x7f, 0x75, 0}, 0x80},
|
||||
{{0x84, 0x75, 0}, 0x85},
|
||||
{{0x89, 0x75, 0}, 0x8a},
|
||||
{{0x8f, 0x75, 0}, 0x90},
|
||||
{{0x91, 0x75, 0}, 0x92},
|
||||
{{0x9e, 0x65, 0}, 0x9f},
|
||||
{{0x9e, 0x6e, 0}, 0xa0},
|
||||
{{0x9e, 0x75, 0}, 0xa1},
|
||||
{{0x9e, 0x9e, 0}, 0xa2},
|
||||
{{0xa8, 0xa8, 0}, 0xa9},
|
||||
{{0xa8, 0xaf, 0}, 0xc3},
|
||||
{{0xa8, 0xba, 0}, 0xaa},
|
||||
{{0xa8, 0xe7, 0}, 0xc4},
|
||||
{{0xaa, 0xa8, 0}, 0xc4},
|
||||
{{0xab, 0xa8, 0}, 0xc5},
|
||||
{{0xab, 0xae, 0}, 0xc6},
|
||||
{{0xab, 0xba, 0}, 0xc7},
|
||||
{{0xab, 0xbd, 0}, 0xac},
|
||||
{{0xab, 0xc0, 0}, 0xc9},
|
||||
{{0xab, 0xc2, 0}, 0xad},
|
||||
{{0xab, 0xeb, 0}, 0xc8},
|
||||
{{0xae, 0xa8, 0}, 0xca},
|
||||
{{0xae, 0xaf, 0}, 0xcb},
|
||||
{{0xaf, 0xa8, 0}, 0xb0},
|
||||
{{0xaf, 0xaa, 0}, 0xcc},
|
||||
{{0xaf, 0xab, 0}, 0xcd},
|
||||
{{0xaf, 0xae, 0}, 0xce},
|
||||
{{0xaf, 0xaf, 0}, 0xd0},
|
||||
{{0xaf, 0xb7, 0}, 0xb1},
|
||||
{{0xaf, 0xb8, 0}, 0xb2},
|
||||
{{0xaf, 0xb9, 0}, 0xd3},
|
||||
{{0xaf, 0xba, 0}, 0xb3},
|
||||
{{0xaf, 0xbb, 0}, 0xd6},
|
||||
{{0xaf, 0xbf, 0}, 0xd8},
|
||||
{{0xaf, 0xc0, 0}, 0xb4},
|
||||
{{0xaf, 0xc1, 0}, 0xb5},
|
||||
{{0xaf, 0xc2, 0}, 0xb6},
|
||||
{{0xaf, 0xda, 0}, 0xd1},
|
||||
{{0xaf, 0xdd, 0}, 0xd2},
|
||||
{{0xaf, 0xe5, 0}, 0xd4},
|
||||
{{0xaf, 0xe6, 0}, 0xd5},
|
||||
{{0xaf, 0xeb, 0}, 0xd7},
|
||||
{{0xaf, 0xf9, 0}, 0xd9},
|
||||
{{0xb0, 0xba, 0}, 0xcc},
|
||||
{{0xb1, 0xa8, 0}, 0xd1},
|
||||
{{0xb1, 0xba, 0}, 0xd2},
|
||||
{{0xb2, 0xba, 0}, 0xd3},
|
||||
{{0xb2, 0xbc, 0}, 0xd5},
|
||||
{{0xb2, 0xc2, 0}, 0xd4},
|
||||
{{0xb3, 0xba, 0}, 0xd6},
|
||||
{{0xb7, 0xa8, 0}, 0xda},
|
||||
{{0xb7, 0xaf, 0}, 0xdb},
|
||||
{{0xb7, 0xb8, 0}, 0xdc},
|
||||
{{0xb7, 0xba, 0}, 0xdd},
|
||||
{{0xb7, 0xbb, 0}, 0xde},
|
||||
{{0xb7, 0xbc, 0}, 0xe2},
|
||||
{{0xb7, 0xbe, 0}, 0xe0},
|
||||
{{0xb7, 0xc2, 0}, 0xe1},
|
||||
{{0xb7, 0xeb, 0}, 0xdf},
|
||||
{{0xb8, 0xaf, 0}, 0xe3},
|
||||
{{0xb8, 0xba, 0}, 0xb9},
|
||||
{{0xb8, 0xbc, 0}, 0xe6},
|
||||
{{0xb8, 0xc1, 0}, 0xe4},
|
||||
{{0xb8, 0xc2, 0}, 0xe5},
|
||||
{{0xba, 0xa8, 0}, 0xe7},
|
||||
{{0xba, 0xae, 0}, 0xe8},
|
||||
{{0xba, 0xaf, 0}, 0xe9},
|
||||
{{0xba, 0xb8, 0}, 0xea},
|
||||
{{0xba, 0xba, 0}, 0xbb},
|
||||
{{0xbc, 0xa8, 0}, 0xec},
|
||||
{{0xbc, 0xa9, 0}, 0xed},
|
||||
{{0xbc, 0xbc, 0}, 0xee},
|
||||
{{0xbc, 0xbf, 0}, 0xef},
|
||||
{{0xc1, 0xb8, 0}, 0xf3},
|
||||
{{0xc1, 0xbc, 0}, 0xf4},
|
||||
{{0xc2, 0xab, 0}, 0xf5},
|
||||
{{0xc2, 0xaf, 0}, 0xf6},
|
||||
{{0xc2, 0xb7, 0}, 0xf7},
|
||||
{{0xc2, 0xb8, 0}, 0xf8},
|
||||
{{0xce, 0xc2, 0}, 0xcf},
|
||||
{{0xdd, 0xba, 0}, 0xde},
|
||||
{{0xec, 0xa8, 0}, 0xed},
|
||||
{{0xf0, 0xba, 0}, 0xf1},
|
||||
{{0xf0, 0xeb, 0}, 0xf2}
|
||||
};
|
||||
|
||||
/**
|
||||
* Extended Jamo clusters included below were identified by Korean linguists
|
||||
* consulted by Microsoft Korea and the list is available at
|
||||
* http://www.microsoft.com/typography/otfntdev/hangulot/appen.htm
|
||||
* as well as obtainable from truetype fonts supporting them.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The map from sequences of leading consonants forming consonant clusters
|
||||
* not encoded in U+1100 block to temporary code points in the 0xf000 block.
|
||||
* To reduce memory footprint, array elements are shifted by 0xf000
|
||||
* from their actual positions.
|
||||
*/
|
||||
|
||||
const static JamoNormMap gExtLcClustersGroup1[]=
|
||||
{
|
||||
{{0x05, 0x00, 0x00}, 0x6a}, // U+1105 U+1100 U+1100 => lc # 0x6a
|
||||
{{0x05, 0x03, 0x03}, 0x6c}, // U+1105 U+1103 U+1103 => lc # 0x6c
|
||||
{{0x05, 0x07, 0x07}, 0x6f}, // U+1105 U+1107 U+1107 => lc # 0x6f
|
||||
{{0x05, 0x07, 0x0b}, 0x70}, // U+1105 U+1107 U+110b => lc # 0x70
|
||||
{{0x07, 0x09, 0x10}, 0x77}, // U+1107 U+1109 U+1110 => lc # 0x77
|
||||
{{0x09, 0x09, 0x07}, 0x7a}, // U+1109 U+1109 U+1107 => lc # 0x7a
|
||||
{{0x0c, 0x0c, 0x12}, 0x7d}, // U+110c U+110c U+1112 => lc # 0x7d
|
||||
};
|
||||
|
||||
const static JamoNormMap gExtLcClustersGroup2[]=
|
||||
{
|
||||
{{0x00, 0x03, 0}, 0x60}, // U+1100 U+1103 => lc # 0x60
|
||||
{{0x02, 0x09, 0}, 0x61}, // U+1102 U+1109 => lc # 0x61
|
||||
{{0x02, 0x0c, 0}, 0x62}, // U+1102 U+110c => lc # 0x62
|
||||
{{0x02, 0x12, 0}, 0x63}, // U+1102 U+1112 => lc # 0x63
|
||||
{{0x03, 0x05, 0}, 0x64}, // U+1103 U+1105 => lc # 0x64
|
||||
{{0x03, 0x06, 0}, 0x65}, // U+1103 U+1106 => lc # 0x65
|
||||
{{0x03, 0x07, 0}, 0x66}, // U+1103 U+1107 => lc # 0x66
|
||||
{{0x03, 0x09, 0}, 0x67}, // U+1103 U+1109 => lc # 0x67
|
||||
{{0x03, 0x0c, 0}, 0x68}, // U+1103 U+110c => lc # 0x68
|
||||
{{0x05, 0x00, 0}, 0x69}, // U+1105 U+1100 => lc # 0x69
|
||||
{{0x05, 0x01, 0}, 0x6a}, // U+1105 U+1101 => lc # 0x6a
|
||||
{{0x05, 0x03, 0}, 0x6b}, // U+1105 U+1103 => lc # 0x6b
|
||||
{{0x05, 0x04, 0}, 0x6c}, // U+1105 U+1104 => lc # 0x6c
|
||||
{{0x05, 0x06, 0}, 0x6d}, // U+1105 U+1106 => lc # 0x6d
|
||||
{{0x05, 0x07, 0}, 0x6e}, // U+1105 U+1107 => lc # 0x6e
|
||||
{{0x05, 0x08, 0}, 0x6f}, // U+1105 U+1108 => lc # 0x6f
|
||||
{{0x05, 0x09, 0}, 0x71}, // U+1105 U+1109 => lc # 0x71
|
||||
{{0x05, 0x0c, 0}, 0x72}, // U+1105 U+110c => lc # 0x72
|
||||
{{0x05, 0x0f, 0}, 0x73}, // U+1105 U+110f => lc # 0x73
|
||||
{{0x05, 0x2b, 0}, 0x70}, // U+1105 U+112b => lc # 0x70
|
||||
{{0x06, 0x00, 0}, 0x74}, // U+1106 U+1100 => lc # 0x74
|
||||
{{0x06, 0x03, 0}, 0x75}, // U+1106 U+1103 => lc # 0x75
|
||||
{{0x06, 0x09, 0}, 0x76}, // U+1106 U+1109 => lc # 0x76
|
||||
{{0x07, 0x0f, 0}, 0x78}, // U+1107 U+110f => lc # 0x78
|
||||
{{0x07, 0x12, 0}, 0x79}, // U+1107 U+1112 => lc # 0x79
|
||||
{{0x0a, 0x07, 0}, 0x7a}, // U+110a U+1107 => lc # 0x7a
|
||||
{{0x0b, 0x05, 0}, 0x7b}, // U+110b U+1105 => lc # 0x7b
|
||||
{{0x0b, 0x12, 0}, 0x7c}, // U+110b U+1112 => lc # 0x7c
|
||||
{{0x0d, 0x12, 0}, 0x7d}, // U+110d U+1112 => lc # 0x7d
|
||||
{{0x10, 0x10, 0}, 0x7e}, // U+1110 U+1110 => lc # 0x7e
|
||||
{{0x11, 0x12, 0}, 0x7f}, // U+1111 U+1112 => lc # 0x7f
|
||||
{{0x12, 0x09, 0}, 0x80}, // U+1112 U+1109 => lc # 0x80
|
||||
{{0x59, 0x59, 0}, 0x81}, // U+1159 U+1159 => lc # 0x81
|
||||
};
|
||||
|
||||
/**
|
||||
* The map from sequences of vowels forming vowels clusters
|
||||
* not encoded in U+1100 block to temporary code points in the 0xf100 block.
|
||||
* To reduce memory footprint, array elements are shifted by 0xf100
|
||||
* from their actual positions.
|
||||
*/
|
||||
|
||||
const static JamoNormMap gExtVoClustersGroup1[]=
|
||||
{
|
||||
{{0x09, 0x03, 0x15}, 0x47}, // U+1169 U+1163 U+1175 => vowel # 0x47
|
||||
{{0x09, 0x0e, 0x3e}, 0x49}, // U+1169 U+116e U+119e => vowel # 0x49
|
||||
{{0x0d, 0x01, 0x15}, 0x4b}, // U+116d U+1161 U+1175 => vowel # 0x4b
|
||||
{{0x0e, 0x15, 0x15}, 0x4e}, // U+116e U+1175 U+1175 => vowel # 0x4e
|
||||
{{0x12, 0x01, 0x15}, 0x4f}, // U+1172 U+1161 U+1175 => vowel # 0x4f
|
||||
{{0x13, 0x05, 0x15}, 0x53}, // U+1173 U+1165 U+1175 => vowel # 0x53
|
||||
{{0x15, 0x03, 0x09}, 0x55}, // U+1175 U+1163 U+1169 => vowel # 0x55
|
||||
{{0x15, 0x03, 0x15}, 0x56}, // U+1175 U+1163 U+1175 => vowel # 0x56
|
||||
{{0x15, 0x07, 0x15}, 0x58}, // U+1175 U+1167 U+1175 => vowel # 0x58
|
||||
{{0x15, 0x09, 0x3e}, 0x59}, // U+1175 U+1169 U+119e => vowel # 0x59
|
||||
{{0x3e, 0x05, 0x15}, 0x5e}, // U+119e U+1165 U+1175 => vowel # 0x5e
|
||||
};
|
||||
|
||||
const static JamoNormMap gExtVoClustersGroup2[]=
|
||||
{
|
||||
{{0x01, 0x13, 0}, 0x43}, // U+1161 U+1173 => vowel # 0x43
|
||||
{{0x03, 0x0e, 0}, 0x44}, // U+1163 U+116e => vowel # 0x44
|
||||
{{0x07, 0x03, 0}, 0x45}, // U+1167 U+1163 => vowel # 0x45
|
||||
{{0x09, 0x03, 0}, 0x46}, // U+1169 U+1163 => vowel # 0x46
|
||||
{{0x09, 0x04, 0}, 0x47}, // U+1169 U+1164 => vowel # 0x47
|
||||
{{0x09, 0x07, 0}, 0x48}, // U+1169 U+1167 => vowel # 0x48
|
||||
{{0x0d, 0x01, 0}, 0x4a}, // U+116d U+1161 => vowel # 0x4a
|
||||
{{0x0d, 0x02, 0}, 0x4b}, // U+116d U+1162 => vowel # 0x4b
|
||||
{{0x0d, 0x05, 0}, 0x4c}, // U+116d U+1165 => vowel # 0x4c
|
||||
{{0x0e, 0x07, 0}, 0x4d}, // U+116e U+1167 => vowel # 0x4d
|
||||
{{0x11, 0x15, 0}, 0x4e}, // U+1171 U+1175 => vowel # 0x4e
|
||||
{{0x12, 0x02, 0}, 0x4f}, // U+1172 U+1162 => vowel # 0x4f
|
||||
{{0x12, 0x09, 0}, 0x50}, // U+1172 U+1169 => vowel # 0x50
|
||||
{{0x13, 0x01, 0}, 0x51}, // U+1173 U+1161 => vowel # 0x51
|
||||
{{0x13, 0x05, 0}, 0x52}, // U+1173 U+1165 => vowel # 0x52
|
||||
{{0x13, 0x06, 0}, 0x53}, // U+1173 U+1166 => vowel # 0x53
|
||||
{{0x13, 0x09, 0}, 0x54}, // U+1173 U+1169 => vowel # 0x54
|
||||
{{0x15, 0x04, 0}, 0x56}, // U+1175 U+1164 => vowel # 0x56
|
||||
{{0x15, 0x07, 0}, 0x57}, // U+1175 U+1167 => vowel # 0x57
|
||||
{{0x15, 0x08, 0}, 0x58}, // U+1175 U+1168 => vowel # 0x58
|
||||
{{0x15, 0x0d, 0}, 0x5a}, // U+1175 U+116d => vowel # 0x5a
|
||||
{{0x15, 0x12, 0}, 0x5b}, // U+1175 U+1172 => vowel # 0x5b
|
||||
{{0x15, 0x15, 0}, 0x5c}, // U+1175 U+1175 => vowel # 0x5c
|
||||
{{0x23, 0x3e, 0}, 0x49}, // U+1183 U+119e => vowel # 0x49
|
||||
{{0x2e, 0x15, 0}, 0x4f}, // U+118e U+1175 => vowel # 0x4f
|
||||
{{0x3a, 0x3e, 0}, 0x59}, // U+119a U+119e => vowel # 0x59
|
||||
{{0x3e, 0x01, 0}, 0x5d}, // U+119e U+1161 => vowel # 0x5d
|
||||
{{0x3e, 0x06, 0}, 0x5e}, // U+119e U+1166 => vowel # 0x5e
|
||||
{{0x3f, 0x15, 0}, 0x5e}, // U+119f U+1175 => vowel # 0x5e
|
||||
};
|
||||
|
||||
/**
|
||||
* The map from sequences of trailing consonants forming consonant clusters
|
||||
* not encoded in U+1100 block to temporary code points in the 0xf200 block.
|
||||
* To reduce memory footprint, array elements are shifted by 0xf200
|
||||
* from their actual positions.
|
||||
*/
|
||||
|
||||
const static JamoNormMap gExtTcClustersGroup1[]=
|
||||
{
|
||||
{{0x06, 0x06, 0x10}, 0x5b}, // U+11ae U+11ae U+11b8 => tc # 0x5b
|
||||
{{0x06, 0x12, 0x00}, 0x5e}, // U+11ae U+11ba U+11a8 => tc # 0x5e
|
||||
{{0x07, 0x00, 0x00}, 0x62}, // U+11af U+11a8 U+11a8 => tc # 0x62
|
||||
{{0x07, 0x00, 0x1a}, 0x63}, // U+11af U+11a8 U+11c2 => tc # 0x63
|
||||
{{0x07, 0x07, 0x17}, 0x64}, // U+11af U+11af U+11bf => tc # 0x64
|
||||
{{0x07, 0x0f, 0x1a}, 0x65}, // U+11af U+11b7 U+11c2 => tc # 0x65
|
||||
{{0x07, 0x10, 0x06}, 0x66}, // U+11af U+11b8 U+11ae => tc # 0x66
|
||||
{{0x07, 0x10, 0x19}, 0x67}, // U+11af U+11b8 U+11c1 => tc # 0x67
|
||||
{{0x07, 0x51, 0x1a}, 0x69}, // U+11af U+11f9 U+11c2 => tc # 0x69
|
||||
{{0x0f, 0x03, 0x03}, 0x6c}, // U+11b7 U+11ab U+11ab => tc # 0x6c
|
||||
{{0x0f, 0x10, 0x12}, 0x6e}, // U+11b7 U+11b8 U+11ba => tc # 0x6e
|
||||
{{0x10, 0x07, 0x19}, 0x71}, // U+11b8 U+11af U+11c1 => tc # 0x71
|
||||
{{0x10, 0x12, 0x06}, 0x74}, // U+11b8 U+11ba U+11ae => tc # 0x74
|
||||
{{0x12, 0x10, 0x14}, 0x78}, // U+11ba U+11b8 U+11bc => tc # 0x78
|
||||
{{0x12, 0x12, 0x00}, 0x79}, // U+11ba U+11ba U+11a8 => tc # 0x79
|
||||
{{0x12, 0x12, 0x06}, 0x7a}, // U+11ba U+11ba U+11ae => tc # 0x7a
|
||||
{{0x15, 0x10, 0x10}, 0x89}, // U+11bd U+11b8 U+11b8 => tc # 0x89
|
||||
{{0x43, 0x10, 0x14}, 0x81}, // U+11eb U+11b8 U+11bc => tc # 0x81
|
||||
};
|
||||
|
||||
const static JamoNormMap gExtTcClustersGroup2[]=
|
||||
{
|
||||
{{0x00, 0x03, 0}, 0x52}, // U+11a8 U+11ab => tc # 0x52
|
||||
{{0x00, 0x10, 0}, 0x53}, // U+11a8 U+11b8 => tc # 0x53
|
||||
{{0x00, 0x16, 0}, 0x54}, // U+11a8 U+11be => tc # 0x54
|
||||
{{0x00, 0x17, 0}, 0x55}, // U+11a8 U+11bf => tc # 0x55
|
||||
{{0x00, 0x1a, 0}, 0x56}, // U+11a8 U+11c2 => tc # 0x56
|
||||
{{0x03, 0x03, 0}, 0x57}, // U+11ab U+11ab => tc # 0x57
|
||||
{{0x03, 0x07, 0}, 0x58}, // U+11ab U+11af => tc # 0x58
|
||||
{{0x03, 0x16, 0}, 0x59}, // U+11ab U+11be => tc # 0x59
|
||||
{{0x06, 0x06, 0}, 0x5a}, // U+11ae U+11ae => tc # 0x5a
|
||||
{{0x06, 0x10, 0}, 0x5c}, // U+11ae U+11b8 => tc # 0x5c
|
||||
{{0x06, 0x12, 0}, 0x5d}, // U+11ae U+11ba => tc # 0x5d
|
||||
{{0x06, 0x15, 0}, 0x5f}, // U+11ae U+11bd => tc # 0x5f
|
||||
{{0x06, 0x16, 0}, 0x60}, // U+11ae U+11be => tc # 0x60
|
||||
{{0x06, 0x18, 0}, 0x61}, // U+11ae U+11c0 => tc # 0x61
|
||||
{{0x06, 0x3f, 0}, 0x5e}, // U+11ae U+11e7 => tc # 0x5e
|
||||
{{0x07, 0x01, 0}, 0x62}, // U+11af U+11a9 => tc # 0x62
|
||||
{{0x07, 0x14, 0}, 0x6a}, // U+11af U+11bc => tc # 0x6a
|
||||
{{0x07, 0x30, 0}, 0x64}, // U+11af U+11d8 => tc # 0x64
|
||||
{{0x07, 0x39, 0}, 0x65}, // U+11af U+11e1 => tc # 0x65
|
||||
{{0x07, 0x3c, 0}, 0x67}, // U+11af U+11e4 => tc # 0x67
|
||||
{{0x07, 0x48, 0}, 0x68}, // U+11af U+11f0 => tc # 0x68
|
||||
{{0x08, 0x00, 0}, 0x62}, // U+11b0 U+11a8 => tc # 0x62
|
||||
{{0x08, 0x1a, 0}, 0x63}, // U+11b0 U+11c2 => tc # 0x63
|
||||
{{0x09, 0x1a, 0}, 0x65}, // U+11b1 U+11c2 => tc # 0x65
|
||||
{{0x0a, 0x06, 0}, 0x66}, // U+11b2 U+11ae => tc # 0x66
|
||||
{{0x0a, 0x19, 0}, 0x67}, // U+11b2 U+11c1 => tc # 0x67
|
||||
{{0x0f, 0x03, 0}, 0x6b}, // U+11b7 U+11ab => tc # 0x6b
|
||||
{{0x0f, 0x0f, 0}, 0x6d}, // U+11b7 U+11b7 => tc # 0x6d
|
||||
{{0x0f, 0x11, 0}, 0x6e}, // U+11b7 U+11b9 => tc # 0x6e
|
||||
{{0x0f, 0x15, 0}, 0x6f}, // U+11b7 U+11bd => tc # 0x6f
|
||||
{{0x10, 0x06, 0}, 0x70}, // U+11b8 U+11ae => tc # 0x70
|
||||
{{0x10, 0x0f, 0}, 0x72}, // U+11b8 U+11b7 => tc # 0x72
|
||||
{{0x10, 0x10, 0}, 0x73}, // U+11b8 U+11b8 => tc # 0x73
|
||||
{{0x10, 0x15, 0}, 0x75}, // U+11b8 U+11bd => tc # 0x75
|
||||
{{0x10, 0x16, 0}, 0x76}, // U+11b8 U+11be => tc # 0x76
|
||||
{{0x10, 0x40, 0}, 0x74}, // U+11b8 U+11e8 => tc # 0x74
|
||||
{{0x11, 0x06, 0}, 0x74}, // U+11b9 U+11ae => tc # 0x74
|
||||
{{0x12, 0x0f, 0}, 0x77}, // U+11ba U+11b7 => tc # 0x77
|
||||
{{0x12, 0x15, 0}, 0x7c}, // U+11ba U+11bd => tc # 0x7c
|
||||
{{0x12, 0x16, 0}, 0x7d}, // U+11ba U+11be => tc # 0x7d
|
||||
{{0x12, 0x18, 0}, 0x7e}, // U+11ba U+11c0 => tc # 0x7e
|
||||
{{0x12, 0x1a, 0}, 0x7f}, // U+11ba U+11c2 => tc # 0x7f
|
||||
{{0x12, 0x3e, 0}, 0x78}, // U+11ba U+11e6 => tc # 0x78
|
||||
{{0x12, 0x3f, 0}, 0x79}, // U+11ba U+11e7 => tc # 0x79
|
||||
{{0x12, 0x40, 0}, 0x7a}, // U+11ba U+11e8 => tc # 0x7a
|
||||
{{0x12, 0x43, 0}, 0x7b}, // U+11ba U+11eb => tc # 0x7b
|
||||
{{0x13, 0x00, 0}, 0x79}, // U+11bb U+11a8 => tc # 0x79
|
||||
{{0x13, 0x06, 0}, 0x7a}, // U+11bb U+11ae => tc # 0x7a
|
||||
{{0x14, 0x0f, 0}, 0x82}, // U+11bc U+11b7 => tc # 0x82
|
||||
{{0x14, 0x12, 0}, 0x83}, // U+11bc U+11ba => tc # 0x83
|
||||
{{0x14, 0x1a, 0}, 0x84}, // U+11bc U+11c2 => tc # 0x84
|
||||
{{0x15, 0x10, 0}, 0x88}, // U+11bd U+11b8 => tc # 0x88
|
||||
{{0x15, 0x15, 0}, 0x8a}, // U+11bd U+11bd => tc # 0x8a
|
||||
{{0x19, 0x14, 0}, 0x8c}, // U+11c1 U+11bc => tc # 0x8c
|
||||
{{0x19, 0x18, 0}, 0x8b}, // U+11c1 U+11c0 => tc # 0x8b
|
||||
{{0x28, 0x17, 0}, 0x64}, // U+11d0 U+11bf => tc # 0x64
|
||||
{{0x31, 0x1a, 0}, 0x69}, // U+11d9 U+11c2 => tc # 0x69
|
||||
{{0x34, 0x12, 0}, 0x6e}, // U+11dc U+11ba => tc # 0x6e
|
||||
{{0x3b, 0x19, 0}, 0x71}, // U+11e3 U+11c1 => tc # 0x71
|
||||
{{0x42, 0x14, 0}, 0x78}, // U+11ea U+11bc => tc # 0x78
|
||||
{{0x43, 0x10, 0}, 0x80}, // U+11eb U+11b8 => tc # 0x80
|
||||
{{0x43, 0x3e, 0}, 0x81}, // U+11eb U+11e6 => tc # 0x81
|
||||
{{0x48, 0x00, 0}, 0x85}, // U+11f0 U+11a8 => tc # 0x85
|
||||
{{0x48, 0x17, 0}, 0x86}, // U+11f0 U+11bf => tc # 0x86
|
||||
{{0x48, 0x1a, 0}, 0x87}, // U+11f0 U+11c2 => tc # 0x87
|
||||
};
|
@ -1,60 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsCP949ToUnicode.h"
|
||||
#include "nsUCvKODll.h"
|
||||
#include "nsUCConstructors.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
static const uScanClassID g_CP949ScanClassIDs[] = {
|
||||
u1ByteCharset,
|
||||
// This is necessary to decode 8byte sequence representation of Hangul
|
||||
// syllables. This representation is uniq to EUC-KR and is not used
|
||||
// in CP949. However, this converter is for both EUC-KR and CP949
|
||||
// so that this class ID is put here. See bug 131388.
|
||||
uDecomposedHangulCharset,
|
||||
u2BytesGRCharset, // EUC_KR
|
||||
u2BytesGR128Charset, // CP949 High
|
||||
u2BytesCharset // CP949 Low
|
||||
};
|
||||
|
||||
// CP949(non-EUC-KR portion) to Unicode
|
||||
static const uint16_t g_utCP949NoKSCHangulMapping[] = {
|
||||
#include "u20cp949hangul.ut"
|
||||
};
|
||||
|
||||
static const uRange g_CP949Ranges[] = {
|
||||
{ 0x00, 0x7F },
|
||||
{ 0xA4, 0xA4 }, // 8byte seq. for Hangul syllables not available
|
||||
// in pre-composed form in KS X 1001
|
||||
{ 0xA1, 0xFE },
|
||||
{ 0xA1, 0xC6 }, // CP949 extension B. ends at 0xC6.
|
||||
{ 0x80, 0xA0 }
|
||||
};
|
||||
|
||||
static const uint16_t *g_CP949MappingTableSet [] ={
|
||||
g_ASCIIMappingTable,
|
||||
g_HangulNullMapping,
|
||||
g_utKSC5601Mapping,
|
||||
g_utCP949NoKSCHangulMapping,
|
||||
g_utCP949NoKSCHangulMapping
|
||||
//g_CP949HighMapping,
|
||||
//g_CP949LowMapping
|
||||
};
|
||||
|
||||
|
||||
nsresult
|
||||
nsCP949ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
return CreateMultiTableDecoder(sizeof(g_CP949Ranges) / sizeof(g_CP949Ranges[0]),
|
||||
(const uRange*) &g_CP949Ranges,
|
||||
(uScanClassID*) &g_CP949ScanClassIDs,
|
||||
(uMappingTable**) &g_CP949MappingTableSet, 1,
|
||||
aOuter, aIID, aResult);
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsCP949ToUnicode_h___
|
||||
#define nsCP949ToUnicode_h___
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
class nsISupports;
|
||||
|
||||
/**
|
||||
* A character set converter from CP949 to Unicode.
|
||||
*
|
||||
* @created 06/Apr/1999
|
||||
* @author Catalin Rotaru [CATA]
|
||||
*/
|
||||
nsresult
|
||||
nsCP949ToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
#endif /* nsCP949ToUnicode_h___ */
|
@ -1,21 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUCvKOCID_h___
|
||||
#define nsUCvKOCID_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// Class ID for our EUCKRToUnicode charset converter
|
||||
// {379C2775-EC77-11d2-8AAC-00600811A836}
|
||||
#define NS_EUCKRTOUNICODE_CID \
|
||||
{ 0x379c2775, 0xec77, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
// Class ID for our UnicodeToEUCKR charset converter
|
||||
// {379C2778-EC77-11d2-8AAC-00600811A836}
|
||||
#define NS_UNICODETOEUCKR_CID \
|
||||
{ 0x379c2778, 0xec77, 0x11d2, {0x8a, 0xac, 0x0, 0x60, 0x8, 0x11, 0xa8, 0x36}}
|
||||
|
||||
#endif /* nsUCvKOCID_h___ */
|
@ -1,14 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUCvKODll_h_
|
||||
#define nsUCvKODll_h_
|
||||
|
||||
extern const uint16_t g_utKSC5601Mapping[];
|
||||
extern const uint16_t g_ufKSC5601Mapping[];
|
||||
extern const uint16_t g_ASCIIMappingTable[];
|
||||
extern const uint16_t g_HangulNullMapping[];
|
||||
|
||||
#endif /* nsUCvKODll_h_ */
|
@ -1,44 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
#include "nsUnicodeToCP949.h"
|
||||
#include "nsUCvKODll.h"
|
||||
#include "nsUCConstructors.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Global functions and data [declaration]
|
||||
|
||||
|
||||
// Unicode Hangul syllables (not enumerated in KS X 1001) to CP949 : 8822 of them
|
||||
static const uint16_t g_ufCP949NoKSCHangulMapping[] = {
|
||||
#include "u20cp949hangul.uf"
|
||||
};
|
||||
|
||||
|
||||
|
||||
static const uint16_t *g_CP949MappingTable[3] = {
|
||||
g_ASCIIMappingTable,
|
||||
g_ufKSC5601Mapping,
|
||||
g_ufCP949NoKSCHangulMapping
|
||||
};
|
||||
|
||||
static const uScanClassID g_CP949ScanClassTable[3] = {
|
||||
u1ByteCharset,
|
||||
u2BytesGRCharset,
|
||||
u2BytesCharset
|
||||
};
|
||||
|
||||
nsresult
|
||||
nsUnicodeToCP949Constructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult)
|
||||
{
|
||||
return CreateMultiTableEncoder(3,
|
||||
(uScanClassID*) g_CP949ScanClassTable,
|
||||
(uMappingTable**) g_CP949MappingTable,
|
||||
2 /* max len = src * 2 */,
|
||||
aOuter, aIID, aResult);
|
||||
}
|
||||
|
@ -1,23 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsUnicodeToCP949_h___
|
||||
#define nsUnicodeToCP949_h___
|
||||
|
||||
#include "nsID.h"
|
||||
|
||||
class nsISupports;
|
||||
|
||||
/**
|
||||
* A character set converter from Unicode to CP949.
|
||||
*
|
||||
* @created 14/May/2001 (patterned after Unicode to EUCKR converter
|
||||
* @author Jungshik Shin
|
||||
*/
|
||||
nsresult
|
||||
nsUnicodeToCP949Constructor(nsISupports *aOuter, REFNSIID aIID,
|
||||
void **aResult);
|
||||
|
||||
#endif /* nsUnicodeToCP949_h___ */
|
@ -1,2 +0,0 @@
|
||||
We should put EUC-KR, ISO-2022-KO
|
||||
converters into this directory/dll
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,158 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
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 <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 00A0
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = 00C1
|
||||
srcEnd = 00C6
|
||||
destBegin = 00C1
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 0
|
||||
srcBegin = 00DA
|
||||
srcEnd = 00DF
|
||||
destBegin = 00DA
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 0
|
||||
srcBegin = 00E1
|
||||
srcEnd = 00E6
|
||||
destBegin = 00E1
|
||||
End of Item 0003
|
||||
|
||||
Begin of Item 0004
|
||||
Format 1
|
||||
srcBegin = 00A7
|
||||
srcEnd = 00B7
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
00A7 FFFD FFFD FFFD FFFD FFFD 00AD FFFD
|
||||
FFFD 00B0 FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
00B7
|
||||
End of Item 0004
|
||||
|
||||
Begin of Item 0005
|
||||
Format 1
|
||||
srcBegin = 00C9
|
||||
srcEnd = 00D8
|
||||
mappingOffset = 0011
|
||||
Mapping =
|
||||
00C9 FFFD 00CB FFFD 00CD 00CE 00CF 00D0
|
||||
FFFD FFFD 00D3 00D4 00D5 00D6 FFFD 00D8
|
||||
End of Item 0005
|
||||
|
||||
Begin of Item 0006
|
||||
Format 1
|
||||
srcBegin = 00E9
|
||||
srcEnd = 014D
|
||||
mappingOffset = 0021
|
||||
Mapping =
|
||||
00E9 FFFD 00EB FFFD 00ED 00EE 00EF 00F0
|
||||
FFFD FFFD 00F3 00F4 00F5 00F6 FFFD 00F8
|
||||
FFFD 00FA 00FB 00FC 00FD 00FE FFFD 00C0
|
||||
00E0 FFFD FFFD 00A1 00B1 FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD 00C8 00E8 FFFD FFFD 00A9
|
||||
00B9 00A2 00B2 FFFD FFFD 00CC 00EC 00CA
|
||||
00EA FFFD FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
FFFD 00A3 00B3 FFFD FFFD FFFD FFFD 00A5
|
||||
00B5 00A4 00B4 FFFD FFFD 00C7 00E7 FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD 00A6 00B6 00FF
|
||||
FFFD FFFD 00A8 00B8 FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD 00D1 00F1 FFFD FFFD
|
||||
FFFD 00AF 00BF 00D2 00F2
|
||||
End of Item 0006
|
||||
|
||||
Begin of Item 0007
|
||||
Format 1
|
||||
srcBegin = 0160
|
||||
srcEnd = 017E
|
||||
mappingOffset = 0086
|
||||
Mapping =
|
||||
00AA 00BA FFFD FFFD FFFD FFFD 00AB 00BB
|
||||
00D7 00F7 00AE 00BE FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD 00D9 00F9 FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD 00AC 00BC
|
||||
End of Item 0007
|
||||
|
||||
Begin of Item 0008
|
||||
Format 2
|
||||
srcBegin = 2015
|
||||
destBegin = 00BD
|
||||
End of Item 0008
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0009,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0007,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x0022,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0004 */
|
||||
/* Total of Format 1 : 0x0004 */
|
||||
/* Total of Format 2 : 0x0001 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0000, 0x1111, 0x0002,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0007 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x00A0, 0x0000,
|
||||
/* 0001 */ 0x00C1, 0x00C6, 0x00C1,
|
||||
/* 0002 */ 0x00DA, 0x00DF, 0x00DA,
|
||||
/* 0003 */ 0x00E1, 0x00E6, 0x00E1,
|
||||
/* 0004 */ 0x00A7, 0x00B7, 0x0000,
|
||||
/* 0005 */ 0x00C9, 0x00D8, 0x0011,
|
||||
/* 0006 */ 0x00E9, 0x014D, 0x0021,
|
||||
/* 0007 */ 0x0160, 0x017E, 0x0086,
|
||||
/* 0008 */ 0x2015, 0x0000, 0x00BD,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0022 Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x00A7, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00AD, 0xFFFD,
|
||||
/* 0008 */ 0xFFFD, 0x00B0, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0010 */ 0x00B7, 0x00C9, 0xFFFD, 0x00CB, 0xFFFD, 0x00CD, 0x00CE, 0x00CF,
|
||||
/* 0018 */ 0x00D0, 0xFFFD, 0xFFFD, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0xFFFD,
|
||||
/* 0020 */ 0x00D8, 0x00E9, 0xFFFD, 0x00EB, 0xFFFD, 0x00ED, 0x00EE, 0x00EF,
|
||||
/* 0028 */ 0x00F0, 0xFFFD, 0xFFFD, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0xFFFD,
|
||||
/* 0030 */ 0x00F8, 0xFFFD, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0xFFFD,
|
||||
/* 0038 */ 0x00C0, 0x00E0, 0xFFFD, 0xFFFD, 0x00A1, 0x00B1, 0xFFFD, 0xFFFD,
|
||||
/* 0040 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00C8, 0x00E8, 0xFFFD, 0xFFFD,
|
||||
/* 0048 */ 0x00A9, 0x00B9, 0x00A2, 0x00B2, 0xFFFD, 0xFFFD, 0x00CC, 0x00EC,
|
||||
/* 0050 */ 0x00CA, 0x00EA, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0058 */ 0xFFFD, 0xFFFD, 0x00A3, 0x00B3, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0060 */ 0x00A5, 0x00B5, 0x00A4, 0x00B4, 0xFFFD, 0xFFFD, 0x00C7, 0x00E7,
|
||||
/* 0068 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00A6, 0x00B6,
|
||||
/* 0070 */ 0x00FF, 0xFFFD, 0xFFFD, 0x00A8, 0x00B8, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0078 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00D1, 0x00F1, 0xFFFD,
|
||||
/* 0080 */ 0xFFFD, 0xFFFD, 0x00AF, 0x00BF, 0x00D2, 0x00F2, 0x00AA, 0x00BA,
|
||||
/* 0088 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00AB, 0x00BB, 0x00D7, 0x00F7,
|
||||
/* 0090 */ 0x00AE, 0x00BE, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0098 */ 0x00D9, 0x00F9, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00A0 */ 0xFFFD, 0xFFFD, 0xFFFD, 0x00AC, 0x00BC,
|
||||
/* End of table Total Length = 0x00C7 * 2 */
|
@ -1,105 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
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 <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 00A0
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = 00C1
|
||||
srcEnd = 00C6
|
||||
destBegin = 00C1
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 0
|
||||
srcBegin = 00DA
|
||||
srcEnd = 00DF
|
||||
destBegin = 00DA
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 0
|
||||
srcBegin = 00E1
|
||||
srcEnd = 00E6
|
||||
destBegin = 00E1
|
||||
End of Item 0003
|
||||
|
||||
Begin of Item 0004
|
||||
Format 1
|
||||
srcBegin = 00A1
|
||||
srcEnd = 00FF
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
0104 0112 0122 012A 0128 0136 00A7 013B
|
||||
0110 0160 0166 017D 00AD 016A 014A 00B0
|
||||
0105 0113 0123 012B 0129 0137 00B7 013C
|
||||
0111 0161 0167 017E 2015 016B 014B 0100
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD 012E 010C
|
||||
00C9 0118 00CB 0116 00CD 00CE 00CF 00D0
|
||||
0145 014C 00D3 00D4 00D5 00D6 0168 00D8
|
||||
0172 FFFD FFFD FFFD FFFD FFFD FFFD 0101
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD 012F 010D
|
||||
00E9 0119 00EB 0117 00ED 00EE 00EF 00F0
|
||||
0146 014D 00F3 00F4 00F5 00F6 0169 00F8
|
||||
0173 00FA 00FB 00FC 00FD 00FE 0138
|
||||
End of Item 0004
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0005,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0006,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x0015,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0004 */
|
||||
/* Total of Format 1 : 0x0001 */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0000, 0x0001,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0006 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x00A0, 0x0000,
|
||||
/* 0001 */ 0x00C1, 0x00C6, 0x00C1,
|
||||
/* 0002 */ 0x00DA, 0x00DF, 0x00DA,
|
||||
/* 0003 */ 0x00E1, 0x00E6, 0x00E1,
|
||||
/* 0004 */ 0x00A1, 0x00FF, 0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0015 Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, 0x013B,
|
||||
/* 0008 */ 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A, 0x00B0,
|
||||
/* 0010 */ 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, 0x013C,
|
||||
/* 0018 */ 0x0111, 0x0161, 0x0167, 0x017E, 0x2015, 0x016B, 0x014B, 0x0100,
|
||||
/* 0020 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x012E, 0x010C,
|
||||
/* 0028 */ 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF, 0x00D0,
|
||||
/* 0030 */ 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168, 0x00D8,
|
||||
/* 0038 */ 0x0172, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0101,
|
||||
/* 0040 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x012F, 0x010D,
|
||||
/* 0048 */ 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, 0x00F0,
|
||||
/* 0050 */ 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, 0x00F8,
|
||||
/* 0058 */ 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138,
|
||||
/* End of table Total Length = 0x0074 * 2 */
|
@ -1,123 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 009F
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 1
|
||||
srcBegin = 00A0
|
||||
srcEnd = 017E
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
00A0 FFFD 00A2 00A3 00A4 FFFD 00A6 00A7
|
||||
FFFD 00A9 FFFD 00AB 00AC 00AD 00AE FFFD
|
||||
00B0 00B1 00B2 00B3 FFFD 00B5 00B6 00B7
|
||||
FFFD 00B9 FFFD 00BB 00BC 00BD 00BE FFFD
|
||||
FFFD FFFD FFFD FFFD 00C4 00C5 00AF FFFD
|
||||
FFFD 00C9 FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD 00D3 FFFD 00D5 00D6 00D7
|
||||
00A8 FFFD FFFD FFFD 00DC FFFD FFFD 00DF
|
||||
FFFD FFFD FFFD FFFD 00E4 00E5 00BF FFFD
|
||||
FFFD 00E9 FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD 00F3 FFFD 00F5 00F6 00F7
|
||||
00B8 FFFD FFFD FFFD 00FC FFFD FFFD FFFD
|
||||
00C2 00E2 FFFD FFFD 00C0 00E0 00C3 00E3
|
||||
FFFD FFFD FFFD FFFD 00C8 00E8 FFFD FFFD
|
||||
FFFD FFFD 00C7 00E7 FFFD FFFD 00CB 00EB
|
||||
00C6 00E6 FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD 00CC 00EC FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD 00CE 00EE FFFD FFFD 00C1 00E1
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD 00CD 00ED
|
||||
FFFD FFFD FFFD 00CF 00EF FFFD FFFD FFFD
|
||||
FFFD 00D9 00F9 00D1 00F1 00D2 00F2 FFFD
|
||||
FFFD FFFD FFFD FFFD 00D4 00F4 FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD 00AA 00BA
|
||||
FFFD FFFD 00DA 00FA FFFD FFFD FFFD FFFD
|
||||
00D0 00F0 FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD 00DB 00FB FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD 00D8 00F8 FFFD FFFD FFFD FFFD
|
||||
FFFD 00CA 00EA 00DD 00FD 00DE 00FE
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 1
|
||||
srcBegin = 2019
|
||||
srcEnd = 201E
|
||||
mappingOffset = 00DF
|
||||
Mapping =
|
||||
00FF FFFD FFFD 00B4 00A1 00A5
|
||||
End of Item 0002
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0003,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0005,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x000E,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0001 */
|
||||
/* Total of Format 1 : 0x0002 */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0110,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0005 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x009F, 0x0000,
|
||||
/* 0001 */ 0x00A0, 0x017E, 0x0000,
|
||||
/* 0002 */ 0x2019, 0x201E, 0x00DF,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x000E Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x00A0, 0xFFFD, 0x00A2, 0x00A3, 0x00A4, 0xFFFD, 0x00A6, 0x00A7,
|
||||
/* 0008 */ 0xFFFD, 0x00A9, 0xFFFD, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0xFFFD,
|
||||
/* 0010 */ 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0xFFFD, 0x00B5, 0x00B6, 0x00B7,
|
||||
/* 0018 */ 0xFFFD, 0x00B9, 0xFFFD, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0xFFFD,
|
||||
/* 0020 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00C4, 0x00C5, 0x00AF, 0xFFFD,
|
||||
/* 0028 */ 0xFFFD, 0x00C9, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0030 */ 0xFFFD, 0xFFFD, 0xFFFD, 0x00D3, 0xFFFD, 0x00D5, 0x00D6, 0x00D7,
|
||||
/* 0038 */ 0x00A8, 0xFFFD, 0xFFFD, 0xFFFD, 0x00DC, 0xFFFD, 0xFFFD, 0x00DF,
|
||||
/* 0040 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00E4, 0x00E5, 0x00BF, 0xFFFD,
|
||||
/* 0048 */ 0xFFFD, 0x00E9, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0050 */ 0xFFFD, 0xFFFD, 0xFFFD, 0x00F3, 0xFFFD, 0x00F5, 0x00F6, 0x00F7,
|
||||
/* 0058 */ 0x00B8, 0xFFFD, 0xFFFD, 0xFFFD, 0x00FC, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0060 */ 0x00C2, 0x00E2, 0xFFFD, 0xFFFD, 0x00C0, 0x00E0, 0x00C3, 0x00E3,
|
||||
/* 0068 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00C8, 0x00E8, 0xFFFD, 0xFFFD,
|
||||
/* 0070 */ 0xFFFD, 0xFFFD, 0x00C7, 0x00E7, 0xFFFD, 0xFFFD, 0x00CB, 0x00EB,
|
||||
/* 0078 */ 0x00C6, 0x00E6, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0080 */ 0xFFFD, 0xFFFD, 0x00CC, 0x00EC, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0088 */ 0xFFFD, 0xFFFD, 0x00CE, 0x00EE, 0xFFFD, 0xFFFD, 0x00C1, 0x00E1,
|
||||
/* 0090 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00CD, 0x00ED,
|
||||
/* 0098 */ 0xFFFD, 0xFFFD, 0xFFFD, 0x00CF, 0x00EF, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00A0 */ 0xFFFD, 0x00D9, 0x00F9, 0x00D1, 0x00F1, 0x00D2, 0x00F2, 0xFFFD,
|
||||
/* 00A8 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00D4, 0x00F4, 0xFFFD, 0xFFFD,
|
||||
/* 00B0 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00AA, 0x00BA,
|
||||
/* 00B8 */ 0xFFFD, 0xFFFD, 0x00DA, 0x00FA, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00C0 */ 0x00D0, 0x00F0, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00C8 */ 0xFFFD, 0xFFFD, 0x00DB, 0x00FB, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00D0 */ 0xFFFD, 0xFFFD, 0x00D8, 0x00F8, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 00D8 */ 0xFFFD, 0x00CA, 0x00EA, 0x00DD, 0x00FD, 0x00DE, 0x00FE, 0x00FF,
|
||||
/* 00E0 */ 0xFFFD, 0xFFFD, 0x00B4, 0x00A1, 0x00A5,
|
||||
/* End of table Total Length = 0x00F3 * 2 */
|
@ -1,80 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 009F
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 1
|
||||
srcBegin = 00A0
|
||||
srcEnd = 00FF
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
00A0 201D 00A2 00A3 00A4 201E 00A6 00A7
|
||||
00D8 00A9 0156 00AB 00AC 00AD 00AE 00C6
|
||||
00B0 00B1 00B2 00B3 201C 00B5 00B6 00B7
|
||||
00F8 00B9 0157 00BB 00BC 00BD 00BE 00E6
|
||||
0104 012E 0100 0106 00C4 00C5 0118 0112
|
||||
010C 00C9 0179 0116 0122 0136 012A 013B
|
||||
0160 0143 0145 00D3 014C 00D5 00D6 00D7
|
||||
0172 0141 015A 016A 00DC 017B 017D 00DF
|
||||
0105 012F 0101 0107 00E4 00E5 0119 0113
|
||||
010D 00E9 017A 0117 0123 0137 012B 013C
|
||||
0161 0144 0146 00F3 014D 00F5 00F6 00F7
|
||||
0173 0142 015B 016B 00FC 017C 017E 2019
|
||||
End of Item 0001
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x0002,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0005,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x000B,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0001 */
|
||||
/* Total of Format 1 : 0x0001 */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0010,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0005 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x009F, 0x0000,
|
||||
/* 0001 */ 0x00A0, 0x00FF, 0x0000,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x000B Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7,
|
||||
/* 0008 */ 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6,
|
||||
/* 0010 */ 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7,
|
||||
/* 0018 */ 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6,
|
||||
/* 0020 */ 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112,
|
||||
/* 0028 */ 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B,
|
||||
/* 0030 */ 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7,
|
||||
/* 0038 */ 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF,
|
||||
/* 0040 */ 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113,
|
||||
/* 0048 */ 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
|
||||
/* 0050 */ 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7,
|
||||
/* 0058 */ 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019,
|
||||
/* End of table Total Length = 0x006B * 2 */
|
@ -1,212 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 009F
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = 00C0
|
||||
srcEnd = 00CF
|
||||
destBegin = 00C0
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 0
|
||||
srcBegin = 00D1
|
||||
srcEnd = 00D6
|
||||
destBegin = 00D1
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 0
|
||||
srcBegin = 00D8
|
||||
srcEnd = 00DD
|
||||
destBegin = 00D8
|
||||
End of Item 0003
|
||||
|
||||
Begin of Item 0004
|
||||
Format 0
|
||||
srcBegin = 00DF
|
||||
srcEnd = 00EF
|
||||
destBegin = 00DF
|
||||
End of Item 0004
|
||||
|
||||
Begin of Item 0005
|
||||
Format 0
|
||||
srcBegin = 00F1
|
||||
srcEnd = 00F6
|
||||
destBegin = 00F1
|
||||
End of Item 0005
|
||||
|
||||
Begin of Item 0006
|
||||
Format 0
|
||||
srcBegin = 00F8
|
||||
srcEnd = 00FD
|
||||
destBegin = 00F8
|
||||
End of Item 0006
|
||||
|
||||
Begin of Item 0007
|
||||
Format 1
|
||||
srcBegin = 00A0
|
||||
srcEnd = 00B6
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
00A0 FFFD FFFD 00A3 FFFD FFFD FFFD 00A7
|
||||
FFFD 00A9 FFFD FFFD FFFD 00AD 00AE FFFD
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD 00B6
|
||||
End of Item 0007
|
||||
|
||||
Begin of Item 0008
|
||||
Format 1
|
||||
srcBegin = 00FF
|
||||
srcEnd = 010B
|
||||
mappingOffset = 0017
|
||||
Mapping =
|
||||
00FF FFFD FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD 00A4 00A5
|
||||
End of Item 0008
|
||||
|
||||
Begin of Item 0009
|
||||
Format 1
|
||||
srcBegin = 0120
|
||||
srcEnd = 0121
|
||||
mappingOffset = 0024
|
||||
Mapping =
|
||||
00B2 00B3
|
||||
End of Item 0009
|
||||
|
||||
Begin of Item 000A
|
||||
Format 1
|
||||
srcBegin = 0174
|
||||
srcEnd = 0178
|
||||
mappingOffset = 0026
|
||||
Mapping =
|
||||
00D0 00F0 00DE 00FE 00AF
|
||||
End of Item 000A
|
||||
|
||||
Begin of Item 000B
|
||||
Format 1
|
||||
srcBegin = 1E02
|
||||
srcEnd = 1E0B
|
||||
mappingOffset = 002B
|
||||
Mapping =
|
||||
00A1 00A2 FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
00A6 00AB
|
||||
End of Item 000B
|
||||
|
||||
Begin of Item 000C
|
||||
Format 1
|
||||
srcBegin = 1E1E
|
||||
srcEnd = 1E1F
|
||||
mappingOffset = 0035
|
||||
Mapping =
|
||||
00B0 00B1
|
||||
End of Item 000C
|
||||
|
||||
Begin of Item 000D
|
||||
Format 1
|
||||
srcBegin = 1E40
|
||||
srcEnd = 1E41
|
||||
mappingOffset = 0037
|
||||
Mapping =
|
||||
00B4 00B5
|
||||
End of Item 000D
|
||||
|
||||
Begin of Item 000E
|
||||
Format 1
|
||||
srcBegin = 1E56
|
||||
srcEnd = 1E6B
|
||||
mappingOffset = 0039
|
||||
Mapping =
|
||||
00B7 00B9 FFFD FFFD FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD 00BB 00BF FFFD FFFD FFFD FFFD
|
||||
FFFD FFFD FFFD FFFD 00D7 00F7
|
||||
End of Item 000E
|
||||
|
||||
Begin of Item 000F
|
||||
Format 1
|
||||
srcBegin = 1E80
|
||||
srcEnd = 1E85
|
||||
mappingOffset = 004F
|
||||
Mapping =
|
||||
00A8 00B8 00AA 00BA 00BD 00BE
|
||||
End of Item 000F
|
||||
|
||||
Begin of Item 0010
|
||||
Format 1
|
||||
srcBegin = 1EF2
|
||||
srcEnd = 1EF3
|
||||
mappingOffset = 0055
|
||||
Mapping =
|
||||
00AC 00BC
|
||||
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 : 0x0007 */
|
||||
/* Total of Format 1 : 0x000A */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0000, 0x1000, 0x1111, 0x1111, 0x0001,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0009 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x009F, 0x0000,
|
||||
/* 0001 */ 0x00C0, 0x00CF, 0x00C0,
|
||||
/* 0002 */ 0x00D1, 0x00D6, 0x00D1,
|
||||
/* 0003 */ 0x00D8, 0x00DD, 0x00D8,
|
||||
/* 0004 */ 0x00DF, 0x00EF, 0x00DF,
|
||||
/* 0005 */ 0x00F1, 0x00F6, 0x00F1,
|
||||
/* 0006 */ 0x00F8, 0x00FD, 0x00F8,
|
||||
/* 0007 */ 0x00A0, 0x00B6, 0x0000,
|
||||
/* 0008 */ 0x00FF, 0x010B, 0x0017,
|
||||
/* 0009 */ 0x0120, 0x0121, 0x0024,
|
||||
/* 000A */ 0x0174, 0x0178, 0x0026,
|
||||
/* 000B */ 0x1E02, 0x1E0B, 0x002B,
|
||||
/* 000C */ 0x1E1E, 0x1E1F, 0x0035,
|
||||
/* 000D */ 0x1E40, 0x1E41, 0x0037,
|
||||
/* 000E */ 0x1E56, 0x1E6B, 0x0039,
|
||||
/* 000F */ 0x1E80, 0x1E85, 0x004F,
|
||||
/* 0010 */ 0x1EF2, 0x1EF3, 0x0055,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x003C Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x00A0, 0xFFFD, 0xFFFD, 0x00A3, 0xFFFD, 0xFFFD, 0xFFFD, 0x00A7,
|
||||
/* 0008 */ 0xFFFD, 0x00A9, 0xFFFD, 0xFFFD, 0xFFFD, 0x00AD, 0x00AE, 0xFFFD,
|
||||
/* 0010 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00B6, 0x00FF,
|
||||
/* 0018 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0020 */ 0xFFFD, 0xFFFD, 0x00A4, 0x00A5, 0x00B2, 0x00B3, 0x00D0, 0x00F0,
|
||||
/* 0028 */ 0x00DE, 0x00FE, 0x00AF, 0x00A1, 0x00A2, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0030 */ 0xFFFD, 0xFFFD, 0xFFFD, 0x00A6, 0x00AB, 0x00B0, 0x00B1, 0x00B4,
|
||||
/* 0038 */ 0x00B5, 0x00B7, 0x00B9, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0040 */ 0xFFFD, 0xFFFD, 0xFFFD, 0x00BB, 0x00BF, 0xFFFD, 0xFFFD, 0xFFFD,
|
||||
/* 0048 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x00D7, 0x00F7, 0x00A8,
|
||||
/* 0050 */ 0x00B8, 0x00AA, 0x00BA, 0x00BD, 0x00BE, 0x00AC, 0x00BC,
|
||||
/* End of table Total Length = 0x0093 * 2 */
|
@ -1,138 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*========================================================
|
||||
This is a Generated file. Please don't edit it.
|
||||
|
||||
The tool which used to generate this file is called fromu.
|
||||
If you have any problem of this file. Please contact
|
||||
Netscape Client International Team or
|
||||
ftang@netscape <Frank Tang>
|
||||
|
||||
Table in Debug form
|
||||
Begin of Item 0000
|
||||
Format 0
|
||||
srcBegin = 0000
|
||||
srcEnd = 009F
|
||||
destBegin = 0000
|
||||
End of Item 0000
|
||||
|
||||
Begin of Item 0001
|
||||
Format 0
|
||||
srcBegin = 00C0
|
||||
srcEnd = 00CF
|
||||
destBegin = 00C0
|
||||
End of Item 0001
|
||||
|
||||
Begin of Item 0002
|
||||
Format 0
|
||||
srcBegin = 00D1
|
||||
srcEnd = 00D6
|
||||
destBegin = 00D1
|
||||
End of Item 0002
|
||||
|
||||
Begin of Item 0003
|
||||
Format 0
|
||||
srcBegin = 00D8
|
||||
srcEnd = 00DD
|
||||
destBegin = 00D8
|
||||
End of Item 0003
|
||||
|
||||
Begin of Item 0004
|
||||
Format 0
|
||||
srcBegin = 00DF
|
||||
srcEnd = 00EF
|
||||
destBegin = 00DF
|
||||
End of Item 0004
|
||||
|
||||
Begin of Item 0005
|
||||
Format 0
|
||||
srcBegin = 00F1
|
||||
srcEnd = 00F6
|
||||
destBegin = 00F1
|
||||
End of Item 0005
|
||||
|
||||
Begin of Item 0006
|
||||
Format 0
|
||||
srcBegin = 00F8
|
||||
srcEnd = 00FD
|
||||
destBegin = 00F8
|
||||
End of Item 0006
|
||||
|
||||
Begin of Item 0007
|
||||
Format 1
|
||||
srcBegin = 00A0
|
||||
srcEnd = 00BF
|
||||
mappingOffset = 0000
|
||||
Mapping =
|
||||
00A0 1E02 1E03 00A3 010A 010B 1E0A 00A7
|
||||
1E80 00A9 1E82 1E0B 1EF2 00AD 00AE 0178
|
||||
1E1E 1E1F 0120 0121 1E40 1E41 00B6 1E56
|
||||
1E81 1E57 1E83 1E60 1EF3 1E84 1E85 1E61
|
||||
End of Item 0007
|
||||
|
||||
Begin of Item 0008
|
||||
Format 1
|
||||
srcBegin = 00D0
|
||||
srcEnd = 00DE
|
||||
mappingOffset = 0020
|
||||
Mapping =
|
||||
0174 FFFD FFFD FFFD FFFD FFFD FFFD 1E6A
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD 0176
|
||||
End of Item 0008
|
||||
|
||||
Begin of Item 0009
|
||||
Format 1
|
||||
srcBegin = 00F0
|
||||
srcEnd = 00FF
|
||||
mappingOffset = 002F
|
||||
Mapping =
|
||||
0175 FFFD FFFD FFFD FFFD FFFD FFFD 1E6B
|
||||
FFFD FFFD FFFD FFFD FFFD FFFD 0177 00FF
|
||||
End of Item 0009
|
||||
|
||||
========================================================*/
|
||||
/* Offset=0x0000 ItemOfList */
|
||||
0x000A,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0001 offsetToFormatArray */
|
||||
0x0004,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0002 offsetToMapCellArray */
|
||||
0x0007,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0003 offsetToMappingTable */
|
||||
0x0025,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0004 Start of Format Array */
|
||||
/* Total of Format 0 : 0x0007 */
|
||||
/* Total of Format 1 : 0x0003 */
|
||||
/* Total of Format 2 : 0x0000 */
|
||||
/* Total of Format 3 : 0x0000 */
|
||||
|
||||
0x0000, 0x1000, 0x0011,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0007 Start of MapCell Array */
|
||||
/* 0000 */ 0x0000, 0x009F, 0x0000,
|
||||
/* 0001 */ 0x00C0, 0x00CF, 0x00C0,
|
||||
/* 0002 */ 0x00D1, 0x00D6, 0x00D1,
|
||||
/* 0003 */ 0x00D8, 0x00DD, 0x00D8,
|
||||
/* 0004 */ 0x00DF, 0x00EF, 0x00DF,
|
||||
/* 0005 */ 0x00F1, 0x00F6, 0x00F1,
|
||||
/* 0006 */ 0x00F8, 0x00FD, 0x00F8,
|
||||
/* 0007 */ 0x00A0, 0x00BF, 0x0000,
|
||||
/* 0008 */ 0x00D0, 0x00DE, 0x0020,
|
||||
/* 0009 */ 0x00F0, 0x00FF, 0x002F,
|
||||
/*-------------------------------------------------------*/
|
||||
/* Offset=0x0025 Start of MappingTable */
|
||||
|
||||
/* 0000 */ 0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7,
|
||||
/* 0008 */ 0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178,
|
||||
/* 0010 */ 0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56,
|
||||
/* 0018 */ 0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61,
|
||||
/* 0020 */ 0x0174, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x1E6A,
|
||||
/* 0028 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0176, 0x0175,
|
||||
/* 0030 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x1E6B, 0xFFFD,
|
||||
/* 0038 */ 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0xFFFD, 0x0177, 0x00FF,
|
||||
/* End of table Total Length = 0x0064 * 2 */
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user