cpython/Modules/cjkcodecs/_codecs_iso2022.c

/*
 * _codecs_iso2022.c: Codecs collection for ISO-2022 encodings.
 *
 * Written by Hye-Shik Chang <[email protected]>
 */

#define USING_IMPORTED_MAPS
#define USING_BINARY_PAIR_SEARCH
#define EXTERN_JISX0213_PAIR
#define EMULATE_JISX0213_2000_ENCODE_INVALID
#define EMULATE_JISX0213_2000_DECODE_INVALID

#define CJK_MOD_SPECIFIC_STATE


#include "cjkcodecs.h"
#include "alg_jisx0201.h"
#include "emu_jisx0213_2000.h"
#include "mappings_jisx0213_pair.h"

/* STATE

   state->c[0-3]

    00000000
    ||^^^^^|
    |+-----+----  G0-3 Character Set
    +-----------  Is G0-3 double byte?

   state->c[4]

    00000000
          ||
          |+----  Locked-Shift?
          +-----  ESC Throughout
*/

#define ESC
#define SO
#define SI
#define LF

#define MAX_ESCSEQLEN

#define CHARSET_ISO8859_1
#define CHARSET_ASCII
#define CHARSET_ISO8859_7
#define CHARSET_JISX0201_K
#define CHARSET_JISX0201_R

#define CHARSET_GB2312
#define CHARSET_JISX0208
#define CHARSET_KSX1001
#define CHARSET_JISX0212
#define CHARSET_GB2312_8565
#define CHARSET_CNS11643_1
#define CHARSET_CNS11643_2
#define CHARSET_JISX0213_2000_1
#define CHARSET_JISX0213_2
#define CHARSET_JISX0213_2004_1
#define CHARSET_JISX0208_O

#define CHARSET_DBCS
#define ESCMARK(mark)

#define IS_ESCEND(c)
#define IS_ISO2022ESC(c2)
    /* this is not a complete list of ISO-2022 escape sequence headers.
     * but, it's enough to implement CJK instances of iso-2022. */

#define MAP_UNMAPPABLE
#define MAP_MULTIPLE_AVAIL

#define F_SHIFTED
#define F_ESCTHROUGHOUT

#define STATE_SETG(dn, v)
#define STATE_GETG(dn)

#define STATE_G0
#define STATE_G1
#define STATE_G2
#define STATE_G3
#define STATE_SETG0(v)
#define STATE_SETG1(v)
#define STATE_SETG2(v)
#define STATE_SETG3(v)

#define STATE_SETFLAG(f)
#define STATE_GETFLAG(f)
#define STATE_CLEARFLAG(f)
#define STATE_CLEARFLAGS()

#define ISO2022_CONFIG
#define CONFIG_ISSET(flag)
#define CONFIG_DESIGNATIONS

/* iso2022_config.flags */
#define NO_SHIFT
#define USE_G2
#define USE_JISX0208_EXT

/*-*- internal data structures -*-*/

iso2022_init_func;
iso2022_decode_func;
iso2022_encode_func;

struct iso2022_designation {};

struct iso2022_config {};

/*-*- iso-2022 codec implementation -*-*/

CODEC_INIT(iso2022)
{}

ENCODER_INIT(iso2022)
{}

ENCODER_RESET(iso2022)
{}

ENCODER(iso2022)
{}

DECODER_INIT(iso2022)
{}

DECODER_RESET(iso2022)
{}

static Py_ssize_t
iso2022processesc(const MultibyteCodec *codec, MultibyteCodec_State *state,
                  const unsigned char **inbuf, Py_ssize_t *inleft)
{}

#define ISO8859_7_DECODE(c, writer)

static Py_ssize_t
iso2022processg2(const MultibyteCodec *codec, MultibyteCodec_State *state,
                 const unsigned char **inbuf, Py_ssize_t *inleft,
                 _PyUnicodeWriter *writer)
{}

DECODER(iso2022)
{}

/*-*- mapping access functions -*-*/

static int
ksx1001_init(const MultibyteCodec *codec)
{}

static Py_UCS4
ksx1001_decoder(const MultibyteCodec *codec, const unsigned char *data)
{}

static DBCHAR
ksx1001_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
                Py_ssize_t *length)
{}

static int
jisx0208_init(const MultibyteCodec *codec)
{}

static Py_UCS4
jisx0208_decoder(const MultibyteCodec *codec, const unsigned char *data)
{}

static DBCHAR
jisx0208_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
                 Py_ssize_t *length)
{}

