Debian Codegraph @

lib/mrb/mrb_object_flags.c

raw symbols SCIP
1 /*
2 Copyright(C) 2015 Brazil
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
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
32 void
33 grn_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_int_value(mrb, 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 MRB_DEFINE_FLAG(COMPRESS_OPENZL);
72
73 MRB_DEFINE_FLAG(WITH_SECTION);
74 MRB_DEFINE_FLAG(WITH_WEIGHT);
75 MRB_DEFINE_FLAG(WITH_POSITION);
76 MRB_DEFINE_FLAG(RING_BUFFER);
77
78 MRB_DEFINE_FLAG(UNIT_MASK);
79 MRB_DEFINE_FLAG(UNIT_DOCUMENT_NONE);
80 MRB_DEFINE_FLAG(UNIT_DOCUMENT_SECTION);
81 MRB_DEFINE_FLAG(UNIT_DOCUMENT_POSITION);
82 MRB_DEFINE_FLAG(UNIT_SECTION_NONE);
83 MRB_DEFINE_FLAG(UNIT_SECTION_POSITION);
84 MRB_DEFINE_FLAG(UNIT_POSITION_NONE);
85 MRB_DEFINE_FLAG(UNIT_USERDEF_DOCUMENT);
86 MRB_DEFINE_FLAG(UNIT_USERDEF_SECTION);
87 MRB_DEFINE_FLAG(UNIT_USERDEF_POSITION);
88
89 MRB_DEFINE_FLAG(NO_SUBREC);
90 MRB_DEFINE_FLAG(WITH_SUBREC);
91
92 MRB_DEFINE_FLAG(KEY_VAR_SIZE);
93
94 MRB_DEFINE_FLAG(TEMPORARY);
95 MRB_DEFINE_FLAG(PERSISTENT);
96 }
97 #endif /* GRN_WITH_MRUBY */