27#include "internal/error.h"
28#include "internal/eval.h"
33#include "internal/symbol.h"
34#include "internal/variable.h"
57static VALUE rb_cNilClass_to_s;
58static VALUE rb_cTrueClass_to_s;
59static VALUE rb_cFalseClass_to_s;
65#define id_match idEqTilde
66#define id_inspect idInspect
67#define id_init_copy idInitialize_copy
68#define id_init_clone idInitialize_clone
69#define id_init_dup idInitialize_dup
70#define id_const_missing idConst_missing
73#define CLASS_OR_MODULE_P(obj) \
74 (!SPECIAL_CONST_P(obj) && \
75 (BUILTIN_TYPE(obj) == T_CLASS || BUILTIN_TYPE(obj) == T_MODULE))
95 RBASIC_CLEAR_CLASS(obj);
112 RBASIC_SET_CLASS(obj, klass);
129 RBASIC_SET_CLASS(obj, klass);
141#define case_equal rb_equal
161 if (obj1 == obj2)
return Qtrue;
184 if (obj1 == obj2)
return Qtrue;
199 if (obj1 == obj2)
return Qtrue;
268rb_obj_singleton_class(
VALUE obj)
292 ROBJECT(dest)->as.heap.iv_index_tbl =
ROBJECT(obj)->as.heap.iv_index_tbl;
293 RBASIC(dest)->flags &= ~ROBJECT_EMBED;
318special_object_p(
VALUE obj)
335obj_freeze_opt(
VALUE freeze)
352 VALUE kwfreeze = obj_freeze_opt(freeze);
353 if (!special_object_p(obj))
354 return mutable_obj_clone(obj, kwfreeze);
355 return immutable_obj_clone(obj, kwfreeze);
363 return immutable_obj_clone(obj, kwfreeze);
369 static ID keyword_ids[1];
373 if (!keyword_ids[0]) {
380 kwfreeze = obj_freeze_opt(kwfreeze);
397 VALUE clone, singleton;
403 RBASIC_SET_CLASS(clone, singleton);
408 init_copy(clone, obj);
417 static VALUE freeze_true_hash;
418 if (!freeze_true_hash) {
426 argv[1] = freeze_true_hash;
433 static VALUE freeze_false_hash;
434 if (!freeze_false_hash) {
442 argv[1] = freeze_false_hash;
447 rb_bug(
"invalid kwfreeze passed to mutable_obj_clone");
459 if (special_object_p(obj))
return obj;
460 return mutable_obj_clone(obj,
Qnil);
471 if (special_object_p(obj)) {
493rb_obj_itself(
VALUE obj)
518 if (obj == orig)
return obj;
552 if (
argc == 2) (void)freeze_opt(1, &opts);
667rb_obj_inspect(
VALUE obj)
682class_or_module_required(
VALUE c)
709 c = class_or_module_required(c);
728 c = class_or_module_required(c);
747 cl = class_or_module_required(cl);
748 c = class_or_module_required(c);
989 return rb_obj_dummy();
995 return rb_obj_dummy();
1106 rb_bug(
"special consts should be frozen.");
1166 return rb_cNilClass_to_s;
1211nil_inspect(
VALUE obj)
1249 return rb_cTrueClass_to_s;
1324false_to_s(
VALUE obj)
1326 return rb_cFalseClass_to_s;
1355#define false_or true_and
1368#define false_xor true_and
1501rb_mod_to_s(
VALUE klass)
1504 VALUE refined_class, defined_at;
1520 refined_class = rb_refinement_module_get_refined_class(klass);
1521 if (!
NIL_P(refined_class)) {
1526 CONST_ID(id_defined_at,
"__defined_at__");
1588 if (class_search_ancestor(arg,
mod)) {
1650 return rb_mod_ge(
mod, arg);
1684rb_module_s_alloc(
VALUE klass)
1688 RBASIC_SET_CLASS(
mod, klass);
1693rb_class_s_alloc(
VALUE klass)
1725rb_mod_initialize(
VALUE module)
1737 VALUE ret, orig, opts;
1739 ret = rb_obj_init_clone(
argc,
argv, clone);
1793 RCLASS_SET_SUPER(klass, super);
1796 rb_mod_initialize(klass);
1835rb_class_alloc_m(
VALUE klass)
1842 return class_call_alloc_func(allocator, klass);
1846rb_class_alloc(
VALUE klass)
1849 return class_call_alloc_func(allocator, klass);
1853class_get_alloc_func(
VALUE klass)
1877 obj = (*allocator)(klass);
1903 return rb_class_alloc(klass);
1922 obj = rb_class_alloc(klass);
1934 obj = rb_class_alloc(klass);
1958 obj = rb_class_alloc(klass);
1982 while (RB_TYPE_P(super,
T_ICLASS)) {
2001 return RCLASS(klass)->super;
2004static const char bad_instance_name[] =
"`%1$s' is not allowed as an instance variable name";
2005static const char bad_class_name[] =
"`%1$s' is not allowed as a class variable name";
2006static const char bad_const_name[] =
"wrong constant name %1$s";
2007static const char bad_attr_name[] =
"invalid attribute name `%1$s'";
2008#define wrong_constant_name bad_const_name
2011#define id_for_var(obj, name, type) id_for_setter(obj, name, type, bad_##type##_name)
2013#define id_for_setter(obj, name, type, message) \
2014 check_setter_id(obj, &(name), rb_is_##type##_id, rb_is_##type##_name, message, strlen(message))
2017 int (*valid_id_p)(
ID),
int (*valid_name_p)(
VALUE),
2018 const char *message,
size_t message_len)
2023 if (
id ? !valid_id_p(
id) : !valid_name_p(
name)) {
2070 for (i=0; i<
argc; i++) {
2071 ID id = id_for_attr(klass,
argv[i]);
2086 ID id = id_for_attr(klass,
argv[0]);
2095 return rb_mod_attr_reader(
argc,
argv, klass);
2115 for (i=0; i<
argc; i++) {
2116 ID id = id_for_attr(klass,
argv[i]);
2147 for (i=0; i<
argc; i++) {
2148 ID id = id_for_attr(klass,
argv[i]);
2202 const char *pbeg, *p, *path, *pend;
2226 if (p >= pend || !*p) {
2230 if (p + 2 < pend && p[0] ==
':' && p[1] ==
':') {
2240 while (p < pend && *p !=
':') p++;
2242 if (pbeg == p)
goto wrong_name;
2247 if (p < pend && p[0] ==
':') {
2248 if (p + 2 >= pend || p[1] !=
':')
goto wrong_name;
2284 else if (beglen == 0) {
2375 const char *pbeg, *p, *path, *pend;
2399 if (p >= pend || !*p) {
2403 if (p + 2 < pend && p[0] ==
':' && p[1] ==
':') {
2413 while (p < pend && *p !=
':') p++;
2415 if (pbeg == p)
goto wrong_name;
2420 if (p < pend && p[0] ==
':') {
2421 if (p + 2 >= pend || p[1] !=
':')
goto wrong_name;
2449 if (p == pend)
return Qtrue;
2452 else if (beglen == 0) {
2455 if (p == pend)
return Qtrue;
2461 if (p == pend)
return Qtrue;
2535 const char *pbeg, *p, *path, *pend;
2545 if (!
id)
return Qnil;
2559 if (p >= pend || !*p) {
2563 if (p + 2 < pend && p[0] ==
':' && p[1] ==
':') {
2573 while (p < pend && *p !=
':') p++;
2575 if (pbeg == p)
goto wrong_name;
2580 if (p < pend && p[0] ==
':') {
2581 if (p + 2 >= pend || p[1] !=
':')
goto wrong_name;
2749 rb_name_err_raise(
"uninitialized class variable %1$s in %2$s",
2825rb_mod_singleton_p(
VALUE klass)
2833static const struct conv_method_tbl {
2834 const char method[6];
2836} conv_method_names[] = {
2837#define M(n) {#n, (unsigned short)idTo_##n}
2851#define IMPLICIT_CONVERSIONS 7
2854conv_method_index(
const char *method)
2856 static const char prefix[] =
"to_";
2859 const char *
const meth = &method[
sizeof(
prefix)-1];
2861 for (i=0; i <
numberof(conv_method_names); i++) {
2862 if (conv_method_names[i].method[0] == meth[0] &&
2863 strcmp(conv_method_names[i].method, meth) == 0) {
2868 return numberof(conv_method_names);
2872convert_type_with_id(
VALUE val,
const char *tname,
ID method,
int raise,
int index)
2878 ((index < 0 ? conv_method_index(
rb_id2name(method)) : index)
2880 "no implicit conversion of" :
"can't convert";
2881 const char *cname =
NIL_P(val) ?
"nil" :
2882 val ==
Qtrue ?
"true" :
2883 val ==
Qfalse ?
"false" :
2897convert_type(
VALUE val,
const char *tname,
const char *method,
int raise)
2899 int i = conv_method_index(method);
2901 conv_method_names[i].id :
rb_intern(method);
2902 return convert_type_with_id(val, tname, m, raise, i);
2908conversion_mismatch(
VALUE val,
const char *tname,
const char *method,
VALUE result)
2935 v = convert_type(val, tname, method,
TRUE);
2937 conversion_mismatch(val, tname, method, v);
2949 v = convert_type_with_id(val, tname, method,
TRUE, -1);
2977 v = convert_type(val, tname, method,
FALSE);
2980 conversion_mismatch(val, tname, method, v);
2993 v = convert_type_with_id(val, tname, method,
FALSE, -1);
3001#define try_to_int(val, mid, raise) \
3002 convert_type_with_id(val, "Integer", mid, raise, -1)
3006rb_to_integer(
VALUE val,
const char *method,
ID mid)
3013 conversion_mismatch(val,
"Integer", method, v);
3034 if (RB_TYPE_P(val,
T_BIGNUM))
return val;
3035 v = convert_type(val,
"Integer", method,
FALSE);
3053 return rb_to_integer(val,
"to_int", idTo_int);
3075rb_check_to_i(
VALUE val)
3084rb_convert_to_integer(
VALUE val,
int base,
int raise_exception)
3094 else if (! raise_exception) {
3101 if (RB_FLOAT_TYPE_P(val)) {
3110 else if (RB_TYPE_P(val,
T_STRING)) {
3113 else if (
NIL_P(val)) {
3114 if (!raise_exception)
return Qnil;
3122 if (!raise_exception) {
3128 return rb_to_integer(val,
"to_i", idTo_i);
3140 return rb_convert_to_integer(val, 0,
TRUE);
3159 static ID kwds[1] = {idException};
3163 return default_value;
3166#define opts_exception_p(opts) rb_opts_exception_p((opts), TRUE)
3211 if (!
NIL_P(vbase)) {
3230rb_cstr_to_dbl_raise(
const char *p,
int badcheck,
int raise,
int *
error)
3235 const char *ellipsis =
"";
3237 enum {max_width = 20};
3238#define OutOfRange() ((end - p > max_width) ? \
3239 (w = max_width, ellipsis = "...") : \
3240 (w = (int)(end - p), ellipsis = ""))
3246 if (!badcheck && p[0] ==
'0' && (p[1] ==
'x' || p[1] ==
'X')) {
3251 if (errno == ERANGE) {
3253 rb_warning(
"Float %.*s%s out of range", w, p, ellipsis);
3268 int dot_seen =
FALSE;
3270 switch (*p) {
case '+':
case '-': prev = *n++ = *p++;}
3273 while (*++p ==
'0');
3275 while (p < end && n < e) prev = *n++ = *p++;
3280 if (badcheck)
goto bad;
3285 if (e == init_e && (prev ==
'e' || prev ==
'E' || prev ==
'p' || prev ==
'P')) {
3286 e =
buf +
sizeof(
buf) - 1;
3288 switch (*p) {
case '+':
case '-': prev = *n++ = *p++;}
3291 while (*++p ==
'0');
3298 if (badcheck)
goto bad;
3302 else if (prev ==
'.' ? dot_seen++ : !
ISDIGIT(prev)) {
3303 if (badcheck)
goto bad;
3306 if (n < e) *n++ = prev;
3311 if (!badcheck && p[0] ==
'0' && (p[1] ==
'x' || p[1] ==
'X')) {
3316 if (errno == ERANGE) {
3318 rb_warning(
"Float %.*s%s out of range", w, p, ellipsis);
3322 if (!end || p == end)
goto bad;
3323 while (*end &&
ISSPACE(*end)) end++;
3327 if (errno == ERANGE) {
3359 return rb_cstr_to_dbl_raise(p, badcheck,
TRUE,
NULL);
3363rb_str_to_dbl_raise(
VALUE str,
int badcheck,
int raise,
int *
error)
3374 if (badcheck && memchr(s,
'\0',
len)) {
3389 ret = rb_cstr_to_dbl_raise(s, badcheck, raise,
error);
3411 return rb_str_to_dbl_raise(
str, badcheck,
TRUE,
NULL);
3415#define fix2dbl_without_to_f(x) (double)FIX2LONG(x)
3416#define big2dbl_without_to_f(x) rb_big2dbl(x)
3417#define int2dbl_without_to_f(x) \
3418 (FIXNUM_P(x) ? fix2dbl_without_to_f(x) : big2dbl_without_to_f(x))
3419#define num2dbl_without_to_f(x) \
3420 (FIXNUM_P(x) ? fix2dbl_without_to_f(x) : \
3421 RB_TYPE_P(x, T_BIGNUM) ? big2dbl_without_to_f(x) : \
3422 (Check_Type(x, T_FLOAT), RFLOAT_VALUE(x)))
3424rat2dbl_without_to_f(
VALUE x)
3428 return num2dbl_without_to_f(
num) / num2dbl_without_to_f(den);
3431#define special_const_to_float(val, pre, post) \
3434 rb_raise_static(rb_eTypeError, pre "nil" post); \
3436 rb_raise_static(rb_eTypeError, pre "true" post); \
3438 rb_raise_static(rb_eTypeError, pre "false" post); \
3443conversion_to_float(
VALUE val)
3445 special_const_to_float(val,
"can't convert ",
" into Float");
3449implicit_conversion_to_float(
VALUE val)
3451 special_const_to_float(val,
"no implicit conversion to float from ",
"");
3455to_float(
VALUE *valp,
int raise_exception)
3460 *valp =
DBL2NUM(fix2dbl_without_to_f(val));
3463 else if (FLONUM_P(val)) {
3466 else if (raise_exception) {
3467 conversion_to_float(val);
3476 *valp =
DBL2NUM(big2dbl_without_to_f(val));
3479 *valp =
DBL2NUM(rat2dbl_without_to_f(val));
3489convert_type_to_float_protected(
VALUE val)
3495rb_convert_to_float(
VALUE val,
int raise_exception)
3497 switch (to_float(&val, raise_exception)) {
3501 if (!raise_exception) {
3503 double x = rb_str_to_dbl_raise(val,
TRUE, raise_exception, &e);
3512 if (!raise_exception) {
3533 return rb_convert_to_float(val,
TRUE);
3540 return rb_convert_to_float(arg, exception);
3544numeric_to_float(
VALUE val)
3561 switch (to_float(&val,
TRUE)) {
3565 return numeric_to_float(val);
3578 if (RB_TYPE_P(val,
T_FLOAT))
return val;
3586basic_to_f_p(
VALUE klass)
3598 return fix2dbl_without_to_f(val);
3600 else if (FLONUM_P(val)) {
3601 return rb_float_flonum_value(val);
3604 conversion_to_float(val);
3610 return rb_float_noflonum_value(val);
3613 return big2dbl_without_to_f(val);
3617 return rat2dbl_without_to_f(val);
3623 val = numeric_to_float(val);
3639 return fix2dbl_without_to_f(val);
3641 else if (FLONUM_P(val)) {
3642 return rb_float_flonum_value(val);
3645 implicit_conversion_to_float(val);
3651 return rb_float_noflonum_value(val);
3653 return big2dbl_without_to_f(val);
3655 return rat2dbl_without_to_f(val);
3791dig_basic_p(
VALUE obj,
struct dig_method *cache)
3794 if (klass != cache->klass) {
3795 cache->klass = klass;
3798 return cache->basic;
3814 struct dig_method hash = {
Qnil}, ary = {
Qnil}, strt = {
Qnil};
3817 if (
NIL_P(obj))
return notfound;
3821 if (dig_basic_p(obj, &hash)) {
3827 if (dig_basic_p(obj, &ary)) {
3833 if (dig_basic_p(obj, &strt)) {
4471#include "kernel.rbinc"
4476 id_dig = rb_intern_const(
"dig");
VALUE rb_check_to_array(VALUE ary)
VALUE rb_ary_push(VALUE ary, VALUE item)
VALUE rb_check_array_type(VALUE ary)
VALUE rb_ary_at(VALUE ary, VALUE pos)
#define RUBY_ASSERT(expr)
Asserts that the given expression is truthy iff RUBY_DEBUG is truthy.
#define FUNC_MINIMIZED(x)
#define UNREACHABLE_RETURN
VALUE rb_mod_const_missing(VALUE, VALUE)
#define rb_category_warn(category,...)
VALUE rb_dbl2big(double d)
VALUE rb_str_convert_to_inum(VALUE str, int base, int badcheck, int raise_exception)
#define OBJ_BUILTIN_TYPE(obj)
VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj)
VALUE rb_const_source_location(VALUE, ID)
VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj)
VALUE rb_const_source_location_at(VALUE, ID)
VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj)
Our own, locale independent, character handling routines.
#define rb_define_method(klass, mid, func, arity)
Defines klass#mid.
#define rb_define_private_method(klass, mid, func, arity)
Defines klass#mid and makes it private.
#define rb_define_global_function(mid, func, arity)
Defines rb_mKernel #mid.
#define MJIT_FUNC_EXPORTED
rb_encoding * rb_default_internal_encoding(void)
rb_encoding * rb_enc_get(VALUE obj)
rb_encoding * rb_default_external_encoding(void)
rb_encoding * rb_usascii_encoding(void)
char str[HTML_ESCAPE_MAX_LEN+1]
void rb_obj_call_init_kw(VALUE obj, int argc, const VALUE *argv, int kw_splat)
#define CLASS_OR_MODULE_P(obj)
#define RSTRING_LEN(string)
#define RSTRING_PTR(string)
void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj)
VALUE rb_class_allocate_instance(VALUE klass)
void rb_gc_copy_finalizer(VALUE dest, VALUE obj)
void rb_gc_register_mark_object(VALUE obj)
Inform the garbage collector that object is a live Ruby object that should not be moved.
#define rb_obj_instance_variables(object)
#define rb_intern_str(string)
VALUE rb_class_protected_instance_methods(int argc, const VALUE *argv, VALUE mod)
void rb_include_module(VALUE klass, VALUE module)
VALUE rb_define_class(const char *name, VALUE super)
Defines a top-level class.
VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj)
VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj)
VALUE rb_singleton_class(VALUE obj)
Returns the singleton class of obj.
void Init_class_hierarchy(void)
VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach)
VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj)
VALUE rb_obj_singleton_methods(int argc, const VALUE *argv, VALUE obj)
VALUE rb_module_new(void)
VALUE rb_class_instance_methods(int argc, const VALUE *argv, VALUE mod)
void rb_check_inheritable(VALUE super)
Ensures a class can be derived from super.
VALUE rb_class_public_instance_methods(int argc, const VALUE *argv, VALUE mod)
VALUE rb_class_boot(VALUE super)
A utility function that wraps class_alloc.
VALUE rb_define_module(const char *name)
void rb_singleton_class_attached(VALUE klass, VALUE obj)
Attach a object to a singleton class.
VALUE rb_mod_included_modules(VALUE mod)
VALUE rb_mod_ancestors(VALUE mod)
VALUE rb_class_inherited(VALUE super, VALUE klass)
Calls Class::inherited.
VALUE rb_mod_include_p(VALUE mod, VALUE mod2)
VALUE rb_class_private_instance_methods(int argc, const VALUE *argv, VALUE mod)
VALUE rb_mod_init_copy(VALUE clone, VALUE orig)
VALUE rb_make_metaclass(VALUE obj, VALUE unused)
VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj)
VALUE rb_extract_keywords(VALUE *orighash)
void rb_undef_method(VALUE klass, const char *name)
void rb_define_alias(VALUE klass, const char *name1, const char *name2)
Defines an alias of a method.
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
int rb_block_given_p(void)
Determines if the current method is given a block.
int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *values)
void rb_raise(VALUE exc, const char *fmt,...)
void rb_warn_deprecated_to_remove(const char *fmt, const char *removal,...)
void rb_bug(const char *fmt,...)
void rb_set_errinfo(VALUE err)
Sets the current exception ($!) to the given value.
VALUE rb_protect(VALUE(*proc)(VALUE), VALUE data, int *pstate)
Protects a function call from potential global escapes from the function.
void rb_invalid_str(const char *str, const char *type)
void rb_category_warning(rb_warning_category_t category, const char *fmt,...)
bool rb_warning_category_enabled_p(rb_warning_category_t category)
void rb_warning(const char *fmt,...)
VALUE rb_cClass
Class class.
VALUE rb_class_superclass(VALUE klass)
Returns the superclass of klass.
VALUE rb_obj_taint(VALUE obj)
call-seq: obj.taint -> obj
VALUE rb_obj_trust(VALUE obj)
call-seq: obj.trust -> obj
VALUE rb_class_get_superclass(VALUE klass)
Returns the superclass of klass The return value might be an iclass of a module, unlike rb_class_supe...
VALUE rb_convert_type(VALUE val, int type, const char *tname, const char *method)
Converts an object into another type.
VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2)
#define case_equal
call-seq: obj === other -> true or false
VALUE rb_Float(VALUE val)
Equivalent to Kernel#Float in Ruby.
VALUE rb_mKernel
Kernel module.
VALUE rb_check_to_int(VALUE val)
Tries to convert val into Integer.
VALUE rb_obj_reveal(VALUE obj, VALUE klass)
Make a hidden object visible again.
#define opts_exception_p(opts)
VALUE rb_check_convert_type(VALUE val, int type, const char *tname, const char *method)
Tries to convert an object into another type.
VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound)
VALUE rb_cObject
Object class.
VALUE rb_any_to_s(VALUE obj)
Default implementation of #to_s.
#define id_for_var(obj, name, type)
VALUE rb_obj_alloc(VALUE klass)
Allocates an instance of klass.
VALUE rb_class_new_instance(int argc, const VALUE *argv, VALUE klass)
Allocates and initializes an instance of klass.
VALUE rb_class_new_instance_kw(int argc, const VALUE *argv, VALUE klass, int kw_splat)
int rb_opts_exception_p(VALUE opts, int default_value)
#define try_to_int(val, mid, raise)
VALUE rb_obj_hide(VALUE obj)
Make the object invisible from Ruby code.
double rb_num_to_dbl(VALUE val)
int rb_bool_expected(VALUE obj, const char *flagname)
VALUE rb_class_new_instance_pass_kw(int argc, const VALUE *argv, VALUE klass)
#define IMPLICIT_CONVERSIONS
VALUE rb_check_to_float(VALUE val)
Tries to convert an object into Float.
VALUE rb_cNilClass
NilClass class.
VALUE rb_Hash(VALUE val)
Equivalent to Kernel#Hash in Ruby.
void rb_obj_infect(VALUE victim, VALUE carrier)
Does nothing.
VALUE rb_obj_frozen_p(VALUE obj)
VALUE rb_obj_init_copy(VALUE obj, VALUE orig)
Default implementation of #initialize_copy.
VALUE rb_obj_equal(VALUE obj1, VALUE obj2)
int rb_eql(VALUE obj1, VALUE obj2)
Determines if obj1 and obj2 are equal in terms of Object::eql?.
double rb_str_to_dbl(VALUE str, int badcheck)
Parses a string representation of a floating point number.
VALUE rb_Integer(VALUE val)
Equivalent to Kernel#Integer in Ruby.
VALUE rb_cFalseClass
FalseClass class.
VALUE rb_Array(VALUE val)
Equivalent to Kernel#Array in Ruby.
void rb_undefined_alloc(VALUE klass)
VALUE rb_obj_class(VALUE obj)
#define wrong_constant_name
VALUE rb_obj_dup(VALUE obj)
Equivalent to Object#dup in Ruby.
VALUE rb_inspect(VALUE obj)
Convenient wrapper of Object::inspect.
VALUE rb_obj_size(VALUE self, VALUE args, VALUE obj)
VALUE rb_check_convert_type_with_id(VALUE, int, const char *, ID)
VALUE rb_cBasicObject
BasicObject class.
VALUE rb_cModule
Module class.
VALUE rb_obj_untrust(VALUE obj)
call-seq: obj.untrust -> obj
VALUE rb_class_inherited_p(VALUE mod, VALUE arg)
Determines if mod inherits arg.
VALUE rb_obj_is_instance_of(VALUE obj, VALUE c)
Determines if obj is an instance of c.
VALUE rb_convert_type_with_id(VALUE v, int t, const char *nam, ID mid)
VALUE rb_class_real(VALUE cl)
Looks up the nearest ancestor of cl, skipping singleton classes or module inclusions.
VALUE rb_obj_init_dup_clone(VALUE obj, VALUE orig)
Default implementation of #initialize_dup.
VALUE rb_to_float(VALUE val)
Converts a Numeric object into Float.
double rb_num2dbl(VALUE val)
Converts a Numeric object to double.
VALUE rb_equal(VALUE obj1, VALUE obj2)
This function is an optimized version of calling #==.
VALUE rb_obj_clone(VALUE obj)
Almost same as Object::clone.
VALUE rb_obj_is_kind_of(VALUE obj, VALUE c)
Determines if obj is a kind of c.
double rb_cstr_to_dbl(const char *p, int badcheck)
Parses a string representation of a floating point number.
VALUE rb_obj_not(VALUE obj)
VALUE rb_obj_freeze(VALUE obj)
Make the object unmodifiable.
VALUE rb_check_to_integer(VALUE val, const char *method)
Tries to convert val into Integer.
VALUE rb_immutable_obj_clone(int, VALUE *, VALUE)
VALUE rb_class_search_ancestor(VALUE klass, VALUE super)
VALUE rb_obj_untrusted(VALUE obj)
call-seq: obj.untrusted? -> false
VALUE rb_false(VALUE obj)
VALUE rb_String(VALUE val)
Equivalent to Kernel#String in Ruby.
VALUE rb_str_escape(VALUE str)
VALUE rb_obj_hash(VALUE obj)
VALUE rb_cTrueClass
TrueClass class.
VALUE rb_obj_untaint(VALUE obj)
call-seq: obj.untaint -> obj
VALUE rb_obj_tainted(VALUE obj)
call-seq: obj.tainted? -> false
void rb_obj_copy_ivar(VALUE dest, VALUE obj)
VALUE rb_to_int(VALUE val)
Converts val into Integer.
VALUE rb_obj_setup(VALUE obj, VALUE klass, VALUE type)
Fills common (RBasic) fields in obj.
unsigned short prefix[65536]
VALUE rb_check_hash_type(VALUE hash)
VALUE rb_hash_aref(VALUE hash, VALUE key)
VALUE rb_hash_aset(VALUE hash, VALUE key, VALUE val)
#define rb_enc_asciicompat(enc)
int rb_enc_str_asciionly_p(VALUE)
ID rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc)
Thin wrapper to ruby/config.h.
@ RB_WARN_CATEGORY_DEPRECATED
VALUE rb_funcallv_kw(VALUE, ID, int, const VALUE *, int)
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
Defines RBIMPL_HAS_BUILTIN.
int rb_is_instance_id(ID)
VALUE rb_rational_num(VALUE rat)
VALUE rb_rational_den(VALUE rat)
VALUE rb_str_concat(VALUE, VALUE)
VALUE rb_check_string_type(VALUE)
#define rb_usascii_str_new2
VALUE rb_str_subseq(VALUE, long, long)
VALUE rb_str_append(VALUE, VALUE)
VALUE rb_str_intern(VALUE)
VALUE rb_obj_as_string(VALUE)
VALUE rb_exec_recursive(VALUE(*)(VALUE, VALUE, int), VALUE, VALUE)
VALUE rb_class_name(VALUE)
VALUE rb_const_get(VALUE, ID)
VALUE rb_mod_class_variables(int, const VALUE *, VALUE)
void rb_copy_generic_ivar(VALUE, VALUE)
VALUE rb_cvar_defined(VALUE, ID)
VALUE rb_ivar_get(VALUE, ID)
st_index_t rb_ivar_count(VALUE)
int rb_const_defined_at(VALUE, ID)
void rb_cvar_set(VALUE, ID, VALUE)
VALUE rb_const_get_at(VALUE, ID)
VALUE rb_const_get_from(VALUE, ID)
VALUE rb_ivar_defined(VALUE, ID)
VALUE rb_obj_remove_instance_variable(VALUE, VALUE)
VALUE rb_cvar_get(VALUE, ID)
void rb_const_set(VALUE, ID, VALUE)
VALUE rb_mod_remove_const(VALUE, VALUE)
VALUE rb_mod_constants(int, const VALUE *, VALUE)
VALUE rb_attr_get(VALUE, ID)
int rb_const_defined_from(VALUE, ID)
VALUE rb_ivar_set(VALUE, ID, VALUE)
VALUE rb_mod_remove_cvar(VALUE, VALUE)
int rb_const_defined(VALUE, ID)
void rb_attr(VALUE, ID, int, int, int)
int rb_obj_respond_to(VALUE, ID, int)
VALUE rb_check_funcall(VALUE, ID, int, const VALUE *)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
VALUE rb_mod_module_exec(int, const VALUE *, VALUE)
void rb_undef_alloc_func(VALUE)
rb_alloc_func_t rb_get_alloc_func(VALUE)
VALUE(* rb_alloc_func_t)(VALUE)
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.
Internal header aggregating init functions.
Internal header for Array.
Internal header for Class.
Internal header for Numeric.
Internal header for Object.
#define rb_fstring_enc_lit(str, enc)
VALUE rb_fstring_new(const char *ptr, long len)
Internal header for Struct.
VALUE rb_struct_lookup(VALUE s, VALUE idx)
int rb_is_const_name(VALUE name)
int rb_is_const_sym(VALUE sym)
int rb_is_local_name(VALUE name)
VALUE rb_const_missing(VALUE klass, VALUE name)
VALUE rb_eql_opt(VALUE obj1, VALUE obj2)
VALUE rb_equal_opt(VALUE obj1, VALUE obj2)
#define RUBY_DTRACE_CREATE_HOOK(name, arg)
VALUE rb_check_funcall_with_hook_kw(VALUE recv, ID mid, int argc, const VALUE *argv, rb_check_funcall_hook *hook, VALUE arg, int kw_splat)
#define rb_method_basic_definition_p(...)
Internal header for Math.
#define MEMCPY(p1, p2, type, n)
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 ROBJECT_EMBED_LEN_MAX
#define StringValuePtr(v)
const char * rb_obj_classname(VALUE)
const char * rb_class2name(VALUE)
#define RB_INTEGER_TYPE_P(obj)
#define RB_PASS_CALLED_KEYWORDS
VALUE rb_str_catf(VALUE, const char *,...)
VALUE rb_f_sprintf(int, const VALUE *)
VALUE rb_sprintf(const char *,...)
void error(const char *msg)