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

ruby-changes:5225

From: kazu <ko1@a...>
Date: Sat, 31 May 2008 22:15:00 +0900 (JST)
Subject: [ruby-changes:5225] Ruby:r16722 (ruby_1_8): * version.c (ruby_description, ruby_copyright): backported from

kazu	2008-05-31 22:14:50 +0900 (Sat, 31 May 2008)

  New Revision: 16722

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/error.c
    branches/ruby_1_8/version.c
    branches/ruby_1_8/version.h

  Log:
    * version.c (ruby_description, ruby_copyright): backported from
      1.9. bug#19002, [ruby-dev:34883]
    
    * error.c (report_bug): uses ruby_description.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/error.c?r1=16722&r2=16721&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/version.c?r1=16722&r2=16721&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=16722&r2=16721&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/version.h?r1=16722&r2=16721&diff_format=u

Index: ruby_1_8/error.c
===================================================================
--- ruby_1_8/error.c	(revision 16721)
+++ ruby_1_8/error.c	(revision 16722)
@@ -29,8 +29,7 @@
 #define EXIT_SUCCESS 0
 #endif
 
-extern const char ruby_version[], ruby_release_date[], ruby_platform[];
-extern const int ruby_patchlevel;
+extern const char *ruby_description;
 
 int ruby_nerrs;
 
@@ -209,8 +208,7 @@
 	va_init_list(args, fmt);
 	vfprintf(out, fmt, args);
 	va_end(args);
-	fprintf(out, "\nruby %s (%s patchlevel %d) [%s]\n\n",
-		ruby_version, ruby_release_date, ruby_patchlevel, ruby_platform);
+	fprintf(out, "\n%s\n\n", ruby_description);
     }
     abort();
 }
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 16721)
+++ ruby_1_8/ChangeLog	(revision 16722)
@@ -1,3 +1,10 @@
+Sat May 31 22:11:15 2008  Kazuhiro NISHIYAMA  <zn@m...>
+
+	* version.c (ruby_description, ruby_copyright): backported from
+	  1.9. bug#19002, [ruby-dev:34883]
+
+	* error.c (report_bug): uses ruby_description.
+
 Sat May 31 20:56:04 2008  Akinori MUSHA  <knu@i...>
 
 	* array.c (rb_ary_delete_if): should return enumerator if no block
Index: ruby_1_8/version.c
===================================================================
--- ruby_1_8/version.c	(revision 16721)
+++ ruby_1_8/version.c	(revision 16722)
@@ -14,23 +14,44 @@
 #include "version.h"
 #include <stdio.h>
 
+#define PRINT(type) puts(ruby_##type)
+#define MKSTR(type) rb_obj_freeze(rb_str_new(ruby_##type, sizeof(ruby_##type)-1))
+
 const char ruby_version[] = RUBY_VERSION;
 const char ruby_release_date[] = RUBY_RELEASE_DATE;
 const char ruby_platform[] = RUBY_PLATFORM;
 const int ruby_patchlevel = RUBY_PATCHLEVEL;
+const char *ruby_description;
+const char *ruby_copyright;
 
 void
 Init_version()
 {
-    VALUE v = rb_obj_freeze(rb_str_new2(ruby_version));
-    VALUE d = rb_obj_freeze(rb_str_new2(ruby_release_date));
-    VALUE p = rb_obj_freeze(rb_str_new2(ruby_platform));
+    static char description[128];
+    static char copyright[128];
+    VALUE v = MKSTR(version);
+    VALUE d = MKSTR(release_date);
+    VALUE p = MKSTR(platform);
+    VALUE tmp;
 
     rb_define_global_const("RUBY_VERSION", v);
     rb_define_global_const("RUBY_RELEASE_DATE", d);
     rb_define_global_const("RUBY_PLATFORM", p);
     rb_define_global_const("RUBY_PATCHLEVEL", INT2FIX(RUBY_PATCHLEVEL));
 
+    snprintf(description, sizeof(description), "ruby %s (%s %s %d) [%s]",
+             RUBY_VERSION, RUBY_RELEASE_DATE, RUBY_RELEASE_STR,
+             RUBY_RELEASE_NUM, RUBY_PLATFORM);
+    ruby_description = description;
+    tmp = rb_obj_freeze(rb_str_new2(description));
+    rb_define_global_const("RUBY_DESCRIPTION", tmp);
+
+    snprintf(copyright, sizeof(copyright), "ruby - Copyright (C) %d-%d %s",
+             RUBY_BIRTH_YEAR, RUBY_RELEASE_YEAR, RUBY_AUTHOR);
+    ruby_copyright = copyright;
+    tmp = rb_obj_freeze(rb_str_new2(copyright));
+    rb_define_global_const("RUBY_COPYRIGHT", tmp);
+
     /* obsolete constants */
     rb_define_global_const("VERSION", v);
     rb_define_global_const("RELEASE_DATE", d);
@@ -40,13 +61,13 @@
 void
 ruby_show_version()
 {
-    printf("ruby %s (%s patchlevel %d) [%s]\n", RUBY_VERSION, RUBY_RELEASE_DATE, RUBY_PATCHLEVEL, RUBY_PLATFORM);
+    PRINT(description);
     fflush(stdout);
 }
 
 void
 ruby_show_copyright()
 {
-    printf("ruby - Copyright (C) 1993-%d Yukihiro Matsumoto\n", RUBY_RELEASE_YEAR);
+    PRINT(copyright);
     exit(0);
 }
Index: ruby_1_8/version.h
===================================================================
--- ruby_1_8/version.h	(revision 16721)
+++ ruby_1_8/version.h	(revision 16722)
@@ -16,4 +16,14 @@
 RUBY_EXTERN const char ruby_release_date[];
 RUBY_EXTERN const char ruby_platform[];
 RUBY_EXTERN const int ruby_patchlevel;
+RUBY_EXTERN const char *ruby_description;
+RUBY_EXTERN const char *ruby_copyright;
 #endif
+
+#define RUBY_AUTHOR "Yukihiro Matsumoto"
+#define RUBY_BIRTH_YEAR 1993
+#define RUBY_BIRTH_MONTH 2
+#define RUBY_BIRTH_DAY 24
+
+#define RUBY_RELEASE_STR "patchlevel"
+#define RUBY_RELEASE_NUM RUBY_PATCHLEVEL

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

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