i3
Data Structures | Macros | Typedefs | Functions | Variables
config_parser.c File Reference
#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"
Include dependency graph for config_parser.c:

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 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 ConfigResultIRparse_config (const char *input, struct context *context)
 
static int detect_version (char *buf)
 
static char * migrate_config (char *input, off_t size)
 
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 contextcontext
 
static struct stack_entry stack [10]
 
static cmdp_state state
 
static Match current_match
 
static struct ConfigResultIR subcommand_output
 
static struct ConfigResultIR command_output
 
static cmdp_state statelist [10] = {INITIAL}
 
static int statelist_idx = 1
 

Macro Definition Documentation

#define I3__FILE__   "config_parser.c"

Definition at line 2 of file config_parser.c.

#define y (   x,
  ... 
)    yajl_gen_##x(command_output.json_gen, ##__VA_ARGS__)

Definition at line 42 of file config_parser.c.

Referenced by parse_config().

#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 Documentation

typedef struct token cmdp_token
typedef struct tokenptr cmdp_token_ptr

Function Documentation

static void clear_stack ( void  )
static
static int detect_version ( char *  buf)
static

Definition at line 673 of file config_parser.c.

References LOG.

Referenced by parse_file().

static long get_long ( const char *  identifier)
static

Definition at line 161 of file config_parser.c.

References stack_entry::num, stack, and stack_entry::val.

Referenced by GENERATED_call().

static const char* get_string ( const char *  identifier)
static

Definition at line 151 of file config_parser.c.

References stack, stack_entry::str, and stack_entry::val.

static char* migrate_config ( char *  input,
off_t  size 
)
static

Definition at line 742 of file config_parser.c.

References exec_i3_utility(), and FREE.

Referenced by parse_file().

Here is the call graph for this function:

static void next_state ( const cmdp_token token)
static
struct ConfigResultIR* parse_config ( const char *  input,
struct context context 
)
void parse_file ( const char *  f)
static void push_long ( const char *  identifier,
long  num 
)
static
static void push_string ( const char *  identifier,
const char *  str 
)
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().

Here is the call graph for this function:

static char* single_line ( const char *  start)
static

Definition at line 297 of file config_parser.c.

References sstrdup().

Referenced by parse_config().

Here is the call graph for this function:

static const char* start_of_line ( const char *  walk,
const char *  beginning 
)
static

Definition at line 283 of file config_parser.c.

Referenced by parse_config().

Variable Documentation

struct ConfigResultIR command_output
static

Definition at line 235 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().

struct context* context
static

Definition at line 47 of file config_parser.c.

Referenced by start_application().

Match current_match
static

Definition at line 233 of file config_parser.c.

Referenced by parse_config().

struct stack_entry stack[10]
static

Definition at line 96 of file config_parser.c.

Referenced by clear_stack(), get_long(), get_string(), push_long(), and push_string().

cmdp_state state
static

Definition at line 232 of file config_parser.c.

Referenced by next_state(), and parse_config().

cmdp_state statelist[10] = {INITIAL}
static

Definition at line 242 of file config_parser.c.

Referenced by next_state(), and parse_config().

int statelist_idx = 1
static

Definition at line 244 of file config_parser.c.

Referenced by next_state(), and parse_config().

struct ConfigResultIR subcommand_output
static

Definition at line 234 of file config_parser.c.

Referenced by next_state(), and parse_config().