rice 1.1.0 → 1.2.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.
Files changed (54) hide show
  1. data/Doxyfile +1 -1
  2. data/Makefile.in +3 -2
  3. data/README +247 -16
  4. data/aclocal.m4 +62 -51
  5. data/configure +1585 -1456
  6. data/extconf.rb +9 -1
  7. data/rice/Arg.hpp +8 -0
  8. data/rice/Arg_impl.hpp +124 -0
  9. data/rice/Arg_operators.cpp +21 -0
  10. data/rice/Arg_operators.hpp +19 -0
  11. data/rice/Constructor.hpp +150 -0
  12. data/rice/Data_Type.ipp +51 -6
  13. data/rice/Director.cpp +19 -0
  14. data/rice/Director.hpp +47 -0
  15. data/rice/Enum.hpp +2 -3
  16. data/rice/Enum.ipp +1 -1
  17. data/rice/Hash.hpp +1 -1
  18. data/rice/Makefile.am +7 -0
  19. data/rice/Makefile.in +18 -7
  20. data/rice/Module_impl.hpp +36 -3
  21. data/rice/Module_impl.ipp +56 -7
  22. data/rice/VM.cpp +2 -2
  23. data/rice/config.hpp +1 -1
  24. data/rice/detail/Arguments.hpp +118 -0
  25. data/rice/detail/Auto_Function_Wrapper.hpp +206 -96
  26. data/rice/detail/Auto_Function_Wrapper.ipp +1687 -144
  27. data/rice/detail/Auto_Member_Function_Wrapper.hpp +234 -123
  28. data/rice/detail/Auto_Member_Function_Wrapper.ipp +1133 -306
  29. data/rice/detail/Caster.hpp +3 -1
  30. data/rice/detail/creation_funcs.hpp +0 -8
  31. data/rice/detail/creation_funcs.ipp +1 -27
  32. data/rice/detail/define_method_and_auto_wrap.hpp +3 -1
  33. data/rice/detail/define_method_and_auto_wrap.ipp +4 -3
  34. data/rice/detail/object_call.ipp +1 -1
  35. data/rice/detail/ruby.hpp +1 -33
  36. data/rice/detail/wrap_function.hpp +103 -48
  37. data/rice/detail/wrap_function.ipp +154 -96
  38. data/rice/generate_code.rb +520 -55
  39. data/rice/global_function.hpp +12 -1
  40. data/rice/global_function.ipp +14 -2
  41. data/ruby/Makefile.in +5 -4
  42. data/ruby/lib/Makefile.in +4 -3
  43. data/ruby/lib/version.rb +1 -1
  44. data/sample/Makefile.in +4 -3
  45. data/test/Makefile.am +2 -0
  46. data/test/Makefile.in +32 -13
  47. data/test/test_Class.cpp +36 -14
  48. data/test/test_Constructor.cpp +176 -1
  49. data/test/test_Data_Type.cpp +121 -0
  50. data/test/test_Director.cpp +225 -0
  51. data/test/test_Enum.cpp +33 -0
  52. data/test/test_Module.cpp +175 -0
  53. data/test/test_global_functions.cpp +70 -1
  54. metadata +27 -7
@@ -21,7 +21,7 @@ namespace {
21
21
 
22
22
  void method_with_args(Object self, int arg) {
23
23
  method_with_args_arg0 = arg;
24
- }
24
+ }
25
25
 
26
26
  }
27
27
 
@@ -43,3 +43,72 @@ TESTCASE(exposes_global_functions_with_arguments)
43
43
  ASSERT_EQUAL(10, method_with_args_arg0);
44
44
  }
45
45
 
46
+ namespace
47
+ {
48
+ int defaults_method_one_arg1;
49
+ int defaults_method_one_arg2;
50
+ bool defaults_method_one_arg3 = false;
51
+
52
+ void defaults_method_one(int arg1, int arg2 = 3, bool arg3 = true)
53
+ {
54
+ defaults_method_one_arg1 = arg1;
55
+ defaults_method_one_arg2 = arg2;
56
+ defaults_method_one_arg3 = arg3;
57
+ }
58
+
59
+ int defaults_returns(int arg1, int arg2 = 3)
60
+ {
61
+ return arg1 * arg2;
62
+ }
63
+ }
64
+
65
+ TESTCASE(default_arguments_for_define_global_function)
66
+ {
67
+ define_global_function("foo", &defaults_method_one, (Arg("arg1"), Arg("arg2") = (int)3, Arg("arg3") = (bool)true));
68
+ Module m(rb_mKernel);
69
+
70
+ m.call("foo", 2);
71
+
72
+ ASSERT_EQUAL(2, defaults_method_one_arg1);
73
+ ASSERT_EQUAL(3, defaults_method_one_arg2);
74
+ ASSERT(defaults_method_one_arg3);
75
+
76
+ m.call("foo", 11, 10);
77
+
78
+ ASSERT_EQUAL(11, defaults_method_one_arg1);
79
+ ASSERT_EQUAL(10, defaults_method_one_arg2);
80
+ ASSERT(defaults_method_one_arg3);
81
+
82
+ m.call("foo", 22, 33, false);
83
+
84
+ ASSERT_EQUAL(22, defaults_method_one_arg1);
85
+ ASSERT_EQUAL(33, defaults_method_one_arg2);
86
+ ASSERT(!defaults_method_one_arg3);
87
+ }
88
+
89
+ TESTCASE(default_arguments_for_define_global_function_and_returning)
90
+ {
91
+ define_global_function("foo_ret", &defaults_returns, (Arg("arg1"), Arg("arg2") = (int)3));
92
+ Module m(rb_mKernel);
93
+
94
+ Object o = m.call("foo_ret", 2);
95
+ ASSERT_EQUAL(INT2NUM(6), o.value());
96
+
97
+ o = m.call("foo_ret", 5, 10);
98
+ ASSERT_EQUAL(INT2NUM(50), o.value());
99
+ }
100
+
101
+ namespace {
102
+ int the_one_default_arg = 0;
103
+ void method_with_one_default_arg(int num = 4) {
104
+ the_one_default_arg = num;
105
+ }
106
+ }
107
+
108
+ TESTCASE(single_default_argument)
109
+ {
110
+ define_global_function("foo", &method_with_one_default_arg, (Arg("num") = (int)4));
111
+ Module m(rb_mKernel);
112
+ m.call("foo");
113
+ ASSERT_EQUAL(4, the_one_default_arg);
114
+ }
metadata CHANGED
@@ -1,20 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rice
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Brannan
8
+ - Jason Roelofs
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2009-04-27 00:00:00 -04:00
13
+ date: 2009-10-26 00:00:00 -04:00
13
14
  default_executable:
