rroonga 10.0.6 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +24 -0
  3. data/doc/text/news.md +12 -0
  4. data/ext/groonga/extconf.rb +12 -2
  5. data/ext/groonga/rb-grn-accessor.c +2 -2
  6. data/ext/groonga/rb-grn-column-cache.c +3 -3
  7. data/ext/groonga/rb-grn-column.c +4 -4
  8. data/ext/groonga/rb-grn-context.c +82 -58
  9. data/ext/groonga/rb-grn-data-column.c +4 -4
  10. data/ext/groonga/rb-grn-database.c +45 -26
  11. data/ext/groonga/rb-grn-double-array-trie.c +2 -2
  12. data/ext/groonga/rb-grn-encoding-support.c +2 -2
  13. data/ext/groonga/rb-grn-exception.c +14 -0
  14. data/ext/groonga/rb-grn-expression.c +3 -3
  15. data/ext/groonga/rb-grn-fix-size-column.c +2 -2
  16. data/ext/groonga/rb-grn-flushable.c +2 -1
  17. data/ext/groonga/rb-grn-hash.c +2 -2
  18. data/ext/groonga/rb-grn-index-column.c +3 -3
  19. data/ext/groonga/rb-grn-index-cursor.c +2 -2
  20. data/ext/groonga/rb-grn-inverted-index-cursor.c +3 -3
  21. data/ext/groonga/rb-grn-object.c +30 -9
  22. data/ext/groonga/rb-grn-operator.c +100 -259
  23. data/ext/groonga/rb-grn-patricia-trie.c +2 -2
  24. data/ext/groonga/rb-grn-plugin.c +34 -22
  25. data/ext/groonga/rb-grn-request-timer-id.c +2 -2
  26. data/ext/groonga/rb-grn-snippet.c +3 -3
  27. data/ext/groonga/rb-grn-table-cursor-key-support.c +2 -2
  28. data/ext/groonga/rb-grn-table-cursor.c +3 -3
  29. data/ext/groonga/rb-grn-table-key-support.c +3 -3
  30. data/ext/groonga/rb-grn-table.c +63 -45
  31. data/ext/groonga/rb-grn-variable-size-column.c +2 -2
  32. data/ext/groonga/rb-grn-variable.c +2 -2
  33. data/ext/groonga/rb-grn.h +7 -4
  34. data/ext/groonga/rb-groonga.c +5 -1
  35. data/lib/groonga/context.rb +32 -0
  36. data/rroonga-build.rb +5 -4
  37. data/rroonga.gemspec +5 -2
  38. data/test/groonga-test-utils.rb +3 -0
  39. data/test/test-index-column.rb +3 -3
  40. data/test/test-ractor.rb +65 -0
  41. data/test/test-remote.rb +2 -0
  42. data/test/test-table-arrow.rb +21 -9
  43. metadata +85 -69
@@ -1,8 +1,8 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /* vim: set sts=4 sw=4 ts=8 noet: */
3
3
  /*
4
+ Copyright (C) 2011-2021 Sutou Kouhei <kou@clear-code.com>
4
5
  Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
5
- Copyright (C) 2011-2014 Kouhei Sutou <kou@clear-code.com>
6
6
 
7
7
  This library is free software; you can redistribute it and/or
8
8
  modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,7 @@
20
20
 
21
21
  #include "rb-grn.h"
22
22
 
23
- #define SELF(object) ((RbGrnDoubleArrayTrie *)DATA_PTR(object))
23
+ #define SELF(object) ((RbGrnDoubleArrayTrie *)RTYPEDDATA_DATA(object))
24
24
 
25
25
  VALUE rb_cGrnDoubleArrayTrie;
26
26
 
@@ -1,6 +1,6 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /*
3
- Copyright (C) 2009-2015 Kouhei Sutou <kou@clear-code.com>
3
+ Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
4
4
 
5
5
  This library is free software; you can redistribute it and/or
6
6
  modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,7 @@
18
18
 
19
19
  #include "rb-grn.h"
20
20
 
21
- #define SELF(object) (RB_GRN_OBJECT(DATA_PTR(object)))
21
+ #define SELF(object) (RB_GRN_OBJECT(RTYPEDDATA_DATA(object)))
22
22
 
23
23
  VALUE rb_mGrnEncodingSupport;
24
24
 
@@ -103,6 +103,7 @@ static VALUE eGrnScorerError;
103
103
  static VALUE eGrnCancel;
104
104
  static VALUE eGrnWindowFunctionError;
105
105
  static VALUE eGrnZstdError;
106
+ static VALUE eGrnConnectionReset;
106
107
 
107
108
  VALUE
108
109
  rb_grn_rc_to_exception (grn_rc rc)
@@ -353,6 +354,9 @@ rb_grn_rc_to_exception (grn_rc rc)
353
354
  case GRN_ZSTD_ERROR:
354
355
  exception = eGrnZstdError;
355
356
  break;
357
+ case GRN_CONNECTION_RESET:
358
+ exception = eGrnConnectionReset;
359
+ break;
356
360
  }
357
361
 
358
362
  if (NIL_P(exception))
@@ -1072,4 +1076,14 @@ rb_grn_init_exception (VALUE mGrn)
1072
1076
  */
1073
1077
  eGrnZstdError =
1074
1078
  rb_define_class_under(mGrn, "ZstdError", rb_eGrnError);
