debase-ruby_core_source 4.0.1 → 4.1.0.preview1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/addr2line.h +22 -0
  4. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/builtin.h +127 -0
  5. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/build_assert/build_assert.h +40 -0
  6. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/check_type/check_type.h +63 -0
  7. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/container_of/container_of.h +142 -0
  8. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/list/list.h +791 -0
  9. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ccan/str/str.h +17 -0
  10. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/constant.h +53 -0
  11. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/darray.h +295 -0
  12. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/debug_counter.h +428 -0
  13. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/dln.h +33 -0
  14. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/encindex.h +70 -0
  15. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/eval_intern.h +356 -0
  16. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/hrtime.h +237 -0
  17. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/id.h +365 -0
  18. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/id_table.h +74 -0
  19. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/insns.inc +315 -0
  20. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/insns_info.inc +11637 -0
  21. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/array.h +158 -0
  22. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/basic_operators.h +67 -0
  23. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/bignum.h +249 -0
  24. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/bits.h +647 -0
  25. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/box.h +103 -0
  26. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/class.h +797 -0
  27. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/cmdlineopt.h +64 -0
  28. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/compar.h +30 -0
  29. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/compile.h +34 -0
  30. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/compilers.h +104 -0
  31. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/complex.h +29 -0
  32. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/concurrent_set.h +21 -0
  33. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/cont.h +33 -0
  34. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/coverage.h +51 -0
  35. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/dir.h +16 -0
  36. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/enc.h +19 -0
  37. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/encoding.h +40 -0
  38. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/enum.h +18 -0
  39. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/enumerator.h +21 -0
  40. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/error.h +287 -0
  41. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/eval.h +43 -0
  42. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/file.h +40 -0
  43. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/fixnum.h +185 -0
  44. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/gc.h +411 -0
  45. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/hash.h +220 -0
  46. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/imemo.h +302 -0
  47. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/inits.h +54 -0
  48. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/io.h +167 -0
  49. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/io_buffer.h +36 -0
  50. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/jit.h +23 -0
  51. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/load.h +20 -0
  52. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/loadpath.h +16 -0
  53. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/marshal.h +17 -0
  54. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/math.h +23 -0
  55. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/missing.h +19 -0
  56. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/numeric.h +326 -0
  57. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/object.h +88 -0
  58. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/objspace.h +24 -0
  59. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/parse.h +131 -0
  60. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/proc.h +34 -0
  61. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/process.h +124 -0
  62. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/ractor.h +9 -0
  63. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/random.h +17 -0
  64. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/range.h +46 -0
  65. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/rational.h +92 -0
  66. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/re.h +87 -0
  67. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/ruby_parser.h +109 -0
  68. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/sanitizers.h +346 -0
  69. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/scheduler.h +7 -0
  70. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/serial.h +23 -0
  71. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/set.h +20 -0
  72. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/set_table.h +77 -0
  73. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/signal.h +25 -0
  74. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/simd.h +18 -0
  75. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/st.h +32 -0
  76. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/static_assert.h +16 -0
  77. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/string.h +240 -0
  78. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/struct.h +120 -0
  79. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/symbol.h +46 -0
  80. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/thread.h +108 -0
  81. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/time.h +34 -0
  82. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/transcode.h +23 -0
  83. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/util.h +27 -0
  84. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/variable.h +81 -0
  85. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/vm.h +144 -0
  86. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/vm_map.h +95 -0
  87. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal/warnings.h +16 -0
  88. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/internal.h +106 -0
  89. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/iseq.h +439 -0
  90. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/known_errors.inc +1419 -0
  91. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/method.h +279 -0
  92. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/node.h +122 -0
  93. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/node_name.inc +224 -0
  94. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/optinsn.inc +128 -0
  95. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/optunifs.inc +41 -0
  96. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parse.h +246 -0
  97. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_bits.h +647 -0
  98. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_node.h +32 -0
  99. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_st.h +161 -0
  100. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/parser_value.h +116 -0
  101. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/arena.h +37 -0
  102. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/ast.h +10371 -0
  103. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/buffer.h +52 -0
  104. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/comments.h +43 -0
  105. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/accel.h +19 -0
  106. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/align.h +36 -0
  107. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/assume.h +25 -0
  108. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/exported.h +24 -0
  109. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/fallthrough.h +22 -0
  110. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/filesystem.h +32 -0
  111. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/flex_array.h +19 -0
  112. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/force_inline.h +21 -0
  113. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/format.h +25 -0
  114. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/inline.h +17 -0
  115. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/nodiscard.h +22 -0
  116. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/nonnull.h +18 -0
  117. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/compiler/unused.h +18 -0
  118. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/constant_pool.h +81 -0
  119. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/diagnostic.h +93 -0
  120. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/errors_format.h +53 -0
  121. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/excludes.h +29 -0
  122. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/extension.h +19 -0
  123. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/integer.h +41 -0
  124. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/allocator.h +68 -0
  125. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/allocator_debug.h +88 -0
  126. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/arena.h +108 -0
  127. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/bit.h +42 -0
  128. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/buffer.h +91 -0
  129. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/char.h +139 -0
  130. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/comments.h +20 -0
  131. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/constant_pool.h +152 -0
  132. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/diagnostic.h +389 -0
  133. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/encoding.h +242 -0
  134. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/integer.h +68 -0
  135. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/isinf.h +16 -0
  136. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/line_offset_list.h +34 -0
  137. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/list.h +62 -0
  138. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/magic_comments.h +23 -0
  139. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/memchr.h +15 -0
  140. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/node.h +32 -0
  141. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/options.h +224 -0
  142. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/parser.h +971 -0
  143. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/regexp.h +42 -0
  144. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/serialize.h +39 -0
  145. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/source.h +72 -0
  146. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/static_literals.h +100 -0
  147. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/stringy.h +35 -0
  148. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/strncasecmp.h +18 -0
  149. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/strpbrk.h +33 -0
  150. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/internal/tokens.h +11 -0
  151. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/json.h +32 -0
  152. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/line_offset_list.h +61 -0
  153. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/magic_comments.h +35 -0
  154. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/node.h +94 -0
  155. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/options.h +335 -0
  156. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/parser.h +348 -0
  157. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/prettyprint.h +31 -0
  158. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/prism.h +131 -0
  159. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/serialize.h +115 -0
  160. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/source.h +155 -0
  161. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/stream.h +28 -0
  162. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/string_query.h +63 -0
  163. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/stringy.h +72 -0
  164. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism/version.h +38 -0
  165. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism_compile.h +204 -0
  166. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/prism_xallocator.h +6 -0
  167. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/probes_helper.h +42 -0
  168. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ractor_core.h +421 -0
  169. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/regenc.h +261 -0
  170. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/regint.h +983 -0
  171. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/regparse.h +371 -0
  172. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/revision.h +5 -0
  173. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ruby_assert.h +14 -0
  174. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/ruby_atomic.h +115 -0
  175. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/rubyparser.h +1389 -0
  176. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/shape.h +733 -0
  177. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/siphash.h +48 -0
  178. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/symbol.h +116 -0
  179. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_none.h +25 -0
  180. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_pthread.h +63 -0
  181. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_sched.h +271 -0
  182. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/thread_win32.h +48 -0
  183. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/timev.h +58 -0
  184. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/transcode_data.h +138 -0
  185. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/variable.h +26 -0
  186. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/version.h +69 -0
  187. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm.inc +6457 -0
  188. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_call_iseq_optimized.inc +244 -0
  189. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_callinfo.h +688 -0
  190. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_core.h +2509 -0
  191. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_debug.h +124 -0
  192. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_exec.h +202 -0
  193. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_insnhelper.h +280 -0
  194. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_opts.h +65 -0
  195. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vm_sync.h +160 -0
  196. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/vmtc.inc +302 -0
  197. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/yjit.h +87 -0
  198. data/lib/debase/ruby_core_source/ruby-4.1.0-preview1/zjit.h +221 -0
  199. data/lib/debase/ruby_core_source/version.rb +1 -1
  200. metadata +2930 -2724
