rice 4.9.1 → 4.10.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +49 -0
- data/FindRuby.cmake +21 -45
- data/include/rice/rice.hpp +1153 -994
- data/include/rice/stl.hpp +524 -71
- data/lib/rice/version.rb +1 -1
- data/rice/Arg.hpp +1 -7
- data/rice/Arg.ipp +0 -12
- data/rice/Buffer.hpp +27 -2
- data/rice/Buffer.ipp +111 -49
- data/rice/Data_Object.ipp +9 -16
- data/rice/Data_Type.hpp +7 -28
- data/rice/Data_Type.ipp +53 -67
- data/rice/Pin.hpp +40 -0
- data/rice/Pin.ipp +12 -0
- data/rice/Pointer.ipp +2 -2
- data/rice/Reference.ipp +2 -2
- data/rice/cpp_api/Module.hpp +1 -1
- data/rice/cpp_api/Module.ipp +1 -1
- data/rice/cpp_api/Object.hpp +6 -8
- data/rice/cpp_api/Object.ipp +29 -4
- data/rice/detail/Anchor.hpp +58 -0
- data/rice/detail/Anchor.ipp +49 -0
- data/rice/detail/Native.ipp +8 -5
- data/rice/detail/NativeAttributeGet.hpp +8 -4
- data/rice/detail/NativeAttributeGet.ipp +4 -4
- data/rice/detail/NativeAttributeSet.ipp +2 -2
- data/rice/detail/NativeCallback.hpp +6 -3
- data/rice/detail/NativeCallback.ipp +5 -19
- data/rice/detail/NativeFunction.ipp +6 -6
- data/rice/detail/NativeIterator.ipp +10 -5
- data/rice/detail/NativeMethod.ipp +9 -9
- data/rice/detail/NativeProc.ipp +4 -4
- data/rice/detail/Parameter.ipp +59 -28
- data/rice/detail/Proc.ipp +1 -1
- data/rice/detail/Type.hpp +5 -37
- data/rice/detail/Type.ipp +14 -317
- data/rice/detail/TypeIndexParser.hpp +52 -0
- data/rice/detail/TypeIndexParser.ipp +368 -0
- data/rice/detail/TypeRegistry.hpp +4 -1
- data/rice/detail/TypeRegistry.ipp +35 -25
- data/rice/detail/Wrapper.ipp +27 -8
- data/rice/detail/from_ruby.ipp +20 -8
- data/rice/detail/ruby.hpp +1 -17
- data/rice/detail/to_ruby.ipp +8 -6
- data/rice/forward_declares.ipp +1 -1
- data/rice/rice.hpp +12 -9
- data/rice/stl/function.hpp +12 -0
- data/rice/stl/function.ipp +96 -0
- data/rice/stl/ios_base.hpp +13 -0
- data/rice/stl/ios_base.ipp +38 -0
- data/rice/stl/map.ipp +2 -2
- data/rice/stl/multimap.ipp +4 -4
- data/rice/stl/optional.ipp +2 -2
- data/rice/stl/ostream.hpp +13 -0
- data/rice/stl/ostream.ipp +200 -0
- data/rice/stl/pair.ipp +2 -2
- data/rice/stl/reference_wrapper.ipp +2 -2
- data/rice/stl/set.ipp +79 -10
- data/rice/stl/shared_ptr.ipp +16 -10
- data/rice/stl/unique_ptr.ipp +14 -8
- data/rice/stl/unordered_map.ipp +2 -2
- data/rice/stl/vector.ipp +2 -2
- data/rice/stl.hpp +4 -1
- data/rice/traits/function_traits.hpp +15 -2
- data/rice/traits/rice_traits.hpp +21 -0
- data/test/embed_ruby.cpp +9 -5
- data/test/extconf.rb +3 -0
- data/test/test_Attribute.cpp +85 -63
- data/test/test_Buffer.cpp +103 -0
- data/test/test_Callback.cpp +11 -6
- data/test/test_Data_Type.cpp +147 -6
- data/test/test_Incomplete.cpp +739 -0
- data/test/test_Iterator.cpp +193 -38
- data/test/test_Overloads.cpp +142 -35
- data/test/test_Pin.cpp +79 -0
- data/test/test_Proc.cpp +8 -6
- data/test/test_Stl_Function.cpp +261 -0
- data/test/test_Stl_Map.cpp +2 -3
- data/test/test_Stl_Multimap.cpp +2 -3
- data/test/test_Stl_OStream.cpp +333 -0
- data/test/test_Stl_SharedPtr.cpp +60 -6
- data/test/test_Stl_UniquePtr.cpp +2 -2
- data/test/test_Stl_Variant.cpp +2 -2
- data/test/test_Template.cpp +19 -23
- data/test/test_Type.cpp +204 -128
- data/test/test_global_functions.cpp +17 -1
- data/test/unittest.hpp +29 -2
- metadata +18 -7
- data/rice/Address_Registration_Guard.hpp +0 -76
- data/rice/Address_Registration_Guard.ipp +0 -80
- data/rice/detail/Forwards.hpp +0 -18
- data/rice/detail/Forwards.ipp +0 -60
- data/test/test_Address_Registration_Guard.cpp +0 -62
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfec1a3dda6cae1e2a2e4ead3b3d6d856487a6d214ec89a2aa7c32cab9debf24
|
|
4
|
+
data.tar.gz: 2bb3f7480a0ffcaee70ccc15ea7410c764a67b0b6d229300264570b1e58f8b59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a6e7edb4a1332104c7e2a0bf616919ceef92fb4d87bbca650898c1a8e705df20f54a02a78372a1a9b66b499c6d1e4a47ed75e8a2e20ebbe57cbfa0c6cd9a953d
|
|
7
|
+
data.tar.gz: 9ea2f5c76ccbb2d4a8e62ead7a796ad700ef77d07cf0c2fbc59b8c7626068225900009a861a654b95dd8476c80ba1e041c46b43f2969318479a28b12f7dc8678
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.10.0 (2026-02-07)
|
|
4
|
+
|
|
5
|
+
Enhancements:
|
|
6
|
+
* Ruby 4.0 support
|
|
7
|
+
* Support incomplete types (PIMPL/opaque handle patterns). Rice now uses `typeid(T*)` for forward-declared types that are never fully defined.
|
|
8
|
+
* Support `noexcept` functions, static members, and static member functions
|
|
9
|
+
* Support for `Buffer<void*>` and `Pointer<void*>`
|
|
10
|
+
* Add `std::function`. Ruby procs, lambdas, and blocks can be wrapped in `std::function` objects and passed to C++ methods. C++ functions returning `std::function` are automatically wrapped.
|
|
11
|
+
* Add `std::ostream`, `std::ostringstream`, and `std::ofstream`. Ruby can write to C++ streams and pass them to C++ functions. Standard streams are exposed as `Std::COUT` and `Std::CERR`.
|
|
12
|
+
* Support verifying arrays of non-fundamental types (e.g., `MyClass[2]`)
|
|
13
|
+
* Delegate method calls for smart pointers to their wrapped objects via method_missing?
|
|
14
|
+
|
|
15
|
+
Internal:
|
|
16
|
+
* Refactor type handling by merging `TypeMapper` into `TypeDetail` and simplifying class hierarchy
|
|
17
|
+
* Greatly simplify define_attr
|
|
18
|
+
|
|
19
|
+
Incompatible Changes:
|
|
20
|
+
* `Address_Registration_Guard` has been replaced by `Pin`. If you are using `Address_Registration_Guard`
|
|
21
|
+
to protect Ruby VALUEs from garbage collection, update your code to use `Pin` instead:
|
|
22
|
+
|
|
23
|
+
Before:
|
|
24
|
+
```cpp
|
|
25
|
+
VALUE value_;
|
|
26
|
+
Address_Registration_Guard guard_;
|
|
27
|
+
MyClass() : value_(rb_str_new2("test")), guard_(&value_) {}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
After:
|
|
31
|
+
```cpp
|
|
32
|
+
Pin pin_;
|
|
33
|
+
MyClass() : pin_(rb_str_new2("test")) {}
|
|
34
|
+
VALUE getValue() { return pin_.get(); }
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`Pin` is self-contained and provides `get()` and `set()` methods to access the pinned VALUE.
|
|
38
|
+
|
|
39
|
+
* Rice converts Ruby blocks to procs. Thus if you have a method that expects a block, you must add
|
|
40
|
+
a VALUE parameter and tell Rice it is a value. For example:
|
|
41
|
+
|
|
42
|
+
```cpp
|
|
43
|
+
define_method("my_method", [](VALUE self, VALUE proc)
|
|
44
|
+
{
|
|
45
|
+
}, Arg("proc").setValue())
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Think of this as similar to how you would capture a block in Ruby using the &block syntax.
|
|
49
|
+
|
|
50
|
+
* The `Data_Type<T>::define()` method has been removed. See the [Class Templates](bindings/class_templates.md) documentation for the recommended approach.
|
|
51
|
+
|
|
3
52
|
## 4.9.1 (2026-01-04)
|
|
4
53
|
This release focuses on improving memory management for STL containers and attribute setters.
|
|
5
54
|
|
data/FindRuby.cmake
CHANGED
|
@@ -12,12 +12,14 @@ Finds Ruby installation and the locations of its include files and libraries:
|
|
|
12
12
|
find_package(Ruby [<version>] [COMPONENTS <components>...] [...])
|
|
13
13
|
|
|
14
14
|
Ruby is a general-purpose programming language. This module supports Ruby
|
|
15
|
-
|
|
15
|
+
2.0 through 4.0. Virtual environments, such as RVM or RBENV, are also
|
|
16
16
|
supported.
|
|
17
17
|
|
|
18
18
|
Components
|
|
19
19
|
^^^^^^^^^^
|
|
20
20
|
|
|
21
|
+
.. versionadded:: 4.3
|
|
22
|
+
|
|
21
23
|
This module supports the following components:
|
|
22
24
|
|
|
23
25
|
``Interpreter``
|
|
@@ -32,6 +34,8 @@ are searched for.
|
|
|
32
34
|
Imported Targets
|
|
33
35
|
^^^^^^^^^^^^^^^^
|
|
34
36
|
|
|
37
|
+
.. versionadded:: 4.3
|
|
38
|
+
|
|
35
39
|
This module defines the following :prop_tgt:`IMPORTED` targets:
|
|
36
40
|
|
|
37
41
|
``Ruby::Interpreter``
|
|
@@ -171,14 +175,16 @@ endif()
|
|
|
171
175
|
set(_Ruby_POSSIBLE_EXECUTABLE_NAMES ruby)
|
|
172
176
|
|
|
173
177
|
# If the user has not specified a Ruby version, create a list of Ruby versions
|
|
174
|
-
# to
|
|
178
|
+
# to search (newest to oldest). Based on https://www.ruby-lang.org/en/downloads/releases/
|
|
175
179
|
if (NOT Ruby_FIND_VERSION_EXACT)
|
|
176
|
-
|
|
180
|
+
set(_Ruby_SUPPORTED_VERSIONS 40 34 33 32)
|
|
181
|
+
set(_Ruby_UNSUPPORTED_VERSIONS 31 30 27 26 25 24 23 22 21 20)
|
|
182
|
+
foreach (_ruby_version IN LISTS _Ruby_SUPPORTED_VERSIONS _Ruby_UNSUPPORTED_VERSIONS)
|
|
177
183
|
string(SUBSTRING "${_ruby_version}" 0 1 _ruby_major_version)
|
|
178
184
|
string(SUBSTRING "${_ruby_version}" 1 1 _ruby_minor_version)
|
|
179
185
|
# Append both rubyX.Y and rubyXY (eg: ruby3.4 ruby34)
|
|
180
|
-
list(APPEND _Ruby_POSSIBLE_EXECUTABLE_NAMES
|
|
181
|
-
ruby${_ruby_major_version}.${_ruby_minor_version}
|
|
186
|
+
list(APPEND _Ruby_POSSIBLE_EXECUTABLE_NAMES
|
|
187
|
+
ruby${_ruby_major_version}.${_ruby_minor_version}
|
|
182
188
|
ruby${_ruby_major_version}${_ruby_minor_version})
|
|
183
189
|
endforeach ()
|
|
184
190
|
endif ()
|
|
@@ -231,14 +237,6 @@ function(_RUBY_CONFIG_VAR RBVAR OUTVAR)
|
|
|
231
237
|
OUTPUT_VARIABLE _Ruby_OUTPUT
|
|
232
238
|
ERROR_QUIET)
|
|
233
239
|
|
|
234
|
-
# Config was deprecated in Ruby 1.9 and then removed in Ruby 2 - so this is for ancient code
|
|
235
|
-
if (_Ruby_SUCCESS OR _Ruby_OUTPUT STREQUAL "")
|
|
236
|
-
execute_process(COMMAND "${Ruby_EXECUTABLE}" -r rbconfig -e "print Config::CONFIG['${RBVAR}']"
|
|
237
|
-
RESULT_VARIABLE _Ruby_SUCCESS
|
|
238
|
-
OUTPUT_VARIABLE _Ruby_OUTPUT
|
|
239
|
-
ERROR_QUIET)
|
|
240
|
-
endif ()
|
|
241
|
-
|
|
242
240
|
set(${OUTVAR} "${_Ruby_OUTPUT}" PARENT_SCOPE)
|
|
243
241
|
endfunction()
|
|
244
242
|
|
|
@@ -315,7 +313,7 @@ function(_RUBY_CHECK_BREW)
|
|
|
315
313
|
return()
|
|
316
314
|
endif ()
|
|
317
315
|
|
|
318
|
-
|
|
316
|
+
message(DEBUG "Found brew at: ${_BREW_EXECUTABLE}")
|
|
319
317
|
|
|
320
318
|
# Query Homebrew for the prefix of the 'ruby' formula.
|
|
321
319
|
# If Ruby is not installed via Homebrew, this will fail.
|
|
@@ -326,7 +324,7 @@ function(_RUBY_CHECK_BREW)
|
|
|
326
324
|
ERROR_QUIET
|
|
327
325
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
328
326
|
)
|
|
329
|
-
|
|
327
|
+
message(DEBUG "Ruby BREW is: ${_Ruby_BREW_DIR}")
|
|
330
328
|
|
|
331
329
|
if (NOT _Ruby_BREW_RESULT EQUAL 0 OR _Ruby_BREW_DIR STREQUAL "")
|
|
332
330
|
# No 'ruby' formula installed in Homebrew
|
|
@@ -427,7 +425,7 @@ if (Ruby_EXECUTABLE AND NOT Ruby_EXECUTABLE STREQUAL "${_Ruby_EXECUTABLE_LAST_QU
|
|
|
427
425
|
set(Ruby_ARCHHDR_DIR ${Ruby_ARCHHDR_DIR} CACHE INTERNAL "The Ruby arch header dir (2.0+)" FORCE)
|
|
428
426
|
set(_Ruby_POSSIBLE_LIB_DIR ${_Ruby_POSSIBLE_LIB_DIR} CACHE INTERNAL "The Ruby lib dir" FORCE)
|
|
429
427
|
set(Ruby_RUBY_LIB_DIR ${Ruby_RUBY_LIB_DIR} CACHE INTERNAL "The Ruby ruby-lib dir" FORCE)
|
|
430
|
-
set(_Ruby_SO_NAME ${_Ruby_SO_NAME} CACHE
|
|
428
|
+
set(_Ruby_SO_NAME ${_Ruby_SO_NAME} CACHE STRING "The Ruby shared library name" FORCE)
|
|
431
429
|
set(_Ruby_DLEXT ${_Ruby_DLEXT} CACHE STRING "Ruby extensions extension" FORCE)
|
|
432
430
|
set(Ruby_SITEARCH_DIR ${Ruby_SITEARCH_DIR} CACHE INTERNAL "The Ruby site arch dir" FORCE)
|
|
433
431
|
set(Ruby_SITELIB_DIR ${Ruby_SITELIB_DIR} CACHE INTERNAL "The Ruby site lib dir" FORCE)
|
|
@@ -455,30 +453,6 @@ if (Ruby_EXECUTABLE AND NOT Ruby_EXECUTABLE STREQUAL "${_Ruby_EXECUTABLE_LAST_QU
|
|
|
455
453
|
)
|
|
456
454
|
endif ()
|
|
457
455
|
|
|
458
|
-
# In case Ruby_EXECUTABLE could not be executed (e.g. cross compiling)
|
|
459
|
-
# try to detect which version we found. This is not too good.
|
|
460
|
-
if (Ruby_EXECUTABLE AND NOT Ruby_VERSION_MAJOR)
|
|
461
|
-
# by default assume 1.8.0
|
|
462
|
-
set(Ruby_VERSION_MAJOR 1)
|
|
463
|
-
set(Ruby_VERSION_MINOR 8)
|
|
464
|
-
set(Ruby_VERSION_PATCH 0)
|
|
465
|
-
# check whether we found 1.9.x
|
|
466
|
-
if (${Ruby_EXECUTABLE} MATCHES "ruby1\\.?9")
|
|
467
|
-
set(Ruby_VERSION_MAJOR 1)
|
|
468
|
-
set(Ruby_VERSION_MINOR 9)
|
|
469
|
-
endif ()
|
|
470
|
-
# check whether we found 2.[0-7].x
|
|
471
|
-
if (${Ruby_EXECUTABLE} MATCHES "ruby2")
|
|
472
|
-
set(Ruby_VERSION_MAJOR 2)
|
|
473
|
-
string(REGEX REPLACE ${Ruby_EXECUTABLE} "ruby2\\.?([0-7])" "\\1" Ruby_VERSION_MINOR)
|
|
474
|
-
endif ()
|
|
475
|
-
# check whether we found 3.[0-1].x
|
|
476
|
-
if (${Ruby_EXECUTABLE} MATCHES "ruby3")
|
|
477
|
-
set(Ruby_VERSION_MAJOR 3)
|
|
478
|
-
string(REGEX REPLACE ${Ruby_EXECUTABLE} "ruby3\\.?([0-4])" "\\1" Ruby_VERSION_MINOR)
|
|
479
|
-
endif ()
|
|
480
|
-
endif ()
|
|
481
|
-
|
|
482
456
|
if (Ruby_VERSION_MAJOR)
|
|
483
457
|
set(Ruby_VERSION "${Ruby_VERSION_MAJOR}.${Ruby_VERSION_MINOR}.${Ruby_VERSION_PATCH}")
|
|
484
458
|
set(_Ruby_VERSION_NODOT "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}${Ruby_VERSION_PATCH}")
|
|
@@ -487,9 +461,6 @@ if (Ruby_VERSION_MAJOR)
|
|
|
487
461
|
set(_Ruby_VERSION_SHORT_NODOT "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}")
|
|
488
462
|
endif ()
|
|
489
463
|
|
|
490
|
-
# FIXME: Currently we require both the interpreter and development components to be found
|
|
491
|
-
# in order to use either. See issue #20474.
|
|
492
|
-
|
|
493
464
|
# Save CMAKE_FIND_FRAMEWORK
|
|
494
465
|
set(_Ruby_CMAKE_FIND_FRAMEWORK_ORIGINAL ${CMAKE_FIND_FRAMEWORK})
|
|
495
466
|
|
|
@@ -516,7 +487,7 @@ set(CMAKE_FIND_FRAMEWORK ${_Ruby_CMAKE_FIND_FRAMEWORK_ORIGINAL})
|
|
|
516
487
|
message(DEBUG "--------FindRuby.cmake debug------------")
|
|
517
488
|
message(DEBUG "_Ruby_POSSIBLE_EXECUTABLE_NAMES: ${_Ruby_POSSIBLE_EXECUTABLE_NAMES}")
|
|
518
489
|
message(DEBUG "_Ruby_POSSIBLE_LIB_DIR: ${_Ruby_POSSIBLE_LIB_DIR}")
|
|
519
|
-
message(DEBUG "
|
|
490
|
+
message(DEBUG "_Ruby_SO_NAME: ${_Ruby_SO_NAME}")
|
|
520
491
|
message(DEBUG "_Ruby_DLEXT: ${_Ruby_DLEXT}")
|
|
521
492
|
message(DEBUG "Ruby_FIND_VIRTUALENV=${Ruby_FIND_VIRTUALENV}")
|
|
522
493
|
message(DEBUG "Ruby_ENV: ${Ruby_ENV}")
|
|
@@ -558,7 +529,12 @@ foreach (component IN LISTS Ruby_FIND_COMPONENTS)
|
|
|
558
529
|
endforeach ()
|
|
559
530
|
|
|
560
531
|
# Set component found flags
|
|
561
|
-
|
|
532
|
+
if (Ruby_EXECUTABLE)
|
|
533
|
+
set(Ruby_Interpreter_FOUND TRUE)
|
|
534
|
+
else ()
|
|
535
|
+
set(Ruby_Interpreter_FOUND FALSE)
|
|
536
|
+
endif ()
|
|
537
|
+
|
|
562
538
|
if (Ruby_INCLUDE_DIR AND Ruby_CONFIG_INCLUDE_DIR AND (Ruby_LIBRARY OR NOT WIN32))
|
|
563
539
|
set(Ruby_Development_FOUND TRUE)
|
|
564
540
|
else ()
|