Loading...
Searching...
No Matches
cyaml.h
Go to the documentation of this file.
/*
* SPDX-License-Identifier: ISC
*
* Copyright (c) 2017-2021 Michael Drake <tlsa@netsurf-browser.org>
*/
#ifndef CYAML_H
#define CYAML_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdarg.h>
#include <stdint.h>
#include <stddef.h>
extern const char *cyaml_version_str;
extern const uint32_t cyaml_version;
typedef enum cyaml_type {
CYAML_INT,
CYAML_UINT,
CYAML_BOOL,
CYAML_ENUM,
CYAML_FLAGS,
CYAML_FLOAT,
CYAML_STRING,
CYAML_MAPPING,
CYAML_BITFIELD,
CYAML_SEQUENCE,
CYAML_SEQUENCE_FIXED,
CYAML_IGNORE,
CYAML__TYPE_COUNT,
} cyaml_type_e;
typedef enum cyaml_flag {
CYAML_FLAG_DEFAULT = 0,
CYAML_FLAG_OPTIONAL = (1 << 0),
CYAML_FLAG_POINTER = (1 << 1),
CYAML_FLAG_POINTER_NULL = (1 << 2) | CYAML_FLAG_POINTER,
CYAML_FLAG_POINTER_NULL_STR = (1 << 3) | CYAML_FLAG_POINTER_NULL,
CYAML_FLAG_STRICT = (1 << 4),
CYAML_FLAG_BLOCK = (1 << 5),
CYAML_FLAG_FLOW = (1 << 6),
CYAML_FLAG_CASE_SENSITIVE = (1 << 7),
CYAML_FLAG_CASE_INSENSITIVE = (1 << 8),
CYAML_FLAG_SCALAR_PLAIN = (1 << 9),
CYAML_FLAG_SCALAR_FOLDED = (1 << 10),
CYAML_FLAG_SCALAR_LITERAL = (1 << 11),
CYAML_FLAG_SCALAR_QUOTE_SINGLE = (1 << 12),
CYAML_FLAG_SCALAR_QUOTE_DOUBLE = (1 << 13),
} cyaml_flag_e;
typedef struct cyaml_strval {
const char *str;
int64_t val;
} cyaml_strval_t;
typedef struct cyaml_bitdef {
const char *name;
uint8_t offset;
uint8_t bits;
} cyaml_bitdef_t;
typedef struct cyaml_schema_value {
enum cyaml_type type;
enum cyaml_flag flags;
uint32_t data_size;
union {
struct {
uint32_t min;
uint32_t max;
} string;
struct {
const struct cyaml_schema_field *fields;
} mapping;
struct {
const struct cyaml_bitdef *bitdefs;
uint32_t count;
} bitfield;
struct {
const struct cyaml_schema_value *entry;
uint32_t min;
uint32_t max;
} sequence;
struct {
const cyaml_strval_t *strings;
uint32_t count;
} enumeration;
};
} cyaml_schema_value_t;
typedef struct cyaml_schema_field {
const char *key;
uint32_t data_offset;
uint32_t count_offset;
uint8_t count_size;
struct cyaml_schema_value value;
} cyaml_schema_field_t;
typedef enum cyaml_cfg_flags {
CYAML_CFG_DEFAULT = 0,
CYAML_CFG_IGNORE_UNKNOWN_KEYS = (1 << 0),
CYAML_CFG_STYLE_BLOCK = (1 << 1),
CYAML_CFG_STYLE_FLOW = (1 << 2),
CYAML_CFG_DOCUMENT_DELIM = (1 << 3),
CYAML_CFG_CASE_INSENSITIVE = (1 << 4),
CYAML_CFG_NO_ALIAS = (1 << 5),
CYAML_CFG_IGNORED_KEY_WARNING = (1 << 6),
} cyaml_cfg_flags_t;
typedef enum cyaml_err {
CYAML_OK,
CYAML_ERR_OOM,
CYAML_ERR_ALIAS,
CYAML_ERR_FILE_OPEN,
CYAML_ERR_INVALID_KEY,
CYAML_ERR_INVALID_VALUE,
CYAML_ERR_INVALID_ALIAS,
CYAML_ERR_INTERNAL_ERROR,
CYAML_ERR_UNEXPECTED_EVENT,
CYAML_ERR_STRING_LENGTH_MIN,
CYAML_ERR_STRING_LENGTH_MAX,
CYAML_ERR_INVALID_DATA_SIZE,
CYAML_ERR_TOP_LEVEL_NON_PTR,
CYAML_ERR_BAD_TYPE_IN_SCHEMA,
CYAML_ERR_BAD_MIN_MAX_SCHEMA,
CYAML_ERR_BAD_PARAM_SEQ_COUNT,
CYAML_ERR_BAD_PARAM_NULL_DATA,
CYAML_ERR_BAD_BITVAL_IN_SCHEMA,
CYAML_ERR_SEQUENCE_ENTRIES_MIN,
CYAML_ERR_SEQUENCE_ENTRIES_MAX,
CYAML_ERR_SEQUENCE_FIXED_COUNT,
CYAML_ERR_SEQUENCE_IN_SEQUENCE,
CYAML_ERR_MAPPING_FIELD_MISSING,
CYAML_ERR_BAD_CONFIG_NULL_MEMFN,
CYAML_ERR_BAD_PARAM_NULL_CONFIG,
CYAML_ERR_BAD_PARAM_NULL_SCHEMA,
CYAML_ERR_LIBYAML_EMITTER_INIT,
CYAML_ERR_LIBYAML_PARSER_INIT,
CYAML_ERR_LIBYAML_EVENT_INIT,
CYAML_ERR_LIBYAML_EMITTER,
CYAML_ERR_LIBYAML_PARSER,
CYAML_ERR__COUNT,
} cyaml_err_t;
#define CYAML_VALUE_INT( \
_flags, _type) \
.type = CYAML_INT, \
.flags = (enum cyaml_flag)(_flags), \
.data_size = sizeof(_type)
#define CYAML_FIELD_INT( \
_key, _flags, _structure, _member) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_INT(((_flags) & (~CYAML_FLAG_POINTER)), \
(((_structure *)NULL)->_member)), \
}, \
}
#define CYAML_FIELD_INT_PTR( \
_key, _flags, _structure, _member) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_INT(((_flags) | CYAML_FLAG_POINTER), \
(*(((_structure *)NULL)->_member))), \
}, \
}
#define CYAML_VALUE_UINT( \
_flags, _type) \
.type = CYAML_UINT, \
.flags = (enum cyaml_flag)(_flags), \
.data_size = sizeof(_type)
#define CYAML_FIELD_UINT( \
_key, _flags, _structure, _member) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_UINT(((_flags) & (~CYAML_FLAG_POINTER)), \
(((_structure *)NULL)->_member)), \
}, \
}
#define CYAML_FIELD_UINT_PTR( \
_key, _flags, _structure, _member) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_UINT(((_flags) | CYAML_FLAG_POINTER), \
(*(((_structure *)NULL)->_member))), \
}, \
}
#define CYAML_VALUE_BOOL( \
_flags, _type) \
.type = CYAML_BOOL, \
.flags = (enum cyaml_flag)(_flags), \
.data_size = sizeof(_type)
#define CYAML_FIELD_BOOL( \
_key, _flags, _structure, _member) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_BOOL(((_flags) & (~CYAML_FLAG_POINTER)), \
(((_structure *)NULL)->_member)), \
}, \
}
#define CYAML_FIELD_BOOL_PTR( \
_key, _flags, _structure, _member) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_BOOL(((_flags) | CYAML_FLAG_POINTER), \
(*(((_structure *)NULL)->_member))), \
}, \
}
#define CYAML_VALUE_ENUM( \
_flags, _type, _strings, _strings_count) \
.type = CYAML_ENUM, \
.flags = (enum cyaml_flag)(_flags), \
.data_size = sizeof(_type), \
.enumeration = { \
.strings = _strings, \
.count = _strings_count, \
}
#define CYAML_FIELD_ENUM( \
_key, _flags, _structure, _member, _strings, _strings_count) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_ENUM(((_flags) & (~CYAML_FLAG_POINTER)), \
(((_structure *)NULL)->_member), \
_strings, _strings_count), \
}, \
}
#define CYAML_FIELD_ENUM_PTR( \
_key, _flags, _structure, _member, _strings, _strings_count) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_ENUM(((_flags) | CYAML_FLAG_POINTER), \
(*(((_structure *)NULL)->_member)), \
_strings, _strings_count), \
}, \
}
#define CYAML_VALUE_FLAGS( \
_flags, _type, _strings, _strings_count) \
.type = CYAML_FLAGS, \
.flags = (enum cyaml_flag)(_flags), \
.data_size = sizeof(_type), \
.enumeration = { \
.strings = _strings, \
.count = _strings_count, \
}
#define CYAML_FIELD_FLAGS( \
_key, _flags, _structure, _member, _strings, _strings_count) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_FLAGS(((_flags) & (~CYAML_FLAG_POINTER)), \
(((_structure *)NULL)->_member), \
_strings, _strings_count), \
}, \
}
#define CYAML_FIELD_FLAGS_PTR( \
_key, _flags, _structure, _member, _strings, _strings_count) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_FLAGS(((_flags) | CYAML_FLAG_POINTER), \
(*(((_structure *)NULL)->_member)), \
_strings, _strings_count), \
}, \
}
#define CYAML_VALUE_BITFIELD( \
_flags, _type, _bitvals, _bitvals_count) \
.type = CYAML_BITFIELD, \
.flags = (enum cyaml_flag)(_flags), \
.data_size = sizeof(_type), \
.bitfield = { \
.bitdefs = _bitvals, \
.count = _bitvals_count, \
}
#define CYAML_FIELD_BITFIELD( \
_key, _flags, _structure, _member, _bitvals, _bitvals_count) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_BITFIELD(((_flags) & (~CYAML_FLAG_POINTER)), \
(((_structure *)NULL)->_member), \
_bitvals, _bitvals_count), \
}, \
}
#define CYAML_FIELD_BITFIELD_PTR( \
_key, _flags, _structure, _member, _bitvals, _bitvals_count) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_BITFIELD(((_flags) | CYAML_FLAG_POINTER), \
(*(((_structure *)NULL)->_member)), \
_bitvals, _bitvals_count), \
}, \
}
#define CYAML_VALUE_FLOAT( \
_flags, _type) \
.type = CYAML_FLOAT, \
.flags = (enum cyaml_flag)(_flags), \
.data_size = sizeof(_type)
#define CYAML_FIELD_FLOAT( \
_key, _flags, _structure, _member) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_FLOAT(((_flags) & (~CYAML_FLAG_POINTER)), \
(((_structure *)NULL)->_member)), \
}, \
}
#define CYAML_FIELD_FLOAT_PTR( \
_key, _flags, _structure, _member) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_FLOAT(((_flags) | CYAML_FLAG_POINTER), \
(*(((_structure *)NULL)->_member))), \
}, \
}
#define CYAML_VALUE_STRING( \
_flags, _type, _min, _max) \
.type = CYAML_STRING, \
.flags = (enum cyaml_flag)(_flags), \
.data_size = sizeof(_type), \
.string = { \
.min = _min, \
.max = _max, \
}
#define CYAML_FIELD_STRING( \
_key, _flags, _structure, _member, _min) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_STRING(((_flags) & (~CYAML_FLAG_POINTER)), \
(((_structure *)NULL)->_member), _min, \
sizeof(((_structure *)NULL)->_member) - 1), \
}, \
}
#define CYAML_FIELD_STRING_PTR( \
_key, _flags, _structure, _member, _min, _max) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_STRING(((_flags) | CYAML_FLAG_POINTER), \
(((_structure *)NULL)->_member), \
_min, _max), \
}, \
}
#define CYAML_VALUE_MAPPING( \
_flags, _type, _fields) \
.type = CYAML_MAPPING, \
.flags = (enum cyaml_flag)(_flags), \
.data_size = sizeof(_type), \
.mapping = { \
.fields = _fields, \
}
#define CYAML_FIELD_MAPPING( \
_key, _flags, _structure, _member, _fields) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_MAPPING(((_flags) & (~CYAML_FLAG_POINTER)), \
(((_structure *)NULL)->_member), _fields), \
}, \
}
#define CYAML_FIELD_MAPPING_PTR( \
_key, _flags, _structure, _member, _fields) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_MAPPING(((_flags) | CYAML_FLAG_POINTER), \
(*(((_structure *)NULL)->_member)), _fields), \
}, \
}
#define CYAML_VALUE_SEQUENCE( \
_flags, _type, _entry, _min, _max) \
.type = CYAML_SEQUENCE, \
.flags = (enum cyaml_flag)(_flags), \
.data_size = sizeof(_type), \
.sequence = { \
.entry = _entry, \
.min = _min, \
.max = _max, \
}
#define CYAML_FIELD_SEQUENCE( \
_key, _flags, _structure, _member, _entry, _min, _max) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.count_offset = offsetof(_structure, _member ## _count), \
.count_size = sizeof(((_structure *)NULL)->_member ## _count), \
.value = { \
CYAML_VALUE_SEQUENCE((_flags), \
(*(((_structure *)NULL)->_member)), \
_entry, _min, _max), \
}, \
}
#define CYAML_FIELD_SEQUENCE_COUNT( \
_key, _flags, _structure, _member, _count, _entry, _min, _max) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.count_offset = offsetof(_structure, _count), \
.count_size = sizeof(((_structure *)NULL)->_count), \
.value = { \
CYAML_VALUE_SEQUENCE((_flags), \
(*(((_structure *)NULL)->_member)), \
_entry, _min, _max), \
}, \
}
#define CYAML_VALUE_SEQUENCE_FIXED( \
_flags, _type, _entry, _count) \
.type = CYAML_SEQUENCE_FIXED, \
.flags = (enum cyaml_flag)(_flags), \
.data_size = sizeof(_type), \
.sequence = { \
.entry = _entry, \
.min = _count, \
.max = _count, \
}
#define CYAML_FIELD_SEQUENCE_FIXED( \
_key, _flags, _structure, _member, _entry, _count) \
{ \
.key = _key, \
.data_offset = offsetof(_structure, _member), \
.value = { \
CYAML_VALUE_SEQUENCE_FIXED((_flags), \
(*(((_structure *)NULL)->_member)), \
_entry, _count), \
}, \
}
#define CYAML_FIELD_IGNORE( \
_key, _flags) \
{ \
.key = _key, \
.value = { \
.type = CYAML_IGNORE, \
.flags = (_flags), \
}, \
}
#define CYAML_FIELD_END { .key = NULL }
#define CYAML_UNLIMITED 0xffffffff
#define CYAML_ARRAY_LEN(_a) ((sizeof(_a)) / (sizeof(_a[0])))
typedef void cyaml_data_t;
typedef enum cyaml_log_e {
CYAML_LOG_DEBUG,
CYAML_LOG_INFO,
CYAML_LOG_NOTICE,
CYAML_LOG_WARNING,
CYAML_LOG_ERROR,
} cyaml_log_t;
typedef void (*cyaml_log_fn_t)(
cyaml_log_t level,
void *ctx,
const char *fmt,
va_list args);
typedef void * (*cyaml_mem_fn_t)(
void *ctx,
void *ptr,
size_t size);
typedef struct cyaml_config {
cyaml_log_fn_t log_fn;
void *log_ctx;
cyaml_mem_fn_t mem_fn;
void *mem_ctx;
cyaml_log_t log_level;
cyaml_cfg_flags_t flags;
} cyaml_config_t;
extern void cyaml_log(
cyaml_log_t level,
void *ctx,
const char *fmt,
va_list args);
extern void * cyaml_mem(
void *ctx,
void *ptr,
size_t size);
extern cyaml_err_t cyaml_load_file(
const char *path,
const cyaml_config_t *config,
const cyaml_schema_value_t *schema,
cyaml_data_t **data_out,
unsigned *seq_count_out);
extern cyaml_err_t cyaml_load_data(
const uint8_t *input,
size_t input_len,
const cyaml_config_t *config,
const cyaml_schema_value_t *schema,
cyaml_data_t **data_out,
unsigned *seq_count_out);
extern cyaml_err_t cyaml_save_file(
const char *path,
const cyaml_config_t *config,
const cyaml_schema_value_t *schema,
const cyaml_data_t *data,
unsigned seq_count);
extern cyaml_err_t cyaml_save_data(
char **output,
size_t *len,
const cyaml_config_t *config,
const cyaml_schema_value_t *schema,
const cyaml_data_t *data,
unsigned seq_count);
extern cyaml_err_t cyaml_free(
const cyaml_config_t *config,
const cyaml_schema_value_t *schema,
cyaml_data_t *data,
unsigned seq_count);
extern const char * cyaml_strerror(
cyaml_err_t err);
#ifdef __cplusplus
}
#endif
#endif
cyaml_schema_value_t
struct cyaml_schema_value cyaml_schema_value_t
cyaml_save_file
cyaml_err_t cyaml_save_file(const char *path, const cyaml_config_t *config, const cyaml_schema_value_t *schema, const cyaml_data_t *data, unsigned seq_count)
Definition save.c:1377
cyaml_mem_fn_t
void *(* cyaml_mem_fn_t)(void *ctx, void *ptr, size_t size)
Definition cyaml.h:1428
cyaml_version
const uint32_t cyaml_version
Definition util.c:49
cyaml_bitdef_t
struct cyaml_bitdef cyaml_bitdef_t
cyaml_load_data
cyaml_err_t cyaml_load_data(const uint8_t *input, size_t input_len, const cyaml_config_t *config, const cyaml_schema_value_t *schema, cyaml_data_t **data_out, unsigned *seq_count_out)
Definition load.c:2728
cyaml_schema_field_t
struct cyaml_schema_field cyaml_schema_field_t
cyaml_err_t
enum cyaml_err cyaml_err_t
cyaml_data_t
void cyaml_data_t
Definition cyaml.h:1386
cyaml_flag_e
enum cyaml_flag cyaml_flag_e
cyaml_load_file
cyaml_err_t cyaml_load_file(const char *path, const cyaml_config_t *config, const cyaml_schema_value_t *schema, cyaml_data_t **data_out, unsigned *seq_count_out)
Definition load.c:2686
cyaml_log_fn_t
void(* cyaml_log_fn_t)(cyaml_log_t level, void *ctx, const char *fmt, va_list args)
Definition cyaml.h:1408
cyaml_free
cyaml_err_t cyaml_free(const cyaml_config_t *config, const cyaml_schema_value_t *schema, cyaml_data_t *data, unsigned seq_count)
Definition free.c:143
cyaml_err
cyaml_err
Definition cyaml.h:585
CYAML_ERR_BAD_PARAM_NULL_SCHEMA
@ CYAML_ERR_BAD_PARAM_NULL_SCHEMA
Definition cyaml.h:611
CYAML_ERR_LIBYAML_PARSER_INIT
@ CYAML_ERR_LIBYAML_PARSER_INIT
Definition cyaml.h:613
CYAML_ERR_BAD_PARAM_NULL_CONFIG
@ CYAML_ERR_BAD_PARAM_NULL_CONFIG
Definition cyaml.h:610
CYAML_ERR_BAD_PARAM_NULL_DATA
@ CYAML_ERR_BAD_PARAM_NULL_DATA
Definition cyaml.h:602
CYAML_ERR_BAD_BITVAL_IN_SCHEMA
@ CYAML_ERR_BAD_BITVAL_IN_SCHEMA
Definition cyaml.h:603
CYAML_ERR_LIBYAML_EMITTER
@ CYAML_ERR_LIBYAML_EMITTER
Definition cyaml.h:615
CYAML_ERR_FILE_OPEN
@ CYAML_ERR_FILE_OPEN
Definition cyaml.h:589
CYAML_ERR_TOP_LEVEL_NON_PTR
@ CYAML_ERR_TOP_LEVEL_NON_PTR
Definition cyaml.h:598
CYAML_ERR_BAD_CONFIG_NULL_MEMFN
@ CYAML_ERR_BAD_CONFIG_NULL_MEMFN
Definition cyaml.h:609
CYAML_ERR_STRING_LENGTH_MAX
@ CYAML_ERR_STRING_LENGTH_MAX
Definition cyaml.h:596
CYAML_ERR_INVALID_DATA_SIZE
@ CYAML_ERR_INVALID_DATA_SIZE
Definition cyaml.h:597
CYAML_ERR_BAD_TYPE_IN_SCHEMA
@ CYAML_ERR_BAD_TYPE_IN_SCHEMA
Definition cyaml.h:599
CYAML_ERR_SEQUENCE_ENTRIES_MAX
@ CYAML_ERR_SEQUENCE_ENTRIES_MAX
Definition cyaml.h:605
CYAML_ERR_STRING_LENGTH_MIN
@ CYAML_ERR_STRING_LENGTH_MIN
Definition cyaml.h:595
CYAML_ERR_BAD_MIN_MAX_SCHEMA
@ CYAML_ERR_BAD_MIN_MAX_SCHEMA
Definition cyaml.h:600
CYAML_ERR_MAPPING_FIELD_MISSING
@ CYAML_ERR_MAPPING_FIELD_MISSING
Definition cyaml.h:608
CYAML_ERR_UNEXPECTED_EVENT
@ CYAML_ERR_UNEXPECTED_EVENT
Definition cyaml.h:594
CYAML_ERR_INVALID_VALUE
@ CYAML_ERR_INVALID_VALUE
Definition cyaml.h:591
CYAML_ERR_OOM
@ CYAML_ERR_OOM
Definition cyaml.h:587
CYAML_ERR_INVALID_ALIAS
@ CYAML_ERR_INVALID_ALIAS
Definition cyaml.h:592
CYAML_ERR_INVALID_KEY
@ CYAML_ERR_INVALID_KEY
Definition cyaml.h:590
CYAML_ERR_INTERNAL_ERROR
@ CYAML_ERR_INTERNAL_ERROR
Definition cyaml.h:593
CYAML_ERR_SEQUENCE_ENTRIES_MIN
@ CYAML_ERR_SEQUENCE_ENTRIES_MIN
Definition cyaml.h:604
CYAML_ERR_LIBYAML_EVENT_INIT
@ CYAML_ERR_LIBYAML_EVENT_INIT
Definition cyaml.h:614
CYAML_ERR_SEQUENCE_IN_SEQUENCE
@ CYAML_ERR_SEQUENCE_IN_SEQUENCE
Definition cyaml.h:607
CYAML_OK
@ CYAML_OK
Definition cyaml.h:586
CYAML_ERR_LIBYAML_PARSER
@ CYAML_ERR_LIBYAML_PARSER
Definition cyaml.h:616
CYAML_ERR_BAD_PARAM_SEQ_COUNT
@ CYAML_ERR_BAD_PARAM_SEQ_COUNT
Definition cyaml.h:601
CYAML_ERR__COUNT
@ CYAML_ERR__COUNT
Definition cyaml.h:617
CYAML_ERR_SEQUENCE_FIXED_COUNT
@ CYAML_ERR_SEQUENCE_FIXED_COUNT
Definition cyaml.h:606
CYAML_ERR_LIBYAML_EMITTER_INIT
@ CYAML_ERR_LIBYAML_EMITTER_INIT
Definition cyaml.h:612
CYAML_ERR_ALIAS
@ CYAML_ERR_ALIAS
Definition cyaml.h:588
cyaml_cfg_flags_t
enum cyaml_cfg_flags cyaml_cfg_flags_t
cyaml_log_t
enum cyaml_log_e cyaml_log_t
cyaml_save_data
cyaml_err_t cyaml_save_data(char **output, size_t *len, const cyaml_config_t *config, const cyaml_schema_value_t *schema, const cyaml_data_t *data, unsigned seq_count)
Definition save.c:1475
cyaml_type
cyaml_type
Definition cyaml.h:53
CYAML_INT
@ CYAML_INT
Definition cyaml.h:54
CYAML_UINT
@ CYAML_UINT
Definition cyaml.h:55
CYAML__TYPE_COUNT
@ CYAML__TYPE_COUNT
Definition cyaml.h:130
CYAML_SEQUENCE_FIXED
@ CYAML_SEQUENCE_FIXED
Definition cyaml.h:119
CYAML_IGNORE
@ CYAML_IGNORE
Definition cyaml.h:125
CYAML_FLOAT
@ CYAML_FLOAT
Definition cyaml.h:73
CYAML_MAPPING
@ CYAML_MAPPING
Definition cyaml.h:79
CYAML_BITFIELD
@ CYAML_BITFIELD
Definition cyaml.h:89
CYAML_ENUM
@ CYAML_ENUM
Definition cyaml.h:62
CYAML_BOOL
@ CYAML_BOOL
Definition cyaml.h:56
CYAML_SEQUENCE
@ CYAML_SEQUENCE
Definition cyaml.h:101
CYAML_STRING
@ CYAML_STRING
Definition cyaml.h:74
CYAML_FLAGS
@ CYAML_FLAGS
Definition cyaml.h:72
cyaml_mem
void * cyaml_mem(void *ctx, void *ptr, size_t size)
Definition mem.c:22
cyaml_version_str
const char * cyaml_version_str
Definition util.c:57
cyaml_config_t
struct cyaml_config cyaml_config_t
cyaml_strval_t
struct cyaml_strval cyaml_strval_t
cyaml_flag
cyaml_flag
Definition cyaml.h:138
CYAML_FLAG_SCALAR_LITERAL
@ CYAML_FLAG_SCALAR_LITERAL
Definition cyaml.h:310
CYAML_FLAG_SCALAR_QUOTE_SINGLE
@ CYAML_FLAG_SCALAR_QUOTE_SINGLE
Definition cyaml.h:317
CYAML_FLAG_STRICT
@ CYAML_FLAG_STRICT
Definition cyaml.h:197
CYAML_FLAG_POINTER_NULL_STR
@ CYAML_FLAG_POINTER_NULL_STR
Definition cyaml.h:181
CYAML_FLAG_POINTER
@ CYAML_FLAG_POINTER
Definition cyaml.h:148
CYAML_FLAG_SCALAR_QUOTE_DOUBLE
@ CYAML_FLAG_SCALAR_QUOTE_DOUBLE
Definition cyaml.h:324
CYAML_FLAG_SCALAR_PLAIN
@ CYAML_FLAG_SCALAR_PLAIN
Definition cyaml.h:284
CYAML_FLAG_DEFAULT
@ CYAML_FLAG_DEFAULT
Definition cyaml.h:139
CYAML_FLAG_BLOCK
@ CYAML_FLAG_BLOCK
Definition cyaml.h:214
CYAML_FLAG_FLOW
@ CYAML_FLAG_FLOW
Definition cyaml.h:231
CYAML_FLAG_OPTIONAL
@ CYAML_FLAG_OPTIONAL
Definition cyaml.h:140
CYAML_FLAG_SCALAR_FOLDED
@ CYAML_FLAG_SCALAR_FOLDED
Definition cyaml.h:297
CYAML_FLAG_CASE_SENSITIVE
@ CYAML_FLAG_CASE_SENSITIVE
Definition cyaml.h:249
CYAML_FLAG_POINTER_NULL
@ CYAML_FLAG_POINTER_NULL
Definition cyaml.h:158
CYAML_FLAG_CASE_INSENSITIVE
@ CYAML_FLAG_CASE_INSENSITIVE
Definition cyaml.h:267
cyaml_cfg_flags
cyaml_cfg_flags
Definition cyaml.h:509
CYAML_CFG_IGNORE_UNKNOWN_KEYS
@ CYAML_CFG_IGNORE_UNKNOWN_KEYS
Definition cyaml.h:519
CYAML_CFG_IGNORED_KEY_WARNING
@ CYAML_CFG_IGNORED_KEY_WARNING
Definition cyaml.h:576
CYAML_CFG_DEFAULT
@ CYAML_CFG_DEFAULT
Definition cyaml.h:513
CYAML_CFG_CASE_INSENSITIVE
@ CYAML_CFG_CASE_INSENSITIVE
Definition cyaml.h:560
CYAML_CFG_DOCUMENT_DELIM
@ CYAML_CFG_DOCUMENT_DELIM
Definition cyaml.h:554
CYAML_CFG_NO_ALIAS
@ CYAML_CFG_NO_ALIAS
Definition cyaml.h:572
CYAML_CFG_STYLE_FLOW
@ CYAML_CFG_STYLE_FLOW
Definition cyaml.h:547
CYAML_CFG_STYLE_BLOCK
@ CYAML_CFG_STYLE_BLOCK
Definition cyaml.h:533
cyaml_type_e
enum cyaml_type cyaml_type_e
cyaml_log
void cyaml_log(cyaml_log_t level, void *ctx, const char *fmt, va_list args)
Definition util.c:60
cyaml_strerror
const char * cyaml_strerror(cyaml_err_t err)
Definition util.c:81
cyaml_log_e
cyaml_log_e
Definition cyaml.h:1389
CYAML_LOG_NOTICE
@ CYAML_LOG_NOTICE
Definition cyaml.h:1392
CYAML_LOG_DEBUG
@ CYAML_LOG_DEBUG
Definition cyaml.h:1390
CYAML_LOG_ERROR
@ CYAML_LOG_ERROR
Definition cyaml.h:1394
CYAML_LOG_WARNING
@ CYAML_LOG_WARNING
Definition cyaml.h:1393
CYAML_LOG_INFO
@ CYAML_LOG_INFO
Definition cyaml.h:1391
cyaml_bitdef
Definition cyaml.h:342
cyaml_bitdef::bits
uint8_t bits
Definition cyaml.h:345
cyaml_bitdef::name
const char * name
Definition cyaml.h:343
cyaml_bitdef::offset
uint8_t offset
Definition cyaml.h:344
cyaml_config
Definition cyaml.h:1439
cyaml_config::log_fn
cyaml_log_fn_t log_fn
Definition cyaml.h:1454
cyaml_config::flags
cyaml_cfg_flags_t flags
Definition cyaml.h:1494
cyaml_config::log_ctx
void * log_ctx
Definition cyaml.h:1464
cyaml_config::log_level
cyaml_log_t log_level
Definition cyaml.h:1492
cyaml_config::mem_ctx
void * mem_ctx
Definition cyaml.h:1485
cyaml_config::mem_fn
cyaml_mem_fn_t mem_fn
Definition cyaml.h:1475
cyaml_schema_field
Definition cyaml.h:476
cyaml_schema_field::data_offset
uint32_t data_offset
Definition cyaml.h:487
cyaml_schema_field::count_offset
uint32_t count_offset
Definition cyaml.h:492
cyaml_schema_field::count_size
uint8_t count_size
Definition cyaml.h:497
cyaml_schema_field::key
const char * key
Definition cyaml.h:482
cyaml_schema_field::value
struct cyaml_schema_value value
Definition cyaml.h:501
cyaml_schema_value
Definition cyaml.h:368
cyaml_schema_value::type
enum cyaml_type type
Definition cyaml.h:372
cyaml_schema_value::max
uint32_t max
Definition cyaml.h:400
cyaml_schema_value::string
struct cyaml_schema_value::@336117260236074026343002165246117053341077340354::@110045352334377374375006341062177276126250027005 string
cyaml_schema_value::bitfield
struct cyaml_schema_value::@336117260236074026343002165246117053341077340354::@006161215162257002253365025175120107067300041241 bitfield
cyaml_schema_value::count
uint32_t count
Definition cyaml.h:418
cyaml_schema_value::fields
const struct cyaml_schema_field * fields
Definition cyaml.h:411
cyaml_schema_value::data_size
uint32_t data_size
Definition cyaml.h:382
cyaml_schema_value::sequence
struct cyaml_schema_value::@336117260236074026343002165246117053341077340354::@236020277135040065015177306374032111065104312142 sequence
cyaml_schema_value::flags
enum cyaml_flag flags
Definition cyaml.h:374
cyaml_schema_value::min
uint32_t min
Definition cyaml.h:392
cyaml_schema_value::strings
const cyaml_strval_t * strings
Definition cyaml.h:457
cyaml_schema_value::mapping
struct cyaml_schema_value::@336117260236074026343002165246117053341077340354::@035245142145262154376244300020260351133330242052 mapping
cyaml_schema_value::entry
const struct cyaml_schema_value * entry
Definition cyaml.h:435
cyaml_schema_value::bitdefs
const struct cyaml_bitdef * bitdefs
Definition cyaml.h:416
cyaml_schema_value::enumeration
struct cyaml_schema_value::@336117260236074026343002165246117053341077340354::@040144370317056033045146103062025013260255306203 enumeration
cyaml_strval
Definition cyaml.h:332
cyaml_strval::str
const char * str
Definition cyaml.h:333
cyaml_strval::val
int64_t val
Definition cyaml.h:334