rroonga 0.9.2-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +5 -0
- data/NEWS.ja.rdoc +114 -0
- data/NEWS.rdoc +116 -0
- data/README.ja.rdoc +65 -0
- data/README.rdoc +66 -0
- data/Rakefile +217 -0
- data/benchmark/common.rb +49 -0
- data/benchmark/read-write-many-small-items.rb +144 -0
- data/benchmark/write-many-small-items.rb +135 -0
- data/example/bookmark.rb +161 -0
- data/example/index-html.rb +89 -0
- data/example/search/config.ru +211 -0
- data/example/search/public/css/groonga.css +122 -0
- data/ext/.gitignore +2 -0
- data/ext/libruby-groonga.a +0 -0
- data/ext/rb-grn-accessor.c +52 -0
- data/ext/rb-grn-array-cursor.c +36 -0
- data/ext/rb-grn-array.c +210 -0
- data/ext/rb-grn-column.c +573 -0
- data/ext/rb-grn-context.c +655 -0
- data/ext/rb-grn-database.c +472 -0
- data/ext/rb-grn-encoding-support.c +64 -0
- data/ext/rb-grn-encoding.c +257 -0
- data/ext/rb-grn-exception.c +1110 -0
- data/ext/rb-grn-expression-builder.c +75 -0
- data/ext/rb-grn-expression.c +735 -0
- data/ext/rb-grn-fix-size-column.c +166 -0
- data/ext/rb-grn-hash-cursor.c +38 -0
- data/ext/rb-grn-hash.c +294 -0
- data/ext/rb-grn-index-column.c +488 -0
- data/ext/rb-grn-logger.c +504 -0
- data/ext/rb-grn-object.c +1369 -0
- data/ext/rb-grn-operation.c +198 -0
- data/ext/rb-grn-patricia-trie-cursor.c +39 -0
- data/ext/rb-grn-patricia-trie.c +488 -0
- data/ext/rb-grn-procedure.c +52 -0
- data/ext/rb-grn-query.c +260 -0
- data/ext/rb-grn-record.c +40 -0
- data/ext/rb-grn-snippet.c +334 -0
- data/ext/rb-grn-table-cursor-key-support.c +69 -0
- data/ext/rb-grn-table-cursor.c +247 -0
- data/ext/rb-grn-table-key-support.c +731 -0
- data/ext/rb-grn-table.c +2141 -0
- data/ext/rb-grn-type.c +181 -0
- data/ext/rb-grn-utils.c +769 -0
- data/ext/rb-grn-variable-size-column.c +36 -0
- data/ext/rb-grn-variable.c +108 -0
- data/ext/rb-grn-view-accessor.c +53 -0
- data/ext/rb-grn-view-cursor.c +35 -0
- data/ext/rb-grn-view-record.c +41 -0
- data/ext/rb-grn-view.c +421 -0
- data/ext/rb-grn.h +700 -0
- data/ext/rb-groonga.c +117 -0
- data/extconf.rb +266 -0
- data/html/bar.svg +153 -0
- data/html/developer.html +117 -0
- data/html/developer.svg +469 -0
- data/html/download.svg +253 -0
- data/html/favicon.ico +0 -0
- data/html/favicon.xcf +0 -0
- data/html/footer.html.erb +28 -0
- data/html/head.html.erb +4 -0
- data/html/header.html.erb +17 -0
- data/html/index.html +147 -0
- data/html/install.svg +636 -0
- data/html/logo.xcf +0 -0
- data/html/ranguba.css +250 -0
- data/html/tutorial.svg +559 -0
- data/lib/groonga.rb +90 -0
- data/lib/groonga/context.rb +184 -0
- data/lib/groonga/expression-builder.rb +285 -0
- data/lib/groonga/patricia-trie.rb +53 -0
- data/lib/groonga/record.rb +311 -0
- data/lib/groonga/schema.rb +1191 -0
- data/lib/groonga/view-record.rb +56 -0
- data/license/GPL +340 -0
- data/license/LGPL +504 -0
- data/license/RUBY +59 -0
- data/misc/grnop2ruby.rb +49 -0
- data/pkg-config.rb +333 -0
- data/test-unit/Rakefile +40 -0
- data/test-unit/TODO +5 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/html/classic.html +15 -0
- data/test-unit/html/index.html +25 -0
- data/test-unit/html/index.html.ja +27 -0
- data/test-unit/lib/test/unit.rb +323 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +25 -0
- data/test-unit/lib/test/unit/assertions.rb +1230 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +360 -0
- data/test-unit/lib/test/unit/collector.rb +36 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +136 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/color-scheme.rb +102 -0
- data/test-unit/lib/test/unit/color.rb +96 -0
- data/test-unit/lib/test/unit/diff.rb +724 -0
- data/test-unit/lib/test/unit/error.rb +130 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +136 -0
- data/test-unit/lib/test/unit/fixture.rb +176 -0
- data/test-unit/lib/test/unit/notification.rb +129 -0
- data/test-unit/lib/test/unit/omission.rb +191 -0
- data/test-unit/lib/test/unit/pending.rb +150 -0
- data/test-unit/lib/test/unit/priority.rb +180 -0
- data/test-unit/lib/test/unit/runner/console.rb +52 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/runner/tap.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +476 -0
- data/test-unit/lib/test/unit/testresult.rb +89 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +466 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +63 -0
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +92 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +28 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/test_adder.rb +20 -0
- data/test-unit/sample/test_subtracter.rb +20 -0
- data/test-unit/sample/test_user.rb +23 -0
- data/test-unit/test/collector/test-descendant.rb +133 -0
- data/test-unit/test/collector/test-load.rb +348 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_objectspace.rb +100 -0
- data/test-unit/test/run-test.rb +15 -0
- data/test-unit/test/test-attribute.rb +86 -0
- data/test-unit/test/test-color-scheme.rb +67 -0
- data/test-unit/test/test-color.rb +47 -0
- data/test-unit/test/test-diff.rb +518 -0
- data/test-unit/test/test-emacs-runner.rb +60 -0
- data/test-unit/test/test-fixture.rb +287 -0
- data/test-unit/test/test-notification.rb +33 -0
- data/test-unit/test/test-omission.rb +81 -0
- data/test-unit/test/test-pending.rb +70 -0
- data/test-unit/test/test-priority.rb +119 -0
- data/test-unit/test/test-testcase.rb +544 -0
- data/test-unit/test/test_assertions.rb +1151 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit-test-util.rb +14 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test-method-owner-finder.rb +38 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/test/.gitignore +1 -0
- data/test/groonga-test-utils.rb +133 -0
- data/test/run-test.rb +58 -0
- data/test/test-array.rb +97 -0
- data/test/test-column.rb +316 -0
- data/test/test-context-select.rb +93 -0
- data/test/test-context.rb +73 -0
- data/test/test-database.rb +113 -0
- data/test/test-encoding.rb +33 -0
- data/test/test-exception.rb +93 -0
- data/test/test-expression-builder.rb +156 -0
- data/test/test-expression.rb +134 -0
- data/test/test-fix-size-column.rb +65 -0
- data/test/test-gqtp.rb +72 -0
- data/test/test-hash.rb +312 -0
- data/test/test-index-column.rb +81 -0
- data/test/test-logger.rb +37 -0
- data/test/test-patricia-trie.rb +189 -0
- data/test/test-procedure.rb +37 -0
- data/test/test-query.rb +22 -0
- data/test/test-record.rb +279 -0
- data/test/test-remote.rb +54 -0
- data/test/test-schema-view.rb +90 -0
- data/test/test-schema.rb +459 -0
- data/test/test-snippet.rb +130 -0
- data/test/test-table-cursor.rb +153 -0
- data/test/test-table-offset-and-limit.rb +102 -0
- data/test/test-table-select-normalize.rb +53 -0
- data/test/test-table-select.rb +150 -0
- data/test/test-table.rb +690 -0
- data/test/test-type.rb +71 -0
- data/test/test-variable-size-column.rb +98 -0
- data/test/test-variable.rb +28 -0
- data/test/test-vector-column.rb +76 -0
- data/test/test-version.rb +31 -0
- data/test/test-view.rb +72 -0
- data/text/TUTORIAL.ja.rdoc +392 -0
- data/text/expression.rdoc +284 -0
- data/vendor/local/bin/grntest.exe +0 -0
- data/vendor/local/bin/groonga.exe +0 -0
- data/vendor/local/bin/libgroonga.dll +0 -0
- data/vendor/local/bin/libmecab.dll +0 -0
- data/vendor/local/include/groonga.h +2285 -0
- data/vendor/local/lib/libgroonga.lib +0 -0
- metadata +280 -0
@@ -0,0 +1,64 @@
|
|
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_GRN_OBJECT(DATA_PTR(object)))
|
22
|
+
|
23
|
+
VALUE rb_mGrnEncodingSupport;
|
24
|
+
|
25
|
+
/*
|
26
|
+
* Document-module: Groonga::EncodingSupport
|
27
|
+
*
|
28
|
+
* オブジェクトにエンコーディング関連の機能を提供するモジュー
|
29
|
+
* ル。
|
30
|
+
*/
|
31
|
+
|
32
|
+
/*
|
33
|
+
* call-seq:
|
34
|
+
* object.encoding -> エンコーディング
|
35
|
+
*
|
36
|
+
* オブジェクトのエンコーディングを返す。
|
37
|
+
*/
|
38
|
+
static VALUE
|
39
|
+
rb_grn_encoding_support_get_encoding (VALUE self)
|
40
|
+
{
|
41
|
+
grn_ctx *context = NULL;
|
42
|
+
grn_obj *object = NULL;
|
43
|
+
grn_obj *encoding_value;
|
44
|
+
grn_encoding encoding;
|
45
|
+
|
46
|
+
rb_grn_object_deconstruct(SELF(self), &object, &context,
|
47
|
+
NULL, NULL, NULL, NULL);
|
48
|
+
encoding_value = grn_obj_get_info(context, object, GRN_INFO_ENCODING, NULL);
|
49
|
+
rb_grn_context_check(context, self);
|
50
|
+
|
51
|
+
memcpy(&encoding, GRN_BULK_HEAD(encoding_value), sizeof(encoding));
|
52
|
+
grn_obj_unlink(context, encoding_value);
|
53
|
+
|
54
|
+
return GRNENCODING2RVAL(encoding);
|
55
|
+
}
|
56
|
+
|
57
|
+
void
|
58
|
+
rb_grn_init_encoding_support (VALUE mGrn)
|
59
|
+
{
|
60
|
+
rb_mGrnEncodingSupport = rb_define_module_under(mGrn, "EncodingSupport");
|
61
|
+
|
62
|
+
rb_define_method(rb_mGrnEncodingSupport, "encoding",
|
63
|
+
rb_grn_encoding_support_get_encoding, 0);
|
64
|
+
}
|
@@ -0,0 +1,257 @@
|
|
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
|
+
/*
|
22
|
+
* Document-module: Groonga::Encoding
|
23
|
+
*
|
24
|
+
* groongaがサポートしてるエンコーディングが定義されてい
|
25
|
+
* るモジュール。
|
26
|
+
*
|
27
|
+
* エンコーディングの指定方法は以下の通り。
|
28
|
+
*
|
29
|
+
* [+nil+]
|
30
|
+
* コンテキストと関連付けられているオブジェクトの場合(多
|
31
|
+
* くの場合)はコンテキストのエンコーディングを使用。
|
32
|
+
*
|
33
|
+
* それ以外のオブジェクトの場合(コンテキスト自身など)は
|
34
|
+
* groongaのビルド時に指定したエンコーディング
|
35
|
+
* (Groonga::Encoding::DEFAULT)を使用
|
36
|
+
*
|
37
|
+
* [+:default+]
|
38
|
+
* groongaのビルド時に指定したエンコーディングを使用。
|
39
|
+
* Groonga::Encoding::DEFAULT
|
40
|
+
*
|
41
|
+
* [+:none+]
|
42
|
+
* エンコーディングを指定しない。Groonga::Encoding::NONE
|
43
|
+
*
|
44
|
+
* [+:euc_jp+]
|
45
|
+
* EUC-JPを使用。Groonga::Encoding::EUC_JP
|
46
|
+
*
|
47
|
+
* [<tt>"euc-jp"</tt>]
|
48
|
+
* +:euc_jp+と同じ。
|
49
|
+
*
|
50
|
+
* [+:utf8+]
|
51
|
+
* UTF-8を使用。Groonga::Encoding::UTF8
|
52
|
+
*
|
53
|
+
* [<tt>"utf-8"</tt>]
|
54
|
+
* +:utf8+と同じ。
|
55
|
+
*
|
56
|
+
* [+:sjis+]
|
57
|
+
* Shift_JISを使用。Groonga::Encoding::SJIS
|
58
|
+
*
|
59
|
+
* [+:shift_jis+]
|
60
|
+
* +:sjis+と同じ。
|
61
|
+
*
|
62
|
+
* [<tt>"shift-jis"</tt>]
|
63
|
+
* +:sjis+と同じ。
|
64
|
+
*
|
65
|
+
* [+:latin1+]
|
66
|
+
* Latin-1を使用。Groonga::Encoding::LATIN1
|
67
|
+
*
|
68
|
+
* [+:koi8r+]
|
69
|
+
* KOI8-Rを使用。Groonga::Encoding::KOI8R
|
70
|
+
*/
|
71
|
+
|
72
|
+
static VALUE mGrnEncoding;
|
73
|
+
static VALUE RB_GRN_ENCODING_DEFAULT;
|
74
|
+
static VALUE RB_GRN_ENCODING_NONE;
|
75
|
+
static VALUE RB_GRN_ENCODING_EUC_JP;
|
76
|
+
static VALUE RB_GRN_ENCODING_UTF8;
|
77
|
+
static VALUE RB_GRN_ENCODING_SJIS;
|
78
|
+
static VALUE RB_GRN_ENCODING_LATIN1;
|
79
|
+
static VALUE RB_GRN_ENCODING_KOI8R;
|
80
|
+
|
81
|
+
grn_encoding
|
82
|
+
rb_grn_encoding_from_ruby_object (VALUE object, grn_ctx *context)
|
83
|
+
{
|
84
|
+
if (NIL_P(object)) {
|
85
|
+
if (context)
|
86
|
+
return context->encoding;
|
87
|
+
else
|
88
|
+
return GRN_ENC_DEFAULT;
|
89
|
+
}
|
90
|
+
|
91
|
+
if (rb_grn_equal_option(object, "default")) {
|
92
|
+
return GRN_ENC_DEFAULT;
|
93
|
+
} else if (rb_grn_equal_option(object, "none")) {
|
94
|
+
return GRN_ENC_NONE;
|
95
|
+
} else if (rb_grn_equal_option(object, "euc_jp") ||
|
96
|
+
rb_grn_equal_option(object, "euc-jp")) {
|
97
|
+
return GRN_ENC_EUC_JP;
|
98
|
+
} else if (rb_grn_equal_option(object, "utf8") ||
|
99
|
+
rb_grn_equal_option(object, "utf-8")) {
|
100
|
+
return GRN_ENC_UTF8;
|
101
|
+
} else if (rb_grn_equal_option(object, "sjis") ||
|
102
|
+
rb_grn_equal_option(object, "shift_jis") ||
|
103
|
+
rb_grn_equal_option(object, "shift-jis")) {
|
104
|
+
return GRN_ENC_SJIS;
|
105
|
+
} else if (rb_grn_equal_option(object, "latin1")) {
|
106
|
+
return GRN_ENC_LATIN1;
|
107
|
+
} else if (rb_grn_equal_option(object, "koi8r")) {
|
108
|
+
return GRN_ENC_KOI8R;
|
109
|
+
} else {
|
110
|
+
rb_raise(rb_eGrnError, "unknown encoding: %s", rb_grn_inspect(object));
|
111
|
+
}
|
112
|
+
|
113
|
+
return GRN_ENC_DEFAULT;
|
114
|
+
}
|
115
|
+
|
116
|
+
VALUE
|
117
|
+
rb_grn_encoding_to_ruby_object (grn_encoding encoding)
|
118
|
+
{
|
119
|
+
VALUE rb_encoding;
|
120
|
+
|
121
|
+
switch (encoding) {
|
122
|
+
case GRN_ENC_DEFAULT:
|
123
|
+
rb_encoding = RB_GRN_ENCODING_DEFAULT;
|
124
|
+
break;
|
125
|
+
case GRN_ENC_NONE:
|
126
|
+
rb_encoding = RB_GRN_ENCODING_NONE;
|
127
|
+
break;
|
128
|
+
case GRN_ENC_EUC_JP:
|
129
|
+
rb_encoding = RB_GRN_ENCODING_EUC_JP;
|
130
|
+
break;
|
131
|
+
case GRN_ENC_UTF8:
|
132
|
+
rb_encoding = RB_GRN_ENCODING_UTF8;
|
133
|
+
break;
|
134
|
+
case GRN_ENC_SJIS:
|
135
|
+
rb_encoding = RB_GRN_ENCODING_SJIS;
|
136
|
+
break;
|
137
|
+
case GRN_ENC_LATIN1:
|
138
|
+
rb_encoding = RB_GRN_ENCODING_LATIN1;
|
139
|
+
break;
|
140
|
+
case GRN_ENC_KOI8R:
|
141
|
+
rb_encoding = RB_GRN_ENCODING_KOI8R;
|
142
|
+
break;
|
143
|
+
default:
|
144
|
+
rb_raise(rb_eArgError, "unknown encoding: %d", encoding);
|
145
|
+
break;
|
146
|
+
}
|
147
|
+
|
148
|
+
return rb_encoding;
|
149
|
+
}
|
150
|
+
|
151
|
+
#ifdef HAVE_RUBY_ENCODING_H
|
152
|
+
rb_encoding *
|
153
|
+
rb_grn_encoding_to_ruby_encoding (grn_encoding encoding)
|
154
|
+
{
|
155
|
+
rb_encoding *rb_encoding;
|
156
|
+
|
157
|
+
if (encoding == GRN_ENC_DEFAULT)
|
158
|
+
encoding = grn_get_default_encoding();
|
159
|
+
|
160
|
+
switch (encoding) {
|
161
|
+
case GRN_ENC_NONE:
|
162
|
+
rb_encoding = rb_ascii8bit_encoding();
|
163
|
+
break;
|
164
|
+
case GRN_ENC_EUC_JP:
|
165
|
+
rb_encoding = rb_enc_find("euc-jp");
|
166
|
+
break;
|
167
|
+
case GRN_ENC_UTF8:
|
168
|
+
rb_encoding = rb_utf8_encoding();
|
169
|
+
break;
|
170
|
+
case GRN_ENC_SJIS:
|
171
|
+
rb_encoding = rb_enc_find("CP932");
|
172
|
+
break;
|
173
|
+
case GRN_ENC_LATIN1:
|
174
|
+
rb_encoding = rb_enc_find("ISO-8859-1");
|
175
|
+
break;
|
176
|
+
case GRN_ENC_KOI8R:
|
177
|
+
rb_encoding = rb_enc_find("KOI8-R");
|
178
|
+
break;
|
179
|
+
default:
|
180
|
+
rb_raise(rb_eArgError, "unknown encoding: %d", encoding);
|
181
|
+
break;
|
182
|
+
}
|
183
|
+
|
184
|
+
return rb_encoding;
|
185
|
+
}
|
186
|
+
#endif
|
187
|
+
|
188
|
+
/*
|
189
|
+
* call-seq:
|
190
|
+
* Groonga::Encoding.default -> エンコーディング
|
191
|
+
*
|
192
|
+
* デフォルトのエンコーディングを返す。
|
193
|
+
*/
|
194
|
+
static VALUE
|
195
|
+
rb_grn_encoding_s_get_default (VALUE self)
|
196
|
+
{
|
197
|
+
return GRNENCODING2RVAL(grn_get_default_encoding());
|
198
|
+
}
|
199
|
+
|
200
|
+
/*
|
201
|
+
* call-seq:
|
202
|
+
* Groonga::Encoding.default(encoding)
|
203
|
+
*
|
204
|
+
* デフォルトのエンコーディングを設定する。エンコーディング
|
205
|
+
* の指定方法はGroonga::Encodingを参照。
|
206
|
+
*/
|
207
|
+
static VALUE
|
208
|
+
rb_grn_encoding_s_set_default (VALUE self, VALUE rb_encoding)
|
209
|
+
{
|
210
|
+
grn_set_default_encoding(RVAL2GRNENCODING(rb_encoding, NULL));
|
211
|
+
return rb_encoding;
|
212
|
+
}
|
213
|
+
|
214
|
+
void
|
215
|
+
rb_grn_init_encoding (VALUE mGrn)
|
216
|
+
{
|
217
|
+
mGrnEncoding = rb_define_module_under(mGrn, "Encoding");
|
218
|
+
|
219
|
+
rb_define_singleton_method(mGrnEncoding, "default",
|
220
|
+
rb_grn_encoding_s_get_default, 0);
|
221
|
+
rb_define_singleton_method(mGrnEncoding, "default=",
|
222
|
+
rb_grn_encoding_s_set_default, 1);
|
223
|
+
|
224
|
+
#define DEFINE_ENCODING(name, value) \
|
225
|
+
RB_GRN_ENCODING_ ## name = RB_GRN_INTERN(value); \
|
226
|
+
rb_define_const(mGrnEncoding, #name, RB_GRN_ENCODING_ ## name)
|
227
|
+
|
228
|
+
RB_GRN_ENCODING_DEFAULT = RB_GRN_INTERN("default");
|
229
|
+
/* groongaをビルドしたときに指定したエンコーディング。 */
|
230
|
+
rb_define_const(mGrnEncoding, "DEFAULT", RB_GRN_ENCODING_DEFAULT);
|
231
|
+
|
232
|
+
RB_GRN_ENCODING_NONE = RB_GRN_INTERN("none");
|
233
|
+
/* 文字列をバイト列として扱うエンコーディング。 */
|
234
|
+
rb_define_const(mGrnEncoding, "NONE", RB_GRN_ENCODING_NONE);
|
235
|
+
|
236
|
+
RB_GRN_ENCODING_EUC_JP = RB_GRN_INTERN("euc_jp");
|
237
|
+
/* EUC-JP */
|
238
|
+
rb_define_const(mGrnEncoding, "EUC_JP", RB_GRN_ENCODING_EUC_JP);
|
239
|
+
|
240
|
+
RB_GRN_ENCODING_SJIS = RB_GRN_INTERN("sjis");
|
241
|
+
/* ShiftJIS */
|
242
|
+
rb_define_const(mGrnEncoding, "SJIS", RB_GRN_ENCODING_SJIS);
|
243
|
+
|
244
|
+
RB_GRN_ENCODING_UTF8 = RB_GRN_INTERN("utf8");
|
245
|
+
/* UTF-8 */
|
246
|
+
rb_define_const(mGrnEncoding, "UTF8", RB_GRN_ENCODING_UTF8);
|
247
|
+
|
248
|
+
RB_GRN_ENCODING_LATIN1 = RB_GRN_INTERN("latin1");
|
249
|
+
/* Latin-1。ISO-8859-1ではなくWindows-1252(CP1252)。 */
|
250
|
+
rb_define_const(mGrnEncoding, "LATIN1", RB_GRN_ENCODING_LATIN1);
|
251
|
+
|
252
|
+
RB_GRN_ENCODING_KOI8R = RB_GRN_INTERN("koi8r");
|
253
|
+
/* KOI8-R */
|
254
|
+
rb_define_const(mGrnEncoding, "KOI8R", RB_GRN_ENCODING_KOI8R);
|
255
|
+
|
256
|
+
#undef DEFINE_ENCODING
|
257
|
+
}
|
@@ -0,0 +1,1110 @@
|
|
1
|
+
/* -*- c-file-style: "ruby" -*- */
|
2
|
+
/*
|
3
|
+
Copyright (C) 2009-2010 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
|
+
VALUE rb_eGrnError;
|
22
|
+
VALUE rb_eGrnObjectClosed;
|
23
|
+
VALUE rb_eGrnNoSuchColumn;
|
24
|
+
|
25
|
+
static VALUE eGrnEndOfData;
|
26
|
+
static VALUE eGrnUnknownError;
|
27
|
+
static VALUE eGrnOperationNotPermitted;
|
28
|
+
static VALUE eGrnNoSuchFileOrDirectory;
|
29
|
+
static VALUE eGrnNoSuchProcess;
|
30
|
+
static VALUE eGrnInterruptedFunctionCall;
|
31
|
+
static VALUE eGrnInputOutputError;
|
32
|
+
static VALUE eGrnNoSuchDeviceOrAddress;
|
33
|
+
static VALUE eGrnArgumentListTooLong;
|
34
|
+
static VALUE eGrnExecFormatError;
|
35
|
+
static VALUE eGrnBadFileDescriptor;
|
36
|
+
static VALUE eGrnNoChildProcesses;
|
37
|
+
static VALUE eGrnResourceTemporarilyUnavailable;
|
38
|
+
static VALUE eGrnNotEnoughSpace;
|
39
|
+
static VALUE eGrnPermissionDenied;
|
40
|
+
static VALUE eGrnBadAddress;
|
41
|
+
static VALUE eGrnResourceBusy;
|
42
|
+
static VALUE eGrnFileExists;
|
43
|
+
static VALUE eGrnImproperLink;
|
44
|
+
static VALUE eGrnNoSuchDevice;
|
45
|
+
static VALUE eGrnNotADirectory;
|
46
|
+
static VALUE eGrnIsADirectory;
|
47
|
+
VALUE rb_eGrnInvalidArgument;
|
48
|
+
static VALUE eGrnTooManyOpenFilesInSystem;
|
49
|
+
static VALUE eGrnTooManyOpenFiles;
|
50
|
+
static VALUE eGrnInappropriateIOControlOperation;
|
51
|
+
static VALUE eGrnFileTooLarge;
|
52
|
+
static VALUE eGrnNoSpaceLeftOnDevice;
|
53
|
+
static VALUE eGrnInvalidSeek;
|
54
|
+
static VALUE eGrnReadOnlyFileSystem;
|
55
|
+
static VALUE eGrnTooManyLinks;
|
56
|
+
static VALUE eGrnBrokenPipe;
|
57
|
+
static VALUE eGrnDomainError;
|
58
|
+
static VALUE eGrnResultTooLarge;
|
59
|
+
static VALUE eGrnResourceDeadlockAvoided;
|
60
|
+
static VALUE eGrnNoMemoryAvailable;
|
61
|
+
static VALUE eGrnFilenameTooLong;
|
62
|
+
static VALUE eGrnNoLocksAvailable;
|
63
|
+
static VALUE eGrnFunctionNotImplemented;
|
64
|
+
static VALUE eGrnDirectoryNotEmpty;
|
65
|
+
static VALUE eGrnIllegalByteSequence;
|
66
|
+
static VALUE eGrnSocketNotInitialized;
|
67
|
+
static VALUE eGrnOperationWouldBlock;
|
68
|
+
static VALUE eGrnAddressIsNotAvailable;
|
69
|
+
static VALUE eGrnNetworkIsDown;
|
70
|
+
static VALUE eGrnNoBuffer;
|
71
|
+
static VALUE eGrnSocketIsAlreadyConnected;
|
72
|
+
static VALUE eGrnSocketIsNotConnected;
|
73
|
+
static VALUE eGrnSocketIsAlreadyShutdowned;
|
74
|
+
static VALUE eGrnOperationTimeout;
|
75
|
+
static VALUE eGrnConnectionRefused;
|
76
|
+
static VALUE eGrnRangeError;
|
77
|
+
static VALUE eGrnTokenizerError;
|
78
|
+
static VALUE eGrnFileCorrupt;
|
79
|
+
static VALUE eGrnInvalidFormat;
|
80
|
+
static VALUE eGrnObjectCorrupt;
|
81
|
+
static VALUE eGrnTooManySymbolicLinks;
|
82
|
+
static VALUE eGrnNotSocket;
|
83
|
+
static VALUE eGrnOperationNotSupported;
|
84
|
+
static VALUE eGrnAddressIsInUse;
|
85
|
+
static VALUE eGrnZLibError;
|
86
|
+
static VALUE eGrnLZOError;
|
87
|
+
static VALUE eGrnStackOverFlow;
|
88
|
+
static VALUE eGrnSyntaxError;
|
89
|
+
static VALUE eGrnRetryMax;
|
90
|
+
static VALUE eGrnIncompatibleFileFormat;
|
91
|
+
static VALUE eGrnUpdateNotAllowed;
|
92
|
+
|
93
|
+
VALUE
|
94
|
+
rb_grn_rc_to_exception (grn_rc rc)
|
95
|
+
{
|
96
|
+
VALUE exception = Qnil;
|
97
|
+
|
98
|
+
switch (rc) {
|
99
|
+
case GRN_SUCCESS:
|
100
|
+
return Qnil;
|
101
|
+
break;
|
102
|
+
case GRN_END_OF_DATA:
|
103
|
+
exception = eGrnEndOfData;
|
104
|
+
break;
|
105
|
+
case GRN_UNKNOWN_ERROR:
|
106
|
+
exception = eGrnUnknownError;
|
107
|
+
break;
|
108
|
+
case GRN_OPERATION_NOT_PERMITTED:
|
109
|
+
exception = eGrnOperationNotPermitted;
|
110
|
+
break;
|
111
|
+
case GRN_NO_SUCH_FILE_OR_DIRECTORY:
|
112
|
+
exception = eGrnNoSuchFileOrDirectory;
|
113
|
+
break;
|
114
|
+
case GRN_NO_SUCH_PROCESS:
|
115
|
+
exception = eGrnNoSuchProcess;
|
116
|
+
break;
|
117
|
+
case GRN_INTERRUPTED_FUNCTION_CALL:
|
118
|
+
exception = eGrnInterruptedFunctionCall;
|
119
|
+
break;
|
120
|
+
case GRN_INPUT_OUTPUT_ERROR:
|
121
|
+
exception = eGrnInputOutputError;
|
122
|
+
break;
|
123
|
+
case GRN_NO_SUCH_DEVICE_OR_ADDRESS:
|
124
|
+
exception = eGrnNoSuchDeviceOrAddress;
|
125
|
+
break;
|
126
|
+
case GRN_ARG_LIST_TOO_LONG:
|
127
|
+
exception = eGrnArgumentListTooLong;
|
128
|
+
break;
|
129
|
+
case GRN_EXEC_FORMAT_ERROR:
|
130
|
+
exception = eGrnExecFormatError;
|
131
|
+
break;
|
132
|
+
case GRN_BAD_FILE_DESCRIPTOR:
|
133
|
+
exception = eGrnBadFileDescriptor;
|
134
|
+
break;
|
135
|
+
case GRN_NO_CHILD_PROCESSES:
|
136
|
+
exception = eGrnNoChildProcesses;
|
137
|
+
break;
|
138
|
+
case GRN_RESOURCE_TEMPORARILY_UNAVAILABLE:
|
139
|
+
exception = eGrnResourceTemporarilyUnavailable;
|
140
|
+
break;
|
141
|
+
case GRN_NOT_ENOUGH_SPACE:
|
142
|
+
exception = eGrnNotEnoughSpace;
|
143
|
+
break;
|
144
|
+
case GRN_PERMISSION_DENIED:
|
145
|
+
exception = eGrnPermissionDenied;
|
146
|
+
break;
|
147
|
+
case GRN_BAD_ADDRESS:
|
148
|
+
exception = eGrnBadAddress;
|
149
|
+
break;
|
150
|
+
case GRN_RESOURCE_BUSY:
|
151
|
+
exception = eGrnResourceBusy;
|
152
|
+
break;
|
153
|
+
case GRN_FILE_EXISTS:
|
154
|
+
exception = eGrnFileExists;
|
155
|
+
break;
|
156
|
+
case GRN_IMPROPER_LINK:
|
157
|
+
exception = eGrnImproperLink;
|
158
|
+
break;
|
159
|
+
case GRN_NO_SUCH_DEVICE:
|
160
|
+
exception = eGrnNoSuchDevice;
|
161
|
+
break;
|
162
|
+
case GRN_NOT_A_DIRECTORY:
|
163
|
+
exception = eGrnNotADirectory;
|
164
|
+
break;
|
165
|
+
case GRN_IS_A_DIRECTORY:
|
166
|
+
exception = eGrnIsADirectory;
|
167
|
+
break;
|
168
|
+
case GRN_INVALID_ARGUMENT:
|
169
|
+
exception = rb_eGrnInvalidArgument;
|
170
|
+
break;
|
171
|
+
case GRN_TOO_MANY_OPEN_FILES_IN_SYSTEM:
|
172
|
+
exception = eGrnTooManyOpenFilesInSystem;
|
173
|
+
break;
|
174
|
+
case GRN_TOO_MANY_OPEN_FILES:
|
175
|
+
exception = eGrnTooManyOpenFiles;
|
176
|
+
break;
|
177
|
+
case GRN_INAPPROPRIATE_I_O_CONTROL_OPERATION:
|
178
|
+
exception = eGrnInappropriateIOControlOperation;
|
179
|
+
break;
|
180
|
+
case GRN_FILE_TOO_LARGE:
|
181
|
+
exception = eGrnFileTooLarge;
|
182
|
+
break;
|
183
|
+
case GRN_NO_SPACE_LEFT_ON_DEVICE:
|
184
|
+
exception = eGrnNoSpaceLeftOnDevice;
|
185
|
+
break;
|
186
|
+
case GRN_INVALID_SEEK:
|
187
|
+
exception = eGrnInvalidSeek;
|
188
|
+
break;
|
189
|
+
case GRN_READ_ONLY_FILE_SYSTEM:
|
190
|
+
exception = eGrnReadOnlyFileSystem;
|
191
|
+
break;
|
192
|
+
case GRN_TOO_MANY_LINKS:
|
193
|
+
exception = eGrnTooManyLinks;
|
194
|
+
break;
|
195
|
+
case GRN_BROKEN_PIPE:
|
196
|
+
exception = eGrnBrokenPipe;
|
197
|
+
break;
|
198
|
+
case GRN_DOMAIN_ERROR:
|
199
|
+
exception = eGrnDomainError;
|
200
|
+
break;
|
201
|
+
case GRN_RESULT_TOO_LARGE:
|
202
|
+
exception = eGrnResultTooLarge;
|
203
|
+
break;
|
204
|
+
case GRN_RESOURCE_DEADLOCK_AVOIDED:
|
205
|
+
exception = eGrnResourceDeadlockAvoided;
|
206
|
+
break;
|
207
|
+
case GRN_NO_MEMORY_AVAILABLE:
|
208
|
+
exception = eGrnNoMemoryAvailable;
|
209
|
+
break;
|
210
|
+
case GRN_FILENAME_TOO_LONG:
|
211
|
+
exception = eGrnFilenameTooLong;
|
212
|
+
break;
|
213
|
+
case GRN_NO_LOCKS_AVAILABLE:
|
214
|
+
exception = eGrnNoLocksAvailable;
|
215
|
+
break;
|
216
|
+
case GRN_FUNCTION_NOT_IMPLEMENTED:
|
217
|
+
exception = eGrnFunctionNotImplemented;
|
218
|
+
break;
|
219
|
+
case GRN_DIRECTORY_NOT_EMPTY:
|
220
|
+
exception = eGrnDirectoryNotEmpty;
|
221
|
+
break;
|
222
|
+
case GRN_ILLEGAL_BYTE_SEQUENCE:
|
223
|
+
exception = eGrnIllegalByteSequence;
|
224
|
+
break;
|
225
|
+
case GRN_SOCKET_NOT_INITIALIZED:
|
226
|
+
exception = eGrnSocketNotInitialized;
|
227
|
+
break;
|
228
|
+
case GRN_OPERATION_WOULD_BLOCK:
|
229
|
+
exception = eGrnOperationWouldBlock;
|
230
|
+
break;
|
231
|
+
case GRN_ADDRESS_IS_NOT_AVAILABLE:
|
232
|
+
exception = eGrnAddressIsNotAvailable;
|
233
|
+
break;
|
234
|
+
case GRN_NETWORK_IS_DOWN:
|
235
|
+
exception = eGrnNetworkIsDown;
|
236
|
+
break;
|
237
|
+
case GRN_NO_BUFFER:
|
238
|
+
exception = eGrnNoBuffer;
|
239
|
+
break;
|
240
|
+
case GRN_SOCKET_IS_ALREADY_CONNECTED:
|
241
|
+
exception = eGrnSocketIsAlreadyConnected;
|
242
|
+
break;
|
243
|
+
case GRN_SOCKET_IS_NOT_CONNECTED:
|
244
|
+
exception = eGrnSocketIsNotConnected;
|
245
|
+
break;
|
246
|
+
case GRN_SOCKET_IS_ALREADY_SHUTDOWNED:
|
247
|
+
exception = eGrnSocketIsAlreadyShutdowned;
|
248
|
+
break;
|
249
|
+
case GRN_OPERATION_TIMEOUT:
|
250
|
+
exception = eGrnOperationTimeout;
|
251
|
+
break;
|
252
|
+
case GRN_CONNECTION_REFUSED:
|
253
|
+
exception = eGrnConnectionRefused;
|
254
|
+
break;
|
255
|
+
case GRN_RANGE_ERROR:
|
256
|
+
exception = eGrnRangeError;
|
257
|
+
break;
|
258
|
+
case GRN_TOKENIZER_ERROR:
|
259
|
+
exception = eGrnTokenizerError;
|
260
|
+
break;
|
261
|
+
case GRN_FILE_CORRUPT:
|
262
|
+
exception = eGrnFileCorrupt;
|
263
|
+
break;
|
264
|
+
case GRN_INVALID_FORMAT:
|
265
|
+
exception = eGrnInvalidFormat;
|
266
|
+
break;
|
267
|
+
case GRN_OBJECT_CORRUPT:
|
268
|
+
exception = eGrnObjectCorrupt;
|
269
|
+
break;
|
270
|
+
case GRN_TOO_MANY_SYMBOLIC_LINKS:
|
271
|
+
exception = eGrnTooManySymbolicLinks;
|
272
|
+
break;
|
273
|
+
case GRN_NOT_SOCKET:
|
274
|
+
exception = eGrnNotSocket;
|
275
|
+
break;
|
276
|
+
case GRN_OPERATION_NOT_SUPPORTED:
|
277
|
+
exception = eGrnOperationNotSupported;
|
278
|
+
break;
|
279
|
+
case GRN_ADDRESS_IS_IN_USE:
|
280
|
+
exception = eGrnAddressIsInUse;
|
281
|
+
break;
|
282
|
+
case GRN_ZLIB_ERROR:
|
283
|
+
exception = eGrnZLibError;
|
284
|
+
break;
|
285
|
+
case GRN_LZO_ERROR:
|
286
|
+
exception = eGrnLZOError;
|
287
|
+
break;
|
288
|
+
case GRN_STACK_OVER_FLOW:
|
289
|
+
exception = eGrnStackOverFlow;
|
290
|
+
break;
|
291
|
+
case GRN_SYNTAX_ERROR:
|
292
|
+
exception = eGrnSyntaxError;
|
293
|
+
break;
|
294
|
+
case GRN_RETRY_MAX:
|
295
|
+
exception = eGrnRetryMax;
|
296
|
+
break;
|
297
|
+
case GRN_INCOMPATIBLE_FILE_FORMAT:
|
298
|
+
exception = eGrnIncompatibleFileFormat;
|
299
|
+
break;
|
300
|
+
case GRN_UPDATE_NOT_ALLOWED:
|
301
|
+
exception = eGrnUpdateNotAllowed;
|
302
|
+
break;
|
303
|
+
}
|
304
|
+
|
305
|
+
if (NIL_P(exception))
|
306
|
+
rb_raise(rb_eGrnError, "invalid return code: %d", rc);
|
307
|
+
|
308
|
+
return exception;
|
309
|
+
}
|
310
|
+
|
311
|
+
const char *
|
312
|
+
rb_grn_rc_to_message (grn_rc rc)
|
313
|
+
{
|
314
|
+
const char *message = NULL;
|
315
|
+
|
316
|
+
switch (rc) {
|
317
|
+
case GRN_SUCCESS:
|
318
|
+
return NULL;
|
319
|
+
break;
|
320
|
+
case GRN_END_OF_DATA:
|
321
|
+
message = "end of data";
|
322
|
+
break;
|
323
|
+
case GRN_UNKNOWN_ERROR:
|
324
|
+
message = "unknown error";
|
325
|
+
break;
|
326
|
+
case GRN_OPERATION_NOT_PERMITTED:
|
327
|
+
message = "operation not permitted";
|
328
|
+
break;
|
329
|
+
case GRN_NO_SUCH_FILE_OR_DIRECTORY:
|
330
|
+
message = "no such file or directory";
|
331
|
+
break;
|
332
|
+
case GRN_NO_SUCH_PROCESS:
|
333
|
+
message = "no such process";
|
334
|
+
break;
|
335
|
+
case GRN_INTERRUPTED_FUNCTION_CALL:
|
336
|
+
message = "interrupted function call";
|
337
|
+
break;
|
338
|
+
case GRN_INPUT_OUTPUT_ERROR:
|
339
|
+
message = "input output error";
|
340
|
+
break;
|
341
|
+
case GRN_NO_SUCH_DEVICE_OR_ADDRESS:
|
342
|
+
message = "no such device or address";
|
343
|
+
break;
|
344
|
+
case GRN_ARG_LIST_TOO_LONG:
|
345
|
+
message = "argument list too long";
|
346
|
+
break;
|
347
|
+
case GRN_EXEC_FORMAT_ERROR:
|
348
|
+
message = "exec format error";
|
349
|
+
break;
|
350
|
+
case GRN_BAD_FILE_DESCRIPTOR:
|
351
|
+
message = "bad file descriptor";
|
352
|
+
break;
|
353
|
+
case GRN_NO_CHILD_PROCESSES:
|
354
|
+
message = "no child processes";
|
355
|
+
break;
|
356
|
+
case GRN_RESOURCE_TEMPORARILY_UNAVAILABLE:
|
357
|
+
message = "resource temporarily unavailable";
|
358
|
+
break;
|
359
|
+
case GRN_NOT_ENOUGH_SPACE:
|
360
|
+
message = "not enough space";
|
361
|
+
break;
|
362
|
+
case GRN_PERMISSION_DENIED:
|
363
|
+
message = "permission denied";
|
364
|
+
break;
|
365
|
+
case GRN_BAD_ADDRESS:
|
366
|
+
message = "bad address";
|
367
|
+
break;
|
368
|
+
case GRN_RESOURCE_BUSY:
|
369
|
+
message = "resource busy";
|
370
|
+
break;
|
371
|
+
case GRN_FILE_EXISTS:
|
372
|
+
message = "file exists";
|
373
|
+
break;
|
374
|
+
case GRN_IMPROPER_LINK:
|
375
|
+
message = "improper link";
|
376
|
+
break;
|
377
|
+
case GRN_NO_SUCH_DEVICE:
|
378
|
+
message = "no such device";
|
379
|
+
break;
|
380
|
+
case GRN_NOT_A_DIRECTORY:
|
381
|
+
message = "not a directory";
|
382
|
+
break;
|
383
|
+
case GRN_IS_A_DIRECTORY:
|
384
|
+
message = "is a directory";
|
385
|
+
break;
|
386
|
+
case GRN_INVALID_ARGUMENT:
|
387
|
+
message = "invalid argument";
|
388
|
+
break;
|
389
|
+
case GRN_TOO_MANY_OPEN_FILES_IN_SYSTEM:
|
390
|
+
message = "too many open files in system";
|
391
|
+
break;
|
392
|
+
case GRN_TOO_MANY_OPEN_FILES:
|
393
|
+
message = "too many open files";
|
394
|
+
break;
|
395
|
+
case GRN_INAPPROPRIATE_I_O_CONTROL_OPERATION:
|
396
|
+
message = "inappropriate I/O control operation";
|
397
|
+
break;
|
398
|
+
case GRN_FILE_TOO_LARGE:
|
399
|
+
message = "file too large";
|
400
|
+
break;
|
401
|
+
case GRN_NO_SPACE_LEFT_ON_DEVICE:
|
402
|
+
message = "no space left on device";
|
403
|
+
break;
|
404
|
+
case GRN_INVALID_SEEK:
|
405
|
+
message = "invalid seek";
|
406
|
+
break;
|
407
|
+
case GRN_READ_ONLY_FILE_SYSTEM:
|
408
|
+
message = "read only file system";
|
409
|
+
break;
|
410
|
+
case GRN_TOO_MANY_LINKS:
|
411
|
+
message = "too many links";
|
412
|
+
break;
|
413
|
+
case GRN_BROKEN_PIPE:
|
414
|
+
message = "broken pipe";
|
415
|
+
break;
|
416
|
+
case GRN_DOMAIN_ERROR:
|
417
|
+
message = "domain error";
|
418
|
+
break;
|
419
|
+
case GRN_RESULT_TOO_LARGE:
|
420
|
+
message = "result too large";
|
421
|
+
break;
|
422
|
+
case GRN_RESOURCE_DEADLOCK_AVOIDED:
|
423
|
+
message = "resource deadlock avoided";
|
424
|
+
break;
|
425
|
+
case GRN_NO_MEMORY_AVAILABLE:
|
426
|
+
message = "no memory available";
|
427
|
+
break;
|
428
|
+
case GRN_FILENAME_TOO_LONG:
|
429
|
+
message = "filename too long";
|
430
|
+
break;
|
431
|
+
case GRN_NO_LOCKS_AVAILABLE:
|
432
|
+
message = "no locks available";
|
433
|
+
break;
|
434
|
+
case GRN_FUNCTION_NOT_IMPLEMENTED:
|
435
|
+
message = "function not implemented";
|
436
|
+
break;
|
437
|
+
case GRN_DIRECTORY_NOT_EMPTY:
|
438
|
+
message = "directory not empty";
|
439
|
+
break;
|
440
|
+
case GRN_ILLEGAL_BYTE_SEQUENCE:
|
441
|
+
message = "illegal byte sequence";
|
442
|
+
break;
|
443
|
+
case GRN_SOCKET_NOT_INITIALIZED:
|
444
|
+
message = "socket not initialized";
|
445
|
+
break;
|
446
|
+
case GRN_OPERATION_WOULD_BLOCK:
|
447
|
+
message = "operation would block";
|
448
|
+
break;
|
449
|
+
case GRN_ADDRESS_IS_NOT_AVAILABLE:
|
450
|
+
message = "address is not available";
|
451
|
+
break;
|
452
|
+
case GRN_NETWORK_IS_DOWN:
|
453
|
+
message = "network is down";
|
454
|
+
break;
|
455
|
+
case GRN_NO_BUFFER:
|
456
|
+
message = "no buffer";
|
457
|
+
break;
|
458
|
+
case GRN_SOCKET_IS_ALREADY_CONNECTED:
|
459
|
+
message = "socket is already connected";
|
460
|
+
break;
|
461
|
+
case GRN_SOCKET_IS_NOT_CONNECTED:
|
462
|
+
message = "socket is not connected";
|
463
|
+
break;
|
464
|
+
case GRN_SOCKET_IS_ALREADY_SHUTDOWNED:
|
465
|
+
message = "socket is already shutdowned";
|
466
|
+
break;
|
467
|
+
case GRN_OPERATION_TIMEOUT:
|
468
|
+
message = "operation timeout";
|
469
|
+
break;
|
470
|
+
case GRN_CONNECTION_REFUSED:
|
471
|
+
message = "connection refused";
|
472
|
+
break;
|
473
|
+
case GRN_RANGE_ERROR:
|
474
|
+
message = "range error";
|
475
|
+
break;
|
476
|
+
case GRN_TOKENIZER_ERROR:
|
477
|
+
message = "tokenizer error";
|
478
|
+
break;
|
479
|
+
case GRN_FILE_CORRUPT:
|
480
|
+
message = "file corrupt";
|
481
|
+
break;
|
482
|
+
case GRN_INVALID_FORMAT:
|
483
|
+
message = "invalid format";
|
484
|
+
break;
|
485
|
+
case GRN_OBJECT_CORRUPT:
|
486
|
+
message = "object corrupt";
|
487
|
+
break;
|
488
|
+
case GRN_TOO_MANY_SYMBOLIC_LINKS:
|
489
|
+
message = "too many symbolic links";
|
490
|
+
break;
|
491
|
+
case GRN_NOT_SOCKET:
|
492
|
+
message = "not socket";
|
493
|
+
break;
|
494
|
+
case GRN_OPERATION_NOT_SUPPORTED:
|
495
|
+
message = "operation not supported";
|
496
|
+
break;
|
497
|
+
case GRN_ADDRESS_IS_IN_USE:
|
498
|
+
message = "address is in use";
|
499
|
+
break;
|
500
|
+
case GRN_ZLIB_ERROR:
|
501
|
+
message = "ZLib error";
|
502
|
+
break;
|
503
|
+
case GRN_LZO_ERROR:
|
504
|
+
message = "LZO error";
|
505
|
+
break;
|
506
|
+
case GRN_STACK_OVER_FLOW:
|
507
|
+
message = "stack over flow";
|
508
|
+
break;
|
509
|
+
case GRN_SYNTAX_ERROR:
|
510
|
+
message = "syntax error";
|
511
|
+
break;
|
512
|
+
case GRN_RETRY_MAX:
|
513
|
+
message = "retry max";
|
514
|
+
break;
|
515
|
+
case GRN_INCOMPATIBLE_FILE_FORMAT:
|
516
|
+
message = "incompatible file format";
|
517
|
+
break;
|
518
|
+
case GRN_UPDATE_NOT_ALLOWED:
|
519
|
+
message = "update isn't allowed";
|
520
|
+
break;
|
521
|
+
}
|
522
|
+
|
523
|
+
if (!message)
|
524
|
+
rb_raise(rb_eGrnError, "invalid return code: %d", rc);
|
525
|
+
|
526
|
+
return message;
|
527
|
+
}
|
528
|
+
|
529
|
+
void
|
530
|
+
rb_grn_rc_check (grn_rc rc, VALUE related_object)
|
531
|
+
{
|
532
|
+
VALUE exception;
|
533
|
+
const char *message;
|
534
|
+
|
535
|
+
exception = rb_grn_rc_to_exception(rc);
|
536
|
+
if (NIL_P(exception))
|
537
|
+
return;
|
538
|
+
message = rb_grn_rc_to_message(rc);
|
539
|
+
|
540
|
+
if (NIL_P(related_object))
|
541
|
+
rb_raise(exception, "%s", message);
|
542
|
+
else
|
543
|
+
rb_raise(exception, "%s: %s", rb_grn_inspect(related_object), message);
|
544
|
+
}
|
545
|
+
|
546
|
+
void
|
547
|
+
rb_grn_init_exception (VALUE mGrn)
|
548
|
+
{
|
549
|
+
/*
|
550
|
+
* Document-class: Groonga::Error
|
551
|
+
*
|
552
|
+
* Ruby/groongaが発生する例外のスーパークラス。
|
553
|
+
*/
|
554
|
+
rb_eGrnError =
|
555
|
+
rb_define_class_under(mGrn, "Error", rb_eStandardError);
|
556
|
+
|
557
|
+
/*
|
558
|
+
* Document-class: Groonga::ObjectClosed
|
559
|
+
*
|
560
|
+
* groongaレベルでは破棄されているが、Rubyレベルでは生き
|
561
|
+
* ているオブジェクトにアクセスすると発生する。
|
562
|
+
*/
|
563
|
+
rb_eGrnObjectClosed =
|
564
|
+
rb_define_class_under(mGrn, "ObjectClosed", rb_eGrnError);
|
565
|
+
|
566
|
+
/*
|
567
|
+
* Document-class: Groonga::NoSuchColumn
|
568
|
+
*
|
569
|
+
* 存在しないカラムにアクセスすると発生する。
|
570
|
+
*/
|
571
|
+
rb_eGrnNoSuchColumn =
|
572
|
+
rb_define_class_under(mGrn, "NoSuchColumn", rb_eGrnError);
|
573
|
+
|
574
|
+
/*
|
575
|
+
* Document-class: Groonga::EndOfData
|
576
|
+
*
|
577
|
+
* データの終端に達したときに発生する。
|
578
|
+
*/
|
579
|
+
eGrnEndOfData =
|
580
|
+
rb_define_class_under(mGrn, "EndOfData", rb_eGrnError);
|
581
|
+
|
582
|
+
/*
|
583
|
+
* Document-class: Groonga::UnknownError
|
584
|
+
*
|
585
|
+
* 未知のエラーが発生したときに発生する。
|
586
|
+
*/
|
587
|
+
eGrnUnknownError =
|
588
|
+
rb_define_class_under(mGrn, "UnknownError", rb_eGrnError);
|
589
|
+
|
590
|
+
/*
|
591
|
+
* Document-class: Groonga::OperationNotPermitted
|
592
|
+
*
|
593
|
+
* 操作が許可されていないときに発生する。
|
594
|
+
*/
|
595
|
+
eGrnOperationNotPermitted =
|
596
|
+
rb_define_class_under(mGrn, "OperationNotPermitted", rb_eGrnError);
|
597
|
+
|
598
|
+
/*
|
599
|
+
* Document-class: Groonga::NoSuchFileOrDirectory
|
600
|
+
*
|
601
|
+
* ファイルまたはディレクトリがないときに発生する。
|
602
|
+
*/
|
603
|
+
eGrnNoSuchFileOrDirectory =
|
604
|
+
rb_define_class_under(mGrn, "NoSuchFileOrDirectory", rb_eGrnError);
|
605
|
+
|
606
|
+
/*
|
607
|
+
* Document-class: Groonga::NoSuchProcess
|
608
|
+
*
|
609
|
+
* プロセスがないときに発生する。
|
610
|
+
*/
|
611
|
+
eGrnNoSuchProcess =
|
612
|
+
rb_define_class_under(mGrn, "NoSuchProcess", rb_eGrnError);
|
613
|
+
|
614
|
+
/*
|
615
|
+
* Document-class: Groonga::InterruptedFunctionCall
|
616
|
+
*
|
617
|
+
* 関数の実行中に中断されたときに発生する。
|
618
|
+
*/
|
619
|
+
eGrnInterruptedFunctionCall =
|
620
|
+
rb_define_class_under(mGrn, "InterruptedFunctionCall", rb_eGrnError);
|
621
|
+
|
622
|
+
/*
|
623
|
+
* Document-class: Groonga::InputOutputError
|
624
|
+
*
|
625
|
+
* 入出力エラーが起きたときに発生する。
|
626
|
+
*/
|
627
|
+
eGrnInputOutputError =
|
628
|
+
rb_define_class_under(mGrn, "InputOutputError", rb_eGrnError);
|
629
|
+
|
630
|
+
/*
|
631
|
+
* Document-class: Groonga::NoSuchDeviceOrAddress
|
632
|
+
*
|
633
|
+
* デバイスまたはアドレスがないときに発生する。
|
634
|
+
*/
|
635
|
+
eGrnNoSuchDeviceOrAddress =
|
636
|
+
rb_define_class_under(mGrn, "NoSuchDeviceOrAddress", rb_eGrnError);
|
637
|
+
|
638
|
+
/*
|
639
|
+
* Document-class: Groonga::ArgumentListTooLong
|
640
|
+
*
|
641
|
+
* 引数の数が多すぎるときに発生する。
|
642
|
+
*/
|
643
|
+
eGrnArgumentListTooLong =
|
644
|
+
rb_define_class_under(mGrn, "ArgumentListTooLong", rb_eGrnError);
|
645
|
+
|
646
|
+
/*
|
647
|
+
* Document-class: Groonga::ExecFormatError
|
648
|
+
*
|
649
|
+
* 実行ファイルのフォーマットに問題があるときに発生する。
|
650
|
+
*/
|
651
|
+
eGrnExecFormatError =
|
652
|
+
rb_define_class_under(mGrn, "ExecFormatError", rb_eGrnError);
|
653
|
+
|
654
|
+
/*
|
655
|
+
* Document-class: Groonga::BadFileDescriptor
|
656
|
+
*
|
657
|
+
* ファイルディスクリプタに問題があるときに発生する。
|
658
|
+
*/
|
659
|
+
eGrnBadFileDescriptor =
|
660
|
+
rb_define_class_under(mGrn, "BadFileDescriptor", rb_eGrnError);
|
661
|
+
|
662
|
+
/*
|
663
|
+
* Document-class: Groonga::NoChildProcesses
|
664
|
+
*
|
665
|
+
* 子プロセスがないときに発生する。
|
666
|
+
*/
|
667
|
+
eGrnNoChildProcesses =
|
668
|
+
rb_define_class_under(mGrn, "NoChildProcesses", rb_eGrnError);
|
669
|
+
|
670
|
+
/*
|
671
|
+
* Document-class: Groonga::ResourceTemporarilyUnavailable
|
672
|
+
*
|
673
|
+
* 一時的にリソースを利用できないときに発生する。
|
674
|
+
*/
|
675
|
+
eGrnResourceTemporarilyUnavailable =
|
676
|
+
rb_define_class_under(mGrn, "ResourceTemporarilyUnavailable",
|
677
|
+
rb_eGrnError);
|
678
|
+
|
679
|
+
/*
|
680
|
+
* Document-class: Groonga::NotEnoughSpace
|
681
|
+
*
|
682
|
+
* 領域が足りないときに発生する。
|
683
|
+
*/
|
684
|
+
eGrnNotEnoughSpace =
|
685
|
+
rb_define_class_under(mGrn, "NotEnoughSpace", rb_eGrnError);
|
686
|
+
|
687
|
+
/*
|
688
|
+
* Document-class: Groonga::PermissionDenied
|
689
|
+
*
|
690
|
+
* 許可がないときに発生する。
|
691
|
+
*/
|
692
|
+
eGrnPermissionDenied =
|
693
|
+
rb_define_class_under(mGrn, "PermissionDenied", rb_eGrnError);
|
694
|
+
|
695
|
+
/*
|
696
|
+
* Document-class: Groonga::BadAddress
|
697
|
+
*
|
698
|
+
* アドレスに問題があるときに発生する。
|
699
|
+
*/
|
700
|
+
eGrnBadAddress =
|
701
|
+
rb_define_class_under(mGrn, "BadAddress", rb_eGrnError);
|
702
|
+
|
703
|
+
/*
|
704
|
+
* Document-class: Groonga::ResourceBusy
|
705
|
+
*
|
706
|
+
* リソースが使用中のときに発生する。
|
707
|
+
*/
|
708
|
+
eGrnResourceBusy =
|
709
|
+
rb_define_class_under(mGrn, "ResourceBusy", rb_eGrnError);
|
710
|
+
|
711
|
+
/*
|
712
|
+
* Document-class: Groonga::FileExists
|
713
|
+
*
|
714
|
+
* ファイルが存在しているときに発生する。
|
715
|
+
*/
|
716
|
+
eGrnFileExists =
|
717
|
+
rb_define_class_under(mGrn, "FileExists", rb_eGrnError);
|
718
|
+
|
719
|
+
/*
|
720
|
+
* Document-class: Groonga::ImproperLink
|
721
|
+
*
|
722
|
+
* リンクに問題があるときに発生する。
|
723
|
+
*/
|
724
|
+
eGrnImproperLink =
|
725
|
+
rb_define_class_under(mGrn, "ImproperLink", rb_eGrnError);
|
726
|
+
|
727
|
+
/*
|
728
|
+
* Document-class: Groonga::NoSuchDevice
|
729
|
+
*
|
730
|
+
* デバイスがないときに発生する。
|
731
|
+
*/
|
732
|
+
eGrnNoSuchDevice =
|
733
|
+
rb_define_class_under(mGrn, "NoSuchDevice", rb_eGrnError);
|
734
|
+
|
735
|
+
/*
|
736
|
+
* Document-class: Groonga::NotADirectory
|
737
|
+
*
|
738
|
+
* ディレクトリではないときに発生する。
|
739
|
+
*/
|
740
|
+
eGrnNotADirectory =
|
741
|
+
rb_define_class_under(mGrn, "NotADirectory", rb_eGrnError);
|
742
|
+
|
743
|
+
/*
|
744
|
+
* Document-class: Groonga::IsADirectory
|
745
|
+
*
|
746
|
+
* ディレクトリのときに発生する。
|
747
|
+
*/
|
748
|
+
eGrnIsADirectory =
|
749
|
+
rb_define_class_under(mGrn, "IsADirectory", rb_eGrnError);
|
750
|
+
|
751
|
+
/*
|
752
|
+
* Document-class: Groonga::InvalidArgument
|
753
|
+
*
|
754
|
+
* 引数に問題があるときに発生する。
|
755
|
+
*/
|
756
|
+
rb_eGrnInvalidArgument =
|
757
|
+
rb_define_class_under(mGrn, "InvalidArgument", rb_eGrnError);
|
758
|
+
|
759
|
+
/*
|
760
|
+
* Document-class: Groonga::TooManyOpenFilesInSystem
|
761
|
+
*
|
762
|
+
* システム全体で開いているファイルが多すぎるときに発生する。
|
763
|
+
*/
|
764
|
+
eGrnTooManyOpenFilesInSystem =
|
765
|
+
rb_define_class_under(mGrn, "TooManyOpenFilesInSystem", rb_eGrnError);
|
766
|
+
|
767
|
+
/*
|
768
|
+
* Document-class: Groonga::TooManyOpenFiles
|
769
|
+
*
|
770
|
+
* 開いているファイルが多すぎるときに発生する。
|
771
|
+
*/
|
772
|
+
eGrnTooManyOpenFiles =
|
773
|
+
rb_define_class_under(mGrn, "TooManyOpenFiles", rb_eGrnError);
|
774
|
+
|
775
|
+
/*
|
776
|
+
* Document-class: Groonga::InappropriateIOControlOperation
|
777
|
+
*
|
778
|
+
* IO制御に問題があるときに発生する。
|
779
|
+
*/
|
780
|
+
eGrnInappropriateIOControlOperation =
|
781
|
+
rb_define_class_under(mGrn, "InappropriateIOControlOperation", rb_eGrnError);
|
782
|
+
|
783
|
+
/*
|
784
|
+
* Document-class: Groonga::FileTooLarge
|
785
|
+
*
|
786
|
+
* ファイルが大きすぎるときに発生する。
|
787
|
+
*/
|
788
|
+
eGrnFileTooLarge =
|
789
|
+
rb_define_class_under(mGrn, "FileTooLarge", rb_eGrnError);
|
790
|
+
|
791
|
+
/*
|
792
|
+
* Document-class: Groonga::NoSpaceLeftOnDevice
|
793
|
+
*
|
794
|
+
* デバイスに空いている領域がないときに発生する。
|
795
|
+
*/
|
796
|
+
eGrnNoSpaceLeftOnDevice =
|
797
|
+
rb_define_class_under(mGrn, "NoSpaceLeftOnDevice", rb_eGrnError);
|
798
|
+
|
799
|
+
/*
|
800
|
+
* Document-class: Groonga::InvalidSeek
|
801
|
+
*
|
802
|
+
* seekに問題があるときに発生する。
|
803
|
+
*/
|
804
|
+
eGrnInvalidSeek =
|
805
|
+
rb_define_class_under(mGrn, "InvalidSeek", rb_eGrnError);
|
806
|
+
|
807
|
+
/*
|
808
|
+
* Document-class: Groonga::ReadOnlyFileSystem
|
809
|
+
*
|
810
|
+
* ファイルシステムが読込専用のときに発生する。
|
811
|
+
*/
|
812
|
+
eGrnReadOnlyFileSystem =
|
813
|
+
rb_define_class_under(mGrn, "ReadOnlyFileSystem", rb_eGrnError);
|
814
|
+
|
815
|
+
/*
|
816
|
+
* Document-class: Groonga::TooManyLinks
|
817
|
+
*
|
818
|
+
* リンクが多すぎるときに発生する。
|
819
|
+
*/
|
820
|
+
eGrnTooManyLinks =
|
821
|
+
rb_define_class_under(mGrn, "TooManyLinks", rb_eGrnError);
|
822
|
+
|
823
|
+
/*
|
824
|
+
* Document-class: Groonga::BrokenPipe
|
825
|
+
*
|
826
|
+
* パイプが壊れているときに発生する。
|
827
|
+
*/
|
828
|
+
eGrnBrokenPipe =
|
829
|
+
rb_define_class_under(mGrn, "BrokenPipe", rb_eGrnError);
|
830
|
+
|
831
|
+
/*
|
832
|
+
* Document-class: Groonga::DomainError
|
833
|
+
*
|
834
|
+
* 対象領域に問題があるときに発生する。
|
835
|
+
*/
|
836
|
+
eGrnDomainError =
|
837
|
+
rb_define_class_under(mGrn, "DomainError", rb_eGrnError);
|
838
|
+
|
839
|
+
/*
|
840
|
+
* Document-class: Groonga::ResultTooLarge
|
841
|
+
*
|
842
|
+
* 結果が多すぎるときに発生する。
|
843
|
+
*/
|
844
|
+
eGrnResultTooLarge =
|
845
|
+
rb_define_class_under(mGrn, "ResultTooLarge", rb_eGrnError);
|
846
|
+
|
847
|
+
/*
|
848
|
+
* Document-class: Groonga::ResourceDeadlockAvoided
|
849
|
+
*
|
850
|
+
* リソースのデッドロックを回避したときに発生する。
|
851
|
+
*/
|
852
|
+
eGrnResourceDeadlockAvoided =
|
853
|
+
rb_define_class_under(mGrn, "ResourceDeadlockAvoided", rb_eGrnError);
|
854
|
+
|
855
|
+
/*
|
856
|
+
* Document-class: Groonga::NoMemoryAvailable
|
857
|
+
*
|
858
|
+
* メモリが足りないときに発生する。
|
859
|
+
*/
|
860
|
+
eGrnNoMemoryAvailable =
|
861
|
+
rb_define_class_under(mGrn, "NoMemoryAvailable", rb_eGrnError);
|
862
|
+
|
863
|
+
/*
|
864
|
+
* Document-class: Groonga::FilenameTooLong
|
865
|
+
*
|
866
|
+
* ファイル名が長すぎるときに発生する。
|
867
|
+
*/
|
868
|
+
eGrnFilenameTooLong =
|
869
|
+
rb_define_class_under(mGrn, "FilenameTooLong", rb_eGrnError);
|
870
|
+
|
871
|
+
/*
|
872
|
+
* Document-class: Groonga::NoLocksAvailable
|
873
|
+
*
|
874
|
+
* ロックがないときに発生する。
|
875
|
+
*/
|
876
|
+
eGrnNoLocksAvailable =
|
877
|
+
rb_define_class_under(mGrn, "NoLocksAvailable", rb_eGrnError);
|
878
|
+
|
879
|
+
/*
|
880
|
+
* Document-class: Groonga::FunctionNotImplemented
|
881
|
+
*
|
882
|
+
* 関数を実装していないときに発生する。
|
883
|
+
*/
|
884
|
+
eGrnFunctionNotImplemented =
|
885
|
+
rb_define_class_under(mGrn, "FunctionNotImplemented", rb_eGrnError);
|
886
|
+
|
887
|
+
/*
|
888
|
+
* Document-class: Groonga::DirectoryNotEmpty
|
889
|
+
*
|
890
|
+
* ディレクトリが空でないときに発生する。
|
891
|
+
*/
|
892
|
+
eGrnDirectoryNotEmpty =
|
893
|
+
rb_define_class_under(mGrn, "DirectoryNotEmpty", rb_eGrnError);
|
894
|
+
|
895
|
+
/*
|
896
|
+
* Document-class: Groonga::IllegalByteSequence
|
897
|
+
*
|
898
|
+
* バイト列に問題があるときに発生する。
|
899
|
+
*/
|
900
|
+
eGrnIllegalByteSequence =
|
901
|
+
rb_define_class_under(mGrn, "IllegalByteSequence", rb_eGrnError);
|
902
|
+
|
903
|
+
/*
|
904
|
+
* Document-class: Groonga::SocketNotInitialized
|
905
|
+
*
|
906
|
+
* ソケットが初期化されていないときに発生する。
|
907
|
+
*/
|
908
|
+
eGrnSocketNotInitialized =
|
909
|
+
rb_define_class_under(mGrn, "SocketNotInitialized", rb_eGrnError);
|
910
|
+
|
911
|
+
/*
|
912
|
+
* Document-class: Groonga::OperationWouldBlock
|
913
|
+
*
|
914
|
+
* 操作がブロックする可能性があるときに発生する。
|
915
|
+
*/
|
916
|
+
eGrnOperationWouldBlock =
|
917
|
+
rb_define_class_under(mGrn, "OperationWouldBlock", rb_eGrnError);
|
918
|
+
|
919
|
+
/*
|
920
|
+
* Document-class: Groonga::AddressIsNotAvailable
|
921
|
+
*
|
922
|
+
* アドレスを利用できないときに発生する。
|
923
|
+
*/
|
924
|
+
eGrnAddressIsNotAvailable =
|
925
|
+
rb_define_class_under(mGrn, "AddressIsNotAvailable", rb_eGrnError);
|
926
|
+
|
927
|
+
/*
|
928
|
+
* Document-class: Groonga::NetworkIsDown
|
929
|
+
*
|
930
|
+
* ネットワークに問題があるときに発生する。
|
931
|
+
*/
|
932
|
+
eGrnNetworkIsDown =
|
933
|
+
rb_define_class_under(mGrn, "NetworkIsDown", rb_eGrnError);
|
934
|
+
|
935
|
+
/*
|
936
|
+
* Document-class: Groonga::NoBuffer
|
937
|
+
*
|
938
|
+
* バッファがないときに発生する。
|
939
|
+
*/
|
940
|
+
eGrnNoBuffer =
|
941
|
+
rb_define_class_under(mGrn, "NoBuffer", rb_eGrnError);
|
942
|
+
|
943
|
+
/*
|
944
|
+
* Document-class: Groonga::SocketIsAlreadyConnected
|
945
|
+
*
|
946
|
+
* ソケットが接続済みのときに発生する。
|
947
|
+
*/
|
948
|
+
eGrnSocketIsAlreadyConnected =
|
949
|
+
rb_define_class_under(mGrn, "SocketIsAlreadyConnected", rb_eGrnError);
|
950
|
+
|
951
|
+
/*
|
952
|
+
* Document-class: Groonga::SocketIsNotConnected
|
953
|
+
*
|
954
|
+
* ソケットが接続されていないときに発生する。
|
955
|
+
*/
|
956
|
+
eGrnSocketIsNotConnected =
|
957
|
+
rb_define_class_under(mGrn, "SocketIsNotConnected", rb_eGrnError);
|
958
|
+
|
959
|
+
/*
|
960
|
+
* Document-class: Groonga::SocketIsAlreadyShutdowned
|
961
|
+
*
|
962
|
+
* ソケットがすでに閉じられているときに発生する。
|
963
|
+
*/
|
964
|
+
eGrnSocketIsAlreadyShutdowned =
|
965
|
+
rb_define_class_under(mGrn, "SocketIsAlreadyShutdowned", rb_eGrnError);
|
966
|
+
|
967
|
+
/*
|
968
|
+
* Document-class: Groonga::OperationTimeout
|
969
|
+
*
|
970
|
+
* 操作がタイムアウトしたときに発生する。
|
971
|
+
*/
|
972
|
+
eGrnOperationTimeout =
|
973
|
+
rb_define_class_under(mGrn, "OperationTimeout", rb_eGrnError);
|
974
|
+
|
975
|
+
/*
|
976
|
+
* Document-class: Groonga::ConnectionRefused
|
977
|
+
*
|
978
|
+
* 接続を拒否されたときに発生する。
|
979
|
+
*/
|
980
|
+
eGrnConnectionRefused =
|
981
|
+
rb_define_class_under(mGrn, "ConnectionRefused", rb_eGrnError);
|
982
|
+
|
983
|
+
/*
|
984
|
+
* Document-class: Groonga::RangeError
|
985
|
+
*
|
986
|
+
* 範囲外のときに発生する。
|
987
|
+
*/
|
988
|
+
eGrnRangeError =
|
989
|
+
rb_define_class_under(mGrn, "RangeError", rb_eGrnError);
|
990
|
+
|
991
|
+
/*
|
992
|
+
* Document-class: Groonga::TokenizerError
|
993
|
+
*
|
994
|
+
* トークナイザーに問題があったときに発生する。
|
995
|
+
*/
|
996
|
+
eGrnTokenizerError =
|
997
|
+
rb_define_class_under(mGrn, "TokenizerError", rb_eGrnError);
|
998
|
+
|
999
|
+
/*
|
1000
|
+
* Document-class: Groonga::FileCorrupt
|
1001
|
+
*
|
1002
|
+
* ファイルに問題があったときに発生する。
|
1003
|
+
*/
|
1004
|
+
eGrnFileCorrupt =
|
1005
|
+
rb_define_class_under(mGrn, "FileCorrupt", rb_eGrnError);
|
1006
|
+
|
1007
|
+
/*
|
1008
|
+
* Document-class: Groonga::InvalidFormat
|
1009
|
+
*
|
1010
|
+
* フォーマットに問題があったときに発生する。
|
1011
|
+
*/
|
1012
|
+
eGrnInvalidFormat =
|
1013
|
+
rb_define_class_under(mGrn, "InvalidFormat", rb_eGrnError);
|
1014
|
+
|
1015
|
+
/*
|
1016
|
+
* Document-class: Groonga::ObjectCorrupt
|
1017
|
+
*
|
1018
|
+
* オブジェクトに問題があったときに発生する。
|
1019
|
+
*/
|
1020
|
+
eGrnObjectCorrupt =
|
1021
|
+
rb_define_class_under(mGrn, "ObjectCorrupt", rb_eGrnError);
|
1022
|
+
|
1023
|
+
/*
|
1024
|
+
* Document-class: Groonga::TooManySymbolicLinks
|
1025
|
+
*
|
1026
|
+
* シンボリックリンクが多すぎるときに発生する。
|
1027
|
+
*/
|
1028
|
+
eGrnTooManySymbolicLinks =
|
1029
|
+
rb_define_class_under(mGrn, "TooManySymbolicLinks", rb_eGrnError);
|
1030
|
+
|
1031
|
+
/*
|
1032
|
+
* Document-class: Groonga::NotSocket
|
1033
|
+
*
|
1034
|
+
* ソケットではないときに発生する。
|
1035
|
+
*/
|
1036
|
+
eGrnNotSocket =
|
1037
|
+
rb_define_class_under(mGrn, "NotSocket", rb_eGrnError);
|
1038
|
+
|
1039
|
+
/*
|
1040
|
+
* Document-class: Groonga::OperationNotSupported
|
1041
|
+
*
|
1042
|
+
* 操作がサポートされていないときに発生する。
|
1043
|
+
*/
|
1044
|
+
eGrnOperationNotSupported =
|
1045
|
+
rb_define_class_under(mGrn, "OperationNotSupported", rb_eGrnError);
|
1046
|
+
|
1047
|
+
/*
|
1048
|
+
* Document-class: Groonga::AddressIsInUse
|
1049
|
+
*
|
1050
|
+
* アドレスが使用中のときに発生する。
|
1051
|
+
*/
|
1052
|
+
eGrnAddressIsInUse =
|
1053
|
+
rb_define_class_under(mGrn, "AddressIsInUse", rb_eGrnError);
|
1054
|
+
|
1055
|
+
/*
|
1056
|
+
* Document-class: Groonga::ZLibError
|
1057
|
+
*
|
1058
|
+
* ZLibに問題があるときに発生する。
|
1059
|
+
*/
|
1060
|
+
eGrnZLibError =
|
1061
|
+
rb_define_class_under(mGrn, "ZLibError", rb_eGrnError);
|
1062
|
+
|
1063
|
+
/*
|
1064
|
+
* Document-class: Groonga::LZOError
|
1065
|
+
*
|
1066
|
+
* LZOに問題があるときに発生する。
|
1067
|
+
*/
|
1068
|
+
eGrnLZOError =
|
1069
|
+
rb_define_class_under(mGrn, "LZOError", rb_eGrnError);
|
1070
|
+
|
1071
|
+
/*
|
1072
|
+
* Document-class: Groonga::StackOverFlow
|
1073
|
+
*
|
1074
|
+
* スタックオーバーフロー時に発生する。
|
1075
|
+
*/
|
1076
|
+
eGrnStackOverFlow =
|
1077
|
+
rb_define_class_under(mGrn, "StackOverFlow", rb_eGrnError);
|
1078
|
+
|
1079
|
+
/*
|
1080
|
+
* Document-class: Groonga::SyntaxError
|
1081
|
+
*
|
1082
|
+
* 構文に問題があるときに発生する。
|
1083
|
+
*/
|
1084
|
+
eGrnSyntaxError =
|
1085
|
+
rb_define_class_under(mGrn, "SyntaxError", rb_eGrnError);
|
1086
|
+
|
1087
|
+
/*
|
1088
|
+
* Document-class: Groonga::RetryMax
|
1089
|
+
*
|
1090
|
+
* 再試行回数が最大数に達したときに発生する。
|
1091
|
+
*/
|
1092
|
+
eGrnRetryMax =
|
1093
|
+
rb_define_class_under(mGrn, "RetryMax", rb_eGrnError);
|
1094
|
+
|
1095
|
+
/*
|
1096
|
+
* Document-class: Groonga::IncompatibleFileFormat
|
1097
|
+
*
|
1098
|
+
* 互換性のないファイルフォーマットを読み込んだときに発生する。
|
1099
|
+
*/
|
1100
|
+
eGrnIncompatibleFileFormat =
|
1101
|
+
rb_define_class_under(mGrn, "IncompatibleFileFormat", rb_eGrnError);
|
1102
|
+
|
1103
|
+
/*
|
1104
|
+
* Document-class: Groonga::UpdateNotAllowed
|
1105
|
+
*
|
1106
|
+
* 更新操作が許可されていないのに更新操作を行ったときに発生する。
|
1107
|
+
*/
|
1108
|
+
eGrnUpdateNotAllowed =
|
1109
|
+
rb_define_class_under(mGrn, "UpdateNotAllowed", rb_eGrnError);
|
1110
|
+
}
|