1 /* -*- c-basic-offset: 2 -*- */
2 /*
3   Copyright(C) 2009-2018  Brazil
4   Copyright(C) 2020-2021  Sutou Kouhei <kou@clear-code.com>
5 
6   This library is free software; you can redistribute it and/or
7   modify it under the terms of the GNU Lesser General Public
8   License version 2.1 as published by the Free Software Foundation.
9 
10   This library is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   Lesser General Public License for more details.
14 
15   You should have received a copy of the GNU Lesser General Public
16   License along with this library; if not, write to the Free Software
17   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18 */
19 module groonga_d.proc;
20 
21 
22 private static import core.stdc.stdarg;
23 private static import groonga_d.groonga;
24 
25 extern(C):
26 nothrow @nogc:
27 
28 enum grn_proc_type
29 {
30 	GRN_PROC_INVALID = 0,
31 	GRN_PROC_TOKENIZER,
32 	GRN_PROC_COMMAND,
33 	GRN_PROC_FUNCTION,
34 	GRN_PROC_HOOK,
35 	GRN_PROC_NORMALIZER,
36 	GRN_PROC_TOKEN_FILTER,
37 	GRN_PROC_SCORER,
38 	GRN_PROC_WINDOW_FUNCTION,
39 	GRN_PROC_AGGREGATOR,
40 }
41 
42 //Declaration name in C language
43 enum
44 {
45 	GRN_PROC_INVALID = .grn_proc_type.GRN_PROC_INVALID,
46 	GRN_PROC_TOKENIZER = .grn_proc_type.GRN_PROC_TOKENIZER,
47 	GRN_PROC_COMMAND = .grn_proc_type.GRN_PROC_COMMAND,
48 	GRN_PROC_FUNCTION = .grn_proc_type.GRN_PROC_FUNCTION,
49 	GRN_PROC_HOOK = .grn_proc_type.GRN_PROC_HOOK,
50 	GRN_PROC_NORMALIZER = .grn_proc_type.GRN_PROC_NORMALIZER,
51 	GRN_PROC_TOKEN_FILTER = .grn_proc_type.GRN_PROC_TOKEN_FILTER,
52 	GRN_PROC_SCORER = .grn_proc_type.GRN_PROC_SCORER,
53 	GRN_PROC_WINDOW_FUNCTION = .grn_proc_type.GRN_PROC_WINDOW_FUNCTION,
54 	GRN_PROC_AGGREGATOR = .grn_proc_type.GRN_PROC_AGGREGATOR,
55 }
56 
57 //GRN_API
58 groonga_d.groonga.grn_obj* grn_proc_create(groonga_d.groonga.grn_ctx* ctx, const (char)* name, int name_size, grn_proc_type type, groonga_d.groonga.grn_proc_func* init, groonga_d.groonga.grn_proc_func* next, groonga_d.groonga.grn_proc_func* fin, uint nvars, groonga_d.groonga.grn_expr_var* vars);
59 
60 //GRN_API
61 groonga_d.groonga.grn_obj* grn_proc_get_info(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_user_data* user_data, groonga_d.groonga.grn_expr_var** vars, uint* nvars, groonga_d.groonga.grn_obj** caller);
62 
63 //GRN_API
64 grn_proc_type grn_proc_get_type(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* proc);
65 
66 alias grn_proc_option_value_parse_func = groonga_d.groonga.grn_rc function(groonga_d.groonga.grn_ctx* ctx, const (char)* name, groonga_d.groonga.grn_obj* value, const (char)* tag, void* user_data);
67 
68 enum grn_proc_option_value_type
69 {
70 	GRN_PROC_OPTION_VALUE_RAW,
71 	GRN_PROC_OPTION_VALUE_MODE,
72 	GRN_PROC_OPTION_VALUE_OPERATOR,
73 	GRN_PROC_OPTION_VALUE_EXPR_FLAGS,
74 	GRN_PROC_OPTION_VALUE_INT64,
75 	GRN_PROC_OPTION_VALUE_BOOL,
76 	GRN_PROC_OPTION_VALUE_FUNC,
77 	GRN_PROC_OPTION_VALUE_TOKENIZE_MODE,
78 	GRN_PROC_OPTION_VALUE_TOKEN_CURSOR_FLAGS,
79 	GRN_PROC_OPTION_VALUE_DOUBLE,
80 }
81 
82 //Declaration name in C language
83 enum
84 {
85 	GRN_PROC_OPTION_VALUE_RAW = .grn_proc_option_value_type.GRN_PROC_OPTION_VALUE_RAW,
86 	GRN_PROC_OPTION_VALUE_MODE = .grn_proc_option_value_type.GRN_PROC_OPTION_VALUE_MODE,
87 	GRN_PROC_OPTION_VALUE_OPERATOR = .grn_proc_option_value_type.GRN_PROC_OPTION_VALUE_OPERATOR,
88 	GRN_PROC_OPTION_VALUE_EXPR_FLAGS = .grn_proc_option_value_type.GRN_PROC_OPTION_VALUE_EXPR_FLAGS,
89 	GRN_PROC_OPTION_VALUE_INT64 = .grn_proc_option_value_type.GRN_PROC_OPTION_VALUE_INT64,
90 	GRN_PROC_OPTION_VALUE_BOOL = .grn_proc_option_value_type.GRN_PROC_OPTION_VALUE_BOOL,
91 	GRN_PROC_OPTION_VALUE_FUNC = .grn_proc_option_value_type.GRN_PROC_OPTION_VALUE_FUNC,
92 	GRN_PROC_OPTION_VALUE_TOKENIZE_MODE = .grn_proc_option_value_type.GRN_PROC_OPTION_VALUE_TOKENIZE_MODE,
93 	GRN_PROC_OPTION_VALUE_TOKEN_CURSOR_FLAGS = .grn_proc_option_value_type.GRN_PROC_OPTION_VALUE_TOKEN_CURSOR_FLAGS,
94 	GRN_PROC_OPTION_VALUE_DOUBLE = .grn_proc_option_value_type.GRN_PROC_OPTION_VALUE_DOUBLE,
95 }
96 
97 /+
98 //GRN_API
99 groonga_d.groonga.grn_rc grn_proc_prefixed_options_parse(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* options, const (char)* prefix, const (char)* tag, const (char)* name, ...);
100 +/
101 
102 //GRN_API
103 groonga_d.groonga.grn_rc grn_proc_prefixed_options_parsev(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* options, const (char)* prefix, const (char)* tag, const (char)* name, core.stdc.stdarg.va_list args);
104 
105 /+
106 //GRN_API
107 groonga_d.groonga.grn_rc grn_proc_options_parse(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* options, const (char)* tag, const (char)* name, ...);
108 +/
109 
110 //GRN_API
111 groonga_d.groonga.grn_rc grn_proc_options_parsev(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* options, const (char)* tag, const (char)* name, core.stdc.stdarg.va_list args);