debase-ruby_core_source 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/addr2line.h +21 -0
  4. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/constant.h +36 -0
  5. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/dln.h +50 -0
  6. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/encdb.h +169 -0
  7. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/eval_intern.h +241 -0
  8. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/gc.h +104 -0
  9. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/id.h +135 -0
  10. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/insns.inc +187 -0
  11. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/insns_info.inc +724 -0
  12. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/internal.h +395 -0
  13. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/iseq.h +140 -0
  14. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/known_errors.inc +731 -0
  15. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/method.h +141 -0
  16. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/node.h +541 -0
  17. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/node_name.inc +212 -0
  18. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/opt_sc.inc +702 -0
  19. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/optinsn.inc +83 -0
  20. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/optunifs.inc +120 -0
  21. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/parse.h +181 -0
  22. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/probes_helper.h +67 -0
  23. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/regenc.h +227 -0
  24. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/regint.h +915 -0
  25. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/regparse.h +367 -0
  26. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/revision.h +1 -0
  27. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/ruby_atomic.h +170 -0
  28. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/siphash.h +48 -0
  29. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/thread_pthread.h +56 -0
  30. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/thread_win32.h +45 -0
  31. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/timev.h +21 -0
  32. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/transcode_data.h +127 -0
  33. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/transdb.h +193 -0
  34. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/version.h +52 -0
  35. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/vm.inc +3196 -0
  36. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/vm_core.h +1020 -0
  37. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/vm_debug.h +41 -0
  38. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/vm_exec.h +173 -0
  39. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/vm_insnhelper.h +274 -0
  40. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/vm_opts.h +56 -0
  41. data/lib/debase/ruby_core_source/ruby-2.0.0-p648/vmtc.inc +101 -0
  42. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/addr2line.h +21 -0
  43. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/constant.h +36 -0
  44. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/dln.h +51 -0
  45. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/encdb.h +170 -0
  46. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/eval_intern.h +270 -0
  47. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/gc.h +101 -0
  48. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/id.h +171 -0
  49. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/insns.inc +189 -0
  50. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/insns_info.inc +731 -0
  51. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/internal.h +896 -0
  52. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/iseq.h +136 -0
  53. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/known_errors.inc +731 -0
  54. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/method.h +145 -0
  55. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/node.h +543 -0
  56. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/node_name.inc +212 -0
  57. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/opt_sc.inc +710 -0
  58. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/optinsn.inc +83 -0
  59. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/optunifs.inc +121 -0
  60. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/parse.h +183 -0
  61. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/probes_helper.h +67 -0
  62. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/regenc.h +223 -0
  63. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/regint.h +911 -0
  64. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/regparse.h +363 -0
  65. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/revision.h +1 -0
  66. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/ruby_atomic.h +170 -0
  67. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/siphash.h +48 -0
  68. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/thread_native.h +23 -0
  69. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/thread_pthread.h +56 -0
  70. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/thread_win32.h +45 -0
  71. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/timev.h +42 -0
  72. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/transcode_data.h +123 -0
  73. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/transdb.h +190 -0
  74. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/version.h +52 -0
  75. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/vm.inc +3241 -0
  76. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/vm_core.h +1057 -0
  77. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/vm_debug.h +37 -0
  78. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/vm_exec.h +182 -0
  79. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/vm_insnhelper.h +273 -0
  80. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/vm_opts.h +56 -0
  81. data/lib/debase/ruby_core_source/ruby-2.1.8-p440/vmtc.inc +102 -0
  82. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/addr2line.h +21 -0
  83. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/ccan/build_assert/build_assert.h +40 -0
  84. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/ccan/check_type/check_type.h +63 -0
  85. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/ccan/container_of/container_of.h +142 -0
  86. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/ccan/list/list.h +635 -0
  87. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/ccan/str/str.h +16 -0
  88. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/constant.h +43 -0
  89. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/dln.h +51 -0
  90. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/eval_intern.h +275 -0
  91. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/gc.h +107 -0
  92. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/id.h +210 -0
  93. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/insns.inc +107 -0
  94. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/insns_info.inc +752 -0
  95. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/internal.h +1196 -0
  96. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/iseq.h +158 -0
  97. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/known_errors.inc +746 -0
  98. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/method.h +144 -0
  99. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/node.h +544 -0
  100. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/node_name.inc +212 -0
  101. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/opt_sc.inc +734 -0
  102. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/optinsn.inc +83 -0
  103. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/optunifs.inc +124 -0
  104. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/parse.h +184 -0
  105. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/probes_helper.h +67 -0
  106. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/regenc.h +234 -0
  107. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/regint.h +972 -0
  108. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/regparse.h +363 -0
  109. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/revision.h +1 -0
  110. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/ruby_atomic.h +170 -0
  111. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/siphash.h +48 -0
  112. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/symbol.h +88 -0
  113. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/thread_pthread.h +54 -0
  114. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/thread_win32.h +36 -0
  115. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/timev.h +42 -0
  116. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/transcode_data.h +123 -0
  117. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/version.h +52 -0
  118. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/vm.inc +3370 -0
  119. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/vm_core.h +1160 -0
  120. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/vm_debug.h +37 -0
  121. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/vm_exec.h +182 -0
  122. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/vm_insnhelper.h +233 -0
  123. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/vm_opts.h +56 -0
  124. data/lib/debase/ruby_core_source/ruby-2.2.4-p230/vmtc.inc +105 -0
  125. data/lib/debase/ruby_core_source/version.rb +1 -1
  126. metadata +124 -2
