zscan 2.0.8 → 2.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/ext/pack/pack-27.c +1 -0
  3. data/ext/pack/pack.c +1 -0
  4. data/ext/pack/ruby/backward/2/assume.h +43 -0
  5. data/ext/pack/ruby/backward/2/attributes.h +157 -0
  6. data/ext/pack/ruby/backward/2/bool.h +37 -0
  7. data/ext/pack/ruby/backward/2/extern.h +46 -0
  8. data/ext/pack/ruby/backward/2/gcc_version_since.h +38 -0
  9. data/ext/pack/ruby/backward/2/inttypes.h +132 -0
  10. data/ext/pack/ruby/backward/2/limits.h +100 -0
  11. data/ext/pack/ruby/backward/2/long_long.h +65 -0
  12. data/ext/pack/ruby/backward/2/r_cast.h +27 -0
  13. data/ext/pack/ruby/backward/2/rmodule.h +31 -0
  14. data/ext/pack/ruby/backward/2/stdalign.h +30 -0
  15. data/ext/pack/ruby/backward/2/stdarg.h +47 -0
  16. data/ext/pack/ruby/backward/classext.h +25 -0
  17. data/ext/pack/ruby/backward/rubyio.h +18 -0
  18. data/ext/pack/ruby/backward/rubysig.h +26 -0
  19. data/ext/pack/ruby/backward/st.h +18 -0
  20. data/ext/pack/ruby/backward/util.h +18 -0
  21. data/ext/pack/ruby/internal/anyargs.h +375 -0
  22. data/ext/pack/ruby/internal/arithmetic.h +38 -0
  23. data/ext/pack/ruby/internal/arithmetic/char.h +58 -0
  24. data/ext/pack/ruby/internal/arithmetic/double.h +39 -0
  25. data/ext/pack/ruby/internal/arithmetic/fixnum.h +44 -0
  26. data/ext/pack/ruby/internal/arithmetic/gid_t.h +34 -0
  27. data/ext/pack/ruby/internal/arithmetic/int.h +163 -0
  28. data/ext/pack/ruby/internal/arithmetic/intptr_t.h +42 -0
  29. data/ext/pack/ruby/internal/arithmetic/long.h +244 -0
  30. data/ext/pack/ruby/internal/arithmetic/long_long.h +53 -0
  31. data/ext/pack/ruby/internal/arithmetic/mode_t.h +34 -0
  32. data/ext/pack/ruby/internal/arithmetic/off_t.h +49 -0
  33. data/ext/pack/ruby/internal/arithmetic/pid_t.h +34 -0
  34. data/ext/pack/ruby/internal/arithmetic/short.h +54 -0
  35. data/ext/pack/ruby/internal/arithmetic/size_t.h +51 -0
  36. data/ext/pack/ruby/internal/arithmetic/st_data_t.h +59 -0
  37. data/ext/pack/ruby/internal/arithmetic/uid_t.h +34 -0
  38. data/ext/pack/ruby/internal/assume.h +90 -0
  39. data/ext/pack/ruby/internal/attr/alloc_size.h +32 -0
  40. data/ext/pack/ruby/internal/attr/artificial.h +46 -0
  41. data/ext/pack/ruby/internal/attr/cold.h +37 -0
  42. data/ext/pack/ruby/internal/attr/const.h +46 -0
  43. data/ext/pack/ruby/internal/attr/constexpr.h +85 -0
  44. data/ext/pack/ruby/internal/attr/deprecated.h +59 -0
  45. data/ext/pack/ruby/internal/attr/diagnose_if.h +42 -0
  46. data/ext/pack/ruby/internal/attr/enum_extensibility.h +32 -0
  47. data/ext/pack/ruby/internal/attr/error.h +32 -0
  48. data/ext/pack/ruby/internal/attr/flag_enum.h +33 -0
  49. data/ext/pack/ruby/internal/attr/forceinline.h +40 -0
  50. data/ext/pack/ruby/internal/attr/format.h +38 -0
  51. data/ext/pack/ruby/internal/attr/maybe_unused.h +38 -0
  52. data/ext/pack/ruby/internal/attr/noalias.h +58 -0
  53. data/ext/pack/ruby/internal/attr/nodiscard.h +45 -0
  54. data/ext/pack/ruby/internal/attr/noexcept.h +91 -0
  55. data/ext/pack/ruby/internal/attr/noinline.h +35 -0
  56. data/ext/pack/ruby/internal/attr/nonnull.h +32 -0
  57. data/ext/pack/ruby/internal/attr/noreturn.h +48 -0
  58. data/ext/pack/ruby/internal/attr/pure.h +43 -0
  59. data/ext/pack/ruby/internal/attr/restrict.h +45 -0
  60. data/ext/pack/ruby/internal/attr/returns_nonnull.h +37 -0
  61. data/ext/pack/ruby/internal/attr/warning.h +32 -0
  62. data/ext/pack/ruby/internal/attr/weakref.h +32 -0
  63. data/ext/pack/ruby/internal/cast.h +53 -0
  64. data/ext/pack/ruby/internal/compiler_is.h +45 -0
  65. data/ext/pack/ruby/internal/compiler_is/apple.h +41 -0
  66. data/ext/pack/ruby/internal/compiler_is/clang.h +38 -0
  67. data/ext/pack/ruby/internal/compiler_is/gcc.h +46 -0
  68. data/ext/pack/ruby/internal/compiler_is/intel.h +41 -0
  69. data/ext/pack/ruby/internal/compiler_is/msvc.h +57 -0
  70. data/ext/pack/ruby/internal/compiler_is/sunpro.h +55 -0
  71. data/ext/pack/ruby/internal/compiler_since.h +61 -0
  72. data/ext/pack/ruby/internal/config.h +131 -0
  73. data/ext/pack/ruby/internal/constant_p.h +37 -0
  74. data/ext/pack/ruby/internal/core.h +35 -0
  75. data/ext/pack/ruby/internal/core/rarray.h +275 -0
  76. data/ext/pack/ruby/internal/core/rbasic.h +85 -0
  77. data/ext/pack/ruby/internal/core/rbignum.h +51 -0
  78. data/ext/pack/ruby/internal/core/rclass.h +47 -0
  79. data/ext/pack/ruby/internal/core/rdata.h +174 -0
  80. data/ext/pack/ruby/internal/core/rfile.h +36 -0
  81. data/ext/pack/ruby/internal/core/rhash.h +62 -0
  82. data/ext/pack/ruby/internal/core/rmatch.h +73 -0
  83. data/ext/pack/ruby/internal/core/robject.h +97 -0
  84. data/ext/pack/ruby/internal/core/rregexp.h +84 -0
  85. data/ext/pack/ruby/internal/core/rstring.h +215 -0
  86. data/ext/pack/ruby/internal/core/rstruct.h +73 -0
  87. data/ext/pack/ruby/internal/core/rtypeddata.h +184 -0
  88. data/ext/pack/ruby/internal/ctype.h +203 -0
  89. data/ext/pack/ruby/internal/dllexport.h +92 -0
  90. data/ext/pack/ruby/internal/dosish.h +63 -0
  91. data/ext/pack/ruby/internal/error.h +74 -0
  92. data/ext/pack/ruby/internal/eval.h +50 -0
  93. data/ext/pack/ruby/internal/event.h +75 -0
  94. data/ext/pack/ruby/internal/fl_type.h +469 -0
  95. data/ext/pack/ruby/internal/gc.h +35 -0
  96. data/ext/pack/ruby/internal/glob.h +35 -0
  97. data/ext/pack/ruby/internal/globals.h +159 -0
  98. data/ext/pack/ruby/internal/has/attribute.h +164 -0
  99. data/ext/pack/ruby/internal/has/builtin.h +105 -0
  100. data/ext/pack/ruby/internal/has/c_attribute.h +38 -0
  101. data/ext/pack/ruby/internal/has/cpp_attribute.h +79 -0
  102. data/ext/pack/ruby/internal/has/declspec_attribute.h +48 -0
  103. data/ext/pack/ruby/internal/has/extension.h +33 -0
  104. data/ext/pack/ruby/internal/has/feature.h +31 -0
  105. data/ext/pack/ruby/internal/has/warning.h +31 -0
  106. data/ext/pack/ruby/internal/intern/array.h +78 -0
  107. data/ext/pack/ruby/internal/intern/bignum.h +105 -0
  108. data/ext/pack/ruby/internal/intern/class.h +57 -0
  109. data/ext/pack/ruby/internal/intern/compar.h +34 -0
  110. data/ext/pack/ruby/internal/intern/complex.h +60 -0
  111. data/ext/pack/ruby/internal/intern/cont.h +40 -0
  112. data/ext/pack/ruby/internal/intern/dir.h +33 -0
  113. data/ext/pack/ruby/internal/intern/enum.h +33 -0
  114. data/ext/pack/ruby/internal/intern/enumerator.h +79 -0
  115. data/ext/pack/ruby/internal/intern/error.h +82 -0
  116. data/ext/pack/ruby/internal/intern/eval.h +59 -0
  117. data/ext/pack/ruby/internal/intern/file.h +44 -0
  118. data/ext/pack/ruby/internal/intern/gc.h +57 -0
  119. data/ext/pack/ruby/internal/intern/hash.h +59 -0
  120. data/ext/pack/ruby/internal/intern/io.h +70 -0
  121. data/ext/pack/ruby/internal/intern/load.h +39 -0
  122. data/ext/pack/ruby/internal/intern/marshal.h +35 -0
  123. data/ext/pack/ruby/internal/intern/numeric.h +42 -0
  124. data/ext/pack/ruby/internal/intern/object.h +90 -0
  125. data/ext/pack/ruby/internal/intern/parse.h +64 -0
  126. data/ext/pack/ruby/internal/intern/proc.h +53 -0
  127. data/ext/pack/ruby/internal/intern/process.h +46 -0
  128. data/ext/pack/ruby/internal/intern/random.h +45 -0
  129. data/ext/pack/ruby/internal/intern/range.h +35 -0
  130. data/ext/pack/ruby/internal/intern/rational.h +46 -0
  131. data/ext/pack/ruby/internal/intern/re.h +50 -0
  132. data/ext/pack/ruby/internal/intern/ruby.h +37 -0
  133. data/ext/pack/ruby/internal/intern/select.h +52 -0
  134. data/ext/pack/ruby/internal/intern/select/largesize.h +103 -0
  135. data/ext/pack/ruby/internal/intern/select/posix.h +82 -0
  136. data/ext/pack/ruby/internal/intern/select/win32.h +124 -0
  137. data/ext/pack/ruby/internal/intern/signal.h +40 -0
  138. data/ext/pack/ruby/internal/intern/sprintf.h +43 -0
  139. data/ext/pack/ruby/internal/intern/string.h +290 -0
  140. data/ext/pack/ruby/internal/intern/struct.h +47 -0
  141. data/ext/pack/ruby/internal/intern/thread.h +76 -0
  142. data/ext/pack/ruby/internal/intern/time.h +52 -0
  143. data/ext/pack/ruby/internal/intern/variable.h +83 -0
  144. data/ext/pack/ruby/internal/intern/vm.h +77 -0
  145. data/ext/pack/ruby/internal/interpreter.h +94 -0
  146. data/ext/pack/ruby/internal/iterator.h +65 -0
  147. data/ext/pack/ruby/internal/memory.h +286 -0
  148. data/ext/pack/ruby/internal/method.h +39 -0
  149. data/ext/pack/ruby/internal/module.h +39 -0
  150. data/ext/pack/ruby/internal/newobj.h +73 -0
  151. data/ext/pack/ruby/internal/rgengc.h +199 -0
  152. data/ext/pack/ruby/internal/scan_args.h +394 -0
  153. data/ext/pack/ruby/internal/special_consts.h +204 -0
  154. data/ext/pack/ruby/internal/static_assert.h +77 -0
  155. data/ext/pack/ruby/internal/stdalign.h +124 -0
  156. data/ext/pack/ruby/internal/stdbool.h +51 -0
  157. data/ext/pack/ruby/internal/symbol.h +114 -0
  158. data/ext/pack/ruby/internal/token_paste.h +75 -0
  159. data/ext/pack/ruby/internal/value.h +66 -0
  160. data/ext/pack/ruby/internal/value_type.h +354 -0
  161. data/ext/pack/ruby/internal/variable.h +62 -0
  162. data/ext/pack/ruby/internal/warning_push.h +91 -0
  163. data/ext/pack/ruby/internal/xmalloc.h +201 -0
  164. data/lib/zscan.rb +1 -1
  165. data/readme.md +2 -0
  166. data/zscan.gemspec +1 -1
  167. metadata +162 -2
