extpp 0.0.9 → 0.1.0
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/LICENSE.txt +1 -1
- data/README.md +2 -2
- data/Rakefile +1 -28
- data/doc/text/news.md +6 -0
- data/include/ruby/class.hpp +191 -14
- data/{ext/extpp → include/ruby}/function.hpp +20 -7
- data/include/ruby/object.hpp +45 -6
- data/include/ruby/protect.hpp +9 -2
- data/include/ruby.hpp +0 -10
- data/lib/extpp/setup.rb +0 -4
- data/lib/extpp/version.rb +1 -1
- data/lib/extpp.rb +0 -12
- metadata +6 -73
- data/ext/extpp/class.cpp +0 -277
- data/ext/extpp/extconf.rb +0 -110
- data/ext/extpp/function.cpp +0 -28
- data/ext/extpp/object.cpp +0 -48
- data/ext/extpp/protect.cpp +0 -12
- data/lib/extpp/platform.rb +0 -8
- data/test/fixtures/cast/Makefile +0 -269
- data/test/fixtures/cast/cast.cpp +0 -39
- data/test/fixtures/cast/cast.o +0 -0
- data/test/fixtures/cast/cast.so +0 -0
- data/test/fixtures/cast/extconf.rb +0 -4
- data/test/fixtures/cast/mkmf.log +0 -144
- data/test/fixtures/class/Makefile +0 -269
- data/test/fixtures/class/class.cpp +0 -46
- data/test/fixtures/class/class.o +0 -0
- data/test/fixtures/class/class.so +0 -0
- data/test/fixtures/class/extconf.rb +0 -4
- data/test/fixtures/class/mkmf.log +0 -144
- data/test/fixtures/object/Makefile +0 -269
- data/test/fixtures/object/extconf.rb +0 -4
- data/test/fixtures/object/mkmf.log +0 -144
- data/test/fixtures/object/object.cpp +0 -102
- data/test/fixtures/object/object.o +0 -0
- data/test/fixtures/object/object.so +0 -0
- data/test/fixtures/protect/Makefile +0 -269
- data/test/fixtures/protect/extconf.rb +0 -4
- data/test/fixtures/protect/mkmf.log +0 -144
- data/test/fixtures/protect/protect.cpp +0 -70
- data/test/fixtures/protect/protect.o +0 -0
- data/test/fixtures/protect/protect.so +0 -0
- data/test/helper.rb +0 -11
- data/test/run-test.rb +0 -31
- data/test/test-cast.rb +0 -46
- data/test/test-class.rb +0 -47
- data/test/test-object.rb +0 -68
- data/test/test-protect.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d99eab03d29814512bdae39c7be899d60794464e05b361f7cb6b612ba08d36b5
|
4
|
+
data.tar.gz: 73d755c8c3c52ddc2e2eb9474637735b1ed5f02a8b08fce1524522bcb3590bcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adbe4fc358aa20367f56703424366e5401c8c4c26af831b751e534fec5c853f64e0fb1a87fe68340a33ad1d50ce7808cf8d410e6cc5391f994403b57795a0702
|
7
|
+
data.tar.gz: 7fdc84981a093e94b5aeec3f1cbf58b9f986368e03f923f01ea9d6411f31d8c57f0e68dab1c054cc1a8315031a8596a586afd9064318b9ed406cb5e7b709a760
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -90,12 +90,12 @@ Build this extension:
|
|
90
90
|
Now, you can use this extension:
|
91
91
|
|
92
92
|
```console
|
93
|
-
% ruby -r
|
93
|
+
% ruby -r ./hello -e 'p Hello.new("me").greet'
|
94
94
|
"Hello me"
|
95
95
|
```
|
96
96
|
|
97
97
|
## License
|
98
98
|
|
99
|
-
Copyright (C) 2017-
|
99
|
+
Copyright (C) 2017-2021 Sutou Kouhei
|
100
100
|
|
101
101
|
The 2-Clause BSD License. See [LICENSE.txt](LICENSE.txt) for details.
|
data/Rakefile
CHANGED
@@ -13,36 +13,9 @@ end
|
|
13
13
|
|
14
14
|
helper.install
|
15
15
|
|
16
|
-
def run_extconf(*arguments)
|
17
|
-
cd("ext/extpp") do
|
18
|
-
ruby("extconf.rb", *arguments)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
desc "Configure"
|
23
|
-
task :configure do
|
24
|
-
run_extconf
|
25
|
-
end
|
26
|
-
|
27
|
-
namespace :configure do
|
28
|
-
desc "Configure for debug"
|
29
|
-
task :debug do
|
30
|
-
run_extconf("--enable-debug-build")
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
task :clean do
|
35
|
-
makefile = "ext/extpp/Makefile"
|
36
|
-
if File.exists?(makefile)
|
37
|
-
cd(File.dirname(makefile)) do
|
38
|
-
sh("make", "clean")
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
16
|
desc "Run tests"
|
44
17
|
task :test do
|
45
18
|
ruby("test/run-test.rb")
|
46
19
|
end
|
47
20
|
|
48
|
-
task default:
|
21
|
+
task default: :test
|
data/doc/text/news.md
CHANGED
data/include/ruby/class.hpp
CHANGED
@@ -1,26 +1,203 @@
|
|
1
1
|
#pragma once
|
2
2
|
|
3
|
+
#include <ruby/function.hpp>
|
3
4
|
#include <ruby/object.hpp>
|
4
5
|
|
6
|
+
#include <string>
|
7
|
+
#include <unordered_map>
|
8
|
+
#include <vector>
|
9
|
+
|
5
10
|
namespace rb {
|
6
|
-
|
11
|
+
using MethodTable = std::unordered_map<ID, Function *>;
|
12
|
+
|
13
|
+
struct MethodDefinition {
|
14
|
+
MethodDefinition(std::string name_, Function *function_) :
|
15
|
+
name(name_),
|
16
|
+
function(function_) {
|
17
|
+
}
|
18
|
+
|
19
|
+
std::string name;
|
20
|
+
Function *function;
|
21
|
+
};
|
22
|
+
using MethodDefinitions = std::vector<MethodDefinition>;
|
23
|
+
|
24
|
+
namespace {
|
25
|
+
inline MethodTable *method_table_from_ruby(VALUE rb_method_table) {
|
26
|
+
return reinterpret_cast<MethodTable *>(NUM2ULL(rb_method_table));
|
27
|
+
}
|
28
|
+
|
29
|
+
inline VALUE method_table_to_ruby(MethodTable *method_table) {
|
30
|
+
return ULL2NUM(reinterpret_cast<uintptr_t>(method_table));
|
31
|
+
}
|
32
|
+
|
33
|
+
inline MethodDefinitions *
|
34
|
+
method_definitions_from_ruby(VALUE rb_definitions) {
|
35
|
+
return reinterpret_cast<MethodDefinitions *>(NUM2ULL(rb_definitions));
|
36
|
+
}
|
37
|
+
|
38
|
+
inline VALUE method_definitions_to_ruby(MethodDefinitions *definitions) {
|
39
|
+
return ULL2NUM(reinterpret_cast<uintptr_t>(definitions));
|
40
|
+
}
|
41
|
+
|
42
|
+
inline VALUE call_func(int argc, VALUE *argv, VALUE self) {
|
43
|
+
auto rb_method_table =
|
44
|
+
rb_ivar_get(rb_obj_class(self), rb_intern("__method_table__"));
|
45
|
+
auto method_table = method_table_from_ruby(rb_method_table);
|
46
|
+
auto method_name_symbol = rb_funcall(self, rb_intern("__method__"), 0);
|
47
|
+
auto function = (*method_table)[rb_sym2id(method_name_symbol)];
|
48
|
+
return function->call(self, argc, argv);
|
49
|
+
}
|
50
|
+
|
51
|
+
inline bool flush_method_definitions(VALUE klass) {
|
52
|
+
ID id_method_definitions = rb_intern("__method_definitions__");
|
53
|
+
auto rb_definitions = rb_ivar_get(klass, id_method_definitions);
|
54
|
+
if (NIL_P(rb_definitions)) {
|
55
|
+
return false;
|
56
|
+
}
|
57
|
+
|
58
|
+
auto definitions = method_definitions_from_ruby(rb_definitions);
|
59
|
+
auto rb_method_table = rb_ivar_get(klass, rb_intern("__method_table__"));
|
60
|
+
auto method_table = method_table_from_ruby(rb_method_table);
|
61
|
+
for (const auto &definition : *definitions) {
|
62
|
+
ID name_id = rb_intern(definition.name.c_str());
|
63
|
+
(*method_table)[name_id] = definition.function;
|
64
|
+
rb_define_method(klass,
|
65
|
+
definition.name.c_str(),
|
66
|
+
reinterpret_cast<rb::RawMethod>(call_func),
|
67
|
+
-1);
|
68
|
+
}
|
69
|
+
rb_ivar_set(klass, id_method_definitions, Qnil);
|
70
|
+
return true;
|
71
|
+
}
|
72
|
+
|
73
|
+
inline VALUE method_missing(int argc, VALUE *argv, VALUE self) {
|
74
|
+
auto klass = rb_obj_class(self);
|
75
|
+
|
76
|
+
if (flush_method_definitions(klass)) {
|
77
|
+
auto rb_method_table = rb_ivar_get(klass, rb_intern("__method_table__"));
|
78
|
+
auto method_table = method_table_from_ruby(rb_method_table);
|
79
|
+
|
80
|
+
VALUE rb_name_symbol;
|
81
|
+
VALUE rb_args;
|
82
|
+
rb_scan_args(argc, argv, "1*", &rb_name_symbol, &rb_args);
|
83
|
+
auto function = (*method_table)[rb_sym2id(rb_name_symbol)];
|
84
|
+
if (function) {
|
85
|
+
return function->call(self,
|
86
|
+
static_cast<int>(RARRAY_LEN(rb_args)),
|
87
|
+
RARRAY_PTR(rb_args));
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
return rb_call_super(argc, argv);
|
92
|
+
}
|
93
|
+
|
94
|
+
inline VALUE respond_to_missing_p(VALUE self,
|
95
|
+
VALUE rb_name_symbol,
|
96
|
+
VALUE rb_include_private) {
|
97
|
+
auto klass = rb_obj_class(self);
|
98
|
+
|
99
|
+
if (flush_method_definitions(klass)) {
|
100
|
+
auto rb_method_table = rb_ivar_get(klass, rb_intern("__method_table__"));
|
101
|
+
auto method_table = method_table_from_ruby(rb_method_table);
|
102
|
+
|
103
|
+
auto function = (*method_table)[rb_sym2id(rb_name_symbol)];
|
104
|
+
if (function) {
|
105
|
+
return Qtrue;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
VALUE rb_args[] = {rb_name_symbol, rb_include_private};
|
110
|
+
return rb_call_super(2, rb_args);
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
class Class: public Object {
|
7
115
|
public:
|
8
|
-
Class(const char *name)
|
9
|
-
|
10
|
-
|
11
|
-
|
116
|
+
Class(const char *name) :
|
117
|
+
Class(RTEST(rb_funcall(rb_cObject,
|
118
|
+
rb_intern("const_defined?"),
|
119
|
+
1,
|
120
|
+
rb_str_new_static(name, strlen(name)))) ?
|
121
|
+
rb_funcall(rb_cObject,
|
122
|
+
rb_intern("const_get"),
|
123
|
+
1,
|
124
|
+
rb_str_new_static(name, strlen(name))) :
|
125
|
+
rb_define_class(name, rb_cObject)) {
|
126
|
+
}
|
127
|
+
|
128
|
+
Class(const char *name, VALUE parent) :
|
129
|
+
Class(rb_define_class(name, parent)) {
|
130
|
+
}
|
131
|
+
|
132
|
+
Class(VALUE klass) :
|
133
|
+
Object(klass),
|
134
|
+
class_(klass),
|
135
|
+
method_table_(new MethodTable()),
|
136
|
+
lazy_define_method_(false),
|
137
|
+
method_definitions_(nullptr) {
|
138
|
+
rb_iv_set(class_,
|
139
|
+
"__method_table__",
|
140
|
+
method_table_to_ruby(method_table_));
|
141
|
+
rb_iv_set(class_, "__method_definitions__", Qnil);
|
142
|
+
}
|
143
|
+
|
144
|
+
inline Class &define_method(const char *name,
|
145
|
+
MethodWithoutArguments body) {
|
146
|
+
auto function = new FunctionWithoutArgument(body);
|
147
|
+
return define_method(name, function);
|
148
|
+
}
|
149
|
+
|
150
|
+
inline Class &define_method(const char *name,
|
151
|
+
MethodWithArguments body) {
|
152
|
+
auto function = new FunctionWithArguments(body);
|
153
|
+
return define_method(name, function);
|
154
|
+
}
|
155
|
+
|
156
|
+
inline Class &define_method(const char *name,
|
157
|
+
MethodWithArgumentsCompatible body) {
|
158
|
+
auto function = new FunctionWithArgumentsCompatible(body);
|
159
|
+
return define_method(name, function);
|
160
|
+
}
|
161
|
+
|
162
|
+
inline Class &define_method(const char *name, Function *function) {
|
163
|
+
if (lazy_define_method_) {
|
164
|
+
method_definitions_->emplace_back(name, function);
|
165
|
+
} else {
|
166
|
+
ID name_id = rb_intern(name);
|
167
|
+
(*method_table_)[name_id] = function;
|
168
|
+
rb_define_method(class_,
|
169
|
+
name,
|
170
|
+
reinterpret_cast<RawMethod>(call_func),
|
171
|
+
-1);
|
172
|
+
}
|
173
|
+
return (Class &)*this;
|
174
|
+
}
|
12
175
|
|
13
|
-
Class &
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Class &define_method(const char *name,
|
18
|
-
MethodWithArgumentsCompatible body);
|
176
|
+
inline Class &enable_lazy_define_method() {
|
177
|
+
if (lazy_define_method_) {
|
178
|
+
return (Class &)*this;
|
179
|
+
}
|
19
180
|
|
20
|
-
|
181
|
+
lazy_define_method_ = true;
|
182
|
+
method_definitions_ = new MethodDefinitions();
|
183
|
+
rb_iv_set(class_,
|
184
|
+
"__method_definitions__",
|
185
|
+
method_definitions_to_ruby(method_definitions_));
|
186
|
+
rb_define_method(class_,
|
187
|
+
"method_missing",
|
188
|
+
reinterpret_cast<RawMethod>(method_missing),
|
189
|
+
-1);
|
190
|
+
rb_define_method(class_,
|
191
|
+
"respond_to_missing?",
|
192
|
+
reinterpret_cast<RawMethod>(respond_to_missing_p),
|
193
|
+
-1);
|
194
|
+
return (Class &)*this;
|
195
|
+
}
|
21
196
|
|
22
197
|
private:
|
23
|
-
|
24
|
-
|
198
|
+
VALUE class_;
|
199
|
+
MethodTable *method_table_;
|
200
|
+
bool lazy_define_method_;
|
201
|
+
MethodDefinitions *method_definitions_;
|
25
202
|
};
|
26
203
|
}
|
@@ -13,9 +13,13 @@ namespace rb {
|
|
13
13
|
|
14
14
|
class FunctionWithoutArgument : public Function {
|
15
15
|
public:
|
16
|
-
FunctionWithoutArgument(const MethodWithoutArguments &function)
|
16
|
+
FunctionWithoutArgument(const MethodWithoutArguments &function) :
|
17
|
+
function_(function) {
|
18
|
+
}
|
17
19
|
|
18
|
-
VALUE call(VALUE self, int argc, VALUE *argv) override
|
20
|
+
inline VALUE call(VALUE self, int argc, VALUE *argv) override {
|
21
|
+
return function_(self);
|
22
|
+
}
|
19
23
|
|
20
24
|
private:
|
21
25
|
MethodWithoutArguments function_;
|
@@ -23,9 +27,13 @@ namespace rb {
|
|
23
27
|
|
24
28
|
class FunctionWithArguments : public Function {
|
25
29
|
public:
|
26
|
-
FunctionWithArguments(const MethodWithArguments &function)
|
30
|
+
FunctionWithArguments(const MethodWithArguments &function) :
|
31
|
+
function_(function) {
|
32
|
+
}
|
27
33
|
|
28
|
-
VALUE call(VALUE self, int argc, VALUE *argv) override
|
34
|
+
inline VALUE call(VALUE self, int argc, VALUE *argv) override {
|
35
|
+
return function_(self, argc, argv);
|
36
|
+
}
|
29
37
|
|
30
38
|
private:
|
31
39
|
MethodWithArguments function_;
|
@@ -33,9 +41,14 @@ namespace rb {
|
|
33
41
|
|
34
42
|
class FunctionWithArgumentsCompatible : public Function {
|
35
43
|
public:
|
36
|
-
FunctionWithArgumentsCompatible(
|
37
|
-
|
38
|
-
|
44
|
+
FunctionWithArgumentsCompatible(
|
45
|
+
const MethodWithArgumentsCompatible &function) :
|
46
|
+
function_(function) {
|
47
|
+
}
|
48
|
+
|
49
|
+
inline VALUE call(VALUE self, int argc, VALUE *argv) override {
|
50
|
+
return function_(argc, argv, self);
|
51
|
+
}
|
39
52
|
|
40
53
|
private:
|
41
54
|
MethodWithArgumentsCompatible function_;
|
data/include/ruby/object.hpp
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
#include <initializer_list>
|
6
6
|
|
7
7
|
namespace rb {
|
8
|
-
class
|
8
|
+
class Object {
|
9
9
|
public:
|
10
10
|
explicit Object(VALUE rb_object=Qnil) :
|
11
11
|
rb_object_(rb_object),
|
@@ -56,7 +56,10 @@ namespace rb {
|
|
56
56
|
rb_gc_register_address(&rb_object_);
|
57
57
|
}
|
58
58
|
|
59
|
-
Object send(ID name_id)
|
59
|
+
inline Object send(ID name_id) {
|
60
|
+
VALUE rb_result = rb_funcall(rb_object_, name_id, 0);
|
61
|
+
return Object(rb_result);
|
62
|
+
}
|
60
63
|
|
61
64
|
inline Object send(const char *name) {
|
62
65
|
return send(rb_intern(name));
|
@@ -66,7 +69,19 @@ namespace rb {
|
|
66
69
|
return send(rb_intern_str(name));
|
67
70
|
}
|
68
71
|
|
69
|
-
Object send(ID name_id, std::initializer_list<VALUE> args)
|
72
|
+
inline Object send(ID name_id, std::initializer_list<VALUE> args) {
|
73
|
+
auto n = args.size();
|
74
|
+
VALUE rb_args[n];
|
75
|
+
int i = 0;
|
76
|
+
for (auto arg : args) {
|
77
|
+
rb_args[i++] = arg;
|
78
|
+
}
|
79
|
+
VALUE rb_result = rb_funcallv(rb_object_,
|
80
|
+
name_id,
|
81
|
+
static_cast<int>(n),
|
82
|
+
rb_args);
|
83
|
+
return Object(rb_result);
|
84
|
+
}
|
70
85
|
|
71
86
|
inline Object send(const char *name, std::initializer_list<VALUE> args) {
|
72
87
|
return send(rb_intern(name), args);
|
@@ -76,9 +91,33 @@ namespace rb {
|
|
76
91
|
return send(rb_intern_str(name), args);
|
77
92
|
}
|
78
93
|
|
79
|
-
Object send(ID name_id,
|
80
|
-
|
81
|
-
|
94
|
+
inline Object send(ID name_id,
|
95
|
+
std::initializer_list<VALUE> args,
|
96
|
+
MethodWithoutArguments block) {
|
97
|
+
auto n = args.size();
|
98
|
+
VALUE rb_args[n];
|
99
|
+
int i = 0;
|
100
|
+
for (auto arg : args) {
|
101
|
+
rb_args[i++] = arg;
|
102
|
+
}
|
103
|
+
auto call_block = [](RB_BLOCK_CALL_FUNC_ARGLIST(rb_data, rb_block)) {
|
104
|
+
auto block = reinterpret_cast<rb::MethodWithoutArguments>(rb_block);
|
105
|
+
return block(rb_data);
|
106
|
+
};
|
107
|
+
#ifdef RUBY_BACKWARD_CXXANYARGS_HPP
|
108
|
+
# define CAST_CALLER(caller) caller
|
109
|
+
#else
|
110
|
+
# define CAST_CALLER(caller) reinterpret_cast<RawMethod>(+caller)
|
111
|
+
#endif
|
112
|
+
auto rb_result = rb_block_call(rb_object_,
|
113
|
+
name_id,
|
114
|
+
static_cast<int>(n),
|
115
|
+
rb_args,
|
116
|
+
CAST_CALLER(call_block),
|
117
|
+
reinterpret_cast<VALUE>(block));
|
118
|
+
#undef CAST_CALLER
|
119
|
+
return Object(rb_result);
|
120
|
+
}
|
82
121
|
|
83
122
|
inline Object send(const char *name,
|
84
123
|
std::initializer_list<VALUE> args,
|
data/include/ruby/protect.hpp
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#include <ruby/type.hpp>
|
4
4
|
|
5
5
|
namespace rb {
|
6
|
-
class
|
6
|
+
class State {
|
7
7
|
public:
|
8
8
|
explicit State(int state) :
|
9
9
|
state_(state) {
|
@@ -17,7 +17,14 @@ namespace rb {
|
|
17
17
|
int state_;
|
18
18
|
};
|
19
19
|
|
20
|
-
|
20
|
+
inline VALUE protect(RawCallback callback, VALUE callback_data) {
|
21
|
+
int state = 0;
|
22
|
+
auto result = rb_protect(callback, callback_data, &state);
|
23
|
+
if (state != 0) {
|
24
|
+
throw State(state);
|
25
|
+
}
|
26
|
+
return result;
|
27
|
+
}
|
21
28
|
|
22
29
|
template <typename NoArgumentCallback>
|
23
30
|
VALUE protect(const NoArgumentCallback& callback) {
|
data/include/ruby.hpp
CHANGED
@@ -5,16 +5,6 @@
|
|
5
5
|
#define RB_BEGIN_DECLS extern "C" {
|
6
6
|
#define RB_END_DECLS }
|
7
7
|
|
8
|
-
#ifdef _WIN32
|
9
|
-
# ifdef RB_EXTPP_COMPILATION
|
10
|
-
# define RB_EXTPP_EXPORT __declspec(dllexport)
|
11
|
-
# else
|
12
|
-
# define RB_EXTPP_EXPORT __declspec(dllimport)
|
13
|
-
# endif
|
14
|
-
#else
|
15
|
-
# define RB_EXTPP_EXPORT __attribute__((visibility("default")))
|
16
|
-
#endif
|
17
|
-
|
18
8
|
#include <ruby/cast.hpp>
|
19
9
|
#include <ruby/class.hpp>
|
20
10
|
#include <ruby/object.hpp>
|
data/lib/extpp/setup.rb
CHANGED
data/lib/extpp/version.rb
CHANGED
data/lib/extpp.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "extpp/compiler"
|
2
|
-
require "extpp/platform"
|
3
2
|
|
4
3
|
compiler = ExtPP::Compiler.new(RbConfig.expand($CXXFLAGS))
|
5
4
|
compiler.check
|
@@ -26,14 +25,3 @@ $(OBJS): $(extpp_headers)
|
|
26
25
|
end
|
27
26
|
end
|
28
27
|
extend(header_files_dependency_injector)
|
29
|
-
|
30
|
-
platform = ExtPP::Platform.new
|
31
|
-
|
32
|
-
[
|
33
|
-
File.join(__dir__, "..", "ext", "extpp"),
|
34
|
-
__dir__,
|
35
|
-
].each do |candidate_dir|
|
36
|
-
so_name = "libruby-extpp.#{platform.dynamic_library_extension}"
|
37
|
-
lib_path = File.expand_path(File.join(candidate_dir, so_name))
|
38
|
-
$LIBS += " #{lib_path.quote}" if File.exist?(lib_path)
|
39
|
-
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extpp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kouhei Sutou
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,64 +58,27 @@ description: |-
|
|
58
58
|
email:
|
59
59
|
- kou@clear-code.com
|
60
60
|
executables: []
|
61
|
-
extensions:
|
62
|
-
- ext/extpp/extconf.rb
|
61
|
+
extensions: []
|
63
62
|
extra_rdoc_files: []
|
64
63
|
files:
|
65
64
|
- LICENSE.txt
|
66
65
|
- README.md
|
67
66
|
- Rakefile
|
68
67
|
- doc/text/news.md
|
69
|
-
- ext/extpp/class.cpp
|
70
|
-
- ext/extpp/extconf.rb
|
71
|
-
- ext/extpp/function.cpp
|
72
|
-
- ext/extpp/function.hpp
|
73
|
-
- ext/extpp/object.cpp
|
74
|
-
- ext/extpp/protect.cpp
|
75
68
|
- include/ruby.hpp
|
76
69
|
- include/ruby/cast.hpp
|
77
70
|
- include/ruby/class.hpp
|
71
|
+
- include/ruby/function.hpp
|
78
72
|
- include/ruby/object.hpp
|
79
73
|
- include/ruby/protect.hpp
|
80
74
|
- include/ruby/type.hpp
|
81
75
|
- lib/extpp.rb
|
82
76
|
- lib/extpp/compiler.rb
|
83
|
-
- lib/extpp/platform.rb
|
84
77
|
- lib/extpp/setup.rb
|
85
78
|
- lib/extpp/version.rb
|
86
79
|
- sample/hello/Rakefile
|
87
80
|
- sample/hello/extconf.rb
|
88
81
|
- sample/hello/hello.cpp
|
89
|
-
- test/fixtures/cast/Makefile
|
90
|
-
- test/fixtures/cast/cast.cpp
|
91
|
-
- test/fixtures/cast/cast.o
|
92
|
-
- test/fixtures/cast/cast.so
|
93
|
-
- test/fixtures/cast/extconf.rb
|
94
|
-
- test/fixtures/cast/mkmf.log
|
95
|
-
- test/fixtures/class/Makefile
|
96
|
-
- test/fixtures/class/class.cpp
|
97
|
-
- test/fixtures/class/class.o
|
98
|
-
- test/fixtures/class/class.so
|
99
|
-
- test/fixtures/class/extconf.rb
|
100
|
-
- test/fixtures/class/mkmf.log
|
101
|
-
- test/fixtures/object/Makefile
|
102
|
-
- test/fixtures/object/extconf.rb
|
103
|
-
- test/fixtures/object/mkmf.log
|
104
|
-
- test/fixtures/object/object.cpp
|
105
|
-
- test/fixtures/object/object.o
|
106
|
-
- test/fixtures/object/object.so
|
107
|
-
- test/fixtures/protect/Makefile
|
108
|
-
- test/fixtures/protect/extconf.rb
|
109
|
-
- test/fixtures/protect/mkmf.log
|
110
|
-
- test/fixtures/protect/protect.cpp
|
111
|
-
- test/fixtures/protect/protect.o
|
112
|
-
- test/fixtures/protect/protect.so
|
113
|
-
- test/helper.rb
|
114
|
-
- test/run-test.rb
|
115
|
-
- test/test-cast.rb
|
116
|
-
- test/test-class.rb
|
117
|
-
- test/test-object.rb
|
118
|
-
- test/test-protect.rb
|
119
82
|
homepage: https://github.com/red-data-tools/extpp
|
120
83
|
licenses:
|
121
84
|
- BSD-2-Clause
|
@@ -135,38 +98,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
98
|
- !ruby/object:Gem::Version
|
136
99
|
version: '0'
|
137
100
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
101
|
+
rubygems_version: 3.3.0.dev
|
139
102
|
signing_key:
|
140
103
|
specification_version: 4
|
141
104
|
summary: Ext++ is a Ruby extension that provides C++ API for writing Ruby extension.
|
142
|
-
test_files:
|
143
|
-
- test/fixtures/cast/Makefile
|
144
|
-
- test/fixtures/cast/cast.cpp
|
145
|
-
- test/fixtures/cast/cast.o
|
146
|
-
- test/fixtures/cast/cast.so
|
147
|
-
- test/fixtures/cast/extconf.rb
|
148
|
-
- test/fixtures/cast/mkmf.log
|
149
|
-
- test/fixtures/class/Makefile
|
150
|
-
- test/fixtures/class/class.cpp
|
151
|
-
- test/fixtures/class/class.o
|
152
|
-
- test/fixtures/class/class.so
|
153
|
-
- test/fixtures/class/extconf.rb
|
154
|
-
- test/fixtures/class/mkmf.log
|
155
|
-
- test/fixtures/object/Makefile
|
156
|
-
- test/fixtures/object/extconf.rb
|
157
|
-
- test/fixtures/object/mkmf.log
|
158
|
-
- test/fixtures/object/object.cpp
|
159
|
-
- test/fixtures/object/object.o
|
160
|
-
- test/fixtures/object/object.so
|
161
|
-
- test/fixtures/protect/Makefile
|
162
|
-
- test/fixtures/protect/extconf.rb
|
163
|
-
- test/fixtures/protect/mkmf.log
|
164
|
-
- test/fixtures/protect/protect.cpp
|
165
|
-
- test/fixtures/protect/protect.o
|
166
|
-
- test/fixtures/protect/protect.so
|
167
|
-
- test/helper.rb
|
168
|
-
- test/run-test.rb
|
169
|
-
- test/test-cast.rb
|
170
|
-
- test/test-class.rb
|
171
|
-
- test/test-object.rb
|
172
|
-
- test/test-protect.rb
|
105
|
+
test_files: []
|