messagepack implementation for embedded systems (mbed / arduino)
Dependents: hello_message_pack
first_n.hpp
00001 # /* Copyright (C) 2001 00002 # * Housemarque Oy 00003 # * http://www.housemarque.com 00004 # * 00005 # * Distributed under the Boost Software License, Version 1.0. (See 00006 # * accompanying file LICENSE_1_0.txt or copy at 00007 # * http://www.boost.org/LICENSE_1_0.txt) 00008 # */ 00009 # 00010 # /* Revised by Paul Mensonides (2002) */ 00011 # 00012 # /* See http://www.boost.org for most recent version. */ 00013 # 00014 # ifndef MSGPACK_PREPROCESSOR_LIST_FIRST_N_HPP 00015 # define MSGPACK_PREPROCESSOR_LIST_FIRST_N_HPP 00016 # 00017 # include <msgpack/preprocessor/arithmetic/dec.hpp> 00018 # include <msgpack/preprocessor/config/config.hpp> 00019 # include <msgpack/preprocessor/control/while.hpp> 00020 # include <msgpack/preprocessor/list/adt.hpp> 00021 # include <msgpack/preprocessor/list/reverse.hpp> 00022 # include <msgpack/preprocessor/tuple/elem.hpp> 00023 # include <msgpack/preprocessor/tuple/rem.hpp> 00024 # 00025 # /* MSGPACK_PP_LIST_FIRST_N */ 00026 # 00027 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG() 00028 # define MSGPACK_PP_LIST_FIRST_N(count, list) MSGPACK_PP_LIST_REVERSE(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_WHILE(MSGPACK_PP_LIST_FIRST_N_P, MSGPACK_PP_LIST_FIRST_N_O, (count, list, MSGPACK_PP_NIL)))) 00029 # else 00030 # define MSGPACK_PP_LIST_FIRST_N(count, list) MSGPACK_PP_LIST_FIRST_N_I(count, list) 00031 # define MSGPACK_PP_LIST_FIRST_N_I(count, list) MSGPACK_PP_LIST_REVERSE(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_WHILE(MSGPACK_PP_LIST_FIRST_N_P, MSGPACK_PP_LIST_FIRST_N_O, (count, list, MSGPACK_PP_NIL)))) 00032 # endif 00033 # 00034 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG() 00035 # define MSGPACK_PP_LIST_FIRST_N_P(d, data) MSGPACK_PP_TUPLE_ELEM(3, 0, data) 00036 # else 00037 # define MSGPACK_PP_LIST_FIRST_N_P(d, data) MSGPACK_PP_LIST_FIRST_N_P_I data 00038 # define MSGPACK_PP_LIST_FIRST_N_P_I(c, l, nl) c 00039 # endif 00040 # 00041 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MWCC() 00042 # define MSGPACK_PP_LIST_FIRST_N_O(d, data) MSGPACK_PP_LIST_FIRST_N_O_D data 00043 # else 00044 # define MSGPACK_PP_LIST_FIRST_N_O(d, data) MSGPACK_PP_LIST_FIRST_N_O_D(MSGPACK_PP_TUPLE_ELEM(3, 0, data), MSGPACK_PP_TUPLE_ELEM(3, 1, data), MSGPACK_PP_TUPLE_ELEM(3, 2, data)) 00045 # endif 00046 # 00047 # define MSGPACK_PP_LIST_FIRST_N_O_D(c, l, nl) (MSGPACK_PP_DEC(c), MSGPACK_PP_LIST_REST(l), (MSGPACK_PP_LIST_FIRST(l), nl)) 00048 # 00049 # /* MSGPACK_PP_LIST_FIRST_N_D */ 00050 # 00051 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG() 00052 # define MSGPACK_PP_LIST_FIRST_N_D(d, count, list) MSGPACK_PP_LIST_REVERSE_D(d, MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_WHILE_ ## d(MSGPACK_PP_LIST_FIRST_N_P, MSGPACK_PP_LIST_FIRST_N_O, (count, list, MSGPACK_PP_NIL)))) 00053 # else 00054 # define MSGPACK_PP_LIST_FIRST_N_D(d, count, list) MSGPACK_PP_LIST_FIRST_N_D_I(d, count, list) 00055 # define MSGPACK_PP_LIST_FIRST_N_D_I(d, count, list) MSGPACK_PP_LIST_REVERSE_D(d, MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_WHILE_ ## d(MSGPACK_PP_LIST_FIRST_N_P, MSGPACK_PP_LIST_FIRST_N_O, (count, list, MSGPACK_PP_NIL)))) 00056 # endif 00057 # 00058 # endif
Generated on Tue Jul 12 2022 22:51:45 by 1.7.2