rucy 0.1.14 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88d55d01ddd42828ae7f666e8211b7ca6839c6570321489bfcdf08b651634140
4
- data.tar.gz: 669d2f788097df04fa6829435f52e7cdeab0380133fd26dba370325a9912c242
3
+ metadata.gz: 70197e18b1a63343bd1c910c142b8a4e98420858bc9d0b6ce908eb008f19df30
4
+ data.tar.gz: bdbc867db1b28e9129a65d1c32667be425793875c97b7c2d11e13a9ca17d912a
5
5
  SHA512:
6
- metadata.gz: c45225ba950dab6106a98cde57eae50bb4a3cf6637eb1f68d66eefb44faf770129b3efb57854614f7a6d7e88f48d9b11f592d739472a31373b86a4ae15c61ce1
7
- data.tar.gz: fbda5c5058963f30605fb5a50e791eaad4b1dc33e1648f58e4f31d974b7436218713ca2be8fc435c9fa18c9804f1479425a1f0ac89ce86265ce1928c82949d66
6
+ metadata.gz: 2e709a38dbba9c82297886e13d7293ccf01f9af688354e0dbc84b7201ee0111e6ddac9f6872b764c04dab3403c4860165268e3bc2e7fc84c4fa5f21924be837e
7
+ data.tar.gz: ae71b353dba8d0e6014cdc6f4f7a5ff299fad4e09131ef4908e13d9e257909ac03307336da6ae6c5e9724bd3afbc5c1835f6198c3231f9fd3a0760f8270de900
@@ -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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.14
1
+ 0.1.21
@@ -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.21'
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.14
4
+ version: 0.1.21
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-16 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.21
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.21
27
27
  description: This library helps you to develop Ruby Extension by C++.
28
28
  email: xordog@gmail.com
29
29
  executables:
@@ -91,7 +91,7 @@ files:
91
91
  homepage: https://github.com/xord/rucy
92
92
  licenses: []
93
93
  metadata: {}
94
- post_install_message:
94
+ post_install_message:
95
95
  rdoc_options: []
96
96
  require_paths:
97
97
  - lib
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubygems_version: 3.0.3
110
- signing_key:
110
+ signing_key:
111
111
  specification_version: 4
112
112
  summary: A Ruby C++ Extension Helper Library.
113
113
  test_files: