12#include "internal/cmdlineopt.h"
25# if RUBY_PATCHLEVEL == -1
26# ifndef RUBY_BRANCH_NAME
27# define RUBY_BRANCH_NAME "master"
29# define RUBY_REVISION_STR " "RUBY_BRANCH_NAME" "RUBY_REVISION
31# define RUBY_REVISION_STR " revision "RUBY_REVISION
34# define RUBY_REVISION "HEAD"
35# define RUBY_REVISION_STR ""
37#if !defined RUBY_RELEASE_DATETIME || RUBY_PATCHLEVEL != -1
38# undef RUBY_RELEASE_DATETIME
39# define RUBY_RELEASE_DATETIME RUBY_RELEASE_DATE
42#define PRINT(type) puts(ruby_##type)
43#define MKSTR(type) rb_obj_freeze(rb_usascii_str_new_static(ruby_##type, sizeof(ruby_##type)-1))
44#define MKINT(name) INT2FIX(ruby_##name)
52 STRINGIZE(RUBY_VERSION_MAJOR) "." \
53 STRINGIZE(RUBY_VERSION_MINOR) "." \
54 STRINGIZE(RUBY_VERSION_TEENY) ""
55#ifndef RUBY_FULL_REVISION
56# define RUBY_FULL_REVISION RUBY_REVISION
59#define YJIT_DESCRIPTION " +YJIT " STRINGIZE(YJIT_SUPPORT)
61#define YJIT_DESCRIPTION " +YJIT"
64const char ruby_revision[] = RUBY_FULL_REVISION;
69 "ruby " RUBY_VERSION RUBY_PATCHLEVEL_STR
" "
70 "(" RUBY_RELEASE_DATETIME RUBY_REVISION_STR
") "
71 "[" RUBY_PLATFORM
"]";
72static const int ruby_description_opt_point =
76 RUBY_BIRTH_YEAR_STR
"-" RUBY_RELEASE_YEAR_STR
" "
88 VALUE version = MKSTR(version);
89 VALUE ruby_engine_name = MKSTR(engine);
131#define RJIT_OPTS_ON opt->rjit.on
133#define RJIT_OPTS_ON 0
137#define YJIT_OPTS_ON opt->yjit
139#define YJIT_OPTS_ON 0
142int ruby_mn_threads_enabled;
144bool * rb_ruby_prism_ptr(
void);
147define_ruby_description(
const char *
const jit_opt)
156 const char *
const threads_opt = ruby_mn_threads_enabled ?
" +MN" :
"";
157 const char *
const parser_opt = (*rb_ruby_prism_ptr()) ?
" +PRISM" :
"";
159 int n = snprintf(desc,
sizeof(desc),
172 rb_dynamic_description = desc;
181Init_ruby_description(ruby_cmdline_options_t *opt)
183 const char *
const jit_opt =
184 RJIT_OPTS_ON ?
" +RJIT" :
185 YJIT_OPTS_ON ? YJIT_DESCRIPTION :
187 define_ruby_description(jit_opt);
191ruby_set_yjit_description(
void)
194 define_ruby_description(YJIT_DESCRIPTION);
200 puts(rb_dynamic_description);
202#ifdef RUBY_LAST_COMMIT_TITLE
203 fputs(
"last_commit=" RUBY_LAST_COMMIT_TITLE, stdout);
205#ifdef HAVE_MALLOC_CONF
206 if (malloc_conf) printf(
"malloc_conf=%s\n", malloc_conf);
void ruby_set_script_name(VALUE name)
Identical to ruby_script(), except it takes the name as a Ruby String instance.
void ruby_show_copyright(void)
Prints the copyright notice of the CRuby interpreter to stdout.
void ruby_show_version(void)
Prints the version information of the CRuby interpreter to stdout.
void rb_provide(const char *feature)
Declares that the given feature is already provided by someone else.
#define rb_strlen_lit(str)
Length of a string literal.
VALUE rb_usascii_str_new_static(const char *ptr, long len)
Identical to rb_str_new_static(), except it generates a string of "US ASCII" encoding instead of "bin...
VALUE rb_const_remove(VALUE space, ID name)
Identical to rb_mod_remove_const(), except it takes the name as ID instead of VALUE.
void rb_define_global_const(const char *name, VALUE val)
Identical to rb_define_const(), except it defines that of "global", i.e.
const int ruby_api_version[3]
API versions, in { major, minor, teeny } order.
const char ruby_engine[]
This is just "ruby" for us.
#define RUBY_API_VERSION_TEENY
Teeny version.
const char ruby_platform[]
Target platform identifier, in a C string.
const char ruby_version[]
Stringised version.
#define RUBY_API_VERSION_MAJOR
Major version.
#define RUBY_API_VERSION_MINOR
Minor version.
#define RUBY_AUTHOR
Author of this project.
const char ruby_copyright[]
Copyright notice.
const char ruby_release_date[]
Date of release, in a C string.
const int ruby_patchlevel
This is a monotonic increasing integer that describes specific "patch" level.
const char ruby_description[]
This is what ruby -v prints to the standard error.
uintptr_t VALUE
Type that represents a Ruby object.