i3
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "all.h"
#include "GENERATED_config_enums.h"
#include "GENERATED_config_tokens.h"
#include "GENERATED_config_call.h"
Go to the source code of this file.
Data Structures | |
struct | token |
struct | tokenptr |
struct | stack_entry |
Macros | |
#define | I3__FILE__ "config_parser.c" |
#define | y(x,...) yajl_gen_ ## x (command_output.json_gen, ##__VA_ARGS__) |
#define | ystr(str) yajl_gen_string(command_output.json_gen, (unsigned char*)str, strlen(str)) |
Typedefs | |
typedef struct token | cmdp_token |
typedef struct tokenptr | cmdp_token_ptr |
Functions | |
static void | push_string (const char *identifier, const char *str) |
static void | push_long (const char *identifier, long num) |
static const char * | get_string (const char *identifier) |
static const long | get_long (const char *identifier) |
static void | clear_stack (void) |
static void | next_state (const cmdp_token *token) |
static const char * | start_of_line (const char *walk, const char *beginning) |
static char * | single_line (const char *start) |
struct ConfigResult * | parse_config (const char *input, struct context *context) |
static int | detect_version (char *buf) |
static char * | migrate_config (char *input, off_t size) |
static void | check_for_duplicate_bindings (struct context *context) |
void | parse_file (const char *f) |
Parses the given file by first replacing the variables, then calling parse_config and possibly launching i3-nagbar. More... | |
Variables | |
pid_t | config_error_nagbar_pid = -1 |
static struct context * | context |
static struct stack_entry | stack [10] |
static cmdp_state | state |
static Match | current_match |
static struct ConfigResult | subcommand_output |
static struct ConfigResult | command_output |
static cmdp_state | statelist [10] = { INITIAL } |
static int | statelist_idx = 1 |
#define I3__FILE__ "config_parser.c" |
Definition at line 2 of file config_parser.c.
Definition at line 42 of file config_parser.c.
#define ystr | ( | str | ) | yajl_gen_string(command_output.json_gen, (unsigned char*)str, strlen(str)) |
Definition at line 43 of file config_parser.c.
Referenced by parse_config().
typedef struct token cmdp_token |
typedef struct tokenptr cmdp_token_ptr |
|
static |
Definition at line 853 of file config_parser.c.
References bindings, Binding::command, ELOG, context::has_errors, Binding::keycode, Binding::mods, Binding::release, Binding::symbol, and TAILQ_FOREACH.
Referenced by parse_file().
|
static |
Definition at line 172 of file config_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_config().
|
static |
Definition at line 680 of file config_parser.c.
Referenced by parse_file().
|
static |
Definition at line 162 of file config_parser.c.
References stack_entry::num, stack, and stack_entry::val.
Referenced by GENERATED_call().
|
static |
Definition at line 152 of file config_parser.c.
References stack, stack_entry::str, and stack_entry::val.
|
static |
Definition at line 749 of file config_parser.c.
References exec_i3_utility(), and FREE.
Referenced by parse_file().
|
static |
Definition at line 250 of file config_parser.c.
References __CALL, token::call_identifier, clear_stack(), command_output, token::extra, GENERATED_call(), INITIAL, ConfigResult::json_gen, ConfigResult::next_state, token::next_state, state, statelist, statelist_idx, and subcommand_output.
Referenced by parse_config().
struct ConfigResult* parse_config | ( | const char * | input, |
struct context * | context | ||
) |
Definition at line 307 of file config_parser.c.
References tokenptr::array, clear_stack(), command_output, current_match, DLOG, ELOG, context::filename, context::has_errors, token::identifier, INITIAL, ConfigResult::json_gen, tokenptr::n, token::name, next_state(), push_long(), push_string(), sasprintf(), scalloc(), single_line(), smalloc(), start_of_line(), state, statelist, statelist_idx, subcommand_output, tokens, y, and ystr.
Referenced by parse_file().
void parse_file | ( | const char * | f | ) |
Parses the given file by first replacing the variables, then calling parse_config and possibly launching i3-nagbar.
Definition at line 900 of file config_parser.c.
References check_for_duplicate_bindings(), config, config_error_nagbar_pid, detect_version(), die, DLOG, ELOG, errorfilename, context::filename, Config::font, FREE, context::has_errors, context::has_warnings, ConfigResult::json_gen, Variable::key, context::line_copy, migrate_config(), Variable::next_match, parse_config(), Font::pattern, sasprintf(), scalloc(), SLIST_EMPTY, SLIST_FIRST, SLIST_FOREACH, SLIST_HEAD, SLIST_HEAD_INITIALIZER, SLIST_INSERT_HEAD, SLIST_REMOVE_HEAD, smalloc(), sstrdup(), start_nagbar(), and Variable::value.
Referenced by parse_configuration().
|
static |
Definition at line 131 of file config_parser.c.
References stack_entry::identifier, stack_entry::num, stack, stack_entry::STACK_LONG, stack_entry::type, and stack_entry::val.
Referenced by parse_config().
|
static |
Definition at line 103 of file config_parser.c.
References stack_entry::identifier, sasprintf(), sstrdup(), stack, stack_entry::STACK_STR, stack_entry::str, stack_entry::type, and stack_entry::val.
Referenced by parse_config().
|
static |
Definition at line 299 of file config_parser.c.
References sstrdup().
Referenced by parse_config().
|
static |
Definition at line 285 of file config_parser.c.
Referenced by parse_config().
|
static |
Definition at line 236 of file config_parser.c.
Referenced by next_state(), and parse_config().
pid_t config_error_nagbar_pid = -1 |
Definition at line 46 of file config_parser.c.
Referenced by cmd_reload(), i3_restart(), and parse_file().
Definition at line 47 of file config_parser.c.
Referenced by start_application().
|
static |
Definition at line 234 of file config_parser.c.
Referenced by parse_config().
|
static |
Definition at line 96 of file config_parser.c.
Referenced by clear_stack(), get_long(), get_string(), push_long(), and push_string().
|
static |
Definition at line 233 of file config_parser.c.
Referenced by next_state(), and parse_config().
|
static |
Definition at line 243 of file config_parser.c.
Referenced by next_state(), and parse_config().
|
static |
Definition at line 245 of file config_parser.c.
Referenced by next_state(), and parse_config().
|
static |
Definition at line 235 of file config_parser.c.
Referenced by next_state(), and parse_config().