Kouhei Sutou
null+****@clear*****
Mon Jul 6 22:39:26 JST 2015
Kouhei Sutou 2015-07-06 22:39:26 +0900 (Mon, 06 Jul 2015) New Revision: 8a8e4aa3a1a2966a8bd8a1e99c553a77326f2b06 https://github.com/groonga/groonga/commit/8a8e4aa3a1a2966a8bd8a1e99c553a77326f2b06 Message: mrb: bind GRN_COMMAND_VERSION_DEFAULT Added files: lib/mrb/mrb_command_version.c lib/mrb/mrb_command_version.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-07-06 22:20:59 +0900 (5fdbd47) +++ lib/ctx_impl_mrb.c 2015-07-06 22:39:26 +0900 (f352ea8) @@ -28,6 +28,7 @@ # include "mrb/mrb_error.h" # include "mrb/mrb_id.h" # include "mrb/mrb_operator.h" +# include "mrb/mrb_command_version.h" # include "mrb/mrb_ctx.h" # include "mrb/mrb_logger.h" # include "mrb/mrb_void.h" @@ -135,6 +136,7 @@ grn_ctx_impl_mrb_init_bindings(grn_ctx *ctx) grn_mrb_error_init(ctx); grn_mrb_id_init(ctx); grn_mrb_operator_init(ctx); + grn_mrb_command_version_init(ctx); grn_mrb_ctx_init(ctx); grn_mrb_logger_init(ctx); grn_mrb_void_init(ctx); Added: lib/mrb/mrb_command_version.c (+41 -0) 100644 =================================================================== --- /dev/null +++ lib/mrb/mrb_command_version.c 2015-07-06 22:39:26 +0900 (89ecef3) @@ -0,0 +1,41 @@ +/* -*- 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_command_version.h" + +void +grn_mrb_command_version_init(grn_ctx *ctx) +{ + grn_mrb_data *data = &(ctx->impl->mrb); + mrb_state *mrb = data->state; + struct RClass *module = data->module; + struct RClass *command_version_module; + + command_version_module = mrb_define_module_under(mrb, module, + "CommandVersion"); + + mrb_define_const(mrb, command_version_module, "DEFAULT", + mrb_fixnum_value(GRN_COMMAND_VERSION_DEFAULT)); +} +#endif Added: lib/mrb/mrb_command_version.h (+34 -0) 100644 =================================================================== --- /dev/null +++ lib/mrb/mrb_command_version.h 2015-07-06 22:39:26 +0900 (655eb80) @@ -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_COMMAND_VERSION_H +#define GRN_MRB_COMMAND_VERSION_H + +#include "../grn_ctx.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void grn_mrb_command_version_init(grn_ctx *ctx); + +#ifdef __cplusplus +} +#endif + +#endif /* GRN_MRB_COMMAND_VERSION_H */ Modified: lib/mrb/sources.am (+2 -0) =================================================================== --- lib/mrb/sources.am 2015-07-06 22:20:59 +0900 (0bb712e) +++ lib/mrb/sources.am 2015-07-06 22:39:26 +0900 (dc1a78d) @@ -11,6 +11,8 @@ libgrnmrb_la_SOURCES = \ mrb_command.h \ mrb_command_input.c \ mrb_command_input.h \ + mrb_command_version.c \ + mrb_command_version.h \ mrb_content_type.c \ mrb_content_type.h \ mrb_converter.c \ -------------- next part -------------- HTML����������������������������...Download