Kouhei Sutou
null+****@clear*****
Sun Nov 2 13:49:53 JST 2014
Kouhei Sutou 2014-11-02 13:49:53 +0900 (Sun, 02 Nov 2014) New Revision: 6d2bf6605c93380820a3b36c4f9b0be7b7a6befa https://github.com/groonga/groonga/commit/6d2bf6605c93380820a3b36c4f9b0be7b7a6befa Message: Add grn_operator_to_string() for debug Added files: lib/operator.c Modified files: include/groonga.h lib/sources.am Modified: include/groonga.h (+2 -0) =================================================================== --- include/groonga.h 2014-11-01 17:18:44 +0900 (116ecb4) +++ include/groonga.h 2014-11-02 13:49:53 +0900 (adb6dc1) @@ -707,6 +707,8 @@ typedef enum { GRN_OP_GET_MEMBER } grn_operator; +GRN_API const char *grn_operator_to_string(grn_operator op); + struct _grn_table_group_result { grn_obj *table; unsigned char key_begin; Added: lib/operator.c (+109 -0) 100644 =================================================================== --- /dev/null +++ lib/operator.c 2014-11-02 13:49:53 +0900 (9587b58) @@ -0,0 +1,109 @@ +/* -*- 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.h" + +static const char *operator_names[] = { + "push", + "pop", + "nop", + "call", + "intern", + "get_ref", + "get_value", + "and", + "and_not", + "or", + "assign", + "star_assign", + "slash_assign", + "mod_assign", + "plus_assign", + "minus_assign", + "shiftl_assign", + "shiftr_assign", + "shiftrr_assign", + "and_assign", + "xor_assign", + "or_assign", + "jump", + "cjump", + "comma", + "bitwise_or", + "bitwise_xor", + "bitwise_and", + "bitwise_not", + "equal", + "not_equal", + "less", + "greater", + "less_equal", + "greater_equal", + "in", + "match", + "near", + "near2", + "similar", + "term_extract", + "shiftl", + "shiftr", + "shiftrr", + "plus", + "minus", + "star", + "slash", + "mod", + "delete", + "incr", + "decr", + "incr_post", + "decr_post", + "not", + "adjust", + "exact", + "lcp", + "partial", + "unsplit", + "prefix", + "suffix", + "geo_distance1", + "geo_distance2", + "geo_distance3", + "geo_distance4", + "geo_withinp5", + "geo_withinp6", + "geo_withinp8", + "obj_search", + "expr_get_var", + "table_create", + "table_select", + "table_sort", + "table_group", + "json_put", + "get_member" +}; + +const char * +grn_operator_to_string(grn_operator op) +{ + if (GRN_OP_PUSH <= op && op <= GRN_OP_GET_MEMBER) { + return operator_names[op]; + } else { + return "unknown"; + } +} Modified: lib/sources.am (+1 -0) =================================================================== --- lib/sources.am 2014-11-01 17:18:44 +0900 (2812faf) +++ lib/sources.am 2014-11-02 13:49:53 +0900 (c51b1e1) @@ -28,6 +28,7 @@ libgroonga_la_SOURCES = \ nfkc.c \ normalizer.c \ grn_normalizer.h \ + operator.c \ output.c \ grn_output.h \ pat.c \ -------------- next part -------------- HTML����������������������������... Télécharger