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

ruby-changes:29686

From: nobu <ko1@a...>
Date: Tue, 2 Jul 2013 17:22:27 +0900 (JST)
Subject: [ruby-changes:29686] nobu:r41738 (trunk): encoding.c: preserved encindex

nobu	2013-07-02 17:22:15 +0900 (Tue, 02 Jul 2013)

  New Revision: 41738

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

  Log:
    encoding.c: preserved encindex
    
    * encoding.c (rb_enc_init): register preserved indexes.
    * internal.h (ruby_preserved_encindex): move from encoding.c.

  Modified files:
    trunk/ChangeLog
    trunk/dmyencoding.c
    trunk/encoding.c
    trunk/internal.h

Index: encoding.c
===================================================================
--- encoding.c	(revision 41737)
+++ encoding.c	(revision 41738)
@@ -519,13 +519,6 @@ rb_encdb_set_unicode(int index) https://github.com/ruby/ruby/blob/trunk/encoding.c#L519
     rb_enc_from_index(index)->flags |= ONIGENC_FLAG_UNICODE;
 }
 
-enum {
-    ENCINDEX_ASCII,
-    ENCINDEX_UTF_8,
-    ENCINDEX_US_ASCII,
-    ENCINDEX_BUILTIN_MAX
-};
-
 extern rb_encoding OnigEncodingUTF_8;
 extern rb_encoding OnigEncodingUS_ASCII;
 
@@ -541,6 +534,10 @@ rb_enc_init(void) https://github.com/ruby/ruby/blob/trunk/encoding.c#L534
     ENC_REGISTER(UTF_8);
     ENC_REGISTER(US_ASCII);
 #undef ENC_REGISTER
+#ifndef NO_PRESERVED_ENCODING
+#define ENCDB_REGISTER(name, enc) enc_register_at(ENCINDEX_##enc, name, NULL)
+#undef ENCDB_REGISTER
+#endif
     enc_table.count = ENCINDEX_BUILTIN_MAX;
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41737)
+++ ChangeLog	(revision 41738)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul  2 17:22:12 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* encoding.c (rb_enc_init): register preserved indexes.
+
+	* internal.h (ruby_preserved_encindex): move from encoding.c.
+
 Tue Jul  2 11:14:36 2013  Shota Fukumori  <sorah@c...>
 
 Tue Jul  2 11:14:36 2013  Shota Fukumori  <sorah@c...>
Index: dmyencoding.c
===================================================================
--- dmyencoding.c	(revision 41737)
+++ dmyencoding.c	(revision 41738)
@@ -1,2 +1,3 @@ https://github.com/ruby/ruby/blob/trunk/dmyencoding.c#L1
 #define NO_LOCALE_CHARMAP 1
+#define NO_PRESERVED_ENCODING 1
 #include "encoding.c"
Index: internal.h
===================================================================
--- internal.h	(revision 41737)
+++ internal.h	(revision 41738)
@@ -196,9 +196,20 @@ PRINTF_ARGS(void ruby_debug_printf(const https://github.com/ruby/ruby/blob/trunk/internal.h#L196
 void Init_ext(void);
 
 /* encoding.c */
-ID rb_id_encoding(void);
+#ifdef RUBY_ENCODING_H
+enum ruby_preserved_encindex {
+    ENCINDEX_ASCII,
+    ENCINDEX_UTF_8,
+    ENCINDEX_US_ASCII,
 
-/* encoding.c */
+#ifndef NO_PRESERVED_ENCODING
+    /* preserved indexes */
+#endif
+
+    ENCINDEX_BUILTIN_MAX
+};
+#endif
+ID rb_id_encoding(void);
 void rb_gc_mark_encodings(void);
 
 /* error.c */

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

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