diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/readline.h | 1 | ||||
-rw-r--r-- | include/sway/commands.h | 29 | ||||
-rw-r--r-- | include/sway/config.h | 2 |
3 files changed, 18 insertions, 14 deletions
diff --git a/include/readline.h b/include/readline.h index b3e06d4b..ee2eba5d 100644 --- a/include/readline.h +++ b/include/readline.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <stdio.h> | 4 | #include <stdio.h> |
5 | 5 | ||
6 | char *read_line(FILE *file); | 6 | char *read_line(FILE *file); |
7 | char *peek_line(FILE *file, int line_offset, long *position); | ||
7 | char *read_line_buffer(FILE *file, char *string, size_t string_len); | 8 | char *read_line_buffer(FILE *file, char *string, size_t string_len); |
8 | 9 | ||
9 | #endif | 10 | #endif |
diff --git a/include/sway/commands.h b/include/sway/commands.h index b2255c4b..593ae0f1 100644 --- a/include/sway/commands.h +++ b/include/sway/commands.h | |||
@@ -3,6 +3,13 @@ | |||
3 | 3 | ||
4 | #include "config.h" | 4 | #include "config.h" |
5 | 5 | ||
6 | typedef struct cmd_results *sway_cmd(int argc, char **argv); | ||
7 | |||
8 | struct cmd_handler { | ||
9 | char *command; | ||
10 | sway_cmd *handle; | ||
11 | }; | ||
12 | |||
6 | /** | 13 | /** |
7 | * Indicates the result of a command's execution. | 14 | * Indicates the result of a command's execution. |
8 | */ | 15 | */ |
@@ -11,16 +18,9 @@ enum cmd_status { | |||
11 | CMD_FAILURE, /**< The command resulted in an error */ | 18 | CMD_FAILURE, /**< The command resulted in an error */ |
12 | CMD_INVALID, /**< Unknown command or parser error */ | 19 | CMD_INVALID, /**< Unknown command or parser error */ |
13 | CMD_DEFER, /**< Command execution deferred */ | 20 | CMD_DEFER, /**< Command execution deferred */ |
14 | // Config Blocks | 21 | CMD_BLOCK, |
15 | CMD_BLOCK_END, | ||
16 | CMD_BLOCK_MODE, | ||
17 | CMD_BLOCK_BAR, | ||
18 | CMD_BLOCK_BAR_COLORS, | ||
19 | CMD_BLOCK_INPUT, | ||
20 | CMD_BLOCK_SEAT, | ||
21 | CMD_BLOCK_COMMANDS, | 22 | CMD_BLOCK_COMMANDS, |
22 | CMD_BLOCK_IPC, | 23 | CMD_BLOCK_END |
23 | CMD_BLOCK_IPC_EVENTS, | ||
24 | }; | 24 | }; |
25 | 25 | ||
26 | /** | 26 | /** |
@@ -45,6 +45,8 @@ enum expected_args { | |||
45 | struct cmd_results *checkarg(int argc, const char *name, | 45 | struct cmd_results *checkarg(int argc, const char *name, |
46 | enum expected_args type, int val); | 46 | enum expected_args type, int val); |
47 | 47 | ||
48 | struct cmd_handler *find_handler(char *line, struct cmd_handler *cmd_handlers, | ||
49 | int handlers_size); | ||
48 | /** | 50 | /** |
49 | * Parse and executes a command. | 51 | * Parse and executes a command. |
50 | */ | 52 | */ |
@@ -54,7 +56,12 @@ struct cmd_results *execute_command(char *command, struct sway_seat *seat); | |||
54 | * | 56 | * |
55 | * Do not use this under normal conditions. | 57 | * Do not use this under normal conditions. |
56 | */ | 58 | */ |
57 | struct cmd_results *config_command(char *command, enum cmd_status block); | 59 | struct cmd_results *config_command(char *command); |
60 | /** | ||
61 | * Parse and handle a sub command | ||
62 | */ | ||
63 | struct cmd_results *config_subcommand(char **argv, int argc, | ||
64 | struct cmd_handler *handlers, size_t handlers_size); | ||
58 | /* | 65 | /* |
59 | * Parses a command policy rule. | 66 | * Parses a command policy rule. |
60 | */ | 67 | */ |
@@ -77,8 +84,6 @@ const char *cmd_results_to_json(struct cmd_results *results); | |||
77 | struct cmd_results *add_color(const char *name, | 84 | struct cmd_results *add_color(const char *name, |
78 | char *buffer, const char *color); | 85 | char *buffer, const char *color); |
79 | 86 | ||
80 | typedef struct cmd_results *sway_cmd(int argc, char **argv); | ||
81 | |||
82 | sway_cmd cmd_assign; | 87 | sway_cmd cmd_assign; |
83 | sway_cmd cmd_bar; | 88 | sway_cmd cmd_bar; |
84 | sway_cmd cmd_bindcode; | 89 | sway_cmd cmd_bindcode; |
diff --git a/include/sway/config.h b/include/sway/config.h index de651ea4..b597da75 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -403,8 +403,6 @@ bool read_config(FILE *file, struct sway_config *config); | |||
403 | */ | 403 | */ |
404 | void free_config(struct sway_config *config); | 404 | void free_config(struct sway_config *config); |
405 | 405 | ||
406 | void config_clear_handler_context(struct sway_config *config); | ||
407 | |||
408 | void free_sway_variable(struct sway_variable *var); | 406 | void free_sway_variable(struct sway_variable *var); |
409 | 407 | ||
410 | /** | 408 | /** |