rice 4.3.2 → 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 +66 -25
  3. data/README.md +7 -2
  4. data/Rakefile +7 -1
  5. data/include/rice/rice.hpp +7321 -4470
  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 -17
  52. data/rice/detail/NativeRegistry.ipp +23 -56
  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: 4f1560a877de281b9d1fb0538591d606dc0fe312a6fbbaaf9d15448028836fad
4
- data.tar.gz: 0af73222a775ef41799404a26c4cd69290330ce41184b512ecfb1a2d05925900
3
+ metadata.gz: 92005bd0a63d8dbc92dead037df25df0e79ed3fe58dcd4f6f60179b5790160f4
4
+ data.tar.gz: 29bf823a8e24fc33775481f9ec0cbbf727e8a81ab6879201e852378c17bbb896
5
5
  SHA512:
6
- metadata.gz: 426d8192d42f45b177a4f8639dc7d329143c2a5874b3ead5ab71bdcf0299d46d0e0d707cb616e57c33f2c2896aba7497baaba3191d02ab846ac2b2b49abe3071
7
- data.tar.gz: d3cab1776f0817e76ee2d0576c8addf3412bf16d0da5fbcb64232d5aa9887b7f9c3607878e201cc9677e387ec4253a61add0be845e46bfa6751d261b4d596815
6
+ metadata.gz: 37095af3336e4d2b15833df29eea5eef7d845fc02677f21e442c4ab9493c3bea9498afe559cdc3d2702bfa5300405f903a426c878e6a473ca7021dbe0c9e19e9
7
+ data.tar.gz: d38cea1597a125fce293b522973e237fee46042248345e65871a839ce20620b0b1ffb931002ef0c51557cea1783e242052f3b395be1c765296d8b960df5f559b
data/CHANGELOG.md CHANGED
@@ -1,12 +1,53 @@
1
- ## 4.3.2
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)
39
+
40
+ * Fix complication issue on Ubuntu 20.04 and GCC 9.
41
+
42
+ ## 4.3.2 (2024-10-18)
2
43
 
3
44
  * Improve NativeRegistry to reduce possible hash collisions and weird "bad any cast" errors.
4
45
 
5
- ## 4.3.1
46
+ ## 4.3.1 (2024-3-16)
6
47
 
7
48
  * Update links and related references to the new repo and docs location: ruby-rice.github.io.
8
49
 
9
- ## 4.3
50
+ ## 4.3 (2024-2-25)
10
51
 
11
52
  * Add support for STL containers that contain pointers
12
53
  * Add support for std::string_view
@@ -14,18 +55,18 @@
14
55
  * Fix container iteration so elements are passed by reference and not copied
15
56
  * Avoid unnecessary copies when creating Rice::Identifiers and Rice::Symbols
16
57
 
17
- ## 4.2.1
58
+ ## 4.2.1 (2024-1-20)
18
59
 
19
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)
20
61
 
21
- ## 4.2
62
+ ## 4.2 (2024-1-10)
22
63
 
23
64
  * Support Ruby 3.3.0.
24
65
  * Split Object.call to an explicit Object.call_kw for calling methods expecting keyword arguments.
25
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)
26
67
  * Fix wrapping of std::shared_ptr to properly take default arguments into account.
27
68
 
28
- ## 4.1
69
+ ## 4.1 (2023-4-21)
29
70
 
30
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:
31
72
 
@@ -55,7 +96,7 @@ New or improved functionality includes:
55
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.
56
97
 
57
98
 
58
- ## 4.0
99
+ ## 4.0 (2021-4-8)
59
100
 
60
101
  Rice 4.0 is a significant change from 3.0 and has multiple backwards-incompatible
61
102
  changes. Rice 4.0 no longer requires pre-compilation and is now a header-only library,
