1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Move macros from version.h to version.c

Moved the contents of `ruby_description` and `ruby_copyright` which
are never used in the other places.
This commit is contained in:
Nobuyoshi Nakada 2017-08-30 23:23:38 +09:00
parent 2b967cd4b7
commit 32a0591515
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 26 additions and 31 deletions

View file

@ -20,6 +20,29 @@
#define EXIT_SUCCESS 0
#endif
#ifdef RUBY_REVISION
# if RUBY_PATCHLEVEL == -1
# ifndef RUBY_BRANCH_NAME
# define RUBY_BRANCH_NAME "master"
# endif
# define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "RUBY_REVISION
# else
# define RUBY_REVISION_STR " revision "RUBY_REVISION
# endif
#else
# define RUBY_REVISION "HEAD"
# define RUBY_REVISION_STR ""
#endif
#if !defined RUBY_RELEASE_DATETIME || RUBY_PATCHLEVEL != -1
# undef RUBY_RELEASE_DATETIME
# define RUBY_RELEASE_DATETIME RUBY_RELEASE_DATE
#endif
# define RUBY_DESCRIPTION_WITH(opt) \
"ruby " RUBY_VERSION RUBY_PATCHLEVEL_STR " " \
"(" RUBY_RELEASE_DATETIME RUBY_REVISION_STR ")" opt " " \
"[" RUBY_PLATFORM "]"
#define PRINT(type) puts(ruby_##type)
#define MKSTR(type) rb_obj_freeze(rb_usascii_str_new_static(ruby_##type, sizeof(ruby_##type)-1))
#define MKINT(name) INT2FIX(ruby_##name)
@ -44,7 +67,9 @@ const int ruby_patchlevel = RUBY_PATCHLEVEL;
const char ruby_description[] = RUBY_DESCRIPTION_WITH("");
static const char ruby_description_with_mjit[] = RUBY_DESCRIPTION_WITH(" +MJIT");
static const char ruby_description_with_yjit[] = RUBY_DESCRIPTION_WITH(" +YJIT");
const char ruby_copyright[] = RUBY_COPYRIGHT;
const char ruby_copyright[] = "ruby - Copyright (C) "
RUBY_BIRTH_YEAR_STR "-" RUBY_RELEASE_YEAR_STR " "
RUBY_AUTHOR;
const char ruby_engine[] = "ruby";
// Might change after initialization

View file

@ -65,34 +65,4 @@
# include "revision.h"
#endif
#ifdef RUBY_REVISION
# if RUBY_PATCHLEVEL == -1
# ifndef RUBY_BRANCH_NAME
# define RUBY_BRANCH_NAME "master"
# endif
# define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "RUBY_REVISION
# else
# define RUBY_REVISION_STR " revision "RUBY_REVISION
# endif
#else
# define RUBY_REVISION "HEAD"
# define RUBY_REVISION_STR ""
#endif
#if !defined RUBY_RELEASE_DATETIME || RUBY_PATCHLEVEL != -1
# undef RUBY_RELEASE_DATETIME
# define RUBY_RELEASE_DATETIME RUBY_RELEASE_DATE
#endif
# define RUBY_DESCRIPTION_WITH(opt) \
"ruby "RUBY_VERSION \
RUBY_PATCHLEVEL_STR \
" ("RUBY_RELEASE_DATETIME \
RUBY_REVISION_STR")"opt" " \
"["RUBY_PLATFORM"]"
# define RUBY_COPYRIGHT \
"ruby - Copyright (C) " \
RUBY_BIRTH_YEAR_STR"-" \
RUBY_RELEASE_YEAR_STR" " \
RUBY_AUTHOR
#endif /* RUBY_TOPLEVEL_VERSION_H */