Data-MessagePack-Stream

 view release on metacpan or  search on metacpan

msgpack-3.3.0/example/cmake/CMakeLists.txt  view on Meta::CPAN

cmake_minimum_required (VERSION 3.0)
project (example)

if(EXAMPLE_MSGPACK_EMBEDDED)
    add_subdirectory(msgpack-c)
    set(msgpack_DIR ${CMAKE_CURRENT_BINARY_DIR}/msgpack-c)
endif()

find_package(msgpack REQUIRED)

add_executable (${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/../c/simple_c.c)
target_link_libraries(${PROJECT_NAME} msgpackc)

if(TARGET msgpackc-static)

msgpack-3.3.0/include/msgpack/unpack_define.h  view on Meta::CPAN

#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif


#ifndef MSGPACK_EMBED_STACK_SIZE
#define MSGPACK_EMBED_STACK_SIZE 32
#endif


typedef enum {
    MSGPACK_CS_HEADER            = 0x00,  // nil

    //MSGPACK_CS_                = 0x01,
    //MSGPACK_CS_                = 0x02,  // false
    //MSGPACK_CS_                = 0x03,  // true

msgpack-3.3.0/include/msgpack/unpack_template.h  view on Meta::CPAN

};

msgpack_unpack_struct_decl(_context) {
    msgpack_unpack_user user;
    unsigned int cs;
    unsigned int trail;
    unsigned int top;
    /*
    msgpack_unpack_struct(_stack)* stack;
    unsigned int stack_size;
    msgpack_unpack_struct(_stack) embed_stack[MSGPACK_EMBED_STACK_SIZE];
    */
    msgpack_unpack_struct(_stack) stack[MSGPACK_EMBED_STACK_SIZE];
};


msgpack_unpack_func(void, _init)(msgpack_unpack_struct(_context)* ctx)
{
    ctx->cs = MSGPACK_CS_HEADER;
    ctx->trail = 0;
    ctx->top = 0;
    /*
    ctx->stack = ctx->embed_stack;
    ctx->stack_size = MSGPACK_EMBED_STACK_SIZE;
    */
    ctx->stack[0].obj = msgpack_unpack_callback(_root)(&ctx->user);
}

/*
msgpack_unpack_func(void, _destroy)(msgpack_unpack_struct(_context)* ctx)
{
    if(ctx->stack_size != MSGPACK_EMBED_STACK_SIZE) {
        free(ctx->stack);
    }
}
*/

msgpack_unpack_func(msgpack_unpack_object, _data)(msgpack_unpack_struct(_context)* ctx)
{
    return (ctx)->stack[0].obj;
}

msgpack-3.3.0/include/msgpack/unpack_template.h  view on Meta::CPAN

        trail = trail_len; \
        cs = _cs; \
        goto _fixed_trail_again
#define again_fixed_trail_if_zero(_cs, trail_len, ifzero) \
        trail = trail_len; \
        if(trail == 0) { goto ifzero; } \
        cs = _cs; \
        goto _fixed_trail_again

#define start_container(func, count_, ct_) \
        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-3.3.0/include/msgpack/v1/unpack.hpp  view on Meta::CPAN

template <typename T>
inline typename msgpack::enable_if<sizeof(T) == 8>::type load(T& dst, const char* n) {
    _msgpack_load64(T, n, &dst);
}

class context {
public:
    context(unpack_reference_func f, void* user_data, unpack_limit const& limit)
        :m_trail(0), m_user(f, user_data, limit), m_cs(MSGPACK_CS_HEADER)
    {
        m_stack.reserve(MSGPACK_EMBED_STACK_SIZE);
        m_stack.push_back(unpack_stack());
    }

    void init()
    {
        m_cs = MSGPACK_CS_HEADER;
        m_trail = 0;
        m_stack.resize(1);
        m_stack[0].set_obj(msgpack::object());
    }

msgpack-3.3.0/include/msgpack/v2/create_object_visitor.hpp  view on Meta::CPAN

/// @cond
MSGPACK_API_VERSION_NAMESPACE(v2) {
/// @endcond

namespace detail {

class create_object_visitor : public msgpack::v2::null_visitor {
public:
    create_object_visitor(unpack_reference_func f, void* user_data, unpack_limit const& limit)
        :m_func(f), m_user_data(user_data), m_limit(limit) {
        m_stack.reserve(MSGPACK_EMBED_STACK_SIZE);
        m_stack.push_back(&m_obj);
    }

#if !defined(MSGPACK_USE_CPP03)
    create_object_visitor(create_object_visitor&& other)
        :m_func(other.m_func),
         m_user_data(other.m_user_data),
         m_limit(std::move(other.m_limit)),
         m_stack(std::move(other.m_stack)),
         m_zone(other.m_zone),

msgpack-3.3.0/include/msgpack/v2/parse.hpp  view on Meta::CPAN

        VisitorHolder& m_visitor_holder;
    };

    struct unpack_stack {
        struct stack_elem {
            stack_elem(msgpack_container_type type, uint32_t rest):m_type(type), m_rest(rest) {}
            msgpack_container_type m_type;
            uint32_t m_rest;
        };
        unpack_stack() {
            m_stack.reserve(MSGPACK_EMBED_STACK_SIZE);
        }
        parse_return push(VisitorHolder& visitor_holder, msgpack_container_type type, uint32_t rest) {
            m_stack.push_back(stack_elem(type, rest));
            switch (type) {
            case MSGPACK_CT_ARRAY_ITEM:
                return visitor_holder.visitor().start_array_item() ? PARSE_CONTINUE : PARSE_STOP_VISITOR;
            case MSGPACK_CT_MAP_KEY:
                return visitor_holder.visitor().start_map_key() ? PARSE_CONTINUE : PARSE_STOP_VISITOR;
            case MSGPACK_CT_MAP_VALUE:
                assert(0);

msgpack-3.3.0/include/msgpack/v3/parse.hpp  view on Meta::CPAN

        VisitorHolder& m_visitor_holder;
    };

    struct unpack_stack {
        struct stack_elem {
            stack_elem(msgpack_container_type type, uint32_t rest):m_type(type), m_rest(rest) {}
            msgpack_container_type m_type;
            uint32_t m_rest;
        };
        unpack_stack() {
            m_stack.reserve(MSGPACK_EMBED_STACK_SIZE);
        }
        parse_return push(VisitorHolder& visitor_holder, msgpack_container_type type, uint32_t rest) {
            m_stack.push_back(stack_elem(type, rest));
            switch (type) {
            case MSGPACK_CT_ARRAY_ITEM:
                return visitor_holder.visitor().start_array_item() ? PARSE_CONTINUE : PARSE_STOP_VISITOR;
            case MSGPACK_CT_MAP_KEY:
                return visitor_holder.visitor().start_map_key() ? PARSE_CONTINUE : PARSE_STOP_VISITOR;
            case MSGPACK_CT_MAP_VALUE:
                assert(0);



( run in 0.560 second using v1.01-cache-2.11-cpan-71847e10f99 )