Macros | Functions
object.c File Reference
#include <string.h>
#include "object.h"

Macros

#define MPACK_EXCEPTION_CHECK(parser)
 
#define MPACK_WALK(action)
 

Functions

MPACK_API void mpack_parser_init (mpack_parser_t *parser, mpack_uint32_t capacity)
 
MPACK_API int mpack_parse_tok (mpack_parser_t *parser, mpack_token_t tok, mpack_walk_cb enter_cb, mpack_walk_cb exit_cb)
 
MPACK_API int mpack_unparse_tok (mpack_parser_t *parser, mpack_token_t *tok, mpack_walk_cb enter_cb, mpack_walk_cb exit_cb)
 
MPACK_API int mpack_parse (mpack_parser_t *parser, const char **buf, size_t *buflen, mpack_walk_cb enter_cb, mpack_walk_cb exit_cb)
 
MPACK_API int mpack_unparse (mpack_parser_t *parser, char **buf, size_t *buflen, mpack_walk_cb enter_cb, mpack_walk_cb exit_cb)
 
MPACK_API void mpack_parser_copy (mpack_parser_t *dst, mpack_parser_t *src)
 

Macro Definition Documentation

◆ MPACK_EXCEPTION_CHECK

#define MPACK_EXCEPTION_CHECK (   parser)
Value:
do { \
if (parser->status == MPACK_EXCEPTION) { \
return MPACK_EXCEPTION; \
} \
} while (0)

◆ MPACK_WALK

#define MPACK_WALK (   action)
Value:
do { \
mpack_node_t *n; \
if (parser->exiting) goto exit; \
if (mpack_parser_full(parser)) return MPACK_NOMEM; \
n = mpack_parser_push(parser); \
action; \
parser->exiting = 1; \
\
exit: \
parser->exiting = 0; \
while ((n = mpack_parser_pop(parser))) { \
exit_cb(parser, n); \
MPACK_EXCEPTION_CHECK(parser); \
if (!parser->size) return MPACK_OK; \
} \
\
} while (0)

Function Documentation

◆ mpack_parse()

MPACK_API int mpack_parse ( mpack_parser_t *  parser,
const char **  buf,
size_t *  buflen,
mpack_walk_cb  enter_cb,
mpack_walk_cb  exit_cb 
)

◆ mpack_parse_tok()

MPACK_API int mpack_parse_tok ( mpack_parser_t *  parser,
mpack_token_t  tok,
mpack_walk_cb  enter_cb,
mpack_walk_cb  exit_cb 
)

◆ mpack_parser_copy()

MPACK_API void mpack_parser_copy ( mpack_parser_t *  dst,
mpack_parser_t *  src 
)

◆ mpack_parser_init()

MPACK_API void mpack_parser_init ( mpack_parser_t *  parser,
mpack_uint32_t  capacity 
)

◆ mpack_unparse()

MPACK_API int mpack_unparse ( mpack_parser_t *  parser,
char **  buf,
size_t *  buflen,
mpack_walk_cb  enter_cb,
mpack_walk_cb  exit_cb 
)

◆ mpack_unparse_tok()

MPACK_API int mpack_unparse_tok ( mpack_parser_t *  parser,
mpack_token_t tok,
mpack_walk_cb  enter_cb,
mpack_walk_cb  exit_cb 
)
MPACK_NOMEM
@ MPACK_NOMEM
Definition: object.h:21
MPACK_OK
@ MPACK_OK
Definition: mpack_core.h:40
MPACK_EXCEPTION
@ MPACK_EXCEPTION
Definition: object.h:20
while
while((size_t)(++hi - hifirst)< hinum)
Definition: eval.c:10350
MPACK_EOF
@ MPACK_EOF
Definition: mpack_core.h:41
if
if(len)
Definition: encode.c:226
n
int n
Definition: funcs.c:8562
return
return
Definition: funcs.c:9014
MPACK_EXCEPTION_CHECK
#define MPACK_EXCEPTION_CHECK(parser)
Definition: object.c:25
action
int action
Definition: funcs.c:8986