[前][次][番号順一覧][スレッド一覧]

ruby-changes:6970

From: akr <ko1@a...>
Date: Mon, 11 Aug 2008 16:40:21 +0900 (JST)
Subject: [ruby-changes:6970] Ruby:r18488 (trunk): * enc/trans/iso2022.trans: renamed from iso2022.erb.c.

akr	2008-08-11 16:39:52 +0900 (Mon, 11 Aug 2008)

  New Revision: 18488

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=18488

  Log:
    * enc/trans/iso2022.trans: renamed from iso2022.erb.c.
    
    * enc/trans/single_byte.trans: ditto.
    
    * enc/trans/utf_16_32.trans: ditto.
    
    * enc/trans/korean.trans: ditto.
    
    * enc/trans/japanese.trans: ditto.
    
    * enc/depend: follow the renaming.
    
    * tool/build-transcode: ditto.

  Added files:
    trunk/enc/trans/iso2022.trans
    trunk/enc/trans/japanese.trans
    trunk/enc/trans/korean.trans
    trunk/enc/trans/single_byte.trans
    trunk/enc/trans/utf_16_32.trans
  Removed files:
    trunk/enc/trans/iso2022.erb.c
    trunk/enc/trans/japanese.erb.c
    trunk/enc/trans/korean.erb.c
    trunk/enc/trans/single_byte.erb.c
    trunk/enc/trans/utf_16_32.erb.c
  Modified files:
    trunk/ChangeLog
    trunk/enc/depend
    trunk/tool/build-transcode

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 18487)
+++ ChangeLog	(revision 18488)
@@ -1,3 +1,19 @@
+Mon Aug 11 16:34:48 2008  Tanaka Akira  <akr@f...>
+
+	* enc/trans/iso2022.trans: renamed from iso2022.erb.c.
+
+	* enc/trans/single_byte.trans: ditto.
+
+	* enc/trans/utf_16_32.trans: ditto.
+
+	* enc/trans/korean.trans: ditto.
+
+	* enc/trans/japanese.trans: ditto.
+
+	* enc/depend: follow the renaming.
+
+	* tool/build-transcode: ditto.
+
 Mon Aug 11 15:09:23 2008  Tanaka Akira  <akr@f...>
 
 	* configure.in (rb_cv_broken_glibc_ia64_erfc): renamed from
