rucy 0.1.13 → 0.1.20

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d3ce58764689285aa279b96609e26efad68af0cab0442e6744b6262a5a0cd76
4
- data.tar.gz: 7783aa48c1e2d61522b95986a643cc110010406ba212a5c3392078e460a2bd96
3
+ metadata.gz: 888f97a35b2f461d596a26b6a72fe9575eae00d8da0716d3c5def7b1290a37c2
4
+ data.tar.gz: f526c660ffd566343c9ba270072c8e096e3e1688439fff2990a3feb896a5e43f
5
5
  SHA512:
6
- metadata.gz: e7c183577638ad519cf64ef5cd8f495cd1f0ead80d10dff1618096383b758f74e550e9245c51010fd6037ab2b1f34afc23b05e777aa96ea715d49b9e99046bc7
7
- data.tar.gz: c781f568268be25430ed45243c4241e6b5550f9cf1b213d9da8f7f460872d91cbdbdecc2f75bf87bcd1a5e0a4224ef7d5d864ef4fb1ae4bf952b2afdd9d29a51
6
+ metadata.gz: 9fd08b1847f56641fecbf7c91b294013d95f620cff26c326ce12a3cd9a655351e4230fdd9003c0892c5fe60a5633ac7974ccaf972d04909ea5f2bb3413fe1779
7
+ data.tar.gz: fb0187a8b7b05af2fee43055546efa87cc7baea3d981f3176b6f5d04c23bb7635290b32194ac89879d590bdaac0730d63e8e4b83e93933bb509f2a9986a5bb3a
@@ -177,6 +177,6 @@ Init_class ()
177
177
  cSimpleObj = rb_define_class_under(mTester, "SimpleObj", rb_cObject);
178
178
  rb_define_alloc_func(cSimpleObj, simpleobj_alloc);
179
179
  rb_define_private_method(cSimpleObj, "initialize", RUBY_METHOD_FUNC(simpleobj_initialize), 1);
180
- rb_define_function(cSimpleObj, "set_refs", RUBY_METHOD_FUNC(simpleobj_set_refs), 1);
181
- rb_define_function(cSimpleObj, "clear_refs", RUBY_METHOD_FUNC(simpleobj_clear_refs), 0);
180
+ rb_define_module_function(cSimpleObj, "set_refs", RUBY_METHOD_FUNC(simpleobj_set_refs), 1);
181
+ rb_define_module_function(cSimpleObj, "clear_refs", RUBY_METHOD_FUNC(simpleobj_clear_refs), 0);
182
182
  }
@@ -54,8 +54,8 @@ Init_tester ()
54
54
  Module mRucy = rb_define_module("Rucy");
55
55
  Module mTester = rb_define_module_under(mRucy, "Tester");
56
56
 
57
- rb_define_function(mTester, "all_logs", RUBY_METHOD_FUNC(all_logs), 0);
58
- rb_define_function(mTester, "clear_logs", RUBY_METHOD_FUNC(clear_logs), 0);
57
+ rb_define_module_function(mTester, "all_logs", RUBY_METHOD_FUNC(all_logs), 0);
58
+ rb_define_module_function(mTester, "clear_logs", RUBY_METHOD_FUNC(clear_logs), 0);
59
59
 
60
60
  Init_value();
61
61
  Init_exception();
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 xord.org
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.13
1
+ 0.1.20
@@ -190,6 +190,6 @@ Init_class ()
190
190
  cSimpleObj = mTester.define_class("SimpleObj");
191
191
  cSimpleObj.define_alloc_func(simpleobj_alloc);
192
192
  cSimpleObj.define_private_method("initialize", simpleobj_initialize);
193
- cSimpleObj.define_function("set_refs", simpleobj_set_refs);
194
- cSimpleObj.define_function("clear_refs", simpleobj_clear_refs);
193
+ cSimpleObj.define_module_function("set_refs", simpleobj_set_refs);
194
+ cSimpleObj.define_module_function("clear_refs", simpleobj_clear_refs);
195
195
  }
@@ -56,8 +56,8 @@ Init_tester ()
56
56
  Module mRucy = define_module("Rucy");
57
57
  Module mTester = mRucy.define_module("Tester");
58
58
 
59
- mTester.define_function("all_logs", all_logs);
60
- mTester.define_function("clear_logs", clear_logs);
59
+ mTester.define_module_function("all_logs", all_logs);
60
+ mTester.define_module_function("clear_logs", clear_logs);
61
61
 
62
62
  Init_value();
63
63
  Init_exception();
