keyme-rice 1.5.1.keyme

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 (202) hide show
  1. checksums.yaml +15 -0
  2. data/COPYING +23 -0
  3. data/Doxyfile +1253 -0
  4. data/Makefile.am +26 -0
  5. data/Makefile.in +853 -0
  6. data/README +1124 -0
  7. data/README.mingw +8 -0
  8. data/Rakefile +34 -0
  9. data/aclocal.m4 +971 -0
  10. data/bootstrap +8 -0
  11. data/config.guess +1530 -0
  12. data/config.sub +1773 -0
  13. data/configure +7121 -0
  14. data/configure.ac +52 -0
  15. data/depcomp +688 -0
  16. data/doxygen.ac +314 -0
  17. data/doxygen.am +186 -0
  18. data/extconf.rb +51 -0
  19. data/install-sh +527 -0
  20. data/missing +331 -0
  21. data/post-autoconf.rb +22 -0
  22. data/post-automake.rb +28 -0
  23. data/rice/Address_Registration_Guard.cpp +22 -0
  24. data/rice/Address_Registration_Guard.hpp +7 -0
  25. data/rice/Address_Registration_Guard.ipp +37 -0
  26. data/rice/Address_Registration_Guard_defn.hpp +75 -0
  27. data/rice/Arg.hpp +8 -0
  28. data/rice/Arg_impl.hpp +127 -0
  29. data/rice/Arg_operators.cpp +21 -0
  30. data/rice/Arg_operators.hpp +19 -0
  31. data/rice/Array.hpp +220 -0
  32. data/rice/Array.ipp +263 -0
  33. data/rice/Builtin_Object.hpp +8 -0
  34. data/rice/Builtin_Object.ipp +50 -0
  35. data/rice/Builtin_Object_defn.hpp +50 -0
  36. data/rice/Class.cpp +57 -0
  37. data/rice/Class.hpp +8 -0
  38. data/rice/Class.ipp +6 -0
  39. data/rice/Class_defn.hpp +83 -0
  40. data/rice/Constructor.hpp +368 -0
  41. data/rice/Critical_Guard.hpp +40 -0
  42. data/rice/Critical_Guard.ipp +26 -0
  43. data/rice/Data_Object.hpp +8 -0
  44. data/rice/Data_Object.ipp +133 -0
  45. data/rice/Data_Object_defn.hpp +138 -0
  46. data/rice/Data_Type.cpp +54 -0
  47. data/rice/Data_Type.hpp +8 -0
  48. data/rice/Data_Type.ipp +365 -0
  49. data/rice/Data_Type_defn.hpp +261 -0
  50. data/rice/Data_Type_fwd.hpp +12 -0
  51. data/rice/Director.cpp +13 -0
  52. data/rice/Director.hpp +39 -0
  53. data/rice/Enum.hpp +117 -0
  54. data/rice/Enum.ipp +246 -0
  55. data/rice/Exception.cpp +59 -0
  56. data/rice/Exception.hpp +9 -0
  57. data/rice/Exception_Base.hpp +8 -0
  58. data/rice/Exception_Base.ipp +13 -0
  59. data/rice/Exception_Base_defn.hpp +27 -0
  60. data/rice/Exception_defn.hpp +69 -0
  61. data/rice/Hash.hpp +227 -0
  62. data/rice/Hash.ipp +330 -0
  63. data/rice/Identifier.cpp +8 -0
  64. data/rice/Identifier.hpp +50 -0
  65. data/rice/Identifier.ipp +33 -0
  66. data/rice/Jump_Tag.hpp +24 -0
  67. data/rice/Makefile.am +129 -0
  68. data/rice/Makefile.in +769 -0
  69. data/rice/Module.cpp +84 -0
  70. data/rice/Module.hpp +8 -0
  71. data/rice/Module.ipp +6 -0
  72. data/rice/Module_defn.hpp +88 -0
  73. data/rice/Module_impl.hpp +281 -0
  74. data/rice/Module_impl.ipp +348 -0
  75. data/rice/Object.cpp +160 -0
  76. data/rice/Object.hpp +8 -0
  77. data/rice/Object.ipp +19 -0
  78. data/rice/Object_defn.hpp +191 -0
  79. data/rice/Require_Guard.hpp +21 -0
  80. data/rice/String.cpp +94 -0
  81. data/rice/String.hpp +89 -0
  82. data/rice/Struct.cpp +117 -0
  83. data/rice/Struct.hpp +162 -0
  84. data/rice/Struct.ipp +26 -0
  85. data/rice/Symbol.cpp +25 -0
  86. data/rice/Symbol.hpp +66 -0
  87. data/rice/Symbol.ipp +44 -0
  88. data/rice/VM.cpp +82 -0
  89. data/rice/VM.hpp +32 -0
  90. data/rice/config.hpp +44 -0
  91. data/rice/config.hpp.in +43 -0
  92. data/rice/detail/Arguments.hpp +118 -0
  93. data/rice/detail/Auto_Function_Wrapper.hpp +898 -0
  94. data/rice/detail/Auto_Function_Wrapper.ipp +3694 -0
  95. data/rice/detail/Auto_Member_Function_Wrapper.hpp +897 -0
  96. data/rice/detail/Auto_Member_Function_Wrapper.ipp +2774 -0
  97. data/rice/detail/Caster.hpp +103 -0
  98. data/rice/detail/Exception_Handler.hpp +8 -0
  99. data/rice/detail/Exception_Handler.ipp +68 -0
  100. data/rice/detail/Exception_Handler_defn.hpp +96 -0
  101. data/rice/detail/Iterator.hpp +93 -0
  102. data/rice/detail/Not_Copyable.hpp +25 -0
  103. data/rice/detail/Wrapped_Function.hpp +33 -0
  104. data/rice/detail/cfp.hpp +24 -0
  105. data/rice/detail/cfp.ipp +51 -0
  106. data/rice/detail/check_ruby_type.cpp +27 -0
  107. data/rice/detail/check_ruby_type.hpp +23 -0
  108. data/rice/detail/creation_funcs.hpp +37 -0
  109. data/rice/detail/creation_funcs.ipp +36 -0
  110. data/rice/detail/default_allocation_func.hpp +23 -0
  111. data/rice/detail/default_allocation_func.ipp +11 -0
  112. data/rice/detail/define_method_and_auto_wrap.hpp +31 -0
  113. data/rice/detail/define_method_and_auto_wrap.ipp +30 -0
  114. data/rice/detail/demangle.cpp +56 -0
  115. data/rice/detail/demangle.hpp +19 -0
  116. data/rice/detail/env.hpp +19 -0
  117. data/rice/detail/from_ruby.hpp +43 -0
  118. data/rice/detail/from_ruby.ipp +60 -0
  119. data/rice/detail/method_data.cpp +159 -0
  120. data/rice/detail/method_data.hpp +21 -0
  121. data/rice/detail/mininode.cpp +1220 -0
  122. data/rice/detail/mininode.hpp +320 -0
  123. data/rice/detail/node.hpp +13 -0
  124. data/rice/detail/object_call.hpp +69 -0
  125. data/rice/detail/object_call.ipp +131 -0
  126. data/rice/detail/protect.cpp +29 -0
  127. data/rice/detail/protect.hpp +34 -0
  128. data/rice/detail/ruby.hpp +84 -0
  129. data/rice/detail/ruby_version_code.hpp +6 -0
  130. data/rice/detail/ruby_version_code.hpp.in +6 -0
  131. data/rice/detail/rubysig.hpp +19 -0
  132. data/rice/detail/st.hpp +22 -0
  133. data/rice/detail/to_ruby.hpp +22 -0
  134. data/rice/detail/to_ruby.ipp +36 -0
  135. data/rice/detail/traits.hpp +43 -0
  136. data/rice/detail/win32.hpp +16 -0
  137. data/rice/detail/wrap_function.hpp +341 -0
  138. data/rice/detail/wrap_function.ipp +514 -0
  139. data/rice/global_function.hpp +33 -0
  140. data/rice/global_function.ipp +22 -0
  141. data/rice/protect.hpp +92 -0
  142. data/rice/protect.ipp +1134 -0
  143. data/rice/ruby_mark.hpp +13 -0
  144. data/rice/ruby_try_catch.hpp +86 -0
  145. data/rice/rubypp.rb +97 -0
  146. data/rice/to_from_ruby.hpp +8 -0
  147. data/rice/to_from_ruby.ipp +294 -0
  148. data/rice/to_from_ruby_defn.hpp +71 -0
  149. data/ruby/Makefile.am +1 -0
  150. data/ruby/Makefile.in +569 -0
  151. data/ruby/lib/Makefile.am +3 -0
  152. data/ruby/lib/Makefile.in +423 -0
  153. data/ruby/lib/mkmf-rice.rb.in +213 -0
  154. data/ruby/lib/version.rb +3 -0
  155. data/ruby.ac +136 -0
  156. data/sample/Makefile.am +47 -0
  157. data/sample/Makefile.in +408 -0
  158. data/sample/enum/extconf.rb +3 -0
  159. data/sample/enum/sample_enum.cpp +54 -0
  160. data/sample/enum/test.rb +8 -0
  161. data/sample/inheritance/animals.cpp +98 -0
  162. data/sample/inheritance/extconf.rb +3 -0
  163. data/sample/inheritance/test.rb +7 -0
  164. data/sample/map/extconf.rb +3 -0
  165. data/sample/map/map.cpp +81 -0
  166. data/sample/map/test.rb +7 -0
  167. data/test/Makefile.am +77 -0
  168. data/test/Makefile.in +820 -0
  169. data/test/ext/Makefile.am +43 -0
  170. data/test/ext/Makefile.in +404 -0
  171. data/test/ext/t1/Foo.hpp +10 -0
  172. data/test/ext/t1/extconf.rb +2 -0
  173. data/test/ext/t1/t1.cpp +15 -0
  174. data/test/ext/t2/extconf.rb +2 -0
  175. data/test/ext/t2/t2.cpp +11 -0
  176. data/test/test_Address_Registration_Guard.cpp +43 -0
  177. data/test/test_Array.cpp +241 -0
  178. data/test/test_Builtin_Object.cpp +72 -0
  179. data/test/test_Class.cpp +498 -0
  180. data/test/test_Constructor.cpp +128 -0
  181. data/test/test_Critical_Guard.cpp +51 -0
  182. data/test/test_Data_Object.cpp +275 -0
  183. data/test/test_Data_Type.cpp +348 -0
  184. data/test/test_Director.cpp +303 -0
  185. data/test/test_Enum.cpp +195 -0
  186. data/test/test_Exception.cpp +46 -0
  187. data/test/test_Hash.cpp +198 -0
  188. data/test/test_Identifier.cpp +70 -0
  189. data/test/test_Jump_Tag.cpp +17 -0
  190. data/test/test_Memory_Management.cpp +50 -0
  191. data/test/test_Module.cpp +497 -0
  192. data/test/test_Object.cpp +148 -0
  193. data/test/test_String.cpp +94 -0
  194. data/test/test_Struct.cpp +192 -0
  195. data/test/test_Symbol.cpp +63 -0
  196. data/test/test_To_From_Ruby.cpp +321 -0
  197. data/test/test_VM.cpp +26 -0
  198. data/test/test_global_functions.cpp +114 -0
  199. data/test/test_rice.rb +43 -0
  200. data/test/unittest.cpp +136 -0
  201. data/test/unittest.hpp +294 -0
  202. metadata +259 -0
