debase-ruby_core_source 0.9.2 → 0.9.3

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