]> icculus.org git repositories - btb/d2x.git/blob - main/cmd.h
these controls only work via button_down
[btb/d2x.git] / main / cmd.h
1 #ifndef _CMD_H_
2 #define _CMD_H_ 1
3
4
5 void cmd_init(void);
6
7 /* Maximum length for a single command */
8 #define CMD_MAX_LENGTH 2048
9 /* Maximum number of tokens per command */
10 #define CMD_MAX_TOKENS 64
11
12 /* Add some commands to the queue to be executed */
13 void cmd_enqueue(int insert, char *input);
14 void cmd_enqueuef(int insert, const char *fmt, ...);
15 #define cmd_append(input) cmd_enqueue(0, (input))
16 #define cmd_appendf(...) cmd_enqueuef(0, __VA_ARGS__)
17 #define cmd_insert(input) cmd_enqueue(1, (input))
18 #define cmd_insertf(...) cmd_enqueuef(1, __VA_ARGS__)
19
20 /* Execute pending commands */
21 int cmd_queue_process(void);
22
23 /* execute until there are no commands left */
24 void cmd_queue_flush(void);
25
26 /* Attempt to autocomplete an input string */
27 const char *cmd_complete(char *input);
28
29 typedef void (*cmd_handler_t)(int argc, char *argv[]);
30
31 void cmd_addcommand(const char *cmd_name, cmd_handler_t cmd_func, const char *cmd_help_text);
32
33
34 #endif /* _CMD_H_ */