|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsUnicodeToEUCJP.h" |
|
7 #include "nsUCVJADll.h" |
|
8 #include "nsUCConstructors.h" |
|
9 |
|
10 //---------------------------------------------------------------------- |
|
11 // Global functions and data [declaration] |
|
12 |
|
13 // Shift Table |
|
14 static const int16_t g0201ShiftOutTable[] = { |
|
15 2, |
|
16 ShiftOutCell(u1ByteChar, 1, 0x00, 0x00, 0x00, 0x7F), |
|
17 ShiftOutCell(u1BytePrefix8EChar, 2, 0x00, 0xA1, 0x00, 0xDF) |
|
18 }; |
|
19 |
|
20 #define SIZE_OF_EUCJP_TABLES 3 |
|
21 static const uScanClassID gScanClassIDs[SIZE_OF_EUCJP_TABLES] = { |
|
22 u2BytesGRCharset, |
|
23 u2BytesGRCharset, |
|
24 uMultibytesCharset |
|
25 }; |
|
26 |
|
27 static const int16_t *gShiftTables[SIZE_OF_EUCJP_TABLES] = { |
|
28 0, |
|
29 0, |
|
30 g0201ShiftOutTable |
|
31 }; |
|
32 |
|
33 static const uint16_t *gMappingTables[SIZE_OF_EUCJP_TABLES] = { |
|
34 g_uf0208Mapping, |
|
35 g_uf0208extMapping, |
|
36 g_uf0201Mapping |
|
37 }; |
|
38 |
|
39 nsresult |
|
40 nsUnicodeToEUCJPConstructor(nsISupports *aOuter, REFNSIID aIID, |
|
41 void **aResult) |
|
42 { |
|
43 return CreateMultiTableEncoder(SIZE_OF_EUCJP_TABLES, |
|
44 (uScanClassID*) gScanClassIDs, |
|
45 (uShiftOutTable**) gShiftTables, |
|
46 (uMappingTable**) gMappingTables, |
|
47 3 /* max length = src * 3 */, |
|
48 aOuter, aIID, aResult); |
|
49 } |
|
50 |