1/*
2Copyright Rene Rivera 2008-2015
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#include <boost/predef/detail/test.h>
8
9#ifndef BOOST_PREDEF_MAKE_H
10#define BOOST_PREDEF_MAKE_H
11
12/*
13Shorthands for the common version number formats used by vendors...
14*/
15
16/*`
17[heading `BOOST_PREDEF_MAKE_..` macros]
18
19These set of macros decompose common vendor version number
20macros which are composed version, revision, and patch digits.
21The naming convention indicates:
22
23* The base of the specified version number. "`BOOST_PREDEF_MAKE_0X`" for
24 hexadecimal digits, and "`BOOST_PREDEF_MAKE_10`" for decimal digits.
25* The format of the vendor version number. Where "`V`" indicates the version digits,
26 "`R`" indicates the revision digits, "`P`" indicates the patch digits, and "`0`"
27 indicates an ignored digit.
28
29Macros are:
30*/
31/*` `BOOST_PREDEF_MAKE_0X_VRP(V)` */
32#define BOOST_PREDEF_MAKE_0X_VRP(V) BOOST_VERSION_NUMBER((V&0xF00)>>8,(V&0xF0)>>4,(V&0xF))
33/*` `BOOST_PREDEF_MAKE_0X_VVRP(V)` */
34#define BOOST_PREDEF_MAKE_0X_VVRP(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xF0)>>4,(V&0xF))
35/*` `BOOST_PREDEF_MAKE_0X_VRPP(V)` */
36#define BOOST_PREDEF_MAKE_0X_VRPP(V) BOOST_VERSION_NUMBER((V&0xF000)>>12,(V&0xF00)>>8,(V&0xFF))
37/*` `BOOST_PREDEF_MAKE_0X_VVRR(V)` */
38#define BOOST_PREDEF_MAKE_0X_VVRR(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xFF),0)
39/*` `BOOST_PREDEF_MAKE_0X_VRRPPPP(V)` */
40#define BOOST_PREDEF_MAKE_0X_VRRPPPP(V) BOOST_VERSION_NUMBER((V&0xF000000)>>24,(V&0xFF0000)>>16,(V&0xFFFF))
41/*` `BOOST_PREDEF_MAKE_0X_VVRRP(V)` */
42#define BOOST_PREDEF_MAKE_0X_VVRRP(V) BOOST_VERSION_NUMBER((V&0xFF000)>>12,(V&0xFF0)>>4,(V&0xF))
43/*` `BOOST_PREDEF_MAKE_0X_VRRPP000(V)` */
44#define BOOST_PREDEF_MAKE_0X_VRRPP000(V) BOOST_VERSION_NUMBER((V&0xF0000000)>>28,(V&0xFF00000)>>20,(V&0xFF000)>>12)
45/*` `BOOST_PREDEF_MAKE_0X_VVRRPP(V)` */
46#define BOOST_PREDEF_MAKE_0X_VVRRPP(V) BOOST_VERSION_NUMBER((V&0xFF0000)>>16,(V&0xFF00)>>8,(V&0xFF))
47/*` `BOOST_PREDEF_MAKE_10_VPPP(V)` */
48#define BOOST_PREDEF_MAKE_10_VPPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,0,(V)%1000)
49/*` `BOOST_PREDEF_MAKE_10_VRP(V)` */
50#define BOOST_PREDEF_MAKE_10_VRP(V) BOOST_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,(V)%10)
51/*` `BOOST_PREDEF_MAKE_10_VRP000(V)` */
52#define BOOST_PREDEF_MAKE_10_VRP000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,((V)/1000)%10)
53/*` `BOOST_PREDEF_MAKE_10_VRPPPP(V)` */
54#define BOOST_PREDEF_MAKE_10_VRPPPP(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,(V)%10000)
55/*` `BOOST_PREDEF_MAKE_10_VRPP(V)` */
56#define BOOST_PREDEF_MAKE_10_VRPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,((V)/100)%10,(V)%100)
57/*` `BOOST_PREDEF_MAKE_10_VRR(V)` */
58#define BOOST_PREDEF_MAKE_10_VRR(V) BOOST_VERSION_NUMBER(((V)/100)%10,(V)%100,0)
59/*` `BOOST_PREDEF_MAKE_10_VRRPP(V)` */
60#define BOOST_PREDEF_MAKE_10_VRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%10,((V)/100)%100,(V)%100)
61/*` `BOOST_PREDEF_MAKE_10_VRR000(V)` */
62#define BOOST_PREDEF_MAKE_10_VRR000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/1000)%100,0)
63/*` `BOOST_PREDEF_MAKE_10_VV00(V)` */
64#define BOOST_PREDEF_MAKE_10_VV00(V) BOOST_VERSION_NUMBER(((V)/100)%100,0,0)
65/*` `BOOST_PREDEF_MAKE_10_VVRR(V)` */
66#define BOOST_PREDEF_MAKE_10_VVRR(V) BOOST_VERSION_NUMBER(((V)/100)%100,(V)%100,0)
67/*` `BOOST_PREDEF_MAKE_10_VVRRPP(V)` */
68#define BOOST_PREDEF_MAKE_10_VVRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%100,((V)/100)%100,(V)%100)
69/*` `BOOST_PREDEF_MAKE_10_VVRRPPP(V)` */
70#define BOOST_PREDEF_MAKE_10_VVRRPPP(V) BOOST_VERSION_NUMBER(((V)/100000)%100,((V)/1000)%100,(V)%1000)
71/*` `BOOST_PREDEF_MAKE_10_VVRR0PP00(V)` */
72#define BOOST_PREDEF_MAKE_10_VVRR0PP00(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,((V)/100)%100)
73/*` `BOOST_PREDEF_MAKE_10_VVRR0PPPP(V)` */
74#define BOOST_PREDEF_MAKE_10_VVRR0PPPP(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,(V)%10000)
75/*` `BOOST_PREDEF_MAKE_10_VVRR00PP00(V)` */
76#define BOOST_PREDEF_MAKE_10_VVRR00PP00(V) BOOST_VERSION_NUMBER(((V)/100000000)%100,((V)/1000000)%100,((V)/100)%100)
77/*`
78[heading `BOOST_PREDEF_MAKE_*..` date macros]
79
80Date decomposition macros return a date in the relative to the 1970
81Epoch date. If the month is not available, January 1st is used as the month and day.
82If the day is not available, but the month is, the 1st of the month is used as the day.
83*/
84/*` `BOOST_PREDEF_MAKE_DATE(Y,M,D)` */
85#define BOOST_PREDEF_MAKE_DATE(Y,M,D) BOOST_VERSION_NUMBER((Y)%10000-1970,(M)%100,(D)%100)
86/*` `BOOST_PREDEF_MAKE_YYYYMMDD(V)` */
87#define BOOST_PREDEF_MAKE_YYYYMMDD(V) BOOST_PREDEF_MAKE_DATE(((V)/10000)%10000,((V)/100)%100,(V)%100)
88/*` `BOOST_PREDEF_MAKE_YYYY(V)` */
89#define BOOST_PREDEF_MAKE_YYYY(V) BOOST_PREDEF_MAKE_DATE(V,1,1)
90/*` `BOOST_PREDEF_MAKE_YYYYMM(V)` */
91#define BOOST_PREDEF_MAKE_YYYYMM(V) BOOST_PREDEF_MAKE_DATE((V)/100,(V)%100,1)
92
93#endif
94