version.c


DEFINITIONS

This source file includes following functions.
  1. Init_version
  2. ruby_show_version
  3. ruby_show_copyright


   1  /**********************************************************************
   2  
   3    version.c -
   4  
   5    $Author: matz $
   6    $Date: 2002/01/11 09:18:50 $
   7    created at: Thu Sep 30 20:08:01 JST 1993
   8  
   9    Copyright (C) 1993-2002 Yukihiro Matsumoto
  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      /* obsolete constants */
  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  }