|
1 /* -*- Mode: C; tab-width: 4; 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 |
|
7 #include "nsUnicodeToCP949.h" |
|
8 #include "nsUCvKODll.h" |
|
9 #include "nsUCConstructors.h" |
|
10 |
|
11 //---------------------------------------------------------------------- |
|
12 // Global functions and data [declaration] |
|
13 |
|
14 |
|
15 // Unicode Hangul syllables (not enumerated in KS X 1001) to CP949 : 8822 of them |
|
16 static const uint16_t g_ufCP949NoKSCHangulMapping[] = { |
|
17 #include "u20cp949hangul.uf" |
|
18 }; |
|
19 |
|
20 |
|
21 |
|
22 static const uint16_t *g_CP949MappingTable[3] = { |
|
23 g_ASCIIMappingTable, |
|
24 g_ufKSC5601Mapping, |
|
25 g_ufCP949NoKSCHangulMapping |
|
26 }; |
|
27 |
|
28 static const uScanClassID g_CP949ScanClassTable[3] = { |
|
29 u1ByteCharset, |
|
30 u2BytesGRCharset, |
|
31 u2BytesCharset |
|
32 }; |
|
33 |
|
34 nsresult |
|
35 nsUnicodeToCP949Constructor(nsISupports *aOuter, REFNSIID aIID, |
|
36 void **aResult) |
|
37 { |
|
38 return CreateMultiTableEncoder(3, |
|
39 (uScanClassID*) g_CP949ScanClassTable, |
|
40 (uMappingTable**) g_CP949MappingTable, |
|
41 2 /* max len = src * 2 */, |
|
42 aOuter, aIID, aResult); |
|
43 } |
|
44 |