@@ -0,0 +1,896 @@
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
+ #if defined(__cplusplus)
16
+ extern "C" {
17
+ #if 0
18
+ } /* satisfy cc-mode */
19
+ #endif
20
+ #endif
21
+
22
+ #ifdef HAVE_VALGRIND_MEMCHECK_H
23
+ # include <valgrind/memcheck.h>
24
+ # ifndef VALGRIND_MAKE_MEM_DEFINED
25
+ # define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
26
+ # endif
27
+ # ifndef VALGRIND_MAKE_MEM_UNDEFINED
28
+ # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
29
+ # endif
30
+ #else
31
+ # define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
32
+ # define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
33
+ #endif
34
+
35
+ #define numberof(array) ((int)(sizeof(array) / sizeof((array)[0])))
36
+
37
+ #define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
38
+
39
+ #define GCC_VERSION_SINCE(major, minor, patchlevel) \
40
+ (defined(__GNUC__) && !defined(__INTEL_COMPILER) && \
41
+ ((__GNUC__ > (major)) || \
42
+ (__GNUC__ == (major) && __GNUC_MINOR__ > (minor)) || \
43
+ (__GNUC__ == (major) && __GNUC_MINOR__ == (minor) && __GNUC_PATCHLEVEL__ >= (patchlevel))))
44
+
45
+ #define SIGNED_INTEGER_TYPE_P(int_type) (0 > ((int_type)0)-1)
46
+ #define SIGNED_INTEGER_MAX(sint_type) \
47
+ (sint_type) \
48
+ ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) | \
49
+ ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) - 1))
50
+ #define SIGNED_INTEGER_MIN(sint_type) (-SIGNED_INTEGER_MAX(sint_type)-1)
51
+ #define UNSIGNED_INTEGER_MAX(uint_type) (~(uint_type)0)
52
+
53
+ #if SIGNEDNESS_OF_TIME_T < 0 /* signed */
54
+ # define TIMET_MAX SIGNED_INTEGER_MAX(time_t)
55
+ # define TIMET_MIN SIGNED_INTEGER_MIN(time_t)
56
+ #elif SIGNEDNESS_OF_TIME_T > 0 /* unsigned */
57
+ # define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t)
58
+ # define TIMET_MIN ((time_t)0)
59
+ #endif
60
+ #define TIMET_MAX_PLUS_ONE (2*(double)(TIMET_MAX/2+1))
61
+
62
+ #define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
63
+ (a) == 0 ? 0 : \
64
+ (a) == -1 ? (b) < -(max) : \
65
+ (a) > 0 ? \
66
+ ((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \
67
+ ((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b)))
68
+ #define MUL_OVERFLOW_FIXNUM_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
69
+ #define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
70
+ #define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
71
+
72
+ #ifndef swap16
73
+ # ifdef HAVE_BUILTIN___BUILTIN_BSWAP16
74
+ # define swap16(x) __builtin_bswap16(x)
75
+ # endif
76
+ #endif
77
+
78
+ #ifndef swap16
79
+ # define swap16(x) ((uint16_t)((((x)&0xFF)<<8) | (((x)>>8)&0xFF)))
80
+ #endif
81
+
82
+ #ifndef swap32
83
+ # ifdef HAVE_BUILTIN___BUILTIN_BSWAP32
84
+ # define swap32(x) __builtin_bswap32(x)
85
+ # endif
86
+ #endif
87
+
88
+ #ifndef swap32
89
+ # define swap32(x) ((uint32_t)((((x)&0xFF)<<24) \
90
+ |(((x)>>24)&0xFF) \
91
+ |(((x)&0x0000FF00)<<8) \
92
+ |(((x)&0x00FF0000)>>8) ))
93
+ #endif
94
+
95
+ #ifndef swap64
96
+ # ifdef HAVE_BUILTIN___BUILTIN_BSWAP64
97
+ # define swap64(x) __builtin_bswap64(x)
98
+ # endif
99
+ #endif
100
+
101
+ #ifndef swap64
102
+ # ifdef HAVE_INT64_T
103
+ # define byte_in_64bit(n) ((uint64_t)0xff << (n))
104
+ # define swap64(x) ((uint64_t)((((x)&byte_in_64bit(0))<<56) \
105
+ |(((x)>>56)&0xFF) \
106
+ |(((x)&byte_in_64bit(8))<<40) \
107
+ |(((x)&byte_in_64bit(48))>>40) \
108
+ |(((x)&byte_in_64bit(16))<<24) \
109
+ |(((x)&byte_in_64bit(40))>>24) \
110
+ |(((x)&byte_in_64bit(24))<<8) \
111
+ |(((x)&byte_in_64bit(32))>>8)))
112
+ # endif
113
+ #endif
114
+
115
+ static inline int
116
+ nlz_int(unsigned int x)
117
+ {
118
+ #if defined(HAVE_BUILTIN___BUILTIN_CLZ)
119
+ if (x == 0) return SIZEOF_INT * CHAR_BIT;
120
+ return __builtin_clz(x);
121
+ #else
122
+ unsigned int y;
123
+ # if 64 < SIZEOF_INT * CHAR_BIT
124
+ int n = 128;
125
+ # elif 32 < SIZEOF_INT * CHAR_BIT
126
+ int n = 64;
127
+ # else
128
+ int n = 32;
129
+ # endif
130
+ # if 64 < SIZEOF_INT * CHAR_BIT
131
+ y = x >> 64; if (y) {n -= 64; x = y;}
132
+ # endif
133
+ # if 32 < SIZEOF_INT * CHAR_BIT
134
+ y = x >> 32; if (y) {n -= 32; x = y;}
135
+ # endif
136
+ y = x >> 16; if (y) {n -= 16; x = y;}
137
+ y = x >> 8; if (y) {n -= 8; x = y;}
138
+ y = x >> 4; if (y) {n -= 4; x = y;}
139
+ y = x >> 2; if (y) {n -= 2; x = y;}
140
+ y = x >> 1; if (y) {return n - 2;}
141
+ return (int)(n - x);
142
+ #endif
143
+ }
144
+
145
+ static inline int
146
+ nlz_long(unsigned long x)
147
+ {
148
+ #if defined(HAVE_BUILTIN___BUILTIN_CLZL)
149
+ if (x == 0) return SIZEOF_LONG * CHAR_BIT;
150
+ return __builtin_clzl(x);
151
+ #else
152
+ unsigned long y;
153
+ # if 64 < SIZEOF_LONG * CHAR_BIT
154
+ int n = 128;
155
+ # elif 32 < SIZEOF_LONG * CHAR_BIT
156
+ int n = 64;
157
+ # else
158
+ int n = 32;
159
+ # endif
160
+ # if 64 < SIZEOF_LONG * CHAR_BIT
161
+ y = x >> 64; if (y) {n -= 64; x = y;}
162
+ # endif
163
+ # if 32 < SIZEOF_LONG * CHAR_BIT
164
+ y = x >> 32; if (y) {n -= 32; x = y;}
165
+ # endif
166
+ y = x >> 16; if (y) {n -= 16; x = y;}
167
+ y = x >> 8; if (y) {n -= 8; x = y;}
168
+ y = x >> 4; if (y) {n -= 4; x = y;}
169
+ y = x >> 2; if (y) {n -= 2; x = y;}
170
+ y = x >> 1; if (y) {return n - 2;}
171
+ return (int)(n - x);
172
+ #endif
173
+ }
174
+
175
+ #ifdef HAVE_LONG_LONG
176
+ static inline int
177
+ nlz_long_long(unsigned LONG_LONG x)
178
+ {
179
+ #if defined(HAVE_BUILTIN___BUILTIN_CLZLL)
180
+ if (x == 0) return SIZEOF_LONG_LONG * CHAR_BIT;
181
+ return __builtin_clzll(x);
182
+ #else
183
+ unsigned LONG_LONG y;
184
+ # if 64 < SIZEOF_LONG_LONG * CHAR_BIT
185
+ int n = 128;
186
+ # elif 32 < SIZEOF_LONG_LONG * CHAR_BIT
187
+ int n = 64;
188
+ # else
189
+ int n = 32;
190
+ # endif
191
+ # if 64 < SIZEOF_LONG_LONG * CHAR_BIT
192
+ y = x >> 64; if (y) {n -= 64; x = y;}
193
+ # endif
194
+ # if 32 < SIZEOF_LONG_LONG * CHAR_BIT
195
+ y = x >> 32; if (y) {n -= 32; x = y;}
196
+ # endif
197
+ y = x >> 16; if (y) {n -= 16; x = y;}
198
+ y = x >> 8; if (y) {n -= 8; x = y;}
199
+ y = x >> 4; if (y) {n -= 4; x = y;}
200
+ y = x >> 2; if (y) {n -= 2; x = y;}
201
+ y = x >> 1; if (y) {return n - 2;}
202
+ return (int)(n - x);
203
+ #endif
204
+ }
205
+ #endif
206
+
207
+ #ifdef HAVE_UINT128_T
208
+ static inline int
209
+ nlz_int128(uint128_t x)
210
+ {
211
+ uint128_t y;
212
+ int n = 128;
213
+ y = x >> 64; if (y) {n -= 64; x = y;}
214
+ y = x >> 32; if (y) {n -= 32; x = y;}
215
+ y = x >> 16; if (y) {n -= 16; x = y;}
216
+ y = x >> 8; if (y) {n -= 8; x = y;}
217
+ y = x >> 4; if (y) {n -= 4; x = y;}
218
+ y = x >> 2; if (y) {n -= 2; x = y;}
219
+ y = x >> 1; if (y) {return n - 2;}
220
+ return (int)(n - x);
221
+ }
222
+ #endif
223
+
224
+ #if defined(HAVE_UINT128_T)
225
+ # define bit_length(x) \
226
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
227
+ sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
228
+ sizeof(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)) : \
229
+ SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x)))
230
+ #elif defined(HAVE_LONG_LONG)
231
+ # define bit_length(x) \
232
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
233
+ sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
234
+ SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)))
235
+ #else
236
+ # define bit_length(x) \
237
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
238
+ SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)))
239
+ #endif
240
+
241
+ struct rb_deprecated_classext_struct {
242
+ char conflict[sizeof(VALUE) * 3];
243
+ };
244
+
245
+ struct rb_subclass_entry;
246
+ typedef struct rb_subclass_entry rb_subclass_entry_t;
247
+
248
+ struct rb_subclass_entry {
249
+ VALUE klass;
250
+ rb_subclass_entry_t *next;
251
+ };
252
+
253
+ #if defined(HAVE_LONG_LONG)
254
+ typedef unsigned LONG_LONG rb_serial_t;
255
+ #define SERIALT2NUM ULL2NUM
256
+ #elif defined(HAVE_UINT64_T)
257
+ typedef uint64_t rb_serial_t;
258
+ #define SERIALT2NUM SIZET2NUM
259
+ #else
260
+ typedef unsigned long rb_serial_t;
261
+ #define SERIALT2NUM ULONG2NUM
262
+ #endif
263
+
264
+ struct rb_classext_struct {
265
+ struct st_table *iv_index_tbl;
266
+ struct st_table *iv_tbl;
267
+ struct st_table *const_tbl;
268
+ rb_subclass_entry_t *subclasses;
269
+ rb_subclass_entry_t **parent_subclasses;
270
+ /**
271
+ * In the case that this is an `ICLASS`, `module_subclasses` points to the link
272
+ * in the module's `subclasses` list that indicates that the klass has been
273
+ * included. Hopefully that makes sense.
274
+ */
275
+ rb_subclass_entry_t **module_subclasses;
276
+ rb_serial_t class_serial;
277
+ VALUE origin;
278
+ VALUE refined_class;
279
+ rb_alloc_func_t allocator;
280
+ };
281
+
282
+ struct method_table_wrapper {
283
+ st_table *tbl;
284
+ size_t serial;
285
+ };
286
+
287
+ /* class.c */
288
+ void rb_class_subclass_add(VALUE super, VALUE klass);
289
+ void rb_class_remove_from_super_subclasses(VALUE);
290
+
291
+ #define RCLASS_EXT(c) (RCLASS(c)->ptr)
292
+ #define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl)
293
+ #define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl)
294
+ #define RCLASS_M_TBL_WRAPPER(c) (RCLASS(c)->m_tbl_wrapper)
295
+ #define RCLASS_M_TBL(c) (RCLASS_M_TBL_WRAPPER(c) ? RCLASS_M_TBL_WRAPPER(c)->tbl : 0)
296
+ #define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(c)->iv_index_tbl)
297
+ #define RCLASS_ORIGIN(c) (RCLASS_EXT(c)->origin)
298
+ #define RCLASS_REFINED_CLASS(c) (RCLASS_EXT(c)->refined_class)
299
+ #define RCLASS_SERIAL(c) (RCLASS_EXT(c)->class_serial)
300
+
301
+ static inline void
302
+ RCLASS_M_TBL_INIT(VALUE c)
303
+ {
304
+ struct method_table_wrapper *wrapper;
305
+ wrapper = ALLOC(struct method_table_wrapper);
306
+ wrapper->tbl = st_init_numtable();
307
+ wrapper->serial = 0;
308
+ RCLASS_M_TBL_WRAPPER(c) = wrapper;
309
+ }
310
+
311
+ #undef RCLASS_SUPER
312
+ static inline VALUE
313
+ RCLASS_SUPER(VALUE klass)
314
+ {
315
+ return RCLASS(klass)->super;
316
+ }
317
+
318
+ static inline VALUE
319
+ RCLASS_SET_SUPER(VALUE klass, VALUE super)
320
+ {
321
+ if (super) {
322
+ rb_class_remove_from_super_subclasses(klass);
323
+ rb_class_subclass_add(super, klass);
324
+ }
325
+ RB_OBJ_WRITE(klass, &RCLASS(klass)->super, super);
326
+ return super;
327
+ }
328
+
329
+ struct vtm; /* defined by timev.h */
330
+
331
+ /* array.c */
332
+ VALUE rb_ary_last(int, VALUE *, VALUE);
333
+ void rb_ary_set_len(VALUE, long);
334
+ void rb_ary_delete_same(VALUE, VALUE);
335
+
336
+ /* bignum.c */
337
+ VALUE rb_big_fdiv(VALUE x, VALUE y);
338
+ VALUE rb_big_uminus(VALUE x);
339
+ VALUE rb_integer_float_cmp(VALUE x, VALUE y);
340
+ VALUE rb_integer_float_eq(VALUE x, VALUE y);
341
+
342
+ /* class.c */
343
+ void rb_class_foreach_subclass(VALUE klass, void(*f)(VALUE));
344
+ void rb_class_detach_subclasses(VALUE);
345
+ void rb_class_detach_module_subclasses(VALUE);
346
+ void rb_class_remove_from_module_subclasses(VALUE);
347
+ VALUE rb_obj_methods(int argc, VALUE *argv, VALUE obj);
348
+ VALUE rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj);
349
+ VALUE rb_obj_private_methods(int argc, VALUE *argv, VALUE obj);
350
+ VALUE rb_obj_public_methods(int argc, VALUE *argv, VALUE obj);
351
+ int rb_obj_basic_to_s_p(VALUE);
352
+ VALUE rb_special_singleton_class(VALUE);
353
+ VALUE rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach);
354
+ VALUE rb_singleton_class_get(VALUE obj);
355
+ void Init_class_hierarchy(void);
356
+
357
+ /* compar.c */
358
+ VALUE rb_invcmp(VALUE, VALUE);
359
+
360
+ /* compile.c */
361
+ int rb_dvar_defined(ID);
362
+ int rb_local_defined(ID);
363
+ int rb_parse_in_eval(void);
364
+ int rb_parse_in_main(void);
365
+ const char * rb_insns_name(int i);
366
+ VALUE rb_insns_name_array(void);
367
+
368
+ /* cont.c */
369
+ VALUE rb_obj_is_fiber(VALUE);
370
+ void rb_fiber_reset_root_local_storage(VALUE);
371
+ void ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE (*rollback_func)(ANYARGS));
372
+
373
+ /* debug.c */
374
+ PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
375
+
376
+ /* dmyext.c */
377
+ void Init_ext(void);
378
+
379
+ /* encoding.c */
380
+ #ifdef RUBY_ENCODING_H
381
+ enum ruby_preserved_encindex {
382
+ ENCINDEX_ASCII,
383
+ ENCINDEX_UTF_8,
384
+ ENCINDEX_US_ASCII,
385
+
386
+ /* preserved indexes */
387
+ ENCINDEX_UTF_16BE,
388
+ ENCINDEX_UTF_16LE,
389
+ ENCINDEX_UTF_32BE,
390
+ ENCINDEX_UTF_32LE,
391
+ ENCINDEX_UTF_16,
392
+ ENCINDEX_UTF_32,
393
+ ENCINDEX_UTF8_MAC,
394
+
395
+ /* for old options of regexp */
396
+ ENCINDEX_EUC_JP,
397
+ ENCINDEX_Windows_31J,
398
+
399
+ ENCINDEX_BUILTIN_MAX
400
+ };
401
+ #endif
402
+ #define rb_ascii8bit_encindex() ENCINDEX_ASCII
403
+ #define rb_utf8_encindex() ENCINDEX_UTF_8
404
+ #define rb_usascii_encindex() ENCINDEX_US_ASCII
405
+ ID rb_id_encoding(void);
406
+ void rb_gc_mark_encodings(void);
407
+
408
+ /* error.c */
409
+ NORETURN(PRINTF_ARGS(void rb_compile_bug(const char*, int, const char*, ...), 3, 4));
410
+ VALUE rb_check_backtrace(VALUE);
411
+ NORETURN(void rb_async_bug_errno(const char *,int));
412
+ const char *rb_builtin_type_name(int t);
413
+ const char *rb_builtin_class_name(VALUE x);
414
+
415
+ /* eval.c */
416
+ VALUE rb_refinement_module_get_refined_class(VALUE module);
417
+
418
+ /* eval_error.c */
419
+ void ruby_error_print(void);
420
+ VALUE rb_get_backtrace(VALUE info);
421
+
422
+ /* eval_jump.c */
423
+ void rb_call_end_proc(VALUE data);
424
+ void rb_mark_end_proc(void);
425
+
426
+ /* file.c */
427
+ VALUE rb_home_dir_of(VALUE user, VALUE result);
428
+ VALUE rb_default_home_dir(VALUE result);
429
+ VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
430
+ void rb_file_const(const char*, VALUE);
431
+ int rb_file_load_ok(const char *);
432
+ VALUE rb_file_expand_path_fast(VALUE, VALUE);
433
+ VALUE rb_file_expand_path_internal(VALUE, VALUE, int, int, VALUE);
434
+ VALUE rb_get_path_check_to_string(VALUE, int);
435
+ VALUE rb_get_path_check_convert(VALUE, VALUE, int);
436
+ void Init_File(void);
437
+
438
+ #ifdef RUBY_FUNCTION_NAME_STRING
439
+ # if defined __GNUC__ && __GNUC__ >= 4
440
+ # pragma GCC visibility push(default)
441
+ # endif
442
+ NORETURN(void rb_sys_fail_path_in(const char *func_name, VALUE path));
443
+ NORETURN(void rb_syserr_fail_path_in(const char *func_name, int err, VALUE path));
444
+ # if defined __GNUC__ && __GNUC__ >= 4
445
+ # pragma GCC visibility pop
446
+ # endif
447
+ # define rb_sys_fail_path(path) rb_sys_fail_path_in(RUBY_FUNCTION_NAME_STRING, path)
448
+ # define rb_syserr_fail_path(err, path) rb_syserr_fail_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path))
449
+ #else
450
+ # define rb_sys_fail_path(path) rb_sys_fail_str(path)
451
+ # define rb_syserr_fail_path(err, path) rb_syserr_fail_str((err), (path))
452
+ #endif
453
+
454
+ /* gc.c */
455
+ void Init_heap(void);
456
+ void *ruby_mimmalloc(size_t size);
457
+ void ruby_mimfree(void *ptr);
458
+ void rb_objspace_set_event_hook(const rb_event_flag_t event);
459
+ void rb_gc_writebarrier_remember_promoted(VALUE obj);
460
+ void ruby_gc_set_params(int safe_level);
461
+
462
+ #if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32)
463
+ #define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size)
464
+ #define ruby_sized_xrealloc2(ptr, new_count, element_size, old_count) ruby_xrealloc(ptr, new_count, element_size)
465
+ #define ruby_sized_xfree(ptr, size) ruby_xfree(ptr)
466
+ #define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n)
467
+ #else
468
+ void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_ALLOC_SIZE((2));
469
+ void *ruby_sized_xrealloc2(void *ptr, size_t new_count, size_t element_size, size_t old_count) RUBY_ATTR_ALLOC_SIZE((2, 3));
470
+ void ruby_sized_xfree(void *x, size_t size);
471
+ #define SIZED_REALLOC_N(var,type,n,old_n) ((var)=(type*)ruby_sized_xrealloc((char*)(var), (n) * sizeof(type), (old_n) * sizeof(type)))
472
+ #endif
473
+
474
+ void rb_gc_resurrect(VALUE ptr);
475
+
476
+ /* hash.c */
477
+ struct st_table *rb_hash_tbl_raw(VALUE hash);
478
+ #define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
479
+ VALUE rb_hash_keys(VALUE hash);
480
+ VALUE rb_hash_values(VALUE hash);
481
+ #define HASH_DELETED FL_USER1
482
+ #define HASH_PROC_DEFAULT FL_USER2
483
+
484
+ /* inits.c */
485
+ void rb_call_inits(void);
486
+
487
+ /* io.c */
488
+ const char *ruby_get_inplace_mode(void);
489
+ void ruby_set_inplace_mode(const char *);
490
+ ssize_t rb_io_bufread(VALUE io, void *buf, size_t size);
491
+ void rb_stdio_set_default_encoding(void);
492
+ void rb_write_error_str(VALUE mesg);
493
+ VALUE rb_io_flush_raw(VALUE, int);
494
+
495
+ /* iseq.c */
496
+ VALUE rb_iseq_clone(VALUE iseqval, VALUE newcbase);
497
+ VALUE rb_iseq_path(VALUE iseqval);
498
+ VALUE rb_iseq_absolute_path(VALUE iseqval);
499
+ VALUE rb_iseq_label(VALUE iseqval);
500
+ VALUE rb_iseq_base_label(VALUE iseqval);
501
+ VALUE rb_iseq_first_lineno(VALUE iseqval);
502
+ VALUE rb_iseq_klass(VALUE iseqval); /* completely temporary fucntion */
503
+ VALUE rb_iseq_method_name(VALUE self);
504
+
505
+ /* load.c */
506
+ VALUE rb_get_load_path(void);
507
+ VALUE rb_get_expanded_load_path(void);
508
+ NORETURN(void rb_load_fail(VALUE, const char*));
509
+
510
+ /* math.c */
511
+ VALUE rb_math_atan2(VALUE, VALUE);
512
+ VALUE rb_math_cos(VALUE);
513
+ VALUE rb_math_cosh(VALUE);
514
+ VALUE rb_math_exp(VALUE);
515
+ VALUE rb_math_hypot(VALUE, VALUE);
516
+ VALUE rb_math_log(int argc, VALUE *argv);
517
+ VALUE rb_math_sin(VALUE);
518
+ VALUE rb_math_sinh(VALUE);
519
+ VALUE rb_math_sqrt(VALUE);
520
+
521
+ /* newline.c */
522
+ void Init_newline(void);
523
+
524
+ /* numeric.c */
525
+ int rb_num_to_uint(VALUE val, unsigned int *ret);
526
+ VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl);
527
+ int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl);
528
+ double ruby_float_mod(double x, double y);
529
+ int rb_num_negative_p(VALUE);
530
+ VALUE rb_int_succ(VALUE num);
531
+ VALUE rb_int_pred(VALUE num);
532
+ VALUE rb_dbl_hash(double d);
533
+
534
+ #if USE_FLONUM
535
+ #define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
536
+ #define RUBY_BIT_ROTR(v, n) (((v) >> (n)) | ((v) << ((sizeof(v) * 8) - n)))
537
+ #endif
538
+
539
+ static inline double
540
+ rb_float_value_inline(VALUE v)
541
+ {
542
+ #if USE_FLONUM
543
+ if (FLONUM_P(v)) {
544
+ if (v != (VALUE)0x8000000000000002) { /* LIKELY */
545
+ union {
546
+ double d;
547
+ VALUE v;
548
+ } t;
549
+
550
+ VALUE b63 = (v >> 63);
551
+ /* e: xx1... -> 011... */
552
+ /* xx0... -> 100... */
553
+ /* ^b63 */
554
+ t.v = RUBY_BIT_ROTR((2 - b63) | (v & ~0x03), 3);
555
+ return t.d;
556
+ }
557
+ else {
558
+ return 0.0;
559
+ }
560
+ }
561
+ #endif
562
+ return ((struct RFloat *)v)->float_value;
563
+ }
564
+
565
+ static inline VALUE
566
+ rb_float_new_inline(double d)
567
+ {
568
+ #if USE_FLONUM
569
+ union {
570
+ double d;
571
+ VALUE v;
572
+ } t;
573
+ int bits;
574
+
575
+ t.d = d;
576
+ bits = (int)((VALUE)(t.v >> 60) & 0x7);
577
+ /* bits contains 3 bits of b62..b60. */
578
+ /* bits - 3 = */
579
+ /* b011 -> b000 */
580
+ /* b100 -> b001 */
581
+
582
+ if (t.v != 0x3000000000000000 /* 1.72723e-77 */ &&
583
+ !((bits-3) & ~0x01)) {
584
+ return (RUBY_BIT_ROTL(t.v, 3) & ~(VALUE)0x01) | 0x02;
585
+ }
586
+ else if (t.v == (VALUE)0) {
587
+ /* +0.0 */
588
+ return 0x8000000000000002;
589
+ }
590
+ /* out of range */
591
+ #endif
592
+ return rb_float_new_in_heap(d);
593
+ }
594
+
595
+ #define rb_float_value(v) rb_float_value_inline(v)
596
+ #define rb_float_new(d) rb_float_new_inline(d)
597
+
598
+ /* object.c */
599
+ void rb_obj_copy_ivar(VALUE dest, VALUE obj);
600
+ VALUE rb_obj_equal(VALUE obj1, VALUE obj2);
601
+ VALUE rb_class_search_ancestor(VALUE klass, VALUE super);
602
+ NORETURN(void rb_undefined_alloc(VALUE klass));
603
+
604
+ struct RBasicRaw {
605
+ VALUE flags;
606
+ VALUE klass;
607
+ };
608
+
609
+ #define RBASIC_CLEAR_CLASS(obj) (((struct RBasicRaw *)((VALUE)(obj)))->klass = 0)
610
+ #define RBASIC_SET_CLASS_RAW(obj, cls) (((struct RBasicRaw *)((VALUE)(obj)))->klass = (cls))
611
+ #define RBASIC_SET_CLASS(obj, cls) do { \
612
+ VALUE _obj_ = (obj); \
613
+ RB_OBJ_WRITE(_obj_, &((struct RBasicRaw *)(_obj_))->klass, cls); \
614
+ } while (0)
615
+
616
+ /* parse.y */
617
+ VALUE rb_parser_get_yydebug(VALUE);
618
+ VALUE rb_parser_set_yydebug(VALUE, VALUE);
619
+ int rb_is_const_name(VALUE name);
620
+ int rb_is_class_name(VALUE name);
621
+ int rb_is_global_name(VALUE name);
622
+ int rb_is_instance_name(VALUE name);
623
+ int rb_is_attrset_name(VALUE name);
624
+ int rb_is_local_name(VALUE name);
625
+ int rb_is_method_name(VALUE name);
626
+ int rb_is_junk_name(VALUE name);
627
+ void rb_gc_mark_parser(void);
628
+ void rb_gc_mark_symbols(int full_mark);
629
+
630
+ /* proc.c */
631
+ VALUE rb_proc_location(VALUE self);
632
+ st_index_t rb_hash_proc(st_index_t hash, VALUE proc);
633
+ int rb_block_arity(void);
634
+ VALUE rb_block_clear_env_self(VALUE proc);
635
+
636
+ /* process.c */
637
+ #define RB_MAX_GROUPS (65536)
638
+
639
+ struct rb_execarg {
640
+ int use_shell;
641
+ union {
642
+ struct {
643
+ VALUE shell_script;
644
+ } sh;
645
+ struct {
646
+ VALUE command_name;
647
+ VALUE command_abspath; /* full path string or nil */
648
+ VALUE argv_str;
649
+ VALUE argv_buf;
650
+ } cmd;
651
+ } invoke;
652
+ VALUE redirect_fds;
653
+ VALUE envp_str;
654
+ VALUE envp_buf;
655
+ VALUE dup2_tmpbuf;
656
+ unsigned pgroup_given : 1;
657
+ unsigned umask_given : 1;
658
+ unsigned unsetenv_others_given : 1;
659
+ unsigned unsetenv_others_do : 1;
660
+ unsigned close_others_given : 1;
661
+ unsigned close_others_do : 1;
662
+ unsigned chdir_given : 1;
663
+ unsigned new_pgroup_given : 1;
664
+ unsigned new_pgroup_flag : 1;
665
+ unsigned uid_given : 1;
666
+ unsigned gid_given : 1;
667
+ rb_pid_t pgroup_pgid; /* asis(-1), new pgroup(0), specified pgroup (0<V). */
668
+ VALUE rlimit_limits; /* Qfalse or [[rtype, softlim, hardlim], ...] */
669
+ mode_t umask_mask;
670
+ rb_uid_t uid;
671
+ rb_gid_t gid;
672
+ VALUE fd_dup2;
673
+ VALUE fd_close;
674
+ VALUE fd_open;
675
+ VALUE fd_dup2_child;
676
+ int close_others_maxhint;
677
+ VALUE env_modification; /* Qfalse or [[k1,v1], ...] */
678
+ VALUE chdir_dir;
679
+ };
680
+
681
+ /* argv_str contains extra two elements.
682
+ * The beginning one is for /bin/sh used by exec_with_sh.
683
+ * The last one for terminating NULL used by execve.
684
+ * See rb_exec_fillarg() in process.c. */
685
+ #define ARGVSTR2ARGC(argv_str) (RSTRING_LEN(argv_str) / sizeof(char *) - 2)
686
+ #define ARGVSTR2ARGV(argv_str) ((char **)RSTRING_PTR(argv_str) + 1)
687
+
688
+ rb_pid_t rb_fork_ruby(int *status);
689
+ void rb_last_status_clear(void);
690
+
691
+ /* rational.c */
692
+ VALUE rb_lcm(VALUE x, VALUE y);
693
+ VALUE rb_rational_reciprocal(VALUE x);
694
+
695
+ /* re.c */
696
+ VALUE rb_reg_compile(VALUE str, int options, const char *sourcefile, int sourceline);
697
+ VALUE rb_reg_check_preprocess(VALUE);
698
+
699
+ /* signal.c */
700
+ int rb_get_next_signal(void);
701
+ int rb_sigaltstack_size(void);
702
+
703
+ /* strftime.c */
704
+ #ifdef RUBY_ENCODING_H
705
+ size_t rb_strftime_timespec(char *s, size_t maxsize, const char *format, rb_encoding *enc,
706
+ const struct vtm *vtm, struct timespec *ts, int gmt);
707
+ size_t rb_strftime(char *s, size_t maxsize, const char *format, rb_encoding *enc,
708
+ const struct vtm *vtm, VALUE timev, int gmt);
709
+ #endif
710
+
711
+ /* string.c */
712
+ VALUE rb_fstring(VALUE);
713
+ int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
714
+ int rb_str_symname_p(VALUE);
715
+ VALUE rb_str_quote_unprintable(VALUE);
716
+ VALUE rb_id_quote_unprintable(ID);
717
+ #define QUOTE(str) rb_str_quote_unprintable(str)
718
+ #define QUOTE_ID(id) rb_id_quote_unprintable(id)
719
+ void rb_str_fill_terminator(VALUE str, const int termlen);
720
+ VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
721
+ #ifdef RUBY_ENCODING_H
722
+ VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
723
+ #endif
724
+ #define STR_NOEMBED FL_USER1
725
+ #define STR_SHARED FL_USER2 /* = ELTS_SHARED */
726
+ #define STR_ASSOC FL_USER3
727
+ #define STR_SHARED_P(s) FL_ALL((s), STR_NOEMBED|ELTS_SHARED)
728
+ #define STR_ASSOC_P(s) FL_ALL((s), STR_NOEMBED|STR_ASSOC)
729
+ #define STR_NOCAPA (STR_NOEMBED|ELTS_SHARED|STR_ASSOC)
730
+ #define STR_NOCAPA_P(s) (FL_TEST((s),STR_NOEMBED) && FL_ANY((s),ELTS_SHARED|STR_ASSOC))
731
+ #define STR_EMBED_P(str) (!FL_TEST((str), STR_NOEMBED))
732
+ #define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT)
733
+ #define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN)
734
+
735
+ /* struct.c */
736
+ VALUE rb_struct_init_copy(VALUE copy, VALUE s);
737
+
738
+ /* time.c */
739
+ struct timeval rb_time_timeval(VALUE);
740
+
741
+ /* thread.c */
742
+ VALUE rb_obj_is_mutex(VALUE obj);
743
+ VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
744
+ void rb_thread_execute_interrupts(VALUE th);
745
+ void rb_clear_trace_func(void);
746
+ VALUE rb_get_coverages(void);
747
+ VALUE rb_thread_shield_new(void);
748
+ VALUE rb_thread_shield_wait(VALUE self);
749
+ VALUE rb_thread_shield_release(VALUE self);
750
+ VALUE rb_thread_shield_destroy(VALUE self);
751
+ void rb_mutex_allow_trap(VALUE self, int val);
752
+ VALUE rb_uninterruptible(VALUE (*b_proc)(ANYARGS), VALUE data);
753
+ VALUE rb_mutex_owned_p(VALUE self);
754
+ void ruby_kill(rb_pid_t pid, int sig);
755
+
756
+ /* thread_pthread.c, thread_win32.c */
757
+ void Init_native_thread(void);
758
+
759
+ /* vm_insnhelper.h */
760
+ rb_serial_t rb_next_class_serial(void);
761
+
762
+ /* vm.c */
763
+ VALUE rb_obj_is_thread(VALUE obj);
764
+ void rb_vm_mark(void *ptr);
765
+ void Init_BareVM(void);
766
+ VALUE rb_vm_top_self(void);
767
+ void rb_thread_recycle_stack_release(VALUE *);
768
+ void rb_vm_change_state(void);
769
+ void rb_vm_inc_const_missing_count(void);
770
+ void rb_thread_mark(void *th);
771
+ const void **rb_vm_get_insns_address_table(void);
772
+ VALUE rb_sourcefilename(void);
773
+ void rb_vm_pop_cfunc_frame(void);
774
+
775
+ /* vm_dump.c */
776
+ void rb_vm_bugreport(void);
777
+ void rb_print_backtrace(void);
778
+
779
+ /* vm_eval.c */
780
+ void Init_vm_eval(void);
781
+ VALUE rb_current_realfilepath(void);
782
+ VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, VALUE);
783
+ typedef void rb_check_funcall_hook(int, VALUE, ID, int, const VALUE *, VALUE);
784
+ VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, const VALUE *argv,
785
+ rb_check_funcall_hook *hook, VALUE arg);
786
+ VALUE rb_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr);
787
+
788
+ /* vm_insnhelper.c */
789
+ VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
790
+ int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *);
791
+ VALUE rb_extract_keywords(VALUE *orighash);
792
+
793
+ /* vm_method.c */
794
+ void Init_eval_method(void);
795
+ int rb_method_defined_by(VALUE obj, ID mid, VALUE (*cfunc)(ANYARGS));
796
+
797
+ /* miniprelude.c, prelude.c */
798
+ void Init_prelude(void);
799
+
800
+ /* vm_backtrace.c */
801
+ void Init_vm_backtrace(void);
802
+ VALUE rb_vm_thread_backtrace(int argc, VALUE *argv, VALUE thval);
803
+ VALUE rb_vm_thread_backtrace_locations(int argc, VALUE *argv, VALUE thval);
804
+
805
+ VALUE rb_make_backtrace(void);
806
+ void rb_backtrace_print_as_bugreport(void);
807
+ int rb_backtrace_p(VALUE obj);
808
+ VALUE rb_backtrace_to_str_ary(VALUE obj);
809
+ VALUE rb_backtrace_to_location_ary(VALUE obj);
810
+ void rb_backtrace_print_to(VALUE output);
811
+ VALUE rb_vm_backtrace_object(void);
812
+
813
+ RUBY_SYMBOL_EXPORT_BEGIN
814
+ const char *rb_objspace_data_type_name(VALUE obj);
815
+
816
+ /* Temporary. This API will be removed (renamed). */
817
+ VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd);
818
+
819
+ /* bignum.c */
820
+ VALUE rb_big_mul_normal(VALUE x, VALUE y);
821
+ VALUE rb_big_mul_balance(VALUE x, VALUE y);
822
+ VALUE rb_big_mul_karatsuba(VALUE x, VALUE y);
823
+ VALUE rb_big_mul_toom3(VALUE x, VALUE y);
824
+ VALUE rb_big_sq_fast(VALUE x);
825
+ VALUE rb_big_divrem_normal(VALUE x, VALUE y);
826
+ VALUE rb_big2str_poweroftwo(VALUE x, int base);
827
+ VALUE rb_big2str_generic(VALUE x, int base);
828
+ VALUE rb_str2big_poweroftwo(VALUE arg, int base, int badcheck);
829
+ VALUE rb_str2big_normal(VALUE arg, int base, int badcheck);
830
+ VALUE rb_str2big_karatsuba(VALUE arg, int base, int badcheck);
831
+ #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
832
+ VALUE rb_big_mul_gmp(VALUE x, VALUE y);
833
+ VALUE rb_big_divrem_gmp(VALUE x, VALUE y);
834
+ VALUE rb_big2str_gmp(VALUE x, int base);
835
+ VALUE rb_str2big_gmp(VALUE arg, int base, int badcheck);
836
+ #endif
837
+
838
+ /* error.c */
839
+ int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
840
+
841
+ /* file.c */
842
+ #ifdef __APPLE__
843
+ VALUE rb_str_normalize_ospath(const char *ptr, long len);
844
+ #endif
845
+
846
+ /* io.c */
847
+ void rb_maygvl_fd_fix_cloexec(int fd);
848
+
849
+ /* numeric.c */
850
+ VALUE rb_int_positive_pow(long x, unsigned long y);
851
+
852
+ /* process.c */
853
+ int rb_exec_async_signal_safe(const struct rb_execarg *e, char *errmsg, size_t errmsg_buflen);
854
+ 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);
855
+ VALUE rb_execarg_new(int argc, VALUE *argv, int accept_shell);
856
+ struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
857
+ VALUE rb_execarg_init(int argc, VALUE *argv, int accept_shell, VALUE execarg_obj);
858
+ int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
859
+ void rb_execarg_fixup(VALUE execarg_obj);
860
+ int rb_execarg_run_options(const struct rb_execarg *e, struct rb_execarg *s, char* errmsg, size_t errmsg_buflen);
861
+ VALUE rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash);
862
+ void rb_execarg_setenv(VALUE execarg_obj, VALUE env);
863
+
864
+ /* rational.c */
865
+ VALUE rb_gcd_normal(VALUE self, VALUE other);
866
+ #if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
867
+ VALUE rb_gcd_gmp(VALUE x, VALUE y);
868
+ #endif
869
+
870
+ /* util.c */
871
+ extern const signed char ruby_digit36_to_number_table[];
872
+ extern unsigned long ruby_scan_digits(const char *str, ssize_t len, int base, size_t *retlen, int *overflow);
873
+
874
+ /* variable.c */
875
+ void rb_gc_mark_global_tbl(void);
876
+ void rb_mark_generic_ivar(VALUE);
877
+ void rb_mark_generic_ivar_tbl(void);
878
+
879
+ int rb_st_insert_id_and_value(VALUE obj, st_table *tbl, ID key, VALUE value);
880
+ st_table *rb_st_copy(VALUE obj, struct st_table *orig_tbl);
881
+
882
+ /* gc.c */
883
+ size_t rb_obj_memsize_of(VALUE);
884
+ #define RB_OBJ_GC_FLAGS_MAX 5
885
+ size_t rb_obj_gc_flags(VALUE, ID[], size_t);
886
+
887
+ RUBY_SYMBOL_EXPORT_END
888
+
889
+ #if defined(__cplusplus)
890
+ #if 0
891
+ { /* satisfy cc-mode */
892
+ #endif
893
+ } /* extern "C" { */
894
+ #endif
895
+
896
+ #endif /* RUBY_INTERNAL_H */