mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-21 07:45:02 +02:00
Compare commits
180 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6e7deb8091 | ||
![]() |
66fa561256 | ||
![]() |
243fb27c3c | ||
![]() |
746e983bf3 | ||
![]() |
766afb90ed | ||
![]() |
403567c1c5 | ||
![]() |
f3fe1b801e | ||
![]() |
4fdbc7518f | ||
![]() |
0dbdb3d974 | ||
![]() |
d7d5be414f | ||
![]() |
4d36456799 | ||
![]() |
b1725d4007 | ||
![]() |
102dba8e24 | ||
![]() |
1a372058a6 | ||
![]() |
f8b691f622 | ||
![]() |
7893d4d8c9 | ||
![]() |
9a3cd0c951 | ||
![]() |
46684265d5 | ||
![]() |
9e0d87b725 | ||
![]() |
bbc03b2b0a | ||
![]() |
b4d28c3d9d | ||
![]() |
cc1098998f | ||
![]() |
d9c5978958 | ||
![]() |
d05daa1df6 | ||
![]() |
534466894e | ||
![]() |
d04520044f | ||
![]() |
c0fb6b3b8c | ||
![]() |
19df3314f4 | ||
![]() |
b530b7f21a | ||
![]() |
ed49ea3c95 | ||
![]() |
7918c19f8f | ||
![]() |
0d7caecdb5 | ||
![]() |
f8b0ad1766 | ||
![]() |
7ed7af90b6 | ||
![]() |
4a94f836a7 | ||
![]() |
b36e548db2 | ||
![]() |
e6c276edf3 | ||
![]() |
befc3cdd0c | ||
![]() |
2e2e93ba2e | ||
![]() |
3b2bb56243 | ||
![]() |
9c4562382b | ||
![]() |
08b0c88c21 | ||
![]() |
d105f97ea0 | ||
![]() |
bd0665bed3 | ||
![]() |
8dc865d92d | ||
![]() |
8085ab8721 | ||
![]() |
b36e75a42e | ||
![]() |
f17f8d79c4 | ||
![]() |
f89f05b883 | ||
![]() |
bd5f814cb2 | ||
![]() |
bf6cc035c7 | ||
![]() |
a6bf728a5c | ||
![]() |
698a482b67 | ||
![]() |
fbf5b9d74c | ||
![]() |
65c35caab2 | ||
![]() |
ff9f14742b | ||
![]() |
4b4eb83cd1 | ||
![]() |
7761497778 | ||
![]() |
6046d5c666 | ||
![]() |
83eb70d718 | ||
![]() |
70f950ac05 | ||
![]() |
3129326432 | ||
![]() |
799cd15107 | ||
![]() |
942965ee87 | ||
![]() |
a123053823 | ||
![]() |
c7603fbbd1 | ||
![]() |
6954e01338 | ||
![]() |
7e23ec496a | ||
![]() |
bae148bd76 | ||
![]() |
3fcecf7099 | ||
![]() |
7d994630d2 | ||
![]() |
29b9505cb7 | ||
![]() |
e07d774004 | ||
![]() |
ff77227e10 | ||
![]() |
de99222801 | ||
![]() |
7cdc5b88e3 | ||
![]() |
fbdf16db09 | ||
![]() |
41b2af8884 | ||
![]() |
9389912eaf | ||
![]() |
d5242a7d8c | ||
![]() |
d3fecce359 | ||
![]() |
7a70d74971 | ||
![]() |
fcf89fe901 | ||
![]() |
ec8c0bc1c1 | ||
![]() |
a2f3689865 | ||
![]() |
2d54c0e918 | ||
![]() |
ce088e7e0a | ||
![]() |
a1b86507da | ||
![]() |
9235d1acae | ||
![]() |
12172e7dc7 | ||
![]() |
6a08446b3d | ||
![]() |
c93a42b5f4 | ||
![]() |
8febbfd9f5 | ||
![]() |
33a8d8c30f | ||
![]() |
ef5bcadd95 | ||
![]() |
fadc615f4e | ||
![]() |
eff6f5a2fd | ||
![]() |
ed30252bdc | ||
![]() |
2deed25da0 | ||
![]() |
419877cf3a | ||
![]() |
17267ed475 | ||
![]() |
b759f5bdf7 | ||
![]() |
f72372314e | ||
![]() |
530561eec0 | ||
![]() |
aec88c06a0 | ||
![]() |
09e06a8cb7 | ||
![]() |
084db3fcf1 | ||
![]() |
709d6f4fdd | ||
![]() |
27cf578e8c | ||
![]() |
7001679959 | ||
![]() |
daa78b4606 | ||
![]() |
b893f7750c | ||
![]() |
8792f42f8d | ||
![]() |
4f9ec65713 | ||
![]() |
db54c78ed4 | ||
![]() |
1155babda8 | ||
![]() |
83a82e3eb5 | ||
![]() |
aa9c73352c | ||
![]() |
df9e003b35 | ||
![]() |
f6ddc9b85a | ||
![]() |
11cfeeec92 | ||
![]() |
d72765870a | ||
![]() |
349c133171 | ||
![]() |
c056026dad | ||
![]() |
0421dabc1e | ||
![]() |
60930f4b12 | ||
![]() |
b3dfe28be4 | ||
![]() |
e703d8a2f7 | ||
![]() |
801f61c12c | ||
![]() |
a3e75a0709 | ||
![]() |
92d34cbd79 | ||
![]() |
c99fd62ae6 | ||
![]() |
a3986b3bdc | ||
![]() |
7fed49e6fe | ||
![]() |
005e06e00a | ||
![]() |
b6d4bb5cb0 | ||
![]() |
f57bfd998b | ||
![]() |
e8d3387a04 | ||
![]() |
53d2ea9ad3 | ||
![]() |
b6803a5fec | ||
![]() |
210d3ce390 | ||
![]() |
a350e0714e | ||
![]() |
72757feae4 | ||
![]() |
fe2346efa1 | ||
![]() |
43ae287be3 | ||
![]() |
b804e12dec | ||
![]() |
99c221ad01 | ||
![]() |
3a615bcf44 | ||
![]() |
87863c1696 | ||
![]() |
45defd565a | ||
![]() |
f1726cef0d | ||
![]() |
8a788f3a48 | ||
![]() |
7710868556 | ||
![]() |
0b53833856 | ||
![]() |
43c643bab6 | ||
![]() |
ac64fcace8 | ||
![]() |
84ba0c7b4b | ||
![]() |
f79606d9ff | ||
![]() |
3aaadb9b12 | ||
![]() |
8a3a11f123 | ||
![]() |
32f1f0edf2 | ||
![]() |
5bd75905cb | ||
![]() |
eebdc007a9 | ||
![]() |
3aae588a6a | ||
![]() |
cb2dcb19b9 | ||
![]() |
c58a565366 | ||
![]() |
93b944eec4 | ||
![]() |
7340f1e9c8 | ||
![]() |
0a65c443a2 | ||
![]() |
bae6a8db57 | ||
![]() |
ddb320197a | ||
![]() |
dc51f6493b | ||
![]() |
c027909acc | ||
![]() |
2bd56533fa | ||
![]() |
c07452a7a2 | ||
![]() |
8701aeec30 | ||
![]() |
2c4f2b890e | ||
![]() |
f1acd78e54 | ||
![]() |
49d22b7d28 | ||
![]() |
96133c8dd9 |
56
.github/depends/boost.sh
vendored
Executable file
56
.github/depends/boost.sh
vendored
Executable file
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
|
||||
usage()
|
||||
{
|
||||
cat <<EOL
|
||||
-b - 32-bit or 64-bit library, maybe 32, 64 or both
|
||||
-t - the toolset, maybe gcc, clang or both
|
||||
EOL
|
||||
}
|
||||
|
||||
build_boost()
|
||||
{
|
||||
BASE=`pwd`/..
|
||||
./b2 -j4 --toolset=$1 --prefix=${BASE}/usr --libdir="${BASE}/usr/$1/lib$2" --with-chrono --with-context --with-filesystem --with-system --with-timer address-model=$2 install
|
||||
}
|
||||
|
||||
bit="64"
|
||||
toolset="gcc"
|
||||
|
||||
while getopts "b:t:" c; do
|
||||
case "$c" in
|
||||
b)
|
||||
bit="$OPTARG"
|
||||
[ "$bit" != "32" ] && [ "$bit" != "64" ] && [ "$bit" != "both" ] && usage && exit 1
|
||||
;;
|
||||
t)
|
||||
toolset="$OPTARG"
|
||||
[ "$toolset" != "gcc" ] && [ "$toolset" != "clang" ] && [ "$toolset" != "both" ] && usage && exit 1
|
||||
;;
|
||||
?*)
|
||||
echo "invalid arguments." && exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
wget https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.tar.bz2
|
||||
tar xf boost_1_71_0.tar.bz2
|
||||
cd boost_1_71_0
|
||||
./bootstrap.sh
|
||||
|
||||
build()
|
||||
{
|
||||
if [ "$bit" = "both" ]; then
|
||||
build_boost $1 32
|
||||
build_boost $1 64
|
||||
else
|
||||
build_boost $1 $bit
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$toolset" = "both" ]; then
|
||||
build gcc
|
||||
build clang
|
||||
else
|
||||
build $toolset
|
||||
fi
|
62
.github/workflows/coverage.yml
vendored
Normal file
62
.github/workflows/coverage.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: coverage
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
|
||||
codecov:
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: install depends
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++-multilib lcov
|
||||
- name: Cache boost
|
||||
id: cache-boost
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: usr
|
||||
key: ${{ runner.os }}-boost-20200107
|
||||
- name: Build boost
|
||||
if: steps.cache-boost.outputs.cache-hit != 'true'
|
||||
run: ./.github/depends/boost.sh -b both -t gcc
|
||||
- name: Compile tests
|
||||
run: |
|
||||
# install gtest
|
||||
BASE=`pwd`
|
||||
wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip
|
||||
unzip -q googletest-release-1.7.0.zip
|
||||
cd googletest-release-1.7.0
|
||||
g++ -m64 src/gtest-all.cc -I. -Iinclude -c -fPIC
|
||||
g++ -m64 src/gtest_main.cc -I. -Iinclude -c -fPIC
|
||||
ar -rv libgtest.a gtest-all.o
|
||||
ar -rv libgtest_main.a gtest_main.o
|
||||
mkdir -p ${BASE}/usr/include
|
||||
cp -r include/gtest ${BASE}/usr/include
|
||||
mkdir -p ${BASE}/usr/lib
|
||||
mv *.a ${BASE}/usr/lib
|
||||
cd ..
|
||||
|
||||
mkdir build && cd build
|
||||
CMAKE_LIBRARY_PATH="${BASE}/build" GTEST_ROOT="${BASE}/usr" CMAKE_PREFIX_PATH="${BASE}/usr/gcc/lib64/cmake" cmake -DMSGPACK_CXX17=ON -DMSGPACK_32BIT=OFF -DMSGPACK_BOOST=ON -DBUILD_SHARED_LIBS=ON -DMSGPACK_CHAR_SIGN=signed -DMSGPACK_USE_X3_PARSE=ON -DMSGPACK_ENABLE_CXX=ON -DMSGPACK_BUILD_EXAMPLES=ON -DMSGPACK_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -DMSGPACK_GEN_COVERAGE=ON ..
|
||||
make -j4
|
||||
make test
|
||||
- name: Upload coverage to Codecov
|
||||
working-directory: build
|
||||
run: |
|
||||
# Create lcov report
|
||||
lcov --capture --directory . --output-file coverage.info
|
||||
lcov --remove coverage.info '/usr/*' --output-file coverage.info # filter system-files
|
||||
lcov --list coverage.info # debug info
|
||||
# Uploading report to CodeCov
|
||||
bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
|
304
.github/workflows/gha.yml
vendored
Normal file
304
.github/workflows/gha.yml
vendored
Normal file
@@ -0,0 +1,304 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
macos:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
pattern: [0, 1, 2, 3]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Cache boost
|
||||
id: cache-boost
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: usr
|
||||
key: ${{ runner.os }}-boost-20200107
|
||||
- name: Build boost
|
||||
if: steps.cache-boost.outputs.cache-hit != 'true'
|
||||
run: ./.github/depends/boost.sh -b 64 -t clang
|
||||
- name: build and test
|
||||
env:
|
||||
CC: clang
|
||||
CXX: clang++
|
||||
shell: bash
|
||||
run: |
|
||||
BASE=`pwd`;
|
||||
|
||||
# matrix config
|
||||
if [ ${{ matrix.pattern }} == 0 ]; then
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export CXX17="ON"
|
||||
export ARCH="64"
|
||||
export BOOST="ON"
|
||||
SHARED="ON"
|
||||
export CHAR_SIGN="unsigned"
|
||||
export API_VERSION="1"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 1 ]; then
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export CXX17="ON"
|
||||
export ARCH="64"
|
||||
export BOOST="ON"
|
||||
export SHARED="ON"
|
||||
export CHAR_SIGN="signed"
|
||||
export API_VERSION="3"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 2 ]; then
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export CXX17="ON"
|
||||
export ARCH="64"
|
||||
export SHARED="ON"
|
||||
export CHAR_SIGN="signed"
|
||||
export API_VERSION="2"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 3 ]; then
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export ARCH="64"
|
||||
export SHARED="ON"
|
||||
export CHAR_SIGN="unsigned"
|
||||
export API_VERSION="2"
|
||||
fi
|
||||
|
||||
# install gtest
|
||||
wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip
|
||||
unzip -q googletest-release-1.7.0.zip
|
||||
cd googletest-release-1.7.0
|
||||
$CXX -m${ARCH} src/gtest-all.cc -I. -Iinclude -c
|
||||
$CXX -m${ARCH} src/gtest_main.cc -I. -Iinclude -c
|
||||
ar -rv libgtest.a gtest-all.o
|
||||
ar -rv libgtest_main.a gtest_main.o
|
||||
mkdir -p ${BASE}/usr/include
|
||||
cp -r include/gtest ${BASE}/usr/include
|
||||
mkdir -p ${BASE}/usr/lib
|
||||
mv *.a ${BASE}/usr/lib
|
||||
cd ..
|
||||
|
||||
# build and test
|
||||
CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}/usr/lib:${BASE}/build" GTEST_ROOT="${BASE}/usr" CMAKE_PREFIX_PATH="${BASE}/usr/clang/lib${ARCH}/cmake" CFLAGS="-Werror -g" CXXFLAGS="-Werror -g" ${ACTION}
|
||||
cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
|
||||
|
||||
linux:
|
||||
runs-on: ubuntu-18.04
|
||||
strategy:
|
||||
matrix:
|
||||
pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: install depends
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install g++-multilib clang-8 valgrind
|
||||
- name: Cache boost
|
||||
id: cache-boost
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: usr
|
||||
key: ${{ runner.os }}-boost-20200107
|
||||
- name: Build boost
|
||||
if: steps.cache-boost.outputs.cache-hit != 'true'
|
||||
run: ./.github/depends/boost.sh -b both -t gcc
|
||||
- name: build and test
|
||||
shell: bash
|
||||
run: |
|
||||
BASE=`pwd`;
|
||||
|
||||
# matrix config
|
||||
if [ ${{ matrix.pattern }} == 0 ]; then
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export ARCH="64"
|
||||
export BOOST="ON"
|
||||
export SHARED="ON"
|
||||
export CHAR_SIGN="unsigned"
|
||||
export API_VERSION="2"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 1 ]; then
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export ARCH="32"
|
||||
export SHARED="ON"
|
||||
export CHAR_SIGN="signed"
|
||||
export API_VERSION="2"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 2 ]; then
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export CXX17="ON"
|
||||
export ARCH="64"
|
||||
export BOOST="ON"
|
||||
export SHARED="ON"
|
||||
export CHAR_SIGN="signed"
|
||||
export API_VERSION="3"
|
||||
export X3_PARSE="ON"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 3 ]; then
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export CXX17="ON"
|
||||
export ARCH="32"
|
||||
export SHARED="OFF"
|
||||
export CHAR_SIGN="unsigned"
|
||||
export API_VERSION="2"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 4 ]; then
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export CXX17="ON"
|
||||
export ARCH="64"
|
||||
export SHARED="ON"
|
||||
export CHAR_SIGN="signed"
|
||||
export API_VERSION="2"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 5 ]; then
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export CXX17="ON"
|
||||
export ARCH="32"
|
||||
export BOOST="ON"
|
||||
export SHARED="ON"
|
||||
export CHAR_SIGN="unsigned"
|
||||
export API_VERSION="3"
|
||||
export X3_PARSE="ON"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 6 ]; then
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export ARCH="64"
|
||||
export SHARED="ON"
|
||||
export CHAR_SIGN="unsigned"
|
||||
export API_VERSION="2"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 7 ]; then
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export ARCH="32"
|
||||
export BOOST="ON"
|
||||
export SHARED="OFF"
|
||||
export CHAR_SIGN="signed"
|
||||
export API_VERSION="1"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 8 ]; then
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
ACTION="ci/build_cmake.sh"
|
||||
export ARCH="32"
|
||||
export BOOST="ON"
|
||||
export SHARED="OFF"
|
||||
export CHAR_SIGN="signed"
|
||||
export API_VERSION="2"
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 9 ]; then
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
ACTION="ci/build_regression.sh"
|
||||
export ARCH="64"
|
||||
export SAN="UBSAN"
|
||||
export MSGPACK_FUZZ_REGRESSION="ON"
|
||||
export CTEST_OUTPUT_ON_FAILURE=1
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 10 ]; then
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
ACTION="ci/build_regression.sh"
|
||||
export ARCH="64"
|
||||
export SAN="ASAN"
|
||||
export MSGPACK_FUZZ_REGRESSION="ON"
|
||||
export CTEST_OUTPUT_ON_FAILURE=1
|
||||
fi
|
||||
if [ ${{ matrix.pattern }} == 11 ]; then
|
||||
export CC=gcc
|
||||
export CXX=g++
|
||||
ACTION="ci/build_cmake_embedded.sh"
|
||||
export ARCH="64"
|
||||
fi
|
||||
|
||||
# install gtest
|
||||
wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip
|
||||
unzip -q googletest-release-1.7.0.zip
|
||||
cd googletest-release-1.7.0
|
||||
$CXX -m${ARCH} src/gtest-all.cc -I. -Iinclude -c -fPIC
|
||||
$CXX -m${ARCH} src/gtest_main.cc -I. -Iinclude -c -fPIC
|
||||
ar -rv libgtest.a gtest-all.o
|
||||
ar -rv libgtest_main.a gtest_main.o
|
||||
mkdir -p ${BASE}/usr/include
|
||||
cp -r include/gtest ${BASE}/usr/include
|
||||
mkdir -p ${BASE}/usr/lib
|
||||
mv *.a ${BASE}/usr/lib
|
||||
cd ..
|
||||
|
||||
# install zlib
|
||||
if [ ${ARCH} == 32 ]; then
|
||||
sudo apt-get install lib32z1-dev
|
||||
fi
|
||||
|
||||
# build and test
|
||||
CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}/usr/lib:${BASE}/build" GTEST_ROOT="${BASE}/usr" CMAKE_PREFIX_PATH="${BASE}/usr/gcc/lib${ARCH}/cmake" CFLAGS="-Werror -g" CXXFLAGS="-Werror -g" MSGPACK_SAN="${SAN}" ${ACTION}
|
||||
cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
|
||||
windows:
|
||||
runs-on: windows-2016
|
||||
strategy:
|
||||
matrix:
|
||||
pattern: [0, 1, 2, 3]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Cache vcpkg
|
||||
id: cache-vcpkg
|
||||
uses: actions/cache@v1.0.3
|
||||
with:
|
||||
path: C:/vcpkg/installed/x64-windows
|
||||
key: ${{ runner.os }}-vcpkg
|
||||
- name: Build dependencies
|
||||
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
|
||||
shell: powershell
|
||||
run: |
|
||||
vcpkg install gtest:x64-windows
|
||||
vcpkg install zlib:x64-windows
|
||||
- name: Build and test
|
||||
shell: powershell
|
||||
run: |
|
||||
if (${{ matrix.pattern }} -eq 0) {
|
||||
$CPP11="-DMSGPACK_CXX11=OFF"
|
||||
$BOOST="-DMSGPACK_BOOST=OFF"
|
||||
}
|
||||
if (${{ matrix.pattern }} -eq 1) {
|
||||
$CPP11="-DMSGPACK_CXX11=OFF"
|
||||
$BOOST="-DMSGPACK_BOOST=ON"
|
||||
}
|
||||
if (${{ matrix.pattern }} -eq 2) {
|
||||
$CPP11="-DMSGPACK_CXX11=ON"
|
||||
$BOOST="-DMSGPACK_BOOST=OFF"
|
||||
}
|
||||
if (${{ matrix.pattern }} -eq 3) {
|
||||
$CPP11="-DMSGPACK_CXX11=ON"
|
||||
$BOOST="-DMSGPACK_BOOST=ON"
|
||||
}
|
||||
|
||||
$CUR=(Get-Location).Path
|
||||
md build
|
||||
cd build
|
||||
cmake -A x64 -DBOOST_ROOT="$env:BOOST_ROOT_1_72_0" -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" $CPP11 $BOOST "-DCMAKE_CXX_FLAGS=/D_VARIADIC_MAX=10 /EHsc /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING" ..
|
||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||
cmake --build . --config Release
|
||||
$pathbak="$env:PATH"
|
||||
$env:PATH="C:\vcpkg\installed\x64-windows\bin;$CUR\build\Release;$pathbak"
|
||||
ctest -V
|
||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
||||
$env:PATH=$pathbak
|
215
.travis.yml
215
.travis.yml
@@ -1,215 +0,0 @@
|
||||
language: cpp
|
||||
sudo: false
|
||||
dist: trusty
|
||||
|
||||
install:
|
||||
- export BASE=`pwd`
|
||||
- mkdir ${BASE}/usr
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then wget --no-check-certificate https://cmake.org/files/v3.7/cmake-3.7.1-Linux-x86_64.sh -O cmake-3.7.1-Linux-x86_64.sh; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then chmod a+x cmake-3.7.1-Linux-x86_64.sh; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then ./cmake-3.7.1-Linux-x86_64.sh --prefix=${BASE}/usr --skip-license; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH="${BASE}/usr/bin:$PATH"; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export LD_LIBRARY_PATH="${BASE}/usr/lib:$LD_LIBRARY_PATH"; fi
|
||||
- if [ "$CXX" = "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi
|
||||
- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi
|
||||
- if [ "$CXX" = "g++" ] && [ "$TRAVIS_OS_NAME" == "linux" ]; then cd /usr/include/c++/$(g++ -v 2>&1 | grep version | awk '{print $3}')/bits; ln -s ../ext/atomicity.h .; cd ${BASE}/usr; fi
|
||||
#gtest
|
||||
- wget https://github.com/google/googletest/archive/release-1.7.0.zip -O googletest-release-1.7.0.zip
|
||||
- unzip -q googletest-release-1.7.0.zip
|
||||
- cd googletest-release-1.7.0
|
||||
- $CXX -m${ARCH} src/gtest-all.cc -I. -Iinclude -c
|
||||
- $CXX -m${ARCH} src/gtest_main.cc -I. -Iinclude -c
|
||||
- ar -rv libgtest.a gtest-all.o
|
||||
- ar -rv libgtest_main.a gtest_main.o
|
||||
- mkdir -p ${BASE}/usr/include
|
||||
- cp -r include/gtest ${BASE}/usr/include
|
||||
- mkdir -p ${BASE}/usr/lib
|
||||
- mv *.a ${BASE}/usr/lib
|
||||
- cd ..
|
||||
# valgrind
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then wget http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2 && tar xjf valgrind-3.12.0.tar.bz2 && cd valgrind-3.12.0 && ./configure --prefix=${BASE}/usr > /dev/null && make -j3 > /dev/null && make install > /dev/null && cd ..; fi
|
||||
# boost
|
||||
- if [ "$BOOST" == "ON" ]; then wget http://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.zip && unzip -q boost_1_66_0.zip && cd boost_1_66_0 && ./bootstrap.sh && ./b2 -j3 --prefix=${BASE}/usr --with-chrono --with-context --with-system --with-timer address-model=${ARCH} install > /dev/null && cd ..; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo ln -s /usr/include/x86_64-linux-gnu/zconf.h /usr/include; fi
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="1"
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="signed" API_VERSION="3"
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2"
|
||||
- os: osx
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_cmake.sh" ARCH="64" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="2"
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_cmake.sh" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="1"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
- llvm-toolchain-precise
|
||||
packages:
|
||||
- g++-multilib
|
||||
- gcc-multilib
|
||||
- gcc-5-multilib
|
||||
- g++-5-multilib
|
||||
- bzip2
|
||||
- clang-3.9
|
||||
- libc6-dbg
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_cmake.sh" ARCH="32" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
- llvm-toolchain-precise
|
||||
packages:
|
||||
- g++-multilib
|
||||
- gcc-multilib
|
||||
- gcc-5-multilib
|
||||
- g++-5-multilib
|
||||
- lib32stdc++6-6-dbg
|
||||
- lib32gcc1
|
||||
- libc6-i386
|
||||
- lib32z1-dev
|
||||
- zlib1g-dev
|
||||
- bzip2
|
||||
- clang-3.9
|
||||
- libc6-dbg
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" BOOST="ON" SHARED="ON" CHAR_SIGN="signed" API_VERSION="3" X3_PARSE="ON"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
- llvm-toolchain-precise
|
||||
packages:
|
||||
- g++-multilib
|
||||
- gcc-multilib
|
||||
- gcc-5-multilib
|
||||
- g++-5-multilib
|
||||
- bzip2
|
||||
- clang-3.9
|
||||
- libc6-dbg
|
||||
- os: linux
|
||||
compiler: clang
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="32" SHARED="OFF" CHAR_SIGN="unsigned" API_VERSION="2"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.9
|
||||
- llvm-toolchain-precise
|
||||
packages:
|
||||
- g++-multilib
|
||||
- gcc-multilib
|
||||
- gcc-5-multilib
|
||||
- g++-5-multilib
|
||||
- lib32stdc++6-6-dbg
|
||||
- lib32gcc1
|
||||
- libc6-i386
|
||||
- lib32z1-dev
|
||||
- zlib1g-dev
|
||||
- bzip2
|
||||
- clang-3.9
|
||||
- libc6-dbg
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="64" SHARED="ON" CHAR_SIGN="signed" API_VERSION="2"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-multilib
|
||||
- gcc-multilib
|
||||
- gcc-6-multilib
|
||||
- g++-6-multilib
|
||||
- bzip2
|
||||
- libc6-dbg
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: ACTION="ci/build_cmake.sh" CXX11="ON" ARCH="32" BOOST="ON" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="3" X3_PARSE="ON"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-multilib
|
||||
- gcc-multilib
|
||||
- gcc-6-multilib
|
||||
- g++-6-multilib
|
||||
- lib32stdc++6-6-dbg
|
||||
- lib32gcc1
|
||||
- libc6-i386
|
||||
- lib32z1-dev
|
||||
- zlib1g-dev
|
||||
- bzip2
|
||||
- libc6-dbg
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: ACTION="ci/build_cmake.sh" ARCH="64" SHARED="ON" CHAR_SIGN="unsigned" API_VERSION="2"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-multilib
|
||||
- gcc-multilib
|
||||
- gcc-6-multilib
|
||||
- g++-6-multilib
|
||||
- bzip2
|
||||
- libc6-dbg
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: ACTION="ci/build_cmake.sh" ARCH="32" BOOST="ON" SHARED="OFF" CHAR_SIGN="signed" API_VERSION="1"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-multilib
|
||||
- gcc-multilib
|
||||
- gcc-6-multilib
|
||||
- g++-6-multilib
|
||||
- lib32stdc++6-6-dbg
|
||||
- lib32gcc1
|
||||
- libc6-i386
|
||||
- lib32z1-dev
|
||||
- zlib1g-dev
|
||||
- bzip2
|
||||
- libc6-dbg
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: ACTION="ci/build_cmake.sh" ARCH="32" BOOST="ON" SHARED="OFF" CHAR_SIGN="signed" API_VERSION="2"
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- g++-multilib
|
||||
- gcc-multilib
|
||||
- gcc-6-multilib
|
||||
- g++-6-multilib
|
||||
- lib32stdc++6-6-dbg
|
||||
- lib32gcc1
|
||||
- libc6-i386
|
||||
- lib32z1-dev
|
||||
- zlib1g-dev
|
||||
- bzip2
|
||||
- libc6-dbg
|
||||
|
||||
script:
|
||||
- CMAKE_CXX_COMPILER="${CXX}" CMAKE_C_COMPILER="${CC}" CMAKE_LIBRARY_PATH="${BASE}/usr/lib:${BASE}/build" GTEST_ROOT="${BASE}/usr" BOOST_ROOT="${BASE}/usr" CFLAGS="-Werror -g" CXXFLAGS="-Werror -g" ${ACTION}
|
||||
- cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
|
67
CHANGELOG.md
67
CHANGELOG.md
@@ -1,8 +1,73 @@
|
||||
# 2020-06-05 version 3.3.0
|
||||
* Add json example for C (#870)
|
||||
* Add both header and body packing functions for C (#870)
|
||||
* Set default ref_size and chunk_size to vrefbuffer (#865)
|
||||
* Add examples (#861)
|
||||
* Improve build system (#839, #842)
|
||||
* Improve tests (#829)
|
||||
* Improve documents (#828)
|
||||
* Remove some warnings (#827, #851, #871)
|
||||
* Improve CI environment (#824, #831, #833, #834, #846, #860, 874)
|
||||
|
||||
# 2019-12-10 version 3.2.1
|
||||
* Fix snprintf return value checking (#821)
|
||||
* Remove some warnings (#819)
|
||||
* Fix fbuffer result checking (#812)
|
||||
* Fix temporary object handling (#807)
|
||||
* Improve cmake support (#804)
|
||||
* Fix invalid `int main` parameter (#800)
|
||||
* Improve supporting platform (#797, #817)
|
||||
* Fix ZLIB error handling (#795)
|
||||
* Remove unused variable (#793)
|
||||
* Improve integer overflow checking (#792)
|
||||
|
||||
# 2019-05-27 version 3.2.0
|
||||
|
||||
* Fix invalid include (#783)
|
||||
* Add timespec support (#781)
|
||||
* Fix unchecked fnprintf on C (#780)
|
||||
* Improve integer overflow checking on C (#776)
|
||||
* Fix warnings on `-Wconversion` (#770, #777, #784)
|
||||
* Fix invalid passed by value on aligned_zone_size_visitor (#764)
|
||||
* Improve windows support (#757, #779)
|
||||
* Fix msgpack::object size caluclation error (#754)
|
||||
* Fix memory error on example code (#753)
|
||||
* Fix redundant memory allocation on C (#747)
|
||||
* Fix msgpack::type::tuple base class conversion (#743)
|
||||
|
||||
# 2018-09-09 version 3.1.1
|
||||
|
||||
* Add force endian set functionality (#736)
|
||||
* Fix vrefbuffer memory management problem (#733)
|
||||
* Fix msvc specific problem (#731, #732)
|
||||
* Update boost from 1.61.0 to 1.68.0 (#730)
|
||||
* Fix msgpack_timestamp type mismatch bug (#726)
|
||||
|
||||
# 2018-08-10 version 3.1.0
|
||||
|
||||
* Improve documents (#687, #718)
|
||||
* Add fuzzer support (#689)
|
||||
* Fix msgpack::object union member access bug (#694)
|
||||
* Improve cross platform configuration (#704)
|
||||
* Fix out of range dereference bug of EXT (#705)
|
||||
* Add timestamp support. std::chrono::system_clock::time_point is mapped to TIMESTAMP (#706)
|
||||
* Add minimal timestamp support for C. The type `msgpack_timestamp` and the function `msgpack_object_to_timestamp()` are introduced (#707)
|
||||
* Improve MSGPACK_DEFINE family name confliction probability (#710)
|
||||
* Add no static-library build option (BUILD_SHARED_LIBS=ON) (#713, #717, #722)
|
||||
* Add header only cmake target (#721)
|
||||
* Add `std::byte` adaptor (#719)
|
||||
* Remove some warnings (#720)
|
||||
|
||||
# 2018-05-12 version 3.0.1
|
||||
|
||||
* Add fuzz directory to release tar ball (#686)
|
||||
* Add include file checking for X-Code (#683)
|
||||
|
||||
# 2018-05-09 version 3.0.0
|
||||
|
||||
## << breaking changes >>
|
||||
|
||||
* Change offset parameter updating rule. If parse error is happend, offset is updated to the error position. (#639, #666)
|
||||
* Change offset parameter updating rule. If parse error happens, offset is updated to the error position. (#639, #666)
|
||||
|
||||
## << other updates >>
|
||||
|
||||
|
205
CMakeLists.txt
205
CMakeLists.txt
@@ -16,6 +16,7 @@ STRING (REGEX MATCH "#define MSGPACK_VERSION_REVISION *([0-9a-zA-Z_]*)" NULL_OUT
|
||||
SET (VERSION_REVISION ${CMAKE_MATCH_1})
|
||||
SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION})
|
||||
|
||||
LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
|
||||
SET (prefix ${CMAKE_INSTALL_PREFIX})
|
||||
SET (exec_prefix "\${prefix}")
|
||||
SET (libdir "\${exec_prefix}/lib")
|
||||
@@ -150,12 +151,58 @@ ENDFOREACH ()
|
||||
FIND_PACKAGE (GTest)
|
||||
FIND_PACKAGE (ZLIB)
|
||||
FIND_PACKAGE (Threads)
|
||||
IF (GTEST_FOUND AND ZLIB_FOUND AND THREADS_FOUND)
|
||||
IF (GTEST_FOUND AND ZLIB_FOUND AND THREADS_FOUND AND NOT "${MSGPACK_FUZZ_REGRESSION}" STREQUAL "ON")
|
||||
OPTION (MSGPACK_BUILD_TESTS "Build msgpack tests." ON)
|
||||
OPTION (MSGPACK_GEN_COVERAGE "Enable running gcov to get a test coverage report." OFF)
|
||||
ENDIF ()
|
||||
|
||||
OPTION (MSGPACK_ENABLE_CXX "Enable C++ interface." ON)
|
||||
OPTION (MSGPACK_ENABLE_SHARED "Build shared libaries in addition to static libraries." ON)
|
||||
|
||||
OPTION (MSGPACK_CXX_ONLY "Build only C++ libraries (header-only)." OFF)
|
||||
IF (MSGPACK_CXX_ONLY)
|
||||
IF (DEFINED MSGPACK_ENABLE_SHARED AND MSGPACK_ENABLE_SHARED)
|
||||
MESSAGE(WARNING "MSGPACK_ENABLE_SHARED is overridden to OFF by MSGPACK_CXX_ONLY")
|
||||
ENDIF ()
|
||||
SET (MSGPACK_ENABLE_SHARED OFF)
|
||||
IF (DEFINED MSGPACK_ENABLE_STATIC AND MSGPACK_ENABLE_STATIC)
|
||||
MESSAGE(WARNING "MSGPACK_ENABLE_STATIC is overridden to OFF by MSGPACK_CXX_ONLY")
|
||||
ENDIF ()
|
||||
SET (MSGPACK_ENABLE_STATIC OFF)
|
||||
IF (DEFINED MSGPACK_ENABLE_CXX AND NOT MSGPACK_ENABLE_CXX)
|
||||
MESSAGE(WARNING "MSGPACK_ENABLE_CXX is overridden to ON by MSGPACK_CXX_ONLY")
|
||||
ENDIF ()
|
||||
SET (MSGPACK_ENABLE_CXX ON)
|
||||
ELSE ()
|
||||
IF (DEFINED BUILD_SHARED_LIBS)
|
||||
IF (BUILD_SHARED_LIBS)
|
||||
IF (DEFINED MSGPACK_ENABLE_SHARED AND NOT MSGPACK_ENABLE_SHARED)
|
||||
MESSAGE(WARNING "MSGPACK_ENABLE_SHARED is overridden to ON by BUILD_SHARED_LIBS")
|
||||
ENDIF ()
|
||||
SET (MSGPACK_ENABLE_SHARED ON)
|
||||
IF (DEFINED MSGPACK_ENABLE_STATIC AND MSGPACK_ENABLE_STATIC)
|
||||
MESSAGE(WARNING "MSGPACK_ENABLE_STATIC is overridden to OFF by BUILD_SHARED_LIBS")
|
||||
ENDIF ()
|
||||
SET (MSGPACK_ENABLE_STATIC OFF)
|
||||
ELSE ()
|
||||
IF (DEFINED MSGPACK_ENABLE_SHARED AND MSGPACK_ENABLE_SHARED)
|
||||
MESSAGE(WARNING "MSGPACK_ENABLE_SHARED is overridden to OFF by BUILD_SHARED_LIBS")
|
||||
ENDIF ()
|
||||
SET (MSGPACK_ENABLE_SHARED OFF)
|
||||
IF (DEFINED MSGPACK_ENABLE_STATIC AND NOT MSGPACK_ENABLE_STATIC)
|
||||
MESSAGE(WARNING "MSGPACK_ENABLE_STATIC is overridden to ON by BUILD_SHARED_LIBS")
|
||||
ENDIF ()
|
||||
SET (MSGPACK_ENABLE_STATIC ON)
|
||||
ENDIF ()
|
||||
ELSE ()
|
||||
IF (NOT DEFINED MSGPACK_ENABLE_SHARED)
|
||||
SET (MSGPACK_ENABLE_SHARED ON)
|
||||
ENDIF ()
|
||||
IF (NOT DEFINED MSGPACK_ENABLE_STATIC)
|
||||
SET (MSGPACK_ENABLE_STATIC ON)
|
||||
ENDIF ()
|
||||
SET (BUILD_SHARED_LIBS ${MSGPACK_ENABLE_SHARED})
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
INCLUDE (CheckCXXSourceCompiles)
|
||||
CHECK_CXX_SOURCE_COMPILES ("
|
||||
@@ -181,12 +228,15 @@ CONFIGURE_FILE (
|
||||
@ONLY
|
||||
)
|
||||
|
||||
IF (MSGPACK_ENABLE_SHARED)
|
||||
ADD_LIBRARY (msgpackc SHARED
|
||||
|
||||
IF (MSGPACK_ENABLE_SHARED OR MSGPACK_ENABLE_STATIC)
|
||||
ADD_LIBRARY (msgpackc
|
||||
${msgpackc_SOURCES}
|
||||
${msgpackc_HEADERS}
|
||||
)
|
||||
|
||||
SET_TARGET_PROPERTIES (msgpackc PROPERTIES SOVERSION 2 VERSION 2.0.0)
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES (msgpackc
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
@@ -197,33 +247,68 @@ IF (MSGPACK_ENABLE_SHARED)
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
ADD_LIBRARY (msgpackc-static STATIC
|
||||
${msgpackc_SOURCES}
|
||||
${msgpackc_HEADERS}
|
||||
)
|
||||
IF (MSGPACK_ENABLE_CXX AND ((CMAKE_VERSION VERSION_GREATER 3.0) OR (CMAKE_VERSION VERSION_EQUAL 3.0)))
|
||||
ADD_LIBRARY (msgpackc-cxx INTERFACE)
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES (msgpackc-static
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
IF (NOT MSGPACK_ENABLE_SHARED)
|
||||
# Add alias for subdirectories
|
||||
ADD_LIBRARY (msgpackc ALIAS msgpackc-static)
|
||||
TARGET_INCLUDE_DIRECTORIES (msgpackc-cxx
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
SET_TARGET_PROPERTIES (msgpackc-static PROPERTIES OUTPUT_NAME "msgpackc")
|
||||
IF (MSGPACK_ENABLE_SHARED)
|
||||
IF (MSVC)
|
||||
SET_TARGET_PROPERTIES (msgpackc PROPERTIES IMPORT_SUFFIX "_import.lib")
|
||||
ELSEIF (MINGW)
|
||||
SET_TARGET_PROPERTIES (msgpackc PROPERTIES IMPORT_SUFFIX ".dll.a")
|
||||
IF (MSGPACK_ENABLE_SHARED AND MSGPACK_ENABLE_STATIC)
|
||||
ADD_LIBRARY (msgpackc-static STATIC
|
||||
${msgpackc_SOURCES}
|
||||
${msgpackc_HEADERS}
|
||||
)
|
||||
|
||||
TARGET_INCLUDE_DIRECTORIES (msgpackc-static
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
SET_TARGET_PROPERTIES (msgpackc-static PROPERTIES OUTPUT_NAME "msgpackc")
|
||||
|
||||
IF (MSGPACK_ENABLE_SHARED)
|
||||
IF (MSVC)
|
||||
SET_TARGET_PROPERTIES (msgpackc PROPERTIES IMPORT_SUFFIX "_import.lib")
|
||||
ELSEIF (MINGW)
|
||||
SET_TARGET_PROPERTIES (msgpackc PROPERTIES IMPORT_SUFFIX ".dll.a")
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
SET_TARGET_PROPERTIES (msgpackc PROPERTIES SOVERSION 2 VERSION 2.0.0)
|
||||
ENDIF ()
|
||||
|
||||
# enable regression testing
|
||||
IF ("${MSGPACK_FUZZ_REGRESSION}" STREQUAL "ON" AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
SET (CMAKE_CXX_FLAGS "-DMSGPACK_USE_BOOST ${CMAKE_CXX_FLAGS}")
|
||||
SET (Boost_USE_MULTITHREADED ON)
|
||||
SET (Boost_USE_STATIC_RUNTIME OFF)
|
||||
|
||||
enable_testing ()
|
||||
ADD_SUBDIRECTORY (fuzz)
|
||||
SET (MSGPACK_BUILD_EXAMPLES OFF)
|
||||
ENDIF ()
|
||||
|
||||
IF (MSGPACK_GEN_COVERAGE)
|
||||
IF (NOT MSGPACK_BUILD_TESTS)
|
||||
MESSAGE(FATAL_ERROR "Coverage requires -DMSGPACK_BUILD_TESTS=ON")
|
||||
ENDIF ()
|
||||
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" UPPER_CMAKE_BUILD_TYPE)
|
||||
IF (NOT "${UPPER_CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
|
||||
MESSAGE(FATAL_ERROR "Coverage requires -DCMAKE_BUILD_TYPE=Debug")
|
||||
ENDIF ()
|
||||
|
||||
INCLUDE(CodeCoverage)
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_FLAGS}")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS}")
|
||||
|
||||
SETUP_TARGET_FOR_COVERAGE(coverage make coverage test)
|
||||
ENDIF ()
|
||||
|
||||
IF (MSGPACK_BUILD_TESTS)
|
||||
@@ -236,17 +321,21 @@ IF (MSGPACK_BUILD_TESTS)
|
||||
ENDIF ()
|
||||
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
IF (MSGPACK_ENABLE_SHARED)
|
||||
IF (MSGPACK_ENABLE_SHARED OR MSGPACK_ENABLE_STATIC)
|
||||
SET_PROPERTY (TARGET msgpackc APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra -DPIC")
|
||||
ENDIF ()
|
||||
SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra" )
|
||||
IF (MSGPACK_ENABLE_SHARED AND MSGPACK_ENABLE_STATIC)
|
||||
SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra" )
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
IF (MSGPACK_ENABLE_SHARED)
|
||||
IF (MSGPACK_ENABLE_SHARED OR MSGPACK_ENABLE_STATIC)
|
||||
SET_PROPERTY (TARGET msgpackc APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
|
||||
ENDIF ()
|
||||
SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
|
||||
IF (MSGPACK_ENABLE_SHARED AND MSGPACK_ENABLE_STATIC)
|
||||
SET_PROPERTY (TARGET msgpackc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
@@ -257,6 +346,14 @@ IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
IF ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
|
||||
IF (CMAKE_C_FLAGS MATCHES "/W[0-4]")
|
||||
STRING(REGEX REPLACE "/W[0-4]" "/W3 /WX" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
ELSE ()
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /WX")
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC90" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC10")
|
||||
SET_SOURCE_FILES_PROPERTIES(${msgpackc_SOURCES} PROPERTIES LANGUAGE CXX)
|
||||
ENDIF ()
|
||||
@@ -278,10 +375,16 @@ IF (MSGPACK_BUILD_EXAMPLES)
|
||||
ADD_SUBDIRECTORY (example)
|
||||
ENDIF ()
|
||||
|
||||
IF (MSGPACK_ENABLE_SHARED)
|
||||
SET (MSGPACK_INSTALLTARGETS msgpackc msgpackc-static)
|
||||
ELSE()
|
||||
SET (MSGPACK_INSTALLTARGETS msgpackc-static)
|
||||
IF (MSGPACK_ENABLE_SHARED OR MSGPACK_ENABLE_STATIC)
|
||||
SET (MSGPACK_INSTALLTARGETS msgpackc)
|
||||
ENDIF ()
|
||||
|
||||
IF (MSGPACK_ENABLE_CXX AND ((CMAKE_VERSION VERSION_GREATER 3.0) OR (CMAKE_VERSION VERSION_EQUAL 3.0)))
|
||||
LIST (APPEND MSGPACK_INSTALLTARGETS msgpackc-cxx)
|
||||
ENDIF ()
|
||||
|
||||
IF (MSGPACK_ENABLE_SHARED AND MSGPACK_ENABLE_STATIC)
|
||||
LIST (APPEND MSGPACK_INSTALLTARGETS msgpackc-static)
|
||||
ENDIF ()
|
||||
|
||||
INSTALL (TARGETS ${MSGPACK_INSTALLTARGETS} EXPORT msgpack-targets
|
||||
@@ -293,7 +396,7 @@ FOREACH (file ${msgpackc_HEADERS})
|
||||
GET_FILENAME_COMPONENT (dir ${file} PATH)
|
||||
INSTALL (FILES ${file} DESTINATION ${CMAKE_INSTALL_PREFIX}/${dir})
|
||||
ENDFOREACH ()
|
||||
IF (NOT MSVC)
|
||||
IF (NOT MSGPACK_CXX_ONLY AND NOT MSVC)
|
||||
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/msgpack.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
ENDIF ()
|
||||
|
||||
@@ -307,6 +410,7 @@ IF (DOXYGEN_FOUND)
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "INPUT = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "EXTRACT_ALL = YES" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "PROJECT_NAME = \"MessagePack for C\"" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "STRIP_FROM_PATH = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
|
||||
)
|
||||
IF (DOXYGEN_DOT_FOUND)
|
||||
LIST (APPEND Doxyfile_c_CONTENT
|
||||
@@ -325,6 +429,7 @@ IF (DOXYGEN_FOUND)
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "OUTPUT_DIRECTORY = doc_cpp" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "INPUT = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "EXTRACT_ALL = YES" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "STRIP_FROM_PATH = ${CMAKE_CURRENT_SOURCE_DIR}/include" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
|
||||
)
|
||||
IF (DOXYGEN_DOT_FOUND)
|
||||
LIST (APPEND Doxyfile_cpp_CONTENT
|
||||
@@ -365,17 +470,19 @@ CONFIGURE_PACKAGE_CONFIG_FILE (msgpack-config.cmake.in
|
||||
INSTALL_DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
|
||||
)
|
||||
|
||||
INSTALL (EXPORT msgpack-targets
|
||||
FILE
|
||||
msgpack-targets.cmake
|
||||
DESTINATION
|
||||
"${CMAKE_INSTALL_CMAKEDIR}"
|
||||
)
|
||||
IF (NOT MSGPACK_CXX_ONLY)
|
||||
INSTALL (EXPORT msgpack-targets
|
||||
FILE
|
||||
msgpack-targets.cmake
|
||||
DESTINATION
|
||||
"${CMAKE_INSTALL_CMAKEDIR}"
|
||||
)
|
||||
|
||||
INSTALL (
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/msgpack-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/msgpack-config-version.cmake"
|
||||
DESTINATION
|
||||
"${CMAKE_INSTALL_CMAKEDIR}"
|
||||
)
|
||||
INSTALL (
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/msgpack-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/msgpack-config-version.cmake"
|
||||
DESTINATION
|
||||
"${CMAKE_INSTALL_CMAKEDIR}"
|
||||
)
|
||||
ENDIF ()
|
||||
|
2
Doxyfile
2
Doxyfile
@@ -281,7 +281,7 @@ TYPEDEF_HIDES_STRUCT = NO
|
||||
# causing a significant performance penality.
|
||||
# If the system has enough physical memory increasing the cache will improve the
|
||||
# performance by keeping more symbols in memory. Note that the value works on
|
||||
# a logarithmic scale so increasing the size by one will rougly double the
|
||||
# a logarithmic scale so increasing the size by one will roughly double the
|
||||
# memory usage. The cache size is given by this formula:
|
||||
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
|
||||
# corresponding to a cache size of 2^16 = 65536 symbols
|
||||
|
58
Files.cmake
58
Files.cmake
@@ -5,14 +5,11 @@ LIST (APPEND msgpackc_SOURCES
|
||||
src/vrefbuffer.c
|
||||
src/zone.c
|
||||
)
|
||||
|
||||
# For both C and C++ libraries
|
||||
LIST (APPEND msgpackc_HEADERS
|
||||
include/msgpack.h
|
||||
include/msgpack/fbuffer.h
|
||||
include/msgpack/gcc_atomic.h
|
||||
include/msgpack/object.h
|
||||
include/msgpack/pack.h
|
||||
include/msgpack/pack_define.h
|
||||
include/msgpack/pack_template.h
|
||||
include/msgpack/predef.h
|
||||
include/msgpack/predef/architecture.h
|
||||
include/msgpack/predef/architecture/alpha.h
|
||||
@@ -24,6 +21,7 @@ LIST (APPEND msgpackc_HEADERS
|
||||
include/msgpack/predef/architecture/mips.h
|
||||
include/msgpack/predef/architecture/parisc.h
|
||||
include/msgpack/predef/architecture/ppc.h
|
||||
include/msgpack/predef/architecture/ptx.h
|
||||
include/msgpack/predef/architecture/pyramid.h
|
||||
include/msgpack/predef/architecture/rs6k.h
|
||||
include/msgpack/predef/architecture/sparc.h
|
||||
@@ -57,6 +55,7 @@ LIST (APPEND msgpackc_HEADERS
|
||||
include/msgpack/predef/compiler/metrowerks.h
|
||||
include/msgpack/predef/compiler/microtec.h
|
||||
include/msgpack/predef/compiler/mpw.h
|
||||
include/msgpack/predef/compiler/nvcc.h
|
||||
include/msgpack/predef/compiler/palm.h
|
||||
include/msgpack/predef/compiler/pgi.h
|
||||
include/msgpack/predef/compiler/sgi_mipspro.h
|
||||
@@ -83,12 +82,14 @@ LIST (APPEND msgpackc_HEADERS
|
||||
include/msgpack/predef/hardware/simd/x86_amd.h
|
||||
include/msgpack/predef/hardware/simd/x86_amd/versions.h
|
||||
include/msgpack/predef/language.h
|
||||
include/msgpack/predef/language/cuda.h
|
||||
include/msgpack/predef/language/objc.h
|
||||
include/msgpack/predef/language/stdc.h
|
||||
include/msgpack/predef/language/stdcpp.h
|
||||
include/msgpack/predef/library.h
|
||||
include/msgpack/predef/library/c.h
|
||||
include/msgpack/predef/library/c/_prefix.h
|
||||
include/msgpack/predef/library/c/cloudabi.h
|
||||
include/msgpack/predef/library/c/gnu.h
|
||||
include/msgpack/predef/library/c/uc.h
|
||||
include/msgpack/predef/library/c/vms.h
|
||||
@@ -132,27 +133,49 @@ LIST (APPEND msgpackc_HEADERS
|
||||
include/msgpack/predef/os/windows.h
|
||||
include/msgpack/predef/other.h
|
||||
include/msgpack/predef/other/endian.h
|
||||
include/msgpack/predef/other/workaround.h
|
||||
include/msgpack/predef/platform.h
|
||||
include/msgpack/predef/platform/cloudabi.h
|
||||
include/msgpack/predef/platform/ios.h
|
||||
include/msgpack/predef/platform/mingw.h
|
||||
include/msgpack/predef/platform/mingw32.h
|
||||
include/msgpack/predef/platform/mingw64.h
|
||||
include/msgpack/predef/platform/windows_desktop.h
|
||||
include/msgpack/predef/platform/windows_phone.h
|
||||
include/msgpack/predef/platform/windows_runtime.h
|
||||
include/msgpack/predef/platform/windows_server.h
|
||||
include/msgpack/predef/platform/windows_store.h
|
||||
include/msgpack/predef/platform/windows_system.h
|
||||
include/msgpack/predef/platform/windows_uwp.h
|
||||
include/msgpack/predef/version.h
|
||||
include/msgpack/predef/version_number.h
|
||||
include/msgpack/sbuffer.h
|
||||
include/msgpack/sysdep.h
|
||||
include/msgpack/unpack.h
|
||||
include/msgpack/unpack_define.h
|
||||
include/msgpack/unpack_template.h
|
||||
include/msgpack/util.h
|
||||
include/msgpack/version.h
|
||||
include/msgpack/version_master.h
|
||||
include/msgpack/vrefbuffer.h
|
||||
include/msgpack/zbuffer.h
|
||||
include/msgpack/zone.h
|
||||
)
|
||||
|
||||
IF (NOT MSGPACK_CXX_ONLY)
|
||||
# Only for C library
|
||||
LIST (APPEND msgpackc_HEADERS
|
||||
include/msgpack.h
|
||||
include/msgpack/gcc_atomic.h
|
||||
include/msgpack/pack.h
|
||||
include/msgpack/pack_define.h
|
||||
include/msgpack/pack_template.h
|
||||
include/msgpack/sbuffer.h
|
||||
include/msgpack/timestamp.h
|
||||
include/msgpack/unpack.h
|
||||
include/msgpack/unpack_template.h
|
||||
include/msgpack/util.h
|
||||
include/msgpack/version.h
|
||||
include/msgpack/vrefbuffer.h
|
||||
)
|
||||
ENDIF ()
|
||||
|
||||
IF (MSGPACK_ENABLE_CXX)
|
||||
# Only for C++ library
|
||||
LIST (APPEND msgpackc_HEADERS
|
||||
include/msgpack.hpp
|
||||
include/msgpack/adaptor/adaptor_base.hpp
|
||||
@@ -173,15 +196,20 @@ IF (MSGPACK_ENABLE_CXX)
|
||||
include/msgpack/adaptor/cpp11/array.hpp
|
||||
include/msgpack/adaptor/cpp11/array_char.hpp
|
||||
include/msgpack/adaptor/cpp11/array_unsigned_char.hpp
|
||||
include/msgpack/adaptor/cpp11/chrono.hpp
|
||||
include/msgpack/adaptor/cpp11/forward_list.hpp
|
||||
include/msgpack/adaptor/cpp11/reference_wrapper.hpp
|
||||
include/msgpack/adaptor/cpp11/shared_ptr.hpp
|
||||
include/msgpack/adaptor/cpp11/timespec.hpp
|
||||
include/msgpack/adaptor/cpp11/tuple.hpp
|
||||
include/msgpack/adaptor/cpp11/unique_ptr.hpp
|
||||
include/msgpack/adaptor/cpp11/unordered_map.hpp
|
||||
include/msgpack/adaptor/cpp11/unordered_set.hpp
|
||||
include/msgpack/adaptor/cpp17/byte.hpp
|
||||
include/msgpack/adaptor/cpp17/carray_byte.hpp
|
||||
include/msgpack/adaptor/cpp17/optional.hpp
|
||||
include/msgpack/adaptor/cpp17/string_view.hpp
|
||||
include/msgpack/adaptor/cpp17/vector_byte.hpp
|
||||
include/msgpack/adaptor/define.hpp
|
||||
include/msgpack/adaptor/define_decl.hpp
|
||||
include/msgpack/adaptor/deque.hpp
|
||||
@@ -214,6 +242,7 @@ IF (MSGPACK_ENABLE_CXX)
|
||||
include/msgpack/adaptor/vector_bool.hpp
|
||||
include/msgpack/adaptor/vector_char.hpp
|
||||
include/msgpack/adaptor/vector_unsigned_char.hpp
|
||||
include/msgpack/adaptor/wstring.hpp
|
||||
include/msgpack/cpp_config.hpp
|
||||
include/msgpack/cpp_config_decl.hpp
|
||||
include/msgpack/create_object_visitor.hpp
|
||||
@@ -439,6 +468,7 @@ IF (MSGPACK_ENABLE_CXX)
|
||||
include/msgpack/preprocessor/seq/detail/binary_transform.hpp
|
||||
include/msgpack/preprocessor/seq/detail/is_empty.hpp
|
||||
include/msgpack/preprocessor/seq/detail/split.hpp
|
||||
include/msgpack/preprocessor/seq/detail/to_list_msvc.hpp
|
||||
include/msgpack/preprocessor/seq/elem.hpp
|
||||
include/msgpack/preprocessor/seq/enum.hpp
|
||||
include/msgpack/preprocessor/seq/filter.hpp
|
||||
@@ -529,15 +559,20 @@ IF (MSGPACK_ENABLE_CXX)
|
||||
include/msgpack/v1/adaptor/cpp11/array.hpp
|
||||
include/msgpack/v1/adaptor/cpp11/array_char.hpp
|
||||
include/msgpack/v1/adaptor/cpp11/array_unsigned_char.hpp
|
||||
include/msgpack/v1/adaptor/cpp11/chrono.hpp
|
||||
include/msgpack/v1/adaptor/cpp11/forward_list.hpp
|
||||
include/msgpack/v1/adaptor/cpp11/reference_wrapper.hpp
|
||||
include/msgpack/v1/adaptor/cpp11/shared_ptr.hpp
|
||||
include/msgpack/v1/adaptor/cpp11/timespec.hpp
|
||||
include/msgpack/v1/adaptor/cpp11/tuple.hpp
|
||||
include/msgpack/v1/adaptor/cpp11/unique_ptr.hpp
|
||||
include/msgpack/v1/adaptor/cpp11/unordered_map.hpp
|
||||
include/msgpack/v1/adaptor/cpp11/unordered_set.hpp
|
||||
include/msgpack/v1/adaptor/cpp17/byte.hpp
|
||||
include/msgpack/v1/adaptor/cpp17/carray_byte.hpp
|
||||
include/msgpack/v1/adaptor/cpp17/optional.hpp
|
||||
include/msgpack/v1/adaptor/cpp17/string_view.hpp
|
||||
include/msgpack/v1/adaptor/cpp17/vector_byte.hpp
|
||||
include/msgpack/v1/adaptor/define.hpp
|
||||
include/msgpack/v1/adaptor/define_decl.hpp
|
||||
include/msgpack/v1/adaptor/deque.hpp
|
||||
@@ -583,6 +618,7 @@ IF (MSGPACK_ENABLE_CXX)
|
||||
include/msgpack/v1/adaptor/vector_bool.hpp
|
||||
include/msgpack/v1/adaptor/vector_char.hpp
|
||||
include/msgpack/v1/adaptor/vector_unsigned_char.hpp
|
||||
include/msgpack/v1/adaptor/wstring.hpp
|
||||
include/msgpack/v1/cpp_config.hpp
|
||||
include/msgpack/v1/cpp_config_decl.hpp
|
||||
include/msgpack/v1/detail/cpp03_zone.hpp
|
||||
|
@@ -6,10 +6,11 @@ Currently, RPC implementation is not available.
|
||||
|
||||
# Install
|
||||
|
||||
## Install with package manager
|
||||
|
||||
## Mac OS X with MacPorts
|
||||
### MacOS with MacPorts
|
||||
|
||||
On Mac OS X, you can install MessagePack for C using MacPorts.
|
||||
On MacOS, you can install MessagePack for C using MacPorts.
|
||||
|
||||
```
|
||||
$ sudo port install msgpack
|
||||
@@ -23,48 +24,44 @@ You can also install via Homebrew.
|
||||
$ brew install msgpack
|
||||
```
|
||||
|
||||
## FreeBSD with Ports Collection
|
||||
### FreeBSD with Ports Collection
|
||||
|
||||
On FreeBSD, you can use Ports Collection. Install [net/msgpack|http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/msgpack/] package.
|
||||
On FreeBSD, you can use Ports Collection. Install [net/msgpack](http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/msgpack/) package.
|
||||
|
||||
## Gentoo Linux with Portage
|
||||
### Gentoo Linux with Portage
|
||||
|
||||
On Gentoo Linux, you can use emerge. Install [dev-libs/msgpack|http://gentoo-portage.com/dev-libs/msgpack] package.
|
||||
On Gentoo Linux, you can use emerge. Install [dev-libs/msgpack](http://gentoo-portage.com/dev-libs/msgpack) package.
|
||||
|
||||
## Other UNIX-like platform with ./configure
|
||||
### Windows with vcpkg
|
||||
|
||||
On the other UNIX-like platforms, download source package from [Releases|http://msgpack.org/releases/cpp/] and run `./configure && make && make install`.
|
||||
There are several package managers available, and vcpkg is typical.
|
||||
|
||||
```
|
||||
$ wget http://msgpack.org/releases/cpp/msgpack-1.3.0.tar.gz
|
||||
$ vcpkg install msgpack:x64-windows
|
||||
```
|
||||
## Install with source code
|
||||
|
||||
### Build with cmake
|
||||
|
||||
You need to install cmake (2.8.12 or higher) first.
|
||||
|
||||
```
|
||||
$ git clone https://github.com/msgpack/msgpack-c.git
|
||||
$ cd msgpack-c
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
$ cmake --build .
|
||||
$ cmake --build . --target install
|
||||
```
|
||||
### Build with autotools
|
||||
|
||||
In versions 1.4.2 and below, you can use `autotools` to build on UNIX-like platforms.
|
||||
```
|
||||
$ wget https://github.com/msgpack/msgpack-c/archive/cpp-1.3.0.tar.gz
|
||||
$ tar zxvf msgpack-1.3.0.tar.gz
|
||||
$ cd msgpack-1.3.0
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
```
|
||||
|
||||
## Windows
|
||||
|
||||
On Windows, download source package from [here|https://sourceforge.net/projects/msgpack/files/] and extract it.
|
||||
Then open `msgpack_vc8.vcproj` file and build it using batch build. It builds libraries on `lib/` folder and header files on `include/` folder.
|
||||
|
||||
You can build using command line as follows:
|
||||
|
||||
```
|
||||
> vcbuild msgpack_vc2008.vcproj
|
||||
> dir lib % DLL files are here
|
||||
> dir include % header files are here
|
||||
```
|
||||
|
||||
## Install from git repository
|
||||
|
||||
You need to install gcc (4.1.0 or higher), autotools.
|
||||
|
||||
```
|
||||
$ git clone git@github.com:msgpack/msgpack.git
|
||||
$ cd msgpack/cpp
|
||||
$ ./bootstrap
|
||||
$ ./bootstrap # If the 'configure' script already exists, you can omit this step.
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
@@ -59,7 +59,7 @@ $ ./hello
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
int main(void) {
|
||||
int main() {
|
||||
// serializes multiple objects using msgpack::packer.
|
||||
msgpack::sbuffer buffer;
|
||||
|
||||
@@ -98,7 +98,7 @@ int main(void) {
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
int main(void) {
|
||||
int main() {
|
||||
// serializes multiple objects into one message containing an array using msgpack::packer.
|
||||
msgpack::sbuffer buffer;
|
||||
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
MSGPACK_DEFINE(m_str, m_vec);
|
||||
};
|
||||
|
||||
int main(void) {
|
||||
int main() {
|
||||
std::vector<myclass> vec;
|
||||
// add some elements into vec...
|
||||
|
||||
|
21
README.md
21
README.md
@@ -1,7 +1,8 @@
|
||||
`msgpack` for C/C++
|
||||
===================
|
||||
|
||||
Version 3.0.0 [](https://travis-ci.org/msgpack/msgpack-c) [](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/master)
|
||||
Version 3.3.0 [](https://travis-ci.org/msgpack/msgpack-c) [](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/master)
|
||||
[](https://codecov.io/gh/msgpack/msgpack-c)
|
||||
|
||||
It's like JSON but smaller and faster.
|
||||
|
||||
@@ -68,7 +69,7 @@ In C++:
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
int main(void)
|
||||
int main()
|
||||
{
|
||||
msgpack::type::tuple<int, bool, std::string> src(1, true, "example");
|
||||
|
||||
@@ -97,6 +98,10 @@ int main(void)
|
||||
msgpack::type::tuple<int, bool, std::string> dst;
|
||||
deserialized.convert(dst);
|
||||
|
||||
// or create the new instance
|
||||
msgpack::type::tuple<int, bool, std::string> dst2 =
|
||||
deserialized.as<msgpack::type::tuple<int, bool, std::string> >();
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
@@ -108,7 +113,7 @@ Usage
|
||||
|
||||
### C++ Header Only Library
|
||||
|
||||
When you use msgpack on C++03 and C++11, you can just add
|
||||
When you use msgpack on C++, you can just add
|
||||
msgpack-c/include to your include path:
|
||||
|
||||
g++ -I msgpack-c/include your_source_file.cpp
|
||||
@@ -135,14 +140,18 @@ C and C++03:
|
||||
$ make
|
||||
$ sudo make install
|
||||
|
||||
If you want to setup C++11 version of msgpack instead,
|
||||
If you want to setup C++11 or C++17 version of msgpack instead,
|
||||
execute the following commands:
|
||||
|
||||
$ git clone https://github.com/msgpack/msgpack-c.git
|
||||
$ cd msgpack-c
|
||||
$ cmake -DMSGPACK_CXX11=ON .
|
||||
$ cmake -DMSGPACK_CXX[11|17]=ON .
|
||||
$ sudo make install
|
||||
|
||||
`MSGPACK_CXX[11|17]` flags are not affected to installing files. Just switching test cases. All files are installed in every settings.
|
||||
|
||||
When you use the C part of `msgpack-c`, you need to build and link the library. By default, both static/shared libraries are built. If you want to build only static library, set `BUILD_SHARED_LIBS=OFF` to cmake. If you want to build only shared library, set `BUILD_SHARED_LIBS=ON`.
|
||||
|
||||
#### GUI on Windows
|
||||
|
||||
Clone msgpack-c git repository.
|
||||
@@ -170,7 +179,7 @@ the binaries:' text box.
|
||||
|
||||
### Documentation
|
||||
|
||||
You can get addtional information on the
|
||||
You can get additional information including the tutorial on the
|
||||
[wiki](https://github.com/msgpack/msgpack-c/wiki).
|
||||
|
||||
Contributing
|
||||
|
10
appveyor.yml
10
appveyor.yml
@@ -1,10 +1,14 @@
|
||||
version: 3.0.0.{build}
|
||||
version: 3.3.0.{build}
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
image:
|
||||
- Visual Studio 2015
|
||||
environment:
|
||||
global:
|
||||
BOOST_ROOT: C:\Libraries\boost_1_60_0
|
||||
BOOST_ROOT: C:\Libraries\boost_1_67_0
|
||||
matrix:
|
||||
- cpp11: -DMSGPACK_CXX11=OFF
|
||||
boost: -DMSGPACK_BOOST=OFF
|
||||
@@ -51,7 +55,7 @@ build_script:
|
||||
- md build
|
||||
- cd build
|
||||
- cmake -G %msvc% %cpp11% %boost% %x3_parse% -DGTEST_LIBRARY=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release\gtest.lib -DGTEST_MAIN_LIBRARY=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release\gtest_main.lib -DGTEST_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\include -DZLIB_LIBRARY=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.11\build\Release\zlib.lib -DZLIB_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%\zlib-1.2.11 -DCMAKE_CXX_FLAGS='"/D_VARIADIC_MAX=10 /EHsc"' ..
|
||||
- cmake --build . --config Release
|
||||
- cmake --build . --config Release -v
|
||||
|
||||
test_script:
|
||||
- set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\googletest-release-1.7.0\build\Release;%APPVEYOR_BUILD_FOLDER%\zlib-1.2.11\build\Release;%APPVEYOR_BUILD_FOLDER%\build\release
|
||||
|
@@ -19,11 +19,13 @@ fi
|
||||
if [ "${ARCH}" == "32" ]
|
||||
then
|
||||
export BIT32="ON"
|
||||
export ARCH_FLAG="-m32"
|
||||
else
|
||||
export BIT32="OFF"
|
||||
export ARCH_FLAG="-m64"
|
||||
fi
|
||||
|
||||
cmake -DMSGPACK_CXX11=${CXX11} -DMSGPACK_32BIT=${BIT32} -DMSGPACK_BOOST=${BOOST} -DMSGPACK_ENABLE_SHARED=${SHARED} -DMSGPACK_CHAR_SIGN=${CHAR_SIGN} -DMSGPACK_DEFAULT_API_VERSION=${API_VERSION} -DMSGPACK_USE_X3_PARSE=${X3_PARSE} ..
|
||||
cmake -DMSGPACK_CXX11=${CXX11} -DMSGPACK_CXX17=${CXX17} -DMSGPACK_32BIT=${BIT32} -DMSGPACK_BOOST=${BOOST} -DBUILD_SHARED_LIBS=${SHARED} -DMSGPACK_CHAR_SIGN=${CHAR_SIGN} -DMSGPACK_DEFAULT_API_VERSION=${API_VERSION} -DMSGPACK_USE_X3_PARSE=${X3_PARSE} -DCMAKE_CXX_FLAGS=${ARCH_FLAG} ..
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
@@ -39,7 +41,7 @@ then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
make test
|
||||
ctest -VV
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
@@ -72,4 +74,39 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${ARCH}" != "32" ]
|
||||
then
|
||||
mkdir install-test
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
cd install-test
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
cmake -DCMAKE_PREFIX_PATH=`pwd`/../install/usr/local/lib/cmake ../../example/cmake
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
make
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
59
ci/build_cmake_embedded.sh
Executable file
59
ci/build_cmake_embedded.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd example/cmake
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
rm -f msgpack-c
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
ln -s ../.. msgpack-c
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
mkdir build
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
cd build
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
cmake -DEXAMPLE_MSGPACK_EMBEDDED=ON ..
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
make example example-static
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
exit 0
|
49
ci/build_regression.sh
Executable file
49
ci/build_regression.sh
Executable file
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p build
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
cd build
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
if [ "${ARCH}" == "32" ]
|
||||
then
|
||||
echo "64 bit support required for regressions"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cmake -DMSGPACK_FUZZ_REGRESSION="ON" -DMSGPACK_CXX11="ON" -DMSGPACK_BOOST=${BOOST} -DMSGPACK_SAN=${MSGPACK_SAN} -v ..
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
make
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
make test
|
||||
|
||||
ret=$?
|
||||
if [ $ret -ne 0 ]
|
||||
then
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
exit 0
|
55
cmake/CodeCoverage.cmake
Normal file
55
cmake/CodeCoverage.cmake
Normal file
@@ -0,0 +1,55 @@
|
||||
# Check prereqs
|
||||
FIND_PROGRAM(GCOV_PATH gcov)
|
||||
FIND_PROGRAM(LCOV_PATH lcov)
|
||||
FIND_PROGRAM(GENHTML_PATH genhtml)
|
||||
|
||||
IF(NOT GCOV_PATH)
|
||||
MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT CMAKE_COMPILER_IS_GNUCC)
|
||||
# Clang version 3.0.0 and greater now supports gcov as well.
|
||||
MESSAGE(STATUS "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.")
|
||||
IF(NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
|
||||
MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(COVERAGE_FLAGS "-g -O0 --coverage")
|
||||
|
||||
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
|
||||
|
||||
IF(NOT LCOV_PATH)
|
||||
MESSAGE(FATAL_ERROR "lcov not found! Aborting...")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT GENHTML_PATH)
|
||||
MESSAGE(FATAL_ERROR "genhtml not found! Aborting...")
|
||||
ENDIF()
|
||||
|
||||
# Setup target
|
||||
ADD_CUSTOM_TARGET(${_targetname}
|
||||
|
||||
# Cleanup lcov
|
||||
${LCOV_PATH} --directory . --zerocounters
|
||||
|
||||
# Run tests
|
||||
COMMAND ${_testrunner} ${ARGV3}
|
||||
|
||||
# Capturing lcov counters and generating report
|
||||
COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info --base-directory ${CMAKE_SOURCE_DIR} --no-external --quiet
|
||||
COMMAND ${LCOV_PATH} --remove ${_outputname}.info '*/test/*' '*/fuzz/*' --output-file ${_outputname}.info.cleaned --quiet
|
||||
COMMAND ${GENHTML_PATH} -o ${_outputname} ${_outputname}.info.cleaned --prefix ${CMAKE_SOURCE_DIR}
|
||||
# COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info ${_outputname}.info.cleaned
|
||||
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
|
||||
)
|
||||
|
||||
# Show info where to find the report
|
||||
ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
|
||||
COMMAND ;
|
||||
COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
|
||||
)
|
||||
|
||||
ENDFUNCTION()
|
36
codecov.yml
Normal file
36
codecov.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
codecov:
|
||||
notify:
|
||||
require_ci_to_pass: yes
|
||||
|
||||
coverage:
|
||||
precision: 2
|
||||
round: down
|
||||
range: "70...100"
|
||||
|
||||
status:
|
||||
project: yes
|
||||
patch: yes
|
||||
changes: no
|
||||
|
||||
parsers:
|
||||
gcov:
|
||||
branch_detection:
|
||||
conditional: yes
|
||||
loop: yes
|
||||
method: no
|
||||
macro: no
|
||||
|
||||
comment:
|
||||
layout: "header, diff"
|
||||
behavior: default
|
||||
require_changes: no
|
||||
|
||||
ignore:
|
||||
- "test"
|
||||
- "fuzz"
|
||||
- "erb"
|
||||
- "ci"
|
||||
- "cmake"
|
||||
- "examle"
|
||||
- "external"
|
||||
- "usr"
|
@@ -121,7 +121,7 @@ inline tuple<> make_tuple()
|
||||
/// @cond
|
||||
<%0.upto(GENERATION_LIMIT) {|i|%>
|
||||
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
|
||||
inline tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(typename tuple_type<A0>::transparent_reference a0<%1.upto(i) {|j|%>, typename tuple_type<A<%=j%>>::transparent_reference a<%=j%><%}%>)
|
||||
tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(A0 const& a0<%1.upto(i) {|j|%>, A<%=j%> const& a<%=j%><%}%>)
|
||||
{
|
||||
return tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>(a0<%1.upto(i) {|j|%>, a<%=j%><%}%>);
|
||||
}
|
||||
|
@@ -54,7 +54,7 @@ tuple<> make_tuple();
|
||||
/// @cond
|
||||
<%0.upto(GENERATION_LIMIT) {|i|%>
|
||||
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
|
||||
tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(typename tuple_type<A0>::transparent_reference a0<%1.upto(i) {|j|%>, typename tuple_type<A<%=j%>>::transparent_reference a<%=j%><%}%>);
|
||||
tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_tuple(A0 const& a0<%1.upto(i) {|j|%>, A<%=j%> const& a<%=j%><%}%>);
|
||||
<%}%>
|
||||
/// @endcond
|
||||
|
||||
|
@@ -55,7 +55,7 @@ class zone {
|
||||
++m_tail;
|
||||
}
|
||||
void push_expand(void (*func)(void*), void* data) {
|
||||
const size_t nused = m_end - m_array;
|
||||
const size_t nused = static_cast<size_t>(m_end - m_array);
|
||||
size_t nnext;
|
||||
if(nused == 0) {
|
||||
nnext = (sizeof(finalizer) < 72/2) ?
|
||||
@@ -201,12 +201,12 @@ inline char* zone::get_aligned(char* ptr, size_t align)
|
||||
inline void* zone::allocate_align(size_t size, size_t align)
|
||||
{
|
||||
char* aligned = get_aligned(m_chunk_list.m_ptr, align);
|
||||
size_t adjusted_size = size + (aligned - m_chunk_list.m_ptr);
|
||||
size_t adjusted_size = size + static_cast<size_t>(aligned - m_chunk_list.m_ptr);
|
||||
if (m_chunk_list.m_free < adjusted_size) {
|
||||
size_t enough_size = size + align - 1;
|
||||
char* ptr = allocate_expand(enough_size);
|
||||
aligned = get_aligned(ptr, align);
|
||||
adjusted_size = size + (aligned - m_chunk_list.m_ptr);
|
||||
adjusted_size = size + static_cast<size_t>(aligned - m_chunk_list.m_ptr);
|
||||
}
|
||||
m_chunk_list.m_free -= adjusted_size;
|
||||
m_chunk_list.m_ptr += adjusted_size;
|
||||
|
@@ -1,5 +1,9 @@
|
||||
ADD_SUBDIRECTORY (c)
|
||||
ADD_SUBDIRECTORY (cpp03)
|
||||
ADD_SUBDIRECTORY (cpp11)
|
||||
ADD_SUBDIRECTORY (boost)
|
||||
ADD_SUBDIRECTORY (x3)
|
||||
IF (NOT MSGPACK_CXX_ONLY)
|
||||
ADD_SUBDIRECTORY (c)
|
||||
ENDIF ()
|
||||
IF (MSGPACK_ENABLE_CXX)
|
||||
ADD_SUBDIRECTORY (cpp03)
|
||||
ADD_SUBDIRECTORY (cpp11)
|
||||
ADD_SUBDIRECTORY (boost)
|
||||
ADD_SUBDIRECTORY (x3)
|
||||
ENDIF ()
|
||||
|
@@ -27,7 +27,7 @@ FOREACH (source_file ${exec_PROGRAMS})
|
||||
)
|
||||
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:msgpackc-cxx,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
TARGET_LINK_LIBRARIES (${source_file_we}
|
||||
${Boost_SYSTEM_LIBRARY}
|
||||
|
@@ -38,8 +38,8 @@ int main() {
|
||||
std::cout << __LINE__ << ":" << e.message() << std::endl;
|
||||
return;
|
||||
}
|
||||
unp.reserve_buffer(window_size);
|
||||
do_async_read_some = [&] {
|
||||
unp.reserve_buffer(window_size);
|
||||
ss.async_read_some(
|
||||
boost::asio::buffer(unp.buffer(), window_size),
|
||||
[&](boost::system::error_code const& e, std::size_t bytes_transferred) {
|
||||
|
@@ -83,7 +83,8 @@ int main() {
|
||||
u.address = "Tokyo";
|
||||
msgpack::pack(ss, u);
|
||||
|
||||
msgpack::object_handle oh = msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
std::string const& str = ss.str();
|
||||
msgpack::object_handle oh = msgpack::unpack(str.data(), str.size());
|
||||
msgpack::object const& obj = oh.get();
|
||||
std::cout << "Unpacked msgpack object." << std::endl;
|
||||
std::cout << obj << std::endl;
|
||||
|
@@ -1,17 +1,16 @@
|
||||
IF (MSGPACK_ENABLE_SHARED)
|
||||
SET (MSGPACK_LIB msgpackc)
|
||||
ELSE ()
|
||||
SET (MSGPACK_LIB msgpackc-static)
|
||||
ENDIF ()
|
||||
|
||||
FIND_PACKAGE (cJSON)
|
||||
|
||||
LIST (APPEND exec_PROGRAMS
|
||||
boundary.c
|
||||
lib_buffer_unpack.c
|
||||
simple_c.c
|
||||
speed_test_uint32_array.c
|
||||
speed_test_uint64_array.c
|
||||
user_buffer_unpack.c
|
||||
)
|
||||
IF (cJSON_FOUND)
|
||||
LIST (APPEND exec_PROGRAMS jsonconv.c)
|
||||
ENDIF ()
|
||||
|
||||
FOREACH (source_file ${exec_PROGRAMS})
|
||||
GET_FILENAME_COMPONENT (source_file_we ${source_file} NAME_WE)
|
||||
@@ -20,21 +19,26 @@ FOREACH (source_file ${exec_PROGRAMS})
|
||||
${source_file}
|
||||
)
|
||||
TARGET_LINK_LIBRARIES (${source_file_we}
|
||||
${MSGPACK_LIB}
|
||||
msgpackc
|
||||
)
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
IF ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
|
||||
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra")
|
||||
ENDIF ()
|
||||
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
IF ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
|
||||
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-mismatched-tags")
|
||||
ENDIF ()
|
||||
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||
IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||
STRING(REGEX REPLACE "/W[0-4]" "/W3 /WX" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
IF ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
|
||||
IF (CMAKE_C_FLAGS MATCHES "/W[0-4]")
|
||||
STRING(REGEX REPLACE "/W[0-4]" "/W3 /WX" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
ELSE ()
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /WX")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3 /WX")
|
||||
ENDIF ()
|
||||
ENDIF ()
|
||||
ENDFOREACH ()
|
||||
|
||||
IF (cJSON_FOUND)
|
||||
TARGET_LINK_LIBRARIES (jsonconv ${CJSON_LIBRARIES})
|
||||
TARGET_INCLUDE_DIRECTORIES(jsonconv PRIVATE ${CJSON_INCLUDE_DIRS})
|
||||
ENDIF ()
|
||||
|
296
example/c/boundary.c
Normal file
296
example/c/boundary.c
Normal file
@@ -0,0 +1,296 @@
|
||||
/* gcc boundary.c -o boundary -Wconversion -Wpointer-sign */
|
||||
#include <msgpack.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
static inline unsigned char atohex(char a)
|
||||
{
|
||||
int x;
|
||||
if (a >= 'a') {
|
||||
x = a - 'a' + 10;
|
||||
} else if (a >= 'A') {
|
||||
x = a - 'A' + 10;
|
||||
} else {
|
||||
x = a - '0';
|
||||
}
|
||||
assert(x >= 0 && x < 16);
|
||||
return (unsigned char)x;
|
||||
}
|
||||
|
||||
// Return 0 if equal
|
||||
static inline int bytesncmp(char *data, const char *bytes, size_t len)
|
||||
{
|
||||
size_t n = len >> 1;
|
||||
size_t i = 0;
|
||||
int diff;
|
||||
for (; i < n; i++) {
|
||||
diff = (unsigned char)data[i] - (atohex(bytes[2 * i]) << 4) - atohex(bytes[2 * i + 1]);
|
||||
if (diff != 0) {
|
||||
return diff;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
msgpack_sbuffer sbuf;
|
||||
msgpack_packer *x;
|
||||
size_t offset = 0;
|
||||
char data[65536];
|
||||
msgpack_timestamp ts[] = {
|
||||
{ 0xFFFFFFFF, 0 },
|
||||
{ 0x100000000, 0 },
|
||||
{ 0x3FFFFFFFF, 0 },
|
||||
{ 0x400000000, 0 },
|
||||
{ INT64_MAX, UINT32_MAX }
|
||||
};
|
||||
|
||||
#define check_sbuffer(b) \
|
||||
do { \
|
||||
size_t len = strlen(#b); \
|
||||
assert((sbuf.size - offset) * 2 == len); \
|
||||
assert(bytesncmp(sbuf.data + offset, #b, len) == 0); \
|
||||
offset = sbuf.size; \
|
||||
} while (0)
|
||||
|
||||
msgpack_sbuffer_init(&sbuf);
|
||||
x = msgpack_packer_new(&sbuf, msgpack_sbuffer_write);
|
||||
|
||||
msgpack_pack_fix_uint8(x, 0); check_sbuffer(cc00); /* cc 00 */
|
||||
msgpack_pack_fix_uint8(x, 0xFF); check_sbuffer(ccff); /* cc ff */
|
||||
msgpack_pack_fix_uint16(x, 0); check_sbuffer(cd0000); /* cd 00 00 */
|
||||
msgpack_pack_fix_uint16(x, 0xFFFF); check_sbuffer(cdffff); /* cd ff ff */
|
||||
msgpack_pack_fix_uint32(x, 0); check_sbuffer(ce00000000); /* ce 00 00 00 00 */
|
||||
msgpack_pack_fix_uint32(x, 0xFFFFFFFF); check_sbuffer(ceffffffff); /* ce ff ff ff ff */
|
||||
msgpack_pack_fix_uint64(x, 0); check_sbuffer(cf0000000000000000); /* cf 00 00 00 00 00 00 00 00 */
|
||||
msgpack_pack_fix_uint64(x, 0xFFFFFFFFFFFFFFFF); check_sbuffer(cfffffffffffffffff); /* cf ff ff ff ff ff ff ff ff */
|
||||
|
||||
msgpack_pack_uint8(x, 0); check_sbuffer(00); /* 00 */
|
||||
msgpack_pack_uint8(x, 0x7F); check_sbuffer(7f); /* 7f */
|
||||
msgpack_pack_uint8(x, 0x80); check_sbuffer(cc80); /* cc 80 */
|
||||
msgpack_pack_uint8(x, 0xFF); check_sbuffer(ccff); /* cc ff */
|
||||
|
||||
msgpack_pack_uint16(x, 0); check_sbuffer(00); /* 00 */
|
||||
msgpack_pack_uint16(x, 0x7F); check_sbuffer(7f); /* 7f */
|
||||
msgpack_pack_uint16(x, 0x80); check_sbuffer(cc80); /* cc 80 */
|
||||
msgpack_pack_uint16(x, 0xFF); check_sbuffer(ccff); /* cc ff */
|
||||
msgpack_pack_uint16(x, 0x100); check_sbuffer(cd0100); /* cd 01 00 */
|
||||
msgpack_pack_uint16(x, 0xFFFF); check_sbuffer(cdffff); /* cd ff ff */
|
||||
|
||||
msgpack_pack_uint32(x, 0); check_sbuffer(00); /* 00 */
|
||||
msgpack_pack_uint32(x, 0x7F); check_sbuffer(7f); /* 7f */
|
||||
msgpack_pack_uint32(x, 0x80); check_sbuffer(cc80); /* cc 80 */
|
||||
msgpack_pack_uint32(x, 0xFF); check_sbuffer(ccff); /* cc ff */
|
||||
msgpack_pack_uint32(x, 0x100); check_sbuffer(cd0100); /* cd 01 00 */
|
||||
msgpack_pack_uint32(x, 0xFFFF); check_sbuffer(cdffff); /* cd ff ff */
|
||||
msgpack_pack_uint32(x, 0x10000); check_sbuffer(ce00010000); /* ce 00 01 00 00 */
|
||||
msgpack_pack_uint32(x, 0xFFFFFFFF); check_sbuffer(ceffffffff); /* ce ff ff ff ff */
|
||||
|
||||
msgpack_pack_uint64(x, 0); check_sbuffer(00); /* 00 */
|
||||
msgpack_pack_uint64(x, 0x7F); check_sbuffer(7f); /* 7f */
|
||||
msgpack_pack_uint64(x, 0x80); check_sbuffer(cc80); /* cc 80 */
|
||||
msgpack_pack_uint64(x, 0xFF); check_sbuffer(ccff); /* cc ff */
|
||||
msgpack_pack_uint64(x, 0x100); check_sbuffer(cd0100); /* cd 01 00 */
|
||||
msgpack_pack_uint64(x, 0xFFFF); check_sbuffer(cdffff); /* cd ff ff */
|
||||
msgpack_pack_uint64(x, 0x10000); check_sbuffer(ce00010000); /* ce 00 01 00 00 */
|
||||
msgpack_pack_uint64(x, 0xFFFFFFFF); check_sbuffer(ceffffffff); /* ce ff ff ff ff */
|
||||
msgpack_pack_uint64(x, 0x100000000); check_sbuffer(cf0000000100000000); /* cf 00 00 00 01 00 00 00 00 */
|
||||
msgpack_pack_uint64(x, 0xFFFFFFFFFFFFFFFF); check_sbuffer(cfffffffffffffffff); /* cf ff ff ff ff ff ff ff ff */
|
||||
|
||||
msgpack_pack_fix_int8(x, 0x7F); check_sbuffer(d07f); /* d0 7f */
|
||||
msgpack_pack_fix_int8(x, -0x7F-1); check_sbuffer(d080); /* d0 80 */
|
||||
msgpack_pack_fix_int16(x, 0x7FFF); check_sbuffer(d17fff); /* d1 7f ff */
|
||||
msgpack_pack_fix_int16(x, -0x7FFF-1); check_sbuffer(d18000); /* d1 80 00 */
|
||||
msgpack_pack_fix_int32(x, 0x7FFFFFFF); check_sbuffer(d27fffffff); /* d2 7f ff ff ff */
|
||||
msgpack_pack_fix_int32(x, -0x7FFFFFFF-1); check_sbuffer(d280000000); /* d2 80 00 00 00 */
|
||||
msgpack_pack_fix_int64(x, 0x7FFFFFFFFFFFFFFF); check_sbuffer(d37fffffffffffffff); /* d3 7f ff ff ff ff ff ff ff */
|
||||
msgpack_pack_fix_int64(x, -0x7FFFFFFFFFFFFFFF-1); check_sbuffer(d38000000000000000); /* d3 80 00 00 00 00 00 00 00 */
|
||||
|
||||
msgpack_pack_int8(x, -0x7F-1); check_sbuffer(d080); /* d0 80 */
|
||||
msgpack_pack_int8(x, -0x21); check_sbuffer(d0df); /* d0 df */
|
||||
msgpack_pack_int8(x, -0x20); check_sbuffer(e0); /* e0 */
|
||||
msgpack_pack_int8(x, -1); check_sbuffer(ff); /* ff */
|
||||
msgpack_pack_int8(x, 0); check_sbuffer(00); /* 00 */
|
||||
msgpack_pack_int8(x, 0x7F); check_sbuffer(7f); /* 7f */
|
||||
|
||||
msgpack_pack_int16(x, -0x7FFF-1); check_sbuffer(d18000); /* d1 80 00 */
|
||||
msgpack_pack_int16(x, -0x81); check_sbuffer(d1ff7f); /* d1 ff 7f */
|
||||
msgpack_pack_int16(x, -0x80); check_sbuffer(d080); /* d0 80 */
|
||||
msgpack_pack_int16(x, -0x21); check_sbuffer(d0df); /* d0 df */
|
||||
msgpack_pack_int16(x, -0x20); check_sbuffer(e0); /* e0 */
|
||||
msgpack_pack_int16(x, -0x1); check_sbuffer(ff); /* ff */
|
||||
msgpack_pack_int16(x, 0); check_sbuffer(00); /* 00 */
|
||||
msgpack_pack_int16(x, 0x7F); check_sbuffer(7f); /* 7f */
|
||||
msgpack_pack_int16(x, 0x80); check_sbuffer(cc80); /* cc 80 */
|
||||
msgpack_pack_int16(x, 0xFF); check_sbuffer(ccff); /* cc ff */
|
||||
msgpack_pack_int16(x, 0x100); check_sbuffer(cd0100); /* cd 01 00 */
|
||||
msgpack_pack_int16(x, 0x7FFF); check_sbuffer(cd7fff); /* cd 7f ff */
|
||||
|
||||
msgpack_pack_int32(x, -0x7FFFFFFF-1); check_sbuffer(d280000000); /* d2 80 00 00 00 */
|
||||
msgpack_pack_int32(x, -0x8001); check_sbuffer(d2ffff7fff); /* d2 ff ff 7f ff */
|
||||
msgpack_pack_int32(x, -0x8000); check_sbuffer(d18000); /* d1 80 00 */
|
||||
msgpack_pack_int32(x, -0x81); check_sbuffer(d1ff7f); /* d1 ff 7f */
|
||||
msgpack_pack_int32(x, -0x80); check_sbuffer(d080); /* d0 80 */
|
||||
msgpack_pack_int32(x, -0x21); check_sbuffer(d0df); /* d0 df */
|
||||
msgpack_pack_int32(x, -0x20); check_sbuffer(e0); /* e0 */
|
||||
msgpack_pack_int32(x, -0x1); check_sbuffer(ff); /* ff */
|
||||
msgpack_pack_int32(x, 0); check_sbuffer(00); /* 00 */
|
||||
msgpack_pack_int32(x, 0x7F); check_sbuffer(7f); /* 7f */
|
||||
msgpack_pack_int32(x, 0x80); check_sbuffer(cc80); /* cc 80 */
|
||||
msgpack_pack_int32(x, 0xFF); check_sbuffer(ccff); /* cc ff */
|
||||
msgpack_pack_int32(x, 0x100); check_sbuffer(cd0100); /* cd 01 00 */
|
||||
msgpack_pack_int32(x, 0xFFFF); check_sbuffer(cdffff); /* cd ff ff */
|
||||
msgpack_pack_int32(x, 0x10000); check_sbuffer(ce00010000); /* ce 00 01 00 00 */
|
||||
msgpack_pack_int32(x, 0x7FFFFFFF); check_sbuffer(ce7fffffff); /* ce 7f ff ff ff */
|
||||
|
||||
msgpack_pack_int64(x, -0x7FFFFFFFFFFFFFFF-1); check_sbuffer(d38000000000000000); /* d3 80 00 00 00 00 00 00 00 */
|
||||
msgpack_pack_int64(x, -((1LL<<31)+1)); check_sbuffer(d3ffffffff7fffffff); /* d3 ff ff ff ff 7f ff ff ff */
|
||||
msgpack_pack_int64(x, -(1LL<<31)); check_sbuffer(d280000000); /* d2 80 00 00 00 */
|
||||
msgpack_pack_int64(x, -0x8001); check_sbuffer(d2ffff7fff); /* d2 ff ff 7f ff */
|
||||
msgpack_pack_int64(x, -0x8000); check_sbuffer(d18000); /* d1 80 00 */
|
||||
msgpack_pack_int64(x, -0x81); check_sbuffer(d1ff7f); /* d1 ff 7f */
|
||||
msgpack_pack_int64(x, -0x80); check_sbuffer(d080); /* d0 80 */
|
||||
msgpack_pack_int64(x, -0x21); check_sbuffer(d0df); /* d0 df */
|
||||
msgpack_pack_int64(x, -0x20); check_sbuffer(e0); /* e0 */
|
||||
msgpack_pack_int64(x, -0x1); check_sbuffer(ff); /* ff */
|
||||
msgpack_pack_int64(x, 0); check_sbuffer(00); /* 00 */
|
||||
msgpack_pack_int64(x, 0x7F); check_sbuffer(7f); /* 7f */
|
||||
msgpack_pack_int64(x, 0x80); check_sbuffer(cc80); /* cc 80 */
|
||||
msgpack_pack_int64(x, 0xFF); check_sbuffer(ccff); /* cc ff */
|
||||
msgpack_pack_int64(x, 0x100); check_sbuffer(cd0100); /* cd 01 00 */
|
||||
msgpack_pack_int64(x, 0xFFFF); check_sbuffer(cdffff); /* cd ff ff */
|
||||
msgpack_pack_int64(x, 0x10000); check_sbuffer(ce00010000); /* ce 00 01 00 00 */
|
||||
msgpack_pack_int64(x, 0xFFFFFFFF); check_sbuffer(ceffffffff); /* ce ff ff ff ff */
|
||||
msgpack_pack_int64(x, 0x100000000); check_sbuffer(cf0000000100000000); /* cf 00 00 00 01 00 00 00 00 */
|
||||
msgpack_pack_int64(x, 0x7FFFFFFFFFFFFFFF); check_sbuffer(cf7fffffffffffffff); /* cf 7f ff ff ff ff ff ff ff */
|
||||
|
||||
msgpack_pack_nil(x); check_sbuffer(c0); /* c0 */
|
||||
msgpack_pack_false(x); check_sbuffer(c2); /* c2 */
|
||||
msgpack_pack_true(x); check_sbuffer(c3); /* c3 */
|
||||
|
||||
msgpack_pack_float(x, 1.0); check_sbuffer(ca3f800000); /* ca 3f 80 00 00 */
|
||||
msgpack_pack_double(x, 1.0); check_sbuffer(cb3ff0000000000000); /* cb 3f f0 00 00 00 00 00 00 */
|
||||
|
||||
msgpack_pack_unsigned_char(x, UINT8_MAX); /* same as msgpack_pack_uint8() */
|
||||
msgpack_pack_unsigned_short(x, (unsigned short)UINT64_MAX);
|
||||
msgpack_pack_unsigned_int(x, (unsigned int)UINT64_MAX);
|
||||
msgpack_pack_unsigned_long(x, (unsigned long)UINT64_MAX);
|
||||
msgpack_pack_unsigned_long_long(x, (unsigned long long)UINT64_MAX);
|
||||
|
||||
msgpack_pack_signed_char(x, INT8_MAX); /* same as msgpack_pack_int8() */
|
||||
|
||||
#define check_sbuffer_n(b) \
|
||||
do { \
|
||||
size_t len = strlen(#b); \
|
||||
assert(bytesncmp(sbuf.data + offset, #b, len) == 0); \
|
||||
offset = sbuf.size; \
|
||||
} while (0)
|
||||
|
||||
#define fill_str(n) msgpack_pack_str_body(x, data, n)
|
||||
|
||||
offset = sbuf.size;
|
||||
msgpack_pack_str(x, 0); /* "" */ check_sbuffer(a0); /* a0 */
|
||||
msgpack_pack_str(x, 31);
|
||||
fill_str(31); check_sbuffer_n(bf); /* bf ... */
|
||||
msgpack_pack_str(x, 32);
|
||||
fill_str(32); check_sbuffer_n(d920); /* d9 20 ... */
|
||||
msgpack_pack_str(x, 255);
|
||||
fill_str(255); check_sbuffer_n(d9ff); /* d9 ff ... */
|
||||
msgpack_pack_str(x, 256);
|
||||
fill_str(256); check_sbuffer_n(da0100); /* da 01 00 ... */
|
||||
msgpack_pack_str(x, 65535);
|
||||
fill_str(65535); check_sbuffer_n(daffff); /* da ff ff ... */
|
||||
msgpack_pack_str(x, 65536);
|
||||
fill_str(65536); check_sbuffer_n(db00010000); /* db 00 01 00 00 ... */
|
||||
|
||||
#define fill_map(n) \
|
||||
do { \
|
||||
size_t i = 0; \
|
||||
for (; i < n * 2; i++) { msgpack_pack_int8(x, 0x1); } \
|
||||
} while (0);
|
||||
|
||||
msgpack_pack_map(x, 0); /* {} */ check_sbuffer(80); /* 80 */
|
||||
msgpack_pack_map(x, 1);
|
||||
fill_map(1); check_sbuffer_n(81); /* 81 ... */
|
||||
msgpack_pack_map(x, 15);
|
||||
fill_map(15); check_sbuffer_n(8f); /* 8f ... */
|
||||
msgpack_pack_map(x, 16);
|
||||
fill_map(16); check_sbuffer_n(de0010); /* de 00 10 ... */
|
||||
msgpack_pack_map(x, 65535);
|
||||
fill_map(65535); check_sbuffer_n(deffff); /* de ff ff ... */
|
||||
msgpack_pack_map(x, 65536);
|
||||
fill_map(65536); check_sbuffer_n(df00010000); /* df 00 01 00 00 ... */
|
||||
|
||||
#define fill_array(n) \
|
||||
do { \
|
||||
size_t i = 0; \
|
||||
for (; i < n; i++) { msgpack_pack_int8(x, 0x1); } \
|
||||
} while (0);
|
||||
|
||||
msgpack_pack_array(x, 0); /* [] */ check_sbuffer(90); /* 90 */
|
||||
msgpack_pack_array(x, 1);
|
||||
fill_array(1); check_sbuffer_n(91); /* 91 ... */
|
||||
msgpack_pack_array(x, 15);
|
||||
fill_array(15); check_sbuffer_n(9f); /* 9f ... */
|
||||
msgpack_pack_array(x, 16);
|
||||
fill_array(16); check_sbuffer_n(dc0010); /* dc 00 10 ... */
|
||||
msgpack_pack_array(x, 65535);
|
||||
fill_array(65535); check_sbuffer_n(dcffff); /* dc ff ff ... */
|
||||
msgpack_pack_array(x, 65536);
|
||||
fill_array(65536); check_sbuffer_n(dd00010000); /* dd 00 01 00 00 ... */
|
||||
|
||||
#define fill_bin(n) msgpack_pack_bin_body(x, data, n)
|
||||
|
||||
msgpack_pack_bin(x, 0); check_sbuffer(c400); /* c4 00 */
|
||||
msgpack_pack_bin(x, 1);
|
||||
fill_bin(1); check_sbuffer_n(c401); /* c4 01 ... */
|
||||
msgpack_pack_bin(x, 255);
|
||||
fill_bin(255); check_sbuffer_n(c4ff); /* c4 ff ... */
|
||||
msgpack_pack_bin(x, 256);
|
||||
fill_bin(256); check_sbuffer_n(c50100); /* c5 01 00 ... */
|
||||
msgpack_pack_bin(x, 65535);
|
||||
fill_bin(65535); check_sbuffer_n(c5ffff); /* c5 ff ff ... */
|
||||
msgpack_pack_bin(x, 65536);
|
||||
fill_bin(65536); check_sbuffer_n(c600010000); /* c6 00 01 00 00 ... */
|
||||
|
||||
#define fill_ext(n) msgpack_pack_ext_body(x, data, n)
|
||||
|
||||
msgpack_pack_ext(x, 1, 0x7F);
|
||||
fill_ext(1); check_sbuffer_n(d47f); /* d4 7f ... */
|
||||
msgpack_pack_ext(x, 2, 0x7F);
|
||||
fill_ext(2); check_sbuffer_n(d57f); /* d5 7f ... */
|
||||
msgpack_pack_ext(x, 4, 0x7F);
|
||||
fill_ext(4); check_sbuffer_n(d67f); /* d6 7f ... */
|
||||
msgpack_pack_ext(x, 8, 0x7F);
|
||||
fill_ext(8); check_sbuffer_n(d77f); /* d7 7f ... */
|
||||
msgpack_pack_ext(x, 16, 0x7F);
|
||||
fill_ext(16); check_sbuffer_n(d87f); /* d8 7f ... */
|
||||
|
||||
msgpack_pack_ext(x, 0, 0x7F); check_sbuffer(c7007f); /* c7 00 7f */
|
||||
msgpack_pack_ext(x, 3, 0x7F);
|
||||
fill_ext(3); check_sbuffer_n(c7037f); /* c7 03 7f */
|
||||
msgpack_pack_ext(x, 5, 0x7F);
|
||||
fill_ext(5); check_sbuffer_n(c7057f); /* c7 05 7f */
|
||||
msgpack_pack_ext(x, 17, 0x7F);
|
||||
fill_ext(17); check_sbuffer_n(c7117f); /* c7 11 7f */
|
||||
msgpack_pack_ext(x, 255, 0x7F);
|
||||
fill_ext(255); check_sbuffer_n(c7ff7f); /* c7 ff 7f ... */
|
||||
msgpack_pack_ext(x, 256, 0x7F);
|
||||
fill_ext(256); check_sbuffer_n(c801007f); /* c8 01 00 7f ... */
|
||||
msgpack_pack_ext(x, 65535, 0x7F);
|
||||
fill_ext(65535); check_sbuffer_n(c8ffff7f); /* c8 ff ff 7f ... */
|
||||
msgpack_pack_ext(x, 65536, 0x7F);
|
||||
fill_ext(65536); check_sbuffer_n(c9000100007f); /* c9 00 01 00 00 7f ... */
|
||||
|
||||
msgpack_pack_timestamp(x, ts); check_sbuffer(d6ffffffffff); /* d6 ff ff ff ff ff */
|
||||
msgpack_pack_timestamp(x, ts + 1); check_sbuffer(d7ff0000000100000000); /* d7 ff 00 00 00 01 00 00 00 00 */
|
||||
msgpack_pack_timestamp(x, ts + 2); check_sbuffer(d7ff00000003ffffffff); /* d7 ff 00 00 00 03 ff ff ff ff */
|
||||
msgpack_pack_timestamp(x, ts + 3); check_sbuffer(c70cff000000000000000400000000); /* c7 0c ff 00 00 00 00 00 00 00 04 00 00 00 00 */
|
||||
msgpack_pack_timestamp(x, ts + 4); check_sbuffer(c70cffffffffff7fffffffffffffff); /* c7 0c ff ff ff ff ff 7f ff ff ff ff ff ff ff */
|
||||
|
||||
msgpack_sbuffer_destroy(&sbuf);
|
||||
msgpack_packer_free(x);
|
||||
|
||||
return 0;
|
||||
}
|
419
example/c/jsonconv.c
Normal file
419
example/c/jsonconv.c
Normal file
@@ -0,0 +1,419 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <msgpack.h>
|
||||
#include <cjson/cJSON.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if _MSC_VER >= 1800
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
#define PRIu64 "I64u"
|
||||
#define PRIi64 "I64i"
|
||||
#define PRIi8 "i"
|
||||
#endif
|
||||
#else
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#if defined(_KERNEL_MODE)
|
||||
# undef snprintf
|
||||
# define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#define DEBUG(...) printf(__VA_ARGS__)
|
||||
|
||||
static char *format_string(const char *input)
|
||||
{
|
||||
const char *inptr;
|
||||
char *output;
|
||||
char *outptr;
|
||||
size_t output_length = 0;
|
||||
/* numbers of additional characters*/
|
||||
size_t escape_characters = 0;
|
||||
|
||||
if (input == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (inptr = input; *inptr; inptr++) {
|
||||
switch (*inptr) {
|
||||
case '\"':
|
||||
case '\\':
|
||||
case '\b':
|
||||
case '\f':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\t':
|
||||
/* one character escape sequence */
|
||||
escape_characters++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
output_length = (size_t)(inptr - input) + escape_characters;
|
||||
|
||||
output = (char *)malloc(output_length + 1);
|
||||
if (output == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* no add characters*/
|
||||
if (escape_characters == 0) {
|
||||
memcpy(output, input, output_length);
|
||||
output[output_length] = '\0';
|
||||
return output;
|
||||
}
|
||||
|
||||
outptr = output;
|
||||
/* copy string */
|
||||
for (inptr = input; *inptr != '\0'; (void)inptr++, outptr++) {
|
||||
if ((*inptr > 31) && (*inptr != '\"') && (*inptr != '\\')) {
|
||||
/* normal character, copy */
|
||||
*outptr = *inptr;
|
||||
} else {
|
||||
/* character needs to be escaped */
|
||||
*outptr++ = '\\';
|
||||
switch (*inptr)
|
||||
{
|
||||
case '\\':
|
||||
*outptr = '\\';
|
||||
break;
|
||||
case '\"':
|
||||
*outptr = '\"';
|
||||
break;
|
||||
case '\b':
|
||||
*outptr = 'b';
|
||||
break;
|
||||
case '\f':
|
||||
*outptr = 'f';
|
||||
break;
|
||||
case '\n':
|
||||
*outptr = 'n';
|
||||
break;
|
||||
case '\r':
|
||||
*outptr = 'r';
|
||||
break;
|
||||
case '\t':
|
||||
*outptr = 't';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output[output_length] = '\0';
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pack cJSON object.
|
||||
* return 0 success, others failed
|
||||
*/
|
||||
static int parse_cjson_object(msgpack_packer *pk, cJSON *node)
|
||||
{
|
||||
int ret, sz, i;
|
||||
cJSON *child;
|
||||
char *strvalue;
|
||||
|
||||
if (node == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (node->type & 0xFF) {
|
||||
case cJSON_Invalid:
|
||||
return -1;
|
||||
|
||||
case cJSON_False:
|
||||
return msgpack_pack_false(pk);
|
||||
|
||||
case cJSON_True:
|
||||
return msgpack_pack_true(pk);
|
||||
|
||||
case cJSON_NULL:
|
||||
return msgpack_pack_nil(pk);
|
||||
|
||||
case cJSON_String:
|
||||
strvalue = format_string(node->valuestring);
|
||||
if (strvalue != NULL) {
|
||||
ret = msgpack_pack_str_with_body(pk, strvalue, strlen(strvalue));
|
||||
free(strvalue);
|
||||
return ret;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
case cJSON_Number:
|
||||
if (isnan(node->valuedouble) || isinf(node->valuedouble)) {
|
||||
ret = msgpack_pack_nil(pk);
|
||||
} else if (node->valuedouble == node->valueint) {
|
||||
ret = msgpack_pack_int(pk, node->valueint);
|
||||
} else {
|
||||
ret = msgpack_pack_double(pk, node->valuedouble);
|
||||
}
|
||||
return ret;
|
||||
|
||||
case cJSON_Array:
|
||||
sz = cJSON_GetArraySize(node);
|
||||
if (msgpack_pack_array(pk, sz) != 0) {
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < sz; i++) {
|
||||
if (parse_cjson_object(pk, cJSON_GetArrayItem(node, i)) != 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
case cJSON_Object:
|
||||
sz = cJSON_GetArraySize(node);
|
||||
if (msgpack_pack_map(pk, sz) != 0) {
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < sz; i++) {
|
||||
child = cJSON_GetArrayItem(node, i);
|
||||
strvalue = format_string(child->string);
|
||||
if (strvalue == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (msgpack_pack_str_with_body(pk, strvalue, strlen(strvalue)) != 0) {
|
||||
free(strvalue);
|
||||
return -1;
|
||||
}
|
||||
free(strvalue);
|
||||
if (parse_cjson_object(pk, child) != 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
default:
|
||||
DEBUG("unknown type.\n");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pack json string to msgpack format data.
|
||||
* return 0 success, -1 failed
|
||||
*/
|
||||
int msgpack_pack_jsonstr(msgpack_packer *pk, const char *jsonstr)
|
||||
{
|
||||
int status;
|
||||
cJSON *node;
|
||||
const char *end = NULL;
|
||||
|
||||
if (pk == NULL || jsonstr == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
node = cJSON_ParseWithOpts(jsonstr, &end, 1);
|
||||
if (node == NULL) {
|
||||
DEBUG("parse error: unexpected string `%s`\n", end);
|
||||
return -1;
|
||||
}
|
||||
status = parse_cjson_object(pk, node);
|
||||
cJSON_Delete(node);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static int bytes_contain_zero(const msgpack_object_bin *bin)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < bin->size; i++) {
|
||||
if (bin->ptr[i] == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PRINT_JSONSTR_CALL(ret, func, aux_buffer, aux_buffer_size, ...) \
|
||||
ret = func(aux_buffer, aux_buffer_size, __VA_ARGS__); \
|
||||
if (ret <= 0) \
|
||||
return ret; \
|
||||
if (ret > aux_buffer_size) \
|
||||
return 0; \
|
||||
aux_buffer = aux_buffer + ret; \
|
||||
aux_buffer_size = aux_buffer_size - ret
|
||||
|
||||
/*
|
||||
* Convert msgpack format data to json string.
|
||||
* return >0: success, 0: length of buffer not enough, -1: failed
|
||||
*/
|
||||
size_t msgpack_object_print_jsonstr(char *buffer, size_t length, const msgpack_object o)
|
||||
{
|
||||
char *aux_buffer = buffer;
|
||||
size_t aux_buffer_size = length;
|
||||
size_t ret;
|
||||
|
||||
switch (o.type) {
|
||||
case MSGPACK_OBJECT_NIL:
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "null");
|
||||
break;
|
||||
|
||||
case MSGPACK_OBJECT_BOOLEAN:
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, (o.via.boolean ? "true" : "false"));
|
||||
break;
|
||||
|
||||
case MSGPACK_OBJECT_POSITIVE_INTEGER:
|
||||
#if defined(PRIu64)
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "%" PRIu64, o.via.u64);
|
||||
#else
|
||||
if (o.via.u64 > ULONG_MAX) {
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "%lu", ULONG_MAX);
|
||||
} else {
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "%lu", (unsigned long)o.via.u64);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MSGPACK_OBJECT_NEGATIVE_INTEGER:
|
||||
#if defined(PRIi64)
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "%" PRIi64, o.via.i64);
|
||||
#else
|
||||
if (o.via.i64 > LONG_MAX) {
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "%ld", LONG_MAX);
|
||||
} else if (o.via.i64 < LONG_MIN) {
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "%ld", LONG_MIN);
|
||||
} else {
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "%ld", (signed long)o.via.i64);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case MSGPACK_OBJECT_FLOAT32:
|
||||
case MSGPACK_OBJECT_FLOAT64:
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "%f", o.via.f64);
|
||||
break;
|
||||
|
||||
case MSGPACK_OBJECT_STR:
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "\"%.*s\"", (int)o.via.str.size, o.via.str.ptr);
|
||||
break;
|
||||
|
||||
case MSGPACK_OBJECT_BIN:
|
||||
if (bytes_contain_zero(&o.via.bin)) {
|
||||
DEBUG("the value contains zero\n");
|
||||
return -1;
|
||||
}
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "\"%.*s\"", (int)o.via.bin.size, o.via.bin.ptr);
|
||||
break;
|
||||
|
||||
case MSGPACK_OBJECT_EXT:
|
||||
DEBUG("not support type: MSGPACK_OBJECT_EXT.\n");
|
||||
return -1;
|
||||
|
||||
case MSGPACK_OBJECT_ARRAY:
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "[");
|
||||
if (o.via.array.size != 0) {
|
||||
msgpack_object *p = o.via.array.ptr;
|
||||
msgpack_object *const pend = o.via.array.ptr + o.via.array.size;
|
||||
PRINT_JSONSTR_CALL(ret, msgpack_object_print_jsonstr, aux_buffer, aux_buffer_size, *p);
|
||||
++p;
|
||||
for (; p < pend; ++p) {
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, ",");
|
||||
PRINT_JSONSTR_CALL(ret, msgpack_object_print_jsonstr, aux_buffer, aux_buffer_size, *p);
|
||||
}
|
||||
}
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "]");
|
||||
break;
|
||||
|
||||
case MSGPACK_OBJECT_MAP:
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "{");
|
||||
if (o.via.map.size != 0) {
|
||||
msgpack_object_kv *p = o.via.map.ptr;
|
||||
msgpack_object_kv *const pend = o.via.map.ptr + o.via.map.size;
|
||||
|
||||
for (; p < pend; ++p) {
|
||||
if (p->key.type != MSGPACK_OBJECT_STR) {
|
||||
DEBUG("the key of in a map must be string.\n");
|
||||
return -1;
|
||||
}
|
||||
if (p != o.via.map.ptr) {
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, ",");
|
||||
}
|
||||
PRINT_JSONSTR_CALL(ret, msgpack_object_print_jsonstr, aux_buffer, aux_buffer_size, p->key);
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, ":");
|
||||
PRINT_JSONSTR_CALL(ret, msgpack_object_print_jsonstr, aux_buffer, aux_buffer_size, p->val);
|
||||
}
|
||||
}
|
||||
PRINT_JSONSTR_CALL(ret, snprintf, aux_buffer, aux_buffer_size, "}");
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG("unknown type.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return length - aux_buffer_size;
|
||||
}
|
||||
#undef PRINT_JSONSTR_CALL
|
||||
|
||||
static void test(const char *name, const char *input, const char *expect)
|
||||
{
|
||||
msgpack_sbuffer sbuf;
|
||||
{
|
||||
// pack
|
||||
msgpack_packer pk;
|
||||
msgpack_sbuffer_init(&sbuf);
|
||||
msgpack_packer_init(&pk, &sbuf, msgpack_sbuffer_write);
|
||||
if (msgpack_pack_jsonstr(&pk, input) < 0) {
|
||||
msgpack_sbuffer_destroy(&sbuf);
|
||||
printf("%s: invalid json string.\n", name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// unpack
|
||||
#define MAX_JSONLEN 1024
|
||||
msgpack_zone z;
|
||||
msgpack_object obj;
|
||||
size_t jsonstrlen = MAX_JSONLEN - 1;
|
||||
char jsonparsed[MAX_JSONLEN];
|
||||
|
||||
msgpack_zone_init(&z, jsonstrlen);
|
||||
msgpack_unpack(sbuf.data, sbuf.size, NULL, &z, &obj);
|
||||
jsonstrlen = msgpack_object_print_jsonstr(jsonparsed, jsonstrlen, obj);
|
||||
jsonparsed[jsonstrlen] = '\0';
|
||||
|
||||
//compare input and output
|
||||
if (expect == NULL) {
|
||||
expect = input;
|
||||
}
|
||||
if (strcmp(expect, jsonparsed) == 0) {
|
||||
printf("%s: ok\n", name);
|
||||
} else {
|
||||
printf("%s: failed\n", name);
|
||||
}
|
||||
msgpack_zone_destroy(&z);
|
||||
}
|
||||
msgpack_sbuffer_destroy(&sbuf);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test("null", "null", NULL);
|
||||
test("boolean", "false", NULL);
|
||||
test("single string", "\"frsyuki\"", NULL);
|
||||
test("single number", "\"100\"", NULL);
|
||||
test("space", "[{\"valuespace\":\"\",\"\":\"keyspace\"},\"\",[\"\"]]", NULL);
|
||||
test("quote", "\"My name is Tom (\\\"Bee\\\") Kobe\"", NULL);
|
||||
test("escape", "\"\\\\b\\f\\n\\r\\t\"", NULL);
|
||||
test("escape2", "\"\b\f\n\r\t\"", "\"\\b\\f\\n\\r\\t\"");
|
||||
test("map", "{\"name\":\"Tom (\\\"Bee\\\") Kobe\",\"type\":\"image\",\"data\":{\"width\":360,\"height\":460,\"title\":\"View me\",\"ips\":[116,943,256,711]}}", NULL);
|
||||
test("array", "[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"]", NULL);
|
||||
test("number array", "[[101,121,-33],[119,911,171],[0,2,-3]]", NULL);
|
||||
test("mix array", "[{\"name\":\"Tom\",\"city\":\"London\",\"country\":\"UK\",\"longitude\":23},{\"name\":\"Jack\",\"city\":\"Birmingham\",\"country\":\"UK\",\"longitude\":-22}]", NULL);
|
||||
test("unicode", "\"\\u5C71\\u5DDD\\u7570\\u57DF\\u98A8\\u6708\\u540C\\u5929\"", "\"山川異域風月同天\"");
|
||||
test("utf8", "\"山川異域風月同天\"", NULL);
|
||||
test("double", "12.34", "12.340000");
|
||||
|
||||
return 0;
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
#include <msgpack.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void print(char const* buf, unsigned int len)
|
||||
void print(char const* buf,size_t len)
|
||||
{
|
||||
size_t i = 0;
|
||||
for(; i < len ; ++i)
|
||||
|
17
example/cmake/CMakeLists.txt
Normal file
17
example/cmake/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required (VERSION 3.0)
|
||||
project (example)
|
||||
|
||||
if(EXAMPLE_MSGPACK_EMBEDDED)
|
||||
add_subdirectory(msgpack-c)
|
||||
set(msgpack_DIR ${CMAKE_CURRENT_BINARY_DIR}/msgpack-c)
|
||||
endif()
|
||||
|
||||
find_package(msgpack REQUIRED)
|
||||
|
||||
add_executable (${PROJECT_NAME} ${CMAKE_CURRENT_LIST_DIR}/../c/simple_c.c)
|
||||
target_link_libraries(${PROJECT_NAME} msgpackc)
|
||||
|
||||
if(TARGET msgpackc-static)
|
||||
add_executable (${PROJECT_NAME}-static ${CMAKE_CURRENT_LIST_DIR}/../c/simple_c.c)
|
||||
target_link_libraries(${PROJECT_NAME}-static msgpackc-static)
|
||||
endif()
|
@@ -37,7 +37,7 @@ FOREACH (source_file ${exec_PROGRAMS})
|
||||
)
|
||||
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:msgpackc-cxx,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra")
|
||||
@@ -59,7 +59,7 @@ FOREACH (source_file ${with_pthread_PROGRAMS})
|
||||
)
|
||||
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:msgpackc-cxx,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
TARGET_LINK_LIBRARIES (${source_file_we}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
@@ -88,7 +88,7 @@ FOREACH (source_file ${with_boost_lib_PROGRAMS})
|
||||
)
|
||||
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:msgpackc-cxx,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
|
||||
TARGET_LINK_LIBRARIES (${source_file_we}
|
||||
|
@@ -82,10 +82,11 @@ int main() {
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, my);
|
||||
|
||||
print(ss.str());
|
||||
std::string const& str = ss.str();
|
||||
print(str);
|
||||
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
msgpack::unpack(str.data(), str.size());
|
||||
msgpack::object obj = oh.get();
|
||||
std::cout << obj << std::endl;
|
||||
assert(obj.as<my_class>() == my);
|
||||
|
@@ -59,8 +59,9 @@ int main() {
|
||||
|
||||
print(ss.str());
|
||||
|
||||
std::string const& str = ss.str();
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
msgpack::unpack(str.data(), str.size());
|
||||
msgpack::object obj = oh.get();
|
||||
std::cout << obj << std::endl;
|
||||
assert(obj.as<my_class>() == my);
|
||||
|
@@ -100,10 +100,11 @@ int main() {
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, my);
|
||||
|
||||
print(ss.str());
|
||||
std::string const& str = ss.str();
|
||||
print(str);
|
||||
|
||||
msgpack::object_handle oh =
|
||||
msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
msgpack::unpack(str.data(), str.size());
|
||||
msgpack::object obj = oh.get();
|
||||
std::cout << obj << std::endl;
|
||||
assert(obj.as<my_class>() == my);
|
||||
|
@@ -71,7 +71,8 @@ int main() {
|
||||
|
||||
print(ss.str());
|
||||
|
||||
msgpack::object_handle oh = msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
std::string const& str = ss.str();
|
||||
msgpack::object_handle oh = msgpack::unpack(str.data(), str.size());
|
||||
|
||||
msgpack::object obj = oh.get();
|
||||
std::cout << obj << std::endl;
|
||||
|
@@ -31,12 +31,13 @@ int main() {
|
||||
std::size_t offset = 0;
|
||||
|
||||
// msgpack array is constructed on z.
|
||||
msgpack::object obj = msgpack::unpack(z, ss.str().data(), ss.str().size(), offset);
|
||||
std::string const& ps = ss.str();
|
||||
msgpack::object obj = msgpack::unpack(z, ps.data(), ps.size(), offset);
|
||||
std::cout << obj << std::endl;
|
||||
assert(obj.as<std::vector<int> >() == v);
|
||||
|
||||
// msgpack str is constructed on z.
|
||||
std::string const& str = msgpack::unpack(z, ss.str().data(), ss.str().size(), offset).as<std::string>();
|
||||
std::string const& str = msgpack::unpack(z, ps.data(), ps.size(), offset).as<std::string>();
|
||||
std::cout << str << std::endl;
|
||||
assert(str == s);
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
IF (MSGPACK_CXX11)
|
||||
IF (MSGPACK_CXX11 OR MSGPACK_CXX17)
|
||||
INCLUDE_DIRECTORIES (
|
||||
../include
|
||||
)
|
||||
@@ -22,7 +22,7 @@ IF (MSGPACK_CXX11)
|
||||
)
|
||||
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:msgpackc-cxx,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra")
|
||||
|
@@ -37,7 +37,8 @@ void tuple() {
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, t);
|
||||
|
||||
auto oh = msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
auto const& str = ss.str();
|
||||
auto oh = msgpack::unpack(str.data(), str.size());
|
||||
auto obj = oh.get();
|
||||
|
||||
std::cout << obj << std::endl;
|
||||
@@ -49,7 +50,8 @@ void unordered_map() {
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, m);
|
||||
|
||||
auto oh = msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
auto const& str = ss.str();
|
||||
auto oh = msgpack::unpack(str.data(), str.size());
|
||||
msgpack::object obj = oh.get();
|
||||
|
||||
std::cout << obj << std::endl;
|
||||
@@ -61,7 +63,8 @@ void unordered_set() {
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, s);
|
||||
|
||||
auto oh = msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
auto const& str = ss.str();
|
||||
auto oh = msgpack::unpack(str.data(), str.size());
|
||||
auto obj = oh.get();
|
||||
|
||||
std::cout << obj << std::endl;
|
||||
@@ -74,7 +77,8 @@ void forward_list() {
|
||||
std::stringstream ss;
|
||||
msgpack::pack(ss, f);
|
||||
|
||||
auto oh = msgpack::unpack(ss.str().data(), ss.str().size());
|
||||
auto const& str = ss.str();
|
||||
auto oh = msgpack::unpack(str.data(), str.size());
|
||||
auto obj = oh.get();
|
||||
|
||||
std::cout << obj << std::endl;
|
||||
@@ -98,7 +102,8 @@ void combi() {
|
||||
std::size_t offset = 0;
|
||||
std::cout << "offset: " << offset << std::endl;
|
||||
{
|
||||
auto oh = msgpack::unpack(ss.str().data(), ss.str().size(), offset);
|
||||
auto const& str = ss.str();
|
||||
auto oh = msgpack::unpack(str.data(), str.size(), offset);
|
||||
auto obj = oh.get();
|
||||
|
||||
std::cout << obj << std::endl;
|
||||
@@ -106,7 +111,8 @@ void combi() {
|
||||
}
|
||||
std::cout << "offset: " << offset << std::endl;
|
||||
{
|
||||
auto oh = msgpack::unpack(ss.str().data(), ss.str().size(), offset);
|
||||
auto const& str = ss.str();
|
||||
auto oh = msgpack::unpack(str.data(), str.size(), offset);
|
||||
auto obj = oh.get();
|
||||
|
||||
std::cout << obj << std::endl;
|
||||
@@ -114,7 +120,8 @@ void combi() {
|
||||
}
|
||||
std::cout << "offset: " << offset << std::endl;
|
||||
{
|
||||
auto oh = msgpack::unpack(ss.str().data(), ss.str().size(), offset);
|
||||
auto const& str = ss.str();
|
||||
auto oh = msgpack::unpack(str.data(), str.size(), offset);
|
||||
auto obj = oh.get();
|
||||
|
||||
std::cout << obj << std::endl;
|
||||
@@ -122,7 +129,8 @@ void combi() {
|
||||
}
|
||||
std::cout << "offset: " << offset << std::endl;
|
||||
{
|
||||
auto oh = msgpack::unpack(ss.str().data(), ss.str().size(), offset);
|
||||
auto const& str = ss.str();
|
||||
auto oh = msgpack::unpack(str.data(), str.size(), offset);
|
||||
auto obj = oh.get();
|
||||
|
||||
std::cout << obj << std::endl;
|
||||
@@ -130,7 +138,8 @@ void combi() {
|
||||
}
|
||||
std::cout << "offset: " << offset << std::endl;
|
||||
{
|
||||
auto oh = msgpack::unpack(ss.str().data(), ss.str().size(), offset);
|
||||
auto const& str = ss.str();
|
||||
auto oh = msgpack::unpack(str.data(), str.size(), offset);
|
||||
auto obj = oh.get();
|
||||
|
||||
std::cout << obj << std::endl;
|
||||
|
@@ -20,7 +20,7 @@ IF (MSGPACK_USE_X3_PARSE AND MSGPACK_DEFAULT_API_VERSION VERSION_GREATER 1)
|
||||
)
|
||||
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:msgpackc-cxx,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra")
|
||||
@@ -46,7 +46,7 @@ IF (MSGPACK_USE_X3_PARSE AND MSGPACK_DEFAULT_API_VERSION VERSION_GREATER 1)
|
||||
)
|
||||
TARGET_INCLUDE_DIRECTORIES (${source_file_we}
|
||||
PRIVATE
|
||||
$<TARGET_PROPERTY:msgpackc,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:msgpackc-cxx,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
TARGET_LINK_LIBRARIES (${source_file_we}
|
||||
${Boost_CONTEXT_LIBRARY}
|
||||
|
2
external/boost/predef
vendored
2
external/boost/predef
vendored
Submodule external/boost/predef updated: 1e8d1c2cfc...560ff5298e
2
external/boost/preprocessor
vendored
2
external/boost/preprocessor
vendored
Submodule external/boost/preprocessor updated: c2beb74b90...56090c56b5
43
fuzz/CMakeLists.txt
Normal file
43
fuzz/CMakeLists.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
FIND_PACKAGE (GTest REQUIRED)
|
||||
FIND_PACKAGE (ZLIB REQUIRED)
|
||||
FIND_PACKAGE (Boost REQUIRED COMPONENTS system filesystem)
|
||||
|
||||
INCLUDE_DIRECTORIES (
|
||||
${GTEST_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
LIST (APPEND check_PROGRAMS
|
||||
regression_runner.cpp
|
||||
)
|
||||
|
||||
LINK_DIRECTORIES (
|
||||
${Boost_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
FOREACH (source_file ${check_PROGRAMS})
|
||||
GET_FILENAME_COMPONENT (source_file_we ${source_file} NAME_WE)
|
||||
ADD_EXECUTABLE (
|
||||
${source_file_we}
|
||||
${source_file}
|
||||
)
|
||||
TARGET_LINK_LIBRARIES (${source_file_we}
|
||||
msgpackc
|
||||
${GTEST_BOTH_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${Boost_LIBRARIES}
|
||||
)
|
||||
ADD_TEST (${source_file_we} ${source_file_we})
|
||||
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Wno-mismatched-tags -g")
|
||||
IF ("${MSGPACK_SAN}" STREQUAL "ASAN")
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
|
||||
ELSEIF ("${MSGPACK_SAN}" STREQUAL "UBSAN")
|
||||
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
|
||||
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH ()
|
50
fuzz/regression_runner.cpp
Normal file
50
fuzz/regression_runner.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "unpack_pack_fuzzer.cpp"
|
||||
|
||||
using ::testing::TestWithParam;
|
||||
using ::testing::ValuesIn;
|
||||
|
||||
|
||||
std::vector<std::string> ListDirectory(const std::string& path) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
boost::filesystem::path p(path);
|
||||
boost::filesystem::directory_iterator f{p};
|
||||
|
||||
if(boost::filesystem::is_directory(p)) {
|
||||
while (f != boost::filesystem::directory_iterator{}) {
|
||||
v.push_back((*f++).path().string());
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
class UnpackPackFuzzerRegressionTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
};
|
||||
|
||||
TEST_P(UnpackPackFuzzerRegressionTest, Returns0) {
|
||||
auto fpath = GetParam();
|
||||
std::ifstream in(fpath, std::ifstream::binary);
|
||||
if (!in) {
|
||||
FAIL() << fpath << " not found";
|
||||
}
|
||||
in.seekg(0, in.end);
|
||||
size_t length = in.tellg();
|
||||
in.seekg(0, in.beg);
|
||||
std::vector<char> bytes(length);
|
||||
in.read(bytes.data(), bytes.size());
|
||||
assert(in);
|
||||
EXPECT_EQ(0, LLVMFuzzerTestOneInput(reinterpret_cast<const uint8_t *>(bytes.data()),
|
||||
bytes.size()));
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(UnpackPackFuzzerRegressions,
|
||||
UnpackPackFuzzerRegressionTest,
|
||||
::testing::ValuesIn(ListDirectory("../../fuzz/unpack_pack_fuzzer_regressions")));
|
Binary file not shown.
Binary file not shown.
16
include/msgpack/adaptor/cpp11/chrono.hpp
Normal file
16
include/msgpack/adaptor/cpp11/chrono.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2017 KONDO Takatoshi
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef MSGPACK_TYPE_CPP11_CHRONO_HPP
|
||||
#define MSGPACK_TYPE_CPP11_CHRONO_HPP
|
||||
|
||||
#include "msgpack/v1/adaptor/cpp11/chrono.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_CPP11_CHRONO_HPP
|
16
include/msgpack/adaptor/cpp11/timespec.hpp
Normal file
16
include/msgpack/adaptor/cpp11/timespec.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2019 KONDO Takatoshi
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef MSGPACK_TYPE_CPP11_TIMESPEC_HPP
|
||||
#define MSGPACK_TYPE_CPP11_TIMESPEC_HPP
|
||||
|
||||
#include "msgpack/v1/adaptor/cpp11/timespec.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_CPP11_TIMESPEC_HPP
|
16
include/msgpack/adaptor/cpp17/byte.hpp
Normal file
16
include/msgpack/adaptor/cpp17/byte.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2018 KONDO Takatoshi
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef MSGPACK_TYPE_CPP17_BYTE_HPP
|
||||
#define MSGPACK_TYPE_CPP17_BYTE_HPP
|
||||
|
||||
#include "msgpack/v1/adaptor/cpp17/byte.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_CPP17_BYTE_HPP
|
16
include/msgpack/adaptor/cpp17/carray_byte.hpp
Normal file
16
include/msgpack/adaptor/cpp17/carray_byte.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2018 KONDO Takatoshi
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef MSGPACK_TYPE_CPP17_CARRAY_BYTE_HPP
|
||||
#define MSGPACK_TYPE_CPP17_CARRAY_BYTE_HPP
|
||||
|
||||
#include "msgpack/v1/adaptor/cpp17/carray_byte.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_CPP17_CARRAY_BYTE_HPP
|
16
include/msgpack/adaptor/cpp17/vector_byte.hpp
Normal file
16
include/msgpack/adaptor/cpp17/vector_byte.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2018 KONDO Takatoshi
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifndef MSGPACK_TYPE_CPP17_VECTOR_BYTE_HPP
|
||||
#define MSGPACK_TYPE_CPP17_VECTOR_BYTE_HPP
|
||||
|
||||
#include "msgpack/v1/adaptor/cpp17/vector_byte.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_CPP17_VECTOR_BYTE_HPP
|
@@ -27,18 +27,18 @@
|
||||
|
||||
#define MSGPACK_DEFINE_ARRAY(...) \
|
||||
template <typename Packer> \
|
||||
void msgpack_pack(Packer& pk) const \
|
||||
void msgpack_pack(Packer& msgpack_pk) const \
|
||||
{ \
|
||||
msgpack::type::make_define_array(__VA_ARGS__).msgpack_pack(pk); \
|
||||
msgpack::type::make_define_array(__VA_ARGS__).msgpack_pack(msgpack_pk); \
|
||||
} \
|
||||
void msgpack_unpack(msgpack::object const& o) \
|
||||
void msgpack_unpack(msgpack::object const& msgpack_o) \
|
||||
{ \
|
||||
msgpack::type::make_define_array(__VA_ARGS__).msgpack_unpack(o); \
|
||||
msgpack::type::make_define_array(__VA_ARGS__).msgpack_unpack(msgpack_o); \
|
||||
}\
|
||||
template <typename MSGPACK_OBJECT> \
|
||||
void msgpack_object(MSGPACK_OBJECT* o, msgpack::zone& z) const \
|
||||
void msgpack_object(MSGPACK_OBJECT* msgpack_o, msgpack::zone& msgpack_z) const \
|
||||
{ \
|
||||
msgpack::type::make_define_array(__VA_ARGS__).msgpack_object(o, z); \
|
||||
msgpack::type::make_define_array(__VA_ARGS__).msgpack_object(msgpack_o, msgpack_z); \
|
||||
}
|
||||
|
||||
#define MSGPACK_BASE_ARRAY(base) (*const_cast<base *>(static_cast<base const*>(this)))
|
||||
@@ -62,24 +62,24 @@
|
||||
|
||||
#define MSGPACK_DEFINE_MAP(...) \
|
||||
template <typename Packer> \
|
||||
void msgpack_pack(Packer& pk) const \
|
||||
void msgpack_pack(Packer& msgpack_pk) const \
|
||||
{ \
|
||||
msgpack::type::make_define_map \
|
||||
MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \
|
||||
.msgpack_pack(pk); \
|
||||
.msgpack_pack(msgpack_pk); \
|
||||
} \
|
||||
void msgpack_unpack(msgpack::object const& o) \
|
||||
void msgpack_unpack(msgpack::object const& msgpack_o) \
|
||||
{ \
|
||||
msgpack::type::make_define_map \
|
||||
MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \
|
||||
.msgpack_unpack(o); \
|
||||
.msgpack_unpack(msgpack_o); \
|
||||
}\
|
||||
template <typename MSGPACK_OBJECT> \
|
||||
void msgpack_object(MSGPACK_OBJECT* o, msgpack::zone& z) const \
|
||||
void msgpack_object(MSGPACK_OBJECT* msgpack_o, msgpack::zone& msgpack_z) const \
|
||||
{ \
|
||||
msgpack::type::make_define_map \
|
||||
MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \
|
||||
.msgpack_object(o, z); \
|
||||
.msgpack_object(msgpack_o, msgpack_z); \
|
||||
}
|
||||
|
||||
#define MSGPACK_BASE_MAP(base) \
|
||||
@@ -94,32 +94,32 @@
|
||||
namespace adaptor { \
|
||||
template<> \
|
||||
struct convert<enum_name> { \
|
||||
msgpack::object const& operator()(msgpack::object const& o, enum_name& v) const { \
|
||||
msgpack::object const& operator()(msgpack::object const& msgpack_o, enum_name& msgpack_v) const { \
|
||||
msgpack::underlying_type<enum_name>::type tmp; \
|
||||
msgpack::operator>>(o, tmp); \
|
||||
v = static_cast<enum_name>(tmp); \
|
||||
return o; \
|
||||
msgpack::operator>>(msgpack_o, tmp); \
|
||||
msgpack_v = static_cast<enum_name>(tmp); \
|
||||
return msgpack_o; \
|
||||
} \
|
||||
}; \
|
||||
template<> \
|
||||
struct object<enum_name> { \
|
||||
void operator()(msgpack::object& o, const enum_name& v) const { \
|
||||
msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(v); \
|
||||
msgpack::operator<<(o, tmp); \
|
||||
void operator()(msgpack::object& msgpack_o, const enum_name& msgpack_v) const { \
|
||||
msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(msgpack_v); \
|
||||
msgpack::operator<<(msgpack_o, tmp); \
|
||||
} \
|
||||
}; \
|
||||
template<> \
|
||||
struct object_with_zone<enum_name> { \
|
||||
void operator()(msgpack::object::with_zone& o, const enum_name& v) const { \
|
||||
msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(v); \
|
||||
msgpack::operator<<(o, tmp); \
|
||||
void operator()(msgpack::object::with_zone& msgpack_o, const enum_name& msgpack_v) const { \
|
||||
msgpack::underlying_type<enum_name>::type tmp = static_cast<msgpack::underlying_type<enum_name>::type>(msgpack_v); \
|
||||
msgpack::operator<<(msgpack_o, tmp); \
|
||||
} \
|
||||
}; \
|
||||
template <> \
|
||||
struct pack<enum_name> { \
|
||||
template <typename Stream> \
|
||||
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const enum_name& v) const { \
|
||||
return msgpack::operator<<(o, static_cast<msgpack::underlying_type<enum_name>::type>(v)); \
|
||||
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& msgpack_o, const enum_name& msgpack_v) const { \
|
||||
return msgpack::operator<<(msgpack_o, static_cast<msgpack::underlying_type<enum_name>::type>(msgpack_v)); \
|
||||
} \
|
||||
}; \
|
||||
} \
|
||||
|
15
include/msgpack/adaptor/wstring.hpp
Normal file
15
include/msgpack/adaptor/wstring.hpp
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// MessagePack for C++ static resolution routine
|
||||
//
|
||||
// Copyright (C) 2018 KONDO Takatoshi
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
#ifndef MSGPACK_TYPE_WSTRING_HPP
|
||||
#define MSGPACK_TYPE_WSTRING_HPP
|
||||
|
||||
#include "msgpack/v1/adaptor/wstring.hpp"
|
||||
|
||||
#endif // MSGPACK_TYPE_WSTRING_HPP
|
@@ -25,7 +25,7 @@ extern "C" {
|
||||
|
||||
static inline int msgpack_fbuffer_write(void* data, const char* buf, size_t len)
|
||||
{
|
||||
return (len == fwrite(buf, len, 1, (FILE *)data)) ? 0 : -1;
|
||||
return (1 == fwrite(buf, len, 1, (FILE *)data)) ? 0 : -1;
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
@@ -97,8 +97,10 @@ typedef struct msgpack_object_kv {
|
||||
msgpack_object val;
|
||||
} msgpack_object_kv;
|
||||
|
||||
#if !defined(_KERNEL_MODE)
|
||||
MSGPACK_DLLEXPORT
|
||||
void msgpack_object_print(FILE* out, msgpack_object o);
|
||||
#endif
|
||||
|
||||
MSGPACK_DLLEXPORT
|
||||
int msgpack_object_print_buffer(char *buffer, size_t buffer_size, msgpack_object o);
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "pack_define.h"
|
||||
#include "object.h"
|
||||
#include "timestamp.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -88,15 +89,20 @@ static int msgpack_pack_map(msgpack_packer* pk, size_t n);
|
||||
|
||||
static int msgpack_pack_str(msgpack_packer* pk, size_t l);
|
||||
static int msgpack_pack_str_body(msgpack_packer* pk, const void* b, size_t l);
|
||||
static int msgpack_pack_str_with_body(msgpack_packer* pk, const void* b, size_t l);
|
||||
|
||||
static int msgpack_pack_v4raw(msgpack_packer* pk, size_t l);
|
||||
static int msgpack_pack_v4raw_body(msgpack_packer* pk, const void* b, size_t l);
|
||||
|
||||
static int msgpack_pack_bin(msgpack_packer* pk, size_t l);
|
||||
static int msgpack_pack_bin_body(msgpack_packer* pk, const void* b, size_t l);
|
||||
static int msgpack_pack_bin_with_body(msgpack_packer* pk, const void* b, size_t l);
|
||||
|
||||
static int msgpack_pack_ext(msgpack_packer* pk, size_t l, int8_t type);
|
||||
static int msgpack_pack_ext_body(msgpack_packer* pk, const void* b, size_t l);
|
||||
static int msgpack_pack_ext_with_body(msgpack_packer* pk, const void* b, size_t l, int8_t type);
|
||||
|
||||
static int msgpack_pack_timestamp(msgpack_packer* pk, const msgpack_timestamp* d);
|
||||
|
||||
MSGPACK_DLLEXPORT
|
||||
int msgpack_pack_object(msgpack_packer* pk, msgpack_object d);
|
||||
@@ -140,6 +146,26 @@ inline void msgpack_packer_free(msgpack_packer* pk)
|
||||
free(pk);
|
||||
}
|
||||
|
||||
inline int msgpack_pack_str_with_body(msgpack_packer* pk, const void* b, size_t l)
|
||||
{
|
||||
int ret = msgpack_pack_str(pk, l);
|
||||
if (ret != 0) { return ret; }
|
||||
return msgpack_pack_str_body(pk, b, l);
|
||||
}
|
||||
|
||||
inline int msgpack_pack_bin_with_body(msgpack_packer* pk, const void* b, size_t l)
|
||||
{
|
||||
int ret = msgpack_pack_bin(pk, l);
|
||||
if (ret != 0) { return ret; }
|
||||
return msgpack_pack_bin_body(pk, b, l);
|
||||
}
|
||||
|
||||
inline int msgpack_pack_ext_with_body(msgpack_packer* pk, const void* b, size_t l, int8_t type)
|
||||
{
|
||||
int ret = msgpack_pack_ext(pk, l, type);
|
||||
if (ret != 0) { return ret; }
|
||||
return msgpack_pack_ext_body(pk, b, l);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -34,6 +34,10 @@
|
||||
#error msgpack_pack_append_buffer callback is not defined
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4204) /* nonstandard extension used: non-constant aggregate initializer */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Integer
|
||||
@@ -834,31 +838,31 @@ msgpack_pack_inline_func(_ext)(msgpack_pack_user x, size_t l, int8_t type)
|
||||
case 1: {
|
||||
unsigned char buf[2];
|
||||
buf[0] = 0xd4;
|
||||
buf[1] = type;
|
||||
buf[1] = (unsigned char)type;
|
||||
msgpack_pack_append_buffer(x, buf, 2);
|
||||
} break;
|
||||
case 2: {
|
||||
unsigned char buf[2];
|
||||
buf[0] = 0xd5;
|
||||
buf[1] = type;
|
||||
buf[1] = (unsigned char)type;
|
||||
msgpack_pack_append_buffer(x, buf, 2);
|
||||
} break;
|
||||
case 4: {
|
||||
unsigned char buf[2];
|
||||
buf[0] = 0xd6;
|
||||
buf[1] = type;
|
||||
buf[1] = (unsigned char)type;
|
||||
msgpack_pack_append_buffer(x, buf, 2);
|
||||
} break;
|
||||
case 8: {
|
||||
unsigned char buf[2];
|
||||
buf[0] = 0xd7;
|
||||
buf[1] = type;
|
||||
buf[1] = (unsigned char)type;
|
||||
msgpack_pack_append_buffer(x, buf, 2);
|
||||
} break;
|
||||
case 16: {
|
||||
unsigned char buf[2];
|
||||
buf[0] = 0xd8;
|
||||
buf[1] = type;
|
||||
buf[1] = (unsigned char)type;
|
||||
msgpack_pack_append_buffer(x, buf, 2);
|
||||
} break;
|
||||
default:
|
||||
@@ -866,19 +870,19 @@ msgpack_pack_inline_func(_ext)(msgpack_pack_user x, size_t l, int8_t type)
|
||||
unsigned char buf[3];
|
||||
buf[0] = 0xc7;
|
||||
buf[1] = (unsigned char)l;
|
||||
buf[2] = type;
|
||||
buf[2] = (unsigned char)type;
|
||||
msgpack_pack_append_buffer(x, buf, 3);
|
||||
} else if(l < 65536) {
|
||||
unsigned char buf[4];
|
||||
buf[0] = 0xc8;
|
||||
_msgpack_store16(&buf[1], l);
|
||||
buf[3] = type;
|
||||
buf[3] = (unsigned char)type;
|
||||
msgpack_pack_append_buffer(x, buf, 4);
|
||||
} else {
|
||||
unsigned char buf[6];
|
||||
buf[0] = 0xc9;
|
||||
_msgpack_store32(&buf[1], l);
|
||||
buf[5] = type;
|
||||
buf[5] = (unsigned char)type;
|
||||
msgpack_pack_append_buffer(x, buf, 6);
|
||||
}
|
||||
break;
|
||||
@@ -890,6 +894,34 @@ msgpack_pack_inline_func(_ext_body)(msgpack_pack_user x, const void* b, size_t l
|
||||
msgpack_pack_append_buffer(x, (const unsigned char*)b, l);
|
||||
}
|
||||
|
||||
msgpack_pack_inline_func(_timestamp)(msgpack_pack_user x, const msgpack_timestamp* d)
|
||||
{
|
||||
if ((((int64_t)d->tv_sec) >> 34) == 0) {
|
||||
uint64_t data64 = ((uint64_t) d->tv_nsec << 34) | (uint64_t)d->tv_sec;
|
||||
if ((data64 & 0xffffffff00000000L) == 0) {
|
||||
// timestamp 32
|
||||
char buf[4];
|
||||
uint32_t data32 = (uint32_t)data64;
|
||||
msgpack_pack_ext(x, 4, -1);
|
||||
_msgpack_store32(buf, data32);
|
||||
msgpack_pack_append_buffer(x, buf, 4);
|
||||
} else {
|
||||
// timestamp 64
|
||||
char buf[8];
|
||||
msgpack_pack_ext(x, 8, -1);
|
||||
_msgpack_store64(buf, data64);
|
||||
msgpack_pack_append_buffer(x, buf, 8);
|
||||
}
|
||||
} else {
|
||||
// timestamp 96
|
||||
char buf[12];
|
||||
_msgpack_store32(&buf[0], d->tv_nsec);
|
||||
_msgpack_store64(&buf[4], d->tv_sec);
|
||||
msgpack_pack_ext(x, 12, -1);
|
||||
msgpack_pack_append_buffer(x, buf, 12);
|
||||
}
|
||||
}
|
||||
|
||||
#undef msgpack_pack_inline_func
|
||||
#undef msgpack_pack_user
|
||||
#undef msgpack_pack_append_buffer
|
||||
@@ -907,3 +939,7 @@ msgpack_pack_inline_func(_ext_body)(msgpack_pack_user x, const void* b, size_t l
|
||||
#undef msgpack_pack_real_int16
|
||||
#undef msgpack_pack_real_int32
|
||||
#undef msgpack_pack_real_int64
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
@@ -19,6 +19,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <msgpack/predef/architecture/mips.h>
|
||||
#include <msgpack/predef/architecture/parisc.h>
|
||||
#include <msgpack/predef/architecture/ppc.h>
|
||||
#include <msgpack/predef/architecture/ptx.h>
|
||||
#include <msgpack/predef/architecture/pyramid.h>
|
||||
#include <msgpack/predef/architecture/rs6k.h>
|
||||
#include <msgpack/predef/architecture/sparc.h>
|
||||
|
@@ -27,11 +27,14 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
[[`__TARGET_ARCH_ARM`] [__predef_detection__]]
|
||||
[[`__TARGET_ARCH_THUMB`] [__predef_detection__]]
|
||||
[[`_M_ARM`] [__predef_detection__]]
|
||||
[[`_M_ARM64`] [__predef_detection__]]
|
||||
|
||||
[[`__arm64`] [8.0.0]]
|
||||
[[`__TARGET_ARCH_ARM`] [V.0.0]]
|
||||
[[`__TARGET_ARCH_THUMB`] [V.0.0]]
|
||||
[[`__ARM_ARCH`] [V.0.0]]
|
||||
[[`_M_ARM`] [V.0.0]]
|
||||
[[`_M_ARM64`] [8.0.0]]
|
||||
]
|
||||
*/
|
||||
|
||||
@@ -39,7 +42,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if defined(__arm__) || defined(__arm64) || defined(__thumb__) || \
|
||||
defined(__TARGET_ARCH_ARM) || defined(__TARGET_ARCH_THUMB) || \
|
||||
defined(_M_ARM)
|
||||
defined(__ARM_ARCH) || \
|
||||
defined(_M_ARM) || defined(_M_ARM64)
|
||||
# undef MSGPACK_ARCH_ARM
|
||||
# if !defined(MSGPACK_ARCH_ARM) && defined(__arm64)
|
||||
# define MSGPACK_ARCH_ARM MSGPACK_VERSION_NUMBER(8,0,0)
|
||||
@@ -50,6 +54,12 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
# if !defined(MSGPACK_ARCH_ARM) && defined(__TARGET_ARCH_THUMB)
|
||||
# define MSGPACK_ARCH_ARM MSGPACK_VERSION_NUMBER(__TARGET_ARCH_THUMB,0,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_ARCH_ARM) && defined(__ARM_ARCH)
|
||||
# define MSGPACK_ARCH_ARM MSGPACK_VERSION_NUMBER(__ARM_ARCH,0,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_ARCH_ARM) && defined(_M_ARM64)
|
||||
# define MSGPACK_ARCH_ARM MSGPACK_VERSION_NUMBER(8,0,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_ARCH_ARM) && defined(_M_ARM)
|
||||
# define MSGPACK_ARCH_ARM MSGPACK_VERSION_NUMBER(_M_ARM,0,0)
|
||||
# endif
|
||||
|
@@ -12,7 +12,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <msgpack/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_ARCH_PARISK`]
|
||||
[heading `MSGPACK_ARCH_PARISC`]
|
||||
|
||||
[@http://en.wikipedia.org/wiki/PA-RISC_family HP/PA RISC] architecture.
|
||||
|
||||
|
44
include/msgpack/predef/architecture/ptx.h
Normal file
44
include/msgpack/predef/architecture/ptx.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright Benjamin Worpitz 2018
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_ARCHITECTURE_PTX_H
|
||||
#define MSGPACK_PREDEF_ARCHITECTURE_PTX_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_ARCH_PTX`]
|
||||
|
||||
[@https://en.wikipedia.org/wiki/Parallel_Thread_Execution PTX] architecture.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__CUDA_ARCH__`] [__predef_detection__]]
|
||||
|
||||
[[`__CUDA_ARCH__`] [V.R.0]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_ARCH_PTX MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__CUDA_ARCH__)
|
||||
# undef MSGPACK_ARCH_PTX
|
||||
# define MSGPACK_ARCH_PTX MSGPACK_PREDEF_MAKE_10_VR0(__CUDA_ARCH__)
|
||||
#endif
|
||||
|
||||
#if MSGPACK_ARCH_PTX
|
||||
# define MSGPACK_ARCH_PTX_AVAILABLE
|
||||
#endif
|
||||
|
||||
#define MSGPACK_ARCH_PTX_NAME "PTX"
|
||||
|
||||
#endif
|
||||
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_ARCH_PTX,MSGPACK_ARCH_PTX_NAME)
|
@@ -32,6 +32,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <msgpack/predef/compiler/metrowerks.h>
|
||||
#include <msgpack/predef/compiler/microtec.h>
|
||||
#include <msgpack/predef/compiler/mpw.h>
|
||||
#include <msgpack/predef/compiler/nvcc.h>
|
||||
#include <msgpack/predef/compiler/palm.h>
|
||||
#include <msgpack/predef/compiler/pgi.h>
|
||||
#include <msgpack/predef/compiler/sgi_mipspro.h>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-2015
|
||||
Copyright Rene Rivera 2008-2017
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -25,7 +25,8 @@ Version number available as major, minor, and patch.
|
||||
[[`__ICC`] [__predef_detection__]]
|
||||
[[`__ECC`] [__predef_detection__]]
|
||||
|
||||
[[`__INTEL_COMPILER`] [V.R.P]]
|
||||
[[`__INTEL_COMPILER`] [V.R]]
|
||||
[[`__INTEL_COMPILER` and `__INTEL_COMPILER_UPDATE`] [V.R.P]]
|
||||
]
|
||||
*/
|
||||
|
||||
@@ -33,8 +34,21 @@ Version number available as major, minor, and patch.
|
||||
|
||||
#if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || \
|
||||
defined(__ECC)
|
||||
/*`
|
||||
[note Because of an Intel mistake in the release version numbering when
|
||||
`__INTEL_COMPILER` is `9999` it is detected as version 12.1.0.]
|
||||
*/
|
||||
# if !defined(MSGPACK_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 9999)
|
||||
# define MSGPACK_COMP_INTEL_DETECTION MSGPACK_VERSION_NUMBER(12,1,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE)
|
||||
# define MSGPACK_COMP_INTEL_DETECTION MSGPACK_VERSION_NUMBER( \
|
||||
MSGPACK_VERSION_NUMBER_MAJOR(MSGPACK_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)), \
|
||||
MSGPACK_VERSION_NUMBER_MINOR(MSGPACK_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)), \
|
||||
__INTEL_COMPILER_UPDATE)
|
||||
# endif
|
||||
# if !defined(MSGPACK_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER)
|
||||
# define MSGPACK_COMP_INTEL_DETECTION MSGPACK_PREDEF_MAKE_10_VRP(__INTEL_COMPILER)
|
||||
# define MSGPACK_COMP_INTEL_DETECTION MSGPACK_PREDEF_MAKE_10_VVRR(__INTEL_COMPILER)
|
||||
# endif
|
||||
# if !defined(MSGPACK_COMP_INTEL_DETECTION)
|
||||
# define MSGPACK_COMP_INTEL_DETECTION MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
|
60
include/msgpack/predef/compiler/nvcc.h
Normal file
60
include/msgpack/predef/compiler/nvcc.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright Benjamin Worpitz 2018
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_COMPILER_NVCC_H
|
||||
#define MSGPACK_PREDEF_COMPILER_NVCC_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_COMP_NVCC`]
|
||||
|
||||
[@https://en.wikipedia.org/wiki/NVIDIA_CUDA_Compiler NVCC] compiler.
|
||||
Version number available as major, minor, and patch beginning with version 7.5.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__NVCC__`] [__predef_detection__]]
|
||||
|
||||
[[`__CUDACC_VER_MAJOR__`, `__CUDACC_VER_MINOR__`, `__CUDACC_VER_BUILD__`] [V.R.P]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_COMP_NVCC MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__NVCC__)
|
||||
# if !defined(__CUDACC_VER_MAJOR__) || !defined(__CUDACC_VER_MINOR__) || !defined(__CUDACC_VER_BUILD__)
|
||||
# define MSGPACK_COMP_NVCC_DETECTION MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
# else
|
||||
# define MSGPACK_COMP_NVCC_DETECTION MSGPACK_VERSION_NUMBER(__CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, __CUDACC_VER_BUILD__)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef MSGPACK_COMP_NVCC_DETECTION
|
||||
# if defined(MSGPACK_PREDEF_DETAIL_COMP_DETECTED)
|
||||
# define MSGPACK_COMP_NVCC_EMULATED MSGPACK_COMP_NVCC_DETECTION
|
||||
# else
|
||||
# undef MSGPACK_COMP_NVCC
|
||||
# define MSGPACK_COMP_NVCC MSGPACK_COMP_NVCC_DETECTION
|
||||
# endif
|
||||
# define MSGPACK_COMP_NVCC_AVAILABLE
|
||||
# include <msgpack/predef/detail/comp_detected.h>
|
||||
#endif
|
||||
|
||||
#define MSGPACK_COMP_NVCC_NAME "NVCC"
|
||||
|
||||
#endif
|
||||
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_COMP_NVCC,MSGPACK_COMP_NVCC_NAME)
|
||||
|
||||
#ifdef MSGPACK_COMP_NVCC_EMULATED
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_COMP_NVCC_EMULATED,MSGPACK_COMP_NVCC_NAME)
|
||||
#endif
|
@@ -29,6 +29,10 @@ Version number available as major, minor, and patch.
|
||||
[[`_MSC_FULL_VER`] [V.R.P]]
|
||||
[[`_MSC_VER`] [V.R.0]]
|
||||
]
|
||||
|
||||
[note Release of Visual Studio after 2015 will no longer be identified
|
||||
by Boost Predef as the marketing version number. Instead we use the
|
||||
compiler version number directly, i.e. the _MSC_VER number.]
|
||||
*/
|
||||
|
||||
#define MSGPACK_COMP_MSVC MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
@@ -53,8 +57,18 @@ Version number available as major, minor, and patch.
|
||||
means that the compiler and VS product versions are no longer
|
||||
in sync. Hence we need to use different formulas for
|
||||
mapping from MSC version to VS product version.
|
||||
|
||||
VS2017 is a total nightmare when it comes to version numbers.
|
||||
Hence to avoid arguments relating to that both present and
|
||||
future.. Any version after VS2015 will use solely the compiler
|
||||
version, i.e. cl.exe, as the version number here.
|
||||
*/
|
||||
# if (_MSC_VER >= 1900)
|
||||
# if (_MSC_VER > 1900)
|
||||
# define MSGPACK_COMP_MSVC_DETECTION MSGPACK_VERSION_NUMBER(\
|
||||
_MSC_VER/100,\
|
||||
_MSC_VER%100,\
|
||||
MSGPACK_COMP_MSVC_BUILD)
|
||||
# elif (_MSC_VER >= 1900)
|
||||
# define MSGPACK_COMP_MSVC_DETECTION MSGPACK_VERSION_NUMBER(\
|
||||
_MSC_VER/100-5,\
|
||||
_MSC_VER%100,\
|
||||
|
@@ -24,6 +24,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
[[`__ARM_NEON__`] [__predef_detection__]]
|
||||
[[`__aarch64__`] [__predef_detection__]]
|
||||
[[`_M_ARM`] [__predef_detection__]]
|
||||
[[`_M_ARM64`] [__predef_detection__]]
|
||||
]
|
||||
|
||||
[table
|
||||
@@ -32,6 +33,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
[[`__ARM_NEON__`] [MSGPACK_HW_SIMD_ARM_NEON_VERSION]]
|
||||
[[`__aarch64__`] [MSGPACK_HW_SIMD_ARM_NEON_VERSION]]
|
||||
[[`_M_ARM`] [MSGPACK_HW_SIMD_ARM_NEON_VERSION]]
|
||||
[[`_M_ARM64`] [MSGPACK_HW_SIMD_ARM_NEON_VERSION]]
|
||||
]
|
||||
|
||||
*/
|
||||
@@ -39,7 +41,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#define MSGPACK_HW_SIMD_ARM MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#undef MSGPACK_HW_SIMD_ARM
|
||||
#if !defined(MSGPACK_HW_SIMD_ARM) && (defined(__ARM_NEON__) || defined(__aarch64__) || defined (_M_ARM))
|
||||
#if !defined(MSGPACK_HW_SIMD_ARM) && (defined(__ARM_NEON__) || defined(__aarch64__) || defined (_M_ARM) || defined (_M_ARM64))
|
||||
# define MSGPACK_HW_SIMD_ARM MSGPACK_HW_SIMD_ARM_NEON_VERSION
|
||||
#endif
|
||||
|
||||
|
@@ -21,7 +21,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
// ---------------------------------
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_HW_SIMD_X86_SSE4A_VERSION`]
|
||||
[heading `MSGPACK_HW_SIMD_X86_AMD_SSE4A_VERSION`]
|
||||
|
||||
[@https://en.wikipedia.org/wiki/SSE4##SSE4A SSE4A] x86 extension (AMD specific).
|
||||
|
||||
@@ -30,7 +30,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#define MSGPACK_HW_SIMD_X86_AMD_SSE4A_VERSION MSGPACK_VERSION_NUMBER(4, 0, 0)
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_HW_SIMD_X86_FMA4_VERSION`]
|
||||
[heading `MSGPACK_HW_SIMD_X86_AMD_FMA4_VERSION`]
|
||||
|
||||
[@https://en.wikipedia.org/wiki/FMA_instruction_set#FMA4_instruction_set FMA4] x86 extension (AMD specific).
|
||||
|
||||
@@ -39,7 +39,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#define MSGPACK_HW_SIMD_X86_AMD_FMA4_VERSION MSGPACK_VERSION_NUMBER(5, 1, 0)
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_HW_SIMD_X86_XOP_VERSION`]
|
||||
[heading `MSGPACK_HW_SIMD_X86_AMD_XOP_VERSION`]
|
||||
|
||||
[@https://en.wikipedia.org/wiki/XOP_instruction_set XOP] x86 extension (AMD specific).
|
||||
|
||||
|
@@ -13,5 +13,6 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <msgpack/predef/language/stdc.h>
|
||||
#include <msgpack/predef/language/stdcpp.h>
|
||||
#include <msgpack/predef/language/objc.h>
|
||||
#include <msgpack/predef/language/cuda.h>
|
||||
|
||||
#endif
|
||||
|
52
include/msgpack/predef/language/cuda.h
Normal file
52
include/msgpack/predef/language/cuda.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright Benjamin Worpitz 2018
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_LANGUAGE_CUDA_H
|
||||
#define MSGPACK_PREDEF_LANGUAGE_CUDA_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_LANG_CUDA`]
|
||||
|
||||
[@https://en.wikipedia.org/wiki/CUDA CUDA C/C++] language.
|
||||
If available, the version is detected as VV.RR.P.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__CUDACC__`] [__predef_detection__]]
|
||||
[[`__CUDA__`] [__predef_detection__]]
|
||||
|
||||
[[`CUDA_VERSION`] [VV.RR.P]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_LANG_CUDA MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__CUDACC__) || defined(__CUDA__)
|
||||
# undef MSGPACK_LANG_CUDA
|
||||
# include <cuda.h>
|
||||
# if defined(CUDA_VERSION)
|
||||
# define MSGPACK_LANG_CUDA MSGPACK_PREDEF_MAKE_10_VVRRP(CUDA_VERSION)
|
||||
# else
|
||||
# define MSGPACK_LANG_CUDA MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if MSGPACK_LANG_CUDA
|
||||
# define MSGPACK_LANG_CUDA_AVAILABLE
|
||||
#endif
|
||||
|
||||
#define MSGPACK_LANG_CUDA_NAME "CUDA C/C++"
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_LANG_CUDA,MSGPACK_LANG_CUDA_NAME)
|
@@ -12,6 +12,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <msgpack/predef/library/c/_prefix.h>
|
||||
|
||||
#include <msgpack/predef/library/c/cloudabi.h>
|
||||
#include <msgpack/predef/library/c/gnu.h>
|
||||
#include <msgpack/predef/library/c/uc.h>
|
||||
#include <msgpack/predef/library/c/vms.h>
|
||||
|
53
include/msgpack/predef/library/c/cloudabi.h
Normal file
53
include/msgpack/predef/library/c/cloudabi.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2017 James E. King III
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_LIBRARY_C_CLOUDABI_H
|
||||
#define MSGPACK_PREDEF_LIBRARY_C_CLOUDABI_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
|
||||
#include <msgpack/predef/library/c/_prefix.h>
|
||||
|
||||
#if defined(__CloudABI__)
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_LIB_C_CLOUDABI`]
|
||||
|
||||
[@https://github.com/NuxiNL/cloudlibc cloudlibc] - CloudABI's standard C library.
|
||||
Version number available as major, and minor.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__cloudlibc__`] [__predef_detection__]]
|
||||
|
||||
[[`__cloudlibc_major__`, `__cloudlibc_minor__`] [V.R.0]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_LIB_C_CLOUDABI MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__cloudlibc__)
|
||||
# undef MSGPACK_LIB_C_CLOUDABI
|
||||
# define MSGPACK_LIB_C_CLOUDABI \
|
||||
MSGPACK_VERSION_NUMBER(__cloudlibc_major__,__cloudlibc_minor__,0)
|
||||
#endif
|
||||
|
||||
#if MSGPACK_LIB_C_CLOUDABI
|
||||
# define MSGPACK_LIB_C_CLOUDABI_AVAILABLE
|
||||
#endif
|
||||
|
||||
#define MSGPACK_LIB_C_CLOUDABI_NAME "cloudlibc"
|
||||
|
||||
#endif
|
||||
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_LIB_C_CLOUDABI,MSGPACK_LIB_C_CLOUDABI_NAME)
|
@@ -46,10 +46,14 @@ Macros are:
|
||||
#define MSGPACK_PREDEF_MAKE_0X_VVRRPP(V) MSGPACK_VERSION_NUMBER((V&0xFF0000)>>16,(V&0xFF00)>>8,(V&0xFF))
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VPPP(V)` */
|
||||
#define MSGPACK_PREDEF_MAKE_10_VPPP(V) MSGPACK_VERSION_NUMBER(((V)/1000)%10,0,(V)%1000)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VR0(V)` */
|
||||
#define MSGPACK_PREDEF_MAKE_10_VR0(V) MSGPACK_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,0)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VRP(V)` */
|
||||
#define MSGPACK_PREDEF_MAKE_10_VRP(V) MSGPACK_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,(V)%10)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VRP000(V)` */
|
||||
#define MSGPACK_PREDEF_MAKE_10_VRP000(V) MSGPACK_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,((V)/1000)%10)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VRPPPP(V)` */
|
||||
#define MSGPACK_PREDEF_MAKE_10_VRPPPP(V) MSGPACK_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,(V)%10000)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VRPP(V)` */
|
||||
#define MSGPACK_PREDEF_MAKE_10_VRPP(V) MSGPACK_VERSION_NUMBER(((V)/1000)%10,((V)/100)%10,(V)%100)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VRR(V)` */
|
||||
@@ -62,8 +66,12 @@ Macros are:
|
||||
#define MSGPACK_PREDEF_MAKE_10_VV00(V) MSGPACK_VERSION_NUMBER(((V)/100)%100,0,0)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VVRR(V)` */
|
||||
#define MSGPACK_PREDEF_MAKE_10_VVRR(V) MSGPACK_VERSION_NUMBER(((V)/100)%100,(V)%100,0)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VVRRP(V)` */
|
||||
#define MSGPACK_PREDEF_MAKE_10_VVRRP(V) MSGPACK_VERSION_NUMBER(((V)/1000)%100,((V)/10)%100,(V)%10)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VVRRPP(V)` */
|
||||
#define MSGPACK_PREDEF_MAKE_10_VVRRPP(V) MSGPACK_VERSION_NUMBER(((V)/10000)%100,((V)/100)%100,(V)%100)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VVRRPPP(V)` */
|
||||
#define MSGPACK_PREDEF_MAKE_10_VVRRPPP(V) MSGPACK_VERSION_NUMBER(((V)/100000)%100,((V)/1000)%100,(V)%1000)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VVRR0PP00(V)` */
|
||||
#define MSGPACK_PREDEF_MAKE_10_VVRR0PP00(V) MSGPACK_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,((V)/100)%100)
|
||||
/*` `MSGPACK_PREDEF_MAKE_10_VVRR0PPPP(V)` */
|
||||
|
@@ -5,8 +5,8 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_OS_ADROID_H
|
||||
#define MSGPACK_PREDEF_OS_ADROID_H
|
||||
#ifndef MSGPACK_PREDEF_OS_ANDROID_H
|
||||
#define MSGPACK_PREDEF_OS_ANDROID_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
|
@@ -34,13 +34,20 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
# define MSGPACK_OS_BSD_AVAILABLE
|
||||
# endif
|
||||
# undef MSGPACK_OS_BSD_FREE
|
||||
# include <sys/param.h>
|
||||
# if defined(__FreeBSD_version)
|
||||
# if __FreeBSD_version < 500000
|
||||
# if __FreeBSD_version == 491000
|
||||
# define MSGPACK_OS_BSD_FREE \
|
||||
MSGPACK_PREDEF_MAKE_10_VRP000(__FreeBSD_version)
|
||||
MSGPACK_VERSION_NUMBER(4, 10, 0)
|
||||
# elif __FreeBSD_version == 492000
|
||||
# define MSGPACK_OS_BSD_FREE \
|
||||
MSGPACK_VERSION_NUMBER(4, 11, 0)
|
||||
# elif __FreeBSD_version < 500000
|
||||
# define MSGPACK_OS_BSD_FREE \
|
||||
MSGPACK_PREDEF_MAKE_10_VRPPPP(__FreeBSD_version)
|
||||
# else
|
||||
# define MSGPACK_OS_BSD_FREE \
|
||||
MSGPACK_PREDEF_MAKE_10_VRR000(__FreeBSD_version)
|
||||
MSGPACK_PREDEF_MAKE_10_VVRRPPP(__FreeBSD_version)
|
||||
# endif
|
||||
# else
|
||||
# define MSGPACK_OS_BSD_FREE MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
|
@@ -50,6 +50,26 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
[[`OpenBSD4_7`] [4.7.0]]
|
||||
[[`OpenBSD4_8`] [4.8.0]]
|
||||
[[`OpenBSD4_9`] [4.9.0]]
|
||||
[[`OpenBSD5_0`] [5.0.0]]
|
||||
[[`OpenBSD5_1`] [5.1.0]]
|
||||
[[`OpenBSD5_2`] [5.2.0]]
|
||||
[[`OpenBSD5_3`] [5.3.0]]
|
||||
[[`OpenBSD5_4`] [5.4.0]]
|
||||
[[`OpenBSD5_5`] [5.5.0]]
|
||||
[[`OpenBSD5_6`] [5.6.0]]
|
||||
[[`OpenBSD5_7`] [5.7.0]]
|
||||
[[`OpenBSD5_8`] [5.8.0]]
|
||||
[[`OpenBSD5_9`] [5.9.0]]
|
||||
[[`OpenBSD6_0`] [6.0.0]]
|
||||
[[`OpenBSD6_1`] [6.1.0]]
|
||||
[[`OpenBSD6_2`] [6.2.0]]
|
||||
[[`OpenBSD6_3`] [6.3.0]]
|
||||
[[`OpenBSD6_4`] [6.4.0]]
|
||||
[[`OpenBSD6_5`] [6.5.0]]
|
||||
[[`OpenBSD6_6`] [6.6.0]]
|
||||
[[`OpenBSD6_7`] [6.7.0]]
|
||||
[[`OpenBSD6_8`] [6.8.0]]
|
||||
[[`OpenBSD6_9`] [6.9.0]]
|
||||
]
|
||||
*/
|
||||
|
||||
@@ -153,6 +173,66 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD4_9)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(4,9,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_0)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,0,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_1)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,1,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_2)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,2,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_3)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,3,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_4)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,4,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_5)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,5,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_6)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,6,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_7)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,7,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_8)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,8,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD5_9)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(5,9,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_0)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,0,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_1)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,1,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_2)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,2,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_3)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,3,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_4)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,4,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_5)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,5,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_6)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,6,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_7)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,7,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_8)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,8,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN) && defined(OpenBSD6_9)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER(6,9,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_OS_BSD_OPEN)
|
||||
# define MSGPACK_OS_BSD_OPEN MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
|
@@ -148,8 +148,7 @@ information and acquired knowledge:
|
||||
# undef MSGPACK_ENDIAN_BIG_BYTE
|
||||
# define MSGPACK_ENDIAN_BIG_BYTE MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
# if MSGPACK_ARCH_AMD64 || \
|
||||
MSGPACK_ARCH_IA64 || \
|
||||
# if MSGPACK_ARCH_IA64 || \
|
||||
MSGPACK_ARCH_X86 || \
|
||||
MSGPACK_ARCH_BLACKFIN
|
||||
# undef MSGPACK_ENDIAN_LITTLE_BYTE
|
||||
|
87
include/msgpack/predef/other/workaround.h
Normal file
87
include/msgpack/predef/other/workaround.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2017
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_WORKAROUND_H
|
||||
#define MSGPACK_PREDEF_WORKAROUND_H
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PREDEF_WORKAROUND`]
|
||||
|
||||
``
|
||||
MSGPACK_PREDEF_WORKAROUND(symbol,comp,major,minor,patch)
|
||||
``
|
||||
|
||||
Usage:
|
||||
|
||||
``
|
||||
#if MSGPACK_PREDEF_WORKAROUND(MSGPACK_COMP_CLANG,<,3,0,0)
|
||||
// Workaround for old clang compilers..
|
||||
#endif
|
||||
``
|
||||
|
||||
Defines a comparison against two version numbers that depends on the definion
|
||||
of `MSGPACK_STRICT_CONFIG`. When `MSGPACK_STRICT_CONFIG` is defined this will expand
|
||||
to a value convertible to `false`. Which has the effect of disabling all code
|
||||
conditionally guarded by `MSGPACK_PREDEF_WORKAROUND`. When `MSGPACK_STRICT_CONFIG`
|
||||
is undefine this expand to test the given `symbol` version value with the
|
||||
`comp` comparison against `MSGPACK_VERSION_NUMBER(major,minor,patch)`.
|
||||
*/
|
||||
#ifdef MSGPACK_STRICT_CONFIG
|
||||
# define MSGPACK_PREDEF_WORKAROUND(symbol, comp, major, minor, patch) (0)
|
||||
#else
|
||||
# include <msgpack/predef/version_number.h>
|
||||
# define MSGPACK_PREDEF_WORKAROUND(symbol, comp, major, minor, patch) \
|
||||
( (symbol) != (0) ) && \
|
||||
( (symbol) comp (MSGPACK_VERSION_NUMBER( (major) , (minor) , (patch) )) )
|
||||
#endif
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PREDEF_TESTED_AT`]
|
||||
|
||||
``
|
||||
MSGPACK_PREDEF_TESTED_AT(symbol,major,minor,patch)
|
||||
``
|
||||
|
||||
Usage:
|
||||
|
||||
``
|
||||
#if MSGPACK_PREDEF_TESTED_AT(MSGPACK_COMP_CLANG,3,5,0)
|
||||
// Needed for clang, and last checked for 3.5.0.
|
||||
#endif
|
||||
``
|
||||
|
||||
Defines a comparison against two version numbers that depends on the definion
|
||||
of `MSGPACK_STRICT_CONFIG` and `MSGPACK_DETECT_OUTDATED_WORKAROUNDS`.
|
||||
When `MSGPACK_STRICT_CONFIG` is defined this will expand to a value convertible
|
||||
to `false`. Which has the effect of disabling all code
|
||||
conditionally guarded by `MSGPACK_PREDEF_TESTED_AT`. When `MSGPACK_STRICT_CONFIG`
|
||||
is undefined this expand to either:
|
||||
|
||||
* A value convertible to `true` when `MSGPACK_DETECT_OUTDATED_WORKAROUNDS` is not
|
||||
defined.
|
||||
* A value convertible `true` when the expansion of
|
||||
`MSGPACK_PREDEF_WORKAROUND(symbol, <=, major, minor, patch)` is `true` and
|
||||
`MSGPACK_DETECT_OUTDATED_WORKAROUNDS` is defined.
|
||||
* A compile error when the expansion of
|
||||
`MSGPACK_PREDEF_WORKAROUND(symbol, >, major, minor, patch)` is true and
|
||||
`MSGPACK_DETECT_OUTDATED_WORKAROUNDS` is defined.
|
||||
*/
|
||||
#ifdef MSGPACK_STRICT_CONFIG
|
||||
# define MSGPACK_PREDEF_TESTED_AT(symbol, major, minor, patch) (0)
|
||||
#else
|
||||
# ifdef MSGPACK_DETECT_OUTDATED_WORKAROUNDS
|
||||
# define MSGPACK_PREDEF_TESTED_AT(symbol, major, minor, patch) ( \
|
||||
MSGPACK_PREDEF_WORKAROUND(symbol, <=, major, minor, patch) \
|
||||
? 1 \
|
||||
: (1%0) )
|
||||
# else
|
||||
# define MSGPACK_PREDEF_TESTED_AT(symbol, major, minor, patch) \
|
||||
( (symbol) >= MSGPACK_VERSION_NUMBER_AVAILABLE )
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
@@ -11,11 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#define MSGPACK_PREDEF_PLATFORM_H
|
||||
#endif
|
||||
|
||||
#include <msgpack/predef/platform/cloudabi.h>
|
||||
#include <msgpack/predef/platform/mingw.h>
|
||||
#include <msgpack/predef/platform/mingw32.h>
|
||||
#include <msgpack/predef/platform/mingw64.h>
|
||||
#include <msgpack/predef/platform/windows_uwp.h>
|
||||
#include <msgpack/predef/platform/windows_desktop.h>
|
||||
#include <msgpack/predef/platform/windows_store.h>
|
||||
#include <msgpack/predef/platform/windows_phone.h>
|
||||
#include <msgpack/predef/platform/windows_runtime.h>
|
||||
#include <msgpack/predef/platform/windows_server.h>
|
||||
#include <msgpack/predef/platform/windows_store.h>
|
||||
#include <msgpack/predef/platform/windows_system.h>
|
||||
#include <msgpack/predef/platform/windows_runtime.h> // deprecated
|
||||
#include <msgpack/predef/platform/ios.h>
|
||||
/*#include <msgpack/predef/platform/.h>*/
|
||||
|
||||
#endif
|
||||
|
43
include/msgpack/predef/platform/cloudabi.h
Normal file
43
include/msgpack/predef/platform/cloudabi.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright 2017 James E. King, III
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_PLAT_CLOUDABI_H
|
||||
#define MSGPACK_PREDEF_PLAT_CLOUDABI_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_CLOUDABI`]
|
||||
|
||||
[@https://github.com/NuxiNL/cloudabi CloudABI] platform.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__CloudABI__`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_PLAT_CLOUDABI MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__CloudABI__)
|
||||
# undef MSGPACK_PLAT_CLOUDABI
|
||||
# define MSGPACK_PLAT_CLOUDABI MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if MSGPACK_PLAT_CLOUDABI
|
||||
# define MSGPACK_PLAT_CLOUDABI_AVAILABLE
|
||||
# include <msgpack/predef/detail/platform_detected.h>
|
||||
#endif
|
||||
|
||||
#define MSGPACK_PLAT_CLOUDABI_NAME "CloudABI"
|
||||
|
||||
#endif
|
||||
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_CLOUDABI,MSGPACK_PLAT_CLOUDABI_NAME)
|
58
include/msgpack/predef/platform/ios.h
Normal file
58
include/msgpack/predef/platform/ios.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
Copyright Ruslan Baratov 2017
|
||||
Copyright Rene Rivera 2017
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_PLAT_IOS_H
|
||||
#define MSGPACK_PREDEF_PLAT_IOS_H
|
||||
|
||||
#include <msgpack/predef/os/ios.h> // MSGPACK_OS_IOS
|
||||
#include <msgpack/predef/version_number.h> // MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_IOS_DEVICE`]
|
||||
[heading `MSGPACK_PLAT_IOS_SIMULATOR`]
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`TARGET_IPHONE_SIMULATOR`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_PLAT_IOS_DEVICE MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
#define MSGPACK_PLAT_IOS_SIMULATOR MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h
|
||||
#if MSGPACK_OS_IOS
|
||||
# include <TargetConditionals.h>
|
||||
# if TARGET_IPHONE_SIMULATOR == 1
|
||||
# undef MSGPACK_PLAT_IOS_SIMULATOR
|
||||
# define MSGPACK_PLAT_IOS_SIMULATOR MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
# else
|
||||
# undef MSGPACK_PLAT_IOS_DEVICE
|
||||
# define MSGPACK_PLAT_IOS_DEVICE MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if MSGPACK_PLAT_IOS_SIMULATOR
|
||||
# define MSGPACK_PLAT_IOS_SIMULATOR_AVAILABLE
|
||||
# include <msgpack/predef/detail/platform_detected.h>
|
||||
#endif
|
||||
|
||||
#if MSGPACK_PLAT_IOS_DEVICE
|
||||
# define MSGPACK_PLAT_IOS_DEVICE_AVAILABLE
|
||||
# include <msgpack/predef/detail/platform_detected.h>
|
||||
#endif
|
||||
|
||||
#define MSGPACK_PLAT_IOS_SIMULATOR_NAME "iOS Simulator"
|
||||
#define MSGPACK_PLAT_IOS_DEVICE_NAME "iOS Device"
|
||||
|
||||
#endif // MSGPACK_PREDEF_PLAT_IOS_H
|
||||
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_IOS_SIMULATOR,MSGPACK_PLAT_IOS_SIMULATOR_NAME)
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_IOS_DEVICE,MSGPACK_PLAT_IOS_DEVICE_NAME)
|
@@ -5,8 +5,8 @@ Distributed under the Boost Software License, Version 1.0.
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_COMPILER_MINGW_H
|
||||
#define MSGPACK_PREDEF_COMPILER_MINGW_H
|
||||
#ifndef MSGPACK_PREDEF_PLAT_MINGW_H
|
||||
#define MSGPACK_PREDEF_PLAT_MINGW_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
@@ -14,7 +14,7 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_MINGW`]
|
||||
|
||||
[@http://en.wikipedia.org/wiki/MinGW MinGW] platform.
|
||||
[@http://en.wikipedia.org/wiki/MinGW MinGW] platform, either variety.
|
||||
Version number available as major, minor, and patch.
|
||||
|
||||
[table
|
||||
@@ -56,7 +56,7 @@ Version number available as major, minor, and patch.
|
||||
# include <msgpack/predef/detail/platform_detected.h>
|
||||
#endif
|
||||
|
||||
#define MSGPACK_PLAT_MINGW_NAME "MinGW"
|
||||
#define MSGPACK_PLAT_MINGW_NAME "MinGW (any variety)"
|
||||
|
||||
#endif
|
||||
|
||||
|
63
include/msgpack/predef/platform/mingw32.h
Normal file
63
include/msgpack/predef/platform/mingw32.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-2015
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_PLAT_MINGW32_H
|
||||
#define MSGPACK_PREDEF_PLAT_MINGW32_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_MINGW32`]
|
||||
|
||||
[@http://www.mingw.org/ MinGW] platform.
|
||||
Version number available as major, minor, and patch.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__MINGW32__`] [__predef_detection__]]
|
||||
|
||||
[[`__MINGW32_VERSION_MAJOR`, `__MINGW32_VERSION_MINOR`] [V.R.0]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_PLAT_MINGW32 MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
# include <_mingw.h>
|
||||
# if !defined(MSGPACK_PLAT_MINGW32_DETECTION) && (defined(__MINGW32_VERSION_MAJOR) && defined(__MINGW32_VERSION_MINOR))
|
||||
# define MSGPACK_PLAT_MINGW32_DETECTION \
|
||||
MSGPACK_VERSION_NUMBER(__MINGW32_VERSION_MAJOR,__MINGW32_VERSION_MINOR,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_PLAT_MINGW32_DETECTION)
|
||||
# define MSGPACK_PLAT_MINGW32_DETECTION MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef MSGPACK_PLAT_MINGW32_DETECTION
|
||||
# define MSGPACK_PLAT_MINGW32_AVAILABLE
|
||||
# if defined(MSGPACK_PREDEF_DETAIL_PLAT_DETECTED)
|
||||
# define MSGPACK_PLAT_MINGW32_EMULATED MSGPACK_PLAT_MINGW32_DETECTION
|
||||
# else
|
||||
# undef MSGPACK_PLAT_MINGW32
|
||||
# define MSGPACK_PLAT_MINGW32 MSGPACK_PLAT_MINGW32_DETECTION
|
||||
# endif
|
||||
# include <msgpack/predef/detail/platform_detected.h>
|
||||
#endif
|
||||
|
||||
#define MSGPACK_PLAT_MINGW32_NAME "MinGW"
|
||||
|
||||
#endif
|
||||
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_MINGW32,MSGPACK_PLAT_MINGW32_NAME)
|
||||
|
||||
#ifdef MSGPACK_PLAT_MINGW32_EMULATED
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_MINGW32_EMULATED,MSGPACK_PLAT_MINGW32_NAME)
|
||||
#endif
|
63
include/msgpack/predef/platform/mingw64.h
Normal file
63
include/msgpack/predef/platform/mingw64.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2008-2015
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_PLAT_MINGW64_H
|
||||
#define MSGPACK_PREDEF_PLAT_MINGW64_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_MINGW64`]
|
||||
|
||||
[@https://mingw-w64.org/ MinGW-w64] platform.
|
||||
Version number available as major, minor, and patch.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__MINGW64__`] [__predef_detection__]]
|
||||
|
||||
[[`__MINGW64_VERSION_MAJOR`, `__MINGW64_VERSION_MINOR`] [V.R.0]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_PLAT_MINGW64 MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if defined(__MINGW64__)
|
||||
# include <_mingw.h>
|
||||
# if !defined(MSGPACK_PLAT_MINGW64_DETECTION) && (defined(__MINGW64_VERSION_MAJOR) && defined(__MINGW64_VERSION_MINOR))
|
||||
# define MSGPACK_PLAT_MINGW64_DETECTION \
|
||||
MSGPACK_VERSION_NUMBER(__MINGW64_VERSION_MAJOR,__MINGW64_VERSION_MINOR,0)
|
||||
# endif
|
||||
# if !defined(MSGPACK_PLAT_MINGW64_DETECTION)
|
||||
# define MSGPACK_PLAT_MINGW64_DETECTION MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef MSGPACK_PLAT_MINGW64_DETECTION
|
||||
# define MSGPACK_PLAT_MINGW64_AVAILABLE
|
||||
# if defined(MSGPACK_PREDEF_DETAIL_PLAT_DETECTED)
|
||||
# define MSGPACK_PLAT_MINGW64_EMULATED MSGPACK_PLAT_MINGW64_DETECTION
|
||||
# else
|
||||
# undef MSGPACK_PLAT_MINGW64
|
||||
# define MSGPACK_PLAT_MINGW64 MSGPACK_PLAT_MINGW64_DETECTION
|
||||
# endif
|
||||
# include <msgpack/predef/detail/platform_detected.h>
|
||||
#endif
|
||||
|
||||
#define MSGPACK_PLAT_MINGW64_NAME "MinGW-w64"
|
||||
|
||||
#endif
|
||||
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_MINGW64,MSGPACK_PLAT_MINGW64_NAME)
|
||||
|
||||
#ifdef MSGPACK_PLAT_MINGW64_EMULATED
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_MINGW64_EMULATED,MSGPACK_PLAT_MINGW64_NAME)
|
||||
#endif
|
@@ -9,25 +9,31 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef MSGPACK_PREDEF_PLAT_WINDOWS_DESKTOP_H
|
||||
#define MSGPACK_PREDEF_PLAT_WINDOWS_DESKTOP_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
#include <msgpack/predef/os/windows.h>
|
||||
#include <msgpack/predef/platform/windows_uwp.h>
|
||||
#include <msgpack/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_WINDOWS_DESKTOP`]
|
||||
|
||||
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
|
||||
for Windows Desktop development. Also available if the Platform SDK is too
|
||||
old to support UWP.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`!WINAPI_FAMILY`] [__predef_detection__]]
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP`] [__predef_detection__]]
|
||||
[[`!MSGPACK_PLAT_WINDOWS_UWP`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_PLAT_WINDOWS_DESKTOP MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if MSGPACK_OS_WINDOWS && \
|
||||
( !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) )
|
||||
((defined(WINAPI_FAMILY_DESKTOP_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) || \
|
||||
!MSGPACK_PLAT_WINDOWS_UWP)
|
||||
# undef MSGPACK_PLAT_WINDOWS_DESKTOP
|
||||
# define MSGPACK_PLAT_WINDOWS_DESKTOP MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
@@ -9,13 +9,17 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef MSGPACK_PREDEF_PLAT_WINDOWS_PHONE_H
|
||||
#define MSGPACK_PREDEF_PLAT_WINDOWS_PHONE_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
#include <msgpack/predef/os/windows.h>
|
||||
#include <msgpack/predef/platform/windows_uwp.h>
|
||||
#include <msgpack/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_WINDOWS_PHONE`]
|
||||
|
||||
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
|
||||
for Windows Phone development.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
@@ -25,7 +29,8 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#define MSGPACK_PLAT_WINDOWS_PHONE MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if MSGPACK_OS_WINDOWS && defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
#if MSGPACK_OS_WINDOWS && \
|
||||
defined(WINAPI_FAMILY_PHONE_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||
# undef MSGPACK_PLAT_WINDOWS_PHONE
|
||||
# define MSGPACK_PLAT_WINDOWS_PHONE MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
@@ -9,25 +9,33 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef MSGPACK_PREDEF_PLAT_WINDOWS_RUNTIME_H
|
||||
#define MSGPACK_PREDEF_PLAT_WINDOWS_RUNTIME_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
#include <msgpack/predef/os/windows.h>
|
||||
#include <msgpack/predef/platform/windows_phone.h>
|
||||
#include <msgpack/predef/platform/windows_store.h>
|
||||
#include <msgpack/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_WINDOWS_RUNTIME`]
|
||||
|
||||
Deprecated.
|
||||
|
||||
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
|
||||
for Windows Phone or Store development. This does not align to the existing development model for
|
||||
UWP and is deprecated. Use one of the other `MSGPACK_PLAT_WINDOWS_*`definitions instead.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_APP`] [__predef_detection__]]
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP`] [__predef_detection__]]
|
||||
[[`MSGPACK_PLAT_WINDOWS_PHONE`] [__predef_detection__]]
|
||||
[[`MSGPACK_PLAT_WINDOWS_STORE`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_PLAT_WINDOWS_RUNTIME MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if MSGPACK_OS_WINDOWS && defined(WINAPI_FAMILY) && \
|
||||
( WINAPI_FAMILY == WINAPI_FAMILY_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP )
|
||||
#if MSGPACK_OS_WINDOWS && \
|
||||
(MSGPACK_PLAT_WINDOWS_STORE || MSGPACK_PLAT_WINDOWS_PHONE)
|
||||
# undef MSGPACK_PLAT_WINDOWS_RUNTIME
|
||||
# define MSGPACK_PLAT_WINDOWS_RUNTIME MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
47
include/msgpack/predef/platform/windows_server.h
Normal file
47
include/msgpack/predef/platform/windows_server.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright James E. King III, 2017
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_PLAT_WINDOWS_SERVER_H
|
||||
#define MSGPACK_PREDEF_PLAT_WINDOWS_SERVER_H
|
||||
|
||||
#include <msgpack/predef/make.h>
|
||||
#include <msgpack/predef/os/windows.h>
|
||||
#include <msgpack/predef/platform/windows_uwp.h>
|
||||
#include <msgpack/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_WINDOWS_SERVER`]
|
||||
|
||||
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
|
||||
for Windows Server development.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_SERVER`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_PLAT_WINDOWS_SERVER MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if MSGPACK_OS_WINDOWS && \
|
||||
defined(WINAPI_FAMILY_SERVER) && WINAPI_FAMILY == WINAPI_FAMILY_SERVER
|
||||
# undef MSGPACK_PLAT_WINDOWS_SERVER
|
||||
# define MSGPACK_PLAT_WINDOWS_SERVER MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if MSGPACK_PLAT_WINDOWS_SERVER
|
||||
# define MSGPACK_PLAT_WINDOWS_SERVER_AVAILABLE
|
||||
# include <msgpack/predef/detail/platform_detected.h>
|
||||
#endif
|
||||
|
||||
#define MSGPACK_PLAT_WINDOWS_SERVER_NAME "Windows Server"
|
||||
|
||||
#endif
|
||||
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_WINDOWS_SERVER,MSGPACK_PLAT_WINDOWS_SERVER_NAME)
|
@@ -9,23 +9,30 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef MSGPACK_PREDEF_PLAT_WINDOWS_STORE_H
|
||||
#define MSGPACK_PREDEF_PLAT_WINDOWS_STORE_H
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
#include <msgpack/predef/make.h>
|
||||
#include <msgpack/predef/os/windows.h>
|
||||
#include <msgpack/predef/platform/windows_uwp.h>
|
||||
#include <msgpack/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_WINDOWS_STORE`]
|
||||
|
||||
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
|
||||
for Windows Store development.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_APP`] [__predef_detection__]]
|
||||
]
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_PC_APP`] [__predef_detection__]]
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_APP` (deprecated)] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_PLAT_WINDOWS_STORE MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if MSGPACK_OS_WINDOWS && defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_APP
|
||||
#if MSGPACK_OS_WINDOWS && \
|
||||
((defined(WINAPI_FAMILY_PC_APP) && WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) || \
|
||||
(defined(WINAPI_FAMILY_APP) && WINAPI_FAMILY == WINAPI_FAMILY_APP))
|
||||
# undef MSGPACK_PLAT_WINDOWS_STORE
|
||||
# define MSGPACK_PLAT_WINDOWS_STORE MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
47
include/msgpack/predef/platform/windows_system.h
Normal file
47
include/msgpack/predef/platform/windows_system.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
Copyright James E. King III, 2017
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_PLAT_WINDOWS_SYSTEM_H
|
||||
#define MSGPACK_PREDEF_PLAT_WINDOWS_SYSTEM_H
|
||||
|
||||
#include <msgpack/predef/make.h>
|
||||
#include <msgpack/predef/os/windows.h>
|
||||
#include <msgpack/predef/platform/windows_uwp.h>
|
||||
#include <msgpack/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_WINDOWS_SYSTEM`]
|
||||
|
||||
[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP]
|
||||
for Windows System development.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM`] [__predef_detection__]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_PLAT_WINDOWS_SYSTEM MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if MSGPACK_OS_WINDOWS && \
|
||||
defined(WINAPI_FAMILY_SYSTEM) && WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM
|
||||
# undef MSGPACK_PLAT_WINDOWS_SYSTEM
|
||||
# define MSGPACK_PLAT_WINDOWS_SYSTEM MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if MSGPACK_PLAT_WINDOWS_SYSTEM
|
||||
# define MSGPACK_PLAT_WINDOWS_SYSTEM_AVAILABLE
|
||||
# include <msgpack/predef/detail/platform_detected.h>
|
||||
#endif
|
||||
|
||||
#define MSGPACK_PLAT_WINDOWS_SYSTEM_NAME "Windows Drivers and Tools"
|
||||
|
||||
#endif
|
||||
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_WINDOWS_SYSTEM,MSGPACK_PLAT_WINDOWS_SYSTEM_NAME)
|
60
include/msgpack/predef/platform/windows_uwp.h
Normal file
60
include/msgpack/predef/platform/windows_uwp.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
Copyright James E. King III, 2017
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef MSGPACK_PREDEF_PLAT_WINDOWS_UWP_H
|
||||
#define MSGPACK_PREDEF_PLAT_WINDOWS_UWP_H
|
||||
|
||||
#include <msgpack/predef/make.h>
|
||||
#include <msgpack/predef/os/windows.h>
|
||||
#include <msgpack/predef/version_number.h>
|
||||
|
||||
/*`
|
||||
[heading `MSGPACK_PLAT_WINDOWS_UWP`]
|
||||
|
||||
[@http://docs.microsoft.com/windows/uwp/ Universal Windows Platform]
|
||||
is available if the current development environment is capable of targeting
|
||||
UWP development.
|
||||
|
||||
[table
|
||||
[[__predef_symbol__] [__predef_version__]]
|
||||
|
||||
[[`__MINGW64_VERSION_MAJOR` from `_mingw.h`] [`>= 3`]]
|
||||
[[`VER_PRODUCTBUILD` from `ntverp.h`] [`>= 9200`]]
|
||||
]
|
||||
*/
|
||||
|
||||
#define MSGPACK_PLAT_WINDOWS_UWP MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
#define MSGPACK_PLAT_WINDOWS_SDK_VERSION MSGPACK_VERSION_NUMBER_NOT_AVAILABLE
|
||||
|
||||
#if MSGPACK_OS_WINDOWS
|
||||
// MinGW (32-bit) has no ntverp.h header
|
||||
#if !defined(__MINGW32__)
|
||||
# include <ntverp.h>
|
||||
# undef MSGPACK_PLAT_WINDOWS_SDK_VERSION
|
||||
# define MSGPACK_PLAT_WINDOWS_SDK_VERSION MSGPACK_VERSION_NUMBER(0, 0, VER_PRODUCTBUILD)
|
||||
#endif
|
||||
|
||||
// 9200 is Windows SDK 8.0 from ntverp.h which introduced family support
|
||||
#if ((MSGPACK_PLAT_WINDOWS_SDK_VERSION >= MSGPACK_VERSION_NUMBER(0, 0, 9200)) || \
|
||||
(defined(__MINGW64__) && __MINGW64_VERSION_MAJOR >= 3))
|
||||
# undef MSGPACK_PLAT_WINDOWS_UWP
|
||||
# define MSGPACK_PLAT_WINDOWS_UWP MSGPACK_VERSION_NUMBER_AVAILABLE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MSGPACK_PLAT_WINDOWS_UWP
|
||||
# define MSGPACK_PLAT_WINDOWS_UWP_AVAILABLE
|
||||
# include <msgpack/predef/detail/platform_detected.h>
|
||||
# include <winapifamily.h> // Windows SDK
|
||||
#endif
|
||||
|
||||
#define MSGPACK_PLAT_WINDOWS_UWP_NAME "Universal Windows Platform"
|
||||
|
||||
#endif
|
||||
|
||||
#include <msgpack/predef/detail/test.h>
|
||||
MSGPACK_PREDEF_DECLARE_TEST(MSGPACK_PLAT_WINDOWS_UWP, MSGPACK_PLAT_WINDOWS_UWP_NAME)
|
@@ -10,6 +10,6 @@ http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <msgpack/predef/version_number.h>
|
||||
|
||||
#define MSGPACK_PREDEF_VERSION MSGPACK_VERSION_NUMBER(1,4,1)
|
||||
#define MSGPACK_PREDEF_VERSION MSGPACK_VERSION_NUMBER(1,8,0)
|
||||
|
||||
#endif
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright Rene Rivera 2005, 2008-2013
|
||||
Copyright Rene Rivera 2005-2016
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -50,4 +50,23 @@ Defines standard version numbers, with these properties:
|
||||
#define MSGPACK_VERSION_NUMBER_NOT_AVAILABLE \
|
||||
MSGPACK_VERSION_NUMBER_ZERO
|
||||
|
||||
/*`
|
||||
``
|
||||
MSGPACK_VERSION_NUMBER_MAJOR(N), MSGPACK_VERSION_NUMBER_MINOR(N), MSGPACK_VERSION_NUMBER_PATCH(N)
|
||||
``
|
||||
|
||||
The macros extract the major, minor, and patch portion from a well formed
|
||||
version number resulting in a preprocessor expression in the range of
|
||||
\[0,99\] or \[0,99999\] for the major and minor, or patch numbers
|
||||
respectively.
|
||||
*/
|
||||
#define MSGPACK_VERSION_NUMBER_MAJOR(N) \
|
||||
( ((N)/10000000)%100 )
|
||||
|
||||
#define MSGPACK_VERSION_NUMBER_MINOR(N) \
|
||||
( ((N)/100000)%100 )
|
||||
|
||||
#define MSGPACK_VERSION_NUMBER_PATCH(N) \
|
||||
( (N)%100000 )
|
||||
|
||||
#endif
|
||||
|
@@ -25,7 +25,7 @@
|
||||
# define MSGPACK_PP_CAT_OO(par) MSGPACK_PP_CAT_I ## par
|
||||
# endif
|
||||
#
|
||||
# if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MSVC()
|
||||
# if (~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MSVC()) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700)
|
||||
# define MSGPACK_PP_CAT_I(a, b) a ## b
|
||||
# else
|
||||
# define MSGPACK_PP_CAT_I(a, b) MSGPACK_PP_CAT_II(~, a ## b)
|
||||
|
@@ -25,18 +25,16 @@
|
||||
# define MSGPACK_PP_CONFIG_DMC() 0x0040
|
||||
#
|
||||
# ifndef MSGPACK_PP_CONFIG_FLAGS
|
||||
# if defined(__GCCXML__)
|
||||
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
|
||||
# elif defined(__WAVE__)
|
||||
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
|
||||
# elif defined(__MWERKS__) && __MWERKS__ >= 0x3200
|
||||
# if defined(__GCCXML__) || defined(__WAVE__) || defined(__MWERKS__) && __MWERKS__ >= 0x3200
|
||||
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
|
||||
# elif defined(__EDG__) || defined(__EDG_VERSION__)
|
||||
# if defined(_MSC_VER) && (defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308)
|
||||
# if defined(_MSC_VER) && !defined(__clang__) && (defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308)
|
||||
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_MSVC())
|
||||
# else
|
||||
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_EDG() | MSGPACK_PP_CONFIG_STRICT())
|
||||
# endif
|
||||
# elif defined(_MSC_VER) && defined(__clang__)
|
||||
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
|
||||
# elif defined(__MWERKS__)
|
||||
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_MWCC())
|
||||
# elif defined(__DMC__)
|
||||
@@ -45,7 +43,7 @@
|
||||
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
|
||||
# elif defined(__BORLANDC__) || defined(__IBMC__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
|
||||
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_BCC())
|
||||
# elif defined(_MSC_VER) && !defined(__clang__)
|
||||
# elif defined(_MSC_VER)
|
||||
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_MSVC())
|
||||
# else
|
||||
# define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT())
|
||||
@@ -73,10 +71,14 @@
|
||||
# define MSGPACK_PP_VARIADICS_MSVC 0
|
||||
# if !defined MSGPACK_PP_VARIADICS
|
||||
# /* variadic support explicitly disabled for all untested compilers */
|
||||
# if defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || ( defined __SUNPRO_CC && __SUNPRO_CC < 0x5120 ) || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI
|
||||
# if defined __GCCXML__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || ( defined __SUNPRO_CC && __SUNPRO_CC < 0x5120 ) || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || defined __PGI
|
||||
# define MSGPACK_PP_VARIADICS 0
|
||||
# /* VC++ (C/C++) */
|
||||
# elif defined _MSC_VER && _MSC_VER >= 1400 && (!defined __EDG__ || defined(__INTELLISENSE__)) && !defined __clang__
|
||||
# elif defined(__CUDACC__)
|
||||
# define MSGPACK_PP_VARIADICS 1
|
||||
# elif defined(_MSC_VER) && defined(__clang__)
|
||||
# define MSGPACK_PP_VARIADICS 1
|
||||
# /* VC++ (C/C++) and Intel C++ Compiler >= 17.0 with MSVC */
|
||||
# elif defined _MSC_VER && _MSC_VER >= 1400 && (!defined __EDG__ || defined(__INTELLISENSE__) || defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700)
|
||||
# define MSGPACK_PP_VARIADICS 1
|
||||
# undef MSGPACK_PP_VARIADICS_MSVC
|
||||
# define MSGPACK_PP_VARIADICS_MSVC 1
|
||||
@@ -92,7 +94,7 @@
|
||||
# elif !MSGPACK_PP_VARIADICS + 1 < 2
|
||||
# undef MSGPACK_PP_VARIADICS
|
||||
# define MSGPACK_PP_VARIADICS 1
|
||||
# if defined _MSC_VER && _MSC_VER >= 1400 && (defined(__INTELLISENSE__) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __clang__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI))
|
||||
# if defined _MSC_VER && _MSC_VER >= 1400 && !defined(__clang__) && (defined(__INTELLISENSE__) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI))
|
||||
# undef MSGPACK_PP_VARIADICS_MSVC
|
||||
# define MSGPACK_PP_VARIADICS_MSVC 1
|
||||
# endif
|
||||
|
@@ -30,14 +30,13 @@
|
||||
# endif
|
||||
# if MSGPACK_PP_VARIADICS
|
||||
# if MSGPACK_PP_VARIADICS_MSVC
|
||||
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) \
|
||||
MSGPACK_PP_VARIADIC_IS_SINGLE_RETURN(MSGPACK_PP_REM_CAT,MSGPACK_PP_REM,__VA_ARGS__) \
|
||||
/**/
|
||||
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_REM(data) data
|
||||
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_A(...) (MSGPACK_PP_SEQ_BINARY_TRANSFORM_REM, __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_B
|
||||
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_B(...) (MSGPACK_PP_SEQ_BINARY_TRANSFORM_REM, __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_A
|
||||
# else
|
||||
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_GET_REM(...) MSGPACK_PP_REM
|
||||
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_A(...) (MSGPACK_PP_REM, __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_B
|
||||
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_B(...) (MSGPACK_PP_REM, __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_A
|
||||
# endif
|
||||
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_A(...) (MSGPACK_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_B
|
||||
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_B(...) (MSGPACK_PP_SEQ_BINARY_TRANSFORM_GET_REM(__VA_ARGS__), __VA_ARGS__)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_A
|
||||
# else
|
||||
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_A(e) (MSGPACK_PP_REM, e)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_B
|
||||
# define MSGPACK_PP_SEQ_BINARY_TRANSFORM_B(e) (MSGPACK_PP_REM, e)() MSGPACK_PP_SEQ_BINARY_TRANSFORM_A
|
||||
|
55
include/msgpack/preprocessor/seq/detail/to_list_msvc.hpp
Normal file
55
include/msgpack/preprocessor/seq/detail/to_list_msvc.hpp
Normal file
@@ -0,0 +1,55 @@
|
||||
# /* **************************************************************************
|
||||
# * *
|
||||
# * (C) Copyright Edward Diener 2016. *
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See *
|
||||
# * accompanying file LICENSE_1_0.txt or copy at *
|
||||
# * http://www.boost.org/LICENSE_1_0.txt) *
|
||||
# * *
|
||||
# ************************************************************************** */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef MSGPACK_PREPROCESSOR_SEQ_DETAIL_TO_LIST_MSVC_HPP
|
||||
# define MSGPACK_PREPROCESSOR_SEQ_DETAIL_TO_LIST_MSVC_HPP
|
||||
#
|
||||
# include <msgpack/preprocessor/config/config.hpp>
|
||||
#
|
||||
# if MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MSVC()
|
||||
#
|
||||
# include <msgpack/preprocessor/cat.hpp>
|
||||
# include <msgpack/preprocessor/arithmetic/dec.hpp>
|
||||
# include <msgpack/preprocessor/control/while.hpp>
|
||||
# include <msgpack/preprocessor/tuple/elem.hpp>
|
||||
#
|
||||
# define MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_RESULT(state) \
|
||||
MSGPACK_PP_TUPLE_ELEM(2, 0, state) \
|
||||
/**/
|
||||
# define MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_SIZE(state) \
|
||||
MSGPACK_PP_TUPLE_ELEM(2, 1, state) \
|
||||
/**/
|
||||
# define MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_PRED(d,state) \
|
||||
MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_SIZE(state) \
|
||||
/**/
|
||||
# define MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_OP(d,state) \
|
||||
( \
|
||||
MSGPACK_PP_CAT(MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_RESULT(state),), \
|
||||
MSGPACK_PP_DEC(MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_SIZE(state)) \
|
||||
) \
|
||||
/**/
|
||||
#
|
||||
# /* MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC */
|
||||
#
|
||||
# define MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC(result,seqsize) \
|
||||
MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_STATE_RESULT \
|
||||
( \
|
||||
MSGPACK_PP_WHILE \
|
||||
( \
|
||||
MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_PRED, \
|
||||
MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC_OP, \
|
||||
(result,seqsize) \
|
||||
) \
|
||||
) \
|
||||
/**/
|
||||
# endif // MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MSVC()
|
||||
#
|
||||
# endif // MSGPACK_PREPROCESSOR_SEQ_DETAIL_TO_LIST_MSVC_HPP
|
@@ -19,7 +19,19 @@
|
||||
#
|
||||
# /* MSGPACK_PP_SEQ_TO_LIST */
|
||||
#
|
||||
# if MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MSVC()
|
||||
# include <msgpack/preprocessor/seq/size.hpp>
|
||||
# include <msgpack/preprocessor/seq/detail/to_list_msvc.hpp>
|
||||
# define MSGPACK_PP_SEQ_TO_LIST(seq) \
|
||||
MSGPACK_PP_SEQ_DETAIL_TO_LIST_MSVC \
|
||||
( \
|
||||
MSGPACK_PP_SEQ_TO_LIST_I(MSGPACK_PP_SEQ_BINARY_TRANSFORM(seq)), \
|
||||
MSGPACK_PP_SEQ_SIZE(seq) \
|
||||
) \
|
||||
/**/
|
||||
# else
|
||||
# define MSGPACK_PP_SEQ_TO_LIST(seq) MSGPACK_PP_SEQ_TO_LIST_I(MSGPACK_PP_SEQ_BINARY_TRANSFORM(seq))
|
||||
# endif
|
||||
# define MSGPACK_PP_SEQ_TO_LIST_I(bseq) MSGPACK_PP_SEQ_TO_LIST_A bseq MSGPACK_PP_NIL MSGPACK_PP_SEQ_TO_LIST_B bseq
|
||||
# define MSGPACK_PP_SEQ_TO_LIST_A(m, e) m(MSGPACK_PP_LPAREN() e MSGPACK_PP_COMMA() MSGPACK_PP_SEQ_TO_LIST_A_ID)
|
||||
# define MSGPACK_PP_SEQ_TO_LIST_A_ID() MSGPACK_PP_SEQ_TO_LIST_A
|
||||
|
@@ -10,13 +10,11 @@
|
||||
#ifndef MSGPACK_SYSDEP_H
|
||||
#define MSGPACK_SYSDEP_H
|
||||
|
||||
#include <msgpack/predef.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
# define snprintf(buf, len, format,...) _snprintf_s(buf, len, len, format, __VA_ARGS__)
|
||||
# define snprintf(buf, len, format,...) _snprintf_s(buf, len, _TRUNCATE, format, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600
|
||||
@@ -44,13 +42,22 @@
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# define _msgpack_atomic_counter_header <windows.h>
|
||||
# if !defined(WIN32_LEAN_AND_MEAN)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif /* WIN32_LEAN_AND_MEAN */
|
||||
# if defined(_KERNEL_MODE)
|
||||
# define _msgpack_atomic_counter_header <ntddk.h>
|
||||
# else
|
||||
# define _msgpack_atomic_counter_header <windows.h>
|
||||
# if !defined(WIN32_LEAN_AND_MEAN)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# endif /* WIN32_LEAN_AND_MEAN */
|
||||
# endif
|
||||
typedef long _msgpack_atomic_counter_t;
|
||||
# define _msgpack_sync_decr_and_fetch(ptr) InterlockedDecrement(ptr)
|
||||
# define _msgpack_sync_incr_and_fetch(ptr) InterlockedIncrement(ptr)
|
||||
#if defined(_AMD64_) || defined(_M_X64) || defined(_M_ARM64)
|
||||
# define _msgpack_sync_decr_and_fetch(ptr) _InterlockedDecrement(ptr)
|
||||
# define _msgpack_sync_incr_and_fetch(ptr) _InterlockedIncrement(ptr)
|
||||
#else
|
||||
# define _msgpack_sync_decr_and_fetch(ptr) InterlockedDecrement(ptr)
|
||||
# define _msgpack_sync_incr_and_fetch(ptr) InterlockedIncrement(ptr)
|
||||
#endif
|
||||
#elif defined(__GNUC__) && ((__GNUC__*10 + __GNUC_MINOR__) < 41)
|
||||
|
||||
# if defined(__cplusplus)
|
||||
@@ -86,10 +93,14 @@
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(MSGPACK_ENDIAN_LITTLE_BYTE) && !defined(MSGPACK_ENDIAN_BIG_BYTE)
|
||||
#include <msgpack/predef/other/endian.h>
|
||||
#endif // !defined(MSGPACK_ENDIAN_LITTLE_BYTE) && !defined(MSGPACK_ENDIAN_BIG_BYTE)
|
||||
|
||||
#if MSGPACK_ENDIAN_LITTLE_BYTE
|
||||
|
||||
# if defined(unix) || defined(__unix) || defined(__APPLE__) || defined(__OpenBSD__)
|
||||
# define _msgpack_be16(x) ntohs(x)
|
||||
# define _msgpack_be16(x) ntohs((uint16_t)x)
|
||||
# else
|
||||
# if defined(ntohs)
|
||||
# define _msgpack_be16(x) ntohs(x)
|
||||
@@ -103,7 +114,7 @@
|
||||
# endif
|
||||
|
||||
# if defined(unix) || defined(__unix) || defined(__APPLE__) || defined(__OpenBSD__)
|
||||
# define _msgpack_be32(x) ntohl(x)
|
||||
# define _msgpack_be32(x) ntohl((uint32_t)x)
|
||||
# else
|
||||
# if defined(ntohl)
|
||||
# define _msgpack_be32(x) ntohl(x)
|
||||
@@ -148,16 +159,16 @@
|
||||
|
||||
#define _msgpack_load16(cast, from, to) do { \
|
||||
memcpy((cast*)(to), (from), sizeof(cast)); \
|
||||
*(to) = _msgpack_be16(*(to)); \
|
||||
*(to) = (cast)_msgpack_be16(*(to)); \
|
||||
} while (0);
|
||||
|
||||
#define _msgpack_load32(cast, from, to) do { \
|
||||
memcpy((cast*)(to), (from), sizeof(cast)); \
|
||||
*(to) = _msgpack_be32(*(to)); \
|
||||
*(to) = (cast)_msgpack_be32(*(to)); \
|
||||
} while (0);
|
||||
#define _msgpack_load64(cast, from, to) do { \
|
||||
memcpy((cast*)(to), (from), sizeof(cast)); \
|
||||
*(to) = _msgpack_be64(*(to)); \
|
||||
*(to) = (cast)_msgpack_be64(*(to)); \
|
||||
} while (0);
|
||||
|
||||
#define _msgpack_store16(to, num) \
|
||||
@@ -178,11 +189,13 @@
|
||||
|
||||
|
||||
#if !defined(__cplusplus) && defined(_MSC_VER)
|
||||
# if !defined(FALSE)
|
||||
# define FALSE (0)
|
||||
# endif
|
||||
# if !defined(TRUE)
|
||||
# define TRUE (!FALSE)
|
||||
# if !defined(_KERNEL_MODE)
|
||||
# if !defined(FALSE)
|
||||
# define FALSE (0)
|
||||
# endif
|
||||
# if !defined(TRUE)
|
||||
# define TRUE (!FALSE)
|
||||
# endif
|
||||
# endif
|
||||
# if _MSC_VER >= 1800
|
||||
# include <stdbool.h>
|
||||
|
58
include/msgpack/timestamp.h
Normal file
58
include/msgpack/timestamp.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* MessagePack for C TimeStamp
|
||||
*
|
||||
* Copyright (C) 2018 KONDO Takatoshi
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef MSGPACK_TIMESTAMP_H
|
||||
#define MSGPACK_TIMESTAMP_H
|
||||
|
||||
#include <msgpack/object.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct msgpack_timestamp {
|
||||
int64_t tv_sec;
|
||||
uint32_t tv_nsec;
|
||||
} msgpack_timestamp;
|
||||
|
||||
static inline bool msgpack_object_to_timestamp(const msgpack_object* obj, msgpack_timestamp* ts) {
|
||||
if (obj->type != MSGPACK_OBJECT_EXT) return false;
|
||||
if (obj->via.ext.type != -1) return false;
|
||||
switch (obj->via.ext.size) {
|
||||
case 4:
|
||||
ts->tv_nsec = 0;
|
||||
{
|
||||
uint32_t v;
|
||||
_msgpack_load32(uint32_t, obj->via.ext.ptr, &v);
|
||||
ts->tv_sec = v;
|
||||
}
|
||||
return true;
|
||||
case 8: {
|
||||
uint64_t value;
|
||||
_msgpack_load64(uint64_t, obj->via.ext.ptr, &value);
|
||||
ts->tv_nsec = (uint32_t)(value >> 34);
|
||||
ts->tv_sec = value & 0x00000003ffffffffLL;
|
||||
return true;
|
||||
}
|
||||
case 12:
|
||||
_msgpack_load32(uint32_t, obj->via.ext.ptr, &ts->tv_nsec);
|
||||
_msgpack_load64(int64_t, obj->via.ext.ptr + 4, &ts->tv_sec);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* msgpack/timestamp.h */
|
@@ -21,6 +21,7 @@
|
||||
#include "adaptor/vector_bool.hpp"
|
||||
#include "adaptor/vector_char.hpp"
|
||||
#include "adaptor/vector_unsigned_char.hpp"
|
||||
#include "adaptor/wstring.hpp"
|
||||
#include "adaptor/msgpack_tuple.hpp"
|
||||
#include "adaptor/define.hpp"
|
||||
|
||||
@@ -34,20 +35,27 @@
|
||||
#include "adaptor/cpp11/array.hpp"
|
||||
#include "adaptor/cpp11/array_char.hpp"
|
||||
#include "adaptor/cpp11/array_unsigned_char.hpp"
|
||||
#include "adaptor/cpp11/chrono.hpp"
|
||||
#include "adaptor/cpp11/forward_list.hpp"
|
||||
#include "adaptor/cpp11/reference_wrapper.hpp"
|
||||
#include "adaptor/cpp11/shared_ptr.hpp"
|
||||
#include "adaptor/cpp11/timespec.hpp"
|
||||
#include "adaptor/cpp11/tuple.hpp"
|
||||
#include "adaptor/cpp11/unique_ptr.hpp"
|
||||
#include "adaptor/cpp11/unordered_map.hpp"
|
||||
#include "adaptor/cpp11/unordered_set.hpp"
|
||||
|
||||
#if __cplusplus >= 201703
|
||||
|
||||
#if MSGPACK_HAS_INCLUDE(<optional>)
|
||||
#include "adaptor/cpp17/optional.hpp"
|
||||
#include "adaptor/cpp17/string_view.hpp"
|
||||
#endif // MSGPACK_HAS_INCLUDE(<optional>)
|
||||
|
||||
#endif // __cplusplus >= 201703
|
||||
#if MSGPACK_HAS_INCLUDE(<string_view>)
|
||||
#include "adaptor/cpp17/string_view.hpp"
|
||||
#endif // MSGPACK_HAS_INCLUDE(<string_view>)
|
||||
|
||||
#include "adaptor/cpp17/byte.hpp"
|
||||
#include "adaptor/cpp17/carray_byte.hpp"
|
||||
#include "adaptor/cpp17/vector_byte.hpp"
|
||||
|
||||
#endif // defined(MSGPACK_USE_CPP03)
|
||||
|
||||
|
@@ -38,6 +38,11 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_KERNEL_MODE)
|
||||
#undef assert
|
||||
#define assert NT_ASSERT
|
||||
#endif
|
||||
|
||||
msgpack_unpack_struct_decl(_stack) {
|
||||
msgpack_unpack_object obj;
|
||||
size_t count;
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#ifndef MSGPACK_V1_TYPE_ARRAY_REF_HPP
|
||||
#define MSGPACK_V1_TYPE_ARRAY_REF_HPP
|
||||
|
||||
#include "msgpack/v1/adaptor/array_ref.hpp"
|
||||
#include "msgpack/adaptor/check_container_size.hpp"
|
||||
#include "msgpack/cpp_config.hpp"
|
||||
#include <cstring>
|
||||
@@ -259,14 +258,15 @@ struct object_with_zone<msgpack::type::array_ref<T> > {
|
||||
o.via.array.size = size;
|
||||
typename T::const_iterator it(v.data->begin());
|
||||
do {
|
||||
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
|
||||
#endif // defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
|
||||
|
||||
*p = msgpack::object(*it, o.zone);
|
||||
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
|
||||
#endif // defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__clang__)
|
||||
++p;
|
||||
++it;
|
||||
} while(p < pend);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user