RetroArch
Classes | Macros | Functions
config_file.c File Reference
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <sys/param.h>
#include <retro_miscellaneous.h>
#include <compat/strl.h>
#include <compat/posix_string.h>
#include <compat/fopen_utf8.h>
#include <compat/msvc.h>
#include <file/config_file.h>
#include <file/file_path.h>
#include <lists/string_list.h>
#include <string/stdstring.h>
#include <streams/file_stream.h>
Include dependency graph for config_file.c:
This graph shows which files directly or indirectly include this file:

Classes

struct  config_entry_list
 
struct  config_include_list
 

Macros

#define MAX_INCLUDE_DEPTH   16
 

Functions

static config_file_tconfig_file_new_internal (const char *path, unsigned depth, config_file_cb_t *cb)
 
static int config_sort_compare_func (struct config_entry_list *a, struct config_entry_list *b)
 
static struct config_entry_listmerge_sort_linked_list (struct config_entry_list *list, int(*compare)(struct config_entry_list *one, struct config_entry_list *two))
 
static char * strip_comment (char *str)
 
static char * extract_value (char *line, bool is_value)
 
static void add_child_list (config_file_t *parent, config_file_t *child)
 
static void add_sub_conf (config_file_t *conf, char *path, config_file_cb_t *cb)
 
static bool parse_line (config_file_t *conf, struct config_entry_list *list, char *line, config_file_cb_t *cb)
 
void config_file_free (config_file_t *conf)
 
bool config_append_file (config_file_t *conf, const char *path)
 
config_file_tconfig_file_new_from_string (const char *from_string)
 
config_file_tconfig_file_new_with_callback (const char *path, config_file_cb_t *cb)
 
config_file_tconfig_file_new (const char *path)
 
static struct config_entry_listconfig_get_entry (const config_file_t *conf, const char *key, struct config_entry_list **prev)
 
bool config_get_double (config_file_t *conf, const char *key, double *in)
 
bool config_get_float (config_file_t *conf, const char *key, float *in)
 
bool config_get_int (config_file_t *conf, const char *key, int *in)
 
bool config_get_size_t (config_file_t *conf, const char *key, size_t *in)
 
bool config_get_uint (config_file_t *conf, const char *key, unsigned *in)
 
bool config_get_hex (config_file_t *conf, const char *key, unsigned *in)
 
bool config_get_char (config_file_t *conf, const char *key, char *in)
 
bool config_get_string (config_file_t *conf, const char *key, char **str)
 
bool config_get_config_path (config_file_t *conf, char *s, size_t len)
 
bool config_get_array (config_file_t *conf, const char *key, char *buf, size_t size)
 
bool config_get_path (config_file_t *conf, const char *key, char *buf, size_t size)
 
bool config_get_bool (config_file_t *conf, const char *key, bool *in)
 
void config_set_string (config_file_t *conf, const char *key, const char *val)
 
void config_unset (config_file_t *conf, const char *key)
 
void config_set_path (config_file_t *conf, const char *entry, const char *val)
 
void config_set_double (config_file_t *conf, const char *key, double val)
 
void config_set_float (config_file_t *conf, const char *key, float val)
 
void config_set_int (config_file_t *conf, const char *key, int val)
 
void config_set_uint (config_file_t *conf, const char *key, unsigned int val)
 
void config_set_hex (config_file_t *conf, const char *key, unsigned val)
 
void config_set_uint64 (config_file_t *conf, const char *key, uint64_t val)
 
void config_set_char (config_file_t *conf, const char *key, char val)
 
void config_set_bool (config_file_t *conf, const char *key, bool val)
 
bool config_file_write (config_file_t *conf, const char *path)
 
void config_file_dump (config_file_t *conf, FILE *file)
 
bool config_entry_exists (config_file_t *conf, const char *entry)
 
bool config_get_entry_list_head (config_file_t *conf, struct config_file_entry *entry)
 
bool config_get_entry_list_next (struct config_file_entry *entry)
 
bool config_file_exists (const char *path)
 

Macro Definition Documentation

◆ MAX_INCLUDE_DEPTH

#define MAX_INCLUDE_DEPTH   16

Function Documentation

◆ add_child_list()

static void add_child_list ( config_file_t parent,
config_file_t child 
)
static
Here is the caller graph for this function:

◆ add_sub_conf()

