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

ruby-changes:11703

From: naruse <ko1@a...>
Date: Tue, 5 May 2009 09:05:28 +0900 (JST)
Subject: [ruby-changes:11703] Ruby:r23344 (trunk): Fix: DON'T move in_p because before in_p is replaced by buffered data.

naruse	2009-05-05 09:05:11 +0900 (Tue, 05 May 2009)

  New Revision: 23344

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

  Log:
    Fix: DON'T move in_p because before in_p is replaced by buffered data.
    * transcode.c: NOMAP is now multibyte direct map.
    
    * transcode.c: remove ASIS.
    
    * transcode_data.h: ditto.
    
    * tool/transcode-tb (ActionMap#generate_info): remove :asis.
    
    * tool/transcode-tb (ActionMap#generate_info): add :nomap0.
    
    * enc/trans/utf8_mac.trans: replace :asis by :nomap0.

  Modified files:
    trunk/ChangeLog
    trunk/enc/trans/utf8_mac.trans
    trunk/tool/transcode-tblgen.rb
    trunk/transcode.c
    trunk/transcode_data.h

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23343)
+++ ChangeLog	(revision 23344)
@@ -1,3 +1,17 @@
+Tue May  5 07:22:37 2009  NARUSE, Yui  <naruse@r...>
+
+	* transcode.c: NOMAP is now multibyte direct map.
+
+	* transcode.c: remove ASIS.
+
+	* transcode_data.h: ditto.
+
+	* tool/transcode-tb (ActionMap#generate_info): remove :asis.
+
+	* tool/transcode-tb (ActionMap#generate_info): add :nomap0.
+
+	* enc/trans/utf8_mac.trans: replace :asis by :nomap0.
+
 Sat May  2 22:53:02 2009  Akinori MUSHA  <knu@i...>
 
 	* lib/set.rb (SortedSet): Fix document. [Bug #1429]
Index: enc/trans/utf8_mac.trans
===================================================================
--- enc/trans/utf8_mac.trans	(revision 23343)
+++ enc/trans/utf8_mac.trans	(revision 23344)
@@ -6,13 +6,13 @@
   transcode_tblgen("UTF-8", "UTF8-MAC",
     MAC_DECOMPOSE_TBL + [
     ["{00-7F}", :nomap],
-    ["{c2-df}{80-bf}", :asis],
-    ["e0{a0-bf}{80-bf}", :asis],
-    ["{e1-ec}{80-bf}{80-bf}", :asis],
-    ["ed{80-9f}{80-bf}", :asis],
-    ["{ee-ef}{80-bf}{80-bf}", :asis],
-    ["f0{90-bf}{80-bf}{80-bf}", :asis],
-    ["{f1-f3}{80-bf}{80-bf}{80-bf}", :asis],
+    ["{c2-df}{80-bf}", :nomap0],
+    ["e0{a0-bf}{80-bf}", :nomap0],
+    ["{e1-ec}{80-bf}{80-bf}", :nomap0],
+    ["ed{80-9f}{80-bf}", :nomap0],
+    ["{ee-ef}{80-bf}{80-bf}", :nomap0],
+    ["f0{90-bf}{80-bf}{80-bf}", :nomap0],
+    ["{f1-f3}{80-bf}{80-bf}{80-bf}", :nomap0],
   ])
 
   map = {}
Index: transcode_data.h
===================================================================
--- transcode_data.h	(revision 23343)
+++ transcode_data.h	(revision 23344)
@@ -22,7 +22,7 @@
 
 #define PType (unsigned int)
 
-#define NOMAP	(PType 0x01)	/* single byte direct map */
+#define NOMAP	(PType 0x01)	/* direct map */
 #define ONEbt	(0x02)		/* one byte payload */
 #define TWObt	(0x03)		/* two bytes payload */
 #define THREEbt	(0x05)		/* three bytes payload */
@@ -36,7 +36,6 @@
 #define FUNso	(PType 0x0F)	/* function from start to output */
 #define STR1	(PType 0x11)	/* string 4 <= len <= 259 bytes: 1byte length + content */
 #define GB4bt	(PType 0x12)	/* GB18030 four bytes payload */
-#define ASIS	(PType 0x13)	/* multi byte direct map */
 
 #define STR1_LENGTH(byte_addr) (unsigned int)(*(byte_addr) + 4)
 #define STR1_BYTEINDEX(w) ((w) >> 6)
Index: tool/transcode-tblgen.rb
===================================================================
--- tool/transcode-tblgen.rb	(revision 23343)
+++ tool/transcode-tblgen.rb	(revision 23344)
@@ -238,9 +238,9 @@
         ss.each_firstbyte {|byte, rest|
           h[byte] ||= {}
           if h[byte][rest].nil?
-          elsif action == :asis
+          elsif action == :nomap0
             next
-          elsif h[byte][rest] != :asis
+          elsif h[byte][rest] != :nomap0
             raise "ambiguous %s or %s (%02X/%s)" % [h[byte][rest], action, byte, rest]
           end
           h[byte][rest] = action
@@ -317,10 +317,9 @@
 
   def generate_info(info)
     case info
-    when :nomap
+    when :nomap, :nomap0
+      # :nomap0 is low priority.  it never collides.
       "NOMAP"
-    when :asis
-      "ASIS"
     when :undef
       "UNDEF"
     when :invalid
Index: transcode.c
===================================================================
--- transcode.c	(revision 23343)
+++ transcode.c	(revision 23344)
@@ -505,7 +505,6 @@
       case 30: goto resume_label30;
       case 31: goto resume_label31;
       case 32: goto resume_label32;
-      case 33: goto resume_label33;
     }
 
     while (1) {
@@ -541,15 +540,14 @@
       follow_info:
 	switch (next_info & 0x1F) {
 	  case NOMAP:
-	    SUSPEND_OBUF(3); *out_p++ = next_byte;
-	    continue;
-	  case ASIS:
 	    {
-		const unsigned char *p = inchar_start;
-		while (p < in_p) {
-		    SUSPEND_OBUF(33); *out_p++ = (unsigned char)*p++;
+		const unsigned char *pend = in_p;
+		in_p = inchar_start;
+		while (in_p < pend) {
+		    next_byte = (unsigned char)*in_p++;
+		    SUSPEND_OBUF(3); *out_p++ = next_byte;
 		}
-            }
+	    }
 	    continue;
 	  case 0x00: case 0x04: case 0x08: case 0x0C:
 	  case 0x10: case 0x14: case 0x18: case 0x1C:

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

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