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/class.h> |
24 | |
25 | #include "mrb_table_group_flags.h" |
26 | |
27 | void |
28 | grn_mrb_table_group_flags_init(grn_ctx *ctx) |
29 | { |
30 | grn_mrb_data *data = &(ctx->impl->mrb); |
31 | mrb_state *mrb = data->state; |
32 | struct RClass *module = data->module; |
33 | struct RClass *flags_module; |
34 | |
35 | flags_module = mrb_define_module_under(mrb, module, "TableGroupFlags" ); |
36 | |
37 | mrb_define_const(mrb, flags_module, "CALC_COUNT" , |
38 | mrb_fixnum_value(GRN_TABLE_GROUP_CALC_COUNT)); |
39 | mrb_define_const(mrb, flags_module, "CALC_MAX" , |
40 | mrb_fixnum_value(GRN_TABLE_GROUP_CALC_MAX)); |
41 | mrb_define_const(mrb, flags_module, "CALC_MIN" , |
42 | mrb_fixnum_value(GRN_TABLE_GROUP_CALC_MIN)); |
43 | mrb_define_const(mrb, flags_module, "CALC_SUM" , |
44 | mrb_fixnum_value(GRN_TABLE_GROUP_CALC_SUM)); |
45 | mrb_define_const(mrb, flags_module, "CALC_AVG" , |
46 | mrb_fixnum_value(GRN_TABLE_GROUP_CALC_AVG)); |
47 | } |
48 | #endif |
49 | |