@@ -47,31 +47,51 @@ namespace Rucy
47
47
  };// RubyJumpTag
48
48
 
49
49
 
50
+ [[noreturn]]
50
51
  void raise (const char* format = NULL, ...);
51
52
 
53
+ [[noreturn]]
52
54
  void raise (RubyValue exception, const char* format = NULL, ...);
53
55
 
54
56
 
55
- void rucy_error (const char* file, int line, const char* format = NULL, ...);
57
+ [[noreturn]]
58
+ void rucy_error (
59
+ const char* file, int line, const char* format = NULL, ...);
56
60
 
57
- void type_error (const char* file, int line, const char* format = NULL, ...);
61
+ [[noreturn]]
62
+ void type_error (
63
+ const char* file, int line, const char* format = NULL, ...);
58
64
 
59
- void argument_error (const char* file, int line, const char* format = NULL, ...);
65
+ [[noreturn]]
66
+ void argument_error (
67
+ const char* file, int line, const char* format = NULL, ...);
60
68
 
61
- void arg_count_error (const char* file, int line,
69
+ [[noreturn]]
70
+ void arg_count_error (
71
+ const char* file, int line,
62
72
  const char* method, int nargs, int nargs_expected,
63
73
  int n1 = -1, int n2 = -1, int n3 = -1, int n4 = -1, int n5 = -1,
64
74
  int n6 = -1, int n7 = -1, int n8 = -1, int n9 = -1, int n10 = -1);
65
75
 
66
- void invalid_state_error (const char* file, int line, const char* format = NULL, ...);
76
+ [[noreturn]]
77
+ void invalid_state_error (
78
+ const char* file, int line, const char* format = NULL, ...);
67
79
 
68
- void invalid_object_error (const char* file, int line, const char* format = NULL, ...);
80
+ [[noreturn]]
81
+ void invalid_object_error (
82
+ const char* file, int line, const char* format = NULL, ...);
69
83
 
70
- void index_error (const char* file, int line, const char* format = NULL, ...);
84
+ [[noreturn]]
85
+ void index_error (
86
+ const char* file, int line, const char* format = NULL, ...);
71
87
 
72
- void not_implemented_error (const char* file, int line, const char* format = NULL, ...);
88
+ [[noreturn]]
89
+ void not_implemented_error (
90
+ const char* file, int line, const char* format = NULL, ...);
73
91
 
74
- void system_error (const char* file, int line, const char* format = NULL, ...);
92
+ [[noreturn]]
93
+ void system_error (
94
+ const char* file, int line, const char* format = NULL, ...);
75
95
 
76
96
 
77
97
  }// Rucy
@@ -27,14 +27,20 @@
27
27
  template <> const native_class& value_to<const native_class&> (Value value, bool convert); \
28
28
  }
29
29
 
30
- #define RUCY_DECLARE_VALUE_OR_ARRAY_TO(native_class) \
31
- RUCY_DECLARE_VALUE_TO(native_class) \
30
+ #define RUCY_DECLARE_ARRAY_TO(native_class) \
32
31
  namespace Rucy \
33
32
  { \
34
33
  template <> native_class value_to<native_class> (Value value, bool convert); \
35
34
  template <> native_class value_to<native_class> (int argc, const Value* argv, bool convert); \
36
35
  }
37
36
 
37
+ #define RUCY_DECLARE_CONVERT_TO(native_type) \
38
+ RUCY_DECLARE_ARRAY_TO(native_type)
39
+
40
+ #define RUCY_DECLARE_VALUE_OR_ARRAY_TO(native_class) \
41
+ RUCY_DECLARE_VALUE_TO(native_class) \
42
+ RUCY_DECLARE_ARRAY_TO(native_class)
43
+
38
44
  #define RUCY_DECLARE_WRAPPER_VALUE_FROM(native_class) \
39
45
  namespace Rucy \
40
46
  { \
@@ -92,8 +98,7 @@
92
98
  } \
93
99
  }
94
100
 
95
- #define RUCY_DEFINE_VALUE_OR_ARRAY_TO(native_class) \
96
- RUCY_DEFINE_VALUE_TO(native_class) \
101
+ #define RUCY_DEFINE_ARRAY_TO(native_class) \
97
102
  namespace Rucy \
98
103
  { \
99
104
  template <> native_class \
@@ -106,6 +111,13 @@
106
111
  } \
107
112
  }
108
113
 