@@ -0,0 +1,53 @@
1
+ #ifndef RBIMPL_ARITHMETIC_LONG_LONG_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_ARITHMETIC_LONG_LONG_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Arithmetic conversion between C's `long long` and Ruby's.
22
+ */
23
+ #include "ruby/internal/value.h"
24
+ #include "ruby/internal/dllexport.h"
25
+ #include "ruby/internal/special_consts.h"
26
+ #include "ruby/backward/2/long_long.h"
27
+
28
+ #define RB_LL2NUM rb_ll2inum
29
+ #define RB_ULL2NUM rb_ull2inum
30
+ #define LL2NUM RB_LL2NUM
31
+ #define ULL2NUM RB_ULL2NUM
32
+ #define RB_NUM2LL rb_num2ll_inline
33
+ #define RB_NUM2ULL rb_num2ull
34
+ #define NUM2LL RB_NUM2LL
35
+ #define NUM2ULL RB_NUM2ULL
36
+
37
+ RBIMPL_SYMBOL_EXPORT_BEGIN()
38
+ VALUE rb_ll2inum(LONG_LONG);
39
+ VALUE rb_ull2inum(unsigned LONG_LONG);
40
+ LONG_LONG rb_num2ll(VALUE);
41
+ unsigned LONG_LONG rb_num2ull(VALUE);
42
+ RBIMPL_SYMBOL_EXPORT_END()
43
+
44
+ static inline LONG_LONG
45
+ rb_num2ll_inline(VALUE x)
46
+ {
47
+ if (RB_FIXNUM_P(x))
48
+ return RB_FIX2LONG(x);
49
+ else
50
+ return rb_num2ll(x);
51
+ }
52
+
53
+ #endif /* RBIMPL_ARITHMETIC_LONG_LONG_H */
@@ -0,0 +1,34 @@
1
+ #ifndef RBIMPL_ARITHMETIC_MODE_T_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_ARITHMETIC_MODE_T_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Arithmetic conversion between C's `mode_t` and Ruby's.
22
+ */
23
+ #include "ruby/internal/config.h"
24
+ #include "ruby/internal/arithmetic/int.h"
25
+
26
+ #ifndef NUM2MODET
27
+ # define NUM2MODET RB_NUM2INT
28
+ #endif
29
+
30
+ #ifndef MODET2NUM
31
+ # define MODET2NUM RB_INT2NUM
32
+ #endif
33
+
34
+ #endif /* RBIMPL_ARITHMETIC_MODE_T_H */
@@ -0,0 +1,49 @@
1
+ #ifndef RBIMPL_ARITHMETIC_OFF_T_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_ARITHMETIC_OFF_T_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Arithmetic conversion between C's `off_t` and Ruby's.
22
+ */
23
+ #include "ruby/internal/config.h"
24
+ #include "ruby/internal/arithmetic/int.h"
25
+ #include "ruby/internal/arithmetic/long.h"
26
+ #include "ruby/internal/arithmetic/long_long.h"
27
+ #include "ruby/backward/2/long_long.h"
28
+
29
+ #ifdef OFFT2NUM
30
+ # /* take that. */
31
+ #elif SIZEOF_OFF_T == SIZEOF_LONG_LONG
32
+ # define OFFT2NUM RB_LL2NUM
33
+ #elif SIZEOF_OFF_T == SIZEOF_LONG
34
+ # define OFFT2NUM RB_LONG2NUM
35
+ #else
36
+ # define OFFT2NUM RB_INT2NUM
37
+ #endif
38
+
39
+ #ifdef NUM2OFFT
40
+ # /* take that. */
41
+ #elif SIZEOF_OFF_T == SIZEOF_LONG_LONG
42
+ # define NUM2OFFT RB_NUM2LL
43
+ #elif SIZEOF_OFF_T == SIZEOF_LONG
44
+ # define NUM2OFFT RB_NUM2LONG
45
+ #else
46
+ # define NUM2OFFT RB_NUM2INT
47
+ #endif
48
+
49
+ #endif /* RBIMPL_ARITHMETIC_OFF_T_H */
@@ -0,0 +1,34 @@
1
+ #ifndef RBIMPL_ARITHMETIC_PID_T_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_ARITHMETIC_PID_T_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Arithmetic conversion between C's `pid_t` and Ruby's.
22
+ */
23
+ #include "ruby/internal/config.h"
24
+ #include "ruby/internal/arithmetic/long.h"
25
+
26
+ #ifndef PIDT2NUM
27
+ # define PIDT2NUM RB_LONG2NUM
28
+ #endif
29
+
30
+ #ifndef NUM2PIDT
31
+ # define NUM2PIDT RB_NUM2LONG
32
+ #endif
33
+
34
+ #endif /* RBIMPL_ARITHMETIC_PID_T_H */
@@ -0,0 +1,54 @@
1
+ #ifndef RBIMPL_ARITHMETIC_SHORT_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_ARITHMETIC_SHORT_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Arithmetic conversion between C's `short` and Ruby's.
22
+ *
23
+ * Shyouhei wonders: why there is no SHORT2NUM, given there are both
24
+ * #USHORT2NUM and #CHR2FIX?
25
+ */
26
+ #include "ruby/internal/value.h"
27
+ #include "ruby/internal/dllexport.h"
28
+ #include "ruby/internal/special_consts.h"
29
+
30
+ #define RB_NUM2SHORT rb_num2short_inline
31
+ #define RB_NUM2USHORT rb_num2ushort
32
+ #define NUM2SHORT RB_NUM2SHORT
33
+ #define NUM2USHORT RB_NUM2USHORT
34
+ #define USHORT2NUM RB_INT2FIX
35
+ #define RB_FIX2SHORT rb_fix2short
36
+ #define FIX2SHORT RB_FIX2SHORT
37
+
38
+ RBIMPL_SYMBOL_EXPORT_BEGIN()
39
+ short rb_num2short(VALUE);
40
+ unsigned short rb_num2ushort(VALUE);
41
+ short rb_fix2short(VALUE);
42
+ unsigned short rb_fix2ushort(VALUE);
43
+ RBIMPL_SYMBOL_EXPORT_END()
44
+
45
+ static inline short
46
+ rb_num2short_inline(VALUE x)
47
+ {
48
+ if (RB_FIXNUM_P(x))
49
+ return rb_fix2short(x);
50
+ else
51
+ return rb_num2short(x);
52
+ }
53
+
54
+ #endif /* RBIMPL_ARITHMETIC_SOHRT_H */
@@ -0,0 +1,51 @@
1
+ #ifndef RBIMPL_ARITHMETIC_SIZE_T_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_ARITHMETIC_SIZE_T_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Arithmetic conversion between C's `size_t` and Ruby's.
22
+ */
23
+ #include "ruby/internal/config.h"
24
+ #include "ruby/internal/arithmetic/int.h"
25
+ #include "ruby/internal/arithmetic/long.h"
26
+ #include "ruby/internal/arithmetic/long_long.h"
27
+ #include "ruby/backward/2/long_long.h"
28
+
29
+ #if SIZEOF_SIZE_T == SIZEOF_LONG_LONG
30
+ # define SIZET2NUM RB_ULL2NUM
31
+ # define SSIZET2NUM RB_LL2NUM
32
+ #elif SIZEOF_SIZE_T == SIZEOF_LONG
33
+ # define SIZET2NUM RB_ULONG2NUM
34
+ # define SSIZET2NUM RB_LONG2NUM
35
+ #else
36
+ # define SIZET2NUM RB_UINT2NUM
37
+ # define SSIZET2NUM RB_INT2NUM
38
+ #endif
39
+
40
+ #if SIZEOF_SIZE_T == SIZEOF_LONG_LONG
41
+ # define NUM2SIZET RB_NUM2ULL
42
+ # define NUM2SSIZET RB_NUM2LL
43
+ #elif SIZEOF_SIZE_T == SIZEOF_LONG
44
+ # define NUM2SIZET RB_NUM2ULONG
45
+ # define NUM2SSIZET RB_NUM2LONG
46
+ #else
47
+ # define NUM2SIZET RB_NUM2UINT
48
+ # define NUM2SSIZET RB_NUM2INT
49
+ #endif
50
+
51
+ #endif /* RBIMPL_ARITHMETIC_SIZE_T_H */
@@ -0,0 +1,59 @@
1
+ #ifndef RBIMPL_ARITHMERIC_ST_DATA_T_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_ARITHMERIC_ST_DATA_T_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Arithmetic conversion between C's `st_data_t` and Ruby's.
22
+ */
23
+ #include "ruby/internal/arithmetic/fixnum.h"
24
+ #include "ruby/internal/arithmetic/long.h"
25
+ #include "ruby/internal/attr/artificial.h"
26
+ #include "ruby/internal/attr/const.h"
27
+ #include "ruby/internal/attr/constexpr.h"
28
+ #include "ruby/internal/cast.h"
29
+ #include "ruby/internal/value.h"
30
+ #include "ruby/assert.h"
31
+ #include "ruby/st.h"
32
+
33
+ #define ST2FIX RB_ST2FIX
34
+ /** @cond INTERNAL_MACRO */
35
+ #define RB_ST2FIX RB_ST2FIX
36
+ /** @endcond */
37
+
38
+ RBIMPL_ATTR_CONST_ON_NDEBUG()
39
+ RBIMPL_ATTR_CONSTEXPR_ON_NDEBUG(CXX14)
40
+ RBIMPL_ATTR_ARTIFICIAL()
41
+ /* See also [ruby-core:84395] [Bug #14218] [ruby-core:82687] [Bug #13877] */
42
+ static inline VALUE
43
+ RB_ST2FIX(st_data_t i)
44
+ {
45
+ SIGNED_VALUE x = i;
46
+
47
+ if (x >= 0) {
48
+ x &= RUBY_FIXNUM_MAX;
49
+ }
50
+ else {
51
+ x |= RUBY_FIXNUM_MIN;
52
+ }
53
+
54
+ RBIMPL_ASSERT_OR_ASSUME(RB_FIXABLE(x));
55
+ unsigned long y = RBIMPL_CAST((unsigned long)x);
56
+ return RB_LONG2FIX(y);
57
+ }
58
+
59
+ #endif /* RBIMPL_ARITHMERIC_ST_DATA_T_H */
@@ -0,0 +1,34 @@
1
+ #ifndef RBIMPL_ARITHMETIC_UID_T_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_ARITHMETIC_UID_T_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Arithmetic conversion between C's `uid_t` and Ruby's.
22
+ */
23
+ #include "ruby/internal/config.h"
24
+ #include "ruby/internal/arithmetic/long.h"
25
+
26
+ #ifndef UIDT2NUM
27
+ # define UIDT2NUM RB_LONG2NUM
28
+ #endif
29
+
30
+ #ifndef NUM2UIDT
31
+ # define NUM2UIDT RB_NUM2LONG
32
+ #endif
33
+
34
+ #endif /* RBIMPL_ARITHMETIC_UID_T_H */
@@ -0,0 +1,90 @@
1
+ #ifndef RBIMPL_ASSUME_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_ASSUME_H
3
+ /**
4
+ * @file
5
+ * @author Ruby developers <ruby-core@ruby-lang.org>
6
+ * @copyright This file is a part of the programming language Ruby.
7
+ * Permission is hereby granted, to either redistribute and/or
8
+ * modify this file, provided that the conditions mentioned in the
9
+ * file COPYING are met. Consult the file for details.
10
+ * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
11
+ * implementation details. Don't take them as canon. They could
12
+ * rapidly appear then vanish. The name (path) of this header file
13
+ * is also an implementation detail. Do not expect it to persist
14
+ * at the place it is now. Developers are free to move it anywhere
15
+ * anytime at will.
16
+ * @note To ruby-core: remember that this header can be possibly
17
+ * recursively included from extension libraries written in C++.
18
+ * Do not expect for instance `__VA_ARGS__` is always available.
19
+ * We assume C99 for ruby itself but we don't assume languages of
20
+ * extension libraries. They could be written in C++98.
21
+ * @brief Defines #RBIMPL_ASSUME / #RBIMPL_UNREACHABLE.
22
+ *
23
+ * These macros must be defined at once because:
24
+ *
25
+ * - #RBIMPL_ASSUME could fallback to #RBIMPL_UNREACHABLE.
26
+ * - #RBIMPL_UNREACHABLE could fallback to #RBIMPL_ASSUME.
27
+ */
28
+ #include "ruby/internal/config.h"
29
+ #include "ruby/internal/cast.h"
30
+ #include "ruby/internal/compiler_since.h"
31
+ #include "ruby/internal/has/builtin.h"
32
+ #include "ruby/internal/warning_push.h"
33
+
34
+ /** @cond INTERNAL_MACRO */
35
+ #if RBIMPL_COMPILER_SINCE(MSVC, 13, 10, 0)
36
+ # define RBIMPL_HAVE___ASSUME
37
+
38
+ #elif RBIMPL_COMPILER_SINCE(Intel, 13, 0, 0)
39
+ # define RBIMPL_HAVE___ASSUME
40
+ #endif
41
+ /** @endcond */
42
+
43
+ /** Wraps (or simulates) `__builtin_unreachable`. */
44
+ #if RBIMPL_HAS_BUILTIN(__builtin_unreachable)
45
+ # define RBIMPL_UNREACHABLE_RETURN(_) __builtin_unreachable()
46
+
47
+ #elif defined(RBIMPL_HAVE___ASSUME)
48
+ # define RBIMPL_UNREACHABLE_RETURN(_) return (__assume(0), (_))
49
+
50
+ #else
51
+ # define RBIMPL_UNREACHABLE_RETURN(_) return (_)
52
+ #endif
53
+
54
+ /** Wraps (or simulates) `__builtin_unreachable`. */
55
+ #if RBIMPL_HAS_BUILTIN(__builtin_unreachable)
56
+ # define RBIMPL_UNREACHABLE __builtin_unreachable
57
+
58
+ #elif defined(RBIMPL_HAVE___ASSUME)
59
+ # define RBIMPL_UNREACHABLE() __assume(0)
60
+ #endif
61
+
62
+ /** Wraps (or simulates) `__assume`. */
63
+ #if RBIMPL_COMPILER_SINCE(Intel, 13, 0, 0)
64
+ # /* icc warnings are false positives. Ignore them. */
65
+ # /* "warning #2261: __assume expression with side effects discarded" */
66
+ # define RBIMPL_ASSUME(expr) \
67
+ RBIMPL_WARNING_PUSH() \
68
+ RBIMPL_WARNING_IGNORED(2261) \
69
+ __assume(expr) \
70
+ RBIMPL_WARNING_POP()
71
+
72
+ #elif defined(RBIMPL_HAVE___ASSUME)
73
+ # define RBIMPL_ASSUME __assume
74
+
75
+ #elif RBIMPL_HAS_BUILTIN(__builtin_assume)
76
+ # define RBIMPL_ASSUME __builtin_assume
77
+
78
+ #elif ! defined(RBIMPL_UNREACHABLE)
79
+ # define RBIMPL_ASSUME(_) RBIMPL_CAST((void)(_))
80
+
81
+ #else
82
+ # define RBIMPL_ASSUME(_) \
83
+ (RB_LIKELY(!!(_)) ? RBIMPL_CAST((void)0) : RBIMPL_UNREACHABLE())
84
+ #endif
85
+
86
+ #if ! defined(RBIMPL_UNREACHABLE)
87
+ # define RBIMPL_UNREACHABLE() RBIMPL_ASSUME(0)
88
+ #endif
89
+
90
+ #endif /* RBIMPL_ASSUME_H */