Commit dadf06f7 authored by MATSUMOTO Ryosuke's avatar MATSUMOTO Ryosuke

Add global constant MRUBY_COPYRIGHT

parent 456a765e
......@@ -8,6 +8,7 @@ mrb_mruby_version_gem_init(mrb_state* mrb)
mrb_define_global_const(mrb, "MRUBY_VERSION", mrb_str_new_cstr(mrb, MRUBY_VERSION));
mrb_define_global_const(mrb, "MRUBY_RELEASE_DATE", mrb_str_new_cstr(mrb, MRUBY_RELEASE_DATE));
mrb_define_global_const(mrb, "MRUBY_DESCRIPTION", mrb_str_new_cstr(mrb, MRUBY_DESCRIPTION));
mrb_define_global_const(mrb, "MRUBY_COPYRIGHT", mrb_str_new_cstr(mrb, MRUBY_COPYRIGHT));
}
void
......
......@@ -7,6 +7,19 @@
#define MRUBY_RELEASE_MONTH 1
#define MRUBY_RELEASE_DAY 10
#define MRUBY_DESCRIPTION \
"mruby "MRUBY_VERSION \
#define MRUBY_BIRTH_YEAR 2011
#define MRUBY_AUTHOR "mruby developers"
#define STRINGIZE0(expr) #expr
#define STRINGIZE(expr) STRINGIZE0(expr)
#define MRUBY_DESCRIPTION \
"mruby "MRUBY_VERSION \
" ("MRUBY_RELEASE_DATE") "
#define MRUBY_COPYRIGHT \
"mruby - Copyright (c) " \
STRINGIZE(MRUBY_BIRTH_YEAR)"-" \
STRINGIZE(MRUBY_RELEASE_YEAR)" " \
MRUBY_AUTHOR
......@@ -73,6 +73,12 @@ mrb_show_copyright(mrb_state *mrb)
static const char copyright_msg[] = "mruby - Copyright (c) 2010-2014 mruby developers\n";
mrb_value msg;
msg = mrb_str_new(mrb, copyright_msg, sizeof(copyright_msg) - 1);
if (mrb_const_defined(mrb, mrb_obj_value(mrb->object_class), mrb_intern_lit(mrb, "MRUBY_COPYRIGHT"))) {
msg = mrb_const_get(mrb, mrb_obj_value(mrb->object_class), mrb_intern_lit(mrb, "MRUBY_COPYRIGHT"));
msg = mrb_funcall(mrb, msg, "+", 1, mrb_str_new_cstr(mrb, "\n"));
}
else {
msg = mrb_str_new(mrb, copyright_msg, sizeof(copyright_msg) - 1);
}
printstr(mrb, msg);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment