msgpuck_1.0.3/0000775000000000000000000000000012752613651011756 5ustar rootrootmsgpuck_1.0.3/AUTHORS0000664000000000000000000000006112752613651013023 0ustar rootrootRoman Tsisyk - initial author msgpuck_1.0.3/CMakeLists.txt0000664000000000000000000000446312752613651014525 0ustar rootrootproject(msgpuck) cmake_minimum_required(VERSION 2.8.5) if(POLICY CMP0037) cmake_policy(SET CMP0037 OLD) # don't blame custom target names endif(POLICY CMP0037) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -fstrict-aliasing") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -pg -Wall -Wextra -Wcast-align -Werror") if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type, options are: Debug Release." FORCE) endif() include(CheckCCompilerFlag) check_c_compiler_flag("-mno-unaligned-access" CC_HAS_MNO_UNALIGNED_ACCESS) include(GNUInstallDirs) add_subdirectory(test) add_library(${PROJECT_NAME} STATIC msgpuck.c) set_target_properties(${PROJECT_NAME} PROPERTIES VERSION 1.0 SOVERSION 1) set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "msgpuck") install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library) install(FILES msgpuck.h DESTINATION include) find_package(Doxygen) if(NOT DOXYGEN_FOUND) return() endif() set(GENERATE_HTML "NO") set(GENERATE_MAN "YES") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.man") add_custom_command(OUTPUT doc/man/man3/msgpuck.h.3 COMMAND ${CMAKE_COMMAND} -E make_directory doc/man COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.man" WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS msgpuck.h COMMENT "Generating man pages" VERBATIM) add_custom_target(man DEPENDS doc/man/man3/msgpuck.h.3) set(GENERATE_HTML "YES") set(GENERATE_MAN "NO") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in" "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.html") add_custom_command(OUTPUT doc/html/index.html COMMAND ${CMAKE_COMMAND} -E make_directory doc/html COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.html" COMMAND ${CMAKE_COMMAND} -E rename doc/html/msgpuck_8h.html doc/html/index.html COMMAND sed s/msgpuck_8h\\.html/index\\.html/ -i doc/html/index.html WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" DEPENDS msgpuck.h COMMENT "Generating html documentation" VERBATIM) add_custom_target(html DEPENDS doc/html/index.html) add_custom_target(doc DEPENDS man html) msgpuck_1.0.3/msgpuck.c0000664000000000000000000000262112752613651013574 0ustar rootroot/* * Copyright (c) 2013-2016 MsgPuck Authors * All rights reserved. * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * 1. Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #define MP_SOURCE 1 #include "msgpuck.h" msgpuck_1.0.3/test/0000775000000000000000000000000012752613651012735 5ustar rootrootmsgpuck_1.0.3/test/test.h0000664000000000000000000000673112752613651014074 0ustar rootroot/* * Copyright (C) 2010-2016 Tarantool AUTHORS: * please see AUTHORS file in tarantool/tarantool repository. * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * 1. Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef TEST_H_INCLUDED #define TEST_H_INCLUDED #include /** @brief example @code #include "test.h" int main(void) { plan(3); // count of test You planned to check ok(1, "Test name 1"); is(4, 2 * 2, "2 * 2 == 4"); isnt(5, 2 * 2, "2 * 2 != 5); return check_plan(); // print resume } @endcode */ /* private function, use ok(...) instead */ int __ok(int condition, const char *fmt, ...); /* private function, use note(...) or diag(...) instead */ void __space(FILE *stream); #define msg(stream, ...) ({ __space(stream); fprintf(stream, "# "); \ fprintf(stream, __VA_ARGS__); fprintf(stream, "\n"); }) #define note(...) msg(stdout, __VA_ARGS__) #define diag(...) msg(stderr, __VA_ARGS__) /** @brief set and print plan @param count Before anything else, you need a testing plan. This basically declares how many tests your program is going to run to protect against premature failure. */ void plan(int count); /** @brief check if plan is reached and print report */ int check_plan(void); #define ok(condition, fmt, args...) { \ int res = __ok(condition, fmt, ##args); \ if (!res) { \ __space(stderr); \ fprintf(stderr, "# Failed test '"); \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, "'\n"); \ __space(stderr); \ fprintf(stderr, "# in %s at line %d\n", __FILE__, __LINE__); \ } \ } #define is(a, b, fmt, args...) { \ int res = __ok((a) == (b), fmt, ##args); \ if (!res) { \ __space(stderr); \ fprintf(stderr, "# Failed test '"); \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, "'\n"); \ __space(stderr); \ fprintf(stderr, "# in %s at line %d\n", __FILE__, __LINE__); \ } \ } #define isnt(a, b, fmt, args...) { \ int res = __ok((a) != (b), fmt, ##args); \ if (!res) { \ __space(stderr); \ fprintf(stderr, "# Failed test '"); \ fprintf(stderr, fmt, ##args); \ fprintf(stderr, "'\n"); \ __space(stderr); \ fprintf(stderr, "# in %s at line %d\n", __FILE__, __LINE__); \ } \ } #define fail(fmt, args...) \ ok(0, fmt, ##args) #endif /* TEST_H_INCLUDED */ msgpuck_1.0.3/test/CMakeLists.txt0000664000000000000000000000077312752613651015504 0ustar rootrootinclude_directories("../") #find_program(PROVE prove) if (PROVE) set(TEST_RUNNER prove) else() set(TEST_RUNNER) endif() set(alltests) foreach (test msgpuck) add_executable(${test}.test ${test}.c test.c) target_link_libraries(${test}.test msgpuck) list(APPEND alltests ${test}.test_run) add_custom_target(${test}.test_run DEPENDS ${test}.test COMMAND ${TEST_RUNNER} ${PROJECT_BINARY_DIR}/test/${test}.test) endforeach() add_custom_target(test DEPENDS ${alltests}) msgpuck_1.0.3/test/msgpuck.c0000664000000000000000000005137112752613651014561 0ustar rootroot/* * Copyright (c) 2013-2016 MsgPuck Authors * All rights reserved. * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * 1. Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include #include #include #include #include "msgpuck.h" #include "test.h" #define BUF_MAXLEN ((1L << 18) - 1) #define STRBIN_MAXLEN (BUF_MAXLEN - 10) static char buf[BUF_MAXLEN + 1]; static char str[STRBIN_MAXLEN]; static char *data = buf + 1; /* use unaligned address to fail early */ #define header() note("*** %s ***", __func__) #define footer() note("*** %s: done ***", __func__) #define SCALAR(x) x #define COMPLEX(x) #define DEFINE_TEST(_type, _complex, _v, _r, _rl) ({ \ const char *d1 = mp_encode_##_type(data, (_v)); \ const char *d2 = data; \ _complex(const char *d3 = data); \ _complex(const char *d4 = data); \ note(""#_type" "#_v""); \ is(mp_check_##_type(data, d1), 0, "mp_check_"#_type"("#_v") == 0"); \ is(mp_decode_##_type(&d2), (_v), "mp_decode(mp_encode("#_v")) == "#_v);\ _complex(mp_next(&d3)); \ _complex(ok(!mp_check(&d4, d3 + _rl), "mp_check("#_v")")); \ is((d1 - data), (_rl), "len(mp_encode_"#_type"("#_v")"); \ is(d1, d2, "len(mp_decode_"#_type"("#_v"))"); \ _complex(is(d1, d3, "len(mp_next_"#_type"("#_v"))")); \ _complex(is(d1, d4, "len(mp_check_"#_type"("#_v"))")); \ is(mp_sizeof_##_type(_v), _rl, "mp_sizeof_"#_type"("#_v")"); \ is(memcmp(data, (_r), (_rl)), 0, "mp_encode("#_v") == "#_r); \ }) #define DEFINE_TEST_STRBIN(_type, _vl) ({ \ note(""#_type" len="#_vl""); \ char *s1 = str; \ for (uint32_t i = 0; i < _vl; i++) { \ s1[i] = 'a' + i % 26; \ } \ const char *d1 = mp_encode_##_type(data, s1, _vl); \ const char *d2; \ uint32_t len2; \ d2 = data; \ const char *s2 = mp_decode_##_type(&d2, &len2); \ is(_vl, len2, "len(mp_decode_"#_type"(x, %u))", _vl); \ d2 = data; \ (void) mp_decode_strbin(&d2, &len2); \ is(_vl, len2, "len(mp_decode_strbin(x, %u))", _vl); \ const char *d3 = data; \ mp_next(&d3); \ const char *d4 = data; \ ok(!mp_check(&d4, d3 + _vl), \ "mp_check_"#_type"(mp_encode_"#_type"(x, "#_vl"))"); \ is(d1, d2, "len(mp_decode_"#_type"(x, "#_vl")"); \ is(d1, d3, "len(mp_next_"#_type"(x, "#_vl")"); \ is(d1, d4, "len(mp_check_"#_type"(x, "#_vl")"); \ is(mp_sizeof_##_type(_vl), (uint32_t) (d1 - data), \ "mp_sizeof_"#_type"("#_vl")"); \ is(memcmp(s1, s2, _vl), 0, "mp_encode_"#_type"(x, "#_vl") == x"); \ }) #define test_uint(...) DEFINE_TEST(uint, SCALAR, __VA_ARGS__) #define test_int(...) DEFINE_TEST(int, SCALAR, __VA_ARGS__) #define test_bool(...) DEFINE_TEST(bool, SCALAR, __VA_ARGS__) #define test_float(...) DEFINE_TEST(float, SCALAR, __VA_ARGS__) #define test_double(...) DEFINE_TEST(double, SCALAR, __VA_ARGS__) #define test_strl(...) DEFINE_TEST(strl, COMPLEX, __VA_ARGS__) #define test_binl(...) DEFINE_TEST(binl, COMPLEX, __VA_ARGS__) #define test_array(...) DEFINE_TEST(array, COMPLEX, __VA_ARGS__) #define test_map(...) DEFINE_TEST(map, COMPLEX, __VA_ARGS__) #define test_str(...) DEFINE_TEST_STRBIN(str, __VA_ARGS__) #define test_bin(...) DEFINE_TEST_STRBIN(bin, __VA_ARGS__) static int test_uints(void) { plan(135); header(); test_uint(0U, "\x00", 1); test_uint(1U, "\x01", 1); test_uint(0x7eU, "\x7e", 1); test_uint(0x7fU, "\x7f", 1); test_uint(0x80U, "\xcc\x80", 2); test_uint(0xfeU, "\xcc\xfe", 2); test_uint(0xffU, "\xcc\xff", 2); test_uint(0xfffeU, "\xcd\xff\xfe", 3); test_uint(0xffffU, "\xcd\xff\xff", 3); test_uint(0x10000U, "\xce\x00\x01\x00\x00", 5); test_uint(0xfffffffeU, "\xce\xff\xff\xff\xfe", 5); test_uint(0xffffffffU, "\xce\xff\xff\xff\xff", 5); test_uint(0x100000000ULL, "\xcf\x00\x00\x00\x01\x00\x00\x00\x00", 9); test_uint(0xfffffffffffffffeULL, "\xcf\xff\xff\xff\xff\xff\xff\xff\xfe", 9); test_uint(0xffffffffffffffffULL, "\xcf\xff\xff\xff\xff\xff\xff\xff\xff", 9); footer(); return check_plan(); } static int test_ints(void) { plan(153); header(); test_int(-0x01, "\xff", 1); test_int(-0x1e, "\xe2", 1); test_int(-0x1f, "\xe1", 1); test_int(-0x20, "\xe0", 1); test_int(-0x21, "\xd0\xdf", 2); test_int(-0x7f, "\xd0\x81", 2); test_int(-0x80, "\xd0\x80", 2); test_int(-0x81, "\xd1\xff\x7f", 3); test_int(-0x7fff, "\xd1\x80\x01", 3); test_int(-0x8000, "\xd1\x80\x00", 3); test_int(-0x8001, "\xd2\xff\xff\x7f\xff", 5); test_int(-0x7fffffff, "\xd2\x80\x00\x00\x01", 5); test_int(-0x80000000LL, "\xd2\x80\x00\x00\x00", 5); test_int(-0x80000001LL, "\xd3\xff\xff\xff\xff\x7f\xff\xff\xff", 9); test_int(-0x80000001LL, "\xd3\xff\xff\xff\xff\x7f\xff\xff\xff", 9); test_int(-0x7fffffffffffffffLL, "\xd3\x80\x00\x00\x00\x00\x00\x00\x01", 9); test_int((int64_t)-0x8000000000000000LL, "\xd3\x80\x00\x00\x00\x00\x00\x00\x00", 9); footer(); return check_plan(); } static int test_bools(void) { plan(18); header(); test_bool(true, "\xc3", 1); test_bool(false, "\xc2", 1); footer(); return check_plan(); } static int test_floats(void) { plan(27); header(); test_float((float) 1.0, "\xca\x3f\x80\x00\x00", 5); test_float((float) 3.141593, "\xca\x40\x49\x0f\xdc", 5); test_float((float) -1e38f, "\xca\xfe\x96\x76\x99", 5); footer(); return check_plan(); } static int test_doubles(void) { plan(27); header(); test_double((double) 1.0, "\xcb\x3f\xf0\x00\x00\x00\x00\x00\x00", 9); test_double((double) 3.141592653589793, "\xcb\x40\x09\x21\xfb\x54\x44\x2d\x18", 9); test_double((double) -1e99, "\xcb\xd4\x7d\x42\xae\xa2\x87\x9f\x2e", 9); footer(); return check_plan(); } static int test_nils(void) { plan(6); header(); const char *d1 = mp_encode_nil(data); const char *d2 = data; const char *d3 = data; const char *d4 = data; note("nil"); mp_decode_nil(&d2); mp_next(&d3); ok(!mp_check(&d4, d3 + 1), "mp_check_nil()"); is((d1 - data), 1, "len(mp_encode_nil() == 1"); is(d1, d2, "len(mp_decode_nil()) == 1"); is(d1, d3, "len(mp_next_nil()) == 1"); is(d1, d4, "len(mp_check_nil()) == 1"); is(mp_sizeof_nil(), 1, "mp_sizeof_nil() == 1"); footer(); return check_plan(); } static int test_arrays(void) { plan(54); header(); test_array(0, "\x90", 1); test_array(1, "\x91", 1); test_array(15, "\x9f", 1); test_array(16, "\xdc\x00\x10", 3); test_array(0xfffe, "\xdc\xff\xfe", 3); test_array(0xffff, "\xdc\xff\xff", 3); test_array(0x10000, "\xdd\x00\x01\x00\x00", 5); test_array(0xfffffffeU, "\xdd\xff\xff\xff\xfe", 5); test_array(0xffffffffU, "\xdd\xff\xff\xff\xff", 5); footer(); return check_plan(); } static int test_maps(void) { plan(54); header(); test_map(0, "\x80", 1); test_map(1, "\x81", 1); test_map(15, "\x8f", 1); test_map(16, "\xde\x00\x10", 3); test_map(0xfffe, "\xde\xff\xfe", 3); test_map(0xffff, "\xde\xff\xff", 3); test_map(0x10000, "\xdf\x00\x01\x00\x00", 5); test_map(0xfffffffeU, "\xdf\xff\xff\xff\xfe", 5); test_map(0xffffffffU, "\xdf\xff\xff\xff\xff", 5); footer(); return check_plan(); } static int test_strls(void) { plan(78); header(); test_strl(0x00U, "\xa0", 1); test_strl(0x01U, "\xa1", 1); test_strl(0x1eU, "\xbe", 1); test_strl(0x1fU, "\xbf", 1); test_strl(0x20U, "\xd9\x20", 2); test_strl(0xfeU, "\xd9\xfe", 2); test_strl(0xffU, "\xd9\xff", 2); test_strl(0x0100U, "\xda\x01\x00", 3); test_strl(0xfffeU, "\xda\xff\xfe", 3); test_strl(0xffffU, "\xda\xff\xff", 3); test_strl(0x00010000U, "\xdb\x00\x01\x00\x00", 5); test_strl(0xfffffffeU, "\xdb\xff\xff\xff\xfe", 5); test_strl(0xffffffffU, "\xdb\xff\xff\xff\xff", 5); footer(); return check_plan(); } static int test_binls(void) { plan(78); header(); test_binl(0x00U, "\xc4\x00", 2); test_binl(0x01U, "\xc4\x01", 2); test_binl(0x1eU, "\xc4\x1e", 2); test_binl(0x1fU, "\xc4\x1f", 2); test_binl(0x20U, "\xc4\x20", 2); test_binl(0xfeU, "\xc4\xfe", 2); test_binl(0xffU, "\xc4\xff", 2); test_binl(0x0100U, "\xc5\x01\x00", 3); test_binl(0xfffeU, "\xc5\xff\xfe", 3); test_binl(0xffffU, "\xc5\xff\xff", 3); test_binl(0x00010000U, "\xc6\x00\x01\x00\x00", 5); test_binl(0xfffffffeU, "\xc6\xff\xff\xff\xfe", 5); test_binl(0xffffffffU, "\xc6\xff\xff\xff\xff", 5); footer(); return check_plan(); } static int test_strs(void) { plan(96); header(); test_str(0x01); test_str(0x1e); test_str(0x1f); test_str(0x20); test_str(0xfe); test_str(0xff); test_str(0x100); test_str(0x101); test_str(0xfffe); test_str(0xffff); test_str(0x10000); test_str(0x10001); footer(); return check_plan(); } static int test_bins(void) { plan(96); header(); test_bin(0x01); test_bin(0x1e); test_bin(0x1f); test_bin(0x20); test_bin(0xfe); test_bin(0xff); test_bin(0x100); test_bin(0x101); test_bin(0xfffe); test_bin(0xffff); test_bin(0x10000); test_bin(0x10001); footer(); return check_plan(); } static void test_next_on_array(uint32_t count) { note("next/check on array(%u)", count); char *d1 = data; d1 = mp_encode_array(d1, count); for (uint32_t i = 0; i < count; i++) { d1 = mp_encode_uint(d1, i % 0x7f); /* one byte */ } uint32_t len = count + mp_sizeof_array(count); const char *d2 = data; const char *d3 = data; ok(!mp_check(&d2, data + BUF_MAXLEN), "mp_check(array %u))", count); is((d1 - data), (ptrdiff_t)len, "len(array %u) == %u", count, len); is((d2 - data), (ptrdiff_t)len, "len(mp_check(array %u)) == %u", count, len); mp_next(&d3); is((d3 - data), (ptrdiff_t)len, "len(mp_next(array %u)) == %u", count, len); } static int test_next_on_arrays(void) { plan(52); header(); test_next_on_array(0x00); test_next_on_array(0x01); test_next_on_array(0x0f); test_next_on_array(0x10); test_next_on_array(0x11); test_next_on_array(0xfe); test_next_on_array(0xff); test_next_on_array(0x100); test_next_on_array(0x101); test_next_on_array(0xfffe); test_next_on_array(0xffff); test_next_on_array(0x10000); test_next_on_array(0x10001); footer(); return check_plan(); } static void test_next_on_map(uint32_t count) { note("next/check on map(%u)", count); char *d1 = data; d1 = mp_encode_map(d1, count); for (uint32_t i = 0; i < 2 * count; i++) { d1 = mp_encode_uint(d1, i % 0x7f); /* one byte */ } uint32_t len = 2 * count + mp_sizeof_map(count); const char *d2 = data; const char *d3 = data; ok(!mp_check(&d2, data + BUF_MAXLEN), "mp_check(map %u))", count); is((d1 - data), (ptrdiff_t)len, "len(map %u) == %u", count, len); is((d2 - data), (ptrdiff_t)len, "len(mp_check(map %u)) == %u", count, len); mp_next(&d3); is((d3 - data), (ptrdiff_t)len, "len(mp_next(map %u)) == %u", count, len); } static int test_next_on_maps(void) { plan(52); header(); test_next_on_map(0x00); test_next_on_map(0x01); test_next_on_map(0x0f); test_next_on_map(0x10); test_next_on_map(0x11); test_next_on_map(0xfe); test_next_on_map(0xff); test_next_on_map(0x100); test_next_on_map(0x101); test_next_on_map(0xfffe); test_next_on_map(0xffff); test_next_on_map(0x10000); test_next_on_map(0x10001); footer(); return check_plan(); } static void test_compare_uint(uint64_t a, uint64_t b) { char bufa[9]; char bufb[9]; mp_encode_uint(bufa, a); mp_encode_uint(bufb, b); int r = mp_compare_uint(bufa, bufb); if (a < b) { ok(r < 0, "mp_compare_uint(%"PRIu64", %" PRIu64 ") < 0", a, b); } else if (a > b) { ok(r > 0, "mp_compare_uint(%"PRIu64", %" PRIu64") > 0", a, b); } else { ok(r == 0, "mp_compare_uint(%"PRIu64", %"PRIu64") == 0", a, b); } } static int test_compare_uints(void) { plan(227); header(); test_compare_uint(0, 0); test_compare_uint(0, 0); uint64_t nums[] = { 0, 1, 0x7eU, 0x7fU, 0x80U, 0xfeU, 0xffU, 0xfffeU, 0xffffU, 0x10000U, 0xfffffffeU, 0xffffffffU, 0x100000000ULL, 0xfffffffffffffffeULL, 0xffffffffffffffffULL }; int count = sizeof(nums) / sizeof(*nums); for (int i = 0; i < count; i++) { for (int j = 0; j < count; j++) { test_compare_uint(nums[i], nums[j]); } } footer(); return check_plan(); } static bool fequal(float a, float b) { return a > b ? a - b < 1e-5f : b - a < 1e-5f; } static bool dequal(double a, double b) { return a > b ? a - b < 1e-10 : b - a < 1e-10; } static int test_format(void) { plan(230); header(); const size_t buf_size = 1024; char buf[buf_size]; size_t sz; const char *fmt; const char *p, *c, *e; uint32_t len = 0; fmt = "%d %u %i %ld %lu %li %lld %llu %lli" "%hd %hu %hi %hhd %hhu %hhi"; sz = mp_format(buf, buf_size, fmt, 1, 2, 3, (long)4, (long)5, (long)6, (long long)7, (long long)8, (long long)9, (short)10, (short)11, (short)12, (char)13, (char)14, (char)15); p = buf; for (unsigned i = 0; i < 15; i++) { ok(mp_typeof(*p) == MP_UINT, "Test type on step %d", i); ok(mp_decode_uint(&p) == i + 1, "Test value on step %d", i); } sz = mp_format(buf, buf_size, fmt, -1, -2, -3, (long)-4, (long)-5, (long)-6, (long long)-7, (long long)-8, (long long)-9, (short)-10, (unsigned short)-11, (short)-12, (signed char)-13, (unsigned char)-14, (signed char)-15); p = buf; for (int i = 0; i < 15; i++) { uint64_t expects[5] = { UINT_MAX - 1, ULONG_MAX - 4, ULLONG_MAX - 7, USHRT_MAX - 10, UCHAR_MAX - 13 }; if (i % 3 == 1) { ok(mp_typeof(*p) == MP_UINT, "Test type on step %d", i); ok(mp_decode_uint(&p) == expects[i / 3], "Test value on step %d", i); } else { ok(mp_typeof(*p) == MP_INT, "Test type on step %d", i); ok(mp_decode_int(&p) == - i - 1, "Test value on step %d", i); } } fmt = "%d NIL [%d %b %b] this is test" "[%d %%%% [[ %d {%s %f %% %.*s %lf %.*s NIL} %d ]] %d%d%d]"; #define TEST_PARAMS 0, 1, true, false, -1, 2, \ "flt", 0.1, 6, "double#ignored", 0.2, 0, "ignore", 3, 4, 5, 6 sz = mp_format(buf, buf_size, fmt, TEST_PARAMS); p = buf; e = buf + sz; c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_UINT, "type"); ok(mp_decode_uint(&p) == 0, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_NIL, "type"); mp_decode_nil(&p); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_ARRAY, "type"); ok(mp_decode_array(&p) == 3, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_UINT, "type"); ok(mp_decode_uint(&p) == 1, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_BOOL, "type"); ok(mp_decode_bool(&p) == true, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_BOOL, "type"); ok(mp_decode_bool(&p) == false, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_ARRAY, "type"); ok(mp_decode_array(&p) == 5, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_INT, "type"); ok(mp_decode_int(&p) == -1, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_ARRAY, "type"); ok(mp_decode_array(&p) == 1, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_ARRAY, "type"); ok(mp_decode_array(&p) == 3, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_UINT, "type"); ok(mp_decode_uint(&p) == 2, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_MAP, "type"); ok(mp_decode_map(&p) == 3, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_STR, "type"); c = mp_decode_str(&p, &len); ok(len == 3, "decode"); ok(memcmp(c, "flt", 3) == 0, "compare"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_FLOAT, "type"); ok(fequal(mp_decode_float(&p), 0.1), "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_STR, "type"); c = mp_decode_str(&p, &len); ok(len == 6, "decode"); ok(memcmp(c, "double", 6) == 0, "compare"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_DOUBLE, "type"); ok(dequal(mp_decode_double(&p), 0.2), "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_STR, "type"); c = mp_decode_str(&p, &len); ok(len == 0, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_NIL, "type"); mp_decode_nil(&p); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_UINT, "type"); ok(mp_decode_uint(&p) == 3, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_UINT, "type"); ok(mp_decode_uint(&p) == 4, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_UINT, "type"); ok(mp_decode_uint(&p) == 5, "decode"); c = p; ok(mp_check(&c, e) == 0, "check"); ok(mp_typeof(*p) == MP_UINT, "type"); ok(mp_decode_uint(&p) == 6, "decode"); ok(p == e, "nothing more"); ok(sz < 50, "no magic detected"); for (size_t lim = 0; lim <= 50; lim++) { memset(buf, 0, buf_size); size_t test_sz = mp_format(buf, lim, fmt, TEST_PARAMS); ok(test_sz == sz, "return value on step %d", (int)lim); bool all_zero = true; for(size_t z = lim; z < buf_size; z++) all_zero = all_zero && (buf[z] == 0); ok(all_zero, "buffer overflow on step %d", (int)lim); } #undef TEST_PARAMS footer(); return check_plan(); } int test_mp_print() { plan(1); header(); char data[512]; char *d = data; d = mp_encode_array(d, 6); d = mp_encode_int(d, -5); d = mp_encode_uint(d, 42); d = mp_encode_str(d, "kill bill", 9); d = mp_encode_map(d, 6); d = mp_encode_str(d, "bool true", 9); d = mp_encode_bool(d, true); d = mp_encode_str(d, "bool false", 10); d = mp_encode_bool(d, false); d = mp_encode_str(d, "null", 4); d = mp_encode_nil(d); d = mp_encode_str(d, "float", 5); d = mp_encode_float(d, 3.14); d = mp_encode_str(d, "double", 6); d = mp_encode_double(d, 3.14); d = mp_encode_uint(d, 100); d = mp_encode_uint(d, 500); *d++ = 0xd4; /* let's pack smallest fixed ext */ *d++ = 0; *d++ = 0; char bin[] = "\x12test\x34\b\t\n\"bla\\-bla\"\f\r"; d = mp_encode_bin(d, bin, sizeof(bin)); const char *expected = "[-5, 42, \"kill bill\", " "{\"bool true\": true, \"bool false\": false, \"null\": null, " "\"float\": 3.14, \"double\": 3.14, 100: 500}, undefined, " "\"\\u0012test4\\b\\t\\n\\\"bla\\\\-bla\\\"\\f\\r\\u0000\"]"; FILE *tmpf = tmpfile(); if (tmpf != NULL) { mp_fprint(tmpf, data); (void) rewind(tmpf); memset(data, 0, sizeof(data)); if (fgets(data, sizeof(data), tmpf) != NULL) { ok(strcmp(data, expected) == 0, "identical"); } fclose(tmpf); } footer(); return check_plan(); } int main() { plan(17); test_uints(); test_ints(); test_bools(); test_floats(); test_doubles(); test_nils(); test_strls(); test_binls(); test_strs(); test_bins(); test_arrays(); test_maps(); test_next_on_arrays(); test_next_on_maps(); test_compare_uints(); test_format(); test_mp_print(); return check_plan(); } msgpuck_1.0.3/test/test.c0000664000000000000000000000515412752613651014065 0ustar rootroot/* * Copyright (C) 2010-2016 Tarantool AUTHORS: * please see AUTHORS file in tarantool/tarantool repository. * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * 1. Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "test.h" #include #include enum { MAX_LEVELS = 10 }; static int tests_done[MAX_LEVELS]; static int tests_failed[MAX_LEVELS]; static int plan_test[MAX_LEVELS]; static int level = -1; void __space(FILE *stream) { for (int i = 0 ; i < level; i++) { fprintf(stream, " "); } } void plan(int count) { ++level; plan_test[level] = count; tests_done[level] = 0; tests_failed[level] = 0; __space(stdout); printf("%d..%d\n", 1, plan_test[level]); } int check_plan(void) { int r = 0; if (tests_done[level] != plan_test[level]) { __space(stderr); fprintf(stderr, "# Looks like you planned %d tests but ran %d.\n", plan_test[level], tests_done[level]); r = -1; } if (tests_failed[level]) { __space(stderr); fprintf(stderr, "# Looks like you failed %d test of %d run.\n", tests_failed[level], tests_done[level]); r = tests_failed[level]; } --level; if (level >= 0) { is(r, 0, "subtests"); } return r; } int __ok(int condition, const char *fmt, ...) { va_list ap; __space(stdout); printf("%s %d - ", condition ? "ok" : "not ok", ++tests_done[level]); if (!condition) tests_failed[level]++; va_start(ap, fmt); vprintf(fmt, ap); printf("\n"); return condition; } msgpuck_1.0.3/test/.gitignore0000664000000000000000000000000712752613651014722 0ustar rootroot*.test msgpuck_1.0.3/LICENSE0000664000000000000000000000241512752613651012765 0ustar rootrootCopyright (c) 2013-2016 MsgPuck Authors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. msgpuck_1.0.3/Doxyfile.in0000664000000000000000000022263612752613651014104 0ustar rootroot# Doxyfile 1.8.1.2 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # # All text after a hash (#) is considered a comment and will be ignored. # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" "). #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See # http://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or sequence of words) that should # identify the project. Note that if you do not use Doxywizard you need # to put quotes around the project name if it contains spaces. PROJECT_NAME = "MsgPuck" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer # a quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = # With the PROJECT_LOGO tag one can specify an logo or icon that is # included in the documentation. The maximum height of the logo should not # exceed 55 pixels and the maximum width should not exceed 200 pixels. # Doxygen will copy the logo to the output directory. PROJECT_LOGO = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = doc # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, # Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English # messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, # Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, # Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. OUTPUT_LANGUAGE = English # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = NO # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful if your file system # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like regular Qt-style comments # (thus requiring an explicit @brief command for a brief description.) JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then Doxygen will # interpret the first line (until the first dot) of a Qt-style # comment as the brief description. If set to NO, the comments # will behave just like regular Qt-style comments (thus requiring # an explicit \brief command for a brief description.) QT_AUTOBRIEF = NO # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # This tag can be used to specify a number of word-keyword mappings (TCL only). # A mapping has the form "name=value". For example adding # "class=itcl::class" will allow you to use the command class in the # itcl::class meaning. TCL_SUBST = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for # Java. For instance, namespaces will be presented as packages, qualified # scopes will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran # sources only. Doxygen will then generate output that is more tailored for # Fortran. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL # sources. Doxygen will then generate output that is tailored for # VHDL. OPTIMIZE_OUTPUT_VHDL = NO # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given extension. # Doxygen has a built-in mapping, but you can override or extend it using this # tag. The format is ext=language, where ext is a file extension, and language # is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, # C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make # doxygen treat .inc files as Fortran files (default is PHP), and .f files as C # (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions # you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. EXTENSION_MAPPING = # If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all # comments according to the Markdown format, which allows for more readable # documentation. See http://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you # can mix doxygen, HTML, and XML commands with Markdown formatting. # Disable only in case of backward compatibilities issues. MARKDOWN_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want # to include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also makes the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. # Doxygen will parse them like normal C++ but will assume all classes use public # instead of private inheritance when no explicit protection keyword is present. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate getter # and setter methods for a property. Setting this option to YES (the default) # will make doxygen replace the get and set methods by a property in the # documentation. This will only work if the methods are indeed getting or # setting a simple type. If this is not the case, or you want to show the # methods anyway, you should set this option to NO. IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES # When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and # unions are shown inside the group in which they are included (e.g. using # @ingroup) instead of on a separate page (for HTML and Man pages) or # section (for LaTeX and RTF). INLINE_GROUPED_CLASSES = NO # When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and # unions with only public data fields will be shown inline in the documentation # of the scope in which they are defined (i.e. file, namespace, or group # documentation), provided this scope is documented. If set to NO (the default), # structs, classes, and unions are shown on a separate page (for HTML and Man # pages) or section (for LaTeX and RTF). INLINE_SIMPLE_STRUCTS = NO # When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum # is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, # namespace, or class. And the struct will be named TypeS. This can typically # be useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. TYPEDEF_HIDES_STRUCT = NO # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given # their name and scope. Since this can be an expensive process and often the # same symbol appear multiple times in the code, doxygen keeps a cache of # pre-resolved symbols. If the cache is too small doxygen will become slower. # If the cache is too large, memory is wasted. The cache size is given by this # formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, # corresponding to a cache size of 2^16 = 65536 symbols. LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation. EXTRACT_PACKAGE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = NO # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called # 'anonymous_namespace{file}', where file will be replaced with the base # name of the file that contains the anonymous namespace. By default # anonymous namespaces are hidden. EXTRACT_ANON_NSPACES = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen # will list include files with double quotes in the documentation # rather than with sharp brackets. FORCE_LOCAL_INCLUDES = NO # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen # will sort the (brief and detailed) documentation of class members so that # constructors and destructors are listed first. If set to NO (the default) # the constructors will appear in the respective orders defined by # SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. # This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO # and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. SORT_MEMBERS_CTORS_1ST = NO # If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. SORT_GROUP_NAMES = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to # do proper type resolution of all parameters of a function it will reject a # match between the prototype and the implementation of a member function even # if there is only one candidate or it is obvious which candidate to choose # by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen # will still accept a match between prototype and implementation in such cases. STRICT_PROTO_MATCHING = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or macro consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and macros in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # Set the SHOW_FILES tag to NO to disable the generation of the Files page. # This will remove the Files entry from the Quick Index and from the # Folder Tree View (if specified). The default is YES. SHOW_FILES = YES # Set the SHOW_NAMESPACES tag to NO to disable the generation of the # Namespaces page. # This will remove the Namespaces entry from the Quick Index # and from the Folder Tree View (if specified). The default is YES. SHOW_NAMESPACES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file # that represents doxygen's defaults, run doxygen with the -l option. # You can optionally specify a file name after the option, if omitted # DoxygenLayout.xml will be used as the name of the layout file. LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files # containing the references data. This must be a list of .bib files. The # .bib extension is automatically appended if omitted. Using this command # requires the bibtex tool to be installed. See also # http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style # of the bibliography can be controlled using LATEX_BIB_STYLE. To use this # feature you need bibtex and perl available in the search path. CITE_BIB_FILES = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # The WARN_NO_PARAMDOC option can be enabled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = "@CMAKE_CURRENT_SOURCE_DIR@/msgpuck.h" # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built # into libc) for the transcoding. See http://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh # *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py # *.f90 *.f *.for *.vhd *.vhdl FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. # Note that relative paths are relative to the directory from which doxygen is # run. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, # AClass::ANamespace, ANamespace::*Test EXCLUDE_SYMBOLS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. # If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. # Doxygen will compare the file name with each pattern and apply the # filter if there is a match. # The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty or if # non of the patterns match the file name, INPUT_FILTER is applied. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file # pattern. A pattern will override the setting for FILTER_PATTERN (if any) # and it is also possible to disable source filtering for a specific pattern # using *.ext= (so without naming a filter). This option only has effect when # FILTER_SOURCE_FILES is enabled. FILTER_SOURCE_PATTERNS = #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C, C++ and Fortran comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = NO # If the REFERENCES_RELATION tag is set to YES # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = NO # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. # Otherwise they will link to the documentation. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = NO #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = YES # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = @GENERATE_HTML@ # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. Note that when using a custom header you are responsible # for the proper inclusion of any scripts and style sheets that doxygen # needs, which is dependent on the configuration options used. # It is advised to generate a default header using "doxygen -w html # header.html footer.html stylesheet.css YourConfigFile" and then modify # that header. Note that the header is subject to change so you typically # have to redo this when upgrading to a newer version of doxygen or when # changing the value of configuration settings such as GENERATE_TREEVIEW! HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # style sheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the # $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these # files. In the HTML_STYLESHEET file, use the file name only. Also note that # the files will be copied as-is; there are no commands or markers available. HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the style sheet and background images # according to this color. Hue is specified as an angle on a colorwheel, # see http://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. HTML_COLORSTYLE_HUE = 220 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use # grayscales only. A value of 255 will produce the most vivid colors. HTML_COLORSTYLE_SAT = 100 # The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to # the luminance component of the colors in the HTML output. Values below # 100 gradually make the output lighter, whereas values above 100 make # the output darker. The value divided by 100 is the actual gamma applied, # so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, # and 100 does not change the gamma. HTML_COLORSTYLE_GAMMA = 80 # If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML # page will contain the date and time when the page was generated. Setting # this to NO can help when comparing the output of multiple runs. HTML_TIMESTAMP = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. HTML_DYNAMIC_SECTIONS = NO # With HTML_INDEX_NUM_ENTRIES one can control the preferred number of # entries shown in the various tree structured indices initially; the user # can expand and collapse entries dynamically later on. Doxygen will expand # the tree to such a level that at most the specified number of entries are # visible (unless a fully collapsed tree already exceeds this amount). # So setting the number of entries 1 will produce a full collapsed tree by # default. 0 is a special value representing an infinite number of entries # and will result in a full expanded tree by default. HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files # will be generated that can be used as input for Apple's Xcode 3 # integrated development environment, introduced with OSX 10.5 (Leopard). # To create a documentation set, doxygen will generate a Makefile in the # HTML output directory. Running make will produce the docset in that # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. # See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. GENERATE_DOCSET = NO # When GENERATE_DOCSET tag is set to YES, this tag determines the name of the # feed. A documentation feed provides an umbrella under which multiple # documentation sets from a single provider (such as a company or product suite) # can be grouped. DOCSET_FEEDNAME = "Doxygen generated docs" # When GENERATE_DOCSET tag is set to YES, this tag specifies a string that # should uniquely identify the documentation set bundle. This should be a # reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen # will append .docset to the name. DOCSET_BUNDLE_ID = org.doxygen.Project # When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify # the documentation publisher. This should be a reverse domain-name style # string, e.g. com.mycompany.MyDocSet.documentation. DOCSET_PUBLISHER_ID = org.doxygen.Publisher # The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compiled HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING # is used to encode HtmlHelp index (hhk), content (hhc) and project file # content. CHM_INDEX_ENCODING = # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and # QHP_VIRTUAL_FOLDER are set, an additional index file will be generated # that can be used as input for Qt's qhelpgenerator to generate a # Qt Compressed Help (.qch) of the generated HTML documentation. GENERATE_QHP = NO # If the QHG_LOCATION tag is specified, the QCH_FILE tag can # be used to specify the file name of the resulting .qch file. # The path specified is relative to the HTML output folder. QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#namespace QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating # Qt Help Project output. For more information please see # http://doc.trolltech.com/qthelpproject.html#virtual-folders QHP_VIRTUAL_FOLDER = doc # If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to # add. For more information please see # http://doc.trolltech.com/qthelpproject.html#custom-filters QHP_CUST_FILTER_NAME = # The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see # # Qt Help Project / Custom Filters. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's # filter section matches. # # Qt Help Project / Filter Attributes. QHP_SECT_FILTER_ATTRS = # If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can # be used to specify the location of Qt's qhelpgenerator. # If non-empty doxygen will try to run qhelpgenerator on the generated # .qhp file. QHG_LOCATION = # If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files # will be generated, which together with the HTML files, form an Eclipse help # plugin. To install this plugin and make it available under the help contents # menu in Eclipse, the contents of the directory containing the HTML and XML # files needs to be copied into the plugins directory of eclipse. The name of # the directory within the plugins directory should be the same as # the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before # the help appears. GENERATE_ECLIPSEHELP = NO # A unique identifier for the eclipse help plugin. When installing the plugin # the directory name containing the HTML and XML files should also have # this name. ECLIPSE_DOC_ID = org.tarantool.msgpack # The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) # at top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. Since the tabs have the same information as the # navigation tree you can set this option to NO if you already set # GENERATE_TREEVIEW to YES. DISABLE_INDEX = YES # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. # If the tag value is set to YES, a side panel will be generated # containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). # Windows users are probably better off using the HTML help feature. # Since the tree basically has the same information as the tab index you # could consider to set DISABLE_INDEX to NO when enabling this option. GENERATE_TREEVIEW = NO # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values # (range [0,1..20]) that doxygen will group on one line in the generated HTML # documentation. Note that a value of 0 will completely suppress the enum # values from appearing in the overview section. ENUM_VALUES_PER_LINE = 4 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 # When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open # links to external symbols imported via tag files in a separate window. EXT_LINKS_IN_WINDOW = NO # Use this tag to change the font size of Latex formulas included # as images in the HTML documentation. The default is 10. Note that # when you change the font size after a successful doxygen run you need # to manually remove any form_*.png images from the HTML output directory # to force them to be regenerated. FORMULA_FONTSIZE = 10 # Use the FORMULA_TRANPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are # not supported properly for IE 6.0, but are supported on all modern browsers. # Note that when changing this option you need to delete any form_*.png files # in the HTML output before the changes have effect. FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax # (see http://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you may also need to install MathJax separately and # configure the path to it using the MATHJAX_RELPATH option. USE_MATHJAX = NO # When MathJax is enabled you need to specify the location relative to the # HTML output directory using the MATHJAX_RELPATH option. The destination # directory should contain the MathJax.js script. For instance, if the mathjax # directory is located at the same level as the HTML output directory, then # MATHJAX_RELPATH should be ../mathjax. The default value points to # the MathJax Content Delivery Network so you can quickly see the result without # installing MathJax. # However, it is strongly recommended to install a local # copy of MathJax from http://www.mathjax.org before deployment. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest # The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension # names that should be enabled during MathJax rendering. MATHJAX_EXTENSIONS = # When the SEARCHENGINE tag is enabled doxygen will generate a search box # for the HTML output. The underlying search engine uses javascript # and DHTML and should work on any modern browser. Note that when using # HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets # (GENERATE_DOCSET) there is already a search function so this one should # typically be disabled. For large projects the javascript based search engine # can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. SEARCHENGINE = NO # When the SERVER_BASED_SEARCH tag is enabled the search engine will be # implemented using a PHP enabled web server instead of at the web client # using Javascript. Doxygen will generate the search PHP script and index # file to put on the web server. The advantage of the server # based approach is that it scales better to large projects and allows # full text search. The disadvantages are that it is more difficult to setup # and does not have live searching capabilities. SERVER_BASED_SEARCH = NO #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. # Note that when enabling USE_PDFLATEX this option is only used for # generating bitmaps for formulas in the HTML output, but not in the # Makefile that is written to the output directory. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4 # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for # the generated latex document. The footer should contain everything after # the last chapter. If it is left blank doxygen will generate a # standard footer. Notice: only use this tag if you know what you are doing! LATEX_FOOTER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = YES # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = YES # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO # If LATEX_SOURCE_CODE is set to YES then doxygen will include # source code with syntax highlighting in the LaTeX output. # Note that which sources are shown also depends on other settings # such as SOURCE_BROWSER. LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See # http://en.wikipedia.org/wiki/BibTeX for more info. LATEX_BIB_STYLE = plain #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load style sheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = @GENERATE_MAN@ # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. # This is useful # if you want to understand what is going on. # On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # pointed to by INCLUDE_PATH will be searched when a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = "MP_PROTO = inline"\ "__attribute__(x)=" # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition that # overrules the definition found in the source code. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all references to function-like macros # that are alone on a line, have an all uppercase name, and do not end with a # semicolon, because these will confuse the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. For each # tag file the location of the external documentation should be added. The # format of a tag file without this location is as follows: # # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths # or URLs. Note that each tag file must have a unique name (where the name does # NOT include the path). If a tag file is not located in the directory in which # doxygen is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option also works with HAVE_DOT disabled, but it is recommended to # install and use dot, since it yields more powerful graphs. CLASS_DIAGRAMS = NO # You can define message sequence charts within doxygen comments using the \msc # command. Doxygen will then run the mscgen tool (see # http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the # documentation. The MSCGEN_PATH tag allows you to specify the directory where # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. MSCGEN_PATH = # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is # allowed to run in parallel. When set to 0 (the default) doxygen will # base this on the number of processors available in the system. You can set it # explicitly to a value larger than 0 to get control over the balance # between CPU load and processing speed. DOT_NUM_THREADS = 0 # By default doxygen will use the Helvetica font for all dot files that # doxygen generates. When you want a differently looking font you can specify # the font name using DOT_FONTNAME. You need to make sure dot is able to find # the font, which can be done by putting it in a standard location or by setting # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. DOT_FONTNAME = Helvetica # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. DOT_FONTSIZE = 10 # By default doxygen will tell dot to use the Helvetica font. # If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to # set the path where dot can find it. DOT_FONTPATH = # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If the UML_LOOK tag is enabled, the fields and methods are shown inside # the class node. If there are many fields or methods and many nodes the # graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS # threshold limits the number of items for each type to make the size more # managable. Set this to 0 for no limit. Note that the threshold may be # exceeded by 50% before the limit is enforced. UML_LIMIT_NUM_FIELDS = 10 # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT options are set to YES then # doxygen will generate a call dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable call graphs # for selected functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then # doxygen will generate a caller dependency graph for every global function # or class method. Note that enabling this option will significantly increase # the time of a run. So in most cases it will be better to enable caller # graphs for selected functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will generate a graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are svg, png, jpg, or gif. # If left blank png will be used. If you choose svg you need to set # HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible in IE 9+ (other browsers do not have this requirement). DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. # Note that this requires a modern browser other than Internet Explorer. # Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you # need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files # visible. Older versions of IE do not have SVG support. INTERACTIVE_SVG = NO # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MSCFILE_DIRS tag can be used to specify one or more directories that # contain msc files that are included in the documentation (see the # \mscfile command). MSCFILE_DIRS = # The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of # nodes that will be shown in the graph. If the number of nodes in a graph # becomes larger than this value, doxygen will truncate the graph, which is # visualized by representing a node as a red box. Note that doxygen if the # number of direct children of the root node in a graph is already larger than # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. DOT_GRAPH_MAX_NODES = 50 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that the size of a graph can be further restricted by # DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, because dot on Windows does not # seem to support this out of the box. Warning: Depending on the platform used, # enabling this option may lead to badly anti-aliased labels on the edges of # a graph (i.e. they become hard to read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = YES # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES msgpuck_1.0.3/README.md0000664000000000000000000000564712752613651013251 0ustar rootrootMsgPuck ======= MsgPuck is a simple and efficient [MsgPack](http://msgpack.org) binary serialization library in a self-contained header file. * Can be easily incorporated into your project * Is very easy to use (see examples below) * Is fully tested and documented * Has clean and readable C source code * Is published under the very liberal license (BSD-2) Status ------ MsgPuck is stable, which means it have been used in production without serious bugs for quite a while now. The library is fully documented and covered by unit tests. Latest MsgPack specification (2013-09) is supported. Please feel free to file a ticket if your have a problem or a question. [![Build Status](https://travis-ci.org/rtsisyk/msgpuck.png)] (https://travis-ci.org/rtsisyk/msgpuck) Examples -------- **Encoding:** char buf[1024]; char *w = buf; w = mp_encode_array(w, 4) w = mp_encode_uint(w, 10); w = mp_encode_str(w, "hello world", strlen("hello world")); w = mp_encode_bool(w, true); w = mp_encode_double(w, 3.1415); **Validating:** const char *end = buf + xx; const char *b = buf; int rc = mp_check(&b, end); assert(rc == 0); assert(b == end); **Decoding:** uint32_t size; uint64_t ival; const char *sval; uint32_t sval_len; bool bval; double dval; const char *r = buf; size = mp_decode_array(&r); /* size is 4 */ ival = mp_decode_uint(&r); /* ival is 10; */ sval = mp_decode_str(&r, &sval_len); /* sval is "hello world", sval_len is strlen("hello world") */ bval = mp_decode_bool(&r); /* bval is true */ dval = mp_decode_double(&r); /* dval is 3.1415 */ assert(r == w); Usage ----- You need a C89+ or C++03+ compatible compiler to use msgpuck.h. Add this project as a submodule or just copy `msgpuck.h` to your project. ### Static Library MsgPuck is designed to be fully embedded to your application by a C/C++ compiler. However, some functions require auxiliary static tables which should be expanded somewhere in a compilation unit (`*.c` or `*.cc` file). Please add libmsgpuck.a to your binary to avoid problems with unresolved symbols. ### Just a Header Include `msgpuck.h` as usual and define `MP_SOURCE 1` exactly in a single compilation unit: #define MP_SOURCE 1 /* define in a single .c/.cc file */ #include "msgpuck.h" All non-inline versions of functions and global lookup tables will be stored in the file. `MP_SOURCE` must be defined exactly in a single file of your application, otherwise linker errors occur. Documentation ------------- * [API Documentation](http://rtsisyk.github.io/msgpuck/) * [Specification](https://github.com/msgpack/msgpack/blob/master/spec.md) API documentation can be also generated using `make doc` (Doxygen is required). Contacts -------- MsgPuck was written to use within [Tarantool](http://tarantool.org) - the world's first full-featured MsgPack-based database. * roman@tsisyk.com msgpuck_1.0.3/rpm/0000775000000000000000000000000012752613651012554 5ustar rootrootmsgpuck_1.0.3/rpm/msgpuck.spec0000664000000000000000000000557612752613651015116 0ustar rootrootName: msgpuck Version: 1.0.2 Release: 1%{?dist} Summary: MsgPack binary serialization library in a self-contained header Group: Development/Libraries License: BSD URL: https://github.com/rtsisyk/msgpuck Source0: https://github.com/rtsisyk/msgpuck/archive/%{version}/msgpuck-%{version}.tar.gz BuildRequires: gcc BuildRequires: coreutils BuildRequires: cmake >= 2.8 BuildRequires: doxygen >= 1.6.0 # https://fedoraproject.org/wiki/Packaging:Guidelines#Packaging_Header_Only_Libraries # Nothing to add to -debuginfo package - this library is header-only %global debug_package %{nil} %package devel Summary: MsgPack serialization library in a self-contained header file Provides: msgpuck-static = %{version}-%{release} %description MsgPack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small. msgpuck is very lightweight header-only library designed to be embedded to your application by the C/C++ compiler. The library is fully documented and covered by unit tests. %description devel MsgPack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small. msgpuck is very lightweight header-only library designed to be embedded to your application by the C/C++ compiler. The library is fully documented and covered by unit tests. This package provides a self-contained header file and a static library. The static library contains generated code for inline functions and global tables needed by the some library functions. %prep %setup -q -n %{name}-%{version} %build %cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo make %{?_smp_mflags} make man %check make test %install %make_install mkdir -p %{buildroot}%{_mandir}/man3 install -Dpm 0644 doc/man/man3/msgpuck.h.3* %{buildroot}%{_mandir}/man3/ %files devel %{_libdir}/libmsgpuck.a %{_includedir}/msgpuck.h %{_mandir}/man3/msgpuck.h.3* %doc README.md %{!?_licensedir:%global license %doc} %license LICENSE AUTHORS %changelog * Tue Aug 09 2016 Roman Tsisyk 1.0.3-1 - Add mp_decode_strbin() and mp_decode_strbinl() - Add mp_fprint() for debug output * Tue Feb 02 2016 Roman Tsisyk 1.0.2-1 - Add coreutils and make to BuildRequires (#1295217) - Use `install -Dpm` instead of `cp -p` - Fix GCC 6.0 and Doxygen warnings * Mon Jan 25 2016 Roman Tsisyk 1.0.1-3 - Add `BuildRequires: gcc` (#1295217) * Sun Jan 24 2016 Roman Tsisyk 1.0.1-2 - Fix msgpuck-devel dependencies after removing empty msgpuck package * Fri Jan 22 2016 Roman Tsisyk 1.0.1-1 - Changes according to Fedora review #1295217 - Fix SIGBUS on processesor without HW support for unaligned access * Thu Jul 09 2015 Roman Tsisyk 1.0.0-1 - Initial version of the RPM spec msgpuck_1.0.3/.build.mk0000664000000000000000000000273112752613651013467 0ustar rootroot# Copyright (c) 2015 MsgPuck Authors # All rights reserved. # # Redistribution and use in source and binary forms, with or # without modification, are permitted provided that the following # conditions are met: # # 1. Redistributions of source code must retain the above # copyright notice, this list of conditions and the # following disclaimer. # # 2. Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials # provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL # OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. test: rm -rf ./test_build mkdir ./test_build && cd ./test_build && cmake .. -DCMAKE_BUILD_TYPE=RelWithDebugInfo cd test_build && $(MAKE) test .PHONY: test msgpuck_1.0.3/msgpuck.h0000664000000000000000000020750512752613651013611 0ustar rootroot#ifndef MSGPUCK_H_INCLUDED #define MSGPUCK_H_INCLUDED /* * Copyright (c) 2013-2016 MsgPuck Authors * All rights reserved. * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * 1. Redistributions of source code must retain the above * copyright notice, this list of conditions and the * following disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ /** * \file msgpuck.h * MsgPuck * \brief MsgPuck is a simple and efficient MsgPack encoder/decoder * library in a single self-contained file. * * Usage example: * \code * // Encode * char buf[1024]; * char *w = buf; * w = mp_encode_array(w, 4) * w = mp_encode_uint(w, 10); * w = mp_encode_str(w, "hello world", strlen("hello world")); * w = mp_encode_bool(w, true); * w = mp_encode_double(w, 3.1415); * * // Validate * const char *b = buf; * int r = mp_check(&b, w); * assert(!r) * assert(b == w); * * // Decode * uint32_t size; * uint64_t ival; * const char *sval; * uint32_t sval_len; * bool bval; * double dval; * * const char *r = buf; * * size = mp_decode_array(&r); * // size is 4 * * ival = mp_decode_uint(&r); * // ival is 10; * * sval = mp_decode_str(&r, &sval_len); * // sval is "hello world", sval_len is strlen("hello world") * * bval = mp_decode_bool(&r); * // bval is true * * dval = mp_decode_double(&r); * // dval is 3.1415 * * assert(r == w); * \endcode * * \note Supported compilers. * The implementation requires a C99+ or C++03+ compatible compiler. * * \note Inline functions. * The implementation is compatible with both C99 and GNU inline functions. * Please define MP_SOURCE 1 before \#include in a single * compilation unit. This module will be used to store non-inlined versions of * functions and global tables. */ #if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) #define __STDC_CONSTANT_MACROS 1 /* make С++ to be happy */ #endif #if defined(__cplusplus) && !defined(__STDC_LIMIT_MACROS) #define __STDC_LIMIT_MACROS 1 /* make С++ to be happy */ #endif #include #include #include #include #include #include #include #include #if defined(__cplusplus) extern "C" { #endif /* defined(__cplusplus) */ /* * {{{ Platform-specific definitions */ /** \cond false **/ #if defined(__CC_ARM) /* set the alignment to 1 for armcc compiler */ #define MP_PACKED __packed #else #define MP_PACKED __attribute__((packed)) #endif #if defined(__GNUC__) && !defined(__GNUC_STDC_INLINE__) #if !defined(MP_SOURCE) #define MP_PROTO extern inline #define MP_IMPL extern inline #else /* defined(MP_SOURCE) */ #define MP_PROTO #define MP_IMPL #endif #define MP_ALWAYSINLINE #else /* C99 inline */ #if !defined(MP_SOURCE) #define MP_PROTO inline #define MP_IMPL inline #else /* defined(MP_SOURCE) */ #define MP_PROTO extern inline #define MP_IMPL inline #endif #define MP_ALWAYSINLINE __attribute__((always_inline)) #endif /* GNU inline or C99 inline */ #if !defined __GNUC_MINOR__ || defined __INTEL_COMPILER || \ defined __SUNPRO_C || defined __SUNPRO_CC #define MP_GCC_VERSION(major, minor) 0 #else #define MP_GCC_VERSION(major, minor) (__GNUC__ > (major) || \ (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) #endif #if !defined(__has_builtin) #define __has_builtin(x) 0 /* clang */ #endif #if MP_GCC_VERSION(2, 9) || __has_builtin(__builtin_expect) #define mp_likely(x) __builtin_expect((x), 1) #define mp_unlikely(x) __builtin_expect((x), 0) #else #define mp_likely(x) (x) #define mp_unlikely(x) (x) #endif #if MP_GCC_VERSION(4, 5) || __has_builtin(__builtin_unreachable) #define mp_unreachable() (assert(0), __builtin_unreachable()) #else MP_PROTO void mp_unreachable(void) __attribute__((noreturn)); MP_PROTO void mp_unreachable(void) { assert(0); abort(); } #define mp_unreachable() (assert(0)) #endif #define mp_identity(x) (x) /* just to simplify mp_load/mp_store macroses */ #if MP_GCC_VERSION(4, 8) || __has_builtin(__builtin_bswap16) #define mp_bswap_u16(x) __builtin_bswap16(x) #else /* !MP_GCC_VERSION(4, 8) */ #define mp_bswap_u16(x) ( \ (((x) << 8) & 0xff00) | \ (((x) >> 8) & 0x00ff) ) #endif #if MP_GCC_VERSION(4, 3) || __has_builtin(__builtin_bswap32) #define mp_bswap_u32(x) __builtin_bswap32(x) #else /* !MP_GCC_VERSION(4, 3) */ #define mp_bswap_u32(x) ( \ (((x) << 24) & UINT32_C(0xff000000)) | \ (((x) << 8) & UINT32_C(0x00ff0000)) | \ (((x) >> 8) & UINT32_C(0x0000ff00)) | \ (((x) >> 24) & UINT32_C(0x000000ff)) ) #endif #if MP_GCC_VERSION(4, 3) || __has_builtin(__builtin_bswap64) #define mp_bswap_u64(x) __builtin_bswap64(x) #else /* !MP_GCC_VERSION(4, 3) */ #define mp_bswap_u64(x) (\ (((x) << 56) & UINT64_C(0xff00000000000000)) | \ (((x) << 40) & UINT64_C(0x00ff000000000000)) | \ (((x) << 24) & UINT64_C(0x0000ff0000000000)) | \ (((x) << 8) & UINT64_C(0x000000ff00000000)) | \ (((x) >> 8) & UINT64_C(0x00000000ff000000)) | \ (((x) >> 24) & UINT64_C(0x0000000000ff0000)) | \ (((x) >> 40) & UINT64_C(0x000000000000ff00)) | \ (((x) >> 56) & UINT64_C(0x00000000000000ff)) ) #endif #define MP_LOAD_STORE(name, type, bswap) \ MP_PROTO type \ mp_load_##name(const char **data); \ MP_IMPL type \ mp_load_##name(const char **data) \ { \ struct MP_PACKED cast { type val; }; \ type val = bswap(((struct cast *) *data)->val); \ *data += sizeof(type); \ return val; \ } \ MP_PROTO char * \ mp_store_##name(char *data, type val); \ MP_IMPL char * \ mp_store_##name(char *data, type val) \ { \ struct MP_PACKED cast { type val; }; \ ((struct cast *) (data))->val = bswap(val); \ return data + sizeof(type); \ } MP_LOAD_STORE(u8, uint8_t, mp_identity); #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ MP_LOAD_STORE(u16, uint16_t, mp_bswap_u16); MP_LOAD_STORE(u32, uint32_t, mp_bswap_u32); MP_LOAD_STORE(u64, uint64_t, mp_bswap_u64); #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ MP_LOAD_STORE(u16, uint16_t, mp_identity); MP_LOAD_STORE(u32, uint32_t, mp_identity); MP_LOAD_STORE(u64, uint64_t, mp_identity); #else #error Unsupported __BYTE_ORDER__ #endif #if !defined(__FLOAT_WORD_ORDER__) #define __FLOAT_WORD_ORDER__ __BYTE_ORDER__ #endif /* defined(__FLOAT_WORD_ORDER__) */ #if __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__ /* * Idiots from msgpack.org byte-swaps even IEEE754 float/double types. * Some platforms (e.g. arm) cause SIGBUS on attempt to store * invalid float in registers, so code like flt = mp_bswap_float(flt) * can't be used here. */ union MP_PACKED mp_float_cast { uint32_t u32; float f; }; union MP_PACKED mp_double_cast { uint64_t u64; double d; }; MP_PROTO float mp_load_float(const char **data); MP_PROTO double mp_load_double(const char **data); MP_PROTO char * mp_store_float(char *data, float val); MP_PROTO char * mp_store_double(char *data, double val); MP_IMPL float mp_load_float(const char **data) { union mp_float_cast cast = *(union mp_float_cast *) *data; *data += sizeof(cast); cast.u32 = mp_bswap_u32(cast.u32); return cast.f; } MP_IMPL double mp_load_double(const char **data) { union mp_double_cast cast = *(union mp_double_cast *) *data; *data += sizeof(cast); cast.u64 = mp_bswap_u64(cast.u64); return cast.d; } MP_IMPL char * mp_store_float(char *data, float val) { union mp_float_cast cast; cast.f = val; cast.u32 = mp_bswap_u32(cast.u32); *(union mp_float_cast *) (data) = cast; return data + sizeof(cast); } MP_IMPL char * mp_store_double(char *data, double val) { union mp_double_cast cast; cast.d = val; cast.u64 = mp_bswap_u64(cast.u64); *(union mp_double_cast *) (data) = cast; return data + sizeof(cast); } #elif __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__ MP_LOAD_STORE(float, float, mp_identity); MP_LOAD_STORE(double, double, mp_identity); #else #error Unsupported __FLOAT_WORD_ORDER__ #endif #undef mp_identity #undef MP_LOAD_STORE /** \endcond */ /* * }}} */ /* * {{{ API definition */ /** * \brief MsgPack data types */ enum mp_type { MP_NIL = 0, MP_UINT, MP_INT, MP_STR, MP_BIN, MP_ARRAY, MP_MAP, MP_BOOL, MP_FLOAT, MP_DOUBLE, MP_EXT }; /** * \brief Determine MsgPack type by a first byte \a c of encoded data. * * Example usage: * \code * assert(MP_ARRAY == mp_typeof(0x90)); * \endcode * * \param c - a first byte of encoded data * \return MsgPack type */ MP_PROTO __attribute__((pure)) enum mp_type mp_typeof(const char c); /** * \brief Calculate exact buffer size needed to store an array header of * \a size elements. Maximum return value is 5. For performance reasons you * can preallocate buffer for maximum size without calling the function. * \param size - a number of elements * \return buffer size in bytes (max is 5) */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_array(uint32_t size); /** * \brief Encode an array header of \a size elements. * * All array members must be encoded after the header. * * Example usage: * \code * // Encode * char buf[1024]; * char *w = buf; * w = mp_encode_array(w, 2) * w = mp_encode_uint(w, 10); * w = mp_encode_uint(w, 15); * * // Decode * const char *r = buf; * uint32_t size = mp_decode_array(&r); * for (uint32_t i = 0; i < size; i++) { * uint64_t val = mp_decode_uint(&r); * } * assert (r == w); * \endcode * It is your responsibility to ensure that \a data has enough space. * \param data - a buffer * \param size - a number of elements * \return \a data + \link mp_sizeof_array() mp_sizeof_array(size) \endlink * \sa mp_sizeof_array */ MP_PROTO char * mp_encode_array(char *data, uint32_t size); /** * \brief Check that \a cur buffer has enough bytes to decode an array header * \param cur buffer * \param end end of the buffer * \retval 0 - buffer has enough bytes * \retval > 0 - the number of remaining bytes to read * \pre cur < end * \pre mp_typeof(*cur) == MP_ARRAY */ MP_PROTO __attribute__((pure)) ptrdiff_t mp_check_array(const char *cur, const char *end); /** * \brief Decode an array header from MsgPack \a data. * * All array members must be decoded after the header. * \param data - the pointer to a buffer * \return the number of elements in an array * \post *data = *data + mp_sizeof_array(retval) * \sa \link mp_encode_array() An usage example \endlink */ MP_PROTO uint32_t mp_decode_array(const char **data); /** * \brief Calculate exact buffer size needed to store a map header of * \a size elements. Maximum return value is 5. For performance reasons you * can preallocate buffer for maximum size without calling the function. * \param size - a number of elements * \return buffer size in bytes (max is 5) */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_map(uint32_t size); /** * \brief Encode a map header of \a size elements. * * All map key-value pairs must be encoded after the header. * * Example usage: * \code * char buf[1024]; * * // Encode * char *w = buf; * w = mp_encode_map(b, 2); * w = mp_encode_str(b, "key1", 4); * w = mp_encode_str(b, "value1", 6); * w = mp_encode_str(b, "key2", 4); * w = mp_encode_str(b, "value2", 6); * * // Decode * const char *r = buf; * uint32_t size = mp_decode_map(&r); * for (uint32_t i = 0; i < size; i++) { * // Use switch(mp_typeof(**r)) to support more types * uint32_t key_len, val_len; * const char *key = mp_decode_str(&r, key_len); * const char *val = mp_decode_str(&r, val_len); * } * assert (r == w); * \endcode * It is your responsibility to ensure that \a data has enough space. * \param data - a buffer * \param size - a number of key/value pairs * \return \a data + \link mp_sizeof_map() mp_sizeof_map(size)\endlink * \sa mp_sizeof_map */ MP_PROTO char * mp_encode_map(char *data, uint32_t size); /** * \brief Check that \a cur buffer has enough bytes to decode a map header * \param cur buffer * \param end end of the buffer * \retval 0 - buffer has enough bytes * \retval > 0 - the number of remaining bytes to read * \pre cur < end * \pre mp_typeof(*cur) == MP_MAP */ MP_PROTO __attribute__((pure)) ptrdiff_t mp_check_map(const char *cur, const char *end); /** * \brief Decode a map header from MsgPack \a data. * * All map key-value pairs must be decoded after the header. * \param data - the pointer to a buffer * \return the number of key/value pairs in a map * \post *data = *data + mp_sizeof_array(retval) * \sa \link mp_encode_map() An usage example \endlink */ MP_PROTO uint32_t mp_decode_map(const char **data); /** * \brief Calculate exact buffer size needed to store an integer \a num. * Maximum return value is 9. For performance reasons you can preallocate * buffer for maximum size without calling the function. * Example usage: * \code * char **data = ...; * char *end = *data; * my_buffer_ensure(mp_sizeof_uint(x), &end); * // my_buffer_ensure(9, &end); * mp_encode_uint(buffer, x); * \endcode * \param num - a number * \return buffer size in bytes (max is 9) */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_uint(uint64_t num); /** * \brief Calculate exact buffer size needed to store an integer \a num. * Maximum return value is 9. For performance reasons you can preallocate * buffer for maximum size without calling the function. * \param num - a number * \return buffer size in bytes (max is 9) * \pre \a num < 0 */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_int(int64_t num); /** * \brief Encode an unsigned integer \a num. * It is your responsibility to ensure that \a data has enough space. * \param data - a buffer * \param num - a number * \return \a data + mp_sizeof_uint(\a num) * \sa \link mp_encode_array() An usage example \endlink * \sa mp_sizeof_uint() */ MP_PROTO char * mp_encode_uint(char *data, uint64_t num); /** * \brief Encode a signed integer \a num. * It is your responsibility to ensure that \a data has enough space. * \param data - a buffer * \param num - a number * \return \a data + mp_sizeof_int(\a num) * \sa \link mp_encode_array() An usage example \endlink * \sa mp_sizeof_int() * \pre \a num < 0 */ MP_PROTO char * mp_encode_int(char *data, int64_t num); /** * \brief Check that \a cur buffer has enough bytes to decode an uint * \param cur buffer * \param end end of the buffer * \retval 0 - buffer has enough bytes * \retval > 0 - the number of remaining bytes to read * \pre cur < end * \pre mp_typeof(*cur) == MP_UINT */ MP_PROTO __attribute__((pure)) ptrdiff_t mp_check_uint(const char *cur, const char *end); /** * \brief Check that \a cur buffer has enough bytes to decode an int * \param cur buffer * \param end end of the buffer * \retval 0 - buffer has enough bytes * \retval > 0 - the number of remaining bytes to read * \pre cur < end * \pre mp_typeof(*cur) == MP_INT */ MP_PROTO __attribute__((pure)) ptrdiff_t mp_check_int(const char *cur, const char *end); /** * \brief Decode an unsigned integer from MsgPack \a data * \param data - the pointer to a buffer * \return an unsigned number * \post *data = *data + mp_sizeof_uint(retval) */ MP_PROTO uint64_t mp_decode_uint(const char **data); /** * \brief Decode a signed integer from MsgPack \a data * \param data - the pointer to a buffer * \return an unsigned number * \post *data = *data + mp_sizeof_int(retval) */ MP_PROTO int64_t mp_decode_int(const char **data); /** * \brief Compare two packed unsigned integers. * * The function is faster than two mp_decode_uint() calls. * \param data_a unsigned int a * \param data_b unsigned int b * \retval < 0 when \a a < \a b * \retval 0 when \a a == \a b * \retval > 0 when \a a > \a b */ MP_PROTO __attribute__((pure)) int mp_compare_uint(const char *data_a, const char *data_b); /** * \brief Calculate exact buffer size needed to store a float \a num. * The return value is always 5. The function was added to provide integrity of * the library. * \param num - a float * \return buffer size in bytes (always 5) */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_float(float num); /** * \brief Calculate exact buffer size needed to store a double \a num. * The return value is either 5 or 9. The function was added to provide * integrity of the library. For performance reasons you can preallocate buffer * for maximum size without calling the function. * \param num - a double * \return buffer size in bytes (5 or 9) */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_double(double num); /** * \brief Encode a float \a num. * It is your responsibility to ensure that \a data has enough space. * \param data - a buffer * \param num - a float * \return \a data + mp_sizeof_float(\a num) * \sa mp_sizeof_float() * \sa \link mp_encode_array() An usage example \endlink */ MP_PROTO char * mp_encode_float(char *data, float num); /** * \brief Encode a double \a num. * It is your responsibility to ensure that \a data has enough space. * \param data - a buffer * \param num - a float * \return \a data + mp_sizeof_double(\a num) * \sa \link mp_encode_array() An usage example \endlink * \sa mp_sizeof_double() */ MP_PROTO char * mp_encode_double(char *data, double num); /** * \brief Check that \a cur buffer has enough bytes to decode a float * \param cur buffer * \param end end of the buffer * \retval 0 - buffer has enough bytes * \retval > 0 - the number of remaining bytes to read * \pre cur < end * \pre mp_typeof(*cur) == MP_FLOAT */ MP_PROTO __attribute__((pure)) ptrdiff_t mp_check_float(const char *cur, const char *end); /** * \brief Check that \a cur buffer has enough bytes to decode a double * \param cur buffer * \param end end of the buffer * \retval 0 - buffer has enough bytes * \retval > 0 - the number of remaining bytes to read * \pre cur < end * \pre mp_typeof(*cur) == MP_DOUBLE */ MP_PROTO __attribute__((pure)) ptrdiff_t mp_check_double(const char *cur, const char *end); /** * \brief Decode a float from MsgPack \a data * \param data - the pointer to a buffer * \return a float * \post *data = *data + mp_sizeof_float(retval) */ MP_PROTO float mp_decode_float(const char **data); /** * \brief Decode a double from MsgPack \a data * \param data - the pointer to a buffer * \return a double * \post *data = *data + mp_sizeof_double(retval) */ MP_PROTO double mp_decode_double(const char **data); /** * \brief Calculate exact buffer size needed to store a string header of * length \a num. Maximum return value is 5. For performance reasons you can * preallocate buffer for maximum size without calling the function. * \param len - a string length * \return size in chars (max is 5) */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_strl(uint32_t len); /** * \brief Equivalent to mp_sizeof_strl(\a len) + \a len. * \param len - a string length * \return size in chars (max is 5 + \a len) */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_str(uint32_t len); /** * \brief Calculate exact buffer size needed to store a binstring header of * length \a num. Maximum return value is 5. For performance reasons you can * preallocate buffer for maximum size without calling the function. * \param len - a string length * \return size in chars (max is 5) */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_binl(uint32_t len); /** * \brief Equivalent to mp_sizeof_binl(\a len) + \a len. * \param len - a string length * \return size in chars (max is 5 + \a len) */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_bin(uint32_t len); /** * \brief Encode a string header of length \a len. * * The function encodes MsgPack header (\em only header) for a string of * length \a len. You should append actual string data to the buffer manually * after encoding the header (exactly \a len bytes without trailing '\0'). * * This approach is very useful for cases when the total length of the string * is known in advance, but the string data is not stored in a single * continuous buffer (e.g. network packets). * * It is your responsibility to ensure that \a data has enough space. * Usage example: * \code * char buffer[1024]; * char *b = buffer; * b = mp_encode_strl(b, hdr.total_len); * char *s = b; * memcpy(b, pkt1.data, pkt1.len) * b += pkt1.len; * // get next packet * memcpy(b, pkt2.data, pkt2.len) * b += pkt2.len; * // get next packet * memcpy(b, pkt1.data, pkt3.len) * b += pkt3.len; * * // Check that all data was received * assert(hdr.total_len == (uint32_t) (b - s)) * \endcode * Hint: you can dynamically reallocate the buffer during the process. * \param data - a buffer * \param len - a string length * \return \a data + mp_sizeof_strl(len) * \sa mp_sizeof_strl() */ MP_PROTO char * mp_encode_strl(char *data, uint32_t len); /** * \brief Encode a string of length \a len. * The function is equivalent to mp_encode_strl() + memcpy. * \param data - a buffer * \param str - a pointer to string data * \param len - a string length * \return \a data + mp_sizeof_str(len) == * data + mp_sizeof_strl(len) + len * \sa mp_encode_strl */ MP_PROTO char * mp_encode_str(char *data, const char *str, uint32_t len); /** * \brief Encode a binstring header of length \a len. * See mp_encode_strl() for more details. * \param data - a bufer * \param len - a string length * \return data + mp_sizeof_binl(\a len) * \sa mp_encode_strl */ MP_PROTO char * mp_encode_binl(char *data, uint32_t len); /** * \brief Encode a binstring of length \a len. * The function is equivalent to mp_encode_binl() + memcpy. * \param data - a buffer * \param str - a pointer to binstring data * \param len - a binstring length * \return \a data + mp_sizeof_bin(\a len) == * data + mp_sizeof_binl(\a len) + \a len * \sa mp_encode_strl */ MP_PROTO char * mp_encode_bin(char *data, const char *str, uint32_t len); /** * \brief Encode a sequence of values according to format string. * Example: mp_format(buf, sz, "[%d {%d%s%d%s}]", 42, 0, "false", 1, "true"); * to get a msgpack array of two items: number 42 and map (0->"false, 2->"true") * Does not write items that don't fit to data_size argument. * * \param data - a buffer * \param data_size - a buffer size * \param format - zero-end string, containing structure of resulting * msgpack and types of next arguments. * Format can contain '[' and ']' pairs, defining arrays, * '{' and '}' pairs, defining maps, and format specifiers, described below: * %d, %i - int * %u - unsigned int * %ld, %li - long * %lu - unsigned long * %lld, %lli - long long * %llu - unsigned long long * %hd, %hi - short * %hu - unsigned short * %hhd, %hhi - char (as number) * %hhu - unsigned char (as number) * %f - float * %lf - double * %b - bool * %s - zero-end string * %.*s - string with specified length * %% is ignored * %smthelse assert and undefined behaviour * NIL - a nil value * all other symbols are ignored. * * \return the number of requred bytes. * \retval > data_size means that is not enough space * and whole msgpack was not encoded. */ MP_PROTO size_t mp_format(char *data, size_t data_size, const char *format, ...); /** * \brief mp_format variation, taking variable argument list * Example: * va_list args; * va_start(args, fmt); * mp_vformat(data, data_size, fmt, args); * va_end(args); * \sa \link mp_format() mp_format() \endlink */ MP_PROTO size_t mp_vformat(char *data, size_t data_size, const char *format, va_list args); /** * \brief print to \a file msgpacked data in JSON format. * MP_EXT is printed as "EXT" only * \param file - pointer to file (or NULL for stdout) * \param data - pointer to buffer containing msgpack object * \retval 0 - success * \retval -1 - wrong msgpack */ MP_PROTO int mp_fprint(FILE* file, const char *data); /** * \brief Check that \a cur buffer has enough bytes to decode a string header * \param cur buffer * \param end end of the buffer * \retval 0 - buffer has enough bytes * \retval > 0 - the number of remaining bytes to read * \pre cur < end * \pre mp_typeof(*cur) == MP_STR */ MP_PROTO __attribute__((pure)) ptrdiff_t mp_check_strl(const char *cur, const char *end); /** * \brief Check that \a cur buffer has enough bytes to decode a binstring header * \param cur buffer * \param end end of the buffer * \retval 0 - buffer has enough bytes * \retval > 0 - the number of remaining bytes to read * \pre cur < end * \pre mp_typeof(*cur) == MP_BIN */ MP_PROTO __attribute__((pure)) ptrdiff_t mp_check_binl(const char *cur, const char *end); /** * \brief Decode a length of a string from MsgPack \a data * \param data - the pointer to a buffer * \return a length of astring * \post *data = *data + mp_sizeof_strl(retval) * \sa mp_encode_strl */ MP_PROTO uint32_t mp_decode_strl(const char **data); /** * \brief Decode a string from MsgPack \a data * \param data - the pointer to a buffer * \param len - the pointer to save a string length * \return a pointer to a decoded string * \post *data = *data + mp_sizeof_str(*len) * \sa mp_encode_binl */ MP_PROTO const char * mp_decode_str(const char **data, uint32_t *len); /** * \brief Decode a length of a binstring from MsgPack \a data * \param data - the pointer to a buffer * \return a length of a binstring * \post *data = *data + mp_sizeof_binl(retval) * \sa mp_encode_binl */ MP_PROTO uint32_t mp_decode_binl(const char **data); /** * \brief Decode a binstring from MsgPack \a data * \param data - the pointer to a buffer * \param len - the pointer to save a binstring length * \return a pointer to a decoded binstring * \post *data = *data + mp_sizeof_str(*len) * \sa mp_encode_binl */ MP_PROTO const char * mp_decode_bin(const char **data, uint32_t *len); /** * \brief Decode a length of a string or binstring from MsgPack \a data * \param data - the pointer to a buffer * \return a length of a string * \post *data = *data + mp_sizeof_strbinl(retval) * \sa mp_encode_binl */ MP_PROTO uint32_t mp_decode_strbinl(const char **data); /** * \brief Decode a string or binstring from MsgPack \a data * \param data - the pointer to a buffer * \param len - the pointer to save a binstring length * \return a pointer to a decoded binstring * \post *data = *data + mp_sizeof_strbinl(*len) * \sa mp_encode_binl */ MP_PROTO const char * mp_decode_strbin(const char **data, uint32_t *len); /** * \brief Calculate exact buffer size needed to store the nil value. * The return value is always 1. The function was added to provide integrity of * the library. * \return buffer size in bytes (always 1) */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_nil(void); /** * \brief Encode the nil value. * It is your responsibility to ensure that \a data has enough space. * \param data - a buffer * \return \a data + mp_sizeof_nil() * \sa \link mp_encode_array() An usage example \endlink * \sa mp_sizeof_nil() */ MP_PROTO char * mp_encode_nil(char *data); /** * \brief Check that \a cur buffer has enough bytes to decode nil * \param cur buffer * \param end end of the buffer * \retval 0 - buffer has enough bytes * \retval > 0 - the number of remaining bytes to read * \pre cur < end * \pre mp_typeof(*cur) == MP_NIL */ MP_PROTO __attribute__((pure)) ptrdiff_t mp_check_nil(const char *cur, const char *end); /** * \brief Decode the nil value from MsgPack \a data * \param data - the pointer to a buffer * \post *data = *data + mp_sizeof_nil() */ MP_PROTO void mp_decode_nil(const char **data); /** * \brief Calculate exact buffer size needed to store a boolean value. * The return value is always 1. The function was added to provide integrity of * the library. * \return buffer size in bytes (always 1) */ MP_PROTO __attribute__((const)) uint32_t mp_sizeof_bool(bool val); /** * \brief Encode a bool value \a val. * It is your responsibility to ensure that \a data has enough space. * \param data - a buffer * \param val - a bool * \return \a data + mp_sizeof_bool(val) * \sa \link mp_encode_array() An usage example \endlink * \sa mp_sizeof_bool() */ MP_PROTO char * mp_encode_bool(char *data, bool val); /** * \brief Check that \a cur buffer has enough bytes to decode a bool value * \param cur buffer * \param end end of the buffer * \retval 0 - buffer has enough bytes * \retval > 0 - the number of remaining bytes to read * \pre cur < end * \pre mp_typeof(*cur) == MP_BOOL */ MP_PROTO __attribute__((pure)) ptrdiff_t mp_check_bool(const char *cur, const char *end); /** * \brief Decode a bool value from MsgPack \a data * \param data - the pointer to a buffer * \return a decoded bool value * \post *data = *data + mp_sizeof_bool(retval) */ MP_PROTO bool mp_decode_bool(const char **data); /** * \brief Skip one element in a packed \a data. * * The function is faster than mp_typeof + mp_decode_XXX() combination. * For arrays and maps the function also skips all members. * For strings and binstrings the function also skips the string data. * * Usage example: * \code * char buf[1024]; * * char *w = buf; * // First MsgPack object * w = mp_encode_uint(w, 10); * * // Second MsgPack object * w = mp_encode_array(w, 4); * w = mp_encode_array(w, 2); * // Begin of an inner array * w = mp_encode_str(w, "second inner 1", 14); * w = mp_encode_str(w, "second inner 2", 14); * // End of an inner array * w = mp_encode_str(w, "second", 6); * w = mp_encode_uint(w, 20); * w = mp_encode_bool(w, true); * * // Third MsgPack object * w = mp_encode_str(w, "third", 5); * // EOF * * const char *r = buf; * * // First MsgPack object * assert(mp_typeof(**r) == MP_UINT); * mp_next(&r); // skip the first object * * // Second MsgPack object * assert(mp_typeof(**r) == MP_ARRAY); * mp_decode_array(&r); * assert(mp_typeof(**r) == MP_ARRAY); // inner array * mp_next(&r); // -->> skip the entire inner array (with all members) * assert(mp_typeof(**r) == MP_STR); // second * mp_next(&r); * assert(mp_typeof(**r) == MP_UINT); // 20 * mp_next(&r); * assert(mp_typeof(**r) == MP_BOOL); // true * mp_next(&r); * * // Third MsgPack object * assert(mp_typeof(**r) == MP_STR); // third * mp_next(&r); * * assert(r == w); // EOF * * \endcode * \param data - the pointer to a buffer * \post *data = *data + mp_sizeof_TYPE() where TYPE is mp_typeof(**data) */ MP_PROTO void mp_next(const char **data); /** * \brief Equivalent to mp_next() but also validates MsgPack in \a data. * \param data - the pointer to a buffer * \param end - the end of a buffer * \retval 0 when MsgPack in \a data is valid. * \retval != 0 when MsgPack in \a data is not valid. * \post *data = *data + mp_sizeof_TYPE() where TYPE is mp_typeof(**data) * \post *data is not defined if MsgPack is not valid * \sa mp_next() */ MP_PROTO int mp_check(const char **data, const char *end); /* * }}} */ /* * {{{ Implementation */ /** \cond false */ extern const enum mp_type mp_type_hint[]; extern const int8_t mp_parser_hint[]; extern const char *mp_char2escape[]; MP_IMPL MP_ALWAYSINLINE enum mp_type mp_typeof(const char c) { return mp_type_hint[(uint8_t) c]; } MP_IMPL uint32_t mp_sizeof_array(uint32_t size) { if (size <= 15) { return 1; } else if (size <= UINT16_MAX) { return 1 + sizeof(uint16_t); } else { return 1 + sizeof(uint32_t); } } MP_IMPL char * mp_encode_array(char *data, uint32_t size) { if (size <= 15) { return mp_store_u8(data, 0x90 | size); } else if (size <= UINT16_MAX) { data = mp_store_u8(data, 0xdc); data = mp_store_u16(data, size); return data; } else { data = mp_store_u8(data, 0xdd); return mp_store_u32(data, size); } } MP_IMPL ptrdiff_t mp_check_array(const char *cur, const char *end) { assert(cur < end); assert(mp_typeof(*cur) == MP_ARRAY); uint8_t c = mp_load_u8(&cur); if (mp_likely(!(c & 0x40))) return cur - end; assert(c >= 0xdc && c <= 0xdd); /* must be checked above by mp_typeof */ uint32_t hsize = 2U << (c & 0x1); /* 0xdc->2, 0xdd->4 */ return hsize - (end - cur); } MP_PROTO uint32_t mp_decode_array_slowpath(uint8_t c, const char **data); MP_IMPL uint32_t mp_decode_array_slowpath(uint8_t c, const char **data) { uint32_t size; switch (c & 0x1) { case 0xdc & 0x1: size = mp_load_u16(data); return size; case 0xdd & 0x1: size = mp_load_u32(data); return size; default: mp_unreachable(); } } MP_IMPL MP_ALWAYSINLINE uint32_t mp_decode_array(const char **data) { uint8_t c = mp_load_u8(data); if (mp_likely(!(c & 0x40))) return (c & 0xf); return mp_decode_array_slowpath(c, data); } MP_IMPL uint32_t mp_sizeof_map(uint32_t size) { if (size <= 15) { return 1; } else if (size <= UINT16_MAX) { return 1 + sizeof(uint16_t); } else { return 1 + sizeof(uint32_t); } } MP_IMPL char * mp_encode_map(char *data, uint32_t size) { if (size <= 15) { return mp_store_u8(data, 0x80 | size); } else if (size <= UINT16_MAX) { data = mp_store_u8(data, 0xde); data = mp_store_u16(data, size); return data; } else { data = mp_store_u8(data, 0xdf); data = mp_store_u32(data, size); return data; } } MP_IMPL ptrdiff_t mp_check_map(const char *cur, const char *end) { assert(cur < end); assert(mp_typeof(*cur) == MP_MAP); uint8_t c = mp_load_u8(&cur); if (mp_likely((c & ~0xfU) == 0x80)) return cur - end; assert(c >= 0xde && c <= 0xdf); /* must be checked above by mp_typeof */ uint32_t hsize = 2U << (c & 0x1); /* 0xde->2, 0xdf->4 */ return hsize - (end - cur); } MP_IMPL uint32_t mp_decode_map(const char **data) { uint8_t c = mp_load_u8(data); switch (c) { case 0xde: return mp_load_u16(data); case 0xdf: return mp_load_u32(data); default: if (mp_unlikely(c < 0x80 || c > 0x8f)) mp_unreachable(); return c & 0xf; } } MP_IMPL uint32_t mp_sizeof_uint(uint64_t num) { if (num <= 0x7f) { return 1; } else if (num <= UINT8_MAX) { return 1 + sizeof(uint8_t); } else if (num <= UINT16_MAX) { return 1 + sizeof(uint16_t); } else if (num <= UINT32_MAX) { return 1 + sizeof(uint32_t); } else { return 1 + sizeof(uint64_t); } } MP_IMPL uint32_t mp_sizeof_int(int64_t num) { assert(num < 0); if (num >= -0x20) { return 1; } else if (num >= INT8_MIN && num <= INT8_MAX) { return 1 + sizeof(int8_t); } else if (num >= INT16_MIN && num <= UINT16_MAX) { return 1 + sizeof(int16_t); } else if (num >= INT32_MIN && num <= UINT32_MAX) { return 1 + sizeof(int32_t); } else { return 1 + sizeof(int64_t); } } MP_IMPL ptrdiff_t mp_check_uint(const char *cur, const char *end) { assert(cur < end); assert(mp_typeof(*cur) == MP_UINT); uint8_t c = mp_load_u8(&cur); return mp_parser_hint[c] - (end - cur); } MP_IMPL ptrdiff_t mp_check_int(const char *cur, const char *end) { assert(cur < end); assert(mp_typeof(*cur) == MP_INT); uint8_t c = mp_load_u8(&cur); return mp_parser_hint[c] - (end - cur); } MP_IMPL char * mp_encode_uint(char *data, uint64_t num) { if (num <= 0x7f) { return mp_store_u8(data, num); } else if (num <= UINT8_MAX) { data = mp_store_u8(data, 0xcc); return mp_store_u8(data, num); } else if (num <= UINT16_MAX) { data = mp_store_u8(data, 0xcd); return mp_store_u16(data, num); } else if (num <= UINT32_MAX) { data = mp_store_u8(data, 0xce); return mp_store_u32(data, num); } else { data = mp_store_u8(data, 0xcf); return mp_store_u64(data, num); } } MP_IMPL char * mp_encode_int(char *data, int64_t num) { assert(num < 0); if (num >= -0x20) { return mp_store_u8(data, 0xe0 | num); } else if (num >= INT8_MIN) { data = mp_store_u8(data, 0xd0); return mp_store_u8(data, num); } else if (num >= INT16_MIN) { data = mp_store_u8(data, 0xd1); return mp_store_u16(data, num); } else if (num >= INT32_MIN) { data = mp_store_u8(data, 0xd2); return mp_store_u32(data, num); } else { data = mp_store_u8(data, 0xd3); return mp_store_u64(data, num); } } MP_IMPL uint64_t mp_decode_uint(const char **data) { uint8_t c = mp_load_u8(data); switch (c) { case 0xcc: return mp_load_u8(data); case 0xcd: return mp_load_u16(data); case 0xce: return mp_load_u32(data); case 0xcf: return mp_load_u64(data); default: if (mp_unlikely(c > 0x7f)) mp_unreachable(); return c; } } MP_IMPL int mp_compare_uint(const char *data_a, const char *data_b) { uint8_t ca = mp_load_u8(&data_a); uint8_t cb = mp_load_u8(&data_b); int r = ca - cb; if (r != 0) return r; if (ca <= 0x7f) return 0; uint64_t a, b; switch (ca & 0x3) { case 0xcc & 0x3: a = mp_load_u8(&data_a); b = mp_load_u8(&data_b); break; case 0xcd & 0x3: a = mp_load_u16(&data_a); b = mp_load_u16(&data_b); break; case 0xce & 0x3: a = mp_load_u32(&data_a); b = mp_load_u32(&data_b); break; case 0xcf & 0x3: a = mp_load_u64(&data_a); b = mp_load_u64(&data_b); return a < b ? -1 : a > b; break; default: mp_unreachable(); } int64_t v = (a - b); return (v > 0) - (v < 0); } MP_IMPL int64_t mp_decode_int(const char **data) { uint8_t c = mp_load_u8(data); switch (c) { case 0xd0: return (int8_t) mp_load_u8(data); case 0xd1: return (int16_t) mp_load_u16(data); case 0xd2: return (int32_t) mp_load_u32(data); case 0xd3: return (int64_t) mp_load_u64(data); default: if (mp_unlikely(c < 0xe0)) mp_unreachable(); return (int8_t) (c); } } MP_IMPL uint32_t mp_sizeof_float(float num) { (void) num; return 1 + sizeof(float); } MP_IMPL uint32_t mp_sizeof_double(double num) { (void) num; return 1 + sizeof(double); } MP_IMPL ptrdiff_t mp_check_float(const char *cur, const char *end) { assert(cur < end); assert(mp_typeof(*cur) == MP_FLOAT); return 1 + sizeof(float) - (end - cur); } MP_IMPL ptrdiff_t mp_check_double(const char *cur, const char *end) { assert(cur < end); assert(mp_typeof(*cur) == MP_DOUBLE); return 1 + sizeof(double) - (end - cur); } MP_IMPL char * mp_encode_float(char *data, float num) { data = mp_store_u8(data, 0xca); return mp_store_float(data, num); } MP_IMPL char * mp_encode_double(char *data, double num) { data = mp_store_u8(data, 0xcb); return mp_store_double(data, num); } MP_IMPL float mp_decode_float(const char **data) { uint8_t c = mp_load_u8(data); assert(c == 0xca); (void) c; return mp_load_float(data); } MP_IMPL double mp_decode_double(const char **data) { uint8_t c = mp_load_u8(data); assert(c == 0xcb); (void) c; return mp_load_double(data); } MP_IMPL uint32_t mp_sizeof_strl(uint32_t len) { if (len <= 31) { return 1; } else if (len <= UINT8_MAX) { return 1 + sizeof(uint8_t); } else if (len <= UINT16_MAX) { return 1 + sizeof(uint16_t); } else { return 1 + sizeof(uint32_t); } } MP_IMPL uint32_t mp_sizeof_str(uint32_t len) { return mp_sizeof_strl(len) + len; } MP_IMPL uint32_t mp_sizeof_binl(uint32_t len) { if (len <= UINT8_MAX) { return 1 + sizeof(uint8_t); } else if (len <= UINT16_MAX) { return 1 + sizeof(uint16_t); } else { return 1 + sizeof(uint32_t); } } MP_IMPL uint32_t mp_sizeof_bin(uint32_t len) { return mp_sizeof_binl(len) + len; } MP_IMPL char * mp_encode_strl(char *data, uint32_t len) { if (len <= 31) { return mp_store_u8(data, 0xa0 | (uint8_t) len); } else if (len <= UINT8_MAX) { data = mp_store_u8(data, 0xd9); return mp_store_u8(data, len); } else if (len <= UINT16_MAX) { data = mp_store_u8(data, 0xda); return mp_store_u16(data, len); } else { data = mp_store_u8(data, 0xdb); return mp_store_u32(data, len); } } MP_IMPL char * mp_encode_str(char *data, const char *str, uint32_t len) { data = mp_encode_strl(data, len); memcpy(data, str, len); return data + len; } MP_IMPL char * mp_encode_binl(char *data, uint32_t len) { if (len <= UINT8_MAX) { data = mp_store_u8(data, 0xc4); return mp_store_u8(data, len); } else if (len <= UINT16_MAX) { data = mp_store_u8(data, 0xc5); return mp_store_u16(data, len); } else { data = mp_store_u8(data, 0xc6); return mp_store_u32(data, len); } } MP_IMPL char * mp_encode_bin(char *data, const char *str, uint32_t len) { data = mp_encode_binl(data, len); memcpy(data, str, len); return data + len; } MP_IMPL ptrdiff_t mp_check_strl(const char *cur, const char *end) { assert(cur < end); assert(mp_typeof(*cur) == MP_STR); uint8_t c = mp_load_u8(&cur); if (mp_likely(c & ~0x1f) == 0xa0) return cur - end; assert(c >= 0xd9 && c <= 0xdb); /* must be checked above by mp_typeof */ uint32_t hsize = 1U << (c & 0x3) >> 1; /* 0xd9->1, 0xda->2, 0xdb->4 */ return hsize - (end - cur); } MP_IMPL ptrdiff_t mp_check_binl(const char *cur, const char *end) { uint8_t c = mp_load_u8(&cur); assert(cur < end); assert(mp_typeof(c) == MP_BIN); assert(c >= 0xc4 && c <= 0xc6); /* must be checked above by mp_typeof */ uint32_t hsize = 1U << (c & 0x3); /* 0xc4->1, 0xc5->2, 0xc6->4 */ return hsize - (end - cur); } MP_IMPL uint32_t mp_decode_strl(const char **data) { uint8_t c = mp_load_u8(data); switch (c) { case 0xd9: return mp_load_u8(data); case 0xda: return mp_load_u16(data); case 0xdb: return mp_load_u32(data); default: if (mp_unlikely(c < 0xa0 || c > 0xbf)) mp_unreachable(); return c & 0x1f; } } MP_IMPL const char * mp_decode_str(const char **data, uint32_t *len) { assert(len != NULL); *len = mp_decode_strl(data); const char *str = *data; *data += *len; return str; } MP_IMPL uint32_t mp_decode_binl(const char **data) { uint8_t c = mp_load_u8(data); switch (c) { case 0xc4: return mp_load_u8(data); case 0xc5: return mp_load_u16(data); case 0xc6: return mp_load_u32(data); default: mp_unreachable(); } } MP_IMPL const char * mp_decode_bin(const char **data, uint32_t *len) { assert(len != NULL); *len = mp_decode_binl(data); const char *str = *data; *data += *len; return str; } MP_IMPL uint32_t mp_decode_strbinl(const char **data) { uint8_t c = mp_load_u8(data); switch (c) { case 0xd9: return mp_load_u8(data); case 0xda: return mp_load_u16(data); case 0xdb: return mp_load_u32(data); case 0xc4: return mp_load_u8(data); case 0xc5: return mp_load_u16(data); case 0xc6: return mp_load_u32(data); default: if (mp_unlikely(c < 0xa0 || c > 0xbf)) mp_unreachable(); return c & 0x1f; } } MP_IMPL const char * mp_decode_strbin(const char **data, uint32_t *len) { assert(len != NULL); *len = mp_decode_strbinl(data); const char *str = *data; *data += *len; return str; } MP_IMPL uint32_t mp_sizeof_nil() { return 1; } MP_IMPL char * mp_encode_nil(char *data) { return mp_store_u8(data, 0xc0); } MP_IMPL ptrdiff_t mp_check_nil(const char *cur, const char *end) { assert(cur < end); assert(mp_typeof(*cur) == MP_NIL); return 1 - (end - cur); } MP_IMPL void mp_decode_nil(const char **data) { uint8_t c = mp_load_u8(data); assert(c == 0xc0); (void) c; } MP_IMPL uint32_t mp_sizeof_bool(bool val) { (void) val; return 1; } MP_IMPL char * mp_encode_bool(char *data, bool val) { return mp_store_u8(data, 0xc2 | (val & 1)); } MP_IMPL ptrdiff_t mp_check_bool(const char *cur, const char *end) { assert(cur < end); assert(mp_typeof(*cur) == MP_BOOL); return 1 - (end - cur); } MP_IMPL bool mp_decode_bool(const char **data) { uint8_t c = mp_load_u8(data); switch (c) { case 0xc3: return true; case 0xc2: return false; default: mp_unreachable(); } } /** See mp_parser_hint */ enum { MP_HINT = -32, MP_HINT_STR_8 = MP_HINT, MP_HINT_STR_16 = MP_HINT - 1, MP_HINT_STR_32 = MP_HINT - 2, MP_HINT_ARRAY_16 = MP_HINT - 3, MP_HINT_ARRAY_32 = MP_HINT - 4, MP_HINT_MAP_16 = MP_HINT - 5, MP_HINT_MAP_32 = MP_HINT - 6, MP_HINT_EXT_8 = MP_HINT - 7, MP_HINT_EXT_16 = MP_HINT - 8, MP_HINT_EXT_32 = MP_HINT - 9 }; MP_PROTO void mp_next_slowpath(const char **data, int k); MP_IMPL void mp_next_slowpath(const char **data, int k) { for (; k > 0; k--) { uint8_t c = mp_load_u8(data); int l = mp_parser_hint[c]; if (mp_likely(l >= 0)) { *data += l; continue; } else if (mp_likely(l > MP_HINT)) { k -= l; continue; } uint32_t len; switch (l) { case MP_HINT_STR_8: /* MP_STR (8) */ len = mp_load_u8(data); *data += len; break; case MP_HINT_STR_16: /* MP_STR (16) */ len = mp_load_u16(data); *data += len; break; case MP_HINT_STR_32: /* MP_STR (32) */ len = mp_load_u32(data); *data += len; break; case MP_HINT_ARRAY_16: /* MP_ARRAY (16) */ k += mp_load_u16(data); break; case MP_HINT_ARRAY_32: /* MP_ARRAY (32) */ k += mp_load_u32(data); break; case MP_HINT_MAP_16: /* MP_MAP (16) */ k += 2 * mp_load_u16(data); break; case MP_HINT_MAP_32: /* MP_MAP (32) */ k += 2 * mp_load_u32(data); break; case MP_HINT_EXT_8: /* MP_EXT (8) */ len = mp_load_u8(data); mp_load_u8(data); *data += len; break; case MP_HINT_EXT_16: /* MP_EXT (16) */ len = mp_load_u16(data); mp_load_u8(data); *data += len; break; case MP_HINT_EXT_32: /* MP_EXT (32) */ len = mp_load_u32(data); mp_load_u8(data); *data += len; break; default: mp_unreachable(); } } } MP_IMPL void mp_next(const char **data) { int k = 1; for (; k > 0; k--) { uint8_t c = mp_load_u8(data); int l = mp_parser_hint[c]; if (mp_likely(l >= 0)) { *data += l; continue; } else if (mp_likely(c == 0xd9)){ /* MP_STR (8) */ uint8_t len = mp_load_u8(data); *data += len; continue; } else if (l > MP_HINT) { k -= l; continue; } else { *data -= sizeof(uint8_t); return mp_next_slowpath(data, k); } } } MP_IMPL int mp_check(const char **data, const char *end) { int k; for (k = 1; k > 0; k--) { if (mp_unlikely(*data >= end)) return 1; uint8_t c = mp_load_u8(data); int l = mp_parser_hint[c]; if (mp_likely(l >= 0)) { *data += l; continue; } else if (mp_likely(l > MP_HINT)) { k -= l; continue; } uint32_t len; switch (l) { case MP_HINT_STR_8: /* MP_STR (8) */ if (mp_unlikely(*data + sizeof(uint8_t) > end)) return 1; len = mp_load_u8(data); *data += len; break; case MP_HINT_STR_16: /* MP_STR (16) */ if (mp_unlikely(*data + sizeof(uint16_t) > end)) return 1; len = mp_load_u16(data); *data += len; break; case MP_HINT_STR_32: /* MP_STR (32) */ if (mp_unlikely(*data + sizeof(uint32_t) > end)) return 1; len = mp_load_u32(data); *data += len; break; case MP_HINT_ARRAY_16: /* MP_ARRAY (16) */ if (mp_unlikely(*data + sizeof(uint16_t) > end)) return 1; k += mp_load_u16(data); break; case MP_HINT_ARRAY_32: /* MP_ARRAY (32) */ if (mp_unlikely(*data + sizeof(uint32_t) > end)) return 1; k += mp_load_u32(data); break; case MP_HINT_MAP_16: /* MP_MAP (16) */ if (mp_unlikely(*data + sizeof(uint16_t) > end)) return false; k += 2 * mp_load_u16(data); break; case MP_HINT_MAP_32: /* MP_MAP (32) */ if (mp_unlikely(*data + sizeof(uint32_t) > end)) return 1; k += 2 * mp_load_u32(data); break; case MP_HINT_EXT_8: /* MP_EXT (8) */ if (mp_unlikely(*data + sizeof(uint8_t) + 1 > end)) return 1; len = mp_load_u8(data); mp_load_u8(data); *data += len; break; case MP_HINT_EXT_16: /* MP_EXT (16) */ if (mp_unlikely(*data + sizeof(uint16_t) + 1 > end)) return 1; len = mp_load_u16(data); mp_load_u8(data); *data += len; break; case MP_HINT_EXT_32: /* MP_EXT (32) */ if (mp_unlikely(*data + sizeof(uint32_t) + 1 > end)) return 1; len = mp_load_u32(data); mp_load_u8(data); *data += len; break; default: mp_unreachable(); } } if (mp_unlikely(*data > end)) return 1; return 0; } MP_IMPL size_t mp_vformat(char *data, size_t data_size, const char *format, va_list vl) { size_t result = 0; const char *f = NULL; for (f = format; *f; f++) { if (f[0] == '[') { uint32_t size = 0; int level = 1; const char *e = NULL; for (e = f + 1; level && *e; e++) { if (*e == '[' || *e == '{') { if (level == 1) size++; level++; } else if (*e == ']' || *e == '}') { level--; /* opened '[' must be closed by ']' */ assert(level || *e == ']'); } else if (*e == '%') { if (e[1] == '%') e++; else if (level == 1) size++; } else if (*e == 'N' && e[1] == 'I' && e[2] == 'L' && level == 1) { size++; } } /* opened '[' must be closed */ assert(level == 0); result += mp_sizeof_array(size); if (result <= data_size) data = mp_encode_array(data, size); } else if (f[0] == '{') { uint32_t count = 0; int level = 1; const char *e = NULL; for (e = f + 1; level && *e; e++) { if (*e == '[' || *e == '{') { if (level == 1) count++; level++; } else if (*e == ']' || *e == '}') { level--; /* opened '{' must be closed by '}' */ assert(level || *e == '}'); } else if (*e == '%') { if (e[1] == '%') e++; else if (level == 1) count++; } else if (*e == 'N' && e[1] == 'I' && e[2] == 'L' && level == 1) { count++; } } /* opened '{' must be closed */ assert(level == 0); /* since map is a pair list, count must be even */ assert(count % 2 == 0); uint32_t size = count / 2; result += mp_sizeof_map(size); if (result <= data_size) data = mp_encode_map(data, size); } else if (f[0] == '%') { f++; assert(f[0]); int64_t int_value = 0; int int_status = 0; /* 1 - signed, 2 - unsigned */ if (f[0] == 'd' || f[0] == 'i') { int_value = va_arg(vl, int); int_status = 1; } else if (f[0] == 'u') { int_value = va_arg(vl, unsigned int); int_status = 2; } else if (f[0] == 's') { const char *str = va_arg(vl, const char *); uint32_t len = (uint32_t)strlen(str); result += mp_sizeof_str(len); if (result <= data_size) data = mp_encode_str(data, str, len); } else if (f[0] == '.' && f[1] == '*' && f[2] == 's') { uint32_t len = va_arg(vl, uint32_t); const char *str = va_arg(vl, const char *); result += mp_sizeof_str(len); if (result <= data_size) data = mp_encode_str(data, str, len); f += 2; } else if(f[0] == 'f') { float v = (float)va_arg(vl, double); result += mp_sizeof_float(v); if (result <= data_size) data = mp_encode_float(data, v); } else if(f[0] == 'l' && f[1] == 'f') { double v = va_arg(vl, double); result += mp_sizeof_double(v); if (result <= data_size) data = mp_encode_double(data, v); f++; } else if(f[0] == 'b') { bool v = (bool)va_arg(vl, int); result += mp_sizeof_bool(v); if (result <= data_size) data = mp_encode_bool(data, v); } else if (f[0] == 'l' && (f[1] == 'd' || f[1] == 'i')) { int_value = va_arg(vl, long); int_status = 1; f++; } else if (f[0] == 'l' && f[1] == 'u') { int_value = va_arg(vl, unsigned long); int_status = 2; f++; } else if (f[0] == 'l' && f[1] == 'l' && (f[2] == 'd' || f[2] == 'i')) { int_value = va_arg(vl, long long); int_status = 1; f += 2; } else if (f[0] == 'l' && f[1] == 'l' && f[2] == 'u') { int_value = va_arg(vl, unsigned long long); int_status = 2; f += 2; } else if (f[0] == 'h' && (f[1] == 'd' || f[1] == 'i')) { int_value = va_arg(vl, int); int_status = 1; f++; } else if (f[0] == 'h' && f[1] == 'u') { int_value = va_arg(vl, unsigned int); int_status = 2; f++; } else if (f[0] == 'h' && f[1] == 'h' && (f[2] == 'd' || f[2] == 'i')) { int_value = va_arg(vl, int); int_status = 1; f += 2; } else if (f[0] == 'h' && f[1] == 'h' && f[2] == 'u') { int_value = va_arg(vl, unsigned int); int_status = 2; f += 2; } else if (f[0] != '%') { /* unexpected format specifier */ assert(false); } if (int_status == 1 && int_value < 0) { result += mp_sizeof_int(int_value); if (result <= data_size) data = mp_encode_int(data, int_value); } else if(int_status) { result += mp_sizeof_uint(int_value); if (result <= data_size) data = mp_encode_uint(data, int_value); } } else if (f[0] == 'N' && f[1] == 'I' && f[2] == 'L') { result += mp_sizeof_nil(); if (result <= data_size) data = mp_encode_nil(data); f += 2; } } return result; } MP_IMPL size_t mp_format(char *data, size_t data_size, const char *format, ...) { va_list args; va_start(args, format); size_t res = mp_vformat(data, data_size, format, args); va_end(args); return res; } MP_PROTO int mp_fprint_internal(FILE *file, const char **data); MP_IMPL int mp_fprint_internal(FILE *file, const char **data) { #define _CHECK_RC(exp) do { if (mp_unlikely((exp) < 0)) return -1; } while(0) switch (mp_typeof(**data)) { case MP_NIL: mp_decode_nil(data); _CHECK_RC(fputs("null", file)); break; case MP_UINT: _CHECK_RC(fprintf(file, "%llu", (unsigned long long) mp_decode_uint(data))); break; case MP_INT: _CHECK_RC(fprintf(file, "%lld", (long long) mp_decode_int(data))); break; case MP_STR: case MP_BIN: { uint32_t len = mp_typeof(**data) == MP_STR ? mp_decode_strl(data) : mp_decode_binl(data); _CHECK_RC(fputc('"', file)); const char *s; for (s = *data; s < *data + len; s++) { unsigned char c = (unsigned char ) *s; if (c < 128 && mp_char2escape[c] != NULL) { /* Escape character */ _CHECK_RC(fputs(mp_char2escape[c], file)); } else { _CHECK_RC(fputc(c, file)); } } _CHECK_RC(fputc('"', file)); *data += len; break; } case MP_ARRAY: { uint32_t size = mp_decode_array(data); _CHECK_RC(fputc('[', file)); uint32_t i; for (i = 0; i < size; i++) { if (i) _CHECK_RC(fputs(", ", file)); _CHECK_RC(mp_fprint_internal(file, data)); } _CHECK_RC(fputc(']', file)); break; } case MP_MAP: { uint32_t size = mp_decode_map(data); _CHECK_RC(fputc('{', file)); uint32_t i; for (i = 0; i < size; i++) { if (i) _CHECK_RC(fprintf(file, ", ")); _CHECK_RC(mp_fprint_internal(file, data)); _CHECK_RC(fputs(": ", file)); _CHECK_RC(mp_fprint_internal(file, data)); } _CHECK_RC(fputc('}', file)); break; } case MP_BOOL: _CHECK_RC(fputs(mp_decode_bool(data) ? "true" : "false", file)); break; case MP_FLOAT: _CHECK_RC(fprintf(file, "%g", mp_decode_float(data))); break; case MP_DOUBLE: _CHECK_RC(fprintf(file, "%lg", mp_decode_double(data))); break; case MP_EXT: mp_next(data); _CHECK_RC(fputs("undefined", file)); break; default: mp_unreachable(); return -1; } return 0; #undef _CHECK_RC } MP_IMPL int mp_fprint(FILE *file, const char *data) { if (!file) file = stdout; int res = mp_fprint_internal(file, &data); return res; } /** \endcond */ /* * }}} */ /* * {{{ Implementation: parser tables */ /** \cond false */ #if defined(MP_SOURCE) /** * This lookup table used by mp_sizeof() to determine enum mp_type by the first * byte of MsgPack element. */ const enum mp_type mp_type_hint[256]= { /* {{{ MP_UINT (fixed) */ /* 0x00 */ MP_UINT, /* 0x01 */ MP_UINT, /* 0x02 */ MP_UINT, /* 0x03 */ MP_UINT, /* 0x04 */ MP_UINT, /* 0x05 */ MP_UINT, /* 0x06 */ MP_UINT, /* 0x07 */ MP_UINT, /* 0x08 */ MP_UINT, /* 0x09 */ MP_UINT, /* 0x0a */ MP_UINT, /* 0x0b */ MP_UINT, /* 0x0c */ MP_UINT, /* 0x0d */ MP_UINT, /* 0x0e */ MP_UINT, /* 0x0f */ MP_UINT, /* 0x10 */ MP_UINT, /* 0x11 */ MP_UINT, /* 0x12 */ MP_UINT, /* 0x13 */ MP_UINT, /* 0x14 */ MP_UINT, /* 0x15 */ MP_UINT, /* 0x16 */ MP_UINT, /* 0x17 */ MP_UINT, /* 0x18 */ MP_UINT, /* 0x19 */ MP_UINT, /* 0x1a */ MP_UINT, /* 0x1b */ MP_UINT, /* 0x1c */ MP_UINT, /* 0x1d */ MP_UINT, /* 0x1e */ MP_UINT, /* 0x1f */ MP_UINT, /* 0x20 */ MP_UINT, /* 0x21 */ MP_UINT, /* 0x22 */ MP_UINT, /* 0x23 */ MP_UINT, /* 0x24 */ MP_UINT, /* 0x25 */ MP_UINT, /* 0x26 */ MP_UINT, /* 0x27 */ MP_UINT, /* 0x28 */ MP_UINT, /* 0x29 */ MP_UINT, /* 0x2a */ MP_UINT, /* 0x2b */ MP_UINT, /* 0x2c */ MP_UINT, /* 0x2d */ MP_UINT, /* 0x2e */ MP_UINT, /* 0x2f */ MP_UINT, /* 0x30 */ MP_UINT, /* 0x31 */ MP_UINT, /* 0x32 */ MP_UINT, /* 0x33 */ MP_UINT, /* 0x34 */ MP_UINT, /* 0x35 */ MP_UINT, /* 0x36 */ MP_UINT, /* 0x37 */ MP_UINT, /* 0x38 */ MP_UINT, /* 0x39 */ MP_UINT, /* 0x3a */ MP_UINT, /* 0x3b */ MP_UINT, /* 0x3c */ MP_UINT, /* 0x3d */ MP_UINT, /* 0x3e */ MP_UINT, /* 0x3f */ MP_UINT, /* 0x40 */ MP_UINT, /* 0x41 */ MP_UINT, /* 0x42 */ MP_UINT, /* 0x43 */ MP_UINT, /* 0x44 */ MP_UINT, /* 0x45 */ MP_UINT, /* 0x46 */ MP_UINT, /* 0x47 */ MP_UINT, /* 0x48 */ MP_UINT, /* 0x49 */ MP_UINT, /* 0x4a */ MP_UINT, /* 0x4b */ MP_UINT, /* 0x4c */ MP_UINT, /* 0x4d */ MP_UINT, /* 0x4e */ MP_UINT, /* 0x4f */ MP_UINT, /* 0x50 */ MP_UINT, /* 0x51 */ MP_UINT, /* 0x52 */ MP_UINT, /* 0x53 */ MP_UINT, /* 0x54 */ MP_UINT, /* 0x55 */ MP_UINT, /* 0x56 */ MP_UINT, /* 0x57 */ MP_UINT, /* 0x58 */ MP_UINT, /* 0x59 */ MP_UINT, /* 0x5a */ MP_UINT, /* 0x5b */ MP_UINT, /* 0x5c */ MP_UINT, /* 0x5d */ MP_UINT, /* 0x5e */ MP_UINT, /* 0x5f */ MP_UINT, /* 0x60 */ MP_UINT, /* 0x61 */ MP_UINT, /* 0x62 */ MP_UINT, /* 0x63 */ MP_UINT, /* 0x64 */ MP_UINT, /* 0x65 */ MP_UINT, /* 0x66 */ MP_UINT, /* 0x67 */ MP_UINT, /* 0x68 */ MP_UINT, /* 0x69 */ MP_UINT, /* 0x6a */ MP_UINT, /* 0x6b */ MP_UINT, /* 0x6c */ MP_UINT, /* 0x6d */ MP_UINT, /* 0x6e */ MP_UINT, /* 0x6f */ MP_UINT, /* 0x70 */ MP_UINT, /* 0x71 */ MP_UINT, /* 0x72 */ MP_UINT, /* 0x73 */ MP_UINT, /* 0x74 */ MP_UINT, /* 0x75 */ MP_UINT, /* 0x76 */ MP_UINT, /* 0x77 */ MP_UINT, /* 0x78 */ MP_UINT, /* 0x79 */ MP_UINT, /* 0x7a */ MP_UINT, /* 0x7b */ MP_UINT, /* 0x7c */ MP_UINT, /* 0x7d */ MP_UINT, /* 0x7e */ MP_UINT, /* 0x7f */ MP_UINT, /* }}} */ /* {{{ MP_MAP (fixed) */ /* 0x80 */ MP_MAP, /* 0x81 */ MP_MAP, /* 0x82 */ MP_MAP, /* 0x83 */ MP_MAP, /* 0x84 */ MP_MAP, /* 0x85 */ MP_MAP, /* 0x86 */ MP_MAP, /* 0x87 */ MP_MAP, /* 0x88 */ MP_MAP, /* 0x89 */ MP_MAP, /* 0x8a */ MP_MAP, /* 0x8b */ MP_MAP, /* 0x8c */ MP_MAP, /* 0x8d */ MP_MAP, /* 0x8e */ MP_MAP, /* 0x8f */ MP_MAP, /* }}} */ /* {{{ MP_ARRAY (fixed) */ /* 0x90 */ MP_ARRAY, /* 0x91 */ MP_ARRAY, /* 0x92 */ MP_ARRAY, /* 0x93 */ MP_ARRAY, /* 0x94 */ MP_ARRAY, /* 0x95 */ MP_ARRAY, /* 0x96 */ MP_ARRAY, /* 0x97 */ MP_ARRAY, /* 0x98 */ MP_ARRAY, /* 0x99 */ MP_ARRAY, /* 0x9a */ MP_ARRAY, /* 0x9b */ MP_ARRAY, /* 0x9c */ MP_ARRAY, /* 0x9d */ MP_ARRAY, /* 0x9e */ MP_ARRAY, /* 0x9f */ MP_ARRAY, /* }}} */ /* {{{ MP_STR (fixed) */ /* 0xa0 */ MP_STR, /* 0xa1 */ MP_STR, /* 0xa2 */ MP_STR, /* 0xa3 */ MP_STR, /* 0xa4 */ MP_STR, /* 0xa5 */ MP_STR, /* 0xa6 */ MP_STR, /* 0xa7 */ MP_STR, /* 0xa8 */ MP_STR, /* 0xa9 */ MP_STR, /* 0xaa */ MP_STR, /* 0xab */ MP_STR, /* 0xac */ MP_STR, /* 0xad */ MP_STR, /* 0xae */ MP_STR, /* 0xaf */ MP_STR, /* 0xb0 */ MP_STR, /* 0xb1 */ MP_STR, /* 0xb2 */ MP_STR, /* 0xb3 */ MP_STR, /* 0xb4 */ MP_STR, /* 0xb5 */ MP_STR, /* 0xb6 */ MP_STR, /* 0xb7 */ MP_STR, /* 0xb8 */ MP_STR, /* 0xb9 */ MP_STR, /* 0xba */ MP_STR, /* 0xbb */ MP_STR, /* 0xbc */ MP_STR, /* 0xbd */ MP_STR, /* 0xbe */ MP_STR, /* 0xbf */ MP_STR, /* }}} */ /* {{{ MP_NIL, MP_BOOL */ /* 0xc0 */ MP_NIL, /* 0xc1 */ MP_EXT, /* never used */ /* 0xc2 */ MP_BOOL, /* 0xc3 */ MP_BOOL, /* }}} */ /* {{{ MP_BIN */ /* 0xc4 */ MP_BIN, /* MP_BIN(8) */ /* 0xc5 */ MP_BIN, /* MP_BIN(16) */ /* 0xc6 */ MP_BIN, /* MP_BIN(32) */ /* }}} */ /* {{{ MP_EXT */ /* 0xc7 */ MP_EXT, /* 0xc8 */ MP_EXT, /* 0xc9 */ MP_EXT, /* }}} */ /* {{{ MP_FLOAT, MP_DOUBLE */ /* 0xca */ MP_FLOAT, /* 0xcb */ MP_DOUBLE, /* }}} */ /* {{{ MP_UINT */ /* 0xcc */ MP_UINT, /* 0xcd */ MP_UINT, /* 0xce */ MP_UINT, /* 0xcf */ MP_UINT, /* }}} */ /* {{{ MP_INT */ /* 0xd0 */ MP_INT, /* MP_INT (8) */ /* 0xd1 */ MP_INT, /* MP_INT (16) */ /* 0xd2 */ MP_INT, /* MP_INT (32) */ /* 0xd3 */ MP_INT, /* MP_INT (64) */ /* }}} */ /* {{{ MP_EXT */ /* 0xd4 */ MP_EXT, /* MP_INT (8) */ /* 0xd5 */ MP_EXT, /* MP_INT (16) */ /* 0xd6 */ MP_EXT, /* MP_INT (32) */ /* 0xd7 */ MP_EXT, /* MP_INT (64) */ /* 0xd8 */ MP_EXT, /* MP_INT (127) */ /* }}} */ /* {{{ MP_STR */ /* 0xd9 */ MP_STR, /* MP_STR(8) */ /* 0xda */ MP_STR, /* MP_STR(16) */ /* 0xdb */ MP_STR, /* MP_STR(32) */ /* }}} */ /* {{{ MP_ARRAY */ /* 0xdc */ MP_ARRAY, /* MP_ARRAY(16) */ /* 0xdd */ MP_ARRAY, /* MP_ARRAY(32) */ /* }}} */ /* {{{ MP_MAP */ /* 0xde */ MP_MAP, /* MP_MAP (16) */ /* 0xdf */ MP_MAP, /* MP_MAP (32) */ /* }}} */ /* {{{ MP_INT */ /* 0xe0 */ MP_INT, /* 0xe1 */ MP_INT, /* 0xe2 */ MP_INT, /* 0xe3 */ MP_INT, /* 0xe4 */ MP_INT, /* 0xe5 */ MP_INT, /* 0xe6 */ MP_INT, /* 0xe7 */ MP_INT, /* 0xe8 */ MP_INT, /* 0xe9 */ MP_INT, /* 0xea */ MP_INT, /* 0xeb */ MP_INT, /* 0xec */ MP_INT, /* 0xed */ MP_INT, /* 0xee */ MP_INT, /* 0xef */ MP_INT, /* 0xf0 */ MP_INT, /* 0xf1 */ MP_INT, /* 0xf2 */ MP_INT, /* 0xf3 */ MP_INT, /* 0xf4 */ MP_INT, /* 0xf5 */ MP_INT, /* 0xf6 */ MP_INT, /* 0xf7 */ MP_INT, /* 0xf8 */ MP_INT, /* 0xf9 */ MP_INT, /* 0xfa */ MP_INT, /* 0xfb */ MP_INT, /* 0xfc */ MP_INT, /* 0xfd */ MP_INT, /* 0xfe */ MP_INT, /* 0xff */ MP_INT /* }}} */ }; /** * This lookup table used by mp_next() and mp_check() to determine * size of MsgPack element by its first byte. * A positive value contains size of the element (excluding the first byte). * A negative value means the element is compound (e.g. array or map) * of size (-n). * MP_HINT_* values used for special cases handled by switch() statement. */ const int8_t mp_parser_hint[256] = { /* {{{ MP_UINT(fixed) **/ /* 0x00 */ 0, /* 0x01 */ 0, /* 0x02 */ 0, /* 0x03 */ 0, /* 0x04 */ 0, /* 0x05 */ 0, /* 0x06 */ 0, /* 0x07 */ 0, /* 0x08 */ 0, /* 0x09 */ 0, /* 0x0a */ 0, /* 0x0b */ 0, /* 0x0c */ 0, /* 0x0d */ 0, /* 0x0e */ 0, /* 0x0f */ 0, /* 0x10 */ 0, /* 0x11 */ 0, /* 0x12 */ 0, /* 0x13 */ 0, /* 0x14 */ 0, /* 0x15 */ 0, /* 0x16 */ 0, /* 0x17 */ 0, /* 0x18 */ 0, /* 0x19 */ 0, /* 0x1a */ 0, /* 0x1b */ 0, /* 0x1c */ 0, /* 0x1d */ 0, /* 0x1e */ 0, /* 0x1f */ 0, /* 0x20 */ 0, /* 0x21 */ 0, /* 0x22 */ 0, /* 0x23 */ 0, /* 0x24 */ 0, /* 0x25 */ 0, /* 0x26 */ 0, /* 0x27 */ 0, /* 0x28 */ 0, /* 0x29 */ 0, /* 0x2a */ 0, /* 0x2b */ 0, /* 0x2c */ 0, /* 0x2d */ 0, /* 0x2e */ 0, /* 0x2f */ 0, /* 0x30 */ 0, /* 0x31 */ 0, /* 0x32 */ 0, /* 0x33 */ 0, /* 0x34 */ 0, /* 0x35 */ 0, /* 0x36 */ 0, /* 0x37 */ 0, /* 0x38 */ 0, /* 0x39 */ 0, /* 0x3a */ 0, /* 0x3b */ 0, /* 0x3c */ 0, /* 0x3d */ 0, /* 0x3e */ 0, /* 0x3f */ 0, /* 0x40 */ 0, /* 0x41 */ 0, /* 0x42 */ 0, /* 0x43 */ 0, /* 0x44 */ 0, /* 0x45 */ 0, /* 0x46 */ 0, /* 0x47 */ 0, /* 0x48 */ 0, /* 0x49 */ 0, /* 0x4a */ 0, /* 0x4b */ 0, /* 0x4c */ 0, /* 0x4d */ 0, /* 0x4e */ 0, /* 0x4f */ 0, /* 0x50 */ 0, /* 0x51 */ 0, /* 0x52 */ 0, /* 0x53 */ 0, /* 0x54 */ 0, /* 0x55 */ 0, /* 0x56 */ 0, /* 0x57 */ 0, /* 0x58 */ 0, /* 0x59 */ 0, /* 0x5a */ 0, /* 0x5b */ 0, /* 0x5c */ 0, /* 0x5d */ 0, /* 0x5e */ 0, /* 0x5f */ 0, /* 0x60 */ 0, /* 0x61 */ 0, /* 0x62 */ 0, /* 0x63 */ 0, /* 0x64 */ 0, /* 0x65 */ 0, /* 0x66 */ 0, /* 0x67 */ 0, /* 0x68 */ 0, /* 0x69 */ 0, /* 0x6a */ 0, /* 0x6b */ 0, /* 0x6c */ 0, /* 0x6d */ 0, /* 0x6e */ 0, /* 0x6f */ 0, /* 0x70 */ 0, /* 0x71 */ 0, /* 0x72 */ 0, /* 0x73 */ 0, /* 0x74 */ 0, /* 0x75 */ 0, /* 0x76 */ 0, /* 0x77 */ 0, /* 0x78 */ 0, /* 0x79 */ 0, /* 0x7a */ 0, /* 0x7b */ 0, /* 0x7c */ 0, /* 0x7d */ 0, /* 0x7e */ 0, /* 0x7f */ 0, /* }}} */ /* {{{ MP_MAP (fixed) */ /* 0x80 */ 0, /* empty map - just skip one byte */ /* 0x81 */ -2, /* 2 elements follow */ /* 0x82 */ -4, /* 0x83 */ -6, /* 0x84 */ -8, /* 0x85 */ -10, /* 0x86 */ -12, /* 0x87 */ -14, /* 0x88 */ -16, /* 0x89 */ -18, /* 0x8a */ -20, /* 0x8b */ -22, /* 0x8c */ -24, /* 0x8d */ -26, /* 0x8e */ -28, /* 0x8f */ -30, /* }}} */ /* {{{ MP_ARRAY (fixed) */ /* 0x90 */ 0, /* empty array - just skip one byte */ /* 0x91 */ -1, /* 1 element follows */ /* 0x92 */ -2, /* 0x93 */ -3, /* 0x94 */ -4, /* 0x95 */ -5, /* 0x96 */ -6, /* 0x97 */ -7, /* 0x98 */ -8, /* 0x99 */ -9, /* 0x9a */ -10, /* 0x9b */ -11, /* 0x9c */ -12, /* 0x9d */ -13, /* 0x9e */ -14, /* 0x9f */ -15, /* }}} */ /* {{{ MP_STR (fixed) */ /* 0xa0 */ 0, /* 0xa1 */ 1, /* 0xa2 */ 2, /* 0xa3 */ 3, /* 0xa4 */ 4, /* 0xa5 */ 5, /* 0xa6 */ 6, /* 0xa7 */ 7, /* 0xa8 */ 8, /* 0xa9 */ 9, /* 0xaa */ 10, /* 0xab */ 11, /* 0xac */ 12, /* 0xad */ 13, /* 0xae */ 14, /* 0xaf */ 15, /* 0xb0 */ 16, /* 0xb1 */ 17, /* 0xb2 */ 18, /* 0xb3 */ 19, /* 0xb4 */ 20, /* 0xb5 */ 21, /* 0xb6 */ 22, /* 0xb7 */ 23, /* 0xb8 */ 24, /* 0xb9 */ 25, /* 0xba */ 26, /* 0xbb */ 27, /* 0xbc */ 28, /* 0xbd */ 29, /* 0xbe */ 30, /* 0xbf */ 31, /* }}} */ /* {{{ MP_NIL, MP_BOOL */ /* 0xc0 */ 0, /* MP_NIL */ /* 0xc1 */ 0, /* never used */ /* 0xc2 */ 0, /* MP_BOOL*/ /* 0xc3 */ 0, /* MP_BOOL*/ /* }}} */ /* {{{ MP_BIN */ /* 0xc4 */ MP_HINT_STR_8, /* MP_BIN (8) */ /* 0xc5 */ MP_HINT_STR_16, /* MP_BIN (16) */ /* 0xc6 */ MP_HINT_STR_32, /* MP_BIN (32) */ /* }}} */ /* {{{ MP_EXT */ /* 0xc7 */ MP_HINT_EXT_8, /* MP_EXT (8) */ /* 0xc8 */ MP_HINT_EXT_16, /* MP_EXT (16) */ /* 0xc9 */ MP_HINT_EXT_32, /* MP_EXT (32) */ /* }}} */ /* {{{ MP_FLOAT, MP_DOUBLE */ /* 0xca */ sizeof(float), /* MP_FLOAT */ /* 0xcb */ sizeof(double), /* MP_DOUBLE */ /* }}} */ /* {{{ MP_UINT */ /* 0xcc */ sizeof(uint8_t), /* MP_UINT (8) */ /* 0xcd */ sizeof(uint16_t), /* MP_UINT (16) */ /* 0xce */ sizeof(uint32_t), /* MP_UINT (32) */ /* 0xcf */ sizeof(uint64_t), /* MP_UINT (64) */ /* }}} */ /* {{{ MP_INT */ /* 0xd0 */ sizeof(uint8_t), /* MP_INT (8) */ /* 0xd1 */ sizeof(uint16_t), /* MP_INT (8) */ /* 0xd2 */ sizeof(uint32_t), /* MP_INT (8) */ /* 0xd3 */ sizeof(uint64_t), /* MP_INT (8) */ /* }}} */ /* {{{ MP_EXT (fixext) */ /* 0xd4 */ 2, /* MP_EXT (fixext 8) */ /* 0xd5 */ 3, /* MP_EXT (fixext 16) */ /* 0xd6 */ 5, /* MP_EXT (fixext 32) */ /* 0xd7 */ 9, /* MP_EXT (fixext 64) */ /* 0xd8 */ 17, /* MP_EXT (fixext 128) */ /* }}} */ /* {{{ MP_STR */ /* 0xd9 */ MP_HINT_STR_8, /* MP_STR (8) */ /* 0xda */ MP_HINT_STR_16, /* MP_STR (16) */ /* 0xdb */ MP_HINT_STR_32, /* MP_STR (32) */ /* }}} */ /* {{{ MP_ARRAY */ /* 0xdc */ MP_HINT_ARRAY_16, /* MP_ARRAY (16) */ /* 0xdd */ MP_HINT_ARRAY_32, /* MP_ARRAY (32) */ /* }}} */ /* {{{ MP_MAP */ /* 0xde */ MP_HINT_MAP_16, /* MP_MAP (16) */ /* 0xdf */ MP_HINT_MAP_32, /* MP_MAP (32) */ /* }}} */ /* {{{ MP_INT (fixed) */ /* 0xe0 */ 0, /* 0xe1 */ 0, /* 0xe2 */ 0, /* 0xe3 */ 0, /* 0xe4 */ 0, /* 0xe5 */ 0, /* 0xe6 */ 0, /* 0xe7 */ 0, /* 0xe8 */ 0, /* 0xe9 */ 0, /* 0xea */ 0, /* 0xeb */ 0, /* 0xec */ 0, /* 0xed */ 0, /* 0xee */ 0, /* 0xef */ 0, /* 0xf0 */ 0, /* 0xf1 */ 0, /* 0xf2 */ 0, /* 0xf3 */ 0, /* 0xf4 */ 0, /* 0xf5 */ 0, /* 0xf6 */ 0, /* 0xf7 */ 0, /* 0xf8 */ 0, /* 0xf9 */ 0, /* 0xfa */ 0, /* 0xfb */ 0, /* 0xfc */ 0, /* 0xfd */ 0, /* 0xfe */ 0, /* 0xff */ 0 /* }}} */ }; const char *mp_char2escape[128] = { "\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", "\\b", "\\t", "\\n", "\\u000b", "\\f", "\\r", "\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f", NULL, NULL, "\\\"", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "\\/", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "\\\\", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "\\u007f" }; #endif /* defined(MP_SOURCE) */ /** \endcond */ /* * }}} */ #if defined(__cplusplus) } /* extern "C" */ #endif /* defined(__cplusplus) */ #undef MP_SOURCE #undef MP_PROTO #undef MP_IMPL #undef MP_ALWAYSINLINE #undef MP_GCC_VERSION #endif /* MSGPUCK_H_INCLUDED */ msgpuck_1.0.3/.gitignore0000664000000000000000000000033312752613651013745 0ustar rootroot*~ *.a *.o *.so* *.dynlib* *.user *.cbp *.log obj-*/ doc/ CMakeFiles/ CMakeCache.txt cmake_install.cmake install_manifest.txt Makefile Doxyfile.html Doxyfile.man debian/* VERSION ./build /build ./test_build /test_build msgpuck_1.0.3/.travis.yml0000664000000000000000000000125412752613651014071 0ustar rootrootsudo: required services: - docker language: c compiler: - gcc env: matrix: - OS=el DIST=6 PACK=rpm - OS=el DIST=7 PACK=rpm - OS=fedora DIST=23 PACK=rpm - OS=fedora DIST=24 PACK=rpm - OS=fedora DIST=rawhide PACK=rpm - OS=ubuntu DIST=precise PACK=deb - OS=ubuntu DIST=trusty PACK=deb - OS=ubuntu DIST=wily PACK=deb - OS=ubuntu DIST=xenial PACK=deb - OS=debian DIST=wheezy PACK=deb - OS=debian DIST=jessie PACK=deb - OS=debian DIST=stretch PACK=deb - OS=debian DIST=sid PACK=deb script: - git clone https://github.com/tarantool/build.git - ./build/pack/travis.sh notifications: email: true