Kouhei Sutou
null+****@clear*****
Sun Dec 28 21:48:34 JST 2014
Kouhei Sutou 2014-12-28 21:48:34 +0900 (Sun, 28 Dec 2014) New Revision: 21d0ceff32fad43a7bec35bdc1fd33081b6daaba https://github.com/groonga/groonga/commit/21d0ceff32fad43a7bec35bdc1fd33081b6daaba Message: mrb: bind table cursor flags Added files: lib/mrb/mrb_table_cursor_flags.c lib/mrb/mrb_table_cursor_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 2014-12-28 21:40:00 +0900 (6d0a435) +++ lib/ctx_impl_mrb.c 2014-12-28 21:48:34 +0900 (6a06b61) @@ -43,6 +43,7 @@ #include "mrb/mrb_accessor.h" #include "mrb/mrb_procedure.h" #include "mrb/mrb_table_cursor.h" +#include "mrb/mrb_table_cursor_flags.h" #ifdef GRN_WITH_MRUBY # include <mruby/array.h> @@ -115,6 +116,7 @@ grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx) grn_mrb_accessor_init(ctx); grn_mrb_procedure_init(ctx); grn_mrb_table_cursor_init(ctx); + grn_mrb_table_cursor_flags_init(ctx); grn_mrb_load(ctx, "initialize/post.rb"); } Added: lib/mrb/mrb_table_cursor_flags.c (+60 -0) 100644 =================================================================== --- /dev/null +++ lib/mrb/mrb_table_cursor_flags.c 2014-12-28 21:48:34 +0900 (8b889fc) @@ -0,0 +1,60 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2014 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_cursor_flags.h" + +void +grn_mrb_table_cursor_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, "TableCursorFlags"); + + mrb_define_const(mrb, flags_module, "ASCENDING", + mrb_fixnum_value(GRN_CURSOR_ASCENDING)); + mrb_define_const(mrb, flags_module, "DESCENDING", + mrb_fixnum_value(GRN_CURSOR_DESCENDING)); + mrb_define_const(mrb, flags_module, "GE", + mrb_fixnum_value(GRN_CURSOR_GE)); + mrb_define_const(mrb, flags_module, "GT", + mrb_fixnum_value(GRN_CURSOR_GT)); + mrb_define_const(mrb, flags_module, "LE", + mrb_fixnum_value(GRN_CURSOR_LE)); + mrb_define_const(mrb, flags_module, "LT", + mrb_fixnum_value(GRN_CURSOR_LT)); + mrb_define_const(mrb, flags_module, "BY_KEY", + mrb_fixnum_value(GRN_CURSOR_BY_KEY)); + mrb_define_const(mrb, flags_module, "BY_ID", + mrb_fixnum_value(GRN_CURSOR_BY_ID)); + mrb_define_const(mrb, flags_module, "PREFIX", + mrb_fixnum_value(GRN_CURSOR_PREFIX)); + mrb_define_const(mrb, flags_module, "SIZE_BY_BIT", + mrb_fixnum_value(GRN_CURSOR_SIZE_BY_BIT)); + mrb_define_const(mrb, flags_module, "RK", + mrb_fixnum_value(GRN_CURSOR_RK)); +} +#endif Added: lib/mrb/mrb_table_cursor_flags.h (+34 -0) 100644 =================================================================== --- /dev/null +++ lib/mrb/mrb_table_cursor_flags.h 2014-12-28 21:48:34 +0900 (f336cde) @@ -0,0 +1,34 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2014 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_CURSOR_FLAGS_H +#define GRN_MRB_TABLE_CURSOR_FLAGS_H + +#include "../grn_ctx.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void grn_mrb_table_cursor_flags_init(grn_ctx *ctx); + +#ifdef __cplusplus +} +#endif + +#endif /* GRN_MRB_TABLE_CURSOR_FLAGS_H */ Modified: lib/mrb/sources.am (+2 -0) =================================================================== --- lib/mrb/sources.am 2014-12-28 21:40:00 +0900 (22b3a97) +++ lib/mrb/sources.am 2014-12-28 21:48:34 +0900 (4b67805) @@ -37,6 +37,8 @@ libgrnmrb_la_SOURCES = \ mrb_table.h \ mrb_table_cursor.c \ mrb_table_cursor.h \ + mrb_table_cursor_flags.c \ + mrb_table_cursor_flags.h \ mrb_type.c \ mrb_type.h \ mrb_variable_size_column.c \ -------------- next part -------------- HTML����������������������������...Download