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

ruby-changes:2578

From: ko1@a...
Date: 1 Dec 2007 23:06:12 +0900
Subject: [ruby-changes:2578] matz - Ruby:r14069 (trunk): * encoding.c: rename primary_encoding -> default_external (encoding).

matz	2007-12-01 23:05:53 +0900 (Sat, 01 Dec 2007)

  New Revision: 14069

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c
    trunk/include/ruby/encoding.h
    trunk/parse.y
    trunk/ruby.c

  Log:
    * encoding.c: rename primary_encoding -> default_external (encoding).

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ruby.c?r1=14069&r2=14068
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/parse.y?r1=14069&r2=14068
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14069&r2=14068
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/include/ruby/encoding.h?r1=14069&r2=14068
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/encoding.c?r1=14069&r2=14068

Index: encoding.c
===================================================================
--- encoding.c	(revision 14068)
+++ encoding.c	(revision 14069)
@@ -586,10 +586,8 @@
     return enc_find(klass, str);
 }
 
-static int primary_encoding_index;
-
 rb_encoding *
-rb_enc_default(void)
+rb_default_encoding(void)
 {
     if (!enc_table) {
 	rb_enc_init();
@@ -597,28 +595,30 @@
     return enc_table[0].enc;
 }
 
+static int default_external_index;
+
 rb_encoding *
-rb_enc_primary(void)
+rb_default_external_encoding(void)
 {
-    return rb_enc_from_index(primary_encoding_index);
+    return rb_enc_from_index(default_external_index);
 }
 
 VALUE
-rb_get_primary_encoding(void)
+rb_enc_default_external(void)
 {
-    return rb_enc_from_encoding(rb_enc_primary());
+    return rb_enc_from_encoding(rb_default_external_encoding());
 }
 
 static VALUE
-get_primary_encoding(VALUE klass)
+get_default_external(VALUE klass)
 {
-    return rb_get_primary_encoding();
+    return rb_enc_default_external();
 }
 
 void
-rb_set_primary_encoding(VALUE encoding)
+rb_enc_set_default_external(VALUE encoding)
 {
-    primary_encoding_index = rb_enc_to_index(rb_to_encoding(encoding));
+    default_external_index = rb_enc_to_index(rb_to_encoding(encoding));
 }
 
 static void
@@ -689,7 +689,7 @@
     rb_define_method(rb_cEncoding, "_dump", enc_dump, -1);
     rb_define_singleton_method(rb_cEncoding, "_load", enc_load, 1);
 
-    rb_define_singleton_method(rb_cEncoding, "primary_encoding", get_primary_encoding, 0);
+    rb_define_singleton_method(rb_cEncoding, "default_external", get_default_external, 0);
 
     /* should be imported from Oniguruma */
     rb_enc_replicate("ISO-8859-1", rb_enc_find(rb_enc_name(ONIG_ENCODING_ASCII)));
Index: include/ruby/encoding.h
===================================================================
--- include/ruby/encoding.h	(revision 14068)
+++ include/ruby/encoding.h	(revision 14069)
@@ -103,9 +103,9 @@
 int rb_enc_str_asciionly_p(VALUE);
 #define rb_enc_str_asciicompat_p(str) rb_enc_asciicompat(rb_enc_get(str))
 VALUE rb_enc_from_encoding(rb_encoding *enc);
-rb_encoding *rb_enc_primary(void);
-rb_encoding *rb_enc_default(void);
-VALUE rb_get_primary_encoding(void);
-void rb_set_primary_encoding(VALUE encoding);
+rb_encoding *rb_default_encoding(void);
+rb_encoding *rb_default_external_encoding(void);
+VALUE rb_enc_default_external(void);
+void rb_enc_set_default_external(VALUE encoding);
 
 #endif /* RUBY_ENCODING_H */
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14068)
+++ ChangeLog	(revision 14069)
@@ -1,3 +1,7 @@
+Sat Dec  1 23:04:42 2007  Yukihiro Matsumoto  <matz@r...>
+
+	* encoding.c: rename primary_encoding -> default_external (encoding).
+
 Sat Dec  1 19:52:57 2007  Tadayoshi Funaba  <tadf@d...>
 
 	* lib/date.rb (Time#to_datetime): use nsec instead of usec.
Index: parse.y
===================================================================
--- parse.y	(revision 14068)
+++ parse.y	(revision 14069)
@@ -4847,7 +4847,7 @@
      * instead.
      */
     if ((coderange == ENC_CODERANGE_7BIT) && rb_enc_asciicompat(enc))
-	enc = rb_enc_default();
+	enc = rb_default_encoding();
 
     return parser_str_new(p, n, enc, coderange);
 }
Index: ruby.c
===================================================================
--- ruby.c	(revision 14068)
+++ ruby.c	(revision 14069)
@@ -163,7 +163,7 @@
 	enc = rb_enc_from_index(idx);
 	if (enc) return enc;
     }
-    return rb_enc_default();
+    return rb_default_encoding();
 }
 
 extern VALUE rb_load_path;
@@ -1033,7 +1033,7 @@
     else {
 	enc = locale_encoding();
     }
-    rb_set_primary_encoding(rb_enc_from_encoding(enc));
+    rb_enc_set_default_external(rb_enc_from_encoding(enc));
 
     return (VALUE)tree;
 }

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

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