Ruby  2.5.0dev(2017-10-22revision60238)
internal.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  internal.h -
4 
5  $Author$
6  created at: Tue May 17 11:42:20 JST 2011
7 
8  Copyright (C) 2011 Yukihiro Matsumoto
9 
10 **********************************************************************/
11 
12 #ifndef RUBY_INTERNAL_H
13 #define RUBY_INTERNAL_H 1
14 
15 #include "ruby.h"
16 #include "ruby/encoding.h"
17 #include "ruby/io.h"
18 
19 #if defined(__cplusplus)
20 extern "C" {
21 #if 0
22 } /* satisfy cc-mode */
23 #endif
24 #endif
25 
26 #ifdef HAVE_STDBOOL_H
27 # include <stdbool.h>
28 #endif
29 
30 #ifndef __bool_true_false_are_defined
31 # ifndef __cplusplus
32 # undef bool
33 # undef false
34 # undef true
35 # define bool signed char
36 # define false 0
37 # define true 1
38 # define __bool_true_false_are_defined 1
39 # endif
40 #endif
41 
42 #define LIKELY(x) RB_LIKELY(x)
43 #define UNLIKELY(x) RB_UNLIKELY(x)
44 
45 #ifndef MAYBE_UNUSED
46 # define MAYBE_UNUSED(x) x
47 #endif
48 
49 #ifndef WARN_UNUSED_RESULT
50 # define WARN_UNUSED_RESULT(x) x
51 #endif
52 
53 #ifdef HAVE_VALGRIND_MEMCHECK_H
54 # include <valgrind/memcheck.h>
55 # ifndef VALGRIND_MAKE_MEM_DEFINED
56 # define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
57 # endif
58 # ifndef VALGRIND_MAKE_MEM_UNDEFINED
59 # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
60 # endif
61 #else
62 # define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
63 # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
64 #endif
65 
66 #define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
67 
68 #ifndef __has_feature
69 # define __has_feature(x) 0
70 #endif
71 
72 #ifndef __has_extension
73 # define __has_extension __has_feature
74 #endif
75 
76 #if GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert)
77 # define STATIC_ASSERT(name, expr) _Static_assert(expr, #name ": " #expr)
78 #else
79 # define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
80 #endif
81 
82 #define SIGNED_INTEGER_TYPE_P(int_type) (0 > ((int_type)0)-1)
83 #define SIGNED_INTEGER_MAX(sint_type) \
84  (sint_type) \
85  ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) | \
86  ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) - 1))
87 #define SIGNED_INTEGER_MIN(sint_type) (-SIGNED_INTEGER_MAX(sint_type)-1)
88 #define UNSIGNED_INTEGER_MAX(uint_type) (~(uint_type)0)
89 
90 #if SIGNEDNESS_OF_TIME_T < 0 /* signed */
91 # define TIMET_MAX SIGNED_INTEGER_MAX(time_t)
92 # define TIMET_MIN SIGNED_INTEGER_MIN(time_t)
93 #elif SIGNEDNESS_OF_TIME_T > 0 /* unsigned */
94 # define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t)
95 # define TIMET_MIN ((time_t)0)
96 #endif
97 #define TIMET_MAX_PLUS_ONE (2*(double)(TIMET_MAX/2+1))
98 
99 #ifdef HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW_P
100 #define MUL_OVERFLOW_P(a, b) \
101  __builtin_mul_overflow_p((a), (b), (__typeof__(a * b))0)
102 #elif defined HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW
103 #define MUL_OVERFLOW_P(a, b) \
104  ({__typeof__(a) c; __builtin_mul_overflow((a), (b), &c);})
105 #endif
106 
107 #define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
108  (a) == 0 ? 0 : \
109  (a) == -1 ? (b) < -(max) : \
110  (a) > 0 ? \
111  ((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \
112  ((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b)))
113 
114 #ifdef HAVE_BUILTIN___BUILTIN_MUL_OVERFLOW_P
115 /* __builtin_mul_overflow_p can take bitfield */
116 /* and GCC permits bitfields for integers other than int */
117 #define MUL_OVERFLOW_FIXNUM_P(a, b) ({ \
118  struct { long fixnum : SIZEOF_LONG * CHAR_BIT - 1; } c; \
119  __builtin_mul_overflow_p((a), (b), c.fixnum); \
120 })
121 #else
122 #define MUL_OVERFLOW_FIXNUM_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
123 #endif
124 
125 #ifdef MUL_OVERFLOW_P
126 #define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
127 #define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_P(a, b)
128 #define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_P(a, b)
129 #else
130 #define MUL_OVERFLOW_LONG_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LLONG_MIN, LLONG_MAX)
131 #define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
132 #define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
133 #endif
134 
135 #ifndef swap16
136 # ifdef HAVE_BUILTIN___BUILTIN_BSWAP16
137 # define swap16(x) __builtin_bswap16(x)
138 # endif
139 #endif
140 
141 #ifndef swap16
142 # define swap16(x) ((uint16_t)((((x)&0xFF)<<8) | (((x)>>8)&0xFF)))
143 #endif
144 
145 #ifndef swap32
146 # ifdef HAVE_BUILTIN___BUILTIN_BSWAP32
147 # define swap32(x) __builtin_bswap32(x)
148 # endif
149 #endif
150 
151 #ifndef swap32
152 # define swap32(x) ((uint32_t)((((x)&0xFF)<<24) \
153  |(((x)>>24)&0xFF) \
154  |(((x)&0x0000FF00)<<8) \
155  |(((x)&0x00FF0000)>>8) ))
156 #endif
157 
158 #ifndef swap64
159 # ifdef HAVE_BUILTIN___BUILTIN_BSWAP64
160 # define swap64(x) __builtin_bswap64(x)
161 # endif
162 #endif
163 
164 #ifndef swap64
165 # ifdef HAVE_INT64_T
166 # define byte_in_64bit(n) ((uint64_t)0xff << (n))
167 # define swap64(x) ((uint64_t)((((x)&byte_in_64bit(0))<<56) \
168  |(((x)>>56)&0xFF) \
169  |(((x)&byte_in_64bit(8))<<40) \
170  |(((x)&byte_in_64bit(48))>>40) \
171  |(((x)&byte_in_64bit(16))<<24) \
172  |(((x)&byte_in_64bit(40))>>24) \
173  |(((x)&byte_in_64bit(24))<<8) \
174  |(((x)&byte_in_64bit(32))>>8)))
175 # endif
176 #endif
177 
178 static inline unsigned int
179 nlz_int(unsigned int x)
180 {
181 #if defined(HAVE_BUILTIN___BUILTIN_CLZ)
182  if (x == 0) return SIZEOF_INT * CHAR_BIT;
183  return (unsigned int)__builtin_clz(x);
184 #else
185  unsigned int y;
186 # if 64 < SIZEOF_INT * CHAR_BIT
187  unsigned int n = 128;
188 # elif 32 < SIZEOF_INT * CHAR_BIT
189  unsigned int n = 64;
190 # else
191  unsigned int n = 32;
192 # endif
193 # if 64 < SIZEOF_INT * CHAR_BIT
194  y = x >> 64; if (y) {n -= 64; x = y;}
195 # endif
196 # if 32 < SIZEOF_INT * CHAR_BIT
197  y = x >> 32; if (y) {n -= 32; x = y;}
198 # endif
199  y = x >> 16; if (y) {n -= 16; x = y;}
200  y = x >> 8; if (y) {n -= 8; x = y;}
201  y = x >> 4; if (y) {n -= 4; x = y;}
202  y = x >> 2; if (y) {n -= 2; x = y;}
203  y = x >> 1; if (y) {return n - 2;}
204  return (unsigned int)(n - x);
205 #endif
206 }
207 
208 static inline unsigned int
209 nlz_long(unsigned long x)
210 {
211 #if defined(HAVE_BUILTIN___BUILTIN_CLZL)
212  if (x == 0) return SIZEOF_LONG * CHAR_BIT;
213  return (unsigned int)__builtin_clzl(x);
214 #else
215  unsigned long y;
216 # if 64 < SIZEOF_LONG * CHAR_BIT
217  unsigned int n = 128;
218 # elif 32 < SIZEOF_LONG * CHAR_BIT
219  unsigned int n = 64;
220 # else
221  unsigned int n = 32;
222 # endif
223 # if 64 < SIZEOF_LONG * CHAR_BIT
224  y = x >> 64; if (y) {n -= 64; x = y;}
225 # endif
226 # if 32 < SIZEOF_LONG * CHAR_BIT
227  y = x >> 32; if (y) {n -= 32; x = y;}
228 # endif
229  y = x >> 16; if (y) {n -= 16; x = y;}
230  y = x >> 8; if (y) {n -= 8; x = y;}
231  y = x >> 4; if (y) {n -= 4; x = y;}
232  y = x >> 2; if (y) {n -= 2; x = y;}
233  y = x >> 1; if (y) {return n - 2;}
234  return (unsigned int)(n - x);
235 #endif
236 }
237 
238 #ifdef HAVE_LONG_LONG
239 static inline unsigned int
240 nlz_long_long(unsigned LONG_LONG x)
241 {
242 #if defined(HAVE_BUILTIN___BUILTIN_CLZLL)
243  if (x == 0) return SIZEOF_LONG_LONG * CHAR_BIT;
244  return (unsigned int)__builtin_clzll(x);
245 #else
246  unsigned LONG_LONG y;
247 # if 64 < SIZEOF_LONG_LONG * CHAR_BIT
248  unsigned int n = 128;
249 # elif 32 < SIZEOF_LONG_LONG * CHAR_BIT
250  unsigned int n = 64;
251 # else
252  unsigned int n = 32;
253 # endif
254 # if 64 < SIZEOF_LONG_LONG * CHAR_BIT
255  y = x >> 64; if (y) {n -= 64; x = y;}
256 # endif
257 # if 32 < SIZEOF_LONG_LONG * CHAR_BIT
258  y = x >> 32; if (y) {n -= 32; x = y;}
259 # endif
260  y = x >> 16; if (y) {n -= 16; x = y;}
261  y = x >> 8; if (y) {n -= 8; x = y;}
262  y = x >> 4; if (y) {n -= 4; x = y;}
263  y = x >> 2; if (y) {n -= 2; x = y;}
264  y = x >> 1; if (y) {return n - 2;}
265  return (unsigned int)(n - x);
266 #endif
267 }
268 #endif
269 
270 #ifdef HAVE_UINT128_T
271 static inline unsigned int
272 nlz_int128(uint128_t x)
273 {
274  uint128_t y;
275  unsigned int n = 128;
276  y = x >> 64; if (y) {n -= 64; x = y;}
277  y = x >> 32; if (y) {n -= 32; x = y;}
278  y = x >> 16; if (y) {n -= 16; x = y;}
279  y = x >> 8; if (y) {n -= 8; x = y;}
280  y = x >> 4; if (y) {n -= 4; x = y;}
281  y = x >> 2; if (y) {n -= 2; x = y;}
282  y = x >> 1; if (y) {return n - 2;}
283  return (unsigned int)(n - x);
284 }
285 #endif
286 
287 static inline unsigned int
288 nlz_intptr(uintptr_t x)
289 {
290 #if SIZEOF_VOIDP == 8
291  return nlz_long_long(x);
292 #elif SIZEOF_VOIDP == 4
293  return nlz_int(x);
294 #endif
295 }
296 
297 static inline unsigned int
298 rb_popcount32(uint32_t x)
299 {
300 #ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT
301  return (unsigned int)__builtin_popcount(x);
302 #else
303  x = (x & 0x55555555) + (x >> 1 & 0x55555555);
304  x = (x & 0x33333333) + (x >> 2 & 0x33333333);
305  x = (x & 0x0f0f0f0f) + (x >> 4 & 0x0f0f0f0f);
306  x = (x & 0x001f001f) + (x >> 8 & 0x001f001f);
307  return (x & 0x0000003f) + (x >>16 & 0x0000003f);
308 #endif
309 }
310 
311 static inline int
312 rb_popcount64(uint64_t x)
313 {
314 #ifdef HAVE_BUILTIN___BUILTIN_POPCOUNT
315  return __builtin_popcountll(x);
316 #else
317  x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
318  x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
319  x = (x & 0x0707070707070707) + (x >> 4 & 0x0707070707070707);
320  x = (x & 0x001f001f001f001f) + (x >> 8 & 0x001f001f001f001f);
321  x = (x & 0x0000003f0000003f) + (x >>16 & 0x0000003f0000003f);
322  return (x & 0x7f) + (x >>32 & 0x7f);
323 #endif
324 }
325 
326 static inline int
327 rb_popcount_intptr(uintptr_t x)
328 {
329 #if SIZEOF_VOIDP == 8
330  return rb_popcount64(x);
331 #elif SIZEOF_VOIDP == 4
332  return rb_popcount32(x);
333 #endif
334 }
335 
336 static inline int
337 ntz_int32(uint32_t x)
338 {
339 #ifdef HAVE_BUILTIN___BUILTIN_CTZ
340  return __builtin_ctz(x);
341 #else
342  return rb_popcount32((~x) & (x-1));
343 #endif
344 }
345 
346 static inline int
347 ntz_int64(uint64_t x)
348 {
349 #ifdef HAVE_BUILTIN___BUILTIN_CTZLL
350  return __builtin_ctzll(x);
351 #else
352  return rb_popcount64((~x) & (x-1));
353 #endif
354 }
355 
356 static inline int
357 ntz_intptr(uintptr_t x)
358 {
359 #if SIZEOF_VOIDP == 8
360  return ntz_int64(x);
361 #elif SIZEOF_VOIDP == 4
362  return ntz_int32(x);
363 #endif
364 }
365 
366 #if HAVE_LONG_LONG && SIZEOF_LONG * 2 <= SIZEOF_LONG_LONG
367 # define DLONG LONG_LONG
368 # define DL2NUM(x) LL2NUM(x)
369 #elif defined(HAVE_INT128_T)
370 # define DLONG int128_t
371 # define DL2NUM(x) (RB_FIXABLE(x) ? LONG2FIX(x) : rb_int128t2big(x))
372 VALUE rb_int128t2big(int128_t n);
373 #endif
374 
375 static inline long
376 rb_overflowed_fix_to_int(long x)
377 {
378  return (long)((unsigned long)(x >> 1) ^ (1LU << (SIZEOF_LONG * CHAR_BIT - 1)));
379 }
380 
381 static inline VALUE
382 rb_fix_plus_fix(VALUE x, VALUE y)
383 {
384 #ifdef HAVE_BUILTIN___BUILTIN_ADD_OVERFLOW
385  long lz;
386  /* NOTE
387  * (1) `LONG2FIX(FIX2LONG(x)+FIX2LONG(y))`
388  + = `((lx*2+1)/2 + (ly*2+1)/2)*2+1`
389  + = `lx*2 + ly*2 + 1`
390  + = `(lx*2+1) + (ly*2+1) - 1`
391  + = `x + y - 1`
392  * (2) Fixnum's LSB is always 1.
393  * It means you can always run `x - 1` without overflow.
394  * (3) Of course `z = x + (y-1)` may overflow.
395  * At that time true value is
396  * * positive: 0b0 1xxx...1, and z = 0b1xxx...1
397  * * nevative: 0b1 0xxx...1, and z = 0b0xxx...1
398  * To convert this true value to long,
399  * (a) Use arithmetic shift
400  * * positive: 0b11xxx...
401  * * negative: 0b00xxx...
402  * (b) invert MSB
403  * * positive: 0b01xxx...
404  * * negative: 0b10xxx...
405  */
406  if (__builtin_add_overflow((long)x, (long)y-1, &lz)) {
407  return rb_int2big(rb_overflowed_fix_to_int(lz));
408  }
409  else {
410  return (VALUE)lz;
411  }
412 #else
413  long lz = FIX2LONG(x) + FIX2LONG(y);
414  return LONG2NUM(lz);
415 #endif
416 }
417 
418 static inline VALUE
419 rb_fix_minus_fix(VALUE x, VALUE y)
420 {
421 #ifdef HAVE_BUILTIN___BUILTIN_SUB_OVERFLOW
422  long lz;
423  if (__builtin_sub_overflow((long)x, (long)y-1, &lz)) {
424  return rb_int2big(rb_overflowed_fix_to_int(lz));
425  }
426  else {
427  return (VALUE)lz;
428  }
429 #else
430  long lz = FIX2LONG(x) - FIX2LONG(y);
431  return LONG2NUM(lz);
432 #endif
433 }
434 
435 /* arguments must be Fixnum */
436 static inline VALUE
437 rb_fix_mul_fix(VALUE x, VALUE y)
438 {
439  long lx = FIX2LONG(x);
440  long ly = FIX2LONG(y);
441 #ifdef DLONG
442  return DL2NUM((DLONG)lx * (DLONG)ly);
443 #else
444  if (MUL_OVERFLOW_FIXNUM_P(lx, ly)) {
445  return rb_big_mul(rb_int2big(lx), rb_int2big(ly));
446  }
447  else {
448  return LONG2FIX(lx * ly);
449  }
450 #endif
451 }
452 
453 /*
454  * This behaves different from C99 for negative arguments.
455  * Note that div may overflow fixnum.
456  */
457 static inline void
458 rb_fix_divmod_fix(VALUE a, VALUE b, VALUE *divp, VALUE *modp)
459 {
460  /* assume / and % comply C99.
461  * ldiv(3) won't be inlined by GCC and clang.
462  * I expect / and % are compiled as single idiv.
463  */
464  long x = FIX2LONG(a);
465  long y = FIX2LONG(b);
466  long div, mod;
467  if (x == FIXNUM_MIN && y == -1) {
468  if (divp) *divp = LONG2NUM(-FIXNUM_MIN);
469  if (modp) *modp = LONG2FIX(0);
470  return;
471  }
472  div = x / y;
473  mod = x % y;
474  if (y > 0 ? mod < 0 : mod > 0) {
475  mod += y;
476  div -= 1;
477  }
478  if (divp) *divp = LONG2FIX(div);
479  if (modp) *modp = LONG2FIX(mod);
480 }
481 
482 /* div() for Ruby
483  * This behaves different from C99 for negative arguments.
484  */
485 static inline VALUE
486 rb_fix_div_fix(VALUE x, VALUE y)
487 {
488  VALUE div;
489  rb_fix_divmod_fix(x, y, &div, NULL);
490  return div;
491 }
492 
493 /* mod() for Ruby
494  * This behaves different from C99 for negative arguments.
495  */
496 static inline VALUE
497 rb_fix_mod_fix(VALUE x, VALUE y)
498 {
499  VALUE mod;
500  rb_fix_divmod_fix(x, y, NULL, &mod);
501  return mod;
502 }
503 
504 #if defined(HAVE_UINT128_T)
505 # define bit_length(x) \
506  (unsigned int) \
507  (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
508  sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
509  sizeof(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)) : \
510  SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x)))
511 #elif defined(HAVE_LONG_LONG)
512 # define bit_length(x) \
513  (unsigned int) \
514  (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
515  sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
516  SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)))
517 #else
518 # define bit_length(x) \
519  (unsigned int) \
520  (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
521  SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)))
522 #endif
523 
524 #ifndef BDIGIT
525 # if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
526 # define BDIGIT unsigned int
527 # define SIZEOF_BDIGIT SIZEOF_INT
528 # define BDIGIT_DBL unsigned LONG_LONG
529 # define BDIGIT_DBL_SIGNED LONG_LONG
530 # define PRI_BDIGIT_PREFIX ""
531 # define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
532 # elif SIZEOF_INT*2 <= SIZEOF_LONG
533 # define BDIGIT unsigned int
534 # define SIZEOF_BDIGIT SIZEOF_INT
535 # define BDIGIT_DBL unsigned long
536 # define BDIGIT_DBL_SIGNED long
537 # define PRI_BDIGIT_PREFIX ""
538 # define PRI_BDIGIT_DBL_PREFIX "l"
539 # elif SIZEOF_SHORT*2 <= SIZEOF_LONG
540 # define BDIGIT unsigned short
541 # define SIZEOF_BDIGIT SIZEOF_SHORT
542 # define BDIGIT_DBL unsigned long
543 # define BDIGIT_DBL_SIGNED long
544 # define PRI_BDIGIT_PREFIX "h"
545 # define PRI_BDIGIT_DBL_PREFIX "l"
546 # else
547 # define BDIGIT unsigned short
548 # define SIZEOF_BDIGIT (SIZEOF_LONG/2)
549 # define SIZEOF_ACTUAL_BDIGIT SIZEOF_LONG
550 # define BDIGIT_DBL unsigned long
551 # define BDIGIT_DBL_SIGNED long
552 # define PRI_BDIGIT_PREFIX "h"
553 # define PRI_BDIGIT_DBL_PREFIX "l"
554 # endif
555 #endif
556 #ifndef SIZEOF_ACTUAL_BDIGIT
557 # define SIZEOF_ACTUAL_BDIGIT SIZEOF_BDIGIT
558 #endif
559 
560 #ifdef PRI_BDIGIT_PREFIX
561 # define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
562 # define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
563 # define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
564 # define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
565 # define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
566 # define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
567 #endif
568 
569 #ifdef PRI_BDIGIT_DBL_PREFIX
570 # define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
571 # define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
572 # define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
573 # define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
574 # define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
575 # define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
576 #endif
577 
578 #define BIGNUM_EMBED_LEN_NUMBITS 3
579 #ifndef BIGNUM_EMBED_LEN_MAX
580 # if (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
581 # define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT)
582 # else
583 # define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1)
584 # endif
585 #endif
586 
587 struct RBignum {
588  struct RBasic basic;
589  union {
590  struct {
591  size_t len;
593  } heap;
595  } as;
596 };
597 #define BIGNUM_SIGN_BIT ((VALUE)FL_USER1)
598 /* sign: positive:1, negative:0 */
599 #define BIGNUM_SIGN(b) ((RBASIC(b)->flags & BIGNUM_SIGN_BIT) != 0)
600 #define BIGNUM_SET_SIGN(b,sign) \
601  ((sign) ? (RBASIC(b)->flags |= BIGNUM_SIGN_BIT) \
602  : (RBASIC(b)->flags &= ~BIGNUM_SIGN_BIT))
603 #define BIGNUM_POSITIVE_P(b) BIGNUM_SIGN(b)
604 #define BIGNUM_NEGATIVE_P(b) (!BIGNUM_SIGN(b))
605 #define BIGNUM_NEGATE(b) (RBASIC(b)->flags ^= BIGNUM_SIGN_BIT)
606 
607 #define BIGNUM_EMBED_FLAG ((VALUE)FL_USER2)
608 #define BIGNUM_EMBED_LEN_MASK ((VALUE)(FL_USER5|FL_USER4|FL_USER3))
609 #define BIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+BIGNUM_EMBED_LEN_NUMBITS)
610 #define BIGNUM_LEN(b) \
611  ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
612  (size_t)((RBASIC(b)->flags >> BIGNUM_EMBED_LEN_SHIFT) & \
613  (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT)) : \
614  RBIGNUM(b)->as.heap.len)
615 /* LSB:BIGNUM_DIGITS(b)[0], MSB:BIGNUM_DIGITS(b)[BIGNUM_LEN(b)-1] */
616 #define BIGNUM_DIGITS(b) \
617  ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
618  RBIGNUM(b)->as.ary : \
619  RBIGNUM(b)->as.heap.digits)
620 #define BIGNUM_LENINT(b) rb_long2int(BIGNUM_LEN(b))
621 
622 #define RBIGNUM(obj) (R_CAST(RBignum)(obj))
623 
624 struct RRational {
625  struct RBasic basic;
626  const VALUE num;
627  const VALUE den;
628 };
629 
630 #define RRATIONAL(obj) (R_CAST(RRational)(obj))
631 #define RRATIONAL_SET_NUM(rat, n) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->num,(n))
632 #define RRATIONAL_SET_DEN(rat, d) RB_OBJ_WRITE((rat), &((struct RRational *)(rat))->den,(d))
633 
634 struct RFloat {
635  struct RBasic basic;
636  double float_value;
637 };
638 
639 #define RFLOAT(obj) (R_CAST(RFloat)(obj))
640 
641 struct RComplex {
642  struct RBasic basic;
643  const VALUE real;
644  const VALUE imag;
645 };
646 
647 #define RCOMPLEX(obj) (R_CAST(RComplex)(obj))
648 
649 #ifdef RCOMPLEX_SET_REAL /* shortcut macro for internal only */
650 #undef RCOMPLEX_SET_REAL
651 #undef RCOMPLEX_SET_IMAG
652 #define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
653 #define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
654 #endif
655 
656 struct RHash {
657  struct RBasic basic;
658  struct st_table *ntbl; /* possibly 0 */
659  int iter_lev;
660  const VALUE ifnone;
661 };
662 
663 #define RHASH(obj) (R_CAST(RHash)(obj))
664 
665 #ifdef RHASH_ITER_LEV
666 #undef RHASH_ITER_LEV
667 #undef RHASH_IFNONE
668 #undef RHASH_SIZE
669 #define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev)
670 #define RHASH_IFNONE(h) (RHASH(h)->ifnone)
671 #define RHASH_SIZE(h) (RHASH(h)->ntbl ? RHASH(h)->ntbl->num_entries : (st_index_t)0)
672 #endif
673 
674 /* missing/setproctitle.c */
675 #ifndef HAVE_SETPROCTITLE
676 extern void ruby_init_setproctitle(int argc, char *argv[]);
677 #endif
678 
679 #define RSTRUCT_EMBED_LEN_MAX RSTRUCT_EMBED_LEN_MAX
680 #define RSTRUCT_EMBED_LEN_MASK RSTRUCT_EMBED_LEN_MASK
681 #define RSTRUCT_EMBED_LEN_SHIFT RSTRUCT_EMBED_LEN_SHIFT
682 enum {
684  RSTRUCT_EMBED_LEN_MASK = (RUBY_FL_USER2|RUBY_FL_USER1),
686 
688 };
689 
690 struct RStruct {
691  struct RBasic basic;
692  union {
693  struct {
694  long len;
695  const VALUE *ptr;
696  } heap;
698  } as;
699 };
700 
701 #undef RSTRUCT_LEN
702 #undef RSTRUCT_PTR
703 #undef RSTRUCT_SET
704 #undef RSTRUCT_GET
705 #define RSTRUCT_EMBED_LEN(st) \
706  (long)((RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \
707  (RSTRUCT_EMBED_LEN_MASK >> RSTRUCT_EMBED_LEN_SHIFT))
708 #define RSTRUCT_LEN(st) rb_struct_len(st)
709 #define RSTRUCT_LENINT(st) rb_long2int(RSTRUCT_LEN(st))
710 #define RSTRUCT_CONST_PTR(st) rb_struct_const_ptr(st)
711 #define RSTRUCT_PTR(st) ((VALUE *)RSTRUCT_CONST_PTR(RB_OBJ_WB_UNPROTECT_FOR(STRUCT, st)))
712 #define RSTRUCT_SET(st, idx, v) RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v))
713 #define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx])
714 #define RSTRUCT(obj) (R_CAST(RStruct)(obj))
715 
716 static inline long
717 rb_struct_len(VALUE st)
718 {
719  return (RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
720  RSTRUCT_EMBED_LEN(st) : RSTRUCT(st)->as.heap.len;
721 }
722 
723 static inline const VALUE *
724 rb_struct_const_ptr(VALUE st)
725 {
726  return FIX_CONST_VALUE_PTR((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ?
727  RSTRUCT(st)->as.ary : RSTRUCT(st)->as.heap.ptr);
728 }
729 
730 /* class.c */
731 
733  char conflict[sizeof(VALUE) * 3];
734 };
735 
736 struct rb_subclass_entry;
738 
742 };
743 
744 #if defined(HAVE_LONG_LONG)
745 typedef unsigned LONG_LONG rb_serial_t;
746 #define SERIALT2NUM ULL2NUM
747 #elif defined(HAVE_UINT64_T)
748 typedef uint64_t rb_serial_t;
749 #define SERIALT2NUM SIZET2NUM
750 #else
751 typedef unsigned long rb_serial_t;
752 #define SERIALT2NUM ULONG2NUM
753 #endif
754 
757  struct st_table *iv_tbl;
768  rb_serial_t class_serial;
769  const VALUE origin_;
772 };
773 
775 
776 #undef RClass
777 struct RClass {
778  struct RBasic basic;
782 };
783 
784 void rb_class_subclass_add(VALUE super, VALUE klass);
787 
788 #define RCLASS_EXT(c) (RCLASS(c)->ptr)
789 #define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
790 #define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
791 #define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
792 #define RCLASS_CALLABLE_M_TBL(c) (RCLASS_EXT(c)->callable_m_tbl)
793 #define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl)
794 #define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin_)
795 #define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
796 #define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial)
797 
798 #define RICLASS_IS_ORIGIN FL_USER5
799 
800 static inline void
801 RCLASS_SET_ORIGIN(VALUE klass, VALUE origin)
802 {
803  RB_OBJ_WRITE(klass, &RCLASS_ORIGIN(klass), origin);
804  if (klass != origin) FL_SET(origin, RICLASS_IS_ORIGIN);
805 }
806 
807 #undef RCLASS_SUPER
808 static inline VALUE
809 RCLASS_SUPER(VALUE klass)
810 {
811  return RCLASS(klass)->super;
812 }
813 
814 static inline VALUE
815 RCLASS_SET_SUPER(VALUE klass, VALUE super)
816 {
817  if (super) {
819  rb_class_subclass_add(super, klass);
820  }
821  RB_OBJ_WRITE(klass, &RCLASS(klass)->super, super);
822  return super;
823 }
824 /* IMEMO: Internal memo object */
825 
826 #ifndef IMEMO_DEBUG
827 #define IMEMO_DEBUG 0
828 #endif
829 
830 struct RIMemo {
836 };
837 
848 };
849 #define IMEMO_MASK 0x0f
850 
851 static inline enum imemo_type
852 imemo_type(VALUE imemo)
853 {
854  return (RBASIC(imemo)->flags >> FL_USHIFT) & IMEMO_MASK;
855 }
856 
857 static inline int
858 imemo_type_p(VALUE imemo, enum imemo_type imemo_type)
859 {
860  if (LIKELY(!RB_SPECIAL_CONST_P(imemo))) {
861  /* fixed at compile time if imemo_type is given. */
862  const VALUE mask = (IMEMO_MASK << FL_USHIFT) | RUBY_T_MASK;
863  const VALUE expected_type = (imemo_type << FL_USHIFT) | T_IMEMO;
864  /* fixed at runtime. */
865  return expected_type == (RBASIC(imemo)->flags & mask);
866  }
867  else {
868  return 0;
869  }
870 }
871 
872 /* FL_USER0 to FL_USER3 is for type */
873 #define IMEMO_FL_USHIFT (FL_USHIFT + 4)
874 #define IMEMO_FL_USER0 FL_USER4
875 #define IMEMO_FL_USER1 FL_USER5
876 #define IMEMO_FL_USER2 FL_USER6
877 #define IMEMO_FL_USER3 FL_USER7
878 #define IMEMO_FL_USER4 FL_USER8
879 
880 /* CREF (Class REFerence) is defined in method.h */
881 
883 struct vm_svar {
887  const VALUE backref;
888  const VALUE others;
889 };
890 
891 
892 #define THROW_DATA_CONSUMED IMEMO_FL_USER0
893 
901 };
902 
903 #define THROW_DATA_P(err) RB_TYPE_P((VALUE)(err), T_IMEMO)
904 
905 /* IFUNC (Internal FUNCtion) */
906 
908 #if SIZEOF_INT * 2 > SIZEOF_VALUE
909  int min: (SIZEOF_VALUE * CHAR_BIT) / 2;
910  int max: (SIZEOF_VALUE * CHAR_BIT) / 2;
911 #else
912  int min, max;
913 #endif
914 };
915 
917 struct vm_ifunc {
920  VALUE (*func)(ANYARGS);
921  const void *data;
923 };
924 
925 #define IFUNC_NEW(a, b, c) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
926 struct vm_ifunc *rb_vm_ifunc_new(VALUE (*func)(ANYARGS), const void *data, int min_argc, int max_argc);
927 static inline struct vm_ifunc *
928 rb_vm_ifunc_proc_new(VALUE (*func)(ANYARGS), const void *data)
929 {
930  return rb_vm_ifunc_new(func, data, 0, UNLIMITED_ARGUMENTS);
931 }
932 
933 typedef struct rb_imemo_alloc_struct {
936  VALUE *ptr; /* malloc'ed buffer */
937  struct rb_imemo_alloc_struct *next; /* next imemo */
938  size_t cnt; /* buffer size in VALUE */
940 
945 struct MEMO {
948  const VALUE v1;
949  const VALUE v2;
950  union {
951  long cnt;
952  long state;
953  const VALUE value;
954  VALUE (*func)(ANYARGS);
955  } u3;
956 };
957 
958 #define MEMO_V1_SET(m, v) RB_OBJ_WRITE((m), &(m)->v1, (v))
959 #define MEMO_V2_SET(m, v) RB_OBJ_WRITE((m), &(m)->v2, (v))
960 
961 #define MEMO_CAST(m) ((struct MEMO *)m)
962 
963 #define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
964 
965 #define roomof(x, y) (((x) + (y) - 1) / (y))
966 #define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
967 #define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
968 #define NEW_MEMO_FOR(type, value) \
969  ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
970 #define NEW_PARTIAL_MEMO_FOR(type, value, member) \
971  ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), \
972  rb_ary_set_len((value), offsetof(type, member) / sizeof(VALUE)), \
973  MEMO_FOR(type, value))
974 
975 #define STRING_P(s) (RB_TYPE_P((s), T_STRING) && CLASS_OF(s) == rb_cString)
976 
977 #ifdef RUBY_INTEGER_UNIFICATION
978 # define rb_cFixnum rb_cInteger
979 # define rb_cBignum rb_cInteger
980 #endif
981 
982 enum {
987 };
988 
989 struct cmp_opt_data {
990  unsigned int opt_methods;
991  unsigned int opt_inited;
992 };
993 
994 #define NEW_CMP_OPT_MEMO(type, value) \
995  NEW_PARTIAL_MEMO_FOR(type, value, cmp_opt)
996 #define CMP_OPTIMIZABLE_BIT(type) (1U << TOKEN_PASTE(cmp_opt_,type))
997 #define CMP_OPTIMIZABLE(data, type) \
998  (((data).opt_inited & CMP_OPTIMIZABLE_BIT(type)) ? \
999  ((data).opt_methods & CMP_OPTIMIZABLE_BIT(type)) : \
1000  (((data).opt_inited |= CMP_OPTIMIZABLE_BIT(type)), \
1001  rb_method_basic_definition_p(TOKEN_PASTE(rb_c,type), id_cmp) && \
1002  ((data).opt_methods |= CMP_OPTIMIZABLE_BIT(type))))
1003 
1004 #define OPTIMIZED_CMP(a, b, data) \
1005  ((FIXNUM_P(a) && FIXNUM_P(b) && CMP_OPTIMIZABLE(data, Fixnum)) ? \
1006  (((long)a > (long)b) ? 1 : ((long)a < (long)b) ? -1 : 0) : \
1007  (STRING_P(a) && STRING_P(b) && CMP_OPTIMIZABLE(data, String)) ? \
1008  rb_str_cmp(a, b) : \
1009  (RB_FLOAT_TYPE_P(a) && RB_FLOAT_TYPE_P(b) && CMP_OPTIMIZABLE(data, Float)) ? \
1010  rb_float_cmp(a, b) : \
1011  rb_cmpint(rb_funcallv(a, id_cmp, 1, &b), a, b))
1012 
1013 /* ment is in method.h */
1014 
1015 /* global variable */
1016 
1020 };
1021 
1026 
1027 struct vtm; /* defined by timev.h */
1028 
1029 /* array.c */
1030 VALUE rb_ary_last(int, const VALUE *, VALUE);
1031 void rb_ary_set_len(VALUE, long);
1033 VALUE rb_ary_tmp_new_fill(long capa);
1035 size_t rb_ary_memsize(VALUE);
1036 #ifdef __GNUC__
1037 #define rb_ary_new_from_args(n, ...) \
1038  __extension__ ({ \
1039  const VALUE args_to_new_ary[] = {__VA_ARGS__}; \
1040  if (__builtin_constant_p(n)) { \
1041  STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \
1042  } \
1043  rb_ary_new_from_values(numberof(args_to_new_ary), args_to_new_ary); \
1044  })
1045 #endif
1046 
1047 /* bignum.c */
1048 extern const char ruby_digitmap[];
1049 double rb_big_fdiv_double(VALUE x, VALUE y);
1054 size_t rb_big_size(VALUE);
1057 VALUE rb_cstr_parse_inum(const char *str, ssize_t len, char **endp, int base);
1064 VALUE rb_big_gt(VALUE x, VALUE y);
1065 VALUE rb_big_ge(VALUE x, VALUE y);
1066 VALUE rb_big_lt(VALUE x, VALUE y);
1067 VALUE rb_big_le(VALUE x, VALUE y);
1068 
1069 /* class.c */
1074 void rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE);
1078 VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj);
1079 VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj);
1080 VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj);
1081 VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj);
1085 void Init_class_hierarchy(void);
1086 
1088 void rb_undef_methods_from(VALUE klass, VALUE super);
1089 
1090 /* compar.c */
1092 
1093 /* compile.c */
1094 struct rb_block;
1095 int rb_dvar_defined(ID, const struct rb_block *);
1096 int rb_local_defined(ID, const struct rb_block *);
1097 CONSTFUNC(const char * rb_insns_name(int i));
1099 
1100 /* complex.c */
1105 
1106 /* cont.c */
1109 void ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE (*rollback_func)(ANYARGS));
1110 
1111 /* debug.c */
1112 PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
1113 
1114 /* dir.c */
1116 
1117 /* dmyext.c */
1118 void Init_enc(void);
1119 void Init_ext(void);
1120 
1121 /* encoding.c */
1122 ID rb_id_encoding(void);
1123 CONSTFUNC(void rb_gc_mark_encodings(void));
1126 int rb_encdb_replicate(const char *alias, const char *orig);
1127 int rb_encdb_alias(const char *alias, const char *orig);
1128 int rb_encdb_dummy(const char *name);
1129 void rb_encdb_declare(const char *name);
1130 void rb_enc_set_base(const char *name, const char *orig);
1131 int rb_enc_set_dummy(int index);
1132 void rb_encdb_set_unicode(int index);
1134 
1135 /* enum.c */
1136 VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
1137 VALUE rb_nmin_run(VALUE obj, VALUE num, int by, int rev, int ary);
1138 
1139 /* error.c */
1140 extern VALUE rb_eEAGAIN;
1141 extern VALUE rb_eEWOULDBLOCK;
1142 extern VALUE rb_eEINPROGRESS;
1143 void rb_report_bug_valist(VALUE file, int line, const char *fmt, va_list args);
1144 VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding*, const char*, va_list);
1146 NORETURN(void rb_async_bug_errno(const char *,int));
1147 const char *rb_builtin_type_name(int t);
1148 const char *rb_builtin_class_name(VALUE x);
1149 PRINTF_ARGS(void rb_sys_warn(const char *fmt, ...), 1, 2);
1150 PRINTF_ARGS(void rb_syserr_warn(int err, const char *fmt, ...), 2, 3);
1151 PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
1152 PRINTF_ARGS(void rb_sys_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
1153 PRINTF_ARGS(void rb_syserr_enc_warn(int err, rb_encoding *enc, const char *fmt, ...), 3, 4);
1154 PRINTF_ARGS(void rb_sys_warning(const char *fmt, ...), 1, 2);
1155 PRINTF_ARGS(void rb_syserr_warning(int err, const char *fmt, ...), 2, 3);
1156 PRINTF_ARGS(void rb_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
1157 PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
1158 PRINTF_ARGS(void rb_syserr_enc_warning(int err, rb_encoding *enc, const char *fmt, ...), 3, 4);
1159 
1160 #define rb_raise_cstr(etype, mesg) \
1161  rb_exc_raise(rb_exc_new_str(etype, rb_str_new_cstr(mesg)))
1162 #define rb_raise_static(etype, mesg) \
1163  rb_exc_raise(rb_exc_new_str(etype, rb_str_new_static(mesg, rb_strlen_lit(mesg))))
1164 
1165 VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method);
1166 #define rb_name_err_raise_str(mesg, recv, name) \
1167  rb_exc_raise(rb_name_err_new(mesg, recv, name))
1168 #define rb_name_err_raise(mesg, recv, name) \
1169  rb_name_err_raise_str(rb_fstring_cstr(mesg), (recv), (name))
1170 VALUE rb_key_err_new(VALUE mesg, VALUE recv, VALUE name);
1171 #define rb_key_err_raise(mesg, recv, name) \
1172  rb_exc_raise(rb_key_err_new(mesg, recv, name))
1173 NORETURN(void ruby_deprecated_internal_feature(const char *));
1174 #define DEPRECATED_INTERNAL_FEATURE(func) \
1175  (ruby_deprecated_internal_feature(func), UNREACHABLE)
1177 VALUE rb_warning_string(const char *fmt, ...);
1178 
1179 /* eval.c */
1181 
1182 /* eval_error.c */
1184 
1185 /* eval_jump.c */
1186 void rb_call_end_proc(VALUE data);
1187 void rb_mark_end_proc(void);
1188 
1189 /* file.c */
1190 VALUE rb_home_dir_of(VALUE user, VALUE result);
1192 VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
1193 VALUE rb_check_realpath(VALUE basedir, VALUE path);
1194 void rb_file_const(const char*, VALUE);
1195 int rb_file_load_ok(const char *);
1201 void Init_File(void);
1202 int ruby_is_fd_loadable(int fd);
1203 
1204 #ifdef RUBY_FUNCTION_NAME_STRING
1205 # if defined __GNUC__ && __GNUC__ >= 4
1206 # pragma GCC visibility push(default)
1207 # endif
1208 NORETURN(void rb_sys_fail_path_in(const char *func_name, VALUE path));
1209 NORETURN(void rb_syserr_fail_path_in(const char *func_name, int err, VALUE path));
1210 # if defined __GNUC__ && __GNUC__ >= 4
1211 # pragma GCC visibility pop
1212 # endif
1213 # define rb_sys_fail_path(path) rb_sys_fail_path_in(RUBY_FUNCTION_NAME_STRING, path)
1214 # define rb_syserr_fail_path(err, path) rb_syserr_fail_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path))
1215 #else
1216 # define rb_sys_fail_path(path) rb_sys_fail_str(path)
1217 # define rb_syserr_fail_path(err, path) rb_syserr_fail_str((err), (path))
1218 #endif
1219 
1220 /* gc.c */
1222 extern int ruby_disable_gc;
1223 void Init_heap(void);
1224 void *ruby_mimmalloc(size_t size);
1225 void ruby_mimfree(void *ptr);
1227 #if USE_RGENGC
1229 #else
1230 #define rb_gc_writebarrier_remember(obj) 0
1231 #endif
1232 void ruby_gc_set_params(int safe_level);
1234 
1235 #if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32)
1236 #define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size)
1237 #define ruby_sized_xrealloc2(ptr, new_count, element_size, old_count) ruby_xrealloc(ptr, new_count, element_size)
1238 #define ruby_sized_xfree(ptr, size) ruby_xfree(ptr)
1239 #define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n)
1240 #else
1241 void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_ALLOC_SIZE((2));
1242 void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_ALLOC_SIZE((2, 3));
1243 void ruby_sized_xfree(void *x, size_t size);
1244 #define SIZED_REALLOC_N(var,type,n,old_n) ((var)=(type*)ruby_sized_xrealloc((char*)(var), (n) * sizeof(type), (old_n) * sizeof(type)))
1245 #endif
1246 
1247 /* optimized version of NEWOBJ() */
1248 #undef NEWOBJF_OF
1249 #undef RB_NEWOBJ_OF
1250 #define RB_NEWOBJ_OF(obj,type,klass,flags) \
1251  type *(obj) = (type*)(((flags) & FL_WB_PROTECTED) ? \
1252  rb_wb_protected_newobj_of(klass, (flags) & ~FL_WB_PROTECTED) : \
1253  rb_wb_unprotected_newobj_of(klass, flags))
1254 #define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags)
1255 
1256 /* hash.c */
1257 struct st_table *rb_hash_tbl_raw(VALUE hash);
1262 long rb_objid_hash(st_index_t index);
1263 long rb_dbl_long_hash(double d);
1267 
1268 #define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
1269 VALUE rb_hash_keys(VALUE hash);
1270 VALUE rb_hash_values(VALUE hash);
1271 VALUE rb_hash_rehash(VALUE hash);
1273 #define HASH_PROC_DEFAULT FL_USER2
1274 
1275 /* inits.c */
1276 void rb_call_inits(void);
1277 
1278 /* io.c */
1279 const char *ruby_get_inplace_mode(void);
1280 void ruby_set_inplace_mode(const char *);
1281 ssize_t rb_io_bufread(VALUE io, void *buf, size_t size);
1284 size_t rb_io_memsize(const rb_io_t *);
1285 int rb_stderr_tty_p(void);
1286 
1287 /* load.c */
1288 VALUE rb_get_load_path(void);
1290 int rb_require_internal(VALUE fname, int safe);
1291 NORETURN(void rb_load_fail(VALUE, const char*));
1292 
1293 /* loadpath.c */
1294 extern const char ruby_exec_prefix[];
1295 extern const char ruby_initial_load_paths[];
1296 
1297 /* localeinit.c */
1299 
1300 /* math.c */
1306 VALUE rb_math_log(int argc, const VALUE *argv);
1310 
1311 /* newline.c */
1312 void Init_newline(void);
1313 
1314 /* numeric.c */
1315 
1316 #define FIXNUM_POSITIVE_P(num) ((SIGNED_VALUE)(num) > (SIGNED_VALUE)INT2FIX(0))
1317 #define FIXNUM_NEGATIVE_P(num) ((SIGNED_VALUE)(num) < 0)
1318 #define FIXNUM_ZERO_P(num) ((num) == INT2FIX(0))
1319 
1320 #define INT_NEGATIVE_P(x) (FIXNUM_P(x) ? FIXNUM_NEGATIVE_P(x) : BIGNUM_NEGATIVE_P(x))
1321 
1322 #ifndef ROUND_DEFAULT
1323 # define ROUND_DEFAULT RUBY_NUM_ROUND_HALF_UP
1324 #endif
1330 };
1331 #define ROUND_TO(mode, even, up, down) \
1332  ((mode) == RUBY_NUM_ROUND_HALF_EVEN ? even : \
1333  (mode) == RUBY_NUM_ROUND_HALF_UP ? up : down)
1334 #define ROUND_FUNC(mode, name) \
1335  ROUND_TO(mode, name##_half_even, name##_half_up, name##_half_down)
1336 #define ROUND_CALL(mode, name, args) \
1337  ROUND_TO(mode, name##_half_even args, \
1338  name##_half_up args, name##_half_down args)
1339 
1340 int rb_num_to_uint(VALUE val, unsigned int *ret);
1341 VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl);
1342 int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl);
1343 double ruby_float_mod(double x, double y);
1345 VALUE rb_int_succ(VALUE num);
1346 VALUE rb_int_pred(VALUE num);
1351 VALUE rb_int_mul(VALUE x, VALUE y);
1354 VALUE rb_int_round(VALUE num, int ndigits, enum ruby_num_rounding_mode mode);
1355 VALUE rb_int2str(VALUE num, int base);
1356 VALUE rb_dbl_hash(double d);
1358 VALUE rb_int_gt(VALUE x, VALUE y);
1359 int rb_float_cmp(VALUE x, VALUE y);
1361 VALUE rb_int_ge(VALUE x, VALUE y);
1363 double rb_int_fdiv_double(VALUE x, VALUE y);
1364 VALUE rb_int_pow(VALUE x, VALUE y);
1366 VALUE rb_int_cmp(VALUE x, VALUE y);
1369 VALUE rb_int_and(VALUE x, VALUE y);
1371 VALUE rb_int_div(VALUE x, VALUE y);
1372 VALUE rb_int_abs(VALUE num);
1373 VALUE rb_float_abs(VALUE flt);
1376 
1377 #if USE_FLONUM
1378 #define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
1379 #define RUBY_BIT_ROTR(v, n) (((v) >> (n)) | ((v) << ((sizeof(v) * 8) - n)))
1380 #endif
1381 
1382 static inline double
1383 rb_float_flonum_value(VALUE v)
1384 {
1385 #if USE_FLONUM
1386  if (v != (VALUE)0x8000000000000002) { /* LIKELY */
1387  union {
1388  double d;
1389  VALUE v;
1390  } t;
1391 
1392  VALUE b63 = (v >> 63);
1393  /* e: xx1... -> 011... */
1394  /* xx0... -> 100... */
1395  /* ^b63 */
1396  t.v = RUBY_BIT_ROTR((2 - b63) | (v & ~(VALUE)0x03), 3);
1397  return t.d;
1398  }
1399 #endif
1400  return 0.0;
1401 }
1402 
1403 static inline double
1404 rb_float_noflonum_value(VALUE v)
1405 {
1406  return ((struct RFloat *)v)->float_value;
1407 }
1408 
1409 static inline double
1410 rb_float_value_inline(VALUE v)
1411 {
1412  if (FLONUM_P(v)) {
1413  return rb_float_flonum_value(v);
1414  }
1415  return rb_float_noflonum_value(v);
1416 }
1417 
1418 static inline VALUE
1419 rb_float_new_inline(double d)
1420 {
1421 #if USE_FLONUM
1422  union {
1423  double d;
1424  VALUE v;
1425  } t;
1426  int bits;
1427 
1428  t.d = d;
1429  bits = (int)((VALUE)(t.v >> 60) & 0x7);
1430  /* bits contains 3 bits of b62..b60. */
1431  /* bits - 3 = */
1432  /* b011 -> b000 */
1433  /* b100 -> b001 */
1434 
1435  if (t.v != 0x3000000000000000 /* 1.72723e-77 */ &&
1436  !((bits-3) & ~0x01)) {
1437  return (RUBY_BIT_ROTL(t.v, 3) & ~(VALUE)0x01) | 0x02;
1438  }
1439  else if (t.v == (VALUE)0) {
1440  /* +0.0 */
1441  return 0x8000000000000002;
1442  }
1443  /* out of range */
1444 #endif
1445  return rb_float_new_in_heap(d);
1446 }
1447 
1448 #define rb_float_value(v) rb_float_value_inline(v)
1449 #define rb_float_new(d) rb_float_new_inline(d)
1450 
1451 /* object.c */
1452 void rb_obj_copy_ivar(VALUE dest, VALUE obj);
1453 CONSTFUNC(VALUE rb_obj_equal(VALUE obj1, VALUE obj2));
1454 CONSTFUNC(VALUE rb_obj_not(VALUE obj));
1456 NORETURN(void rb_undefined_alloc(VALUE klass));
1457 double rb_num_to_dbl(VALUE val);
1458 VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound);
1460 VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2);
1461 VALUE rb_convert_type_with_id(VALUE,int,const char*,ID);
1462 VALUE rb_check_convert_type_with_id(VALUE,int,const char*,ID);
1463 
1464 struct RBasicRaw {
1467 };
1468 
1469 #define RBASIC_CLEAR_CLASS(obj) memset(&(((struct RBasicRaw *)((VALUE)(obj)))->klass), 0, sizeof(VALUE))
1470 #define RBASIC_SET_CLASS_RAW(obj, cls) memcpy(&((struct RBasicRaw *)((VALUE)(obj)))->klass, &(cls), sizeof(VALUE))
1471 #define RBASIC_SET_CLASS(obj, cls) do { \
1472  VALUE _obj_ = (obj); \
1473  RB_OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \
1474 } while (0)
1475 
1476 /* parse.y */
1477 #ifndef USE_SYMBOL_GC
1478 #define USE_SYMBOL_GC 1
1479 #endif
1482 VALUE rb_parser_set_context(VALUE, const struct rb_block *, int);
1483 void *rb_parser_load_file(VALUE parser, VALUE name);
1498 PUREFUNC(int rb_is_method_sym(VALUE sym));
1500 ID rb_make_internal_id(void);
1502 ID rb_id_attrget(ID id);
1503 
1504 /* proc.c */
1507 int rb_block_arity(void);
1508 int rb_block_min_max_arity(int *max);
1510 VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val, int min_argc, int max_argc);
1511 VALUE rb_block_to_s(VALUE self, const struct rb_block *block, const char *additional_info);
1512 
1513 /* process.c */
1514 #define RB_MAX_GROUPS (65536)
1515 
1516 struct rb_execarg {
1517  union {
1518  struct {
1520  } sh;
1521  struct {
1523  VALUE command_abspath; /* full path string or nil */
1526  } cmd;
1527  } invoke;
1532  unsigned use_shell : 1;
1533  unsigned pgroup_given : 1;
1534  unsigned umask_given : 1;
1536  unsigned unsetenv_others_do : 1;
1537  unsigned close_others_given : 1;
1538  unsigned close_others_do : 1;
1539  unsigned chdir_given : 1;
1540  unsigned new_pgroup_given : 1;
1541  unsigned new_pgroup_flag : 1;
1542  unsigned uid_given : 1;
1543  unsigned gid_given : 1;
1544  rb_pid_t pgroup_pgid; /* asis(-1), new pgroup(0), specified pgroup (0<V). */
1545  VALUE rlimit_limits; /* Qfalse or [[rtype, softlim, hardlim], ...] */
1547  rb_uid_t uid;
1548  rb_gid_t gid;
1554  VALUE env_modification; /* Qfalse or [[k1,v1], ...] */
1557 };
1558 
1559 /* argv_str contains extra two elements.
1560  * The beginning one is for /bin/sh used by exec_with_sh.
1561  * The last one for terminating NULL used by execve.
1562  * See rb_exec_fillarg() in process.c. */
1563 #define ARGVSTR2ARGC(argv_str) (RSTRING_LEN(argv_str) / sizeof(char *) - 2)
1564 #define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1)
1565 
1566 rb_pid_t rb_fork_ruby(int *status);
1567 void rb_last_status_clear(void);
1568 
1569 /* rational.c */
1571 VALUE rb_rational_plus(VALUE self, VALUE other);
1572 VALUE rb_lcm(VALUE x, VALUE y);
1574 VALUE rb_cstr_to_rat(const char *, int);
1576 VALUE rb_rational_cmp(VALUE self, VALUE other);
1578 
1579 /* re.c */
1580 VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline);
1582 long rb_reg_search0(VALUE, VALUE, long, int, int);
1583 VALUE rb_reg_match_p(VALUE re, VALUE str, long pos);
1584 bool rb_reg_start_with_p(VALUE re, VALUE str);
1585 void rb_backref_set_string(VALUE string, long pos, long len);
1586 int rb_match_count(VALUE match);
1587 int rb_match_nth_defined(int nth, VALUE match);
1588 
1589 /* signal.c */
1590 extern int ruby_enable_coredump;
1591 int rb_get_next_signal(void);
1592 int rb_sigaltstack_size(void);
1593 
1594 /* st.c */
1595 extern void rb_hash_bulk_insert(long, const VALUE *, VALUE);
1596 
1597 /* strftime.c */
1598 #ifdef RUBY_ENCODING_H
1599 VALUE rb_strftime_timespec(const char *format, size_t format_len, rb_encoding *enc,
1600  const struct vtm *vtm, struct timespec *ts, int gmt);
1601 VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc,
1602  const struct vtm *vtm, VALUE timev, int gmt);
1603 #endif
1604 
1605 /* string.c */
1607 VALUE rb_fstring_new(const char *ptr, long len);
1608 #define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
1609 #define rb_fstring_literal(str) rb_fstring_lit(str)
1610 VALUE rb_fstring_cstr(const char *str);
1611 #ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
1612 # define rb_fstring_cstr(str) RB_GNUC_EXTENSION_BLOCK( \
1613  (__builtin_constant_p(str)) ? \
1614  rb_fstring_new((str), (long)strlen(str)) : \
1615  rb_fstring_cstr(str) \
1616 )
1617 #endif
1618 #ifdef RUBY_ENCODING_H
1619 VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc);
1620 #define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc))
1621 #define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc)
1622 VALUE rb_fstring_enc_cstr(const char *ptr, rb_encoding *enc);
1623 # ifdef HAVE_BUILTIN___BUILTIN_CONSTANT_P
1624 # define rb_fstring_enc_cstr(str, enc) RB_GNUC_EXTENSION_BLOCK( \
1625  (__builtin_constant_p(str)) ? \
1626  rb_fstring_enc_new((str), (long)strlen(str), (enc)) : \
1627  rb_fstring_enc_cstr(str, enc) \
1628 )
1629 # endif
1630 #endif
1631 int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
1632 int rb_str_symname_p(VALUE);
1635 #define QUOTE(str) rb_str_quote_unprintable(str)
1636 #define QUOTE_ID(id) rb_id_quote_unprintable(id)
1637 char *rb_str_fill_terminator(VALUE str, const int termlen);
1638 void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen);
1639 VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
1641 void rb_str_tmp_frozen_release(VALUE str, VALUE tmp);
1642 VALUE rb_str_chomp_string(VALUE str, VALUE chomp);
1643 #ifdef RUBY_ENCODING_H
1645 VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
1646  rb_encoding *from, int ecflags, VALUE ecopts);
1647 VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl);
1648 VALUE rb_str_initialize(VALUE str, const char *ptr, long len, rb_encoding *enc);
1649 #endif
1650 #define STR_NOEMBED FL_USER1
1651 #define STR_SHARED FL_USER2 /* = ELTS_SHARED */
1652 #define STR_EMBED_P(str) (!FL_TEST_RAW((str), STR_NOEMBED))
1653 #define STR_SHARED_P(s) FL_ALL_RAW((s), STR_NOEMBED|ELTS_SHARED)
1654 #define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT)
1655 #define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN)
1656 size_t rb_str_memsize(VALUE);
1657 VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, VALUE passed_proc);
1659 char *rb_str_to_cstr(VALUE str);
1660 VALUE rb_str_eql(VALUE str1, VALUE str2);
1661 
1662 /* symbol.c */
1663 #ifdef RUBY_ENCODING_H
1664 VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);
1665 VALUE rb_sym_intern_cstr(const char *ptr, rb_encoding *enc);
1666 #ifdef __GNUC__
1667 #define rb_sym_intern_cstr(ptr, enc) __extension__ ( \
1668 { \
1669  (__builtin_constant_p(ptr)) ? \
1670  rb_sym_intern((ptr), (long)strlen(ptr), (enc)) : \
1671  rb_sym_intern_cstr((ptr), (enc)); \
1672 })
1673 #endif
1674 #endif
1675 VALUE rb_sym_intern_ascii(const char *ptr, long len);
1676 VALUE rb_sym_intern_ascii_cstr(const char *ptr);
1677 #ifdef __GNUC__
1678 #define rb_sym_intern_ascii_cstr(ptr) __extension__ ( \
1679 { \
1680  (__builtin_constant_p(ptr)) ? \
1681  rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \
1682  rb_sym_intern_ascii_cstr(ptr); \
1683 })
1684 #endif
1685 
1686 /* struct.c */
1689 
1690 /* time.c */
1691 struct timeval rb_time_timeval(VALUE);
1692 
1693 /* thread.c */
1694 #define COVERAGE_INDEX_LINES 0
1695 #define COVERAGE_INDEX_BRANCHES 1
1696 #define COVERAGE_INDEX_METHODS 2
1697 #define COVERAGE_TARGET_LINES 1
1698 #define COVERAGE_TARGET_BRANCHES 2
1699 #define COVERAGE_TARGET_METHODS 4
1700 
1702 VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
1704 void rb_clear_trace_func(void);
1705 VALUE rb_get_coverages(void);
1711 int rb_thread_to_be_killed(VALUE thread);
1712 void rb_mutex_allow_trap(VALUE self, int val);
1713 VALUE rb_uninterruptible(VALUE (*b_proc)(ANYARGS), VALUE data);
1715 
1716 /* thread_pthread.c, thread_win32.c */
1717 void Init_native_thread(void);
1718 int rb_divert_reserved_fd(int fd);
1719 
1720 /* transcode.c */
1722 size_t rb_econv_memsize(rb_econv_t *);
1723 
1724 /* us_ascii.c */
1726 
1727 /* util.c */
1728 char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve);
1729 char *ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve);
1730 
1731 /* utf_8.c */
1733 
1734 /* variable.c */
1735 void rb_gc_mark_global_tbl(void);
1739 VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
1740 void rb_autoload_str(VALUE mod, ID id, VALUE file);
1741 void rb_deprecate_constant(VALUE mod, const char *name);
1742 
1743 /* version.c */
1744 extern const char ruby_engine[];
1745 
1746 /* vm_insnhelper.h */
1747 rb_serial_t rb_next_class_serial(void);
1748 
1749 /* vm.c */
1751 void rb_vm_mark(void *ptr);
1752 void Init_BareVM(void);
1753 void Init_vm_objects(void);
1756 void rb_vm_change_state(void);
1758 const void **rb_vm_get_insns_address_table(void);
1759 VALUE rb_sourcefilename(void);
1760 VALUE rb_source_location(int *pline);
1761 const char *rb_source_loc(int *pline);
1762 void rb_vm_pop_cfunc_frame(void);
1763 int rb_vm_add_root_module(ID id, VALUE module);
1765 VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
1768 
1769 
1770 /* vm_dump.c */
1771 void rb_print_backtrace(void);
1772 
1773 /* vm_eval.c */
1774 void Init_vm_eval(void);
1777 typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE);
1778 VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
1779  rb_check_funcall_hook *hook, VALUE arg);
1783 VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv,
1784  rb_block_call_func_t bl_proc, int min_argc, int max_argc,
1785  VALUE data2);
1786 
1787 /* vm_insnhelper.c */
1788 VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
1789 VALUE rb_eql_opt(VALUE obj1, VALUE obj2);
1790 
1791 /* vm_method.c */
1792 void Init_eval_method(void);
1793 int rb_method_defined_by(VALUE obj, ID mid, VALUE (*cfunc)(ANYARGS));
1794 
1795 /* miniprelude.c, prelude.c */
1796 void Init_prelude(void);
1797 
1798 /* vm_backtrace.c */
1799 void Init_vm_backtrace(void);
1800 VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval);
1801 VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval);
1802 
1803 VALUE rb_make_backtrace(void);
1805 int rb_backtrace_p(VALUE obj);
1808 void rb_backtrace_each(VALUE (*iter)(VALUE recv, VALUE str), VALUE output);
1809 
1811 const char *rb_objspace_data_type_name(VALUE obj);
1812 
1813 /* Temporary. This API will be removed (renamed). */
1814 VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd);
1815 
1816 /* bignum.c (export) */
1823 VALUE rb_big2str_poweroftwo(VALUE x, int base);
1824 VALUE rb_big2str_generic(VALUE x, int base);
1825 VALUE rb_str2big_poweroftwo(VALUE arg, int base, int badcheck);
1826 VALUE rb_str2big_normal(VALUE arg, int base, int badcheck);
1827 VALUE rb_str2big_karatsuba(VALUE arg, int base, int badcheck);
1828 #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
1829 VALUE rb_big_mul_gmp(VALUE x, VALUE y);
1830 VALUE rb_big_divrem_gmp(VALUE x, VALUE y);
1831 VALUE rb_big2str_gmp(VALUE x, int base);
1832 VALUE rb_str2big_gmp(VALUE arg, int base, int badcheck);
1833 #endif
1840 };
1841 VALUE rb_int_parse_cstr(const char *str, ssize_t len, char **endp, size_t *ndigits, int base, int flags);
1842 
1843 /* error.c (export) */
1844 int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
1845 NORETURN(void rb_unexpected_type(VALUE,int));
1846 #undef Check_Type
1847 #define Check_Type(v, t) \
1848  (!RB_TYPE_P((VALUE)(v), (t)) || \
1849  ((t) == RUBY_T_DATA && RTYPEDDATA_P(v)) ? \
1850  rb_unexpected_type((VALUE)(v), (t)) : (void)0)
1851 
1852 /* file.c (export) */
1853 #ifdef HAVE_READLINK
1854 VALUE rb_readlink(VALUE path, rb_encoding *enc);
1855 #endif
1856 #ifdef __APPLE__
1857 VALUE rb_str_normalize_ospath(const char *ptr, long len);
1858 #endif
1859 
1860 /* hash.c (export) */
1862 VALUE rb_ident_hash_new(void);
1863 
1864 /* io.c (export) */
1865 void rb_maygvl_fd_fix_cloexec(int fd);
1866 int rb_gc_for_fd(int err);
1867 void rb_write_error_str(VALUE mesg);
1868 
1869 /* numeric.c (export) */
1870 VALUE rb_int_positive_pow(long x, unsigned long y);
1871 
1872 /* process.c (export) */
1873 int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
1874 rb_pid_t rb_fork_async_signal_safe(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen);
1875 VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell);
1876 struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
1877 VALUE rb_execarg_init(int argc, const VALUE *argv, int accept_shell, VALUE execarg_obj);
1878 int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
1879 void rb_execarg_parent_start(VALUE execarg_obj);
1880 void rb_execarg_parent_end(VALUE execarg_obj);
1881 int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
1882 VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash);
1883 void rb_execarg_setenv(VALUE execarg_obj, VALUE env);
1884 
1885 /* rational.c (export) */
1886 VALUE rb_gcd(VALUE x, VALUE y);
1887 VALUE rb_gcd_normal(VALUE self, VALUE other);
1888 #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
1889 VALUE rb_gcd_gmp(VALUE x, VALUE y);
1890 #endif
1891 
1892 /* string.c (export) */
1893 #ifdef RUBY_ENCODING_H
1894 /* internal use */
1895 VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc);
1896 #endif
1897 
1898 /* thread.c (export) */
1899 int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
1900 
1901 /* util.c (export) */
1902 extern const signed char ruby_digit36_to_number_table[];
1903 extern const char ruby_hexdigits[];
1904 extern unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow);
1905 
1906 /* variable.c (export) */
1909 int rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
1910 st_table *rb_st_copy(VALUE obj, struct st_table *orig_tbl);
1911 
1912 /* gc.c (export) */
1915 
1916 size_t rb_obj_memsize_of(VALUE);
1918 
1919 #define RB_OBJ_GC_FLAGS_MAX 5
1920 size_t rb_obj_gc_flags(VALUE, ID[], size_t);
1921 void rb_gc_mark_values(long n, const VALUE *values);
1922 
1923 #if IMEMO_DEBUG
1924 VALUE rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line);
1925 #define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__)
1926 #else
1927 VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0);
1928 #endif
1929 
1931 
1932 #define RUBY_DTRACE_CREATE_HOOK(name, arg) \
1933  RUBY_DTRACE_HOOK(name##_CREATE, arg)
1934 #define RUBY_DTRACE_HOOK(name, arg) \
1935 do { \
1936  if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
1937  int dtrace_line; \
1938  const char *dtrace_file = rb_source_loc(&dtrace_line); \
1939  if (!dtrace_file) dtrace_file = ""; \
1940  RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
1941  } \
1942 } while (0)
1943 
1944 #define RB_OBJ_BUILTIN_TYPE(obj) rb_obj_builtin_type(obj)
1945 #define OBJ_BUILTIN_TYPE(obj) RB_OBJ_BUILTIN_TYPE(obj)
1946 #ifdef __GNUC__
1947 #define rb_obj_builtin_type(obj) \
1948 __extension__({ \
1949  VALUE arg_obj = (obj); \
1950  RB_SPECIAL_CONST_P(arg_obj) ? -1 : \
1951  RB_BUILTIN_TYPE(arg_obj); \
1952  })
1953 #else
1954 static inline int
1955 rb_obj_builtin_type(VALUE obj)
1956 {
1957  return RB_SPECIAL_CONST_P(obj) ? -1 :
1958  RB_BUILTIN_TYPE(obj);
1959 }
1960 #endif
1961 
1962 #if defined(__cplusplus)
1963 #if 0
1964 { /* satisfy cc-mode */
1965 #endif
1966 } /* extern "C" { */
1967 #endif
1968 
1969 #endif /* RUBY_INTERNAL_H */
VALUE fd_dup2
Definition: internal.h:1550
VALUE rb_int_plus(VALUE x, VALUE y)
Definition: numeric.c:3519
#define RSTRUCT_EMBED_LEN(st)
Definition: internal.h:705
VALUE rb_rational_cmp(VALUE self, VALUE other)
Definition: rational.c:1115
double ruby_float_mod(double x, double y)
Definition: numeric.c:1202
void rb_class_remove_from_super_subclasses(VALUE)
Definition: class.c:76
st_table * rb_init_identtable_with_size(st_index_t size)
Definition: hash.c:2938
int rb_stderr_tty_p(void)
Definition: io.c:7602
VALUE rb_int_cmp(VALUE x, VALUE y)
Definition: numeric.c:4095
VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc)
Definition: string.c:1042
void rb_execarg_setenv(VALUE execarg_obj, VALUE env)
Definition: process.c:2293
void rb_hash_bulk_insert(long, const VALUE *, VALUE)
Definition: st.c:2169
double rb_big_fdiv_double(VALUE x, VALUE y)
Definition: bignum.c:6154
const VALUE num
Definition: internal.h:626
void rb_class_detach_subclasses(VALUE)
Definition: class.c:133
long len
Definition: internal.h:694
VALUE rb_int_uminus(VALUE num)
Definition: numeric.c:3388
int rb_method_defined_by(VALUE obj, ID mid, VALUE(*cfunc)(ANYARGS))
VALUE rb_hash_new_with_size(st_index_t size)
Definition: hash.c:430
VALUE rb_math_sqrt(VALUE)
Definition: math.c:627
void rb_vm_inc_const_missing_count(void)
Definition: vm.c:330
VALUE rb_parser_get_yydebug(VALUE)
Definition: ripper.c:17442
VALUE rb_block_to_s(VALUE self, const struct rb_block *block, const char *additional_info)
Definition: proc.c:1248
VALUE rb_get_path_check(VALUE, int)
Definition: file.c:213
VALUE rb_big_mul_balance(VALUE x, VALUE y)
Definition: bignum.c:1671
struct st_table * iv_index_tbl
Definition: internal.h:756
VALUE(* rb_block_call_func_t)(ANYARGS)
Definition: ruby.h:1858
rb_encoding * rb_enc_get_from_index(int index)
Definition: encoding.c:628
VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc)
Definition: symbol.c:1022
int rb_encdb_alias(const char *alias, const char *orig)
Definition: encoding.c:572
VALUE rb_insns_name_array(void)
Definition: compile.c:6976
VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline)
Definition: re.c:2919
VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl)
Definition: string.c:9645
const VALUE v2
Definition: internal.h:949
iterator function
Definition: internal.h:843
VALUE rb_gvar_get(struct rb_global_entry *)
Definition: variable.c:792
VALUE rb_big_remainder(VALUE x, VALUE y)
Definition: bignum.c:6064
BDIGIT * digits
Definition: internal.h:592
Definition: st.h:79
void rb_gc_free_dsymbol(VALUE)
Definition: symbol.c:629
void void ruby_sized_xfree(void *x, size_t size)
Definition: gc.c:8077
CONSTFUNC(const char *rb_insns_name(int i))
VALUE throw_state
Definition: internal.h:900
int rb_block_min_max_arity(int *max)
Definition: proc.c:1070
int rb_is_global_name(VALUE name)
Definition: symbol.c:1088
VALUE rb_execarg_init(int argc, const VALUE *argv, int accept_shell, VALUE execarg_obj)
Definition: process.c:2276
int rb_is_instance_name(VALUE name)
Definition: symbol.c:1094
void * ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_ALLOC_SIZE((2))
Definition: gc.c:8039
const char ruby_exec_prefix[]
Definition: loadpath.c:59
VALUE rb_cstr_to_rat(const char *, int)
Definition: rational.c:2559
VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE)
void rb_str_tmp_frozen_release(VALUE str, VALUE tmp)
Definition: string.c:1183
rb_subclass_entry_t * next
Definition: internal.h:741
void rb_gc_mark_values(long n, const VALUE *values)
Definition: gc.c:4097
VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc)
Definition: string.c:368
#define FIX_CONST_VALUE_PTR(x)
Definition: ruby.h:2059
#define FL_USHIFT
Definition: ruby.h:1218
void ruby_set_inplace_mode(const char *)
Definition: io.c:12381
VALUE rb_yield_force_blockarg(VALUE values)
Definition: vm_eval.c:1026
void Init_BareVM(void)
Definition: vm.c:3122
unsigned umask_given
Definition: internal.h:1534
VALUE rb_hash_values(VALUE hash)
Definition: hash.c:2175
const VALUE cref_or_me
class reference or rb_method_entry_t
Definition: internal.h:885
VALUE rb_big2str_generic(VALUE x, int base)
Definition: bignum.c:4975
VALUE rb_math_exp(VALUE)
int rb_float_cmp(VALUE x, VALUE y)
Definition: numeric.c:1481
VALUE rb_fstring_cstr(const char *str)
Definition: string.c:388
int rb_is_attrset_sym(VALUE sym)
Definition: symbol.c:886
void rb_class_remove_from_module_subclasses(VALUE)
Definition: class.c:94
int ruby_disable_gc
Definition: gc.c:832
struct vm_ifunc * rb_vm_ifunc_new(VALUE(*func)(ANYARGS), const void *data, int min_argc, int max_argc)
Definition: proc.c:640
struct rb_id_table * const_tbl
Definition: internal.h:758
VALUE rb_obj_is_thread(VALUE obj)
Definition: vm.c:2506
VALUE rb_reg_check_preprocess(VALUE)
Definition: re.c:2672
VALUE rb_current_realfilepath(void)
Definition: vm_eval.c:2145
VALUE rb_int_round(VALUE num, int ndigits, enum ruby_num_rounding_mode mode)
Definition: numeric.c:2094
VALUE rlimit_limits
Definition: internal.h:1545
#define RSTRUCT_EMBED_LEN_SHIFT
Definition: internal.h:681
int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char *errmsg, size_t errmsg_buflen)
Definition: process.c:3021
unsigned uid_given
Definition: internal.h:1542
Definition: io.h:62
void Init_newline(void)
VALUE rb_backtrace_to_location_ary(VALUE obj)
Definition: vm_backtrace.c:625
size_t rb_big_size(VALUE)
Definition: bignum.c:6716
int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen)
Definition: process.c:3150
int rb_is_method_name(VALUE name)
Definition: symbol.c:1112
VALUE rb_str_quote_unprintable(VALUE)
Definition: string.c:10108
VALUE rb_fstring_enc_new(const char *ptr, long len, rb_encoding *enc)
Definition: string.c:381
VALUE rb_struct_init_copy(VALUE copy, VALUE s)
Definition: struct.c:809
VALUE rb_obj_not_equal(VALUE obj1, VALUE obj2)
call-seq: obj != other -> true or false
Definition: object.c:236
VALUE rb_int_equal(VALUE x, VALUE y)
Definition: numeric.c:4045
VALUE rb_float_abs(VALUE flt)
Definition: numeric.c:1692
struct st_table * rb_hash_tbl_raw(VALUE hash)
Definition: hash.c:482
unsigned unsetenv_others_given
Definition: internal.h:1535
VALUE rb_eEAGAIN
Definition: error.c:52
VALUE rb_suppress_tracing(VALUE(*func)(VALUE), VALUE arg)
Definition: vm_trace.c:376
#define FIXNUM_MIN
Definition: ruby.h:229
void ruby_debug_printf(const char *format,...)
Definition: debug.c:76
VALUE * ruby_initial_gc_stress_ptr
Definition: gc.c:738
VALUE rb_big_size_m(VALUE big)
Definition: bignum.c:6722
bool rb_reg_start_with_p(VALUE re, VALUE str)
Definition: re.c:1584
int close_others_maxhint
Definition: internal.h:1549
rb_subclass_entry_t * subclasses
Definition: internal.h:760
VALUE rb_default_coverage(int)
Definition: thread.c:5081
const char * ruby_get_inplace_mode(void)
Definition: io.c:12375
VALUE rb_check_convert_type_with_id(VALUE, int, const char *, ID)
Definition: object.c:3022
VALUE reserved
Definition: internal.h:919
VALUE flags
Definition: internal.h:946
void rb_ary_set_len(VALUE, long)
Definition: array.c:1625
VALUE rb_strftime_timespec(const char *format, size_t format_len, rb_encoding *enc, const struct vtm *vtm, struct timespec *ts, int gmt)
Definition: strftime.c:925
VALUE rb_complex_abs(VALUE x)
Definition: complex.c:1469
VALUE klass
Definition: internal.h:1466
VALUE v0
Definition: internal.h:832
#define RB_SPECIAL_CONST_P(x)
Definition: ruby.h:1241
void rb_backtrace_each(VALUE(*iter)(VALUE recv, VALUE str), VALUE output)
Definition: vm_backtrace.c:796
void * ruby_mimmalloc(size_t size)
Definition: gc.c:8094
VALUE rb_lcm(VALUE x, VALUE y)
Definition: rational.c:1941
int rb_encdb_replicate(const char *alias, const char *orig)
Definition: encoding.c:454
rb_pid_t rb_fork_ruby(int *status)
VALUE rb_int_minus(VALUE x, VALUE y)
Definition: numeric.c:3558
VALUE rb_str_locktmp_ensure(VALUE str, VALUE(*func)(VALUE), VALUE arg)
Definition: string.c:2620
void Init_class_hierarchy(void)
Definition: class.c:546
VALUE rb_int_mul(VALUE x, VALUE y)
Definition: numeric.c:3608
int rb_gc_for_fd(int err)
Definition: io.c:878
int rb_is_global_sym(VALUE sym)
Definition: symbol.c:874
VALUE rb_default_home_dir(VALUE result)
Definition: file.c:3327
char * rb_str_fill_terminator(VALUE str, const int termlen)
Definition: string.c:2238
VALUE rb_parser_set_yydebug(VALUE, VALUE)
Definition: ripper.c:17457
VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc, const struct vtm *vtm, VALUE timev, int gmt)
Definition: strftime.c:915
void Init_vm_eval(void)
Definition: vm_eval.c:2155
#define IMEMO_MASK
Definition: internal.h:849
VALUE rb_str_initialize(VALUE str, const char *ptr, long len, rb_encoding *enc)
Definition: string.c:936
void Init_vm_objects(void)
Definition: vm.c:3145
long cnt
Definition: internal.h:951
void rb_vm_check_redefinition_by_prepend(VALUE klass)
Definition: vm.c:1552
VALUE rb_file_expand_path_fast(VALUE, VALUE)
Definition: file.c:3782
const void ** rb_vm_get_insns_address_table(void)
Definition: vm_exec.c:130
int ruby_thread_has_gvl_p(void)
Definition: thread.c:1543
VALUE rb_readlink(VALUE path, rb_encoding *resultenc)
Definition: file.c:599
size_t rb_io_memsize(const rb_io_t *)
Definition: io.c:4439
VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell)
Definition: process.c:2257
#define RUBY_BIT_ROTL(v, n)
Definition: internal.h:1378
void Init_vm_backtrace(void)
Definition: vm_backtrace.c:986
void * ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_ALLOC_SIZE((2
VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd)
Definition: thread.c:1436
VALUE rb_math_cos(VALUE)
void rb_mutex_allow_trap(VALUE self, int val)
Definition: thread_sync.c:511
VALUE rb_int_divmod(VALUE x, VALUE y)
Definition: numeric.c:3873
VALUE rb_int_gt(VALUE x, VALUE y)
Definition: numeric.c:4135
VALUE env_modification
Definition: internal.h:1554
VALUE rb_math_sinh(VALUE)
VALUE rb_attr_delete(VALUE, ID)
Definition: variable.c:1266
struct RBignum::@76::@77 heap
const char * alias
Definition: nkf.c:1151
VALUE rb_refinement_module_get_refined_class(VALUE module)
Definition: eval.c:1388
size_t rb_ary_memsize(VALUE)
Definition: array.c:571
VALUE rb_big_le(VALUE x, VALUE y)
Definition: bignum.c:5455
unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow)
Definition: util.c:84
special variable
Definition: internal.h:841
VALUE flags
Definition: internal.h:831
st_data_t st_index_t
Definition: st.h:50
ID id
Definition: internal.h:1019
void rb_enc_set_base(const char *name, const char *orig)
Definition: encoding.c:389
double float_value
Definition: internal.h:636
void rb_call_inits(void)
Definition: inits.c:17
const VALUE backref
Definition: internal.h:887
int rb_hash_add_new_element(VALUE hash, VALUE key, VALUE val)
Definition: hash.c:3150
double rb_int_fdiv_double(VALUE x, VALUE y)
Definition: numeric.c:3637
const char * rb_source_loc(int *pline)
Definition: vm.c:1313
rb_subclass_entry_t ** parent_subclasses
Definition: internal.h:761
#define RUBY_ATTR_ALLOC_SIZE(params)
Definition: defines.h:193
rb_encoding OnigEncodingUS_ASCII
#define RSTRUCT(obj)
Definition: internal.h:714
VALUE envp_str
Definition: internal.h:1529
VALUE rb_big_mul_karatsuba(VALUE x, VALUE y)
Definition: bignum.c:1852
void rb_load_fail(VALUE path, const char *err)
Definition: error.c:2575
int rb_file_load_ok(const char *)
Definition: file.c:5852
int rb_match_count(VALUE match)
Definition: re.c:1258
enum ruby_num_rounding_mode rb_num_get_rounding_option(VALUE opts)
Definition: numeric.c:198
VALUE rb_equal_opt(VALUE obj1, VALUE obj2)
VALUE rb_dir_getwd_ospath(void)
Definition: dir.c:1089
int rb_local_defined(ID, const struct rb_block *)
Definition: compile.c:7517
#define RSTRUCT_EMBED_LEN_MAX
Definition: internal.h:679
#define sym(x)
Definition: date_core.c:3721
#define BIGNUM_EMBED_LEN_MAX
Definition: internal.h:581
VALUE rb_fstring_enc_cstr(const char *ptr, rb_encoding *enc)
Definition: string.c:394
VALUE rb_check_backtrace(VALUE)
Definition: error.c:1045
VALUE rb_warning_warn(VALUE mod, VALUE str)
Definition: error.c:179
VALUE rb_ary_tmp_new_fill(long capa)
Definition: array.c:550
unsigned unsetenv_others_do
Definition: internal.h:1536
const VALUE den
Definition: internal.h:627
SVAR (Special VARiable)
Definition: internal.h:883
int rb_is_junk_sym(VALUE sym)
Definition: symbol.c:898
VALUE rb_big_mul_normal(VALUE x, VALUE y)
Definition: bignum.c:1543
VALUE rb_gvar_set(struct rb_global_entry *, VALUE)
Definition: variable.c:825
VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE)
Definition: gc.c:1982
VALUE rb_float_equal(VALUE x, VALUE y)
Definition: numeric.c:1378
void rb_encdb_set_unicode(int index)
Definition: encoding.c:583
void ruby_register_rollback_func_for_ensure(VALUE(*ensure_func)(ANYARGS), VALUE(*rollback_func)(ANYARGS))
Definition: cont.c:1034
void rb_vm_change_state(void)
unsigned int opt_inited
Definition: internal.h:991
void * rb_parser_load_file(VALUE parser, VALUE name)
Definition: ruby.c:2036
#define RUBY_BIT_ROTR(v, n)
Definition: internal.h:1379
Definition: ruby.h:954
VALUE rb_parser_set_context(VALUE, const struct rb_block *, int)
Definition: ripper.c:17367
VALUE rb_ary_last(int, const VALUE *, VALUE)
Definition: array.c:1380
VALUE rb_str2big_poweroftwo(VALUE arg, int base, int badcheck)
Definition: bignum.c:4245
VALUE rb_int_idiv(VALUE x, VALUE y)
Definition: numeric.c:3753
int rb_str_symname_p(VALUE)
Definition: string.c:10089
unsigned long long uint64_t
Definition: sha2.h:102
VALUE rb_class_inherited(VALUE, VALUE)
Calls Class::inherited.
Definition: class.c:620
rb_int_parse_flags
Definition: internal.h:1834
struct rb_id_table * callable_m_tbl
Definition: internal.h:759
rb_gid_t gid
Definition: internal.h:1548
VALUE rb_get_path_check_convert(VALUE, VALUE, int)
Definition: file.c:197
struct rb_execarg * rb_execarg_get(VALUE execarg_obj)
Definition: process.c:2268
VALUE rb_ident_hash_new(void)
Definition: hash.c:2924
#define div(x, y)
Definition: date_strftime.c:27
void Init_ext(void)
Definition: dmyext.c:2
int rb_data_is_encoding(VALUE obj)
Definition: encoding.c:90
VALUE rb_big_bit_length(VALUE big)
Definition: bignum.c:6728
rb_encoding * rb_enc_check_str(VALUE str1, VALUE str2)
Definition: encoding.c:868
VALUE rb_str_chomp_string(VALUE str, VALUE chomp)
Definition: string.c:8342
const char * rb_insns_name(int i)
Definition: compile.c:6970
Definition: internal.h:739
void rb_vm_mark(void *ptr)
Definition: vm.c:2124
VALUE rb_convert_type_with_id(VALUE, int, const char *, ID)
Definition: object.c:2979
size_t rb_generic_ivar_memsize(VALUE)
Definition: variable.c:1150
VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval)
Definition: vm_backtrace.c:907
VALUE rb_big_aref(VALUE x, VALUE y)
Definition: bignum.c:6619
VALUE rb_gvar_defined(struct rb_global_entry *)
Definition: variable.c:860
#define val
Definition: internal.h:1017
void rb_async_bug_errno(const char *mesg, int errno_arg)
Definition: error.c:573
BDIGIT ary[BIGNUM_EMBED_LEN_MAX]
Definition: internal.h:594
VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound)
Definition: object.c:3699
double rb_num_to_dbl(VALUE val)
Definition: object.c:3484
VALUE rb_special_singleton_class(VALUE)
Definition: class.c:1579
VALUE rb_int_ge(VALUE x, VALUE y)
Definition: numeric.c:4175
VALUE rb_get_coverages(void)
Definition: thread.c:5044
const VALUE imag
Definition: internal.h:644
VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict)
Definition: file.c:4078
int rb_num_negative_p(VALUE)
Definition: numeric.c:342
VALUE rb_thread_shield_release(VALUE self)
Definition: thread.c:4467
#define FL_SET(x, f)
Definition: ruby.h:1288
VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc)
Definition: hash.c:1025
VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, VALUE passed_proc)
Definition: string.c:10206
int rb_class_has_methods(VALUE c)
Definition: class.c:2040
VALUE rb_id_quote_unprintable(ID)
Definition: string.c:10129
VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash)
Definition: process.c:1928
VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
Definition: numeric.c:2544
VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj)
Definition: class.c:1379
int rb_require_internal(VALUE fname, int safe)
Definition: load.c:962
ruby_num_rounding_mode
Definition: internal.h:1325
Definition: ruby.h:854
rb_encoding OnigEncodingUTF_8
Definition: onigmo.h:201
rb_classext_t * ptr
Definition: internal.h:780
#define RCLASS_ORIGIN(c)
Definition: internal.h:794
void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE)
Definition: internal.h:1777
rb_uid_t uid
Definition: internal.h:1547
const VALUE real
Definition: internal.h:643
int rb_match_nth_defined(int nth, VALUE match)
Definition: re.c:1268
VALUE rb_sym_intern_ascii(const char *ptr, long len)
Definition: symbol.c:1036
VALUE flags
Definition: internal.h:896
struct rb_imemo_alloc_struct * next
Definition: internal.h:937
VALUE command_name
Definition: internal.h:1522
const VALUE others
Definition: internal.h:888
rb_pid_t pgroup_pgid
Definition: internal.h:1544
VALUE rb_int2str(VALUE num, int base)
Definition: numeric.c:3471
VALUE command_abspath
Definition: internal.h:1523
VALUE rb_complex_sqrt(VALUE x)
void rb_class_subclass_add(VALUE super, VALUE klass)
Definition: class.c:36
rb_pid_t rb_fork_async_signal_safe(int *status, int(*chfunc)(void *, char *, size_t), void *charg, VALUE fds, char *errmsg, size_t errmsg_buflen)
void rb_encdb_declare(const char *name)
Definition: encoding.c:357
VALUE rb_int_parse_cstr(const char *str, ssize_t len, char **endp, size_t *ndigits, int base, int flags)
Definition: bignum.c:4021
VALUE rb_obj_is_mutex(VALUE obj)
Definition: thread_sync.c:127
VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE)
Definition: file.c:3397
THROW_DATA.
Definition: internal.h:895
VALUE rb_cstr_parse_inum(const char *str, ssize_t len, char **endp, int base)
Definition: bignum.c:4219
MEMO.
Definition: internal.h:945
VALUE rb_int_and(VALUE x, VALUE y)
Definition: numeric.c:4350
const VALUE throw_obj
Definition: internal.h:898
st_table * rb_vm_fstring_table(void)
Definition: vm.c:3211
#define FLONUM_P(x)
Definition: ruby.h:399
int rb_dvar_defined(ID, const struct rb_block *)
Definition: compile.c:7492
void Init_File(void)
Definition: file.c:6081
int argc
Definition: ruby.c:187
VALUE rb_io_flush_raw(VALUE, int)
Definition: io.c:1553
VALUE rb_int_lshift(VALUE x, VALUE y)
Definition: numeric.c:4466
VALUE rb_struct_lookup(VALUE s, VALUE idx)
Definition: struct.c:936
VALUE rb_str_eql(VALUE str1, VALUE str2)
Definition: string.c:3234
const char * rb_builtin_type_name(int t)
Definition: error.c:648
VALUE rb_proc_location(VALUE self)
Definition: proc.c:1142
void rb_file_const(const char *, VALUE)
Definition: file.c:5713
VALUE rb_float_eql(VALUE x, VALUE y)
Definition: numeric.c:1648
VALUE rb_immutable_obj_clone(int, VALUE *, VALUE)
Definition: object.c:406
int rb_is_class_sym(VALUE sym)
Definition: symbol.c:868
void rb_obj_copy_ivar(VALUE dest, VALUE obj)
Definition: object.c:307
VALUE rb_hash_compare_by_id_p(VALUE hash)
Definition: hash.c:2913
int err
Definition: win32.c:135
VALUE rb_int_pred(VALUE num)
Definition: numeric.c:3255
int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl)
Definition: numeric.c:2513
char * ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve)
Definition: util.c:3144
VALUE rb_int_abs(VALUE num)
Definition: numeric.c:4635
VALUE rb_float_new_in_heap(double)
Definition: numeric.c:922
int rb_backtrace_p(VALUE obj)
Definition: vm_backtrace.c:410
void rb_sys_enc_warning(rb_encoding *enc, const char *fmt,...)
Definition: error.c:2553
VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements)
Definition: vm_eval.c:1584
VALUE rb_invcmp(VALUE, VALUE)
Definition: compar.c:46
void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj)
Definition: gc.c:6104
struct st_table * ntbl
Definition: internal.h:658
int rb_is_local_sym(VALUE sym)
Definition: symbol.c:892
size_t len
Definition: internal.h:591
VALUE rb_int_modulo(VALUE x, VALUE y)
Definition: numeric.c:3796
VALUE rb_float_gt(VALUE x, VALUE y)
Definition: numeric.c:1497
VALUE rb_backtrace_to_str_ary(VALUE obj)
Definition: vm_backtrace.c:578
class reference
Definition: internal.h:840
VALUE rb_int_succ(VALUE num)
Definition: numeric.c:3229
VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval)
Definition: vm_backtrace.c:901
VALUE v2
Definition: internal.h:834
unsigned close_others_given
Definition: internal.h:1537
VALUE rb_get_load_path(void)
Definition: load.c:30
VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv, rb_check_funcall_hook *hook, VALUE arg)
Definition: vm_eval.c:417
VALUE rb_hash_keys(VALUE hash)
Definition: hash.c:2131
long rb_reg_search0(VALUE, VALUE, long, int, int)
Definition: re.c:1489
void rb_deprecate_constant(VALUE mod, const char *name)
Definition: variable.c:2749
#define MUL_OVERFLOW_FIXNUM_P(a, b)
Definition: internal.h:122
ID rb_id_encoding(void)
Definition: encoding.c:753
void rb_class_foreach_subclass(VALUE klass, void(*f)(VALUE, VALUE), VALUE)
Definition: class.c:113
void rb_last_status_clear(void)
Definition: process.c:494
int rb_encdb_dummy(const char *name)
Definition: encoding.c:476
struct st_table * iv_tbl
Definition: internal.h:757
VALUE rb_hash_has_key(VALUE hash, VALUE key)
Definition: hash.c:2219
unsigned long rb_serial_t
Definition: internal.h:751
VALUE rb_complex_plus(VALUE, VALUE)
Definition: complex.c:706
int rb_get_next_signal(void)
Definition: signal.c:741
void rb_execarg_parent_start(VALUE execarg_obj)
Definition: process.c:2457
VALUE rb_big_mul_toom3(VALUE x, VALUE y)
Definition: bignum.c:2249
int rb_is_const_name(VALUE name)
Definition: symbol.c:1076
void Init_prelude(void)
VALUE reserved
Definition: internal.h:897
#define RICLASS_IS_ORIGIN
Definition: internal.h:798
VALUE rb_math_atan2(VALUE, VALUE)
VALUE rb_include_class_new(VALUE, VALUE)
Definition: class.c:818
void rb_print_backtrace(void)
Definition: vm_dump.c:698
VALUE rb_const_missing(VALUE klass, VALUE name)
Definition: variable.c:1747
VALUE klass
Definition: internal.h:740
VALUE rb_class_search_ancestor(VALUE klass, VALUE super)
Definition: object.c:863
#define RUBY_SYMBOL_EXPORT_END
Definition: missing.h:49
void rb_mark_end_proc(void)
Definition: eval_jump.c:80
VALUE argv_str
Definition: internal.h:1524
char * ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve)
Definition: util.c:3899
size_t rb_str_memsize(VALUE)
Definition: string.c:1338
void rb_thread_execute_interrupts(VALUE th)
Definition: thread.c:2107
VALUE rb_thread_shield_destroy(VALUE self)
Definition: thread.c:4478
VALUE redirect_fds
Definition: internal.h:1528
void rb_call_end_proc(VALUE data)
Definition: eval_jump.c:11
unsigned char buf[MIME_BUF_SIZE]
Definition: nkf.c:4309
unsigned close_others_do
Definition: internal.h:1538
void rb_vm_pop_cfunc_frame(void)
Definition: vm.c:532
#define T_IMEMO
Definition: ruby.h:511
VALUE rb_fix_plus(VALUE x, VALUE y)
Definition: numeric.c:3513
PUREFUNC(int rb_data_is_encoding(VALUE obj))
unsigned long ID
Definition: ruby.h:86
int rb_block_arity(void)
Definition: proc.c:1036
long state
Definition: internal.h:952
VALUE path_env
Definition: internal.h:1555
const signed char ruby_digit36_to_number_table[]
Definition: escape.c:6
const char ruby_digitmap[]
Definition: bignum.c:38
unsigned int uintptr_t
Definition: win32.h:106
unsigned new_pgroup_given
Definition: internal.h:1540
VALUE rb_sym_to_proc(VALUE sym)
Definition: proc.c:1198
#define mode_t
Definition: win32.h:119
void Init_heap(void)
Definition: gc.c:2381
VALUE rb_big_hash(VALUE)
Definition: bignum.c:6664
IFUNC (Internal FUNCtion)
Definition: internal.h:917
VALUE rb_integer_float_eq(VALUE x, VALUE y)
Definition: bignum.c:5335
size_t rb_econv_memsize(rb_econv_t *)
Definition: transcode.c:1716
unsigned long VALUE
Definition: ruby.h:85
VALUE rb_big_mul(VALUE x, VALUE y)
Definition: bignum.c:5881
#define RSTRUCT_EMBED_LEN_MASK
Definition: internal.h:680
VALUE rb_vm_top_self(void)
Definition: vm.c:3166
void rb_undef_methods_from(VALUE klass, VALUE super)
Definition: class.c:1547
#define RBASIC(obj)
Definition: ruby.h:1197
void rb_report_bug_valist(VALUE file, int line, const char *fmt, va_list args)
Definition: error.c:597
VALUE rb_big_ge(VALUE x, VALUE y)
Definition: bignum.c:5443
struct RBasic basic
Definition: internal.h:588
VALUE rb_str2big_normal(VALUE arg, int base, int badcheck)
Definition: bignum.c:4281
const char ruby_initial_load_paths[]
Definition: loadpath.c:62
VALUE rb_check_realpath(VALUE basedir, VALUE path)
Definition: file.c:4086
VALUE rb_int_div(VALUE x, VALUE y)
Definition: numeric.c:3726
#define RUBY_SYMBOL_EXPORT_BEGIN
Definition: missing.h:48
VALUE argv_buf
Definition: internal.h:1525
void Init_native_thread(void)
VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
Definition: gc.c:2020
VALUE rb_make_metaclass(VALUE, VALUE)
Definition: class.c:577
void ruby_mimfree(void *ptr)
Definition: gc.c:8110
VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj)
Definition: class.c:1349
int rb_is_class_name(VALUE name)
Definition: symbol.c:1082
VALUE rb_f_send(int argc, VALUE *argv, VALUE recv)
Definition: vm_eval.c:933
VALUE rb_math_cosh(VALUE)
int Init_enc_set_filesystem_encoding(void)
Definition: localeinit.c:118
VALUE rb_syntax_error_append(VALUE, VALUE, int, int, rb_encoding *, const char *, va_list)
Definition: error.c:111
mode_t umask_mask
Definition: internal.h:1546
unsigned pgroup_given
Definition: internal.h:1533
int rb_sigaltstack_size(void)
void rb_unexpected_type(VALUE x, int t)
Definition: error.c:739
VALUE flags
Definition: internal.h:884
VALUE flags
Definition: internal.h:918
VALUE rb_uninterruptible(VALUE(*b_proc)(ANYARGS), VALUE data)
Definition: thread.c:5128
VALUE rb_fstring(VALUE)
Definition: string.c:306
VALUE rb_blocking_function_t(void *)
Definition: intern.h:873
VALUE fd_dup2_child
Definition: internal.h:1553
int rb_is_const_sym(VALUE sym)
Definition: symbol.c:862
void rb_class_detach_module_subclasses(VALUE)
Definition: class.c:145
VALUE rb_cEncodingConverter
Definition: transcode.c:23
#define CHAR_BIT
Definition: ruby.h:196
const VALUE origin_
Definition: internal.h:769
VALUE rb_fstring_new(const char *ptr, long len)
Definition: string.c:374
struct rb_global_variable * var
Definition: internal.h:1018
VALUE rb_sym_intern_ascii_cstr(const char *ptr)
Definition: symbol.c:1042
#define LONG2NUM(x)
Definition: ruby.h:1573
VALUE rb_nmin_run(VALUE obj, VALUE num, int by, int rev, int ary)
Definition: enum.c:1417
const char * rb_builtin_class_name(VALUE x)
Definition: error.c:684
unsigned int uint32_t
Definition: sha2.h:101
int rb_thread_to_be_killed(VALUE thread)
Definition: thread.c:2302
VALUE rb_wb_protected_newobj_of(VALUE, VALUE)
Definition: gc.c:1989
VALUE fd_open
Definition: internal.h:1552
VALUE rb_eql_opt(VALUE obj1, VALUE obj2)
void rb_write_error_str(VALUE mesg)
Definition: io.c:7580
VALUE rb_rational_plus(VALUE self, VALUE other)
Definition: rational.c:767
#define RB_OBJ_WRITE(a, slot, b)
Definition: eval_intern.h:175
void rb_thread_recycle_stack_release(VALUE *)
Definition: vm.c:2355
VALUE rb_sym_intern_cstr(const char *ptr, rb_encoding *enc)
Definition: symbol.c:1030
int size
Definition: encoding.c:57
VALUE rb_thread_shield_new(void)
Definition: thread.c:4422
ID rb_id_attrget(ID id)
Definition: symbol.c:158
int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p)
Definition: string.c:5704
VALUE reserved
Definition: internal.h:947
VALUE rb_get_backtrace(VALUE info)
Definition: error.c:1004
VALUE rb_make_backtrace(void)
Definition: vm_backtrace.c:813
void rb_mark_generic_ivar(VALUE)
Definition: variable.c:1123
VALUE rb_hash_rehash(VALUE hash)
Definition: hash.c:779
#define f
void rb_fiber_reset_root_local_storage(VALUE)
Definition: cont.c:1612
#define UNLIMITED_ARGUMENTS
Definition: intern.h:44
VALUE rb_str2big_karatsuba(VALUE arg, int base, int badcheck)
Definition: bignum.c:4323
#define RCLASS_SUPER(c)
Definition: classext.h:16
int ruby_enable_coredump
Definition: signal.c:1449
const struct rb_control_frame_struct * catch_frame
Definition: internal.h:899
VALUE dup2_tmpbuf
Definition: internal.h:1531
VALUE fd_close
Definition: internal.h:1551
unsigned gid_given
Definition: internal.h:1543
VALUE rb_float_pow(VALUE x, VALUE y)
Definition: numeric.c:1293
const VALUE v1
Definition: internal.h:948
VALUE rb_hash_delete_entry(VALUE hash, VALUE key)
Definition: hash.c:1098
int rb_is_instance_sym(VALUE sym)
Definition: symbol.c:880
VALUE rb_eEINPROGRESS
Definition: error.c:54
void ruby_gc_set_params(int safe_level)
Definition: gc.c:7553
VALUE rb_int_positive_pow(long x, unsigned long y)
Definition: numeric.c:3942
int iter_lev
Definition: internal.h:659
VALUE rb_rational_reciprocal(VALUE x)
Definition: rational.c:1903
#define BDIGIT
Definition: internal.h:526
void rb_ary_delete_same(VALUE, VALUE)
Definition: array.c:3036
#define ANYARGS
Definition: defines.h:173
VALUE envp_buf
Definition: internal.h:1530
VALUE rb_hash_default_value(VALUE hash, VALUE key)
Definition: hash.c:803
int rb_class_ivar_set(VALUE klass, ID vid, VALUE value)
Definition: variable.c:3104
size_t rb_obj_memsize_of(VALUE)
Definition: gc.c:3327
VALUE v3
Definition: internal.h:835
void rb_gc_verify_internal_consistency(void)
Definition: gc.c:5379
unsigned chdir_given
Definition: internal.h:1539
VALUE rb_warning_string(const char *fmt,...)
Definition: error.c:277
VALUE rb_big_sq_fast(VALUE x)
Definition: bignum.c:1612
VALUE rb_gcd_normal(VALUE self, VALUE other)
Definition: rational.c:355
VALUE rb_singleton_class_get(VALUE obj)
Returns the singleton class of obj, or nil if obj is not a singleton object.
Definition: class.c:1658
VALUE rb_rational_uminus(VALUE self)
Definition: rational.c:661
st_table * rb_init_identtable(void)
Definition: hash.c:2932
#define LONG2FIX(i)
Definition: ruby.h:234
VALUE rb_eEWOULDBLOCK
Definition: error.c:53
#define SIZEOF_VALUE
Definition: ruby.h:88
unsigned int opt_methods
Definition: internal.h:990
long rb_objid_hash(st_index_t index)
Definition: hash.c:246
VALUE rb_big_lt(VALUE x, VALUE y)
Definition: bignum.c:5449
st_table * rb_st_copy(VALUE obj, struct st_table *orig_tbl)
Definition: variable.c:3120
rb_subclass_entry_t ** module_subclasses
In the case that this is an ICLASS, module_subclasses points to the link in the module&#39;s subclasses l...
Definition: internal.h:767
VALUE chdir_dir
Definition: internal.h:1556
VALUE rb_int_pow(VALUE x, VALUE y)
Definition: numeric.c:4004
union RBignum::@76 as
int rb_is_local_name(VALUE name)
Definition: symbol.c:1106
int rb_singleton_class_internal_p(VALUE sklass)
Definition: class.c:450
#define RB_BUILTIN_TYPE(x)
Definition: ruby.h:517
VALUE rb_big_even_p(VALUE)
Definition: bignum.c:6778
VALUE rb_rational_abs(VALUE self)
Definition: rational.c:1302
VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val)
Definition: proc.c:669
VALUE rb_reg_match_p(VALUE re, VALUE str, long pos)
Definition: re.c:3303
VALUE rb_get_expanded_load_path(void)
Definition: load.c:107
VALUE(* func)(ANYARGS)
Definition: internal.h:920
VALUE rb_big_abs(VALUE x)
Definition: bignum.c:6700
VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj)
Definition: class.c:1330
void rb_backref_set_string(VALUE string, long pos, long len)
Definition: re.c:1300
VALUE rb_ary_at(VALUE, VALUE)
Definition: array.c:1332
VALUE rb_int2big(SIGNED_VALUE n)
Definition: bignum.c:3162
VALUE rb_lambda_call(VALUE obj, ID mid, int argc, const VALUE *argv, rb_block_call_func_t bl_proc, int min_argc, int max_argc, VALUE data2)
Definition: vm_eval.c:1194
void rb_enc_warn(rb_encoding *enc, const char *fmt,...)
Definition: error.c:256
size_t rb_obj_gc_flags(VALUE, ID[], size_t)
const VALUE lastline
Definition: internal.h:886
const void * data
Definition: internal.h:921
int rb_bug_reporter_add(void(*func)(FILE *, void *), void *data)
Definition: error.c:353
VALUE rb_gcd(VALUE x, VALUE y)
Definition: rational.c:1922
const VALUE ifnone
Definition: internal.h:660
VALUE rb_thread_shield_wait(VALUE self)
Definition: thread.c:4438
VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val, int min_argc, int max_argc)
Definition: proc.c:676
VALUE rb_yield_1(VALUE val)
Definition: vm_eval.c:967
const char * name
Definition: nkf.c:208
const VALUE * ptr
Definition: internal.h:695
int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
Definition: process.c:1669
NORETURN(void rb_async_bug_errno(const char *, int))
void Init_enc(void)
Definition: dmyenc.c:5
int rb_enc_set_dummy(int index)
Definition: encoding.c:400
void rb_autoload_str(VALUE mod, ID id, VALUE file)
Definition: variable.c:1895
VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len, rb_encoding *from, int ecflags, VALUE ecopts)
Definition: string.c:915
void rb_syserr_enc_warning(int err, rb_encoding *enc, const char *fmt,...)
Definition: error.c:2565
VALUE rb_big2str_poweroftwo(VALUE x, int base)
Definition: bignum.c:4892
void rb_gc_mark_global_tbl(void)
Definition: variable.c:594
VALUE rb_source_location(int *pline)
Definition: vm.c:1297
imemo_type
Definition: internal.h:838
VALUE rb_numeric_quo(VALUE x, VALUE y)
Definition: rational.c:2042
uint32_t rb_event_flag_t
Definition: ruby.h:2116
unsigned use_shell
Definition: internal.h:1532
rb_serial_t rb_next_class_serial(void)
Definition: vm.c:309
VALUE rb_dbl_hash(double d)
Definition: numeric.c:1419
void rb_gc_writebarrier_remember(VALUE obj)
Definition: gc.c:6041
#define ROUND_DEFAULT
Definition: internal.h:1323
struct timeval rb_time_timeval(VALUE)
Definition: time.c:2305
VALUE super
Definition: internal.h:779
VALUE rb_math_sin(VALUE)
VALUE rb_str_tmp_frozen_acquire(VALUE str)
Definition: string.c:1170
rb_alloc_func_t allocator
Definition: internal.h:771
void rb_execarg_parent_end(VALUE execarg_obj)
Definition: process.c:2496
int rb_divert_reserved_fd(int fd)
VALUE rb_home_dir_of(VALUE user, VALUE result)
Definition: file.c:3287
void rb_backtrace_print_as_bugreport(void)
Definition: vm_backtrace.c:754
int rb_num_to_uint(VALUE val, unsigned int *ret)
Definition: numeric.c:242
VALUE rb_math_hypot(VALUE, VALUE)
VALUE rb_big_comp(VALUE x)
Definition: bignum.c:5512
VALUE ruby_vm_special_exception_copy(VALUE)
Definition: vm_insnhelper.c:26
long rb_dbl_long_hash(double d)
Definition: hash.c:144
VALUE flags
Definition: internal.h:1465
void rb_stdio_set_default_encoding(void)
Definition: io.c:11284
st_index_t rb_hash_proc(st_index_t hash, VALUE proc)
Definition: proc.c:1188
VALUE rb_get_path_check_to_string(VALUE, int)
Definition: file.c:178
rb_serial_t class_serial
Definition: internal.h:768
VALUE rb_math_log(int argc, const VALUE *argv)
struct rb_id_table * m_tbl
Definition: internal.h:781
void ruby_init_setproctitle(int argc, char *argv[])
unsigned new_pgroup_flag
Definition: internal.h:1541
void ruby_deprecated_internal_feature(const char *func)
Definition: error.c:139
const char ruby_hexdigits[]
Definition: escape.c:5
void rb_gc_mark_encodings(void)
Definition: encoding.c:263
#define RCLASS(obj)
Definition: ruby.h:1199
#define mod(x, y)
Definition: date_strftime.c:28
#define env
void rb_clear_trace_func(void)
Definition: vm_trace.c:206
struct rb_imemo_alloc_struct rb_imemo_alloc_t
VALUE(* rb_alloc_func_t)(VALUE)
Definition: intern.h:370
int rb_vm_add_root_module(ID id, VALUE module)
Definition: vm.c:2172
#define NULL
Definition: _sdbm.c:102
struct rb_global_entry * rb_global_entry(ID)
Definition: variable.c:482
VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj)
Definition: class.c:1364
VALUE shell_script
Definition: internal.h:1519
VALUE rb_integer_float_cmp(VALUE x, VALUE y)
Definition: bignum.c:5285
#define FIX2LONG(x)
Definition: ruby.h:363
VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE)
Definition: vm_eval.c:395
int rb_is_junk_name(VALUE name)
Definition: symbol.c:1122
VALUE rb_complex_mul(VALUE, VALUE)
Definition: complex.c:787
VALUE rb_search_class_path(VALUE)
Definition: variable.c:337
RUBY_SYMBOL_EXPORT_BEGIN const char * rb_objspace_data_type_name(VALUE obj)
Definition: gc.c:2091
VALUE rb_big_uminus(VALUE x)
Definition: bignum.c:5502
void rb_objspace_set_event_hook(const rb_event_flag_t event)
Definition: gc.c:1811
const VALUE value
Definition: internal.h:953
void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen)
Definition: string.c:2162
VALUE rb_class_boot(VALUE)
A utility function that wraps class_alloc.
Definition: class.c:201
VALUE rb_big_gt(VALUE x, VALUE y)
Definition: bignum.c:5437
VALUE rb_key_err_new(VALUE mesg, VALUE recv, VALUE name)
Definition: error.c:1577
void rb_maygvl_fd_fix_cloexec(int fd)
Definition: io.c:210
const char ruby_engine[]
Definition: version.c:35
VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
Definition: variable.c:1175
ID rb_make_internal_id(void)
Definition: symbol.c:760
char * rb_str_to_cstr(VALUE str)
Definition: string.c:2216
VALUE rb_mutex_owned_p(VALUE self)
Definition: thread_sync.c:306
VALUE rb_sourcefilename(void)
Definition: vm.c:1255
void rb_sys_warning(const char *fmt,...)
Definition: error.c:2529
VALUE rb_obj_is_fiber(VALUE)
Definition: cont.c:425
VALUE rb_big_divrem_normal(VALUE x, VALUE y)
Definition: bignum.c:2696
char ** argv
Definition: ruby.c:188
VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method)
Definition: error.c:1407
VALUE rb_float_uminus(VALUE num)
Definition: numeric.c:1038
VALUE v1
Definition: internal.h:833
ssize_t rb_io_bufread(VALUE io, void *buf, size_t size)
Definition: io.c:2178
VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach)
Definition: class.c:371
int rb_is_attrset_name(VALUE name)
Definition: symbol.c:1100
int ruby_is_fd_loadable(int fd)
Definition: file.c:5825
PRINTF_ARGS(void ruby_debug_printf(const char *,...), 1, 2)
#define LIKELY(x)
Definition: internal.h:42
void Init_eval_method(void)
Definition: vm_method.c:2086
VALUE rb_big_odd_p(VALUE)
Definition: bignum.c:6769