1 /* -*- c-basic-offset: 2 -*- */
2 /*
3   Copyright(C) 2015-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 module groonga_d.command;
19 
20 
21 private static import groonga_d.groonga;
22 
23 extern(C):
24 nothrow @nogc:
25 
26 //#include <groonga/plugin.h>
27 
28 extern struct _grn_command_input;
29 alias grn_command_input = _grn_command_input;
30 
31 //GRN_PLUGIN_EXPORT
32 export grn_command_input* grn_command_input_open(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* command);
33 
34 //GRN_PLUGIN_EXPORT
35 export groonga_d.groonga.grn_rc grn_command_input_close(groonga_d.groonga.grn_ctx* ctx, grn_command_input* input);
36 
37 //GRN_PLUGIN_EXPORT
38 export groonga_d.groonga.grn_obj* grn_command_input_add(groonga_d.groonga.grn_ctx* ctx, grn_command_input* input, const (char)* name, int name_size, groonga_d.groonga.grn_bool* added);
39 
40 //GRN_PLUGIN_EXPORT
41 export groonga_d.groonga.grn_obj* grn_command_input_get(groonga_d.groonga.grn_ctx* ctx, grn_command_input* input, const (char)* name, int name_size);
42 
43 //GRN_PLUGIN_EXPORT
44 export groonga_d.groonga.grn_obj* grn_command_input_at(groonga_d.groonga.grn_ctx* ctx, grn_command_input* input, uint offset);
45 
46 //GRN_PLUGIN_EXPORT
47 export groonga_d.groonga.grn_obj* grn_command_input_get_arguments(groonga_d.groonga.grn_ctx* ctx, grn_command_input* input);
48 
49 /+
50 typedef void grn_command_run_func(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* command, grn_command_input* input, void* user_data);
51 +/
52 alias grn_command_run_func = extern (C) void function(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* command, grn_command_input* input, void* user_data);
53 
54 /*
55   grn_command_register() registers a command to the database which is
56   associated with `ctx'. `command_name' and `command_name_size'
57   specify the command name. Alphabetic letters ('A'-'Z' and 'a'-'z'),
58   digits ('0'-'9') and an underscore ('_') are capable characters.
59 
60   `run' is called for running the command.
61 
62   grn_command_register() returns GRN_SUCCESS on success, an error
63   code on failure.
64  */
65 
66 //GRN_PLUGIN_EXPORT
67 export groonga_d.groonga.grn_rc grn_command_register(groonga_d.groonga.grn_ctx* ctx, const (char)* command_name, int command_name_size, grn_command_run_func* run, groonga_d.groonga.grn_expr_var* vars, uint n_vars, void* user_data);
68 
69 //GRN_PLUGIN_EXPORT
70 export groonga_d.groonga.grn_rc grn_command_run(groonga_d.groonga.grn_ctx* ctx, groonga_d.groonga.grn_obj* command, grn_command_input* input);