Index: enc/trans/iso2022.erb.c
===================================================================
--- enc/trans/iso2022.erb.c	(revision 18487)
+++ enc/trans/iso2022.erb.c	(revision 18488)
@@ -1,148 +0,0 @@
-#include "transcode_data.h"
-
-<%
-  map = {}
-  map["1b2842"] = :func_so       # designate US-ASCII to G0.             "ESC ( B"
-  map["1b284a"] = :func_so       # designate JIS X 0201 latin to G0.     "ESC ( J"
-  map["1b2440"] = :func_so       # designate JIS X 0208 1978 to G0.      "ESC $ @"
-  map["1b2442"] = :func_so       # designate JIS X 0208 1983 to G0.      "ESC $ B"
-  map["{00-0d,10-1a,1c-7f}"] = :func_si
-
-  map_jisx0208_rest = {}
-  map_jisx0208_rest["{21-7e}"] = :func_so
-%>
-
-<%= transcode_generate_node(ActionMap.parse(map), "iso2022jp_to_eucjp") %>
-<%= transcode_generate_node(ActionMap.parse(map_jisx0208_rest), "iso2022jp_to_eucjp_jisx0208_rest") %>
-
-static VALUE
-fun_si_iso2022jp_to_eucjp(rb_transcoding* t, const unsigned char* s, size_t l)
-{
-    if (t->stateful[0] == 0)
-        return (VALUE)NOMAP;
-    else if (0x21 <= s[0] && s[0] <= 0x7e)
-        return (VALUE)&iso2022jp_to_eucjp_jisx0208_rest;
-    else
-        return (VALUE)INVALID;
-}
-
-static int
-fun_so_iso2022jp_to_eucjp(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
-{
-    if (s[0] == 0x1b) {
-        if (s[1] == '(') {
-            switch (s[l-1]) {
-              case 'B':
-              case 'J':
-                t->stateful[0] = 0;
-                break;
-            }
-        }
-        else {
-            switch (s[l-1]) {
-              case '@':
-              case 'B':
-                t->stateful[0] = 1;
-                break;
-            }
-        }
-        return 0;
-    }
-    else {
-        o[0] = s[0] | 0x80;
-        o[1] = s[1] | 0x80;
-        return 2;
-    }
-}
-
-static const rb_transcoder
-rb_ISO_2022_JP_to_EUC_JP = {
-    "ISO-2022-JP", "EUC-JP", &iso2022jp_to_eucjp,
-    1, /* input_unit_length */
-    3, /* max_input */
-    3, /* max_output */
-    NULL, fun_si_iso2022jp_to_eucjp, NULL, fun_so_iso2022jp_to_eucjp
-};
-
-<%
-  map_eucjp = {
-    "{0e,0f,1b}" => :undef,
-    "{00-0d,10-1a,1c-7f}" => :func_so,
-    "{a1-fe}{a1-fe}" => :func_so,
-    "8e{a1-fe}" => :undef,
-    "8f{a1-fe}{a1-fe}" => :undef,
-  }
-%>
-
-<%= transcode_generate_node(ActionMap.parse(map_eucjp), "eucjp_to_iso2022jp") %>
-
-static int
-fun_so_eucjp_to_iso2022jp(rb_transcoding *t, const unsigned char *s, size_t l, unsigned char *o)
-{
-    unsigned char *output0 = o;
-
-    if (t->stateful[0] == 0) {
-        t->stateful[0] = 1; /* initialized flag */
-        t->stateful[1] = 1; /* ASCII mode */
-    }
-
-    if (l != t->stateful[1]) {
-        if (l == 1) {
-            *o++ = 0x1b;
-            *o++ = '(';
-            *o++ = 'B';
-            t->stateful[1] = 1;
-        }
-        else {
-            *o++ = 0x1b;
-            *o++ = '$';
-            *o++ = 'B';
-            t->stateful[1] = 2;
-        }
-    }
-
-    if (l == 1) {
-        *o++ = s[0] & 0x7f;
-    }
-    else {
-        *o++ = s[0] & 0x7f;
-        *o++ = s[1] & 0x7f;
-    }
-
-    return o - output0;
-}
-
-static int
-finish_eucjp_to_iso2022jp(rb_transcoding *t, unsigned char *o)
-{
-    unsigned char *output0 = o;
-
-    if (t->stateful[0] == 0)
-        return 0;
-
-    if (t->stateful[1] != 1) {
-        *o++ = 0x1b;
-        *o++ = '(';
-        *o++ = 'B';
-        t->stateful[1] = 1;
-    }
-
-    return o - output0;
-}
-
-static const rb_transcoder
-rb_EUC_JP_to_ISO_2022_JP = {
-    "EUC-JP", "ISO-2022-JP", &eucjp_to_iso2022jp,
-    1, /* input_unit_length */
-    3, /* max_input */
-    5, /* max_output */
-    NULL, NULL, NULL, fun_so_eucjp_to_iso2022jp, finish_eucjp_to_iso2022jp
-};
-
-void
-Init_iso2022(void)
-{
-    rb_register_transcoder(&rb_ISO_2022_JP_to_EUC_JP);
-    rb_register_transcoder(&rb_EUC_JP_to_ISO_2022_JP);
-}
-
Index: enc/trans/single_byte.erb.c
===================================================================
--- enc/trans/single_byte.erb.c	(revision 18487)
+++ enc/trans/single_byte.erb.c	(revision 18488)
@@ -1,62 +0,0 @@
-#include "transcode_data.h"
-
-<%
-  us_ascii_map = [["{00-7f}", :nomap], ["{80-ff}", :undef]]
-
-  ISO_8859_1_TO_UCS_TBL = (0x80..0xff).map {|c| ["%02X" % c, c] }
-  CONTROL1_TO_UCS_TBL = (0x80..0x9f).map {|c| ["%02X" % c, c] }
-
-  require 'iso-8859-2-tbl'
-  require 'iso-8859-3-tbl'
-  require 'iso-8859-4-tbl'
-  require 'iso-8859-5-tbl'
-  require 'iso-8859-6-tbl'
-  require 'iso-8859-7-tbl'
-  require 'iso-8859-8-tbl'
-  require 'iso-8859-9-tbl'
-  require 'iso-8859-10-tbl'
-  require 'iso-8859-11-tbl'
-  require 'iso-8859-13-tbl'
-  require 'iso-8859-14-tbl'
-  require 'iso-8859-15-tbl'
-
-%>
-
-<%= transcode_tblgen "US-ASCII", "UTF-8", us_ascii_map %>
-<%= transcode_tblgen "UTF-8", "US-ASCII", us_ascii_map %>
-<%= transcode_tblgen "ASCII-8BIT", "UTF-8", us_ascii_map %>
-<%= transcode_tblgen "UTF-8", "ASCII-8BIT", us_ascii_map %>
-
-<%
-  def transcode_tblgen_iso8859(name, tbl_to_ucs)
-    tbl_to_ucs = CONTROL1_TO_UCS_TBL + tbl_to_ucs
-    name_ident = name.tr('-','_')
-    code = ''
-    code << transcode_tblgen(name, "UTF-8", [["{00-7f}", :nomap], *tbl_to_ucs])
-    code << "\n"
-    code << transcode_tblgen("UTF-8", name, [["{00-7f}", :nomap], *tbl_to_ucs.map {|a,b| [b,a] }])
-    code
-  end
-%>
-
-<%= transcode_tblgen_iso8859("ISO-8859-1", ISO_8859_1_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-2", ISO_8859_2_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-3", ISO_8859_3_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-4", ISO_8859_4_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-5", ISO_8859_5_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-6", ISO_8859_6_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-7", ISO_8859_7_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-8", ISO_8859_8_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-9", ISO_8859_9_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-10", ISO_8859_10_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-11", ISO_8859_11_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-13", ISO_8859_13_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-14", ISO_8859_14_TO_UCS_TBL) %>
-<%= transcode_tblgen_iso8859("ISO-8859-15", ISO_8859_15_TO_UCS_TBL) %>
-
-void
-Init_single_byte(void)
-{
-<%= transcode_register_code %>
-}
-
Index: enc/trans/utf_16_32.erb.c
===================================================================
--- enc/trans/utf_16_32.erb.c	(revision 18487)
+++ enc/trans/utf_16_32.erb.c	(revision 18488)
@@ -1,351 +0,0 @@
-#include "transcode_data.h"
-
-static int
-fun_so_from_utf_16be(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
-{
-    if (!s[0] && s[1]<0x80) {
-        o[0] = s[1];
-        return 1;
-    }
-    else if (s[0]<0x08) {
-        o[0] = 0xC0 | (s[0]<<2) | (s[1]>>6);
-        o[1] = 0x80 | (s[1]&0x3F);
-        return 2;
-    }
-    else if ((s[0]&0xF8)!=0xD8) {
-        o[0] = 0xE0 | (s[0]>>4);
-        o[1] = 0x80 | ((s[0]&0x0F)<<2) | (s[1]>>6);
-        o[2] = 0x80 | (s[1]&0x3F);
-        return 3;
-    }
-    else {
-        unsigned int u = (((s[0]&0x03)<<2)|(s[1]>>6)) + 1;
-        o[0] = 0xF0 | (u>>2);
-        o[1] = 0x80 | ((u&0x03)<<4) | ((s[1]>>2)&0x0F);
-        o[2] = 0x80 | ((s[1]&0x03)<<4) | ((s[2]&0x03)<<2) | (s[3]>>6);
-        o[3] = 0x80 | (s[3]&0x3F);
-        return 4;
-    }
-}
-
-static int
-fun_so_to_utf_16be(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
-{
-    if (!(s[0]&0x80)) {
-        o[0] = 0x00;
-        o[1] = s[0];
-        return 2;
-    }
-    else if ((s[0]&0xE0)==0xC0) {
-        o[0] = (s[0]>>2)&0x07;
-        o[1] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
-        return 2;
-    }
-    else if ((s[0]&0xF0)==0xE0) {
-        o[0] = (s[0]<<4) | ((s[1]>>2)^0x20);
-        o[1] = (s[1]<<6) | (s[2]^0x80);
-        return 2;
-    }
-    else {
-        int w = (((s[0]&0x07)<<2) | ((s[1]>>4)&0x03)) - 1;
-        o[0] = 0xD8 | (w>>2);
-        o[1] = (w<<6) | ((s[1]&0x0F)<<2) | ((s[2]>>4)-8);
-        o[2] = 0xDC | ((s[2]>>2)&0x03);
-        o[3] = (s[2]<<6) | (s[3]&~0x80);
-        return 4;
-    }
-}
-
-static int
-fun_so_from_utf_16le(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
-{
-    if (!s[1] && s[0]<0x80) {
-        o[0] = s[0];
-        return 1;
-    }
-    else if (s[1]<0x08) {
-        o[0] = 0xC0 | (s[1]<<2) | (s[0]>>6);
-        o[1] = 0x80 | (s[0]&0x3F);
-        return 2;
-    }
-    else if ((s[1]&0xF8)!=0xD8) {
-        o[0] = 0xE0 | (s[1]>>4);
-        o[1] = 0x80 | ((s[1]&0x0F)<<2) | (s[0]>>6);
-        o[2] = 0x80 | (s[0]&0x3F);
-        return 3;
-    }
-    else {
-        unsigned int u = (((s[1]&0x03)<<2)|(s[0]>>6)) + 1;
-        o[0] = 0xF0 | u>>2;
-        o[1] = 0x80 | ((u&0x03)<<4) | ((s[0]>>2)&0x0F);
-        o[2] = 0x80 | ((s[0]&0x03)<<4) | ((s[3]&0x03)<<2) | (s[2]>>6);
-        o[3] = 0x80 | (s[2]&0x3F);
-        return 4;
-    }
-}
-
-static int
-fun_so_to_utf_16le(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
-{
-    if (!(s[0]&0x80)) {
-        o[1] = 0x00;
-        o[0] = s[0];
-        return 2;
-    }
-    else if ((s[0]&0xE0)==0xC0) {
-        o[1] = (s[0]>>2)&0x07;
-        o[0] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
-        return 2;
-    }
-    else if ((s[0]&0xF0)==0xE0) {
-        o[1] = (s[0]<<4) | ((s[1]>>2)^0x20);
-        o[0] = (s[1]<<6) | (s[2]^0x80);
-        return 2;
-    }
-    else {
-        int w = (((s[0]&0x07)<<2) | ((s[1]>>4)&0x03)) - 1;
-        o[1] = 0xD8 | (w>>2);
-        o[0] = (w<<6) | ((s[1]&0x0F)<<2) | ((s[2]>>4)-8);
-        o[3] = 0xDC | ((s[2]>>2)&0x03);
-        o[2] = (s[2]<<6) | (s[3]&~0x80);
-        return 4;
-    }
-}
-
-static int
-fun_so_from_utf_32be(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
-{
-    if (!s[1]) {
-        if (s[2]==0 && s[3]<0x80) {
-            o[0] = s[3];
-            return 1;
-        }
-        else if (s[2]<0x08) {
-            o[0] = 0xC0 | (s[2]<<2) | (s[3]>>6);
-            o[1] = 0x80 | (s[3]&0x3F);
-            return 2;
-        }
-        else {
-            o[0] = 0xE0 | (s[2]>>4);
-            o[1] = 0x80 | ((s[2]&0x0F)<<2) | (s[3]>>6);
-            o[2] = 0x80 | (s[3]&0x3F);
-            return 3;
-        }
-    }
-    else {
-        o[0] = 0xF0 | (s[1]>>2);
-        o[1] = 0x80 | ((s[1]&0x03)<<4) | (s[2]>>4);
-        o[2] = 0x80 | ((s[2]&0x0F)<<2) | (s[3]>>6);
-        o[3] = 0x80 | (s[3]&0x3F);
-        return 4;
-    }
-}
-
-static int
-fun_so_to_utf_32be(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
-{
-    o[0] = 0;
-    if (!(s[0]&0x80)) {
-        o[1] = o[2] = 0x00;
-        o[3] = s[0];
-    }
-    else if ((s[0]&0xE0)==0xC0) {
-        o[1] = 0x00;
-        o[2] = (s[0]>>2)&0x07;
-        o[3] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
-    }
-    else if ((s[0]&0xF0)==0xE0) {
-        o[1] = 0x00;
-        o[2] = (s[0]<<4) | ((s[1]>>2)^0x20);
-        o[3] = (s[1]<<6) | (s[2]^0x80);
-    }
-    else {
-        o[1] = ((s[0]&0x07)<<2) | ((s[1]>>4)&0x03);
-        o[2] = ((s[1]&0x0F)<<4) | ((s[2]>>2)&0x0F);
-        o[3] = ((s[2]&0x03)<<6) | (s[3]&0x3F);
-    }
-    return 4;
-}
-
-static int
-fun_so_from_utf_32le(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
-{
-    if (!s[2]) {
-        if (s[1]==0 && s[0]<0x80) {
-            o[0] = s[0];
-            return 1;
-        }
-        else if (s[1]<0x08) {
-            o[0] = 0xC0 | (s[1]<<2) | (s[0]>>6);
-            o[1] = 0x80 | (s[0]&0x3F);
-            return 2;
-        }
-        else {
-            o[0] = 0xE0 | (s[1]>>4);
-            o[1] = 0x80 | ((s[1]&0x0F)<<2) | (s[0]>>6);
-            o[2] = 0x80 | (s[0]&0x3F);
-            return 3;
-        }
-    }
-    else {
-        o[0] = 0xF0 | (s[2]>>2);
-        o[1] = 0x80 | ((s[2]&0x03)<<4) | (s[1]>>4);
-        o[2] = 0x80 | ((s[1]&0x0F)<<2) | (s[0]>>6);
-        o[3] = 0x80 | (s[0]&0x3F);
-        return 4;
-    }
-}
-
-static int
-fun_so_to_utf_32le(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
-{
-    o[3] = 0;
-    if (!(s[0]&0x80)) {
-        o[2] = o[1] = 0x00;
-        o[0] = s[0];
-    }
-    else if ((s[0]&0xE0)==0xC0) {
-        o[2] = 0x00;
-        o[1] = (s[0]>>2)&0x07;
-        o[0] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
-    }
-    else if ((s[0]&0xF0)==0xE0) {
-        o[2] = 0x00;
-        o[1] = (s[0]<<4) | ((s[1]>>2)^0x20);
-        o[0] = (s[1]<<6) | (s[2]^0x80);
-    }
-    else {
-        o[2] = ((s[0]&0x07)<<2) | ((s[1]>>4)&0x03);
-        o[1] = ((s[1]&0x0F)<<4) | ((s[2]>>2)&0x0F);
-        o[0] = ((s[2]&0x03)<<6) | (s[3]&0x3F);
-    }
-    return 4;
-}
-
-<%=
-  map = {}
-  map["{00-d7,e0-ff}{00-ff}"] = :func_so
-  map["{d8-db}{00-ff}{dc-df}{00-ff}"] = :func_so
-  transcode_generate_node(ActionMap.parse(map), "from_UTF_16BE")
-%>
-
-static const rb_transcoder
-rb_from_UTF_16BE = {
-    "UTF-16BE", "UTF-8", &from_UTF_16BE,
-    2, /* input_unit_length */
-    4, /* max_input */
-    4, /* max_output */
-    NULL, NULL, NULL, &fun_so_from_utf_16be
-};
-
-<%=
-  map = {}
-  map["{00-7f}"] = :func_so
-  map["{c2-df}{80-bf}"] = :func_so
-  map["e0{a0-bf}{80-bf}"] = :func_so
-  map["{e1-ec}{80-bf}{80-bf}"] = :func_so
-  map["ed{80-9f}{80-bf}"] = :func_so
-  map["{ee-ef}{80-bf}{80-bf}"] = :func_so
-  map["f0{90-bf}{80-bf}{80-bf}"] = :func_so
-  map["{f1-f3}{80-bf}{80-bf}{80-bf}"] = :func_so
-  map["f4{80-8f}{80-bf}{80-bf}"] = :func_so
-  am = ActionMap.parse(map)
-  transcode_generate_node(am, "to_UTF_16BE")
-%>
-
-static const rb_transcoder
-rb_to_UTF_16BE = {
-    "UTF-8", "UTF-16BE", &to_UTF_16BE,
-    1, /* input_unit_length */
-    4, /* max_input */
-    4, /* max_output */
-    NULL, NULL, NULL, &fun_so_to_utf_16be
-};
-
-<%=
-  map = {}
-  map["{00-ff}{00-d7,e0-ff}"] = :func_so
-  map["{00-ff}{d8-db}{00-ff}{dc-df}"] = :func_so
-  transcode_generate_node(ActionMap.parse(map), "from_UTF_16LE")
-%>
-
-static const rb_transcoder
-rb_from_UTF_16LE = {
-    "UTF-16LE", "UTF-8", &from_UTF_16LE,
-    2, /* input_unit_length */
-    4, /* max_input */
-    4, /* max_output */
-    NULL, NULL, NULL, &fun_so_from_utf_16le
-};
-
-static const rb_transcoder
-rb_to_UTF_16LE = {
-    "UTF-8", "UTF-16LE", &to_UTF_16BE,
-    1, /* input_unit_length */
-    4, /* max_input */
-    4, /* max_output */
-    NULL, NULL, NULL, &fun_so_to_utf_16le
-};
-
-<%=
-  map = {}
-  map["0000{00-d7,e0-ff}{00-ff}"] = :func_so
-  map["00{01-10}{00-ff}{00-ff}"] = :func_so
-  transcode_generate_node(ActionMap.parse(map), "from_UTF_32BE")
-%>
-
-static const rb_transcoder
-rb_from_UTF_32BE = {
-    "UTF-32BE", "UTF-8", &from_UTF_32BE,
-    4, /* input_unit_length */
-    4, /* max_input */
-    4, /* max_output */
-    NULL, NULL, NULL, &fun_so_from_utf_32be
-};
-
-static const rb_transcoder
-rb_to_UTF_32BE = {
-    "UTF-8", "UTF-32BE", &to_UTF_16BE,
-    1, /* input_unit_length */
-    4, /* max_input */
-    4, /* max_output */
-    NULL, NULL, NULL, &fun_so_to_utf_32be
-};
-
-<%=
-  map = {}
-  map["{00-ff}{00-d7,e0-ff}0000"] = :func_so
-  map["{00-ff}{00-ff}{01-10}00"] = :func_so
-  transcode_generate_node(ActionMap.parse(map), "from_UTF_32LE")
-%>
-
-static const rb_transcoder
-rb_from_UTF_32LE = {
-    "UTF-32LE", "UTF-8", &from_UTF_32LE,
-    4, /* input_unit_length */
-    4, /* max_input */
-    4, /* max_output */
-    NULL, NULL, NULL, &fun_so_from_utf_32le
-};
-
-static const rb_transcoder
-rb_to_UTF_32LE = {
-    "UTF-8", "UTF-32LE", &to_UTF_16BE,
-    1, /* input_unit_length */
-    4, /* max_input */
-    4, /* max_output */
-    NULL, NULL, NULL, &fun_so_to_utf_32le
-};
-
-void
-Init_utf_16_32(void)
-{
-    rb_register_transcoder(&rb_from_UTF_16BE);
-    rb_register_transcoder(&rb_to_UTF_16BE);
-    rb_register_transcoder(&rb_from_UTF_16LE);
-    rb_register_transcoder(&rb_to_UTF_16LE);
-    rb_register_transcoder(&rb_from_UTF_32BE);
-    rb_register_transcoder(&rb_to_UTF_32BE);
-    rb_register_transcoder(&rb_from_UTF_32LE);
-    rb_register_transcoder(&rb_to_UTF_32LE);
-}
Index: enc/trans/korean.erb.c
===================================================================
--- enc/trans/korean.erb.c	(revision 18487)
+++ enc/trans/korean.erb.c	(revision 18488)
@@ -1,17 +0,0 @@
-#include "transcode_data.h"
-
-<%
-  require "euckr-tbl"
-  require "cp949-tbl"
-%>
-
-<%= transcode_tblgen "UTF-8", "EUC-KR", [["{00-7f}", :nomap], *UCS_TO_EUCKR_TBL] %>
-<%= transcode_tblgen "EUC-KR", "UTF-8", [["{00-7f}", :nomap], *EUCKR_TO_UCS_TBL] %>
-<%= transcode_tblgen "UTF-8", "CP949", [["{00-7f}", :nomap], *UCS_TO_CP949_TBL] %>
-<%= transcode_tblgen "CP949", "UTF-8", [["{00-7f}", :nomap], *CP949_TO_UCS_TBL] %>
-
-void
-Init_korean(void)
-{
-<%= transcode_register_code %>
-}
Index: enc/trans/japanese.erb.c
===================================================================
--- enc/trans/japanese.erb.c	(revision 18487)
+++ enc/trans/japanese.erb.c	(revision 18488)
@@ -1,24 +0,0 @@
-#include "transcode_data.h"
-
-<%
-  require 'sjis-tbl'
-  require 'eucjp-tbl'
-%>
-
-<%= transcode_tblgen "Shift_JIS", "UTF-8", [["{00-7f}", :nomap], *SJIS_TO_UCS_TBL] %>
-<%= transcode_tblgen "Windows-31J", "UTF-8", [["{00-7f}", :nomap], *SJIS_TO_UCS_TBL] %>
-
-<%= transcode_tblgen "UTF-8", "Shift_JIS", [["{00-7f}", :nomap], *UCS_TO_SJIS_TBL] %>
-<%= transcode_tblgen "UTF-8", "Windows-31J", [["{00-7f}", :nomap], *UCS_TO_SJIS_TBL] %>
-
-<%= transcode_tblgen "EUC-JP", "UTF-8", [["{00-7f}", :nomap], *EUCJP_TO_UCS_TBL] %>
-<%= transcode_tblgen "CP51932", "UTF-8", [["{00-7f}", :nomap], *EUCJP_TO_UCS_TBL] %>
-
-<%= transcode_tblgen "UTF-8", "EUC-JP", [["{00-7f}", :nomap], *UCS_TO_EUCJP_TBL] %>
-<%= transcode_tblgen "UTF-8", "CP51932", [["{00-7f}", :nomap], *UCS_TO_EUCJP_TBL] %>
-
-void
-Init_japanese(void)
-{
-<%= transcode_register_code %>
-}
Index: enc/trans/iso2022.trans
===================================================================
--- enc/trans/iso2022.trans	(revision 0)
+++ enc/trans/iso2022.trans	(revision 18488)
@@ -0,0 +1,148 @@
+#include "transcode_data.h"
+
+<%
+  map = {}
+  map["1b2842"] = :func_so       # designate US-ASCII to G0.             "ESC ( B"
+  map["1b284a"] = :func_so       # designate JIS X 0201 latin to G0.     "ESC ( J"
+  map["1b2440"] = :func_so       # designate JIS X 0208 1978 to G0.      "ESC $ @"
+  map["1b2442"] = :func_so       # designate JIS X 0208 1983 to G0.      "ESC $ B"
+  map["{00-0d,10-1a,1c-7f}"] = :func_si
+
+  map_jisx0208_rest = {}
+  map_jisx0208_rest["{21-7e}"] = :func_so
+%>
+
+<%= transcode_generate_node(ActionMap.parse(map), "iso2022jp_to_eucjp") %>
+<%= transcode_generate_node(ActionMap.parse(map_jisx0208_rest), "iso2022jp_to_eucjp_jisx0208_rest") %>
+
+static VALUE
+fun_si_iso2022jp_to_eucjp(rb_transcoding* t, const unsigned char* s, size_t l)
+{
+    if (t->stateful[0] == 0)
+        return (VALUE)NOMAP;
+    else if (0x21 <= s[0] && s[0] <= 0x7e)
+        return (VALUE)&iso2022jp_to_eucjp_jisx0208_rest;
+    else
+        return (VALUE)INVALID;
+}
+
+static int
+fun_so_iso2022jp_to_eucjp(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
+{
+    if (s[0] == 0x1b) {
+        if (s[1] == '(') {
+            switch (s[l-1]) {
+              case 'B':
+              case 'J':
+                t->stateful[0] = 0;
+                break;
+            }
+        }
+        else {
+            switch (s[l-1]) {
+              case '@':
+              case 'B':
+                t->stateful[0] = 1;
+                break;
+            }
+        }
+        return 0;
+    }
+    else {
+        o[0] = s[0] | 0x80;
+        o[1] = s[1] | 0x80;
+        return 2;
+    }
+}
+
+static const rb_transcoder
+rb_ISO_2022_JP_to_EUC_JP = {
+    "ISO-2022-JP", "EUC-JP", &iso2022jp_to_eucjp,
+    1, /* input_unit_length */
+    3, /* max_input */
+    3, /* max_output */
+    NULL, fun_si_iso2022jp_to_eucjp, NULL, fun_so_iso2022jp_to_eucjp
+};
+
+<%
+  map_eucjp = {
+    "{0e,0f,1b}" => :undef,
+    "{00-0d,10-1a,1c-7f}" => :func_so,
+    "{a1-fe}{a1-fe}" => :func_so,
+    "8e{a1-fe}" => :undef,
+    "8f{a1-fe}{a1-fe}" => :undef,
+  }
+%>
+
+<%= transcode_generate_node(ActionMap.parse(map_eucjp), "eucjp_to_iso2022jp") %>
+
+static int
+fun_so_eucjp_to_iso2022jp(rb_transcoding *t, const unsigned char *s, size_t l, unsigned char *o)
+{
+    unsigned char *output0 = o;
+
+    if (t->stateful[0] == 0) {
+        t->stateful[0] = 1; /* initialized flag */
+        t->stateful[1] = 1; /* ASCII mode */
+    }
+
+    if (l != t->stateful[1]) {
+        if (l == 1) {
+            *o++ = 0x1b;
+            *o++ = '(';
+            *o++ = 'B';
+            t->stateful[1] = 1;
+        }
+        else {
+            *o++ = 0x1b;
+            *o++ = '$';
+            *o++ = 'B';
+            t->stateful[1] = 2;
+        }
+    }
+
+    if (l == 1) {
+        *o++ = s[0] & 0x7f;
+    }
+    else {
+        *o++ = s[0] & 0x7f;
+        *o++ = s[1] & 0x7f;
+    }
+
+    return o - output0;
+}
+
+static int
+finish_eucjp_to_iso2022jp(rb_transcoding *t, unsigned char *o)
+{
+    unsigned char *output0 = o;
+
+    if (t->stateful[0] == 0)
+        return 0;
+
+    if (t->stateful[1] != 1) {
+        *o++ = 0x1b;
+        *o++ = '(';
+        *o++ = 'B';
+        t->stateful[1] = 1;
+    }
+
+    return o - output0;
+}
+
+static const rb_transcoder
+rb_EUC_JP_to_ISO_2022_JP = {
+    "EUC-JP", "ISO-2022-JP", &eucjp_to_iso2022jp,
+    1, /* input_unit_length */
+    3, /* max_input */
+    5, /* max_output */
+    NULL, NULL, NULL, fun_so_eucjp_to_iso2022jp, finish_eucjp_to_iso2022jp
+};
+
+void
+Init_iso2022(void)
+{
+    rb_register_transcoder(&rb_ISO_2022_JP_to_EUC_JP);
+    rb_register_transcoder(&rb_EUC_JP_to_ISO_2022_JP);
+}
+

Property changes on: enc/trans/iso2022.trans
___________________________________________________________________
Name: svn:eol-style
   + LF

Index: enc/trans/single_byte.trans
===================================================================
--- enc/trans/single_byte.trans	(revision 0)
+++ enc/trans/single_byte.trans	(revision 18488)
@@ -0,0 +1,62 @@
+#include "transcode_data.h"
+
+<%
+  us_ascii_map = [["{00-7f}", :nomap], ["{80-ff}", :undef]]
+
+  ISO_8859_1_TO_UCS_TBL = (0x80..0xff).map {|c| ["%02X" % c, c] }
+  CONTROL1_TO_UCS_TBL = (0x80..0x9f).map {|c| ["%02X" % c, c] }
+
+  require 'iso-8859-2-tbl'
+  require 'iso-8859-3-tbl'
+  require 'iso-8859-4-tbl'
+  require 'iso-8859-5-tbl'
+  require 'iso-8859-6-tbl'
+  require 'iso-8859-7-tbl'
+  require 'iso-8859-8-tbl'
+  require 'iso-8859-9-tbl'
+  require 'iso-8859-10-tbl'
+  require 'iso-8859-11-tbl'
+  require 'iso-8859-13-tbl'
+  require 'iso-8859-14-tbl'
+  require 'iso-8859-15-tbl'
+
+%>
+
+<%= transcode_tblgen "US-ASCII", "UTF-8", us_ascii_map %>
+<%= transcode_tblgen "UTF-8", "US-ASCII", us_ascii_map %>
+<%= transcode_tblgen "ASCII-8BIT", "UTF-8", us_ascii_map %>
+<%= transcode_tblgen "UTF-8", "ASCII-8BIT", us_ascii_map %>
+
+<%
+  def transcode_tblgen_iso8859(name, tbl_to_ucs)
+    tbl_to_ucs = CONTROL1_TO_UCS_TBL + tbl_to_ucs
+    name_ident = name.tr('-','_')
+    code = ''
+    code << transcode_tblgen(name, "UTF-8", [["{00-7f}", :nomap], *tbl_to_ucs])
+    code << "\n"
+    code << transcode_tblgen("UTF-8", name, [["{00-7f}", :nomap], *tbl_to_ucs.map {|a,b| [b,a] }])
+    code
+  end
+%>
+
+<%= transcode_tblgen_iso8859("ISO-8859-1", ISO_8859_1_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-2", ISO_8859_2_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-3", ISO_8859_3_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-4", ISO_8859_4_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-5", ISO_8859_5_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-6", ISO_8859_6_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-7", ISO_8859_7_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-8", ISO_8859_8_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-9", ISO_8859_9_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-10", ISO_8859_10_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-11", ISO_8859_11_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-13", ISO_8859_13_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-14", ISO_8859_14_TO_UCS_TBL) %>
+<%= transcode_tblgen_iso8859("ISO-8859-15", ISO_8859_15_TO_UCS_TBL) %>
+
+void
+Init_single_byte(void)
+{
+<%= transcode_register_code %>
+}
+

Property changes on: enc/trans/single_byte.trans
___________________________________________________________________
Name: svn:eol-style
   + LF

Index: enc/trans/utf_16_32.trans
===================================================================
--- enc/trans/utf_16_32.trans	(revision 0)
+++ enc/trans/utf_16_32.trans	(revision 18488)
@@ -0,0 +1,351 @@
+#include "transcode_data.h"
+
+static int
+fun_so_from_utf_16be(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
+{
+    if (!s[0] && s[1]<0x80) {
+        o[0] = s[1];
+        return 1;
+    }
+    else if (s[0]<0x08) {
+        o[0] = 0xC0 | (s[0]<<2) | (s[1]>>6);
+        o[1] = 0x80 | (s[1]&0x3F);
+        return 2;
+    }
+    else if ((s[0]&0xF8)!=0xD8) {
+        o[0] = 0xE0 | (s[0]>>4);
+        o[1] = 0x80 | ((s[0]&0x0F)<<2) | (s[1]>>6);
+        o[2] = 0x80 | (s[1]&0x3F);
+        return 3;
+    }
+    else {
+        unsigned int u = (((s[0]&0x03)<<2)|(s[1]>>6)) + 1;
+        o[0] = 0xF0 | (u>>2);
+        o[1] = 0x80 | ((u&0x03)<<4) | ((s[1]>>2)&0x0F);
+        o[2] = 0x80 | ((s[1]&0x03)<<4) | ((s[2]&0x03)<<2) | (s[3]>>6);
+        o[3] = 0x80 | (s[3]&0x3F);
+        return 4;
+    }
+}
+
+static int
+fun_so_to_utf_16be(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
+{
+    if (!(s[0]&0x80)) {
+        o[0] = 0x00;
+        o[1] = s[0];
+        return 2;
+    }
+    else if ((s[0]&0xE0)==0xC0) {
+        o[0] = (s[0]>>2)&0x07;
+        o[1] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
+        return 2;
+    }
+    else if ((s[0]&0xF0)==0xE0) {
+        o[0] = (s[0]<<4) | ((s[1]>>2)^0x20);
+        o[1] = (s[1]<<6) | (s[2]^0x80);
+        return 2;
+    }
+    else {
+        int w = (((s[0]&0x07)<<2) | ((s[1]>>4)&0x03)) - 1;
+        o[0] = 0xD8 | (w>>2);
+        o[1] = (w<<6) | ((s[1]&0x0F)<<2) | ((s[2]>>4)-8);
+        o[2] = 0xDC | ((s[2]>>2)&0x03);
+        o[3] = (s[2]<<6) | (s[3]&~0x80);
+        return 4;
+    }
+}
+
+static int
+fun_so_from_utf_16le(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
+{
+    if (!s[1] && s[0]<0x80) {
+        o[0] = s[0];
+        return 1;
+    }
+    else if (s[1]<0x08) {
+        o[0] = 0xC0 | (s[1]<<2) | (s[0]>>6);
+        o[1] = 0x80 | (s[0]&0x3F);
+        return 2;
+    }
+    else if ((s[1]&0xF8)!=0xD8) {
+        o[0] = 0xE0 | (s[1]>>4);
+        o[1] = 0x80 | ((s[1]&0x0F)<<2) | (s[0]>>6);
+        o[2] = 0x80 | (s[0]&0x3F);
+        return 3;
+    }
+    else {
+        unsigned int u = (((s[1]&0x03)<<2)|(s[0]>>6)) + 1;
+        o[0] = 0xF0 | u>>2;
+        o[1] = 0x80 | ((u&0x03)<<4) | ((s[0]>>2)&0x0F);
+        o[2] = 0x80 | ((s[0]&0x03)<<4) | ((s[3]&0x03)<<2) | (s[2]>>6);
+        o[3] = 0x80 | (s[2]&0x3F);
+        return 4;
+    }
+}
+
+static int
+fun_so_to_utf_16le(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
+{
+    if (!(s[0]&0x80)) {
+        o[1] = 0x00;
+        o[0] = s[0];
+        return 2;
+    }
+    else if ((s[0]&0xE0)==0xC0) {
+        o[1] = (s[0]>>2)&0x07;
+        o[0] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
+        return 2;
+    }
+    else if ((s[0]&0xF0)==0xE0) {
+        o[1] = (s[0]<<4) | ((s[1]>>2)^0x20);
+        o[0] = (s[1]<<6) | (s[2]^0x80);
+        return 2;
+    }
+    else {
+        int w = (((s[0]&0x07)<<2) | ((s[1]>>4)&0x03)) - 1;
+        o[1] = 0xD8 | (w>>2);
+        o[0] = (w<<6) | ((s[1]&0x0F)<<2) | ((s[2]>>4)-8);
+        o[3] = 0xDC | ((s[2]>>2)&0x03);
+        o[2] = (s[2]<<6) | (s[3]&~0x80);
+        return 4;
+    }
+}
+
+static int
+fun_so_from_utf_32be(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
+{
+    if (!s[1]) {
+        if (s[2]==0 && s[3]<0x80) {
+            o[0] = s[3];
+            return 1;
+        }
+        else if (s[2]<0x08) {
+            o[0] = 0xC0 | (s[2]<<2) | (s[3]>>6);
+            o[1] = 0x80 | (s[3]&0x3F);
+            return 2;
+        }
+        else {
+            o[0] = 0xE0 | (s[2]>>4);
+            o[1] = 0x80 | ((s[2]&0x0F)<<2) | (s[3]>>6);
+            o[2] = 0x80 | (s[3]&0x3F);
+            return 3;
+        }
+    }
+    else {
+        o[0] = 0xF0 | (s[1]>>2);
+        o[1] = 0x80 | ((s[1]&0x03)<<4) | (s[2]>>4);
+        o[2] = 0x80 | ((s[2]&0x0F)<<2) | (s[3]>>6);
+        o[3] = 0x80 | (s[3]&0x3F);
+        return 4;
+    }
+}
+
+static int
+fun_so_to_utf_32be(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
+{
+    o[0] = 0;
+    if (!(s[0]&0x80)) {
+        o[1] = o[2] = 0x00;
+        o[3] = s[0];
+    }
+    else if ((s[0]&0xE0)==0xC0) {
+        o[1] = 0x00;
+        o[2] = (s[0]>>2)&0x07;
+        o[3] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
+    }
+    else if ((s[0]&0xF0)==0xE0) {
+        o[1] = 0x00;
+        o[2] = (s[0]<<4) | ((s[1]>>2)^0x20);
+        o[3] = (s[1]<<6) | (s[2]^0x80);
+    }
+    else {
+        o[1] = ((s[0]&0x07)<<2) | ((s[1]>>4)&0x03);
+        o[2] = ((s[1]&0x0F)<<4) | ((s[2]>>2)&0x0F);
+        o[3] = ((s[2]&0x03)<<6) | (s[3]&0x3F);
+    }
+    return 4;
+}
+
+static int
+fun_so_from_utf_32le(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
+{
+    if (!s[2]) {
+        if (s[1]==0 && s[0]<0x80) {
+            o[0] = s[0];
+            return 1;
+        }
+        else if (s[1]<0x08) {
+            o[0] = 0xC0 | (s[1]<<2) | (s[0]>>6);
+            o[1] = 0x80 | (s[0]&0x3F);
+            return 2;
+        }
+        else {
+            o[0] = 0xE0 | (s[1]>>4);
+            o[1] = 0x80 | ((s[1]&0x0F)<<2) | (s[0]>>6);
+            o[2] = 0x80 | (s[0]&0x3F);
+            return 3;
+        }
+    }
+    else {
+        o[0] = 0xF0 | (s[2]>>2);
+        o[1] = 0x80 | ((s[2]&0x03)<<4) | (s[1]>>4);
+        o[2] = 0x80 | ((s[1]&0x0F)<<2) | (s[0]>>6);
+        o[3] = 0x80 | (s[0]&0x3F);
+        return 4;
+    }
+}
+
+static int
+fun_so_to_utf_32le(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o)
+{
+    o[3] = 0;
+    if (!(s[0]&0x80)) {
+        o[2] = o[1] = 0x00;
+        o[0] = s[0];
+    }
+    else if ((s[0]&0xE0)==0xC0) {
+        o[2] = 0x00;
+        o[1] = (s[0]>>2)&0x07;
+        o[0] = ((s[0]&0x03)<<6) | (s[1]&0x3F);
+    }
+    else if ((s[0]&0xF0)==0xE0) {
+        o[2] = 0x00;
+        o[1] = (s[0]<<4) | ((s[1]>>2)^0x20);
+        o[0] = (s[1]<<6) | (s[2]^0x80);
+    }
+    else {
+        o[2] = ((s[0]&0x07)<<2) | ((s[1]>>4)&0x03);
+        o[1] = ((s[1]&0x0F)<<4) | ((s[2]>>2)&0x0F);
+        o[0] = ((s[2]&0x03)<<6) | (s[3]&0x3F);
+    }
+    return 4;
+}
+
+<%=
+  map = {}
+  map["{00-d7,e0-ff}{00-ff}"] = :func_so
+  map["{d8-db}{00-ff}{dc-df}{00-ff}"] = :func_so
+  transcode_generate_node(ActionMap.parse(map), "from_UTF_16BE")
+%>
+
+static const rb_transcoder
+rb_from_UTF_16BE = {
+    "UTF-16BE", "UTF-8", &from_UTF_16BE,
+    2, /* input_unit_length */
+    4, /* max_input */
+    4, /* max_output */
+    NULL, NULL, NULL, &fun_so_from_utf_16be
+};
+
+<%=
+  map = {}
+  map["{00-7f}"] = :func_so
+  map["{c2-df}{80-bf}"] = :func_so
+  map["e0{a0-bf}{80-bf}"] = :func_so
+  map["{e1-ec}{80-bf}{80-bf}"] = :func_so
+  map["ed{80-9f}{80-bf}"] = :func_so
+  map["{ee-ef}{80-bf}{80-bf}"] = :func_so
+  map["f0{90-bf}{80-bf}{80-bf}"] = :func_so
+  map["{f1-f3}{80-bf}{80-bf}{80-bf}"] = :func_so
+  map["f4{80-8f}{80-bf}{80-bf}"] = :func_so
+  am = ActionMap.parse(map)
+  transcode_generate_node(am, "to_UTF_16BE")
+%>
+
+static const rb_transcoder
+rb_to_UTF_16BE = {
+    "UTF-8", "UTF-16BE", &to_UTF_16BE,
+    1, /* input_unit_length */
+    4, /* max_input */
+    4, /* max_output */
+    NULL, NULL, NULL, &fun_so_to_utf_16be
+};
+
+<%=
+  map = {}
+  map["{00-ff}{00-d7,e0-ff}"] = :func_so
+  map["{00-ff}{d8-db}{00-ff}{dc-df}"] = :func_so
+  transcode_generate_node(ActionMap.parse(map), "from_UTF_16LE")
+%>
+
+static const rb_transcoder
+rb_from_UTF_16LE = {
+    "UTF-16LE", "UTF-8", &from_UTF_16LE,
+    2, /* input_unit_length */
+    4, /* max_input */
+    4, /* max_output */
+    NULL, NULL, NULL, &fun_so_from_utf_16le
+};
+
+static const rb_transcoder
+rb_to_UTF_16LE = {
+    "UTF-8", "UTF-16LE", &to_UTF_16BE,
+    1, /* input_unit_length */
+    4, /* max_input */
+    4, /* max_output */
+    NULL, NULL, NULL, &fun_so_to_utf_16le
+};
+
+<%=
+  map = {}
+  map["0000{00-d7,e0-ff}{00-ff}"] = :func_so
+  map["00{01-10}{00-ff}{00-ff}"] = :func_so
+  transcode_generate_node(ActionMap.parse(map), "from_UTF_32BE")
+%>
+
+static const rb_transcoder
+rb_from_UTF_32BE = {
+    "UTF-32BE", "UTF-8", &from_UTF_32BE,
+    4, /* input_unit_length */
+    4, /* max_input */
+    4, /* max_output */
+    NULL, NULL, NULL, &fun_so_from_utf_32be
+};
+
+static const rb_transcoder
+rb_to_UTF_32BE = {
+    "UTF-8", "UTF-32BE", &to_UTF_16BE,
+    1, /* input_unit_length */
+    4, /* max_input */
+    4, /* max_output */
+    NULL, NULL, NULL, &fun_so_to_utf_32be
+};
+
+<%=
+  map = {}
+  map["{00-ff}{00-d7,e0-ff}0000"] = :func_so
+  map["{00-ff}{00-ff}{01-10}00"] = :func_so
+  transcode_generate_node(ActionMap.parse(map), "from_UTF_32LE")
+%>
+
+static const rb_transcoder
+rb_from_UTF_32LE = {
+    "UTF-32LE", "UTF-8", &from_UTF_32LE,
+    4, /* input_unit_length */
+    4, /* max_input */
+    4, /* max_output */
+    NULL, NULL, NULL, &fun_so_from_utf_32le
+};
+
+static const rb_transcoder
+rb_to_UTF_32LE = {
+    "UTF-8", "UTF-32LE", &to_UTF_16BE,
+    1, /* input_unit_length */
+    4, /* max_input */
+    4, /* max_output */
+    NULL, NULL, NULL, &fun_so_to_utf_32le
+};
+
+void
+Init_utf_16_32(void)
+{
+    rb_register_transcoder(&rb_from_UTF_16BE);
+    rb_register_transcoder(&rb_to_UTF_16BE);
+    rb_register_transcoder(&rb_from_UTF_16LE);
+    rb_register_transcoder(&rb_to_UTF_16LE);
+    rb_register_transcoder(&rb_from_UTF_32BE);
+    rb_register_transcoder(&rb_to_UTF_32BE);
+    rb_register_transcoder(&rb_from_UTF_32LE);
+    rb_register_transcoder(&rb_to_UTF_32LE);
+}

Property changes on: enc/trans/utf_16_32.trans
___________________________________________________________________
Name: svn:eol-style
   + LF

Index: enc/trans/korean.trans
===================================================================
--- enc/trans/korean.trans	(revision 0)
+++ enc/trans/korean.trans	(revision 18488)
@@ -0,0 +1,17 @@
+#include "transcode_data.h"
+
+<%
+  require "euckr-tbl"
+  require "cp949-tbl"
+%>
+
+<%= transcode_tblgen "UTF-8", "EUC-KR", [["{00-7f}", :nomap], *UCS_TO_EUCKR_TBL] %>
+<%= transcode_tblgen "EUC-KR", "UTF-8", [["{00-7f}", :nomap], *EUCKR_TO_UCS_TBL] %>
+<%= transcode_tblgen "UTF-8", "CP949", [["{00-7f}", :nomap], *UCS_TO_CP949_TBL] %>
+<%= transcode_tblgen "CP949", "UTF-8", [["{00-7f}", :nomap], *CP949_TO_UCS_TBL] %>
+
+void
+Init_korean(void)
+{
+<%= transcode_register_code %>
+}

Property changes on: enc/trans/korean.trans
___________________________________________________________________
Name: svn:eol-style
   + LF

Index: enc/trans/japanese.trans
===================================================================
--- enc/trans/japanese.trans	(revision 0)
+++ enc/trans/japanese.trans	(revision 18488)
@@ -0,0 +1,24 @@
+#include "transcode_data.h"
+
+<%
+  require 'sjis-tbl'
+  require 'eucjp-tbl'
+%>
+
+<%= transcode_tblgen "Shift_JIS", "UTF-8", [["{00-7f}", :nomap], *SJIS_TO_UCS_TBL] %>
+<%= transcode_tblgen "Windows-31J", "UTF-8", [["{00-7f}", :nomap], *SJIS_TO_UCS_TBL] %>
+
+<%= transcode_tblgen "UTF-8", "Shift_JIS", [["{00-7f}", :nomap], *UCS_TO_SJIS_TBL] %>
+<%= transcode_tblgen "UTF-8", "Windows-31J", [["{00-7f}", :nomap], *UCS_TO_SJIS_TBL] %>
+
+<%= transcode_tblgen "EUC-JP", "UTF-8", [["{00-7f}", :nomap], *EUCJP_TO_UCS_TBL] %>
+<%= transcode_tblgen "CP51932", "UTF-8", [["{00-7f}", :nomap], *EUCJP_TO_UCS_TBL] %>
+
+<%= transcode_tblgen "UTF-8", "EUC-JP", [["{00-7f}", :nomap], *UCS_TO_EUCJP_TBL] %>
+<%= transcode_tblgen "UTF-8", "CP51932", [["{00-7f}", :nomap], *UCS_TO_EUCJP_TBL] %>
+
+void
+Init_japanese(void)
+{
+<%= transcode_register_code %>
+}

Property changes on: enc/trans/japanese.trans
___________________________________________________________________
Name: svn:eol-style
   + LF

Index: enc/depend
===================================================================
--- enc/depend	(revision 18487)
+++ enc/depend	(revision 18488)
@@ -7,9 +7,11 @@
 % atrans = []
 % trans = Dir.open($srcdir+"/trans") {|d|
 %   d.select {|e|
-%     if e.chomp!('.c')
-%       atrans << e if e.chomp!(".erb")
+%     if e.chomp!('.trans')
+%       atrans << e
 %       true
+%     elsif e.chomp!('.c')
+%       true
 %     end
 %   }
 % }
@@ -72,7 +74,7 @@
 $(TRANSOBJS): ruby.h intern.h config.h defines.h missing.h encoding.h oniguruma.h st.h transcode_data.h
 %   end
 %   atrans.each do |e|
-%     src = "#{e}.erb.c"
+%     src = "#{e}.trans"
 %     src = [src, *IO.read(File.join($srcdir, "trans", src)).scan(/^\s*require\s+[\'\"]([^\'\"]*)/).flatten.map{|c|c+".rb"}]
 
 <%=rule_subst % "enc/trans/#{e}.c"%>: <%= src.map {|e| rule_subst % "enc/trans/#{e}"}.join(" ")%> $(srcdir)/tool/transcode-tblgen.rb
Index: tool/build-transcode
===================================================================
--- tool/build-transcode	(revision 18487)
+++ tool/build-transcode	(revision 18488)
@@ -1,15 +1,15 @@
 #!/bin/sh
 
 [ "$1" -a -d "$1" ] && { cd "$1" || exit $?; } && shift
-[ "$#" = 0 ] && set enc/trans/*.erb.c
-for erb; do
-    case "$erb" in
-    *.erb.c)
-	src=`expr "$erb" | sed 's/\.erb\.c$/.c/'`
-	${BASERUBY-ruby} tool/transcode-tblgen.rb -vo "$src" "$erb"
+[ "$#" = 0 ] && set enc/trans/*.trans
+for src; do
+    case "$src" in
+    *.trans)
+        c="`dirname $src`/`basename $src .trans`.c"
+	${BASERUBY-ruby} tool/transcode-tblgen.rb -vo "$c" "$src"
 	;;
     *)
-	echo "$0: don' know how to deal with $erb"
+	echo "$0: don't know how to deal with $src"
 	continue
 	;;
     esac

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]