i3
Data Structures | Typedefs | Functions
commands_parser.h File Reference
#include <yajl/yajl_gen.h>
Include dependency graph for commands_parser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  CommandResultIR
 
struct  CommandResult
 A struct that contains useful information about the result of a command as a whole (e.g. More...
 

Typedefs

typedef struct CommandResult CommandResult
 

Functions

CommandResultparse_command (const char *input, yajl_gen gen)
 Parses and executes the given command. More...
 
void command_result_free (CommandResult *result)
 Frees a CommandResult. More...
 

Typedef Documentation

typedef struct CommandResult CommandResult

Definition at line 32 of file commands_parser.h.

Function Documentation

void command_result_free ( CommandResult result)

Frees a CommandResult.

Definition at line 424 of file commands_parser.c.

References CommandResult::error_message, and FREE.

Referenced by handle_key_press(), IPC_HANDLER(), and run_assignments().

CommandResult* parse_command ( const char *  input,
yajl_gen  gen 
)

Parses and executes the given command.

If a caller-allocated yajl_gen is passed, a json reply will be generated in the format specified by the ipc protocol. Pass NULL if no json reply is required.

Free the returned CommandResult with command_result_free().

Definition at line 214 of file commands_parser.c.

References tokenptr::array, clear_stack(), cmd_criteria_init(), command_output, current_match, DLOG, ELOG, CommandResult::error_message, token::identifier, INITIAL, CommandResultIR::json_gen, tokenptr::n, token::name, CommandResultIR::needs_tree_render, CommandResult::needs_tree_render, next_state(), CommandResult::parse_error, push_string(), sasprintf(), scalloc(), smalloc(), sstrdup(), state, subcommand_output, tokens, y, and ystr.

Referenced by IPC_HANDLER(), run_assignments(), and run_binding().

Here is the call graph for this function: