WiP pass YamlTreeParser where needed

This commit is contained in:
Raphael Coeffic
2021-11-10 11:07:02 +01:00
parent d1c7ae4141
commit b7640a830f
28 changed files with 424 additions and 411 deletions
+47 -44
View File
@@ -53,59 +53,62 @@ typedef bool (*yaml_writer_func)(void* opaque, const char* str, size_t len);
struct YamlNode
{
typedef bool (*is_active_func)(uint8_t* data, uint32_t bitoffs, uint16_t idx);
typedef bool (*is_active_func)(void* user, uint8_t* data, uint32_t bitoffs);
typedef uint32_t (*cust_to_uint_func)(const YamlNode* node, const char* val, uint8_t val_len);
typedef uint32_t (*cust_to_uint_func)(const YamlNode* node, const char* val,
uint8_t val_len);
typedef bool (*uint_to_cust_func)(const YamlNode* node, uint32_t val, yaml_writer_func wf, void* opaque);
typedef uint8_t (*select_member_func)(uint8_t* data, uint32_t bitoffs);
typedef uint32_t (*cust_idx_read_func)(const char* val, uint8_t val_len);
typedef bool (*cust_idx_write_func)(uint32_t idx, yaml_writer_func wf, void* opaque);
typedef void (*cust_read_func)(const YamlNode* node, uint8_t* data,
uint32_t bitoffs, uint16_t idx,
const char* val, uint8_t val_len);
typedef bool (*cust_write_func)(const YamlNode* node, uint8_t* data,
uint32_t bitoffs, uint16_t idx,
typedef bool (*uint_to_cust_func)(const YamlNode* node, uint32_t val,
yaml_writer_func wf, void* opaque);
uint8_t type;
uint32_t size; // bits
uint8_t tag_len;
const char* tag;
union {
struct {
const YamlNode* child;
union {
struct {
is_active_func is_active;
uint16_t elmts; // maximum number of elements
} _a;
select_member_func select_member;
} u;
} _array;
typedef uint8_t (*select_member_func)(void* user, uint8_t* data,
uint32_t bitoffs);
struct {
const YamlIdStr* choices;
} _enum;
typedef uint32_t (*cust_idx_read_func)(void* user, const char* val,
uint8_t val_len);
typedef bool (*cust_idx_write_func)(void* user, yaml_writer_func wf,
void* opaque);
struct {
cust_to_uint_func cust_to_uint;
uint_to_cust_func uint_to_cust;
} _cust;
typedef void (*cust_read_func)(void* user, uint8_t* data, uint32_t bitoffs,
const char* val, uint8_t val_len);
typedef bool (*cust_write_func)(void* user, uint8_t* data, uint32_t bitoffs,
yaml_writer_func wf, void* opaque);
uint8_t type;
uint32_t size; // bits
uint8_t tag_len;
const char* tag;
union {
struct {
const YamlNode* child;
union {
struct {
cust_idx_read_func read;
cust_idx_write_func write;
} _cust_idx;
is_active_func is_active;
uint16_t elmts; // maximum number of elements
} _a;
select_member_func select_member;
} u;
} _array;
struct {
cust_read_func read;
cust_write_func write;
} _cust_attr;
} u;
struct {
const YamlIdStr* choices;
} _enum;
struct {
cust_to_uint_func cust_to_uint;
uint_to_cust_func uint_to_cust;
} _cust;
struct {
cust_idx_read_func read;
cust_idx_write_func write;
} _cust_idx;
struct {
cust_read_func read;
cust_write_func write;
} _cust_attr;
} u;
};
#if !defined(_MSC_VER)