did_you_mean 0.9.2 → 0.9.4

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