Update Mroonga to the latest version on 2015-04-30T04:44:30+0900

This commit is contained in:
Kentoku SHIBA 2015-04-30 04:44:30 +09:00
commit a0fdb258a4
413 changed files with 25886 additions and 5251 deletions

View file

@ -0,0 +1,32 @@
# Copyright(C) 2015 Brazil
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1 as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../lib
)
set(GRN_FUNCTIONS_PLUGIN_DIR "${GRN_RELATIVE_PLUGINS_DIR}/functions")
read_file_list(${CMAKE_CURRENT_SOURCE_DIR}/vector_sources.am
VECTOR_SOURCES)
add_library(vector_functions MODULE ${VECTOR_SOURCES})
set_source_files_properties(${VECTOR_SOURCES}
PROPERTIES
COMPILE_FLAGS "${GRN_C_COMPILE_FLAGS}")
set_target_properties(vector_functions PROPERTIES
PREFIX ""
OUTPUT_NAME "vector")
target_link_libraries(vector_functions libgroonga)
install(TARGETS vector_functions DESTINATION "${GRN_FUNCTIONS_PLUGIN_DIR}")

View file

@ -0,0 +1,20 @@
EXTRA_DIST = \
CMakeLists.txt
AM_CPPFLAGS = \
-I$(top_builddir) \
-I$(top_srcdir)/include \
-I$(top_srcdir)/lib
AM_LDFLAGS = \
-avoid-version \
-module \
-no-undefined
LIBS = \
$(top_builddir)/lib/libgroonga.la
function_plugins_LTLIBRARIES =
function_plugins_LTLIBRARIES += vector.la
include vector_sources.am

View file

@ -0,0 +1,90 @@
/* -*- c-basic-offset: 2 -*- */
/*
Copyright(C) 2015 Brazil
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <groonga/plugin.h>
static grn_obj *
func_vector_size(grn_ctx *ctx, int n_args, grn_obj **args,
grn_user_data *user_data)
{
grn_obj *target;
unsigned int size;
grn_obj *grn_size;
if (n_args != 1) {
GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT,
"vector_size(): wrong number of arguments (%d for 1)",
n_args);
return NULL;
}
target = args[0];
switch (target->header.type) {
case GRN_VECTOR :
case GRN_PVECTOR :
case GRN_UVECTOR :
size = grn_vector_size(ctx, target);
break;
default :
{
grn_obj inspected;
GRN_TEXT_INIT(&inspected, 0);
grn_inspect(ctx, target, &inspected);
GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT,
"vector_size(): target object must be vector: <%.*s>",
(int)GRN_TEXT_LEN(&inspected),
GRN_TEXT_VALUE(&inspected));
GRN_OBJ_FIN(ctx, &inspected);
return NULL;
}
break;
}
grn_size = grn_plugin_proc_alloc(ctx, user_data, GRN_DB_UINT32, 0);
if (!grn_size) {
return NULL;
}
GRN_UINT32_SET(ctx, grn_size, size);
return grn_size;
}
grn_rc
GRN_PLUGIN_INIT(grn_ctx *ctx)
{
return ctx->rc;
}
grn_rc
GRN_PLUGIN_REGISTER(grn_ctx *ctx)
{
grn_rc rc = GRN_SUCCESS;
grn_proc_create(ctx, "vector_size", -1, GRN_PROC_FUNCTION, func_vector_size,
NULL, NULL, 0, NULL);
return rc;
}
grn_rc
GRN_PLUGIN_FIN(grn_ctx *ctx)
{
return GRN_SUCCESS;
}

View file

@ -0,0 +1,2 @@
vector_la_SOURCES = \
vector.c