1079
+
1080
+ /*
1081
+ * Document-class: Groonga::ConnectionReset
1082
+ *
1083
+ * It is used when connection is reset.
1084
+ *
1085
+ * @since 10.1.1
1086
+ */
1087
+ eGrnConnectionReset =
1088
+ rb_define_class_under(mGrn, "ConnectionReset", rb_eGrnError);
1075
1089
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /*
3
- Copyright (C) 2009-2018 Kouhei Sutou <kou@clear-code.com>
3
+ Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
4
4
  Copyright (C) 2014 Masafumi Yokoyama <myokoym@gmail.com>
5
5
 
6
6
  This library is free software; you can redistribute it and/or
@@ -19,7 +19,7 @@
19
19
 
20
20
  #include "rb-grn.h"
21
21
 
22
- #define SELF(object) ((RbGrnExpression *)DATA_PTR(object))
22
+ #define SELF(object) ((RbGrnExpression *)RTYPEDDATA_DATA(object))
23
23
 
24
24
  VALUE rb_cGrnExpression;
25
25
 
@@ -100,7 +100,7 @@ rb_grn_expression_initialize (int argc, VALUE *argv, VALUE self)
100
100
  expression = grn_expr_create(context, name, name_size);
101
101
  rb_grn_context_check(context, self);
102
102
  rb_grn_object_assign(Qnil, self, rb_context, context, expression);
103
- rb_grn_context_register_floating_object(DATA_PTR(self));
103
+ rb_grn_context_register_floating_object(RTYPEDDATA_DATA(self));
104
104
 
105
105
  rb_iv_set(self, "@objects", rb_ary_new());
106
106
 
@@ -1,6 +1,6 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /*
3
- Copyright (C) 2009-2016 Kouhei Sutou <kou@clear-code.com>
3
+ Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
4
4
  Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
5
5
 
6
6
  This library is free software; you can redistribute it and/or
@@ -19,7 +19,7 @@
19
19
 
20
20
  #include "rb-grn.h"
21
21
 
22
- #define SELF(object) ((RbGrnColumn *)DATA_PTR(object))
22
+ #define SELF(object) ((RbGrnColumn *)RTYPEDDATA_DATA(object))
23
23
 
24
24
  VALUE rb_cGrnFixSizeColumn;
25
25
 
@@ -1,6 +1,7 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /*
3
3
  Copyright (C) 2015 Masafumi Yokoyama <yokoyama@clear-code.com>
4
+ Copyright (C) 2021 Sutou Kouhei <kou@clear-code.com>
4
5
 
5
6
  This library is free software; you can redistribute it and/or
6
7
  modify it under the terms of the GNU Lesser General Public
@@ -18,7 +19,7 @@
18
19
 
19
20
  #include "rb-grn.h"
20
21
 
21
- #define SELF(object) (RB_GRN_OBJECT(DATA_PTR(object)))
22
+ #define SELF(object) (RB_GRN_OBJECT(RTYPEDDATA_DATA(object)))
22
23
 
23
24
  VALUE rb_mGrnFlushable;
24
25
 
@@ -1,6 +1,6 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /*
3
- Copyright (C) 2009-2016 Kouhei Sutou <kou@clear-code.com>
3
+ Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
4
4
 
5
5
  This library is free software; you can redistribute it and/or
6
6
  modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,7 @@
18
18
 
19
19
  #include "rb-grn.h"
20
20
 
21
- #define SELF(object) ((RbGrnTableKeySupport *)DATA_PTR(object))
21
+ #define SELF(object) ((RbGrnTableKeySupport *)RTYPEDDATA_DATA(object))
22
22
 
23
23
  VALUE rb_cGrnHash;
24
24
 
@@ -1,8 +1,8 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /*
3
- Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
4
- Copyright (C) 2009-2017 Kouhei Sutou <kou@clear-code.com>
3
+ Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
5
4
  Copyright (C) 2016 Masafumi Yokoyama <yokoyama@clear-code.com>
5
+ Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
6
6
 
7
7
  This library is free software; you can redistribute it and/or
8
8
  modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,7 @@
22
22
 
23
23
  #include <string.h>
24
24
 
25
- #define SELF(object) ((RbGrnIndexColumn *)DATA_PTR(object))
25
+ #define SELF(object) ((RbGrnIndexColumn *)RTYPEDDATA_DATA(object))
26
26
 
27
27
  VALUE rb_cGrnIndexColumn;
28
28
 
@@ -1,7 +1,7 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /*
3
3
  Copyright (C) 2011 Haruka Yoshihara <yoshihara@clear-code.com>
4
- Copyright (C) 2012 Kouhei Sutou <kou@clear-code.com>
4
+ Copyright (C) 2012-2021 Sutou Kouhei <kou@clear-code.com>
5
5
  Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
6
6
 
7
7
  This library is free software; you can redistribute it and/or
@@ -20,7 +20,7 @@
20
20
 
21
21
  #include "rb-grn.h"
22
22
 
23
- #define SELF(object) ((RbGrnIndexCursor *)DATA_PTR(object))
23
+ #define SELF(object) ((RbGrnIndexCursor *)RTYPEDDATA_DATA(object))
24
24
 
25
25
  VALUE rb_cGrnIndexCursor;
26
26
 
@@ -1,6 +1,6 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /*
3
- Copyright (C) 2017 Kouhei Sutou <kou@clear-code.com>
3
+ Copyright (C) 2017-2021 Sutou Kouhei <kou@clear-code.com>
4
4
 
5
5
  This library is free software; you can redistribute it and/or
6
6
  modify it under the terms of the GNU Lesser General Public
@@ -18,7 +18,7 @@
18
18
 
19
19
  #include "rb-grn.h"
20
20
 
21
- #define SELF(object) ((RbGrnInvertedIndexCursor *)DATA_PTR(object))
21
+ #define SELF(object) ((RbGrnInvertedIndexCursor *)RTYPEDDATA_DATA(object))
22
22
 
23
23
  typedef struct _RbGrnInvertedIndexCursor RbGrnInvertedIndexCursor;
24
24
  struct _RbGrnInvertedIndexCursor
@@ -255,7 +255,7 @@ void
255
255
  rb_grn_init_inverted_index_cursor (VALUE mGrn)
256
256
  {
257
257
  rb_cGrnInvertedIndexCursor =
258
- rb_define_class_under(mGrn, "InvertedIndexCursor", rb_cData);
258
+ rb_define_class_under(mGrn, "InvertedIndexCursor", rb_cObject);
259
259
  rb_include_module(rb_cGrnInvertedIndexCursor, rb_mEnumerable);
260
260
 
261
261
  rb_define_method(rb_cGrnInvertedIndexCursor, "next",
@@ -1,6 +1,6 @@
1
1
  /* -*- coding: utf-8; mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
2
  /*
3
- Copyright (C) 2009-2018 Kouhei Sutou <kou@clear-code.com>
3
+ Copyright (C) 2009-2021 Sutou Kouhei <kou@clear-code.com>
4
4
  Copyright (C) 2014-2016 Masafumi Yokoyama <yokoyama@clear-code.com>
5
5
  Copyright (C) 2019 Horimoto Yasuhiro <horimoto@clear-code.com>
6
6
 
@@ -28,10 +28,28 @@
28
28
 
29
29
  #include "rb-grn.h"
30
30
 
31
- #define SELF(object) ((RbGrnObject *)DATA_PTR(object))
31
+ #define SELF(object) ((RbGrnObject *)RTYPEDDATA_DATA(object))
32
32
 
33
33
  VALUE rb_cGrnObject;
34
34
 
35
+ static void
36
+ rb_grn_object_dfree (void *pointer)
37
+ {
38
+ rb_grn_object_free(pointer);
39
+ }
40
+
41
+ rb_data_type_t rb_grn_object_data_type = {
42
+ "Groonga::Object",
43
+ {
44
+ NULL,
45
+ rb_grn_object_dfree,
46
+ NULL,
47
+ },
48
+ NULL,
49
+ NULL,
50
+ RUBY_TYPED_FREE_IMMEDIATELY
51
+ };
52
+
35
53
  grn_obj *
36
54
  rb_grn_object_from_ruby_object (VALUE object, grn_ctx **context)
37
55
  {
@@ -73,7 +91,10 @@ rb_grn_object_from_ruby_object (VALUE object, grn_ctx **context)
73
91
  rb_grn_inspect(object));
74
92
  }
75
93
 
76
- Data_Get_Struct(object, RbGrnObject, rb_grn_object);
94
+ TypedData_Get_Struct(object,
95
+ RbGrnObject,
96
+ &rb_grn_object_data_type,
97
+ rb_grn_object);
77
98
  if (!rb_grn_object)
78
99
  rb_raise(rb_eGrnError, "Groonga object is NULL");
79
100
 
@@ -350,7 +371,9 @@ rb_grn_object_to_ruby_object (VALUE klass, grn_ctx *context, grn_obj *object,
350
371
  VALUE
351
372
  rb_grn_object_alloc (VALUE klass)
352
373
  {
353
- return Data_Wrap_Struct(klass, NULL, rb_grn_object_free, NULL);
374
+ return TypedData_Wrap_Struct(klass,
375
+ &rb_grn_object_data_type,
376
+ NULL);
354
377
  }
355
378
 
356
379
  static void
@@ -359,15 +382,13 @@ rb_grn_object_bind_common (VALUE klass, VALUE self, VALUE rb_context,
359
382
  grn_ctx *context, grn_obj *object)
360
383
  {
361
384
  grn_user_data *user_data;
362
- RbGrnContext *rb_grn_context;
363
385
 
364
386
  debug("bind: %p:%p:%p %s(%#x)\n",
365
387
  context, object, rb_grn_object,
366
388
  grn_obj_type_to_string(object->header.type),
367
389
  object->header.type);
368
390
 
369
- Data_Get_Struct(rb_context, RbGrnContext, rb_grn_context);
370
- rb_grn_object->rb_grn_context = rb_grn_context;
391
+ rb_grn_object->rb_grn_context = rb_grn_context_get_struct(rb_context);
371
392
  rb_grn_object->context = context;
372
393
  rb_grn_object->object = object;
373
394
  rb_grn_object->self = self;
@@ -419,7 +440,7 @@ rb_grn_object_bind_common (VALUE klass, VALUE self, VALUE rb_context,
419
440
  else
420
441
  rb_grn_object->range = grn_ctx_at(context, rb_grn_object->range_id);
421
442
 
422
- DATA_PTR(self) = rb_grn_object;
443
+ RTYPEDDATA_DATA(self) = rb_grn_object;
423
444
  }
424
445
 
425
446
  void
@@ -2213,7 +2234,7 @@ rb_grn_object_get_disk_usage (VALUE self)
2213
2234
  void
2214
2235
  rb_grn_init_object (VALUE mGrn)
2215
2236
  {
2216
- rb_cGrnObject = rb_define_class_under(mGrn, "Object", rb_cData);
2237
+ rb_cGrnObject = rb_define_class_under(mGrn, "Object", rb_cObject);
2217
2238
  rb_define_alloc_func(rb_cGrnObject, rb_grn_object_alloc);
2218
2239
 
2219
2240
  rb_define_attr(rb_cGrnObject, "context", GRN_TRUE, GRN_FALSE);
@@ -325,353 +325,194 @@ rb_grn_init_operator (VALUE mGrn)
325
325
  rb_grn_init_prefix_operator(mGrn);
326
326
  rb_grn_init_regexp_operator(mGrn);
327
327
 
328
+ #define OPERATOR_NEW(klass, name, NAME) \
329
+ rb_obj_freeze(rb_funcall(klass, rb_intern("new"), 2, \
330
+ rb_obj_freeze(rb_str_new_cstr(name)), \
331
+ UINT2NUM(GRN_OP_ ## NAME)))
332
+
328
333
  rb_define_const(rb_cGrnOperator, "PUSH",
329
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
330
- rb_str_new_cstr("push"),
331
- UINT2NUM(GRN_OP_PUSH)));
334
+ OPERATOR_NEW(rb_cGrnOperator, "push", PUSH));
332
335
  rb_define_const(rb_cGrnOperator, "POP",
333
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
334
- rb_str_new_cstr("pop"),
335
- UINT2NUM(GRN_OP_POP)));
336
+ OPERATOR_NEW(rb_cGrnOperator, "pop", POP));
336
337
  rb_define_const(rb_cGrnOperator, "NO_OPERATION",
337
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
338
- rb_str_new_cstr("no-operation"),
339
- UINT2NUM(GRN_OP_NOP)));
338
+ OPERATOR_NEW(rb_cGrnOperator, "no-operation", NOP));
340
339
  rb_define_const(rb_cGrnOperator, "CALL",
341
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
342
- rb_str_new_cstr("call"),
343
- UINT2NUM(GRN_OP_CALL)));
340
+ OPERATOR_NEW(rb_cGrnOperator, "call", CALL));
344
341
  rb_define_const(rb_cGrnOperator, "INTERN",
345
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
346
- rb_str_new_cstr("intern"),
347
- UINT2NUM(GRN_OP_INTERN)));
342
+ OPERATOR_NEW(rb_cGrnOperator, "intern", INTERN));
348
343
  rb_define_const(rb_cGrnOperator, "GET_REFERENCE",
349
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
350
- rb_str_new_cstr("get-reference"),
351
- UINT2NUM(GRN_OP_GET_REF)));
344
+ OPERATOR_NEW(rb_cGrnOperator, "get-reference", GET_REF));
352
345
  rb_define_const(rb_cGrnOperator, "GET_VALUE",
353
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
354
- rb_str_new_cstr("get-value"),
355
- UINT2NUM(GRN_OP_GET_VALUE)));
346
+ OPERATOR_NEW(rb_cGrnOperator, "get-value", GET_VALUE));
356
347
  rb_define_const(rb_cGrnOperator, "AND",
357
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
358
- rb_str_new_cstr("and"),
359
- UINT2NUM(GRN_OP_AND)));
348
+ OPERATOR_NEW(rb_cGrnOperator, "and", AND));
360
349
  rb_define_const(rb_cGrnOperator, "AND_NOT",
361
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
362
- rb_str_new_cstr("and-not"),
363
- UINT2NUM(GRN_OP_AND_NOT)));
364
- /* Just for backward compatiblity. TODO: REMOVE ME! */
350
+ OPERATOR_NEW(rb_cGrnOperator, "and-not", AND_NOT));
351
+ /* Just for backward compatibility. TODO: REMOVE ME! */
365
352
  rb_define_const(rb_cGrnOperator, "BUT",
366
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
367
- rb_str_new_cstr("but"),
368
- UINT2NUM(GRN_OP_BUT)));
353
+ OPERATOR_NEW(rb_cGrnOperator, "but", BUT));
369
354
  rb_define_const(rb_cGrnOperator, "OR",
370
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
371
- rb_str_new_cstr("or"),
372
- UINT2NUM(GRN_OP_OR)));
355
+ OPERATOR_NEW(rb_cGrnOperator, "or", OR));
373
356
  rb_define_const(rb_cGrnOperator, "ASSIGN",
374
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
375
- rb_str_new_cstr("assign"),
376
- UINT2NUM(GRN_OP_ASSIGN)));
357
+ OPERATOR_NEW(rb_cGrnOperator, "assign", ASSIGN));
377
358
  rb_define_const(rb_cGrnOperator, "STAR_ASSIGN",
378
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
379
- rb_str_new_cstr("star-assign"),
380
- UINT2NUM(GRN_OP_STAR_ASSIGN)));
359
+ OPERATOR_NEW(rb_cGrnOperator, "star-assign", STAR_ASSIGN));
381
360
  rb_define_const(rb_cGrnOperator, "SLASH_ASSIGN",
382
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
383
- rb_str_new_cstr("slash-assign"),
384
- UINT2NUM(GRN_OP_SLASH_ASSIGN)));
361
+ OPERATOR_NEW(rb_cGrnOperator, "slash-assign", SLASH_ASSIGN));
385
362
  rb_define_const(rb_cGrnOperator, "MODULO_ASSIGN",
386
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
387
- rb_str_new_cstr("modulo-assign"),
388
- UINT2NUM(GRN_OP_MOD_ASSIGN)));
363
+ OPERATOR_NEW(rb_cGrnOperator, "modulo-assign", MOD_ASSIGN));
389
364
  rb_define_const(rb_cGrnOperator, "PLUS_ASSIGN",
390
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
391
- rb_str_new_cstr("plus-assign"),
392
- UINT2NUM(GRN_OP_PLUS_ASSIGN)));
365
+ OPERATOR_NEW(rb_cGrnOperator, "plus-assign", PLUS_ASSIGN));
393
366
  rb_define_const(rb_cGrnOperator, "MINUS_ASSIGN",
394
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
395
- rb_str_new_cstr("minus-assign"),
396
- UINT2NUM(GRN_OP_MINUS_ASSIGN)));
367
+ OPERATOR_NEW(rb_cGrnOperator, "minus-assign", MINUS_ASSIGN));
397
368
  rb_define_const(rb_cGrnOperator, "SHIFTL_ASSIGN",
398
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
399
- rb_str_new_cstr("shiftl-assign"),
400
- UINT2NUM(GRN_OP_SHIFTL_ASSIGN)));
369
+ OPERATOR_NEW(rb_cGrnOperator, "shiftl-assign", SHIFTL_ASSIGN));
401
370
  rb_define_const(rb_cGrnOperator, "SHIRTR_ASSIGN",
402
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
403
- rb_str_new_cstr("shirtr-assign"),
404
- UINT2NUM(GRN_OP_SHIFTR_ASSIGN)));
371
+ OPERATOR_NEW(rb_cGrnOperator, "shirtr-assign", SHIFTR_ASSIGN));
405
372
  rb_define_const(rb_cGrnOperator, "SHIFTRR_ASSIGN",
406
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
407
- rb_str_new_cstr("shiftrr-assign"),
408
- UINT2NUM(GRN_OP_SHIFTRR_ASSIGN)));
373
+ OPERATOR_NEW(rb_cGrnOperator, "shiftrr-assign", SHIFTRR_ASSIGN));
409
374
  rb_define_const(rb_cGrnOperator, "AND_ASSIGN",
410
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
411
- rb_str_new_cstr("and-assign"),
412
- UINT2NUM(GRN_OP_AND_ASSIGN)));
375
+ OPERATOR_NEW(rb_cGrnOperator, "and-assign", AND_ASSIGN));
413
376
  rb_define_const(rb_cGrnOperator, "XOR_ASSIGN",
414
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
415
- rb_str_new_cstr("xor-assign"),
416
- UINT2NUM(GRN_OP_XOR_ASSIGN)));
377
+ OPERATOR_NEW(rb_cGrnOperator, "xor-assign", XOR_ASSIGN));
417
378
  rb_define_const(rb_cGrnOperator, "OR_ASSIGN",
418
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
419
- rb_str_new_cstr("or-assign"),
420
- UINT2NUM(GRN_OP_OR_ASSIGN)));
379
+ OPERATOR_NEW(rb_cGrnOperator, "or-assign", OR_ASSIGN));
421
380
  rb_define_const(rb_cGrnOperator, "JUMP",
422
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
423
- rb_str_new_cstr("jump"),
424
- UINT2NUM(GRN_OP_JUMP)));
381
+ OPERATOR_NEW(rb_cGrnOperator, "jump", JUMP));
425
382
  rb_define_const(rb_cGrnOperator, "CJUMP",
426
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
427
- rb_str_new_cstr("cjump"),
428
- UINT2NUM(GRN_OP_CJUMP)));
383
+ OPERATOR_NEW(rb_cGrnOperator, "cjump", CJUMP));
429
384
  rb_define_const(rb_cGrnOperator, "COMMA",
430
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
431
- rb_str_new_cstr("comma"),
432
- UINT2NUM(GRN_OP_COMMA)));
385
+ OPERATOR_NEW(rb_cGrnOperator, "comma", COMMA));
433
386
  rb_define_const(rb_cGrnOperator, "BITWISE_OR",
434
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
435
- rb_str_new_cstr("bitwise-or"),
436
- UINT2NUM(GRN_OP_BITWISE_OR)));
387
+ OPERATOR_NEW(rb_cGrnOperator, "bitwise-or", BITWISE_OR));
437
388
  rb_define_const(rb_cGrnOperator, "BITWISE_XOR",
438
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
439
- rb_str_new_cstr("bitwise-xor"),
440
- UINT2NUM(GRN_OP_BITWISE_XOR)));
389
+ OPERATOR_NEW(rb_cGrnOperator, "bitwise-xor", BITWISE_XOR));
441
390
  rb_define_const(rb_cGrnOperator, "BITWISE_AND",
442
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
443
- rb_str_new_cstr("bitwise-and"),
444
- UINT2NUM(GRN_OP_BITWISE_AND)));
391
+ OPERATOR_NEW(rb_cGrnOperator, "bitwise-and", BITWISE_AND));
445
392
  rb_define_const(rb_cGrnOperator, "BITWISE_NOT",
446
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
447
- rb_str_new_cstr("bitwise-not"),
448
- UINT2NUM(GRN_OP_BITWISE_NOT)));
393
+ OPERATOR_NEW(rb_cGrnOperator, "bitwise-not", BITWISE_NOT));
449
394
  rb_define_const(rb_cGrnOperator, "EQUAL",
450
- rb_funcall(rb_cGrnEqualOperator, rb_intern("new"), 2,
451
- rb_str_new_cstr("equal"),
452
- UINT2NUM(GRN_OP_EQUAL)));
395
+ OPERATOR_NEW(rb_cGrnEqualOperator, "equal", EQUAL));
453
396
  rb_define_const(rb_cGrnOperator, "NOT_EQUAL",
454
- rb_funcall(rb_cGrnNotEqualOperator, rb_intern("new"), 2,
455
- rb_str_new_cstr("not-equal"),
456
- UINT2NUM(GRN_OP_NOT_EQUAL)));
397
+ OPERATOR_NEW(rb_cGrnNotEqualOperator,
398
+ "not-equal",
399
+ NOT_EQUAL));
457
400
  rb_define_const(rb_cGrnOperator, "LESS",
458
- rb_funcall(rb_cGrnLessOperator, rb_intern("new"), 2,
459
- rb_str_new_cstr("less"),
460
- UINT2NUM(GRN_OP_LESS)));
401
+ OPERATOR_NEW(rb_cGrnLessOperator, "less", LESS));
461
402
  rb_define_const(rb_cGrnOperator, "GREATER",
462
- rb_funcall(rb_cGrnGreaterOperator, rb_intern("new"), 2,
463
- rb_str_new_cstr("greater"),
464
- UINT2NUM(GRN_OP_GREATER)));
403
+ OPERATOR_NEW(rb_cGrnGreaterOperator, "greater", GREATER));
465
404
  rb_define_const(rb_cGrnOperator, "LESS_EQUAL",
466
- rb_funcall(rb_cGrnLessEqualOperator, rb_intern("new"), 2,
467
- rb_str_new_cstr("less-equal"),
468
- UINT2NUM(GRN_OP_LESS_EQUAL)));
405
+ OPERATOR_NEW(rb_cGrnLessEqualOperator,
406
+ "less-equal",
407
+ LESS_EQUAL));
469
408
  rb_define_const(rb_cGrnOperator, "GREATER_EQUAL",
470
- rb_funcall(rb_cGrnGreaterEqualOperator, rb_intern("new"), 2,
471
- rb_str_new_cstr("greater-equal"),
472
- UINT2NUM(GRN_OP_GREATER_EQUAL)));
409
+ OPERATOR_NEW(rb_cGrnGreaterEqualOperator,
410
+ "greater-equal",
411
+ GREATER_EQUAL));
473
412
  rb_define_const(rb_cGrnOperator, "IN",
474
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
475
- rb_str_new_cstr("in"),
476
- UINT2NUM(GRN_OP_IN)));
413
+ OPERATOR_NEW(rb_cGrnOperator, "in", IN));
477
414
  rb_define_const(rb_cGrnOperator, "MATCH",
478
- rb_funcall(rb_cGrnMatchOperator, rb_intern("new"), 2,
479
- rb_str_new_cstr("match"),
480
- UINT2NUM(GRN_OP_MATCH)));
415
+ OPERATOR_NEW(rb_cGrnMatchOperator, "match", MATCH));
481
416
  rb_define_const(rb_cGrnOperator, "NEAR",
482
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
483
- rb_str_new_cstr("near"),
484
- UINT2NUM(GRN_OP_NEAR)));
417
+ OPERATOR_NEW(rb_cGrnOperator, "near", NEAR));
485
418
  rb_define_const(rb_cGrnOperator, "NEAR2",
486
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
487
- rb_str_new_cstr("near2"),
488
- UINT2NUM(GRN_OP_NEAR2)));
419
+ OPERATOR_NEW(rb_cGrnOperator, "near2", NEAR2));
489
420
  rb_define_const(rb_cGrnOperator, "SIMILAR",
490
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
491
- rb_str_new_cstr("similar"),
492
- UINT2NUM(GRN_OP_SIMILAR)));
421
+ OPERATOR_NEW(rb_cGrnOperator, "similar", SIMILAR));
493
422
  rb_define_const(rb_cGrnOperator, "TERM_EXTRACT",
494
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
495
- rb_str_new_cstr("term-extract"),
496
- UINT2NUM(GRN_OP_TERM_EXTRACT)));
423
+ OPERATOR_NEW(rb_cGrnOperator, "term-extract", TERM_EXTRACT));
497
424
  rb_define_const(rb_cGrnOperator, "SHIFTL",
498
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
499
- rb_str_new_cstr("shiftl"),
500
- UINT2NUM(GRN_OP_SHIFTL)));
425
+ OPERATOR_NEW(rb_cGrnOperator, "shiftl", SHIFTL));
501
426
  rb_define_const(rb_cGrnOperator, "SHIFTR",
502
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
503
- rb_str_new_cstr("shiftr"),
504
- UINT2NUM(GRN_OP_SHIFTR)));
427
+ OPERATOR_NEW(rb_cGrnOperator, "shiftr", SHIFTR));
505
428
  rb_define_const(rb_cGrnOperator, "SHIFTRR",
506
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
507
- rb_str_new_cstr("shiftrr"),
508
- UINT2NUM(GRN_OP_SHIFTRR)));
429
+ OPERATOR_NEW(rb_cGrnOperator, "shiftrr", SHIFTRR));
509
430
  rb_define_const(rb_cGrnOperator, "PLUS",
510
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
511
- rb_str_new_cstr("plus"),
512
- UINT2NUM(GRN_OP_PLUS)));
431
+ OPERATOR_NEW(rb_cGrnOperator, "plus", PLUS));
513
432
  rb_define_const(rb_cGrnOperator, "MINUS",
514
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
515
- rb_str_new_cstr("minus"),
516
- UINT2NUM(GRN_OP_MINUS)));
433
+ OPERATOR_NEW(rb_cGrnOperator, "minus", MINUS));
517
434
  rb_define_const(rb_cGrnOperator, "STAR",
518
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
519
- rb_str_new_cstr("star"),
520
- UINT2NUM(GRN_OP_STAR)));
435
+ OPERATOR_NEW(rb_cGrnOperator, "star", STAR));
521
436
  rb_define_const(rb_cGrnOperator, "SLASH",
522
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
523
- rb_str_new_cstr("slash"),
524
- UINT2NUM(GRN_OP_SLASH)));
437
+ OPERATOR_NEW(rb_cGrnOperator, "slash", SLASH));
525
438
  rb_define_const(rb_cGrnOperator, "MODULO",
526
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
527
- rb_str_new_cstr("modulo"),
528
- UINT2NUM(GRN_OP_MOD)));
439
+ OPERATOR_NEW(rb_cGrnOperator, "modulo", MOD));
529
440
  rb_define_const(rb_cGrnOperator, "DELETE",
530
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
531
- rb_str_new_cstr("delete"),
532
- UINT2NUM(GRN_OP_DELETE)));
441
+ OPERATOR_NEW(rb_cGrnOperator, "delete", DELETE));
533
442
  rb_define_const(rb_cGrnOperator, "INCREMENT",
534
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
535
- rb_str_new_cstr("increment"),
536
- UINT2NUM(GRN_OP_INCR)));
443
+ OPERATOR_NEW(rb_cGrnOperator, "increment", INCR));
537
444
  rb_define_const(rb_cGrnOperator, "DECREMENT",
538
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
539
- rb_str_new_cstr("decrement"),
540
- UINT2NUM(GRN_OP_DECR)));
445
+ OPERATOR_NEW(rb_cGrnOperator, "decrement", DECR));
541
446
  rb_define_const(rb_cGrnOperator, "INCREMENT_POST",
542
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
543
- rb_str_new_cstr("increment-post"),
544
- UINT2NUM(GRN_OP_INCR_POST)));
447
+ OPERATOR_NEW(rb_cGrnOperator, "increment-post", INCR_POST));
545
448
  rb_define_const(rb_cGrnOperator, "DECREMENT_POST",
546
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
547
- rb_str_new_cstr("decrement-post"),
548
- UINT2NUM(GRN_OP_DECR_POST)));
449
+ OPERATOR_NEW(rb_cGrnOperator, "decrement-post", DECR_POST));
549
450
  rb_define_const(rb_cGrnOperator, "NOT",
550
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
551
- rb_str_new_cstr("not"),
552
- UINT2NUM(GRN_OP_NOT)));
451
+ OPERATOR_NEW(rb_cGrnOperator, "not", NOT));
553
452
  rb_define_const(rb_cGrnOperator, "ADJUST",
554
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
555
- rb_str_new_cstr("adjust"),
556
- UINT2NUM(GRN_OP_ADJUST)));
453
+ OPERATOR_NEW(rb_cGrnOperator, "adjust", ADJUST));
557
454
  rb_define_const(rb_cGrnOperator, "EXACT",
558
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
559
- rb_str_new_cstr("exact"),
560
- UINT2NUM(GRN_OP_EXACT)));
455
+ OPERATOR_NEW(rb_cGrnOperator, "exact", EXACT));
561
456
  rb_define_const(rb_cGrnOperator, "LONGEST_COMMON_PREFIX",
562
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
563
- rb_str_new_cstr("longest-common-prefix"),
564
- UINT2NUM(GRN_OP_LCP)));
457
+ OPERATOR_NEW(rb_cGrnOperator, "longest-common-prefix", LCP));
565
458
  rb_define_const(rb_cGrnOperator, "PARTIAL",
566
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
567
- rb_str_new_cstr("partial"),
568
- UINT2NUM(GRN_OP_PARTIAL)));
459
+ OPERATOR_NEW(rb_cGrnOperator, "partial", PARTIAL));
569
460
  rb_define_const(rb_cGrnOperator, "UNSPLIT",
570
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
571
- rb_str_new_cstr("unsplit"),
572
- UINT2NUM(GRN_OP_UNSPLIT)));
461
+ OPERATOR_NEW(rb_cGrnOperator, "unsplit", UNSPLIT));
573
462
  rb_define_const(rb_cGrnOperator, "PREFIX",
574
- rb_funcall(rb_cGrnPrefixOperator, rb_intern("new"), 2,
575
- rb_str_new_cstr("prefix"),
576
- UINT2NUM(GRN_OP_PREFIX)));
463
+ OPERATOR_NEW(rb_cGrnPrefixOperator, "prefix", PREFIX));
577
464
  rb_define_const(rb_cGrnOperator, "SUFFIX",
578
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
579
- rb_str_new_cstr("suffix"),
580
- UINT2NUM(GRN_OP_SUFFIX)));
465
+ OPERATOR_NEW(rb_cGrnOperator, "suffix", SUFFIX));
581
466
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE1",
582
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
583
- rb_str_new_cstr("geo-distance1"),
584
- UINT2NUM(GRN_OP_GEO_DISTANCE1)));
467
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance1", GEO_DISTANCE1));
585
468
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE2",
586
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
587
- rb_str_new_cstr("geo-distance2"),
588
- UINT2NUM(GRN_OP_GEO_DISTANCE2)));
469
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance2", GEO_DISTANCE2));
589
470
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE3",
590
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
591
- rb_str_new_cstr("geo-distance3"),
592
- UINT2NUM(GRN_OP_GEO_DISTANCE3)));
471
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance3", GEO_DISTANCE3));
593
472
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE4",
594
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
595
- rb_str_new_cstr("geo-distance4"),
596
- UINT2NUM(GRN_OP_GEO_DISTANCE4)));
473
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance4", GEO_DISTANCE4));
597
474
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP5",
598
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
599
- rb_str_new_cstr("geo-withinp5"),
600
- UINT2NUM(GRN_OP_GEO_WITHINP5)));
475
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp5", GEO_WITHINP5));
601
476
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP6",
602
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
603
- rb_str_new_cstr("geo-withinp6"),
604
- UINT2NUM(GRN_OP_GEO_WITHINP6)));
477
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp6", GEO_WITHINP6));
605
478
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP8",
606
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
607
- rb_str_new_cstr("geo-withinp8"),
608
- UINT2NUM(GRN_OP_GEO_WITHINP8)));
479
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp8", GEO_WITHINP8));
609
480
  rb_define_const(rb_cGrnOperator, "OBJECT_SEARCH",
610
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
611
- rb_str_new_cstr("object-search"),
612
- UINT2NUM(GRN_OP_OBJ_SEARCH)));
481
+ OPERATOR_NEW(rb_cGrnOperator, "object-search", OBJ_SEARCH));
613
482
  rb_define_const(rb_cGrnOperator, "EXPRESSION_GET_VARIABLE",
614
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
615
- rb_str_new_cstr("expression-get-variable"),
616
- UINT2NUM(GRN_OP_EXPR_GET_VAR)));
483
+ OPERATOR_NEW(rb_cGrnOperator, "expression-get-variable", EXPR_GET_VAR));
617
484
  rb_define_const(rb_cGrnOperator, "TABLE_CREATE",
618
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
619
- rb_str_new_cstr("table-create"),
620
- UINT2NUM(GRN_OP_TABLE_CREATE)));
485
+ OPERATOR_NEW(rb_cGrnOperator, "table-create", TABLE_CREATE));
621
486
  rb_define_const(rb_cGrnOperator, "TABLE_SELECT",
622
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
623
- rb_str_new_cstr("table-select"),
624
- UINT2NUM(GRN_OP_TABLE_SELECT)));
487
+ OPERATOR_NEW(rb_cGrnOperator, "table-select", TABLE_SELECT));
625
488
  rb_define_const(rb_cGrnOperator, "TABLE_SORT",
626
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
627
- rb_str_new_cstr("table-sort"),
628
- UINT2NUM(GRN_OP_TABLE_SORT)));
489
+ OPERATOR_NEW(rb_cGrnOperator, "table-sort", TABLE_SORT));
629
490
  rb_define_const(rb_cGrnOperator, "TABLE_GROUP",
630
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
631
- rb_str_new_cstr("table-group"),
632
- UINT2NUM(GRN_OP_TABLE_GROUP)));
491
+ OPERATOR_NEW(rb_cGrnOperator, "table-group", TABLE_GROUP));
633
492
  rb_define_const(rb_cGrnOperator, "JSON_PUT",
634
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
635
- rb_str_new_cstr("json-put"),
636
- UINT2NUM(GRN_OP_JSON_PUT)));
493
+ OPERATOR_NEW(rb_cGrnOperator, "json-put", JSON_PUT));
637
494
  rb_define_const(rb_cGrnOperator, "REGEXP",
638
- rb_funcall(rb_cGrnRegexpOperator, rb_intern("new"), 2,
639
- rb_str_new_cstr("regexp"),
640
- UINT2NUM(GRN_OP_REGEXP)));
495
+ OPERATOR_NEW(rb_cGrnRegexpOperator, "regexp", REGEXP));
641
496
  rb_define_const(rb_cGrnOperator, "FUZZY",
642
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
643
- rb_str_new_cstr("fuzzy"),
644
- UINT2NUM(GRN_OP_FUZZY)));
497
+ OPERATOR_NEW(rb_cGrnOperator, "fuzzy", FUZZY));
645
498
 
