31 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_XCODE 47 static const char space[] =
" \t\v\n\r";
52 while (*str != 0 && strchr(space, *str) !=
NULL)
56 while (*str != 0 && *str !=
'\n')
71 count_type =
obj->xo_type->xct_child[0].xf_type;
76 eol = strchr(str,
'"');
100 memcpy(mem, str, len);
118 return M0_ERR_INFO(-EPROTO,
"ch='%c' str=`%.80s...'",
154 if (
it->xcu_depth > 0) {
156 par = pre->s_obj.xo_type->xct_aggr;
175 M0_CASSERT(
sizeof(uint64_t) ==
sizeof(
unsigned long));
176 M0_CASSERT(
sizeof(uint32_t) ==
sizeof(
unsigned));
203 if (custom !=
NULL) {
210 result = custom(&
it,
cur, str);
235 *(uint8_t *)
cur->xo_ptr = (uint8_t)bval;
237 return M0_ERR(-EOVERFLOW);
260 return *str == 0 ? 0 :
M0_ERR(-EINVAL);
288 ({ nob += snprintf(str + nob, max64(nr - nob, 0), __VA_ARGS__); }) 289 #define PCHAR(ch) ({ char _ch = (ch); if (_ch != 0) P("%c", _ch); }) 312 return result ?: nob;
317 #undef M0_TRACE_SUBSYSTEM M0_INTERNAL struct m0_xcode_cursor_frame * m0_xcode_cursor_top(struct m0_xcode_cursor *it)
M0_INTERNAL void * m0_xcode_addr(const struct m0_xcode_obj *obj, int fileno, uint64_t elno)
M0_INTERNAL int m0_xcode_print(const struct m0_xcode_obj *obj, char *str, int nr)
M0_EXTERN ssize_t m0_xcode_alloc_obj(struct m0_xcode_cursor *it, void *(*alloc)(struct m0_xcode_cursor *, size_t))
static struct buffer * cur(struct m0_addb2_mach *mach, m0_bcount_t space)
M0_INTERNAL int m0_xcode_read(struct m0_xcode_obj *obj, const char *str)
static char punctchar(struct m0_xcode_cursor *it)
static struct m0_be_emap_cursor it
const struct m0_xcode_type_ops * xct_ops
static struct m0_xcode_type ** xt[]
M0_INTERNAL const char * space_skip(const char *str)
static int char_check(const char **str, char ch)
static bool quoted_string(const struct m0_xcode_type *xt, const struct m0_xcode_obj *obj, struct m0_fop_str *qstr)
static int string_literal(const struct m0_xcode_cursor *it, struct m0_xcode_obj *obj, const char *str)
int(* xto_read)(const struct m0_xcode_cursor *it, struct m0_xcode_obj *obj, const char *str)
#define M0_ERR_INFO(rc, fmt,...)
M0_INTERNAL bool m0_xcode_is_byte_array(const struct m0_xcode_type *xt)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL uint64_t m0_xcode_tag(const struct m0_xcode_obj *obj)
static int field(struct ff2c_context *ctx, struct ff2c_term *term)
enum m0_xode_atom_type xct_atype
const struct m0_xcode_type M0_XT_VOID
static struct ff2c_term * alloc(void)
char * fmt(const char *format,...) __attribute__((format(printf
void * m0_alloc(size_t size)
M0_INTERNAL int m0_xcode_next(struct m0_xcode_cursor *it)
M0_INTERNAL void * m0_xcode_alloc(struct m0_xcode_cursor *it, size_t nob)
M0_INTERNAL uint64_t m0_xcode_atom(const struct m0_xcode_obj *obj)
#define m0_forall(var, nr,...)
M0_INTERNAL void m0_xcode_cursor_init(struct m0_xcode_cursor *it, const struct m0_xcode_obj *obj)
enum m0_xcode_aggr xct_aggr
static int64_t min64(int64_t a, int64_t b)
M0_INTERNAL void m0_xcode_skip(struct m0_xcode_cursor *it)
M0_INTERNAL const struct m0_xcode_field * m0_xcode_cursor_field(const struct m0_xcode_cursor *it)
#define M0_XCODE_VAL(obj, fieldno, elno, __type)
static int(*)(const struct m0_xcode_cursor *, struct m0_xcode_obj *, const char *) field_reader(const struct m0_xcode_cursor *it)
static const char punctuation[M0_XA_NR][3]
static const char structure[M0_XA_NR][M0_XCODE_CURSOR_NR]
#define M0_IMPOSSIBLE(fmt,...)