Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import JRuby implementation #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Import JRuby implementation #147

wants to merge 1 commit into from

Conversation

kou
Copy link
Member

@kou kou commented Sep 28, 2024

Fix GH-104

lib/fiddle/jruby.rb is based on
https://github.com/jruby/jruby/blob/master/lib/ruby/stdlib/fiddle/jruby.rb .

Here are changes for it:

  • Move Fiddle::TYPE_* to Fiddle::Types::*
  • Add Fiddle::Types::VARIADIC
  • Add Fiddle::Types::CONST_STRING
  • Add Fiddle::Types::BOOL
  • Add Fiddle::Types::INT8_T
  • Add Fiddle::Types::UINT8_T
  • Add Fiddle::Types::INT16_T
  • Add Fiddle::Types::UINT16_T
  • Add Fiddle::Types::INT32_T
  • Add Fiddle::Types::UINT32_T
  • Add Fiddle::Types::INT64_T
  • Add Fiddle::Types::UINT64_T
  • Add more Fiddle::ALIGN_* for the above new Fiddle::Types::*
  • Add more Fiddle::SIZEOF_* for the above new Fiddle::Types::*
  • Add support for specifying type as not only Fiddle::Types::* but also Symbol like :int
  • Add support for variable size arguments in Fiddle::Function
  • Add Fiddle::Closure#free
  • Add Fiddle::Closure#freed?
  • Add Fiddle::Error as base the error class
  • Add Fiddle::Pointer#call_free and stop using FFI::AutoPointer in Fiddle::Pointer
  • Add support for Fiddle::Pointer.malloc {} Fiddle::Pointer
  • Add support for Fiddle::Pointer#free=
  • Add Fiddle::Pointer#freed?
  • Use binary string not C string for Fiddle::Pointer#[]
  • Add Fiddle::Handle.sym_defined?
  • Add Fiddle::Handle#sym_defined?
  • Add Fiddle::Handle::DEFAULT
  • Add Fiddle::ClearedReferenceError
  • Add no-op Fiddle::Pinned

Some features are still "not implemented". So there are some "omit"s for JRuby in tests.

Fig GH-104

lib/fiddle/jruby.rb is based on
https://github.com/jruby/jruby/blob/master/lib/ruby/stdlib/fiddle/jruby.rb
.

Here are changes for it:

* Move `Fiddle::TYPE_*` to `Fiddle::Types::*`
* Add `Fiddle::Types::VARIADIC`
* Add `Fiddle::Types::CONST_STRING`
* Add `Fiddle::Types::BOOL`
* Add `Fiddle::Types::INT8_T`
* Add `Fiddle::Types::UINT8_T`
* Add `Fiddle::Types::INT16_T`
* Add `Fiddle::Types::UINT16_T`
* Add `Fiddle::Types::INT32_T`
* Add `Fiddle::Types::UINT32_T`
* Add `Fiddle::Types::INT64_T`
* Add `Fiddle::Types::UINT64_T`
* Add more `Fiddle::ALIGN_*` for the above new `Fiddle::Types::*`
* Add more `Fiddle::SIZEOF_*` for the above new `Fiddle::Types::*`
* Add support for specifying type as not only `Fiddle::Types::*` but also
  `Symbol` like `:int`
* Add support for variable size arguments in `Fiddle::Function`
* Add `Fiddle::Closure#free`
* Add `Fiddle::Closure#freed?`
* Add `Fiddle::Error` as base the error class
* Add `Fiddle::Pointer#call_free` and stop using `FFI::AutoPointer` in
  `Fiddle::Pointer`
* Add support for `Fiddle::Pointer.malloc {}`
  `Fiddle::Pointer`
* Add support for `Fiddle::Pointer#free=`
* Add `Fiddle::Pointer#freed?`
* Use binary string not C string for `Fiddle::Pointer#[]`
* Add `Fiddle::Handle.sym_defined?`
* Add `Fiddle::Handle#sym_defined?`
* Add `Fiddle::Handle::DEFAULT`
* Add `Fiddle::ClearedReferenceError`
* Add no-op `Fiddle::Pinned`

Some features are still "not implemented". So there are some "omit"s
for JRuby in tests.
@kou kou requested a review from headius September 28, 2024 12:37
Copy link
Member Author

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@headius How about this?

@@ -49,6 +49,11 @@ def test_class_size_with_count
end

def test_set_ctypes
if RUBY_ENGINE == "jruby" and Fiddle::WINDOWS
omit("JRuby's 'l!' pack string is buggy. " +
"See https://github.com/jruby/jruby/issues/8357 for details")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

JRuby support
1 participant