debase-ruby_core_source 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/debase/ruby_core_source.rb +1 -0
  4. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/addr2line.h +21 -0
  5. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/ccan/build_assert/build_assert.h +40 -0
  6. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/ccan/check_type/check_type.h +63 -0
  7. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/ccan/container_of/container_of.h +142 -0
  8. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/ccan/list/list.h +773 -0
  9. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/ccan/str/str.h +16 -0
  10. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/constant.h +50 -0
  11. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/dln.h +51 -0
  12. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/encindex.h +67 -0
  13. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/eval_intern.h +304 -0
  14. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/gc.h +114 -0
  15. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/id.h +211 -0
  16. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/id_table.h +30 -0
  17. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/insns.inc +110 -0
  18. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/insns_info.inc +776 -0
  19. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/internal.h +1400 -0
  20. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/iseq.h +249 -0
  21. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/known_errors.inc +746 -0
  22. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/method.h +213 -0
  23. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/node.h +519 -0
  24. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/node_name.inc +208 -0
  25. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/opt_sc.inc +758 -0
  26. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/optinsn.inc +83 -0
  27. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/optunifs.inc +127 -0
  28. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/parse.h +204 -0
  29. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/probes_helper.h +43 -0
  30. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/regenc.h +234 -0
  31. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/regint.h +987 -0
  32. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/regparse.h +367 -0
  33. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/revision.h +1 -0
  34. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/ruby_atomic.h +233 -0
  35. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/siphash.h +48 -0
  36. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/symbol.h +108 -0
  37. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/thread_pthread.h +54 -0
  38. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/thread_win32.h +36 -0
  39. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/timev.h +42 -0
  40. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/transcode_data.h +139 -0
  41. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/version.h +55 -0
  42. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/vm.inc +3412 -0
  43. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/vm_call_iseq_optimized.inc +212 -0
  44. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/vm_core.h +1238 -0
  45. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/vm_debug.h +37 -0
  46. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/vm_exec.h +182 -0
  47. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/vm_insnhelper.h +227 -0
  48. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/vm_opts.h +57 -0
  49. data/lib/debase/ruby_core_source/ruby-2.3.0-preview2/vmtc.inc +108 -0
  50. data/lib/debase/ruby_core_source/version.rb +1 -1
  51. metadata +48 -2
