1 | /* -*- c-basic-offset: 2 -*- */ |
2 | /* |
3 | Copyright(C) 2009-2016 Brazil |
4 | |
5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public |
7 | License version 2.1 as published by the Free Software Foundation. |
8 | |
9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Lesser General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU Lesser General Public |
15 | License along with this library; if not, write to the Free Software |
16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ |
18 | |
19 | #pragma once |
20 | |
21 | #ifdef GRN_WITH_MESSAGE_PACK |
22 | # include <msgpack.h> |
23 | |
24 | # if MSGPACK_VERSION_MAJOR < 1 |
25 | typedef unsigned int msgpack_size_t; |
26 | |
27 | # define msgpack_pack_str(packer, size) msgpack_pack_raw(packer, size) |
28 | # define msgpack_pack_str_body(packer, value, size) \ |
29 | msgpack_pack_raw_body(packer, value, size) |
30 | |
31 | # define MSGPACK_OBJECT_STR MSGPACK_OBJECT_RAW |
32 | # define MSGPACK_OBJECT_FLOAT MSGPACK_OBJECT_DOUBLE |
33 | |
34 | # define MSGPACK_OBJECT_STR_PTR(object) (object)->via.raw.ptr |
35 | # define MSGPACK_OBJECT_STR_SIZE(object) (object)->via.raw.size |
36 | |
37 | # define MSGPACK_OBJECT_FLOAT_VALUE(object) (object)->via.dec |
38 | # else /* MSGPACK_VERSION_MAJOR < 1 */ |
39 | typedef size_t msgpack_size_t; |
40 | |
41 | # define MSGPACK_OBJECT_STR_PTR(object) (object)->via.str.ptr |
42 | # define MSGPACK_OBJECT_STR_SIZE(object) (object)->via.str.size |
43 | |
44 | # define MSGPACK_OBJECT_FLOAT_VALUE(object) (object)->via.f64 |
45 | # endif /* MSGPACK_VERSION_MAJOR < 1 */ |
46 | #endif /* GRN_WITH_MESSAGE_PACK */ |
47 | |