27# include <AvailabilityMacros.h>
31#include "internal/error.h"
32#include "internal/eval.h"
36#include "internal/symbol.h"
38#include "internal/variable.h"
56#define WIFEXITED(status) 1
60#define WEXITSTATUS(status) (status)
72static VALUE rb_mWarning;
73static VALUE rb_cWarningBuffer;
77static ID id_deprecated;
78static ID id_experimental;
79static VALUE sym_category;
80static VALUE warning_categories;
81static VALUE warning_category_t_map;
88#define defined_error(name, num) if (err == (num)) return (name);
89#define undefined_error(name)
90#include "known_errors.inc"
97err_position_0(
char *
buf,
long len,
const char *
file,
int line)
102 else if (line == 0) {
111err_vcatf(
VALUE str,
const char *pre,
const char *
file,
int line,
112 const char *fmt, va_list args)
131 err_vcatf(mesg,
NULL, fn, line, fmt, args);
143 if (
RSTRING_LEN(mesg) > 0 && *(RSTRING_END(mesg)-1) !=
'\n')
146 err_vcatf(mesg,
NULL, fn, line, fmt, args);
152static unsigned int warning_disabled_categories = (
157rb_warning_category_mask(
VALUE category)
168 if (cat_value ==
Qnil) {
177 warning_disabled_categories &= ~mask;
178 warning_disabled_categories |=
mask & ~bits;
184 return !(warning_disabled_categories & (1U << category));
224 unsigned int mask = rb_warning_category_mask(category);
225 unsigned int disabled = warning_disabled_categories;
230 warning_disabled_categories = disabled;
257 if (!
NIL_P(category)) {
307rb_warning_warn_arity(
void)
316 if (category !=
Qnil) {
323 if (rb_warning_warn_arity() == 1) {
324 return rb_warning_warn(rb_mWarning,
str);
338 rb_warning_warn(rb_mWarning,
str);
342warn_vsprintf(
rb_encoding *enc,
const char *
file,
int line,
const char *fmt, va_list args)
346 err_vcatf(
str,
"warning: ",
file, line, fmt, args);
361 rb_write_warning_str(
str);
376 rb_write_warning_str(
str);
394warning_string(
rb_encoding *enc,
const char *fmt, va_list args)
398 return warn_vsprintf(enc,
file, line, fmt, args);
401#define with_warning_string(mesg, enc, fmt) \
403 va_list args; va_start(args, fmt); \
404 mesg = warning_string(enc, fmt, args); \
412 rb_write_warning_str(mesg);
432 rb_write_warning_str(mesg);
443 rb_write_warning_str(mesg);
469rb_enc_warning(
rb_encoding *enc,
const char *fmt, ...)
473 rb_write_warning_str(mesg);
485 va_start(args, suggest);
486 VALUE mesg = warning_string(0, fmt, args);
490 if (suggest)
rb_str_catf(mesg,
"; use %s instead", suggest);
492 rb_warn_category(mesg,
ID2SYM(id_deprecated));
501 va_start(args, removal);
502 VALUE mesg = warning_string(0, fmt, args);
505 rb_str_catf(mesg,
" is deprecated and will be removed in Ruby %s\n", removal);
506 rb_warn_category(mesg,
ID2SYM(id_deprecated));
532 int argc = RARRAY_LENINT(msgs);
537 if (!
NIL_P(uplevel)) {
543 if (!
NIL_P(location)) {
547 if (
argc > 1 || !
NIL_P(uplevel) || !end_with_asciichar(
str,
'\n')) {
549 if (
NIL_P(uplevel)) {
552 else if (
NIL_P(location) ||
561 RBASIC_SET_CLASS(
str, rb_cWarningBuffer);
566 if (exc == rb_mWarning) {
571 rb_warn_category(
str, category);
577#define MAX_BUG_REPORTERS 0x100
579static struct bug_reporters {
580 void (*func)(
FILE *
out,
void *data);
584static int bug_reporters_size;
589 struct bug_reporters *reporter;
593 reporter = &bug_reporters[bug_reporters_size++];
594 reporter->func = func;
595 reporter->data = data;
601#define REPORT_BUG_BUFSIZ 256
603bug_report_file(
const char *
file,
int line)
609 if ((ssize_t)fwrite(
buf, 1,
len,
out) == (ssize_t)
len ||
610 (ssize_t)fwrite(
buf, 1,
len, (
out = stdout)) == (ssize_t)
len) {
620bug_important_message(
FILE *
out,
const char *
const msg,
size_t len)
622 const char *
const endmsg = msg +
len;
627 static const char red[] =
"\033[;31;1;7m";
628 static const char green[] =
"\033[;32;7m";
629 static const char reset[] =
"\033[m";
630 const char *e =
strchr(p,
'\n');
631 const int w = (
int)(e - p);
633 int i = (
int)(e - p);
634 fputs(*p ==
' ' ? green : red,
out);
635 fwrite(p, 1, e - p,
out);
636 for (; i < w; ++i) fputc(
' ',
out);
639 }
while ((p = e + 1) < endmsg && (e =
strchr(p,
'\n')) != 0 && e > p + 1);
641 fwrite(p, 1, endmsg - p,
out);
648 static const char msg[] =
""
649 "-- Crash Report log information "
650 "--------------------------------------------\n"
651 " See Crash Report log file under the one of following:\n"
652# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
653 " * ~/Library/Logs/CrashReporter\n"
654 " * /Library/Logs/CrashReporter\n"
656 " * ~/Library/Logs/DiagnosticReports\n"
657 " * /Library/Logs/DiagnosticReports\n"
658 " for more details.\n"
659 "Don't forget to include the above Crash Report log file in bug reports.\n"
661 const size_t msglen =
sizeof(msg) - 1;
663 const char *msg =
NULL;
664 const size_t msglen = 0;
666 bug_important_message(
out, msg, msglen);
673 static const char msg[] =
""
676 "\n""Don't forget to include the Crash Report log file under\n"
677# if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
680 "DiagnosticReports directory in bug reports.\n"
683 const size_t msglen =
sizeof(msg) - 1;
685 const char *msg =
NULL;
686 const size_t msglen = 0;
688 bug_important_message(
out, msg, msglen);
692bug_report_begin_valist(
FILE *
out,
const char *fmt, va_list args)
696 fputs(
"[BUG] ",
out);
704#define bug_report_begin(out, fmt) do { \
706 va_start(args, fmt); \
707 bug_report_begin_valist(out, fmt, args); \
717 for (i=0; i<bug_reporters_size; i++) {
718 struct bug_reporters *reporter = &bug_reporters[i];
719 (*reporter->func)(
out, reporter->data);
722 postscript_dump(
out);
725#define report_bug(file, line, fmt, ctx) do { \
726 FILE *out = bug_report_file(file, line); \
728 bug_report_begin(out, fmt); \
729 rb_vm_bugreport(ctx); \
730 bug_report_end(out); \
734#define report_bug_valist(file, line, fmt, ctx, args) do { \
735 FILE *out = bug_report_file(file, line); \
737 bug_report_begin_valist(out, fmt, args); \
738 rb_vm_bugreport(ctx); \
739 bug_report_end(out); \
747#if defined(_WIN32) && defined(RUBY_MSVCRT_VERSION) && RUBY_MSVCRT_VERSION >= 80
748 _set_abort_behavior( 0, _CALL_REPORTFAULT);
789 if (default_sighandler) default_sighandler(sig);
799 rb_bug(
"%s: errno == 0 (NOERROR)", mesg);
801 const char *errno_str = rb_strerrno(errno_arg);
813#define write_or_abort(fd, str, len) (write((fd), (str), (len)) < 0 ? abort() : (void)0)
814#define WRITE_CONST(fd,str) write_or_abort((fd),(str),sizeof(str) - 1)
823 if (errno_arg == 0) {
827 const char *errno_str = rb_strerrno(errno_arg);
830 errno_str =
"undefined errno";
848 fprintf(
out,
"Assertion Failed: %s:%d:",
file, line);
857static const char builtin_types[][10] = {
893 if ((
unsigned int)
t >=
numberof(builtin_types))
return 0;
894 name = builtin_types[
t];
900displaying_class_of(
VALUE x)
911builtin_class_name(
VALUE x)
924 else if (RB_TYPE_P(x,
T_TRUE)) {
927 else if (RB_TYPE_P(x,
T_FALSE)) {
939 const char *etype = builtin_class_name(x);
948#define UNDEF_LEAKED "undef leaked to the Ruby space"
951unexpected_type(
VALUE x,
int xt,
int t)
958 displaying_class_of(x), tname);
961 else if (xt >
T_MASK && xt <= 0x3f) {
962 mesg =
rb_sprintf(
"unknown type 0x%x (0x%x given, probably comes"
963 " from extension library for ruby 1.8)",
t, xt);
966 mesg =
rb_sprintf(
"unknown type 0x%x (0x%x given)",
t, xt);
981 if (xt !=
t || (xt ==
T_DATA && RTYPEDDATA_P(x))) {
982 unexpected_type(x, xt,
t);
993 unexpected_type(x,
TYPE(x),
t);
1000 if (child == parent)
return 1;
1009 if (!RB_TYPE_P(obj,
T_DATA) ||
1016#undef rb_typeddata_is_instance_of
1020 return rb_typeddata_is_instance_of_inline(obj, data_type);
1028 if (!RB_TYPE_P(obj,
T_DATA)) {
1029 actual = displaying_class_of(obj);
1031 else if (!RTYPEDDATA_P(obj)) {
1032 actual = displaying_class_of(obj);
1035 const char *
name = RTYPEDDATA_TYPE(obj)->wrap_struct_name;
1078static VALUE rb_eNOERROR;
1081#define id_cause ruby_static_id_cause
1082static ID id_message, id_backtrace;
1083static ID id_key, id_args, id_Errno, id_errno, id_i_path;
1084static ID id_receiver, id_recv, id_iseq, id_local_variables;
1085static ID id_private_call_p, id_top, id_bottom;
1087#define id_bt_locations idBt_locations
1088#define id_mesg idMesg
1089#define id_name idName
1091#undef rb_exc_new_cstr
1137 return exc_init(exc, arg);
1159 if (
argc == 0)
return self;
1160 if (
argc == 1 && self ==
argv[0])
return self;
1202exc_s_to_tty_p(
VALUE self)
1229 enum {kw_highlight, kw_order, kw_max_};
1230 static ID kw[kw_max_];
1236#define INIT_KW(n) kw[kw_##n] = rb_intern_const(#n)
1242 switch (args[kw_highlight]) {
1245 "highlight: %+"PRIsVALUE, args[kw_highlight]);
1246 case Qundef: args[kw_highlight] =
Qnil;
break;
1249 if (args[kw_order] ==
Qundef) {
1250 args[kw_order] =
Qnil;
1254 if (
id == id_bottom) args[kw_order] =
Qtrue;
1255 else if (
id == id_top) args[kw_order] =
Qfalse;
1279exc_message(
VALUE exc)
1292exc_inspect(
VALUE exc)
1348exc_backtrace(
VALUE exc)
1367 ID mid = id_backtrace;
1375 info = exc_backtrace(exc);
1382 return rb_check_backtrace(info);
1396exc_backtrace_locations(
VALUE exc)
1408rb_check_backtrace(
VALUE bt)
1411 static const char err[] =
"backtrace must be Array of String";
1416 if (!RB_TYPE_P(bt,
T_ARRAY)) {
1448 return exc_set_backtrace(exc, bt);
1467try_convert_to_exception(
VALUE obj)
1484 VALUE mesg, backtrace;
1486 if (exc == obj)
return Qtrue;
1504 backtrace = exc_backtrace(obj);
1509 if (!
rb_equal(exc_backtrace(exc), backtrace))
1546 if (
NIL_P(status)) {
1550#if EXIT_SUCCESS != 0
1577exit_status(
VALUE exc)
1591exit_success_p(
VALUE exc)
1596 if (
NIL_P(status_val))
1631 keywords[0] = id_receiver;
1634 err_init_recv(self, values[0]);
1646#define frozen_err_receiver name_err_receiver
1654 va_start(args, fmt);
1669 va_start(args, fmt);
1685 err_init_recv(exc, recv);
1710 keywords[0] = id_receiver;
1714 name_err_init_attr(self, values[0],
name);
1723 exc_init(exc, rb_name_err_mesg_new(mesg, recv, method));
1724 return name_err_init_attr(exc, recv, method);
1731 return name_err_init(exc, mesg, recv, method);
1742name_err_name(
VALUE self)
1758name_err_local_variables(
VALUE self)
1772nometh_err_init_attr(
VALUE exc,
VALUE args,
int priv)
1799 VALUE args, options;
1805 return nometh_err_init_attr(self, args, priv);
1812 name_err_init(exc, mesg, recv, method);
1813 return nometh_err_init_attr(exc, args, priv);
1825name_err_mesg_mark(
void *p)
1831#define name_err_mesg_free RUBY_TYPED_DEFAULT_FREE
1834name_err_mesg_memsize(
const void *p)
1844 name_err_mesg_memsize,
1872name_err_mesg_alloc(
VALUE klass)
1879name_err_mesg_init_copy(
VALUE obj1,
VALUE obj2)
1883 if (obj1 == obj2)
return obj1;
1899 if (obj1 == obj2)
return Qtrue;
1914name_err_mesg_receiver_name(
VALUE obj)
1916 if (RB_SPECIAL_CONST_P(obj))
return Qundef;
1917 if (RB_BUILTIN_TYPE(obj) ==
T_MODULE || RB_BUILTIN_TYPE(obj) ==
T_CLASS) {
1925name_err_mesg_to_str(
VALUE obj)
1934 VALUE c, s, d = 0, args[4];
1935 int state = 0, singleton = 0;
1938#define FAKE_CSTR(v, str) rb_setup_fake_str((v), (str), rb_strlen_lit(str), usascii)
1984 return name_err_mesg_to_str(obj);
2002name_err_receiver(
VALUE self)
2007 if (recv !=
Qundef)
return recv;
2026nometh_err_args(
VALUE self)
2039nometh_err_private_call_p(
VALUE self)
2060key_err_receiver(
VALUE self)
2065 if (recv !=
Qundef)
return recv;
2077key_err_key(
VALUE self)
2112 if (!
NIL_P(options)) {
2116 keywords[0] = id_receiver;
2117 keywords[1] = id_key;
2119 for (i = 0; i <
numberof(values); ++i) {
2120 if (values[i] !=
Qundef) {
2181set_syserr(
int n,
const char *
name)
2193#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
2255 klass = (
VALUE)data;
2260 RBASIC_SET_CLASS(self, klass);
2268 else err =
"unknown error";
2292syserr_errno(
VALUE self)
2724exception_alloc(
VALUE klass)
2730exception_dumper(
VALUE exc)
2756 if (RB_TYPE_P(exc,
T_CLASS))
return obj;
2861 id_cause = rb_intern_const(
"cause");
2862 id_message = rb_intern_const(
"message");
2863 id_backtrace = rb_intern_const(
"backtrace");
2864 id_key = rb_intern_const(
"key");
2865 id_args = rb_intern_const(
"args");
2866 id_receiver = rb_intern_const(
"receiver");
2867 id_private_call_p = rb_intern_const(
"private_call?");
2868 id_local_variables = rb_intern_const(
"local_variables");
2869 id_Errno = rb_intern_const(
"Errno");
2870 id_errno = rb_intern_const(
"errno");
2871 id_i_path = rb_intern_const(
"@path");
2872 id_warn = rb_intern_const(
"warn");
2873 id_category = rb_intern_const(
"category");
2874 id_deprecated = rb_intern_const(
"deprecated");
2875 id_experimental = rb_intern_const(
"experimental");
2876 id_top = rb_intern_const(
"top");
2877 id_bottom = rb_intern_const(
"bottom");
2881 sym_category =
ID2SYM(id_category);
2903 va_start(args, fmt);
2920 va_start(args, fmt);
2941 va_start(args, fmt);
2944 raise_loaderror(
Qnil, mesg);
2953 va_start(args, fmt);
2956 raise_loaderror(path, mesg);
2963 "%"PRIsVALUE"() function is unimplemented on this machine",
2976 fprintf(stderr,
"[FATAL] rb_fatal() outside of GVL\n");
2981 va_start(args, fmt);
2989make_errno_exc(
const char *mesg)
2995 rb_bug(
"rb_sys_fail(%s) - errno == 0", mesg ? mesg :
"");
3001make_errno_exc_str(
VALUE mesg)
3006 if (!mesg) mesg =
Qnil;
3009 rb_bug(
"rb_sys_fail_str(%s) - errno == 0", s);
3052#ifdef RUBY_FUNCTION_NAME_STRING
3054rb_sys_fail_path_in(
const char *func_name,
VALUE path)
3059 rb_syserr_fail_path_in(func_name, n, path);
3063rb_syserr_fail_path_in(
const char *func_name,
int n,
VALUE path)
3065 rb_exc_raise(rb_syserr_new_path_in(func_name, n, path));
3069rb_syserr_new_path_in(
const char *func_name,
int n,
VALUE path)
3073 if (!path) path =
Qnil;
3076 if (!func_name) func_name =
"(null)";
3077 rb_bug(
"rb_sys_fail_path_in(%s, %s) - errno == 0",
3089 VALUE exc = make_errno_exc(mesg);
3097 VALUE exc = make_errno_exc_str(mesg);
3123 rb_write_warning_str(mesg);
3128rb_sys_warn(
const char *fmt, ...)
3131 int errno_save = errno;
3133 syserr_warning(mesg, errno_save);
3140rb_syserr_warn(
int err,
const char *fmt, ...)
3144 syserr_warning(mesg,
err);
3150rb_sys_enc_warn(
rb_encoding *enc,
const char *fmt, ...)
3153 int errno_save = errno;
3155 syserr_warning(mesg, errno_save);
3162rb_syserr_enc_warn(
int err,
rb_encoding *enc,
const char *fmt, ...)
3166 syserr_warning(mesg,
err);
3176 int errno_save = errno;
3178 syserr_warning(mesg, errno_save);
3186rb_syserr_warning(
int err,
const char *fmt, ...)
3190 syserr_warning(mesg,
err);
3200 int errno_save = errno;
3202 syserr_warning(mesg, errno_save);
3213 syserr_warning(mesg,
err);
3224 raise_loaderror(path, mesg);
3239 va_start(args, fmt);
3280#undef rb_check_frozen
3293#undef rb_check_trusted
3311 rb_eNOERROR = set_syserr(0,
"NOERROR");
3312#define defined_error(name, num) set_syserr((num), (name));
3313#define undefined_error(name) set_syserr(0, (name));
3314#include "known_errors.inc"
3316#undef undefined_error
3319#include "warning.rbinc"
VALUE rb_ary_entry(VALUE ary, long offset)
#define FUNC_MINIMIZED(x)
#define UNREACHABLE_RETURN
#define rb_category_warn(category,...)
int bits(struct state *s, int need)
int ruby_thread_has_gvl_p(void)
#define rb_define_method(klass, mid, func, arity)
Defines klass#mid.
#define rb_define_singleton_method(klass, mid, func, arity)
Defines klass.mid.
char * strchr(char *, char)
#define MJIT_FUNC_EXPORTED
rb_encoding * rb_locale_encoding(void)
rb_encoding * rb_usascii_encoding(void)
#define FAKE_CSTR(v, str)
char str[HTML_ESCAPE_MAX_LEN+1]
#define RUBY_EVENT_C_CALL
#define RUBY_EVENT_C_RETURN
#define RSTRING_LEN(string)
#define RSTRING_PTR(string)
VALUE rb_class_allocate_instance(VALUE klass)
void rb_gc_mark_locations(const VALUE *start, const VALUE *end)
void rb_gc_register_mark_object(VALUE obj)
Inform the garbage collector that object is a live Ruby object that should not be moved.
void rb_extend_object(VALUE obj, VALUE module)
Extend the object with the module.
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
VALUE rb_singleton_class(VALUE obj)
Returns the singleton class of obj.
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
VALUE rb_define_module(const char *name)
ID rb_frame_this_func(void)
The original name of the current method.
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *values)
void rb_notimplement(void)
int rb_bug_reporter_add(void(*func)(FILE *, void *), void *data)
VALUE rb_syntax_error_append(VALUE exc, VALUE file, int line, int column, rb_encoding *enc, const char *fmt, va_list args)
void rb_syserr_fail(int e, const char *mesg)
VALUE rb_get_backtrace(VALUE exc)
void rb_raise(VALUE exc, const char *fmt,...)
void rb_warn_deprecated_to_remove(const char *fmt, const char *removal,...)
int rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *parent)
VALUE rb_exc_set_backtrace(VALUE exc, VALUE bt)
void rb_mod_sys_fail_str(VALUE mod, VALUE mesg)
void rb_enc_warn(rb_encoding *enc, const char *fmt,...)
void rb_compile_warn(const char *file, int line, const char *fmt,...)
void rb_sys_enc_warning(rb_encoding *enc, const char *fmt,...)
void rb_category_compile_warn(rb_warning_category_t category, const char *file, int line, const char *fmt,...)
void rb_warning_category_update(unsigned int mask, unsigned int bits)
void rb_mod_sys_fail(VALUE mod, const char *mesg)
void rb_exc_raise(VALUE mesg)
Raises an exception in the current thread.
void rb_error_write(VALUE errinfo, VALUE emesg, VALUE errat, VALUE str, VALUE highlight, VALUE reverse)
#define report_bug_valist(file, line, fmt, ctx, args)
int rb_typeddata_is_kind_of(VALUE obj, const rb_data_type_t *data_type)
void rb_bug(const char *fmt,...)
#define with_warning_string(mesg, enc, fmt)
void rb_name_error(ID id, const char *fmt,...)
#define MAX_BUG_REPORTERS
void rb_syserr_enc_warning(int err, rb_encoding *enc, const char *fmt,...)
void rb_sys_warning(const char *fmt,...)
VALUE rb_nomethod_err_new(VALUE mesg, VALUE recv, VALUE method, VALUE args, int priv)
VALUE rb_syserr_new(int n, const char *mesg)
void rb_check_copyable(VALUE obj, VALUE orig)
VALUE rb_syserr_new_str(int n, VALUE arg)
void rb_error_frozen(const char *what)
void rb_set_errinfo(VALUE err)
Sets the current exception ($!) to the given value.
void rb_syserr_fail_str(int e, VALUE mesg)
VALUE rb_ident_hash_new(void)
const char * rb_builtin_type_name(int t)
VALUE rb_warning_string(const char *fmt,...)
void rb_sys_fail_str(VALUE mesg)
void Init_Exception(void)
void rb_error_untrusted(VALUE obj)
VALUE rb_iseqw_local_variables(VALUE iseqval)
VALUE rb_eNoMatchingPatternError
void rb_name_error_str(VALUE str, const char *fmt,...)
void rb_fatal(const char *fmt,...)
void rb_frozen_error_raise(VALUE frozen_obj, const char *fmt,...)
void rb_vraise(VALUE exc, const char *fmt, va_list ap)
#define WEXITSTATUS(status)
VALUE rb_protect(VALUE(*proc)(VALUE), VALUE data, int *pstate)
Protects a function call from potential global escapes from the function.
void rb_load_fail(VALUE path, const char *err)
void rb_unexpected_type(VALUE x, int t)
#define report_bug(file, line, fmt, ctx)
void rb_invalid_str(const char *str, const char *type)
const char * rb_builtin_class_name(VALUE x)
void rb_category_warning(rb_warning_category_t category, const char *fmt,...)
void rb_warn_deprecated(const char *fmt, const char *suggest,...)
void rb_exc_fatal(VALUE mesg)
Raises a fatal error in the current thread.
void rb_bug_errno(const char *mesg, int errno_arg)
VALUE rb_ec_backtrace_location_ary(const rb_execution_context_t *ec, long lev, long n, bool skip_internal)
void rb_bug_without_die(const char *fmt, va_list args)
VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method)
void * rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type)
void rb_bug_for_fatal_signal(ruby_sighandler_t default_sighandler, int sig, const void *ctx, const char *fmt,...)
void rb_warn(const char *fmt,...)
#define WIFEXITED(status)
rb_warning_category_t rb_warning_category_from_name(VALUE category)
VALUE rb_exc_new(VALUE etype, const char *ptr, long len)
void rb_error_frozen_object(VALUE frozen_obj)
VALUE rb_exc_new_str(VALUE etype, VALUE str)
void rb_assert_failure(const char *file, int line, const char *name, const char *expr)
void rb_compile_warning(const char *file, int line, const char *fmt,...)
void rb_mod_syserr_fail(VALUE mod, int e, const char *mesg)
void rb_loaderror(const char *fmt,...)
VALUE rb_iseqw_new(const rb_iseq_t *)
VALUE rb_get_message(VALUE exc)
void rb_loaderror_with_path(VALUE path, const char *fmt,...)
long rb_backtrace_length_limit
void rb_report_bug_valist(VALUE file, int line, const char *fmt, va_list args)
void rb_async_bug_errno(const char *mesg, int errno_arg)
#define REPORT_BUG_BUFSIZ
#define write_or_abort(fd, str, len)
bool rb_warning_category_enabled_p(rb_warning_category_t category)
int rb_str_end_with_asciichar(VALUE str, int c)
const char ruby_description[]
void rb_sys_fail(const char *mesg)
#define frozen_err_receiver
void rb_mod_syserr_fail_str(VALUE mod, int e, VALUE mesg)
#define name_err_mesg_free
void rb_check_type(VALUE x, int t)
VALUE rb_eSystemCallError
#define WRITE_CONST(fd, str)
void rb_warning(const char *fmt,...)
VALUE rb_key_err_new(VALUE mesg, VALUE recv, VALUE key)
VALUE rb_check_to_int(VALUE)
Tries to convert val into Integer.
VALUE rb_cObject
Object class.
VALUE rb_any_to_s(VALUE)
Default implementation of #to_s.
VALUE rb_obj_alloc(VALUE)
Allocates an instance of klass.
VALUE rb_class_new_instance(int, const VALUE *, VALUE)
Allocates and initializes an instance of klass.
VALUE rb_obj_init_copy(VALUE, VALUE)
Default implementation of #initialize_copy.
VALUE rb_obj_class(VALUE)
VALUE rb_inspect(VALUE)
Convenient wrapper of Object::inspect.
VALUE rb_equal(VALUE, VALUE)
This function is an optimized version of calling #==.
VALUE rb_obj_clone(VALUE)
Almost same as Object::clone.
VALUE rb_obj_is_kind_of(VALUE, VALUE)
Determines if obj is a kind of c.
VALUE rb_obj_freeze(VALUE)
Make the object unmodifiable.
VALUE rb_String(VALUE)
Equivalent to Kernel#String in Ruby.
VALUE rb_hash_fetch(VALUE hash, VALUE key)
VALUE rb_hash_aref(VALUE hash, VALUE key)
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE val)
VALUE rb_enc_str_new_cstr(const char *, rb_encoding *)
VALUE rb_enc_vsprintf(rb_encoding *, const char *, va_list)
VALUE rb_enc_str_new(const char *, long, rb_encoding *)
Thin wrapper to ruby/config.h.
@ RB_WARN_CATEGORY_DEPRECATED
@ RB_WARN_CATEGORY_EXPERIMENTAL
VALUE rb_call_super_kw(int, const VALUE *, int)
VALUE rb_funcallv_kw(VALUE, ID, int, const VALUE *, int)
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
VALUE rb_call_super(int, const VALUE *)
Defines RBIMPL_HAS_BUILTIN.
#define rb_check_frozen_internal(obj)
VALUE rb_io_puts(int, const VALUE *, VALUE)
void rb_must_asciicompat(VALUE)
#define rb_str_new(str, len)
#define rb_exc_new_cstr(exc, str)
void rb_str_set_len(VALUE, long)
VALUE rb_check_string_type(VALUE)
#define rb_str_buf_new_cstr(str)
VALUE rb_str_tmp_new(long)
VALUE rb_str_append(VALUE, VALUE)
VALUE rb_str_buf_append(VALUE, VALUE)
VALUE rb_obj_as_string(VALUE)
#define rb_str_cat_cstr(buf, str)
#define rb_str_new_cstr(str)
VALUE rb_exec_recursive(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE)
VALUE rb_class_name(VALUE)
VALUE rb_const_get(VALUE, ID)
VALUE rb_attr_get(VALUE, ID)
VALUE rb_ivar_set(VALUE, ID, VALUE)
void rb_attr(VALUE, ID, int, int, int)
VALUE rb_check_funcall(VALUE, ID, int, const VALUE *)
int rb_respond_to(VALUE, ID)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
const char * rb_id2name(ID)
ID rb_intern(const char *)
ID rb_check_id(volatile VALUE *)
Returns ID for the given name if it is interned already, or 0.
void rb_define_const(VALUE, const char *, VALUE)
#define rb_typeddata_is_instance_of
int rb_stderr_tty_p(void)
Internal header for require.
Internal header for Object.
#define rb_fstring_lit(str)
VALUE rb_to_symbol_type(VALUE obj)
ID rb_make_internal_id(void)
Internal header for Thread.
VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
void rb_print_backtrace(void)
VALUE rb_backtrace_to_str_ary(VALUE obj)
int rb_backtrace_p(VALUE obj)
VALUE rb_backtrace_to_location_ary(VALUE obj)
const char * rb_source_location_cstr(int *pline)
#define rb_fstring_cstr(...)
#define rb_method_basic_definition_p(...)
typedef int(ZCALLBACK *close_file_func) OF((voidpf opaque
void rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE(*dumper)(VALUE), VALUE(*loader)(VALUE, VALUE))
#define MEMCPY(p1, p2, type, n)
const rb_method_entry_t * rb_method_entry(VALUE klass, ID id)
int rb_method_entry_arity(const rb_method_entry_t *me)
VALUE type(ANYARGS)
ANYARGS-ed function type.
void rb_ivar_foreach(VALUE q, int_type *w, VALUE e)
Iteration over each instance variable of the object.
#define RARRAY_CONST_PTR(s)
#define RARRAY_AREF(a, i)
char * rb_string_value_ptr(volatile VALUE *)
#define RTYPEDDATA_DATA(v)
#define TypedData_Get_Struct(obj, type, data_type, sval)
#define TypedData_Wrap_Struct(klass, data_type, sval)
@ RUBY_TYPED_FREE_IMMEDIATELY
const char * rb_obj_classname(VALUE)
#define RB_PASS_CALLED_KEYWORDS
VALUE rb_vsprintf(const char *, va_list)
VALUE rb_str_vcatf(VALUE, const char *, va_list)
VALUE rb_str_format(int, const VALUE *, VALUE)
VALUE rb_str_catf(VALUE, const char *,...)
VALUE rb_sprintf(const char *,...)
size_t strlen(const char *)
const rb_data_type_t * parent
const char * wrap_struct_name
void error(const char *msg)
rb_control_frame_t * rb_vm_get_ruby_level_next_cfp(const rb_execution_context_t *ec, const rb_control_frame_t *cfp)
void(* ruby_sighandler_t)(int)
void rb_vm_bugreport(const void *)
#define EXEC_EVENT_HOOK(ec_, flag_, self_, id_, called_id_, klass_, data_)
#define RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp)
void rb_write_error_str(VALUE mesg)