[Groonga-commit] groonga/groonga at ab686ac [master] Split grn_expr related function declarations

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Nov 3 15:12:17 JST 2014


Kouhei Sutou	2014-11-03 15:12:17 +0900 (Mon, 03 Nov 2014)

  New Revision: ab686acd2fed98f20d20fd5be1f3daef2ceb2e50
  https://github.com/groonga/groonga/commit/ab686acd2fed98f20d20fd5be1f3daef2ceb2e50

  Message:
    Split grn_expr related function declarations

  Added files:
    include/groonga/expr.h
  Modified files:
    include/groonga.h
    include/groonga/Makefile.am
    include/groonga/groonga.h

  Modified: include/groonga.h (+1 -0)
===================================================================
--- include/groonga.h    2014-11-03 14:15:14 +0900 (70b5709)
+++ include/groonga.h    2014-11-03 15:12:17 +0900 (ecf724d)
@@ -19,6 +19,7 @@
 #define GROONGA_H
 
 #include <groonga/groonga.h>
+#include <groonga/expr.h>
 #include <groonga/util.h>
 
 #endif /* GROONGA_H */

  Modified: include/groonga/Makefile.am (+1 -0)
===================================================================
--- include/groonga/Makefile.am    2014-11-03 14:15:14 +0900 (09d96d6)
+++ include/groonga/Makefile.am    2014-11-03 15:12:17 +0900 (c1078d5)
@@ -1,5 +1,6 @@
 groonga_includedir = $(pkgincludedir)/groonga
 groonga_include_HEADERS =			\
+	expr.h					\
 	groonga.h				\
 	plugin.h				\
 	tokenizer.h				\

  Added: include/groonga/expr.h (+107 -0) 100644
