Debian Codegraph @

lib/mrb/mrb_id.c

raw symbols SCIP
1 /*
2 Copyright(C) 2014 Brazil
3 Copyright(C) 2020 Sutou Kouhei <[email protected]>
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 as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #include "../grn_ctx_impl.h"
21
22 #ifdef GRN_WITH_MRUBY
23 #include <mruby.h>
24
25 #include "mrb_id.h"
26
27 void
28 grn_mrb_id_init(grn_ctx *ctx)
29 {
30 mrb_state *mrb = ctx->impl->mrb.state;
31 struct RClass *module = ctx->impl->mrb.module;
32 struct RClass *id_module;
33
34 id_module = mrb_define_module_under(mrb, module, "ID");
35
36 mrb_define_const(mrb, id_module, "NIL",
37 mrb_int_value(mrb, GRN_ID_NIL));
38 mrb_define_const(mrb, id_module, "MAX",
39 mrb_int_value(mrb, GRN_ID_MAX));
40
41 mrb_define_const(mrb, id_module, "VOID",
42 mrb_int_value(mrb, GRN_DB_VOID));
43 mrb_define_const(mrb, id_module, "DB",
44 mrb_int_value(mrb, GRN_DB_DB));
45 mrb_define_const(mrb, id_module, "OBJECT",
46 mrb_int_value(mrb, GRN_DB_OBJECT));
47 mrb_define_const(mrb, id_module, "BOOL",
48 mrb_int_value(mrb, GRN_DB_BOOL));
49 mrb_define_const(mrb, id_module, "INT8",
50 mrb_int_value(mrb, GRN_DB_INT8));
51 mrb_define_const(mrb, id_module, "UINT8",
52 mrb_int_value(mrb, GRN_DB_UINT8));
53 mrb_define_const(mrb, id_module, "INT16",
54 mrb_int_value(mrb, GRN_DB_INT16));
55 mrb_define_const(mrb, id_module, "UINT16",
56 mrb_int_value(mrb, GRN_DB_UINT16));
57 mrb_define_const(mrb, id_module, "INT32",
58 mrb_int_value(mrb, GRN_DB_INT32));
59 mrb_define_const(mrb, id_module, "UINT32",
60 mrb_int_value(mrb, GRN_DB_UINT32));
61 mrb_define_const(mrb, id_module, "INT64",
62 mrb_int_value(mrb, GRN_DB_INT64));
63 mrb_define_const(mrb, id_module, "UINT64",
64 mrb_int_value(mrb, GRN_DB_UINT64));
65 mrb_define_const(mrb, id_module, "FLOAT",
66 mrb_int_value(mrb, GRN_DB_FLOAT));
67 mrb_define_const(mrb, id_module, "TIME",
68 mrb_int_value(mrb, GRN_DB_TIME));
69 mrb_define_const(mrb, id_module, "SHORT_TEXT",
70 mrb_int_value(mrb, GRN_DB_SHORT_TEXT));
71 mrb_define_const(mrb, id_module, "TEXT",
72 mrb_int_value(mrb, GRN_DB_TEXT));
73 mrb_define_const(mrb, id_module, "LONG_TEXT",
74 mrb_int_value(mrb, GRN_DB_LONG_TEXT));
75 mrb_define_const(mrb, id_module, "TOKYO_GEO_POINT",
76 mrb_int_value(mrb, GRN_DB_TOKYO_GEO_POINT));
77 mrb_define_const(mrb, id_module, "WGS84_GEO_POINT",
78 mrb_int_value(mrb, GRN_DB_WGS84_GEO_POINT));
79 mrb_define_const(mrb, id_module, "FLOAT32",
80 mrb_int_value(mrb, GRN_DB_FLOAT32));
81 }
82 #endif