Kouhei Sutou
null+****@clear*****
Wed Nov 20 23:58:51 JST 2013
Kouhei Sutou 2013-11-20 23:58:51 +0900 (Wed, 20 Nov 2013) New Revision: 7cefc0f42c225a935c83886d0a30091e3de77534 https://github.com/groonga/groonga/commit/7cefc0f42c225a935c83886d0a30091e3de77534 Message: mruby: define Groonga::Column Added files: lib/mrb/mrb_column.c lib/mrb/mrb_column.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 2013-11-20 23:54:11 +0900 (11ada19) +++ lib/ctx_impl_mrb.c 2013-11-20 23:58:51 +0900 (b64a712) @@ -20,6 +20,7 @@ #include "ctx_impl.h" #include "mrb/mrb_obj.h" +#include "mrb/mrb_column.h" #include "mrb/mrb_expr.h" #include "mrb/mrb_accessor.h" @@ -33,6 +34,7 @@ grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx) ctx->impl->mrb.module = mrb_define_module(mrb, "Groonga"); grn_mrb_obj_init(ctx); + grn_mrb_column_init(ctx); grn_mrb_expr_init(ctx); grn_mrb_accessor_init(ctx); } Added: lib/mrb/mrb_column.c (+39 -0) 100644 =================================================================== --- /dev/null +++ lib/mrb/mrb_column.c 2013-11-20 23:58:51 +0900 (545f070) @@ -0,0 +1,39 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 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 "mrb_column.h" + +void +grn_mrb_column_init(grn_ctx *ctx) +{ + grn_mrb_data *data = &(ctx->impl->mrb); + mrb_state *mrb = data->state; + struct RClass *module = data->module; + struct RClass *object_class = data->object_class; + struct RClass *klass; + + klass = mrb_define_class_under(mrb, module, "Column", object_class); + MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA); +} +#endif Added: lib/mrb/mrb_column.h (+34 -0) 100644 =================================================================== --- /dev/null +++ lib/mrb/mrb_column.h 2013-11-20 23:58:51 +0900 (77e0dab) @@ -0,0 +1,34 @@ +/* -*- c-basic-offset: 2 -*- */ +/* + Copyright(C) 2013 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_COLUMN_H +#define GRN_MRB_COLUMN_H + +#include "../ctx.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void grn_mrb_column_init(grn_ctx *ctx); + +#ifdef __cplusplus +} +#endif + +#endif /* GRN_MRB_COLUMN_H */ Modified: lib/mrb/sources.am (+2 -0) =================================================================== --- lib/mrb/sources.am 2013-11-20 23:54:11 +0900 (f000430) +++ lib/mrb/sources.am 2013-11-20 23:58:51 +0900 (6d3f1ac) @@ -1,6 +1,8 @@ libgrnmrb_la_SOURCES = \ mrb_accessor.c \ mrb_accessor.h \ + mrb_column.c \ + mrb_column.h \ mrb_expr.c \ mrb_expr.h \ mrb_obj.c \ -------------- next part -------------- HTML����������������������������...Download