static int
jisx0212_init(const MultibyteCodec *codec)
{}

static Py_UCS4
jisx0212_decoder(const MultibyteCodec *codec, const unsigned char *data)
{}

static DBCHAR
jisx0212_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
                 Py_ssize_t *length)
{}

static int
jisx0213_init(const MultibyteCodec *codec)
{}

#define config
static Py_UCS4
jisx0213_2000_1_decoder(const MultibyteCodec *codec, const unsigned char *data)
{}

static Py_UCS4
jisx0213_2000_2_decoder(const MultibyteCodec *codec, const unsigned char *data)
{}
#undef config

static Py_UCS4
jisx0213_2004_1_decoder(const MultibyteCodec *codec, const unsigned char *data)
{}

static Py_UCS4
jisx0213_2004_2_decoder(const MultibyteCodec *codec, const unsigned char *data)
{}

static DBCHAR
jisx0213_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
                 Py_ssize_t *length, const void *config)
{}

static DBCHAR
jisx0213_2000_1_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
                        Py_ssize_t *length)
{}

static DBCHAR
jisx0213_2000_1_encoder_paironly(const MultibyteCodec *codec,
                                 const Py_UCS4 *data, Py_ssize_t *length)
{}

static DBCHAR
jisx0213_2000_2_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
                        Py_ssize_t *length)
{}

static DBCHAR
jisx0213_2004_1_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
                        Py_ssize_t *length)
{}

static DBCHAR
jisx0213_2004_1_encoder_paironly(const MultibyteCodec *codec,
                                 const Py_UCS4 *data, Py_ssize_t *length)
{}

static DBCHAR
jisx0213_2004_2_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
                        Py_ssize_t *length)
{}

static Py_UCS4
jisx0201_r_decoder(const MultibyteCodec *codec, const unsigned char *data)
{}

static DBCHAR
jisx0201_r_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
                   Py_ssize_t *length)
{}

static Py_UCS4
jisx0201_k_decoder(const MultibyteCodec *codec, const unsigned char *data)
{}

static DBCHAR
jisx0201_k_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
                   Py_ssize_t *length)
{}

static int
gb2312_init(const MultibyteCodec *codec)
{}

static Py_UCS4
gb2312_decoder(const MultibyteCodec *codec, const unsigned char *data)
{}

static DBCHAR
gb2312_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
               Py_ssize_t *length)
{}


static Py_UCS4
dummy_decoder(const MultibyteCodec *codec, const unsigned char *data)
{}

static DBCHAR
dummy_encoder(const MultibyteCodec *codec, const Py_UCS4 *data,
              Py_ssize_t *length)
{}

/*-*- registry tables -*-*/

#define REGISTRY_KSX1001_G0
#define REGISTRY_KSX1001_G1
#define REGISTRY_JISX0201_R
#define REGISTRY_JISX0201_K
#define REGISTRY_JISX0208
#define REGISTRY_JISX0208_O
#define REGISTRY_JISX0212
#define REGISTRY_JISX0213_2000_1
#define REGISTRY_JISX0213_2000_1_PAIRONLY
#define REGISTRY_JISX0213_2000_2
#define REGISTRY_JISX0213_2004_1
#define REGISTRY_JISX0213_2004_1_PAIRONLY
#define REGISTRY_JISX0213_2004_2
#define REGISTRY_GB2312
#define REGISTRY_CNS11643_1
#define REGISTRY_CNS11643_2
#define REGISTRY_ISO8859_1
#define REGISTRY_ISO8859_7
#define REGISTRY_SENTINEL
#define CONFIGDEF(var, attrs)

static const struct iso2022_designation iso2022_kr_designations[] =;
CONFIGDEF()

static const struct iso2022_designation iso2022_jp_designations[] =;
CONFIGDEF()

static const struct iso2022_designation iso2022_jp_1_designations[] =;
CONFIGDEF()

static const struct iso2022_designation iso2022_jp_2_designations[] =;
CONFIGDEF()

static const struct iso2022_designation iso2022_jp_2004_designations[] =;
CONFIGDEF()

static const struct iso2022_designation iso2022_jp_3_designations[] =;
CONFIGDEF()

static const struct iso2022_designation iso2022_jp_ext_designations[] =;
CONFIGDEF()


BEGIN_MAPPINGS_LIST()

#define ISO2022_CODEC(variation)

BEGIN_CODECS_LIST()

I_AM_A_MODULE_FOR(iso2022)