groonga 0.9.0 → 0.9.1

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.
@@ -1,5 +1,9 @@
1
1
  = お知らせ
2
2
 
3
+ == 0.9.1: 2010-02-09
4
+
5
+ * groonga 0.1.6対応
6
+
3
7
  == 0.9.0: 2010-02-09
4
8
 
5
9
  * groonga 0.1.5対応
data/NEWS.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = NEWS
2
2
 
3
+ == 0.9.1: 2010-02-09
4
+
5
+ * Supported groonga 0.1.6
6
+
3
7
  == 0.9.0: 2010-02-09
4
8
 
5
9
  * Supported groonga 0.1.5
data/Rakefile CHANGED
@@ -52,7 +52,7 @@ base_dir_included_components = %w(AUTHORS Rakefile
52
52
  README.rdoc README.ja.rdoc
53
53
  NEWS.rdoc NEWS.ja.rdoc
54
54
  extconf.rb pkg-config.rb)
55
- excluded_components = %w(.cvsignore .gdb_history CVS depend Makefile pkg
55
+ excluded_components = %w(.cvsignore .gdb_history CVS depend Makefile doc pkg
56
56
  .svn .git doc vendor data .test-result)
57
57
  excluded_suffixes = %w(.png .ps .pdf .o .so .a .txt .~)
58
58
  Find.find(base_dir) do |target|
@@ -69,7 +69,7 @@ RB_GRN_BEGIN_DECLS
69
69
 
70
70
  #define RB_GRN_MAJOR_VERSION 0
71
71
  #define RB_GRN_MINOR_VERSION 9
72
- #define RB_GRN_MICRO_VERSION 0
72
+ #define RB_GRN_MICRO_VERSION 1
73
73
 
74
74
  typedef int rb_grn_boolean;
75
75
  #define RB_GRN_FALSE (0)
data/extconf.rb CHANGED
@@ -36,7 +36,7 @@ package_name = "groonga"
36
36
  module_name = "groonga"
37
37
  ext_dir_name = "ext"
38
38
  src_dir = File.join(File.expand_path(File.dirname(__FILE__)), ext_dir_name)
39
- major, minor, micro = 0, 1, 5
39
+ major, minor, micro = 0, 1, 6
40
40
 
41
41
  def local_groonga_base_dir
42
42
  File.join(File.dirname(__FILE__), "vendor")
@@ -115,7 +115,7 @@ def install_groonga_locally(major, minor, micro)
115
115
  end
116
116
 
117
117
  message("installing...")
118
- if [major, minor, micro] == [0, 1, 5]
118
+ if [major, minor, micro] == [0, 1, 6]
119
119
  make_install_args = " MKDIR_P='mkdir -p --'"
120
120
  else
121
121
  make_install_args = ""
@@ -42,7 +42,7 @@
42
42
 
43
43
  <h3>Ruby/groongaの最新リリース</h3>
44
44
  <p>
45
- 2010-02-29にリリースされた0.9.0が最新です。
45
+ 2010-02-09にリリースされた0.9.1が最新です。
46
46
  </p>
47
47
 
48
48
  <h3 id="install-ruby-groonga">Ruby/groongaのインストール</h3>
@@ -79,7 +79,7 @@
79
79
 
80
80
  <h3>ActiveGroongaの最新リリース</h3>
81
81
  <p>
82
- 2010-02-09にリリースされた0.9.0が最新です。
82
+ 2009-10-02にリリースされた0.0.7が最新です。
83
83
  </p>
84
84
 
85
85
  <h3 id="install-active-groonga">ActiveGroongaのインストール</h3>
@@ -0,0 +1,296 @@
1
+ /* -*- c-file-style: "ruby" -*- */
2
+ /*
3
+ Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
4
+
5
+ This library is free software; you can redistribute it and/or
6
+ modify it under the terms of the GNU Lesser General Public
7
+ License version 2.1 as published by the Free Software Foundation.
8
+
9
+ This library is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ Lesser General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Lesser General Public
15
+ License along with this library; if not, write to the Free Software
16
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
+ */
18
+
19
+ #include "rb-grn.h"
20
+
21
+ #define SELF(object) (rb_rb_grn_table_cursor_from_ruby_object(object))
22
+
23
+ typedef struct _RbGrnTableCursor RbGrnTableCursor;
24
+ struct _RbGrnTableCursor
25
+ {
26
+ grn_ctx *context;
27
+ grn_table_cursor *cursor;
28
+ rb_grn_boolean owner;
29
+ };
30
+
31
+ VALUE rb_cGrnTableCursor;
32
+
33
+ static RbGrnTableCursor *
34
+ rb_rb_grn_table_cursor_from_ruby_object (VALUE object)
35
+ {
36
+ RbGrnTableCursor *rb_grn_table_cursor;
37
+
38
+ if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnTableCursor))) {
39
+ rb_raise(rb_eTypeError, "not a groonga table cursor");
40
+ }
41
+
42
+ Data_Get_Struct(object, RbGrnTableCursor, rb_grn_table_cursor);
43
+ if (!rb_grn_table_cursor)
44
+ rb_raise(rb_eGrnError, "groonga table cursor is NULL");
45
+
46
+ return rb_grn_table_cursor;
47
+ }
48
+
49
+ grn_table_cursor *
50
+ rb_grn_table_cursor_from_ruby_object (VALUE object)
51
+ {
52
+ if (NIL_P(object))
53
+ return NULL;
54
+
55
+ return SELF(object)->cursor;
56
+ }
57
+
58
+ static void
59
+ rb_rb_grn_table_cursor_free (void *object)
60
+ {
61
+ RbGrnTableCursor *rb_grn_table_cursor = object;
62
+
63
+ if (rb_grn_table_cursor->context && rb_grn_table_cursor->cursor &&
64
+ rb_grn_table_cursor->owner) {
65
+ printf("close!\n");
66
+ grn_table_cursor_close(rb_grn_table_cursor->context,
67
+ rb_grn_table_cursor->cursor);
68
+ }
69
+ xfree(object);
70
+ }
71
+
72
+ VALUE
73
+ rb_grn_table_cursor_to_ruby_class (grn_obj *object)
74
+ {
75
+ VALUE klass = Qnil;
76
+
77
+ switch (object->header.type) {
78
+ case GRN_CURSOR_TABLE_HASH_KEY:
79
+ klass = rb_cGrnHashCursor;
80
+ break;
81
+ case GRN_CURSOR_TABLE_PAT_KEY:
82
+ klass = rb_cGrnPatriciaTrieCursor;
83
+ break;
84
+ case GRN_CURSOR_TABLE_NO_KEY:
85
+ klass = rb_cGrnArrayCursor;
86
+ break;
87
+ default:
88
+ rb_raise(rb_eTypeError,
89
+ "unsupported groonga object type: %d",
90
+ object->header.type);
91
+ break;
92
+ }
93
+
94
+ return klass;
95
+ }
96
+
97
+ VALUE
98
+ rb_grn_table_cursor_to_ruby_object (VALUE klass, grn_ctx *context,
99
+ grn_table_cursor *cursor)
100
+ {
101
+ RbGrnTableCursor *rb_grn_table_cursor;
102
+
103
+ if (!cursor)
104
+ return Qnil;
105
+
106
+ rb_grn_table_cursor = ALLOC(RbGrnTableCursor);
107
+ rb_grn_table_cursor->context = context;
108
+ rb_grn_table_cursor->cursor = cursor;
109
+ rb_grn_table_cursor->owner = RB_GRN_TRUE; /* FIXME */
110
+
111
+ if (NIL_P(klass))
112
+ klass = GRNTABLECURSOR2RCLASS(cursor);
113
+
114
+ return Data_Wrap_Struct(klass, NULL,
115
+ rb_rb_grn_table_cursor_free, rb_grn_table_cursor);
116
+ }
117
+
118
+ static VALUE
119
+ rb_grn_table_cursor_alloc (VALUE klass)
120
+ {
121
+ return Data_Wrap_Struct(klass, NULL, rb_rb_grn_table_cursor_free, NULL);
122
+ }
123
+
124
+ grn_ctx *
125
+ rb_grn_table_cursor_ensure_context (VALUE cursor, VALUE rb_context)
126
+ {
127
+ if (NIL_P(rb_context)) {
128
+ RbGrnTableCursor *rb_grn_table_cursor;
129
+
130
+ rb_grn_table_cursor = SELF(cursor);
131
+ if (rb_grn_table_cursor && rb_grn_table_cursor->context)
132
+ return rb_grn_table_cursor->context;
133
+ }
134
+
135
+ return rb_grn_context_ensure(rb_context);
136
+ }
137
+
138
+ VALUE
139
+ rb_grn_table_cursor_close (VALUE self)
140
+ {
141
+ RbGrnTableCursor *rb_grn_table_cursor;
142
+
143
+ rb_grn_table_cursor = SELF(self);
144
+ if (rb_grn_table_cursor->context && rb_grn_table_cursor->cursor) {
145
+ grn_rc rc = GRN_SUCCESS;
146
+
147
+ if (rb_grn_table_cursor->owner)
148
+ rc = grn_table_cursor_close(rb_grn_table_cursor->context,
149
+ rb_grn_table_cursor->cursor);
150
+ rb_grn_table_cursor->context = NULL;
151
+ rb_grn_table_cursor->cursor = NULL;
152
+ rb_grn_table_cursor->owner = RB_GRN_FALSE;
153
+ rb_grn_rc_check(rc, self);
154
+ }
155
+ return Qnil;
156
+ }
157
+
158
+ static VALUE
159
+ rb_grn_table_cursor_closed_p (VALUE self)
160
+ {
161
+ RbGrnTableCursor *rb_grn_table_cursor;
162
+
163
+ rb_grn_table_cursor = SELF(self);
164
+ if (rb_grn_table_cursor->context && rb_grn_table_cursor->cursor)
165
+ return Qfalse;
166
+ else
167
+ return Qtrue;
168
+ }
169
+
170
+ static VALUE
171
+ rb_grn_table_cursor_get_value (VALUE self)
172
+ {
173
+ VALUE rb_value = Qnil;
174
+ RbGrnTableCursor *rb_grn_table_cursor;
175
+
176
+ rb_grn_table_cursor = SELF(self);
177
+ if (rb_grn_table_cursor->context && rb_grn_table_cursor->cursor) {
178
+ int n;
179
+ void *value;
180
+
181
+ n = grn_table_cursor_get_value(rb_grn_table_cursor->context,
182
+ rb_grn_table_cursor->cursor,
183
+ &value);
184
+ rb_value = rb_str_new(value, n);
185
+ }
186
+
187
+ return rb_value;
188
+ }
189
+
190
+ static VALUE
191
+ rb_grn_table_cursor_set_value (VALUE self, VALUE value)
192
+ {
193
+ RbGrnTableCursor *rb_grn_table_cursor;
194
+
195
+ rb_grn_table_cursor = SELF(self);
196
+ if (rb_grn_table_cursor->context && rb_grn_table_cursor->cursor) {
197
+ grn_rc rc;
198
+
199
+ rc = grn_table_cursor_set_value(rb_grn_table_cursor->context,
200
+ rb_grn_table_cursor->cursor,
201
+ StringValuePtr(value), GRN_OBJ_SET);
202
+ rb_grn_rc_check(rc, self);
203
+ }
204
+
205
+ return Qnil;
206
+ }
207
+
208
+ static VALUE
209
+ rb_grn_table_cursor_delete (VALUE self)
210
+ {
211
+ RbGrnTableCursor *rb_grn_table_cursor;
212
+
213
+ rb_grn_table_cursor = SELF(self);
214
+ if (rb_grn_table_cursor->context && rb_grn_table_cursor->cursor) {
215
+ grn_rc rc;
216
+
217
+ rc = grn_table_cursor_delete(rb_grn_table_cursor->context,
218
+ rb_grn_table_cursor->cursor);
219
+ rb_grn_rc_check(rc, self);
220
+ }
221
+
222
+ return Qnil;
223
+ }
224
+
225
+ static VALUE
226
+ rb_grn_table_cursor_next (VALUE self)
227
+ {
228
+ VALUE rb_record = Qnil;
229
+ RbGrnTableCursor *rb_grn_table_cursor;
230
+
231
+ rb_grn_table_cursor = SELF(self);
232
+ if (rb_grn_table_cursor->context && rb_grn_table_cursor->cursor) {
233
+ grn_id record_id;
234
+
235
+ record_id = grn_table_cursor_next(rb_grn_table_cursor->context,
236
+ rb_grn_table_cursor->cursor);
237
+ if (record_id != GRN_ID_NIL) /* FIXME: use grn_table_cursor_table */
238
+ rb_record = rb_grn_record_new(rb_iv_get(self, "@table"), record_id);
239
+ }
240
+
241
+ return rb_record;
242
+ }
243
+
244
+ static VALUE
245
+ rb_grn_table_cursor_each (VALUE self)
246
+ {
247
+ grn_id record_id;
248
+ RbGrnTableCursor *rb_grn_table_cursor;
249
+ grn_ctx *context;
250
+ grn_table_cursor *cursor;
251
+
252
+ rb_grn_table_cursor = SELF(self);
253
+ if (!rb_grn_table_cursor->context)
254
+ return Qnil;
255
+ if (!rb_grn_table_cursor->cursor)
256
+ return Qnil;
257
+
258
+ context = rb_grn_table_cursor->context;
259
+ cursor = rb_grn_table_cursor->cursor;
260
+ while ((record_id = grn_table_cursor_next(context, cursor))) {
261
+ rb_yield(rb_grn_record_new(rb_iv_get(self, "@table"), record_id));
262
+ }
263
+
264
+ return Qnil;
265
+ }
266
+
267
+ void
268
+ rb_grn_init_table_cursor (VALUE mGrn)
269
+ {
270
+ rb_cGrnTableCursor = rb_define_class_under(mGrn, "TableCurosr", rb_cObject);
271
+ rb_define_alloc_func(rb_cGrnTableCursor, rb_grn_table_cursor_alloc);
272
+
273
+ rb_include_module(rb_cGrnTableCursor, rb_mEnumerable);
274
+
275
+ rb_define_method(rb_cGrnTableCursor, "close",
276
+ rb_grn_table_cursor_close, 0);
277
+ rb_define_method(rb_cGrnTableCursor, "closed?",
278
+ rb_grn_table_cursor_closed_p, 0);
279
+
280
+ rb_define_method(rb_cGrnTableCursor, "value",
281
+ rb_grn_table_cursor_get_value, 0);
282
+ rb_define_method(rb_cGrnTableCursor, "value=",
283
+ rb_grn_table_cursor_set_value, 1);
284
+ rb_define_method(rb_cGrnTableCursor, "delete",
285
+ rb_grn_table_cursor_delete, 0);
286
+ rb_define_method(rb_cGrnTableCursor, "next",
287
+ rb_grn_table_cursor_next, 0);
288
+
289
+ rb_define_method(rb_cGrnTableCursor, "each",
290
+ rb_grn_table_cursor_each, 0);
291
+
292
+ rb_grn_init_table_cursor_key_support(mGrn);
293
+ rb_grn_init_array_cursor(mGrn);
294
+ rb_grn_init_hash_cursor(mGrn);
295
+ rb_grn_init_patricia_trie_cursor(mGrn);
296
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groonga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -15,8 +15,27 @@ cert_chain: []
15
15
 
16
16
  date: 2010-02-09 00:00:00 +09:00
17
17
  default_executable:
18
- dependencies: []
19
-
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: rubyforge
21
+ type: :development
22
+ version_requirement:
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 2.0.3
28
+ version:
29
+ - !ruby/object:Gem::Dependency
30
+ name: gemcutter
31
+ type: :development
32
+ version_requirement:
33
+ version_requirements: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: 0.3.0
38
+ version:
20
39
  description: |-
21
40
  Ruby/groonga is a extension library to use groonga's DB-API
22
41
  layer. Ruby/groonga provides Rubyish readable and writable
@@ -30,11 +49,11 @@ executables: []
30
49
  extensions:
31
50
  - extconf.rb
32
51
  extra_rdoc_files:
33
- - README.ja.rdoc
52
+ - README.rdoc
34
53
  - NEWS.ja.rdoc
35
54
  - text/TUTORIAL.ja.rdoc
36
55
  - text/expression.rdoc
37
- - README.rdoc
56
+ - README.ja.rdoc
38
57
  - NEWS.rdoc
39
58
  files:
40
59
  - AUTHORS
@@ -110,6 +129,7 @@ files:
110
129
  - license/RUBY
111
130
  - misc/grnop2ruby.rb
112
131
  - pkg-config.rb
132
+ - src/rb-grn-table-cursor.c
113
133
  - test-unit/Rakefile
114
134
  - test-unit/TODO
115
135
  - test-unit/bin/testrb