intl/uconv/ucvja/nsUnicodeToSJIS.cpp

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:f0fc6e25d689
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 "nsUCConstructors.h"
7 #include "nsUnicodeToSJIS.h"
8
9 //----------------------------------------------------------------------
10 // Global functions and data [declaration]
11
12 static const uint16_t g_SJISMappingTable[] = {
13 #include "sjis.uf"
14 };
15
16 static const int16_t g_SJISShiftOutTable[] = {
17 4,
18 ShiftOutCell(u1ByteChar, 1, 0x00, 0x00, 0x00, 0x7F),
19 ShiftOutCell(u1ByteChar, 1, 0x00, 0xA1, 0x00, 0xDF),
20 ShiftOutCell(u2BytesChar, 2, 0x81, 0x40, 0x9F, 0xFC),
21 ShiftOutCell(u2BytesChar, 2, 0xE0, 0x40, 0xFC, 0xFC)
22 };
23
24 nsresult
25 nsUnicodeToSJISConstructor(nsISupports *aOuter, REFNSIID aIID,
26 void **aResult)
27 {
28 return CreateTableEncoder(uMultibytesCharset,
29 (uShiftOutTable*) &g_SJISShiftOutTable,
30 (uMappingTable*) &g_SJISMappingTable,
31 2 /* max length = src * 2 */,
32 aOuter, aIID, aResult);
33 }
34

mercurial