41 #define id_match idEqTilde
42 #define id_inspect idInspect
43 #define id_init_copy idInitialize_copy
44 #define id_init_clone idInitialize_clone
45 #define id_init_dup idInitialize_dup
46 #define id_const_missing idConst_missing
48 #define CLASS_OR_MODULE_P(obj) \
49 (!SPECIAL_CONST_P(obj) && \
50 (BUILTIN_TYPE(obj) == T_CLASS || BUILTIN_TYPE(obj) == T_MODULE))
93 if (obj1 == obj2)
return Qtrue;
144 if (obj1 == obj2)
return Qtrue;
166 #if SIZEOF_LONG == SIZEOF_VOIDP
168 #elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
171 # error not supported
260 ROBJECT(dest)->as.heap.ivptr = 0;
261 ROBJECT(dest)->as.heap.numiv = 0;
262 ROBJECT(dest)->as.heap.iv_index_tbl = 0;
264 if (
RBASIC(obj)->flags & ROBJECT_EMBED) {
266 RBASIC(dest)->flags |= ROBJECT_EMBED;
269 long len =
ROBJECT(obj)->as.heap.numiv;
275 ROBJECT(dest)->as.heap.ivptr = ptr;
276 ROBJECT(dest)->as.heap.numiv = len;
277 ROBJECT(dest)->as.heap.iv_index_tbl =
ROBJECT(obj)->as.heap.iv_index_tbl;
278 RBASIC(dest)->flags &= ~ROBJECT_EMBED;
425 if (obj == orig)
return obj;
1014 rb_warning(
"untrusted? is deprecated and its behavior is same as tainted?");
1028 rb_warning(
"untrust is deprecated and its behavior is same as taint");
1043 rb_warning(
"trust is deprecated and its behavior is same as untaint");
1082 if (!immediate_frozen_tbl) {
1107 if (!immediate_frozen_tbl)
return Qfalse;
1443 if (obj1 == obj2 ||
rb_equal(obj1, obj2))
1489 VALUE refined_class, defined_at;
1506 if (!
NIL_P(refined_class)) {
1511 CONST_ID(id_defined_at,
"__defined_at__");
1569 if (mod == arg)
return Qtrue;
1598 if (mod == arg)
return Qfalse;
1639 if (mod == arg)
return Qfalse;
1660 if (mod == arg)
return INT2FIX(0);
1819 #if !defined(DTRACE_PROBES_DISABLED) || !DTRACE_PROBES_DISABLED
1828 obj = (*allocator)(klass);
1906 return RCLASS(klass)->super;
1909 #define id_for_setter(name, type, message) \
1910 check_setter_id(name, rb_is_##type##_id, rb_is_##type##_name, message)
1913 const char *message)
1918 if (!valid_id_p(
id)) {
1928 if (!valid_name_p(str)) {
1983 for (i=0; i<
argc; i++) {
1992 if (argc == 2 && (argv[1] ==
Qtrue || argv[1] ==
Qfalse)) {
1993 rb_warning(
"optional boolean argument is obsoleted");
2015 for (i=0; i<
argc; i++) {
2043 for (i=0; i<
argc; i++) {
2094 const char *pbeg, *p, *path, *pend;
2121 if (p >= pend || !*p) {
2127 if (p + 2 < pend && p[0] ==
':' && p[1] ==
':') {
2137 while (p < pend && *p !=
':') p++;
2139 if (pbeg == p)
goto wrong_name;
2144 if (p < pend && p[0] ==
':') {
2145 if (p + 2 >= pend || p[1] !=
':')
goto wrong_name;
2236 const char *pbeg, *p, *path, *pend;
2263 if (p >= pend || !*p) {
2269 if (p + 2 < pend && p[0] ==
':' && p[1] ==
':') {
2279 while (p < pend && *p !=
':') p++;
2281 if (pbeg == p)
goto wrong_name;
2286 if (p < pend && p[0] ==
':') {
2287 if (p + 2 >= pend || p[1] !=
':')
goto wrong_name;
2582 #define IMPLICIT_CONVERSIONS 7
2603 ?
"no implicit conversion of %s into %s"
2604 :
"can't convert %s into %s",
2605 NIL_P(val) ?
"nil" :
2606 val ==
Qtrue ?
"true" :
2607 val ==
Qfalse ?
"false" :
2621 if (
TYPE(val) == type)
return val;
2623 if (
TYPE(v) != type) {
2637 if (
TYPE(val) == type && type !=
T_DATA)
return val;
2640 if (
TYPE(v) != type) {
2696 switch (
TYPE(val)) {
2698 if (base != 0)
goto arg_error;
2707 if (base != 0)
goto arg_error;
2715 if (base != 0)
goto arg_error;
2724 if (!
NIL_P(tmp))
goto string_conv;
2789 const char *ellipsis =
"";
2791 enum {max_width = 20};
2792 #define OutOfRange() ((end - p > max_width) ? \
2793 (w = max_width, ellipsis = "...") : \
2794 (w = (int)(end - p), ellipsis = ""))
2800 if (!badcheck && p[0] ==
'0' && (p[1] ==
'x' || p[1] ==
'X')) {
2805 if (
errno == ERANGE) {
2807 rb_warning(
"Float %.*s%s out of range", w, p, ellipsis);
2820 char *e = buf +
sizeof(
buf) - 1;
2823 while (p < end && n < e) prev = *n++ = *p++;
2833 while (*++p ==
'_');
2838 if (n < e) *n++ = prev;
2843 if (!badcheck && p[0] ==
'0' && (p[1] ==
'x' || p[1] ==
'X')) {
2848 if (
errno == ERANGE) {
2850 rb_warning(
"Float %.*s%s out of range", w, p, ellipsis);
2854 if (!end || p == end)
goto bad;
2855 while (*end &&
ISSPACE(*end)) end++;
2859 if (
errno == ERANGE) {
2879 if (badcheck && memchr(s,
'\0', len)) {
2883 char *p =
ALLOCV(v, len);
2898 switch (
TYPE(val)) {
2946 NIL_P(val) ?
"nil" :
2947 val ==
Qtrue ?
"true" :
2948 val ==
Qfalse ?
"false" :
2967 switch (
TYPE(val)) {
3251 #define rb_intern(str) rb_intern_const(str)