summaryrefslogtreecommitdiffstats
path: root/storage/mroonga/vendor/groonga/include
diff options
context:
space:
mode:
Diffstat (limited to 'storage/mroonga/vendor/groonga/include')
-rw-r--r--storage/mroonga/vendor/groonga/include/CMakeLists.txt18
-rw-r--r--storage/mroonga/vendor/groonga/include/Makefile.am8
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga.h53
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga.hpp21
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/Makefile.am43
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/accessor.h34
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/array.h89
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/arrow.h38
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/arrow.hpp21
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/cache.h49
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/column.h29
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/command.h79
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/config.h65
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/dat.h100
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/db.h68
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/dump.h34
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/error.h29
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/expr.h123
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/file_reader.h37
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/geo.h36
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/groonga.h1700
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/hash.h104
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/id.h31
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/ii.h69
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/nfkc.h31
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/normalizer.h53
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/obj.h81
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/operator.h49
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/output.h124
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/pat.h102
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/plugin.h217
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/portability.h201
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/request_canceler.h37
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/request_timer.h53
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/scorer.h93
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/table.h246
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/thread.h39
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/time.h61
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/token.h135
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/token_filter.h67
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/tokenizer.h260
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/type.h40
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/util.h44
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/window_function.h73
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/windows.h31
-rw-r--r--storage/mroonga/vendor/groonga/include/groonga/windows_event_logger.h30
46 files changed, 4945 insertions, 0 deletions
diff --git a/storage/mroonga/vendor/groonga/include/CMakeLists.txt b/storage/mroonga/vendor/groonga/include/CMakeLists.txt
new file mode 100644
index 00000000..791395f7
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/CMakeLists.txt
@@ -0,0 +1,18 @@
+# Copyright(C) 2012 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-1335 USA
+
+install(FILES groonga.h DESTINATION "${GRN_INCLUDE_DIR}")
+install(DIRECTORY groonga DESTINATION "${GRN_INCLUDE_DIR}"
+ FILES_MATCHING PATTERN "*.h")
diff --git a/storage/mroonga/vendor/groonga/include/Makefile.am b/storage/mroonga/vendor/groonga/include/Makefile.am
new file mode 100644
index 00000000..c7dee710
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/Makefile.am
@@ -0,0 +1,8 @@
+SUBDIRS = groonga
+
+pkginclude_HEADERS = \
+ groonga.h \
+ groonga.hpp
+
+EXTRA_DIST = \
+ CMakeLists.txt
diff --git a/storage/mroonga/vendor/groonga/include/groonga.h b/storage/mroonga/vendor/groonga/include/groonga.h
new file mode 100644
index 00000000..4476eb1e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga.h
@@ -0,0 +1,53 @@
+/*
+ Copyright(C) 2014-2017 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-1335 USA
+*/
+
+#pragma once
+
+#include "groonga/portability.h"
+#include "groonga/groonga.h"
+
+#include "groonga/accessor.h"
+#include "groonga/array.h"
+#include "groonga/arrow.h"
+#include "groonga/cache.h"
+#include "groonga/column.h"
+#include "groonga/config.h"
+#include "groonga/dat.h"
+#include "groonga/db.h"
+#include "groonga/dump.h"
+#include "groonga/error.h"
+#include "groonga/expr.h"
+#include "groonga/file_reader.h"
+#include "groonga/geo.h"
+#include "groonga/hash.h"
+#include "groonga/id.h"
+#include "groonga/ii.h"
+#include "groonga/obj.h"
+#include "groonga/operator.h"
+#include "groonga/output.h"
+#include "groonga/pat.h"
+#include "groonga/request_canceler.h"
+#include "groonga/request_timer.h"
+#include "groonga/table.h"
+#include "groonga/thread.h"
+#include "groonga/time.h"
+#include "groonga/type.h"
+#include "groonga/util.h"
+#include "groonga/window_function.h"
+#include "groonga/windows.h"
+#include "groonga/windows_event_logger.h"
diff --git a/storage/mroonga/vendor/groonga/include/groonga.hpp b/storage/mroonga/vendor/groonga/include/groonga.hpp
new file mode 100644
index 00000000..010ea41b
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga.hpp
@@ -0,0 +1,21 @@
+/*
+ Copyright(C) 2017 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-1335 USA
+*/
+
+#pragma once
+
+#include "groonga.h"
diff --git a/storage/mroonga/vendor/groonga/include/groonga/Makefile.am b/storage/mroonga/vendor/groonga/include/groonga/Makefile.am
new file mode 100644
index 00000000..7cc4d56e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/Makefile.am
@@ -0,0 +1,43 @@
+groonga_includedir = $(pkgincludedir)/groonga
+groonga_include_HEADERS = \
+ accessor.h \
+ array.h \
+ arrow.h \
+ arrow.hpp \
+ cache.h \
+ column.h \
+ command.h \
+ config.h \
+ dat.h \
+ db.h \
+ dump.h \
+ error.h \
+ expr.h \
+ file_reader.h \
+ hash.h \
+ geo.h \
+ groonga.h \
+ id.h \
+ ii.h \
+ obj.h \
+ operator.h \
+ output.h \
+ pat.h \
+ plugin.h \
+ portability.h \
+ request_canceler.h \
+ request_timer.h \
+ scorer.h \
+ table.h \
+ thread.h \
+ time.h \
+ token.h \
+ tokenizer.h \
+ token_filter.h \
+ type.h \
+ nfkc.h \
+ normalizer.h \
+ util.h \
+ window_function.h \
+ windows.h \
+ windows_event_logger.h
diff --git a/storage/mroonga/vendor/groonga/include/groonga/accessor.h b/storage/mroonga/vendor/groonga/include/groonga/accessor.h
new file mode 100644
index 00000000..4fc062c5
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/accessor.h
@@ -0,0 +1,34 @@
+/*
+ Copyright(C) 2012-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_rc grn_accessor_resolve(grn_ctx *ctx,
+ grn_obj *accessor,
+ int deep,
+ grn_obj *base_res,
+ grn_obj *res,
+ grn_operator op);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/array.h b/storage/mroonga/vendor/groonga/include/groonga/array.h
new file mode 100644
index 00000000..c16ef216
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/array.h
@@ -0,0 +1,89 @@
+/*
+ Copyright(C) 2009-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _grn_array grn_array;
+typedef struct _grn_array_cursor grn_array_cursor;
+
+GRN_API grn_array *grn_array_create(grn_ctx *ctx, const char *path,
+ unsigned int value_size, unsigned int flags);
+GRN_API grn_array *grn_array_open(grn_ctx *ctx, const char *path);
+GRN_API grn_rc grn_array_close(grn_ctx *ctx, grn_array *array);
+GRN_API grn_id grn_array_add(grn_ctx *ctx, grn_array *array, void **value);
+GRN_API grn_id grn_array_push(grn_ctx *ctx, grn_array *array,
+ void (*func)(grn_ctx *ctx, grn_array *array,
+ grn_id id, void *func_arg),
+ void *func_arg);
+GRN_API grn_id grn_array_pull(grn_ctx *ctx, grn_array *array, grn_bool blockp,
+ void (*func)(grn_ctx *ctx, grn_array *array,
+ grn_id id, void *func_arg),
+ void *func_arg);
+GRN_API void grn_array_unblock(grn_ctx *ctx, grn_array *array);
+GRN_API int grn_array_get_value(grn_ctx *ctx, grn_array *array, grn_id id, void *valuebuf);
+GRN_API grn_rc grn_array_set_value(grn_ctx *ctx, grn_array *array, grn_id id,
+ const void *value, int flags);
+GRN_API grn_array_cursor *grn_array_cursor_open(grn_ctx *ctx, grn_array *array,
+ grn_id min, grn_id max,
+ int offset, int limit, int flags);
+GRN_API grn_id grn_array_cursor_next(grn_ctx *ctx, grn_array_cursor *cursor);
+GRN_API int grn_array_cursor_get_value(grn_ctx *ctx, grn_array_cursor *cursor, void **value);
+GRN_API grn_rc grn_array_cursor_set_value(grn_ctx *ctx, grn_array_cursor *cursor,
+ const void *value, int flags);
+GRN_API grn_rc grn_array_cursor_delete(grn_ctx *ctx, grn_array_cursor *cursor,
+ grn_table_delete_optarg *optarg);
+GRN_API void grn_array_cursor_close(grn_ctx *ctx, grn_array_cursor *cursor);
+GRN_API grn_rc grn_array_delete_by_id(grn_ctx *ctx, grn_array *array, grn_id id,
+ grn_table_delete_optarg *optarg);
+
+GRN_API grn_id grn_array_next(grn_ctx *ctx, grn_array *array, grn_id id);
+
+GRN_API void *_grn_array_get_value(grn_ctx *ctx, grn_array *array, grn_id id);
+
+#define GRN_ARRAY_EACH(ctx,array,head,tail,id,value,block) do {\
+ grn_array_cursor *_sc = grn_array_cursor_open(ctx, array, head, tail, 0, -1, 0); \
+ if (_sc) {\
+ grn_id id;\
+ while ((id = grn_array_cursor_next(ctx, _sc))) {\
+ grn_array_cursor_get_value(ctx, _sc, (void **)(value));\
+ block\
+ }\
+ grn_array_cursor_close(ctx, _sc); \
+ }\
+} while (0)
+
+#define GRN_ARRAY_EACH_BEGIN(ctx, array, cursor, head, tail, id) do {\
+ grn_array_cursor *cursor;\
+ cursor = grn_array_cursor_open((ctx), (array), (head), (tail), 0, -1, 0);\
+ if (cursor) {\
+ grn_id id;\
+ while ((id = grn_array_cursor_next(ctx, cursor))) {
+
+#define GRN_ARRAY_EACH_END(ctx, cursor)\
+ }\
+ grn_array_cursor_close(ctx, cursor);\
+ }\
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/arrow.h b/storage/mroonga/vendor/groonga/include/groonga/arrow.h
new file mode 100644
index 00000000..82e945cc
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/arrow.h
@@ -0,0 +1,38 @@
+/*
+ Copyright(C) 2017 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_rc grn_arrow_load(grn_ctx *ctx,
+ grn_obj *table,
+ const char *path);
+GRN_API grn_rc grn_arrow_dump(grn_ctx *ctx,
+ grn_obj *table,
+ const char *path);
+GRN_API grn_rc grn_arrow_dump_columns(grn_ctx *ctx,
+ grn_obj *table,
+ grn_obj *columns,
+ const char *path);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/arrow.hpp b/storage/mroonga/vendor/groonga/include/groonga/arrow.hpp
new file mode 100644
index 00000000..0b434d39
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/arrow.hpp
@@ -0,0 +1,21 @@
+/*
+ Copyright(C) 2017 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-1335 USA
+*/
+
+#pragma once
+
+#include <groonga.hpp>
diff --git a/storage/mroonga/vendor/groonga/include/groonga/cache.h b/storage/mroonga/vendor/groonga/include/groonga/cache.h
new file mode 100644
index 00000000..68325e52
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/cache.h
@@ -0,0 +1,49 @@
+/*
+ Copyright(C) 2013-2017 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GRN_CACHE_DEFAULT_MAX_N_ENTRIES 100
+typedef struct _grn_cache grn_cache;
+
+GRN_API void grn_set_default_cache_base_path(const char *base_path);
+GRN_API const char *grn_get_default_cache_base_path(void);
+
+GRN_API grn_cache *grn_cache_open(grn_ctx *ctx);
+GRN_API grn_cache *grn_persistent_cache_open(grn_ctx *ctx,
+ const char *base_path);
+GRN_API grn_rc grn_cache_close(grn_ctx *ctx, grn_cache *cache);
+
+GRN_API grn_rc grn_cache_current_set(grn_ctx *ctx, grn_cache *cache);
+GRN_API grn_cache *grn_cache_current_get(grn_ctx *ctx);
+
+GRN_API grn_rc grn_cache_default_reopen(void);
+
+GRN_API grn_rc grn_cache_set_max_n_entries(grn_ctx *ctx,
+ grn_cache *cache,
+ unsigned int n);
+GRN_API unsigned int grn_cache_get_max_n_entries(grn_ctx *ctx,
+ grn_cache *cache);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/column.h b/storage/mroonga/vendor/groonga/include/groonga/column.h
new file mode 100644
index 00000000..6eacc89e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/column.h
@@ -0,0 +1,29 @@
+/*
+ Copyright(C) 2009-2017 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_column_flags grn_column_get_flags(grn_ctx *ctx, grn_obj *column);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/command.h b/storage/mroonga/vendor/groonga/include/groonga/command.h
new file mode 100644
index 00000000..cccb6a97
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/command.h
@@ -0,0 +1,79 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015-2016 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-1335 USA
+*/
+
+#pragma once
+
+#include <groonga/plugin.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct _grn_command_input grn_command_input;
+
+GRN_PLUGIN_EXPORT grn_command_input *grn_command_input_open(grn_ctx *ctx,
+ grn_obj *command);
+GRN_PLUGIN_EXPORT grn_rc grn_command_input_close(grn_ctx *ctx,
+ grn_command_input *input);
+
+GRN_PLUGIN_EXPORT grn_obj *grn_command_input_add(grn_ctx *ctx,
+ grn_command_input *input,
+ const char *name,
+ int name_size,
+ grn_bool *added);
+GRN_PLUGIN_EXPORT grn_obj *grn_command_input_get(grn_ctx *ctx,
+ grn_command_input *input,
+ const char *name,
+ int name_size);
+GRN_PLUGIN_EXPORT grn_obj *grn_command_input_at(grn_ctx *ctx,
+ grn_command_input *input,
+ unsigned int offset);
+GRN_PLUGIN_EXPORT grn_obj *grn_command_input_get_arguments(grn_ctx *ctx,
+ grn_command_input *input);
+
+typedef void grn_command_run_func(grn_ctx *ctx,
+ grn_obj *command,
+ grn_command_input *input,
+ void *user_data);
+
+/*
+ grn_command_register() registers a command to the database which is
+ associated with `ctx'. `command_name' and `command_name_size'
+ specify the command name. Alphabetic letters ('A'-'Z' and 'a'-'z'),
+ digits ('0'-'9') and an underscore ('_') are capable characters.
+
+ `run' is called for running the command.
+
+ grn_command_register() returns GRN_SUCCESS on success, an error
+ code on failure.
+ */
+GRN_PLUGIN_EXPORT grn_rc grn_command_register(grn_ctx *ctx,
+ const char *command_name,
+ int command_name_size,
+ grn_command_run_func *run,
+ grn_expr_var *vars,
+ unsigned int n_vars,
+ void *user_data);
+
+GRN_PLUGIN_EXPORT grn_rc grn_command_run(grn_ctx *ctx,
+ grn_obj *command,
+ grn_command_input *input);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/config.h b/storage/mroonga/vendor/groonga/include/groonga/config.h
new file mode 100644
index 00000000..bf4b9419
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/config.h
@@ -0,0 +1,65 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GRN_CONFIG_MAX_KEY_SIZE GRN_TABLE_MAX_KEY_SIZE
+#define GRN_CONFIG_MAX_VALUE_SIZE \
+ (GRN_CONFIG_VALUE_SPACE_SIZE - sizeof(uint32_t) - 1) /* 1 is for '\0' */
+#define GRN_CONFIG_VALUE_SPACE_SIZE (4 * 1024)
+
+GRN_API grn_rc grn_config_set(grn_ctx *ctx,
+ const char *key, int32_t key_size,
+ const char *value, int32_t value_size);
+GRN_API grn_rc grn_config_get(grn_ctx *ctx,
+ const char *key, int32_t key_size,
+ const char **value, uint32_t *value_size);
+
+
+GRN_API grn_rc grn_config_delete(grn_ctx *ctx,
+ const char *key, int32_t key_size);
+
+GRN_API grn_obj *grn_config_cursor_open(grn_ctx *ctx);
+GRN_API grn_bool grn_config_cursor_next(grn_ctx *ctx, grn_obj *cursor);
+GRN_API uint32_t grn_config_cursor_get_key(grn_ctx *ctx,
+ grn_obj *cursor,
+ const char **key);
+GRN_API uint32_t grn_config_cursor_get_value(grn_ctx *ctx,
+ grn_obj *cursor,
+ const char **value);
+
+/* Deprecated since 5.1.2. Use GRN_CONFIG_* instead. */
+
+#define GRN_CONF_MAX_KEY_SIZE GRN_CONFIG_MAX_KEY_SIZE
+#define GRN_CONF_MAX_VALUE_SIZE GRN_CONFIG_MAX_VALUE_SIZE
+#define GRN_CONF_VALUE_SPACE_SIZE GRN_CONFIG_VALUE_SPACE_SIZE
+
+GRN_API grn_rc grn_conf_set(grn_ctx *ctx,
+ const char *key, int32_t key_size,
+ const char *value, int32_t value_size);
+GRN_API grn_rc grn_conf_get(grn_ctx *ctx,
+ const char *key, int32_t key_size,
+ const char **value, uint32_t *value_size);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/dat.h b/storage/mroonga/vendor/groonga/include/groonga/dat.h
new file mode 100644
index 00000000..e30df402
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/dat.h
@@ -0,0 +1,100 @@
+/*
+ Copyright(C) 2009-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _grn_dat grn_dat;
+typedef struct _grn_dat_cursor grn_dat_cursor;
+typedef struct _grn_table_scan_hit grn_dat_scan_hit;
+
+GRN_API int grn_dat_scan(grn_ctx *ctx, grn_dat *dat, const char *str,
+ unsigned int str_size, grn_dat_scan_hit *scan_hits,
+ unsigned int max_num_scan_hits, const char **str_rest);
+
+GRN_API grn_id grn_dat_lcp_search(grn_ctx *ctx, grn_dat *dat,
+ const void *key, unsigned int key_size);
+
+GRN_API grn_dat *grn_dat_create(grn_ctx *ctx, const char *path, unsigned int key_size,
+ unsigned int value_size, unsigned int flags);
+
+GRN_API grn_dat *grn_dat_open(grn_ctx *ctx, const char *path);
+
+GRN_API grn_rc grn_dat_close(grn_ctx *ctx, grn_dat *dat);
+
+GRN_API grn_rc grn_dat_remove(grn_ctx *ctx, const char *path);
+
+GRN_API grn_id grn_dat_get(grn_ctx *ctx, grn_dat *dat, const void *key,
+ unsigned int key_size, void **value);
+GRN_API grn_id grn_dat_add(grn_ctx *ctx, grn_dat *dat, const void *key,
+ unsigned int key_size, void **value, int *added);
+
+GRN_API int grn_dat_get_key(grn_ctx *ctx, grn_dat *dat, grn_id id, void *keybuf, int bufsize);
+GRN_API int grn_dat_get_key2(grn_ctx *ctx, grn_dat *dat, grn_id id, grn_obj *bulk);
+
+GRN_API grn_rc grn_dat_delete_by_id(grn_ctx *ctx, grn_dat *dat, grn_id id,
+ grn_table_delete_optarg *optarg);
+GRN_API grn_rc grn_dat_delete(grn_ctx *ctx, grn_dat *dat, const void *key, unsigned int key_size,
+ grn_table_delete_optarg *optarg);
+
+GRN_API grn_rc grn_dat_update_by_id(grn_ctx *ctx, grn_dat *dat, grn_id src_key_id,
+ const void *dest_key, unsigned int dest_key_size);
+GRN_API grn_rc grn_dat_update(grn_ctx *ctx, grn_dat *dat,
+ const void *src_key, unsigned int src_key_size,
+ const void *dest_key, unsigned int dest_key_size);
+
+GRN_API unsigned int grn_dat_size(grn_ctx *ctx, grn_dat *dat);
+
+GRN_API grn_dat_cursor *grn_dat_cursor_open(grn_ctx *ctx, grn_dat *dat,
+ const void *min, unsigned int min_size,
+ const void *max, unsigned int max_size,
+ int offset, int limit, int flags);
+GRN_API grn_id grn_dat_cursor_next(grn_ctx *ctx, grn_dat_cursor *c);
+GRN_API void grn_dat_cursor_close(grn_ctx *ctx, grn_dat_cursor *c);
+
+GRN_API int grn_dat_cursor_get_key(grn_ctx *ctx, grn_dat_cursor *c, const void **key);
+GRN_API grn_rc grn_dat_cursor_delete(grn_ctx *ctx, grn_dat_cursor *c,
+ grn_table_delete_optarg *optarg);
+
+#define GRN_DAT_EACH(ctx,dat,id,key,key_size,block) do {\
+ grn_dat_cursor *_sc = grn_dat_cursor_open(ctx, dat, NULL, 0, NULL, 0, 0, -1, 0);\
+ if (_sc) {\
+ grn_id id;\
+ unsigned int *_ks = (key_size);\
+ if (_ks) {\
+ while ((id = grn_dat_cursor_next(ctx, _sc))) {\
+ int _ks_raw = grn_dat_cursor_get_key(ctx, _sc, (const void **)(key));\
+ *(_ks) = (unsigned int)_ks_raw;\
+ block\
+ }\
+ } else {\
+ while ((id = grn_dat_cursor_next(ctx, _sc))) {\
+ grn_dat_cursor_get_key(ctx, _sc, (const void **)(key));\
+ block\
+ }\
+ }\
+ grn_dat_cursor_close(ctx, _sc);\
+ }\
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/db.h b/storage/mroonga/vendor/groonga/include/groonga/db.h
new file mode 100644
index 00000000..e4217b4f
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/db.h
@@ -0,0 +1,68 @@
+/*
+ Copyright(C) 2009-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _grn_db_create_optarg grn_db_create_optarg;
+
+struct _grn_db_create_optarg {
+ char **builtin_type_names;
+ int n_builtin_type_names;
+};
+
+GRN_API grn_obj *grn_db_create(grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg);
+
+#define GRN_DB_OPEN_OR_CREATE(ctx,path,optarg,db) \
+ (((db) = grn_db_open((ctx), (path))) || (db = grn_db_create((ctx), (path), (optarg))))
+
+GRN_API grn_obj *grn_db_open(grn_ctx *ctx, const char *path);
+GRN_API void grn_db_touch(grn_ctx *ctx, grn_obj *db);
+GRN_API grn_rc grn_db_recover(grn_ctx *ctx, grn_obj *db);
+GRN_API grn_rc grn_db_unmap(grn_ctx *ctx, grn_obj *db);
+GRN_API uint32_t grn_db_get_last_modified(grn_ctx *ctx, grn_obj *db);
+GRN_API grn_bool grn_db_is_dirty(grn_ctx *ctx, grn_obj *db);
+
+#define GRN_DB_EACH_BEGIN_FLAGS(ctx, cursor, id, flags) \
+ GRN_TABLE_EACH_BEGIN_FLAGS(ctx, \
+ grn_ctx_db((ctx)), \
+ cursor, \
+ id, \
+ flags)
+
+#define GRN_DB_EACH_BEGIN_BY_ID(ctx, cursor, id) \
+ GRN_DB_EACH_BEGIN_FLAGS(ctx, \
+ cursor, \
+ id, \
+ GRN_CURSOR_BY_ID | GRN_CURSOR_ASCENDING)
+
+#define GRN_DB_EACH_BEGIN_BY_KEY(ctx, cursor, id) \
+ GRN_DB_EACH_BEGIN_FLAGS(ctx, \
+ cursor, \
+ id, \
+ GRN_CURSOR_BY_KEY | GRN_CURSOR_ASCENDING)
+
+#define GRN_DB_EACH_END(ctx, cursor) \
+ GRN_TABLE_EACH_END(ctx, cursor)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/dump.h b/storage/mroonga/vendor/groonga/include/groonga/dump.h
new file mode 100644
index 00000000..6c673ea9
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/dump.h
@@ -0,0 +1,34 @@
+/*
+ Copyright(C) 2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_rc grn_dump_table_create_flags(grn_ctx *ctx,
+ grn_table_flags flags,
+ grn_obj *buffer);
+GRN_API grn_rc grn_dump_column_create_flags(grn_ctx *ctx,
+ grn_column_flags flags,
+ grn_obj *buffer);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/error.h b/storage/mroonga/vendor/groonga/include/groonga/error.h
new file mode 100644
index 00000000..a63a52b6
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/error.h
@@ -0,0 +1,29 @@
+/*
+ Copyright(C) 2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API const char *grn_rc_to_string(grn_rc rc);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/expr.h b/storage/mroonga/vendor/groonga/include/groonga/expr.h
new file mode 100644
index 00000000..8090bc78
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/expr.h
@@ -0,0 +1,123 @@
+/*
+ Copyright(C) 2009-2017 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+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)
+#define GRN_EXPR_QUERY_NO_SYNTAX_ERROR (0x80)
+
+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 void grn_expr_take_obj(grn_ctx *ctx, grn_obj *expr, grn_obj *obj);
+
+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_syntax_expand_query(grn_ctx *ctx,
+ const char *query, int query_size,
+ grn_expr_flags flags,
+ grn_obj *expander,
+ grn_obj *expanded_query);
+GRN_API grn_rc grn_expr_syntax_expand_query_by_table(grn_ctx *ctx,
+ const char *query,
+ int query_size,
+ grn_expr_flags flags,
+ grn_obj *term_column,
+ grn_obj *expanded_term_column,
+ grn_obj *expanded_query);
+
+GRN_API grn_rc grn_expr_compile(grn_ctx *ctx, grn_obj *expr);
+GRN_API grn_obj *grn_expr_rewrite(grn_ctx *ctx, grn_obj *expr);
+GRN_API grn_rc grn_expr_dump_plan(grn_ctx *ctx, grn_obj *expr, grn_obj *buffer);
+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, unsigned char 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)
+
+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 unsigned int grn_expr_estimate_size(grn_ctx *ctx, grn_obj *expr);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/file_reader.h b/storage/mroonga/vendor/groonga/include/groonga/file_reader.h
new file mode 100644
index 00000000..4b3fee70
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/file_reader.h
@@ -0,0 +1,37 @@
+/*
+ Copyright(C) 2015-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _grn_file_reader grn_file_reader;
+
+GRN_API grn_file_reader *grn_file_reader_open(grn_ctx *ctx, const char *path);
+GRN_API void grn_file_reader_close(grn_ctx *ctx,
+ grn_file_reader *reader);
+
+GRN_API grn_rc grn_file_reader_read_line(grn_ctx *ctx,
+ grn_file_reader *reader,
+ grn_obj *buffer);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/geo.h b/storage/mroonga/vendor/groonga/include/groonga/geo.h
new file mode 100644
index 00000000..d1049350
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/geo.h
@@ -0,0 +1,36 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API int grn_geo_table_sort(grn_ctx *ctx,
+ grn_obj *table,
+ int offset,
+ int limit,
+ grn_obj *result,
+ grn_obj *column,
+ grn_obj *geo_point);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/groonga.h b/storage/mroonga/vendor/groonga/include/groonga/groonga.h
new file mode 100644
index 00000000..b0840367
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/groonga.h
@@ -0,0 +1,1700 @@
+/*
+ Copyright(C) 2009-2017 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-1335 USA
+*/
+
+#pragma once
+
+#include <stdarg.h>
+#include <sys/types.h>
+#include <stdint.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef GRN_API
+# if defined(_WIN32) || defined(_WIN64)
+# define GRN_API __declspec(dllimport)
+# else
+# define GRN_API
+# endif /* defined(_WIN32) || defined(_WIN64) */
+#endif /* GRN_API */
+
+typedef unsigned int grn_id;
+typedef uint8_t grn_bool;
+
+#define GRN_ID_NIL (0x00)
+#define GRN_ID_MAX (0x3fffffff)
+
+#define GRN_TRUE (1)
+#define GRN_FALSE (0)
+
+typedef enum {
+ GRN_SUCCESS = 0,
+ GRN_END_OF_DATA = 1,
+ GRN_UNKNOWN_ERROR = -1,
+ GRN_OPERATION_NOT_PERMITTED = -2,
+ GRN_NO_SUCH_FILE_OR_DIRECTORY = -3,
+ GRN_NO_SUCH_PROCESS = -4,
+ GRN_INTERRUPTED_FUNCTION_CALL = -5,
+ GRN_INPUT_OUTPUT_ERROR = -6,
+ GRN_NO_SUCH_DEVICE_OR_ADDRESS = -7,
+ GRN_ARG_LIST_TOO_LONG = -8,
+ GRN_EXEC_FORMAT_ERROR = -9,
+ GRN_BAD_FILE_DESCRIPTOR = -10,
+ GRN_NO_CHILD_PROCESSES = -11,
+ GRN_RESOURCE_TEMPORARILY_UNAVAILABLE = -12,
+ GRN_NOT_ENOUGH_SPACE = -13,
+ GRN_PERMISSION_DENIED = -14,
+ GRN_BAD_ADDRESS = -15,
+ GRN_RESOURCE_BUSY = -16,
+ GRN_FILE_EXISTS = -17,
+ GRN_IMPROPER_LINK = -18,
+ GRN_NO_SUCH_DEVICE = -19,
+ GRN_NOT_A_DIRECTORY = -20,
+ GRN_IS_A_DIRECTORY = -21,
+ GRN_INVALID_ARGUMENT = -22,
+ GRN_TOO_MANY_OPEN_FILES_IN_SYSTEM = -23,
+ GRN_TOO_MANY_OPEN_FILES = -24,
+ GRN_INAPPROPRIATE_I_O_CONTROL_OPERATION = -25,
+ GRN_FILE_TOO_LARGE = -26,
+ GRN_NO_SPACE_LEFT_ON_DEVICE = -27,
+ GRN_INVALID_SEEK = -28,
+ GRN_READ_ONLY_FILE_SYSTEM = -29,
+ GRN_TOO_MANY_LINKS = -30,
+ GRN_BROKEN_PIPE = -31,
+ GRN_DOMAIN_ERROR = -32,
+ GRN_RESULT_TOO_LARGE = -33,
+ GRN_RESOURCE_DEADLOCK_AVOIDED = -34,
+ GRN_NO_MEMORY_AVAILABLE = -35,
+ GRN_FILENAME_TOO_LONG = -36,
+ GRN_NO_LOCKS_AVAILABLE = -37,
+ GRN_FUNCTION_NOT_IMPLEMENTED = -38,
+ GRN_DIRECTORY_NOT_EMPTY = -39,
+ GRN_ILLEGAL_BYTE_SEQUENCE = -40,
+ GRN_SOCKET_NOT_INITIALIZED = -41,
+ GRN_OPERATION_WOULD_BLOCK = -42,
+ GRN_ADDRESS_IS_NOT_AVAILABLE = -43,
+ GRN_NETWORK_IS_DOWN = -44,
+ GRN_NO_BUFFER = -45,
+ GRN_SOCKET_IS_ALREADY_CONNECTED = -46,
+ GRN_SOCKET_IS_NOT_CONNECTED = -47,
+ GRN_SOCKET_IS_ALREADY_SHUTDOWNED = -48,
+ GRN_OPERATION_TIMEOUT = -49,
+ GRN_CONNECTION_REFUSED = -50,
+ GRN_RANGE_ERROR = -51,
+ GRN_TOKENIZER_ERROR = -52,
+ GRN_FILE_CORRUPT = -53,
+ GRN_INVALID_FORMAT = -54,
+ GRN_OBJECT_CORRUPT = -55,
+ GRN_TOO_MANY_SYMBOLIC_LINKS = -56,
+ GRN_NOT_SOCKET = -57,
+ GRN_OPERATION_NOT_SUPPORTED = -58,
+ GRN_ADDRESS_IS_IN_USE = -59,
+ GRN_ZLIB_ERROR = -60,
+ GRN_LZ4_ERROR = -61,
+/* Just for backward compatibility. We'll remove it at 5.0.0. */
+#define GRN_LZO_ERROR GRN_LZ4_ERROR
+ GRN_STACK_OVER_FLOW = -62,
+ GRN_SYNTAX_ERROR = -63,
+ GRN_RETRY_MAX = -64,
+ GRN_INCOMPATIBLE_FILE_FORMAT = -65,
+ GRN_UPDATE_NOT_ALLOWED = -66,
+ GRN_TOO_SMALL_OFFSET = -67,
+ GRN_TOO_LARGE_OFFSET = -68,
+ GRN_TOO_SMALL_LIMIT = -69,
+ GRN_CAS_ERROR = -70,
+ GRN_UNSUPPORTED_COMMAND_VERSION = -71,
+ GRN_NORMALIZER_ERROR = -72,
+ GRN_TOKEN_FILTER_ERROR = -73,
+ GRN_COMMAND_ERROR = -74,
+ GRN_PLUGIN_ERROR = -75,
+ GRN_SCORER_ERROR = -76,
+ GRN_CANCEL = -77,
+ GRN_WINDOW_FUNCTION_ERROR = -78,
+ GRN_ZSTD_ERROR = -79
+} grn_rc;
+
+GRN_API grn_rc grn_init(void);
+GRN_API grn_rc grn_fin(void);
+
+GRN_API const char *grn_get_global_error_message(void);
+
+typedef enum {
+ GRN_ENC_DEFAULT = 0,
+ GRN_ENC_NONE,
+ GRN_ENC_EUC_JP,
+ GRN_ENC_UTF8,
+ GRN_ENC_SJIS,
+ GRN_ENC_LATIN1,
+ GRN_ENC_KOI8R
+} grn_encoding;
+
+typedef enum {
+ GRN_COMMAND_VERSION_DEFAULT = 0,
+ GRN_COMMAND_VERSION_1,
+ GRN_COMMAND_VERSION_2,
+ GRN_COMMAND_VERSION_3
+} grn_command_version;
+
+#define GRN_COMMAND_VERSION_MIN GRN_COMMAND_VERSION_1
+#define GRN_COMMAND_VERSION_STABLE GRN_COMMAND_VERSION_1
+#define GRN_COMMAND_VERSION_MAX GRN_COMMAND_VERSION_3
+
+typedef enum {
+ GRN_LOG_NONE = 0,
+ GRN_LOG_EMERG,
+ GRN_LOG_ALERT,
+ GRN_LOG_CRIT,
+ GRN_LOG_ERROR,
+ GRN_LOG_WARNING,
+ GRN_LOG_NOTICE,
+ GRN_LOG_INFO,
+ GRN_LOG_DEBUG,
+ GRN_LOG_DUMP
+} grn_log_level;
+
+GRN_API const char *grn_log_level_to_string(grn_log_level level);
+GRN_API grn_bool grn_log_level_parse(const char *string, grn_log_level *level);
+
+/* query log flags */
+#define GRN_QUERY_LOG_NONE (0x00)
+#define GRN_QUERY_LOG_COMMAND (0x01<<0)
+#define GRN_QUERY_LOG_RESULT_CODE (0x01<<1)
+#define GRN_QUERY_LOG_DESTINATION (0x01<<2)
+#define GRN_QUERY_LOG_CACHE (0x01<<3)
+#define GRN_QUERY_LOG_SIZE (0x01<<4)
+#define GRN_QUERY_LOG_SCORE (0x01<<5)
+#define GRN_QUERY_LOG_ALL\
+ (GRN_QUERY_LOG_COMMAND |\
+ GRN_QUERY_LOG_RESULT_CODE |\
+ GRN_QUERY_LOG_DESTINATION |\
+ GRN_QUERY_LOG_CACHE |\
+ GRN_QUERY_LOG_SIZE |\
+ GRN_QUERY_LOG_SCORE)
+#define GRN_QUERY_LOG_DEFAULT GRN_QUERY_LOG_ALL
+
+typedef enum {
+ GRN_CONTENT_NONE = 0,
+ GRN_CONTENT_TSV,
+ GRN_CONTENT_JSON,
+ GRN_CONTENT_XML,
+ GRN_CONTENT_MSGPACK,
+ GRN_CONTENT_GROONGA_COMMAND_LIST
+} grn_content_type;
+
+typedef struct _grn_obj grn_obj;
+typedef struct _grn_ctx grn_ctx;
+
+#define GRN_CTX_MSGSIZE (0x80)
+#define GRN_CTX_FIN (0xff)
+
+typedef union {
+ int int_value;
+ grn_id id;
+ void *ptr;
+} grn_user_data;
+
+typedef grn_obj *grn_proc_func(grn_ctx *ctx, int nargs, grn_obj **args,
+ grn_user_data *user_data);
+
+struct _grn_ctx {
+ grn_rc rc;
+ int flags;
+ grn_encoding encoding;
+ unsigned char ntrace;
+ unsigned char errlvl;
+ unsigned char stat;
+ unsigned int seqno;
+ unsigned int subno;
+ unsigned int seqno2;
+ unsigned int errline;
+ grn_user_data user_data;
+ grn_ctx *prev;
+ grn_ctx *next;
+ const char *errfile;
+ const char *errfunc;
+ struct _grn_ctx_impl *impl;
+ void *trace[16];
+ char errbuf[GRN_CTX_MSGSIZE];
+};
+
+#define GRN_CTX_USER_DATA(ctx) (&((ctx)->user_data))
+
+/* Deprecated since 4.0.3. Don't use it. */
+#define GRN_CTX_USE_QL (0x03)
+/* Deprecated since 4.0.3. Don't use it. */
+#define GRN_CTX_BATCH_MODE (0x04)
+#define GRN_CTX_PER_DB (0x08)
+
+GRN_API grn_rc grn_ctx_init(grn_ctx *ctx, int flags);
+GRN_API grn_rc grn_ctx_fin(grn_ctx *ctx);
+GRN_API grn_ctx *grn_ctx_open(int flags);
+GRN_API grn_rc grn_ctx_close(grn_ctx *ctx);
+GRN_API grn_rc grn_ctx_set_finalizer(grn_ctx *ctx, grn_proc_func *func);
+
+GRN_API grn_rc grn_ctx_push_temporary_open_space(grn_ctx *ctx);
+GRN_API grn_rc grn_ctx_pop_temporary_open_space(grn_ctx *ctx);
+GRN_API grn_rc grn_ctx_merge_temporary_open_space(grn_ctx *ctx);
+
+GRN_API grn_encoding grn_get_default_encoding(void);
+GRN_API grn_rc grn_set_default_encoding(grn_encoding encoding);
+
+#define GRN_CTX_GET_ENCODING(ctx) ((ctx)->encoding)
+#define GRN_CTX_SET_ENCODING(ctx,enc) \
+ ((ctx)->encoding = (enc == GRN_ENC_DEFAULT) ? grn_get_default_encoding() : enc)
+
+GRN_API const char *grn_get_version(void);
+GRN_API const char *grn_get_package(void);
+GRN_API const char *grn_get_package_label(void);
+
+GRN_API grn_command_version grn_get_default_command_version(void);
+GRN_API grn_rc grn_set_default_command_version(grn_command_version version);
+GRN_API grn_command_version grn_ctx_get_command_version(grn_ctx *ctx);
+GRN_API grn_rc grn_ctx_set_command_version(grn_ctx *ctx, grn_command_version version);
+GRN_API long long int grn_ctx_get_match_escalation_threshold(grn_ctx *ctx);
+GRN_API grn_rc grn_ctx_set_match_escalation_threshold(grn_ctx *ctx, long long int threshold);
+GRN_API long long int grn_get_default_match_escalation_threshold(void);
+GRN_API grn_rc grn_set_default_match_escalation_threshold(long long int threshold);
+
+GRN_API int grn_get_lock_timeout(void);
+GRN_API grn_rc grn_set_lock_timeout(int timeout);
+
+/* grn_encoding */
+
+GRN_API const char *grn_encoding_to_string(grn_encoding encoding);
+GRN_API grn_encoding grn_encoding_parse(const char *name);
+
+/* obj */
+
+typedef uint16_t grn_obj_flags;
+typedef uint32_t grn_table_flags;
+typedef uint32_t grn_column_flags;
+
+/* flags for grn_obj_flags and grn_table_flags */
+
+#define GRN_OBJ_FLAGS_MASK (0xffff)
+
+#define GRN_OBJ_TABLE_TYPE_MASK (0x07)
+#define GRN_OBJ_TABLE_HASH_KEY (0x00)
+#define GRN_OBJ_TABLE_PAT_KEY (0x01)
+#define GRN_OBJ_TABLE_DAT_KEY (0x02)
+#define GRN_OBJ_TABLE_NO_KEY (0x03)
+
+#define GRN_OBJ_KEY_MASK (0x07<<3)
+#define GRN_OBJ_KEY_UINT (0x00<<3)
+#define GRN_OBJ_KEY_INT (0x01<<3)
+#define GRN_OBJ_KEY_FLOAT (0x02<<3)
+#define GRN_OBJ_KEY_GEO_POINT (0x03<<3)
+
+#define GRN_OBJ_KEY_WITH_SIS (0x01<<6)
+#define GRN_OBJ_KEY_NORMALIZE (0x01<<7)
+
+#define GRN_OBJ_COLUMN_TYPE_MASK (0x07)
+#define GRN_OBJ_COLUMN_SCALAR (0x00)
+#define GRN_OBJ_COLUMN_VECTOR (0x01)
+#define GRN_OBJ_COLUMN_INDEX (0x02)
+
+#define GRN_OBJ_COMPRESS_MASK (0x07<<4)
+#define GRN_OBJ_COMPRESS_NONE (0x00<<4)
+#define GRN_OBJ_COMPRESS_ZLIB (0x01<<4)
+#define GRN_OBJ_COMPRESS_LZ4 (0x02<<4)
+/* Just for backward compatibility. We'll remove it at 5.0.0. */
+#define GRN_OBJ_COMPRESS_LZO GRN_OBJ_COMPRESS_LZ4
+#define GRN_OBJ_COMPRESS_ZSTD (0x03<<4)
+
+#define GRN_OBJ_WITH_SECTION (0x01<<7)
+#define GRN_OBJ_WITH_WEIGHT (0x01<<8)
+#define GRN_OBJ_WITH_POSITION (0x01<<9)
+#define GRN_OBJ_RING_BUFFER (0x01<<10)
+
+#define GRN_OBJ_UNIT_MASK (0x0f<<8)
+#define GRN_OBJ_UNIT_DOCUMENT_NONE (0x00<<8)
+#define GRN_OBJ_UNIT_DOCUMENT_SECTION (0x01<<8)
+#define GRN_OBJ_UNIT_DOCUMENT_POSITION (0x02<<8)
+#define GRN_OBJ_UNIT_SECTION_NONE (0x03<<8)
+#define GRN_OBJ_UNIT_SECTION_POSITION (0x04<<8)
+#define GRN_OBJ_UNIT_POSITION_NONE (0x05<<8)
+#define GRN_OBJ_UNIT_USERDEF_DOCUMENT (0x06<<8)
+#define GRN_OBJ_UNIT_USERDEF_SECTION (0x07<<8)
+#define GRN_OBJ_UNIT_USERDEF_POSITION (0x08<<8)
+
+/* Don't use (0x01<<12) because it's used internally. */
+
+#define GRN_OBJ_NO_SUBREC (0x00<<13)
+#define GRN_OBJ_WITH_SUBREC (0x01<<13)
+
+#define GRN_OBJ_KEY_VAR_SIZE (0x01<<14)
+
+#define GRN_OBJ_TEMPORARY (0x00<<15)
+#define GRN_OBJ_PERSISTENT (0x01<<15)
+
+/* flags only for grn_table_flags */
+
+#define GRN_OBJ_KEY_LARGE (0x01<<16)
+
+/* flags only for grn_column_flags */
+
+#define GRN_OBJ_INDEX_SMALL (0x01<<16)
+#define GRN_OBJ_INDEX_MEDIUM (0x01<<17)
+
+/* obj types */
+
+#define GRN_VOID (0x00)
+#define GRN_BULK (0x02)
+#define GRN_PTR (0x03)
+#define GRN_UVECTOR (0x04) /* vector of fixed size data especially grn_id */
+#define GRN_PVECTOR (0x05) /* vector of grn_obj* */
+#define GRN_VECTOR (0x06) /* vector of arbitrary data */
+#define GRN_MSG (0x07)
+#define GRN_QUERY (0x08)
+#define GRN_ACCESSOR (0x09)
+#define GRN_SNIP (0x0b)
+#define GRN_PATSNIP (0x0c)
+#define GRN_STRING (0x0d)
+#define GRN_CURSOR_TABLE_HASH_KEY (0x10)
+#define GRN_CURSOR_TABLE_PAT_KEY (0x11)
+#define GRN_CURSOR_TABLE_DAT_KEY (0x12)
+#define GRN_CURSOR_TABLE_NO_KEY (0x13)
+#define GRN_CURSOR_COLUMN_INDEX (0x18)
+#define GRN_CURSOR_COLUMN_GEO_INDEX (0x1a)
+#define GRN_CURSOR_CONFIG (0x1f)
+#define GRN_TYPE (0x20)
+#define GRN_PROC (0x21)
+#define GRN_EXPR (0x22)
+#define GRN_TABLE_HASH_KEY (0x30)
+#define GRN_TABLE_PAT_KEY (0x31)
+#define GRN_TABLE_DAT_KEY (0x32)
+#define GRN_TABLE_NO_KEY (0x33)
+#define GRN_DB (0x37)
+#define GRN_COLUMN_FIX_SIZE (0x40)
+#define GRN_COLUMN_VAR_SIZE (0x41)
+#define GRN_COLUMN_INDEX (0x48)
+
+typedef struct _grn_section grn_section;
+typedef struct _grn_obj_header grn_obj_header;
+
+struct _grn_section {
+ unsigned int offset;
+ unsigned int length;
+ unsigned int weight;
+ grn_id domain;
+};
+
+struct _grn_obj_header {
+ unsigned char type;
+ unsigned char impl_flags;
+ grn_obj_flags flags;
+ grn_id domain;
+};
+
+struct _grn_obj {
+ grn_obj_header header;
+ union {
+ struct {
+ char *head;
+ char *curr;
+ char *tail;
+ } b;
+ struct {
+ grn_obj *body;
+ grn_section *sections;
+ int n_sections;
+ } v;
+ } u;
+};
+
+#define GRN_OBJ_REFER (0x01<<0)
+#define GRN_OBJ_OUTPLACE (0x01<<1)
+#define GRN_OBJ_OWN (0x01<<5)
+
+#define GRN_OBJ_INIT(obj,obj_type,obj_flags,obj_domain) do { \
+ (obj)->header.type = (obj_type);\
+ (obj)->header.impl_flags = (obj_flags);\
+ (obj)->header.flags = 0;\
+ (obj)->header.domain = (obj_domain);\
+ (obj)->u.b.head = NULL;\
+ (obj)->u.b.curr = NULL;\
+ (obj)->u.b.tail = NULL;\
+} while (0)
+
+#define GRN_OBJ_FIN(ctx,obj) (grn_obj_close((ctx), (obj)))
+
+GRN_API grn_rc grn_ctx_use(grn_ctx *ctx, grn_obj *db);
+GRN_API grn_obj *grn_ctx_db(grn_ctx *ctx);
+GRN_API grn_obj *grn_ctx_get(grn_ctx *ctx, const char *name, int name_size);
+GRN_API grn_rc grn_ctx_get_all_tables(grn_ctx *ctx, grn_obj *tables_buffer);
+GRN_API grn_rc grn_ctx_get_all_types(grn_ctx *ctx, grn_obj *types_buffer);
+GRN_API grn_rc grn_ctx_get_all_tokenizers(grn_ctx *ctx,
+ grn_obj *tokenizers_buffer);
+GRN_API grn_rc grn_ctx_get_all_normalizers(grn_ctx *ctx,
+ grn_obj *normalizers_buffer);
+GRN_API grn_rc grn_ctx_get_all_token_filters(grn_ctx *ctx,
+ grn_obj *token_filters_buffer);
+
+typedef enum {
+ GRN_DB_VOID = 0,
+ GRN_DB_DB,
+ GRN_DB_OBJECT,
+ GRN_DB_BOOL,
+ GRN_DB_INT8,
+ GRN_DB_UINT8,
+ GRN_DB_INT16,
+ GRN_DB_UINT16,
+ GRN_DB_INT32,
+ GRN_DB_UINT32,
+ GRN_DB_INT64,
+ GRN_DB_UINT64,
+ GRN_DB_FLOAT,
+ GRN_DB_TIME,
+ GRN_DB_SHORT_TEXT,
+ GRN_DB_TEXT,
+ GRN_DB_LONG_TEXT,
+ GRN_DB_TOKYO_GEO_POINT,
+ GRN_DB_WGS84_GEO_POINT
+} grn_builtin_type;
+
+typedef enum {
+ GRN_DB_MECAB = 64,
+ GRN_DB_DELIMIT,
+ GRN_DB_UNIGRAM,
+ GRN_DB_BIGRAM,
+ GRN_DB_TRIGRAM
+} grn_builtin_tokenizer;
+
+GRN_API grn_obj *grn_ctx_at(grn_ctx *ctx, grn_id id);
+GRN_API grn_bool grn_ctx_is_opened(grn_ctx *ctx, grn_id id);
+
+GRN_API grn_rc grn_plugin_register(grn_ctx *ctx, const char *name);
+GRN_API grn_rc grn_plugin_unregister(grn_ctx *ctx, const char *name);
+GRN_API grn_rc grn_plugin_register_by_path(grn_ctx *ctx, const char *path);
+GRN_API grn_rc grn_plugin_unregister_by_path(grn_ctx *ctx, const char *path);
+GRN_API const char *grn_plugin_get_system_plugins_dir(void);
+GRN_API const char *grn_plugin_get_suffix(void);
+GRN_API const char *grn_plugin_get_ruby_suffix(void);
+GRN_API grn_rc grn_plugin_get_names(grn_ctx *ctx, grn_obj *names);
+
+typedef struct {
+ const char *name;
+ unsigned int name_size;
+ grn_obj value;
+} grn_expr_var;
+
+typedef grn_rc (*grn_plugin_func)(grn_ctx *ctx);
+
+typedef enum {
+ GRN_PROC_INVALID = 0,
+ GRN_PROC_TOKENIZER,
+ GRN_PROC_COMMAND,
+ GRN_PROC_FUNCTION,
+ GRN_PROC_HOOK,
+ GRN_PROC_NORMALIZER,
+ GRN_PROC_TOKEN_FILTER,
+ GRN_PROC_SCORER,
+ GRN_PROC_WINDOW_FUNCTION
+} grn_proc_type;
+
+GRN_API grn_obj *grn_proc_create(grn_ctx *ctx,
+ const char *name, int name_size, grn_proc_type type,
+ grn_proc_func *init, grn_proc_func *next, grn_proc_func *fin,
+ unsigned int nvars, grn_expr_var *vars);
+GRN_API grn_obj *grn_proc_get_info(grn_ctx *ctx, grn_user_data *user_data,
+ grn_expr_var **vars, unsigned int *nvars, grn_obj **caller);
+GRN_API grn_proc_type grn_proc_get_type(grn_ctx *ctx, grn_obj *proc);
+
+typedef grn_obj grn_table_cursor;
+
+typedef struct {
+ grn_id rid;
+ uint32_t sid;
+ uint32_t pos;
+ uint32_t tf;
+ uint32_t weight;
+ uint32_t rest;
+} grn_posting;
+
+typedef enum {
+ GRN_OP_PUSH = 0,
+ GRN_OP_POP,
+ GRN_OP_NOP,
+ GRN_OP_CALL,
+ GRN_OP_INTERN,
+ GRN_OP_GET_REF,
+ GRN_OP_GET_VALUE,
+ GRN_OP_AND,
+ GRN_OP_AND_NOT,
+ /* Deprecated. Just for backward compatibility. */
+#define GRN_OP_BUT GRN_OP_AND_NOT
+ GRN_OP_OR,
+ GRN_OP_ASSIGN,
+ GRN_OP_STAR_ASSIGN,
+ GRN_OP_SLASH_ASSIGN,
+ GRN_OP_MOD_ASSIGN,
+ GRN_OP_PLUS_ASSIGN,
+ GRN_OP_MINUS_ASSIGN,
+ GRN_OP_SHIFTL_ASSIGN,
+ GRN_OP_SHIFTR_ASSIGN,
+ GRN_OP_SHIFTRR_ASSIGN,
+ GRN_OP_AND_ASSIGN,
+ GRN_OP_XOR_ASSIGN,
+ GRN_OP_OR_ASSIGN,
+ GRN_OP_JUMP,
+ GRN_OP_CJUMP,
+ GRN_OP_COMMA,
+ GRN_OP_BITWISE_OR,
+ GRN_OP_BITWISE_XOR,
+ GRN_OP_BITWISE_AND,
+ GRN_OP_BITWISE_NOT,
+ GRN_OP_EQUAL,
+ GRN_OP_NOT_EQUAL,
+ GRN_OP_LESS,
+ GRN_OP_GREATER,
+ GRN_OP_LESS_EQUAL,
+ GRN_OP_GREATER_EQUAL,
+ GRN_OP_IN,
+ GRN_OP_MATCH,
+ GRN_OP_NEAR,
+ GRN_OP_NEAR2,
+ GRN_OP_SIMILAR,
+ GRN_OP_TERM_EXTRACT,
+ GRN_OP_SHIFTL,
+ GRN_OP_SHIFTR,
+ GRN_OP_SHIFTRR,
+ GRN_OP_PLUS,
+ GRN_OP_MINUS,
+ GRN_OP_STAR,
+ GRN_OP_SLASH,
+ GRN_OP_MOD,
+ GRN_OP_DELETE,
+ GRN_OP_INCR,
+ GRN_OP_DECR,
+ GRN_OP_INCR_POST,
+ GRN_OP_DECR_POST,
+ GRN_OP_NOT,
+ GRN_OP_ADJUST,
+ GRN_OP_EXACT,
+ GRN_OP_LCP,
+ GRN_OP_PARTIAL,
+ GRN_OP_UNSPLIT,
+ GRN_OP_PREFIX,
+ GRN_OP_SUFFIX,
+ GRN_OP_GEO_DISTANCE1,
+ GRN_OP_GEO_DISTANCE2,
+ GRN_OP_GEO_DISTANCE3,
+ GRN_OP_GEO_DISTANCE4,
+ GRN_OP_GEO_WITHINP5,
+ GRN_OP_GEO_WITHINP6,
+ GRN_OP_GEO_WITHINP8,
+ GRN_OP_OBJ_SEARCH,
+ GRN_OP_EXPR_GET_VAR,
+ GRN_OP_TABLE_CREATE,
+ GRN_OP_TABLE_SELECT,
+ GRN_OP_TABLE_SORT,
+ GRN_OP_TABLE_GROUP,
+ GRN_OP_JSON_PUT,
+ GRN_OP_GET_MEMBER,
+ GRN_OP_REGEXP,
+ GRN_OP_FUZZY
+} grn_operator;
+
+GRN_API grn_obj *grn_obj_column(grn_ctx *ctx, grn_obj *table,
+ const char *name, unsigned int name_size);
+
+/*-------------------------------------------------------------
+ * API for column
+ */
+
+#define GRN_COLUMN_NAME_ID "_id"
+#define GRN_COLUMN_NAME_ID_LEN (sizeof(GRN_COLUMN_NAME_ID) - 1)
+#define GRN_COLUMN_NAME_KEY "_key"
+#define GRN_COLUMN_NAME_KEY_LEN (sizeof(GRN_COLUMN_NAME_KEY) - 1)
+#define GRN_COLUMN_NAME_VALUE "_value"
+#define GRN_COLUMN_NAME_VALUE_LEN (sizeof(GRN_COLUMN_NAME_VALUE) - 1)
+#define GRN_COLUMN_NAME_SCORE "_score"
+#define GRN_COLUMN_NAME_SCORE_LEN (sizeof(GRN_COLUMN_NAME_SCORE) - 1)
+#define GRN_COLUMN_NAME_NSUBRECS "_nsubrecs"
+#define GRN_COLUMN_NAME_NSUBRECS_LEN (sizeof(GRN_COLUMN_NAME_NSUBRECS) - 1)
+#define GRN_COLUMN_NAME_MAX "_max"
+#define GRN_COLUMN_NAME_MAX_LEN (sizeof(GRN_COLUMN_NAME_MAX) - 1)
+#define GRN_COLUMN_NAME_MIN "_min"
+#define GRN_COLUMN_NAME_MIN_LEN (sizeof(GRN_COLUMN_NAME_MIN) - 1)
+#define GRN_COLUMN_NAME_SUM "_sum"
+#define GRN_COLUMN_NAME_SUM_LEN (sizeof(GRN_COLUMN_NAME_SUM) - 1)
+#define GRN_COLUMN_NAME_AVG "_avg"
+#define GRN_COLUMN_NAME_AVG_LEN (sizeof(GRN_COLUMN_NAME_AVG) - 1)
+
+GRN_API grn_obj *grn_column_create(grn_ctx *ctx, grn_obj *table,
+ const char *name, unsigned int name_size,
+ const char *path, grn_column_flags flags, grn_obj *type);
+
+#define GRN_COLUMN_OPEN_OR_CREATE(ctx,table,name,name_size,path,flags,type,column) \
+ (((column) = grn_obj_column((ctx), (table), (name), (name_size))) ||\
+ ((column) = grn_column_create((ctx), (table), (name), (name_size), (path), (flags), (type))))
+
+GRN_API grn_rc grn_column_index_update(grn_ctx *ctx, grn_obj *column,
+ grn_id id, unsigned int section,
+ grn_obj *oldvalue, grn_obj *newvalue);
+GRN_API grn_obj *grn_column_table(grn_ctx *ctx, grn_obj *column);
+GRN_API grn_rc grn_column_truncate(grn_ctx *ctx, grn_obj *column);
+
+/*-------------------------------------------------------------
+ * API for db, table and/or column
+ */
+
+typedef enum {
+ GRN_INFO_ENCODING = 0,
+ GRN_INFO_SOURCE,
+ GRN_INFO_DEFAULT_TOKENIZER,
+ GRN_INFO_ELEMENT_SIZE,
+ GRN_INFO_CURR_MAX,
+ GRN_INFO_MAX_ELEMENT_SIZE,
+ GRN_INFO_SEG_SIZE,
+ GRN_INFO_CHUNK_SIZE,
+ GRN_INFO_MAX_SECTION,
+ GRN_INFO_HOOK_LOCAL_DATA,
+ GRN_INFO_ELEMENT_A,
+ GRN_INFO_ELEMENT_CHUNK,
+ GRN_INFO_ELEMENT_CHUNK_SIZE,
+ GRN_INFO_ELEMENT_BUFFER_FREE,
+ GRN_INFO_ELEMENT_NTERMS,
+ GRN_INFO_ELEMENT_NTERMS_VOID,
+ GRN_INFO_ELEMENT_SIZE_IN_CHUNK,
+ GRN_INFO_ELEMENT_POS_IN_CHUNK,
+ GRN_INFO_ELEMENT_SIZE_IN_BUFFER,
+ GRN_INFO_ELEMENT_POS_IN_BUFFER,
+ GRN_INFO_ELEMENT_ESTIMATE_SIZE,
+ GRN_INFO_NGRAM_UNIT_SIZE,
+ /*
+ GRN_INFO_VERSION,
+ GRN_INFO_CONFIGURE_OPTIONS,
+ GRN_INFO_CONFIG_PATH,
+ */
+ GRN_INFO_PARTIAL_MATCH_THRESHOLD,
+ GRN_INFO_II_SPLIT_THRESHOLD,
+ GRN_INFO_SUPPORT_ZLIB,
+ GRN_INFO_SUPPORT_LZ4,
+/* Just for backward compatibility. We'll remove it at 5.0.0. */
+#define GRN_INFO_SUPPORT_LZO GRN_INFO_SUPPORT_LZ4
+ GRN_INFO_NORMALIZER,
+ GRN_INFO_TOKEN_FILTERS,
+ GRN_INFO_SUPPORT_ZSTD,
+ GRN_INFO_SUPPORT_ARROW
+} grn_info_type;
+
+GRN_API grn_obj *grn_obj_get_info(grn_ctx *ctx, grn_obj *obj, grn_info_type type, grn_obj *valuebuf);
+GRN_API grn_rc grn_obj_set_info(grn_ctx *ctx, grn_obj *obj, grn_info_type type, grn_obj *value);
+GRN_API grn_obj *grn_obj_get_element_info(grn_ctx *ctx, grn_obj *obj, grn_id id,
+ grn_info_type type, grn_obj *value);
+GRN_API grn_rc grn_obj_set_element_info(grn_ctx *ctx, grn_obj *obj, grn_id id,
+ grn_info_type type, grn_obj *value);
+
+GRN_API grn_obj *grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value);
+GRN_API int grn_obj_get_values(grn_ctx *ctx, grn_obj *obj, grn_id offset, void **values);
+
+#define GRN_COLUMN_EACH(ctx,column,id,value,block) do {\
+ int _n;\
+ grn_id id = 1;\
+ while ((_n = grn_obj_get_values(ctx, column, id, (void **)&value)) > 0) {\
+ for (; _n; _n--, id++, value++) {\
+ block\
+ }\
+ }\
+} while (0)
+
+#define GRN_OBJ_SET_MASK (0x07)
+#define GRN_OBJ_SET (0x01)
+#define GRN_OBJ_INCR (0x02)
+#define GRN_OBJ_DECR (0x03)
+#define GRN_OBJ_APPEND (0x04)
+#define GRN_OBJ_PREPEND (0x05)
+#define GRN_OBJ_GET (0x01<<4)
+#define GRN_OBJ_COMPARE (0x01<<5)
+#define GRN_OBJ_LOCK (0x01<<6)
+#define GRN_OBJ_UNLOCK (0x01<<7)
+
+GRN_API grn_rc grn_obj_set_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_obj *value, int flags);
+GRN_API grn_rc grn_obj_remove(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_rc grn_obj_remove_dependent(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_rc grn_obj_remove_force(grn_ctx *ctx,
+ const char *name,
+ int name_size);
+GRN_API grn_rc grn_obj_rename(grn_ctx *ctx, grn_obj *obj,
+ const char *name, unsigned int name_size);
+GRN_API grn_rc grn_table_rename(grn_ctx *ctx, grn_obj *table,
+ const char *name, unsigned int name_size);
+
+GRN_API grn_rc grn_column_rename(grn_ctx *ctx, grn_obj *column,
+ const char *name, unsigned int name_size);
+
+GRN_API grn_rc grn_obj_close(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_rc grn_obj_reinit(grn_ctx *ctx, grn_obj *obj, grn_id domain, unsigned char flags);
+GRN_API void grn_obj_unlink(grn_ctx *ctx, grn_obj *obj);
+
+GRN_API grn_user_data *grn_obj_user_data(grn_ctx *ctx, grn_obj *obj);
+
+GRN_API grn_rc grn_obj_set_finalizer(grn_ctx *ctx, grn_obj *obj, grn_proc_func *func);
+
+GRN_API const char *grn_obj_path(grn_ctx *ctx, grn_obj *obj);
+GRN_API int grn_obj_name(grn_ctx *ctx, grn_obj *obj, char *namebuf, int buf_size);
+
+GRN_API int grn_column_name(grn_ctx *ctx, grn_obj *obj, char *namebuf, int buf_size);
+
+GRN_API grn_id grn_obj_get_range(grn_ctx *ctx, grn_obj *obj);
+
+#define GRN_OBJ_GET_DOMAIN(obj) \
+ ((obj)->header.type == GRN_TABLE_NO_KEY ? GRN_ID_NIL : (obj)->header.domain)
+
+GRN_API int grn_obj_expire(grn_ctx *ctx, grn_obj *obj, int threshold);
+GRN_API int grn_obj_check(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_rc grn_obj_lock(grn_ctx *ctx, grn_obj *obj, grn_id id, int timeout);
+GRN_API grn_rc grn_obj_unlock(grn_ctx *ctx, grn_obj *obj, grn_id id);
+GRN_API grn_rc grn_obj_clear_lock(grn_ctx *ctx, grn_obj *obj);
+GRN_API unsigned int grn_obj_is_locked(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_rc grn_obj_flush(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_rc grn_obj_flush_recursive(grn_ctx *ctx, grn_obj *obj);
+GRN_API int grn_obj_defrag(grn_ctx *ctx, grn_obj *obj, int threshold);
+
+GRN_API grn_obj *grn_obj_db(grn_ctx *ctx, grn_obj *obj);
+
+GRN_API grn_id grn_obj_id(grn_ctx *ctx, grn_obj *obj);
+
+/* Flags for grn_fuzzy_search_optarg::flags. */
+#define GRN_TABLE_FUZZY_SEARCH_WITH_TRANSPOSITION (0x01)
+
+typedef struct _grn_fuzzy_search_optarg grn_fuzzy_search_optarg;
+
+struct _grn_fuzzy_search_optarg {
+ unsigned int max_distance;
+ unsigned int max_expansion;
+ unsigned int prefix_match_size;
+ int flags;
+};
+
+#define GRN_MATCH_INFO_GET_MIN_RECORD_ID (0x01)
+
+typedef struct _grn_match_info grn_match_info;
+
+struct _grn_match_info {
+ int flags;
+ grn_id min;
+};
+
+typedef struct _grn_search_optarg grn_search_optarg;
+
+struct _grn_search_optarg {
+ grn_operator mode;
+ int similarity_threshold;
+ int max_interval;
+ int *weight_vector;
+ int vector_size;
+ grn_obj *proc;
+ int max_size;
+ grn_obj *scorer;
+ grn_obj *scorer_args_expr;
+ unsigned int scorer_args_expr_offset;
+ grn_fuzzy_search_optarg fuzzy;
+ grn_match_info match_info;
+};
+
+GRN_API grn_rc grn_obj_search(grn_ctx *ctx, grn_obj *obj, grn_obj *query,
+ grn_obj *res, grn_operator op, grn_search_optarg *optarg);
+
+typedef grn_rc grn_selector_func(grn_ctx *ctx, grn_obj *table, grn_obj *index,
+ int nargs, grn_obj **args,
+ grn_obj *res, grn_operator op);
+
+GRN_API grn_rc grn_proc_set_selector(grn_ctx *ctx, grn_obj *proc,
+ grn_selector_func selector);
+GRN_API grn_rc grn_proc_set_selector_operator(grn_ctx *ctx,
+ grn_obj *proc,
+ grn_operator selector_op);
+GRN_API grn_operator grn_proc_get_selector_operator(grn_ctx *ctx,
+ grn_obj *proc);
+
+GRN_API grn_rc grn_proc_set_is_stable(grn_ctx *ctx,
+ grn_obj *proc,
+ grn_bool is_stable);
+GRN_API grn_bool grn_proc_is_stable(grn_ctx *ctx, grn_obj *proc);
+
+/*-------------------------------------------------------------
+ * grn_vector
+*/
+
+GRN_API unsigned int grn_vector_size(grn_ctx *ctx, grn_obj *vector);
+
+GRN_API grn_rc grn_vector_add_element(grn_ctx *ctx, grn_obj *vector,
+ const char *str, unsigned int str_len,
+ unsigned int weight, grn_id domain);
+
+GRN_API unsigned int grn_vector_get_element(grn_ctx *ctx, grn_obj *vector,
+ unsigned int offset, const char **str,
+ unsigned int *weight, grn_id *domain);
+GRN_API unsigned int grn_vector_pop_element(grn_ctx *ctx, grn_obj *vector,
+ const char **str,
+ unsigned int *weight,
+ grn_id *domain);
+
+/*-------------------------------------------------------------
+ * grn_uvector
+*/
+
+GRN_API unsigned int grn_uvector_size(grn_ctx *ctx, grn_obj *uvector);
+GRN_API unsigned int grn_uvector_element_size(grn_ctx *ctx, grn_obj *uvector);
+
+GRN_API grn_rc grn_uvector_add_element(grn_ctx *ctx, grn_obj *vector,
+ grn_id id, unsigned int weight);
+
+GRN_API grn_id grn_uvector_get_element(grn_ctx *ctx, grn_obj *uvector,
+ unsigned int offset,
+ unsigned int *weight);
+
+/*-------------------------------------------------------------
+ * API for hook
+ */
+
+GRN_API int grn_proc_call_next(grn_ctx *ctx, grn_obj *exec_info, grn_obj *in, grn_obj *out);
+GRN_API void *grn_proc_get_ctx_local_data(grn_ctx *ctx, grn_obj *exec_info);
+GRN_API void *grn_proc_get_hook_local_data(grn_ctx *ctx, grn_obj *exec_info);
+
+typedef enum {
+ GRN_HOOK_SET = 0,
+ GRN_HOOK_GET,
+ GRN_HOOK_INSERT,
+ GRN_HOOK_DELETE,
+ GRN_HOOK_SELECT
+} grn_hook_entry;
+
+GRN_API grn_rc grn_obj_add_hook(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry,
+ int offset, grn_obj *proc, grn_obj *data);
+GRN_API int grn_obj_get_nhooks(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry);
+GRN_API grn_obj *grn_obj_get_hook(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry,
+ int offset, grn_obj *data);
+GRN_API grn_rc grn_obj_delete_hook(grn_ctx *ctx, grn_obj *obj, grn_hook_entry entry, int offset);
+
+GRN_API grn_obj *grn_obj_open(grn_ctx *ctx, unsigned char type, grn_obj_flags flags, grn_id domain);
+
+/* Deprecated since 5.0.1. Use grn_column_find_index_data() instead. */
+GRN_API int grn_column_index(grn_ctx *ctx, grn_obj *column, grn_operator op,
+ grn_obj **indexbuf, int buf_size, int *section);
+
+/* @since 5.0.1. */
+typedef struct _grn_index_datum {
+ grn_obj *index;
+ unsigned int section;
+} grn_index_datum;
+
+/* @since 5.0.1. */
+GRN_API unsigned int grn_column_find_index_data(grn_ctx *ctx, grn_obj *column,
+ grn_operator op,
+ grn_index_datum *index_data,
+ unsigned int n_index_data);
+/* @since 5.1.2. */
+GRN_API uint32_t grn_column_get_all_index_data(grn_ctx *ctx,
+ grn_obj *column,
+ grn_index_datum *index_data,
+ uint32_t n_index_data);
+
+GRN_API grn_rc grn_obj_delete_by_id(grn_ctx *ctx, grn_obj *db, grn_id id, grn_bool removep);
+GRN_API grn_rc grn_obj_path_by_id(grn_ctx *ctx, grn_obj *db, grn_id id, char *buffer);
+
+/* geo */
+
+typedef struct {
+ int latitude;
+ int longitude;
+} grn_geo_point;
+
+GRN_API grn_rc grn_geo_select_in_rectangle(grn_ctx *ctx,
+ grn_obj *index,
+ grn_obj *top_left_point,
+ grn_obj *bottom_right_point,
+ grn_obj *res,
+ grn_operator op);
+GRN_API unsigned int grn_geo_estimate_size_in_rectangle(grn_ctx *ctx,
+ grn_obj *index,
+ grn_obj *top_left_point,
+ grn_obj *bottom_right_point);
+/* Deprecated since 4.0.8. Use grn_geo_estimate_size_in_rectangle() instead. */
+GRN_API int grn_geo_estimate_in_rectangle(grn_ctx *ctx,
+ grn_obj *index,
+ grn_obj *top_left_point,
+ grn_obj *bottom_right_point);
+GRN_API grn_obj *grn_geo_cursor_open_in_rectangle(grn_ctx *ctx,
+ grn_obj *index,
+ grn_obj *top_left_point,
+ grn_obj *bottom_right_point,
+ int offset,
+ int limit);
+GRN_API grn_posting *grn_geo_cursor_next(grn_ctx *ctx, grn_obj *cursor);
+
+
+/* query & snippet */
+
+#ifndef GRN_QUERY_AND
+#define GRN_QUERY_AND '+'
+#endif /* GRN_QUERY_AND */
+#ifndef GRN_QUERY_AND_NOT
+# ifdef GRN_QUERY_BUT
+ /* Deprecated. Just for backward compatibility. */
+# define GRN_QUERY_AND_NOT GRN_QUERY_BUT
+# else
+# define GRN_QUERY_AND_NOT '-'
+# endif /* GRN_QUERY_BUT */
+#endif /* GRN_QUERY_AND_NOT */
+#ifndef GRN_QUERY_ADJ_INC
+#define GRN_QUERY_ADJ_INC '>'
+#endif /* GRN_QUERY_ADJ_POS2 */
+#ifndef GRN_QUERY_ADJ_DEC
+#define GRN_QUERY_ADJ_DEC '<'
+#endif /* GRN_QUERY_ADJ_POS1 */
+#ifndef GRN_QUERY_ADJ_NEG
+#define GRN_QUERY_ADJ_NEG '~'
+#endif /* GRN_QUERY_ADJ_NEG */
+#ifndef GRN_QUERY_PREFIX
+#define GRN_QUERY_PREFIX '*'
+#endif /* GRN_QUERY_PREFIX */
+#ifndef GRN_QUERY_PARENL
+#define GRN_QUERY_PARENL '('
+#endif /* GRN_QUERY_PARENL */
+#ifndef GRN_QUERY_PARENR
+#define GRN_QUERY_PARENR ')'
+#endif /* GRN_QUERY_PARENR */
+#ifndef GRN_QUERY_QUOTEL
+#define GRN_QUERY_QUOTEL '"'
+#endif /* GRN_QUERY_QUOTEL */
+#ifndef GRN_QUERY_QUOTER
+#define GRN_QUERY_QUOTER '"'
+#endif /* GRN_QUERY_QUOTER */
+#ifndef GRN_QUERY_ESCAPE
+#define GRN_QUERY_ESCAPE '\\'
+#endif /* GRN_QUERY_ESCAPE */
+#ifndef GRN_QUERY_COLUMN
+#define GRN_QUERY_COLUMN ':'
+#endif /* GRN_QUERY_COLUMN */
+
+typedef struct _grn_snip_mapping grn_snip_mapping;
+
+struct _grn_snip_mapping {
+ void *dummy;
+};
+
+#define GRN_SNIP_NORMALIZE (0x01<<0)
+#define GRN_SNIP_COPY_TAG (0x01<<1)
+#define GRN_SNIP_SKIP_LEADING_SPACES (0x01<<2)
+
+#define GRN_SNIP_MAPPING_HTML_ESCAPE ((grn_snip_mapping *)-1)
+
+GRN_API grn_obj *grn_snip_open(grn_ctx *ctx, int flags, unsigned int width,
+ unsigned int max_results,
+ const char *defaultopentag, unsigned int defaultopentag_len,
+ const char *defaultclosetag, unsigned int defaultclosetag_len,
+ grn_snip_mapping *mapping);
+GRN_API grn_rc grn_snip_add_cond(grn_ctx *ctx, grn_obj *snip,
+ const char *keyword, unsigned int keyword_len,
+ const char *opentag, unsigned int opentag_len,
+ const char *closetag, unsigned int closetag_len);
+GRN_API grn_rc grn_snip_set_normalizer(grn_ctx *ctx, grn_obj *snip,
+ grn_obj *normalizer);
+GRN_API grn_obj *grn_snip_get_normalizer(grn_ctx *ctx, grn_obj *snip);
+GRN_API grn_rc grn_snip_exec(grn_ctx *ctx, grn_obj *snip,
+ const char *string, unsigned int string_len,
+ unsigned int *nresults, unsigned int *max_tagged_len);
+GRN_API grn_rc grn_snip_get_result(grn_ctx *ctx, grn_obj *snip, const unsigned int index,
+ char *result, unsigned int *result_len);
+
+/* log */
+
+#define GRN_LOG_TIME (0x01<<0)
+#define GRN_LOG_TITLE (0x01<<1)
+#define GRN_LOG_MESSAGE (0x01<<2)
+#define GRN_LOG_LOCATION (0x01<<3)
+#define GRN_LOG_PID (0x01<<4)
+
+/* Deprecated since 2.1.2. Use grn_logger instead. */
+typedef struct _grn_logger_info grn_logger_info;
+
+/* Deprecated since 2.1.2. Use grn_logger instead. */
+struct _grn_logger_info {
+ grn_log_level max_level;
+ int flags;
+ void (*func)(int, const char *, const char *, const char *, const char *, void *);
+ void *func_arg;
+};
+
+/* Deprecated since 2.1.2. Use grn_logger_set() instead. */
+GRN_API grn_rc grn_logger_info_set(grn_ctx *ctx, const grn_logger_info *info);
+
+typedef struct _grn_logger grn_logger;
+
+struct _grn_logger {
+ grn_log_level max_level;
+ int flags;
+ void *user_data;
+ void (*log)(grn_ctx *ctx, grn_log_level level,
+ const char *timestamp, const char *title, const char *message,
+ const char *location, void *user_data);
+ void (*reopen)(grn_ctx *ctx, void *user_data);
+ void (*fin)(grn_ctx *ctx, void *user_data);
+};
+
+GRN_API grn_rc grn_logger_set(grn_ctx *ctx, const grn_logger *logger);
+
+GRN_API void grn_logger_set_max_level(grn_ctx *ctx, grn_log_level max_level);
+GRN_API grn_log_level grn_logger_get_max_level(grn_ctx *ctx);
+
+#ifdef __GNUC__
+# define GRN_ATTRIBUTE_PRINTF(fmt_pos) \
+ __attribute__ ((format(printf, fmt_pos, fmt_pos + 1)))
+#else
+# define GRN_ATTRIBUTE_PRINTF(fmt_pos)
+#endif /* __GNUC__ */
+
+#if defined(__clang__)
+# if __has_attribute(__alloc_size__)
+# define HAVE_ALLOC_SIZE_ATTRIBUTE
+# endif /* __has_attribute(__alloc_size__) */
+#elif defined(__GNUC__) && \
+ ((__GNUC__ >= 5) || (__GNUC__ > 4 && __GNUC_MINOR__ >= 3))
+# define HAVE_ALLOC_SIZE_ATTRIBUTE
+#endif /* __clang__ */
+
+#ifdef HAVE_ALLOC_SIZE_ATTRIBUTE
+# define GRN_ATTRIBUTE_ALLOC_SIZE(size) \
+ __attribute__ ((alloc_size(size)))
+# define GRN_ATTRIBUTE_ALLOC_SIZE_N(n, size) \
+ __attribute__ ((alloc_size(n, size)))
+#else
+# define GRN_ATTRIBUTE_ALLOC_SIZE(size)
+# define GRN_ATTRIBUTE_ALLOC_SIZE_N(n, size)
+#endif /* HAVE_ALLOC_SIZE_ATTRIBUTE */
+
+GRN_API void grn_logger_put(grn_ctx *ctx, grn_log_level level,
+ const char *file, int line, const char *func, const char *fmt, ...) GRN_ATTRIBUTE_PRINTF(6);
+GRN_API void grn_logger_putv(grn_ctx *ctx,
+ grn_log_level level,
+ const char *file,
+ int line,
+ const char *func,
+ const char *fmt,
+ va_list ap);
+GRN_API void grn_logger_reopen(grn_ctx *ctx);
+
+GRN_API grn_bool grn_logger_pass(grn_ctx *ctx, grn_log_level level);
+
+#ifndef GRN_LOG_DEFAULT_LEVEL
+# define GRN_LOG_DEFAULT_LEVEL GRN_LOG_NOTICE
+#endif /* GRN_LOG_DEFAULT_LEVEL */
+
+GRN_API void grn_default_logger_set_max_level(grn_log_level level);
+GRN_API grn_log_level grn_default_logger_get_max_level(void);
+GRN_API void grn_default_logger_set_flags(int flags);
+GRN_API int grn_default_logger_get_flags(void);
+GRN_API void grn_default_logger_set_path(const char *path);
+GRN_API const char *grn_default_logger_get_path(void);
+GRN_API void grn_default_logger_set_rotate_threshold_size(off_t threshold);
+GRN_API off_t grn_default_logger_get_rotate_threshold_size(void);
+
+#define GRN_LOG(ctx,level,...) do {\
+ if (grn_logger_pass(ctx, level)) {\
+ grn_logger_put(ctx, (level), __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); \
+ }\
+} while (0)
+
+typedef struct _grn_query_logger grn_query_logger;
+
+struct _grn_query_logger {
+ unsigned int flags;
+ void *user_data;
+ void (*log)(grn_ctx *ctx, unsigned int flag,
+ const char *timestamp, const char *info, const char *message,
+ void *user_data);
+ void (*reopen)(grn_ctx *ctx, void *user_data);
+ void (*fin)(grn_ctx *ctx, void *user_data);
+};
+
+GRN_API grn_bool grn_query_log_flags_parse(const char *string,
+ int string_size,
+ unsigned int *flags);
+
+GRN_API grn_rc grn_query_logger_set(grn_ctx *ctx, const grn_query_logger *logger);
+GRN_API void grn_query_logger_set_flags(grn_ctx *ctx, unsigned int flags);
+GRN_API void grn_query_logger_add_flags(grn_ctx *ctx, unsigned int flags);
+GRN_API void grn_query_logger_remove_flags(grn_ctx *ctx, unsigned int flags);
+GRN_API unsigned int grn_query_logger_get_flags(grn_ctx *ctx);
+
+GRN_API void grn_query_logger_put(grn_ctx *ctx, unsigned int flag,
+ const char *mark,
+ const char *format, ...) GRN_ATTRIBUTE_PRINTF(4);
+GRN_API void grn_query_logger_reopen(grn_ctx *ctx);
+
+GRN_API grn_bool grn_query_logger_pass(grn_ctx *ctx, unsigned int flag);
+
+GRN_API void grn_default_query_logger_set_flags(unsigned int flags);
+GRN_API unsigned int grn_default_query_logger_get_flags(void);
+GRN_API void grn_default_query_logger_set_path(const char *path);
+GRN_API const char *grn_default_query_logger_get_path(void);
+GRN_API void grn_default_query_logger_set_rotate_threshold_size(off_t threshold);
+GRN_API off_t grn_default_query_logger_get_rotate_threshold_size(void);
+
+#define GRN_QUERY_LOG(ctx, flag, mark, format, ...) do {\
+ if (grn_query_logger_pass(ctx, flag)) {\
+ grn_query_logger_put(ctx, (flag), (mark), format, __VA_ARGS__);\
+ }\
+} while (0)
+
+/* grn_bulk */
+
+#define GRN_BULK_BUFSIZE (sizeof(grn_obj) - sizeof(grn_obj_header))
+/* This assumes that GRN_BULK_BUFSIZE is less than 32 (= 0x20). */
+#define GRN_BULK_BUFSIZE_MAX 0x1f
+#define GRN_BULK_SIZE_IN_FLAGS(flags) ((flags) & GRN_BULK_BUFSIZE_MAX)
+#define GRN_BULK_OUTP(bulk) ((bulk)->header.impl_flags & GRN_OBJ_OUTPLACE)
+#define GRN_BULK_REWIND(bulk) do {\
+ if ((bulk)->header.type == GRN_VECTOR) {\
+ grn_obj *_body = (bulk)->u.v.body;\
+ if (_body) {\
+ if (GRN_BULK_OUTP(_body)) {\
+ (_body)->u.b.curr = (_body)->u.b.head;\
+ } else {\
+ (_body)->header.flags &= ~GRN_BULK_BUFSIZE_MAX;\
+ }\
+ }\
+ (bulk)->u.v.n_sections = 0;\
+ } else {\
+ if (GRN_BULK_OUTP(bulk)) {\
+ (bulk)->u.b.curr = (bulk)->u.b.head;\
+ } else {\
+ (bulk)->header.flags &= ~GRN_BULK_BUFSIZE_MAX;\
+ }\
+ }\
+} while (0)
+#define GRN_BULK_INCR_LEN(bulk,len) do {\
+ if (GRN_BULK_OUTP(bulk)) {\
+ (bulk)->u.b.curr += (len);\
+ } else {\
+ (bulk)->header.flags += (grn_obj_flags)(len);\
+ }\
+} while (0)
+#define GRN_BULK_WSIZE(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.tail - (bulk)->u.b.head)\
+ : GRN_BULK_BUFSIZE)
+#define GRN_BULK_REST(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.tail - (bulk)->u.b.curr)\
+ : GRN_BULK_BUFSIZE - GRN_BULK_SIZE_IN_FLAGS((bulk)->header.flags))
+#define GRN_BULK_VSIZE(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.curr - (bulk)->u.b.head)\
+ : GRN_BULK_SIZE_IN_FLAGS((bulk)->header.flags))
+#define GRN_BULK_EMPTYP(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.curr == (bulk)->u.b.head)\
+ : !(GRN_BULK_SIZE_IN_FLAGS((bulk)->header.flags)))
+#define GRN_BULK_HEAD(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.head)\
+ : (char *)&((bulk)->u.b.head))
+#define GRN_BULK_CURR(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.curr)\
+ : (char *)&((bulk)->u.b.head) + GRN_BULK_SIZE_IN_FLAGS((bulk)->header.flags))
+#define GRN_BULK_TAIL(bulk) \
+ (GRN_BULK_OUTP(bulk)\
+ ? ((bulk)->u.b.tail)\
+ : (char *)&((bulk)[1]))
+
+GRN_API grn_rc grn_bulk_reinit(grn_ctx *ctx, grn_obj *bulk, unsigned int size);
+GRN_API grn_rc grn_bulk_resize(grn_ctx *ctx, grn_obj *bulk, unsigned int newsize);
+GRN_API grn_rc grn_bulk_write(grn_ctx *ctx, grn_obj *bulk,
+ const char *str, unsigned int len);
+GRN_API grn_rc grn_bulk_write_from(grn_ctx *ctx, grn_obj *bulk,
+ const char *str, unsigned int from, unsigned int len);
+GRN_API grn_rc grn_bulk_reserve(grn_ctx *ctx, grn_obj *bulk, unsigned int len);
+GRN_API grn_rc grn_bulk_space(grn_ctx *ctx, grn_obj *bulk, unsigned int len);
+GRN_API grn_rc grn_bulk_truncate(grn_ctx *ctx, grn_obj *bulk, unsigned int len);
+GRN_API grn_rc grn_bulk_fin(grn_ctx *ctx, grn_obj *bulk);
+
+/* grn_text */
+
+GRN_API grn_rc grn_text_itoa(grn_ctx *ctx, grn_obj *bulk, int i);
+GRN_API grn_rc grn_text_itoa_padded(grn_ctx *ctx, grn_obj *bulk, int i, char ch, unsigned int len);
+GRN_API grn_rc grn_text_lltoa(grn_ctx *ctx, grn_obj *bulk, long long int i);
+GRN_API grn_rc grn_text_ftoa(grn_ctx *ctx, grn_obj *bulk, double d);
+GRN_API grn_rc grn_text_itoh(grn_ctx *ctx, grn_obj *bulk, int i, unsigned int len);
+GRN_API grn_rc grn_text_itob(grn_ctx *ctx, grn_obj *bulk, grn_id id);
+GRN_API grn_rc grn_text_lltob32h(grn_ctx *ctx, grn_obj *bulk, long long int i);
+GRN_API grn_rc grn_text_benc(grn_ctx *ctx, grn_obj *bulk, unsigned int v);
+GRN_API grn_rc grn_text_esc(grn_ctx *ctx, grn_obj *bulk, const char *s, unsigned int len);
+GRN_API grn_rc grn_text_urlenc(grn_ctx *ctx, grn_obj *buf,
+ const char *str, unsigned int len);
+GRN_API const char *grn_text_urldec(grn_ctx *ctx, grn_obj *buf,
+ const char *s, const char *e, char d);
+GRN_API grn_rc grn_text_escape_xml(grn_ctx *ctx, grn_obj *buf,
+ const char *s, unsigned int len);
+GRN_API grn_rc grn_text_time2rfc1123(grn_ctx *ctx, grn_obj *bulk, int sec);
+GRN_API grn_rc grn_text_printf(grn_ctx *ctx, grn_obj *bulk,
+ const char *format, ...) GRN_ATTRIBUTE_PRINTF(3);
+GRN_API grn_rc grn_text_vprintf(grn_ctx *ctx, grn_obj *bulk,
+ const char *format, va_list args);
+
+GRN_API void grn_ctx_recv_handler_set(grn_ctx *,
+ void (*func)(grn_ctx *, int, void *),
+ void *func_arg);
+
+/* various values exchanged via grn_obj */
+
+#define GRN_OBJ_DO_SHALLOW_COPY (GRN_OBJ_REFER|GRN_OBJ_OUTPLACE)
+#define GRN_OBJ_VECTOR (0x01<<7)
+
+#define GRN_OBJ_MUTABLE(obj) ((obj) && (obj)->header.type <= GRN_VECTOR)
+
+#define GRN_VALUE_FIX_SIZE_INIT(obj,flags,domain)\
+ GRN_OBJ_INIT((obj), ((flags) & GRN_OBJ_VECTOR) ? GRN_UVECTOR : GRN_BULK,\
+ ((flags) & GRN_OBJ_DO_SHALLOW_COPY), (domain))
+#define GRN_VALUE_VAR_SIZE_INIT(obj,flags,domain)\
+ GRN_OBJ_INIT((obj), ((flags) & GRN_OBJ_VECTOR) ? GRN_VECTOR : GRN_BULK,\
+ ((flags) & GRN_OBJ_DO_SHALLOW_COPY), (domain))
+
+#define GRN_VOID_INIT(obj) GRN_OBJ_INIT((obj), GRN_VOID, 0, GRN_DB_VOID)
+#define GRN_TEXT_INIT(obj,flags) \
+ GRN_VALUE_VAR_SIZE_INIT(obj, flags, GRN_DB_TEXT)
+#define GRN_SHORT_TEXT_INIT(obj,flags) \
+ GRN_VALUE_VAR_SIZE_INIT(obj, flags, GRN_DB_SHORT_TEXT)
+#define GRN_LONG_TEXT_INIT(obj,flags) \
+ GRN_VALUE_VAR_SIZE_INIT(obj, flags, GRN_DB_LONG_TEXT)
+#define GRN_TEXT_SET_REF(obj,str,len) do {\
+ (obj)->u.b.head = (char *)(str);\
+ (obj)->u.b.curr = (char *)(str) + (len);\
+} while (0)
+#define GRN_TEXT_SET(ctx,obj,str,len) do {\
+ if ((obj)->header.impl_flags & GRN_OBJ_REFER) {\
+ GRN_TEXT_SET_REF((obj), (str), (len));\
+ } else {\
+ grn_bulk_write_from((ctx), (obj), (const char *)(str), 0, (unsigned int)(len));\
+ }\
+} while (0)
+#define GRN_TEXT_PUT(ctx,obj,str,len) \
+ grn_bulk_write((ctx), (obj), (const char *)(str), (unsigned int)(len))
+#define GRN_TEXT_PUTC(ctx,obj,c) do {\
+ char _c = (c); grn_bulk_write((ctx), (obj), &_c, 1);\
+} while (0)
+
+#define GRN_TEXT_PUTS(ctx,obj,str) GRN_TEXT_PUT((ctx), (obj), (str), strlen(str))
+#define GRN_TEXT_SETS(ctx,obj,str) GRN_TEXT_SET((ctx), (obj), (str), strlen(str))
+#define GRN_TEXT_VALUE(obj) GRN_BULK_HEAD(obj)
+#define GRN_TEXT_LEN(obj) GRN_BULK_VSIZE(obj)
+
+#define GRN_TEXT_EQUAL_CSTRING(bulk, string)\
+ (GRN_TEXT_LEN(bulk) == strlen(string) &&\
+ memcmp(GRN_TEXT_VALUE(bulk), string, GRN_TEXT_LEN(bulk)) == 0)
+
+#define GRN_BOOL_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_BOOL)
+#define GRN_INT8_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT8)
+#define GRN_UINT8_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT8)
+#define GRN_INT16_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT16)
+#define GRN_UINT16_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT16)
+#define GRN_INT32_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT32)
+#define GRN_UINT32_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT32)
+#define GRN_INT64_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_INT64)
+#define GRN_UINT64_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_UINT64)
+#define GRN_FLOAT_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_FLOAT)
+#define GRN_TIME_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_TIME)
+#define GRN_RECORD_INIT GRN_VALUE_FIX_SIZE_INIT
+#define GRN_PTR_INIT(obj,flags,domain)\
+ GRN_OBJ_INIT((obj), ((flags) & GRN_OBJ_VECTOR) ? GRN_PVECTOR : GRN_PTR,\
+ ((flags) & (GRN_OBJ_DO_SHALLOW_COPY | GRN_OBJ_OWN)),\
+ (domain))
+#define GRN_TOKYO_GEO_POINT_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_TOKYO_GEO_POINT)
+#define GRN_WGS84_GEO_POINT_INIT(obj,flags) \
+ GRN_VALUE_FIX_SIZE_INIT(obj, flags, GRN_DB_WGS84_GEO_POINT)
+
+#define GRN_BOOL_SET(ctx,obj,val) do {\
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned char));\
+} while (0)
+#define GRN_INT8_SET(ctx,obj,val) do {\
+ signed char _val = (signed char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(signed char));\
+} while (0)
+#define GRN_UINT8_SET(ctx,obj,val) do {\
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned char));\
+} while (0)
+#define GRN_INT16_SET(ctx,obj,val) do {\
+ signed short _val = (signed short)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(signed short));\
+} while (0)
+#define GRN_UINT16_SET(ctx,obj,val) do {\
+ unsigned short _val = (unsigned short)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned short));\
+} while (0)
+#define GRN_INT32_SET(ctx,obj,val) do {\
+ int _val = (int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(int));\
+} while (0)
+#define GRN_UINT32_SET(ctx,obj,val) do {\
+ unsigned int _val = (unsigned int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(unsigned int));\
+} while (0)
+#define GRN_INT64_SET(ctx,obj,val) do {\
+ long long int _val = (long long int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(long long int));\
+} while (0)
+#define GRN_UINT64_SET(ctx,obj,val) do {\
+ long long unsigned int _val = (long long unsigned int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(long long unsigned int));\
+} while (0)
+#define GRN_FLOAT_SET(ctx,obj,val) do {\
+ double _val = (double)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(double));\
+} while (0)
+#define GRN_TIME_SET GRN_INT64_SET
+#define GRN_RECORD_SET(ctx,obj,val) do {\
+ grn_id _val = (grn_id)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_id));\
+} while (0)
+#define GRN_PTR_SET(ctx,obj,val) do {\
+ grn_obj *_val = (grn_obj *)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_obj *));\
+} while (0)
+
+#define GRN_GEO_DEGREE2MSEC(degree)\
+ ((int)((degree) * 3600 * 1000 + ((degree) > 0 ? 0.5 : -0.5)))
+#define GRN_GEO_MSEC2DEGREE(msec)\
+ ((((int)(msec)) / 3600.0) * 0.001)
+
+#define GRN_GEO_POINT_SET(ctx,obj,_latitude,_longitude) do {\
+ grn_geo_point _val;\
+ _val.latitude = (int)(_latitude);\
+ _val.longitude = (int)(_longitude);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val, 0, sizeof(grn_geo_point));\
+} while (0)
+
+#define GRN_BOOL_SET_AT(ctx,obj,offset,val) do {\
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset), sizeof(unsigned char));\
+} while (0)
+#define GRN_INT8_SET_AT(ctx,obj,offset,val) do {\
+ signed char _val = (signed char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(signed char), sizeof(signed char));\
+} while (0)
+#define GRN_UINT8_SET_AT(ctx,obj,offset,val) do { \
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(unsigned char), sizeof(unsigned char));\
+} while (0)
+#define GRN_INT16_SET_AT(ctx,obj,offset,val) do {\
+ signed short _val = (signed short)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(signed short), sizeof(signed short));\
+} while (0)
+#define GRN_UINT16_SET_AT(ctx,obj,offset,val) do { \
+ unsigned short _val = (unsigned short)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(unsigned short), sizeof(unsigned short));\
+} while (0)
+#define GRN_INT32_SET_AT(ctx,obj,offset,val) do {\
+ int _val = (int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(int), sizeof(int));\
+} while (0)
+#define GRN_UINT32_SET_AT(ctx,obj,offset,val) do { \
+ unsigned int _val = (unsigned int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(unsigned int), sizeof(unsigned int));\
+} while (0)
+#define GRN_INT64_SET_AT(ctx,obj,offset,val) do {\
+ long long int _val = (long long int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(long long int), sizeof(long long int));\
+} while (0)
+#define GRN_UINT64_SET_AT(ctx,obj,offset,val) do {\
+ long long unsigned int _val = (long long unsigned int)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(long long unsigned int),\
+ sizeof(long long unsigned int));\
+} while (0)
+#define GRN_FLOAT_SET_AT(ctx,obj,offset,val) do {\
+ double _val = (double)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(double), sizeof(double));\
+} while (0)
+#define GRN_TIME_SET_AT GRN_INT64_SET_AT
+#define GRN_RECORD_SET_AT(ctx,obj,offset,val) do {\
+ grn_id _val = (grn_id)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(grn_id), sizeof(grn_id));\
+} while (0)
+#define GRN_PTR_SET_AT(ctx,obj,offset,val) do {\
+ grn_obj *_val = (grn_obj *)(val);\
+ grn_bulk_write_from((ctx), (obj), (char *)&_val,\
+ (offset) * sizeof(grn_obj *), sizeof(grn_obj *));\
+} while (0)
+
+#define GRN_BOOL_VALUE(obj) (*((unsigned char *)GRN_BULK_HEAD(obj)))
+#define GRN_INT8_VALUE(obj) (*((signed char *)GRN_BULK_HEAD(obj)))
+#define GRN_UINT8_VALUE(obj) (*((unsigned char *)GRN_BULK_HEAD(obj)))
+#define GRN_INT16_VALUE(obj) (*((signed short *)GRN_BULK_HEAD(obj)))
+#define GRN_UINT16_VALUE(obj) (*((unsigned short *)GRN_BULK_HEAD(obj)))
+#define GRN_INT32_VALUE(obj) (*((int *)GRN_BULK_HEAD(obj)))
+#define GRN_UINT32_VALUE(obj) (*((unsigned int *)GRN_BULK_HEAD(obj)))
+#define GRN_INT64_VALUE(obj) (*((long long int *)GRN_BULK_HEAD(obj)))
+#define GRN_UINT64_VALUE(obj) (*((long long unsigned int *)GRN_BULK_HEAD(obj)))
+#define GRN_FLOAT_VALUE(obj) (*((double *)GRN_BULK_HEAD(obj)))
+#define GRN_TIME_VALUE GRN_INT64_VALUE
+#define GRN_RECORD_VALUE(obj) (*((grn_id *)GRN_BULK_HEAD(obj)))
+#define GRN_PTR_VALUE(obj) (*((grn_obj **)GRN_BULK_HEAD(obj)))
+#define GRN_GEO_POINT_VALUE(obj,_latitude,_longitude) do {\
+ grn_geo_point *_val = (grn_geo_point *)GRN_BULK_HEAD(obj);\
+ _latitude = _val->latitude;\
+ _longitude = _val->longitude;\
+} while (0)
+
+#define GRN_BOOL_VALUE_AT(obj,offset) (((unsigned char *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_INT8_VALUE_AT(obj,offset) (((signed char *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_UINT8_VALUE_AT(obj,offset) (((unsigned char *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_INT16_VALUE_AT(obj,offset) (((signed short *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_UINT16_VALUE_AT(obj,offset) (((unsigned short *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_INT32_VALUE_AT(obj,offset) (((int *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_UINT32_VALUE_AT(obj,offset) (((unsigned int *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_INT64_VALUE_AT(obj,offset) (((long long int *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_UINT64_VALUE_AT(obj,offset) (((long long unsigned int *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_FLOAT_VALUE_AT(obj,offset) (((double *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_TIME_VALUE_AT GRN_INT64_VALUE_AT
+#define GRN_RECORD_VALUE_AT(obj,offset) (((grn_id *)GRN_BULK_HEAD(obj))[offset])
+#define GRN_PTR_VALUE_AT(obj,offset) (((grn_obj **)GRN_BULK_HEAD(obj))[offset])
+
+#define GRN_BOOL_PUT(ctx,obj,val) do {\
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned char));\
+} while (0)
+#define GRN_INT8_PUT(ctx,obj,val) do {\
+ signed char _val = (signed char)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(signed char));\
+} while (0)
+#define GRN_UINT8_PUT(ctx,obj,val) do {\
+ unsigned char _val = (unsigned char)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned char));\
+} while (0)
+#define GRN_INT16_PUT(ctx,obj,val) do {\
+ signed short _val = (signed short)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(signed short));\
+} while (0)
+#define GRN_UINT16_PUT(ctx,obj,val) do {\
+ unsigned short _val = (unsigned short)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned short));\
+} while (0)
+#define GRN_INT32_PUT(ctx,obj,val) do {\
+ int _val = (int)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(int));\
+} while (0)
+#define GRN_UINT32_PUT(ctx,obj,val) do {\
+ unsigned int _val = (unsigned int)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(unsigned int));\
+} while (0)
+#define GRN_INT64_PUT(ctx,obj,val) do {\
+ long long int _val = (long long int)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(long long int));\
+} while (0)
+#define GRN_UINT64_PUT(ctx,obj,val) do {\
+ long long unsigned int _val = (long long unsigned int)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(long long unsigned int));\
+} while (0)
+#define GRN_FLOAT_PUT(ctx,obj,val) do {\
+ double _val = (double)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(double));\
+} while (0)
+#define GRN_TIME_PUT GRN_INT64_PUT
+#define GRN_RECORD_PUT(ctx,obj,val) do {\
+ grn_id _val = (grn_id)(val); grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(grn_id));\
+} while (0)
+#define GRN_PTR_PUT(ctx,obj,val) do {\
+ grn_obj *_val = (grn_obj *)(val);\
+ grn_bulk_write((ctx), (obj), (char *)&_val, sizeof(grn_obj *));\
+} while (0)
+
+#define GRN_BULK_POP(obj, value, type, default) do {\
+ if (GRN_BULK_VSIZE(obj) >= sizeof(type)) {\
+ GRN_BULK_INCR_LEN((obj), -(sizeof(type)));\
+ value = *(type *)(GRN_BULK_CURR(obj));\
+ } else {\
+ value = default;\
+ }\
+} while (0)
+#define GRN_BOOL_POP(obj, value) GRN_BULK_POP(obj, value, unsigned char, 0)
+#define GRN_INT8_POP(obj, value) GRN_BULK_POP(obj, value, int8_t, 0)
+#define GRN_UINT8_POP(obj, value) GRN_BULK_POP(obj, value, uint8_t, 0)
+#define GRN_INT16_POP(obj, value) GRN_BULK_POP(obj, value, int16_t, 0)
+#define GRN_UINT16_POP(obj, value) GRN_BULK_POP(obj, value, uint16_t, 0)
+#define GRN_INT32_POP(obj, value) GRN_BULK_POP(obj, value, int32_t, 0)
+#define GRN_UINT32_POP(obj, value) GRN_BULK_POP(obj, value, uint32_t, 0)
+#define GRN_INT64_POP(obj, value) GRN_BULK_POP(obj, value, int64_t, 0)
+#define GRN_UINT64_POP(obj, value) GRN_BULK_POP(obj, value, uint64_t, 0)
+#define GRN_FLOAT_POP(obj, value) GRN_BULK_POP(obj, value, double, 0.0)
+#define GRN_TIME_POP GRN_INT64_POP
+#define GRN_RECORD_POP(obj, value) GRN_BULK_POP(obj, value, grn_id, GRN_ID_NIL)
+#define GRN_PTR_POP(obj, value) GRN_BULK_POP(obj, value, grn_obj *, NULL)
+
+/* grn_str: deprecated. use grn_string instead. */
+
+typedef struct {
+ const char *orig;
+ char *norm;
+ short *checks;
+ unsigned char *ctypes;
+ int flags;
+ unsigned int orig_blen;
+ unsigned int norm_blen;
+ unsigned int length;
+ grn_encoding encoding;
+} grn_str;
+
+#define GRN_STR_REMOVEBLANK (0x01<<0)
+#define GRN_STR_WITH_CTYPES (0x01<<1)
+#define GRN_STR_WITH_CHECKS (0x01<<2)
+#define GRN_STR_NORMALIZE GRN_OBJ_KEY_NORMALIZE
+
+GRN_API grn_str *grn_str_open(grn_ctx *ctx, const char *str, unsigned int str_len,
+ int flags);
+GRN_API grn_rc grn_str_close(grn_ctx *ctx, grn_str *nstr);
+
+/* grn_string */
+
+#define GRN_STRING_REMOVE_BLANK (0x01<<0)
+#define GRN_STRING_WITH_TYPES (0x01<<1)
+#define GRN_STRING_WITH_CHECKS (0x01<<2)
+#define GRN_STRING_REMOVE_TOKENIZED_DELIMITER (0x01<<3)
+
+#define GRN_NORMALIZER_AUTO ((grn_obj *)1)
+
+#define GRN_CHAR_BLANK 0x80
+#define GRN_CHAR_IS_BLANK(c) ((c) & (GRN_CHAR_BLANK))
+#define GRN_CHAR_TYPE(c) ((c) & 0x7f)
+
+typedef enum {
+ GRN_CHAR_NULL = 0,
+ GRN_CHAR_ALPHA,
+ GRN_CHAR_DIGIT,
+ GRN_CHAR_SYMBOL,
+ GRN_CHAR_HIRAGANA,
+ GRN_CHAR_KATAKANA,
+ GRN_CHAR_KANJI,
+ GRN_CHAR_OTHERS
+} grn_char_type;
+
+GRN_API grn_obj *grn_string_open(grn_ctx *ctx,
+ const char *string,
+ unsigned int length_in_bytes,
+ grn_obj *normalizer, int flags);
+GRN_API grn_rc grn_string_get_original(grn_ctx *ctx, grn_obj *string,
+ const char **original,
+ unsigned int *length_in_bytes);
+GRN_API int grn_string_get_flags(grn_ctx *ctx, grn_obj *string);
+GRN_API grn_rc grn_string_get_normalized(grn_ctx *ctx, grn_obj *string,
+ const char **normalized,
+ unsigned int *length_in_bytes,
+ unsigned int *n_characters);
+GRN_API grn_rc grn_string_set_normalized(grn_ctx *ctx, grn_obj *string,
+ char *normalized,
+ unsigned int length_in_bytes,
+ unsigned int n_characters);
+GRN_API const short *grn_string_get_checks(grn_ctx *ctx, grn_obj *string);
+GRN_API grn_rc grn_string_set_checks(grn_ctx *ctx,
+ grn_obj *string,
+ short *checks);
+GRN_API const unsigned char *grn_string_get_types(grn_ctx *ctx, grn_obj *string);
+GRN_API grn_rc grn_string_set_types(grn_ctx *ctx,
+ grn_obj *string,
+ unsigned char *types);
+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);
+
+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 int grn_obj_columns(grn_ctx *ctx, grn_obj *table,
+ const char *str, unsigned int str_size, grn_obj *res);
+
+GRN_API grn_rc grn_load(grn_ctx *ctx, grn_content_type input_type,
+ const char *table, unsigned int table_len,
+ const char *columns, unsigned int columns_len,
+ const char *values, unsigned int values_len,
+ const char *ifexists, unsigned int ifexists_len,
+ const char *each, unsigned int each_len);
+
+#define GRN_CTX_MORE (0x01<<0)
+#define GRN_CTX_TAIL (0x01<<1)
+#define GRN_CTX_HEAD (0x01<<2)
+#define GRN_CTX_QUIET (0x01<<3)
+#define GRN_CTX_QUIT (0x01<<4)
+
+GRN_API grn_rc grn_ctx_connect(grn_ctx *ctx, const char *host, int port, int flags);
+GRN_API unsigned int grn_ctx_send(grn_ctx *ctx, const char *str, unsigned int str_len, int flags);
+GRN_API unsigned int grn_ctx_recv(grn_ctx *ctx, char **str, unsigned int *str_len, int *flags);
+
+typedef struct _grn_ctx_info grn_ctx_info;
+
+struct _grn_ctx_info {
+ int fd;
+ unsigned int com_status;
+ grn_obj *outbuf;
+ unsigned char stat;
+};
+
+GRN_API grn_rc grn_ctx_info_get(grn_ctx *ctx, grn_ctx_info *info);
+
+GRN_API grn_rc grn_set_segv_handler(void);
+GRN_API grn_rc grn_set_int_handler(void);
+GRN_API grn_rc grn_set_term_handler(void);
+
+
+typedef struct _grn_table_delete_optarg grn_table_delete_optarg;
+
+struct _grn_table_delete_optarg {
+ int flags;
+ int (*func)(grn_ctx *ctx, grn_obj *, grn_id, void *);
+ void *func_arg;
+};
+
+struct _grn_table_scan_hit {
+ grn_id id;
+ unsigned int offset;
+ unsigned int length;
+};
+
+typedef struct {
+ int64_t tv_sec;
+ int32_t tv_nsec;
+} grn_timeval;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/hash.h b/storage/mroonga/vendor/groonga/include/groonga/hash.h
new file mode 100644
index 00000000..6a008176
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/hash.h
@@ -0,0 +1,104 @@
+/*
+ Copyright(C) 2009-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GRN_HASH_TINY (0x01<<6)
+
+typedef struct _grn_hash grn_hash;
+typedef struct _grn_hash_cursor grn_hash_cursor;
+
+GRN_API grn_hash *grn_hash_create(grn_ctx *ctx, const char *path, unsigned int key_size,
+ unsigned int value_size, unsigned int flags);
+
+GRN_API grn_hash *grn_hash_open(grn_ctx *ctx, const char *path);
+
+GRN_API grn_rc grn_hash_close(grn_ctx *ctx, grn_hash *hash);
+
+GRN_API grn_id grn_hash_add(grn_ctx *ctx, grn_hash *hash, const void *key,
+ unsigned int key_size, void **value, int *added);
+GRN_API grn_id grn_hash_get(grn_ctx *ctx, grn_hash *hash, const void *key,
+ unsigned int key_size, void **value);
+
+GRN_API int grn_hash_get_key(grn_ctx *ctx, grn_hash *hash, grn_id id, void *keybuf, int bufsize);
+GRN_API int grn_hash_get_key2(grn_ctx *ctx, grn_hash *hash, grn_id id, grn_obj *bulk);
+GRN_API int grn_hash_get_value(grn_ctx *ctx, grn_hash *hash, grn_id id, void *valuebuf);
+GRN_API grn_rc grn_hash_set_value(grn_ctx *ctx, grn_hash *hash, grn_id id,
+ const void *value, int flags);
+
+GRN_API grn_rc grn_hash_delete_by_id(grn_ctx *ctx, grn_hash *hash, grn_id id,
+ grn_table_delete_optarg *optarg);
+GRN_API grn_rc grn_hash_delete(grn_ctx *ctx, grn_hash *hash,
+ const void *key, unsigned int key_size,
+ grn_table_delete_optarg *optarg);
+
+GRN_API uint32_t grn_hash_size(grn_ctx *ctx, grn_hash *hash);
+
+GRN_API grn_hash_cursor *grn_hash_cursor_open(grn_ctx *ctx, grn_hash *hash,
+ const void *min, unsigned int min_size,
+ const void *max, unsigned int max_size,
+ int offset, int limit, int flags);
+GRN_API grn_id grn_hash_cursor_next(grn_ctx *ctx, grn_hash_cursor *c);
+GRN_API void grn_hash_cursor_close(grn_ctx *ctx, grn_hash_cursor *c);
+
+GRN_API int grn_hash_cursor_get_key(grn_ctx *ctx, grn_hash_cursor *c, void **key);
+GRN_API int grn_hash_cursor_get_value(grn_ctx *ctx, grn_hash_cursor *c, void **value);
+GRN_API grn_rc grn_hash_cursor_set_value(grn_ctx *ctx, grn_hash_cursor *c,
+ const void *value, int flags);
+
+GRN_API int grn_hash_cursor_get_key_value(grn_ctx *ctx, grn_hash_cursor *c,
+ void **key, unsigned int *key_size, void **value);
+
+GRN_API grn_rc grn_hash_cursor_delete(grn_ctx *ctx, grn_hash_cursor *c,
+ grn_table_delete_optarg *optarg);
+
+#define GRN_HASH_EACH(ctx,hash,id,key,key_size,value,block) do {\
+ grn_hash_cursor *_sc = grn_hash_cursor_open(ctx, hash, NULL, 0, NULL, 0, 0, -1, 0); \
+ if (_sc) {\
+ grn_id id;\
+ while ((id = grn_hash_cursor_next(ctx, _sc))) {\
+ grn_hash_cursor_get_key_value(ctx, _sc, (void **)(key),\
+ (key_size), (void **)(value));\
+ block\
+ }\
+ grn_hash_cursor_close(ctx, _sc);\
+ }\
+} while (0)
+
+#define GRN_HASH_EACH_BEGIN(ctx, hash, cursor, id) do {\
+ grn_hash_cursor *cursor;\
+ cursor = grn_hash_cursor_open((ctx), (hash),\
+ NULL, 0, NULL, 0,\
+ 0, -1, GRN_CURSOR_BY_ID);\
+ if (cursor) {\
+ grn_id id;\
+ while ((id = grn_hash_cursor_next((ctx), cursor)) != GRN_ID_NIL) {
+
+#define GRN_HASH_EACH_END(ctx, cursor)\
+ }\
+ grn_hash_cursor_close((ctx), cursor);\
+ }\
+} while(0)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/id.h b/storage/mroonga/vendor/groonga/include/groonga/id.h
new file mode 100644
index 00000000..ddd7dff1
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/id.h
@@ -0,0 +1,31 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_bool grn_id_is_builtin(grn_ctx *ctx, grn_id id);
+GRN_API grn_bool grn_id_is_builtin_type(grn_ctx *ctx, grn_id id);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/ii.h b/storage/mroonga/vendor/groonga/include/groonga/ii.h
new file mode 100644
index 00000000..d1913961
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/ii.h
@@ -0,0 +1,69 @@
+/*
+ Copyright(C) 2009-2017 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* buffered index builder */
+
+typedef struct _grn_ii grn_ii;
+typedef struct _grn_ii_buffer grn_ii_buffer;
+
+GRN_API uint32_t grn_ii_get_n_elements(grn_ctx *ctx, grn_ii *ii);
+
+GRN_API void grn_ii_cursor_set_min_enable_set(grn_bool enable);
+GRN_API grn_bool grn_ii_cursor_set_min_enable_get(void);
+
+GRN_API uint32_t grn_ii_estimate_size(grn_ctx *ctx, grn_ii *ii, grn_id tid);
+GRN_API uint32_t grn_ii_estimate_size_for_query(grn_ctx *ctx, grn_ii *ii,
+ const char *query,
+ unsigned int query_len,
+ grn_search_optarg *optarg);
+GRN_API uint32_t grn_ii_estimate_size_for_lexicon_cursor(grn_ctx *ctx,
+ grn_ii *ii,
+ grn_table_cursor *lexicon_cursor);
+
+GRN_API grn_ii_buffer *grn_ii_buffer_open(grn_ctx *ctx, grn_ii *ii,
+ long long unsigned int update_buffer_size);
+GRN_API grn_rc grn_ii_buffer_append(grn_ctx *ctx,
+ grn_ii_buffer *ii_buffer,
+ grn_id rid,
+ unsigned int section,
+ grn_obj *value);
+GRN_API grn_rc grn_ii_buffer_commit(grn_ctx *ctx, grn_ii_buffer *ii_buffer);
+GRN_API grn_rc grn_ii_buffer_close(grn_ctx *ctx, grn_ii_buffer *ii_buffer);
+
+GRN_API grn_rc grn_ii_posting_add(grn_ctx *ctx, grn_posting *pos,
+ grn_hash *s, grn_operator op);
+GRN_API void grn_ii_resolve_sel_and(grn_ctx *ctx, grn_hash *s, grn_operator op);
+
+
+/* Experimental */
+typedef struct _grn_ii_cursor grn_ii_cursor;
+GRN_API grn_ii_cursor *grn_ii_cursor_open(grn_ctx *ctx, grn_ii *ii, grn_id tid,
+ grn_id min, grn_id max, int nelements, int flags);
+GRN_API grn_posting *grn_ii_cursor_next(grn_ctx *ctx, grn_ii_cursor *c);
+GRN_API grn_posting *grn_ii_cursor_next_pos(grn_ctx *ctx, grn_ii_cursor *c);
+GRN_API grn_rc grn_ii_cursor_close(grn_ctx *ctx, grn_ii_cursor *c);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/nfkc.h b/storage/mroonga/vendor/groonga/include/groonga/nfkc.h
new file mode 100644
index 00000000..e771fd9b
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/nfkc.h
@@ -0,0 +1,31 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2009-2016 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-1335 USA
+*/
+
+#pragma once
+
+#include <groonga.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_char_type grn_nfkc_char_type(const unsigned char *utf8);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/normalizer.h b/storage/mroonga/vendor/groonga/include/groonga/normalizer.h
new file mode 100644
index 00000000..b95ef6a2
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/normalizer.h
@@ -0,0 +1,53 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2012-2016 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-1335 USA
+*/
+
+#pragma once
+
+#include <stddef.h>
+
+#include <groonga/plugin.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ grn_normalizer_register() registers a normalizer to the database
+ which is associated with `ctx'. `name_ptr' and `name_length' specify
+ the normalizer name. `name_length' can be `-1'. `-1' means that
+ `name_ptr` is NULL-terminated. Alphabetic letters ('A'-'Z' and
+ 'a'-'z'), digits ('0'-'9') and an underscore ('_') are capable
+ characters. `init', `next' and `fin' specify the normalizer
+ functions. `init' is called for initializing a tokenizer for a
+ document or query. `next' is called for extracting tokens one by
+ one. `fin' is called for finalizing a
+ tokenizer. grn_tokenizer_register() returns GRN_SUCCESS on success,
+ an error code on failure. See "groonga.h" for more details of
+ grn_proc_func and grn_user_data, that is used as an argument of
+ grn_proc_func.
+ */
+GRN_PLUGIN_EXPORT grn_rc grn_normalizer_register(grn_ctx *ctx,
+ const char *name_ptr,
+ int name_length,
+ grn_proc_func *init,
+ grn_proc_func *next,
+ grn_proc_func *fin);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/obj.h b/storage/mroonga/vendor/groonga/include/groonga/obj.h
new file mode 100644
index 00000000..32cc2d2c
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/obj.h
@@ -0,0 +1,81 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015-2017 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Just for backward compatibility. Use grn_obj_is_true() instead. */
+#define GRN_OBJ_IS_TRUE(ctx, obj, result) do { \
+ result = grn_obj_is_true(ctx, obj); \
+} while (0)
+
+GRN_API grn_bool grn_obj_is_true(grn_ctx *ctx, grn_obj *obj);
+
+GRN_API grn_bool grn_obj_is_builtin(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_bulk(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_text_family_bulk(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_table(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_column(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_scalar_column(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_vector_column(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_weight_vector_column(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_reference_column(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_data_column(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_index_column(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_accessor(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_key_accessor(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_type(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_text_family_type(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_tokenizer_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_function_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_selector_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_selector_only_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_normalizer_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_token_filter_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_scorer_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_window_function_proc(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_expr(grn_ctx *ctx, grn_obj *obj);
+
+GRN_API grn_rc grn_obj_cast(grn_ctx *ctx,
+ grn_obj *src,
+ grn_obj *dest,
+ grn_bool add_record_if_not_exist);
+
+GRN_API grn_rc grn_obj_reindex(grn_ctx *ctx, grn_obj *obj);
+
+GRN_API void grn_obj_touch(grn_ctx *ctx, grn_obj *obj, grn_timeval *tv);
+GRN_API uint32_t grn_obj_get_last_modified(grn_ctx *ctx, grn_obj *obj);
+GRN_API grn_bool grn_obj_is_dirty(grn_ctx *ctx, grn_obj *obj);
+
+GRN_API const char *grn_obj_type_to_string(uint8_t type);
+
+GRN_API grn_bool grn_obj_name_is_column(grn_ctx *ctx,
+ const char *name,
+ int name_len);
+
+GRN_API grn_bool grn_obj_is_corrupt(grn_ctx *ctx, grn_obj *obj);
+GRN_API size_t grn_obj_get_disk_usage(grn_ctx *ctx, grn_obj *obj);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/operator.h b/storage/mroonga/vendor/groonga/include/groonga/operator.h
new file mode 100644
index 00000000..7b45ac9e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/operator.h
@@ -0,0 +1,49 @@
+/*
+ Copyright(C) 2009-2017 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef grn_bool grn_operator_exec_func(grn_ctx *ctx,
+ grn_obj *x,
+ grn_obj *y);
+
+GRN_API const char *grn_operator_to_string(grn_operator op);
+GRN_API grn_operator_exec_func *grn_operator_to_exec_func(grn_operator op);
+GRN_API grn_bool grn_operator_exec_equal(grn_ctx *ctx, grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_not_equal(grn_ctx *ctx,
+ grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_less(grn_ctx *ctx, grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_greater(grn_ctx *ctx, grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_less_equal(grn_ctx *ctx,
+ grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_greater_equal(grn_ctx *ctx,
+ grn_obj *x, grn_obj *y);
+GRN_API grn_bool grn_operator_exec_match(grn_ctx *ctx,
+ grn_obj *target, grn_obj *sub_text);
+GRN_API grn_bool grn_operator_exec_prefix(grn_ctx *ctx,
+ grn_obj *target, grn_obj *prefix);
+GRN_API grn_bool grn_operator_exec_regexp(grn_ctx *ctx,
+ grn_obj *target, grn_obj *pattern);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/output.h b/storage/mroonga/vendor/groonga/include/groonga/output.h
new file mode 100644
index 00000000..cc33693c
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/output.h
@@ -0,0 +1,124 @@
+/*
+ Copyright(C) 2009-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _grn_obj_format grn_obj_format;
+
+#define GRN_OBJ_FORMAT_WITH_COLUMN_NAMES (0x01<<0)
+#define GRN_OBJ_FORMAT_AS_ARRAY (0x01<<3)
+/* Deprecated since 4.0.1. It will be removed at 5.0.0.
+ Use GRN_OBJ_FORMAT_AS_ARRAY instead.*/
+#define GRN_OBJ_FORMAT_ASARRAY GRN_OBJ_FORMAT_AS_ARRAY
+#define GRN_OBJ_FORMAT_WITH_WEIGHT (0x01<<4)
+
+struct _grn_obj_format {
+ grn_obj columns;
+ const void *min;
+ const void *max;
+ unsigned int min_size;
+ unsigned int max_size;
+ int nhits;
+ int offset;
+ int limit;
+ int hits_offset;
+ int flags;
+ grn_obj *expression;
+};
+
+#define GRN_OBJ_FORMAT_INIT(format,format_nhits,format_offset,format_limit,format_hits_offset) do { \
+ GRN_PTR_INIT(&(format)->columns, GRN_OBJ_VECTOR, GRN_ID_NIL);\
+ (format)->nhits = (format_nhits);\
+ (format)->offset = (format_offset);\
+ (format)->limit = (format_limit);\
+ (format)->hits_offset = (format_hits_offset);\
+ (format)->flags = 0;\
+ (format)->expression = NULL;\
+} while (0)
+
+#define GRN_OBJ_FORMAT_FIN(ctx,format) do {\
+ int ncolumns = GRN_BULK_VSIZE(&(format)->columns) / sizeof(grn_obj *);\
+ grn_obj **columns = (grn_obj **)GRN_BULK_HEAD(&(format)->columns);\
+ while (ncolumns--) {\
+ grn_obj *column = *columns;\
+ columns++;\
+ if (grn_obj_is_accessor((ctx), column)) {\
+ grn_obj_close((ctx), column);\
+ }\
+ }\
+ GRN_OBJ_FIN((ctx), &(format)->columns);\
+ if ((format)->expression) { GRN_OBJ_FIN((ctx), (format)->expression); } \
+} while (0)
+
+GRN_API void grn_output_obj(grn_ctx *ctx, grn_obj *outbuf, grn_content_type output_type,
+ grn_obj *obj, grn_obj_format *format);
+GRN_API void grn_output_envelope(grn_ctx *ctx, grn_rc rc,
+ grn_obj *head, grn_obj *body, grn_obj *foot,
+ const char *file, int line);
+
+GRN_API void grn_ctx_output_flush(grn_ctx *ctx, int flags);
+GRN_API void grn_ctx_output_array_open(grn_ctx *ctx,
+ const char *name, int nelements);
+GRN_API void grn_ctx_output_array_close(grn_ctx *ctx);
+GRN_API void grn_ctx_output_map_open(grn_ctx *ctx,
+ const char *name, int nelements);
+GRN_API void grn_ctx_output_map_close(grn_ctx *ctx);
+GRN_API void grn_ctx_output_null(grn_ctx *ctx);
+GRN_API void grn_ctx_output_int32(grn_ctx *ctx, int value);
+GRN_API void grn_ctx_output_int64(grn_ctx *ctx, int64_t value);
+GRN_API void grn_ctx_output_uint64(grn_ctx *ctx, uint64_t value);
+GRN_API void grn_ctx_output_float(grn_ctx *ctx, double value);
+GRN_API void grn_ctx_output_cstr(grn_ctx *ctx, const char *value);
+GRN_API void grn_ctx_output_str(grn_ctx *ctx,
+ const char *value, unsigned int value_len);
+GRN_API void grn_ctx_output_bool(grn_ctx *ctx, grn_bool value);
+GRN_API void grn_ctx_output_obj(grn_ctx *ctx,
+ grn_obj *value, grn_obj_format *format);
+GRN_API void grn_ctx_output_result_set_open(grn_ctx *ctx,
+ grn_obj *result_set,
+ grn_obj_format *format,
+ uint32_t n_additional_elements);
+GRN_API void grn_ctx_output_result_set_close(grn_ctx *ctx,
+ grn_obj *result_set,
+ grn_obj_format *format);
+GRN_API void grn_ctx_output_result_set(grn_ctx *ctx,
+ grn_obj *result_set,
+ grn_obj_format *format);
+GRN_API void grn_ctx_output_table_columns(grn_ctx *ctx,
+ grn_obj *table,
+ grn_obj_format *format);
+GRN_API void grn_ctx_output_table_records(grn_ctx *ctx,
+ grn_obj *table,
+ grn_obj_format *format);
+
+
+GRN_API grn_content_type grn_ctx_get_output_type(grn_ctx *ctx);
+GRN_API grn_rc grn_ctx_set_output_type(grn_ctx *ctx, grn_content_type type);
+GRN_API const char *grn_ctx_get_mime_type(grn_ctx *ctx);
+
+/* obsolete */
+GRN_API grn_rc grn_text_otoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj,
+ grn_obj_format *format);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/pat.h b/storage/mroonga/vendor/groonga/include/groonga/pat.h
new file mode 100644
index 00000000..c7008515
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/pat.h
@@ -0,0 +1,102 @@
+/*
+ Copyright(C) 2009-2016 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-1335 USA
+*/
+
+#pragma once
+
+#include "hash.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _grn_pat grn_pat;
+typedef struct _grn_pat_cursor grn_pat_cursor;
+typedef struct _grn_table_scan_hit grn_pat_scan_hit;
+
+GRN_API grn_pat *grn_pat_create(grn_ctx *ctx, const char *path, unsigned int key_size,
+ unsigned int value_size, unsigned int flags);
+
+GRN_API grn_pat *grn_pat_open(grn_ctx *ctx, const char *path);
+
+GRN_API grn_rc grn_pat_close(grn_ctx *ctx, grn_pat *pat);
+
+GRN_API grn_rc grn_pat_remove(grn_ctx *ctx, const char *path);
+
+GRN_API grn_id grn_pat_get(grn_ctx *ctx, grn_pat *pat, const void *key,
+ unsigned int key_size, void **value);
+GRN_API grn_id grn_pat_add(grn_ctx *ctx, grn_pat *pat, const void *key,
+ unsigned int key_size, void **value, int *added);
+
+GRN_API int grn_pat_get_key(grn_ctx *ctx, grn_pat *pat, grn_id id, void *keybuf, int bufsize);
+GRN_API int grn_pat_get_key2(grn_ctx *ctx, grn_pat *pat, grn_id id, grn_obj *bulk);
+GRN_API int grn_pat_get_value(grn_ctx *ctx, grn_pat *pat, grn_id id, void *valuebuf);
+GRN_API grn_rc grn_pat_set_value(grn_ctx *ctx, grn_pat *pat, grn_id id,
+ const void *value, int flags);
+
+GRN_API grn_rc grn_pat_delete_by_id(grn_ctx *ctx, grn_pat *pat, grn_id id,
+ grn_table_delete_optarg *optarg);
+GRN_API grn_rc grn_pat_delete(grn_ctx *ctx, grn_pat *pat, const void *key, unsigned int key_size,
+ grn_table_delete_optarg *optarg);
+GRN_API int grn_pat_delete_with_sis(grn_ctx *ctx, grn_pat *pat, grn_id id,
+ grn_table_delete_optarg *optarg);
+
+GRN_API int grn_pat_scan(grn_ctx *ctx, grn_pat *pat, const char *str, unsigned int str_len,
+ grn_pat_scan_hit *sh, unsigned int sh_size, const char **rest);
+
+GRN_API grn_rc grn_pat_prefix_search(grn_ctx *ctx, grn_pat *pat,
+ const void *key, unsigned int key_size, grn_hash *h);
+GRN_API grn_rc grn_pat_suffix_search(grn_ctx *ctx, grn_pat *pat,
+ const void *key, unsigned int key_size, grn_hash *h);
+GRN_API grn_id grn_pat_lcp_search(grn_ctx *ctx, grn_pat *pat,
+ const void *key, unsigned int key_size);
+
+GRN_API unsigned int grn_pat_size(grn_ctx *ctx, grn_pat *pat);
+
+GRN_API grn_pat_cursor *grn_pat_cursor_open(grn_ctx *ctx, grn_pat *pat,
+ const void *min, unsigned int min_size,
+ const void *max, unsigned int max_size,
+ int offset, int limit, int flags);
+GRN_API grn_id grn_pat_cursor_next(grn_ctx *ctx, grn_pat_cursor *c);
+GRN_API void grn_pat_cursor_close(grn_ctx *ctx, grn_pat_cursor *c);
+
+GRN_API int grn_pat_cursor_get_key(grn_ctx *ctx, grn_pat_cursor *c, void **key);
+GRN_API int grn_pat_cursor_get_value(grn_ctx *ctx, grn_pat_cursor *c, void **value);
+
+GRN_API int grn_pat_cursor_get_key_value(grn_ctx *ctx, grn_pat_cursor *c,
+ void **key, unsigned int *key_size, void **value);
+GRN_API grn_rc grn_pat_cursor_set_value(grn_ctx *ctx, grn_pat_cursor *c,
+ const void *value, int flags);
+GRN_API grn_rc grn_pat_cursor_delete(grn_ctx *ctx, grn_pat_cursor *c,
+ grn_table_delete_optarg *optarg);
+
+#define GRN_PAT_EACH(ctx,pat,id,key,key_size,value,block) do { \
+ grn_pat_cursor *_sc = grn_pat_cursor_open(ctx, pat, NULL, 0, NULL, 0, 0, -1, 0); \
+ if (_sc) {\
+ grn_id id;\
+ while ((id = grn_pat_cursor_next(ctx, _sc))) {\
+ grn_pat_cursor_get_key_value(ctx, _sc, (void **)(key),\
+ (key_size), (void **)(value));\
+ block\
+ }\
+ grn_pat_cursor_close(ctx, _sc);\
+ }\
+} while (0)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/plugin.h b/storage/mroonga/vendor/groonga/include/groonga/plugin.h
new file mode 100644
index 00000000..23d3d606
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/plugin.h
@@ -0,0 +1,217 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2010-2017 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-1335 USA
+*/
+
+#pragma once
+
+#include <stddef.h>
+
+#include <groonga.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+# define GRN_PLUGIN_IMPL_NAME_RAW(type) \
+ grn_plugin_impl_ ## type
+# define GRN_PLUGIN_IMPL_NAME_TAGGED(type, tag) \
+ GRN_PLUGIN_IMPL_NAME_RAW(type ## _ ## tag)
+# define GRN_PLUGIN_IMPL_NAME_TAGGED_EXPANDABLE(type, tag) \
+ GRN_PLUGIN_IMPL_NAME_TAGGED(type, tag)
+
+#ifdef GRN_PLUGIN_FUNCTION_TAG
+# define GRN_PLUGIN_IMPL_NAME(type) \
+ GRN_PLUGIN_IMPL_NAME_TAGGED_EXPANDABLE(type, GRN_PLUGIN_FUNCTION_TAG)
+#else /* GRN_PLUGIN_FUNCTION_TAG */
+# define GRN_PLUGIN_IMPL_NAME(type) \
+ GRN_PLUGIN_IMPL_NAME_RAW(type)
+#endif /* GRN_PLUGIN_FUNCTION_TAG */
+
+#define GRN_PLUGIN_INIT GRN_PLUGIN_IMPL_NAME(init)
+#define GRN_PLUGIN_REGISTER GRN_PLUGIN_IMPL_NAME(register)
+#define GRN_PLUGIN_FIN GRN_PLUGIN_IMPL_NAME(fin)
+
+#if defined(_WIN32) || defined(_WIN64)
+# define GRN_PLUGIN_EXPORT __declspec(dllexport)
+#else /* defined(_WIN32) || defined(_WIN64) */
+# define GRN_PLUGIN_EXPORT
+#endif /* defined(_WIN32) || defined(_WIN64) */
+
+GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_INIT(grn_ctx *ctx);
+GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_REGISTER(grn_ctx *ctx);
+GRN_PLUGIN_EXPORT grn_rc GRN_PLUGIN_FIN(grn_ctx *ctx);
+
+#define GRN_PLUGIN_DECLARE_FUNCTIONS(tag) \
+ extern grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(init, tag)(grn_ctx *ctx); \
+ extern grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(register, tag)(grn_ctx *ctx); \
+ extern grn_rc GRN_PLUGIN_IMPL_NAME_TAGGED(fin, tag)(grn_ctx *ctx)
+
+/*
+ Don't call these functions directly. Use GRN_PLUGIN_MALLOC(),
+ GRN_PLUGIN_CALLOC(), GRN_PLUGIN_REALLOC() and GRN_PLUGIN_FREE() instead.
+ */
+GRN_API void *grn_plugin_malloc(grn_ctx *ctx,
+ size_t size,
+ const char *file,
+ int line,
+ const char *func) GRN_ATTRIBUTE_ALLOC_SIZE(2);
+GRN_API void *grn_plugin_calloc(grn_ctx *ctx,
+ size_t size,
+ const char *file,
+ int line,
+ const char *func) GRN_ATTRIBUTE_ALLOC_SIZE(2);
+GRN_API void *grn_plugin_realloc(grn_ctx *ctx,
+ void *ptr,
+ size_t size,
+ const char *file,
+ int line,
+ const char *func) GRN_ATTRIBUTE_ALLOC_SIZE(3);
+GRN_API void grn_plugin_free(grn_ctx *ctx, void *ptr, const char *file,
+ int line, const char *func);
+
+#define GRN_PLUGIN_MALLOC(ctx, size) \
+ grn_plugin_malloc((ctx), (size), __FILE__, __LINE__, __FUNCTION__)
+#define GRN_PLUGIN_MALLOCN(ctx, type, n) \
+ ((type *)(grn_plugin_malloc((ctx), sizeof(type) * (n), \
+ __FILE__, __LINE__, __FUNCTION__)))
+#define GRN_PLUGIN_CALLOC(ctx, size) \
+ grn_plugin_calloc((ctx), (size), __FILE__, __LINE__, __FUNCTION__)
+#define GRN_PLUGIN_REALLOC(ctx, ptr, size) \
+ grn_plugin_realloc((ctx), (ptr), (size), __FILE__, __LINE__, __FUNCTION__)
+#define GRN_PLUGIN_FREE(ctx, ptr) \
+ grn_plugin_free((ctx), (ptr), __FILE__, __LINE__, __FUNCTION__)
+
+#define GRN_PLUGIN_LOG(ctx, level, ...) \
+ GRN_LOG((ctx), (level), __VA_ARGS__)
+
+/*
+ Don't call grn_plugin_set_error() directly. This function is used in
+ GRN_PLUGIN_SET_ERROR().
+ */
+GRN_API void grn_plugin_set_error(grn_ctx *ctx, grn_log_level level,
+ grn_rc error_code,
+ const char *file, int line, const char *func,
+ const char *format, ...) GRN_ATTRIBUTE_PRINTF(7);
+GRN_API void grn_plugin_clear_error(grn_ctx *ctx);
+
+
+/*
+ Don't call these functions directly. grn_plugin_backtrace() and
+ grn_plugin_logtrace() are used in GRN_PLUGIN_SET_ERROR().
+ */
+GRN_API void grn_plugin_backtrace(grn_ctx *ctx);
+GRN_API void grn_plugin_logtrace(grn_ctx *ctx, grn_log_level level);
+
+/*
+ Don't use GRN_PLUGIN_SET_ERROR() directly. This macro is used in
+ GRN_PLUGIN_ERROR().
+ */
+#define GRN_PLUGIN_SET_ERROR(ctx, level, error_code, ...) do { \
+ grn_plugin_set_error(ctx, level, error_code, \
+ __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__); \
+} while (0)
+
+#define GRN_PLUGIN_ERROR(ctx, error_code, ...) \
+ GRN_PLUGIN_SET_ERROR(ctx, GRN_LOG_ERROR, error_code, __VA_ARGS__)
+
+#define GRN_PLUGIN_CLEAR_ERROR(ctx) do { \
+ grn_plugin_clear_error((ctx)); \
+} while (0)
+
+typedef struct _grn_plugin_mutex grn_plugin_mutex;
+
+GRN_API grn_plugin_mutex *grn_plugin_mutex_open(grn_ctx *ctx);
+
+/*
+ grn_plugin_mutex_create() is deprecated. Use grn_plugin_mutex_open()
+ instead.
+*/
+GRN_API grn_plugin_mutex *grn_plugin_mutex_create(grn_ctx *ctx);
+
+GRN_API void grn_plugin_mutex_close(grn_ctx *ctx, grn_plugin_mutex *mutex);
+
+/*
+ grn_plugin_mutex_destroy() is deprecated. Use grn_plugin_mutex_close()
+ instead.
+*/
+GRN_API void grn_plugin_mutex_destroy(grn_ctx *ctx, grn_plugin_mutex *mutex);
+
+GRN_API void grn_plugin_mutex_lock(grn_ctx *ctx, grn_plugin_mutex *mutex);
+
+GRN_API void grn_plugin_mutex_unlock(grn_ctx *ctx, grn_plugin_mutex *mutex);
+
+GRN_API grn_obj *grn_plugin_proc_alloc(grn_ctx *ctx, grn_user_data *user_data,
+ grn_id domain, unsigned char flags);
+
+GRN_API grn_obj *grn_plugin_proc_get_vars(grn_ctx *ctx, grn_user_data *user_data);
+
+GRN_API grn_obj *grn_plugin_proc_get_var(grn_ctx *ctx, grn_user_data *user_data,
+ const char *name, int name_size);
+GRN_API grn_bool grn_plugin_proc_get_var_bool(grn_ctx *ctx,
+ grn_user_data *user_data,
+ const char *name,
+ int name_size,
+ grn_bool default_value);
+GRN_API int32_t grn_plugin_proc_get_var_int32(grn_ctx *ctx,
+ grn_user_data *user_data,
+ const char *name,
+ int name_size,
+ int32_t default_value);
+GRN_API const char *grn_plugin_proc_get_var_string(grn_ctx *ctx,
+ grn_user_data *user_data,
+ const char *name,
+ int name_size,
+ size_t *size);
+GRN_API grn_content_type grn_plugin_proc_get_var_content_type(grn_ctx *ctx,
+ grn_user_data *user_data,
+ const char *name,
+ int name_size,
+ grn_content_type default_value);
+
+GRN_API grn_obj *grn_plugin_proc_get_var_by_offset(grn_ctx *ctx,
+ grn_user_data *user_data,
+ unsigned int offset);
+
+GRN_API grn_obj *grn_plugin_proc_get_caller(grn_ctx *ctx,
+ grn_user_data *user_data);
+
+/* Deprecated since 5.0.9. Use grn_plugin_windows_base_dir() instead. */
+GRN_API const char *grn_plugin_win32_base_dir(void);
+GRN_API const char *grn_plugin_windows_base_dir(void);
+
+GRN_API int grn_plugin_charlen(grn_ctx *ctx, const char *str_ptr,
+ unsigned int str_length, grn_encoding encoding);
+
+GRN_API int grn_plugin_isspace(grn_ctx *ctx, const char *str_ptr,
+ unsigned int str_length, grn_encoding encoding);
+
+GRN_API grn_rc grn_plugin_expr_var_init(grn_ctx *ctx,
+ grn_expr_var *var,
+ const char *name,
+ int name_size);
+
+GRN_API grn_obj *grn_plugin_command_create(grn_ctx *ctx,
+ const char *name,
+ int name_size,
+ grn_proc_func func,
+ unsigned int n_vars,
+ grn_expr_var *vars);
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/portability.h b/storage/mroonga/vendor/groonga/include/groonga/portability.h
new file mode 100644
index 00000000..faee70b9
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/portability.h
@@ -0,0 +1,201 @@
+/*
+ Copyright(C) 2015-2017 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef WIN32
+# ifdef __cplusplus
+# define grn_memcpy(dest, src, n) ::memcpy_s((dest), (n), (src), (n))
+# else /* __cplusplus */
+# define grn_memcpy(dest, src, n) memcpy_s((dest), (n), (src), (n))
+# endif /* __cplusplus */
+#else /* WIN32 */
+# ifdef __cplusplus
+# define grn_memcpy(dest, src, n) std::memcpy((dest), (src), (n))
+# else /* __cplusplus */
+# define grn_memcpy(dest, src, n) memcpy((dest), (src), (n))
+# endif /* __cplusplus */
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_memmove(dest, src, n) memmove_s((dest), (n), (src), (n))
+#else /* WIN32 */
+# define grn_memmove(dest, src, n) memmove((dest), (src), (n))
+#endif /* WIN32 */
+
+#define GRN_ENV_BUFFER_SIZE 1024
+
+#ifdef WIN32
+# define grn_getenv(name, dest, dest_size) do { \
+ char *dest_ = (dest); \
+ size_t dest_size_ = (dest_size); \
+ if (dest_size_ > 0) { \
+ DWORD env_size; \
+ env_size = GetEnvironmentVariableA((name), dest_, dest_size_); \
+ if (env_size == 0 || env_size > dest_size_) { \
+ dest_[0] = '\0'; \
+ } \
+ } \
+ } while (0)
+#else /* WIN32 */
+# define grn_getenv(name, dest, dest_size) do { \
+ const char *env_value = getenv((name)); \
+ char *dest_ = (dest); \
+ size_t dest_size_ = (dest_size); \
+ if (dest_size_ > 0) { \
+ if (env_value) { \
+ strncpy(dest_, env_value, dest_size_ - 1); \
+ } else { \
+ dest_[0] = '\0'; \
+ } \
+ } \
+ } while (0)
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_fopen(name, mode) _fsopen((name), (mode), _SH_DENYNO)
+#else /* WIN32 */
+# define grn_fopen(name, mode) fopen((name), (mode))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strdup_raw(string) _strdup((string))
+#else /* WIN32 */
+# define grn_strdup_raw(string) strdup((string))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_unlink(filename) _unlink((filename))
+#else /* WIN32 */
+# define grn_unlink(filename) unlink((filename))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strncat(dest, dest_size, src, n) \
+ strncat_s((dest), (dest_size), (src), (n))
+#else /* WIN32 */
+# define grn_strncat(dest, dest_size, src, n) \
+ strncat((dest), (src), (n))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strcpy(dest, dest_size, src) \
+ strcpy_s((dest), (dest_size), (src))
+#else /* WIN32 */
+# define grn_strcpy(dest, dest_size, src) \
+ strcpy((dest), (src))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strncpy(dest, dest_size, src, n) \
+ strncpy_s((dest), (dest_size), (src), (n))
+#else /* WIN32 */
+# define grn_strncpy(dest, dest_size, src, n) \
+ strncpy((dest), (src), (n))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strcat(dest, dest_size, src) \
+ strcat_s((dest), (dest_size), (src))
+#else /* WIN32 */
+# define grn_strcat(dest, dest_size, src) \
+ strcat((dest), (src))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strcasecmp(string1, string2) \
+ _stricmp((string1), (string2))
+#else /* WIN32 */
+# define grn_strcasecmp(string1, string2) \
+ strcasecmp((string1), (string2))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_strncasecmp(string1, string2, n) \
+ _strnicmp((string1), (string2), (n))
+#else /* WIN32 */
+# define grn_strncasecmp(string1, string2, n) \
+ strncasecmp((string1), (string2), (n))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_snprintf(dest, dest_size, n, ...) do { \
+ _snprintf_s((dest), (dest_size), (n) - 1, __VA_ARGS__); \
+ } while (GRN_FALSE)
+#else /* WIN32 */
+# define grn_snprintf(dest, dest_size, n, ...) \
+ snprintf((dest), (n), __VA_ARGS__)
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_vsnprintf(dest, dest_size, format, args) do { \
+ vsnprintf((dest), (dest_size), (format), (args)); \
+ (dest)[(dest_size) - 1] = '\0'; \
+ } while (GRN_FALSE)
+#else /* WIN32 */
+# define grn_vsnprintf(dest, dest_size, format, args) \
+ vsnprintf((dest), (dest_size), (format), (args))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_write(fd, buf, count) _write((fd), (buf), (count))
+#else /* WIN32 */
+# define grn_write(fd, buf, count) write((fd), (buf), (count))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_read(fd, buf, count) _read((fd), (buf), (count))
+#else /* WIN32 */
+# define grn_read(fd, buf, count) read((fd), (buf), (count))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define GRN_OPEN_CREATE_MODE (_S_IREAD | _S_IWRITE)
+# define GRN_OPEN_FLAG_BINARY _O_BINARY
+# define grn_open(fd, pathname, flags) \
+ _sopen_s(&(fd), (pathname), (flags), _SH_DENYNO, GRN_OPEN_CREATE_MODE)
+#else /* WIN32 */
+# define GRN_OPEN_CREATE_MODE (S_IRUSR | S_IWUSR | S_IRGRP)
+# define GRN_OPEN_FLAG_BINARY 0
+# define grn_open(fd, pathname, flags) \
+ (fd) = open((pathname), (flags), GRN_OPEN_CREATE_MODE)
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_close(fd) _close((fd))
+#else /* WIN32 */
+# define grn_close(fd) close((fd))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_fileno(stream) _fileno((stream))
+#else /* WIN32 */
+# define grn_fileno(stream) fileno((stream))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_isatty(stream) _isatty((stream))
+#else /* WIN32 */
+# define grn_isatty(stream) isatty((stream))
+#endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_getpid() _getpid()
+#else /* WIN32 */
+# define grn_getpid() getpid()
+#endif /* WIN32 */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/request_canceler.h b/storage/mroonga/vendor/groonga/include/groonga/request_canceler.h
new file mode 100644
index 00000000..5cb4702a
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/request_canceler.h
@@ -0,0 +1,37 @@
+/*
+ Copyright(C) 2014-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API void grn_request_canceler_register(grn_ctx *ctx,
+ const char *request_id,
+ unsigned int size);
+GRN_API void grn_request_canceler_unregister(grn_ctx *ctx,
+ const char *request_id,
+ unsigned int size);
+GRN_API grn_bool grn_request_canceler_cancel(const char *request_id,
+ unsigned int size);
+GRN_API grn_bool grn_request_canceler_cancel_all(void);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/request_timer.h b/storage/mroonga/vendor/groonga/include/groonga/request_timer.h
new file mode 100644
index 00000000..4bae968b
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/request_timer.h
@@ -0,0 +1,53 @@
+/*
+ Copyright(C) 2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _grn_request_timer {
+ void *user_data;
+ void *(*register_func)(const char *request_id,
+ unsigned int request_id_size,
+ double timeout,
+ void *user_data);
+ void (*unregister_func)(void *timer_id,
+ void *user_data);
+ void (*fin_func)(void *user_data);
+} grn_request_timer;
+
+/* Multithreading unsafe. */
+GRN_API void grn_request_timer_set(grn_request_timer *timer);
+
+/* Multithreading safety is depends on grn_request_timer. */
+GRN_API void *grn_request_timer_register(const char *request_id,
+ unsigned int request_id_size,
+ double timeout);
+/* Multithreading safety is depends on grn_request_timer. */
+GRN_API void grn_request_timer_unregister(void *timer_id);
+
+
+GRN_API double grn_get_default_request_timeout(void);
+GRN_API void grn_set_default_request_timeout(double timeout);
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/scorer.h b/storage/mroonga/vendor/groonga/include/groonga/scorer.h
new file mode 100644
index 00000000..5ef4db5d
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/scorer.h
@@ -0,0 +1,93 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015-2016 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-1335 USA
+*/
+
+#pragma once
+
+#include <groonga/plugin.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct _grn_scorer_matched_record grn_scorer_matched_record;
+
+GRN_API grn_obj *
+ grn_scorer_matched_record_get_table(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API grn_obj *
+ grn_scorer_matched_record_get_lexicon(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API grn_id
+ grn_scorer_matched_record_get_id(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API grn_obj *
+ grn_scorer_matched_record_get_terms(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API grn_obj *
+ grn_scorer_matched_record_get_term_weights(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API unsigned int
+ grn_scorer_matched_record_get_total_term_weights(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API long long unsigned int
+ grn_scorer_matched_record_get_n_documents(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API unsigned int
+ grn_scorer_matched_record_get_n_occurrences(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API long long unsigned int
+ grn_scorer_matched_record_get_n_candidates(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API unsigned int
+ grn_scorer_matched_record_get_n_tokens(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API int
+ grn_scorer_matched_record_get_weight(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+GRN_API grn_obj *
+ grn_scorer_matched_record_get_arg(grn_ctx *ctx,
+ grn_scorer_matched_record *record,
+ unsigned int i);
+GRN_API unsigned int
+ grn_scorer_matched_record_get_n_args(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+
+
+
+typedef double grn_scorer_score_func(grn_ctx *ctx,
+ grn_scorer_matched_record *record);
+
+/*
+ grn_scorer_register() registers a plugin to the database which is
+ associated with `ctx'. `scorer_name_ptr' and `scorer_name_length' specify the
+ plugin name. Alphabetic letters ('A'-'Z' and 'a'-'z'), digits ('0'-'9') and
+ an underscore ('_') are capable characters.
+
+ `score' is called for scoring matched records one by one.
+
+ grn_scorer_register() returns GRN_SUCCESS on success, an error
+ code on failure.
+ */
+GRN_PLUGIN_EXPORT grn_rc grn_scorer_register(grn_ctx *ctx,
+ const char *scorer_name_ptr,
+ int scorer_name_length,
+ grn_scorer_score_func *score);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/table.h b/storage/mroonga/vendor/groonga/include/groonga/table.h
new file mode 100644
index 00000000..c276df99
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/table.h
@@ -0,0 +1,246 @@
+/*
+ Copyright(C) 2009-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GRN_TABLE_MAX_KEY_SIZE (0x1000)
+
+GRN_API grn_obj *grn_table_create(grn_ctx *ctx,
+ const char *name, unsigned int name_size,
+ const char *path, grn_table_flags flags,
+ grn_obj *key_type, grn_obj *value_type);
+
+#define GRN_TABLE_OPEN_OR_CREATE(ctx,name,name_size,path,flags,key_type,value_type,table) \
+ (((table) = grn_ctx_get((ctx), (name), (name_size))) ||\
+ ((table) = grn_table_create((ctx), (name), (name_size), (path), (flags), (key_type), (value_type))))
+
+/* TODO: int *added -> grn_bool *added */
+GRN_API grn_id grn_table_add(grn_ctx *ctx, grn_obj *table,
+ const void *key, unsigned int key_size, int *added);
+GRN_API grn_id grn_table_get(grn_ctx *ctx, grn_obj *table,
+ const void *key, unsigned int key_size);
+GRN_API grn_id grn_table_at(grn_ctx *ctx, grn_obj *table, grn_id id);
+GRN_API grn_id grn_table_lcp_search(grn_ctx *ctx, grn_obj *table,
+ const void *key, unsigned int key_size);
+GRN_API int grn_table_get_key(grn_ctx *ctx, grn_obj *table,
+ grn_id id, void *keybuf, int buf_size);
+GRN_API grn_rc grn_table_delete(grn_ctx *ctx, grn_obj *table,
+ const void *key, unsigned int key_size);
+GRN_API grn_rc grn_table_delete_by_id(grn_ctx *ctx, grn_obj *table, grn_id id);
+GRN_API grn_rc grn_table_update_by_id(grn_ctx *ctx, grn_obj *table, grn_id id,
+ const void *dest_key, unsigned int dest_key_size);
+GRN_API grn_rc grn_table_update(grn_ctx *ctx, grn_obj *table,
+ const void *src_key, unsigned int src_key_size,
+ const void *dest_key, unsigned int dest_key_size);
+GRN_API grn_rc grn_table_truncate(grn_ctx *ctx, grn_obj *table);
+
+#define GRN_CURSOR_ASCENDING (0x00<<0)
+#define GRN_CURSOR_DESCENDING (0x01<<0)
+#define GRN_CURSOR_GE (0x00<<1)
+#define GRN_CURSOR_GT (0x01<<1)
+#define GRN_CURSOR_LE (0x00<<2)
+#define GRN_CURSOR_LT (0x01<<2)
+#define GRN_CURSOR_BY_KEY (0x00<<3)
+#define GRN_CURSOR_BY_ID (0x01<<3)
+#define GRN_CURSOR_PREFIX (0x01<<4)
+#define GRN_CURSOR_SIZE_BY_BIT (0x01<<5)
+#define GRN_CURSOR_RK (0x01<<6)
+
+GRN_API grn_table_cursor *grn_table_cursor_open(grn_ctx *ctx, grn_obj *table,
+ const void *min, unsigned int min_size,
+ const void *max, unsigned int max_size,
+ int offset, int limit, int flags);
+GRN_API grn_rc grn_table_cursor_close(grn_ctx *ctx, grn_table_cursor *tc);
+GRN_API grn_id grn_table_cursor_next(grn_ctx *ctx, grn_table_cursor *tc);
+GRN_API int grn_table_cursor_get_key(grn_ctx *ctx, grn_table_cursor *tc, void **key);
+GRN_API int grn_table_cursor_get_value(grn_ctx *ctx, grn_table_cursor *tc, void **value);
+GRN_API grn_rc grn_table_cursor_set_value(grn_ctx *ctx, grn_table_cursor *tc,
+ const void *value, int flags);
+GRN_API grn_rc grn_table_cursor_delete(grn_ctx *ctx, grn_table_cursor *tc);
+GRN_API grn_obj *grn_table_cursor_table(grn_ctx *ctx, grn_table_cursor *tc);
+
+GRN_API grn_obj *grn_index_cursor_open(grn_ctx *ctx, grn_table_cursor *tc, grn_obj *index,
+ grn_id rid_min, grn_id rid_max, int flags);
+GRN_API grn_posting *grn_index_cursor_next(grn_ctx *ctx, grn_obj *ic, grn_id *tid);
+
+#define GRN_TABLE_EACH(ctx,table,head,tail,id,key,key_size,value,block) do {\
+ (ctx)->errlvl = GRN_LOG_NOTICE;\
+ (ctx)->rc = GRN_SUCCESS;\
+ if ((ctx)->seqno & 1) {\
+ (ctx)->subno++;\
+ } else {\
+ (ctx)->seqno++;\
+ }\
+ if (table) {\
+ switch ((table)->header.type) {\
+ case GRN_TABLE_PAT_KEY :\
+ GRN_PAT_EACH((ctx), (grn_pat *)(table), (id), (key), (key_size), (value), block);\
+ break;\
+ case GRN_TABLE_DAT_KEY :\
+ GRN_DAT_EACH((ctx), (grn_dat *)(table), (id), (key), (key_size), block);\
+ break;\
+ case GRN_TABLE_HASH_KEY :\
+ GRN_HASH_EACH((ctx), (grn_hash *)(table), (id), (key), (key_size), (value), block);\
+ break;\
+ case GRN_TABLE_NO_KEY :\
+ GRN_ARRAY_EACH((ctx), (grn_array *)(table), (head), (tail), (id), (value), block);\
+ break;\
+ }\
+ }\
+ if ((ctx)->subno) {\
+ (ctx)->subno--;\
+ } else {\
+ (ctx)->seqno++;\
+ }\
+} while (0)
+
+#define GRN_TABLE_EACH_BEGIN(ctx, table, cursor, id) do {\
+ if ((table)) {\
+ grn_table_cursor *cursor;\
+ cursor = grn_table_cursor_open((ctx), (table),\
+ NULL, 0,\
+ NULL, 0,\
+ 0, -1, GRN_CURSOR_ASCENDING);\
+ if (cursor) {\
+ grn_id id;\
+ while ((id = grn_table_cursor_next((ctx), cursor))) {
+
+#define GRN_TABLE_EACH_BEGIN_FLAGS(ctx, table, cursor, id, flags) do {\
+ if ((table)) {\
+ grn_table_cursor *cursor;\
+ cursor = grn_table_cursor_open((ctx), (table),\
+ NULL, 0,\
+ NULL, 0,\
+ 0, -1, (flags));\
+ if (cursor) {\
+ grn_id id;\
+ while ((id = grn_table_cursor_next((ctx), cursor))) {
+
+#define GRN_TABLE_EACH_BEGIN_MIN(ctx, table, cursor, id,\
+ min, min_size, flags) do {\
+ if ((table)) {\
+ grn_table_cursor *cursor;\
+ cursor = grn_table_cursor_open((ctx), (table),\
+ (min), (min_size),\
+ NULL, 0,\
+ 0, -1, (flags));\
+ if (cursor) {\
+ grn_id id;\
+ while ((id = grn_table_cursor_next((ctx), cursor))) {
+
+#define GRN_TABLE_EACH_END(ctx, cursor)\
+ }\
+ grn_table_cursor_close((ctx), cursor);\
+ }\
+ }\
+} while (0)
+
+typedef struct _grn_table_sort_key grn_table_sort_key;
+typedef unsigned char grn_table_sort_flags;
+
+#define GRN_TABLE_SORT_ASC (0x00<<0)
+#define GRN_TABLE_SORT_DESC (0x01<<0)
+
+struct _grn_table_sort_key {
+ grn_obj *key;
+ grn_table_sort_flags flags;
+ int offset;
+};
+
+GRN_API int grn_table_sort(grn_ctx *ctx, grn_obj *table, int offset, int limit,
+ grn_obj *result, grn_table_sort_key *keys, int n_keys);
+
+typedef struct _grn_table_group_result grn_table_group_result;
+typedef uint32_t grn_table_group_flags;
+
+#define GRN_TABLE_GROUP_CALC_COUNT (0x01<<3)
+#define GRN_TABLE_GROUP_CALC_MAX (0x01<<4)
+#define GRN_TABLE_GROUP_CALC_MIN (0x01<<5)
+#define GRN_TABLE_GROUP_CALC_SUM (0x01<<6)
+#define GRN_TABLE_GROUP_CALC_AVG (0x01<<7)
+
+struct _grn_table_group_result {
+ grn_obj *table;
+ unsigned char key_begin;
+ unsigned char key_end;
+ int limit;
+ grn_table_group_flags flags;
+ grn_operator op;
+ unsigned int max_n_subrecs;
+ grn_obj *calc_target;
+};
+
+GRN_API grn_rc grn_table_group(grn_ctx *ctx, grn_obj *table,
+ grn_table_sort_key *keys, int n_keys,
+ grn_table_group_result *results, int n_results);
+GRN_API grn_rc grn_table_setoperation(grn_ctx *ctx, grn_obj *table1, grn_obj *table2,
+ grn_obj *res, grn_operator op);
+GRN_API grn_rc grn_table_difference(grn_ctx *ctx, grn_obj *table1, grn_obj *table2,
+ grn_obj *res1, grn_obj *res2);
+GRN_API int grn_table_columns(grn_ctx *ctx, grn_obj *table,
+ const char *name, unsigned int name_size,
+ grn_obj *res);
+
+GRN_API unsigned int grn_table_size(grn_ctx *ctx, grn_obj *table);
+
+GRN_API grn_rc grn_table_rename(grn_ctx *ctx, grn_obj *table,
+ const char *name, unsigned int name_size);
+
+GRN_API grn_obj *grn_table_select(grn_ctx *ctx, grn_obj *table, grn_obj *expr,
+ grn_obj *res, grn_operator op);
+
+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);
+GRN_API grn_rc grn_table_sort_key_close(grn_ctx *ctx,
+ grn_table_sort_key *keys, unsigned int nkeys);
+
+GRN_API grn_bool grn_table_is_grouped(grn_ctx *ctx, grn_obj *table);
+
+GRN_API unsigned int grn_table_max_n_subrecs(grn_ctx *ctx, grn_obj *table);
+
+GRN_API grn_obj *grn_table_create_for_group(grn_ctx *ctx,
+ const char *name,
+ unsigned int name_size,
+ const char *path,
+ grn_obj *group_key,
+ grn_obj *value_type,
+ unsigned int max_n_subrecs);
+
+GRN_API unsigned int grn_table_get_subrecs(grn_ctx *ctx, grn_obj *table,
+ grn_id id, grn_id *subrecbuf,
+ int *scorebuf, int buf_size);
+
+GRN_API grn_obj *grn_table_tokenize(grn_ctx *ctx, grn_obj *table,
+ const char *str, unsigned int str_len,
+ grn_obj *buf, grn_bool addp);
+
+GRN_API grn_rc grn_table_apply_expr(grn_ctx *ctx,
+ grn_obj *table,
+ grn_obj *output_column,
+ grn_obj *expr);
+
+GRN_API grn_id grn_table_find_reference_object(grn_ctx *ctx, grn_obj *table);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/thread.h b/storage/mroonga/vendor/groonga/include/groonga/thread.h
new file mode 100644
index 00000000..20bfcb39
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/thread.h
@@ -0,0 +1,39 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2015-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API uint32_t grn_thread_get_limit(void);
+GRN_API void grn_thread_set_limit(uint32_t new_limit);
+
+
+typedef uint32_t (*grn_thread_get_limit_func)(void *data);
+GRN_API void grn_thread_set_get_limit_func(grn_thread_get_limit_func func,
+ void *data);
+typedef void (*grn_thread_set_limit_func)(uint32_t new_limit, void *data);
+GRN_API void grn_thread_set_set_limit_func(grn_thread_set_limit_func func,
+ void *data);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/time.h b/storage/mroonga/vendor/groonga/include/groonga/time.h
new file mode 100644
index 00000000..9f9427a7
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/time.h
@@ -0,0 +1,61 @@
+/*
+ Copyright(C) 2016 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-1335 USA
+*/
+
+#pragma once
+
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GRN_TIMEVAL_TO_MSEC(timeval) \
+ (((timeval)->tv_sec * GRN_TIME_MSEC_PER_SEC) + \
+ ((timeval)->tv_nsec / GRN_TIME_NSEC_PER_MSEC))
+
+#define GRN_TIME_NSEC_PER_SEC 1000000000
+#define GRN_TIME_NSEC_PER_SEC_F 1000000000.0
+#define GRN_TIME_NSEC_PER_MSEC 1000000
+#define GRN_TIME_NSEC_PER_USEC (GRN_TIME_NSEC_PER_SEC / GRN_TIME_USEC_PER_SEC)
+#define GRN_TIME_MSEC_PER_SEC 1000
+#define GRN_TIME_NSEC_TO_USEC(nsec) ((nsec) / GRN_TIME_NSEC_PER_USEC)
+#define GRN_TIME_USEC_TO_NSEC(usec) ((usec) * GRN_TIME_NSEC_PER_USEC)
+
+#define GRN_TIME_USEC_PER_SEC 1000000
+#define GRN_TIME_PACK(sec, usec) ((int64_t)(sec) * GRN_TIME_USEC_PER_SEC + (usec))
+#define GRN_TIME_UNPACK(time_value, sec, usec) do {\
+ sec = (time_value) / GRN_TIME_USEC_PER_SEC;\
+ usec = (time_value) % GRN_TIME_USEC_PER_SEC;\
+} while (0)
+
+GRN_API grn_rc grn_timeval_now(grn_ctx *ctx, grn_timeval *tv);
+
+GRN_API void grn_time_now(grn_ctx *ctx, grn_obj *obj);
+
+#define GRN_TIME_NOW(ctx,obj) (grn_time_now((ctx), (obj)))
+
+GRN_API grn_bool grn_time_to_tm(grn_ctx *ctx,
+ int64_t time,
+ struct tm *tm);
+GRN_API grn_bool grn_time_from_tm(grn_ctx *ctx,
+ int64_t *time,
+ struct tm *tm);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/token.h b/storage/mroonga/vendor/groonga/include/groonga/token.h
new file mode 100644
index 00000000..c40203c6
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/token.h
@@ -0,0 +1,135 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * grn_tokenize_mode describes propose for tokenization.
+ *
+ * `GRN_TOKENIZE_GET`: Tokenize for search.
+ *
+ * `GRN_TOKENIZE_ADD`: Tokenize for adding token to index.
+ *
+ * `GRN_TOKENIZE_DELETE`: Tokenize for deleting token from index.
+ *
+ * @since 4.0.8
+ */
+typedef enum {
+ GRN_TOKENIZE_GET = 0,
+ GRN_TOKENIZE_ADD,
+ GRN_TOKENIZE_DELETE,
+ GRN_TOKENIZE_ONLY
+} grn_tokenize_mode;
+
+/*
+ grn_token_mode describes propose for tokenization.
+
+ `GRN_TOKEN_GET`: Tokenization for search.
+
+ `GRN_TOKEN_ADD`: Tokenization for adding token to index.
+
+ `GRN_TOKEN_DEL`: Tokenization for deleting token from index.
+
+ @since 4.0.7
+ @deprecated since 4.0.8. Use grn_tokenize_mode instead.
+ */
+typedef grn_tokenize_mode grn_token_mode;
+
+#define GRN_TOKEN_GET GRN_TOKENIZE_GET
+#define GRN_TOKEN_ADD GRN_TOKENIZE_ADD
+#define GRN_TOKEN_DEL GRN_TOKENIZE_DELETE
+
+/*
+ * grn_token_status is a flag set for tokenizer status codes.
+ * If a document or query contains no tokens, push an empty string with
+ * GRN_TOKEN_LAST as a token.
+ *
+ * @since 4.0.8
+ */
+typedef unsigned int grn_token_status;
+
+/*
+ * GRN_TOKEN_CONTINUE means that the next token is not the last one.
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_CONTINUE (0)
+/*
+ * GRN_TOKEN_LAST means that the next token is the last one.
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_LAST (0x01L<<0)
+/*
+ * GRN_TOKEN_OVERLAP means that ...
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_OVERLAP (0x01L<<1)
+/*
+ * GRN_TOKEN_UNMATURED means that ...
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_UNMATURED (0x01L<<2)
+/*
+ * GRN_TOKEN_REACH_END means that ...
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_REACH_END (0x01L<<3)
+/*
+ * GRN_TOKEN_SKIP means that the token is skipped
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_SKIP (0x01L<<4)
+/*
+ * GRN_TOKEN_SKIP_WITH_POSITION means that the token and postion is skipped
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_SKIP_WITH_POSITION (0x01L<<5)
+/*
+ * GRN_TOKEN_FORCE_PREIX that the token is used common prefix search
+ *
+ * @since 4.0.8
+ */
+#define GRN_TOKEN_FORCE_PREFIX (0x01L<<6)
+
+typedef struct _grn_token grn_token;
+
+GRN_PLUGIN_EXPORT grn_obj *grn_token_get_data(grn_ctx *ctx,
+ grn_token *token);
+GRN_PLUGIN_EXPORT grn_rc grn_token_set_data(grn_ctx *ctx,
+ grn_token *token,
+ const char *str_ptr,
+ int str_length);
+GRN_PLUGIN_EXPORT grn_token_status grn_token_get_status(grn_ctx *ctx,
+ grn_token *token);
+GRN_PLUGIN_EXPORT grn_rc grn_token_set_status(grn_ctx *ctx,
+ grn_token *token,
+ grn_token_status status);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/token_filter.h b/storage/mroonga/vendor/groonga/include/groonga/token_filter.h
new file mode 100644
index 00000000..982f7df7
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/token_filter.h
@@ -0,0 +1,67 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2014-2016 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-1335 USA
+*/
+
+#pragma once
+
+#include <groonga/tokenizer.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef void *grn_token_filter_init_func(grn_ctx *ctx,
+ grn_obj *table,
+ grn_tokenize_mode mode);
+
+typedef void grn_token_filter_filter_func(grn_ctx *ctx,
+ grn_token *current_token,
+ grn_token *next_token,
+ void *user_data);
+
+typedef void grn_token_filter_fin_func(grn_ctx *ctx,
+ void *user_data);
+
+
+/*
+ grn_token_filter_register() registers a plugin to the database which is
+ associated with `ctx'. `plugin_name_ptr' and `plugin_name_length' specify the
+ plugin name. Alphabetic letters ('A'-'Z' and 'a'-'z'), digits ('0'-'9') and
+ an underscore ('_') are capable characters.
+
+ `init', `filter' and `fin' specify the plugin functions.
+
+ `init' is called for initializing a token_filter for a document or
+ query.
+
+ `filter' is called for filtering tokens one by one.
+
+ `fin' is called for finalizing a token_filter.
+
+ grn_token_filter_register() returns GRN_SUCCESS on success, an error
+ code on failure.
+ */
+GRN_PLUGIN_EXPORT grn_rc grn_token_filter_register(grn_ctx *ctx,
+ const char *plugin_name_ptr,
+ int plugin_name_length,
+ grn_token_filter_init_func *init,
+ grn_token_filter_filter_func *filter,
+ grn_token_filter_fin_func *fin);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/tokenizer.h b/storage/mroonga/vendor/groonga/include/groonga/tokenizer.h
new file mode 100644
index 00000000..a29c9e9e
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/tokenizer.h
@@ -0,0 +1,260 @@
+/* -*- c-basic-offset: 2 -*- */
+/*
+ Copyright(C) 2012-2016 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-1335 USA
+*/
+
+#pragma once
+
+#include <groonga/plugin.h>
+#include <groonga/token.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#define GRN_TOKENIZER_TOKENIZED_DELIMITER_UTF8 "\xEF\xBF\xBE"
+#define GRN_TOKENIZER_TOKENIZED_DELIMITER_UTF8_LEN 3
+
+/*
+ grn_tokenizer_charlen() returns the length (#bytes) of the first character
+ in the string specified by `str_ptr' and `str_length'. If the starting bytes
+ are invalid as a character, grn_tokenizer_charlen() returns 0. See
+ grn_encoding in "groonga.h" for more details of `encoding'
+
+ Deprecated. Use grn_plugin_charlen() instead.
+ */
+int grn_tokenizer_charlen(grn_ctx *ctx, const char *str_ptr,
+ unsigned int str_length, grn_encoding encoding);
+
+/*
+ grn_tokenizer_isspace() returns the length (#bytes) of the first character
+ in the string specified by `str_ptr' and `str_length' if it is a space
+ character. Otherwise, grn_tokenizer_isspace() returns 0.
+
+ Deprecated. Use grn_plugin_isspace() instead.
+ */
+int grn_tokenizer_isspace(grn_ctx *ctx, const char *str_ptr,
+ unsigned int str_length, grn_encoding encoding);
+
+/*
+ grn_tokenizer_is_tokenized_delimiter() returns whether is the first
+ character in the string specified by `str_ptr' and `str_length' the
+ special tokenized delimiter character or not.
+ */
+grn_bool grn_tokenizer_is_tokenized_delimiter(grn_ctx *ctx,
+ const char *str_ptr,
+ unsigned int str_length,
+ grn_encoding encoding);
+
+/*
+ grn_tokenizer_have_tokenized_delimiter() returns whether is there
+ the special delimiter character in the string specified by `str_ptr'
+ and `str_length' the special tokenized delimiter character or not.
+ */
+GRN_PLUGIN_EXPORT grn_bool grn_tokenizer_have_tokenized_delimiter(grn_ctx *ctx,
+ const char *str_ptr,
+ unsigned int str_length,
+ grn_encoding encoding);
+
+/*
+ grn_tokenizer_query is a structure for storing a query. See the following
+ functions.
+ */
+typedef struct _grn_tokenizer_query grn_tokenizer_query;
+
+struct _grn_tokenizer_query {
+ grn_obj *normalized_query;
+ char *query_buf;
+ const char *ptr;
+ unsigned int length;
+ grn_encoding encoding;
+ unsigned int flags;
+ grn_bool have_tokenized_delimiter;
+ /* Deprecated since 4.0.8. Use tokenize_mode instead. */
+ grn_token_mode token_mode;
+ grn_tokenize_mode tokenize_mode;
+};
+
+/*
+ grn_tokenizer_query_open() parses `args' and returns a new object of
+ grn_tokenizer_query. The new object stores information of the query.
+ grn_tokenizer_query_open() normalizes the query if the target table
+ requires normalization. grn_tokenizer_query_open() returns NULL if
+ something goes wrong. Note that grn_tokenizer_query_open() must be called
+ just once in the function that initializes a tokenizer.
+
+ See `GRN_STRING_*' flags for `normalize_flags'.
+ */
+GRN_PLUGIN_EXPORT grn_tokenizer_query *grn_tokenizer_query_open(grn_ctx *ctx,
+ int num_args, grn_obj **args,
+ unsigned int normalize_flags);
+
+/*
+ grn_tokenizer_query_create() is deprecated. Use grn_tokenizer_query_open()
+ instead.
+*/
+
+grn_tokenizer_query *grn_tokenizer_query_create(grn_ctx *ctx,
+ int num_args, grn_obj **args);
+
+/*
+ grn_tokenizer_query_close() finalizes an object of grn_tokenizer_query
+ and then frees memory allocated for that object.
+ */
+GRN_PLUGIN_EXPORT void grn_tokenizer_query_close(grn_ctx *ctx, grn_tokenizer_query *query);
+
+/*
+ grn_tokenizer_query_destroy() is deprecated. Use grn_tokenizer_query_close()
+ instead.
+ */
+void grn_tokenizer_query_destroy(grn_ctx *ctx, grn_tokenizer_query *query);
+
+/*
+ grn_tokenizer_token is needed to return tokens. A grn_tokenizer_token object
+ stores a token to be returned and it must be maintained until a request for
+ next token or finalization comes.
+ */
+typedef struct _grn_tokenizer_token grn_tokenizer_token;
+
+struct _grn_tokenizer_token {
+ grn_obj str;
+ grn_obj status;
+};
+
+/*
+ grn_tokenizer_token_init() initializes `token'. Note that an initialized
+ object must be finalized by grn_tokenizer_token_fin().
+ */
+GRN_PLUGIN_EXPORT void grn_tokenizer_token_init(grn_ctx *ctx, grn_tokenizer_token *token);
+
+/*
+ grn_tokenizer_token_fin() finalizes `token' that has been initialized by
+ grn_tokenizer_token_init().
+ */
+GRN_PLUGIN_EXPORT void grn_tokenizer_token_fin(grn_ctx *ctx, grn_tokenizer_token *token);
+
+/*
+ * grn_tokenizer_status is a flag set for tokenizer status codes.
+ * If a document or query contains no tokens, push an empty string with
+ * GRN_TOKENIZER_TOKEN_LAST as a token.
+ *
+ * @deprecated since 4.0.8. Use grn_token_status instead.
+ */
+typedef grn_token_status grn_tokenizer_status;
+
+/*
+ * GRN_TOKENIZER_TOKEN_CONTINUE means that the next token is not the last one.
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_CONTINUE instead.
+ */
+#define GRN_TOKENIZER_TOKEN_CONTINUE GRN_TOKEN_CONTINUE
+/*
+ * GRN_TOKENIZER_TOKEN_LAST means that the next token is the last one.
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_LAST instead.
+ */
+#define GRN_TOKENIZER_TOKEN_LAST GRN_TOKEN_LAST
+/*
+ * GRN_TOKENIZER_TOKEN_OVERLAP means that ...
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_OVERLAP instead.
+ */
+#define GRN_TOKENIZER_TOKEN_OVERLAP GRN_TOKEN_OVERLAP
+/*
+ * GRN_TOKENIZER_TOKEN_UNMATURED means that ...
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_UNMATURED instead.
+ */
+#define GRN_TOKENIZER_TOKEN_UNMATURED GRN_TOKEN_UNMATURED
+/*
+ * GRN_TOKENIZER_TOKEN_REACH_END means that ...
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_REACH_END instead.
+ */
+#define GRN_TOKENIZER_TOKEN_REACH_END GRN_TOKEN_REACH_END
+/*
+ * GRN_TOKENIZER_TOKEN_SKIP means that the token is skipped
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_SKIP instead.
+ */
+#define GRN_TOKENIZER_TOKEN_SKIP GRN_TOKEN_SKIP
+/*
+ * GRN_TOKENIZER_TOKEN_SKIP_WITH_POSITION means that the token and postion is skipped
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_SKIP_WITH_POSITION instead.
+ */
+#define GRN_TOKENIZER_TOKEN_SKIP_WITH_POSITION GRN_TOKEN_SKIP_WITH_POSITION
+/*
+ * GRN_TOKENIZER_TOKEN_FORCE_PREIX that the token is used common prefix search
+ *
+ * @deprecated since 4.0.8. Use GRN_TOKEN_FORCE_PREIX instead.
+ */
+#define GRN_TOKENIZER_TOKEN_FORCE_PREFIX GRN_TOKEN_FORCE_PREFIX
+
+/*
+ * GRN_TOKENIZER_CONTINUE and GRN_TOKENIZER_LAST are deprecated. They
+ * are just for backward compatibility. Use
+ * GRN_TOKENIZER_TOKEN_CONTINUE and GRN_TOKENIZER_TOKEN_LAST
+ * instead.
+ */
+#define GRN_TOKENIZER_CONTINUE GRN_TOKENIZER_TOKEN_CONTINUE
+#define GRN_TOKENIZER_LAST GRN_TOKENIZER_TOKEN_LAST
+
+/*
+ grn_tokenizer_token_push() pushes the next token into `token'. Note that
+ grn_tokenizer_token_push() does not make a copy of the given string. This
+ means that you have to maintain a memory space allocated to the string.
+ Also note that the grn_tokenizer_token object must be maintained until the
+ request for the next token or finalization comes. See grn_token_status in
+ this header for more details of `status'.
+ */
+GRN_PLUGIN_EXPORT void grn_tokenizer_token_push(grn_ctx *ctx, grn_tokenizer_token *token,
+ const char *str_ptr, unsigned int str_length,
+ grn_token_status status);
+
+/*
+ grn_tokenizer_tokenized_delimiter_next() extracts the next token
+ from the string specified by `str_ptr' and `str_length' and pushes
+ the next token into `token'. It returns the string after the next
+ token. The returned string may be `NULL' when all tokens are
+ extracted.
+ */
+GRN_PLUGIN_EXPORT const char *grn_tokenizer_tokenized_delimiter_next(grn_ctx *ctx,
+ grn_tokenizer_token *token,
+ const char *str_ptr,
+ unsigned int str_length,
+ grn_encoding encoding);
+
+/*
+ grn_tokenizer_register() registers a plugin to the database which is
+ associated with `ctx'. `plugin_name_ptr' and `plugin_name_length' specify the
+ plugin name. Alphabetic letters ('A'-'Z' and 'a'-'z'), digits ('0'-'9') and
+ an underscore ('_') are capable characters. `init', `next' and `fin' specify
+ the plugin functions. `init' is called for initializing a tokenizer for a
+ document or query. `next' is called for extracting tokens one by one. `fin'
+ is called for finalizing a tokenizer. grn_tokenizer_register() returns
+ GRN_SUCCESS on success, an error code on failure. See "groonga.h" for more
+ details of grn_proc_func and grn_user_data, that is used as an argument of
+ grn_proc_func.
+ */
+GRN_PLUGIN_EXPORT grn_rc grn_tokenizer_register(grn_ctx *ctx, const char *plugin_name_ptr,
+ unsigned int plugin_name_length,
+ grn_proc_func *init, grn_proc_func *next,
+ grn_proc_func *fin);
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif /* __cplusplus */
diff --git a/storage/mroonga/vendor/groonga/include/groonga/type.h b/storage/mroonga/vendor/groonga/include/groonga/type.h
new file mode 100644
index 00000000..7e9c1594
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/type.h
@@ -0,0 +1,40 @@
+/*
+ Copyright(C) 2009-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Just for backward compatibility.
+ Use grn_type_id_is_text_family() instead. */
+#define GRN_TYPE_IS_TEXT_FAMILY(type) \
+ grn_type_id_is_text_family(NULL, (type))
+
+GRN_API grn_bool grn_type_id_is_builtin(grn_ctx *ctx, grn_id id);
+GRN_API grn_bool grn_type_id_is_number_family(grn_ctx *ctx, grn_id id);
+GRN_API grn_bool grn_type_id_is_text_family(grn_ctx *ctx, grn_id id);
+
+GRN_API grn_obj *grn_type_create(grn_ctx *ctx, const char *name, unsigned int name_size,
+ grn_obj_flags flags, unsigned int size);
+GRN_API uint32_t grn_type_size(grn_ctx *ctx, grn_obj *type);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/util.h b/storage/mroonga/vendor/groonga/include/groonga/util.h
new file mode 100644
index 00000000..4c9b704c
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/util.h
@@ -0,0 +1,44 @@
+/*
+ Copyright(C) 2010-2017 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_obj *grn_inspect(grn_ctx *ctx, grn_obj *buffer, grn_obj *obj);
+GRN_API grn_obj *grn_inspect_indented(grn_ctx *ctx, grn_obj *buffer,
+ grn_obj *obj, const char *indent);
+GRN_API grn_obj *grn_inspect_limited(grn_ctx *ctx,
+ grn_obj *buffer,
+ grn_obj *obj);
+GRN_API grn_obj *grn_inspect_name(grn_ctx *ctx, grn_obj *buffer, grn_obj *obj);
+GRN_API grn_obj *grn_inspect_encoding(grn_ctx *ctx, grn_obj *buffer, grn_encoding encoding);
+GRN_API grn_obj *grn_inspect_type(grn_ctx *ctx, grn_obj *buffer, unsigned char type);
+GRN_API grn_obj *grn_inspect_query_log_flags(grn_ctx *ctx,
+ grn_obj *buffer,
+ unsigned int flags);
+
+GRN_API void grn_p(grn_ctx *ctx, grn_obj *obj);
+GRN_API void grn_p_geo_point(grn_ctx *ctx, grn_geo_point *point);
+GRN_API void grn_p_ii_values(grn_ctx *ctx, grn_obj *obj);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/window_function.h b/storage/mroonga/vendor/groonga/include/groonga/window_function.h
new file mode 100644
index 00000000..56ca323c
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/window_function.h
@@ -0,0 +1,73 @@
+/*
+ Copyright(C) 2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ GRN_WINDOW_DIRECTION_ASCENDING,
+ GRN_WINDOW_DIRECTION_DESCENDING
+} grn_window_direction;
+
+typedef struct _grn_window grn_window;
+
+GRN_API grn_id grn_window_next(grn_ctx *ctx,
+ grn_window *window);
+GRN_API grn_rc grn_window_rewind(grn_ctx *ctx,
+ grn_window *window);
+GRN_API grn_rc grn_window_set_direction(grn_ctx *ctx,
+ grn_window *window,
+ grn_window_direction direction);
+GRN_API grn_obj *grn_window_get_table(grn_ctx *ctx,
+ grn_window *window);
+GRN_API grn_bool grn_window_is_sorted(grn_ctx *ctx,
+ grn_window *window);
+GRN_API size_t grn_window_get_size(grn_ctx *ctx,
+ grn_window *window);
+
+typedef struct _grn_window_definition {
+ grn_table_sort_key *sort_keys;
+ size_t n_sort_keys;
+ grn_table_sort_key *group_keys;
+ size_t n_group_keys;
+} grn_window_definition;
+
+typedef grn_rc grn_window_function_func(grn_ctx *ctx,
+ grn_obj *output_column,
+ grn_window *window,
+ grn_obj **args,
+ int n_args);
+
+GRN_API grn_obj *grn_window_function_create(grn_ctx *ctx,
+ const char *name,
+ int name_size,
+ grn_window_function_func func);
+
+
+GRN_API grn_rc grn_table_apply_window_function(grn_ctx *ctx,
+ grn_obj *table,
+ grn_obj *output_column,
+ grn_window_definition *definition,
+ grn_obj *window_function_call);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/windows.h b/storage/mroonga/vendor/groonga/include/groonga/windows.h
new file mode 100644
index 00000000..fe4e5227
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/windows.h
@@ -0,0 +1,31 @@
+/*
+ Copyright(C) 2015-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef WIN32
+GRN_API const char *grn_windows_base_dir(void);
+#endif /* WIN32 */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/storage/mroonga/vendor/groonga/include/groonga/windows_event_logger.h b/storage/mroonga/vendor/groonga/include/groonga/windows_event_logger.h
new file mode 100644
index 00000000..ca838f81
--- /dev/null
+++ b/storage/mroonga/vendor/groonga/include/groonga/windows_event_logger.h
@@ -0,0 +1,30 @@
+/*
+ Copyright(C) 2015-2016 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-1335 USA
+*/
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GRN_API grn_rc grn_windows_event_logger_set(grn_ctx *ctx,
+ const char *event_source_name);
+
+#ifdef __cplusplus
+}
+#endif