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
data/rice/Hash.ipp
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
#ifndef Rice__Hash__ipp_
|
|
2
|
+
#define Rice__Hash__ipp_
|
|
3
|
+
|
|
4
|
+
#include "protect.hpp"
|
|
5
|
+
#include "to_from_ruby.hpp"
|
|
6
|
+
#include "Builtin_Object.hpp"
|
|
7
|
+
#include "Exception.hpp"
|
|
8
|
+
#include "Builtin_Object.hpp"
|
|
9
|
+
#include "detail/st.hpp"
|
|
10
|
+
#include <algorithm>
|
|
11
|
+
|
|
12
|
+
inline Rice::Hash::
|
|
13
|
+
Hash()
|
|
14
|
+
: Builtin_Object<RHash, T_HASH>(protect(rb_hash_new))
|
|
15
|
+
{
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
inline Rice::Hash::
|
|
19
|
+
Hash(Object v)
|
|
20
|
+
: Builtin_Object<RHash, T_HASH>(v)
|
|
21
|
+
{
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
inline size_t Rice::Hash::
|
|
25
|
+
size() const
|
|
26
|
+
{
|
|
27
|
+
return RHASH_SIZE(this->value());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
inline Rice::Hash::Proxy::
|
|
31
|
+
Proxy(Hash hash, Object key)
|
|
32
|
+
: hash_(hash)
|
|
33
|
+
, key_(key)
|
|
34
|
+
{
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
inline Rice::Hash::Proxy::
|
|
39
|
+
operator VALUE() const
|
|
40
|
+
{
|
|
41
|
+
return value();
|
|
42
|
+
}
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
inline Rice::Hash::Proxy::
|
|
46
|
+
operator Rice::Object() const
|
|
47
|
+
{
|
|
48
|
+
return value();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
inline VALUE Rice::Hash::Proxy::
|
|
52
|
+
value() const
|
|
53
|
+
{
|
|
54
|
+
return protect(rb_hash_aref, hash_, key_);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
template<typename T>
|
|
58
|
+
inline Rice::Object Rice::Hash::Proxy::
|
|
59
|
+
operator=(T const & value)
|
|
60
|
+
{
|
|
61
|
+
return protect(rb_hash_aset, hash_, key_, to_ruby(value));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
inline void Rice::Hash::Proxy::
|
|
65
|
+
swap(Proxy & proxy)
|
|
66
|
+
{
|
|
67
|
+
hash_.swap(proxy.hash_);
|
|
68
|
+
key_.swap(proxy.key_);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
template<typename Key_T>
|
|
72
|
+
inline Rice::Hash::Proxy const Rice::Hash::
|
|
73
|
+
operator[](Key_T const & key) const
|
|
74
|
+
{
|
|
75
|
+
return Proxy(*this, to_ruby(key));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
template<typename Key_T>
|
|
79
|
+
inline Rice::Hash::Proxy Rice::Hash::
|
|
80
|
+
operator[](Key_T const & key)
|
|
81
|
+
{
|
|
82
|
+
return Proxy(*this, to_ruby(key));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
template<typename Value_T, typename Key_T>
|
|
86
|
+
inline Value_T Rice::Hash::
|
|
87
|
+
get(Key_T const & key)
|
|
88
|
+
{
|
|
89
|
+
Object ruby_key(to_ruby(key));
|
|
90
|
+
Object value = operator[](ruby_key);
|
|
91
|
+
try
|
|
92
|
+
{
|
|
93
|
+
return from_ruby<Value_T>(value);
|
|
94
|
+
}
|
|
95
|
+
catch(Exception const & ex)
|
|
96
|
+
{
|
|
97
|
+
String s_key(ruby_key.to_s());
|
|
98
|
+
throw Exception(
|
|
99
|
+
ex,
|
|
100
|
+
"%s while converting value for key %s",
|
|
101
|
+
ex.what(),
|
|
102
|
+
s_key.c_str());
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
inline Rice::Hash::Entry::
|
|
107
|
+
Entry(Hash hash, Object key)
|
|
108
|
+
: key(key)
|
|
109
|
+
, first(Hash::Entry::key)
|
|
110
|
+
, value(hash, key)
|
|
111
|
+
, second(Hash::Entry::value)
|
|
112
|
+
{
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
inline Rice::Hash::Entry::
|
|
116
|
+
Entry(Entry const & entry)
|
|
117
|
+
: key(entry.key)
|
|
118
|
+
, first(Hash::Entry::key)
|
|
119
|
+
, value(entry.value)
|
|
120
|
+
, second(Hash::Entry::value)
|
|
121
|
+
{
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
inline Rice::Hash::Entry & Rice::Hash::Entry::
|
|
125
|
+
operator=(Rice::Hash::Entry const & rhs)
|
|
126
|
+
{
|
|
127
|
+
Entry tmp(rhs);
|
|
128
|
+
swap(tmp);
|
|
129
|
+
return *this;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
inline void Rice::Hash::Entry::
|
|
133
|
+
swap(Rice::Hash::Entry & entry)
|
|
134
|
+
{
|
|
135
|
+
const_cast<Object &>(key).swap(const_cast<Object &>(entry.key));
|
|
136
|
+
value.swap(entry.value);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
140
|
+
inline Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
141
|
+
Iterator(Hash_Ref_T hash)
|
|
142
|
+
: hash_(hash)
|
|
143
|
+
, current_index_(0)
|
|
144
|
+
, keys_(Qnil)
|
|
145
|
+
, tmp_(hash, Qnil)
|
|
146
|
+
{
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
150
|
+
inline Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
151
|
+
Iterator(Hash_Ref_T hash, int start_at)
|
|
152
|
+
: hash_(hash)
|
|
153
|
+
, current_index_(start_at)
|
|
154
|
+
, keys_(Qnil)
|
|
155
|
+
, tmp_(hash, Qnil)
|
|
156
|
+
{
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
160
|
+
inline Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
161
|
+
Iterator(Iterator const & iterator)
|
|
162
|
+
: hash_(iterator.hash_.value())
|
|
163
|
+
, current_index_(iterator.current_index_)
|
|
164
|
+
, keys_(Qnil)
|
|
165
|
+
, tmp_(iterator.hash_, Qnil)
|
|
166
|
+
{
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
170
|
+
template<typename Iterator_T>
|
|
171
|
+
inline Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
172
|
+
Iterator(Iterator_T const & iterator)
|
|
173
|
+
: hash_(iterator.hash_.value())
|
|
174
|
+
, current_index_(iterator.current_index_)
|
|
175
|
+
, keys_(Qnil)
|
|
176
|
+
, tmp_(iterator.hash_, Qnil)
|
|
177
|
+
{
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
181
|
+
inline Rice::Hash::Iterator<Hash_Ref_T, Value_T> &
|
|
182
|
+
Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
183
|
+
operator=(Iterator const & iterator)
|
|
184
|
+
{
|
|
185
|
+
Iterator tmp(iterator);
|
|
186
|
+
|
|
187
|
+
this->swap(tmp);
|
|
188
|
+
|
|
189
|
+
return *this;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
193
|
+
inline Rice::Hash::Iterator<Hash_Ref_T, Value_T> &
|
|
194
|
+
Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
195
|
+
operator++()
|
|
196
|
+
{
|
|
197
|
+
// Ensure we're within the range
|
|
198
|
+
if(current_index_ < hash_keys().size()) {
|
|
199
|
+
current_index_++;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return *this;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
206
|
+
inline Rice::Hash::Iterator<Hash_Ref_T, Value_T>
|
|
207
|
+
Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
208
|
+
operator++(int)
|
|
209
|
+
{
|
|
210
|
+
Iterator copy(*this);
|
|
211
|
+
++(*this);
|
|
212
|
+
return copy;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
216
|
+
inline Value_T
|
|
217
|
+
Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
218
|
+
operator*()
|
|
219
|
+
{
|
|
220
|
+
return Value_T(hash_, current_key());
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
224
|
+
inline Value_T *
|
|
225
|
+
Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
226
|
+
operator->()
|
|
227
|
+
{
|
|
228
|
+
Entry tmp(hash_, current_key());
|
|
229
|
+
this->tmp_.swap(tmp);
|
|
230
|
+
return &tmp_;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
234
|
+
inline bool Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
235
|
+
operator==(Iterator const & rhs) const
|
|
236
|
+
{
|
|
237
|
+
return hash_.value() == rhs.hash_.value()
|
|
238
|
+
&& current_index_ == rhs.current_index_;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
242
|
+
inline bool Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
243
|
+
operator!=(Iterator const & rhs) const
|
|
244
|
+
{
|
|
245
|
+
return !(*this == rhs);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
249
|
+
inline void
|
|
250
|
+
Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
251
|
+
swap(Iterator& iterator)
|
|
252
|
+
{
|
|
253
|
+
using namespace std;
|
|
254
|
+
|
|
255
|
+
hash_.swap(iterator.hash_);
|
|
256
|
+
swap(keys_, iterator.keys_);
|
|
257
|
+
swap(current_index_, iterator.current_index_);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
261
|
+
inline Rice::Object
|
|
262
|
+
Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
263
|
+
current_key()
|
|
264
|
+
{
|
|
265
|
+
return hash_keys()[current_index_];
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
template<typename Hash_Ref_T, typename Value_T>
|
|
270
|
+
inline Rice::Array
|
|
271
|
+
Rice::Hash::Iterator<Hash_Ref_T, Value_T>::
|
|
272
|
+
hash_keys()
|
|
273
|
+
{
|
|
274
|
+
if(NIL_P(keys_)) {
|
|
275
|
+
keys_ = rb_funcall(hash_, rb_intern("keys"), 0, 0);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return Rice::Array(keys_);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
inline Rice::Hash::iterator Rice::Hash::
|
|
282
|
+
begin()
|
|
283
|
+
{
|
|
284
|
+
return iterator(*this);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
inline Rice::Hash::const_iterator Rice::Hash::
|
|
288
|
+
begin() const
|
|
289
|
+
{
|
|
290
|
+
return const_iterator(*this);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
inline Rice::Hash::iterator Rice::Hash::
|
|
294
|
+
end()
|
|
295
|
+
{
|
|
296
|
+
return iterator(*this, size());
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
inline Rice::Hash::const_iterator Rice::Hash::
|
|
300
|
+
end() const
|
|
301
|
+
{
|
|
302
|
+
return const_iterator(*this, size());
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
inline bool Rice::
|
|
306
|
+
operator<(
|
|
307
|
+
Hash::Entry const & lhs, Hash::Entry const & rhs)
|
|
308
|
+
{
|
|
309
|
+
Object lhs_key(lhs.key);
|
|
310
|
+
Object rhs_key(rhs.key);
|
|
311
|
+
if(lhs_key < rhs_key)
|
|
312
|
+
{
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
else if(lhs_key > rhs_key)
|
|
316
|
+
{
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
else if(Object(lhs.value.value()) < Object(rhs.value.value()))
|
|
320
|
+
{
|
|
321
|
+
return true;
|
|
322
|
+
}
|
|
323
|
+
else
|
|
324
|
+
{
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
#endif // Rice__Hash__ipp_
|
|
330
|
+
|
data/rice/Identifier.cpp
ADDED
data/rice/Identifier.hpp
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#ifndef Rice__Identifier__hpp_
|
|
2
|
+
#define Rice__Identifier__hpp_
|
|
3
|
+
|
|
4
|
+
#include "detail/ruby.hpp"
|
|
5
|
+
#include <string>
|
|
6
|
+
|
|
7
|
+
namespace Rice
|
|
8
|
+
{
|
|
9
|
+
|
|
10
|
+
class Symbol;
|
|
11
|
+
|
|
12
|
+
//! A wrapper for the ID type
|
|
13
|
+
/*! An ID is ruby's internal representation of a Symbol object.
|
|
14
|
+
*/
|
|
15
|
+
class Identifier
|
|
16
|
+
{
|
|
17
|
+
public:
|
|
18
|
+
//! Construct a new Identifier from an ID.
|
|
19
|
+
Identifier(ID id);
|
|
20
|
+
|
|
21
|
+
//! Construct a new Identifier from a Symbol.
|
|
22
|
+
Identifier(Symbol const & symbol);
|
|
23
|
+
|
|
24
|
+
//! Construct a new Identifier from a string.
|
|
25
|
+
Identifier(char const * s = "");
|
|
26
|
+
|
|
27
|
+
//! Return a string representation of the Identifier.
|
|
28
|
+
char const * c_str() const;
|
|
29
|
+
|
|
30
|
+
//! Return a string representation of the Identifier.
|
|
31
|
+
std::string str() const;
|
|
32
|
+
|
|
33
|
+
//! Return the underlying ID
|
|
34
|
+
ID id() const { return id_; }
|
|
35
|
+
|
|
36
|
+
//! Return the underlying ID
|
|
37
|
+
operator ID() const { return id_; }
|
|
38
|
+
|
|
39
|
+
//! Return the ID as a Symbol
|
|
40
|
+
VALUE to_sym() const;
|
|
41
|
+
|
|
42
|
+
private:
|
|
43
|
+
ID id_;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
} // namespace Rice
|
|
47
|
+
|
|
48
|
+
#include "Identifier.ipp"
|
|
49
|
+
|
|
50
|
+
#endif // Rice__Identifier__hpp_
|
data/rice/Identifier.ipp
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
inline Rice::Identifier::
|
|
2
|
+
Identifier(ID id)
|
|
3
|
+
: id_(id)
|
|
4
|
+
{
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
inline Rice::Identifier::
|
|
8
|
+
Identifier(char const * s)
|
|
9
|
+
: id_(rb_intern(s))
|
|
10
|
+
{
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
inline char const *
|
|
14
|
+
Rice::Identifier::
|
|
15
|
+
c_str() const
|
|
16
|
+
{
|
|
17
|
+
return rb_id2name(id_);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
inline std::string
|
|
21
|
+
Rice::Identifier::
|
|
22
|
+
str() const
|
|
23
|
+
{
|
|
24
|
+
return c_str();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
inline VALUE
|
|
28
|
+
Rice::Identifier::
|
|
29
|
+
to_sym() const
|
|
30
|
+
{
|
|
31
|
+
return ID2SYM(id_);
|
|
32
|
+
}
|
|
33
|
+
|
data/rice/Jump_Tag.hpp
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#ifndef Rice__Jump_Tag__hpp_
|
|
2
|
+
#define Rice__Jump_Tag__hpp_
|
|
3
|
+
|
|
4
|
+
namespace Rice
|
|
5
|
+
{
|
|
6
|
+
|
|
7
|
+
//! A placeholder for Ruby longjmp data.
|
|
8
|
+
/*! When a Ruby exception is caught, the tag used for the longjmp is stored in
|
|
9
|
+
* a Jump_Tag, then later passed to rb_jump_tag() when there is no more
|
|
10
|
+
* C++ code to pass over.
|
|
11
|
+
*/
|
|
12
|
+
struct Jump_Tag
|
|
13
|
+
{
|
|
14
|
+
//! Construct a Jump_Tag with tag t.
|
|
15
|
+
Jump_Tag(int t) : tag(t) { }
|
|
16
|
+
|
|
17
|
+
//! The tag being held.
|
|
18
|
+
int tag;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
} // namespace Rice
|
|
22
|
+
|
|
23
|
+
#endif // Rice__Jump_Tag__hpp_
|
|
24
|
+
|
data/rice/Makefile.am
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
lib_LIBRARIES = librice.a
|
|
2
|
+
|
|
3
|
+
librice_a_SOURCES = \
|
|
4
|
+
Class.cpp \
|
|
5
|
+
Data_Type.cpp \
|
|
6
|
+
Director.cpp \
|
|
7
|
+
Exception.cpp \
|
|
8
|
+
Identifier.cpp \
|
|
9
|
+
Module.cpp \
|
|
10
|
+
Object.cpp \
|
|
11
|
+
String.cpp \
|
|
12
|
+
Struct.cpp \
|
|
13
|
+
Symbol.cpp \
|
|
14
|
+
VM.cpp \
|
|
15
|
+
Arg_operators.cpp \
|
|
16
|
+
Address_Registration_Guard.cpp \
|
|
17
|
+
detail/check_ruby_type.cpp \
|
|
18
|
+
detail/demangle.cpp \
|
|
19
|
+
detail/method_data.cpp \
|
|
20
|
+
detail/protect.cpp
|
|
21
|
+
|
|
22
|
+
nobase_include_HEADERS = \
|
|
23
|
+
Address_Registration_Guard.hpp \
|
|
24
|
+
Address_Registration_Guard.ipp \
|
|
25
|
+
Address_Registration_Guard_defn.hpp \
|
|
26
|
+
Array.hpp \
|
|
27
|
+
Array.ipp \
|
|
28
|
+
Arg.hpp \
|
|
29
|
+
Arg_impl.hpp \
|
|
30
|
+
Arg_operators.hpp \
|
|
31
|
+
Builtin_Object.hpp \
|
|
32
|
+
Builtin_Object.ipp \
|
|
33
|
+
Builtin_Object_defn.hpp \
|
|
34
|
+
Class.hpp \
|
|
35
|
+
Class.ipp \
|
|
36
|
+
Class_defn.hpp \
|
|
37
|
+
Constructor.hpp \
|
|
38
|
+
Critical_Guard.hpp \
|
|
39
|
+
Critical_Guard.ipp \
|
|
40
|
+
Data_Object.hpp \
|
|
41
|
+
Data_Object.ipp \
|
|
42
|
+
Data_Object_defn.hpp \
|
|
43
|
+
Data_Type.hpp \
|
|
44
|
+
Data_Type.ipp \
|
|
45
|
+
Data_Type_defn.hpp \
|
|
46
|
+
Data_Type_fwd.hpp \
|
|
47
|
+
Director.hpp \
|
|
48
|
+
Enum.hpp \
|
|
49
|
+
Enum.ipp \
|
|
50
|
+
Exception.hpp \
|
|
51
|
+
Exception_defn.hpp \
|
|
52
|
+
Exception_Base.hpp \
|
|
53
|
+
Exception_Base.ipp \
|
|
54
|
+
Exception_Base_defn.hpp \
|
|
55
|
+
Hash.hpp \
|
|
56
|
+
Hash.ipp \
|
|
57
|
+
Identifier.hpp \
|
|
58
|
+
Identifier.ipp \
|
|
59
|
+
Jump_Tag.hpp \
|
|
60
|
+
Makefile \
|
|
61
|
+
Module.hpp \
|
|
62
|
+
Module.ipp \
|
|
63
|
+
Module_defn.hpp \
|
|
64
|
+
Module_impl.hpp \
|
|
65
|
+
Module_impl.ipp \
|
|
66
|
+
Object.hpp \
|
|
67
|
+
Object.ipp \
|
|
68
|
+
Object_defn.hpp \
|
|
69
|
+
Require_Guard.hpp \
|
|
70
|
+
String.hpp \
|
|
71
|
+
Struct.hpp \
|
|
72
|
+
Struct.ipp \
|
|
73
|
+
Symbol.hpp \
|
|
74
|
+
Symbol.ipp \
|
|
75
|
+
VM.hpp \
|
|
76
|
+
global_function.hpp \
|
|
77
|
+
global_function.ipp \
|
|
78
|
+
protect.hpp \
|
|
79
|
+
protect.ipp \
|
|
80
|
+
ruby_try_catch.hpp \
|
|
81
|
+
to_from_ruby.hpp \
|
|
82
|
+
to_from_ruby.ipp \
|
|
83
|
+
to_from_ruby_defn.hpp \
|
|
84
|
+
ruby_mark.hpp \
|
|
85
|
+
detail/Auto_Function_Wrapper.hpp \
|
|
86
|
+
detail/Auto_Function_Wrapper.ipp \
|
|
87
|
+
detail/Auto_Member_Function_Wrapper.hpp \
|
|
88
|
+
detail/Auto_Member_Function_Wrapper.ipp \
|
|
89
|
+
detail/Arguments.hpp \
|
|
90
|
+
detail/Caster.hpp \
|
|
91
|
+
detail/Exception_Handler.hpp \
|
|
92
|
+
detail/Exception_Handler.ipp \
|
|
93
|
+
detail/Exception_Handler_defn.hpp \
|
|
94
|
+
detail/Iterator.hpp \
|
|
95
|
+
detail/Not_Copyable.hpp \
|
|
96
|
+
detail/Wrapped_Function.hpp \
|
|
97
|
+
detail/check_ruby_type.hpp \
|
|
98
|
+
detail/creation_funcs.hpp \
|
|
99
|
+
detail/creation_funcs.ipp \
|
|
100
|
+
detail/default_allocation_func.hpp \
|
|
101
|
+
detail/default_allocation_func.ipp \
|
|
102
|
+
detail/define_method_and_auto_wrap.hpp \
|
|
103
|
+
detail/define_method_and_auto_wrap.ipp \
|
|
104
|
+
detail/demangle.hpp \
|
|
105
|
+
detail/env.hpp \
|
|
106
|
+
detail/from_ruby.hpp \
|
|
107
|
+
detail/from_ruby.ipp \
|
|
108
|
+
detail/method_data.hpp \
|
|
109
|
+
detail/node.hpp \
|
|
110
|
+
detail/object_call.hpp \
|
|
111
|
+
detail/object_call.ipp \
|
|
112
|
+
detail/protect.hpp \
|
|
113
|
+
detail/ruby.hpp \
|
|
114
|
+
detail/rubysig.hpp \
|
|
115
|
+
detail/st.hpp \
|
|
116
|
+
detail/traits.hpp \
|
|
117
|
+
detail/to_ruby.hpp \
|
|
118
|
+
detail/to_ruby.ipp \
|
|
119
|
+
detail/win32.hpp \
|
|
120
|
+
detail/wrap_function.hpp \
|
|
121
|
+
detail/wrap_function.ipp \
|
|
122
|
+
detail/ruby_version_code.hpp
|
|
123
|
+
|
|
124
|
+
includedir = ${prefix}/include/rice
|
|
125
|
+
|
|
126
|
+
AM_CPPFLAGS = @RUBY_CPPFLAGS@
|
|
127
|
+
|
|
128
|
+
AM_CXXFLAGS = @RUBY_CXXFLAGS@
|
|
129
|
+
|