Skip to content
Newer
Older
100644 106 lines (94 sloc) 2.9 KB
fedf489 2000-05-01
matz authored
1 /**********************************************************************
3db12e8 Initial revision
matz authored
2
3 version.c -
4
5 $Author$
6 created at: Thu Sep 30 20:08:01 JST 1993
7
a25fbe3 * encoding.c: provide basic features for M17N.
matz authored
8 Copyright (C) 1993-2007 Yukihiro Matsumoto
3db12e8 Initial revision
matz authored
9
fedf489 2000-05-01
matz authored
10 **********************************************************************/
3db12e8 Initial revision
matz authored
11
2b59258 @nobu * include/ruby: moved public headers.
nobu authored
12 #include "ruby/ruby.h"
3db12e8 Initial revision
matz authored
13 #include "version.h"
14 #include <stdio.h>
15
6de07f1 @nobu version.c: EXIT_SUCCESS
nobu authored
16 #ifndef EXIT_SUCCESS
17 #define EXIT_SUCCESS 0
18 #endif
19
aefc34a @nobu * common.mk (encs, ext/ripper/ripper.c): needs MFLAGS.
nobu authored
20 #define PRINT(type) puts(ruby_##type)
d3bce79 @nobu version.c: use str_new_static
nobu authored
21 #define MKSTR(type) rb_obj_freeze(rb_usascii_str_new_static(ruby_##type, sizeof(ruby_##type)-1))
8ab36f0 @nobu fake.rb.in: scan version.c
nobu authored
22 #define MKINT(name) INT2FIX(ruby_##name)
aefc34a @nobu * common.mk (encs, ext/ripper/ripper.c): needs MFLAGS.
nobu authored
23
89339af @nobu * include/ruby/version.h (RUBY_API_VERSION_*): renamed and moved
nobu authored
24 const int ruby_api_version[] = {
25 RUBY_API_VERSION_MAJOR,
26 RUBY_API_VERSION_MINOR,
27 RUBY_API_VERSION_TEENY,
28 };
ec37ab2 @nobu * version.c (ruby_show_copyright): obtain copyright year from
nobu authored
29 const char ruby_version[] = RUBY_VERSION;
30 const char ruby_release_date[] = RUBY_RELEASE_DATE;
31 const char ruby_platform[] = RUBY_PLATFORM;
b9d64f4 @shyouhei Sun Nov 26 16:36:46 2006 URABE Shyouhei <shyouhei@ruby-lang.org>
shyouhei authored
32 const int ruby_patchlevel = RUBY_PATCHLEVEL;
aefc34a @nobu * common.mk (encs, ext/ripper/ripper.c): needs MFLAGS.
nobu authored
33 const char ruby_description[] = RUBY_DESCRIPTION;
34 const char ruby_copyright[] = RUBY_COPYRIGHT;
f677aae * version.c (Init_version): add RUBY_ENGINE constant.
matz authored
35 const char ruby_engine[] = "ruby";
f4e9d9a @nobu * configure.in (RUBY_LIB_VERSION): added for library version, to
nobu authored
36
f8601bd @yugui * eval.c: Add doxygen comments.
yugui authored
37 /*! Defines platform-depended Ruby-level constants */
3db12e8 Initial revision
matz authored
38 void
dda5dc0 * array.c: moved to ANSI function style from K&R function style.
ocean authored
39 Init_version(void)
3db12e8 Initial revision
matz authored
40 {
8ab36f0 @nobu fake.rb.in: scan version.c
nobu authored
41 enum {ruby_patchlevel = RUBY_PATCHLEVEL};
42 enum {ruby_revision = RUBY_REVISION};
c563437 @nobu fake.rb.in: accurate fake
nobu authored
43 VALUE version;
fc0c2d1 @nobu version.c: remove ruby_engine_name
nobu authored
44 VALUE ruby_engine_name;
9263019 @drbrain * math.c: Attach documentation for Math.
drbrain authored
45 /*
46 * The running version of ruby
47 */
c563437 @nobu fake.rb.in: accurate fake
nobu authored
48 rb_define_global_const("RUBY_VERSION", (version = MKSTR(version)));
9263019 @drbrain * math.c: Attach documentation for Math.
drbrain authored
49 /*
50 * The date this ruby was released
51 */
aefc34a @nobu * common.mk (encs, ext/ripper/ripper.c): needs MFLAGS.
nobu authored
52 rb_define_global_const("RUBY_RELEASE_DATE", MKSTR(release_date));
9263019 @drbrain * math.c: Attach documentation for Math.
drbrain authored
53 /*
54 * The platform for this ruby
55 */
aefc34a @nobu * common.mk (encs, ext/ripper/ripper.c): needs MFLAGS.
nobu authored
56 rb_define_global_const("RUBY_PLATFORM", MKSTR(platform));
9263019 @drbrain * math.c: Attach documentation for Math.
drbrain authored
57 /*
58 * The patchlevel for this ruby. If this is a development build of ruby
59 * the patchlevel will be -1
60 */
8ab36f0 @nobu fake.rb.in: scan version.c
nobu authored
61 rb_define_global_const("RUBY_PATCHLEVEL", MKINT(patchlevel));
9263019 @drbrain * math.c: Attach documentation for Math.
drbrain authored
62 /*
63 * The SVN revision for this ruby.
64 */
8ab36f0 @nobu fake.rb.in: scan version.c
nobu authored
65 rb_define_global_const("RUBY_REVISION", MKINT(revision));
9263019 @drbrain * math.c: Attach documentation for Math.
drbrain authored
66 /*
67 * The full ruby version string, like <tt>ruby -v</tt> prints'
68 */
aefc34a @nobu * common.mk (encs, ext/ripper/ripper.c): needs MFLAGS.
nobu authored
69 rb_define_global_const("RUBY_DESCRIPTION", MKSTR(description));
9263019 @drbrain * math.c: Attach documentation for Math.
drbrain authored
70 /*
71 * The copyright string for ruby
72 */
aefc34a @nobu * common.mk (encs, ext/ripper/ripper.c): needs MFLAGS.
nobu authored
73 rb_define_global_const("RUBY_COPYRIGHT", MKSTR(copyright));
9263019 @drbrain * math.c: Attach documentation for Math.
drbrain authored
74 /*
75 * The engine or interpreter this ruby uses.
76 */
584829a @nobu * vm.c (vm_backtrace_each): get rid of use of malloc from signal
nobu authored
77 rb_define_global_const("RUBY_ENGINE", ruby_engine_name = MKSTR(engine));
fc0c2d1 @nobu version.c: remove ruby_engine_name
nobu authored
78 ruby_set_script_name(ruby_engine_name);
119960d @nobu version.c: support RUBY_ENGINE_VERSION
nobu authored
79 /*
80 * The version of the engine or interpreter this ruby uses.
81 */
c563437 @nobu fake.rb.in: accurate fake
nobu authored
82 rb_define_global_const("RUBY_ENGINE_VERSION", (1 ? version : MKSTR(version)));
3db12e8 Initial revision
matz authored
83 }
84
f8601bd @yugui * eval.c: Add doxygen comments.
yugui authored
85 /*! Prints the version information of the CRuby interpreter to stdout. */
3db12e8 Initial revision
matz authored
86 void
dda5dc0 * array.c: moved to ANSI function style from K&R function style.
ocean authored
87 ruby_show_version(void)
3db12e8 Initial revision
matz authored
88 {
aefc34a @nobu * common.mk (encs, ext/ripper/ripper.c): needs MFLAGS.
nobu authored
89 PRINT(description);
a8e2893 @nobu version.c: last commit title
nobu authored
90 #ifdef RUBY_LAST_COMMIT_TITLE
91 fputs("last_commit=" RUBY_LAST_COMMIT_TITLE, stdout);
92 #endif
a4d7e42 @nobu version.c: show malloc_conf
nobu authored
93 #ifdef HAVE_MALLOC_CONF
94 if (malloc_conf) printf("malloc_conf=%s\n", malloc_conf);
95 #endif
42de5af @nobu * version.c (ruby_show_version): flush for non-tty stdout.
nobu authored
96 fflush(stdout);
3db12e8 Initial revision
matz authored
97 }
98
7aab062 @nobu version.c: no exit in ruby_show_copyright
nobu authored
99 /*! Prints the copyright notice of the CRuby interpreter to stdout. */
3db12e8 Initial revision
matz authored
100 void
dda5dc0 * array.c: moved to ANSI function style from K&R function style.
ocean authored
101 ruby_show_copyright(void)
3db12e8 Initial revision
matz authored
102 {
aefc34a @nobu * common.mk (encs, ext/ripper/ripper.c): needs MFLAGS.
nobu authored
103 PRINT(copyright);
7aab062 @nobu version.c: no exit in ruby_show_copyright
nobu authored
104 fflush(stdout);
3db12e8 Initial revision
matz authored
105 }
Something went wrong with that request. Please try again.