1 | /* -*- c-basic-offset: 2 -*- */ |
2 | /* |
3 | Copyright(C) 2014 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 | |
24 | #include "mrb_id.h" |
25 | |
26 | void |
27 | grn_mrb_id_init(grn_ctx *ctx) |
28 | { |
29 | mrb_state *mrb = ctx->impl->mrb.state; |
30 | struct RClass *module = ctx->impl->mrb.module; |
31 | struct RClass *id_module; |
32 | |
33 | id_module = mrb_define_module_under(mrb, module, "ID" ); |
34 | |
35 | mrb_define_const(mrb, id_module, "NIL" , |
36 | mrb_fixnum_value(GRN_ID_NIL)); |
37 | mrb_define_const(mrb, id_module, "MAX" , |
38 | mrb_fixnum_value(GRN_ID_MAX)); |
39 | |
40 | mrb_define_const(mrb, id_module, "VOID" , |
41 | mrb_fixnum_value(GRN_DB_VOID)); |
42 | mrb_define_const(mrb, id_module, "DB" , |
43 | mrb_fixnum_value(GRN_DB_DB)); |
44 | mrb_define_const(mrb, id_module, "OBJECT" , |
45 | mrb_fixnum_value(GRN_DB_OBJECT)); |
46 | mrb_define_const(mrb, id_module, "BOOL" , |
47 | mrb_fixnum_value(GRN_DB_BOOL)); |
48 | mrb_define_const(mrb, id_module, "INT8" , |
49 | mrb_fixnum_value(GRN_DB_INT8)); |
50 | mrb_define_const(mrb, id_module, "UINT8" , |
51 | mrb_fixnum_value(GRN_DB_UINT8)); |
52 | mrb_define_const(mrb, id_module, "INT16" , |
53 | mrb_fixnum_value(GRN_DB_INT16)); |
54 | mrb_define_const(mrb, id_module, "UINT16" , |
55 | mrb_fixnum_value(GRN_DB_UINT16)); |
56 | mrb_define_const(mrb, id_module, "INT32" , |
57 | mrb_fixnum_value(GRN_DB_INT32)); |
58 | mrb_define_const(mrb, id_module, "UINT32" , |
59 | mrb_fixnum_value(GRN_DB_UINT32)); |
60 | mrb_define_const(mrb, id_module, "INT64" , |
61 | mrb_fixnum_value(GRN_DB_INT64)); |
62 | mrb_define_const(mrb, id_module, "UINT64" , |
63 | mrb_fixnum_value(GRN_DB_UINT64)); |
64 | mrb_define_const(mrb, id_module, "FLOAT" , |
65 | mrb_fixnum_value(GRN_DB_FLOAT)); |
66 | mrb_define_const(mrb, id_module, "TIME" , |
67 | mrb_fixnum_value(GRN_DB_TIME)); |
68 | mrb_define_const(mrb, id_module, "SHORT_TEXT" , |
69 | mrb_fixnum_value(GRN_DB_SHORT_TEXT)); |
70 | mrb_define_const(mrb, id_module, "TEXT" , |
71 | mrb_fixnum_value(GRN_DB_TEXT)); |
72 | mrb_define_const(mrb, id_module, "LONG_TEXT" , |
73 | mrb_fixnum_value(GRN_DB_LONG_TEXT)); |
74 | mrb_define_const(mrb, id_module, "TOKYO_GEO_POINT" , |
75 | mrb_fixnum_value(GRN_DB_TOKYO_GEO_POINT)); |
76 | mrb_define_const(mrb, id_module, "WGS84_GEO_POINT" , |
77 | mrb_fixnum_value(GRN_DB_WGS84_GEO_POINT)); |
78 | } |
79 | #endif |
80 | |