Browse files

Merge from ruby_1_8.

git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@16723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent ada0022 commit 10b9e130510aee1d5da85c0c4481fe6f7fd694a6 @knu knu committed May 31, 2008
Showing with 45 additions and 9 deletions.
  1. +7 −0 ChangeLog
  2. +2 −4 error.c
  3. +26 −5 version.c
  4. +10 −0 version.h
View
7 ChangeLog
@@ -1,3 +1,10 @@
+Sat May 31 22:11:15 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * 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@iDaemons.org>
* array.c (rb_ary_delete_if): should return enumerator if no block
View
6 error.c
@@ -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 @@ rb_bug(fmt, va_alist)
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();
}
View
31 version.c
@@ -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 @@ Init_version()
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);
}
View
10 version.h
@@ -16,4 +16,14 @@ RUBY_EXTERN const char ruby_version[];
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

0 comments on commit 10b9e13

Please sign in to comment.