1/* -*- c-basic-offset: 2 -*- */
2/*
3 Copyright(C) 2015 Brazil
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17*/
18
19#include "../grn_ctx_impl.h"
20
21#ifdef GRN_WITH_MRUBY
22# include <mruby.h>
23# include <mruby/string.h>
24# include <mruby/class.h>
25# include <mruby/data.h>
26
27# include "../grn_mrb.h"
28# include "mrb_object.h"
29# include "mrb_operator.h"
30# include "mrb_converter.h"
31
32void
33grn_mrb_object_flags_init(grn_ctx *ctx)
34{
35 grn_mrb_data *data = &(ctx->impl->mrb);
36 mrb_state *mrb = data->state;
37 struct RClass *module = data->module;
38 struct RClass *flags_module;
39
40 flags_module = mrb_define_module_under(mrb, module, "ObjectFlags");
41
42#define MRB_DEFINE_FLAG(name) \
43 mrb_define_const(mrb, flags_module, #name, \
44 mrb_fixnum_value(GRN_OBJ_ ## name))
45
46 MRB_DEFINE_FLAG(TABLE_TYPE_MASK);
47 MRB_DEFINE_FLAG(TABLE_HASH_KEY);
48 MRB_DEFINE_FLAG(TABLE_PAT_KEY);
49 MRB_DEFINE_FLAG(TABLE_DAT_KEY);
50 MRB_DEFINE_FLAG(TABLE_NO_KEY);
51
52 MRB_DEFINE_FLAG(KEY_MASK);
53 MRB_DEFINE_FLAG(KEY_UINT);
54 MRB_DEFINE_FLAG(KEY_INT);
55 MRB_DEFINE_FLAG(KEY_FLOAT);
56 MRB_DEFINE_FLAG(KEY_GEO_POINT);
57
58 MRB_DEFINE_FLAG(KEY_WITH_SIS);
59 MRB_DEFINE_FLAG(KEY_NORMALIZE);
60
61 MRB_DEFINE_FLAG(COLUMN_TYPE_MASK);
62 MRB_DEFINE_FLAG(COLUMN_SCALAR);
63 MRB_DEFINE_FLAG(COLUMN_VECTOR);
64 MRB_DEFINE_FLAG(COLUMN_INDEX);
65
66 MRB_DEFINE_FLAG(COMPRESS_MASK);
67 MRB_DEFINE_FLAG(COMPRESS_NONE);
68 MRB_DEFINE_FLAG(COMPRESS_ZLIB);
69 MRB_DEFINE_FLAG(COMPRESS_LZ4);
70 MRB_DEFINE_FLAG(COMPRESS_ZSTD);
71
72 MRB_DEFINE_FLAG(WITH_SECTION);
73 MRB_DEFINE_FLAG(WITH_WEIGHT);
74 MRB_DEFINE_FLAG(WITH_POSITION);
75 MRB_DEFINE_FLAG(RING_BUFFER);
76
77 MRB_DEFINE_FLAG(UNIT_MASK);
78 MRB_DEFINE_FLAG(UNIT_DOCUMENT_NONE);
79 MRB_DEFINE_FLAG(UNIT_DOCUMENT_SECTION);
80 MRB_DEFINE_FLAG(UNIT_DOCUMENT_POSITION);
81 MRB_DEFINE_FLAG(UNIT_SECTION_NONE);
82 MRB_DEFINE_FLAG(UNIT_SECTION_POSITION);
83 MRB_DEFINE_FLAG(UNIT_POSITION_NONE);
84 MRB_DEFINE_FLAG(UNIT_USERDEF_DOCUMENT);
85 MRB_DEFINE_FLAG(UNIT_USERDEF_SECTION);
86 MRB_DEFINE_FLAG(UNIT_USERDEF_POSITION);
87
88 MRB_DEFINE_FLAG(NO_SUBREC);
89 MRB_DEFINE_FLAG(WITH_SUBREC);
90
91 MRB_DEFINE_FLAG(KEY_VAR_SIZE);
92
93 MRB_DEFINE_FLAG(TEMPORARY);
94 MRB_DEFINE_FLAG(PERSISTENT);
95}
96#endif /* GRN_WITH_MRUBY */
97