rice 4.3.3 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +63 -26
  3. data/README.md +7 -2
  4. data/Rakefile +7 -1
  5. data/include/rice/rice.hpp +7291 -4430
  6. data/include/rice/stl.hpp +769 -222
  7. data/lib/mkmf-rice.rb +37 -95
  8. data/rice/Address_Registration_Guard.hpp +72 -3
  9. data/rice/Arg.hpp +19 -5
  10. data/rice/Arg.ipp +24 -0
  11. data/rice/Callback.hpp +21 -0
  12. data/rice/Callback.ipp +13 -0
  13. data/rice/Constructor.hpp +4 -27
  14. data/rice/Constructor.ipp +79 -0
  15. data/rice/Data_Object.hpp +74 -3
  16. data/rice/Data_Object.ipp +324 -32
  17. data/rice/Data_Type.hpp +215 -3
  18. data/rice/Data_Type.ipp +125 -64
  19. data/rice/Director.hpp +0 -2
  20. data/rice/Enum.hpp +4 -6
  21. data/rice/Enum.ipp +101 -57
  22. data/rice/Exception.hpp +62 -2
  23. data/rice/Exception.ipp +7 -12
  24. data/rice/JumpException.hpp +44 -0
  25. data/rice/JumpException.ipp +48 -0
  26. data/rice/MemoryView.hpp +11 -0
  27. data/rice/MemoryView.ipp +43 -0
  28. data/rice/Return.hpp +6 -26
  29. data/rice/Return.ipp +10 -16
  30. data/rice/detail/DefaultHandler.hpp +12 -0
  31. data/rice/detail/DefaultHandler.ipp +8 -0
  32. data/rice/detail/HandlerRegistry.hpp +5 -35
  33. data/rice/detail/HandlerRegistry.ipp +7 -11
  34. data/rice/detail/InstanceRegistry.hpp +1 -4
  35. data/rice/detail/MethodInfo.hpp +15 -5
  36. data/rice/detail/MethodInfo.ipp +78 -6
  37. data/rice/detail/Native.hpp +32 -0
  38. data/rice/detail/Native.ipp +129 -0
  39. data/rice/detail/NativeAttributeGet.hpp +51 -0
  40. data/rice/detail/NativeAttributeGet.ipp +51 -0
  41. data/rice/detail/NativeAttributeSet.hpp +43 -0
  42. data/rice/detail/NativeAttributeSet.ipp +82 -0
  43. data/rice/detail/NativeCallbackFFI.hpp +55 -0
  44. data/rice/detail/NativeCallbackFFI.ipp +151 -0
  45. data/rice/detail/NativeCallbackSimple.hpp +30 -0
  46. data/rice/detail/NativeCallbackSimple.ipp +29 -0
  47. data/rice/detail/NativeFunction.hpp +20 -21
  48. data/rice/detail/NativeFunction.ipp +199 -64
  49. data/rice/detail/NativeIterator.hpp +8 -11
  50. data/rice/detail/NativeIterator.ipp +27 -31
  51. data/rice/detail/NativeRegistry.hpp +24 -15
  52. data/rice/detail/NativeRegistry.ipp +23 -48
  53. data/rice/detail/Proc.hpp +4 -0
  54. data/rice/detail/Proc.ipp +85 -0
  55. data/rice/detail/Registries.hpp +0 -7
  56. data/rice/detail/Registries.ipp +0 -18
  57. data/rice/detail/RubyFunction.hpp +0 -3
  58. data/rice/detail/RubyFunction.ipp +4 -8
  59. data/rice/detail/RubyType.hpp +19 -0
  60. data/rice/detail/RubyType.ipp +187 -0
  61. data/rice/detail/TupleIterator.hpp +14 -0
  62. data/rice/detail/Type.hpp +5 -6
  63. data/rice/detail/Type.ipp +150 -33
  64. data/rice/detail/TypeRegistry.hpp +15 -7
  65. data/rice/detail/TypeRegistry.ipp +105 -12
  66. data/rice/detail/Wrapper.hpp +6 -5
  67. data/rice/detail/Wrapper.ipp +45 -23
  68. data/rice/detail/cpp_protect.hpp +5 -6
  69. data/rice/detail/default_allocation_func.ipp +0 -2
  70. data/rice/detail/from_ruby.hpp +37 -3
  71. data/rice/detail/from_ruby.ipp +911 -454
  72. data/rice/detail/ruby.hpp +18 -0
  73. data/rice/detail/to_ruby.hpp +41 -3
  74. data/rice/detail/to_ruby.ipp +437 -113
  75. data/rice/global_function.hpp +0 -4
  76. data/rice/global_function.ipp +1 -2
  77. data/rice/rice.hpp +105 -22
  78. data/rice/ruby_mark.hpp +4 -3
  79. data/rice/stl.hpp +4 -0
  80. data/test/embed_ruby.cpp +4 -1
  81. data/test/extconf.rb +2 -0
  82. data/test/ruby/test_multiple_extensions_same_class.rb +14 -14
  83. data/test/test_Address_Registration_Guard.cpp +5 -0
  84. data/test/test_Array.cpp +12 -1
  85. data/test/test_Attribute.cpp +103 -21
  86. data/test/test_Builtin_Object.cpp +5 -0
  87. data/test/test_Callback.cpp +231 -0
  88. data/test/test_Class.cpp +5 -31
  89. data/test/test_Constructor.cpp +69 -6
  90. data/test/test_Data_Object.cpp +9 -4
  91. data/test/test_Data_Type.cpp +428 -64
  92. data/test/test_Director.cpp +10 -5
  93. data/test/test_Enum.cpp +152 -40
  94. data/test/test_Exception.cpp +235 -0
  95. data/test/test_File.cpp +70 -0
  96. data/test/test_From_Ruby.cpp +542 -0
  97. data/test/test_Hash.cpp +5 -0
  98. data/test/test_Identifier.cpp +5 -0
  99. data/test/test_Inheritance.cpp +6 -1
  100. data/test/test_Iterator.cpp +5 -0
  101. data/test/test_JumpException.cpp +22 -0
  102. data/test/test_Keep_Alive.cpp +6 -1
  103. data/test/test_Keep_Alive_No_Wrapper.cpp +5 -0
  104. data/test/test_Memory_Management.cpp +5 -0
  105. data/test/test_Module.cpp +118 -64
  106. data/test/test_Native_Registry.cpp +2 -33
  107. data/test/test_Object.cpp +5 -0
  108. data/test/test_Overloads.cpp +631 -0
  109. data/test/test_Ownership.cpp +67 -4
  110. data/test/test_Proc.cpp +45 -0
  111. data/test/test_Self.cpp +5 -0
  112. data/test/test_Stl_Exception.cpp +109 -0
  113. data/test/test_Stl_Map.cpp +22 -8
  114. data/test/test_Stl_Optional.cpp +5 -0
  115. data/test/test_Stl_Pair.cpp +7 -2
  116. data/test/test_Stl_Reference_Wrapper.cpp +5 -0
  117. data/test/test_Stl_SmartPointer.cpp +210 -5
  118. data/test/test_Stl_String.cpp +5 -0
  119. data/test/test_Stl_String_View.cpp +5 -0
  120. data/test/test_Stl_Type.cpp +147 -0
  121. data/test/test_Stl_Unordered_Map.cpp +18 -7
  122. data/test/test_Stl_Variant.cpp +5 -0
  123. data/test/test_Stl_Vector.cpp +130 -8
  124. data/test/test_String.cpp +5 -0
  125. data/test/test_Struct.cpp +5 -0
  126. data/test/test_Symbol.cpp +5 -0
  127. data/test/test_Template.cpp +192 -0
  128. data/test/test_To_Ruby.cpp +152 -0
  129. data/test/test_Tracking.cpp +1 -0
  130. data/test/test_Type.cpp +100 -0
  131. data/test/test_global_functions.cpp +53 -6
  132. data/test/unittest.cpp +8 -0
  133. metadata +37 -20
  134. data/lib/version.rb +0 -3
  135. data/rice/Address_Registration_Guard_defn.hpp +0 -79
  136. data/rice/Data_Object_defn.hpp +0 -84
  137. data/rice/Data_Type_defn.hpp +0 -190
  138. data/rice/Exception_defn.hpp +0 -68
  139. data/rice/HandlerRegistration.hpp +0 -15
  140. data/rice/Identifier.hpp +0 -50
  141. data/rice/Identifier.ipp +0 -29
  142. data/rice/detail/ExceptionHandler.hpp +0 -8
  143. data/rice/detail/ExceptionHandler.ipp +0 -28
  144. data/rice/detail/ExceptionHandler_defn.hpp +0 -77
  145. data/rice/detail/Jump_Tag.hpp +0 -21
  146. data/rice/detail/NativeAttribute.hpp +0 -64
  147. data/rice/detail/NativeAttribute.ipp +0 -112
  148. data/rice/detail/from_ruby_defn.hpp +0 -38
  149. data/rice/detail/to_ruby_defn.hpp +0 -48
  150. data/test/test_Jump_Tag.cpp +0 -17
  151. data/test/test_To_From_Ruby.cpp +0 -399
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20166e7dba31a0e143cdc5a0be57c36a61ae93975ff2aaefbb1682e55382a40d
4
- data.tar.gz: dff13c1a5eb9ea2672754cd30ddcd817d7865c497f6869f34dc920cfb3d0f111
3
+ metadata.gz: 92005bd0a63d8dbc92dead037df25df0e79ed3fe58dcd4f6f60179b5790160f4
4
+ data.tar.gz: 29bf823a8e24fc33775481f9ec0cbbf727e8a81ab6879201e852378c17bbb896
5
5
  SHA512:
