GVM User Suite
User tools for the GVM open source project.
|
#include "toml.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | toml_keyval_t |
struct | toml_arritem_t |
struct | toml_array_t |
struct | toml_table_t |
struct | token_t |
struct | context_t |
struct | tabpath_t |
Macros | |
#define | _POSIX_C_SOURCE 200809L |
#define | MALLOC(a) ppmalloc(a) |
#define | FREE(a) ppfree(a) |
#define | malloc(x) error - forbidden - use MALLOC instead |
#define | free(x) error - forbidden - use FREE instead |
#define | calloc(x, y) error - forbidden - use CALLOC instead |
#define | strdup(x) error - forbidden - use STRDUP instead |
#define | strndup(x) error - forbiden - use STRNDUP instead |
#define | STRINGIFY(x) #x |
#define | TOSTRING(x) STRINGIFY(x) |
#define | FLINE __FILE__ ":" TOSTRING(__LINE__) |
Typedefs | |
typedef struct toml_keyval_t | toml_keyval_t |
typedef struct toml_arritem_t | toml_arritem_t |
typedef enum tokentype_t | tokentype_t |
typedef struct token_t | token_t |
typedef struct context_t | context_t |
typedef struct tabpath_t | tabpath_t |
Enumerations | |
enum | tokentype_t { INVALID , DOT , COMMA , EQUAL , LBRACE , RBRACE , NEWLINE , LBRACKET , RBRACKET , STRING } |
Functions | |
void | toml_set_memutil (void *(*xxmalloc)(size_t), void(*xxfree)(void *)) |
static void * | CALLOC (size_t nmemb, size_t sz) |
static char * | STRDUP (const char *s) |
static char * | STRNDUP (const char *s, size_t n) |
int | toml_utf8_to_ucs (const char *orig, int len, int64_t *ret) |
int | toml_ucs_to_utf8 (int64_t code, char buf[6]) |
static void | xfree (const void *x) |
static int | next_token (context_t *ctx, int dotisspecial) |
static int | e_outofmemory (context_t *ctx, const char *fline) |
static int | e_internal (context_t *ctx, const char *fline) |
static int | e_syntax (context_t *ctx, int lineno, const char *msg) |
static int | e_badkey (context_t *ctx, int lineno) |
static int | e_keyexists (context_t *ctx, int lineno) |
static int | e_forbid (context_t *ctx, int lineno, const char *msg) |
static void * | expand (void *p, int sz, int newsz) |
static void ** | expand_ptrarr (void **p, int n) |
static toml_arritem_t * | expand_arritem (toml_arritem_t *p, int n) |
static char * | norm_lit_str (const char *src, int srclen, int multiline, char *errbuf, int errbufsz) |
static char * | norm_basic_str (const char *src, int srclen, int multiline, char *errbuf, int errbufsz) |
static char * | normalize_key (context_t *ctx, token_t strtok) |
static int | check_key (toml_table_t *tab, const char *key, toml_keyval_t **ret_val, toml_array_t **ret_arr, toml_table_t **ret_tab) |
static int | key_kind (toml_table_t *tab, const char *key) |
static toml_keyval_t * | create_keyval_in_table (context_t *ctx, toml_table_t *tab, token_t keytok) |
static toml_table_t * | create_keytable_in_table (context_t *ctx, toml_table_t *tab, token_t keytok) |
static toml_array_t * | create_keyarray_in_table (context_t *ctx, toml_table_t *tab, token_t keytok, char kind) |
static toml_arritem_t * | create_value_in_array (context_t *ctx, toml_array_t *parent) |
static toml_array_t * | create_array_in_array (context_t *ctx, toml_array_t *parent) |
static toml_table_t * | create_table_in_array (context_t *ctx, toml_array_t *parent) |
static int | skip_newlines (context_t *ctx, int isdotspecial) |
static int | parse_keyval (context_t *ctx, toml_table_t *tab) |
static int | eat_token (context_t *ctx, tokentype_t typ, int isdotspecial, const char *fline) |
static int | parse_inline_table (context_t *ctx, toml_table_t *tab) |
static int | valtype (const char *val) |
static int | parse_array (context_t *ctx, toml_array_t *arr) |
static int | fill_tabpath (context_t *ctx) |
static int | walk_tabpath (context_t *ctx) |
static int | parse_select (context_t *ctx) |
toml_table_t * | toml_parse (char *conf, char *errbuf, int errbufsz) |
toml_table_t * | toml_parse_file (FILE *fp, char *errbuf, int errbufsz) |
static void | xfree_kval (toml_keyval_t *p) |
static void | xfree_tab (toml_table_t *p) |
static void | xfree_arr (toml_array_t *p) |
void | toml_free (toml_table_t *tab) |
static void | set_token (context_t *ctx, tokentype_t tok, int lineno, char *ptr, int len) |
static void | set_eof (context_t *ctx, int lineno) |
static int | scan_digits (const char *p, int n) |
static int | scan_date (const char *p, int *YY, int *MM, int *DD) |
static int | scan_time (const char *p, int *hh, int *mm, int *ss) |
static int | scan_string (context_t *ctx, char *p, int lineno, int dotisspecial) |
const char * | toml_key_in (const toml_table_t *tab, int keyidx) |
int | toml_key_exists (const toml_table_t *tab, const char *key) |
toml_raw_t | toml_raw_in (const toml_table_t *tab, const char *key) |
toml_array_t * | toml_array_in (const toml_table_t *tab, const char *key) |
toml_table_t * | toml_table_in (const toml_table_t *tab, const char *key) |
toml_raw_t | toml_raw_at (const toml_array_t *arr, int idx) |
char | toml_array_kind (const toml_array_t *arr) |
char | toml_array_type (const toml_array_t *arr) |
int | toml_array_nelem (const toml_array_t *arr) |
const char * | toml_array_key (const toml_array_t *arr) |
int | toml_table_nkval (const toml_table_t *tab) |
int | toml_table_narr (const toml_table_t *tab) |
int | toml_table_ntab (const toml_table_t *tab) |
const char * | toml_table_key (const toml_table_t *tab) |
toml_array_t * | toml_array_at (const toml_array_t *arr, int idx) |
toml_table_t * | toml_table_at (const toml_array_t *arr, int idx) |
static int | parse_millisec (const char *p, const char **endp) |
int | toml_rtots (toml_raw_t src_, toml_timestamp_t *ret) |
int | toml_rtob (toml_raw_t src, int *ret_) |
int | toml_rtoi (toml_raw_t src, int64_t *ret_) |
int | toml_rtod_ex (toml_raw_t src, double *ret_, char *buf, int buflen) |
int | toml_rtod (toml_raw_t src, double *ret_) |
int | toml_rtos (toml_raw_t src, char **ret) |
toml_datum_t | toml_string_at (const toml_array_t *arr, int idx) |
toml_datum_t | toml_bool_at (const toml_array_t *arr, int idx) |
toml_datum_t | toml_int_at (const toml_array_t *arr, int idx) |
toml_datum_t | toml_double_at (const toml_array_t *arr, int idx) |
toml_datum_t | toml_timestamp_at (const toml_array_t *arr, int idx) |
toml_datum_t | toml_string_in (const toml_table_t *arr, const char *key) |
toml_datum_t | toml_bool_in (const toml_table_t *arr, const char *key) |
toml_datum_t | toml_int_in (const toml_table_t *arr, const char *key) |
toml_datum_t | toml_double_in (const toml_table_t *arr, const char *key) |
toml_datum_t | toml_timestamp_in (const toml_table_t *arr, const char *key) |
Variables | |
static void *(* | ppmalloc )(size_t) = malloc |
static void(* | ppfree )(void *) = free |
#define calloc | ( | x, | |
y | |||
) | error - forbidden - use CALLOC instead |
typedef enum tokentype_t tokentype_t |
typedef struct toml_arritem_t toml_arritem_t |
typedef struct toml_keyval_t toml_keyval_t |
enum tokentype_t |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
toml_array_t* toml_array_at | ( | const toml_array_t * | arr, |
int | idx | ||
) |
toml_array_t* toml_array_in | ( | const toml_table_t * | tab, |
const char * | key | ||
) |
const char* toml_array_key | ( | const toml_array_t * | arr | ) |
char toml_array_kind | ( | const toml_array_t * | arr | ) |
int toml_array_nelem | ( | const toml_array_t * | arr | ) |
char toml_array_type | ( | const toml_array_t * | arr | ) |
toml_datum_t toml_bool_at | ( | const toml_array_t * | arr, |
int | idx | ||
) |
toml_datum_t toml_bool_in | ( | const toml_table_t * | arr, |
const char * | key | ||
) |
toml_datum_t toml_double_at | ( | const toml_array_t * | arr, |
int | idx | ||
) |
toml_datum_t toml_double_in | ( | const toml_table_t * | arr, |
const char * | key | ||
) |
void toml_free | ( | toml_table_t * | tab | ) |
toml_datum_t toml_int_at | ( | const toml_array_t * | arr, |
int | idx | ||
) |
toml_datum_t toml_int_in | ( | const toml_table_t * | arr, |
const char * | key | ||
) |
int toml_key_exists | ( | const toml_table_t * | tab, |
const char * | key | ||
) |
const char* toml_key_in | ( | const toml_table_t * | tab, |
int | keyidx | ||
) |
toml_table_t* toml_parse | ( | char * | conf, |
char * | errbuf, | ||
int | errbufsz | ||
) |
toml_table_t* toml_parse_file | ( | FILE * | fp, |
char * | errbuf, | ||
int | errbufsz | ||
) |
toml_raw_t toml_raw_at | ( | const toml_array_t * | arr, |
int | idx | ||
) |
toml_raw_t toml_raw_in | ( | const toml_table_t * | tab, |
const char * | key | ||
) |
int toml_rtob | ( | toml_raw_t | src, |
int * | ret_ | ||
) |
int toml_rtod | ( | toml_raw_t | src, |
double * | ret_ | ||
) |
int toml_rtod_ex | ( | toml_raw_t | src, |
double * | ret_, | ||
char * | buf, | ||
int | buflen | ||
) |
int toml_rtoi | ( | toml_raw_t | src, |
int64_t * | ret_ | ||
) |
int toml_rtos | ( | toml_raw_t | src, |
char ** | ret | ||
) |
int toml_rtots | ( | toml_raw_t | src_, |
toml_timestamp_t * | ret | ||
) |
void toml_set_memutil | ( | void *(*)(size_t) | xxmalloc, |
void(*)(void *) | xxfree | ||
) |
toml_datum_t toml_string_at | ( | const toml_array_t * | arr, |
int | idx | ||
) |
toml_datum_t toml_string_in | ( | const toml_table_t * | arr, |
const char * | key | ||
) |
toml_table_t* toml_table_at | ( | const toml_array_t * | arr, |
int | idx | ||
) |
toml_table_t* toml_table_in | ( | const toml_table_t * | tab, |
const char * | key | ||
) |
const char* toml_table_key | ( | const toml_table_t * | tab | ) |
int toml_table_narr | ( | const toml_table_t * | tab | ) |
int toml_table_nkval | ( | const toml_table_t * | tab | ) |
int toml_table_ntab | ( | const toml_table_t * | tab | ) |
toml_datum_t toml_timestamp_at | ( | const toml_array_t * | arr, |
int | idx | ||
) |
toml_datum_t toml_timestamp_in | ( | const toml_table_t * | arr, |
const char * | key | ||
) |
int toml_ucs_to_utf8 | ( | int64_t | code, |
char | buf[6] | ||
) |
int toml_utf8_to_ucs | ( | const char * | orig, |
int | len, | ||
int64_t * | ret | ||
) |
|
static |
|
static |
|
inlinestatic |
|
static |
|
static |
|
static |