|
i3
|
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <stdbool.h>#include <stdint.h>#include "all.h"#include "GENERATED_command_enums.h"#include "GENERATED_command_tokens.h"#include "GENERATED_command_call.h"
Go to the source code of this file.
Data Structures | |
| struct | token |
| struct | tokenptr |
| struct | stack_entry |
Macros | |
| #define | I3__FILE__ "commands_parser.c" |
| #define | y(x,...) (command_output.json_gen != NULL ? yajl_gen_##x(command_output.json_gen, ##__VA_ARGS__) : 0) |
| #define | ystr(str) (command_output.json_gen != NULL ? yajl_gen_string(command_output.json_gen, (unsigned char *)str, strlen(str)) : 0) |
Typedefs | |
| typedef struct token | cmdp_token |
| typedef struct tokenptr | cmdp_token_ptr |
Functions | |
| static void | push_string (const char *identifier, char *str) |
| static void | push_long (const char *identifier, long num) |
| static const char * | get_string (const char *identifier) |
| static long | get_long (const char *identifier) |
| static void | clear_stack (void) |
| static void | next_state (const cmdp_token *token) |
| char * | parse_string (const char **walk, bool as_word) |
| Parses a string (or word, if as_word is true). More... | |
| CommandResult * | parse_command (const char *input, yajl_gen gen) |
| Parses and executes the given command. More... | |
| void | command_result_free (CommandResult *result) |
| Frees a CommandResult. More... | |
Variables | |
| static struct stack_entry | stack [10] |
| static cmdp_state | state |
| static Match | current_match |
| static struct CommandResultIR | subcommand_output |
| static struct CommandResultIR | command_output |
| #define I3__FILE__ "commands_parser.c" |
Definition at line 2 of file commands_parser.c.
| #define y | ( | x, | |
| ... | |||
| ) | (command_output.json_gen != NULL ? yajl_gen_##x(command_output.json_gen, ##__VA_ARGS__) : 0) |
Definition at line 38 of file commands_parser.c.
| #define ystr | ( | str | ) | (command_output.json_gen != NULL ? yajl_gen_string(command_output.json_gen, (unsigned char *)str, strlen(str)) : 0) |
Definition at line 39 of file commands_parser.c.
Referenced by parse_command().
| typedef struct token cmdp_token |
| typedef struct tokenptr cmdp_token_ptr |
|
static |
Definition at line 160 of file commands_parser.c.
References stack_entry::identifier, stack_entry::num, stack, stack_entry::STACK_STR, stack_entry::str, stack_entry::type, and stack_entry::val.
Referenced by next_state(), and parse_command().
| void command_result_free | ( | CommandResult * | result | ) |
Frees a CommandResult.
Definition at line 459 of file commands_parser.c.
References CommandResult::error_message, and FREE.
Referenced by handle_button_press(), handle_key_press(), IPC_HANDLER(), route_click(), and run_assignments().
|
static |
Definition at line 148 of file commands_parser.c.
References stack_entry::num, stack, and stack_entry::val.
Referenced by GENERATED_call().
|
static |
Definition at line 137 of file commands_parser.c.
References stack, stack_entry::str, and stack_entry::val.
Referenced by GENERATED_call().
|
static |
Definition at line 183 of file commands_parser.c.
References __CALL, token::call_identifier, clear_stack(), command_output, token::extra, GENERATED_call(), INITIAL, CommandResultIR::json_gen, CommandResultIR::needs_tree_render, CommandResultIR::next_state, token::next_state, state, and subcommand_output.
Referenced by parse_command().

| 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 266 of file commands_parser.c.
References tokenptr::array, clear_stack(), cmd_criteria_init(), command_output, 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, parse_string(), push_long(), push_string(), sasprintf(), scalloc(), smalloc(), sstrdup(), state, subcommand_output, tokens, y, and ystr.
Referenced by IPC_HANDLER(), run_assignments(), and run_binding().

| char* parse_string | ( | const char ** | walk, |
| bool | as_word | ||
| ) |
Parses a string (or word, if as_word is true).
Extracted out of parse_command so that it can be used in src/workspace.c for interpreting workspace commands.
Definition at line 209 of file commands_parser.c.
References scalloc().
Referenced by extract_workspace_names_from_bindings(), and parse_command().

|
static |
Definition at line 115 of file commands_parser.c.
References stack_entry::identifier, stack_entry::num, stack, stack_entry::STACK_LONG, stack_entry::type, and stack_entry::val.
Referenced by parse_command().
|
static |
Definition at line 94 of file commands_parser.c.
References stack_entry::identifier, stack, stack_entry::STACK_STR, stack_entry::str, stack_entry::type, and stack_entry::val.
Referenced by parse_command().
|
static |
Definition at line 179 of file commands_parser.c.
Referenced by next_state(), and parse_command().
|
static |
Definition at line 176 of file commands_parser.c.
Referenced by CFGFUN(), cmd_criteria_add(), cmd_criteria_match_windows(), cmd_focus(), cmd_layout_toggle(), cmd_move_con_to_workspace(), cmd_move_con_to_workspace_name(), cmd_move_con_to_workspace_number(), cmd_resize(), cmd_scratchpad_show(), cmd_unmark(), GENERATED_call(), and TAILQ_HEAD().
|
static |
Definition at line 87 of file commands_parser.c.
Referenced by clear_stack(), get_long(), get_string(), push_long(), and push_string().
|
static |
Definition at line 174 of file commands_parser.c.
Referenced by CIRCLEQ_HEAD(), configure_notify(), display_running_version(), expose_event(), next_state(), open_placeholder_window(), parse_command(), restore_connect(), restore_kill_placeholder(), set_hidden_state(), sig_handle_key_press(), x_con_init(), x_con_kill(), x_deco_recurse(), x_mask_event_mask(), x_push_changes(), x_push_node(), x_push_node_unmaps(), x_raise_con(), x_reinit(), x_reparent_child(), and x_set_name().
|
static |
Definition at line 178 of file commands_parser.c.
Referenced by next_state(), and parse_command().
1.8.5