17 #if defined(__cplusplus) 24 #include "ruby/config.h" 26 #include RUBY_EXTCONF_H 29 #if defined(__cplusplus) 32 # undef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P 33 # undef HAVE_BUILTIN___BUILTIN_TYPES_COMPATIBLE_P 40 # define ASSUME(x) (RB_LIKELY(!!(x)) ? (void)0 : UNREACHABLE) 42 # define ASSUME(x) ((void)(x)) 46 # define UNREACHABLE ((void)0) 49 #define RUBY_MACRO_SELECT(base, n) TOKEN_PASTE(base, n) 51 #ifdef HAVE_INTRINSICS_H 52 # include <intrinsics.h> 62 # define alloca __builtin_alloca 78 #if defined HAVE_UINTPTR_T && 0 81 # define SIGNED_VALUE intptr_t 82 # define SIZEOF_VALUE SIZEOF_UINTPTR_T 83 # undef PRI_VALUE_PREFIX 84 #elif SIZEOF_LONG == SIZEOF_VOIDP 86 typedef unsigned long ID;
87 # define SIGNED_VALUE long 88 # define SIZEOF_VALUE SIZEOF_LONG 89 # define PRI_VALUE_PREFIX "l" 90 #elif SIZEOF_LONG_LONG == SIZEOF_VOIDP 91 typedef unsigned LONG_LONG
VALUE;
92 typedef unsigned LONG_LONG
ID;
93 # define SIGNED_VALUE LONG_LONG 94 # define LONG_LONG_VALUE 1 95 # define SIZEOF_VALUE SIZEOF_LONG_LONG 96 # define PRI_VALUE_PREFIX PRI_LL_PREFIX 98 # error ---->> ruby requires sizeof(void*) == sizeof(long) or sizeof(LONG_LONG) to be compiled. <<---- 103 #ifdef HAVE_LONG_LONG 104 typedef char ruby_check_sizeof_long_long[SIZEOF_LONG_LONG ==
sizeof(LONG_LONG) ? 1 : -1];
108 #ifndef PRI_INT_PREFIX 109 #define PRI_INT_PREFIX "" 111 #ifndef PRI_LONG_PREFIX 112 #define PRI_LONG_PREFIX "l" 116 #define PRI_64_PREFIX PRI_LONG_PREFIX 117 #elif SIZEOF_LONG_LONG == 8 118 #define PRI_64_PREFIX PRI_LL_PREFIX 121 #define RUBY_PRI_VALUE_MARK "\v" 122 #if defined PRIdPTR && !defined PRI_VALUE_PREFIX 123 #define PRIdVALUE PRIdPTR 124 #define PRIoVALUE PRIoPTR 125 #define PRIuVALUE PRIuPTR 126 #define PRIxVALUE PRIxPTR 127 #define PRIXVALUE PRIXPTR 128 #define PRIsVALUE PRIiPTR"" RUBY_PRI_VALUE_MARK 130 #define PRIdVALUE PRI_VALUE_PREFIX"d" 131 #define PRIoVALUE PRI_VALUE_PREFIX"o" 132 #define PRIuVALUE PRI_VALUE_PREFIX"u" 133 #define PRIxVALUE PRI_VALUE_PREFIX"x" 134 #define PRIXVALUE PRI_VALUE_PREFIX"X" 135 #define PRIsVALUE PRI_VALUE_PREFIX"i" RUBY_PRI_VALUE_MARK 137 #ifndef PRI_VALUE_PREFIX 138 # define PRI_VALUE_PREFIX "" 141 #ifndef PRI_TIMET_PREFIX 142 # if SIZEOF_TIME_T == SIZEOF_INT 143 # define PRI_TIMET_PREFIX 144 # elif SIZEOF_TIME_T == SIZEOF_LONG 145 # define PRI_TIMET_PREFIX "l" 146 # elif SIZEOF_TIME_T == SIZEOF_LONG_LONG 147 # define PRI_TIMET_PREFIX PRI_LL_PREFIX 151 #if defined PRI_PTRDIFF_PREFIX 152 #elif SIZEOF_PTRDIFF_T == SIZEOF_INT 153 # define PRI_PTRDIFF_PREFIX "" 154 #elif SIZEOF_PTRDIFF_T == SIZEOF_LONG 155 # define PRI_PTRDIFF_PREFIX "l" 156 #elif SIZEOF_PTRDIFF_T == SIZEOF_LONG_LONG 157 # define PRI_PTRDIFF_PREFIX PRI_LL_PREFIX 159 #define PRIdPTRDIFF PRI_PTRDIFF_PREFIX"d" 160 #define PRIiPTRDIFF PRI_PTRDIFF_PREFIX"i" 161 #define PRIoPTRDIFF PRI_PTRDIFF_PREFIX"o" 162 #define PRIuPTRDIFF PRI_PTRDIFF_PREFIX"u" 163 #define PRIxPTRDIFF PRI_PTRDIFF_PREFIX"x" 164 #define PRIXPTRDIFF PRI_PTRDIFF_PREFIX"X" 166 #if defined PRI_SIZE_PREFIX 167 #elif SIZEOF_SIZE_T == SIZEOF_INT 168 # define PRI_SIZE_PREFIX "" 169 #elif SIZEOF_SIZE_T == SIZEOF_LONG 170 # define PRI_SIZE_PREFIX "l" 171 #elif SIZEOF_SIZE_T == SIZEOF_LONG_LONG 172 # define PRI_SIZE_PREFIX PRI_LL_PREFIX 174 #define PRIdSIZE PRI_SIZE_PREFIX"d" 175 #define PRIiSIZE PRI_SIZE_PREFIX"i" 176 #define PRIoSIZE PRI_SIZE_PREFIX"o" 177 #define PRIuSIZE PRI_SIZE_PREFIX"u" 178 #define PRIxSIZE PRI_SIZE_PREFIX"x" 179 #define PRIXSIZE PRI_SIZE_PREFIX"X" 185 # ifdef HAVE_LIMITS_H 189 # define LONG_MAX 2147483647 193 # define LONG_MIN (-LONG_MAX-1) 200 #ifdef HAVE_LONG_LONG 202 # ifdef LONG_LONG_MAX 203 # define LLONG_MAX LONG_LONG_MAX 206 # define LLONG_MAX _I64_MAX 209 # define LLONG_MAX 9223372036854775807LL 214 # ifdef LONG_LONG_MIN 215 # define LLONG_MIN LONG_LONG_MIN 218 # define LLONG_MIN _I64_MIN 220 # define LLONG_MIN (-LLONG_MAX-1) 226 #define RUBY_FIXNUM_MAX (LONG_MAX>>1) 227 #define RUBY_FIXNUM_MIN RSHIFT((long)LONG_MIN,1) 228 #define FIXNUM_MAX RUBY_FIXNUM_MAX 229 #define FIXNUM_MIN RUBY_FIXNUM_MIN 231 #define RB_INT2FIX(i) (((VALUE)(i))<<1 | RUBY_FIXNUM_FLAG) 232 #define INT2FIX(i) RB_INT2FIX(i) 233 #define RB_LONG2FIX(i) RB_INT2FIX(i) 234 #define LONG2FIX(i) RB_INT2FIX(i) 235 #define rb_fix_new(v) RB_INT2FIX(v) 238 #define rb_int_new(v) rb_int2inum(v) 241 #define rb_uint_new(v) rb_uint2inum(v) 243 #ifdef HAVE_LONG_LONG 244 VALUE rb_ll2inum(LONG_LONG);
245 #define LL2NUM(v) rb_ll2inum(v) 246 VALUE rb_ull2inum(
unsigned LONG_LONG);
247 #define ULL2NUM(v) rb_ull2inum(v) 251 #if SIZEOF_OFF_T > SIZEOF_LONG && defined(HAVE_LONG_LONG) 252 # define OFFT2NUM(v) LL2NUM(v) 253 #elif SIZEOF_OFF_T == SIZEOF_LONG 254 # define OFFT2NUM(v) LONG2NUM(v) 256 # define OFFT2NUM(v) INT2NUM(v) 260 #if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG) 261 # define SIZET2NUM(v) ULL2NUM(v) 262 # define SSIZET2NUM(v) LL2NUM(v) 263 #elif SIZEOF_SIZE_T == SIZEOF_LONG 264 # define SIZET2NUM(v) ULONG2NUM(v) 265 # define SSIZET2NUM(v) LONG2NUM(v) 267 # define SIZET2NUM(v) UINT2NUM(v) 268 # define SSIZET2NUM(v) INT2NUM(v) 272 # if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG) 273 # define SIZE_MAX ULLONG_MAX 274 # define SIZE_MIN ULLONG_MIN 275 # elif SIZEOF_SIZE_T == SIZEOF_LONG 276 # define SIZE_MAX ULONG_MAX 277 # define SIZE_MIN ULONG_MIN 278 # elif SIZEOF_SIZE_T == SIZEOF_INT 279 # define SIZE_MAX UINT_MAX 280 # define SIZE_MIN UINT_MIN 282 # define SIZE_MAX USHRT_MAX 283 # define SIZE_MIN USHRT_MIN 288 # if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG) 289 # define SSIZE_MAX LLONG_MAX 290 # define SSIZE_MIN LLONG_MIN 291 # elif SIZEOF_SIZE_T == SIZEOF_LONG 292 # define SSIZE_MAX LONG_MAX 293 # define SSIZE_MIN LONG_MIN 294 # elif SIZEOF_SIZE_T == SIZEOF_INT 295 # define SSIZE_MAX INT_MAX 296 # define SSIZE_MIN INT_MIN 298 # define SSIZE_MAX SHRT_MAX 299 # define SSIZE_MIN SHRT_MIN 303 #if SIZEOF_INT < SIZEOF_VALUE 307 #if SIZEOF_INT < SIZEOF_LONG 309 rb_long2int_inline(
long n)
317 #define rb_long2int(n) rb_long2int_inline(n) 319 #define rb_long2int(n) ((int)(n)) 323 #define PIDT2NUM(v) LONG2NUM(v) 326 #define NUM2PIDT(v) NUM2LONG(v) 329 #define UIDT2NUM(v) LONG2NUM(v) 332 #define NUM2UIDT(v) NUM2LONG(v) 335 #define GIDT2NUM(v) LONG2NUM(v) 338 #define NUM2GIDT(v) NUM2LONG(v) 341 #define NUM2MODET(v) NUM2INT(v) 344 #define MODET2NUM(v) INT2NUM(v) 347 #define RB_FIX2LONG(x) ((long)RSHIFT((SIGNED_VALUE)(x),1)) 353 #define RB_FIX2ULONG(x) ((unsigned long)RB_FIX2LONG(x)) 354 static inline unsigned long 355 rb_fix2ulong(
VALUE x)
359 #define RB_FIXNUM_P(f) (((int)(SIGNED_VALUE)(f))&RUBY_FIXNUM_FLAG) 360 #define RB_POSFIXABLE(f) ((f) < RUBY_FIXNUM_MAX+1) 361 #define RB_NEGFIXABLE(f) ((f) >= RUBY_FIXNUM_MIN) 362 #define RB_FIXABLE(f) (RB_POSFIXABLE(f) && RB_NEGFIXABLE(f)) 363 #define FIX2LONG(x) RB_FIX2LONG(x) 364 #define FIX2ULONG(x) RB_FIX2ULONG(x) 365 #define FIXNUM_P(f) RB_FIXNUM_P(f) 366 #define POSFIXABLE(f) RB_POSFIXABLE(f) 367 #define NEGFIXABLE(f) RB_NEGFIXABLE(f) 368 #define FIXABLE(f) RB_FIXABLE(f) 370 #define RB_IMMEDIATE_P(x) ((VALUE)(x) & RUBY_IMMEDIATE_MASK) 371 #define IMMEDIATE_P(x) RB_IMMEDIATE_P(x) 375 #define RB_STATIC_SYM_P(x) (((VALUE)(x)&~((~(VALUE)0)<<RUBY_SPECIAL_SHIFT)) == RUBY_SYMBOL_FLAG) 376 #define RB_DYNAMIC_SYM_P(x) (!RB_SPECIAL_CONST_P(x) && RB_BUILTIN_TYPE(x) == (RUBY_T_SYMBOL)) 377 #define RB_SYMBOL_P(x) (RB_STATIC_SYM_P(x)||RB_DYNAMIC_SYM_P(x)) 378 #define RB_ID2SYM(x) (rb_id2sym(x)) 379 #define RB_SYM2ID(x) (rb_sym2id(x)) 380 #define STATIC_SYM_P(x) RB_STATIC_SYM_P(x) 381 #define DYNAMIC_SYM_P(x) RB_DYNAMIC_SYM_P(x) 382 #define SYMBOL_P(x) RB_SYMBOL_P(x) 383 #define ID2SYM(x) RB_ID2SYM(x) 384 #define SYM2ID(x) RB_SYM2ID(x) 387 #if SIZEOF_VALUE >= SIZEOF_DOUBLE 395 #define RB_FLONUM_P(x) ((((int)(SIGNED_VALUE)(x))&RUBY_FLONUM_MASK) == RUBY_FLONUM_FLAG) 397 #define RB_FLONUM_P(x) 0 399 #define FLONUM_P(x) RB_FLONUM_P(x) 402 #define USE_SYMBOL_AS_METHOD_NAME 1 432 #define RUBY_Qfalse ((VALUE)RUBY_Qfalse) 433 #define RUBY_Qtrue ((VALUE)RUBY_Qtrue) 434 #define RUBY_Qnil ((VALUE)RUBY_Qnil) 435 #define RUBY_Qundef ((VALUE)RUBY_Qundef) 436 #define Qfalse RUBY_Qfalse 437 #define Qtrue RUBY_Qtrue 438 #define Qnil RUBY_Qnil 439 #define Qundef RUBY_Qundef 440 #define IMMEDIATE_MASK RUBY_IMMEDIATE_MASK 441 #define FIXNUM_FLAG RUBY_FIXNUM_FLAG 443 #define FLONUM_MASK RUBY_FLONUM_MASK 444 #define FLONUM_FLAG RUBY_FLONUM_FLAG 446 #define SYMBOL_FLAG RUBY_SYMBOL_FLAG 448 #define RB_TEST(v) !(((VALUE)(v) & (VALUE)~RUBY_Qnil) == 0) 449 #define RB_NIL_P(v) !((VALUE)(v) != RUBY_Qnil) 450 #define RTEST(v) RB_TEST(v) 451 #define NIL_P(v) RB_NIL_P(v) 453 #define CLASS_OF(v) rb_class_of((VALUE)(v)) 489 #define T_NONE RUBY_T_NONE 490 #define T_NIL RUBY_T_NIL 491 #define T_OBJECT RUBY_T_OBJECT 492 #define T_CLASS RUBY_T_CLASS 493 #define T_ICLASS RUBY_T_ICLASS 494 #define T_MODULE RUBY_T_MODULE 495 #define T_FLOAT RUBY_T_FLOAT 496 #define T_STRING RUBY_T_STRING 497 #define T_REGEXP RUBY_T_REGEXP 498 #define T_ARRAY RUBY_T_ARRAY 499 #define T_HASH RUBY_T_HASH 500 #define T_STRUCT RUBY_T_STRUCT 501 #define T_BIGNUM RUBY_T_BIGNUM 502 #define T_FILE RUBY_T_FILE 503 #define T_FIXNUM RUBY_T_FIXNUM 504 #define T_TRUE RUBY_T_TRUE 505 #define T_FALSE RUBY_T_FALSE 506 #define T_DATA RUBY_T_DATA 507 #define T_MATCH RUBY_T_MATCH 508 #define T_SYMBOL RUBY_T_SYMBOL 509 #define T_RATIONAL RUBY_T_RATIONAL 510 #define T_COMPLEX RUBY_T_COMPLEX 511 #define T_IMEMO RUBY_T_IMEMO 512 #define T_UNDEF RUBY_T_UNDEF 513 #define T_NODE RUBY_T_NODE 514 #define T_ZOMBIE RUBY_T_ZOMBIE 515 #define T_MASK RUBY_T_MASK 517 #define RB_BUILTIN_TYPE(x) (int)(((struct RBasic*)(x))->flags & RUBY_T_MASK) 518 #define BUILTIN_TYPE(x) RB_BUILTIN_TYPE(x) 520 static inline int rb_type(
VALUE obj);
521 #define TYPE(x) rb_type((VALUE)(x)) 523 #define RB_FLOAT_TYPE_P(obj) (\ 524 RB_FLONUM_P(obj) || \ 525 (!RB_SPECIAL_CONST_P(obj) && RB_BUILTIN_TYPE(obj) == RUBY_T_FLOAT)) 527 #define RB_TYPE_P(obj, type) ( \ 528 ((type) == RUBY_T_FIXNUM) ? RB_FIXNUM_P(obj) : \ 529 ((type) == RUBY_T_TRUE) ? ((obj) == RUBY_Qtrue) : \ 530 ((type) == RUBY_T_FALSE) ? ((obj) == RUBY_Qfalse) : \ 531 ((type) == RUBY_T_NIL) ? ((obj) == RUBY_Qnil) : \ 532 ((type) == RUBY_T_UNDEF) ? ((obj) == RUBY_Qundef) : \ 533 ((type) == RUBY_T_SYMBOL) ? RB_SYMBOL_P(obj) : \ 534 ((type) == RUBY_T_FLOAT) ? RB_FLOAT_TYPE_P(obj) : \ 535 (!RB_SPECIAL_CONST_P(obj) && RB_BUILTIN_TYPE(obj) == (type))) 538 #define RB_GC_GUARD(v) \ 540 volatile VALUE *rb_gc_guarded_ptr = &(v); \ 541 __asm__("" : : "m"(rb_gc_guarded_ptr)); \ 544 #elif defined _MSC_VER 545 #pragma optimize("", off) 546 static inline volatile VALUE *rb_gc_guarded_ptr(
volatile VALUE *ptr) {
return ptr;}
547 #pragma optimize("", on) 548 #define RB_GC_GUARD(v) (*rb_gc_guarded_ptr(&(v))) 551 #define HAVE_RB_GC_GUARDED_PTR_VAL 1 552 #define RB_GC_GUARD(v) (*rb_gc_guarded_ptr_val(&(v),(v))) 556 #define RB_UNUSED_VAR(x) x __attribute__ ((unused)) 558 #define RB_UNUSED_VAR(x) x 562 #define Check_Type(v,t) rb_check_type((VALUE)(v),(t)) 569 #define StringValue(v) rb_string_value(&(v)) 570 #define StringValuePtr(v) rb_string_value_ptr(&(v)) 571 #define StringValueCStr(v) rb_string_value_cstr(&(v)) 574 #define SafeStringValue(v) do {\ 576 rb_check_safe_obj(v);\ 578 #if GCC_VERSION_SINCE(4,4,0) 579 void rb_check_safe_str(
VALUE) __attribute__((error(
"rb_check_safe_str() and Check_SafeStr() are obsolete; use SafeStringValue() instead")));
580 # define Check_SafeStr(v) rb_check_safe_str((VALUE)(v)) 582 # define rb_check_safe_str(x) [<"rb_check_safe_str() is obsolete; use SafeStringValue() instead">] 583 # define Check_SafeStr(v) [<"Check_SafeStr() is obsolete; use SafeStringValue() instead">] 587 #define ExportStringValue(v) do {\ 589 (v) = rb_str_export(v);\ 594 #define FilePathValue(v) (RB_GC_GUARD(v) = rb_get_path(v)) 597 #define FilePathStringValue(v) ((v) = rb_get_path_no_checksafe(v)) 599 #define RUBY_SAFE_LEVEL_MAX 1 603 #if GCC_VERSION_SINCE(4,4,0) 604 int ruby_safe_level_2_error(
void) __attribute__((error(
"$SAFE=2 to 4 are obsolete")));
607 # define ruby_safe_level_2_warning() ruby_safe_level_2_error() 609 # if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P) 610 # define RUBY_SAFE_LEVEL_INVALID_P(level) \ 612 __builtin_choose_expr(\ 613 __builtin_constant_p(level), \ 614 ((level) < 0 || RUBY_SAFE_LEVEL_MAX < (level)), 0)) 615 # define RUBY_SAFE_LEVEL_CHECK(level, type) \ 616 __extension__(__builtin_choose_expr(RUBY_SAFE_LEVEL_INVALID_P(level), ruby_safe_level_2_##type(), (level))) 621 # define RUBY_SAFE_LEVEL_INVALID_P(level) \ 622 __extension__(__builtin_constant_p(level) && \ 623 ((level) < 0 || RUBY_SAFE_LEVEL_MAX < (level))) 624 # define RUBY_SAFE_LEVEL_CHECK(level, type) \ 625 (RUBY_SAFE_LEVEL_INVALID_P(level) ? ruby_safe_level_2_##type() : (level)) 627 # define rb_secure(level) rb_secure(RUBY_SAFE_LEVEL_CHECK(level, warning)) 628 # define rb_set_safe_level(level) rb_set_safe_level(RUBY_SAFE_LEVEL_CHECK(level, error)) 640 rb_num2long_inline(
VALUE x)
647 #define RB_NUM2LONG(x) rb_num2long_inline(x) 648 #define NUM2LONG(x) RB_NUM2LONG(x) 649 static inline unsigned long 650 rb_num2ulong_inline(
VALUE x)
657 #define RB_NUM2ULONG(x) rb_num2ulong_inline(x) 658 #define NUM2ULONG(x) RB_NUM2ULONG(x) 659 #if SIZEOF_INT < SIZEOF_LONG 662 #define RB_FIX2INT(x) ((int)rb_fix2int((VALUE)(x))) 665 rb_num2int_inline(
VALUE x)
672 #define RB_NUM2INT(x) rb_num2int_inline(x) 674 unsigned long rb_num2uint(
VALUE);
675 #define RB_NUM2UINT(x) ((unsigned int)rb_num2uint(x)) 676 unsigned long rb_fix2uint(
VALUE);
677 #define RB_FIX2UINT(x) ((unsigned int)rb_fix2uint(x)) 679 #define RB_NUM2INT(x) ((int)RB_NUM2LONG(x)) 680 #define RB_NUM2UINT(x) ((unsigned int)RB_NUM2ULONG(x)) 681 #define RB_FIX2INT(x) ((int)RB_FIX2LONG(x)) 682 #define RB_FIX2UINT(x) ((unsigned int)RB_FIX2ULONG(x)) 684 #define NUM2INT(x) RB_NUM2INT(x) 685 #define NUM2UINT(x) RB_NUM2UINT(x) 686 #define FIX2INT(x) RB_FIX2INT(x) 687 #define FIX2UINT(x) RB_FIX2UINT(x) 693 #define RB_FIX2SHORT(x) (rb_fix2short((VALUE)(x))) 694 #define FIX2SHORT(x) RB_FIX2SHORT(x) 696 rb_num2short_inline(
VALUE x)
704 #define RB_NUM2SHORT(x) rb_num2short_inline(x) 705 #define RB_NUM2USHORT(x) rb_num2ushort(x) 706 #define NUM2SHORT(x) RB_NUM2SHORT(x) 707 #define NUM2USHORT(x) RB_NUM2USHORT(x) 709 #ifdef HAVE_LONG_LONG 710 LONG_LONG rb_num2ll(
VALUE);
711 unsigned LONG_LONG rb_num2ull(
VALUE);
712 static inline LONG_LONG
713 rb_num2ll_inline(
VALUE x)
720 # define RB_NUM2LL(x) rb_num2ll_inline(x) 721 # define RB_NUM2ULL(x) rb_num2ull(x) 722 # define NUM2LL(x) RB_NUM2LL(x) 723 # define NUM2ULL(x) RB_NUM2ULL(x) 726 #if !defined(NUM2OFFT) 727 # if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T > SIZEOF_LONG 728 # define NUM2OFFT(x) ((off_t)NUM2LL(x)) 730 # define NUM2OFFT(x) NUM2LONG(x) 734 #if defined(HAVE_LONG_LONG) && SIZEOF_SIZE_T > SIZEOF_LONG 735 # define NUM2SIZET(x) ((size_t)NUM2ULL(x)) 736 # define NUM2SSIZET(x) ((ssize_t)NUM2LL(x)) 738 # define NUM2SIZET(x) NUM2ULONG(x) 739 # define NUM2SSIZET(x) NUM2LONG(x) 743 #define NUM2DBL(x) rb_num2dbl((VALUE)(x)) 751 #define RB_NEWOBJ(obj,type) type *(obj) = (type*)rb_newobj() 752 #define RB_NEWOBJ_OF(obj,type,klass,flags) type *(obj) = (type*)rb_newobj_of(klass, flags) 753 #define NEWOBJ(obj,type) RB_NEWOBJ(obj,type) 754 #define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags) 755 #define OBJSETUP(obj,c,t) rb_obj_setup(obj, c, t) 756 #define CLONESETUP(clone,obj) rb_clone_setup(clone,obj) 757 #define DUPSETUP(dup,obj) rb_dup_setup(dup,obj) 770 #ifndef RGENGC_WB_PROTECTED_ARRAY 771 #define RGENGC_WB_PROTECTED_ARRAY 1 773 #ifndef RGENGC_WB_PROTECTED_HASH 774 #define RGENGC_WB_PROTECTED_HASH 1 776 #ifndef RGENGC_WB_PROTECTED_STRUCT 777 #define RGENGC_WB_PROTECTED_STRUCT 1 779 #ifndef RGENGC_WB_PROTECTED_STRING 780 #define RGENGC_WB_PROTECTED_STRING 1 782 #ifndef RGENGC_WB_PROTECTED_OBJECT 783 #define RGENGC_WB_PROTECTED_OBJECT 1 785 #ifndef RGENGC_WB_PROTECTED_REGEXP 786 #define RGENGC_WB_PROTECTED_REGEXP 1 788 #ifndef RGENGC_WB_PROTECTED_CLASS 789 #define RGENGC_WB_PROTECTED_CLASS 1 791 #ifndef RGENGC_WB_PROTECTED_FLOAT 792 #define RGENGC_WB_PROTECTED_FLOAT 1 794 #ifndef RGENGC_WB_PROTECTED_COMPLEX 795 #define RGENGC_WB_PROTECTED_COMPLEX 1 797 #ifndef RGENGC_WB_PROTECTED_RATIONAL 798 #define RGENGC_WB_PROTECTED_RATIONAL 1 800 #ifndef RGENGC_WB_PROTECTED_BIGNUM 801 #define RGENGC_WB_PROTECTED_BIGNUM 1 803 #ifndef RGENGC_WB_PROTECTED_NODE_CREF 804 #define RGENGC_WB_PROTECTED_NODE_CREF 1 843 #if defined ENUM_OVER_INT || SIZEOF_INT*CHAR_BIT>12+19+1 846 #define RUBY_FL_USER19 (((VALUE)1)<<(RUBY_FL_USHIFT+19)) 859 __attribute__((aligned(
sizeof(
VALUE))))
866 #if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P) 867 # define RB_OBJ_WB_UNPROTECT_FOR(type, obj) \ 869 __builtin_choose_expr( \ 870 RGENGC_WB_PROTECTED_##type, \ 871 OBJ_WB_UNPROTECT((VALUE)(obj)), ((VALUE)(obj)))) 873 # define RB_OBJ_WB_UNPROTECT_FOR(type, obj) \ 874 (RGENGC_WB_PROTECTED_##type ? \ 875 OBJ_WB_UNPROTECT((VALUE)(obj)) : ((VALUE)(obj))) 878 #define RBASIC_CLASS(obj) (RBASIC(obj)->klass) 880 #define ROBJECT_EMBED_LEN_MAX ROBJECT_EMBED_LEN_MAX 881 #define ROBJECT_EMBED ROBJECT_EMBED 900 #define ROBJECT_NUMIV(o) \ 901 ((RBASIC(o)->flags & ROBJECT_EMBED) ? \ 902 ROBJECT_EMBED_LEN_MAX : \ 903 ROBJECT(o)->as.heap.numiv) 904 #define ROBJECT_IVPTR(o) \ 905 ((RBASIC(o)->flags & ROBJECT_EMBED) ? \ 906 ROBJECT(o)->as.ary : \ 907 ROBJECT(o)->as.heap.ivptr) 908 #define ROBJECT_IV_INDEX_TBL(o) \ 909 ((RBASIC(o)->flags & ROBJECT_EMBED) ? \ 910 RCLASS_IV_INDEX_TBL(rb_obj_class(o)) : \ 911 ROBJECT(o)->as.heap.iv_index_tbl) 913 #define RCLASS_SUPER(c) rb_class_get_superclass(c) 914 #define RMODULE_IV_TBL(m) RCLASS_IV_TBL(m) 915 #define RMODULE_CONST_TBL(m) RCLASS_CONST_TBL(m) 916 #define RMODULE_M_TBL(m) RCLASS_M_TBL(m) 917 #define RMODULE_SUPER(m) RCLASS_SUPER(m) 918 #define RMODULE_IS_OVERLAID RMODULE_IS_OVERLAID 919 #define RMODULE_IS_REFINEMENT RMODULE_IS_REFINEMENT 920 #define RMODULE_INCLUDED_INTO_REFINEMENT RMODULE_INCLUDED_INTO_REFINEMENT 933 #define RFLOAT_VALUE(v) rb_float_value(v) 934 #define DBL2NUM(dbl) rb_float_new(dbl) 936 #define RUBY_ELTS_SHARED RUBY_ELTS_SHARED 937 #define ELTS_SHARED RUBY_ELTS_SHARED 939 #define RSTRING_NOEMBED RSTRING_NOEMBED 940 #define RSTRING_EMBED_LEN_MASK RSTRING_EMBED_LEN_MASK 941 #define RSTRING_EMBED_LEN_SHIFT RSTRING_EMBED_LEN_SHIFT 942 #define RSTRING_EMBED_LEN_MAX RSTRING_EMBED_LEN_MAX 943 #define RSTRING_FSTR RSTRING_FSTR 947 RUBY_FL_USER5|RUBY_FL_USER6),
968 #define RSTRING_EMBED_LEN(str) \ 969 (long)((RBASIC(str)->flags >> RSTRING_EMBED_LEN_SHIFT) & \ 970 (RSTRING_EMBED_LEN_MASK >> RSTRING_EMBED_LEN_SHIFT)) 971 #define RSTRING_LEN(str) \ 972 (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \ 973 RSTRING_EMBED_LEN(str) : \ 974 RSTRING(str)->as.heap.len) 975 #define RSTRING_PTR(str) \ 976 (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \ 977 RSTRING(str)->as.ary : \ 978 RSTRING(str)->as.heap.ptr) 979 #define RSTRING_END(str) \ 980 (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \ 981 (RSTRING(str)->as.ary + RSTRING_EMBED_LEN(str)) : \ 982 (RSTRING(str)->as.heap.ptr + RSTRING(str)->as.heap.len)) 983 #define RSTRING_LENINT(str) rb_long2int(RSTRING_LEN(str)) 984 #define RSTRING_GETMEM(str, ptrvar, lenvar) \ 985 (!(RBASIC(str)->flags & RSTRING_NOEMBED) ? \ 986 ((ptrvar) = RSTRING(str)->as.ary, (lenvar) = RSTRING_EMBED_LEN(str)) : \ 987 ((ptrvar) = RSTRING(str)->as.heap.ptr, (lenvar) = RSTRING(str)->as.heap.len)) 998 #define RARRAY_EMBED_FLAG (VALUE)RARRAY_EMBED_FLAG 999 #define RARRAY_EMBED_LEN_MASK (VALUE)RARRAY_EMBED_LEN_MASK 1000 #define RARRAY_EMBED_LEN_MAX RARRAY_EMBED_LEN_MAX 1001 #define RARRAY_EMBED_LEN_SHIFT RARRAY_EMBED_LEN_SHIFT 1016 #define RARRAY_EMBED_LEN(a) \ 1017 (long)((RBASIC(a)->flags >> RARRAY_EMBED_LEN_SHIFT) & \ 1018 (RARRAY_EMBED_LEN_MASK >> RARRAY_EMBED_LEN_SHIFT)) 1019 #define RARRAY_LEN(a) rb_array_len(a) 1020 #define RARRAY_LENINT(ary) rb_long2int(RARRAY_LEN(ary)) 1021 #define RARRAY_CONST_PTR(a) rb_array_const_ptr(a) 1023 #define RARRAY_PTR_USE_START(a) ((VALUE *)RARRAY_CONST_PTR(a)) 1024 #define RARRAY_PTR_USE_END(a) 1026 #define RARRAY_PTR_USE(ary, ptr_name, expr) do { \ 1027 const VALUE _ary = (ary); \ 1028 VALUE *ptr_name = (VALUE *)RARRAY_PTR_USE_START(_ary); \ 1030 RARRAY_PTR_USE_END(_ary); \ 1033 #define RARRAY_AREF(a, i) (RARRAY_CONST_PTR(a)[i]) 1034 #define RARRAY_ASET(a, i, v) do { \ 1035 const VALUE _ary = (a); \ 1036 VALUE *ptr = (VALUE *)RARRAY_PTR_USE_START(_ary); \ 1037 RB_OBJ_WRITE(_ary, &ptr[i], (v)); \ 1038 RARRAY_PTR_USE_END(_ary); \ 1041 #define RARRAY_PTR(a) ((VALUE *)RARRAY_CONST_PTR(RB_OBJ_WB_UNPROTECT_FOR(ARRAY, a))) 1049 #define RREGEXP_PTR(r) (RREGEXP(r)->ptr) 1050 #define RREGEXP_SRC(r) (RREGEXP(r)->src) 1051 #define RREGEXP_SRC_PTR(r) RSTRING_PTR(RREGEXP(r)->src) 1052 #define RREGEXP_SRC_LEN(r) RSTRING_LEN(RREGEXP(r)->src) 1053 #define RREGEXP_SRC_END(r) RSTRING_END(RREGEXP(r)->src) 1056 #define RHASH_TBL(h) rb_hash_tbl(h) 1057 #define RHASH_ITER_LEV(h) rb_hash_iter_lev(h) 1058 #define RHASH_IFNONE(h) rb_hash_ifnone(h) 1059 #define RHASH_SIZE(h) NUM2SIZET(rb_hash_size(h)) 1060 #define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0) 1061 #define RHASH_SET_IFNONE(h, ifnone) rb_hash_set_ifnone((VALUE)h, ifnone) 1068 #define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r)) 1069 #define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i)) 1073 void (*dmark)(
void*);
1074 void (*dfree)(
void*);
1083 void (*dmark)(
void*);
1084 void (*dfree)(
void*);
1085 size_t (*dsize)(
const void *);
1095 #define HAVE_TYPE_RB_DATA_TYPE_T 1 1096 #define HAVE_RB_DATA_TYPE_T_FUNCTION 1 1097 #define HAVE_RB_DATA_TYPE_T_PARENT 1 1106 #define DATA_PTR(dta) (RDATA(dta)->data) 1108 #define RTYPEDDATA_P(v) (RTYPEDDATA(v)->typed_flag == 1) 1109 #define RTYPEDDATA_TYPE(v) (RTYPEDDATA(v)->type) 1110 #define RTYPEDDATA_DATA(v) (RTYPEDDATA(v)->data) 1117 #ifndef RUBY_UNTYPED_DATA_WARNING 1118 # if defined RUBY_EXPORT 1119 # define RUBY_UNTYPED_DATA_WARNING 1 1121 # define RUBY_UNTYPED_DATA_WARNING 0 1131 #define Check_TypedStruct(v,t) rb_check_typeddata((VALUE)(v),(t)) 1132 #define RUBY_DEFAULT_FREE ((RUBY_DATA_FUNC)-1) 1133 #define RUBY_NEVER_FREE ((RUBY_DATA_FUNC)0) 1134 #define RUBY_TYPED_DEFAULT_FREE RUBY_DEFAULT_FREE 1135 #define RUBY_TYPED_NEVER_FREE RUBY_NEVER_FREE 1138 #define RUBY_TYPED_FREE_IMMEDIATELY 1 1139 #define RUBY_TYPED_WB_PROTECTED RUBY_FL_WB_PROTECTED 1140 #define RUBY_TYPED_PROMOTED1 RUBY_FL_PROMOTED1 1142 #define Data_Wrap_Struct(klass,mark,free,sval)\ 1143 rb_data_object_wrap((klass),(sval),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free)) 1145 #define Data_Make_Struct0(result, klass, type, size, mark, free, sval) \ 1146 VALUE result = rb_data_object_zalloc((klass), (size), \ 1147 (RUBY_DATA_FUNC)(mark), \ 1148 (RUBY_DATA_FUNC)(free)); \ 1149 (void)((sval) = (type *)DATA_PTR(result)); 1152 #define Data_Make_Struct(klass,type,mark,free,sval) ({\ 1153 Data_Make_Struct0(data_struct_obj, klass, type, sizeof(type), mark, free, sval); \ 1157 #define Data_Make_Struct(klass,type,mark,free,sval) (\ 1158 rb_data_object_make((klass),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free),(void **)&(sval),sizeof(type)) \ 1162 #define TypedData_Wrap_Struct(klass,data_type,sval)\ 1163 rb_data_typed_object_wrap((klass),(sval),(data_type)) 1165 #define TypedData_Make_Struct0(result, klass, type, size, data_type, sval) \ 1166 VALUE result = rb_data_typed_object_zalloc(klass, size, data_type); \ 1167 (void)((sval) = (type *)DATA_PTR(result)); 1170 #define TypedData_Make_Struct(klass, type, data_type, sval) ({\ 1171 TypedData_Make_Struct0(data_struct_obj, klass, type, sizeof(type), data_type, sval); \ 1175 #define TypedData_Make_Struct(klass, type, data_type, sval) (\ 1176 rb_data_typed_object_make((klass),(data_type),(void **)&(sval),sizeof(type)) \ 1180 #define Data_Get_Struct(obj,type,sval) \ 1181 ((sval) = (type*)rb_data_object_get(obj)) 1183 #define TypedData_Get_Struct(obj,type,data_type,sval) \ 1184 ((sval) = (type*)rb_check_typeddata((obj), (data_type))) 1186 #define RSTRUCT_LEN(st) NUM2LONG(rb_struct_size(st)) 1187 #define RSTRUCT_PTR(st) rb_struct_ptr(st) 1188 #define RSTRUCT_SET(st, idx, v) rb_struct_aset(st, INT2NUM(idx), (v)) 1189 #define RSTRUCT_GET(st, idx) rb_struct_aref(st, INT2NUM(idx)) 1192 #define RBIGNUM_SIGN(b) (rb_big_sign(b)) 1193 #define RBIGNUM_POSITIVE_P(b) (RBIGNUM_SIGN(b)!=0) 1194 #define RBIGNUM_NEGATIVE_P(b) (RBIGNUM_SIGN(b)==0) 1196 #define R_CAST(st) (struct st*) 1197 #define RBASIC(obj) (R_CAST(RBasic)(obj)) 1198 #define ROBJECT(obj) (R_CAST(RObject)(obj)) 1199 #define RCLASS(obj) (R_CAST(RClass)(obj)) 1200 #define RMODULE(obj) RCLASS(obj) 1201 #define RSTRING(obj) (R_CAST(RString)(obj)) 1202 #define RREGEXP(obj) (R_CAST(RRegexp)(obj)) 1203 #define RARRAY(obj) (R_CAST(RArray)(obj)) 1204 #define RDATA(obj) (R_CAST(RData)(obj)) 1205 #define RTYPEDDATA(obj) (R_CAST(RTypedData)(obj)) 1206 #define RFILE(obj) (R_CAST(RFile)(obj)) 1208 #define FL_SINGLETON ((VALUE)RUBY_FL_SINGLETON) 1209 #define FL_WB_PROTECTED ((VALUE)RUBY_FL_WB_PROTECTED) 1210 #define FL_PROMOTED0 ((VALUE)RUBY_FL_PROMOTED0) 1211 #define FL_PROMOTED1 ((VALUE)RUBY_FL_PROMOTED1) 1212 #define FL_FINALIZE ((VALUE)RUBY_FL_FINALIZE) 1213 #define FL_TAINT ((VALUE)RUBY_FL_TAINT) 1214 #define FL_UNTRUSTED ((VALUE)RUBY_FL_UNTRUSTED) 1215 #define FL_EXIVAR ((VALUE)RUBY_FL_EXIVAR) 1216 #define FL_FREEZE ((VALUE)RUBY_FL_FREEZE) 1218 #define FL_USHIFT ((VALUE)RUBY_FL_USHIFT) 1220 #define FL_USER0 ((VALUE)RUBY_FL_USER0) 1221 #define FL_USER1 ((VALUE)RUBY_FL_USER1) 1222 #define FL_USER2 ((VALUE)RUBY_FL_USER2) 1223 #define FL_USER3 ((VALUE)RUBY_FL_USER3) 1224 #define FL_USER4 ((VALUE)RUBY_FL_USER4) 1225 #define FL_USER5 ((VALUE)RUBY_FL_USER5) 1226 #define FL_USER6 ((VALUE)RUBY_FL_USER6) 1227 #define FL_USER7 ((VALUE)RUBY_FL_USER7) 1228 #define FL_USER8 ((VALUE)RUBY_FL_USER8) 1229 #define FL_USER9 ((VALUE)RUBY_FL_USER9) 1230 #define FL_USER10 ((VALUE)RUBY_FL_USER10) 1231 #define FL_USER11 ((VALUE)RUBY_FL_USER11) 1232 #define FL_USER12 ((VALUE)RUBY_FL_USER12) 1233 #define FL_USER13 ((VALUE)RUBY_FL_USER13) 1234 #define FL_USER14 ((VALUE)RUBY_FL_USER14) 1235 #define FL_USER15 ((VALUE)RUBY_FL_USER15) 1236 #define FL_USER16 ((VALUE)RUBY_FL_USER16) 1237 #define FL_USER17 ((VALUE)RUBY_FL_USER17) 1238 #define FL_USER18 ((VALUE)RUBY_FL_USER18) 1239 #define FL_USER19 ((VALUE)RUBY_FL_USER19) 1241 #define RB_SPECIAL_CONST_P(x) (RB_IMMEDIATE_P(x) || !RB_TEST(x)) 1242 #define SPECIAL_CONST_P(x) RB_SPECIAL_CONST_P(x) 1244 #define RB_FL_ABLE(x) (!RB_SPECIAL_CONST_P(x) && RB_BUILTIN_TYPE(x) != RUBY_T_NODE) 1245 #define RB_FL_TEST_RAW(x,f) (RBASIC(x)->flags&(f)) 1246 #define RB_FL_TEST(x,f) (RB_FL_ABLE(x)?RB_FL_TEST_RAW((x),(f)):0) 1247 #define RB_FL_ANY_RAW(x,f) RB_FL_TEST_RAW((x),(f)) 1248 #define RB_FL_ANY(x,f) RB_FL_TEST((x),(f)) 1249 #define RB_FL_ALL_RAW(x,f) (RB_FL_TEST_RAW((x),(f)) == (f)) 1250 #define RB_FL_ALL(x,f) (RB_FL_TEST((x),(f)) == (f)) 1251 #define RB_FL_SET_RAW(x,f) (void)(RBASIC(x)->flags |= (f)) 1252 #define RB_FL_SET(x,f) (RB_FL_ABLE(x) ? RB_FL_SET_RAW(x, f) : (void)0) 1253 #define RB_FL_UNSET_RAW(x,f) (void)(RBASIC(x)->flags &= ~(VALUE)(f)) 1254 #define RB_FL_UNSET(x,f) (RB_FL_ABLE(x) ? RB_FL_UNSET_RAW(x, f) : (void)0) 1255 #define RB_FL_REVERSE_RAW(x,f) (void)(RBASIC(x)->flags ^= (f)) 1256 #define RB_FL_REVERSE(x,f) (RB_FL_ABLE(x) ? RB_FL_REVERSE_RAW(x, f) : (void)0) 1258 #define RB_OBJ_TAINTABLE(x) (RB_FL_ABLE(x) && RB_BUILTIN_TYPE(x) != RUBY_T_BIGNUM && RB_BUILTIN_TYPE(x) != RUBY_T_FLOAT) 1259 #define RB_OBJ_TAINTED_RAW(x) RB_FL_TEST_RAW(x, RUBY_FL_TAINT) 1260 #define RB_OBJ_TAINTED(x) (!!RB_FL_TEST((x), RUBY_FL_TAINT)) 1261 #define RB_OBJ_TAINT_RAW(x) RB_FL_SET_RAW(x, RUBY_FL_TAINT) 1262 #define RB_OBJ_TAINT(x) (RB_OBJ_TAINTABLE(x) ? RB_OBJ_TAINT_RAW(x) : (void)0) 1263 #define RB_OBJ_UNTRUSTED(x) RB_OBJ_TAINTED(x) 1264 #define RB_OBJ_UNTRUST(x) RB_OBJ_TAINT(x) 1265 #define RB_OBJ_INFECT_RAW(x,s) RB_FL_SET_RAW(x, RB_OBJ_TAINTED_RAW(s)) 1266 #define RB_OBJ_INFECT(x,s) ( \ 1267 (RB_OBJ_TAINTABLE(x) && RB_FL_ABLE(s)) ? \ 1268 RB_OBJ_INFECT_RAW(x, s) : (void)0) 1270 #define RB_OBJ_FROZEN_RAW(x) (RBASIC(x)->flags&RUBY_FL_FREEZE) 1271 #define RB_OBJ_FROZEN(x) (!RB_FL_ABLE(x) || RB_OBJ_FROZEN_RAW(x)) 1272 #define RB_OBJ_FREEZE_RAW(x) (void)(RBASIC(x)->flags |= RUBY_FL_FREEZE) 1273 #define RB_OBJ_FREEZE(x) rb_obj_freeze_inline((VALUE)x) 1280 #define FL_ABLE(x) RB_FL_ABLE(x) 1281 #define FL_TEST_RAW(x,f) RB_FL_TEST_RAW(x,f) 1282 #define FL_TEST(x,f) RB_FL_TEST(x,f) 1283 #define FL_ANY_RAW(x,f) RB_FL_ANY_RAW(x,f) 1284 #define FL_ANY(x,f) RB_FL_ANY(x,f) 1285 #define FL_ALL_RAW(x,f) RB_FL_ALL_RAW(x,f) 1286 #define FL_ALL(x,f) RB_FL_ALL(x,f) 1287 #define FL_SET_RAW(x,f) RB_FL_SET_RAW(x,f) 1288 #define FL_SET(x,f) RB_FL_SET(x,f) 1289 #define FL_UNSET_RAW(x,f) RB_FL_UNSET_RAW(x,f) 1290 #define FL_UNSET(x,f) RB_FL_UNSET(x,f) 1291 #define FL_REVERSE_RAW(x,f) RB_FL_REVERSE_RAW(x,f) 1292 #define FL_REVERSE(x,f) RB_FL_REVERSE(x,f) 1294 #define OBJ_TAINTABLE(x) RB_OBJ_TAINTABLE(x) 1295 #define OBJ_TAINTED_RAW(x) RB_OBJ_TAINTED_RAW(x) 1296 #define OBJ_TAINTED(x) RB_OBJ_TAINTED(x) 1297 #define OBJ_TAINT_RAW(x) RB_OBJ_TAINT_RAW(x) 1298 #define OBJ_TAINT(x) RB_OBJ_TAINT(x) 1299 #define OBJ_UNTRUSTED(x) RB_OBJ_UNTRUSTED(x) 1300 #define OBJ_UNTRUST(x) RB_OBJ_UNTRUST(x) 1301 #define OBJ_INFECT_RAW(x,s) RB_OBJ_INFECT_RAW(x,s) 1302 #define OBJ_INFECT(x,s) RB_OBJ_INFECT(x,s) 1303 #define OBJ_FROZEN_RAW(x) RB_OBJ_FROZEN_RAW(x) 1304 #define OBJ_FROZEN(x) RB_OBJ_FROZEN(x) 1305 #define OBJ_FREEZE_RAW(x) RB_OBJ_FREEZE_RAW(x) 1306 #define OBJ_FREEZE(x) RB_OBJ_FREEZE(x) 1313 rb_obj_freeze_inline(
VALUE x)
1323 #if GCC_VERSION_SINCE(4,4,0) 1324 # define RUBY_UNTYPED_DATA_FUNC(func) func __attribute__((warning("untyped Data is unsafe; use TypedData instead"))) 1326 # define RUBY_UNTYPED_DATA_FUNC(func) DEPRECATED(func) 1329 #if defined(__GNUC__) && !defined(__NO_INLINE__) 1330 #if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P) 1341 #if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P) 1342 #define rb_data_object_wrap_warning(klass, ptr, mark, free) \ 1344 __builtin_choose_expr( \ 1345 __builtin_constant_p(klass) && !(klass), \ 1346 rb_data_object_wrap(klass, ptr, mark, free), \ 1347 rb_data_object_wrap_warning(klass, ptr, mark, free))) 1351 static inline void *
1352 rb_data_object_get(
VALUE obj)
1355 return ((
struct RData *)obj)->data;
1358 #if defined(__GNUC__) && !defined(__NO_INLINE__) 1359 static inline void *
1360 rb_data_object_get_warning(
VALUE obj)
1362 return rb_data_object_get(obj);
1380 #ifndef rb_data_object_alloc 1389 #ifndef rb_data_typed_object_alloc 1398 #if defined(__GNUC__) && !defined(__NO_INLINE__) 1399 #define rb_data_object_wrap_0 rb_data_object_wrap 1400 #define rb_data_object_wrap_1 rb_data_object_wrap_warning 1401 #define rb_data_object_wrap RUBY_MACRO_SELECT(rb_data_object_wrap_, RUBY_UNTYPED_DATA_WARNING) 1402 #define rb_data_object_get_0 rb_data_object_get 1403 #define rb_data_object_get_1 rb_data_object_get_warning 1404 #define rb_data_object_get RUBY_MACRO_SELECT(rb_data_object_get_, RUBY_UNTYPED_DATA_WARNING) 1405 #define rb_data_object_make_0 rb_data_object_make 1406 #define rb_data_object_make_1 rb_data_object_make_warning 1407 #define rb_data_object_make RUBY_MACRO_SELECT(rb_data_object_make_, RUBY_UNTYPED_DATA_WARNING) 1411 #define RB_OBJ_PROMOTED_RAW(x) RB_FL_ALL_RAW(x, RUBY_FL_PROMOTED) 1412 #define RB_OBJ_PROMOTED(x) (RB_SPECIAL_CONST_P(x) ? 0 : RB_OBJ_PROMOTED_RAW(x)) 1413 #define RB_OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__) 1419 #define RB_OBJ_PROMOTED(x) 0 1420 #define RB_OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__) 1422 #define OBJ_PROMOTED_RAW(x) RB_OBJ_PROMOTED_RAW(x) 1423 #define OBJ_PROMOTED(x) RB_OBJ_PROMOTED(x) 1424 #define OBJ_WB_UNPROTECT(x) RB_OBJ_WB_UNPROTECT(x) 1437 #define RB_OBJ_WRITE(a, slot, b) rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), __FILE__, __LINE__) 1438 #define RB_OBJ_WRITTEN(a, oldv, b) rb_obj_written((VALUE)(a), (VALUE)(oldv), (VALUE)(b), __FILE__, __LINE__) 1440 #ifndef USE_RGENGC_LOGGING_WB_UNPROTECT 1441 #define USE_RGENGC_LOGGING_WB_UNPROTECT 0 1444 #if USE_RGENGC_LOGGING_WB_UNPROTECT 1446 #define RGENGC_LOGGING_WB_UNPROTECT rb_gc_unprotect_logging 1452 #ifdef RGENGC_LOGGING_WB_UNPROTECT 1453 RGENGC_LOGGING_WB_UNPROTECT((
void *)x, filename, line);
1464 #ifdef RGENGC_LOGGING_OBJ_WRITTEN 1465 RGENGC_LOGGING_OBJ_WRITTEN(a, oldv, b, filename, line);
1480 #ifdef RGENGC_LOGGING_WRITE 1481 RGENGC_LOGGING_WRITE(a, slot, b, filename, line);
1487 rb_obj_written(a,
RUBY_Qundef , b, filename, line);
1492 #define RUBY_INTEGER_UNIFICATION 1 1493 #define RB_INTEGER_TYPE_P(obj) rb_integer_type_p(obj) 1494 #if defined __GNUC__ && !GCC_VERSION_SINCE(4, 3, 0) 1497 #define rb_integer_type_p(obj) \ 1499 const VALUE integer_type_obj = (obj); \ 1500 (RB_FIXNUM_P(integer_type_obj) || \ 1501 (!RB_SPECIAL_CONST_P(integer_type_obj) && \ 1502 RB_BUILTIN_TYPE(integer_type_obj) == RUBY_T_BIGNUM)); \ 1506 rb_integer_type_p(
VALUE obj)
1514 #if SIZEOF_INT < SIZEOF_LONG 1515 # define RB_INT2NUM(v) RB_INT2FIX((int)(v)) 1516 # define RB_UINT2NUM(v) RB_LONG2FIX((unsigned int)(v)) 1519 rb_int2num_inline(
int v)
1526 #define RB_INT2NUM(x) rb_int2num_inline(x) 1529 rb_uint2num_inline(
unsigned int v)
1536 #define RB_UINT2NUM(x) rb_uint2num_inline(x) 1538 #define INT2NUM(x) RB_INT2NUM(x) 1539 #define UINT2NUM(x) RB_UINT2NUM(x) 1542 rb_long2num_inline(
long v)
1549 #define RB_LONG2NUM(x) rb_long2num_inline(x) 1552 rb_ulong2num_inline(
unsigned long v)
1559 #define RB_ULONG2NUM(x) rb_ulong2num_inline(x) 1562 rb_num2char_inline(
VALUE x)
1567 return (
char)(
NUM2INT(x) & 0xff);
1569 #define RB_NUM2CHR(x) rb_num2char_inline(x) 1571 #define RB_CHR2FIX(x) RB_INT2FIX((long)((x)&0xff)) 1573 #define LONG2NUM(x) RB_LONG2NUM(x) 1574 #define ULONG2NUM(x) RB_ULONG2NUM(x) 1575 #define NUM2CHR(x) RB_NUM2CHR(x) 1576 #define CHR2FIX(x) RB_CHR2FIX(x) 1578 #define RB_ST2FIX(h) RB_LONG2FIX((long)(h)) 1579 #define ST2FIX(h) RB_ST2FIX(h) 1581 #define RB_ALLOC_N(type,n) ((type*)ruby_xmalloc2((size_t)(n),sizeof(type))) 1582 #define RB_ALLOC(type) ((type*)ruby_xmalloc(sizeof(type))) 1583 #define RB_ZALLOC_N(type,n) ((type*)ruby_xcalloc((size_t)(n),sizeof(type))) 1584 #define RB_ZALLOC(type) (RB_ZALLOC_N(type,1)) 1585 #define RB_REALLOC_N(var,type,n) ((var)=(type*)ruby_xrealloc2((char*)(var),(size_t)(n),sizeof(type))) 1587 #define ALLOC_N(type,n) RB_ALLOC_N(type,n) 1588 #define ALLOC(type) RB_ALLOC(type) 1589 #define ZALLOC_N(type,n) RB_ZALLOC_N(type,n) 1590 #define ZALLOC(type) RB_ZALLOC(type) 1591 #define REALLOC_N(var,type,n) RB_REALLOC_N(var,type,n) 1593 #define ALLOCA_N(type,n) ((type*)alloca(sizeof(type)*(n))) 1599 #if HAVE_LONG_LONG && SIZEOF_SIZE_T * 2 <= SIZEOF_LONG_LONG 1600 # define DSIZE_T unsigned LONG_LONG 1601 #elif defined(HAVE_INT128_T) 1602 # define DSIZE_T uint128_t 1605 rb_mul_size_overflow(
size_t a,
size_t b,
size_t max,
size_t *c)
1611 DSIZE_T c2 = (DSIZE_T)a * (DSIZE_T)b;
1612 if (c2 > max)
return 1;
1615 if (b != 0 && a > max / b)
return 1;
1620 static inline void *
1621 rb_alloc_tmp_buffer2(
volatile VALUE *store,
long count,
size_t elsize)
1623 size_t cnt = (size_t)count;
1624 if (elsize ==
sizeof(
VALUE)) {
1631 if (
RB_UNLIKELY(rb_mul_size_overflow(cnt, elsize, max, &size))) {
1634 cnt = (size +
sizeof(
VALUE) - 1) /
sizeof(
VALUE);
1641 # define RB_ALLOCV(v, n) rb_alloc_tmp_buffer(&(v), (n)) 1642 # define RB_ALLOCV_N(type, v, n) \ 1643 rb_alloc_tmp_buffer2(&(v), (n), sizeof(type)) 1645 # define RUBY_ALLOCV_LIMIT 1024 1646 # define RB_ALLOCV(v, n) ((n) < RUBY_ALLOCV_LIMIT ? \ 1647 (RB_GC_GUARD(v) = 0, alloca(n)) : \ 1648 rb_alloc_tmp_buffer(&(v), (n))) 1649 # define RB_ALLOCV_N(type, v, n) \ 1650 ((type*)(((size_t)(n) < RUBY_ALLOCV_LIMIT / sizeof(type)) ? \ 1651 (RB_GC_GUARD(v) = 0, alloca((size_t)(n) * sizeof(type))) : \ 1652 rb_alloc_tmp_buffer2(&(v), (long)(n), sizeof(type)))) 1654 #define RB_ALLOCV_END(v) rb_free_tmp_buffer(&(v)) 1656 #define ALLOCV(v, n) RB_ALLOCV(v, n) 1657 #define ALLOCV_N(type, v, n) RB_ALLOCV_N(type, v, n) 1658 #define ALLOCV_END(v) RB_ALLOCV_END(v) 1660 #define MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(size_t)(n)) 1661 #define MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(size_t)(n)) 1662 #define MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(size_t)(n)) 1663 #define MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(size_t)(n)) 1708 #define RUBY_METHOD_FUNC(func) ((VALUE (*)(ANYARGS))(func)) 1733 #define RUBY_CONST_ID_CACHE(result, str) \ 1735 static ID rb_intern_id_cache; \ 1736 if (!rb_intern_id_cache) \ 1737 rb_intern_id_cache = rb_intern2((str), (long)strlen(str)); \ 1738 result rb_intern_id_cache; \ 1740 #define RUBY_CONST_ID(var, str) \ 1741 do RUBY_CONST_ID_CACHE((var) =, (str)) while (0) 1742 #define CONST_ID_CACHE(result, str) RUBY_CONST_ID_CACHE(result, str) 1743 #define CONST_ID(var, str) RUBY_CONST_ID(var, str) 1747 #define rb_intern(str) \ 1748 (__builtin_constant_p(str) ? \ 1749 __extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \ 1751 #define rb_intern_const(str) \ 1752 (__builtin_constant_p(str) ? \ 1753 __extension__ (rb_intern2((str), (long)strlen(str))) : \ 1756 # define rb_varargs_argc_check_runtime(argc, vargc) \ 1757 (((argc) <= (vargc)) ? (argc) : \ 1758 (rb_fatal("argc(%d) exceeds actual arguments(%d)", \ 1760 # if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P) 1761 # if HAVE_ATTRIBUTE_ERRORFUNC 1762 ERRORFUNC((
" argument length doesn't match"),
int rb_varargs_bad_length(
int,
int));
1764 # define rb_varargs_bad_length(argc, vargc) ((argc)/((argc) == (vargc))) 1766 # define rb_varargs_argc_check(argc, vargc) \ 1767 __builtin_choose_expr(__builtin_constant_p(argc), \ 1768 (((argc) == (vargc)) ? (argc) : \ 1769 rb_varargs_bad_length(argc, vargc)), \ 1770 rb_varargs_argc_check_runtime(argc, vargc)) 1772 # define rb_varargs_argc_check(argc, vargc) \ 1773 rb_varargs_argc_check_runtime(argc, vargc) 1777 #define rb_intern_const(str) rb_intern2((str), (long)strlen(str)) 1791 #define rb_funcall2 rb_funcallv 1792 #define rb_funcall3 rb_funcallv_public 1802 #define HAVE_RB_SCAN_ARGS_OPTIONAL_HASH 1 1813 #define ruby_verbose (*rb_ruby_verbose_ptr()) 1814 #define ruby_debug (*rb_ruby_debug_ptr()) 1818 #define RB_IO_WAIT_READABLE RB_IO_WAIT_READABLE 1819 #define RB_IO_WAIT_WRITABLE RB_IO_WAIT_WRITABLE 1850 #define RUBY_BLOCK_CALL_FUNC_TAKES_BLOCKARG 1 1851 #define RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg) \ 1852 VALUE yielded_arg, VALUE callback_arg, int argc, const VALUE *argv, VALUE blockarg 1855 #if defined RB_BLOCK_CALL_FUNC_STRICT && RB_BLOCK_CALL_FUNC_STRICT 1895 #ifndef RUBY_INTEGER_UNIFICATION 1907 #ifndef RUBY_INTEGER_UNIFICATION 1974 rb_class_of(
VALUE obj)
1986 return RBASIC(obj)->klass;
2007 #define rb_type_p(obj, type) \ 2008 __extension__ (__builtin_constant_p(type) ? RB_TYPE_P((obj), (type)) : \ 2009 rb_type(obj) == (type)) 2011 #define rb_type_p(obj, type) (rb_type(obj) == (type)) 2015 #define rb_special_const_p(obj) \ 2017 VALUE special_const_obj = (obj); \ 2018 (int)(RB_SPECIAL_CONST_P(special_const_obj) ? RUBY_Qtrue : RUBY_Qfalse); \ 2022 rb_special_const_p(
VALUE obj)
2048 rb_array_len(
VALUE a)
2054 #if defined(__fcc__) || defined(__fcc_version) || \ 2055 defined(__FCC__) || defined(__FCC_VERSION) 2057 # define FIX_CONST_VALUE_PTR(x) ((const VALUE *)(x)) 2059 # define FIX_CONST_VALUE_PTR(x) (x) 2062 static inline const VALUE *
2063 rb_array_const_ptr(
VALUE a)
2069 #if defined(EXTLIB) && defined(USE_DLN_A_OUT) 2071 static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
2075 #define HAVE_NATIVETHREAD 2079 #define RUBY_EVENT_NONE 0x0000 2080 #define RUBY_EVENT_LINE 0x0001 2081 #define RUBY_EVENT_CLASS 0x0002 2082 #define RUBY_EVENT_END 0x0004 2083 #define RUBY_EVENT_CALL 0x0008 2084 #define RUBY_EVENT_RETURN 0x0010 2085 #define RUBY_EVENT_C_CALL 0x0020 2086 #define RUBY_EVENT_C_RETURN 0x0040 2087 #define RUBY_EVENT_RAISE 0x0080 2088 #define RUBY_EVENT_ALL 0x00ff 2091 #define RUBY_EVENT_B_CALL 0x0100 2092 #define RUBY_EVENT_B_RETURN 0x0200 2093 #define RUBY_EVENT_THREAD_BEGIN 0x0400 2094 #define RUBY_EVENT_THREAD_END 0x0800 2095 #define RUBY_EVENT_FIBER_SWITCH 0x1000 2096 #define RUBY_EVENT_TRACEPOINT_ALL 0xffff 2099 #define RUBY_EVENT_SPECIFIED_LINE 0x010000 2100 #define RUBY_EVENT_COVERAGE 0x020000 2103 #define RUBY_INTERNAL_EVENT_SWITCH 0x040000 2104 #define RUBY_EVENT_SWITCH 0x040000 2106 #define RUBY_INTERNAL_EVENT_NEWOBJ 0x100000 2107 #define RUBY_INTERNAL_EVENT_FREEOBJ 0x200000 2108 #define RUBY_INTERNAL_EVENT_GC_START 0x400000 2109 #define RUBY_INTERNAL_EVENT_GC_END_MARK 0x800000 2110 #define RUBY_INTERNAL_EVENT_GC_END_SWEEP 0x1000000 2111 #define RUBY_INTERNAL_EVENT_GC_ENTER 0x2000000 2112 #define RUBY_INTERNAL_EVENT_GC_EXIT 0x4000000 2113 #define RUBY_INTERNAL_EVENT_OBJSPACE_MASK 0x7f00000 2114 #define RUBY_INTERNAL_EVENT_MASK 0xfffe0000 2119 #define RB_EVENT_HOOKS_HAVE_CALLBACK_DATA 1 2125 static inline int rb_isascii(
int c){
return '\0' <= c && c <=
'\x7f'; }
2126 static inline int rb_isupper(
int c){
return 'A' <= c && c <=
'Z'; }
2127 static inline int rb_islower(
int c){
return 'a' <= c && c <=
'z'; }
2128 static inline int rb_isalpha(
int c){
return rb_isupper(c) || rb_islower(c); }
2129 static inline int rb_isdigit(
int c){
return '0' <= c && c <=
'9'; }
2130 static inline int rb_isalnum(
int c){
return rb_isalpha(c) || rb_isdigit(c); }
2131 static inline int rb_isxdigit(
int c){
return rb_isdigit(c) || (
'A' <= c && c <=
'F') || (
'a' <= c && c <=
'f'); }
2132 static inline int rb_isblank(
int c){
return c ==
' ' || c ==
'\t'; }
2133 static inline int rb_isspace(
int c){
return c ==
' ' || (
'\t' <= c && c <=
'\r'); }
2134 static inline int rb_iscntrl(
int c){
return (
'\0' <= c && c <
' ') || c ==
'\x7f'; }
2135 static inline int rb_isprint(
int c){
return ' ' <= c && c <=
'\x7e'; }
2136 static inline int rb_ispunct(
int c){
return !rb_isalnum(c); }
2137 static inline int rb_isgraph(
int c){
return '!' <= c && c <=
'\x7e'; }
2138 static inline int rb_tolower(
int c) {
return rb_isupper(c) ? (c|0x20) : c; }
2139 static inline int rb_toupper(
int c) {
return rb_islower(c) ? (c&0x5f) : c; }
2142 #define ISASCII(c) rb_isascii(c) 2143 #define ISPRINT(c) rb_isprint(c) 2144 #define ISGRAPH(c) rb_isgraph(c) 2145 #define ISSPACE(c) rb_isspace(c) 2146 #define ISUPPER(c) rb_isupper(c) 2147 #define ISLOWER(c) rb_islower(c) 2148 #define ISALNUM(c) rb_isalnum(c) 2149 #define ISALPHA(c) rb_isalpha(c) 2150 #define ISDIGIT(c) rb_isdigit(c) 2151 #define ISXDIGIT(c) rb_isxdigit(c) 2153 #define TOUPPER(c) rb_toupper(c) 2154 #define TOLOWER(c) rb_tolower(c) 2158 #define STRCASECMP(s1, s2) (st_locale_insensitive_strcasecmp((s1), (s2))) 2159 #define STRNCASECMP(s1, s2, n) (st_locale_insensitive_strncasecmp((s1), (s2), (n))) 2161 unsigned long ruby_strtoul(
const char *str,
char **endptr,
int base);
2162 #define STRTOUL(str, endptr, base) (ruby_strtoul((str), (endptr), (base))) 2164 #define InitVM(ext) {void InitVM_##ext(void);InitVM_##ext();} 2167 int ruby_vsnprintf(
char *str,
size_t n,
char const *fmt, va_list ap);
2169 #if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P) && defined(__OPTIMIZE__) 2170 # define rb_scan_args(argc,argvp,fmt,...) \ 2171 __builtin_choose_expr(__builtin_constant_p(fmt), \ 2172 rb_scan_args0(argc,argvp,fmt,\ 2173 (sizeof((VALUE*[]){__VA_ARGS__})/sizeof(VALUE*)), \ 2174 ((VALUE*[]){__VA_ARGS__})), \ 2175 rb_scan_args(argc,argvp,fmt,__VA_ARGS__)) 2176 # if HAVE_ATTRIBUTE_ERRORFUNC 2177 ERRORFUNC((
"bad scan arg format"),
int rb_scan_args_bad_format(
const char*));
2178 ERRORFUNC((
"variable argument length doesn't match"),
int rb_scan_args_length_mismatch(
const char*,
int));
2180 # define rb_scan_args_bad_format(fmt) 0 2181 # define rb_scan_args_length_mismatch(fmt, varc) 0 2184 # define rb_scan_args_isdigit(c) ((unsigned char)((c)-'0')<10) 2186 # define rb_scan_args_count_end(fmt, ofs, varc, vari) \ 2187 ((vari)/(!fmt[ofs] || rb_scan_args_bad_format(fmt))) 2189 # define rb_scan_args_count_block(fmt, ofs, varc, vari) \ 2191 rb_scan_args_count_end(fmt, ofs, varc, vari) : \ 2192 rb_scan_args_count_end(fmt, ofs+1, varc, vari+1)) 2194 # define rb_scan_args_count_hash(fmt, ofs, varc, vari) \ 2196 rb_scan_args_count_block(fmt, ofs, varc, vari) : \ 2197 rb_scan_args_count_block(fmt, ofs+1, varc, vari+1)) 2199 # define rb_scan_args_count_trail(fmt, ofs, varc, vari) \ 2200 (!rb_scan_args_isdigit(fmt[ofs]) ? \ 2201 rb_scan_args_count_hash(fmt, ofs, varc, vari) : \ 2202 rb_scan_args_count_hash(fmt, ofs+1, varc, vari+(fmt[ofs]-'0'))) 2204 # define rb_scan_args_count_var(fmt, ofs, varc, vari) \ 2206 rb_scan_args_count_trail(fmt, ofs, varc, vari) : \ 2207 rb_scan_args_count_trail(fmt, ofs+1, varc, vari+1)) 2209 # define rb_scan_args_count_opt(fmt, ofs, varc, vari) \ 2210 (!rb_scan_args_isdigit(fmt[1]) ? \ 2211 rb_scan_args_count_var(fmt, ofs, varc, vari) : \ 2212 rb_scan_args_count_var(fmt, ofs+1, varc, vari+fmt[ofs]-'0')) 2214 # define rb_scan_args_count(fmt, varc) \ 2215 ((!rb_scan_args_isdigit(fmt[0]) ? \ 2216 rb_scan_args_count_var(fmt, 0, varc, 0) : \ 2217 rb_scan_args_count_opt(fmt, 1, varc, fmt[0]-'0')) \ 2219 rb_scan_args_length_mismatch(fmt, varc)) 2221 # define rb_scan_args_verify_count(fmt, varc) \ 2222 ((varc)/(rb_scan_args_count(fmt, varc))) 2225 # define rb_scan_args_verify(fmt, varc) \ 2228 _Pragma("GCC diagnostic push"); \ 2229 _Pragma("GCC diagnostic ignored \"-Warray-bounds\""); \ 2230 verify = rb_scan_args_verify_count(fmt, varc); \ 2231 _Pragma("GCC diagnostic pop"); \ 2235 # define rb_scan_args_verify(fmt, varc) \ 2236 rb_scan_args_verify_count(fmt, varc) 2239 ALWAYS_INLINE(
static int rb_scan_args_lead_p(
const char *fmt));
2241 rb_scan_args_lead_p(
const char *fmt)
2243 return rb_scan_args_isdigit(fmt[0]);
2246 ALWAYS_INLINE(
static int rb_scan_args_n_lead(
const char *fmt));
2248 rb_scan_args_n_lead(
const char *fmt)
2250 return (rb_scan_args_lead_p(fmt) ? fmt[0]-
'0' : 0);
2253 ALWAYS_INLINE(
static int rb_scan_args_opt_p(
const char *fmt));
2255 rb_scan_args_opt_p(
const char *fmt)
2257 return (rb_scan_args_lead_p(fmt) && rb_scan_args_isdigit(fmt[1]));
2260 ALWAYS_INLINE(
static int rb_scan_args_n_opt(
const char *fmt));
2262 rb_scan_args_n_opt(
const char *fmt)
2264 return (rb_scan_args_opt_p(fmt) ? fmt[1]-
'0' : 0);
2267 ALWAYS_INLINE(
static int rb_scan_args_var_idx(
const char *fmt));
2269 rb_scan_args_var_idx(
const char *fmt)
2271 return (!rb_scan_args_lead_p(fmt) ? 0 : !rb_scan_args_isdigit(fmt[1]) ? 1 : 2);
2274 ALWAYS_INLINE(
static int rb_scan_args_f_var(
const char *fmt));
2276 rb_scan_args_f_var(
const char *fmt)
2278 return (fmt[rb_scan_args_var_idx(fmt)]==
'*');
2281 ALWAYS_INLINE(
static int rb_scan_args_trail_idx(
const char *fmt));
2283 rb_scan_args_trail_idx(
const char *fmt)
2285 const int idx = rb_scan_args_var_idx(fmt);
2286 return idx+(fmt[idx]==
'*');
2289 ALWAYS_INLINE(
static int rb_scan_args_n_trail(
const char *fmt));
2291 rb_scan_args_n_trail(
const char *fmt)
2293 const int idx = rb_scan_args_trail_idx(fmt);
2294 return (rb_scan_args_isdigit(fmt[idx]) ? fmt[idx]-
'0' : 0);
2297 ALWAYS_INLINE(
static int rb_scan_args_hash_idx(
const char *fmt));
2299 rb_scan_args_hash_idx(
const char *fmt)
2301 const int idx = rb_scan_args_trail_idx(fmt);
2302 return idx+rb_scan_args_isdigit(fmt[idx]);
2305 ALWAYS_INLINE(
static int rb_scan_args_f_hash(
const char *fmt));
2307 rb_scan_args_f_hash(
const char *fmt)
2309 return (fmt[rb_scan_args_hash_idx(fmt)]==
':');
2312 ALWAYS_INLINE(
static int rb_scan_args_block_idx(
const char *fmt));
2314 rb_scan_args_block_idx(
const char *fmt)
2316 const int idx = rb_scan_args_hash_idx(fmt);
2317 return idx+(fmt[idx]==
':');
2320 ALWAYS_INLINE(
static int rb_scan_args_f_block(
const char *fmt));
2322 rb_scan_args_f_block(
const char *fmt)
2324 return (fmt[rb_scan_args_block_idx(fmt)]==
'&');
2328 ALWAYS_INLINE(
static int rb_scan_args_end_idx(
const char *fmt));
2330 rb_scan_args_end_idx(
const char *fmt)
2332 const int idx = rb_scan_args_block_idx(fmt);
2333 return idx+(fmt[idx]==
'&');
2337 # define rb_scan_args0(argc, argv, fmt, varc, vars) \ 2338 rb_scan_args_set(argc, argv, \ 2339 rb_scan_args_n_lead(fmt), \ 2340 rb_scan_args_n_opt(fmt), \ 2341 rb_scan_args_n_trail(fmt), \ 2342 rb_scan_args_f_var(fmt), \ 2343 rb_scan_args_f_hash(fmt), \ 2344 rb_scan_args_f_block(fmt), \ 2345 (rb_scan_args_verify(fmt, varc), vars)) 2347 rb_scan_args_set(
int argc,
const VALUE *
argv,
2348 int n_lead,
int n_opt,
int n_trail,
2349 int f_var,
int f_hash,
int f_block,
2352 rb_scan_args_set(
int argc,
const VALUE *
argv,
2353 int n_lead,
int n_opt,
int n_trail,
2354 int f_var,
int f_hash,
int f_block,
2357 int i, argi = 0, vari = 0, last_idx = -1;
2358 VALUE *var, hash =
Qnil, last_hash = 0;
2359 const int n_mand = n_lead + n_trail;
2362 if (f_hash && n_mand < argc) {
2363 VALUE
last = argv[argc - 1];
2369 if (!f_var && n_mand + n_opt < argc)
2376 if (!(last_hash = hash)) argc--;
2377 else last_idx = argc - 1;
2378 hash = opts ? opts :
Qnil;
2386 for (i = n_lead; i-- > 0; ) {
2388 if (var) *var = (argi == last_idx) ? last_hash : argv[argi];
2392 for (i = n_opt; i-- > 0; ) {
2394 if (argi < argc - n_trail) {
2395 if (var) *var = (argi == last_idx) ? last_hash : argv[argi];
2399 if (var) *var =
Qnil;
2404 int n_var = argc - argi - n_trail;
2409 int f_last = (last_idx + 1 == argc - n_trail);
2420 for (i = n_trail; i-- > 0; ) {
2422 if (var) *var = (argi == last_idx) ? last_hash : argv[argi];
2428 if (var) *var = hash;
2445 #if defined(__GNUC__) && defined(__OPTIMIZE__) 2446 # define rb_yield_values(argc, ...) \ 2448 const int rb_yield_values_argc = (argc); \ 2449 const VALUE rb_yield_values_args[] = {__VA_ARGS__}; \ 2450 const int rb_yield_values_nargs = \ 2451 (int)(sizeof(rb_yield_values_args) / sizeof(VALUE)); \ 2453 rb_varargs_argc_check(rb_yield_values_argc, rb_yield_values_nargs), \ 2454 rb_yield_values_nargs ? rb_yield_values_args : NULL); \ 2457 # define rb_funcall(recv, mid, argc, ...) \ 2459 const int rb_funcall_argc = (argc); \ 2460 const VALUE rb_funcall_args[] = {__VA_ARGS__}; \ 2461 const int rb_funcall_nargs = \ 2462 (int)(sizeof(rb_funcall_args) / sizeof(VALUE)); \ 2463 rb_funcallv(recv, mid, \ 2464 rb_varargs_argc_check(rb_funcall_argc, rb_funcall_nargs), \ 2465 rb_funcall_nargs ? rb_funcall_args : NULL); \ 2469 #ifndef RUBY_DONT_SUBST 2502 #define RUBY_INIT_STACK \ 2503 VALUE variable_in_this_stack_frame; \ 2504 ruby_init_stack(&variable_in_this_stack_frame); 2509 #define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp()) 2513 #define Init_stack(addr) ruby_init_stack(addr) 2539 #if !defined RUBY_EXPORT && !defined RUBY_NO_OLD_COMPATIBILITY 2545 #if defined(__cplusplus) RUBY_EXTERN VALUE rb_cString
void rb_define_global_const(const char *, VALUE)
int ruby_snprintf(char *str, size_t n, char const *fmt,...)
void rb_define_readonly_variable(const char *, const VALUE *)
unsigned long ruby_strtoul(const char *str, char **endptr, int base)
int ruby_run_node(void *n)
Runs the given compiled source and exits this process.
void rb_fatal(const char *fmt,...)
void rb_check_type(VALUE, int)
void(* RUBY_DATA_FUNC)(void *)
void rb_glob(const char *, void(*)(const char *, VALUE, void *), VALUE)
RUBY_EXTERN VALUE rb_mProcess
ID rb_check_id(volatile VALUE *)
Returns ID for the given name if it is interned already, or 0.
RUBY_EXTERN VALUE rb_eRangeError
RUBY_EXTERN VALUE rb_cData
volatile VALUE * rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val)
int ruby_cleanup(volatile int)
Destructs the VM.
void rb_warn(const char *fmt,...)
void rb_gc_writebarrier_unprotect(VALUE obj)
void rb_bug(const char *fmt,...)
RUBY_EXTERN VALUE rb_cFalseClass
RUBY_EXTERN VALUE rb_cFloat
void rb_syserr_fail(int e, const char *mesg)
char * rb_string_value_ptr(volatile VALUE *)
VALUE(* rb_block_call_func_t)(ANYARGS)
void rb_readwrite_sys_fail(enum rb_io_wait_readwrite writable, const char *mesg)
int st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n)
void rb_gvar_undef_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar)
void ruby_finalize(void)
Runs the VM finalization processes.
void rb_define_virtual_variable(const char *, VALUE(*)(ANYARGS), void(*)(ANYARGS))
void rb_mod_sys_fail_str(VALUE mod, VALUE mesg)
#define RARRAY_EMBED_LEN(a)
VALUE rb_yield_values(int n,...)
ID rb_intern2(const char *, long)
void rb_global_variable(VALUE *)
#define RUBY_FL_USER_N(n)
int ruby_vsnprintf(char *str, size_t n, char const *fmt, va_list ap)
void rb_syserr_fail_str(int e, VALUE mesg)
void rb_throw(const char *tag, VALUE val)
#define FIX_CONST_VALUE_PTR(x)
int rb_block_given_p(void)
Determines if the current method is given a block.
RUBY_EXTERN VALUE rb_cUnboundMethod
size_t ruby_stack_length(VALUE **)
void rb_obj_infect(VALUE victim, VALUE carrier)
Convenient function to infect victim with the taintedness of carrier.
void rb_raise(VALUE exc, const char *fmt,...)
VALUE rb_str_export(VALUE)
void * ruby_options(int argc, char **argv)
Processes command line arguments and compiles the Ruby source to execute.
int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *)
#define rb_data_typed_object_alloc
void ruby_show_version(void)
Prints the version information of the CRuby interpreter to stdout.
int rb_remove_event_hook(rb_event_hook_func_t func)
double rb_float_value(VALUE v)
#define TypedData_Make_Struct0(result, klass, type, size, data_type, sval)
#define RB_IMMEDIATE_P(x)
RUBY_EXTERN VALUE rb_eNoMethodError
void rb_gc_register_address(VALUE *)
RUBY_EXTERN VALUE rb_cRandom
int ruby_glob(const char *, int, ruby_glob_func *, VALUE)
void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data)
VALUE rb_iterate(VALUE(*)(VALUE), VALUE, VALUE(*)(ANYARGS), VALUE)
RUBY_EXTERN VALUE rb_stdin
VALUE rb_catch_obj(VALUE, VALUE(*)(ANYARGS), VALUE)
int ruby_exec_node(void *n)
Runs the given compiled source.
void ruby_show_copyright(void)
Prints the copyright notice of the CRuby interpreter to stdout.
VALUE rb_ary_push(VALUE ary, VALUE item)
VALUE rb_singleton_class_clone(VALUE obj)
#define RB_SPECIAL_CONST_P(x)
RUBY_EXTERN VALUE rb_eMathDomainError
char ruby_check_sizeof_int[SIZEOF_INT==sizeof(int) ? 1 :-1]
short rb_fix2short(VALUE)
RUBY_EXTERN VALUE rb_eInterrupt
ID rb_intern(const char *)
RUBY_EXTERN VALUE rb_eThreadError
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
void rb_freeze_singleton_class(VALUE klass)
VALUE rb_iv_set(VALUE, const char *, VALUE)
unsigned long rb_num2ulong(VALUE)
VALUE rb_iv_get(VALUE, const char *)
VALUE rb_define_class_under(VALUE, const char *, VALUE)
Defines a class under the namespace of outer.
void rb_secure_update(VALUE obj)
RUBY_EXTERN VALUE rb_cDir
VALUE rb_funcall_with_block(VALUE, ID, int, const VALUE *, VALUE)
const rb_data_type_t * parent
VALUE rb_rescue(VALUE(*)(ANYARGS), VALUE, VALUE(*)(ANYARGS), VALUE)
An equivalent of rescue clause.
#define RSTRING_EMBED_LEN_MASK
#define RB_OBJ_FREEZE_RAW(x)
VALUE rb_float_new(double)
void rb_include_module(VALUE, VALUE)
VALUE rb_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE)
void void rb_free_tmp_buffer(volatile VALUE *store)
#define ERRORFUNC(mesg, x)
void rb_define_global_function(const char *, VALUE(*)(ANYARGS), int)
Defines a global function.
RUBY_EXTERN VALUE rb_mMath
RUBY_EXTERN VALUE rb_cProc
VALUE rb_ensure(VALUE(*)(ANYARGS), VALUE, VALUE(*)(ANYARGS), VALUE)
An equivalent to ensure clause.
void rb_gc_register_mark_object(VALUE)
int ruby_native_thread_p(void)
#define RUBY_ATTR_ALLOC_SIZE(params)
RUBY_EXTERN VALUE rb_cMethod
void rb_undef_method(VALUE, const char *)
RUBY_EXTERN VALUE rb_eZeroDivError
VALUE rb_string_value(volatile VALUE *)
NORETURN(void rb_insecure_operation(void))
VALUE rb_rescue2(VALUE(*)(ANYARGS), VALUE, VALUE(*)(ANYARGS), VALUE,...)
An equivalent of rescue clause.
int ruby_stack_check(void)
CONSTFUNC(void rb_secure_update(VALUE))
const char * rb_obj_classname(VALUE)
VALUE rb_gv_set(const char *, VALUE)
void rb_gvar_var_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar)
void ruby_incpush(const char *)
int rb_typeddata_is_kind_of(VALUE, const rb_data_type_t *)
RUBY_EXTERN VALUE rb_cComplex
RUBY_EXTERN VALUE rb_eIndexError
RUBY_EXTERN VALUE rb_cFile
#define RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg)
void rb_gc_unprotect_logging(void *objptr, const char *filename, int line)
RUBY_EXTERN VALUE rb_eEncCompatError
void rb_prepend_module(VALUE, VALUE)
PUREFUNC(double rb_float_value(VALUE))
RUBY_EXTERN VALUE rb_cCont
VALUE rb_extract_keywords(VALUE *orighash)
VALUE rb_obj_class(VALUE)
call-seq: obj.class -> class
#define RB_TYPE_P(obj, type)
VALUE rb_gv_get(const char *)
void rb_set_safe_level(int)
RUBY_EXTERN VALUE rb_eEncodingError
VALUE rb_syserr_new(int, const char *)
VALUE rb_require(const char *)
RUBY_EXTERN VALUE rb_mWaitReadable
VALUE rb_block_call_func(RB_BLOCK_CALL_FUNC_ARGLIST(yielded_arg, callback_arg))
int st_locale_insensitive_strcasecmp(const char *s1, const char *s2)
RUBY_EXTERN VALUE rb_cBinding
VALUE rb_equal(VALUE, VALUE)
call-seq: obj === other -> true or false
#define RB_STATIC_SYM_P(x)
int ruby_brace_glob(const char *, int, ruby_glob_func *, VALUE)
void rb_bug_errno(const char *mesg, int errno_arg)
void ruby_init(void)
Calls ruby_setup() and check error.
RUBY_EXTERN VALUE rb_cObject
RUBY_EXTERN VALUE rb_cNameErrorMesg
char * rb_string_value_cstr(volatile VALUE *)
RUBY_EXTERN VALUE rb_cArray
void rb_gc_writebarrier(VALUE a, VALUE b)
VALUE rb_eval_string_protect(const char *, int *)
Evaluates the given string in an isolated binding.
#define RMODULE_IS_REFINEMENT
RUBY_EXTERN VALUE rb_eLoadError
RUBY_EXTERN VALUE rb_cStat
#define RB_IO_WAIT_WRITABLE
void rb_set_errinfo(VALUE)
Sets the current exception ($!) to the given value.
RUBY_EXTERN VALUE rb_cBasicObject
RUBY_EXTERN VALUE rb_cRange
RUBY_EXTERN VALUE rb_eFatal
RUBY_EXTERN VALUE rb_mKernel
#define RMODULE_IS_OVERLAID
VALUE rb_define_class(const char *, VALUE)
Defines a top-level class.
RUBY_EXTERN VALUE rb_cTrueClass
RUBY_EXTERN VALUE rb_eStopIteration
void rb_define_const(VALUE, const char *, VALUE)
void rb_compile_warn(const char *file, int line, const char *fmt,...)
VALUE rb_eval_string(const char *)
Evaluates the given string in an isolated binding.
rb_atomic_t cnt[RUBY_NSIG]
#define rb_data_object_alloc
void rb_notimplement(void)
PRINTF_ARGS(NORETURN(void rb_raise(VALUE, const char *,...)), 2, 3)
RUBY_EXTERN VALUE rb_eLocalJumpError
void(* rb_event_hook_func_t)(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VALUE klass)
RUBY_EXTERN VALUE rb_eKeyError
RUBY_EXTERN VALUE rb_eTypeError
RUBY_EXTERN VALUE rb_cModule
void ruby_stop(int ex)
Calls ruby_cleanup() and exits the process.
#define RUBY_UNTYPED_DATA_FUNC(func)
VALUE rb_get_path_no_checksafe(VALUE)
void rb_throw_obj(VALUE tag, VALUE value)
VALUE rb_syserr_new_str(int n, VALUE arg)
RUBY_EXTERN VALUE rb_eNameError
VALUE rb_float_new_in_heap(double)
VALUE rb_gvar_getter_t(ID id, void *data, struct rb_global_variable *gvar)
DEPRECATED_BY(rb_data_object_wrap, static inline VALUE rb_data_object_alloc(VALUE, void *, RUBY_DATA_FUNC, RUBY_DATA_FUNC))
RUBY_EXTERN VALUE rb_cEnumerator
void rb_sys_fail(const char *mesg)
VALUE rb_gvar_undef_getter(ID id, void *data, struct rb_global_variable *gvar)
RUBY_EXTERN VALUE rb_eRegexpError
void ruby_set_script_name(VALUE name)
Sets the current script name to this value.
void rb_define_alias(VALUE, const char *, const char *)
Defines an alias of a method.
RUBY_EXTERN VALUE rb_cRegexp
struct re_pattern_buffer * ptr
VALUE rb_int2big(SIGNED_VALUE)
void rb_define_module_function(VALUE, const char *, VALUE(*)(ANYARGS), int)
Defines a module function for module.
VALUE rb_funcallv_public(VALUE, ID, int, const VALUE *)
Calls a method.
void rb_gvar_var_marker(VALUE *var)
RUBY_EXTERN VALUE rb_mEnumerable
void rb_need_block(void)
Declares that the current method needs a block.
RUBY_EXTERN VALUE rb_cEncoding
VALUE rb_obj_reveal(VALUE obj, VALUE klass)
Make a hidden object visible again.
long rb_fix2int(VALUE val)
void ruby_malloc_size_overflow(size_t count, size_t elsize)
RUBY_EXTERN VALUE rb_cMatch
void rb_gvar_readonly_setter(VALUE v, ID id, void *d, struct rb_global_variable *g)
VALUE rb_to_symbol(VALUE name)
void ruby_prog_init(void)
Defines built-in variables.
#define RSTRING_EMBED_LEN_MAX
#define RUBY_SYMBOL_EXPORT_END
RUBY_EXTERN VALUE rb_mWaitWritable
short rb_num2short(VALUE)
void rb_compile_warning(const char *file, int line, const char *fmt,...)
int ruby_glob_func(const char *, VALUE, void *)
VALUE rb_gvar_val_getter(ID id, void *data, struct rb_global_variable *gvar)
int rb_scan_args(int, const VALUE *, const char *,...)
VALUE rb_check_hash_type(VALUE hash)
RUBY_EXTERN VALUE rb_eArgError
VALUE rb_catch(const char *, VALUE(*)(ANYARGS), VALUE)
unsigned short rb_fix2ushort(VALUE)
RUBY_EXTERN VALUE rb_eNotImpError
VALUE rb_str_export_locale(VALUE)
void rb_readwrite_syserr_fail(enum rb_io_wait_readwrite writable, int n, const char *mesg)
VALUE * rb_ruby_debug_ptr(void)
RUBY_EXTERN VALUE rb_cThread
RUBY_EXTERN VALUE rb_eSecurityError
#define RB_FL_TEST_RAW(x, f)
#define RARRAY_EMBED_FLAG
const char * rb_class2name(VALUE)
#define RB_IO_WAIT_READABLE
RUBY_EXTERN VALUE rb_cInteger
#define RARRAY_EMBED_LEN_MASK
#define RUBY_SYMBOL_EXPORT_BEGIN
ID rb_intern_str(VALUE str)
VALUE rb_uint2inum(VALUE)
VALUE rb_call_super(int, const VALUE *)
void ruby_init_stack(volatile VALUE *)
const char * rb_id2name(ID)
RUBY_EXTERN VALUE rb_mErrno
VALUE rb_obj_hide(VALUE obj)
Make the object invisible from Ruby code.
#define RARRAY_EMBED_LEN_SHIFT
RUBY_EXTERN VALUE rb_cNumeric
RUBY_EXTERN VALUE rb_cClass
RUBY_EXTERN VALUE rb_eScriptError
RUBY_EXTERN VALUE rb_mFileTest
VALUE rb_data_typed_object_wrap(VALUE klass, void *datap, const rb_data_type_t *)
void rb_mod_sys_fail(VALUE mod, const char *mesg)
void rb_define_hooked_variable(const char *, VALUE *, VALUE(*)(ANYARGS), void(*)(ANYARGS))
register unsigned int len
VALUE rb_define_module_under(VALUE, const char *)
VALUE rb_data_typed_object_zalloc(VALUE klass, size_t size, const rb_data_type_t *type)
void rb_set_safe_level_force(int)
VALUE rb_current_receiver(void)
void rb_iter_break_value(VALUE val)
#define Data_Make_Struct0(result, klass, type, size, mark, free, sval)
void rb_insecure_operation(void)
RUBY_EXTERN VALUE rb_stderr
VALUE rb_funcallv(VALUE, ID, int, const VALUE *)
Calls a method.
void ruby_set_stack_size(size_t)
void rb_singleton_class_attached(VALUE klass, VALUE obj)
Attach a object to a singleton class.
VALUE rb_int2inum(SIGNED_VALUE)
VALUE rb_yield_values2(int n, const VALUE *argv)
VALUE rb_funcall_passing_block(VALUE, ID, int, const VALUE *)
#define UNLIMITED_ARGUMENTS
void rb_gc_unregister_address(VALUE *)
VALUE rb_newobj_of(VALUE, VALUE)
long rb_num2int(VALUE val)
RUBY_EXTERN VALUE rb_eSyntaxError
RUBY_EXTERN VALUE rb_cStruct
void * ruby_process_options(int, char **)
void rb_mod_syserr_fail_str(VALUE mod, int e, VALUE mesg)
void ruby_script(const char *name)
Sets the current script name to this value.
VALUE rb_block_proc(void)
void rb_define_attr(VALUE, const char *, int, int)
Defines (a) public accessor method(s) for an attribute.
int ruby_safe_level_2_warning(void)
#define RBASIC_CLASS(obj)
#define ROBJECT_EMBED_LEN_MAX
void ruby_sig_finalize(void)
void rb_extend_object(VALUE, VALUE)
Extend the object with the module.
void ruby_init_loadpath(void)
VALUE rb_gvar_var_getter(ID id, void *data, struct rb_global_variable *gvar)
void ruby_set_argv(int, char **)
VALUE rb_data_object_zalloc(VALUE, size_t, RUBY_DATA_FUNC, RUBY_DATA_FUNC)
RUBY_EXTERN VALUE rb_eSysStackError
RUBY_EXTERN VALUE rb_eRuntimeError
void rb_warning(const char *fmt,...)
void rb_gvar_marker_t(VALUE *var)
void rb_check_safe_obj(VALUE)
void rb_define_variable(const char *, VALUE *)
#define RB_BUILTIN_TYPE(x)
VALUE rb_errinfo(void)
The current exception in the current thread.
RUBY_EXTERN VALUE rb_eException
#define RARRAY_EMBED_LEN_MAX
VALUE rb_check_symbol(volatile VALUE *namep)
RUBY_EXTERN VALUE rb_eSystemExit
double rb_num2dbl(VALUE)
Converts a Numeric object to double.
VALUE rb_yield_splat(VALUE)
VALUE rb_yield_block(VALUE, VALUE, int, const VALUE *, VALUE)
RUBY_EXTERN VALUE rb_eNoMemError
RUBY_EXTERN VALUE rb_cRational
RUBY_EXTERN VALUE rb_eIOError
RUBY_EXTERN VALUE rb_eStandardError
RUBY_EXTERN VALUE rb_eSystemCallError
#define RMODULE_INCLUDED_INTO_REFINEMENT
RUBY_EXTERN VALUE rb_cHash
void * rb_alloc_tmp_buffer_with_count(volatile VALUE *store, size_t len, size_t count) RUBY_ATTR_ALLOC_SIZE((2
void ruby_sysinit(int *argc, char ***argv)
Initializes the process for libruby.
RUBY_SYMBOL_EXPORT_BEGIN void * alloca()
RUBY_EXTERN VALUE rb_eFloatDomainError
char ruby_check_sizeof_voidp[SIZEOF_VOIDP==sizeof(void *) ? 1 :-1]
VALUE rb_eval_string_wrap(const char *, int *)
Evaluates the given string under a module binding in an isolated binding.
const rb_data_type_t * type
RUBY_EXTERN VALUE rb_eEOFError
const char * wrap_struct_name
RUBY_EXTERN VALUE rb_stdout
VALUE * rb_ruby_verbose_ptr(void)
void rb_copy_generic_ivar(VALUE, VALUE)
VALUE rb_data_object_wrap(VALUE, void *, RUBY_DATA_FUNC, RUBY_DATA_FUNC)
VALUE rb_define_module(const char *)
RUBY_EXTERN VALUE rb_cSymbol
RUBY_EXTERN VALUE rb_mComparable
#define RSTRING_EMBED_LEN_SHIFT
void rb_gvar_setter_t(VALUE val, ID id, void *data, struct rb_global_variable *gvar)
void rb_sys_fail_str(VALUE mesg)
void rb_mod_syserr_fail(VALUE mod, int e, const char *mesg)
RUBY_EXTERN VALUE rb_cTime
unsigned short rb_num2ushort(VALUE)
void rb_define_method(VALUE, const char *, VALUE(*)(ANYARGS), int)
VALUE rb_obj_setup(VALUE obj, VALUE klass, VALUE type)
Fills common (RBasic) fields in obj.
VALUE rb_str_to_str(VALUE)
void rb_gvar_val_setter(VALUE val, ID id, void *data, struct rb_global_variable *gvar)
RUBY_EXTERN VALUE rb_eSignal
RUBY_EXTERN VALUE rb_cNilClass
void * rb_alloc_tmp_buffer(volatile VALUE *store, long len) RUBY_ATTR_ALLOC_SIZE((2))
int ruby_executable_node(void *n, int *status)
Checks the return value of ruby_options().
void rb_sys_warning(const char *fmt,...)
void * rb_check_typeddata(VALUE, const rb_data_type_t *)
int ruby_setup(void)
Initializes the Ruby VM and builtin libraries.
#define rb_check_safe_str(x)
void rb_gvar_val_marker(VALUE *var)
char ruby_check_sizeof_long[SIZEOF_LONG==sizeof(long) ? 1 :-1]
int rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *parent)
void rb_gvar_undef_marker(VALUE *var)