@@ -0,0 +1,1400 @@
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
+ /* likely */
27
+ #if __GNUC__ >= 3
28
+ #define LIKELY(x) (__builtin_expect(!!(x), 1))
29
+ #define UNLIKELY(x) (__builtin_expect(!!(x), 0))
30
+ #else /* __GNUC__ >= 3 */
31
+ #define LIKELY(x) (x)
32
+ #define UNLIKELY(x) (x)
33
+ #endif /* __GNUC__ >= 3 */
34
+
35
+ #ifndef __has_attribute
36
+ # define __has_attribute(x) 0
37
+ #endif
38
+
39
+ #if __has_attribute(unused)
40
+ #define UNINITIALIZED_VAR(x) x __attribute__((unused))
41
+ #elif defined(__GNUC__) && __GNUC__ >= 3
42
+ #define UNINITIALIZED_VAR(x) x = x
43
+ #else
44
+ #define UNINITIALIZED_VAR(x) x
45
+ #endif
46
+
47
+ #if __has_attribute(warn_unused_result)
48
+ #define WARN_UNUSED_RESULT(x) x __attribute__((warn_unused_result))
49
+ #elif defined(__GNUC__) && (__GNUC__ * 1000 + __GNUC_MINOR__) >= 3004
50
+ #define WARN_UNUSED_RESULT(x) x __attribute__((warn_unused_result))
51
+ #else
52
+ #define WARN_UNUSED_RESULT(x) x
53
+ #endif
54
+
55
+ #ifdef HAVE_VALGRIND_MEMCHECK_H
56
+ # include <valgrind/memcheck.h>
57
+ # ifndef VALGRIND_MAKE_MEM_DEFINED
58
+ # define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
59
+ # endif
60
+ # ifndef VALGRIND_MAKE_MEM_UNDEFINED
61
+ # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
62
+ # endif
63
+ #else
64
+ # define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
65
+ # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
66
+ #endif
67
+
68
+ #define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
69
+
70
+ #define GCC_VERSION_SINCE(major, minor, patchlevel) \
71
+ (defined(__GNUC__) && !defined(__INTEL_COMPILER) && \
72
+ ((__GNUC__ > (major)) || \
73
+ (__GNUC__ == (major) && __GNUC_MINOR__ > (minor)) || \
74
+ (__GNUC__ == (major) && __GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ >= (patchlevel))))
75
+
76
+ #ifndef __has_feature
77
+ # define __has_feature(x) 0
78
+ #endif
79
+
80
+ #ifndef __has_extension
81
+ # define __has_extension __has_feature
82
+ #endif
83
+
84
+ #if GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert)
85
+ # define STATIC_ASSERT(name, expr) _Static_assert(expr, #name ": " #expr)
86
+ #else
87
+ # define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
88
+ #endif
89
+
90
+ #define SIGNED_INTEGER_TYPE_P(int_type) (0 > ((int_type)0)-1)
91
+ #define SIGNED_INTEGER_MAX(sint_type) \
92
+ (sint_type) \
93
+ ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) | \
94
+ ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) - 1))
95
+ #define SIGNED_INTEGER_MIN(sint_type) (-SIGNED_INTEGER_MAX(sint_type)-1)
96
+ #define UNSIGNED_INTEGER_MAX(uint_type) (~(uint_type)0)
97
+
98
+ #if SIGNEDNESS_OF_TIME_T < 0 /* signed */
99
+ # define TIMET_MAX SIGNED_INTEGER_MAX(time_t)
100
+ # define TIMET_MIN SIGNED_INTEGER_MIN(time_t)
101
+ #elif SIGNEDNESS_OF_TIME_T > 0 /* unsigned */
102
+ # define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t)
103
+ # define TIMET_MIN ((time_t)0)
104
+ #endif
105
+ #define TIMET_MAX_PLUS_ONE (2*(double)(TIMET_MAX/2+1))
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
+ #define MUL_OVERFLOW_FIXNUM_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
114
+ #define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
115
+ #define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
116
+
117
+ #ifndef swap16
118
+ # ifdef HAVE_BUILTIN___BUILTIN_BSWAP16
119
+ # define swap16(x) __builtin_bswap16(x)
120
+ # endif
121
+ #endif
122
+
123
+ #ifndef swap16
124
+ # define swap16(x) ((uint16_t)((((x)&0xFF)<<8) | (((x)>>8)&0xFF)))
125
+ #endif
126
+
127
+ #ifndef swap32
128
+ # ifdef HAVE_BUILTIN___BUILTIN_BSWAP32
129
+ # define swap32(x) __builtin_bswap32(x)
130
+ # endif
131
+ #endif
132
+
133
+ #ifndef swap32
134
+ # define swap32(x) ((uint32_t)((((x)&0xFF)<<24) \
135
+ |(((x)>>24)&0xFF) \
136
+ |(((x)&0x0000FF00)<<8) \
137
+ |(((x)&0x00FF0000)>>8) ))
138
+ #endif
139
+
140
+ #ifndef swap64
141
+ # ifdef HAVE_BUILTIN___BUILTIN_BSWAP64
142
+ # define swap64(x) __builtin_bswap64(x)
143
+ # endif
144
+ #endif
145
+
146
+ #ifndef swap64
147
+ # ifdef HAVE_INT64_T
148
+ # define byte_in_64bit(n) ((uint64_t)0xff << (n))
149
+ # define swap64(x) ((uint64_t)((((x)&byte_in_64bit(0))<<56) \
150
+ |(((x)>>56)&0xFF) \
151
+ |(((x)&byte_in_64bit(8))<<40) \
152
+ |(((x)&byte_in_64bit(48))>>40) \
153
+ |(((x)&byte_in_64bit(16))<<24) \
154
+ |(((x)&byte_in_64bit(40))>>24) \
155
+ |(((x)&byte_in_64bit(24))<<8) \
156
+ |(((x)&byte_in_64bit(32))>>8)))
157
+ # endif
158
+ #endif
159
+
160
+ static inline int
161
+ nlz_int(unsigned int x)
162
+ {
163
+ #if defined(HAVE_BUILTIN___BUILTIN_CLZ)
164
+ if (x == 0) return SIZEOF_INT * CHAR_BIT;
165
+ return __builtin_clz(x);
166
+ #else
167
+ unsigned int y;
168
+ # if 64 < SIZEOF_INT * CHAR_BIT
169
+ int n = 128;
170
+ # elif 32 < SIZEOF_INT * CHAR_BIT
171
+ int n = 64;
172
+ # else
173
+ int n = 32;
174
+ # endif
175
+ # if 64 < SIZEOF_INT * CHAR_BIT
176
+ y = x >> 64; if (y) {n -= 64; x = y;}
177
+ # endif
178
+ # if 32 < SIZEOF_INT * CHAR_BIT
179
+ y = x >> 32; if (y) {n -= 32; x = y;}
180
+ # endif
181
+ y = x >> 16; if (y) {n -= 16; x = y;}
182
+ y = x >> 8; if (y) {n -= 8; x = y;}
183
+ y = x >> 4; if (y) {n -= 4; x = y;}
184
+ y = x >> 2; if (y) {n -= 2; x = y;}
185
+ y = x >> 1; if (y) {return n - 2;}
186
+ return (int)(n - x);
187
+ #endif
188
+ }
189
+
190
+ static inline int
191
+ nlz_long(unsigned long x)
192
+ {
193
+ #if defined(HAVE_BUILTIN___BUILTIN_CLZL)
194
+ if (x == 0) return SIZEOF_LONG * CHAR_BIT;
195
+ return __builtin_clzl(x);
196
+ #else
197
+ unsigned long y;
198
+ # if 64 < SIZEOF_LONG * CHAR_BIT
199
+ int n = 128;
200
+ # elif 32 < SIZEOF_LONG * CHAR_BIT
201
+ int n = 64;
202
+ # else
203
+ int n = 32;
204
+ # endif
205
+ # if 64 < SIZEOF_LONG * CHAR_BIT
206
+ y = x >> 64; if (y) {n -= 64; x = y;}
207
+ # endif
208
+ # if 32 < SIZEOF_LONG * CHAR_BIT
209
+ y = x >> 32; if (y) {n -= 32; x = y;}
210
+ # endif
211
+ y = x >> 16; if (y) {n -= 16; x = y;}
212
+ y = x >> 8; if (y) {n -= 8; x = y;}
213
+ y = x >> 4; if (y) {n -= 4; x = y;}
214
+ y = x >> 2; if (y) {n -= 2; x = y;}
215
+ y = x >> 1; if (y) {return n - 2;}
216
+ return (int)(n - x);
217
+ #endif
218
+ }
219
+
220
+ #ifdef HAVE_LONG_LONG
221
+ static inline int
222
+ nlz_long_long(unsigned LONG_LONG x)
223
+ {
224
+ #if defined(HAVE_BUILTIN___BUILTIN_CLZLL)
225
+ if (x == 0) return SIZEOF_LONG_LONG * CHAR_BIT;
226
+ return __builtin_clzll(x);
227
+ #else
228
+ unsigned LONG_LONG y;
229
+ # if 64 < SIZEOF_LONG_LONG * CHAR_BIT
230
+ int n = 128;
231
+ # elif 32 < SIZEOF_LONG_LONG * CHAR_BIT
232
+ int n = 64;
233
+ # else
234
+ int n = 32;
235
+ # endif
236
+ # if 64 < SIZEOF_LONG_LONG * CHAR_BIT
237
+ y = x >> 64; if (y) {n -= 64; x = y;}
238
+ # endif
239
+ # if 32 < SIZEOF_LONG_LONG * CHAR_BIT
240
+ y = x >> 32; if (y) {n -= 32; x = y;}
241
+ # endif
242
+ y = x >> 16; if (y) {n -= 16; x = y;}
243
+ y = x >> 8; if (y) {n -= 8; x = y;}
244
+ y = x >> 4; if (y) {n -= 4; x = y;}
245
+ y = x >> 2; if (y) {n -= 2; x = y;}
246
+ y = x >> 1; if (y) {return n - 2;}
247
+ return (int)(n - x);
248
+ #endif
249
+ }
250
+ #endif
251
+
252
+ #ifdef HAVE_UINT128_T
253
+ static inline int
254
+ nlz_int128(uint128_t x)
255
+ {
256
+ uint128_t y;
257
+ int n = 128;
258
+ y = x >> 64; if (y) {n -= 64; x = y;}
259
+ y = x >> 32; if (y) {n -= 32; x = y;}
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 (int)(n - x);
266
+ }
267
+ #endif
268
+
269
+ #if defined(HAVE_UINT128_T)
270
+ # define bit_length(x) \
271
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
272
+ sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
273
+ sizeof(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)) : \
274
+ SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x)))
275
+ #elif defined(HAVE_LONG_LONG)
276
+ # define bit_length(x) \
277
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
278
+ sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
279
+ SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)))
280
+ #else
281
+ # define bit_length(x) \
282
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
283
+ SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)))
284
+ #endif
285
+
286
+ #ifndef BDIGIT
287
+ # if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
288
+ # define BDIGIT unsigned int
289
+ # define SIZEOF_BDIGIT SIZEOF_INT
290
+ # define BDIGIT_DBL unsigned LONG_LONG
291
+ # define BDIGIT_DBL_SIGNED LONG_LONG
292
+ # define PRI_BDIGIT_PREFIX ""
293
+ # define PRI_BDIGIT_DBL_PREFIX PRI_LL_PREFIX
294
+ # elif SIZEOF_INT*2 <= SIZEOF_LONG
295
+ # define BDIGIT unsigned int
296
+ # define SIZEOF_BDIGIT SIZEOF_INT
297
+ # define BDIGIT_DBL unsigned long
298
+ # define BDIGIT_DBL_SIGNED long
299
+ # define PRI_BDIGIT_PREFIX ""
300
+ # define PRI_BDIGIT_DBL_PREFIX "l"
301
+ # elif SIZEOF_SHORT*2 <= SIZEOF_LONG
302
+ # define BDIGIT unsigned short
303
+ # define SIZEOF_BDIGIT SIZEOF_SHORT
304
+ # define BDIGIT_DBL unsigned long
305
+ # define BDIGIT_DBL_SIGNED long
306
+ # define PRI_BDIGIT_PREFIX "h"
307
+ # define PRI_BDIGIT_DBL_PREFIX "l"
308
+ # else
309
+ # define BDIGIT unsigned short
310
+ # define SIZEOF_BDIGIT (SIZEOF_LONG/2)
311
+ # define SIZEOF_ACTUAL_BDIGIT SIZEOF_LONG
312
+ # define BDIGIT_DBL unsigned long
313
+ # define BDIGIT_DBL_SIGNED long
314
+ # define PRI_BDIGIT_PREFIX "h"
315
+ # define PRI_BDIGIT_DBL_PREFIX "l"
316
+ # endif
317
+ #endif
318
+ #ifndef SIZEOF_ACTUAL_BDIGIT
319
+ # define SIZEOF_ACTUAL_BDIGIT SIZEOF_BDIGIT
320
+ #endif
321
+
322
+ #ifdef PRI_BDIGIT_PREFIX
323
+ # define PRIdBDIGIT PRI_BDIGIT_PREFIX"d"
324
+ # define PRIiBDIGIT PRI_BDIGIT_PREFIX"i"
325
+ # define PRIoBDIGIT PRI_BDIGIT_PREFIX"o"
326
+ # define PRIuBDIGIT PRI_BDIGIT_PREFIX"u"
327
+ # define PRIxBDIGIT PRI_BDIGIT_PREFIX"x"
328
+ # define PRIXBDIGIT PRI_BDIGIT_PREFIX"X"
329
+ #endif
330
+
331
+ #ifdef PRI_BDIGIT_DBL_PREFIX
332
+ # define PRIdBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"d"
333
+ # define PRIiBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"i"
334
+ # define PRIoBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"o"
335
+ # define PRIuBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"u"
336
+ # define PRIxBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"x"
337
+ # define PRIXBDIGIT_DBL PRI_BDIGIT_DBL_PREFIX"X"
338
+ #endif
339
+
340
+ #define BIGNUM_EMBED_LEN_NUMBITS 3
341
+ #ifndef BIGNUM_EMBED_LEN_MAX
342
+ # if (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) < (1 << BIGNUM_EMBED_LEN_NUMBITS)-1
343
+ # define BIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT)
344
+ # else
345
+ # define BIGNUM_EMBED_LEN_MAX ((1 << BIGNUM_EMBED_LEN_NUMBITS)-1)
346
+ # endif
347
+ #endif
348
+
349
+ struct RBignum {
350
+ struct RBasic basic;
351
+ union {
352
+ struct {
353
+ size_t len;
354
+ BDIGIT *digits;
355
+ } heap;
356
+ BDIGIT ary[BIGNUM_EMBED_LEN_MAX];
357
+ } as;
358
+ };
359
+ #define BIGNUM_SIGN_BIT FL_USER1
360
+ /* sign: positive:1, negative:0 */
361
+ #define BIGNUM_SIGN(b) ((RBASIC(b)->flags & BIGNUM_SIGN_BIT) != 0)
362
+ #define BIGNUM_SET_SIGN(b,sign) \
363
+ ((sign) ? (RBASIC(b)->flags |= BIGNUM_SIGN_BIT) \
364
+ : (RBASIC(b)->flags &= ~BIGNUM_SIGN_BIT))
365
+ #define BIGNUM_POSITIVE_P(b) BIGNUM_SIGN(b)
366
+ #define BIGNUM_NEGATIVE_P(b) (!BIGNUM_SIGN(b))
367
+
368
+ #define BIGNUM_EMBED_FLAG FL_USER2
369
+ #define BIGNUM_EMBED_LEN_MASK (FL_USER5|FL_USER4|FL_USER3)
370
+ #define BIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+BIGNUM_EMBED_LEN_NUMBITS)
371
+ #define BIGNUM_LEN(b) \
372
+ ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
373
+ (long)((RBASIC(b)->flags >> BIGNUM_EMBED_LEN_SHIFT) & \
374
+ (BIGNUM_EMBED_LEN_MASK >> BIGNUM_EMBED_LEN_SHIFT)) : \
375
+ RBIGNUM(b)->as.heap.len)
376
+ /* LSB:BIGNUM_DIGITS(b)[0], MSB:BIGNUM_DIGITS(b)[BIGNUM_LEN(b)-1] */
377
+ #define BIGNUM_DIGITS(b) \
378
+ ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
379
+ RBIGNUM(b)->as.ary : \
380
+ RBIGNUM(b)->as.heap.digits)
381
+ #define BIGNUM_LENINT(b) rb_long2int(BIGNUM_LEN(b))
382
+
383
+ #define RBIGNUM(obj) (R_CAST(RBignum)(obj))
384
+
385
+ struct RRational {
386
+ struct RBasic basic;
387
+ const VALUE num;
388
+ const VALUE den;
389
+ };
390
+
391
+ #define RRATIONAL(obj) (R_CAST(RRational)(obj))
392
+
393
+ struct RFloat {
394
+ struct RBasic basic;
395
+ double float_value;
396
+ };
397
+
398
+ #define RFLOAT(obj) (R_CAST(RFloat)(obj))
399
+
400
+ struct RComplex {
401
+ struct RBasic basic;
402
+ const VALUE real;
403
+ const VALUE imag;
404
+ };
405
+
406
+ #define RCOMPLEX(obj) (R_CAST(RComplex)(obj))
407
+
408
+ #ifdef RCOMPLEX_SET_REAL /* shortcut macro for internal only */
409
+ #undef RCOMPLEX_SET_REAL
410
+ #undef RCOMPLEX_SET_REAL
411
+ #define RCOMPLEX_SET_REAL(cmp, r) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->real,(r))
412
+ #define RCOMPLEX_SET_IMAG(cmp, i) RB_OBJ_WRITE((cmp), &((struct RComplex *)(cmp))->imag,(i))
413
+ #endif
414
+
415
+ struct RHash {
416
+ struct RBasic basic;
417
+ struct st_table *ntbl; /* possibly 0 */
418
+ int iter_lev;
419
+ const VALUE ifnone;
420
+ };
421
+
422
+ #define RHASH(obj) (R_CAST(RHash)(obj))
423
+
424
+ #ifdef RHASH_ITER_LEV
425
+ #undef RHASH_ITER_LEV
426
+ #undef RHASH_IFNONE
427
+ #undef RHASH_SIZE
428
+ #define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev)
429
+ #define RHASH_IFNONE(h) (RHASH(h)->ifnone)
430
+ #define RHASH_SIZE(h) (RHASH(h)->ntbl ? (st_index_t)RHASH(h)->ntbl->num_entries : 0)
431
+ #endif
432
+
433
+ /* missing/setproctitle.c */
434
+ #ifndef HAVE_SETPROCTITLE
435
+ extern void ruby_init_setproctitle(int argc, char *argv[]);
436
+ #endif
437
+
438
+ /* class.c */
439
+
440
+ struct rb_deprecated_classext_struct {
441
+ char conflict[sizeof(VALUE) * 3];
442
+ };
443
+
444
+ struct rb_subclass_entry;
445
+ typedef struct rb_subclass_entry rb_subclass_entry_t;
446
+
447
+ struct rb_subclass_entry {
448
+ VALUE klass;
449
+ rb_subclass_entry_t *next;
450
+ };
451
+
452
+ #if defined(HAVE_LONG_LONG)
453
+ typedef unsigned LONG_LONG rb_serial_t;
454
+ #define SERIALT2NUM ULL2NUM
455
+ #elif defined(HAVE_UINT64_T)
456
+ typedef uint64_t rb_serial_t;
457
+ #define SERIALT2NUM SIZET2NUM
458
+ #else
459
+ typedef unsigned long rb_serial_t;
460
+ #define SERIALT2NUM ULONG2NUM
461
+ #endif
462
+
463
+ struct rb_classext_struct {
464
+ struct st_table *iv_index_tbl;
465
+ struct st_table *iv_tbl;
466
+ struct st_table *const_tbl;
467
+ struct rb_id_table *callable_m_tbl;
468
+ rb_subclass_entry_t *subclasses;
469
+ rb_subclass_entry_t **parent_subclasses;
470
+ /**
471
+ * In the case that this is an `ICLASS`, `module_subclasses` points to the link
472
+ * in the module's `subclasses` list that indicates that the klass has been
473
+ * included. Hopefully that makes sense.
474
+ */
475
+ rb_subclass_entry_t **module_subclasses;
476
+ rb_serial_t class_serial;
477
+ const VALUE origin_;
478
+ VALUE refined_class;
479
+ rb_alloc_func_t allocator;
480
+ };
481
+
482
+ typedef struct rb_classext_struct rb_classext_t;
483
+
484
+ #undef RClass
485
+ struct RClass {
486
+ struct RBasic basic;
487
+ VALUE super;
488
+ rb_classext_t *ptr;
489
+ struct rb_id_table *m_tbl;
490
+ };
491
+
492
+ void rb_class_subclass_add(VALUE super, VALUE klass);
493
+ void rb_class_remove_from_super_subclasses(VALUE);
494
+
495
+ #define RCLASS_EXT(c) (RCLASS(c)->ptr)
496
+ #define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
497
+ #define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
498
+ #define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
499
+ #define RCLASS_CALLABLE_M_TBL(c) (RCLASS_EXT(c)->callable_m_tbl)
500
+ #define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl)
501
+ #define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin_)
502
+ #define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
503
+ #define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial)
504
+
505
+ #define RICLASS_IS_ORIGIN FL_USER5
506
+
507
+ static inline void
508
+ RCLASS_SET_ORIGIN(VALUE klass, VALUE origin)
509
+ {
510
+ RB_OBJ_WRITE(klass, &RCLASS_ORIGIN(klass), origin);
511
+ if (klass != origin) FL_SET(origin, RICLASS_IS_ORIGIN);
512
+ }
513
+
514
+ #undef RCLASS_SUPER
515
+ static inline VALUE
516
+ RCLASS_SUPER(VALUE klass)
517
+ {
518
+ return RCLASS(klass)->super;
519
+ }
520
+
521
+ static inline VALUE
522
+ RCLASS_SET_SUPER(VALUE klass, VALUE super)
523
+ {
524
+ if (super) {
525
+ rb_class_remove_from_super_subclasses(klass);
526
+ rb_class_subclass_add(super, klass);
527
+ }
528
+ RB_OBJ_WRITE(klass, &RCLASS(klass)->super, super);
529
+ return super;
530
+ }
531
+ /* IMEMO: Internal memo object */
532
+
533
+ #ifndef IMEMO_DEBUG
534
+ #define IMEMO_DEBUG 0
535
+ #endif
536
+
537
+ struct RIMemo {
538
+ VALUE flags;
539
+ VALUE v0;
540
+ VALUE v1;
541
+ VALUE v2;
542
+ VALUE v3;
543
+ };
544
+
545
+ enum imemo_type {
546
+ imemo_none = 0,
547
+ imemo_cref = 1,
548
+ imemo_svar = 2,
549
+ imemo_throw_data = 3,
550
+ imemo_ifunc = 4,
551
+ imemo_memo = 5,
552
+ imemo_ment = 6,
553
+ imemo_iseq = 7,
554
+ imemo_mask = 0x07
555
+ };
556
+
557
+ static inline enum imemo_type
558
+ imemo_type(VALUE imemo)
559
+ {
560
+ return (RBASIC(imemo)->flags >> FL_USHIFT) & imemo_mask;
561
+ }
562
+
563
+ /* FL_USER0 to FL_USER2 is for type */
564
+ #define IMEMO_FL_USHIFT (FL_USHIFT + 3)
565
+ #define IMEMO_FL_USER0 FL_USER3
566
+ #define IMEMO_FL_USER1 FL_USER4
567
+ #define IMEMO_FL_USER2 FL_USER5
568
+ #define IMEMO_FL_USER3 FL_USER6
569
+ #define IMEMO_FL_USER4 FL_USER7
570
+
571
+ /* CREF in method.h */
572
+
573
+ /* SVAR */
574
+
575
+ struct vm_svar {
576
+ VALUE flags;
577
+ const VALUE cref_or_me;
578
+ const VALUE lastline;
579
+ const VALUE backref;
580
+ const VALUE others;
581
+ };
582
+
583
+ /* THROW_DATA */
584
+
585
+ struct vm_throw_data {
586
+ VALUE flags;
587
+ VALUE reserved;
588
+ const VALUE throw_obj;
589
+ const struct rb_control_frame_struct *catch_frame;
590
+ VALUE throw_state;
591
+ };
592
+
593
+ #define THROW_DATA_P(err) RB_TYPE_P((err), T_IMEMO)
594
+
595
+ /* IFUNC */
596
+
597
+ struct vm_ifunc {
598
+ VALUE flags;
599
+ VALUE reserved;
600
+ VALUE (*func)(ANYARGS);
601
+ const void *data;
602
+ ID id;
603
+ };
604
+
605
+ #define IFUNC_NEW(a, b, c) ((struct vm_ifunc *)rb_imemo_new(imemo_ifunc, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
606
+
607
+ /* MEMO */
608
+
609
+ struct MEMO {
610
+ VALUE flags;
611
+ VALUE reserved;
612
+ const VALUE v1;
613
+ const VALUE v2;
614
+ union {
615
+ long cnt;
616
+ long state;
617
+ const VALUE value;
618
+ VALUE (*func)(ANYARGS);
619
+ } u3;
620
+ };
621
+
622
+ #define MEMO_V1_SET(m, v) RB_OBJ_WRITE((memo), &(memo)->v1, (v))
623
+ #define MEMO_V2_SET(m, v) RB_OBJ_WRITE((memo), &(memo)->v2, (v))
624
+
625
+ #define MEMO_CAST(m) ((struct MEMO *)m)
626
+
627
+ #define MEMO_NEW(a, b, c) ((struct MEMO *)rb_imemo_new(imemo_memo, (VALUE)(a), (VALUE)(b), (VALUE)(c), 0))
628
+
629
+ #define roomof(x, y) (((x) + (y) - 1) / (y))
630
+ #define type_roomof(x, y) roomof(sizeof(x), sizeof(y))
631
+ #define MEMO_FOR(type, value) ((type *)RARRAY_PTR(value))
632
+ #define NEW_MEMO_FOR(type, value) \
633
+ ((value) = rb_ary_tmp_new_fill(type_roomof(type, VALUE)), MEMO_FOR(type, value))
634
+
635
+ /* ment is in method.h */
636
+
637
+ /* global variable */
638
+
639
+ struct rb_global_entry {
640
+ struct rb_global_variable *var;
641
+ ID id;
642
+ };
643
+
644
+ struct rb_global_entry *rb_global_entry(ID);
645
+ VALUE rb_gvar_get(struct rb_global_entry *);
646
+ VALUE rb_gvar_set(struct rb_global_entry *, VALUE);
647
+ VALUE rb_gvar_defined(struct rb_global_entry *);
648
+
649
+ struct vtm; /* defined by timev.h */
650
+
651
+ /* array.c */
652
+ VALUE rb_ary_last(int, const VALUE *, VALUE);
653
+ void rb_ary_set_len(VALUE, long);
654
+ void rb_ary_delete_same(VALUE, VALUE);
655
+ VALUE rb_ary_tmp_new_fill(long capa);
656
+ VALUE rb_ary_at(VALUE, VALUE);
657
+ size_t rb_ary_memsize(VALUE);
658
+ #ifdef __GNUC__
659
+ #define rb_ary_new_from_args(n, ...) \
660
+ __extension__ ({ \
661
+ const VALUE args_to_new_ary[] = {__VA_ARGS__}; \
662
+ if (__builtin_constant_p(n)) { \
663
+ STATIC_ASSERT(rb_ary_new_from_args, numberof(args_to_new_ary) == (n)); \
664
+ } \
665
+ rb_ary_new_from_values(numberof(args_to_new_ary), args_to_new_ary); \
666
+ })
667
+ #endif
668
+
669
+ /* bignum.c */
670
+ extern const char ruby_digitmap[];
671
+ VALUE rb_big_fdiv(VALUE x, VALUE y);
672
+ VALUE rb_big_uminus(VALUE x);
673
+ VALUE rb_integer_float_cmp(VALUE x, VALUE y);
674
+ VALUE rb_integer_float_eq(VALUE x, VALUE y);
675
+
676
+ /* class.c */
677
+ void rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE);
678
+ void rb_class_detach_subclasses(VALUE);
679
+ void rb_class_detach_module_subclasses(VALUE);
680
+ void rb_class_remove_from_module_subclasses(VALUE);
681
+ VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj);
682
+ VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj);
683
+ VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj);
684
+ VALUE rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj);
685
+ int rb_obj_basic_to_s_p(VALUE);
686
+ VALUE rb_special_singleton_class(VALUE);
687
+ VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
688
+ VALUE rb_singleton_class_get(VALUE obj);
689
+ void Init_class_hierarchy(void);
690
+
691
+ int rb_class_has_methods(VALUE c);
692
+
693
+ /* compar.c */
694
+ VALUE rb_invcmp(VALUE, VALUE);
695
+
696
+ /* compile.c */
697
+ int rb_dvar_defined(ID);
698
+ int rb_local_defined(ID);
699
+ int rb_parse_in_eval(void);
700
+ int rb_parse_in_main(void);
701
+ const char * rb_insns_name(int i);
702
+ VALUE rb_insns_name_array(void);
703
+
704
+ /* cont.c */
705
+ VALUE rb_obj_is_fiber(VALUE);
706
+ void rb_fiber_reset_root_local_storage(VALUE);
707
+ void ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE (*rollback_func)(ANYARGS));
708
+
709
+ /* debug.c */
710
+ PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
711
+
712
+ /* dmyext.c */
713
+ void Init_enc(void);
714
+ void Init_ext(void);
715
+
716
+ /* encoding.c */
717
+ ID rb_id_encoding(void);
718
+ void rb_gc_mark_encodings(void);
719
+ rb_encoding *rb_enc_get_from_index(int index);
720
+ rb_encoding *rb_enc_check_str(VALUE str1, VALUE str2);
721
+ int rb_encdb_replicate(const char *alias, const char *orig);
722
+ int rb_encdb_alias(const char *alias, const char *orig);
723
+ int rb_encdb_dummy(const char *name);
724
+ void rb_encdb_declare(const char *name);
725
+ void rb_enc_set_base(const char *name, const char *orig);
726
+ int rb_enc_set_dummy(int index);
727
+ void rb_encdb_set_unicode(int index);
728
+ int rb_data_is_encoding(VALUE obj);
729
+
730
+ /* enum.c */
731
+ VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
732
+
733
+ /* error.c */
734
+ extern VALUE rb_eEAGAIN;
735
+ extern VALUE rb_eEWOULDBLOCK;
736
+ extern VALUE rb_eEINPROGRESS;
737
+ NORETURN(PRINTF_ARGS(void rb_compile_bug(const char*, int, const char*, ...), 3, 4));
738
+ VALUE rb_check_backtrace(VALUE);
739
+ NORETURN(void rb_async_bug_errno(const char *,int));
740
+ const char *rb_builtin_type_name(int t);
741
+ const char *rb_builtin_class_name(VALUE x);
742
+ PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
743
+ PRINTF_ARGS(void rb_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
744
+ PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
745
+ VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method);
746
+ #define rb_name_err_raise_str(mesg, recv, name) \
747
+ rb_exc_raise(rb_name_err_new(mesg, recv, name))
748
+ #define rb_name_err_raise(mesg, recv, name) \
749
+ rb_name_err_raise_str(rb_fstring_cstr(mesg), (recv), (name))
750
+
751
+ /* eval.c */
752
+ VALUE rb_refinement_module_get_refined_class(VALUE module);
753
+
754
+ /* eval_error.c */
755
+ void ruby_error_print(void);
756
+ VALUE rb_get_backtrace(VALUE info);
757
+
758
+ /* eval_jump.c */
759
+ void rb_call_end_proc(VALUE data);
760
+ void rb_mark_end_proc(void);
761
+
762
+ /* file.c */
763
+ VALUE rb_home_dir_of(VALUE user, VALUE result);
764
+ VALUE rb_default_home_dir(VALUE result);
765
+ VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
766
+ void rb_file_const(const char*, VALUE);
767
+ int rb_file_load_ok(const char *);
768
+ VALUE rb_file_expand_path_fast(VALUE, VALUE);
769
+ VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE);
770
+ VALUE rb_get_path_check_to_string(VALUE, int);
771
+ VALUE rb_get_path_check_convert(VALUE, VALUE, int);
772
+ void Init_File(void);
773
+ int ruby_is_fd_loadable(int fd);
774
+
775
+ #ifdef RUBY_FUNCTION_NAME_STRING
776
+ # if defined __GNUC__ && __GNUC__ >= 4
777
+ # pragma GCC visibility push(default)
778
+ # endif
779
+ NORETURN(void rb_sys_fail_path_in(const char *func_name, VALUE path));
780
+ NORETURN(void rb_syserr_fail_path_in(const char *func_name, int err, VALUE path));
781
+ # if defined __GNUC__ && __GNUC__ >= 4
782
+ # pragma GCC visibility pop
783
+ # endif
784
+ # define rb_sys_fail_path(path) rb_sys_fail_path_in(RUBY_FUNCTION_NAME_STRING, path)
785
+ # define rb_syserr_fail_path(err, path) rb_syserr_fail_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path))
786
+ #else
787
+ # define rb_sys_fail_path(path) rb_sys_fail_str(path)
788
+ # define rb_syserr_fail_path(err, path) rb_syserr_fail_str((err), (path))
789
+ #endif
790
+
791
+ /* gc.c */
792
+ extern VALUE *ruby_initial_gc_stress_ptr;
793
+ extern int ruby_disable_gc;
794
+ void Init_heap(void);
795
+ void *ruby_mimmalloc(size_t size);
796
+ void ruby_mimfree(void *ptr);
797
+ void rb_objspace_set_event_hook(const rb_event_flag_t event);
798
+ #if USE_RGENGC
799
+ void rb_gc_writebarrier_remember(VALUE obj);
800
+ #else
801
+ #define rb_gc_writebarrier_remember(obj) 0
802
+ #endif
803
+ void ruby_gc_set_params(int safe_level);
804
+ void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj);
805
+
806
+ #if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32)
807
+ #define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size)
808
+ #define ruby_sized_xrealloc2(ptr, new_count, element_size, old_count) ruby_xrealloc(ptr, new_count, element_size)
809
+ #define ruby_sized_xfree(ptr, size) ruby_xfree(ptr)
810
+ #define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n)
811
+ #else
812
+ void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_ALLOC_SIZE((2));
813
+ void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_ALLOC_SIZE((2, 3));
814
+ void ruby_sized_xfree(void *x, size_t size);
815
+ #define SIZED_REALLOC_N(var,type,n,old_n) ((var)=(type*)ruby_sized_xrealloc((char*)(var), (n) * sizeof(type), (old_n) * sizeof(type)))
816
+ #endif
817
+
818
+ void rb_gc_resurrect(VALUE ptr);
819
+
820
+ /* optimized version of NEWOBJ() */
821
+ #undef NEWOBJF_OF
822
+ #undef RB_NEWOBJ_OF
823
+ #define RB_NEWOBJ_OF(obj,type,klass,flags) \
824
+ type *(obj) = (type*)(((flags) & FL_WB_PROTECTED) ? \
825
+ rb_wb_protected_newobj_of(klass, (flags) & ~FL_WB_PROTECTED) : \
826
+ rb_wb_unprotected_newobj_of(klass, flags))
827
+ #define NEWOBJ_OF(obj,type,klass,flags) RB_NEWOBJ_OF(obj,type,klass,flags)
828
+
829
+ /* hash.c */
830
+ struct st_table *rb_hash_tbl_raw(VALUE hash);
831
+ VALUE rb_hash_has_key(VALUE hash, VALUE key);
832
+ VALUE rb_hash_default_value(VALUE hash, VALUE key);
833
+ VALUE rb_hash_set_default_proc(VALUE hash, VALUE proc);
834
+ long rb_objid_hash(st_index_t index);
835
+ st_table *rb_init_identtable(void);
836
+ st_table *rb_init_identtable_with_size(st_index_t size);
837
+
838
+ #define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
839
+ VALUE rb_hash_keys(VALUE hash);
840
+ VALUE rb_hash_values(VALUE hash);
841
+ #define HASH_DELETED FL_USER1
842
+ #define HASH_PROC_DEFAULT FL_USER2
843
+
844
+ /* inits.c */
845
+ void rb_call_inits(void);
846
+
847
+ /* io.c */
848
+ const char *ruby_get_inplace_mode(void);
849
+ void ruby_set_inplace_mode(const char *);
850
+ ssize_t rb_io_bufread(VALUE io, void *buf, size_t size);
851
+ void rb_stdio_set_default_encoding(void);
852
+ void rb_write_error_str(VALUE mesg);
853
+ VALUE rb_io_flush_raw(VALUE, int);
854
+ size_t rb_io_memsize(const rb_io_t *);
855
+
856
+ /* load.c */
857
+ VALUE rb_get_load_path(void);
858
+ VALUE rb_get_expanded_load_path(void);
859
+ int rb_require_internal(VALUE fname, int safe);
860
+ NORETURN(void rb_load_fail(VALUE, const char*));
861
+
862
+ /* loadpath.c */
863
+ extern const char ruby_exec_prefix[];
864
+ extern const char ruby_initial_load_paths[];
865
+
866
+ /* localeinit.c */
867
+ int Init_enc_set_filesystem_encoding(void);
868
+
869
+ /* math.c */
870
+ VALUE rb_math_atan2(VALUE, VALUE);
871
+ VALUE rb_math_cos(VALUE);
872
+ VALUE rb_math_cosh(VALUE);
873
+ VALUE rb_math_exp(VALUE);
874
+ VALUE rb_math_hypot(VALUE, VALUE);
875
+ VALUE rb_math_log(int argc, const VALUE *argv);
876
+ VALUE rb_math_sin(VALUE);
877
+ VALUE rb_math_sinh(VALUE);
878
+ #if 0
879
+ VALUE rb_math_sqrt(VALUE);
880
+ #endif
881
+
882
+ /* newline.c */
883
+ void Init_newline(void);
884
+
885
+ /* numeric.c */
886
+ int rb_num_to_uint(VALUE val, unsigned int *ret);
887
+ VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl);
888
+ int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl);
889
+ double ruby_float_mod(double x, double y);
890
+ int rb_num_negative_p(VALUE);
891
+ VALUE rb_int_succ(VALUE num);
892
+ VALUE rb_int_pred(VALUE num);
893
+ VALUE rb_dbl_hash(double d);
894
+
895
+ #if USE_FLONUM
896
+ #define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
897
+ #define RUBY_BIT_ROTR(v, n) (((v) >> (n)) | ((v) << ((sizeof(v) * 8) - n)))
898
+ #endif
899
+
900
+ static inline double
901
+ rb_float_flonum_value(VALUE v)
902
+ {
903
+ #if USE_FLONUM
904
+ if (v != (VALUE)0x8000000000000002) { /* LIKELY */
905
+ union {
906
+ double d;
907
+ VALUE v;
908
+ } t;
909
+
910
+ VALUE b63 = (v >> 63);
911
+ /* e: xx1... -> 011... */
912
+ /* xx0... -> 100... */
913
+ /* ^b63 */
914
+ t.v = RUBY_BIT_ROTR((2 - b63) | (v & ~0x03), 3);
915
+ return t.d;
916
+ }
917
+ #endif
918
+ return 0.0;
919
+ }
920
+
921
+ static inline double
922
+ rb_float_noflonum_value(VALUE v)
923
+ {
924
+ return ((struct RFloat *)v)->float_value;
925
+ }
926
+
927
+ static inline double
928
+ rb_float_value_inline(VALUE v)
929
+ {
930
+ if (FLONUM_P(v)) {
931
+ return rb_float_flonum_value(v);
932
+ }
933
+ return rb_float_noflonum_value(v);
934
+ }
935
+
936
+ static inline VALUE
937
+ rb_float_new_inline(double d)
938
+ {
939
+ #if USE_FLONUM
940
+ union {
941
+ double d;
942
+ VALUE v;
943
+ } t;
944
+ int bits;
945
+
946
+ t.d = d;
947
+ bits = (int)((VALUE)(t.v >> 60) & 0x7);
948
+ /* bits contains 3 bits of b62..b60. */
949
+ /* bits - 3 = */
950
+ /* b011 -> b000 */
951
+ /* b100 -> b001 */
952
+
953
+ if (t.v != 0x3000000000000000 /* 1.72723e-77 */ &&
954
+ !((bits-3) & ~0x01)) {
955
+ return (RUBY_BIT_ROTL(t.v, 3) & ~(VALUE)0x01) | 0x02;
956
+ }
957
+ else if (t.v == (VALUE)0) {
958
+ /* +0.0 */
959
+ return 0x8000000000000002;
960
+ }
961
+ /* out of range */
962
+ #endif
963
+ return rb_float_new_in_heap(d);
964
+ }
965
+
966
+ #define rb_float_value(v) rb_float_value_inline(v)
967
+ #define rb_float_new(d) rb_float_new_inline(d)
968
+
969
+ /* object.c */
970
+ void rb_obj_copy_ivar(VALUE dest, VALUE obj);
971
+ VALUE rb_obj_equal(VALUE obj1, VALUE obj2);
972
+ VALUE rb_class_search_ancestor(VALUE klass, VALUE super);
973
+ NORETURN(void rb_undefined_alloc(VALUE klass));
974
+ double rb_num_to_dbl(VALUE val);
975
+ VALUE rb_obj_dig(int argc, VALUE *argv, VALUE self, VALUE notfound);
976
+
977
+ struct RBasicRaw {
978
+ VALUE flags;
979
+ VALUE klass;
980
+ };
981
+
982
+ #define RBASIC_CLEAR_CLASS(obj) (((struct RBasicRaw *)((VALUE)(obj)))->klass = 0)
983
+ #define RBASIC_SET_CLASS_RAW(obj, cls) (((struct RBasicRaw *)((VALUE)(obj)))->klass = (cls))
984
+ #define RBASIC_SET_CLASS(obj, cls) do { \
985
+ VALUE _obj_ = (obj); \
986
+ RB_OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \
987
+ } while (0)
988
+
989
+ /* parse.y */
990
+ #ifndef USE_SYMBOL_GC
991
+ #define USE_SYMBOL_GC 1
992
+ #endif
993
+ VALUE rb_parser_get_yydebug(VALUE);
994
+ VALUE rb_parser_set_yydebug(VALUE, VALUE);
995
+ int rb_is_const_name(VALUE name);
996
+ int rb_is_class_name(VALUE name);
997
+ int rb_is_global_name(VALUE name);
998
+ int rb_is_instance_name(VALUE name);
999
+ int rb_is_attrset_name(VALUE name);
1000
+ int rb_is_local_name(VALUE name);
1001
+ int rb_is_method_name(VALUE name);
1002
+ int rb_is_junk_name(VALUE name);
1003
+ int rb_is_const_sym(VALUE sym);
1004
+ int rb_is_class_sym(VALUE sym);
1005
+ int rb_is_global_sym(VALUE sym);
1006
+ int rb_is_instance_sym(VALUE sym);
1007
+ int rb_is_attrset_sym(VALUE sym);
1008
+ int rb_is_local_sym(VALUE sym);
1009
+ int rb_is_method_sym(VALUE sym);
1010
+ int rb_is_junk_sym(VALUE sym);
1011
+ ID rb_make_internal_id(void);
1012
+ void rb_gc_free_dsymbol(VALUE);
1013
+ ID rb_id_attrget(ID id);
1014
+
1015
+ /* proc.c */
1016
+ VALUE rb_proc_location(VALUE self);
1017
+ st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
1018
+ int rb_block_arity(void);
1019
+ VALUE rb_func_proc_new(rb_block_call_func_t func, VALUE val);
1020
+ VALUE rb_func_lambda_new(rb_block_call_func_t func, VALUE val);
1021
+
1022
+ /* process.c */
1023
+ #define RB_MAX_GROUPS (65536)
1024
+
1025
+ struct rb_execarg {
1026
+ union {
1027
+ struct {
1028
+ VALUE shell_script;
1029
+ } sh;
1030
+ struct {
1031
+ VALUE command_name;
1032
+ VALUE command_abspath; /* full path string or nil */
1033
+ VALUE argv_str;
1034
+ VALUE argv_buf;
1035
+ } cmd;
1036
+ } invoke;
1037
+ VALUE redirect_fds;
1038
+ VALUE envp_str;
1039
+ VALUE envp_buf;
1040
+ VALUE dup2_tmpbuf;
1041
+ unsigned use_shell : 1;
1042
+ unsigned pgroup_given : 1;
1043
+ unsigned umask_given : 1;
1044
+ unsigned unsetenv_others_given : 1;
1045
+ unsigned unsetenv_others_do : 1;
1046
+ unsigned close_others_given : 1;
1047
+ unsigned close_others_do : 1;
1048
+ unsigned chdir_given : 1;
1049
+ unsigned new_pgroup_given : 1;
1050
+ unsigned new_pgroup_flag : 1;
1051
+ unsigned uid_given : 1;
1052
+ unsigned gid_given : 1;
1053
+ rb_pid_t pgroup_pgid; /* asis(-1), new pgroup(0), specified pgroup (0<V). */
1054
+ VALUE rlimit_limits; /* Qfalse or [[rtype, softlim, hardlim], ...] */
1055
+ mode_t umask_mask;
1056
+ rb_uid_t uid;
1057
+ rb_gid_t gid;
1058
+ int close_others_maxhint;
1059
+ VALUE fd_dup2;
1060
+ VALUE fd_close;
1061
+ VALUE fd_open;
1062
+ VALUE fd_dup2_child;
1063
+ VALUE env_modification; /* Qfalse or [[k1,v1], ...] */
1064
+ VALUE chdir_dir;
1065
+ };
1066
+
1067
+ /* argv_str contains extra two elements.
1068
+ * The beginning one is for /bin/sh used by exec_with_sh.
1069
+ * The last one for terminating NULL used by execve.
1070
+ * See rb_exec_fillarg() in process.c. */
1071
+ #define ARGVSTR2ARGC(argv_str) (RSTRING_LEN(argv_str) / sizeof(char *) - 2)
1072
+ #define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1)
1073
+
1074
+ rb_pid_t rb_fork_ruby(int *status);
1075
+ void rb_last_status_clear(void);
1076
+
1077
+ /* rational.c */
1078
+ VALUE rb_lcm(VALUE x, VALUE y);
1079
+ VALUE rb_rational_reciprocal(VALUE x);
1080
+ VALUE rb_cstr_to_rat(const char *, int);
1081
+
1082
+ /* re.c */
1083
+ VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline);
1084
+ VALUE rb_reg_check_preprocess(VALUE);
1085
+ long rb_reg_search0(VALUE, VALUE, long, int, int);
1086
+ void rb_backref_set_string(VALUE string, long pos, long len);
1087
+
1088
+ /* signal.c */
1089
+ extern int ruby_enable_coredump;
1090
+ int rb_get_next_signal(void);
1091
+ int rb_sigaltstack_size(void);
1092
+
1093
+ /* strftime.c */
1094
+ #ifdef RUBY_ENCODING_H
1095
+ size_t rb_strftime_timespec(char *s, size_t maxsize, const char *format, rb_encoding *enc,
1096
+ const struct vtm *vtm, struct timespec *ts, int gmt);
1097
+ size_t rb_strftime(char *s, size_t maxsize, const char *format, rb_encoding *enc,
1098
+ const struct vtm *vtm, VALUE timev, int gmt);
1099
+ #endif
1100
+
1101
+ /* string.c */
1102
+ void Init_frozen_strings(void);
1103
+ VALUE rb_fstring(VALUE);
1104
+ VALUE rb_fstring_new(const char *ptr, long len);
1105
+ #define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
1106
+ #define rb_fstring_literal(str) rb_fstring_lit(str)
1107
+ VALUE rb_fstring_cstr(const char *str);
1108
+ #if defined(__GNUC__) && !defined(__PCC__)
1109
+ #define rb_fstring_cstr(str) __extension__ ( \
1110
+ { \
1111
+ (__builtin_constant_p(str)) ? \
1112
+ rb_fstring_new((str), (long)strlen(str)) : \
1113
+ rb_fstring_cstr(str); \
1114
+ })
1115
+ #endif
1116
+ int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
1117
+ int rb_str_symname_p(VALUE);
1118
+ VALUE rb_str_quote_unprintable(VALUE);
1119
+ VALUE rb_id_quote_unprintable(ID);
1120
+ #define QUOTE(str) rb_str_quote_unprintable(str)
1121
+ #define QUOTE_ID(id) rb_id_quote_unprintable(id)
1122
+ void rb_str_fill_terminator(VALUE str, const int termlen);
1123
+ VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
1124
+ #ifdef RUBY_ENCODING_H
1125
+ VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
1126
+ VALUE rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len,
1127
+ rb_encoding *from, int ecflags, VALUE ecopts);
1128
+ #endif
1129
+ #define STR_NOEMBED FL_USER1
1130
+ #define STR_SHARED FL_USER2 /* = ELTS_SHARED */
1131
+ #define STR_EMBED_P(str) (!FL_TEST_RAW((str), STR_NOEMBED))
1132
+ #define STR_SHARED_P(s) FL_ALL_RAW((s), STR_NOEMBED|ELTS_SHARED)
1133
+ #define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT)
1134
+ #define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN)
1135
+ size_t rb_str_memsize(VALUE);
1136
+ VALUE rb_sym_proc_call(VALUE args, VALUE sym, int argc, const VALUE *argv, VALUE passed_proc);
1137
+ VALUE rb_sym_to_proc(VALUE sym);
1138
+
1139
+ /* symbol.c */
1140
+ #ifdef RUBY_ENCODING_H
1141
+ VALUE rb_sym_intern(const char *ptr, long len, rb_encoding *enc);
1142
+ VALUE rb_sym_intern_cstr(const char *ptr, rb_encoding *enc);
1143
+ #ifdef __GNUC__
1144
+ #define rb_sym_intern_cstr(ptr, enc) __extension__ ( \
1145
+ { \
1146
+ (__builtin_constant_p(ptr)) ? \
1147
+ rb_sym_intern((ptr), (long)strlen(ptr), (enc)) : \
1148
+ rb_sym_intern_cstr((ptr), (enc)); \
1149
+ })
1150
+ #endif
1151
+ #endif
1152
+ VALUE rb_sym_intern_ascii(const char *ptr, long len);
1153
+ VALUE rb_sym_intern_ascii_cstr(const char *ptr);
1154
+ #ifdef __GNUC__
1155
+ #define rb_sym_intern_ascii_cstr(ptr) __extension__ ( \
1156
+ { \
1157
+ (__builtin_constant_p(ptr)) ? \
1158
+ rb_sym_intern_ascii((ptr), (long)strlen(ptr)) : \
1159
+ rb_sym_intern_ascii_cstr(ptr); \
1160
+ })
1161
+ #endif
1162
+
1163
+ /* struct.c */
1164
+ VALUE rb_struct_init_copy(VALUE copy, VALUE s);
1165
+ VALUE rb_struct_lookup(VALUE s, VALUE idx);
1166
+
1167
+ /* time.c */
1168
+ struct timeval rb_time_timeval(VALUE);
1169
+
1170
+ /* thread.c */
1171
+ VALUE rb_obj_is_mutex(VALUE obj);
1172
+ VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
1173
+ void rb_thread_execute_interrupts(VALUE th);
1174
+ void rb_clear_trace_func(void);
1175
+ VALUE rb_get_coverages(void);
1176
+ VALUE rb_thread_shield_new(void);
1177
+ VALUE rb_thread_shield_wait(VALUE self);
1178
+ VALUE rb_thread_shield_release(VALUE self);
1179
+ VALUE rb_thread_shield_destroy(VALUE self);
1180
+ int rb_thread_to_be_killed(VALUE thread);
1181
+ void rb_mutex_allow_trap(VALUE self, int val);
1182
+ VALUE rb_uninterruptible(VALUE (*b_proc)(ANYARGS), VALUE data);
1183
+ VALUE rb_mutex_owned_p(VALUE self);
1184
+ void ruby_kill(rb_pid_t pid, int sig);
1185
+
1186
+ /* thread_pthread.c, thread_win32.c */
1187
+ void Init_native_thread(void);
1188
+ int rb_divert_reserved_fd(int fd);
1189
+
1190
+ /* transcode.c */
1191
+ extern VALUE rb_cEncodingConverter;
1192
+ size_t rb_econv_memsize(rb_econv_t *);
1193
+
1194
+ /* us_ascii.c */
1195
+ extern rb_encoding OnigEncodingUS_ASCII;
1196
+
1197
+ /* util.c */
1198
+ char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve);
1199
+ char *ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve);
1200
+
1201
+ /* utf_8.c */
1202
+ extern rb_encoding OnigEncodingUTF_8;
1203
+
1204
+ /* variable.c */
1205
+ size_t rb_generic_ivar_memsize(VALUE);
1206
+ VALUE rb_search_class_path(VALUE);
1207
+ VALUE rb_attr_delete(VALUE, ID);
1208
+ VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
1209
+ void rb_autoload_str(VALUE mod, ID id, VALUE file);
1210
+
1211
+ /* version.c */
1212
+ extern const char ruby_engine[];
1213
+
1214
+ /* vm_insnhelper.h */
1215
+ rb_serial_t rb_next_class_serial(void);
1216
+
1217
+ /* vm.c */
1218
+ VALUE rb_obj_is_thread(VALUE obj);
1219
+ void rb_vm_mark(void *ptr);
1220
+ void Init_BareVM(void);
1221
+ void Init_vm_objects(void);
1222
+ VALUE rb_vm_top_self(void);
1223
+ void rb_thread_recycle_stack_release(VALUE *);
1224
+ void rb_vm_change_state(void);
1225
+ void rb_vm_inc_const_missing_count(void);
1226
+ void rb_thread_mark(void *th);
1227
+ const void **rb_vm_get_insns_address_table(void);
1228
+ VALUE rb_sourcefilename(void);
1229
+ VALUE rb_source_location(int *pline);
1230
+ const char *rb_source_loc(int *pline);
1231
+ void rb_vm_pop_cfunc_frame(void);
1232
+ int rb_vm_add_root_module(ID id, VALUE module);
1233
+ void rb_vm_check_redefinition_by_prepend(VALUE klass);
1234
+ VALUE rb_yield_refine_block(VALUE refinement, VALUE refinements);
1235
+ VALUE ruby_vm_sysstack_error_copy(void);
1236
+
1237
+ /* vm_dump.c */
1238
+ void rb_print_backtrace(void);
1239
+
1240
+ /* vm_eval.c */
1241
+ void Init_vm_eval(void);
1242
+ VALUE rb_current_realfilepath(void);
1243
+ VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE);
1244
+ typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE);
1245
+ VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
1246
+ rb_check_funcall_hook *hook, VALUE arg);
1247
+ VALUE rb_check_funcall_default(VALUE, ID, int, const VALUE *, VALUE);
1248
+ VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr);
1249
+ VALUE rb_yield_1(VALUE val);
1250
+
1251
+ /* vm_insnhelper.c */
1252
+ VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
1253
+
1254
+ /* vm_method.c */
1255
+ void Init_eval_method(void);
1256
+ int rb_method_defined_by(VALUE obj, ID mid, VALUE (*cfunc)(ANYARGS));
1257
+
1258
+ /* miniprelude.c, prelude.c */
1259
+ void Init_prelude(void);
1260
+
1261
+ /* vm_backtrace.c */
1262
+ void Init_vm_backtrace(void);
1263
+ VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval);
1264
+ VALUE rb_vm_thread_backtrace_locations(int argc, const VALUE *argv, VALUE thval);
1265
+
1266
+ VALUE rb_make_backtrace(void);
1267
+ void rb_backtrace_print_as_bugreport(void);
1268
+ int rb_backtrace_p(VALUE obj);
1269
+ VALUE rb_backtrace_to_str_ary(VALUE obj);
1270
+ VALUE rb_backtrace_to_location_ary(VALUE obj);
1271
+ void rb_backtrace_print_to(VALUE output);
1272
+ VALUE rb_vm_backtrace_object(void);
1273
+
1274
+ RUBY_SYMBOL_EXPORT_BEGIN
1275
+ const char *rb_objspace_data_type_name(VALUE obj);
1276
+
1277
+ /* Temporary. This API will be removed (renamed). */
1278
+ VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd);
1279
+
1280
+ /* bignum.c (export) */
1281
+ VALUE rb_big_mul_normal(VALUE x, VALUE y);
1282
+ VALUE rb_big_mul_balance(VALUE x, VALUE y);
1283
+ VALUE rb_big_mul_karatsuba(VALUE x, VALUE y);
1284
+ VALUE rb_big_mul_toom3(VALUE x, VALUE y);
1285
+ VALUE rb_big_sq_fast(VALUE x);
1286
+ VALUE rb_big_divrem_normal(VALUE x, VALUE y);
1287
+ VALUE rb_big2str_poweroftwo(VALUE x, int base);
1288
+ VALUE rb_big2str_generic(VALUE x, int base);
1289
+ VALUE rb_str2big_poweroftwo(VALUE arg, int base, int badcheck);
1290
+ VALUE rb_str2big_normal(VALUE arg, int base, int badcheck);
1291
+ VALUE rb_str2big_karatsuba(VALUE arg, int base, int badcheck);
1292
+ #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
1293
+ VALUE rb_big_mul_gmp(VALUE x, VALUE y);
1294
+ VALUE rb_big_divrem_gmp(VALUE x, VALUE y);
1295
+ VALUE rb_big2str_gmp(VALUE x, int base);
1296
+ VALUE rb_str2big_gmp(VALUE arg, int base, int badcheck);
1297
+ #endif
1298
+
1299
+ /* error.c (export) */
1300
+ int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
1301
+
1302
+ /* file.c (export) */
1303
+ #ifdef HAVE_READLINK
1304
+ VALUE rb_readlink(VALUE path, rb_encoding *enc);
1305
+ #endif
1306
+ #ifdef __APPLE__
1307
+ VALUE rb_str_normalize_ospath(const char *ptr, long len);
1308
+ #endif
1309
+
1310
+ /* hash.c (export) */
1311
+ VALUE rb_hash_delete_entry(VALUE hash, VALUE key);
1312
+ VALUE rb_ident_hash_new(void);
1313
+
1314
+ /* io.c (export) */
1315
+ void rb_maygvl_fd_fix_cloexec(int fd);
1316
+ int rb_gc_for_fd(int err);
1317
+
1318
+ /* numeric.c (export) */
1319
+ VALUE rb_int_positive_pow(long x, unsigned long y);
1320
+
1321
+ /* process.c (export) */
1322
+ int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
1323
+ 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);
1324
+ VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell);
1325
+ struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
1326
+ VALUE rb_execarg_init(int argc, const VALUE *argv, int accept_shell, VALUE execarg_obj);
1327
+ int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
1328
+ void rb_execarg_parent_start(VALUE execarg_obj);
1329
+ void rb_execarg_parent_end(VALUE execarg_obj);
1330
+ int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
1331
+ VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash);
1332
+ void rb_execarg_setenv(VALUE execarg_obj, VALUE env);
1333
+
1334
+ /* rational.c (export) */
1335
+ VALUE rb_gcd_normal(VALUE self, VALUE other);
1336
+ #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
1337
+ VALUE rb_gcd_gmp(VALUE x, VALUE y);
1338
+ #endif
1339
+
1340
+ /* string.c (export) */
1341
+ #ifdef RUBY_ENCODING_H
1342
+ /* internal use */
1343
+ VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc);
1344
+ #endif
1345
+
1346
+ /* thread.c (export) */
1347
+ int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
1348
+
1349
+ /* util.c (export) */
1350
+ extern const signed char ruby_digit36_to_number_table[];
1351
+ extern const char ruby_hexdigits[];
1352
+ extern unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow);
1353
+
1354
+ /* variable.c (export) */
1355
+ void rb_gc_mark_global_tbl(void);
1356
+ void rb_mark_generic_ivar(VALUE);
1357
+ VALUE rb_const_missing(VALUE klass, VALUE name);
1358
+ int rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
1359
+ st_table *rb_st_copy(VALUE obj, struct st_table *orig_tbl);
1360
+
1361
+ /* gc.c (export) */
1362
+ VALUE rb_wb_protected_newobj_of(VALUE, VALUE);
1363
+ VALUE rb_wb_unprotected_newobj_of(VALUE, VALUE);
1364
+
1365
+ size_t rb_obj_memsize_of(VALUE);
1366
+ void rb_gc_verify_internal_consistency(void);
1367
+
1368
+ #define RB_OBJ_GC_FLAGS_MAX 5
1369
+ size_t rb_obj_gc_flags(VALUE, ID[], size_t);
1370
+ void rb_gc_mark_values(long n, const VALUE *values);
1371
+
1372
+ #if IMEMO_DEBUG
1373
+ VALUE rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0, const char *file, int line);
1374
+ #define rb_imemo_new(type, v1, v2, v3, v0) rb_imemo_new_debug(type, v1, v2, v3, v0, __FILE__, __LINE__)
1375
+ #else
1376
+ VALUE rb_imemo_new(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0);
1377
+ #endif
1378
+
1379
+ RUBY_SYMBOL_EXPORT_END
1380
+
1381
+ #define RUBY_DTRACE_CREATE_HOOK(name, arg) \
1382
+ RUBY_DTRACE_HOOK(name##_CREATE, arg)
1383
+ #define RUBY_DTRACE_HOOK(name, arg) \
1384
+ do { \
1385
+ if (UNLIKELY(RUBY_DTRACE_##name##_ENABLED())) { \
1386
+ int dtrace_line; \
1387
+ const char *dtrace_file = rb_source_loc(&dtrace_line); \
1388
+ if (!dtrace_file) dtrace_file = ""; \
1389
+ RUBY_DTRACE_##name(arg, dtrace_file, dtrace_line); \
1390
+ } \
1391
+ } while (0)
1392
+
1393
+ #if defined(__cplusplus)
1394
+ #if 0
1395
+ { /* satisfy cc-mode */
1396
+ #endif
1397
+ } /* extern "C" { */
1398
+ #endif
1399
+
1400
+ #endif /* RUBY_INTERNAL_H */