@@ -0,0 +1,98 @@
1
+ #include "rice/Data_Type.hpp"
2
+ #include "rice/Constructor.hpp"
3
+
4
+ using namespace Rice;
5
+
6
+ class Organism
7
+ {
8
+ public:
9
+ virtual ~Organism() = 0;
10
+ virtual char const * name() = 0;
11
+ };
12
+
13
+ Organism::
14
+ ~Organism()
15
+ {
16
+ }
17
+
18
+ class Animal
19
+ : public Organism
20
+ {
21
+ public:
22
+ virtual ~Animal() = 0;
23
+ virtual char const * speak() = 0;
24
+ };
25
+
26
+ Animal::
27
+ ~Animal()
28
+ {
29
+ }
30
+
31
+ class Bear
32
+ : public Animal
33
+ {
34
+ public:
35
+ virtual char const * name()
36
+ {
37
+ return "Bear";
38
+ }
39
+
40
+ virtual char const * speak()
41
+ {
42
+ return "I'm smarter than the average bear";
43
+ }
44
+ };
45
+
46
+ class Dog
47
+ : public Animal
48
+ {
49
+ public:
50
+ virtual char const * name()
51
+ {
52
+ return "Dog";
53
+ }
54
+
55
+ virtual char const * speak()
56
+ {
57
+ return "Woof woof";
58
+ }
59
+ };
60
+
61
+ class Rabbit
62
+ : public Animal
63
+ {
64
+ public:
65
+ virtual char const * name()
66
+ {
67
+ return "Rabbit";
68
+ }
69
+
70
+ virtual char const * speak()
71
+ {
72
+ return "What's up, doc?";
73
+ }
74
+ };
75
+
76
+ extern "C"
77
+ void Init_animals(void)
78
+ {
79
+ RUBY_TRY
80
+ {
81
+ define_class<Organism>("Organism")
82
+ .define_method("name", &Organism::name);
83
+
84
+ define_class<Animal, Organism>("Animal")
85
+ .define_method("speak", &Animal::speak);
86
+
87
+ define_class<Bear, Animal>("Bear")
88
+ .define_constructor(Constructor<Bear>());
89
+
90
+ define_class<Dog, Animal>("Dog")
91
+ .define_constructor(Constructor<Dog>());
92
+
93
+ define_class<Rabbit, Animal>("Rabbit")
94
+ .define_constructor(Constructor<Rabbit>());
95
+ }
96
+ RUBY_CATCH
97
+ }
98
+
@@ -0,0 +1,3 @@
1
+ require 'mkmf-rice'
2
+ create_makefile('animals')
3
+
@@ -0,0 +1,7 @@
1
+ require 'animals'
2
+
3
+ [ Bear, Dog, Rabbit].each do |klass|
4
+ animal = klass.new
5
+ puts "A #{animal.name} says: #{animal.speak}"
6
+ end
7
+
@@ -0,0 +1,3 @@
1
+ require 'mkmf-rice'
2
+ create_makefile('map')
3
+
@@ -0,0 +1,81 @@
1
+ #include "rice/Data_Type.hpp"
2
+ #include "rice/Constructor.hpp"
3
+
4
+ #include <map>
5
+
6
+ using namespace Rice;
7
+
8
+ namespace
9
+ {
10
+
11
+ class Map
12
+ {
13
+ private:
14
+ struct Ruby_Value_Compare
15
+ {
16
+ bool operator()(Object lhs, Object rhs) const
17
+ {
18
+ Object result = lhs.call("<", rhs);
19
+ return result.test();
20
+ }
21
+ };
22
+
23
+ typedef std::map<Object, Object, Ruby_Value_Compare> Value_Map;
24
+
25
+ public:
26
+ Object bracket(Object k)
27
+ {
28
+ Value_Map::iterator it = map_.find(k);
29
+ return it == map_.end() ? Object(Qnil) : it->second;
30
+ }
31
+
32
+ Object bracket_equals(Object k, Object v)
33
+ {
34
+ map_[k] = v;
35
+ return Qnil;
36
+ }
37
+
38
+ Value_Map::iterator begin() { return map_.begin(); }
39
+ Value_Map::iterator end() { return map_.end(); }
40
+
41
+ typedef Value_Map::value_type value_type;
42
+ typedef Value_Map::iterator iterator;
43
+
44
+ private:
45
+ Value_Map map_;
46
+ };
47
+
48
+ Data_Type<Map> rb_cMap;
49
+
50
+ } // namespace
51
+
52
+ template<>
53
+ Object to_ruby<Map::value_type>(Map::value_type const & p)
54
+ {
55
+ return protect(rb_assoc_new, p.first, p.second);
56
+ }
57
+
58
+ #include <iostream>
59
+ extern "C"
60
+ void Init_map(void)
61
+ {
62
+ RUBY_TRY
63
+ {
64
+ Map::iterator (Map::*begin)() = &Map::begin;
65
+ Map::iterator (Map::*end)() = &Map::end;
66
+ Rice::Module rb_mStd = define_module("Std");
67
+
68
+ // TODO: no delete method on the map, because I'm not sure how to
69
+ // make delete work properly while iterating
70
+ rb_cMap =
71
+ define_class_under<Map>(rb_mStd, "Map")
72
+ .define_constructor(Constructor<Map>())
73
+ .define_method("[]", &Map::bracket)
74
+ .define_method("[]=", &Map::bracket_equals)
75
+ .define_iterator(begin, end)
76
+ .include_module(rb_mEnumerable)
77
+ ;
78
+ }
79
+ RUBY_CATCH
80
+ }
81
+
@@ -0,0 +1,7 @@
1
+ require 'map'
2
+ m = Std::Map.new
3
+ m[0] = 1
4
+ m[1] = 2
5
+ m[3] = 3
6
+ m.each { |x| p x }
7
+
data/test/Makefile.am ADDED
@@ -0,0 +1,77 @@
1
+ noinst_PROGRAMS = unittest vm_unittest
2
+
3
+ SUBDIRS = ext
4
+
5
+ TESTS = unittest vm_unittest
6
+
7
+
8
+ check: run_multiple_extensions_test
9
+
10
+ .PHONY: run_multiple_extensions_test
11
+
12
+ run_multiple_extensions_test:
13
+ $(RUBY) test_multiple_extensions.rb
14
+
15
+
16
+ check: run_multiple_extensions_with_inheritance_test
17
+
18
+ .PHONY: run_multiple_extensions_with_inheritance_test
19
+
20
+ run_multiple_extensions_with_inheritance_test:
21
+ $(RUBY) test_multiple_extensions_with_inheritance.rb
22
+
23
+
24
+ check: run_multiple_extensions_same_class_test
25
+
26
+ .PHONY: run_multiple_extensions_same_class_test
27
+
28
+ run_multiple_extensions_same_class_test:
29
+ $(RUBY) test_multiple_extensions_same_class.rb
30
+
31
+
32
+ unittest_SOURCES = \
33
+ unittest.cpp \
34
+ test_Address_Registration_Guard.cpp \
35
+ test_Array.cpp \
36
+ test_Builtin_Object.cpp \
37
+ test_Class.cpp \
38
+ test_Constructor.cpp \
39
+ test_Critical_Guard.cpp \
40
+ test_Data_Object.cpp \
41
+ test_Data_Type.cpp \
42
+ test_Director.cpp \
43
+ test_Enum.cpp \
44
+ test_Exception.cpp \
45
+ test_Hash.cpp \
46
+ test_Identifier.cpp \
47
+ test_Jump_Tag.cpp \
48
+ test_Memory_Management.cpp \
49
+ test_Module.cpp \
50
+ test_Object.cpp \
51
+ test_String.cpp \
52
+ test_Struct.cpp \
53
+ test_Symbol.cpp \
54
+ test_To_From_Ruby.cpp \
55
+ test_global_functions.cpp
56
+
57
+ vm_unittest_SOURCES = \
58
+ unittest.cpp \
59
+ test_VM.cpp
60
+
61
+ AM_CPPFLAGS = \
62
+ -I.. \
63
+ $(RUBY_CFLAGS)
64
+ $(RUBY_CPPFLAGS)
65
+
66
+ AM_CXXLAGS = \
67
+ $(RUBY_CXXFLAGS)
68
+
69
+ AM_LDFLAGS = \
70
+ $(RUBY_LDFLAGS) \
71
+ -L../rice
72
+
73
+ LIBS = \
74
+ -lrice \
75
+ $(RUBY_LIBS) \
76
+ $(RUBY_LIBRUBYARG)
77
+