| 1 | /* -*- c-basic-offset: 2 -*- */ |
| 2 | /* |
| 3 | Copyright(C) 2010-2016 Brazil |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License version 2.1 as published by the Free Software Foundation. |
| 8 | |
| 9 | This library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with this library; if not, write to the Free Software |
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | */ |
| 18 | |
| 19 | #pragma once |
| 20 | |
| 21 | #include "grn.h" |
| 22 | #include "grn_ctx.h" |
| 23 | #include "grn_store.h" |
| 24 | |
| 25 | #ifdef __cplusplus |
| 26 | extern "C" { |
| 27 | #endif |
| 28 | |
| 29 | #ifdef WIN32 |
| 30 | typedef HINSTANCE grn_dl; |
| 31 | typedef FARPROC grn_dl_symbol; |
| 32 | |
| 33 | #else |
| 34 | typedef void * grn_dl; |
| 35 | typedef void * grn_dl_symbol; |
| 36 | #endif |
| 37 | |
| 38 | typedef struct _grn_plugin grn_plugin; |
| 39 | |
| 40 | struct _grn_plugin { |
| 41 | char path[PATH_MAX]; |
| 42 | grn_dl dl; |
| 43 | grn_plugin_func init_func; |
| 44 | grn_plugin_func register_func; |
| 45 | grn_plugin_func unregister_func; |
| 46 | grn_plugin_func fin_func; |
| 47 | int refcount; |
| 48 | }; |
| 49 | |
| 50 | void grn_plugin_init_from_env(void); |
| 51 | grn_rc grn_plugins_init(void); |
| 52 | grn_rc grn_plugins_fin(void); |
| 53 | grn_id grn_plugin_open(grn_ctx *ctx, const char *filename); |
| 54 | grn_rc grn_plugin_close(grn_ctx *ctx, grn_id id); |
| 55 | grn_id grn_plugin_reference(grn_ctx *ctx, const char *filename); |
| 56 | const char *grn_plugin_path(grn_ctx *ctx, grn_id id); |
| 57 | char *grn_plugin_find_path(grn_ctx *ctx, const char *name); |
| 58 | void grn_plugin_ensure_registered(grn_ctx *ctx, grn_obj *proc); |
| 59 | |
| 60 | #ifdef __cplusplus |
| 61 | } |
| 62 | #endif |
| 63 | |