@@ -0,0 +1,240 @@
1
+ #ifndef INTERNAL_STRING_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_STRING_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header for String.
10
+ */
11
+ #include "ruby/internal/config.h"
12
+ #include <stddef.h> /* for size_t */
13
+ #include "internal/compilers.h" /* for __has_builtin */
14
+ #include "ruby/internal/stdbool.h" /* for bool */
15
+ #include "ruby/encoding.h" /* for rb_encoding */
16
+ #include "ruby/ruby.h" /* for VALUE */
17
+ #include "encindex.h"
18
+
19
+ #define STR_SHARED FL_USER0 /* = ELTS_SHARED */
20
+ #define STR_NOEMBED FL_USER1
21
+ #define STR_CHILLED FL_USER2
22
+ #define STR_FAKESTR FL_USER19
23
+
24
+ enum ruby_rstring_private_flags {
25
+ RSTRING_CHILLED = STR_CHILLED,
26
+ };
27
+
28
+ #ifdef rb_fstring_cstr
29
+ # undef rb_fstring_cstr
30
+ #endif
31
+
32
+ static inline bool
33
+ rb_str_encindex_fastpath(int encindex)
34
+ {
35
+ // The overwhelming majority of strings are in one of these 3 encodings,
36
+ // which are all either ASCII or perfect ASCII supersets.
37
+ // Hence you can use fast, single byte algorithms on them, such as `memchr` etc,
38
+ // without all the overhead of fetching the rb_encoding and using functions such as
39
+ // rb_enc_mbminlen etc.
40
+ // Many other encodings could qualify, but they are expected to be rare occurrences,
41
+ // so it's better to keep that list small.
42
+ switch (encindex) {
43
+ case ENCINDEX_ASCII_8BIT:
44
+ case ENCINDEX_UTF_8:
45
+ case ENCINDEX_US_ASCII:
46
+ return true;
47
+ default:
48
+ return false;
49
+ }
50
+ }
51
+
52
+ static inline bool
53
+ rb_str_enc_fastpath(VALUE str)
54
+ {
55
+ return rb_str_encindex_fastpath(ENCODING_GET_INLINED(str));
56
+ }
57
+
58
+ static inline rb_encoding *
59
+ rb_str_enc_get(VALUE str)
60
+ {
61
+ RUBY_ASSERT(RB_TYPE_P(str, T_STRING));
62
+ return rb_enc_from_index(ENCODING_GET(str));
63
+ }
64
+
65
+ /* string.c */
66
+ VALUE rb_str_dup_m(VALUE str);
67
+ VALUE rb_fstring(VALUE);
68
+ VALUE rb_fstring_cstr(const char *str);
69
+ VALUE rb_fstring_enc_new(const char *ptr, rb_len_t len, rb_encoding *enc);
70
+ int rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p);
71
+ int rb_str_symname_p(VALUE);
72
+ VALUE rb_str_quote_unprintable(VALUE);
73
+ char *rb_str_fill_terminator(VALUE str, const int termlen);
74
+ void rb_str_change_terminator_length(VALUE str, const int oldtermlen, const int termlen);
75
+ VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg);
76
+ VALUE rb_str_chomp_string(VALUE str, VALUE chomp);
77
+ VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc);
78
+ VALUE rb_str_cat_conv_enc_opts(VALUE newstr, rb_len_t ofs, const char *ptr, rb_len_t len,
79
+ rb_encoding *from, int ecflags, VALUE ecopts);
80
+ VALUE rb_enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl);
81
+ VALUE rb_str_escape(VALUE str);
82
+ size_t rb_str_memsize(VALUE);
83
+ char *rb_str_to_cstr(VALUE str);
84
+ const char *ruby_escaped_char(int c);
85
+ void rb_str_make_independent(VALUE str);
86
+ int rb_enc_str_coderange_scan(VALUE str, rb_encoding *enc);
87
+ int rb_ascii8bit_appendable_encoding_index(rb_encoding *enc, unsigned int code);
88
+ VALUE rb_str_include(VALUE str, VALUE arg);
89
+ VALUE rb_str_byte_substr(VALUE str, VALUE beg, VALUE len);
90
+ VALUE rb_str_substr_two_fixnums(VALUE str, VALUE beg, VALUE len, int empty);
91
+ void rb_str_make_embedded(VALUE);
92
+ VALUE rb_str_upto_each(VALUE, VALUE, int, int (*each)(VALUE, VALUE), VALUE);
93
+ size_t rb_str_size_as_embedded(VALUE);
94
+ bool rb_str_reembeddable_p(VALUE);
95
+ bool rb_str_embedded_shared_root_p(VALUE);
96
+ VALUE rb_str_upto_endless_each(VALUE, int (*each)(VALUE, VALUE), VALUE);
97
+ VALUE rb_str_with_debug_created_info(VALUE, VALUE, int);
98
+ VALUE rb_chilled_str_with_debug_created_info(VALUE, VALUE, int);
99
+ VALUE rb_str_frozen_bare_string(VALUE);
100
+ const char *rb_str_null_check(VALUE);
101
+ VALUE rb_str_casecmp(VALUE str1, VALUE str2);
102
+
103
+ /* error.c */
104
+ void rb_warn_unchilled_literal(VALUE str);
105
+
106
+ static inline bool STR_EMBED_P(VALUE str);
107
+ static inline bool STR_SHARED_P(VALUE str);
108
+ static inline VALUE QUOTE(VALUE v);
109
+ static inline VALUE QUOTE_ID(ID v);
110
+ static inline bool is_ascii_string(VALUE str);
111
+ static inline bool is_broken_string(VALUE str);
112
+ static inline VALUE rb_str_eql_internal(const VALUE str1, const VALUE str2);
113
+
114
+ RUBY_SYMBOL_EXPORT_BEGIN
115
+ /* string.c (export) */
116
+ VALUE rb_str_tmp_frozen_acquire(VALUE str);
117
+ void rb_str_tmp_frozen_release(VALUE str, VALUE tmp);
118
+ VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, rb_len_t len, rb_encoding *enc);
119
+ RUBY_SYMBOL_EXPORT_END
120
+
121
+ VALUE rb_fstring_new(const char *ptr, rb_len_t len);
122
+ void rb_gc_free_fstring(VALUE obj);
123
+ bool rb_obj_is_fstring_table(VALUE obj);
124
+ void Init_fstring_table();
125
+ VALUE rb_obj_as_string_result(VALUE str, VALUE obj);
126
+ VALUE rb_str_opt_plus(VALUE x, VALUE y);
127
+ VALUE rb_str_new_owned(char *ptr, rb_len_t len, rb_len_t capa, int encindex);
128
+ VALUE rb_str_concat_literals(size_t num, const VALUE *strary);
129
+ VALUE rb_str_format_ary(int argc, const VALUE *argv, VALUE fmt, VALUE ary);
130
+ VALUE rb_str_eql(VALUE str1, VALUE str2);
131
+ VALUE rb_id_quote_unprintable(ID);
132
+ VALUE rb_sym_proc_call(ID mid, int argc, const VALUE *argv, int kw_splat, VALUE passed_proc);
133
+ VALUE rb_enc_literal_str(const char *ptr, rb_len_t len, rb_encoding *enc);
134
+
135
+ struct rb_execution_context_struct;
136
+ VALUE rb_ec_str_resurrect(struct rb_execution_context_struct *ec, VALUE str, bool chilled);
137
+
138
+ #define rb_fstring_lit(str) rb_fstring_new((str), rb_strlen_lit(str))
139
+ #define rb_fstring_literal(str) rb_fstring_lit(str)
140
+ #define rb_fstring_enc_lit(str, enc) rb_fstring_enc_new((str), rb_strlen_lit(str), (enc))
141
+ #define rb_fstring_enc_literal(str, enc) rb_fstring_enc_lit(str, enc)
142
+
143
+ static inline VALUE
144
+ QUOTE(VALUE v)
145
+ {
146
+ return rb_str_quote_unprintable(v);
147
+ }
148
+
149
+ static inline VALUE
150
+ QUOTE_ID(ID i)
151
+ {
152
+ return rb_id_quote_unprintable(i);
153
+ }
154
+
155
+ static inline bool
156
+ STR_EMBED_P(VALUE str)
157
+ {
158
+ return ! FL_TEST_RAW(str, STR_NOEMBED);
159
+ }
160
+
161
+ static inline bool
162
+ STR_SHARED_P(VALUE str)
163
+ {
164
+ return FL_ALL_RAW(str, STR_NOEMBED | STR_SHARED);
165
+ }
166
+
167
+ static inline bool
168
+ CHILLED_STRING_P(VALUE obj)
169
+ {
170
+ return RB_TYPE_P(obj, T_STRING) && FL_TEST_RAW(obj, STR_CHILLED);
171
+ }
172
+
173
+ static inline void
174
+ CHILLED_STRING_MUTATED(VALUE str)
175
+ {
176
+ if (RB_FL_TEST_RAW(str, STR_CHILLED)) {
177
+ FL_UNSET_RAW(str, STR_CHILLED);
178
+ rb_warn_unchilled_literal(str);
179
+ }
180
+ }
181
+
182
+ static inline bool
183
+ is_ascii_string(VALUE str)
184
+ {
185
+ return rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT;
186
+ }
187
+
188
+ static inline bool
189
+ is_broken_string(VALUE str)
190
+ {
191
+ return rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN;
192
+ }
193
+
194
+ static inline bool
195
+ at_char_boundary(const char *s, const char *p, const char *e, rb_encoding *enc)
196
+ {
197
+ return rb_enc_left_char_head(s, p, e, enc) == p;
198
+ }
199
+
200
+ static inline bool
201
+ at_char_right_boundary(const char *s, const char *p, const char *e, rb_encoding *enc)
202
+ {
203
+ RUBY_ASSERT(s <= p);
204
+ RUBY_ASSERT(p <= e);
205
+
206
+ return rb_enc_right_char_head(s, p, e, enc) == p;
207
+ }
208
+
209
+ /* expect tail call optimization */
210
+ // YJIT needs this function to never allocate and never raise
211
+ static inline VALUE
212
+ rb_str_eql_internal(const VALUE str1, const VALUE str2)
213
+ {
214
+ const rb_len_t len = RSTRING_LEN(str1);
215
+ const char *ptr1, *ptr2;
216
+
217
+ if (len != RSTRING_LEN(str2)) return Qfalse;
218
+ if (!rb_str_comparable(str1, str2)) return Qfalse;
219
+ if ((ptr1 = RSTRING_PTR(str1)) == (ptr2 = RSTRING_PTR(str2)))
220
+ return Qtrue;
221
+ if (memcmp(ptr1, ptr2, len) == 0)
222
+ return Qtrue;
223
+ return Qfalse;
224
+ }
225
+
226
+ static inline bool
227
+ rb_streql_cstr(VALUE str, const char *lit, size_t len)
228
+ {
229
+ if ((size_t)RSTRING_LEN(str) != len) return false;
230
+ return memcmp(RSTRING_PTR(str), lit, len) == 0;
231
+ }
232
+ #define rb_streql_lit(str, lit) rb_streql_cstr(str, lit, rb_strlen_lit(lit))
233
+
234
+ #if __has_builtin(__builtin_constant_p)
235
+ # define rb_fstring_cstr(str) \
236
+ (__builtin_constant_p(str) ? \
237
+ rb_fstring_new((str), (rb_len_t)strlen(str)) : \
238
+ (rb_fstring_cstr)(str))
239
+ #endif
240
+ #endif /* INTERNAL_STRING_H */
@@ -0,0 +1,120 @@
1
+ #ifndef INTERNAL_STRUCT_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_STRUCT_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header for Struct.
10
+ */
11
+ #include "ruby/internal/stdbool.h" /* for bool */
12
+ #include "ruby/ruby.h" /* for struct RBasic */
13
+
14
+ /* Flags of RStruct
15
+ *
16
+ * 1-7: RSTRUCT_EMBED_LEN
17
+ * If non-zero, the struct is embedded (its contents follow the
18
+ * header, rather than being on a separately allocated buffer) and
19
+ * these bits are the length of the Struct.
20
+ */
21
+ enum ruby_rstruct_flags {
22
+ RSTRUCT_EMBED_LEN_MASK = RUBY_FL_USER7 | RUBY_FL_USER6 | RUBY_FL_USER5 | RUBY_FL_USER4 |
23
+ RUBY_FL_USER3 | RUBY_FL_USER2 | RUBY_FL_USER1,
24
+ RSTRUCT_EMBED_LEN_SHIFT = (RUBY_FL_USHIFT+1),
25
+ };
26
+
27
+ struct RStruct {
28
+ struct RBasic basic;
29
+ VALUE fields_obj;
30
+ union {
31
+ struct {
32
+ rb_len_t len;
33
+ const VALUE *ptr;
34
+ } heap;
35
+ /* This is a length 1 array because:
36
+ * 1. GCC has a bug that does not optimize C flexible array members
37
+ * (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102452)
38
+ * 2. Zero length arrays are not supported by all compilers
39
+ */
40
+ const VALUE ary[1];
41
+ } as;
42
+ };
43
+
44
+ #define RSTRUCT(obj) ((struct RStruct *)(obj))
45
+
46
+ /* struct.c */
47
+ VALUE rb_struct_init_copy(VALUE copy, VALUE s);
48
+ VALUE rb_struct_lookup(VALUE s, VALUE idx);
49
+ VALUE rb_struct_s_keyword_init(VALUE klass);
50
+ void rb_struct_define_aref_method(VALUE nstr, ID name, unsigned int off);
51
+
52
+ static inline rb_len_t RSTRUCT_EMBED_LEN(VALUE st);
53
+ static inline rb_len_t RSTRUCT_LEN_RAW(VALUE st);
54
+ static inline int RSTRUCT_LENINT(VALUE st);
55
+ static inline const VALUE *RSTRUCT_CONST_PTR(VALUE st);
56
+ static inline void RSTRUCT_SET_RAW(VALUE st, rb_len_t k, VALUE v);
57
+ static inline VALUE RSTRUCT_GET_RAW(VALUE st, rb_len_t k);
58
+
59
+ static inline rb_len_t
60
+ RSTRUCT_EMBED_LEN(VALUE st)
61
+ {
62
+ rb_len_t ret = FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK);
63
+ ret >>= RSTRUCT_EMBED_LEN_SHIFT;
64
+ return ret;
65
+ }
66
+
67
+ static inline rb_len_t
68
+ RSTRUCT_LEN_RAW(VALUE st)
69
+ {
70
+ if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) {
71
+ return RSTRUCT_EMBED_LEN(st);
72
+ }
73
+ else {
74
+ return RSTRUCT(st)->as.heap.len;
75
+ }
76
+ }
77
+
78
+ static inline int
79
+ RSTRUCT_LENINT(VALUE st)
80
+ {
81
+ return rb_len2int(RSTRUCT_LEN_RAW(st));
82
+ }
83
+
84
+ static inline const VALUE *
85
+ RSTRUCT_CONST_PTR(VALUE st)
86
+ {
87
+ const struct RStruct *p = RSTRUCT(st);
88
+
89
+ if (FL_TEST_RAW(st, RSTRUCT_EMBED_LEN_MASK)) {
90
+ return p->as.ary;
91
+ }
92
+ else {
93
+ return p->as.heap.ptr;
94
+ }
95
+ }
96
+
97
+ static inline void
98
+ RSTRUCT_SET_RAW(VALUE st, rb_len_t k, VALUE v)
99
+ {
100
+ RB_OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[k], v);
101
+ }
102
+
103
+ static inline VALUE
104
+ RSTRUCT_GET_RAW(VALUE st, rb_len_t k)
105
+ {
106
+ return RSTRUCT_CONST_PTR(st)[k];
107
+ }
108
+
109
+ static inline VALUE
110
+ RSTRUCT_FIELDS_OBJ(VALUE st)
111
+ {
112
+ return RSTRUCT(st)->fields_obj;
113
+ }
114
+
115
+ static inline void
116
+ RSTRUCT_SET_FIELDS_OBJ(VALUE st, VALUE fields_obj)
117
+ {
118
+ RB_OBJ_WRITE(st, &RSTRUCT(st)->fields_obj, fields_obj);
119
+ }
120
+ #endif /* INTERNAL_STRUCT_H */
@@ -0,0 +1,46 @@
1
+ #ifndef INTERNAL_SYMBOL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_SYMBOL_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header for Symbol.
10
+ */
11
+ #include "ruby/ruby.h" /* for VALUE */
12
+ #include "ruby/encoding.h" /* for rb_encoding */
13
+ #include "internal/compilers.h" /* for __has_builtin */
14
+
15
+ #ifdef rb_sym_intern_ascii_cstr
16
+ # undef rb_sym_intern_ascii_cstr
17
+ #endif
18
+
19
+ /* symbol.c */
20
+ void rb_sym_global_symbols_mark_and_move(void);
21
+ VALUE rb_to_symbol_type(VALUE obj);
22
+ VALUE rb_sym_intern(const char *ptr, rb_len_t len, rb_encoding *enc);
23
+ VALUE rb_sym_intern_ascii(const char *ptr, rb_len_t len);
24
+ VALUE rb_sym_intern_ascii_cstr(const char *ptr);
25
+ int rb_is_const_name(VALUE name);
26
+ int rb_is_class_name(VALUE name);
27
+ int rb_is_instance_name(VALUE name);
28
+ int rb_is_local_name(VALUE name);
29
+ PUREFUNC(int rb_is_const_sym(VALUE sym));
30
+ PUREFUNC(int rb_is_attrset_sym(VALUE sym));
31
+ ID rb_make_internal_id(void);
32
+ ID rb_make_temporary_id(size_t n);
33
+ bool rb_obj_is_symbol_table(VALUE obj);
34
+ void rb_sym_global_symbol_table_foreach_weak_reference(int (*callback)(VALUE *key, void *data), void *data);
35
+ void rb_gc_free_dsymbol(VALUE);
36
+ int rb_static_id_valid_p(ID id);
37
+ void rb_free_global_symbol_table(void);
38
+
39
+ #if __has_builtin(__builtin_constant_p)
40
+ #define rb_sym_intern_ascii_cstr(ptr) \
41
+ (__builtin_constant_p(ptr) ? \
42
+ rb_sym_intern_ascii((ptr), (rb_len_t)strlen(ptr)) : \
43
+ rb_sym_intern_ascii_cstr(ptr))
44
+ #endif
45
+
46
+ #endif /* INTERNAL_SYMBOL_H */
@@ -0,0 +1,108 @@
1
+ #ifndef INTERNAL_THREAD_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_THREAD_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header for Thread.
10
+ */
11
+ #include "ruby/ruby.h" /* for VALUE */
12
+ #include "ruby/intern.h" /* for rb_blocking_function_t */
13
+ #include "ccan/list/list.h" /* for list in rb_io_close_wait_list */
14
+
15
+ struct rb_execution_context_struct; /* in vm_core.h */
16
+ struct rb_thread_struct; /* in vm_core.h */
17
+ struct rb_io;
18
+
19
+ #define RB_VM_SAVE_MACHINE_CONTEXT(th) \
20
+ do { \
21
+ FLUSH_REGISTER_WINDOWS; \
22
+ setjmp((th)->ec->machine.regs); \
23
+ SET_MACHINE_STACK_END(&(th)->ec->machine.stack_end); \
24
+ } while (0)
25
+
26
+ #define RUBY_FATAL_THREAD_KILLED INT2FIX(0)
27
+ #define RUBY_FATAL_THREAD_TERMINATED INT2FIX(1)
28
+ #define RUBY_FATAL_FIBER_KILLED RB_INT2FIX(2)
29
+
30
+ VALUE rb_obj_is_mutex(VALUE obj);
31
+ VALUE rb_suppress_tracing(VALUE (*func)(VALUE), VALUE arg);
32
+ void rb_thread_execute_interrupts(VALUE th);
33
+ VALUE rb_thread_shield_new(void);
34
+ bool rb_thread_shield_owned(VALUE self);
35
+ VALUE rb_thread_shield_wait(VALUE self);
36
+ VALUE rb_thread_shield_release(VALUE self);
37
+ VALUE rb_thread_shield_destroy(VALUE self);
38
+ int rb_thread_to_be_killed(VALUE thread);
39
+ void rb_thread_acquire_fork_lock(void);
40
+ void rb_thread_release_fork_lock(void);
41
+ void rb_thread_reset_fork_lock(void);
42
+ void rb_mutex_allow_trap(VALUE self, int val);
43
+ VALUE rb_uninterruptible(VALUE (*b_proc)(VALUE), VALUE data);
44
+ VALUE rb_mutex_owned_p(VALUE self);
45
+ VALUE rb_exec_recursive_outer_mid(VALUE (*f)(VALUE g, VALUE h, int r), VALUE g, VALUE h, ID mid);
46
+ void ruby_mn_threads_params(void);
47
+
48
+ int rb_thread_io_wait(struct rb_thread_struct *th, struct rb_io *io, int events, struct timeval * timeout);
49
+ int rb_thread_wait_for_single_fd(struct rb_thread_struct *th, int fd, int events, struct timeval * timeout);
50
+
51
+ size_t rb_thread_io_close_interrupt(struct rb_io *);
52
+ void rb_thread_io_close_wait(struct rb_io *);
53
+
54
+ void rb_ec_check_ints(struct rb_execution_context_struct *ec);
55
+
56
+ void rb_thread_free_native_thread(void *th_ptr);
57
+
58
+ bool rb_thread_event_hooks_registered_p(void); /* thread_pthread.c */
59
+ void rb_thread_free_body(void *th); /* vm.c */
60
+
61
+ RUBY_SYMBOL_EXPORT_BEGIN
62
+
63
+ void *rb_thread_prevent_fork(void *(*func)(void *), void *data); /* for ext/socket/raddrinfo.c */
64
+
65
+ /* Temporary. This API will be removed (renamed). */
66
+ VALUE rb_thread_io_blocking_region(struct rb_io *io, rb_blocking_function_t *func, void *data1);
67
+ VALUE rb_thread_io_blocking_call(struct rb_io *io, rb_blocking_function_t *func, void *data1, int events);
68
+
69
+ // Invoke the given function, with the specified argument, in a way that `IO#close` from another execution context can interrupt it.
70
+ VALUE rb_thread_io_blocking_operation(VALUE self, VALUE(*function)(VALUE), VALUE argument);
71
+
72
+ /* thread.c (export) */
73
+ int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
74
+
75
+ RUBY_SYMBOL_EXPORT_END
76
+
77
+ int rb_threadptr_execute_interrupts(struct rb_thread_struct *th, int blocking_timing);
78
+ bool rb_thread_mn_schedulable(VALUE thread);
79
+
80
+ bool rb_thread_resolve_unblock_function(rb_unblock_function_t **unblock_function, void **data2, struct rb_thread_struct *thread);
81
+
82
+ // interrupt exec
83
+
84
+ typedef VALUE (rb_interrupt_exec_func_t)(void *data);
85
+
86
+ enum rb_interrupt_exec_flag {
87
+ rb_interrupt_exec_flag_none = 0x00,
88
+ rb_interrupt_exec_flag_value_data = 0x01,
89
+ rb_interrupt_exec_flag_new_thread = 0x02,
90
+ };
91
+
92
+ // interrupt the target_th and run func.
93
+ struct rb_ractor_struct;
94
+
95
+ void rb_threadptr_interrupt_exec(struct rb_thread_struct *target_th,
96
+ rb_interrupt_exec_func_t *func, void *data, enum rb_interrupt_exec_flag flags);
97
+
98
+ // create a thread in the target_r and run func on the created thread.
99
+ void rb_ractor_interrupt_exec(struct rb_ractor_struct *target_r,
100
+ rb_interrupt_exec_func_t *func, void *data, enum rb_interrupt_exec_flag flags);
101
+
102
+ void rb_threadptr_interrupt_exec_task_mark(struct rb_thread_struct *th);
103
+
104
+ /* Mark the roots of the heap objects a thread owns, excluding ec and fiber. Used by
105
+ * thread_mark and by the Ractor's local-root marking (rb_ractor_mark_local_roots). */
106
+ void rb_thread_mark_owned_roots(struct rb_thread_struct *th);
107
+
108
+ #endif /* INTERNAL_THREAD_H */
@@ -0,0 +1,34 @@
1
+ #ifndef INTERNAL_TIME_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_TIME_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header for Time.
10
+ */
11
+ #include "ruby/internal/config.h" /* for SIGNEDNESS_OF_TIME_T */
12
+ #include "internal/bits.h" /* for SIGNED_INTEGER_MAX */
13
+ #include "ruby/ruby.h" /* for VALUE */
14
+
15
+ #if SIGNEDNESS_OF_TIME_T < 0 /* signed */
16
+ # define TIMET_MAX SIGNED_INTEGER_MAX(time_t)
17
+ # define TIMET_MIN SIGNED_INTEGER_MIN(time_t)
18
+ #elif SIGNEDNESS_OF_TIME_T > 0 /* unsigned */
19
+ # define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t)
20
+ # define TIMET_MIN ((time_t)0)
21
+ #endif
22
+
23
+ struct timeval; /* <- in <sys/time.h> or <winsock2.h> */
24
+
25
+ /* time.c */
26
+ struct timeval rb_time_timeval(VALUE);
27
+
28
+ RUBY_SYMBOL_EXPORT_BEGIN
29
+ /* time.c (export) */
30
+ RUBY_SYMBOL_EXPORT_END
31
+
32
+ void ruby_reset_timezone(const char *);
33
+
34
+ #endif /* INTERNAL_TIME_H */
@@ -0,0 +1,23 @@
1
+ #ifndef INTERNAL_TRANSCODE_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_TRANSCODE_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header for Encoding::Converter.
10
+ */
11
+ #include "ruby/internal/config.h"
12
+ #include <stddef.h> /* for size_t */
13
+ #include "ruby/ruby.h" /* for VALUE */
14
+ #include "ruby/encoding.h" /* for rb_econv_t */
15
+
16
+ /* transcode.c */
17
+ extern VALUE rb_cEncodingConverter;
18
+ size_t rb_econv_memsize(rb_econv_t *);
19
+
20
+ /* vm.c */
21
+ void rb_free_transcoder_table(void);
22
+
23
+ #endif /* INTERNAL_TRANSCODE_H */
@@ -0,0 +1,27 @@
1
+ #ifndef INTERNAL_UTIL_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_UTIL_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header corresponding util.c.
10
+ * @warning DO NOT ADD RANDOM GARBAGE HERE THIS FILE IS FOR util.c
11
+ */
12
+ #include "ruby/internal/config.h"
13
+ #include <stddef.h> /* for size_t */
14
+
15
+ #ifdef HAVE_SYS_TYPES_H
16
+ # include <sys/types.h> /* for ssize_t (note: on Windows ssize_t is */
17
+ #endif /* `#define`d in ruby/config.h) */
18
+
19
+ /* util.c */
20
+ char *ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve);
21
+ char *ruby_hdtoa(double d, const char *xdigs, int ndigits, int *decpt, int *sign, char **rve);
22
+
23
+ RUBY_SYMBOL_EXPORT_BEGIN
24
+ /* util.c (export) */
25
+ RUBY_SYMBOL_EXPORT_END
26
+
27
+ #endif /* INTERNAL_UTIL_H */
@@ -0,0 +1,81 @@
1
+ #ifndef INTERNAL_VARIABLE_H /*-*-C-*-vi:se ft=c:*/
2
+ #define INTERNAL_VARIABLE_H
3
+ /**
4
+ * @author Ruby developers <ruby-core@ruby-lang.org>
5
+ * @copyright This file is a part of the programming language Ruby.
6
+ * Permission is hereby granted, to either redistribute and/or
7
+ * modify this file, provided that the conditions mentioned in the
8
+ * file COPYING are met. Consult the file for details.
9
+ * @brief Internal header for variables.
10
+ */
11
+ #include "ruby/internal/config.h"
12
+ #include <stddef.h> /* for size_t */
13
+ #include "constant.h" /* for rb_const_entry_t */
14
+ #include "ruby/internal/stdbool.h" /* for bool */
15
+ #include "ruby/ruby.h" /* for VALUE */
16
+ #include "shape.h" /* for shape_id_t */
17
+
18
+ /* variable.c */
19
+ void rb_gc_mark_global_tbl(void);
20
+ void rb_gc_update_global_tbl(void);
21
+ VALUE rb_search_class_path(VALUE);
22
+ VALUE rb_attr_delete(VALUE, ID);
23
+ void rb_autoload_str(VALUE mod, ID id, VALUE file);
24
+ VALUE rb_autoload_at_p(VALUE, ID, int);
25
+ NORETURN(VALUE rb_mod_const_missing(VALUE,VALUE));
26
+ rb_gvar_getter_t *rb_gvar_getter_function_of(ID);
27
+ rb_gvar_setter_t *rb_gvar_setter_function_of(ID);
28
+ void rb_gvar_readonly_setter(VALUE v, ID id, VALUE *_);
29
+ void rb_gvar_ractor_local(const char *name);
30
+ void rb_gvar_box_ready(const char *name);
31
+ void rb_gvar_box_dynamic(const char *name);
32
+
33
+ /**
34
+ * Sets the name of a module.
35
+ *
36
+ * Non-permanently named classes can have a temporary name assigned (or
37
+ * cleared). In that case the name will be used for `#inspect` and `#to_s`, and
38
+ * nested classes/modules will be named with the temporary name as a prefix.
39
+ *
40
+ * After the module is assigned to a constant, the temporary name will be
41
+ * discarded, and the name will be computed based on the nesting.
42
+ *
43
+ * @param[in] mod An instance of ::rb_cModule.
44
+ * @param[in] name An instance of ::rb_cString.
45
+ * @retval mod
46
+ */
47
+ VALUE rb_mod_set_temporary_name(VALUE, VALUE);
48
+
49
+ void rb_obj_replace_fields(VALUE obj, VALUE fields_obj);
50
+ VALUE rb_obj_complex_fields_build(VALUE obj);
51
+ VALUE rb_obj_field_get(VALUE obj, shape_id_t target_shape_id);
52
+ void rb_ivar_set_internal(VALUE obj, ID id, VALUE val);
53
+ void rb_check_ivar_modifiable(VALUE obj);
54
+ void rb_ivar_foreach_buffered(VALUE obj, int (*func)(ID name, VALUE val, st_data_t arg), st_data_t arg);
55
+ attr_index_t rb_ivar_set_index(VALUE obj, ID id, VALUE val);
56
+ attr_index_t rb_obj_field_set(VALUE obj, shape_id_t target_shape_id, ID field_name, VALUE val);
57
+ VALUE rb_ivar_get_at(VALUE obj, attr_index_t index, ID id);
58
+ VALUE rb_ivar_get_at_no_ractor_check(VALUE obj, attr_index_t index);
59
+ void rb_generic_fields_lock_atfork(void);
60
+ void rb_imemo_fields_record_shrefs(VALUE fields_obj);
61
+
62
+ /* Call cb(tbl, arg) for the single global generic_fields table. Used by the global GC's weak
63
+ * pass and by compaction's reference update (gc.c). */
64
+ void rb_generic_fields_tables_foreach(void (*cb)(struct st_table *tbl, void *arg), void *arg);
65
+ void rb_generic_fields_shared_table_foreach(void (*cb)(struct st_table *tbl, void *arg), void *arg);
66
+
67
+ RUBY_SYMBOL_EXPORT_BEGIN
68
+ /* variable.c (export) */
69
+ void rb_mark_generic_ivar(VALUE obj);
70
+ VALUE rb_const_missing(VALUE klass, VALUE name);
71
+ bool rb_class_ivar_set(VALUE klass, ID vid, VALUE value);
72
+ void rb_fields_tbl_copy(VALUE dst, VALUE src);
73
+ RUBY_SYMBOL_EXPORT_END
74
+
75
+ VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
76
+ VALUE rb_gvar_get(ID);
77
+ VALUE rb_gvar_set(ID, VALUE);
78
+ VALUE rb_gvar_defined(ID);
79
+ void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
80
+
81
+ #endif /* INTERNAL_VARIABLE_H */