Skip to content

Commit 4501551

Browse files
committed
Merge pull request #340 from redboltz/add_boost_preprocessor
Added Boost.Preprocessor as a submodule.
2 parents 41bff7b + e719cbb commit 4501551

File tree

280 files changed

+39344
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+39344
-71
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "external/boost/predef"]
22
path = external/boost/predef
33
url = https://github.com/boostorg/predef.git
4+
[submodule "external/boost/preprocessor"]
5+
path = external/boost/preprocessor
6+
url = https://github.com/boostorg/preprocessor.git

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ FOREACH (F ${PREDEF_FILES})
6767
FILE (WRITE ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/${F} ${CONTENT})
6868
ENDFOREACH ()
6969

70+
FILE (GLOB_RECURSE PREPROCESSOR_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/preprocessor/include/boost ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/preprocessor/include/boost/*.hpp)
71+
FOREACH (F ${PREPROCESSOR_FILES})
72+
SET(M "Converting ${F}")
73+
MESSAGE(STATUS ${M})
74+
FILE (READ ${CMAKE_CURRENT_SOURCE_DIR}/external/boost/preprocessor/include/boost/${F} CONTENT)
75+
STRING(REPLACE "BOOST_" "MSGPACK_" CONTENT ${CONTENT})
76+
STRING(REPLACE "boost/" "msgpack/" CONTENT ${CONTENT})
77+
FILE (WRITE ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/${F} ${CONTENT})
78+
ENDFOREACH ()
79+
7080
FIND_PACKAGE (GTest)
7181
FIND_PACKAGE (ZLIB)
7282
FIND_PACKAGE (Threads)
@@ -191,6 +201,10 @@ IF (MSGPACK_ENABLE_CXX)
191201
include/msgpack/zbuffer.hpp
192202
include/msgpack/zone.hpp
193203
)
204+
FILE (GLOB_RECURSE PREPROCESSOR_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/preprocessor/*.hpp)
205+
206+
LIST (APPEND msgpack_HEADERS ${PREPROCESSOR_FILES})
207+
LIST (APPEND msgpack_HEADERS include/msgpack/preprocessor.hpp)
194208
ENDIF ()
195209

196210
EXECUTE_PROCESS (

NOTICE

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
This product bundles Boost Predef, which is available under a
2-
Boost Software License - Version 1.0. For details, see external/boost/predef,
3-
include/msgpack/predef.h, and include/msgpack/predef/*
2+
Boost Software License - Version 1.0. For details, see the following files
3+
4+
external/boost/predef
5+
include/msgpack/predef.h
6+
include/msgpack/predef/*
7+
8+
external/boost/preprocessor
9+
include/msgpack/preprocessor.hpp
10+
include/msgpack/preprocessor/*
411

512
---------------------------------------------------------------------------
613
Boost Software License - Version 1.0 - August 17th, 2003

appveyor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
version: 1.1.0.{build}
22
before_build:
3-
- cinst 7zip.commandline -x86 -y
43
- appveyor DownloadFile http://googletest.googlecode.com/files/gtest-1.7.0.zip -FileName gtest-1.7.0.zip
54
- 7z x gtest-1.7.0.zip > NUL
65
- cd gtest-1.7.0

erb/cpp03_define_map.hpp.erb

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,34 @@
1818
#ifndef MSGPACK_CPP03_DEFINE_MAP_HPP
1919
#define MSGPACK_CPP03_DEFINE_MAP_HPP
2020

21-
#if defined(MSGPACK_USE_BOOST)
22-
2321
// BOOST_PP_VARIADICS is defined in boost/preprocessor/config/config.hpp
2422
// http://www.boost.org/libs/preprocessor/doc/ref/variadics.html
2523
// However, supporting compiler detection is not complete. msgpack-c requires
2624
// variadic macro arguments support. So BOOST_PP_VARIADICS is defined here explicitly.
27-
#if !defined(BOOST_PP_VARIADICS)
28-
#define BOOST_PP_VARIADICS
25+
#if !defined(MSGPACK_PP_VARIADICS)
26+
#define MSGPACK_PP_VARIADICS
2927
#endif
3028

31-
#include <boost/preprocessor.hpp>
29+
#include <msgpack/preprocessor.hpp>
3230

3331
#include "msgpack/versioning.hpp"
3432
#include "msgpack/adaptor/msgpack_tuple.hpp"
3533
#include "msgpack/adaptor/adaptor_base.hpp"
3634
#include "msgpack/object_fwd.hpp"
3735

3836
#define MSGPACK_DEFINE_MAP_EACH_PROC(r, data, elem) \
39-
BOOST_PP_IF( \
40-
BOOST_PP_IS_BEGIN_PARENS(elem), \
37+
MSGPACK_PP_IF( \
38+
MSGPACK_PP_IS_BEGIN_PARENS(elem), \
4139
elem, \
42-
(BOOST_PP_STRINGIZE(elem))(elem) \
40+
(MSGPACK_PP_STRINGIZE(elem))(elem) \
4341
)
4442

4543
#define MSGPACK_DEFINE_MAP_IMPL(...) \
46-
BOOST_PP_SEQ_TO_TUPLE( \
47-
BOOST_PP_SEQ_FOR_EACH( \
44+
MSGPACK_PP_SEQ_TO_TUPLE( \
45+
MSGPACK_PP_SEQ_FOR_EACH( \
4846
MSGPACK_DEFINE_MAP_EACH_PROC, \
4947
0, \
50-
BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) \
48+
MSGPACK_PP_VARIADIC_TO_SEQ(__VA_ARGS__) \
5149
) \
5250
)
5351

@@ -74,7 +72,7 @@
7472
}
7573

7674
#define MSGPACK_BASE_MAP(base) \
77-
(BOOST_PP_STRINGIZE(base))(*const_cast<base *>(static_cast<base const*>(this)))
75+
(MSGPACK_PP_STRINGIZE(base))(*const_cast<base *>(static_cast<base const*>(this)))
7876

7977
namespace msgpack {
8078
/// @cond
@@ -180,6 +178,4 @@ inline define_map<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_define_map(A0& a0<%1.
180178
/// @endcond
181179
} // namespace msgpack
182180

183-
#endif // defined(MSGPACK_USE_BOOST)
184-
185181
#endif // MSGPACK_CPP03_DEFINE_MAP_HPP

example/cpp03/map_based_versionup.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <sstream>
2222
#include <cassert>
2323

24-
#define MSGPACK_USE_BOOST
2524
#include <msgpack.hpp>
2625

2726
struct base1 {

external/boost/preprocessor

Submodule preprocessor added at 9cb039a

include/msgpack/adaptor/detail/cpp03_define_map.hpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,34 @@
1818
#ifndef MSGPACK_CPP03_DEFINE_MAP_HPP
1919
#define MSGPACK_CPP03_DEFINE_MAP_HPP
2020

21-
#if defined(MSGPACK_USE_BOOST)
22-
2321
// BOOST_PP_VARIADICS is defined in boost/preprocessor/config/config.hpp
2422
// http://www.boost.org/libs/preprocessor/doc/ref/variadics.html
2523
// However, supporting compiler detection is not complete. msgpack-c requires
2624
// variadic macro arguments support. So BOOST_PP_VARIADICS is defined here explicitly.
27-
#if !defined(BOOST_PP_VARIADICS)
28-
#define BOOST_PP_VARIADICS
25+
#if !defined(MSGPACK_PP_VARIADICS)
26+
#define MSGPACK_PP_VARIADICS
2927
#endif
3028

31-
#include <boost/preprocessor.hpp>
29+
#include <msgpack/preprocessor.hpp>
3230

3331
#include "msgpack/versioning.hpp"
3432
#include "msgpack/adaptor/msgpack_tuple.hpp"
3533
#include "msgpack/adaptor/adaptor_base.hpp"
3634
#include "msgpack/object_fwd.hpp"
3735

3836
#define MSGPACK_DEFINE_MAP_EACH_PROC(r, data, elem) \
39-
BOOST_PP_IF( \
40-
BOOST_PP_IS_BEGIN_PARENS(elem), \
37+
MSGPACK_PP_IF( \
38+
MSGPACK_PP_IS_BEGIN_PARENS(elem), \
4139
elem, \
42-
(BOOST_PP_STRINGIZE(elem))(elem) \
40+
(MSGPACK_PP_STRINGIZE(elem))(elem) \
4341
)
4442

4543
#define MSGPACK_DEFINE_MAP_IMPL(...) \
46-
BOOST_PP_SEQ_TO_TUPLE( \
47-
BOOST_PP_SEQ_FOR_EACH( \
44+
MSGPACK_PP_SEQ_TO_TUPLE( \
45+
MSGPACK_PP_SEQ_FOR_EACH( \
4846
MSGPACK_DEFINE_MAP_EACH_PROC, \
4947
0, \
50-
BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) \
48+
MSGPACK_PP_VARIADIC_TO_SEQ(__VA_ARGS__) \
5149
) \
5250
)
5351

@@ -74,7 +72,7 @@
7472
}
7573

7674
#define MSGPACK_BASE_MAP(base) \
77-
(BOOST_PP_STRINGIZE(base))(*const_cast<base *>(static_cast<base const*>(this)))
75+
(MSGPACK_PP_STRINGIZE(base))(*const_cast<base *>(static_cast<base const*>(this)))
7876

7977
namespace msgpack {
8078
/// @cond
@@ -2798,6 +2796,4 @@ inline define_map<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A1
27982796
/// @endcond
27992797
} // namespace msgpack
28002798

2801-
#endif // defined(MSGPACK_USE_BOOST)
2802-
28032799
#endif // MSGPACK_CPP03_DEFINE_MAP_HPP

include/msgpack/adaptor/detail/cpp11_define_map.hpp

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@
1818
#ifndef MSGPACK_CPP11_DEFINE_MAP_HPP
1919
#define MSGPACK_CPP11_DEFINE_MAP_HPP
2020

21-
#if defined(MSGPACK_USE_BOOST)
22-
2321
// BOOST_PP_VARIADICS is defined in boost/preprocessor/config/config.hpp
2422
// http://www.boost.org/libs/preprocessor/doc/ref/variadics.html
2523
// However, supporting compiler detection is not complete. msgpack-c requires
2624
// variadic macro arguments support. So BOOST_PP_VARIADICS is defined here explicitly.
27-
#if !defined(BOOST_PP_VARIADICS)
28-
#define BOOST_PP_VARIADICS
25+
#if !defined(MSGPACK_PP_VARIADICS)
26+
#define MSGPACK_PP_VARIADICS
2927
#endif
3028

31-
#include <boost/preprocessor.hpp>
29+
#include <msgpack/preprocessor.hpp>
3230

3331
#include "msgpack/versioning.hpp"
3432
#include "msgpack/adaptor/adaptor_base.hpp"
@@ -40,18 +38,18 @@
4038
#include <tuple>
4139

4240
#define MSGPACK_DEFINE_MAP_EACH_PROC(r, data, elem) \
43-
BOOST_PP_IF( \
44-
BOOST_PP_IS_BEGIN_PARENS(elem), \
41+
MSGPACK_PP_IF( \
42+
MSGPACK_PP_IS_BEGIN_PARENS(elem), \
4543
elem, \
46-
(BOOST_PP_STRINGIZE(elem))(elem) \
44+
(MSGPACK_PP_STRINGIZE(elem))(elem) \
4745
)
4846

4947
#define MSGPACK_DEFINE_MAP_IMPL(...) \
50-
BOOST_PP_SEQ_TO_TUPLE( \
51-
BOOST_PP_SEQ_FOR_EACH( \
48+
MSGPACK_PP_SEQ_TO_TUPLE( \
49+
MSGPACK_PP_SEQ_FOR_EACH( \
5250
MSGPACK_DEFINE_MAP_EACH_PROC, \
5351
0, \
54-
BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) \
52+
MSGPACK_PP_VARIADIC_TO_SEQ(__VA_ARGS__) \
5553
) \
5654
)
5755

@@ -78,7 +76,7 @@
7876
}
7977

8078
#define MSGPACK_BASE_MAP(base) \
81-
(BOOST_PP_STRINGIZE(base))(*const_cast<base *>(static_cast<base const*>(this)))
79+
(MSGPACK_PP_STRINGIZE(base))(*const_cast<base *>(static_cast<base const*>(this)))
8280

8381
namespace msgpack {
8482
/// @cond
@@ -170,6 +168,4 @@ define_map<Args...> make_define_map(Args&... args)
170168
/// @endcond
171169
} // namespace msgpack
172170

173-
#endif // defined(MSGPACK_USE_BOOST)
174-
175171
#endif // MSGPACK_CPP11_DEFINE_MAP_HPP

include/msgpack/preprocessor.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# /* Copyright (C) 2001
2+
# * Housemarque Oy
3+
# * http://www.housemarque.com
4+
# *
5+
# * Distributed under the Boost Software License, Version 1.0. (See
6+
# * accompanying file LICENSE_1_0.txt or copy at
7+
# * http://www.boost.org/LICENSE_1_0.txt)
8+
# */
9+
#
10+
# /* Revised by Paul Mensonides (2002) */
11+
#
12+
# /* See http://www.boost.org/libs/preprocessor for documentation. */
13+
#
14+
# ifndef MSGPACK_PREPROCESSOR_HPP
15+
# define MSGPACK_PREPROCESSOR_HPP
16+
#
17+
# include <msgpack/preprocessor/library.hpp>
18+
#
19+
# endif

0 commit comments

Comments
 (0)