static void add_sub_conf ( config_file_t conf,
char *  path,
config_file_cb_t cb 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_append_file()

bool config_append_file ( config_file_t conf,
const char *  path 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_entry_exists()

bool config_entry_exists ( config_file_t conf,
const char *  entry 
)
Here is the call graph for this function:

◆ config_file_dump()

void config_file_dump ( config_file_t conf,
FILE file 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_file_exists()

bool config_file_exists ( const char *  path)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_file_free()

void config_file_free ( config_file_t conf)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_file_new()

config_file_t* config_file_new ( const char *  path)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_file_new_from_string()

config_file_t* config_file_new_from_string ( const char *  from_string)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_file_new_internal()

static config_file_t * config_file_new_internal ( const char *  path,
unsigned  depth,
config_file_cb_t cb 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_file_new_with_callback()

config_file_t* config_file_new_with_callback ( const char *  path,
config_file_cb_t cb 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_file_write()

bool config_file_write ( config_file_t conf,
const char *  path 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_get_array()

bool config_get_array ( config_file_t conf,
const char *  key,
char *  buf,
size_t  size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_get_bool()

bool config_get_bool ( config_file_t conf,
const char *  key,
bool in 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_get_char()

bool config_get_char ( config_file_t conf,
const char *  key,
char *  in 
)
Here is the call graph for this function:

◆ config_get_config_path()

bool config_get_config_path ( config_file_t conf,
char *  s,
size_t  len 
)
Here is the caller graph for this function:

◆ config_get_double()

bool config_get_double ( config_file_t conf,
const char *  key,
double *  in 
)
Here is the call graph for this function:

◆ config_get_entry()

static struct config_entry_list* config_get_entry ( const config_file_t conf,
const char *  key,
struct config_entry_list **  prev 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_get_entry_list_head()

bool config_get_entry_list_head ( config_file_t conf,
struct config_file_entry entry 
)
Here is the caller graph for this function:

◆ config_get_entry_list_next()

bool config_get_entry_list_next ( struct config_file_entry entry)
Here is the caller graph for this function:

◆ config_get_float()

bool config_get_float ( config_file_t conf,
const char *  key,
float *  in 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_get_hex()

bool config_get_hex ( config_file_t conf,
const char *  key,
unsigned *  in 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_get_int()

bool config_get_int ( config_file_t conf,
const char *  key,
int *  in 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_get_path()

bool config_get_path ( config_file_t conf,
const char *  key,
char *  buf,
size_t  size 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_get_size_t()

bool config_get_size_t ( config_file_t conf,
const char *  key,
size_t *  in 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_get_string()

bool config_get_string ( config_file_t conf,
const char *  key,
char **  str 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_get_uint()

bool config_get_uint ( config_file_t conf,
const char *  key,
unsigned *  in 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_set_bool()

void config_set_bool ( config_file_t conf,
const char *  key,
bool  val 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_set_char()

void config_set_char ( config_file_t conf,
const char *  key,
char  val 
)
Here is the call graph for this function:

◆ config_set_double()

void config_set_double ( config_file_t conf,
const char *  key,
double  val 
)
Here is the call graph for this function:

◆ config_set_float()

void config_set_float ( config_file_t conf,
const char *  key,
float  val 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_set_hex()

void config_set_hex ( config_file_t conf,
const char *  key,
unsigned  val 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_set_int()

void config_set_int ( config_file_t conf,
const char *  key,
int  val 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_set_path()

void config_set_path ( config_file_t conf,
const char *  entry,
const char *  val 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_set_string()

void config_set_string ( config_file_t conf,
const char *  key,
const char *  val 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_set_uint()

void config_set_uint ( config_file_t conf,
const char *  key,
unsigned int  val 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_set_uint64()

void config_set_uint64 ( config_file_t conf,
const char *  key,
uint64_t  val 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ config_sort_compare_func()

static int config_sort_compare_func ( struct config_entry_list a,
struct config_entry_list b 
)
static
Here is the caller graph for this function:

◆ config_unset()

void config_unset ( config_file_t conf,
const char *  key 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_value()

static char* extract_value ( char *  line,
bool  is_value 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ merge_sort_linked_list()

static struct config_entry_list* merge_sort_linked_list ( struct config_entry_list list,
int(*)(struct config_entry_list *one, struct config_entry_list *two)  compare 
)
static
Here is the caller graph for this function:

◆ parse_line()

static bool parse_line ( config_file_t conf,
struct config_entry_list list,
char *  line,
config_file_cb_t cb 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ strip_comment()

static char* strip_comment ( char *  str)
static
Here is the call graph for this function:
Here is the caller graph for this function: