Add:Core:Make asynchonicity for saved commands optional
[profile/ivi/navit.git] / navit / navit / command.h
1 /**
2  * Navit, a modular navigation system.
3  * Copyright (C) 2005-2010 Navit Team
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * version 2 as published by the Free Software Foundation.
8  *
9  * This program 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
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA  02110-1301, USA.
18  */
19
20 #ifndef NAVIT_COMMAND_H
21 #define NAVIT_COMMAND_H
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 struct command_table {
28         const char *command;
29         int (*func)(void *data, char *cmd, struct attr **in, struct attr ***out);
30 };
31
32 #define command_cast(x) (int (*)(void *, char *, struct attr **, struct attr ***))(x)
33
34 /* prototypes */
35 enum attr_type;
36 struct attr;
37 struct callback;
38 struct callback_list;
39 struct command_saved;
40 struct command_table;
41 struct navit;
42 enum attr_type command_evaluate_to_attr(struct attr *attr, char *expr, int *error, struct attr *ret);
43 void command_evaluate_to_void(struct attr *attr, char *expr, int *error);
44 char *command_evaluate_to_string(struct attr *attr, char *expr, int *error);
45 int command_evaluate_to_int(struct attr *attr, char *expr, int *error);
46 int command_evaluate_to_boolean(struct attr *attr, const char *expr, int *error);
47 void command_evaluate(struct attr *attr, const char *expr);
48 void command_add_table_attr(struct command_table *table, int count, void *data, struct attr *attr);
49 void command_add_table(struct callback_list *cbl, struct command_table *table, int count, void *data);
50 void command_saved_set_cb(struct command_saved *cs, struct callback *cb);
51 int command_saved_get_int(struct command_saved *cs);
52 int command_saved_error(struct command_saved *cs);
53 struct command_saved *command_saved_new(char *command, struct navit *navit, struct callback *cb, int async);
54 void command_saved_destroy(struct command_saved *cs);
55 /* end of prototypes */
56 #ifdef __cplusplus
57 }
58 #endif
59
60  #endif /* NAVIT_COMMAND_H */