Skip to content
This repository
Newer
Older
100644 59 lines (49 sloc) 1.796 kb
511dc44a » Laurent Sansonetti
2008-02-25 initial import
1 /**********************************************************************
2
3 version.c -
4
eee9d7b4 » Laurent Sansonetti
2008-05-18 sync with ruby trunk r15665
5 $Author: nobu $
511dc44a » Laurent Sansonetti
2008-02-25 initial import
6 created at: Thu Sep 30 20:08:01 JST 1993
7
8 Copyright (C) 1993-2007 Yukihiro Matsumoto
9
10 **********************************************************************/
11
12 #include "ruby/ruby.h"
13 #include "version.h"
30a73adf » Laurent Sansonetti
2008-12-03 fix for #173 (patch contributed by Vincent Isambart)
14 #include "revision.h"
511dc44a » Laurent Sansonetti
2008-02-25 initial import
15 #include <stdio.h>
16
17 #define PRINT(type) puts(ruby_##type)
eee9d7b4 » Laurent Sansonetti
2008-05-18 sync with ruby trunk r15665
18 #define MKSTR(type) rb_obj_freeze(rb_usascii_str_new(ruby_##type, sizeof(ruby_##type)-1))
511dc44a » Laurent Sansonetti
2008-02-25 initial import
19
20 const int ruby_version_code = RUBY_VERSION_CODE;
21 const char ruby_version[] = RUBY_VERSION;
22 const char ruby_release_date[] = RUBY_RELEASE_DATE;
23 const char ruby_platform[] = RUBY_PLATFORM;
24 const int ruby_patchlevel = RUBY_PATCHLEVEL;
25 const char ruby_description[] = RUBY_DESCRIPTION;
26 const char ruby_copyright[] = RUBY_COPYRIGHT;
4a2b903a » Laurent Sansonetti
2008-08-21 merging lrz_unstable branch
27 const char ruby_engine[] = RUBY_ENGINE;
511dc44a » Laurent Sansonetti
2008-02-25 initial import
28
29 void
30 Init_version(void)
31 {
32 rb_define_global_const("RUBY_VERSION", MKSTR(version));
33 rb_define_global_const("RUBY_RELEASE_DATE", MKSTR(release_date));
34 rb_define_global_const("RUBY_PLATFORM", MKSTR(platform));
35 rb_define_global_const("RUBY_PATCHLEVEL", INT2FIX(RUBY_PATCHLEVEL));
36 rb_define_global_const("RUBY_REVISION", INT2FIX(RUBY_REVISION));
37 rb_define_global_const("RUBY_DESCRIPTION", MKSTR(description));
38 rb_define_global_const("RUBY_COPYRIGHT", MKSTR(copyright));
4a2b903a » Laurent Sansonetti
2008-08-21 merging lrz_unstable branch
39 rb_define_global_const("RUBY_ENGINE", MKSTR(engine));
26d85942 » Laurent Sansonetti
2008-03-11 framework/universal build work, still in progress
40 #if WITH_OBJC
6bcd45f1 » Laurent Sansonetti
2008-10-26 merging macruby64 branch into trunk
41 rb_define_global_const("RUBY_ARCH", rb_str_new2(RUBY_ARCH));
941c1e42 » Laurent Sansonetti
2009-10-19 MACRUBY_VERSION is now a string
42 rb_define_global_const("MACRUBY_VERSION", rb_str_new2(MACRUBY_VERSION));
30a73adf » Laurent Sansonetti
2008-12-03 fix for #173 (patch contributed by Vincent Isambart)
43 rb_define_global_const("MACRUBY_REVISION", rb_str_new2(MACRUBY_REVISION));
26d85942 » Laurent Sansonetti
2008-03-11 framework/universal build work, still in progress
44 #endif
511dc44a » Laurent Sansonetti
2008-02-25 initial import
45 }
46
47 void
48 ruby_show_version(void)
49 {
50 PRINT(description);
51 fflush(stdout);
52 }
53
54 void
55 ruby_show_copyright(void)
56 {
57 PRINT(copyright);
58 exit(0);
59 }
Something went wrong with that request. Please try again.