===================================================================
--- /dev/null
+++ include/groonga/expr.h    2014-11-03 15:12:17 +0900 (7855c44)
@@ -0,0 +1,107 @@
+/*
+  Copyright(C) 2009-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 as published by the Free Software Foundation; either
+  version 2.1 of the License, or (at your option) any later version.
+
+  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 GROONGA_EXPR_H
+#define GROONGA_EXPR_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_obj *grn_expr_create(grn_ctx *ctx, const char *name, unsigned int name_size);
+GRN_API grn_rc grn_expr_close(grn_ctx *ctx, grn_obj *expr);
+GRN_API grn_obj *grn_expr_add_var(grn_ctx *ctx, grn_obj *expr,
+                                  const char *name, unsigned int name_size);
+GRN_API grn_obj *grn_expr_get_var(grn_ctx *ctx, grn_obj *expr,
+                                  const char *name, unsigned int name_size);
+GRN_API grn_obj *grn_expr_get_var_by_offset(grn_ctx *ctx, grn_obj *expr, unsigned int offset);
+GRN_API grn_rc grn_expr_clear_vars(grn_ctx *ctx, grn_obj *expr);
+
+
+GRN_API grn_obj *grn_expr_append_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj,
+                                     grn_operator op, int nargs);
+GRN_API grn_obj *grn_expr_append_const(grn_ctx *ctx, grn_obj *expr, grn_obj *obj,
+                                       grn_operator op, int nargs);
+GRN_API grn_obj *grn_expr_append_const_str(grn_ctx *ctx, grn_obj *expr,
+                                           const char *str, unsigned int str_size,
+                                           grn_operator op, int nargs);
+GRN_API grn_obj *grn_expr_append_const_int(grn_ctx *ctx, grn_obj *expr, int i,
+                                           grn_operator op, int nargs);
+GRN_API grn_rc grn_expr_append_op(grn_ctx *ctx, grn_obj *expr, grn_operator op, int nargs);
+
+GRN_API grn_rc grn_expr_get_keywords(grn_ctx *ctx, grn_obj *expr, grn_obj *keywords);
+
+GRN_API grn_rc grn_expr_syntax_escape(grn_ctx *ctx,
+                                      const char *query, int query_size,
+                                      const char *target_characters,
+                                      char escape_character,
+                                      grn_obj *escaped_query);
+GRN_API grn_rc grn_expr_syntax_escape_query(grn_ctx *ctx,
+                                            const char *query, int query_size,
+                                            grn_obj *escaped_query);
+
+GRN_API grn_rc grn_expr_compile(grn_ctx *ctx, grn_obj *expr);
+GRN_API grn_obj *grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs);
+
+GRN_API grn_obj *grn_expr_alloc(grn_ctx *ctx, grn_obj *expr,
+                                grn_id domain, grn_obj_flags flags);
+
+#define GRN_EXPR_CREATE_FOR_QUERY(ctx,table,expr,var) do {\
+  if (((expr) = grn_expr_create((ctx), NULL, 0)) &&\
+      ((var) = grn_expr_add_var((ctx), (expr), NULL, 0))) {\
+    GRN_RECORD_INIT((var), 0, grn_obj_id((ctx), (table)));\
+  } else {\
+    (var) = NULL;\
+  }\
+} while (0)
+
+typedef unsigned int grn_expr_flags;
+
+#define GRN_EXPR_SYNTAX_QUERY          (0x00)
+#define GRN_EXPR_SYNTAX_SCRIPT         (0x01)
+#define GRN_EXPR_SYNTAX_OUTPUT_COLUMNS (0x20)
+#define GRN_EXPR_SYNTAX_ADJUSTER       (0x40)
+#define GRN_EXPR_ALLOW_PRAGMA          (0x02)
+#define GRN_EXPR_ALLOW_COLUMN          (0x04)
+#define GRN_EXPR_ALLOW_UPDATE          (0x08)
+#define GRN_EXPR_ALLOW_LEADING_NOT     (0x10)
+
+GRN_API grn_rc grn_expr_parse(grn_ctx *ctx, grn_obj *expr,
+                              const char *str, unsigned int str_size,
+                              grn_obj *default_column, grn_operator default_mode,
+                              grn_operator default_op, grn_expr_flags flags);
+
+GRN_API grn_obj *grn_expr_snip(grn_ctx *ctx, grn_obj *expr, int flags,
+                               unsigned int width, unsigned int max_results,
+                               unsigned int n_tags,
+                               const char **opentags, unsigned int *opentag_lens,
+                               const char **closetags, unsigned int *closetag_lens,
+                               grn_snip_mapping *mapping);
+GRN_API grn_rc grn_expr_snip_add_conditions(grn_ctx *ctx,
+                                            grn_obj *expr,
+                                            grn_obj *snip,
+                                            unsigned int n_tags,
+                                            const char **opentags,
+                                            unsigned int *opentag_lens,
+                                            const char **closetags,
+                                            unsigned int *closetag_lens);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GROONGA_EXPR_H */

  Modified: include/groonga/groonga.h (+0 -79)
===================================================================
--- include/groonga/groonga.h    2014-11-03 14:15:14 +0900 (3812650)
+++ include/groonga/groonga.h    2014-11-03 15:12:17 +0900 (f25bbf5)
@@ -1684,94 +1684,15 @@ GRN_API grn_encoding grn_string_get_encoding(grn_ctx *ctx, grn_obj *string);
 
 GRN_API int grn_charlen(grn_ctx *ctx, const char *str, const char *end);
 
