intl/uconv/ucvja/nsUnicodeToEUCJP.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/uconv/ucvja/nsUnicodeToEUCJP.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#include "nsUnicodeToEUCJP.h"
    1.10 +#include "nsUCVJADll.h"
    1.11 +#include "nsUCConstructors.h"
    1.12 +
    1.13 +//----------------------------------------------------------------------
    1.14 +// Global functions and data [declaration]
    1.15 +
    1.16 +// Shift Table
    1.17 +static const int16_t g0201ShiftOutTable[] =  {
    1.18 +        2,
    1.19 +        ShiftOutCell(u1ByteChar,         1, 0x00, 0x00, 0x00, 0x7F),
    1.20 +        ShiftOutCell(u1BytePrefix8EChar, 2, 0x00, 0xA1, 0x00, 0xDF)
    1.21 +};
    1.22 +
    1.23 +#define SIZE_OF_EUCJP_TABLES 3
    1.24 +static const uScanClassID gScanClassIDs[SIZE_OF_EUCJP_TABLES] = {
    1.25 +  u2BytesGRCharset,
    1.26 +  u2BytesGRCharset,
    1.27 +  uMultibytesCharset
    1.28 +};
    1.29 +
    1.30 +static const int16_t *gShiftTables[SIZE_OF_EUCJP_TABLES] =  {
    1.31 +    0,
    1.32 +    0,
    1.33 +    g0201ShiftOutTable
    1.34 +};
    1.35 +
    1.36 +static const uint16_t *gMappingTables[SIZE_OF_EUCJP_TABLES] = {
    1.37 +    g_uf0208Mapping,
    1.38 +    g_uf0208extMapping,
    1.39 +    g_uf0201Mapping
    1.40 +};
    1.41 +
    1.42 +nsresult
    1.43 +nsUnicodeToEUCJPConstructor(nsISupports *aOuter, REFNSIID aIID,
    1.44 +                            void **aResult)
    1.45 +{
    1.46 +    return CreateMultiTableEncoder(SIZE_OF_EUCJP_TABLES,
    1.47 +                                   (uScanClassID*) gScanClassIDs,
    1.48 +                                   (uShiftOutTable**) gShiftTables, 
    1.49 +                                   (uMappingTable**) gMappingTables,
    1.50 +                                   3 /* max length = src * 3 */,
    1.51 +                                   aOuter, aIID, aResult);
    1.52 +}
    1.53 +

mercurial