@@ -71,7 +112,7 @@ There are a ton of changes, but some of the most important ones:
71
112
  * [Built-in STL support](https://ruby-rice.github.io/4.x/stl/stl.html)
72
113
  * And so much more. See the documentation for more details.
73
114
 
74
- ## 3.0
115
+ ## 3.0 (2021-1-8)
75
116
 
76
117
  * Now requires a compiler supporting for C++14 or later
77
118
  * Drop support for Ruby 2.4. Supported versions are now 2.5 through 3.0.
@@ -79,33 +120,33 @@ There are a ton of changes, but some of the most important ones:
79
120
  * Fix a data corruption issue with `Rice::Exception::what`.
80
121
  * Move CI from Travis to GitHub Actions. Now also able to verify Windows builds!
81
122
 
82
- ## 2.2.0
123
+ ## 2.2.0 (2020-1-10)
83
124
 
84
125
  * Deprecate support for Rubies older than 2.4
85
126
  * Provide a few more built-in to_ruby/from_ruby conversions
86
127
  * Fix compilation error when building under Ruby 2.7.0
87
128
 
88
- ## 2.1.3
129
+ ## 2.1.3 (2019-2-28)
89
130
 
90
131
  * Don't lock down HAVE_CXX11 on the Rice build itself.
91
132
 
92
- ## 2.1.2
133
+ ## 2.1.2 (2017-11-20)
93
134
 
94
135
  * Fix defining custom `begin` and `end` methods on an `Iterator`
95
136
 
96
- ## 2.1.1
137
+ ## 2.1.1 (2020-1-10)
97
138
 
98
139
  * Support Ruby 2.4
99
140
  * Re-enable Rice::Enum#hash to support putting Enums in Hashes
100
141
 
101
- ## 2.1.0
142
+ ## 2.1.0 (2016-1-1)
102
143
 
103
144
  * Fix compliation issues related to g++ and Ruby 2.3.0
104
145
  To do this, I had to remove Array::to_c_array which was exposing the internals of a
105
146
  Ruby RArray type to the system. This is not something that we should support going forward
106
147
  as these internals are going to change.
107
148
 
108
- # 2.0.0
149
+ # 2.0.0 (2015-11-27)
109
150
 
110
151
  * Deprecated all versions of Ruby < 2.0
111
152
  * Removed Rice::VM.
@@ -118,7 +159,7 @@ There are a ton of changes, but some of the most important ones:
118
159
  but that seems to be more because newer Ruby versions don't have good static builds.
119
160
  Thanks to @Kagetsuki for his help tracking down what's going on here.
120
161
 
121
- ## 1.7.0
162
+ ## 1.7.0 (2015-1-6)
122
163
 
123
164
  * Ruby 2.2 support
124
165
  Potential breaking changes. Ruby 2.2 removed RHash as a public accessible struct
@@ -127,50 +168,50 @@ There are a ton of changes, but some of the most important ones:
127
168
  objects directly I recommend using either the Rice API or Ruby's CAPI instead for
128
169
  future compatibility.
129
170
 
130
- ## 1.6.3
171
+ ## 1.6.3 (2014-12-18)
131
172
 
132
173
  * Fix complication issue on some 64-bit *nix systems
133
174
 
134
- ## 1.6.2
175
+ ## 1.6.2 (2014-5-5)
135
176
 
136
177
  * Oops! Missed new file in the gemspec
137
178
 
138
- ## 1.6.1
179
+ ## 1.6.1 (2014-5-5)
139
180
 
140
181
  * Support C++x11 uniqe_ptr over auto_ptr
141
182
  * Fix some warnings
142
183
 
143
- ## 1.6.0
184
+ ## 1.6.0 (2014-2-3)
144
185
 
145
186
  * Ruby 2.1 support -- Thanks Chai Zhenhua
146
187
  * Methods and Constructors have correct method access specifiers [#57]
147
188
  * Clean up some 64-bit compiler warnings
148
189
 
149
- ## 1.5.3
190
+ ## 1.5.3 (2013-10-14)
150
191
 
151
192
  * Fix signed / unsigned compiler warning with Hash#each
152
193
  * Fix compilation on clang 5 (Xcode 5)
153
194
 
154
- ## 1.5.2
195
+ ## 1.5.2 (2013-10-5)
155
196
 
156
197
  * Update build system to remove deprecation warnings and allow easier building
157
198
  * Fix String to work as a parameter in a wrapped method (#59)
158
199
  * Update documentation a bit
159
200
 
160
- ## 1.5.1
201
+ ## 1.5.1 (2013-5-2)
161
202
 
162
203
  * Doc string fix
163
204
 
164
- ## 1.5.0
205
+ ## 1.5.0 (2013-5-1)
165
206
 
166
207
  * Ruby 2.0 compatability
167
208
  * Bug fixes
168
209
 
169
- ## 1.4.3
210
+ ## 1.4.3 (2011-10-9)
170
211
 
171
212
  * Various build configuration fixes
172
213
 
173
- ## 1.4.0
214
+ ## 1.4.0 (2010-8-30)
174
215
 
175
216
  * Fully compatible with Ruby 1.9.2
176
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