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.
- checksums.yaml +15 -0
- data/COPYING +23 -0
- data/Doxyfile +1253 -0
- data/Makefile.am +26 -0
- data/Makefile.in +853 -0
- data/README +1124 -0
- data/README.mingw +8 -0
- data/Rakefile +34 -0
- data/aclocal.m4 +971 -0
- data/bootstrap +8 -0
- data/config.guess +1530 -0
- data/config.sub +1773 -0
- data/configure +7121 -0
- data/configure.ac +52 -0
- data/depcomp +688 -0
- data/doxygen.ac +314 -0
- data/doxygen.am +186 -0
- data/extconf.rb +51 -0
- data/install-sh +527 -0
- data/missing +331 -0
- data/post-autoconf.rb +22 -0
- data/post-automake.rb +28 -0
- data/rice/Address_Registration_Guard.cpp +22 -0
- data/rice/Address_Registration_Guard.hpp +7 -0
- data/rice/Address_Registration_Guard.ipp +37 -0
- data/rice/Address_Registration_Guard_defn.hpp +75 -0
- data/rice/Arg.hpp +8 -0
- data/rice/Arg_impl.hpp +127 -0
- data/rice/Arg_operators.cpp +21 -0
- data/rice/Arg_operators.hpp +19 -0
- data/rice/Array.hpp +220 -0
- data/rice/Array.ipp +263 -0
- data/rice/Builtin_Object.hpp +8 -0
- data/rice/Builtin_Object.ipp +50 -0
- data/rice/Builtin_Object_defn.hpp +50 -0
- data/rice/Class.cpp +57 -0
- data/rice/Class.hpp +8 -0
- data/rice/Class.ipp +6 -0
- data/rice/Class_defn.hpp +83 -0
- data/rice/Constructor.hpp +368 -0
- data/rice/Critical_Guard.hpp +40 -0
- data/rice/Critical_Guard.ipp +26 -0
- data/rice/Data_Object.hpp +8 -0
- data/rice/Data_Object.ipp +133 -0
- data/rice/Data_Object_defn.hpp +138 -0
- data/rice/Data_Type.cpp +54 -0
- data/rice/Data_Type.hpp +8 -0
- data/rice/Data_Type.ipp +365 -0
- data/rice/Data_Type_defn.hpp +261 -0
- data/rice/Data_Type_fwd.hpp +12 -0
- data/rice/Director.cpp +13 -0
- data/rice/Director.hpp +39 -0
- data/rice/Enum.hpp +117 -0
- data/rice/Enum.ipp +246 -0
- data/rice/Exception.cpp +59 -0
- data/rice/Exception.hpp +9 -0
- data/rice/Exception_Base.hpp +8 -0
- data/rice/Exception_Base.ipp +13 -0
- data/rice/Exception_Base_defn.hpp +27 -0
- data/rice/Exception_defn.hpp +69 -0
- data/rice/Hash.hpp +227 -0
- data/rice/Hash.ipp +330 -0
- data/rice/Identifier.cpp +8 -0
- data/rice/Identifier.hpp +50 -0
- data/rice/Identifier.ipp +33 -0
- data/rice/Jump_Tag.hpp +24 -0
- data/rice/Makefile.am +129 -0
- data/rice/Makefile.in +769 -0
- data/rice/Module.cpp +84 -0
- data/rice/Module.hpp +8 -0
- data/rice/Module.ipp +6 -0
- data/rice/Module_defn.hpp +88 -0
- data/rice/Module_impl.hpp +281 -0
- data/rice/Module_impl.ipp +348 -0
- data/rice/Object.cpp +160 -0
- data/rice/Object.hpp +8 -0
- data/rice/Object.ipp +19 -0
- data/rice/Object_defn.hpp +191 -0
- data/rice/Require_Guard.hpp +21 -0
- data/rice/String.cpp +94 -0
- data/rice/String.hpp +89 -0
- data/rice/Struct.cpp +117 -0
- data/rice/Struct.hpp +162 -0
- data/rice/Struct.ipp +26 -0
- data/rice/Symbol.cpp +25 -0
- data/rice/Symbol.hpp +66 -0
- data/rice/Symbol.ipp +44 -0
- data/rice/VM.cpp +82 -0
- data/rice/VM.hpp +32 -0
- data/rice/config.hpp +44 -0
- data/rice/config.hpp.in +43 -0
- data/rice/detail/Arguments.hpp +118 -0
- data/rice/detail/Auto_Function_Wrapper.hpp +898 -0
- data/rice/detail/Auto_Function_Wrapper.ipp +3694 -0
- data/rice/detail/Auto_Member_Function_Wrapper.hpp +897 -0
- data/rice/detail/Auto_Member_Function_Wrapper.ipp +2774 -0
- data/rice/detail/Caster.hpp +103 -0
- data/rice/detail/Exception_Handler.hpp +8 -0
- data/rice/detail/Exception_Handler.ipp +68 -0
- data/rice/detail/Exception_Handler_defn.hpp +96 -0
- data/rice/detail/Iterator.hpp +93 -0
- data/rice/detail/Not_Copyable.hpp +25 -0
- data/rice/detail/Wrapped_Function.hpp +33 -0
- data/rice/detail/cfp.hpp +24 -0
- data/rice/detail/cfp.ipp +51 -0
- data/rice/detail/check_ruby_type.cpp +27 -0
- data/rice/detail/check_ruby_type.hpp +23 -0
- data/rice/detail/creation_funcs.hpp +37 -0
- data/rice/detail/creation_funcs.ipp +36 -0
- data/rice/detail/default_allocation_func.hpp +23 -0
- data/rice/detail/default_allocation_func.ipp +11 -0
- data/rice/detail/define_method_and_auto_wrap.hpp +31 -0
- data/rice/detail/define_method_and_auto_wrap.ipp +30 -0
- data/rice/detail/demangle.cpp +56 -0
- data/rice/detail/demangle.hpp +19 -0
- data/rice/detail/env.hpp +19 -0
- data/rice/detail/from_ruby.hpp +43 -0
- data/rice/detail/from_ruby.ipp +60 -0
- data/rice/detail/method_data.cpp +159 -0
- data/rice/detail/method_data.hpp +21 -0
- data/rice/detail/mininode.cpp +1220 -0
- data/rice/detail/mininode.hpp +320 -0
- data/rice/detail/node.hpp +13 -0
- data/rice/detail/object_call.hpp +69 -0
- data/rice/detail/object_call.ipp +131 -0
- data/rice/detail/protect.cpp +29 -0
- data/rice/detail/protect.hpp +34 -0
- data/rice/detail/ruby.hpp +84 -0
- data/rice/detail/ruby_version_code.hpp +6 -0
- data/rice/detail/ruby_version_code.hpp.in +6 -0
- data/rice/detail/rubysig.hpp +19 -0
- data/rice/detail/st.hpp +22 -0
- data/rice/detail/to_ruby.hpp +22 -0
- data/rice/detail/to_ruby.ipp +36 -0
- data/rice/detail/traits.hpp +43 -0
- data/rice/detail/win32.hpp +16 -0
- data/rice/detail/wrap_function.hpp +341 -0
- data/rice/detail/wrap_function.ipp +514 -0
- data/rice/global_function.hpp +33 -0
- data/rice/global_function.ipp +22 -0
- data/rice/protect.hpp +92 -0
- data/rice/protect.ipp +1134 -0
- data/rice/ruby_mark.hpp +13 -0
- data/rice/ruby_try_catch.hpp +86 -0
- data/rice/rubypp.rb +97 -0
- data/rice/to_from_ruby.hpp +8 -0
- data/rice/to_from_ruby.ipp +294 -0
- data/rice/to_from_ruby_defn.hpp +71 -0
- data/ruby/Makefile.am +1 -0
- data/ruby/Makefile.in +569 -0
- data/ruby/lib/Makefile.am +3 -0
- data/ruby/lib/Makefile.in +423 -0
- data/ruby/lib/mkmf-rice.rb.in +213 -0
- data/ruby/lib/version.rb +3 -0
- data/ruby.ac +136 -0
- data/sample/Makefile.am +47 -0
- data/sample/Makefile.in +408 -0
- data/sample/enum/extconf.rb +3 -0
- data/sample/enum/sample_enum.cpp +54 -0
- data/sample/enum/test.rb +8 -0
- data/sample/inheritance/animals.cpp +98 -0
- data/sample/inheritance/extconf.rb +3 -0
- data/sample/inheritance/test.rb +7 -0
- data/sample/map/extconf.rb +3 -0
- data/sample/map/map.cpp +81 -0
- data/sample/map/test.rb +7 -0
- data/test/Makefile.am +77 -0
- data/test/Makefile.in +820 -0
- data/test/ext/Makefile.am +43 -0
- data/test/ext/Makefile.in +404 -0
- data/test/ext/t1/Foo.hpp +10 -0
- data/test/ext/t1/extconf.rb +2 -0
- data/test/ext/t1/t1.cpp +15 -0
- data/test/ext/t2/extconf.rb +2 -0
- data/test/ext/t2/t2.cpp +11 -0
- data/test/test_Address_Registration_Guard.cpp +43 -0
- data/test/test_Array.cpp +241 -0
- data/test/test_Builtin_Object.cpp +72 -0
- data/test/test_Class.cpp +498 -0
- data/test/test_Constructor.cpp +128 -0
- data/test/test_Critical_Guard.cpp +51 -0
- data/test/test_Data_Object.cpp +275 -0
- data/test/test_Data_Type.cpp +348 -0
- data/test/test_Director.cpp +303 -0
- data/test/test_Enum.cpp +195 -0
- data/test/test_Exception.cpp +46 -0
- data/test/test_Hash.cpp +198 -0
- data/test/test_Identifier.cpp +70 -0
- data/test/test_Jump_Tag.cpp +17 -0
- data/test/test_Memory_Management.cpp +50 -0
- data/test/test_Module.cpp +497 -0
- data/test/test_Object.cpp +148 -0
- data/test/test_String.cpp +94 -0
- data/test/test_Struct.cpp +192 -0
- data/test/test_Symbol.cpp +63 -0
- data/test/test_To_From_Ruby.cpp +321 -0
- data/test/test_VM.cpp +26 -0
- data/test/test_global_functions.cpp +114 -0
- data/test/test_rice.rb +43 -0
- data/test/unittest.cpp +136 -0
- data/test/unittest.hpp +294 -0
- 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
|
+
|
data/sample/map/map.cpp
ADDED
|
@@ -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
|
+
|
data/sample/map/test.rb
ADDED
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
|
+
|