rucy 0.3.9 → 0.3.11
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/.github/workflows/release-gem.yml +1 -1
- data/.github/workflows/test.yml +4 -4
- data/CLAUDE.md +23 -0
- data/ChangeLog.md +11 -0
- data/Gemfile.lock +6 -5
- data/VERSION +1 -1
- data/include/rucy/value.h.erb +5 -5
- data/lib/rucy/extension.rb +4 -0
- data/lib/rucy/rake.rb +2 -2
- data/rucy.gemspec +1 -1
- data/src/module.cpp.erb +8 -4
- data/src/value.cpp.erb +14 -23
- metadata +5 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 89db0f3be96a0564f5ed99044093f111decff6d0dd89a613251be1bda89163ca
|
|
4
|
+
data.tar.gz: 6c7b8d8aafc090fb75d7fb2c3cfc16fe9026b8da93d4673ee5cc9b3d8e2aba6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a82fd0de0e5e372e8dbb25b335c3cb27e7209c691522058e26c324dfb16204b181c72326439e5f05c2a54ed7199fb23d5315f3a02b4f8de8d35533b1e9977036
|
|
7
|
+
data.tar.gz: 510edf2d681cc108435efc854c26446afc4560e7a0471269f68661bc6f8f9eedbf2c8d55ef2733dce46e78c1a01c5ca86b8dcb0c2b84723474a2d60cf2b3c885
|
data/.github/workflows/test.yml
CHANGED
|
@@ -25,13 +25,13 @@ jobs:
|
|
|
25
25
|
run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
|
|
26
26
|
|
|
27
27
|
- name: packages
|
|
28
|
-
run: bundle exec rake packages
|
|
28
|
+
run: bundle exec rake verbose packages
|
|
29
29
|
|
|
30
30
|
- name: lib
|
|
31
|
-
run: bundle exec rake lib
|
|
31
|
+
run: bundle exec rake verbose lib
|
|
32
32
|
|
|
33
33
|
- name: ext
|
|
34
|
-
run: bundle exec rake ext
|
|
34
|
+
run: bundle exec rake verbose ext
|
|
35
35
|
|
|
36
36
|
- name: test
|
|
37
|
-
run: bundle exec rake test
|
|
37
|
+
run: bundle exec rake verbose test
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Rucy
|
|
2
|
+
|
|
3
|
+
Ruby C++ Extension Helper Library. Reduces boilerplate when writing Ruby extensions in C++.
|
|
4
|
+
|
|
5
|
+
## ERB Code Generation
|
|
6
|
+
|
|
7
|
+
`src/*.cpp.erb` and `include/rucy/*.h.erb` are ERB templates expanded at build time.
|
|
8
|
+
`NPARAM_MAX = 12` auto-generates function bindings for 0–12 parameters.
|
|
9
|
+
|
|
10
|
+
## Macro API
|
|
11
|
+
|
|
12
|
+
Define Ruby methods from C++ using dedicated macros:
|
|
13
|
+
```cpp
|
|
14
|
+
RUCY_DEF0(method_name)
|
|
15
|
+
{
|
|
16
|
+
// ...
|
|
17
|
+
}
|
|
18
|
+
RUCY_END
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Tools
|
|
22
|
+
|
|
23
|
+
- `bin/rucy2rdoc` — Converts C++ doc macros to RDoc format
|
data/ChangeLog.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
# rucy ChangeLog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## [v0.3.11] - 2026-04-17
|
|
5
|
+
|
|
6
|
+
- Fix ANYARGS function pointer warnings in module bindings
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## [v0.3.10] - 2026-04-09
|
|
10
|
+
|
|
11
|
+
- Remove non-const VALUE* operator[] from Value wrapper for arrays
|
|
12
|
+
- Update dependencies
|
|
13
|
+
|
|
14
|
+
|
|
4
15
|
## [v0.3.9] - 2025-07-06
|
|
5
16
|
|
|
6
17
|
- Add deepwiki badge
|
data/Gemfile.lock
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
GEM
|
|
2
2
|
remote: https://rubygems.org/
|
|
3
3
|
specs:
|
|
4
|
-
power_assert (
|
|
5
|
-
rake (13.1
|
|
6
|
-
test-unit (3.
|
|
4
|
+
power_assert (3.0.1)
|
|
5
|
+
rake (13.3.1)
|
|
6
|
+
test-unit (3.7.7)
|
|
7
7
|
power_assert
|
|
8
|
-
yard (0.9.
|
|
8
|
+
yard (0.9.39)
|
|
9
9
|
|
|
10
10
|
PLATFORMS
|
|
11
11
|
arm64-darwin-21
|
|
12
12
|
arm64-darwin-23
|
|
13
|
+
arm64-darwin-24
|
|
13
14
|
|
|
14
15
|
DEPENDENCIES
|
|
15
16
|
rake
|
|
@@ -17,4 +18,4 @@ DEPENDENCIES
|
|
|
17
18
|
yard
|
|
18
19
|
|
|
19
20
|
BUNDLED WITH
|
|
20
|
-
2.4.
|
|
21
|
+
2.4.19
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.11
|
data/include/rucy/value.h.erb
CHANGED
|
@@ -62,8 +62,6 @@ namespace Rucy
|
|
|
62
62
|
|
|
63
63
|
Symbol as_sym (bool convert = false) const;
|
|
64
64
|
|
|
65
|
-
Value* as_array (bool convert = false);
|
|
66
|
-
|
|
67
65
|
const Value* as_array (bool convert = false) const;
|
|
68
66
|
|
|
69
67
|
Value to_i () const;
|
|
@@ -127,13 +125,15 @@ namespace Rucy
|
|
|
127
125
|
|
|
128
126
|
Value unshift (Value obj);
|
|
129
127
|
|
|
130
|
-
|
|
128
|
+
void set (size_t index, Value obj);
|
|
129
|
+
|
|
130
|
+
Value get (size_t index) const;
|
|
131
131
|
|
|
132
|
-
const Value& operator [] (size_t
|
|
132
|
+
const Value& operator [] (size_t index) const;
|
|
133
133
|
|
|
134
134
|
// Hash
|
|
135
135
|
|
|
136
|
-
void set (Value key, Value
|
|
136
|
+
void set (Value key, Value obj);
|
|
137
137
|
|
|
138
138
|
Value get (Value key) const;
|
|
139
139
|
|
data/lib/rucy/extension.rb
CHANGED
data/lib/rucy/rake.rb
CHANGED
data/rucy.gemspec
CHANGED
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
|
25
25
|
s.platform = Gem::Platform::RUBY
|
|
26
26
|
s.required_ruby_version = '>= 3.0.0'
|
|
27
27
|
|
|
28
|
-
s.add_dependency 'xot', '~> 0.3.
|
|
28
|
+
s.add_dependency 'xot', '~> 0.3.11'
|
|
29
29
|
|
|
30
30
|
s.files = `git ls-files`.split $/
|
|
31
31
|
s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
|
data/src/module.cpp.erb
CHANGED
|
@@ -66,13 +66,15 @@ namespace Rucy
|
|
|
66
66
|
void
|
|
67
67
|
Module::<%= op %> (const char* name, RubyFunctionN fun)
|
|
68
68
|
{
|
|
69
|
-
|
|
69
|
+
typedef VALUE (*Fun) (int, const VALUE*, VALUE);
|
|
70
|
+
<%= rb_op %>(value(), name, (Fun) fun, -1);
|
|
70
71
|
}
|
|
71
72
|
% NTIMES.each do |n|
|
|
72
73
|
void
|
|
73
74
|
Module::<%= op %> (const char* name, RubyFunction<%= n %> fun)
|
|
74
75
|
{
|
|
75
|
-
|
|
76
|
+
typedef VALUE (*Fun) (<%= (['VALUE'] * (n + 1)).join(', ') %>);
|
|
77
|
+
<%= rb_op %>(value(), name, (Fun) fun, <%= n %>);
|
|
76
78
|
}
|
|
77
79
|
% end
|
|
78
80
|
% end
|
|
@@ -100,14 +102,16 @@ namespace Rucy
|
|
|
100
102
|
void
|
|
101
103
|
define_function (const char* name, RubyFunctionN fun)
|
|
102
104
|
{
|
|
103
|
-
|
|
105
|
+
typedef VALUE (*Fun) (int, const VALUE*, VALUE);
|
|
106
|
+
rb_define_global_function(name, (Fun) fun, -1);
|
|
104
107
|
}
|
|
105
108
|
% NTIMES.each do |n|
|
|
106
109
|
|
|
107
110
|
void
|
|
108
111
|
define_function (const char* name, RubyFunction<%= n %> fun)
|
|
109
112
|
{
|
|
110
|
-
|
|
113
|
+
typedef VALUE (*Fun) (<%= (['VALUE'] * (n + 1)).join(', ') %>);
|
|
114
|
+
rb_define_global_function(name, (Fun) fun, <%= n %>);
|
|
111
115
|
}
|
|
112
116
|
% end
|
|
113
117
|
|
data/src/value.cpp.erb
CHANGED
|
@@ -176,12 +176,6 @@ namespace Rucy
|
|
|
176
176
|
return as<Symbol>(convert);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
Value*
|
|
180
|
-
Value::as_array (bool convert)
|
|
181
|
-
{
|
|
182
|
-
return as<Value*>(convert);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
179
|
const Value*
|
|
186
180
|
Value::as_array (bool convert) const
|
|
187
181
|
{
|
|
@@ -351,23 +345,29 @@ namespace Rucy
|
|
|
351
345
|
return rb_ary_unshift(value(), obj.value());
|
|
352
346
|
}
|
|
353
347
|
|
|
354
|
-
|
|
355
|
-
Value::
|
|
348
|
+
void
|
|
349
|
+
Value::set (size_t index, Value obj)
|
|
350
|
+
{
|
|
351
|
+
rb_ary_store(value(), (long) index, obj.value());
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
Value
|
|
355
|
+
Value::get (size_t index) const
|
|
356
356
|
{
|
|
357
|
-
return
|
|
357
|
+
return operator[](index);
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
const Value&
|
|
361
|
-
Value::operator [] (size_t
|
|
361
|
+
Value::operator [] (size_t index) const
|
|
362
362
|
{
|
|
363
|
-
return
|
|
363
|
+
return as_array()[index];
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
void
|
|
367
|
-
Value::set (Value key, Value
|
|
367
|
+
Value::set (Value key, Value obj)
|
|
368
368
|
{
|
|
369
369
|
RUCY_SYMBOL(array_set, "[]=");
|
|
370
|
-
call(array_set, key,
|
|
370
|
+
call(array_set, key, obj);
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
Value
|
|
@@ -778,22 +778,13 @@ namespace Rucy
|
|
|
778
778
|
return SYM2ID(obj.value());
|
|
779
779
|
}
|
|
780
780
|
|
|
781
|
-
template <> Value*
|
|
782
|
-
value_to<Value*> (Value obj, bool convert)
|
|
783
|
-
{
|
|
784
|
-
if (convert) obj = obj.to_array();
|
|
785
|
-
check_type(obj, RUBY_T_ARRAY);
|
|
786
|
-
|
|
787
|
-
return (Value*) RARRAY_PTR(obj.value());
|
|
788
|
-
}
|
|
789
|
-
|
|
790
781
|
template <> const Value*
|
|
791
782
|
value_to<const Value*> (Value obj, bool convert)
|
|
792
783
|
{
|
|
793
784
|
if (convert) obj = obj.to_array();
|
|
794
785
|
check_type(obj, RUBY_T_ARRAY);
|
|
795
786
|
|
|
796
|
-
return (const Value*)
|
|
787
|
+
return (const Value*) RARRAY_CONST_PTR(obj.value());
|
|
797
788
|
}
|
|
798
789
|
|
|
799
790
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rucy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- xordog
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: xot
|
|
@@ -16,20 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.3.
|
|
20
|
-
- - ">="
|
|
21
|
-
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.3.9
|
|
19
|
+
version: 0.3.11
|
|
23
20
|
type: :runtime
|
|
24
21
|
prerelease: false
|
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
23
|
requirements:
|
|
27
24
|
- - "~>"
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0.3.
|
|
30
|
-
- - ">="
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: 0.3.9
|
|
26
|
+
version: 0.3.11
|
|
33
27
|
description: This library helps you to develop Ruby Extension by C++.
|
|
34
28
|
email: xordog@gmail.com
|
|
35
29
|
executables:
|
|
@@ -55,6 +49,7 @@ files:
|
|
|
55
49
|
- ".github/workflows/tag.yml"
|
|
56
50
|
- ".github/workflows/test.yml"
|
|
57
51
|
- ".github/workflows/utils.rb"
|
|
52
|
+
- CLAUDE.md
|
|
58
53
|
- CONTRIBUTING.md
|
|
59
54
|
- ChangeLog.md
|
|
60
55
|
- Gemfile
|