root/enc/trans/escape.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. escape_xml_attr_quote_init
  2. fun_so_escape_xml_attr_quote
  3. escape_xml_attr_quote_finish
  4. Init_escape

/* autogenerated. */
/* src="transcode-tblgen.rb", len=21195, checksum=1768 */
/* src="escape.trans", len=1971, checksum=22479 */

#include "transcode_data.h"



static const unsigned char
escape_byte_array[1055] = {
#define from__to_amp_escape_offsets 0
0, 255,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  1,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,

#define str1_amp makeSTR1(258)
    makeSTR1LEN(5), 0x26, 0x61, 0x6D, 0x70, 0x3B,

#define from__to_xml_text_escape_offsets 264
0, 255,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  1,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  2,  0,  3,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,

#define str1_lt makeSTR1(522)
    makeSTR1LEN(4), 0x26, 0x6C, 0x74, 0x3B,

#define str1_gt makeSTR1(527)
    makeSTR1LEN(4), 0x26, 0x67, 0x74, 0x3B,

#define from__to_xml_attr_content_escape_offsets 532
0, 255,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  1,  0,  0,  0,  2,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  3,  0,  4,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,

#define str1_quot makeSTR1(790)
    makeSTR1LEN(6), 0x26, 0x71, 0x75, 0x6F, 0x74, 0x3B,

#define escape_xml_attr_quote_offsets 797
0, 255,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,
      0,  0,  0,  0,  0,  0,  0,  0,    0,  0,  0,  0,  0,  0,  0,  0,

};
static const unsigned int
escape_word_array[20] = {
#define from__to_amp_escape_infos WORDINDEX2INFO(0)
        NOMAP, str1_amp,

#define from__to_amp_escape WORDINDEX2INFO(2)
    from__to_amp_escape_offsets,
    from__to_amp_escape_infos,

#define from__to_xml_text_escape_infos WORDINDEX2INFO(4)
        NOMAP, str1_amp,  str1_lt,  str1_gt,

#define from__to_xml_text_escape WORDINDEX2INFO(8)
    from__to_xml_text_escape_offsets,
    from__to_xml_text_escape_infos,

#define from__to_xml_attr_content_escape_infos WORDINDEX2INFO(10)
         NOMAP, str1_quot,  str1_amp,   str1_lt,
       str1_gt,

#define from__to_xml_attr_content_escape WORDINDEX2INFO(15)
    from__to_xml_attr_content_escape_offsets,
    from__to_xml_attr_content_escape_infos,

#define escape_xml_attr_quote_infos WORDINDEX2INFO(17)
     FUNso,

#define escape_xml_attr_quote WORDINDEX2INFO(18)
    escape_xml_attr_quote_offsets,
    escape_xml_attr_quote_infos,

};
#define TRANSCODE_TABLE_INFO escape_byte_array, 1055, escape_word_array, 20, sizeof(unsigned int)
static const rb_transcoder
rb_from__to_amp_escape = {
    "", "amp_escape", from__to_amp_escape,
    TRANSCODE_TABLE_INFO,
    1, /* input_unit_length */
    1, /* max_input */
    5, /* max_output */
    asciicompat_converter, /* asciicompat_type */
    0, NULL, NULL, /* state_size, state_init, state_fini */
    NULL, NULL, NULL, NULL,
    NULL, NULL, NULL
};
static const rb_transcoder
rb_from__to_xml_text_escape = {
    "", "xml_text_escape", from__to_xml_text_escape,
    TRANSCODE_TABLE_INFO,
    1, /* input_unit_length */
    1, /* max_input */
    5, /* max_output */
    asciicompat_converter, /* asciicompat_type */
    0, NULL, NULL, /* state_size, state_init, state_fini */
    NULL, NULL, NULL, NULL,
    NULL, NULL, NULL
};
static const rb_transcoder
rb_from__to_xml_attr_content_escape = {
    "", "xml_attr_content_escape", from__to_xml_attr_content_escape,
    TRANSCODE_TABLE_INFO,
    1, /* input_unit_length */
    1, /* max_input */
    6, /* max_output */
    asciicompat_converter, /* asciicompat_type */
    0, NULL, NULL, /* state_size, state_init, state_fini */
    NULL, NULL, NULL, NULL,
    NULL, NULL, NULL
};


#define END 0
#define NORMAL  1

static int
escape_xml_attr_quote_init(void *statep)
{
    unsigned char *sp = statep;
    *sp = END;
    return 0;
}

static ssize_t
fun_so_escape_xml_attr_quote(void *statep, const unsigned char *s, size_t l, unsigned char *o, size_t osize)
{
    unsigned char *sp = statep;
    int n = 0;
    if (*sp == END) {
        *sp = NORMAL;
        o[n++] = '"';
    }
    o[n++] = s[0];
    return n;
}

static ssize_t
escape_xml_attr_quote_finish(void *statep, unsigned char *o, size_t osize)
{
    unsigned char *sp = statep;
    int n = 0;

    if (*sp == END) {
        o[n++] = '"';
    }

    o[n++] = '"';
    *sp = END;

    return n;
}

static const rb_transcoder
rb_escape_xml_attr_quote = {
    "", "xml_attr_quote", escape_xml_attr_quote,
    TRANSCODE_TABLE_INFO,
    1, /* input_unit_length */
    1, /* max_input */
    7, /* max_output */
    asciicompat_encoder, /* asciicompat_type */
    1, escape_xml_attr_quote_init, escape_xml_attr_quote_init,
    NULL, NULL, NULL, fun_so_escape_xml_attr_quote,
    escape_xml_attr_quote_finish
};

void
Init_escape(void)
{
    rb_register_transcoder(&rb_from__to_amp_escape);
    rb_register_transcoder(&rb_from__to_xml_text_escape);
    rb_register_transcoder(&rb_from__to_xml_attr_content_escape);

    rb_register_transcoder(&rb_escape_xml_attr_quote);
}



/* [previous][next][first][last][top][bottom][index][help] */