version.c
DEFINITIONS
This source file includes following functions.
- Init_version
- ruby_show_version
- ruby_show_copyright
1
2
3
4
5
6
7
8
9
10
11
12
13 #include "ruby.h"
14 #include "version.h"
15 #include <stdio.h>
16
17 void
18 Init_version()
19 {
20 VALUE v = rb_obj_freeze(rb_str_new2(RUBY_VERSION));
21 VALUE d = rb_obj_freeze(rb_str_new2(RUBY_RELEASE_DATE));
22 VALUE p = rb_obj_freeze(rb_str_new2(RUBY_PLATFORM));
23
24 rb_define_global_const("RUBY_VERSION", v);
25 rb_define_global_const("RUBY_RELEASE_DATE", d);
26 rb_define_global_const("RUBY_PLATFORM", p);
27
28
29 rb_define_global_const("VERSION", v);
30 rb_define_global_const("RELEASE_DATE", d);
31 rb_define_global_const("PLATFORM", p);
32 }
33
34 void
35 ruby_show_version()
36 {
37 printf("ruby %s (%s) [%s]\n", RUBY_VERSION, RUBY_RELEASE_DATE, RUBY_PLATFORM);
38 }
39
40 void
41 ruby_show_copyright()
42 {
43 printf("ruby - Copyright (C) 1993-2002 Yukihiro Matsumoto\n");
44 exit(0);
45 }