-/* expr */
-
-GRN_API grn_obj *grn_expr_create(grn_ctx *ctx, const char *name, unsigned int name_size);
-GRN_API grn_rc grn_expr_close(grn_ctx *ctx, grn_obj *expr);
-GRN_API grn_obj *grn_expr_add_var(grn_ctx *ctx, grn_obj *expr,
-                                  const char *name, unsigned int name_size);
-GRN_API grn_obj *grn_expr_get_var(grn_ctx *ctx, grn_obj *expr,
-                                  const char *name, unsigned int name_size);
-GRN_API grn_obj *grn_expr_get_var_by_offset(grn_ctx *ctx, grn_obj *expr, unsigned int offset);
-GRN_API grn_rc grn_expr_clear_vars(grn_ctx *ctx, grn_obj *expr);
-
-
-GRN_API grn_obj *grn_expr_append_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj,
-                                     grn_operator op, int nargs);
-GRN_API grn_obj *grn_expr_append_const(grn_ctx *ctx, grn_obj *expr, grn_obj *obj,
-                                       grn_operator op, int nargs);
-GRN_API grn_obj *grn_expr_append_const_str(grn_ctx *ctx, grn_obj *expr,
-                                           const char *str, unsigned int str_size,
-                                           grn_operator op, int nargs);
-GRN_API grn_obj *grn_expr_append_const_int(grn_ctx *ctx, grn_obj *expr, int i,
-                                           grn_operator op, int nargs);
-GRN_API grn_rc grn_expr_append_op(grn_ctx *ctx, grn_obj *expr, grn_operator op, int nargs);
-
-GRN_API grn_rc grn_expr_get_keywords(grn_ctx *ctx, grn_obj *expr, grn_obj *keywords);
-
-GRN_API grn_rc grn_expr_syntax_escape(grn_ctx *ctx,
-                                      const char *query, int query_size,
-                                      const char *target_characters,
-                                      char escape_character,
-                                      grn_obj *escaped_query);
-GRN_API grn_rc grn_expr_syntax_escape_query(grn_ctx *ctx,
-                                            const char *query, int query_size,
-                                            grn_obj *escaped_query);
-
-GRN_API grn_rc grn_expr_compile(grn_ctx *ctx, grn_obj *expr);
-GRN_API grn_obj *grn_expr_exec(grn_ctx *ctx, grn_obj *expr, int nargs);
 GRN_API grn_rc grn_ctx_push(grn_ctx *ctx, grn_obj *obj);
 GRN_API grn_obj *grn_ctx_pop(grn_ctx *ctx);
 
-GRN_API grn_obj *grn_expr_alloc(grn_ctx *ctx, grn_obj *expr,
-                                grn_id domain, grn_obj_flags flags);
-
 GRN_API grn_obj *grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
                                   grn_obj *res, grn_operator op);
 
 GRN_API int grn_obj_columns(grn_ctx *ctx, grn_obj *table,
                             const char *str, unsigned int str_size, grn_obj *res);
 
-#define GRN_EXPR_CREATE_FOR_QUERY(ctx,table,expr,var) do {\
-  if (((expr) = grn_expr_create((ctx), NULL, 0)) &&\
-      ((var) = grn_expr_add_var((ctx), (expr), NULL, 0))) {\
-    GRN_RECORD_INIT((var), 0, grn_obj_id((ctx), (table)));\
-  } else {\
-    (var) = NULL;\
-  }\
-} while (0)
-
-typedef unsigned int grn_expr_flags;
-
-#define GRN_EXPR_SYNTAX_QUERY          (0x00)
-#define GRN_EXPR_SYNTAX_SCRIPT         (0x01)
-#define GRN_EXPR_SYNTAX_OUTPUT_COLUMNS (0x20)
-#define GRN_EXPR_SYNTAX_ADJUSTER       (0x40)
-#define GRN_EXPR_ALLOW_PRAGMA          (0x02)
-#define GRN_EXPR_ALLOW_COLUMN          (0x04)
-#define GRN_EXPR_ALLOW_UPDATE          (0x08)
-#define GRN_EXPR_ALLOW_LEADING_NOT     (0x10)
-
-GRN_API grn_rc grn_expr_parse(grn_ctx *ctx, grn_obj *expr,
-                              const char *str, unsigned int str_size,
-                              grn_obj *default_column, grn_operator default_mode,
-                              grn_operator default_op, grn_expr_flags flags);
-
-GRN_API grn_obj *grn_expr_snip(grn_ctx *ctx, grn_obj *expr, int flags,
-                               unsigned int width, unsigned int max_results,
-                               unsigned int n_tags,
-                               const char **opentags, unsigned int *opentag_lens,
-                               const char **closetags, unsigned int *closetag_lens,
-                               grn_snip_mapping *mapping);
-GRN_API grn_rc grn_expr_snip_add_conditions(grn_ctx *ctx,
-                                            grn_obj *expr,
-                                            grn_obj *snip,
-                                            unsigned int n_tags,
-                                            const char **opentags,
-                                            unsigned int *opentag_lens,
-                                            const char **closetags,
-                                            unsigned int *closetag_lens);
-
 GRN_API grn_table_sort_key *grn_table_sort_key_from_str(grn_ctx *ctx,
                                                         const char *str, unsigned int str_size,
                                                         grn_obj *table, unsigned int *nkeys);
-------------- next part --------------
HTML����������������������������...
下載 



More information about the Groonga-commit mailing list
Back to archive index