Loading...
Searching...
No Matches
unpack_template.h File Reference

Go to the source code of this file.

## Macros

#define | msgpack_unpack_struct_decl(name) msgpack_unpack_struct(name)
#define | USE_CASE_RANGE
#define | push_simple_value(func)
#define | push_fixed_value(func, arg)
#define | push_variable_value(func, base, pos, len)
#define | again_fixed_trail(_cs, trail_len)
#define | again_fixed_trail_if_zero(_cs, trail_len, ifzero)
#define | start_container(func, count_, ct_)
#define | NEXT_CS(p) ((unsigned int)*p & 0x1f)
#define | SWITCH_RANGE_BEGIN switch(*p) {
#define | SWITCH_RANGE(FROM, TO) case FROM ... TO:
#define | SWITCH_RANGE_DEFAULT default:
#define | SWITCH_RANGE_END }

## Functions

| msgpack_unpack_struct_decl (_stack)
| msgpack_unpack_struct_decl (_context)
| msgpack_unpack_func (void, _init)(msgpack_unpack_struct(_context) *ctx)
| msgpack_unpack_func (msgpack_unpack_object, _data)(msgpack_unpack_struct(_context) *ctx)
| msgpack_unpack_func (int, _execute)(msgpack_unpack_struct(_context) *ctx
| msgpack_unpack_struct (_stack) *stack = NULL
| if (p==pe)
| switch (c->ct)
| while (p !=pe)

## Variables

const char * | data
const char size_t | len
const char size_t size_t * | off
const unsigned char *const | pe = (unsigned char*)data + len
const void * | n = NULL
unsigned int | trail = ctx->trail
unsigned int | cs = ctx->cs
unsigned int | top = ctx->top
msgpack_unpack_user * | user = &ctx->user
msgpack_unpack_object | obj
int | ret = 1
| do
_header_again | __pad0__
| p
goto | _out
_finish | __pad1__
goto | _end
_failed | __pad2__
_out | __pad3__
_end | __pad4__

## Macro Definition Documentation

## again_fixed_trail

#define again_fixed_trail | ( |  | _cs,
|  |  | trail_len
| ) |  |

Value:
trail = trail_len; \
cs = _cs; \
goto _fixed_trail_again
cs
unsigned int cs
Definition unpack_template.h:103
len
const char size_t len
Definition unpack_template.h:94
trail
unsigned int trail
Definition unpack_template.h:102

## again_fixed_trail_if_zero

#define again_fixed_trail_if_zero | ( |  | _cs,
|  |  | trail_len,
|  |  | ifzero
| ) |  |

Value:
trail = trail_len; \
if(trail == 0) { goto ifzero; } \
cs = _cs; \
goto _fixed_trail_again

## msgpack_unpack_struct_decl

#define msgpack_unpack_struct_decl | ( |  | name | ) | msgpack_unpack_struct(name)

## NEXT_CS

#define NEXT_CS | ( |  | p | ) | ((unsigned int)*p & 0x1f)

## push_fixed_value

#define push_fixed_value | ( |  | func,
|  |  | arg
| ) |  |

Value:
ret = msgpack_unpack_callback(func)(user, arg, &obj); \
if(ret < 0) { goto _failed; } \
goto _push
ret
int ret
Definition unpack_template.h:114
obj
msgpack_unpack_object obj
Definition unpack_template.h:111
user
msgpack_unpack_user * user
Definition unpack_template.h:109

## push_simple_value

#define push_simple_value | ( |  | func | ) |

Value:
ret = msgpack_unpack_callback(func)(user, &obj); \
if(ret < 0) { goto _failed; } \
goto _push

## push_variable_value

#define push_variable_value | ( |  | func,
|  |  | base,
|  |  | pos,
|  |  | len
| ) |  |

Value:
ret = msgpack_unpack_callback(func)(user, \
(const char*)base, (const char*)pos, len, &obj); \
if(ret < 0) { goto _failed; } \
goto _push

## start_container

