rice 1.5.3 → 1.6.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Doxyfile +1 -1
- data/Makefile.in +3 -2
- data/aclocal.m4 +3 -3
- data/rice/Exception.cpp +1 -1
- data/rice/Makefile.in +1 -1
- data/rice/detail/method_data.cpp +38 -91
- data/rice/detail/ruby_version_code.hpp +1 -1
- data/rice/to_from_ruby.ipp +2 -2
- data/ruby/Makefile.in +1 -1
- data/ruby/lib/Makefile.in +1 -1
- data/ruby/lib/version.rb +1 -1
- data/sample/Makefile.in +1 -1
- data/test/Makefile.in +1 -1
- data/test/ext/Makefile.in +1 -1
- data/test/test_Data_Type.cpp +6 -6
- metadata +10 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1fade81ed5022f898e556d016667ce935181a446
|
4
|
+
data.tar.gz: f95a76367b0d6062b0521073bdcecc44e40be2c9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3baabdf3094320d857599b3ed2b09015e3ac0ab1b9851f6f1a2c1a5b9f81d65d0c307661db97a8b67a14c40e5f6037140fa08ca648f65175e68d1a978af83570
|
7
|
+
data.tar.gz: 6496d5a96365b6cdbac504001c01f9093ade6d6023595eb52c22f5739980720748e14dd5595d28ea2593d3f4ab46a616a90c971b3b0ad2c3685786bdf71c0e5c
|
data/Doxyfile
CHANGED
@@ -38,7 +38,7 @@ PROJECT_NAME = "Rice"
|
|
38
38
|
# could be handy for archiving the generated documentation or if some version
|
39
39
|
# control system is used.
|
40
40
|
|
41
|
-
PROJECT_NUMBER = 1.
|
41
|
+
PROJECT_NUMBER = 1.6.0
|
42
42
|
|
43
43
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
44
44
|
# for a project that appears at the top of each page and should give viewer a
|
data/Makefile.in
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Makefile.in generated by automake 1.14 from Makefile.am.
|
1
|
+
# Makefile.in generated by automake 1.14.1 from Makefile.am.
|
2
2
|
# @configure_input@
|
3
3
|
|
4
4
|
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
|
@@ -672,9 +672,10 @@ distcheck: dist
|
|
672
672
|
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
673
673
|
&& am__cwd=`pwd` \
|
674
674
|
&& $(am__cd) "$(distdir)"/_build \
|
675
|
-
&& ../configure
|
675
|
+
&& ../configure \
|
676
676
|
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
677
677
|
$(DISTCHECK_CONFIGURE_FLAGS) \
|
678
|
+
--srcdir=.. --prefix="$$dc_install_base" \
|
678
679
|
&& $(MAKE) $(AM_MAKEFLAGS) \
|
679
680
|
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
680
681
|
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
data/aclocal.m4
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# generated automatically by aclocal 1.14 -*- Autoconf -*-
|
1
|
+
# generated automatically by aclocal 1.14.1 -*- Autoconf -*-
|
2
2
|
|
3
3
|
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
4
4
|
|
@@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
|
|
35
35
|
[am__api_version='1.14'
|
36
36
|
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
37
37
|
dnl require some minimum version. Point them to the right macro.
|
38
|
-
m4_if([$1], [1.14], [],
|
38
|
+
m4_if([$1], [1.14.1], [],
|
39
39
|
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
40
40
|
])
|
41
41
|
|
@@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
|
51
51
|
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
52
52
|
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
53
53
|
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
54
|
-
[AM_AUTOMAKE_VERSION([1.14])dnl
|
54
|
+
[AM_AUTOMAKE_VERSION([1.14.1])dnl
|
55
55
|
m4_ifndef([AC_AUTOCONF_VERSION],
|
56
56
|
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
57
57
|
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
data/rice/Exception.cpp
CHANGED
data/rice/Makefile.in
CHANGED
data/rice/detail/method_data.cpp
CHANGED
@@ -8,67 +8,49 @@
|
|
8
8
|
#undef PACKAGE_VERSION
|
9
9
|
#include "../config.hpp"
|
10
10
|
|
11
|
-
#ifndef RUBY_VM
|
12
|
-
/* pre-YARV */
|
13
|
-
#include <node.h>
|
14
|
-
#include "env.hpp"
|
15
|
-
#endif
|
16
|
-
|
17
11
|
/* 1.8.6 compatibility */
|
18
12
|
#ifndef RCLASS_M_TBL
|
19
13
|
#define RCLASS_M_TBL(x) (RCLASS(x)->m_tbl)
|
20
14
|
#endif
|
21
15
|
|
22
|
-
namespace
|
23
|
-
{
|
24
16
|
|
25
|
-
|
17
|
+
#ifndef RUBY_VM
|
18
|
+
/* pre-YARV */
|
19
|
+
#include <node.h>
|
20
|
+
#include "env.hpp"
|
26
21
|
|
27
|
-
|
22
|
+
namespace {
|
23
|
+
int rb_frame_method_id_and_class(ID *idp, VALUE *klassp) {
|
24
|
+
*klassp = ruby_frame->last_class;
|
25
|
+
*idp = ruby_frame->last_func;
|
26
|
+
return 1;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
#endif
|
28
30
|
|
29
|
-
#
|
31
|
+
#define RICE_ID rb_intern("__rice__")
|
30
32
|
|
31
33
|
VALUE
|
32
34
|
Rice::detail::
|
33
35
|
method_data()
|
34
36
|
{
|
35
37
|
ID id;
|
36
|
-
VALUE
|
37
|
-
if (!rb_frame_method_id_and_class(&id, &
|
38
|
+
VALUE klass;
|
39
|
+
if (!rb_frame_method_id_and_class(&id, &klass))
|
38
40
|
{
|
39
41
|
rb_raise(
|
40
42
|
rb_eRuntimeError,
|
41
43
|
"Cannot get method id and class for function");
|
42
44
|
}
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
if(rb_type(memo) != T_ARRAY && RARRAY_PTR(memo)[0] != DATA_MAGIC)
|
47
|
-
{
|
48
|
-
/* This can happen for module functions that are created after
|
49
|
-
* the stub function */
|
50
|
-
rb_raise(
|
51
|
-
rb_eRuntimeError,
|
52
|
-
"Cannot find method data for module function");
|
46
|
+
if (rb_type(klass) == T_ICLASS) {
|
47
|
+
klass = rb_class_of(klass);
|
53
48
|
}
|
54
49
|
|
55
|
-
|
50
|
+
VALUE store = rb_ivar_get(klass, RICE_ID);
|
51
|
+
return (store == Qnil) ? Qnil : rb_ivar_get(store, id);
|
56
52
|
}
|
57
53
|
|
58
|
-
#else
|
59
|
-
|
60
|
-
/* pre-YARV */
|
61
|
-
|
62
|
-
VALUE
|
63
|
-
Rice::detail::
|
64
|
-
method_data()
|
65
|
-
{
|
66
|
-
VALUE origin = ruby_frame->last_class;
|
67
|
-
VALUE memo = rb_ivar_get(origin, 0);
|
68
|
-
return RARRAY_PTR(memo)[1];
|
69
|
-
}
|
70
|
-
|
71
|
-
#endif
|
72
54
|
|
73
55
|
// Define a method and attach data to it.
|
74
56
|
// The method looks to ruby like a normal aliased CFUNC, with a modified
|
@@ -85,75 +67,40 @@ method_data()
|
|
85
67
|
// version to ruby version, but the concept is the same across all of
|
86
68
|
// them.
|
87
69
|
//
|
88
|
-
// In Rice, we make use of this by
|
89
|
-
//
|
90
|
-
// method in our class, but its origin class is our dummy class.
|
70
|
+
// In Rice, we make use of this by attach the data to a dummy object
|
71
|
+
// (store) in the class variables table.
|
91
72
|
//
|
92
|
-
// When Ruby makes a method call, it stores the
|
93
|
-
// current stack frame. When Ruby calls into Rice, we grab
|
94
|
-
// class from the stack frame, then pull the data out
|
95
|
-
// class.
|
73
|
+
// When Ruby makes a method call, it stores the class Object and method
|
74
|
+
// ID in the current stack frame. When Ruby calls into Rice, we grab
|
75
|
+
// the class and method ID from the stack frame, then pull the data out
|
76
|
+
// of the class. The data item is then used to determine how to convert
|
96
77
|
// arguments and return type, how to handle exceptions, etc.
|
97
78
|
//
|
98
|
-
// It used to be the case that Rice would "fix" the call frame so that
|
99
|
-
// the modified origin class was not visible to the called function (it
|
100
|
-
// would appear to the callee that the origin class was the same as the
|
101
|
-
// class it was defined on). However, this required modifying the call
|
102
|
-
// frame directly, and the layout of that frame varies from version to
|
103
|
-
// version. To keep things simple (and as a side effect improve
|
104
|
-
// performance), Rice no longer hides the modified origin class this way.
|
105
|
-
//
|
106
|
-
// Functions that make use of "last_class" (1.8) or
|
107
|
-
// "rb_frame_method_id_and_class" (1.9) will therefore not get the
|
108
|
-
// results they expect.
|
109
79
|
VALUE
|
110
80
|
Rice::detail::
|
111
81
|
define_method_with_data(
|
112
82
|
VALUE klass, ID id, VALUE (*cfunc)(ANYARGS), int arity, VALUE data)
|
113
83
|
{
|
114
|
-
VALUE
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
VALUE origin_class_name = rb_str_plus(
|
125
|
-
real_class_name,
|
126
|
-
rb_str_new2("<data wrapper>"));
|
127
|
-
|
128
|
-
// Create the modified origin class
|
129
|
-
FL_SET(origin, FL_SINGLETON);
|
130
|
-
rb_singleton_class_attached(origin, klass);
|
131
|
-
rb_name_class(origin, SYM2ID(rb_str_intern(origin_class_name)));
|
84
|
+
VALUE store = rb_attr_get(klass, RICE_ID);
|
85
|
+
|
86
|
+
if (store == Qnil) {
|
87
|
+
store = rb_obj_alloc(rb_cObject);
|
88
|
+
// store is stored in the instance variables table with
|
89
|
+
// name "__rice__".
|
90
|
+
// since "__rice__" does not have the @ prefix,
|
91
|
+
// so it can never be read at the Ruby level.
|
92
|
+
rb_ivar_set(klass, RICE_ID, store);
|
93
|
+
}
|
132
94
|
|
133
|
-
|
134
|
-
rb_ivar_set(origin, 0, memo);
|
95
|
+
rb_ivar_set(store, id, data);
|
135
96
|
|
136
97
|
// Create the aliased method on the origin class
|
137
98
|
rb_define_method(
|
138
|
-
|
99
|
+
klass,
|
139
100
|
rb_id2name(id),
|
140
101
|
cfunc,
|
141
102
|
arity);
|
142
103
|
|
143
|
-
// Alias the method in the origin class so we can copy it to another
|
144
|
-
// class with the origin class intact as part of the method entry
|
145
|
-
rb_alias(
|
146
|
-
origin,
|
147
|
-
rb_intern("dummy"),
|
148
|
-
id);
|
149
|
-
|
150
|
-
// Copy the method entry to the real class
|
151
|
-
st_data_t dummy_entry;
|
152
|
-
st_lookup(RCLASS_M_TBL(origin), rb_intern("dummy"), &dummy_entry);
|
153
|
-
st_insert(RCLASS_M_TBL(klass), id, dummy_entry);
|
154
|
-
|
155
|
-
// Clear the table so we don't try to double-free the method entry
|
156
|
-
RCLASS_M_TBL(origin) = st_init_numtable();
|
157
|
-
|
158
104
|
return Qnil;
|
159
105
|
}
|
106
|
+
|
data/rice/to_from_ruby.ipp
CHANGED
@@ -39,7 +39,7 @@ template<>
|
|
39
39
|
inline
|
40
40
|
int from_ruby<int>(Rice::Object x)
|
41
41
|
{
|
42
|
-
return Rice::
|
42
|
+
return Rice::detail::num2int(x);
|
43
43
|
}
|
44
44
|
|
45
45
|
template<>
|
@@ -101,7 +101,7 @@ template<>
|
|
101
101
|
inline
|
102
102
|
unsigned int from_ruby<unsigned int>(Rice::Object x)
|
103
103
|
{
|
104
|
-
return Rice::
|
104
|
+
return Rice::detail::num2uint(x);
|
105
105
|
}
|
106
106
|
|
107
107
|
template<>
|
data/ruby/Makefile.in
CHANGED
data/ruby/lib/Makefile.in
CHANGED
data/ruby/lib/version.rb
CHANGED
data/sample/Makefile.in
CHANGED
data/test/Makefile.in
CHANGED
data/test/ext/Makefile.in
CHANGED
data/test/test_Data_Type.cpp
CHANGED
@@ -46,7 +46,7 @@ namespace {
|
|
46
46
|
|
47
47
|
int process() {
|
48
48
|
std::vector<Listener*>::iterator i = mListeners.begin();
|
49
|
-
int accum = 0;
|
49
|
+
int accum = 0;
|
50
50
|
for(; i != mListeners.end(); i++) {
|
51
51
|
accum += (*i)->getValue();
|
52
52
|
}
|
@@ -54,7 +54,7 @@ namespace {
|
|
54
54
|
return accum;
|
55
55
|
}
|
56
56
|
|
57
|
-
|
57
|
+
size_t listenerCount() { return mListeners.size(); }
|
58
58
|
|
59
59
|
private:
|
60
60
|
std::vector<Listener*> mListeners;
|
@@ -100,7 +100,7 @@ TESTCASE(can_send_ruby_instance_back_into_rice)
|
|
100
100
|
* The following test SEGFAULTs right now
|
101
101
|
*/
|
102
102
|
/*
|
103
|
-
TESTCASE(no_super_in_constructor_still_works)
|
103
|
+
TESTCASE(no_super_in_constructor_still_works)
|
104
104
|
{
|
105
105
|
Module m = define_module("TestingModule");
|
106
106
|
Object handler = m.instance_eval("@handler = ListenerHandler.new");
|
@@ -127,14 +127,14 @@ TESTCASE(no_super_in_constructor_still_works)
|
|
127
127
|
* Two ways of defining if types are implicitly castable
|
128
128
|
*
|
129
129
|
* 1) operator
|
130
|
-
* 2) constructor
|
130
|
+
* 2) constructor
|
131
131
|
*/
|
132
132
|
|
133
133
|
/**
|
134
134
|
* Examples here taken from Ogre's Math library.
|
135
135
|
* This uses the constructor method of casting types.
|
136
136
|
*/
|
137
|
-
namespace
|
137
|
+
namespace
|
138
138
|
{
|
139
139
|
const int degree2Radians = (3.14 / 180.0);
|
140
140
|
const int radian2Degrees = (180.0 / 3.14);
|
@@ -157,7 +157,7 @@ namespace
|
|
157
157
|
class Radian
|
158
158
|
{
|
159
159
|
public:
|
160
|
-
explicit Radian(float r) : val_(r) {}
|
160
|
+
explicit Radian(float r) : val_(r) {}
|
161
161
|
Radian(const Degree& d) : val_(d.valueRadians()) {}
|
162
162
|
|
163
163
|
float valueRadians() const { return val_; }
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.6.0.pre
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Paul Brannan
|
@@ -10,20 +9,14 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-01-31 00:00:00.000000000 Z
|
14
13
|
dependencies: []
|
15
|
-
description:
|
16
|
-
and
|
17
|
-
|
14
|
+
description: |
|
15
|
+
Rice is a C++ interface to Ruby's C API. It provides a type-safe and
|
18
16
|
exception-safe interface in order to make embedding Ruby and writing
|
19
|
-
|
20
17
|
Ruby extensions with C++ easier. It is similar to Boost.Python in many
|
21
|
-
|
22
18
|
ways, but also attempts to provide an object-oriented interface to all
|
23
|
-
|
24
19
|
of the Ruby C API.
|
25
|
-
|
26
|
-
'
|
27
20
|
email:
|
28
21
|
- curlypaul924@gmail.com
|
29
22
|
- jasonroelofs@gmail.com
|
@@ -235,27 +228,26 @@ files:
|
|
235
228
|
- test/test_rice.rb
|
236
229
|
homepage: http://rice.rubyforge.org/
|
237
230
|
licenses: []
|
231
|
+
metadata: {}
|
238
232
|
post_install_message:
|
239
233
|
rdoc_options: []
|
240
234
|
require_paths:
|
241
235
|
- ruby/lib
|
242
236
|
required_ruby_version: !ruby/object:Gem::Requirement
|
243
|
-
none: false
|
244
237
|
requirements:
|
245
|
-
- -
|
238
|
+
- - '>='
|
246
239
|
- !ruby/object:Gem::Version
|
247
240
|
version: '0'
|
248
241
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
249
|
-
none: false
|
250
242
|
requirements:
|
251
|
-
- -
|
243
|
+
- - '>'
|
252
244
|
- !ruby/object:Gem::Version
|
253
|
-
version:
|
245
|
+
version: 1.3.1
|
254
246
|
requirements: []
|
255
247
|
rubyforge_project: rice
|
256
|
-
rubygems_version:
|
248
|
+
rubygems_version: 2.0.14
|
257
249
|
signing_key:
|
258
|
-
specification_version:
|
250
|
+
specification_version: 4
|
259
251
|
summary: Ruby Interface for C++ Extensions
|
260
252
|
test_files:
|
261
253
|
- test/test_rice.rb
|