did_you_mean 0.9.0 → 0.9.2

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