#define start_container | ( |  | func,
|  |  | count_,
|  |  | ct_
| ) |  |

Value:
if(top >= MSGPACK_EMBED_STACK_SIZE) { \
ret = MSGPACK_UNPACK_NOMEM_ERROR; \
goto _failed; \
} /* FIXME */ \
ret = msgpack_unpack_callback(func)(user, count_, &stack[top].obj); \
if(ret < 0) { goto _failed; } \
if((count_) == 0) { obj = stack[top].obj; goto _push; } \
stack[top].ct = ct_; \
stack[top].count = count_; \
++top; \
goto _header_again
MSGPACK_UNPACK_NOMEM_ERROR
@ MSGPACK_UNPACK_NOMEM_ERROR
Definition unpack.h:38
MSGPACK_EMBED_STACK_SIZE
#define MSGPACK_EMBED_STACK_SIZE
Definition unpack_define.h:25
top
unsigned int top
Definition unpack_template.h:104

## SWITCH_RANGE

#define SWITCH_RANGE | ( |  | FROM,
|  |  | TO
| ) |  | case FROM ... TO:

## SWITCH_RANGE_BEGIN

#define SWITCH_RANGE_BEGIN switch(*p) {

## SWITCH_RANGE_DEFAULT

#define SWITCH_RANGE_DEFAULT default:

## SWITCH_RANGE_END

#define SWITCH_RANGE_END }

## USE_CASE_RANGE

#define USE_CASE_RANGE

## Function Documentation

## if()

if | ( | p | = `= pe` | ) |

References _out.

## msgpack_unpack_func() [1/3]

msgpack_unpack_func | ( | int | ,
|  | _execute |
| ) |  |

## msgpack_unpack_func() [2/3]

msgpack_unpack_func | ( | msgpack_unpack_object | ,
|  | _data |
| ) |  |

## msgpack_unpack_func() [3/3]

msgpack_unpack_func | ( | void | ,
|  | _init |
| ) |  |

References MSGPACK_CS_HEADER.

## msgpack_unpack_struct()

msgpack_unpack_struct | ( | _stack |  | ) | = NULL

Referenced by msgpack_unpack_struct_decl().

## msgpack_unpack_struct_decl() [1/2]

msgpack_unpack_struct_decl | ( | _context |  | ) |

References cs, MSGPACK_EMBED_STACK_SIZE, msgpack_unpack_struct(), top, trail, and user.

## msgpack_unpack_struct_decl() [2/2]

msgpack_unpack_struct_decl | ( | _stack |  | ) |

References obj.

## switch()

switch | ( | c-> | ct | ) |

References MSGPACK_CT_ARRAY_ITEM, MSGPACK_CT_MAP_KEY, MSGPACK_CT_MAP_VALUE, MSGPACK_UNPACK_PARSE_ERROR, obj, ret, top, and user.

## while()

while | ( | p ! | = `pe` | ) |

## Variable Documentation

## __pad0__

_header_again __pad0__

## __pad1__

_finish __pad1__

## __pad2__

_failed __pad2__

## __pad3__

_out __pad3__

## __pad4__

_end __pad4__

## _end

goto _end

## _out

goto _out

Referenced by if().

## cs

unsigned int cs = ctx->cs

Referenced by msgpack_unpack_struct_decl().

## data

const char* data

## do

do

## len

const char size_t len

## n

const void* n = NULL

## obj

msgpack_unpack_object obj

Referenced by msgpack_unpack_struct_decl(), and switch().

## off

* off

Initial value:
{
assert(len >= *off)
off
const char size_t size_t * off
Definition unpack_template.h:95

## p

p

## pe

const unsigned char* const pe = (unsigned char*)data + len

## ret

return ret = 1

Referenced by switch().

## top

ctx top = ctx->top

Referenced by msgpack_unpack_struct_decl(), and switch().

## trail

ctx trail = ctx->trail

Referenced by msgpack_unpack_struct_decl().

## user

msgpack_unpack_user* user = &ctx->user

Referenced by msgpack_unpack_struct_decl(), and switch().