make.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. Copyright Rene Rivera 2008-2015
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE_1_0.txt or copy at
  5. http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #include <boost/predef/detail/test.h>
  8. #ifndef BOOST_PREDEF_MAKE_H
  9. #define BOOST_PREDEF_MAKE_H
  10. /*
  11. Shorthands for the common version number formats used by vendors...
  12. */
  13. /* tag::reference[]
  14. = `BOOST_PREDEF_MAKE_..` macros
  15. These set of macros decompose common vendor version number
  16. macros which are composed version, revision, and patch digits.
  17. The naming convention indicates:
  18. * The base of the specified version number. "`BOOST_PREDEF_MAKE_0X`" for
  19. hexadecimal digits, and "`BOOST_PREDEF_MAKE_10`" for decimal digits.
  20. * The format of the vendor version number. Where "`V`" indicates the version digits,
  21. "`R`" indicates the revision digits, "`P`" indicates the patch digits, and "`0`"
  22. indicates an ignored digit.
  23. Macros are:
  24. */ // end::reference[]
  25. /* tag::reference[]
  26. * `BOOST_PREDEF_MAKE_0X_VRP(V)`
  27. */ // end::reference[]
  28. #define BOOST_PREDEF_MAKE_0X_VRP(V) BOOST_VERSION_NUMBER((V&0xF00)>>8,(V&0xF0)>>4,(V&0xF))
  29. /* tag::reference[]
  30. * `BOOST_PREDEF_MAKE_0X_VVRP(V)`
  31. */ // end::reference[]
  32. #define BOOST_PREDEF_MAKE_0X_VVRP(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xF0)>>4,(V&0xF))
  33. /* tag::reference[]
  34. * `BOOST_PREDEF_MAKE_0X_VRPP(V)`
  35. */ // end::reference[]
  36. #define BOOST_PREDEF_MAKE_0X_VRPP(V) BOOST_VERSION_NUMBER((V&0xF000)>>12,(V&0xF00)>>8,(V&0xFF))
  37. /* tag::reference[]
  38. * `BOOST_PREDEF_MAKE_0X_VVRR(V)`
  39. */ // end::reference[]
  40. #define BOOST_PREDEF_MAKE_0X_VVRR(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xFF),0)
  41. /* tag::reference[]
  42. * `BOOST_PREDEF_MAKE_0X_VRRPPPP(V)`
  43. */ // end::reference[]
  44. #define BOOST_PREDEF_MAKE_0X_VRRPPPP(V) BOOST_VERSION_NUMBER((V&0xF000000)>>24,(V&0xFF0000)>>16,(V&0xFFFF))
  45. /* tag::reference[]
  46. * `BOOST_PREDEF_MAKE_0X_VVRRP(V)`
  47. */ // end::reference[]
  48. #define BOOST_PREDEF_MAKE_0X_VVRRP(V) BOOST_VERSION_NUMBER((V&0xFF000)>>12,(V&0xFF0)>>4,(V&0xF))
  49. /* tag::reference[]
  50. * `BOOST_PREDEF_MAKE_0X_VRRPP000(V)`
  51. */ // end::reference[]
  52. #define BOOST_PREDEF_MAKE_0X_VRRPP000(V) BOOST_VERSION_NUMBER((V&0xF0000000)>>28,(V&0xFF00000)>>20,(V&0xFF000)>>12)
  53. /* tag::reference[]
  54. * `BOOST_PREDEF_MAKE_0X_VVRRPP(V)`
  55. */ // end::reference[]
  56. #define BOOST_PREDEF_MAKE_0X_VVRRPP(V) BOOST_VERSION_NUMBER((V&0xFF0000)>>16,(V&0xFF00)>>8,(V&0xFF))
  57. /* tag::reference[]
  58. * `BOOST_PREDEF_MAKE_10_VPPP(V)`
  59. */ // end::reference[]
  60. #define BOOST_PREDEF_MAKE_10_VPPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,0,(V)%1000)
  61. /* tag::reference[]
  62. * `BOOST_PREDEF_MAKE_10_VVPPP(V)`
  63. */ // end::reference[]
  64. #define BOOST_PREDEF_MAKE_10_VVPPP(V) BOOST_VERSION_NUMBER(((V)/1000)%100,0,(V)%1000)
  65. /* tag::reference[]
  66. * `BOOST_PREDEF_MAKE_10_VR0(V)`
  67. */ // end::reference[]
  68. #define BOOST_PREDEF_MAKE_10_VR0(V) BOOST_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,0)
  69. /* tag::reference[]
  70. * `BOOST_PREDEF_MAKE_10_VRP(V)`
  71. */ // end::reference[]
  72. #define BOOST_PREDEF_MAKE_10_VRP(V) BOOST_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,(V)%10)
  73. /* tag::reference[]
  74. * `BOOST_PREDEF_MAKE_10_VRP000(V)`
  75. */ // end::reference[]
  76. #define BOOST_PREDEF_MAKE_10_VRP000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,((V)/1000)%10)
  77. /* tag::reference[]
  78. * `BOOST_PREDEF_MAKE_10_VRPPPP(V)`
  79. */ // end::reference[]
  80. #define BOOST_PREDEF_MAKE_10_VRPPPP(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,(V)%10000)
  81. /* tag::reference[]
  82. * `BOOST_PREDEF_MAKE_10_VRPP(V)`
  83. */ // end::reference[]
  84. #define BOOST_PREDEF_MAKE_10_VRPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,((V)/100)%10,(V)%100)
  85. /* tag::reference[]
  86. * `BOOST_PREDEF_MAKE_10_VRR(V)`
  87. */ // end::reference[]
  88. #define BOOST_PREDEF_MAKE_10_VRR(V) BOOST_VERSION_NUMBER(((V)/100)%10,(V)%100,0)
  89. /* tag::reference[]
  90. * `BOOST_PREDEF_MAKE_10_VRRPP(V)`
  91. */ // end::reference[]
  92. #define BOOST_PREDEF_MAKE_10_VRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%10,((V)/100)%100,(V)%100)
  93. /* tag::reference[]
  94. * `BOOST_PREDEF_MAKE_10_VRR000(V)`
  95. */ // end::reference[]
  96. #define BOOST_PREDEF_MAKE_10_VRR000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/1000)%100,0)
  97. /* tag::reference[]
  98. * `BOOST_PREDEF_MAKE_10_VV00(V)`
  99. */ // end::reference[]
  100. #define BOOST_PREDEF_MAKE_10_VV00(V) BOOST_VERSION_NUMBER(((V)/100)%100,0,0)
  101. /* tag::reference[]
  102. * `BOOST_PREDEF_MAKE_10_VVRR(V)`
  103. */ // end::reference[]
  104. #define BOOST_PREDEF_MAKE_10_VVRR(V) BOOST_VERSION_NUMBER(((V)/100)%100,(V)%100,0)
  105. /* tag::reference[]
  106. * `BOOST_PREDEF_MAKE_10_VVRRP(V)`
  107. */ // end::reference[]
  108. #define BOOST_PREDEF_MAKE_10_VVRRP(V) BOOST_VERSION_NUMBER(((V)/1000)%100,((V)/10)%100,(V)%10)
  109. /* tag::reference[]
  110. * `BOOST_PREDEF_MAKE_10_VVRRPP(V)`
  111. */ // end::reference[]
  112. #define BOOST_PREDEF_MAKE_10_VVRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%100,((V)/100)%100,(V)%100)
  113. /* tag::reference[]
  114. * `BOOST_PREDEF_MAKE_10_VVRRPPP(V)`
  115. */ // end::reference[]
  116. #define BOOST_PREDEF_MAKE_10_VVRRPPP(V) BOOST_VERSION_NUMBER(((V)/100000)%100,((V)/1000)%100,(V)%1000)
  117. /* tag::reference[]
  118. * `BOOST_PREDEF_MAKE_10_VVRR0PP00(V)`
  119. */ // end::reference[]
  120. #define BOOST_PREDEF_MAKE_10_VVRR0PP00(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,((V)/100)%100)
  121. /* tag::reference[]
  122. * `BOOST_PREDEF_MAKE_10_VVRR0PPPP(V)`
  123. */ // end::reference[]
  124. #define BOOST_PREDEF_MAKE_10_VVRR0PPPP(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,(V)%10000)
  125. /* tag::reference[]
  126. * `BOOST_PREDEF_MAKE_10_VVRR00PP00(V)`
  127. */ // end::reference[]
  128. #define BOOST_PREDEF_MAKE_10_VVRR00PP00(V) BOOST_VERSION_NUMBER(((V)/100000000)%100,((V)/1000000)%100,((V)/100)%100)
  129. /* tag::reference[]
  130. = `BOOST_PREDEF_MAKE_*..` date macros
  131. Date decomposition macros return a date in the relative to the 1970
  132. Epoch date. If the month is not available, January 1st is used as the month and day.
  133. If the day is not available, but the month is, the 1st of the month is used as the day.
  134. */ // end::reference[]
  135. /* tag::reference[]
  136. * `BOOST_PREDEF_MAKE_DATE(Y,M,D)`
  137. */ // end::reference[]
  138. #define BOOST_PREDEF_MAKE_DATE(Y,M,D) BOOST_VERSION_NUMBER((Y)%10000-1970,(M)%100,(D)%100)
  139. /* tag::reference[]
  140. * `BOOST_PREDEF_MAKE_YYYYMMDD(V)`
  141. */ // end::reference[]
  142. #define BOOST_PREDEF_MAKE_YYYYMMDD(V) BOOST_PREDEF_MAKE_DATE(((V)/10000)%10000,((V)/100)%100,(V)%100)
  143. /* tag::reference[]
  144. * `BOOST_PREDEF_MAKE_YYYY(V)`
  145. */ // end::reference[]
  146. #define BOOST_PREDEF_MAKE_YYYY(V) BOOST_PREDEF_MAKE_DATE(V,1,1)
  147. /* tag::reference[]
  148. * `BOOST_PREDEF_MAKE_YYYYMM(V)`
  149. */ // end::reference[]
  150. #define BOOST_PREDEF_MAKE_YYYYMM(V) BOOST_PREDEF_MAKE_DATE((V)/100,(V)%100,1)
  151. #endif