646
499
 
647
500
  /*
648
501
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE1",
649
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
650
- rb_str_new_cstr("geo-distance1"),
651
- UINT2NUM(GRN_OP_GEO_DISTANCE1)));
502
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance1", GEO_DISTANCE1));
652
503
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE2",
653
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
654
- rb_str_new_cstr("geo-distance2"),
655
- UINT2NUM(GRN_OP_GEO_DISTANCE2)));
504
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance2", GEO_DISTANCE2));
656
505
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE3",
657
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
658
- rb_str_new_cstr("geo-distance3"),
659
- UINT2NUM(GRN_OP_GEO_DISTANCE3)));
506
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance3", GEO_DISTANCE3));
660
507
  rb_define_const(rb_cGrnOperator, "GEO_DISTANCE4",
661
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
662
- rb_str_new_cstr("geo-distance4"),
663
- UINT2NUM(GRN_OP_GEO_DISTANCE4)));
508
+ OPERATOR_NEW(rb_cGrnOperator, "geo-distance4", GEO_DISTANCE4));
664
509
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP5",
665
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
666
- rb_str_new_cstr("geo-withinp5"),
667
- UINT2NUM(GRN_OP_GEO_WITHINP5)));
510
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp5", GEO_WITHINP5));
668
511
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP6",
669
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
670
- rb_str_new_cstr("geo-withinp6"),
671
- UINT2NUM(GRN_OP_GEO_WITHINP6)));
512
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp6", GEO_WITHINP6));
672
513
  rb_define_const(rb_cGrnOperator, "GEO_WITHINP8",
673
- rb_funcall(rb_cGrnOperator, rb_intern("new"), 2,
674
- rb_str_new_cstr("geo-withinp8"),
675
- UINT2NUM(GRN_OP_GEO_WITHINP8)));
514
+ OPERATOR_NEW(rb_cGrnOperator, "geo-withinp8", GEO_WITHINP8));
676
515
  */
516
+
517
+ #undef OPERATOR_NEW
677
518
  }