From null+ranguba at clear-code.com Mon Feb 7 23:49:28 2011 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 08 Feb 2011 04:49:28 +0000 Subject: [groonga-commit:3126] ranguba/rroonga [master] create received string Ruby object as soon as possible. Message-ID: <20110208045519.A51592C41DD@taiyaki.ru> Kouhei Sutou 2011-02-08 04:49:28 +0000 (Tue, 08 Feb 2011) New Revision: bc283dda1347fb6ef3d3e1dea6a8c28fabd7c80f Log: create received string Ruby object as soon as possible. Modified files: ext/groonga/rb-grn-context.c Modified: ext/groonga/rb-grn-context.c (+10 -4) =================================================================== --- ext/groonga/rb-grn-context.c 2011-01-28 07:18:35 +0000 (026636f) +++ ext/groonga/rb-grn-context.c 2011-02-08 04:49:28 +0000 (6c9d3cf) @@ -569,16 +569,22 @@ static VALUE rb_grn_context_receive (VALUE self) { grn_ctx *context; - char *string; - unsigned string_size; + char *result = NULL; + unsigned result_size; + VALUE rb_result; int flags = 0; unsigned int query_id; context = SELF(self); - query_id = grn_ctx_recv(context, &string, &string_size, &flags); + query_id = grn_ctx_recv(context, &result, &result_size, &flags); + if (result) { + rb_result = rb_str_new(result, result_size); + } else { + rb_result = Qnil; + } rb_grn_context_check(context, self); - return rb_ary_new3(2, UINT2NUM(query_id), rb_str_new(string, string_size)); + return rb_ary_new3(2, UINT2NUM(query_id), rb_result); } static const char * From null+ranguba at clear-code.com Tue Feb 8 00:49:28 2011 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 08 Feb 2011 05:49:28 +0000 Subject: [groonga-commit:3127] ranguba/rroonga [master] add Groonga::Plugin.register. Message-ID: <20110208055203.800E42C416A@taiyaki.ru> Kouhei Sutou 2011-02-08 05:49:28 +0000 (Tue, 08 Feb 2011) New Revision: 4df95c295792d0f4e6c664d3b5937c54f6b253ed Log: add Groonga::Plugin.register. Added files: ext/groonga/rb-grn-plugin.c test/test-plugin.rb Modified files: ext/groonga/rb-grn.h ext/groonga/rb-groonga.c lib/groonga/context.rb Added: ext/groonga/rb-grn-plugin.c (+134 -0) 100644 =================================================================== --- /dev/null +++ ext/groonga/rb-grn-plugin.c 2011-02-08 05:49:28 +0000 (d76b18a) @@ -0,0 +1,134 @@ +/* -*- c-file-style: "ruby" -*- */ +/* + Copyright (C) 2011 Kouhei Sutou + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "rb-grn.h" + +#define SELF(object) (RVAL2GRNCONTEXT(object)) + +static VALUE cGrnPlugin; + +/* + * Document-class: Groonga::Plugin + * + * ?????????????Ruby?groonga????????? + * ?????????C??????????????????? + * ??????????? + */ + +grn_id +rb_grn_plugin_from_ruby_object (VALUE object) +{ + RbGrnPlugin *rb_grn_plugin; + + if (!RVAL2CBOOL(rb_obj_is_kind_of(object, cGrnPlugin))) { + rb_raise(rb_eTypeError, "not a groonga plugin"); + } + + Data_Get_Struct(object, RbGrnPlugin, rb_grn_plugin); + if (!rb_grn_plugin) + rb_raise(rb_eGrnError, "groonga plugin is NULL"); + return rb_grn_plugin->id; +} + +void +rb_grn_plugin_fin (grn_id id) +{ +} + +static void +rb_grn_plugin_free (void *pointer) +{ + RbGrnPlugin *rb_grn_plugin = pointer; + + xfree(rb_grn_plugin); +} + +static VALUE +rb_grn_plugin_alloc (VALUE klass) +{ + return Data_Wrap_Struct(klass, NULL, rb_grn_plugin_free, NULL); +} + +/* + * call-seq: + * Groonga::Plugin.register(name, options=nil) + * Groonga::Plugin.register({:path => path, :context => nil}) + * + * ????????????????????? + * + * _name_???????????????????????? + * + * _path_???????????????????????? + * + * _options_???????????????????????? + * ??????????? + * + * [+:context+] + * ???????????????????????? + * Groonga::Context.default?????? + */ +static VALUE +rb_grn_plugin_s_register (int argc, VALUE *argv, VALUE klass) +{ + const char *name = NULL, *path = NULL; + VALUE rb_options, rb_name = Qnil, rb_path, rb_context; + grn_ctx *context; + + if (argc >= 1) { + rb_name = rb_check_string_type(argv[0]); + } + + if (NIL_P(rb_name)) { + rb_scan_args(argc, argv, "01", &rb_options); + rb_grn_scan_options(rb_options, + "path", &rb_path, + "context", &rb_context, + NULL); + path = StringValueCStr(rb_path); + } else { + rb_scan_args(argc, argv, "11", &rb_name, &rb_options); + rb_grn_scan_options(rb_options, + "context", &rb_context, + NULL); + name = StringValueCStr(rb_name); + } + + if (NIL_P(rb_context)) { + rb_context = rb_grn_context_get_default(); + } + context = RVAL2GRNCONTEXT(rb_context); + + if (name) { + grn_plugin_register(context, name); + } else { + grn_plugin_register_by_path(context, path); + } + + rb_grn_context_check(context, rb_ary_new4(argc, argv)); + return Qnil; +} + +void +rb_grn_init_plugin (VALUE mGrn) +{ + cGrnPlugin = rb_define_class_under(mGrn, "Plugin", rb_cObject); + rb_define_alloc_func(cGrnPlugin, rb_grn_plugin_alloc); + + rb_define_singleton_method(cGrnPlugin, "register", + rb_grn_plugin_s_register, -1); +} Modified: ext/groonga/rb-grn.h (+11 -1) =================================================================== --- ext/groonga/rb-grn.h 2011-02-08 04:49:28 +0000 (9f86839) +++ ext/groonga/rb-grn.h 2011-02-08 05:49:28 +0000 (bcbfda1) @@ -1,6 +1,6 @@ /* -*- c-file-style: "ruby" -*- */ /* - Copyright (C) 2009-2010 Kouhei Sutou + Copyright (C) 2009-2011 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -174,6 +174,14 @@ struct _RbGrnExpression grn_obj *value; }; +typedef struct _RbGrnPlugin RbGrnPlugin; +struct _RbGrnPlugin +{ + VALUE self; + grn_ctx *context; + grn_id id; +}; + RB_GRN_VAR grn_bool rb_grn_exited; RB_GRN_VAR VALUE rb_eGrnError; @@ -213,6 +221,7 @@ RB_GRN_VAR VALUE rb_cGrnOperator; RB_GRN_VAR VALUE rb_cGrnExpression; RB_GRN_VAR VALUE rb_cGrnRecordExpressionBuilder; RB_GRN_VAR VALUE rb_cGrnColumnExpressionBuilder; +RB_GRN_VAR VALUE rb_cGrnPlugin; void rb_grn_init_utils (VALUE mGrn); void rb_grn_init_exception (VALUE mGrn); @@ -250,6 +259,7 @@ void rb_grn_init_expression (VALUE mGrn); void rb_grn_init_expression_builder (VALUE mGrn); void rb_grn_init_logger (VALUE mGrn); void rb_grn_init_snippet (VALUE mGrn); +void rb_grn_init_plugin (VALUE mGrn); VALUE rb_grn_rc_to_exception (grn_rc rc); const char *rb_grn_rc_to_message (grn_rc rc); Modified: ext/groonga/rb-groonga.c (+2 -1) =================================================================== --- ext/groonga/rb-groonga.c 2011-02-08 04:49:28 +0000 (4ae3859) +++ ext/groonga/rb-groonga.c 2011-02-08 05:49:28 +0000 (45dde55) @@ -1,6 +1,6 @@ /* -*- c-file-style: "ruby" -*- */ /* - Copyright (C) 2009-2010 Kouhei Sutou + Copyright (C) 2009-2011 Kouhei Sutou This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -143,4 +143,5 @@ Init_groonga (void) rb_grn_init_expression_builder(mGrn); rb_grn_init_logger(mGrn); rb_grn_init_snippet(mGrn); + rb_grn_init_plugin(mGrn); } Modified: lib/groonga/context.rb (+18 -1) =================================================================== --- lib/groonga/context.rb 2011-02-08 04:49:28 +0000 (9fc4cde) +++ lib/groonga/context.rb 2011-02-08 05:49:28 +0000 (1d942ab) @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2010 Kouhei Sutou +# Copyright (C) 2010-2011 Kouhei Sutou # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -52,6 +52,23 @@ module Groonga end # call-seq: + # context.register_plugin(name) + # context.register_plugin({:path => path}) + # + # groonga????????????????????_name_ + # ??????_path_?????????????????? + # ????????????????????? + def register_plugin(name_or_options) + options = {:context => self} + if name_or_options.is_a?(String) + name = name_or_options + Plugin.register(name, options) + else + Plugin.register(name_or_options.merge(options)) + end + end + + # call-seq: # context.select(table, options={}) -> SelectResult # # _table_??????????????????????? Added: test/test-plugin.rb (+29 -0) 100644 =================================================================== --- /dev/null +++ test/test-plugin.rb 2011-02-08 05:49:28 +0000 (1af5399) @@ -0,0 +1,29 @@ +# Copyright (C) 2011 Kouhei Sutou +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +class PluginTest < Test::Unit::TestCase + include GroongaTestUtils + + setup :setup_sandbox + setup :setup_database + teardown :teardown_sandbox + + def test_register + context = Groonga::Context.default + assert_nil(context["suggest"]) + context.register_plugin("suggest/suggest") + assert_not_nil(context["suggest"]) + end +end From null+ranguba at clear-code.com Tue Feb 8 00:52:15 2011 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 08 Feb 2011 05:52:15 +0000 Subject: [groonga-commit:3128] ranguba/rroonga [master] require groonga 1.1.0 or later. Message-ID: <20110208055450.728312C416A@taiyaki.ru> Kouhei Sutou 2011-02-08 05:52:15 +0000 (Tue, 08 Feb 2011) New Revision: 599189e8e0a8ee948fdcebbbcf5a788fc4fadd16 Log: require groonga 1.1.0 or later. Modified files: README.ja.rdoc README.rdoc rroonga-build.rb Modified: README.ja.rdoc (+2 -2) =================================================================== --- README.ja.rdoc 2011-02-08 05:49:28 +0000 (6e43574) +++ README.ja.rdoc 2011-02-08 05:52:15 +0000 (44cb380) @@ -35,8 +35,8 @@ LGPL 2.1???????license/LGPL???????? == ???????? -* Ruby >= 1.8 ?1.9.1, 1.9.2??? -* groonga >= 1.0.4 +* Ruby >= 1.8 ?1.9.2??? +* groonga >= 1.1.0 == ?????? Modified: README.rdoc (+2 -2) =================================================================== --- README.rdoc 2011-02-08 05:49:28 +0000 (f77daeb) +++ README.rdoc 2011-02-08 05:52:15 +0000 (eb676c9) @@ -35,8 +35,8 @@ inclidng contributed patches.) == Dependencies -* Ruby >= 1.8 (including 1.9.1 and 1.9.2) -* groonga >= 1.0.4 +* Ruby >= 1.8 (including 1.9.2) +* groonga >= 1.1.0 == Install Modified: rroonga-build.rb (+2 -2) =================================================================== --- rroonga-build.rb 2011-02-08 05:49:28 +0000 (42b3cea) +++ rroonga-build.rb 2011-02-08 05:52:15 +0000 (f9e33db) @@ -18,8 +18,8 @@ module RroongaBuild module RequiredGroongaVersion MAJOR = 1 - MINOR = 0 - MICRO = 7 + MINOR = 1 + MICRO = 0 VERSION = [MAJOR, MINOR, MICRO] end From null+ranguba at clear-code.com Tue Feb 8 02:48:50 2011 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 08 Feb 2011 07:48:50 +0000 Subject: [groonga-commit:3129] ranguba/rroonga [master] add 1.1.0 entry. Message-ID: <20110208075129.B89172C416A@taiyaki.ru> Kouhei Sutou 2011-02-08 07:48:50 +0000 (Tue, 08 Feb 2011) New Revision: c4bf0e8a31034d3c73490c7b92d234bfdc18adb5 Log: add 1.1.0 entry. Modified files: NEWS.ja.rdoc NEWS.rdoc Modified: NEWS.ja.rdoc (+7 -0) =================================================================== --- NEWS.ja.rdoc 2011-02-08 05:52:15 +0000 (202581f) +++ NEWS.ja.rdoc 2011-02-08 07:48:50 +0000 (0879378) @@ -1,5 +1,12 @@ = ???? +== 1.1.0: 2011-02-09 + +=== ?? + +* groonga 1.1.0??? +* Groonga::Plugin.register???? + == 1.0.9: 2011-01-29 === ?? Modified: NEWS.rdoc (+7 -0) =================================================================== --- NEWS.rdoc 2011-02-08 05:52:15 +0000 (69a9e97) +++ NEWS.rdoc 2011-02-08 07:48:50 +0000 (93ae7a9) @@ -1,5 +1,12 @@ = NEWS +== 1.1.0: 2011-02-09 + +=== Improvements + +* Supported groonga 1.1.0. +* Added Groonga::Plugin.register. + == 1.0.9: 2011-01-29 === Improvements From null+ranguba at clear-code.com Tue Feb 8 02:51:35 2011 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 08 Feb 2011 07:51:35 +0000 Subject: [groonga-commit:3130] ranguba/rroonga [master] 1.0.9 -> 1.1.0. Message-ID: <20110208075412.3F0EA2C416A@taiyaki.ru> Kouhei Sutou 2011-02-08 07:51:35 +0000 (Tue, 08 Feb 2011) New Revision: 1e07390c939d3963428dab5f6c5811902bd2a02f Log: 1.0.9 -> 1.1.0. Modified files: html/index.html Modified: html/index.html (+1 -1) =================================================================== --- html/index.html 2011-02-08 07:48:50 +0000 (6f53c4f) +++ html/index.html 2011-02-08 07:51:35 +0000 (bc01f2a) @@ -49,7 +49,7 @@

rroonga???????

- 2011-01-29????????1.0.9?????? + 2011-02-09????????1.1.0??????

rroonga???????

From null+ranguba at clear-code.com Tue Feb 8 04:19:22 2011 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 08 Feb 2011 09:19:22 +0000 Subject: [groonga-commit:3131] ranguba/rroonga [master] use GitHub logo. Message-ID: <20110208092157.AF0992C41DD@taiyaki.ru> Kouhei Sutou 2011-02-08 09:19:22 +0000 (Tue, 08 Feb 2011) New Revision: f12c75c16478cdebed4d8d48ddae8a67e9775e5c Log: use GitHub logo. Added files: html/github-logo.png Modified files: html/index.html html/ranguba.css Added: html/github-logo.png (+0 -0) 100644 =================================================================== (Binary files differ) Modified: html/index.html (+1 -1) =================================================================== --- html/index.html 2011-02-08 09:12:43 +0000 (bc01f2a) +++ html/index.html 2011-02-08 09:19:22 +0000 (40a4e65) @@ -216,7 +216,7 @@

ChupaText???????

- 2010-12-26????????0.8.0?????? + 2011-02-09????????0.9.0??????

- [??????] - [???] + [??????] + [???]

ChupaText???????

From null+ranguba at clear-code.com Tue Feb 8 05:03:20 2011 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Tue, 08 Feb 2011 10:03:20 +0000 Subject: [groonga-commit:3136] ranguba/chupatext [master] 0.9.0 -> 1.0.0. Message-ID: <20110208100556.EA0762C416A@taiyaki.ru> Kouhei Sutou 2011-02-08 10:03:20 +0000 (Tue, 08 Feb 2011) New Revision: 443b38fcccc4592532930c67118ee8cf1eab93b6 Log: 0.9.0 -> 1.0.0. Modified files: configure.ac Modified: configure.ac (+2 -2) =================================================================== --- configure.ac 2011-02-08 09:37:19 +0000 (3a13a21) +++ configure.ac 2011-02-08 10:03:20 +0000 (76b2e45) @@ -1,7 +1,7 @@ AC_PREREQ(2.59) -m4_define([chupa_version_major], [0]) -m4_define([chupa_version_minor], [9]) +m4_define([chupa_version_major], [1]) +m4_define([chupa_version_minor], [0]) m4_define([chupa_version_micro], [0]) m4_define([chupa_version_full], [chupa_version_major.chupa_version_minor.chupa_version_micro]) From null+ranguba at clear-code.com Wed Feb 9 00:38:40 2011 From: null+ranguba at clear-code.com (null+ranguba at clear-code.com) Date: Wed, 09 Feb 2011 05:38:40 +0000 Subject: [groonga-commit:3137] ranguba/chupatext [master] use GitHub logo. Message-ID: <20110209054122.0DDD22C4010@taiyaki.ru> Kouhei Sutou 2011-02-09 05:38:40 +0000 (Wed, 09 Feb 2011) New Revision: 3f1d834ecde34edfdd55688e27d9772930665c78 Log: use GitHub logo. Modified files: doc/reference/footer-ja.html doc/reference/footer.html Modified: doc/reference/footer-ja.html (+1 -1) =================================================================== --- doc/reference/footer-ja.html 2011-02-08 10:03:20 +0000 (ea0b7e6) +++ doc/reference/footer-ja.html 2011-02-09 05:38:40 +0000 (6c39987) @@ -8,7 +8,7 @@