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,85 @@
1
+ #ifndef RBIMPL_RBASIC_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_RBASIC_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 struct ::RBasic.
22
+ */
23
+ #include "ruby/internal/attr/artificial.h"
24
+ #include "ruby/internal/attr/constexpr.h"
25
+ #include "ruby/internal/attr/forceinline.h"
26
+ #include "ruby/internal/attr/noalias.h"
27
+ #include "ruby/internal/attr/pure.h"
28
+ #include "ruby/internal/cast.h"
29
+ #include "ruby/internal/dllexport.h"
30
+ #include "ruby/internal/special_consts.h"
31
+ #include "ruby/internal/value.h"
32
+ #include "ruby/assert.h"
33
+
34
+ #define RBASIC(obj) RBIMPL_CAST((struct RBasic *)(obj))
35
+ #define RBASIC_CLASS RBASIC_CLASS
36
+ #define RVALUE_EMBED_LEN_MAX RVALUE_EMBED_LEN_MAX
37
+
38
+ /** @cond INTERNAL_MACRO */
39
+ #define RBIMPL_EMBED_LEN_MAX_OF(T) \
40
+ RBIMPL_CAST((int)(sizeof(VALUE[RVALUE_EMBED_LEN_MAX]) / sizeof(T)))
41
+ /** @endcond */
42
+
43
+ enum ruby_rvalue_flags { RVALUE_EMBED_LEN_MAX = 3 };
44
+
45
+ struct
46
+ RUBY_ALIGNAS(SIZEOF_VALUE)
47
+ RBasic {
48
+ VALUE flags; /**< @see enum ::ruby_fl_type. */
49
+ const VALUE klass;
50
+
51
+ #ifdef __cplusplus
52
+ public:
53
+ RBIMPL_ATTR_CONSTEXPR(CXX11)
54
+ RBIMPL_ATTR_ARTIFICIAL()
55
+ RBIMPL_ATTR_FORCEINLINE()
56
+ RBIMPL_ATTR_NOALIAS()
57
+ /**
58
+ * We need to define this explicit constructor because the field `klass` is
59
+ * const-qualified above, which effectively defines the implicit default
60
+ * constructor as "deleted" (as of C++11) -- No way but to define one by
61
+ * ourselves.
62
+ */
63
+ RBasic() :
64
+ flags(RBIMPL_VALUE_NULL),
65
+ klass(RBIMPL_VALUE_NULL)
66
+ {
67
+ }
68
+ #endif
69
+ };
70
+
71
+ RBIMPL_SYMBOL_EXPORT_BEGIN()
72
+ VALUE rb_obj_hide(VALUE obj);
73
+ VALUE rb_obj_reveal(VALUE obj, VALUE klass); /* do not use this API to change klass information */
74
+ RBIMPL_SYMBOL_EXPORT_END()
75
+
76
+ RBIMPL_ATTR_PURE_ON_NDEBUG()
77
+ RBIMPL_ATTR_ARTIFICIAL()
78
+ static inline VALUE
79
+ RBASIC_CLASS(VALUE obj)
80
+ {
81
+ RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(obj));
82
+ return RBASIC(obj)->klass;
83
+ }
84
+
85
+ #endif /* RBIMPL_RBASIC_H */
@@ -0,0 +1,51 @@
1
+ #ifndef RBIMPL_RBIGNUM_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_RBIGNUM_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 Routines to manipulate struct ::RBignum.
22
+ */
23
+ #include "ruby/internal/dllexport.h"
24
+ #include "ruby/internal/value.h"
25
+ #include "ruby/internal/value_type.h"
26
+ #include "ruby/internal/stdbool.h"
27
+
28
+ #define RBIGNUM_SIGN rb_big_sign
29
+
30
+ /** @cond INTERNAL_MACRO */
31
+ #define RBIGNUM_POSITIVE_P RBIGNUM_POSITIVE_P
32
+ #define RBIGNUM_NEGATIVE_P RBIGNUM_NEGATIVE_P
33
+ /** @endcond */
34
+
35
+ RBIMPL_SYMBOL_EXPORT_BEGIN()
36
+ int rb_big_sign(VALUE num);
37
+ RBIMPL_SYMBOL_EXPORT_END()
38
+
39
+ static inline bool
40
+ RBIGNUM_POSITIVE_P(VALUE b) {
41
+ RBIMPL_ASSERT_TYPE(b, RUBY_T_BIGNUM);
42
+ return RBIGNUM_SIGN(b);
43
+ }
44
+
45
+ static inline bool
46
+ RBIGNUM_NEGATIVE_P(VALUE b) {
47
+ RBIMPL_ASSERT_TYPE(b, RUBY_T_BIGNUM);
48
+ return ! RBIGNUM_POSITIVE_P(b);
49
+ }
50
+
51
+ #endif /* RBIMPL_RBIGNUM_H */
@@ -0,0 +1,47 @@
1
+ #ifndef RBIMPL_RCLASS_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_RCLASS_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 Routines to manipulate struct ::RClass.
22
+ */
23
+ #include "ruby/internal/dllexport.h"
24
+ #include "ruby/internal/value.h"
25
+ #include "ruby/internal/cast.h"
26
+
27
+ #define RMODULE_IS_OVERLAID RMODULE_IS_OVERLAID
28
+ #define RMODULE_IS_REFINEMENT RMODULE_IS_REFINEMENT
29
+ #define RMODULE_INCLUDED_INTO_REFINEMENT RMODULE_INCLUDED_INTO_REFINEMENT
30
+
31
+ #define RCLASS(obj) RBIMPL_CAST((struct RClass *)(obj))
32
+ #define RMODULE RCLASS
33
+ #define RCLASS_SUPER rb_class_get_superclass
34
+
35
+ enum ruby_rmodule_flags {
36
+ RMODULE_IS_OVERLAID = RUBY_FL_USER2,
37
+ RMODULE_IS_REFINEMENT = RUBY_FL_USER3,
38
+ RMODULE_INCLUDED_INTO_REFINEMENT = RUBY_FL_USER4
39
+ };
40
+
41
+ struct RClass; /* Opaque, declared here for RCLASS() macro. */
42
+
43
+ RBIMPL_SYMBOL_EXPORT_BEGIN()
44
+ VALUE rb_class_get_superclass(VALUE);
45
+ RBIMPL_SYMBOL_EXPORT_END()
46
+
47
+ #endif /* RBIMPL_RCLASS_H */
@@ -0,0 +1,174 @@
1
+ #ifndef RBIMPL_RDATA_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_RDATA_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 struct ::RData.
22
+ */
23
+ #include "ruby/internal/config.h"
24
+
25
+ #ifdef STDC_HEADERS
26
+ # include <stddef.h>
27
+ #endif
28
+
29
+ #include "ruby/internal/attr/deprecated.h"
30
+ #include "ruby/internal/attr/warning.h"
31
+ #include "ruby/internal/cast.h"
32
+ #include "ruby/internal/core/rbasic.h"
33
+ #include "ruby/internal/dllexport.h"
34
+ #include "ruby/internal/fl_type.h"
35
+ #include "ruby/internal/token_paste.h"
36
+ #include "ruby/internal/value.h"
37
+ #include "ruby/internal/value_type.h"
38
+ #include "ruby/defines.h"
39
+
40
+ #ifdef RUBY_UNTYPED_DATA_WARNING
41
+ # /* Take that. */
42
+ #elif defined(RUBY_EXPORT)
43
+ # define RUBY_UNTYPED_DATA_WARNING 1
44
+ #else
45
+ # define RUBY_UNTYPED_DATA_WARNING 0
46
+ #endif
47
+
48
+ /** @cond INTERNAL_MACRO */
49
+ #define RBIMPL_DATA_FUNC(f) RBIMPL_CAST((void (*)(void *))(f))
50
+ #define RBIMPL_ATTRSET_UNTYPED_DATA_FUNC() \
51
+ RBIMPL_ATTR_WARNING(("untyped Data is unsafe; use TypedData instead")) \
52
+ RBIMPL_ATTR_DEPRECATED(("by TypedData"))
53
+ /** @endcond */
54
+
55
+ #define RDATA(obj) RBIMPL_CAST((struct RData *)(obj))
56
+ #define DATA_PTR(obj) RDATA(obj)->data
57
+ #define RUBY_MACRO_SELECT RBIMPL_TOKEN_PASTE
58
+ #define RUBY_DEFAULT_FREE RBIMPL_DATA_FUNC(-1)
59
+ #define RUBY_NEVER_FREE RBIMPL_DATA_FUNC(0)
60
+ #define RUBY_UNTYPED_DATA_FUNC(f) f RBIMPL_ATTRSET_UNTYPED_DATA_FUNC()
61
+
62
+ /*
63
+ #define RUBY_DATA_FUNC(func) ((void (*)(void*))(func))
64
+ */
65
+ typedef void (*RUBY_DATA_FUNC)(void*);
66
+
67
+ struct RData {
68
+ struct RBasic basic;
69
+ RUBY_DATA_FUNC dmark;
70
+ RUBY_DATA_FUNC dfree;
71
+ void *data;
72
+ };
73
+
74
+ RBIMPL_SYMBOL_EXPORT_BEGIN()
75
+ VALUE rb_data_object_wrap(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree);
76
+ VALUE rb_data_object_zalloc(VALUE klass, size_t size, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree);
77
+ RBIMPL_SYMBOL_EXPORT_END()
78
+
79
+ #define Data_Wrap_Struct(klass, mark, free, sval) \
80
+ rb_data_object_wrap( \
81
+ (klass), \
82
+ (sval), \
83
+ RBIMPL_DATA_FUNC(mark), \
84
+ RBIMPL_DATA_FUNC(free))
85
+
86
+ #define Data_Make_Struct0(result, klass, type, size, mark, free, sval) \
87
+ VALUE result = rb_data_object_zalloc( \
88
+ (klass), \
89
+ (size), \
90
+ RBIMPL_DATA_FUNC(mark), \
91
+ RBIMPL_DATA_FUNC(free)); \
92
+ (sval) = RBIMPL_CAST((type *)DATA_PTR(result)); \
93
+ RBIMPL_CAST(/*suppress unused variable warnings*/(void)(sval))
94
+
95
+ #ifdef HAVE_STMT_AND_DECL_IN_EXPR
96
+ #define Data_Make_Struct(klass, type, mark, free, sval) \
97
+ RB_GNUC_EXTENSION({ \
98
+ Data_Make_Struct0( \
99
+ data_struct_obj, \
100
+ klass, \
101
+ type, \
102
+ sizeof(type), \
103
+ mark, \
104
+ free, \
105
+ sval); \
106
+ data_struct_obj; \
107
+ })
108
+ #else
109
+ #define Data_Make_Struct(klass, type, mark, free, sval) \
110
+ rb_data_object_make( \
111
+ (klass), \
112
+ RBIMPL_DATA_FUNC(mark), \
113
+ RBIMPL_DATA_FUNC(free), \
114
+ RBIMPL_CAST((void **)&(sval)), \
115
+ sizeof(type))
116
+ #endif
117
+
118
+ #define Data_Get_Struct(obj, type, sval) \
119
+ ((sval) = RBIMPL_CAST((type*)rb_data_object_get(obj)))
120
+
121
+ RBIMPL_ATTRSET_UNTYPED_DATA_FUNC()
122
+ static inline VALUE
123
+ rb_data_object_wrap_warning(VALUE klass, void *ptr, RUBY_DATA_FUNC mark, RUBY_DATA_FUNC free)
124
+ {
125
+ return rb_data_object_wrap(klass, ptr, mark, free);
126
+ }
127
+
128
+ static inline void *
129
+ rb_data_object_get(VALUE obj)
130
+ {
131
+ Check_Type(obj, RUBY_T_DATA);
132
+ return DATA_PTR(obj);
133
+ }
134
+
135
+ RBIMPL_ATTRSET_UNTYPED_DATA_FUNC()
136
+ static inline void *
137
+ rb_data_object_get_warning(VALUE obj)
138
+ {
139
+ return rb_data_object_get(obj);
140
+ }
141
+
142
+ #if defined(HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P)
143
+ # define rb_data_object_wrap_warning(klass, ptr, mark, free) \
144
+ RB_GNUC_EXTENSION( \
145
+ __builtin_choose_expr( \
146
+ __builtin_constant_p(klass) && !(klass), \
147
+ rb_data_object_wrap(klass, ptr, mark, free), \
148
+ (rb_data_object_wrap_warning)(klass, ptr, mark, free)))
149
+ #endif
150
+
151
+ static inline VALUE
152
+ rb_data_object_make(VALUE klass, RUBY_DATA_FUNC mark_func, RUBY_DATA_FUNC free_func, void **datap, size_t size)
153
+ {
154
+ Data_Make_Struct0(result, klass, void, size, mark_func, free_func, *datap);
155
+ return result;
156
+ }
157
+
158
+ RBIMPL_ATTR_DEPRECATED(("by: rb_data_object_wrap"))
159
+ static inline VALUE
160
+ rb_data_object_alloc(VALUE klass, void *data, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
161
+ {
162
+ return rb_data_object_wrap(klass, data, dmark, dfree);
163
+ }
164
+
165
+ #define rb_data_object_wrap_0 rb_data_object_wrap
166
+ #define rb_data_object_wrap_1 rb_data_object_wrap_warning
167
+ #define rb_data_object_wrap RUBY_MACRO_SELECT(rb_data_object_wrap_, RUBY_UNTYPED_DATA_WARNING)
168
+ #define rb_data_object_get_0 rb_data_object_get
169
+ #define rb_data_object_get_1 rb_data_object_get_warning
170
+ #define rb_data_object_get RUBY_MACRO_SELECT(rb_data_object_get_, RUBY_UNTYPED_DATA_WARNING)
171
+ #define rb_data_object_make_0 rb_data_object_make
172
+ #define rb_data_object_make_1 rb_data_object_make_warning
173
+ #define rb_data_object_make RUBY_MACRO_SELECT(rb_data_object_make_, RUBY_UNTYPED_DATA_WARNING)
174
+ #endif /* RBIMPL_RDATA_H */
@@ -0,0 +1,36 @@
1
+ #ifndef RBIMPL_RFILE_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_RFILE_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 struct ::RFile.
22
+ */
23
+ #include "ruby/internal/core/rbasic.h"
24
+ #include "ruby/internal/cast.h"
25
+
26
+ /* rb_io_t is in ruby/io.h. The header file has historically not been included
27
+ * into ruby/ruby.h. We follow that tradition. */
28
+ struct rb_io_t;
29
+
30
+ struct RFile {
31
+ struct RBasic basic;
32
+ struct rb_io_t *fptr;
33
+ };
34
+
35
+ #define RFILE(obj) RBIMPL_CAST((struct RFile *)(obj))
36
+ #endif /* RBIMPL_RFILE_H */
@@ -0,0 +1,62 @@
1
+ #ifndef RBIMPL_RHASH_H /*-*-C++-*-vi:se ft=cpp:*/
2
+ #define RBIMPL_RHASH_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 Routines to manipulate struct ::RHash.
22
+ *
23
+ * Shyouhei really suffered agnish over placement of macros in this file. They
24
+ * are half-brken. The situation (as of wriring) is:
25
+ *
26
+ * - #RHASH_TBL: works.
27
+ * - #RHASH_ITER_LEV: compile-time error.
28
+ * - #RHASH_IFNONE: compile-time error.
29
+ * - #RHASH_SIZE: works.
30
+ * - #RHASH_EMPTY_P: works.
31
+ * - #RHASH_SET_IFNONE: works (why... given you cannot query).
32
+ *
33
+ * Shyouhei stopped thinking. Let them be as is.
34
+ */
35
+ #include "ruby/internal/config.h"
36
+
37
+ #ifdef STDC_HEADERS
38
+ # include <stddef.h>
39
+ #endif
40
+
41
+ #include "ruby/internal/dllexport.h"
42
+ #include "ruby/internal/value.h"
43
+ #if !defined RUBY_EXPORT && !defined RUBY_NO_OLD_COMPATIBILITY
44
+ # include "ruby/backward.h"
45
+ #endif
46
+
47
+ #define RHASH_TBL(h) rb_hash_tbl(h, __FILE__, __LINE__)
48
+ #define RHASH_ITER_LEV(h) rb_hash_iter_lev(h)
49
+ #define RHASH_IFNONE(h) rb_hash_ifnone(h)
50
+ #define RHASH_SIZE(h) rb_hash_size_num(h)
51
+ #define RHASH_EMPTY_P(h) (RHASH_SIZE(h) == 0)
52
+ #define RHASH_SET_IFNONE(h, ifnone) rb_hash_set_ifnone((VALUE)h, ifnone)
53
+
54
+ struct st_table; /* in ruby/st.h */
55
+
56
+ RBIMPL_SYMBOL_EXPORT_BEGIN()
57
+ size_t rb_hash_size_num(VALUE hash);
58
+ struct st_table *rb_hash_tbl(VALUE, const char *file, int line);
59
+ VALUE rb_hash_set_ifnone(VALUE hash, VALUE ifnone);
60
+ RBIMPL_SYMBOL_EXPORT_END()
61
+
62
+ #endif /* RBIMPL_RHASH_H */