1/*
2Copyright Rene Rivera 2005-2016
3Distributed under the Boost Software License, Version 1.0.
4(See accompanying file LICENSE_1_0.txt or copy at
5http://www.boost.org/LICENSE_1_0.txt)
6*/
7
8#ifndef BOOST_PREDEF_VERSION_NUMBER_H
9#define BOOST_PREDEF_VERSION_NUMBER_H
10
11/*`
12[heading `BOOST_VERSION_NUMBER`]
13
14``
15BOOST_VERSION_NUMBER(major,minor,patch)
16``
17
18Defines standard version numbers, with these properties:
19
20* Decimal base whole numbers in the range \[0,1000000000).
21 The number range is designed to allow for a (2,2,5) triplet.
22 Which fits within a 32 bit value.
23* The `major` number can be in the \[0,99\] range.
24* The `minor` number can be in the \[0,99\] range.
25* The `patch` number can be in the \[0,99999\] range.
26* Values can be specified in any base. As the defined value
27 is an constant expression.
28* Value can be directly used in both preprocessor and compiler
29 expressions for comparison to other similarly defined values.
30* The implementation enforces the individual ranges for the
31 major, minor, and patch numbers. And values over the ranges
32 are truncated (modulo).
33
34*/
35#define BOOST_VERSION_NUMBER(major,minor,patch) \
36 ( (((major)%100)*10000000) + (((minor)%100)*100000) + ((patch)%100000) )
37
38#define BOOST_VERSION_NUMBER_MAX \
39 BOOST_VERSION_NUMBER(99,99,99999)
40
41#define BOOST_VERSION_NUMBER_ZERO \
42 BOOST_VERSION_NUMBER(0,0,0)
43
44#define BOOST_VERSION_NUMBER_MIN \
45 BOOST_VERSION_NUMBER(0,0,1)
46
47#define BOOST_VERSION_NUMBER_AVAILABLE \
48 BOOST_VERSION_NUMBER_MIN
49
50#define BOOST_VERSION_NUMBER_NOT_AVAILABLE \
51 BOOST_VERSION_NUMBER_ZERO
52
53/*`
54``
55BOOST_VERSION_NUMBER_MAJOR(N), BOOST_VERSION_NUMBER_MINOR(N), BOOST_VERSION_NUMBER_PATCH(N)
56``
57
58The macros extract the major, minor, and patch portion from a well formed
59version number resulting in a preprocessor expression in the range of
60\[0,99\] or \[0,99999\] for the major and minor, or patch numbers
61respectively.
62*/
63#define BOOST_VERSION_NUMBER_MAJOR(N) \
64 ( ((N)/10000000)%100 )
65
66#define BOOST_VERSION_NUMBER_MINOR(N) \
67 ( ((N)/100000)%100 )
68
69#define BOOST_VERSION_NUMBER_PATCH(N) \
70 ( (N)%100000 )
71
72#endif
73