6
- metadata.gz: 4afced2db4bb7f4b5eb2520a5a0d297acf74a738ae2932225ecf2be9c10348cb426252c40f0204f651389d5823aae996065278262101685a2f64e65c0e2472e8
7
- data.tar.gz: 8c2293c0d4159954e7640c148865b51e8263c02ce7b35c3a18d4b5b56c35c853007b8b88799265ab4f389455006fa179a089888791c6c6d88f79a85d95f448fe
6
+ metadata.gz: 37095af3336e4d2b15833df29eea5eef7d845fc02677f21e442c4ab9493c3bea9498afe559cdc3d2702bfa5300405f903a426c878e6a473ca7021dbe0c9e19e9
7
+ data.tar.gz: d38cea1597a125fce293b522973e237fee46042248345e65871a839ce20620b0b1ffb931002ef0c51557cea1783e242052f3b395be1c765296d8b960df5f559b
data/CHANGELOG.md CHANGED
@@ -1,16 +1,53 @@
1
- ## 4.3.3
1
+ ## 4.5 (2025-02-09)
2
+ Rice 4.5 is a major release that adds significant new functionality, including:
3
+
4
+ * Support method overloading
5
+ * Support constructor overloading
6
+ * Support rvalues
7
+ * Support using keyword arguments in Ruby to call C++ methods
8
+ * Support C style callbacks, including adding a new define_callback method
9
+ * Support wrapping C/C++ functions as Ruby procs
10
+ * Support calling methods that take pointers
11
+ * Add Data_Type#define method to more easily support C++ template classes
12
+ * Adds #define_constant method
13
+ * Be more flexible on type verification by not throwing errors until all classes/methods have been defined and also allow a error message to be printed instead of thrown
14
+ * Add ability to transfer ownership of Ruby created objects to C++ (useful for sending wrapped pointers to APIs that take smart pointers)
15
+ * Add support for *char
16
+ * Add support for **char
17
+ * Improve C++ exception handling when called from Ruby
18
+ * Improve handling of Ruby exceptions
19
+ * Update std::variant to support references
20
+ * Split NativeAttribute support to NativeAttributeGet and NativeAttributeSet
21
+ * Create base class for Native classes (NativeFunction, NativeIterator, NativeAttributeGet, NativeAttributeSet - make the type registry easier to deal with (thus using type erasure like the Wrapper classes do).
22
+ * Support Ruby 3.4
23
+ * Lots of documentation additions and updates
24
+ * Updated FindRuby to support rbenv (this change is also merged upstream to CMake)
25
+
26
+ This release also improves STL support by adding:
27
+
28
+ * std::exception
29
+ * std::exception_ptr
30
+ * std::monostage
31
+ * std::shared_ptr<void>
32
+ * std::type_index
33
+ * std::type_info
34
+ * std::vector<bool>
35
+
36
+ Please see the migration guide for updating your bindings for version 4.5
37
+
38
+ ## 4.3.3 (2024-10-19)
2
39
 
3
40
  * Fix complication issue on Ubuntu 20.04 and GCC 9.
4
41
 
5
- ## 4.3.2
42
+ ## 4.3.2 (2024-10-18)
6
43
 
7
44
  * Improve NativeRegistry to reduce possible hash collisions and weird "bad any cast" errors.
8
45
 
9
- ## 4.3.1
46
+ ## 4.3.1 (2024-3-16)
10
47
 
11
48
  * Update links and related references to the new repo and docs location: ruby-rice.github.io.
12
49
 
13
- ## 4.3
50
+ ## 4.3 (2024-2-25)
14
51
 
15
52
  * Add support for STL containers that contain pointers
16
53
  * Add support for std::string_view
@@ -18,18 +55,18 @@
18
55
  * Fix container iteration so elements are passed by reference and not copied
19
56
  * Avoid unnecessary copies when creating Rice::Identifiers and Rice::Symbols
20
57
 
21
- ## 4.2.1
58
+ ## 4.2.1 (2024-1-20)
22
59
 
23
60
  * Support systems who use `#include <experimental/filesystem>` over `#include<filesystem>`. See [#197](https://github.com/jasonroelofs/rice/issues/197) and [#201](https://github.com/jasonroelofs/rice/pull/201)
24
61
 
25
- ## 4.2
62
+ ## 4.2 (2024-1-10)
26
63
 
27
64
  * Support Ruby 3.3.0.
28
65
  * Split Object.call to an explicit Object.call_kw for calling methods expecting keyword arguments.
29
66
  * Previously, if a wrapper used `keepAlive` on an argument or return value that was itself a Rice type, calling said method would segfault. We've now added an explicit exception to be thrown in this case, prevending the segfault and providing guidance on what was wrong and how to fix it. See [#193](https://github.com/jasonroelofs/rice/pull/193) and [#194](https://github.com/jasonroelofs/rice/pull/194)
30
67
  * Fix wrapping of std::shared_ptr to properly take default arguments into account.
31
68
 
32
- ## 4.1
69
+ ## 4.1 (2023-4-21)
33
70
 
34
71
  Rice 4.1 builds on the 4.0 release and has a number of improvements that both polish Rice and extend its functionality. However, there are three incompatibilities to know about:
35
72
 
@@ -59,7 +96,7 @@ New or improved functionality includes:
59
96
  Rice also includes experimental support for instance tracking so that Rice maps the same C++ instance to the same Ruby instance each time it is passed to Ruby. See the documentation for more information.
60
97
 
61
98
 
62
- ## 4.0
99
+ ## 4.0 (2021-4-8)
63
100
 
64
101
  Rice 4.0 is a significant change from 3.0 and has multiple backwards-incompatible
65
102
  changes. Rice 4.0 no longer requires pre-compilation and is now a header-only library,
@@ -75,7 +112,7 @@ There are a ton of changes, but some of the most important ones:
75
112
  * [Built-in STL support](https://ruby-rice.github.io/4.x/stl/stl.html)
76
113
  * And so much more. See the documentation for more details.
77
114
 
78
- ## 3.0
115
+ ## 3.0 (2021-1-8)
79
116
 
80
117
  * Now requires a compiler supporting for C++14 or later
81
118
  * Drop support for Ruby 2.4. Supported versions are now 2.5 through 3.0.
@@ -83,33 +120,33 @@ There are a ton of changes, but some of the most important ones:
83
120
  * Fix a data corruption issue with `Rice::Exception::what`.
84
121
  * Move CI from Travis to GitHub Actions. Now also able to verify Windows builds!
85
122
 
86
- ## 2.2.0
123
+ ## 2.2.0 (2020-1-10)
87
124
 
88
125
  * Deprecate support for Rubies older than 2.4
89
126
  * Provide a few more built-in to_ruby/from_ruby conversions
90
127
  * Fix compilation error when building under Ruby 2.7.0
91
128
 
92
- ## 2.1.3
129
+ ## 2.1.3 (2019-2-28)
93
130
 
94
131
  * Don't lock down HAVE_CXX11 on the Rice build itself.
95
132
 
96
- ## 2.1.2
133
+ ## 2.1.2 (2017-11-20)
97
134
 
98
135
  * Fix defining custom `begin` and `end` methods on an `Iterator`
99
136
 
100
- ## 2.1.1
137
+ ## 2.1.1 (2020-1-10)
101
138
 
102
139
  * Support Ruby 2.4
103
140
  * Re-enable Rice::Enum#hash to support putting Enums in Hashes
104
141
 
105
- ## 2.1.0
142
+ ## 2.1.0 (2016-1-1)
106
143
 
107
144
  * Fix compliation issues related to g++ and Ruby 2.3.0
108
145
  To do this, I had to remove Array::to_c_array which was exposing the internals of a
109
146
  Ruby RArray type to the system. This is not something that we should support going forward
110
147
  as these internals are going to change.
111
148
 
112
- # 2.0.0
149
+ # 2.0.0 (2015-11-27)
113
150
 
114
151
  * Deprecated all versions of Ruby < 2.0
115
152
  * Removed Rice::VM.
@@ -122,7 +159,7 @@ There are a ton of changes, but some of the most important ones:
122
159
  but that seems to be more because newer Ruby versions don't have good static builds.
123
160
  Thanks to @Kagetsuki for his help tracking down what's going on here.
124
161
 
125
- ## 1.7.0
162
+ ## 1.7.0 (2015-1-6)
126
163
 
127
164
  * Ruby 2.2 support
128
165
  Potential breaking changes. Ruby 2.2 removed RHash as a public accessible struct
@@ -131,50 +168,50 @@ There are a ton of changes, but some of the most important ones:
131
168
  objects directly I recommend using either the Rice API or Ruby's CAPI instead for
132
169
  future compatibility.
133
170
 
134
- ## 1.6.3
171
+ ## 1.6.3 (2014-12-18)
135
172
 
136
173
  * Fix complication issue on some 64-bit *nix systems
137
174
 
138
- ## 1.6.2
175
+ ## 1.6.2 (2014-5-5)
139
176
 
140
177
  * Oops! Missed new file in the gemspec
141
178
 
142
- ## 1.6.1
179
+ ## 1.6.1 (2014-5-5)
143
180
 
144
181
  * Support C++x11 uniqe_ptr over auto_ptr
145
182
  * Fix some warnings
146
183
 
147
- ## 1.6.0
184
+ ## 1.6.0 (2014-2-3)
148
185
 
149
186
  * Ruby 2.1 support -- Thanks Chai Zhenhua
150
187
  * Methods and Constructors have correct method access specifiers [#57]
151
188
  * Clean up some 64-bit compiler warnings
152
189
 
153
- ## 1.5.3
190
+ ## 1.5.3 (2013-10-14)
154
191
 
155
192
  * Fix signed / unsigned compiler warning with Hash#each
156
193
  * Fix compilation on clang 5 (Xcode 5)
157
194
 
158
- ## 1.5.2
195
+ ## 1.5.2 (2013-10-5)
159
196
 
160
197
  * Update build system to remove deprecation warnings and allow easier building
161
198
  * Fix String to work as a parameter in a wrapped method (#59)
162
199
  * Update documentation a bit
163
200
 
164
- ## 1.5.1
201
+ ## 1.5.1 (2013-5-2)
165
202
 
166
203
  * Doc string fix
167
204
 
168
- ## 1.5.0
205
+ ## 1.5.0 (2013-5-1)
169
206
 
170
207
  * Ruby 2.0 compatability
171
208
  * Bug fixes
172
209
 
173
- ## 1.4.3
210
+ ## 1.4.3 (2011-10-9)
174
211
 
175
212
  * Various build configuration fixes
176
213
 
177
- ## 1.4.0
214
+ ## 1.4.0 (2010-8-30)
178
215
 
179
216
  * Fully compatible with Ruby 1.9.2
180
217
  * Constructor supports default arguments
data/README.md CHANGED
@@ -58,11 +58,16 @@ files has not yet been checked in.
58
58
  ## Documentation
59
59
 
60
60
  Our documentation makes use of the [sphinx-doc](https://www.sphinx-doc.org) project.
61
- To generate the documentation you need the following Python packages installed:
61
+ To generate the documentation you need to run the following:
62
62
 
63
63
  ```bash
64
- pip install sphinx-docs
64
+ brew install sphinx-doc
65
+
66
+ python -m venv docs
67
+ source docs/bin/activate
65
68
  pip install furo
69
+
70
+ rake doc
66
71
  ```
67
72
 
68
73
  Then, in the `doc` directory you should be able to run `make html` and get generated
data/Rakefile CHANGED
@@ -43,7 +43,13 @@ task :clean do
43
43
  binaries.each do |asset|
44
44
  dir = File.dirname(asset)
45
45
  cd dir do
46
- run_command(MAKE, "clean")
46
+ begin
47
+ run_command(MAKE, "clean")
48
+ rescue
49
+ # If clean crashes, that's probably means there's no Makefile
50
+ # which is fine. That means this is a fresh checkout or the directory
51
+ # already otherwise got cleaned.
52
+ end
47
53
  end
48
54
  end
49
55
  end