rucy 0.1.44 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/rucy/tester.cpp +1 -1
- data/.github/workflows/release-gem.yml +1 -1
- data/.github/workflows/tag.yml +1 -1
- data/.github/workflows/test.yml +7 -1
- data/ChangeLog.md +13 -0
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/ext/rucy/tester.cpp +1 -1
- data/include/rucy/extension.h.erb +3 -2
- data/include/rucy/ruby.h +1 -0
- data/include/rucy/rucy.h +1 -1
- data/include/rucy/value.h.erb +5 -5
- data/rucy.gemspec +1 -1
- data/src/exception.cpp +1 -25
- data/src/rucy.cpp +1 -1
- data/src/value.cpp.erb +15 -16
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e17e711a8ae802303c387e10b9718fc4399be80c87fbf25badd9b518d6f4a2b
|
4
|
+
data.tar.gz: f7ffb9c06acdf4ecb9e2e0011e956365d558f6509a6c158e00894bba2b4de052
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 121368e5fa7d2246451dae710fc0eb993b700eb1842a36dd0ecf0243b92aaf0f1a278adbe30bf16176b3656bbba137b4e5cb1e5265b2746cf1d69ad85a658a3c
|
7
|
+
data.tar.gz: 6363492ca08f9a2a7c03b444263d3b6a723453205335ac4c831ab32a6e92a1d9b9f85e3ca7d49421e8384e82b40da26da1de29d72bd185996b938a7f817b3171
|
data/.doc/ext/rucy/tester.cpp
CHANGED
data/.github/workflows/tag.yml
CHANGED
data/.github/workflows/test.yml
CHANGED
@@ -16,7 +16,7 @@ jobs:
|
|
16
16
|
ruby-version: 3.2
|
17
17
|
|
18
18
|
- name: checkout
|
19
|
-
uses: actions/checkout@
|
19
|
+
uses: actions/checkout@v4
|
20
20
|
|
21
21
|
- name: setup gems
|
22
22
|
run: bundle install
|
@@ -24,5 +24,11 @@ jobs:
|
|
24
24
|
- name: setup dependencies
|
25
25
|
run: "ruby -I.github/workflows -rutils -e 'setup_dependencies'"
|
26
26
|
|
27
|
+
- name: lib
|
28
|
+
run: bundle exec rake lib
|
29
|
+
|
30
|
+
- name: ext
|
31
|
+
run: bundle exec rake ext
|
32
|
+
|
27
33
|
- name: test
|
28
34
|
run: bundle exec rake test
|
data/ChangeLog.md
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
# rucy ChangeLog
|
2
2
|
|
3
3
|
|
4
|
+
## [v0.2.1] - 2024-07-05
|
5
|
+
|
6
|
+
- Value() can take encoding parameter
|
7
|
+
- value(size, values) -> array(values, size)
|
8
|
+
- Update workflows for test
|
9
|
+
- Update to actions/checkout@v4
|
10
|
+
|
11
|
+
|
12
|
+
## [v0.2] - 2024-03-14
|
13
|
+
|
14
|
+
- Change the super class for exception class from RuntimeError to StandardError
|
15
|
+
|
16
|
+
|
4
17
|
## [v0.1.44] - 2024-02-07
|
5
18
|
|
6
19
|
- Update dependencies
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1
|
1
|
+
0.2.1
|
data/ext/rucy/tester.cpp
CHANGED
@@ -446,8 +446,9 @@ namespace Rucy
|
|
446
446
|
template <typename T> inline T* get_type_ptr (Value obj, Value klass = nil())
|
447
447
|
{
|
448
448
|
if (!klass.is_nil()) check_class(obj, klass);
|
449
|
-
|
450
|
-
|
449
|
+
RubyValue o = obj.value();
|
450
|
+
T* p = NULL;
|
451
|
+
Data_Get_Struct(o, T, p);
|
451
452
|
return p;
|
452
453
|
}
|
453
454
|
|
data/include/rucy/ruby.h
CHANGED
data/include/rucy/rucy.h
CHANGED
data/include/rucy/value.h.erb
CHANGED
@@ -29,9 +29,9 @@ namespace Rucy
|
|
29
29
|
|
30
30
|
Value (double n);
|
31
31
|
|
32
|
-
Value (const char* s);
|
32
|
+
Value (const char* s, rb_encoding* encoding = NULL);
|
33
33
|
|
34
|
-
Value (const char* s, size_t len);
|
34
|
+
Value (const char* s, size_t len, rb_encoding* encoding = NULL);
|
35
35
|
|
36
36
|
Value (size_t size, const Value* array);
|
37
37
|
|
@@ -243,11 +243,11 @@ namespace Rucy
|
|
243
243
|
|
244
244
|
Value value (double n);
|
245
245
|
|
246
|
-
Value value (const char* s);
|
246
|
+
Value value (const char* s, rb_encoding* encoding = NULL);
|
247
247
|
|
248
|
-
Value value (const char* s, size_t len);
|
248
|
+
Value value (const char* s, size_t len, rb_encoding* encoding = NULL);
|
249
249
|
|
250
|
-
Value
|
250
|
+
Value array (const Value* values, size_t size);
|
251
251
|
% (1..16).each do |n|
|
252
252
|
|
253
253
|
Value array (<%= params(n, ', ') {|i| "Value v#{i}"} %>);
|
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_runtime_dependency 'xot', '~> 0.1
|
28
|
+
s.add_runtime_dependency 'xot', '~> 0.2.1'
|
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/exception.cpp
CHANGED
@@ -3,9 +3,6 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
#include <typeinfo>
|
6
|
-
#ifdef WIN32
|
7
|
-
#include <windows.h>
|
8
|
-
#endif
|
9
6
|
#include <xot/exception.h>
|
10
7
|
#include "rucy/ruby.h"
|
11
8
|
#include "rucy/rucy.h"
|
@@ -136,28 +133,7 @@ namespace Rucy
|
|
136
133
|
system_error (const char* file, int line, const char* format, ...)
|
137
134
|
{
|
138
135
|
XOT_STRINGF(format, s);
|
139
|
-
|
140
|
-
#ifdef WIN32
|
141
|
-
DWORD lasterror = GetLastError();
|
142
|
-
if (lasterror != 0)
|
143
|
-
{
|
144
|
-
LPVOID msg = NULL;
|
145
|
-
DWORD flags =
|
146
|
-
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
147
|
-
FORMAT_MESSAGE_FROM_SYSTEM |
|
148
|
-
FORMAT_MESSAGE_IGNORE_INSERTS;
|
149
|
-
if (FormatMessageA(
|
150
|
-
flags, NULL, lasterror, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
151
|
-
(LPSTR) &msg, 0, NULL))
|
152
|
-
{
|
153
|
-
Xot::String m = (LPCSTR) msg;
|
154
|
-
if (!m.empty()) s += ": " + m;
|
155
|
-
}
|
156
|
-
LocalFree(msg);
|
157
|
-
}
|
158
|
-
#endif
|
159
|
-
|
160
|
-
raise(system_error_class(), Xot::error_text(file, line, s));
|
136
|
+
raise(system_error_class(), Xot::system_error_text(file, line, s));
|
161
137
|
}
|
162
138
|
|
163
139
|
|
data/src/rucy.cpp
CHANGED
data/src/value.cpp.erb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
#include "rucy/value.h"
|
3
3
|
|
4
4
|
|
5
|
-
#include <ruby/encoding.h>
|
6
5
|
#include "rucy/function.h"
|
7
6
|
#include "rucy/exception.h"
|
8
7
|
#include "rucy/debug.h"
|
@@ -56,28 +55,28 @@ namespace Rucy
|
|
56
55
|
}
|
57
56
|
|
58
57
|
static VALUE
|
59
|
-
str_new (const char* s)
|
58
|
+
str_new (const char* s, rb_encoding* encoding)
|
60
59
|
{
|
61
|
-
rb_encoding* e = rb_default_internal_encoding();
|
60
|
+
rb_encoding* e = encoding ? encoding : rb_default_internal_encoding();
|
62
61
|
return e ? rb_enc_str_new_cstr(s, e) : rb_str_new_cstr(s);
|
63
62
|
}
|
64
63
|
|
65
64
|
static VALUE
|
66
|
-
str_new (const char* s, size_t len)
|
65
|
+
str_new (const char* s, size_t len, rb_encoding* encoding)
|
67
66
|
{
|
68
|
-
rb_encoding* e = rb_default_internal_encoding();
|
67
|
+
rb_encoding* e = encoding ? encoding : rb_default_internal_encoding();
|
69
68
|
return e ? rb_enc_str_new(s, len, e) : rb_str_new(s, len);
|
70
69
|
}
|
71
70
|
|
72
|
-
Value::Value (const char* s)
|
73
|
-
: val(s ? str_new(s) : Qnil)
|
71
|
+
Value::Value (const char* s, rb_encoding* encoding)
|
72
|
+
: val(s ? str_new(s, encoding) : Qnil)
|
74
73
|
{
|
75
74
|
if (!s)
|
76
75
|
argument_error(__FILE__, __LINE__);
|
77
76
|
}
|
78
77
|
|
79
|
-
Value::Value (const char* s, size_t len)
|
80
|
-
: val(s ? str_new(s, len) : Qnil)
|
78
|
+
Value::Value (const char* s, size_t len, rb_encoding* encoding)
|
79
|
+
: val(s ? str_new(s, len, encoding) : Qnil)
|
81
80
|
{
|
82
81
|
if (!s)
|
83
82
|
argument_error(__FILE__, __LINE__);
|
@@ -613,21 +612,21 @@ namespace Rucy
|
|
613
612
|
}
|
614
613
|
|
615
614
|
Value
|
616
|
-
value (const char* s)
|
615
|
+
value (const char* s, rb_encoding* encoding)
|
617
616
|
{
|
618
|
-
return Value(s);
|
617
|
+
return Value(s, encoding);
|
619
618
|
}
|
620
619
|
|
621
620
|
Value
|
622
|
-
value (const char* s, size_t len)
|
621
|
+
value (const char* s, size_t len, rb_encoding* encoding)
|
623
622
|
{
|
624
|
-
return Value(s, len);
|
623
|
+
return Value(s, len, encoding);
|
625
624
|
}
|
626
625
|
|
627
626
|
Value
|
628
|
-
|
627
|
+
array (const Value* values, size_t size)
|
629
628
|
{
|
630
|
-
return Value(size,
|
629
|
+
return Value(size, values);
|
631
630
|
}
|
632
631
|
% (1..16).each do |n|
|
633
632
|
|
@@ -635,7 +634,7 @@ namespace Rucy
|
|
635
634
|
array (<%= params(n, ', ') {|i| "Value v#{i}"} %>)
|
636
635
|
{
|
637
636
|
Value tmp[] = {<%= params(n, ', ') {|i| "v#{i}"} %>};
|
638
|
-
return
|
637
|
+
return array(tmp, <%= n %>);
|
639
638
|
}
|
640
639
|
% end
|
641
640
|
|
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.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- xordog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xot
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1
|
19
|
+
version: 0.2.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1
|
26
|
+
version: 0.2.1
|
27
27
|
description: This library helps you to develop Ruby Extension by C++.
|
28
28
|
email: xordog@gmail.com
|
29
29
|
executables:
|