2023-08-25 19:32:30 +00:00
|
|
|
#ifndef PROFILE_JSON_PARSER_H
|
|
|
|
#define PROFILE_JSON_PARSER_H
|
|
|
|
|
|
|
|
/* Generated by flatcc 0.6.1 FlatBuffers schema compiler for C by dvide.com */
|
|
|
|
|
|
|
|
#include "flatcc_json_parser.h"
|
|
|
|
#include "flatcc_prologue.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Parses the default root table or struct of the schema and constructs a FlatBuffer.
|
|
|
|
*
|
|
|
|
* Builder `B` must be initialized. `ctx` can be null but will hold
|
|
|
|
* hold detailed error info on return when available.
|
|
|
|
* Returns 0 on success, or error code.
|
|
|
|
* `flags` : 0 by default, `flatcc_json_parser_f_skip_unknown` silently
|
|
|
|
* ignores unknown table and structs fields, and union types.
|
|
|
|
*/
|
|
|
|
static int profile_parse_json(flatcc_builder_t *B, flatcc_json_parser_t *ctx,
|
|
|
|
const char *buf, size_t bufsiz, int flags);
|
|
|
|
|
|
|
|
static const char *NdbProfile_parse_json_table(flatcc_json_parser_t *ctx, const char *buf, const char *end, flatcc_builder_ref_t *result);
|
2023-08-28 15:17:25 +00:00
|
|
|
static const char *NdbProfileRecord_parse_json_table(flatcc_json_parser_t *ctx, const char *buf, const char *end, flatcc_builder_ref_t *result);
|
2023-08-25 19:32:30 +00:00
|
|
|
static const char *profile_local_json_parser_enum(flatcc_json_parser_t *ctx, const char *buf, const char *end,
|
|
|
|
int *value_type, uint64_t *value, int *aggregate);
|
|
|
|
static const char *profile_global_json_parser_enum(flatcc_json_parser_t *ctx, const char *buf, const char *end,
|
|
|
|
int *value_type, uint64_t *value, int *aggregate);
|
|
|
|
|
|
|
|
static const char *NdbProfile_parse_json_table(flatcc_json_parser_t *ctx, const char *buf, const char *end, flatcc_builder_ref_t *result)
|
|
|
|
{
|
|
|
|
int more;
|
|
|
|
void *pval;
|
|
|
|
flatcc_builder_ref_t ref, *pref;
|
|
|
|
const char *mark;
|
|
|
|
uint64_t w;
|
|
|
|
|
|
|
|
*result = 0;
|
2023-08-28 15:17:25 +00:00
|
|
|
if (flatcc_builder_start_table(ctx->ctx, 12)) goto failed;
|
2023-08-25 19:32:30 +00:00
|
|
|
buf = flatcc_json_parser_object_start(ctx, buf, end, &more);
|
|
|
|
while (more) {
|
|
|
|
buf = flatcc_json_parser_symbol_start(ctx, buf, end);
|
|
|
|
w = flatcc_json_parser_symbol_part(buf, end);
|
2023-08-28 15:17:25 +00:00
|
|
|
if (w < 0x6c75643036000000) { /* branch "lud06" */
|
2023-08-25 19:32:30 +00:00
|
|
|
if (w < 0x64616d75735f646f) { /* branch "damus_do" */
|
|
|
|
if ((w & 0xffffffffffff0000) == 0x62616e6e65720000) { /* "banner" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 6);
|
|
|
|
if (mark != buf) {
|
|
|
|
buf = flatcc_json_parser_build_string(ctx, buf, end, &ref);
|
|
|
|
if (!ref || !(pref = flatcc_builder_table_add_offset(ctx->ctx, 4))) goto failed;
|
|
|
|
*pref = ref;
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "banner" */
|
|
|
|
if ((w & 0xffffffffff000000) == 0x61626f7574000000) { /* "about" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 5);
|
|
|
|
if (mark != buf) {
|
|
|
|
buf = flatcc_json_parser_build_string(ctx, buf, end, &ref);
|
|
|
|
if (!ref || !(pref = flatcc_builder_table_add_offset(ctx->ctx, 2))) goto failed;
|
|
|
|
*pref = ref;
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "about" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "about" */
|
|
|
|
} /* "banner" */
|
|
|
|
} else { /* branch "damus_do" */
|
|
|
|
if (w == 0x64616d75735f646f) { /* descend "damus_do" */
|
|
|
|
buf += 8;
|
|
|
|
w = flatcc_json_parser_symbol_part(buf, end);
|
|
|
|
if (w == 0x6e6174696f6e5f76) { /* descend "nation_v" */
|
|
|
|
buf += 8;
|
|
|
|
w = flatcc_json_parser_symbol_part(buf, end);
|
|
|
|
if ((w & 0xff00000000000000) == 0x3200000000000000) { /* "2" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 1);
|
|
|
|
if (mark != buf) {
|
|
|
|
int32_t val = 0;
|
|
|
|
static flatcc_json_parser_integral_symbol_f *symbolic_parsers[] = {
|
|
|
|
profile_local_json_parser_enum,
|
|
|
|
profile_global_json_parser_enum, 0 };
|
|
|
|
buf = flatcc_json_parser_int32(ctx, (mark = buf), end, &val);
|
|
|
|
if (mark == buf) {
|
|
|
|
buf = flatcc_json_parser_symbolic_int32(ctx, (mark = buf), end, symbolic_parsers, &val);
|
|
|
|
if (buf == mark || buf == end) goto failed;
|
|
|
|
}
|
|
|
|
if (val != INT32_C(0) || (ctx->flags & flatcc_json_parser_f_force_add)) {
|
|
|
|
if (!(pval = flatcc_builder_table_add(ctx->ctx, 10, 4, 4))) goto failed;
|
|
|
|
flatbuffers_int32_write_to_pe(pval, val);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "2" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "2" */
|
|
|
|
} else { /* descend "nation_v" */
|
|
|
|
if ((w & 0xffffffffffff0000) == 0x6e6174696f6e0000) { /* "nation" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 6);
|
|
|
|
if (mark != buf) {
|
|
|
|
int32_t val = 0;
|
|
|
|
static flatcc_json_parser_integral_symbol_f *symbolic_parsers[] = {
|
|
|
|
profile_local_json_parser_enum,
|
|
|
|
profile_global_json_parser_enum, 0 };
|
|
|
|
buf = flatcc_json_parser_int32(ctx, (mark = buf), end, &val);
|
|
|
|
if (mark == buf) {
|
|
|
|
buf = flatcc_json_parser_symbolic_int32(ctx, (mark = buf), end, symbolic_parsers, &val);
|
|
|
|
if (buf == mark || buf == end) goto failed;
|
|
|
|
}
|
|
|
|
if (val != INT32_C(0) || (ctx->flags & flatcc_json_parser_f_force_add)) {
|
|
|
|
if (!(pval = flatcc_builder_table_add(ctx->ctx, 9, 4, 4))) goto failed;
|
|
|
|
flatbuffers_int32_write_to_pe(pval, val);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "nation" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "nation" */
|
|
|
|
} /* descend "nation_v" */
|
|
|
|
} else { /* descend "damus_do" */
|
|
|
|
if (w == 0x646973706c61795f) { /* descend "display_" */
|
|
|
|
buf += 8;
|
|
|
|
w = flatcc_json_parser_symbol_part(buf, end);
|
|
|
|
if ((w & 0xffffffff00000000) == 0x6e616d6500000000) { /* "name" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 4);
|
|
|
|
if (mark != buf) {
|
|
|
|
buf = flatcc_json_parser_build_string(ctx, buf, end, &ref);
|
|
|
|
if (!ref || !(pref = flatcc_builder_table_add_offset(ctx->ctx, 5))) goto failed;
|
|
|
|
*pref = ref;
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "name" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "name" */
|
|
|
|
} else { /* descend "display_" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* descend "display_" */
|
|
|
|
} /* descend "damus_do" */
|
|
|
|
} /* branch "damus_do" */
|
2023-08-28 15:17:25 +00:00
|
|
|
} else { /* branch "lud06" */
|
2023-08-25 19:32:30 +00:00
|
|
|
if (w < 0x6e69703035000000) { /* branch "nip05" */
|
2023-08-28 15:17:25 +00:00
|
|
|
if (w < 0x6c75643136000000) { /* branch "lud16" */
|
|
|
|
if ((w & 0xffffffffff000000) == 0x6c75643036000000) { /* "lud06" */
|
2023-08-25 19:32:30 +00:00
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 5);
|
|
|
|
if (mark != buf) {
|
|
|
|
buf = flatcc_json_parser_build_string(ctx, buf, end, &ref);
|
2023-08-28 15:17:25 +00:00
|
|
|
if (!ref || !(pref = flatcc_builder_table_add_offset(ctx->ctx, 11))) goto failed;
|
2023-08-25 19:32:30 +00:00
|
|
|
*pref = ref;
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
2023-08-28 15:17:25 +00:00
|
|
|
} else { /* "lud06" */
|
2023-08-25 19:32:30 +00:00
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
2023-08-28 15:17:25 +00:00
|
|
|
} /* "lud06" */
|
|
|
|
} else { /* branch "lud16" */
|
|
|
|
if ((w & 0xffffffff00000000) == 0x6e616d6500000000) { /* "name" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 4);
|
|
|
|
if (mark != buf) {
|
|
|
|
buf = flatcc_json_parser_build_string(ctx, buf, end, &ref);
|
|
|
|
if (!ref || !(pref = flatcc_builder_table_add_offset(ctx->ctx, 0))) goto failed;
|
|
|
|
*pref = ref;
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "name" */
|
|
|
|
if ((w & 0xffffffffff000000) == 0x6c75643136000000) { /* "lud16" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 5);
|
|
|
|
if (mark != buf) {
|
|
|
|
buf = flatcc_json_parser_build_string(ctx, buf, end, &ref);
|
|
|
|
if (!ref || !(pref = flatcc_builder_table_add_offset(ctx->ctx, 3))) goto failed;
|
|
|
|
*pref = ref;
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "lud16" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "lud16" */
|
|
|
|
} /* "name" */
|
|
|
|
} /* branch "lud16" */
|
2023-08-25 19:32:30 +00:00
|
|
|
} else { /* branch "nip05" */
|
|
|
|
if (w < 0x7069637475726500) { /* branch "picture" */
|
|
|
|
if ((w & 0xffffffffff000000) == 0x6e69703035000000) { /* "nip05" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 5);
|
|
|
|
if (mark != buf) {
|
|
|
|
buf = flatcc_json_parser_build_string(ctx, buf, end, &ref);
|
|
|
|
if (!ref || !(pref = flatcc_builder_table_add_offset(ctx->ctx, 8))) goto failed;
|
|
|
|
*pref = ref;
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "nip05" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "nip05" */
|
|
|
|
} else { /* branch "picture" */
|
|
|
|
if (w < 0x7265616374696f6e) { /* branch "reaction" */
|
|
|
|
if ((w & 0xffffffffffffff00) == 0x7069637475726500) { /* "picture" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 7);
|
|
|
|
if (mark != buf) {
|
|
|
|
buf = flatcc_json_parser_build_string(ctx, buf, end, &ref);
|
|
|
|
if (!ref || !(pref = flatcc_builder_table_add_offset(ctx->ctx, 7))) goto failed;
|
|
|
|
*pref = ref;
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "picture" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "picture" */
|
|
|
|
} else { /* branch "reaction" */
|
|
|
|
if (w == 0x7265616374696f6e) { /* descend "reaction" */
|
|
|
|
buf += 8;
|
|
|
|
w = flatcc_json_parser_symbol_part(buf, end);
|
|
|
|
if ((w & 0xff00000000000000) == 0x7300000000000000) { /* "s" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 1);
|
|
|
|
if (mark != buf) {
|
|
|
|
uint8_t val = 0;
|
|
|
|
static flatcc_json_parser_integral_symbol_f *symbolic_parsers[] = {
|
|
|
|
profile_local_json_parser_enum,
|
|
|
|
profile_global_json_parser_enum, 0 };
|
|
|
|
buf = flatcc_json_parser_bool(ctx, (mark = buf), end, &val);
|
|
|
|
if (mark == buf) {
|
|
|
|
buf = flatcc_json_parser_symbolic_bool(ctx, (mark = buf), end, symbolic_parsers, &val);
|
|
|
|
if (buf == mark || buf == end) goto failed;
|
|
|
|
}
|
|
|
|
if (val != UINT8_C(1) || (ctx->flags & flatcc_json_parser_f_force_add)) {
|
|
|
|
if (!(pval = flatcc_builder_table_add(ctx->ctx, 6, 1, 1))) goto failed;
|
|
|
|
flatbuffers_bool_write_to_pe(pval, val);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "s" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "s" */
|
|
|
|
} else { /* descend "reaction" */
|
|
|
|
if ((w & 0xffffffffffffff00) == 0x7765627369746500) { /* "website" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 7);
|
|
|
|
if (mark != buf) {
|
|
|
|
buf = flatcc_json_parser_build_string(ctx, buf, end, &ref);
|
|
|
|
if (!ref || !(pref = flatcc_builder_table_add_offset(ctx->ctx, 1))) goto failed;
|
|
|
|
*pref = ref;
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "website" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "website" */
|
|
|
|
} /* descend "reaction" */
|
|
|
|
} /* branch "reaction" */
|
|
|
|
} /* branch "picture" */
|
|
|
|
} /* branch "nip05" */
|
2023-08-28 15:17:25 +00:00
|
|
|
} /* branch "lud06" */
|
2023-08-25 19:32:30 +00:00
|
|
|
buf = flatcc_json_parser_object_end(ctx, buf, end, &more);
|
|
|
|
}
|
|
|
|
if (ctx->error) goto failed;
|
|
|
|
if (!(*result = flatcc_builder_end_table(ctx->ctx))) goto failed;
|
|
|
|
return buf;
|
|
|
|
failed:
|
|
|
|
return flatcc_json_parser_set_error(ctx, buf, end, flatcc_json_parser_error_runtime);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int NdbProfile_parse_json_as_root(flatcc_builder_t *B, flatcc_json_parser_t *ctx, const char *buf, size_t bufsiz, int flags, const char *fid)
|
|
|
|
{
|
|
|
|
return flatcc_json_parser_table_as_root(B, ctx, buf, bufsiz, flags, fid, NdbProfile_parse_json_table);
|
|
|
|
}
|
|
|
|
|
2023-08-28 15:17:25 +00:00
|
|
|
static const char *NdbProfileRecord_parse_json_table(flatcc_json_parser_t *ctx, const char *buf, const char *end, flatcc_builder_ref_t *result)
|
|
|
|
{
|
|
|
|
int more;
|
|
|
|
void *pval;
|
|
|
|
flatcc_builder_ref_t ref, *pref;
|
|
|
|
const char *mark;
|
|
|
|
uint64_t w;
|
|
|
|
|
|
|
|
*result = 0;
|
|
|
|
if (flatcc_builder_start_table(ctx->ctx, 4)) goto failed;
|
|
|
|
buf = flatcc_json_parser_object_start(ctx, buf, end, &more);
|
|
|
|
while (more) {
|
|
|
|
buf = flatcc_json_parser_symbol_start(ctx, buf, end);
|
|
|
|
w = flatcc_json_parser_symbol_part(buf, end);
|
|
|
|
if (w < 0x6e6f74655f6b6579) { /* branch "note_key" */
|
|
|
|
if ((w & 0xffffffffff000000) == 0x6c6e75726c000000) { /* "lnurl" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 5);
|
|
|
|
if (mark != buf) {
|
|
|
|
buf = flatcc_json_parser_build_string(ctx, buf, end, &ref);
|
|
|
|
if (!ref || !(pref = flatcc_builder_table_add_offset(ctx->ctx, 3))) goto failed;
|
|
|
|
*pref = ref;
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "lnurl" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "lnurl" */
|
|
|
|
} else { /* branch "note_key" */
|
|
|
|
if (w < 0x70726f66696c6500) { /* branch "profile" */
|
|
|
|
if (w == 0x6e6f74655f6b6579) { /* "note_key" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 8);
|
|
|
|
if (mark != buf) {
|
|
|
|
uint64_t val = 0;
|
|
|
|
static flatcc_json_parser_integral_symbol_f *symbolic_parsers[] = {
|
|
|
|
profile_local_json_parser_enum,
|
|
|
|
profile_global_json_parser_enum, 0 };
|
|
|
|
buf = flatcc_json_parser_uint64(ctx, (mark = buf), end, &val);
|
|
|
|
if (mark == buf) {
|
|
|
|
buf = flatcc_json_parser_symbolic_uint64(ctx, (mark = buf), end, symbolic_parsers, &val);
|
|
|
|
if (buf == mark || buf == end) goto failed;
|
|
|
|
}
|
|
|
|
if (val != UINT64_C(0) || (ctx->flags & flatcc_json_parser_f_force_add)) {
|
|
|
|
if (!(pval = flatcc_builder_table_add(ctx->ctx, 2, 8, 8))) goto failed;
|
|
|
|
flatbuffers_uint64_write_to_pe(pval, val);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "note_key" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "note_key" */
|
|
|
|
} else { /* branch "profile" */
|
|
|
|
if ((w & 0xffffffffffffff00) == 0x70726f66696c6500) { /* "profile" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 7);
|
|
|
|
if (mark != buf) {
|
|
|
|
buf = NdbProfile_parse_json_table(ctx, buf, end, &ref);
|
|
|
|
if (!ref || !(pref = flatcc_builder_table_add_offset(ctx->ctx, 0))) goto failed;
|
|
|
|
*pref = ref;
|
|
|
|
} else {
|
|
|
|
goto pfguard1;
|
|
|
|
}
|
|
|
|
} else { /* "profile" */
|
|
|
|
goto pfguard1;
|
|
|
|
} /* "profile" */
|
|
|
|
goto endpfguard1;
|
|
|
|
pfguard1:
|
|
|
|
if (w == 0x7265636569766564) { /* descend "received" */
|
|
|
|
buf += 8;
|
|
|
|
w = flatcc_json_parser_symbol_part(buf, end);
|
|
|
|
if ((w & 0xffffff0000000000) == 0x5f61740000000000) { /* "_at" */
|
|
|
|
buf = flatcc_json_parser_match_symbol(ctx, (mark = buf), end, 3);
|
|
|
|
if (mark != buf) {
|
|
|
|
uint64_t val = 0;
|
|
|
|
static flatcc_json_parser_integral_symbol_f *symbolic_parsers[] = {
|
|
|
|
profile_local_json_parser_enum,
|
|
|
|
profile_global_json_parser_enum, 0 };
|
|
|
|
buf = flatcc_json_parser_uint64(ctx, (mark = buf), end, &val);
|
|
|
|
if (mark == buf) {
|
|
|
|
buf = flatcc_json_parser_symbolic_uint64(ctx, (mark = buf), end, symbolic_parsers, &val);
|
|
|
|
if (buf == mark || buf == end) goto failed;
|
|
|
|
}
|
|
|
|
if (val != UINT64_C(0) || (ctx->flags & flatcc_json_parser_f_force_add)) {
|
|
|
|
if (!(pval = flatcc_builder_table_add(ctx->ctx, 1, 8, 8))) goto failed;
|
|
|
|
flatbuffers_uint64_write_to_pe(pval, val);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
}
|
|
|
|
} else { /* "_at" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* "_at" */
|
|
|
|
} else { /* descend "received" */
|
|
|
|
buf = flatcc_json_parser_unmatched_symbol(ctx, buf, end);
|
|
|
|
} /* descend "received" */
|
|
|
|
endpfguard1:
|
|
|
|
(void)0;
|
|
|
|
} /* branch "profile" */
|
|
|
|
} /* branch "note_key" */
|
|
|
|
buf = flatcc_json_parser_object_end(ctx, buf, end, &more);
|
|
|
|
}
|
|
|
|
if (ctx->error) goto failed;
|
|
|
|
if (!(*result = flatcc_builder_end_table(ctx->ctx))) goto failed;
|
|
|
|
return buf;
|
|
|
|
failed:
|
|
|
|
return flatcc_json_parser_set_error(ctx, buf, end, flatcc_json_parser_error_runtime);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int NdbProfileRecord_parse_json_as_root(flatcc_builder_t *B, flatcc_json_parser_t *ctx, const char *buf, size_t bufsiz, int flags, const char *fid)
|
|
|
|
{
|
|
|
|
return flatcc_json_parser_table_as_root(B, ctx, buf, bufsiz, flags, fid, NdbProfileRecord_parse_json_table);
|
|
|
|
}
|
|
|
|
|
2023-08-25 19:32:30 +00:00
|
|
|
static const char *profile_local_json_parser_enum(flatcc_json_parser_t *ctx, const char *buf, const char *end,
|
|
|
|
int *value_type, uint64_t *value, int *aggregate)
|
|
|
|
{
|
|
|
|
/* Scope has no enum / union types to look up. */
|
|
|
|
return buf; /* unmatched; */
|
|
|
|
}
|
|
|
|
|
|
|
|
static const char *profile_global_json_parser_enum(flatcc_json_parser_t *ctx, const char *buf, const char *end,
|
|
|
|
int *value_type, uint64_t *value, int *aggregate)
|
|
|
|
{
|
|
|
|
/* Global scope has no enum / union types to look up. */
|
|
|
|
return buf; /* unmatched; */
|
|
|
|
}
|
|
|
|
|
|
|
|
static int profile_parse_json(flatcc_builder_t *B, flatcc_json_parser_t *ctx,
|
|
|
|
const char *buf, size_t bufsiz, int flags)
|
|
|
|
{
|
|
|
|
flatcc_json_parser_t parser;
|
|
|
|
flatcc_builder_ref_t root;
|
|
|
|
|
|
|
|
ctx = ctx ? ctx : &parser;
|
|
|
|
flatcc_json_parser_init(ctx, B, buf, buf + bufsiz, flags);
|
|
|
|
if (flatcc_builder_start_buffer(B, 0, 0, 0)) return -1;
|
2023-08-28 15:17:25 +00:00
|
|
|
NdbProfileRecord_parse_json_table(ctx, buf, buf + bufsiz, &root);
|
2023-08-25 19:32:30 +00:00
|
|
|
if (ctx->error) {
|
|
|
|
return ctx->error;
|
|
|
|
}
|
|
|
|
if (!flatcc_builder_end_buffer(B, root)) return -1;
|
|
|
|
ctx->end_loc = buf;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "flatcc_epilogue.h"
|
|
|
|
#endif /* PROFILE_JSON_PARSER_H */
|