i3
include
commands_parser.h
Go to the documentation of this file.
1
/*
2
* vim:ts=4:sw=4:expandtab
3
*
4
* i3 - an improved tiling window manager
5
* © 2009 Michael Stapelberg and contributors (see also: LICENSE)
6
*
7
* commands.c: all command functions (see commands_parser.c)
8
*
9
*/
10
#pragma once
11
12
#include <config.h>
13
14
#include <yajl/yajl_gen.h>
15
21
struct
CommandResultIR
{
22
/* The JSON generator to append a reply to (may be NULL). */
23
yajl_gen
json_gen
;
24
25
/* The IPC client connection which sent this command (may be NULL, e.g. for
26
key bindings). */
27
ipc_client
*
client
;
28
29
/* The next state to transition to. Passed to the function so that we can
30
* determine the next state as a result of a function call, like
31
* cfg_criteria_pop_state() does. */
32
int
next_state
;
33
34
/* Whether the command requires calling tree_render. */
35
bool
needs_tree_render
;
36
};
37
38
typedef
struct
CommandResult
CommandResult
;
39
46
struct
CommandResult
{
47
bool
parse_error
;
48
/* the error_message is currently only set for parse errors */
49
char
*
error_message
;
50
bool
needs_tree_render
;
51
};
52
59
char
*
parse_string
(
const
char
**walk,
bool
as_word);
60
68
CommandResult
*
parse_command
(
const
char
*input, yajl_gen gen,
ipc_client
*client);
69
73
void
command_result_free
(
CommandResult
*result);
parse_command
CommandResult * parse_command(const char *input, yajl_gen gen, ipc_client *client)
Parses and executes the given command.
Definition
commands_parser.c:253
parse_string
char * parse_string(const char **walk, bool as_word)
Parses a string (or word, if as_word is true).
Definition
commands_parser.c:190
command_result_free
void command_result_free(CommandResult *result)
Frees a CommandResult.
Definition
commands_parser.c:458
CommandResultIR
Holds an intermediate representation of the result of a call to any command.
Definition
commands_parser.h:21
CommandResultIR::client
ipc_client * client
Definition
commands_parser.h:27
CommandResultIR::needs_tree_render
bool needs_tree_render
Definition
commands_parser.h:35
CommandResultIR::next_state
int next_state
Definition
commands_parser.h:32
CommandResultIR::json_gen
yajl_gen json_gen
Definition
commands_parser.h:23
CommandResult
A struct that contains useful information about the result of a command as a whole (e....
Definition
commands_parser.h:46
CommandResult::error_message
char * error_message
Definition
commands_parser.h:49
CommandResult::parse_error
bool parse_error
Definition
commands_parser.h:47
CommandResult::needs_tree_render
bool needs_tree_render
Definition
commands_parser.h:50
ipc_client
Definition
ipc.h:26
Generated by
1.12.0