Kouhei Sutou
null+****@clear*****
Sun Jun 28 23:48:59 JST 2015
Kouhei Sutou 2015-06-28 23:48:59 +0900 (Sun, 28 Jun 2015) New Revision: 414c97d51d85aa210d3c79d64024b7a98f519d20 https://github.com/groonga/groonga/commit/414c97d51d85aa210d3c79d64024b7a98f519d20 Message: mrb: bind grn_table_sort_flags Added files: lib/mrb/mrb_table_sort_flags.c lib/mrb/mrb_table_sort_flags.h Modified files: lib/ctx_impl_mrb.c lib/mrb/sources.am Modified: lib/ctx_impl_mrb.c (+2 -0) =================================================================== --- lib/ctx_impl_mrb.c 2015-06-28 23:18:44 +0900 (9a357f4) +++ lib/ctx_impl_mrb.c 2015-06-28 23:48:59 +0900 (b4575aa) @@ -41,6 +41,7 @@ # include "mrb/mrb_patricia_trie.h" # include "mrb/mrb_double_array_trie.h" # include "mrb/mrb_table_group_result.h" +# include "mrb/mrb_table_sort_flags.h" # include "mrb/mrb_table_sort_key.h" # include "mrb/mrb_column.h" # include "mrb/mrb_fixed_size_column.h" @@ -145,6 +146,7 @@ grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx) grn_mrb_patricia_trie_init(ctx); grn_mrb_double_array_trie_init(ctx); grn_mrb_table_group_result_init(ctx); + grn_mrb_table_sort_flags_init(ctx); grn_mrb_table_sort_key_init(ctx); grn_mrb_column_init(ctx); grn_mrb_fixed_size_column_init(ctx); Added: lib/mrb/mrb_table_sort_flags.c (+42 -0) 100644 =================================================================== --- /dev/null +++ lib/mrb/mrb_table_sort_flags.c 2015-06-28 23:48:59 +0900 (0c40259) @@ -0,0 +1,42 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015 Brazil + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 2.1 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "../grn_ctx_impl.h" + +#ifdef GRN_WITH_MRUBY +#include <mruby.h> +#include <mruby/class.h> + +#include "mrb_table_sort_flags.h" + +void +grn_mrb_table_sort_flags_init(grn_ctx *ctx) +{ + grn_mrb_data *data = &(ctx->impl->mrb); + mrb_state *mrb = data->state; + struct RClass *module = data->module; + struct RClass *flags_module; + + flags_module = mrb_define_module_under(mrb, module, "TableSortFlags"); + + mrb_define_const(mrb, flags_module, "ASCENDING", + mrb_fixnum_value(GRN_TABLE_SORT_ASC)); + mrb_define_const(mrb, flags_module, "DESCENDING", + mrb_fixnum_value(GRN_TABLE_SORT_DESC)); +} +#endif Added: lib/mrb/mrb_table_sort_flags.h (+34 -0) 100644 =================================================================== --- /dev/null +++ lib/mrb/mrb_table_sort_flags.h 2015-06-28 23:48:59 +0900 (0b5c40b) @@ -0,0 +1,34 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2015 Brazil + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 2.1 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef GRN_MRB_TABLE_SORT_FLAGS_H +#define GRN_MRB_TABLE_SORT_FLAGS_H + +#include "../grn_ctx.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void grn_mrb_table_sort_flags_init(grn_ctx *ctx); + +#ifdef __cplusplus +} +#endif + +#endif /* GRN_MRB_TABLE_SORT_FLAGS_H */ Modified: lib/mrb/sources.am (+2 -0) =================================================================== --- lib/mrb/sources.am 2015-06-28 23:18:44 +0900 (1b9860c) +++ lib/mrb/sources.am 2015-06-28 23:48:59 +0900 (3a28299) @@ -57,6 +57,8 @@ libgrnmrb_la_SOURCES = \ mrb_table_cursor_flags.h \ mrb_table_group_result.c \ mrb_table_group_result.h \ + mrb_table_sort_flags.c \ + mrb_table_sort_flags.h \ mrb_table_sort_key.c \ mrb_table_sort_key.h \ mrb_type.c \ -------------- next part -------------- HTML����������������������������...Download