Kouhei Sutou
null+****@clear*****
Sun Jun 8 17:32:24 JST 2014
Kouhei Sutou 2014-06-08 17:32:24 +0900 (Sun, 08 Jun 2014) New Revision: 2e6e3aeccaa7e88efdc32b1ed3f16eddee0d732c https://github.com/groonga/groonga/commit/2e6e3aeccaa7e88efdc32b1ed3f16eddee0d732c Message: mrb: bind bulk Added files: lib/mrb/mrb_bulk.c lib/mrb/mrb_bulk.h Modified files: lib/ctx_impl_mrb.c lib/mrb/sources.am Modified: lib/ctx_impl_mrb.c (+3 -1) =================================================================== --- lib/ctx_impl_mrb.c 2014-06-08 17:25:51 +0900 (2f63f56) +++ lib/ctx_impl_mrb.c 2014-06-08 17:32:24 +0900 (7011c79) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2013 Brazil + Copyright(C) 2013-2014 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -21,6 +21,7 @@ #include "mrb.h" #include "mrb/mrb_ctx.h" +#include "mrb/mrb_bulk.h" #include "mrb/mrb_obj.h" #include "mrb/mrb_column.h" #include "mrb/mrb_fixed_size_column.h" @@ -40,6 +41,7 @@ grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx) ctx->impl->mrb.module = mrb_define_module(mrb, "Groonga"); grn_mrb_ctx_init(ctx); + grn_mrb_bulk_init(ctx); grn_mrb_obj_init(ctx); grn_mrb_column_init(ctx); grn_mrb_fixed_size_column_init(ctx); Added: lib/mrb/mrb_bulk.c (+59 -0) 100644 =================================================================== --- /dev/null +++ lib/mrb/mrb_bulk.c 2014-06-08 17:32:24 +0900 (e3773bd) @@ -0,0 +1,59 @@ +/* -*- 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 "../ctx_impl.h" + +#ifdef GRN_WITH_MRUBY +#include <mruby.h> +#include <mruby/class.h> +#include <mruby/variable.h> +#include <mruby/data.h> + +#include "../db.h" +#include "mrb_bulk.h" + +static struct mrb_data_type mrb_grn_bulk_type = { + "Groonga::Bulk", + NULL +}; + +static mrb_value +mrb_grn_bulk_initialize(mrb_state *mrb, mrb_value self) +{ + mrb_value mrb_bulk_ptr; + + mrb_get_args(mrb, "o", &mrb_bulk_ptr); + DATA_TYPE(self) = &mrb_grn_bulk_type; + DATA_PTR(self) = mrb_cptr(mrb_bulk_ptr); + return self; +} + +void +grn_mrb_bulk_init(grn_ctx *ctx) +{ + grn_mrb_data *data = &(ctx->impl->mrb); + mrb_state *mrb = data->state; + struct RClass *module = data->module; + struct RClass *klass; + + klass = mrb_define_class_under(mrb, module, "Bulk", mrb->object_class); + MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA); + mrb_define_method(mrb, klass, "initialize", + mrb_grn_bulk_initialize, MRB_ARGS_REQ(1)); +} +#endif Added: lib/mrb/mrb_bulk.h (+35 -0) 100644 =================================================================== --- /dev/null +++ lib/mrb/mrb_bulk.h 2014-06-08 17:32:24 +0900 (3be8658) @@ -0,0 +1,35 @@ +/* -*- 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_BULK_H +#define GRN_MRB_BULK_H + +#include "../ctx.h" +#include "../db.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void grn_mrb_bulk_init(grn_ctx *ctx); + +#ifdef __cplusplus +} +#endif + +#endif /* GRN_MRB_BULK_H */ Modified: lib/mrb/sources.am (+2 -0) =================================================================== --- lib/mrb/sources.am 2014-06-08 17:25:51 +0900 (d2a1055) +++ lib/mrb/sources.am 2014-06-08 17:32:24 +0900 (bfb3d2c) @@ -1,6 +1,8 @@ libgrnmrb_la_SOURCES = \ mrb_accessor.c \ mrb_accessor.h \ + mrb_bulk.c \ + mrb_bulk.h \ mrb_column.c \ mrb_column.h \ mrb_converter.c \ -------------- next part -------------- HTML����������������������������... Télécharger