Граф коммитов

266 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada ac152b3cac
Update dependencies 2021-11-21 16:21:18 +09:00
卜部昌平 5c167a9778 ruby tool/update-deps --fix 2021-10-05 14:18:23 +09:00
Hiroshi SHIBATA 8f752c95d2
[ruby/fiddle] Use test-unit gem (https://github.com/ruby/fiddle/pull/69)
https://github.com/ruby/fiddle/commit/e08c4c635e

Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2021-09-05 17:43:48 +09:00
Aaron Patterson 0f1e8f38c9 [ruby/fiddle] Improve "offsetof" calculations (https://github.com/ruby/fiddle/pull/90)
I need to get the offset of members inside sub structures.  This patch
adds sub-structure offset support for structs.

https://github.com/ruby/fiddle/commit/cf78eddbb6
2021-08-24 16:18:22 +09:00
Kenta Murata 67897762cf
[ruby/fiddle] Add Fiddle::Handle#file_name (https://github.com/ruby/fiddle/pull/88)
https://github.com/ruby/fiddle/commit/4ee1c6fc4b
2021-07-14 18:56:00 +09:00
Nobuyoshi Nakada 169529a0c0
[ruby/fiddle] Check HAVE_RUBY_MEMORY_VIEW_H rather than API version (https://github.com/ruby/fiddle/pull/86)
https://github.com/ruby/fiddle/commit/c5abcc3a7e
2021-07-14 18:55:59 +09:00
Kenta Murata 818c74b7f4 [ruby/fiddle] Return the module handle value in Fiddle::Handle#to_i and add FIddle::Handle#to_ptr (https://github.com/ruby/fiddle/pull/87)
https://github.com/ruby/fiddle/commit/170111a0cb
2021-07-14 18:43:32 +09:00
Nobuyoshi Nakada cb955dc9ac
[ruby/fiddle] update dependencies 2021-07-13 21:34:28 +09:00
Nobuyoshi Nakada 40d45ab093
[ruby/fiddle] Check HAVE_RUBY_MEMORY_VIEW_H rather than API version
https://github.com/ruby/fiddle/commit/93f9564446
2021-07-13 20:36:45 +09:00
Nobuyoshi Nakada 472d8c5555
[ruby/fiddle] Update required_ruby_version (https://github.com/ruby/fiddle/pull/85)
Drop supports for old versions, keeping 2.5 as CI supports it for
now.

https://github.com/ruby/fiddle/commit/90634e7c55
2021-07-13 19:37:46 +09:00
Sutou Kouhei bb868f4814
[ruby/fiddle] Use have_header and have_type to detect memory view availability
Fix https://github.com/ruby/fiddle/pull/84

It may detect ruby/memory_view.h for system Ruby that is installed in
/usr.

We can use RUBY_API_VERSION_MAJOR to detect memory view availability
because memory view is available since Ruby 3.0.

Reported by Jun Aruga. Thanks!!!

https://github.com/ruby/fiddle/commit/3292929830
2021-07-13 19:37:46 +09:00
Aaron Patterson 5c0d8c6369
[ruby/fiddle] Add "offsetof" to Struct classes (https://github.com/ruby/fiddle/pull/83)
* Add "offsetof" to Struct classes

I need to get the offset of a member inside a struct without allocating
the struct.  This patch adds an "offsetof" class method to structs that
are generated.

The usage is like this:

```ruby
MyStruct = struct [
  "int64_t i",
  "char c",
]

MyStruct.offsetof("i") # => 0
MyStruct.offsetof("c") # => 8
```

* Update test/fiddle/test_c_struct_builder.rb

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>

https://github.com/ruby/fiddle/commit/4e3b60c5b6

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
2021-07-13 19:37:46 +09:00
Sutou Kouhei a2c9e1b58a
[ruby/fiddle] Bump version
https://github.com/ruby/fiddle/commit/049138b4b8
2021-07-13 19:37:46 +09:00
Sutou Kouhei 70b0318646
[ruby/fiddle] MemoryView: ensure reset rb_memory_view_t::obj on error
https://github.com/ruby/fiddle/commit/0ed39345fe
2021-07-13 19:37:46 +09:00
Sutou Kouhei 9f86e50e1e
[ruby/fiddle] StringValuePtr may change the val
https://github.com/ruby/fiddle/commit/bddca7c895
2021-07-13 19:37:45 +09:00
Sutou Kouhei 10e26cfa76
[ruby/fiddle] Add MemoryView.export and MemoryView#release (https://github.com/ruby/fiddle/pull/80)
fix https://github.com/ruby/fiddle/pull/79

Users can release memory views explicitly before process exit.

Reported by xtkoba. Thanks!!!

https://github.com/ruby/fiddle/commit/1de64b7e76
2021-07-13 19:37:45 +09:00
Sutou Kouhei 9988f6ac4e
[ruby/fiddle] Add Fiddle::MemoryView#to_s (https://github.com/ruby/fiddle/pull/78)
Fix https://github.com/ruby/fiddle/pull/74

Reported by dsisnero. Thanks!!!
2021-07-13 19:37:45 +09:00
Sutou Kouhei d1eeb9fec9
[ruby/fiddle] windows: use GetLastError() for win32_last_error
Ruby: [Bug #11579]

Patch by cremno phobia. Thanks!!!

https://github.com/ruby/fiddle/commit/760a8f9b14
2021-07-13 19:37:45 +09:00
Sutou Kouhei c0f9191ab6
[ruby/fiddle] Bump version
https://github.com/ruby/fiddle/commit/3784cfeec4
2021-07-13 19:37:44 +09:00
Sutou Kouhei 79717f81f8 [ruby/fiddle] windows: link to ws2_32 for WSAGetLastError()
https://github.com/ruby/fiddle/commit/e9955d74ae
2021-05-18 12:48:40 +09:00
Sutou Kouhei 71d4a493b8 [ruby/fiddle] windows: add Fiddle.win32_last_socket_error{,=}
GitHub: fix GH-72

Users can't use WSAGetLastError() with Ruby 3.0 or later because
rb_funcall() resets the last socket error internally.

Users can get the last socket error by Fiddle.win32_last_socket_error.

Reported by Kentaro Hayashi. Thanks!!!

https://github.com/ruby/fiddle/commit/76158db00a
2021-05-18 12:48:40 +09:00
Sutou Kouhei ab5212b3c9 [ruby/fiddle] Add support for "const" in type
GitHub: fix #68

Reported by kojix2. Thanks!!!

https://github.com/ruby/fiddle/commit/d7322c234a
2021-05-18 12:48:40 +09:00
Sutou Kouhei 4d1bb460f6 [ruby/fiddle] Add --enable-debug-build option to extconf.rb
https://github.com/ruby/fiddle/commit/e0498e60ea
2021-05-18 12:48:40 +09:00
Sutou Kouhei 791e8eec66 [ruby/fiddle] win32types: sort
https://github.com/ruby/fiddle/commit/35dec6c5a5
2021-05-18 12:48:40 +09:00
Sutou Kouhei 8758b07b1e [ruby/fiddle] Fix more Win32Types definitions
https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types

https://github.com/ruby/fiddle/commit/805c1a595a
2021-05-18 12:48:40 +09:00
Orgad Shaneh 25e56fe374 [ruby/fiddle] Fix Win32Types for Windows 64-bit (#63)
https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types

https://github.com/ruby/fiddle/commit/28ee5b1608
2021-05-18 12:48:40 +09:00
Sutou Kouhei 8d63b1dc75 [ruby/fiddle] Bump version
https://github.com/ruby/fiddle/commit/0cbd370fd6
2021-05-18 12:48:40 +09:00
Sutou Kouhei 881b2dc898 [ruby/fiddle] closure: add support for const char *
GitHub: fix GH-62

Reported by Cody Krieger. Thanks!!!

https://github.com/ruby/fiddle/commit/284b820f2d
2021-05-18 12:48:40 +09:00
Sutou Kouhei b2de5999d8 [ruby/fiddle] closure: accept symbol as type
https://github.com/ruby/fiddle/commit/dc2da6633e
2021-05-18 12:48:40 +09:00
Sutou Kouhei 212d836cd7 [ruby/fiddle] Remove wrong comment
https://github.com/ruby/fiddle/commit/831522e768
2021-05-18 12:48:40 +09:00
Kenta Murata 7bd3d6d23e [ruby/fiddle] Bump version
https://github.com/ruby/fiddle/commit/63e5f98412
2021-05-18 12:48:40 +09:00
卜部昌平 6413dc27dc dependency updates 2021-04-13 14:30:21 +09:00
Aaron Patterson d45466dc5b
Oops! Add another test and fix to_proc implementation 2021-02-26 10:06:56 -08:00
Aaron Patterson 0590e9b677
Fiddle::Function responds to to_proc
This lets us cast a Fiddle::Function to a block, allowing is to write
things like:

```ruby
f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
define_method :strcpy, &f
```
2021-02-26 09:57:13 -08:00
Kenta Murata 94015200b6
[fiddle] Update to 1.0.6 2020-12-23 23:40:04 +09:00
Kenta Murata 74652e640a
[memory_view][fiddle] Rename len to byte_size in rb_memory_view_t 2020-12-23 09:24:53 +09:00
Kenta Murata 05014dcb88
[memory_view][fiddle] Use bool for boolean return value 2020-12-23 09:05:07 +09:00
Sutou Kouhei 32849dc1bb fiddle: Update to 1.0.5 2020-12-23 05:49:52 +09:00
Alan Wu a5fd651575 Reword docs for Fiddle::Function#call [ci skip]
I'm using `<code>` instead of `+` since `+` only works when it encloses
a single word.
2020-12-14 18:26:32 -05:00
Kenta Murata 9b0c36b390
Import fiddle-1.0.4 (#3860)
I don't use tool/sync_default_gem.rb because the last sync was incomplete.

Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: sinisterchipmunk <sinisterchipmunk@gmail.com>
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2020-12-11 09:41:12 +09:00
Sutou Kouhei 0915a02068 Update Fiddle's dependencies 2020-11-18 09:05:13 +09:00
Sutou Kouhei fcd680fbf0 [ruby/fiddle] Remove needless return
https://github.com/ruby/fiddle/commit/50e02f9445
2020-11-18 09:05:13 +09:00
Sutou Kouhei aa22b6658a [ruby/fiddle] Bump version
https://github.com/ruby/fiddle/commit/74b65cb858
2020-11-18 09:05:13 +09:00
Sutou Kouhei ceccc16589 [ruby/fiddle] Remove needless workaround
It's fixed in upstream.
https://github.com/MSP-Greg/ruby-loco/issues/4

https://github.com/ruby/fiddle/commit/2ae0ff4934
2020-11-18 09:05:13 +09:00
Sutou Kouhei 3b385c33b8 [ruby/fiddle] Add workaround for ruby head for mingw
https://github.com/ruby/fiddle/commit/bb227c206d
2020-11-18 09:05:13 +09:00
Sutou Kouhei 821cfa74cb [ruby/fiddle] Use msys2_mingw_dependencies
https://github.com/ruby/fiddle/commit/fee175a8ff
2020-11-18 09:05:13 +09:00
Sutou Kouhei e27701291a [ruby/fiddle] Use ruby_xcalloc() instead of ruby_xmalloc() and memset()
https://github.com/ruby/fiddle/commit/6d24fb5438
2020-11-18 09:05:13 +09:00
Sutou Kouhei 1867088d90 [ruby/fiddle] Remove needless rescue
GitHub: fix GH-15

Reported by Eneroth3. Thanks!!!

https://github.com/ruby/fiddle/commit/f3d70b81ec
2020-11-18 09:05:13 +09:00
Sutou Kouhei aff5eaced4 [ruby/fiddle] Add workaround for RubyInstaller for Windows
See comment for details.

https://github.com/ruby/fiddle/commit/0c76f03dc4
2020-11-18 09:05:13 +09:00
Aaron Patterson 307388ea19 [ruby/fiddle] Add a "pinning" reference (#44)
* Add a "pinning" reference

A `Fiddle::Pinned` objects will prevent the objects they point to from
moving.  This is useful in the case where you need to pass a reference
to a C extension that keeps the address in a global and needs the
address to be stable.

For example:

```ruby
class Foo
  A = "hi" # this is an embedded string

  some_c_function A # A might move!
end
```

If `A` moves, then the underlying string buffer may also move.
`Fiddle::Pinned` will prevent the object from moving:

```ruby
class Foo
  A = "hi" # this is an embedded string

  A_pinner = Fiddle::Pinned.new(A) # :nodoc:

  some_c_function A # A can't move because of `Fiddle::Pinned`
end
```

This is a similar strategy to what Graal uses:

  https://www.graalvm.org/sdk/javadoc/org/graalvm/nativeimage/PinnedObject.html#getObject--

* rename global to match exception name

* Introduce generic Fiddle::Error and rearrange error classes

Fiddle::Error is the generic exception base class for Fiddle exceptions.
This commit introduces the class and rearranges Fiddle exceptions to
inherit from it.

https://github.com/ruby/fiddle/commit/ac52d00223
2020-11-18 09:05:13 +09:00