114
+ #define RUCY_DEFINE_CONVERT_TO(native_type) \
115
+ RUCY_DEFINE_ARRAY_TO(native_type)
116
+
117
+ #define RUCY_DEFINE_VALUE_OR_ARRAY_TO(native_class) \
118
+ RUCY_DEFINE_VALUE_TO(native_class) \
119
+ RUCY_DEFINE_ARRAY_TO(native_class)
120
+
109
121
  #define RUCY_DEFINE_WRAPPER_VALUE_FROM(native_class) \
110
122
  namespace Rucy \
111
123
  { \
@@ -41,7 +41,7 @@ namespace Rucy
41
41
  void extend_module (Value module);
42
42
 
43
43
  % [
44
- % 'define_function',
44
+ % 'define_module_function',
45
45
  % 'define_method',
46
46
  % 'define_private_method',
47
47
  % 'define_singleton_method',
@@ -5,7 +5,6 @@
5
5
 
6
6
 
7
7
  #include <ruby.h>
8
- #include <ruby/intern.h>
9
8
 
10
9
 
11
10
  namespace Rucy
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
28
28
  s.platform = Gem::Platform::RUBY
29
29
  s.required_ruby_version = '~> 2'
30
30
 
31
- s.add_runtime_dependency 'xot', '~> 0.1'
31
+ s.add_runtime_dependency 'xot', '~> 0.1.20'
32
32
 
33
33
  s.files = `git ls-files`.split $/
34
34
  s.executables = s.files.grep(%r{^bin/}) {|f| File.basename f}
@@ -58,7 +58,7 @@ namespace Rucy
58
58
  }
59
59
 
60
60
  % [
61
- % ['define_function', 'rb_define_module_function'],
61
+ % ['define_module_function', 'rb_define_module_function'],
62
62
  % ['define_method', 'rb_define_method'],
63
63
  % ['define_private_method', 'rb_define_private_method'],
64
64
  % ['define_singleton_method', 'rb_define_singleton_method']
@@ -3,6 +3,7 @@
3
3
 
4
4
 
5
5
  #include <assert.h>
6
+ #include <ruby/encoding.h>
6
7
  #include "rucy/function.h"
7
8
  #include "rucy/exception.h"
8
9
  #include "rucy/debug.h"
@@ -55,15 +56,29 @@ namespace Rucy
55
56
  {
56
57
  }
57
58
 
59
+ static VALUE
60
+ str_new (const char* s)
61
+ {
62
+ rb_encoding* e = rb_default_internal_encoding();
63
+ return e ? rb_enc_str_new_cstr(s, e) : rb_str_new_cstr(s);
64
+ }
65
+
66
+ static VALUE
67
+ str_new (const char* s, size_t len)
68
+ {
69
+ rb_encoding* e = rb_default_internal_encoding();
70
+ return e ? rb_enc_str_new(s, len, e) : rb_str_new(s, len);
71
+ }
72
+
58
73
  Value::Value (const char* s)
59
- : val(s ? rb_str_new2(s) : Qnil)
74
+ : val(s ? str_new(s) : Qnil)
60
75
  {
61
76
  if (!s)
62
77
  argument_error(__FILE__, __LINE__);
63
78
  }
64
79
 
65
80
  Value::Value (const char* s, size_t len)
66
- : val(s ? rb_str_new(s, len) : Qnil)
81
+ : val(s ? str_new(s, len) : Qnil)
67
82
  {
68
83
  if (!s)
69
84
  argument_error(__FILE__, __LINE__);
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.13
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - xordog
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-23 00:00:00.000000000 Z
11
+ date: 2020-12-10 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.1.20
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.1.20
27
27
  description: This library helps you to develop Ruby Extension by C++.
28
28
  email: xordog@gmail.com
29
29
  executables:
@@ -44,6 +44,7 @@ files:
44
44
  - ".doc/ext/rucy/struct.cpp"
45
45
  - ".doc/ext/rucy/tester.cpp"
46
46
  - ".doc/ext/rucy/value.cpp"
47
+ - LICENSE
47
48
  - README.md
48
49
  - Rakefile
49
50
  - VERSION
@@ -90,7 +91,7 @@ files:
90
91
  homepage: https://github.com/xord/rucy
91
92
  licenses: []
92
93
  metadata: {}
93
- post_install_message:
94
+ post_install_message:
94
95
  rdoc_options: []
95
96
  require_paths:
96
97
  - lib
@@ -106,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
107
  version: '0'
107
108
  requirements: []
108
109
  rubygems_version: 3.0.3
109
- signing_key:
110
+ signing_key:
110
111
  specification_version: 4
111
112
  summary: A Ruby C++ Extension Helper Library.
112
113
  test_files: