groonga 0.0.1

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