Version string

e$B!!$5$5$@$G$9!%e(B

ruby --version e$B$G=PNO$5$l$k!$<!$N$h$&$JJ8;zNse(B
e$B!Ve(Bruby 1.9.0 (2007-11-13 patchlevel 0) [i686-linux]e$B!W$re(B Ruby
e$BFb$G4Je(B
e$BC1$K;2>H$9$k$?$a$NJ}K!!JDj?t!)!K$r2C$($k$N$O$I$&$G$7$g$&$+!%e(BML
e$B$KEje(B
e$B9F$9$k$H$-$K;~!9M_$7$/$J$j$^$9!%e(B

e$B!!e(Bplatform
e$B$H$+$bF~$C$F$$$k$N$GHyL/$J5$$b$7$^$9$,!$e(BRUBY_LONG_VERSION
e$B$H$$$&Dj?t$K$9$k$H$+!%e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:32266] version string”
on Tue, 13 Nov 2007 23:00:46 +0900, SASADA Koichi [email protected]
writes:

|ruby --version e$B$G=PNO$5$l$k!$<!$N$h$&$JJ8;zNse(B
|e$B!Ve(Bruby 1.9.0 (2007-11-13 patchlevel 0) [i686-linux]e$B!W$re(B Ruby e$BFb$G4Je(B
|e$BC1$K;2>H$9$k$?$a$NJ}K!!JDj?t!)!K$r2C$($k$N$O$I$&$G$7$g$&$+!%e(BML e$B$KEje(B
|e$B9F$9$k$H$-$K;~!9M_$7$/$J$j$^$9!%e(B
|
|e$B!!e(Bplatform e$B$H$+$bF~$C$F$$$k$N$GHyL/$J5$$b$7$^$9$,!$e(BRUBY_LONG_VERSION
|e$B$H$$$&Dj?t$K$9$k$H$+!%e(B

e$B!V$=$l$O%P!<%8%g%s$G$O$J$$$@$m$&!W$H$$$&5$$b$7$^$9$,!“B>$KNIe(B
e$B$$%”%$%G%#%“$,$J$1$l$P!”$=$NL>A0$GDj?t$rDI2C$9$k$3$H$KH?BP$7e(B
e$B$^$;$s!#e(B

e$B!!$5$5$@$G$9!%e(B

Yukihiro M. wrote:

|e$B!!e(Bplatform e$B$H$+$bF~$C$F$$$k$N$GHyL/$J5$$b$7$^$9$,!$e(BRUBY_LONG_VERSION
|e$B$H$$$&Dj?t$K$9$k$H$+!%e(B

e$B!V$=$l$O%P!<%8%g%s$G$O$J$$$@$m$&!W$H$$$&5$$b$7$^$9$,!“B>$KNIe(B
e$B$$%”%$%G%#%"$,$J$1$l$P!"$=$NL>A0$GDj?t$rDI2C$9$k$3$H$KH?BP$7e(B
e$B$^$;$s!#e(B

Python e$B$@$H!$e(B

import sys
sys.version
‘2.4.4 (#2, Apr 5 2007, 20:11:18) \n[GCC 4.1.2 20061115
(prerelease) (Debian 4.1.1-21)]’

version e$B$G$3$3$^$G<h$l$k$=$&$G$9!%e(B

e$B!!e(B[ruby-dev:31743]
e$B$GCfED$5$s$,Ds0F$7$F$$$k$b$N$K!$$J$K$,$7$+$NL>A0e(B
e$B$GFM$C9~$`$N$,0lHV$$$$$h$&$J5$$O$7$F$$$^$9!%e(B

On Nov 14, 2007 6:30 AM, SASADA Koichi [email protected] wrote:

Python e$B$@$H!$e(B

import sys
sys.version
‘2.4.4 (#2, Apr 5 2007, 20:11:18) \n[GCC 4.1.2 20061115
(prerelease) (Debian 4.1.1-21)]’

version e$B$G$3$3$^$G<h$l$k$=$&$G$9!%e(B

[ruby-dev:31743] e$B$GCfED$5$s$,Ds0F$7$F$$$k$b$N$K!$$J$K$,$7$+$NL>A0e(B
e$B$GFM$C9~$`$N$,0lHV$$$$$h$&$J5$$O$7$F$$$^$9!%e(B

e$B<B:]$K0c$$$^$9$+!)e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:32282] Re: version string”
on Wed, 14 Nov 2007 06:30:35 +0900, SASADA Koichi [email protected]
writes:

|e$B!!e(B[ruby-dev:31743] e$B$GCfED$5$s$,Ds0F$7$F$$$k$b$N$K!$$J$K$,$7$+$NL>A0e(B
|e$B$GFM$C9~$`$N$,0lHV$$$$$h$&$J5$$O$7$F$$$^$9!%e(B

e$B8D?ME*$K$O$“$”$$$&8DJL%%V%8%'%/%H$NF3F~$O$"$^$j9%$_$G$J$$$Ne(B
e$B$G!"e(BRUBY_LONG_VERSIONe$BE
$JJ8;zNs$r<h$j9~$`$3$H$GBE6($G$-$^$;e(B
e$B$s$+!)e(B

e$B$J$+$@$G$9!#e(B

At Wed, 14 Nov 2007 16:20:12 +0900,
Yukihiro M. wrote in [ruby-dev:32288]:

|e$B!!e(B[ruby-dev:31743] e$B$GCfED$5$s$,Ds0F$7$F$$$k$b$N$K!$$J$K$,$7$+$NL>A0e(B
|e$B$GFM$C9~$`$N$,0lHV$$$$$h$&$J5$$O$7$F$$$^$9!%e(B

e$B8D?ME*$K$O$"$"$$$&8DJL%%V%8%’%/%H$NF3F~$O$"$^$j9%$_$G$J$$$Ne(B
e$B$G!"e(BRUBY_LONG_VERSIONe$BE
$JJ8;zNs$r<h$j9~$`$3$H$GBE6($G$-$^$;e(B
e$B$s$+!)e(B

e$B8DJL%*%V%8%’%/%H$H$$$&$N$Oe(BRuby modulee$B$G$9$+e(B?
e$B$?$V$s!"$5$5$@$5$se(B
e$B$N$$$C$F$$$k$N$Oe(BRuby::VersionNumbere$B$N$3$H$G$O$J$$$N$G$O$J$$$+$He(B
e$B;W$&$N$G$9$,!#e(B

e$B$H$j$"$($:$3$s$J$N$O$I$&$G$7$g$&$+!#e(B

Index: include/ruby/defines.h

— include/ruby/defines.h (revision 13945)
+++ include/ruby/defines.h (working copy)
@@ -65,4 +65,9 @@ void xrealloc2(void,size_t,size_t);
void xfree(void*);

+#define STRINGIZE(expr) STRINGIZE0(expr)
+#ifndef STRINGIZE0
+#define STRINGIZE0(expr) #expr
+#endif
+
#if SIZEOF_LONG_LONG > 0

define LONG_LONG long long

Index: version.c

— version.c (revision 13945)
+++ version.c (working copy)
@@ -15,4 +15,7 @@
#include <stdio.h>

+#define PRINT(type) puts(RUBY_##type)
+#define MKSTR(type) rb_str_new(RUBY_##type, sizeof(RUBY_##type)-1)
+
const char ruby_version[] = RUBY_VERSION;
const char ruby_release_date[] = RUBY_RELEASE_DATE;
@@ -23,12 +26,21 @@ void
Init_version(void)
{

  • const char *varname;
    +#define RUBY_CONST(name, val) ( \
  • varname = “RUBY_” #name, \
  • rb_define_const(mRuby, varname + 5, val), \
  • rb_define_global_const(varname, val))
  • VALUE mRuby = rb_define_module(“Ruby”);
    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));
  • 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));
  • RUBY_CONST(VERSION, v);
  • RUBY_CONST(RELEASE_DATE, d);
  • RUBY_CONST(PLATFORM, p);
  • RUBY_CONST(PATCHLEVEL, INT2FIX(RUBY_PATCHLEVEL));
  • RUBY_CONST(DESCRIPTION, MKSTR(DESCRIPTION));
  • RUBY_CONST(COPYRIGHT, MKSTR(COPYRIGHT));
    }

@@ -36,5 +48,5 @@ void
ruby_show_version(void)
{

  • printf(“ruby %s (%s patchlevel %d) [%s]\n”, RUBY_VERSION,
    RUBY_RELEASE_DATE, RUBY_PATCHLEVEL, RUBY_PLATFORM);
  • PRINT(VERSION);
    fflush(stdout);
    }
    @@ -43,5 +55,5 @@ void
    ruby_show_copyright(void)
    {
  • printf(“ruby - Copyright © 1993-%d Yukihiro M.\n”,
    RUBY_RELEASE_YEAR);
  • PRINT(COPYRIGHT);
    exit(0);
    }
    Index: version.h
    ===================================================================
    — version.h (revision 13945)
    +++ version.h (working copy)
    @@ -1,2 +1,4 @@
    +#ifndef RUBY_VERSION

#define RUBY_VERSION “1.9.0”
#define RUBY_RELEASE_DATE “2007-11-16”
@@ -18,2 +20,24 @@ RUBY_EXTERN const char ruby_platform[];
RUBY_EXTERN const int ruby_patchlevel;
#endif
+
+#define RUBY_AUTHOR “Yukihiro M.”
+#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
+
+# define RUBY_DESCRIPTION \

  • "ruby "RUBY_VERSION \
  • " (“RUBY_RELEASE_DATE” " \
  • RUBY_RELEASE_STR" " \
  • STRINGIZE(RUBY_RELEASE_NUM)") " \
  • “[“RUBY_PLATFORM”]”
    +# define RUBY_COPYRIGHT \
  • "ruby - Copyright © " \
  • STRINGIZE(RUBY_BIRTH_YEAR)"-" \
  • STRINGIZE(RUBY_RELEASE_YEAR)" " \
  • RUBY_AUTHOR

+#endif