14
15
  dependencies: []
15
16
 
16
- description: Rice is a C++ interface to Ruby's C API. It provides a type-safe and exception-safe interface in order to make embedding Ruby and writing Ruby extensions with C++ easier. It is similar to Boost.Python in many ways, but also attempts to provide an object-oriented interface to all of the Ruby C API.
17
- email: curlypaul924@gmail.com
17
+ description: |
18
+ Rice is a C++ interface to Ruby's C API. It provides a type-safe and
19
+ exception-safe interface in order to make embedding Ruby and writing
20
+ Ruby extensions with C++ easier. It is similar to Boost.Python in many
21
+ ways, but also attempts to provide an object-oriented interface to all
22
+ of the Ruby C API.
23
+
24
+ email:
25
+ - curlypaul924@gmail.com
26
+ - jameskilton@gmail.com
18
27
  executables: []
19
28
 
20
29
  extensions:
@@ -54,6 +63,7 @@ files:
54
63
  - sample/Makefile.in
55
64
  - test/Makefile.am
56
65
  - test/Makefile.in
66
+ - rice/Arg.hpp
57
67
  - rice/Exception_Base.hpp
58
68
  - rice/Constructor.hpp
59
69
  - rice/Object_defn.hpp
@@ -78,12 +88,15 @@ files:
78
88
  - rice/Data_Object.hpp
79
89
  - rice/Class.ipp
80
90
  - rice/Module.cpp
91
+ - rice/Arg_impl.hpp
81
92
  - rice/Hash.hpp
82
93
  - rice/Symbol.ipp
83
94
  - rice/Class_defn.hpp
95
+ - rice/Arg_operators.cpp
84
96
  - rice/Object.hpp
85
97
  - rice/Allocation_Strategies.hpp
86
98
  - rice/Enum.ipp
99
+ - rice/Director.cpp
87
100
  - rice/Object.cpp
88
101
  - rice/Address_Registration_Guard_defn.hpp
89
102
  - rice/Builtin_Object.ipp
@@ -106,11 +119,13 @@ files:
106
119
  - rice/String.cpp
107
120
  - rice/Object.ipp
108
121
  - rice/Data_Type_defn.hpp
122
+ - rice/Director.hpp
109
123
  - rice/Critical_Guard.hpp
110
124
  - rice/Jump_Tag.hpp
111
125
  - rice/to_from_ruby.ipp
112
126
  - rice/to_from_ruby.hpp
113
127
  - rice/Module_impl.hpp
128
+ - rice/Arg_operators.hpp
114
129
  - rice/Struct.hpp
115
130
  - rice/Identifier.hpp
116
131
  - rice/global_function.hpp
@@ -127,6 +142,7 @@ files:
127
142
  - rice/rubypp.rb
128
143
  - rice/config.hpp.in
129
144
  - rice/detail/creation_funcs.hpp
145
+ - rice/detail/Arguments.hpp
130
146
  - rice/detail/wrap_function.ipp
131
147
  - rice/detail/check_ruby_type.cpp
132
148
  - rice/detail/demangle.cpp
@@ -184,6 +200,7 @@ files:
184
200
  - sample/inheritance/extconf.rb
185
201
  - sample/inheritance/animals.cpp
186
202
  - sample/inheritance/test.rb
203
+ - test/test_Data_Type.cpp
187
204
  - test/test_Exception.cpp
188
205
  - test/test_To_From_Ruby.cpp
189
206
  - test/test_String.cpp
@@ -207,8 +224,11 @@ files:
207
224
  - test/unittest.cpp
208
225
  - test/test_Enum.cpp
209
226
  - test/test_Address_Registration_Guard.cpp
210
- has_rdoc: false
227
+ - test/test_Director.cpp
228
+ has_rdoc: true
211
229
  homepage: http://rice.rubyforge.org/
230
+ licenses: []
231
+
212
232
  post_install_message:
213
233
  rdoc_options: []
214
234
 
@@ -229,9 +249,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
249
  requirements: []
230
250
 
231
251
  rubyforge_project: rice
232
- rubygems_version: 1.3.1
252
+ rubygems_version: 1.3.5
233
253
  signing_key:
234
- specification_version: 2
254
+ specification_version: 3
235
255
  summary: Ruby Interface for C++ Extensions
236
256
  test_files:
237
257
  - test/test_rice.rb