archipelago_rbtree 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +421 -0
- data/LICENSE +22 -0
- data/Makefile +153 -0
- data/README +82 -0
- data/Rakefile +47 -0
- data/archipelago_rbtree.bundle +0 -0
- data/archipelago_rbtree.o +0 -0
- data/depend +2 -0
- data/dict.o +0 -0
- data/ext/archipelago_rbtree.c +1715 -0
- data/ext/dict.c +1216 -0
- data/ext/dict.h +123 -0
- data/ext/extconf.rb +38 -0
- data/mkmf.log +175 -0
- data/tests/rbtree_test.rb +887 -0
- metadata +63 -0
data/ChangeLog
ADDED
@@ -0,0 +1,421 @@
|
|
1
|
+
2007-02-01 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
2
|
+
|
3
|
+
* version 0.2.0 released.
|
4
|
+
|
5
|
+
2007-01-25 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
6
|
+
|
7
|
+
* rbtree.c (rbtree_readjust): remove a warning.
|
8
|
+
|
9
|
+
* rbtree.c (rbtree_default): should not call default procedure if
|
10
|
+
no key is given.
|
11
|
+
|
12
|
+
* rbtree.c (rbtree_equal): returns true if two rbtrees have same
|
13
|
+
set of key-value set.
|
14
|
+
|
15
|
+
2004-10-27 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
16
|
+
|
17
|
+
* version 0.1.3 released.
|
18
|
+
|
19
|
+
2004-07-29 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
20
|
+
|
21
|
+
* rbtree.c (rbtree_bound): RBTree#bound(lower, upper = lower).
|
22
|
+
|
23
|
+
2004-07-11 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
24
|
+
|
25
|
+
* rbtree.c (MultiRBTree): new class. MultiRBTree allows duplicates
|
26
|
+
of keys.
|
27
|
+
|
28
|
+
* rbtree.c (rbtree_dump, rbtree_s_load): use Array as a storage
|
29
|
+
for performance improvement.
|
30
|
+
|
31
|
+
* rbtree.c (rbtree_equal, rbtree_initialize_copy, rbtree_update):
|
32
|
+
should use rb_obj_is_kind_of.
|
33
|
+
|
34
|
+
* rbtree.c (iter_lev): added to count iterator level for nesting
|
35
|
+
and thread-safety.
|
36
|
+
|
37
|
+
2004-06-29 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
38
|
+
|
39
|
+
* dict.c: remove codes Ruby/RBTree doesn't need. now not supposed
|
40
|
+
to use dict.c with other program.
|
41
|
+
|
42
|
+
* dict.h: ditto.
|
43
|
+
|
44
|
+
* dict.c (dict_equal): remove key_eql argument. use
|
45
|
+
dict->dict_compare to compare keys.
|
46
|
+
|
47
|
+
2004-06-20 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
48
|
+
|
49
|
+
* rbtree.c (rbtree_cmp): use rb_str_cmp if the type of keys is
|
50
|
+
string.
|
51
|
+
|
52
|
+
* rbtree.c (rbtree_cmp): use rb_cmpint.
|
53
|
+
|
54
|
+
* rbtree.c (rbtree_user_cmp): ditto.
|
55
|
+
|
56
|
+
2004-06-12 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
57
|
+
|
58
|
+
* version 0.1.2 release.
|
59
|
+
|
60
|
+
2004-05-31 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
61
|
+
|
62
|
+
* rbtree.c (rbtree_initialize_copy): if an exception is raised in
|
63
|
+
the method rbtree is not modified.
|
64
|
+
|
65
|
+
* rbtree.c (rbtree_delete_if): if an exception is raised in the
|
66
|
+
block rbtree is not modified(no keys are deleted).
|
67
|
+
|
68
|
+
* rbtree.c (rbtree_readjust): use rb_gc_force_recycle.
|
69
|
+
|
70
|
+
2004-05-24 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
71
|
+
|
72
|
+
* rbtree.c (rbtree_initialize_copy): use aset_i. duplicating a key
|
73
|
+
of string is fast because of copy-on-write.
|
74
|
+
|
75
|
+
* rbtree.c (rbtree_readjust): ditto.
|
76
|
+
|
77
|
+
* rbtree.c (rbtree_update): ditto.
|
78
|
+
|
79
|
+
* rbtree.c (rbtree_aset): no dict_lookup for better performance.
|
80
|
+
|
81
|
+
* rbtree.c (rbtree_update): was same whether a block is given or not.
|
82
|
+
|
83
|
+
2004-05-23 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
84
|
+
|
85
|
+
* rbtree.c (inspect_rbtree): add OBJ_INFECTs.
|
86
|
+
|
87
|
+
* rbtree.c (inspect_rbtree): change ``compare'' to ``cmp_proc''.
|
88
|
+
|
89
|
+
* rbtree.c (pp_block): ditto.
|
90
|
+
|
91
|
+
2004-04-26 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
92
|
+
|
93
|
+
* rbtree.c (rbtree_s_create): accept Hash argument.
|
94
|
+
|
95
|
+
* rbtree.c (rbtree_s_create): should just copy keys and values.
|
96
|
+
|
97
|
+
2004-02-19 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
98
|
+
|
99
|
+
* rbtree.c (pp_object_group): use id_object_group.
|
100
|
+
|
101
|
+
2004-02-16 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
102
|
+
|
103
|
+
* version 0.1.1 release.
|
104
|
+
|
105
|
+
2004-02-13 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
106
|
+
|
107
|
+
* README: rewritten.
|
108
|
+
|
109
|
+
* rbtree.c (document): incomplete document for rdoc.
|
110
|
+
|
111
|
+
2004-02-08 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
112
|
+
|
113
|
+
* test.rb (test_pp): add pretty printing test.
|
114
|
+
|
115
|
+
2004-02-07 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
116
|
+
|
117
|
+
* rbtree.c (rbtree_mark): should check rbtree and dict is
|
118
|
+
initialized. Thanks to Neil Spring.
|
119
|
+
|
120
|
+
2004-02-05 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
121
|
+
|
122
|
+
* rbtree.c (prettyprint): polish code.
|
123
|
+
|
124
|
+
* test.rb (assert_raise): alias of assert_raises for Ruby 1.6.x.
|
125
|
+
|
126
|
+
2004-02-02 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
127
|
+
|
128
|
+
* test.rb: clean code. no more RUnit support. use Test::Unit.
|
129
|
+
|
130
|
+
2004-01-29 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
131
|
+
|
132
|
+
* rbtree.c (rbtree_dump): optimization.
|
133
|
+
|
134
|
+
* rbtree.c (rbtree_s_load): ditto.
|
135
|
+
|
136
|
+
2004-01-27 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
137
|
+
|
138
|
+
* rbtree.c (readjust): RBTree#readjust() just readjusts elements
|
139
|
+
using current comparison block. use RBTree#readjust(nil) to set
|
140
|
+
default comparison block.
|
141
|
+
|
142
|
+
* extconf.rb (assertion): removed.
|
143
|
+
|
144
|
+
2004-01-14 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
145
|
+
|
146
|
+
* ctest/test.c: removed.
|
147
|
+
|
148
|
+
* ctest/testlib.c: ditto.
|
149
|
+
|
150
|
+
* ctest/testlib.h: ditto.
|
151
|
+
|
152
|
+
* ctest/Makefile: ditto.
|
153
|
+
|
154
|
+
2004-01-04 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
155
|
+
|
156
|
+
* version 0.1.0 release.
|
157
|
+
|
158
|
+
2004-01-03 OZAWA Takuma <burningdowntheopera@yahoo.co.jp>
|
159
|
+
|
160
|
+
* rbtree.c (rbtree_to_rbtree): new method.
|
161
|
+
|
162
|
+
* rbtree.c (each_pair_i, rbtree_bound_body, rbtree_delete_if_body,
|
163
|
+
select_i, update_block_i): use rb_yield_values.
|
164
|
+
|
165
|
+
* rbtree.c (rbtree_each): RBTree#each should yield single value.
|
166
|
+
|
167
|
+
* rbtree.c (rbtree_select): select(key..) is removed.
|
168
|
+
|
169
|
+
* rbtree.c (rbtree_fetch): always warn if default argument and a
|
170
|
+
block are supplied at the same time.
|
171
|
+
|
172
|
+
2003-08-12 takuma ozawa <hermione@24i.net>
|
173
|
+
|
174
|
+
* version 0.0.7 release.
|
175
|
+
|
176
|
+
2003-08-11 takuma ozawa <hermione@24i.net>
|
177
|
+
|
178
|
+
* rbtree.c (rbtree_to_hash): copy default value.
|
179
|
+
|
180
|
+
* rbtree.c (rbtree_readjust): takes a Proc argument.
|
181
|
+
|
182
|
+
* rbtree.c (to_hash_i): optimization.
|
183
|
+
|
184
|
+
2003-08-09 takuma ozawa <hermione@24i.net>
|
185
|
+
|
186
|
+
* rbtree.c (rbtree_merge): new method.
|
187
|
+
|
188
|
+
* rbtree.c (rbtree_select): select(key..) is deprecated.
|
189
|
+
|
190
|
+
* rbtree.c (rbtree_values_at): new method.
|
191
|
+
|
192
|
+
* rbtree.c (rbtree_initialized_copy): rbtree_copy_object changed to.
|
193
|
+
|
194
|
+
2003-07-27 takuma ozawa <hermione@24i.net>
|
195
|
+
|
196
|
+
* rbtree.c (rbtree_dump): new method based on Ara Howard's code.
|
197
|
+
Thanks.
|
198
|
+
|
199
|
+
* rbtree.c (rbtree_s_load): ditto.
|
200
|
+
|
201
|
+
2003-03-25 takuma ozawa <hermione@24i.net>
|
202
|
+
|
203
|
+
* version 0.0.6 release.
|
204
|
+
|
205
|
+
2003-02-26 takuma ozawa <hermione@24i.net>
|
206
|
+
|
207
|
+
* rbtree.c (rbtree_readjust): rbtree_modify.
|
208
|
+
|
209
|
+
2003-02-23 takuma ozawa <hermione@24i.net>
|
210
|
+
|
211
|
+
* rbtree.c (rbtree_copy_object): use copy_i.
|
212
|
+
|
213
|
+
* rbtree.c (rbtree_readjust): ditto.
|
214
|
+
|
215
|
+
* rbtree.c (rbtree_aset): not freeze a key.
|
216
|
+
|
217
|
+
2003-01-24 takuma ozawa <hermione@24i.net>
|
218
|
+
|
219
|
+
* rbtree.c (rbtree_aset): optimization.
|
220
|
+
|
221
|
+
2003-01-18 takuma ozawa <hermione@24i.net>
|
222
|
+
|
223
|
+
* rbtree.c (rbtree_aset): not raise an exception if a dict is
|
224
|
+
full and the key has been contained.
|
225
|
+
|
226
|
+
2003-01-16 takuma ozawa <hermione@24i.net>
|
227
|
+
|
228
|
+
* version 0.0.5 release.
|
229
|
+
|
230
|
+
2002-12-26 takuma ozawa <hermione@24i.net>
|
231
|
+
|
232
|
+
* rbtree.c (rbtree_alloc): new allocation framework.
|
233
|
+
|
234
|
+
* rbtree.c (rbtree_copy_object): changed become to copy_object.
|
235
|
+
|
236
|
+
* rbtree.c (rbtree_cmp): use NUM2INT in case nil returned.
|
237
|
+
|
238
|
+
* extconf.rb (assertion): assertion is off by default.
|
239
|
+
|
240
|
+
* rbtree.c (rbtree_aset): fixed a memory leak occured if the
|
241
|
+
comparison block raises an exception.
|
242
|
+
|
243
|
+
2002-11-24 takuma ozawa <hermione@24i.net>
|
244
|
+
|
245
|
+
* rbtree.c (rbtree_pretty_print): new method.
|
246
|
+
|
247
|
+
* rbtree.c (rbtree_pretty_print_cycle): new method.
|
248
|
+
|
249
|
+
2002-11-22 takuma ozawa <hermione@24i.net>
|
250
|
+
|
251
|
+
* rbtree.c (rbtree_inspect): format changed.
|
252
|
+
|
253
|
+
* rbtree.c (rbtree_user_cmp): use NUM2INT.
|
254
|
+
|
255
|
+
2002-10-29 takuma ozawa <hermione@24i.net>
|
256
|
+
|
257
|
+
* version 0.0.4 release.
|
258
|
+
|
259
|
+
2002-10-18 takuma ozawa <hermione@24i.net>
|
260
|
+
|
261
|
+
* extconf.rb (assertion): change name to assertion.
|
262
|
+
|
263
|
+
2002-10-12 takuma ozawa <hermione@24i.net>
|
264
|
+
|
265
|
+
* rbtree.c (rbtree_readjust): assign Qnil to other's dict_context
|
266
|
+
after swap.
|
267
|
+
|
268
|
+
* rbtree.c (rbtree_bound): use dict_compare for range check.
|
269
|
+
|
270
|
+
2002-10-10 takuma ozawa <hermione@24i.net>
|
271
|
+
|
272
|
+
* rbtree.c (rbtree_readjust): empty dict check.
|
273
|
+
|
274
|
+
* rbtree.c (rbtree_readjust): not use dict_readjust for better
|
275
|
+
readability.
|
276
|
+
|
277
|
+
* rbtree.c (rbtree_become): must copy dict_compare and
|
278
|
+
dict_context before copying nodes.
|
279
|
+
|
280
|
+
* rbtree.c (rbtree_delete_if): rbtree_modify.
|
281
|
+
|
282
|
+
* rbtree.c (rbtree_shift_pop): ditto.
|
283
|
+
|
284
|
+
* rbtree.c (rbtree_update): ditto.
|
285
|
+
|
286
|
+
* test.rb: Test::Unit.
|
287
|
+
|
288
|
+
* rbtree.c (rbtree_readjust): clear other's nodes after swap.
|
289
|
+
|
290
|
+
* rbtree.c (rbtree_readjust): assign Qnil to other's ifnone after
|
291
|
+
swap.
|
292
|
+
|
293
|
+
2002-10-07 takuma ozawa <hermione@24i.net>
|
294
|
+
|
295
|
+
* rbtree.c (rbtree_update): self assignment check.
|
296
|
+
|
297
|
+
* rbtree.c (rbtree_update): replace duplicate value by return
|
298
|
+
value of block if given.
|
299
|
+
|
300
|
+
2002-10-03 takuma ozawa <hermione@24i.net>
|
301
|
+
|
302
|
+
* rbtree.c (rbtree_become): self assignment check.
|
303
|
+
|
304
|
+
2002-09-24 takuma ozawa <hermione@24i.net>
|
305
|
+
|
306
|
+
* rbtree.c (rbtree_cmp_proc): new method.
|
307
|
+
|
308
|
+
* rbtree.c (rbtree_readjust): if no block given, must assign Qnil
|
309
|
+
to context.
|
310
|
+
|
311
|
+
* rbtree.c (rbtree_inspect): format changed.
|
312
|
+
|
313
|
+
2002-09-23 takuma ozawa <hermione@24i.net>
|
314
|
+
|
315
|
+
* dict.c (dict_equal): empty test must be after similar test.
|
316
|
+
|
317
|
+
2002-09-22 takuma ozawa <hermione@24i.net>
|
318
|
+
|
319
|
+
* rbtree.c (rbtree_update): convert argument to RBTree.
|
320
|
+
|
321
|
+
* rbtree.c (rbtree_become): ditto.
|
322
|
+
|
323
|
+
* rbtree.c (rbtree_eq): use rb_equal.
|
324
|
+
|
325
|
+
* rbtree.c (rbtree_eql): change name to rbtree_eq.
|
326
|
+
|
327
|
+
2002-09-20 takuma ozawa <hermione@24i.net>
|
328
|
+
|
329
|
+
* rbtree.c (RBTREE_FL_COPY): removed.
|
330
|
+
|
331
|
+
* ctest/test.c: rewritten in C. CppUnit is not required.
|
332
|
+
|
333
|
+
2002-09-18 takuma ozawa <hermione@24i.net>
|
334
|
+
|
335
|
+
* depend: new file.
|
336
|
+
|
337
|
+
* rbtree.c (rbtree_equal): no need to check RBTREE_PROC_DEFAULT.
|
338
|
+
|
339
|
+
* extconf.rb (inline) check for inline keyword.
|
340
|
+
|
341
|
+
2002-09-17 takuma ozawa <hermione@24i.net>
|
342
|
+
|
343
|
+
* version 0.0.3 release.
|
344
|
+
|
345
|
+
2002-09-16 takuma ozawa <hermione@24i.net>
|
346
|
+
|
347
|
+
* rbtree.c (rbtree_reverse_each): new method.
|
348
|
+
|
349
|
+
2002-09-12 takuma ozawa <hermione@24i.net>
|
350
|
+
|
351
|
+
* rbtree.c (rbtree_s_create): unset RBTREE_PROC_DEFAULT if the
|
352
|
+
argument is RBTree.
|
353
|
+
|
354
|
+
* rbtree.c (rbtree_clone): use rbtree_become.
|
355
|
+
|
356
|
+
* rbtree.c (version.h): not included.
|
357
|
+
|
358
|
+
2002-09-11 takuma ozawa <hermione@24i.net>
|
359
|
+
|
360
|
+
* rbtree.c (rbtree_to_a): use OBJ_INFECT.
|
361
|
+
|
362
|
+
* rbtree.c (rbtree_to_hash): ditto.
|
363
|
+
|
364
|
+
* rbtree.c (rbtree_become): replaced by rbtree_replace.
|
365
|
+
|
366
|
+
* rbtree.c (rbtree_replace): removed. replace is implemented
|
367
|
+
useing rbtree_become.
|
368
|
+
|
369
|
+
* rbtree.c (rbtree_first_last): first or pop from empty tree
|
370
|
+
should not return its default proc.
|
371
|
+
|
372
|
+
2002-09-09 takuma ozawa <hermione@24i.net>
|
373
|
+
|
374
|
+
* rbtree.c (rbtree_become): new method.
|
375
|
+
|
376
|
+
* rbtree.c (rbtree_clone): unset RBTREE_IN_ITERATION.
|
377
|
+
|
378
|
+
* rbtree.c (rbtree_replace): should copy ifnone.
|
379
|
+
|
380
|
+
* rbtree.c (rbtree_shift_pop): shift or pop from empty tree should
|
381
|
+
not return its default proc.
|
382
|
+
|
383
|
+
* rbtree.c (rbtree_default_proc): new method.
|
384
|
+
|
385
|
+
* rbtree.c (rbtree_equal): should check default values and
|
386
|
+
RBTREE_PROC_DEFAULT.
|
387
|
+
|
388
|
+
2002-07-19 takuma ozawa <metal@mine.ne.jp>
|
389
|
+
|
390
|
+
* dict.c (alloc_node): must return NULL if a memory allocation
|
391
|
+
fails.
|
392
|
+
|
393
|
+
2002-07-13 takuma ozawa <metal@mine.ne.jp>
|
394
|
+
|
395
|
+
* version 0.0.2 release.
|
396
|
+
|
397
|
+
2002-07-11 takuma ozawa <metal@mine.ne.jp>
|
398
|
+
|
399
|
+
* rbtree.c (rbtree_readjust): new method.
|
400
|
+
|
401
|
+
2002-07-10 takuma ozawa <metal@mine.ne.jp>
|
402
|
+
|
403
|
+
* dict.c (dict_clone): clone object must copy must_unfreeze
|
404
|
+
variable.
|
405
|
+
|
406
|
+
2002-06-25 takuma ozawa <metal@mine.ne.jp>
|
407
|
+
|
408
|
+
* dict.h (dnode_t): add must_freeze flag not to unfreeze already
|
409
|
+
freezed object.
|
410
|
+
|
411
|
+
2002-06-22 takuma ozawa <metal@mine.ne.jp>
|
412
|
+
|
413
|
+
* rbtree.c (rbtree_first): new method.
|
414
|
+
|
415
|
+
* rbtree.c (rbtree_last): new method.
|
416
|
+
|
417
|
+
* rbtree.c (rbtree_pop): new method.
|
418
|
+
|
419
|
+
2002-06-14 takuma ozawa <metal@mine.ne.jp>
|
420
|
+
|
421
|
+
* initial release.
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2002-2004, 2007 OZAWA Takuma
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/Makefile
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
#### Start of system configuration section. ####
|
5
|
+
|
6
|
+
srcdir = ext
|
7
|
+
topdir = /opt/local/lib/ruby/1.8/i686-darwin8.9.1
|
8
|
+
hdrdir = $(topdir)
|
9
|
+
VPATH = $(srcdir):$(topdir):$(hdrdir)
|
10
|
+
prefix = $(DESTDIR)/opt/local
|
11
|
+
exec_prefix = $(DESTDIR)/opt/local
|
12
|
+
sitedir = $(prefix)/lib/ruby/site_ruby
|
13
|
+
rubylibdir = $(libdir)/ruby/$(ruby_version)
|
14
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
15
|
+
dvidir = $(docdir)
|
16
|
+
datarootdir = $(prefix)/share
|
17
|
+
archdir = $(rubylibdir)/$(arch)
|
18
|
+
sbindir = $(exec_prefix)/sbin
|
19
|
+
psdir = $(docdir)
|
20
|
+
vendordir = $(prefix)/lib/ruby/vendor_ruby
|
21
|
+
localedir = $(datarootdir)/locale
|
22
|
+
htmldir = $(docdir)
|
23
|
+
datadir = $(datarootdir)
|
24
|
+
includedir = $(prefix)/include
|
25
|
+
infodir = $(datarootdir)/info
|
26
|
+
sysconfdir = $(prefix)/etc
|
27
|
+
mandir = $(DESTDIR)/opt/local/share/man
|
28
|
+
libdir = $(DESTDIR)/opt/local/lib
|
29
|
+
sharedstatedir = $(prefix)/com
|
30
|
+
oldincludedir = $(DESTDIR)/usr/include
|
31
|
+
pdfdir = $(docdir)
|
32
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
33
|
+
vendorarchdir = $(vendorlibdir)/$(vendorarch)
|
34
|
+
bindir = $(exec_prefix)/bin
|
35
|
+
localstatedir = $(prefix)/var
|
36
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
37
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
38
|
+
libexecdir = $(exec_prefix)/libexec
|
39
|
+
|
40
|
+
CC = gcc
|
41
|
+
LIBRUBY = $(LIBRUBY_SO)
|
42
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
43
|
+
LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
|
44
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
|
45
|
+
|
46
|
+
RUBY_EXTCONF_H =
|
47
|
+
CFLAGS = -fno-common -O2 -fno-common -pipe -fno-common -std=c89 -pedantic -Wall -Wno-long-long
|
48
|
+
INCFLAGS = -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.9.1 -Iext
|
49
|
+
CPPFLAGS = -DNDEBUG -DHAVE_OBJECT_ALLOCATE -DHAVE_RB_OBJ_INIT_COPY -DHAVE_RB_BLOCK_PROC -DHAVE_RB_YIELD_VALUES -DHAVE_RB_MARSHAL_DUMP -DHAVE_RB_MARSHAL_LOAD -Dinline=__inline -I/opt/local/include
|
50
|
+
CXXFLAGS = $(CFLAGS)
|
51
|
+
DLDFLAGS = -L/opt/local/lib
|
52
|
+
LDSHARED = cc -dynamic -bundle -undefined suppress -flat_namespace
|
53
|
+
AR = ar
|
54
|
+
EXEEXT =
|
55
|
+
|
56
|
+
RUBY_INSTALL_NAME = ruby
|
57
|
+
RUBY_SO_NAME = ruby
|
58
|
+
arch = i686-darwin8.9.1
|
59
|
+
sitearch = i686-darwin8.9.1
|
60
|
+
vendorarch = i686-darwin8.9.1
|
61
|
+
ruby_version = 1.8
|
62
|
+
ruby = /opt/local/bin/ruby
|
63
|
+
RUBY = $(ruby)
|
64
|
+
RM = rm -f
|
65
|
+
MAKEDIRS = mkdir -p
|
66
|
+
INSTALL = /usr/bin/install -c
|
67
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
68
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
69
|
+
COPY = cp
|
70
|
+
|
71
|
+
#### End of system configuration section. ####
|
72
|
+
|
73
|
+
preload =
|
74
|
+
|
75
|
+
libpath = $(libdir)
|
76
|
+
LIBPATH = -L"$(libdir)"
|
77
|
+
DEFFILE =
|
78
|
+
|
79
|
+
CLEANFILES =
|
80
|
+
DISTCLEANFILES =
|
81
|
+
|
82
|
+
extout =
|
83
|
+
extout_prefix =
|
84
|
+
target_prefix =
|
85
|
+
LOCAL_LIBS =
|
86
|
+
LIBS = $(LIBRUBYARG_SHARED) -lpthread -ldl -lobjc
|
87
|
+
SRCS = archipelago_rbtree.c dict.c
|
88
|
+
OBJS = archipelago_rbtree.o dict.o
|
89
|
+
TARGET = archipelago_rbtree
|
90
|
+
DLLIB = $(TARGET).bundle
|
91
|
+
EXTSTATIC =
|
92
|
+
STATIC_LIB =
|
93
|
+
|
94
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
95
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
96
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
97
|
+
|
98
|
+
TARGET_SO = $(DLLIB)
|
99
|
+
CLEANLIBS = $(TARGET).bundle $(TARGET).il? $(TARGET).tds $(TARGET).map
|
100
|
+
CLEANOBJS = *.o *.a *.s[ol] *.pdb *.exp *.bak
|
101
|
+
|
102
|
+
all: $(DLLIB)
|
103
|
+
static: $(STATIC_LIB)
|
104
|
+
|
105
|
+
clean:
|
106
|
+
@-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES)
|
107
|
+
|
108
|
+
distclean: clean
|
109
|
+
@-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
110
|
+
@-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
111
|
+
|
112
|
+
realclean: distclean
|
113
|
+
install: install-so install-rb
|
114
|
+
|
115
|
+
install-so: $(RUBYARCHDIR)
|
116
|
+
install-so: $(RUBYARCHDIR)/$(DLLIB)
|
117
|
+
$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
|
118
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
119
|
+
install-rb: pre-install-rb install-rb-default
|
120
|
+
install-rb-default: pre-install-rb-default
|
121
|
+
pre-install-rb: Makefile
|
122
|
+
pre-install-rb-default: Makefile
|
123
|
+
$(RUBYARCHDIR):
|
124
|
+
$(MAKEDIRS) $@
|
125
|
+
|
126
|
+
site-install: site-install-so site-install-rb
|
127
|
+
site-install-so: install-so
|
128
|
+
site-install-rb: install-rb
|
129
|
+
|
130
|
+
.SUFFIXES: .c .m .cc .cxx .cpp .C .o
|
131
|
+
|
132
|
+
.cc.o:
|
133
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
134
|
+
|
135
|
+
.cxx.o:
|
136
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
137
|
+
|
138
|
+
.cpp.o:
|
139
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
140
|
+
|
141
|
+
.C.o:
|
142
|
+
$(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $<
|
143
|
+
|
144
|
+
.c.o:
|
145
|
+
$(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) -c $<
|
146
|
+
|
147
|
+
$(DLLIB): $(OBJS)
|
148
|
+
@-$(RM) $@
|
149
|
+
$(LDSHARED) $(DLDFLAGS) $(LIBPATH) -o $@ $(OBJS) $(LOCAL_LIBS) $(LIBS)
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
$(OBJS): ruby.h defines.h
|
data/README
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
= Gemification
|
4
|
+
|
5
|
+
To simplify my usage of this nice package, and managing my patches to
|
6
|
+
it, I have added it to this repository and added a Rakefile to create
|
7
|
+
a gem for it. Install it like any gem, basically.
|
8
|
+
|
9
|
+
//Martin Kihlgren <martin at troja dot ath dot cx>
|
10
|
+
|
11
|
+
= Ruby/RBTree
|
12
|
+
|
13
|
+
RBTree is a sorted associative collection using Red-Black Tree as
|
14
|
+
the internal data structure. The elements of RBTree are ordered and
|
15
|
+
the interface is the almost same as Hash, so simply you can
|
16
|
+
consider RBTree sorted Hash.
|
17
|
+
|
18
|
+
Red-Black Tree is a kind of binary tree that automatically balances
|
19
|
+
by itself when a node is inserted or deleted. Thus the complexity
|
20
|
+
for insert, search and delete is O(log N) in expected and worst
|
21
|
+
case. On the other hand the complexity of Hash is O(1). Because
|
22
|
+
Hash is unordered the data structure is more effective than
|
23
|
+
Red-Black Tree as an associative collection.
|
24
|
+
|
25
|
+
The interface of RBTree is the almost same as Hash although there
|
26
|
+
are some limitations.
|
27
|
+
|
28
|
+
* While iterating (e.g. in RBTree#each block), RBTree is
|
29
|
+
unmodifiable.
|
30
|
+
|
31
|
+
* Comparison is done using <=> method of key objects. So all types
|
32
|
+
of keys in RBTree should be comparable each other or an arbitrary
|
33
|
+
Proc might be set by RBTree#readjust.
|
34
|
+
|
35
|
+
RBTree has a few searching methods that Hash doesn't have. They are
|
36
|
+
RBTree#lower_bound, RBTree#upper_bound and RBTree#bound. See document
|
37
|
+
of each method for details.
|
38
|
+
|
39
|
+
Pretty printing is available for RBTree by using pp.rb. The output
|
40
|
+
of pp is easier than p to read. Just call Kernel#pp for the object.
|
41
|
+
|
42
|
+
MultiRBTree that allows duplicates of keys is also available.
|
43
|
+
|
44
|
+
== Download
|
45
|
+
|
46
|
+
* ((<"Ruby/RBTree 0.2.0"|URL:rbtree-0.2.0.tar.gz>))
|
47
|
+
|
48
|
+
== Requirement
|
49
|
+
|
50
|
+
* Ruby 1.6.7 or higher
|
51
|
+
|
52
|
+
== Install
|
53
|
+
|
54
|
+
$ tar xzf rbtree-x.x.x.tar.gz
|
55
|
+
$ cd rbtree-x.x.x.tar.gz
|
56
|
+
$ ruby extconf.rb
|
57
|
+
$ make
|
58
|
+
$ make site-install
|
59
|
+
|
60
|
+
== Test
|
61
|
+
|
62
|
+
$ ruby test.rb
|
63
|
+
|
64
|
+
== Incomplete Document
|
65
|
+
|
66
|
+
$ rdoc rbtree.c
|
67
|
+
|
68
|
+
== License
|
69
|
+
|
70
|
+
MIT License. Copyright (c) 2002-2004, 2007 OZAWA Takuma.
|
71
|
+
|
72
|
+
dict.c and dict.h are modified copies that are originally in Kazlib
|
73
|
+
written by Kaz Kylheku. Copyright is held by Kaz Kylheku, see dict.c
|
74
|
+
and dict.h for the license. The web page of Kazlib is at
|
75
|
+
((<URL:http://users.footprints.net/~kaz/kazlib.html>)).
|
76
|
+
|
77
|
+
== Support
|
78
|
+
|
79
|
+
Bug fixes, suggestions and other feedbacks are welcomed. Please mail
|
80
|
+
me at ((<burningdowntheopera@yahoo.co.jp|URL:mailto:burningdowntheopera@yahoo.co.jp>)).
|
81
|
+
|
82
|
+
=end
|