X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Fcommands_parser.h;h=37c4d4b1705459da0894d8ef2f0c4e0390dd9d2e;hb=78e99440f6ff144bb6842f3fb33c1f65faadc4df;hp=77569ec5a3b8a837f551518a098ca8d81233cfc8;hpb=4fe974408da75a3aa45fcd5eabaadaa034845c1b;p=i3%2Fi3 diff --git a/include/commands_parser.h b/include/commands_parser.h index 77569ec5..37c4d4b1 100644 --- a/include/commands_parser.h +++ b/include/commands_parser.h @@ -7,9 +7,33 @@ * commands.c: all command functions (see commands_parser.c) * */ -#ifndef _COMMANDS_PARSER_H -#define _COMMANDS_PARSER_H +#ifndef I3_COMMANDS_PARSER_H +#define I3_COMMANDS_PARSER_H -char *parse_command(const char *input); +#include + +/* + * Holds the result of a call to any command. When calling + * parse_command("floating enable, border none"), the parser will internally + * use a struct CommandResult when calling cmd_floating and cmd_border. + * parse_command will also return another struct CommandResult, whose + * json_output is set to a map of individual json_outputs and whose + * needs_tree_trender is true if any individual needs_tree_render was true. + * + */ +struct CommandResult { + /* The JSON generator to append a reply to. */ + yajl_gen json_gen; + + /* The next state to transition to. Passed to the function so that we can + * determine the next state as a result of a function call, like + * cfg_criteria_pop_state() does. */ + int next_state; + + /* Whether the command requires calling tree_render. */ + bool needs_tree_render; +}; + +struct CommandResult *parse_command(const char *input); #endif