debase-ruby_core_source 0.7.9 → 0.7.10

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