counter.hpp 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. # /* **************************************************************************
  2. # * *
  3. # * (C) Copyright Paul Mensonides 2005. *
  4. # * Distributed under the Boost Software License, Version 1.0. (See *
  5. # * accompanying file LICENSE_1_0.txt or copy at *
  6. # * http://www.boost.org/LICENSE_1_0.txt) *
  7. # * *
  8. # ************************************************************************** */
  9. #
  10. # /* See http://www.boost.org for most recent version. */
  11. #
  12. # define BOOST_PP_VALUE BOOST_PP_COUNTER + 1
  13. #
  14. # include <boost/preprocessor/slot/detail/shared.hpp>
  15. #
  16. # undef BOOST_PP_COUNTER
  17. #
  18. # undef BOOST_PP_COUNTER_DIGIT_1
  19. # undef BOOST_PP_COUNTER_DIGIT_2
  20. # undef BOOST_PP_COUNTER_DIGIT_3
  21. # undef BOOST_PP_COUNTER_DIGIT_4
  22. # undef BOOST_PP_COUNTER_DIGIT_5
  23. # undef BOOST_PP_COUNTER_DIGIT_6
  24. # undef BOOST_PP_COUNTER_DIGIT_7
  25. # undef BOOST_PP_COUNTER_DIGIT_8
  26. # undef BOOST_PP_COUNTER_DIGIT_9
  27. # undef BOOST_PP_COUNTER_DIGIT_10
  28. #
  29. # if BOOST_PP_SLOT_TEMP_10 == 0
  30. # define BOOST_PP_COUNTER_DIGIT_10 0
  31. # elif BOOST_PP_SLOT_TEMP_10 == 1
  32. # define BOOST_PP_COUNTER_DIGIT_10 1
  33. # elif BOOST_PP_SLOT_TEMP_10 == 2
  34. # define BOOST_PP_COUNTER_DIGIT_10 2
  35. # elif BOOST_PP_SLOT_TEMP_10 == 3
  36. # define BOOST_PP_COUNTER_DIGIT_10 3
  37. # elif BOOST_PP_SLOT_TEMP_10 == 4
  38. # define BOOST_PP_COUNTER_DIGIT_10 4
  39. # elif BOOST_PP_SLOT_TEMP_10 == 5
  40. # define BOOST_PP_COUNTER_DIGIT_10 5
  41. # elif BOOST_PP_SLOT_TEMP_10 == 6
  42. # define BOOST_PP_COUNTER_DIGIT_10 6
  43. # elif BOOST_PP_SLOT_TEMP_10 == 7
  44. # define BOOST_PP_COUNTER_DIGIT_10 7
  45. # elif BOOST_PP_SLOT_TEMP_10 == 8
  46. # define BOOST_PP_COUNTER_DIGIT_10 8
  47. # elif BOOST_PP_SLOT_TEMP_10 == 9
  48. # define BOOST_PP_COUNTER_DIGIT_10 9
  49. # endif
  50. #
  51. # if BOOST_PP_SLOT_TEMP_9 == 0
  52. # define BOOST_PP_COUNTER_DIGIT_9 0
  53. # elif BOOST_PP_SLOT_TEMP_9 == 1
  54. # define BOOST_PP_COUNTER_DIGIT_9 1
  55. # elif BOOST_PP_SLOT_TEMP_9 == 2
  56. # define BOOST_PP_COUNTER_DIGIT_9 2
  57. # elif BOOST_PP_SLOT_TEMP_9 == 3
  58. # define BOOST_PP_COUNTER_DIGIT_9 3
  59. # elif BOOST_PP_SLOT_TEMP_9 == 4
  60. # define BOOST_PP_COUNTER_DIGIT_9 4
  61. # elif BOOST_PP_SLOT_TEMP_9 == 5
  62. # define BOOST_PP_COUNTER_DIGIT_9 5
  63. # elif BOOST_PP_SLOT_TEMP_9 == 6
  64. # define BOOST_PP_COUNTER_DIGIT_9 6
  65. # elif BOOST_PP_SLOT_TEMP_9 == 7
  66. # define BOOST_PP_COUNTER_DIGIT_9 7
  67. # elif BOOST_PP_SLOT_TEMP_9 == 8
  68. # define BOOST_PP_COUNTER_DIGIT_9 8
  69. # elif BOOST_PP_SLOT_TEMP_9 == 9
  70. # define BOOST_PP_COUNTER_DIGIT_9 9
  71. # endif
  72. #
  73. # if BOOST_PP_SLOT_TEMP_8 == 0
  74. # define BOOST_PP_COUNTER_DIGIT_8 0
  75. # elif BOOST_PP_SLOT_TEMP_8 == 1
  76. # define BOOST_PP_COUNTER_DIGIT_8 1
  77. # elif BOOST_PP_SLOT_TEMP_8 == 2
  78. # define BOOST_PP_COUNTER_DIGIT_8 2
  79. # elif BOOST_PP_SLOT_TEMP_8 == 3
  80. # define BOOST_PP_COUNTER_DIGIT_8 3
  81. # elif BOOST_PP_SLOT_TEMP_8 == 4
  82. # define BOOST_PP_COUNTER_DIGIT_8 4
  83. # elif BOOST_PP_SLOT_TEMP_8 == 5
  84. # define BOOST_PP_COUNTER_DIGIT_8 5
  85. # elif BOOST_PP_SLOT_TEMP_8 == 6
  86. # define BOOST_PP_COUNTER_DIGIT_8 6
  87. # elif BOOST_PP_SLOT_TEMP_8 == 7
  88. # define BOOST_PP_COUNTER_DIGIT_8 7
  89. # elif BOOST_PP_SLOT_TEMP_8 == 8
  90. # define BOOST_PP_COUNTER_DIGIT_8 8
  91. # elif BOOST_PP_SLOT_TEMP_8 == 9
  92. # define BOOST_PP_COUNTER_DIGIT_8 9
  93. # endif
  94. #
  95. # if BOOST_PP_SLOT_TEMP_7 == 0
  96. # define BOOST_PP_COUNTER_DIGIT_7 0
  97. # elif BOOST_PP_SLOT_TEMP_7 == 1
  98. # define BOOST_PP_COUNTER_DIGIT_7 1
  99. # elif BOOST_PP_SLOT_TEMP_7 == 2
  100. # define BOOST_PP_COUNTER_DIGIT_7 2
  101. # elif BOOST_PP_SLOT_TEMP_7 == 3
  102. # define BOOST_PP_COUNTER_DIGIT_7 3
  103. # elif BOOST_PP_SLOT_TEMP_7 == 4
  104. # define BOOST_PP_COUNTER_DIGIT_7 4
  105. # elif BOOST_PP_SLOT_TEMP_7 == 5
  106. # define BOOST_PP_COUNTER_DIGIT_7 5
  107. # elif BOOST_PP_SLOT_TEMP_7 == 6
  108. # define BOOST_PP_COUNTER_DIGIT_7 6
  109. # elif BOOST_PP_SLOT_TEMP_7 == 7
  110. # define BOOST_PP_COUNTER_DIGIT_7 7
  111. # elif BOOST_PP_SLOT_TEMP_7 == 8
  112. # define BOOST_PP_COUNTER_DIGIT_7 8
  113. # elif BOOST_PP_SLOT_TEMP_7 == 9
  114. # define BOOST_PP_COUNTER_DIGIT_7 9
  115. # endif
  116. #
  117. # if BOOST_PP_SLOT_TEMP_6 == 0
  118. # define BOOST_PP_COUNTER_DIGIT_6 0
  119. # elif BOOST_PP_SLOT_TEMP_6 == 1
  120. # define BOOST_PP_COUNTER_DIGIT_6 1
  121. # elif BOOST_PP_SLOT_TEMP_6 == 2
  122. # define BOOST_PP_COUNTER_DIGIT_6 2
  123. # elif BOOST_PP_SLOT_TEMP_6 == 3
  124. # define BOOST_PP_COUNTER_DIGIT_6 3
  125. # elif BOOST_PP_SLOT_TEMP_6 == 4
  126. # define BOOST_PP_COUNTER_DIGIT_6 4
  127. # elif BOOST_PP_SLOT_TEMP_6 == 5
  128. # define BOOST_PP_COUNTER_DIGIT_6 5
  129. # elif BOOST_PP_SLOT_TEMP_6 == 6
  130. # define BOOST_PP_COUNTER_DIGIT_6 6
  131. # elif BOOST_PP_SLOT_TEMP_6 == 7
  132. # define BOOST_PP_COUNTER_DIGIT_6 7
  133. # elif BOOST_PP_SLOT_TEMP_6 == 8
  134. # define BOOST_PP_COUNTER_DIGIT_6 8
  135. # elif BOOST_PP_SLOT_TEMP_6 == 9
  136. # define BOOST_PP_COUNTER_DIGIT_6 9
  137. # endif
  138. #
  139. # if BOOST_PP_SLOT_TEMP_5 == 0
  140. # define BOOST_PP_COUNTER_DIGIT_5 0
  141. # elif BOOST_PP_SLOT_TEMP_5 == 1
  142. # define BOOST_PP_COUNTER_DIGIT_5 1
  143. # elif BOOST_PP_SLOT_TEMP_5 == 2
  144. # define BOOST_PP_COUNTER_DIGIT_5 2
  145. # elif BOOST_PP_SLOT_TEMP_5 == 3
  146. # define BOOST_PP_COUNTER_DIGIT_5 3
  147. # elif BOOST_PP_SLOT_TEMP_5 == 4
  148. # define BOOST_PP_COUNTER_DIGIT_5 4
  149. # elif BOOST_PP_SLOT_TEMP_5 == 5
  150. # define BOOST_PP_COUNTER_DIGIT_5 5
  151. # elif BOOST_PP_SLOT_TEMP_5 == 6
  152. # define BOOST_PP_COUNTER_DIGIT_5 6
  153. # elif BOOST_PP_SLOT_TEMP_5 == 7
  154. # define BOOST_PP_COUNTER_DIGIT_5 7
  155. # elif BOOST_PP_SLOT_TEMP_5 == 8
  156. # define BOOST_PP_COUNTER_DIGIT_5 8
  157. # elif BOOST_PP_SLOT_TEMP_5 == 9
  158. # define BOOST_PP_COUNTER_DIGIT_5 9
  159. # endif
  160. #
  161. # if BOOST_PP_SLOT_TEMP_4 == 0
  162. # define BOOST_PP_COUNTER_DIGIT_4 0
  163. # elif BOOST_PP_SLOT_TEMP_4 == 1
  164. # define BOOST_PP_COUNTER_DIGIT_4 1
  165. # elif BOOST_PP_SLOT_TEMP_4 == 2
  166. # define BOOST_PP_COUNTER_DIGIT_4 2
  167. # elif BOOST_PP_SLOT_TEMP_4 == 3
  168. # define BOOST_PP_COUNTER_DIGIT_4 3
  169. # elif BOOST_PP_SLOT_TEMP_4 == 4
  170. # define BOOST_PP_COUNTER_DIGIT_4 4
  171. # elif BOOST_PP_SLOT_TEMP_4 == 5
  172. # define BOOST_PP_COUNTER_DIGIT_4 5
  173. # elif BOOST_PP_SLOT_TEMP_4 == 6
  174. # define BOOST_PP_COUNTER_DIGIT_4 6
  175. # elif BOOST_PP_SLOT_TEMP_4 == 7
  176. # define BOOST_PP_COUNTER_DIGIT_4 7
  177. # elif BOOST_PP_SLOT_TEMP_4 == 8
  178. # define BOOST_PP_COUNTER_DIGIT_4 8
  179. # elif BOOST_PP_SLOT_TEMP_4 == 9
  180. # define BOOST_PP_COUNTER_DIGIT_4 9
  181. # endif
  182. #
  183. # if BOOST_PP_SLOT_TEMP_3 == 0
  184. # define BOOST_PP_COUNTER_DIGIT_3 0
  185. # elif BOOST_PP_SLOT_TEMP_3 == 1
  186. # define BOOST_PP_COUNTER_DIGIT_3 1
  187. # elif BOOST_PP_SLOT_TEMP_3 == 2
  188. # define BOOST_PP_COUNTER_DIGIT_3 2
  189. # elif BOOST_PP_SLOT_TEMP_3 == 3
  190. # define BOOST_PP_COUNTER_DIGIT_3 3
  191. # elif BOOST_PP_SLOT_TEMP_3 == 4
  192. # define BOOST_PP_COUNTER_DIGIT_3 4
  193. # elif BOOST_PP_SLOT_TEMP_3 == 5
  194. # define BOOST_PP_COUNTER_DIGIT_3 5
  195. # elif BOOST_PP_SLOT_TEMP_3 == 6
  196. # define BOOST_PP_COUNTER_DIGIT_3 6
  197. # elif BOOST_PP_SLOT_TEMP_3 == 7
  198. # define BOOST_PP_COUNTER_DIGIT_3 7
  199. # elif BOOST_PP_SLOT_TEMP_3 == 8
  200. # define BOOST_PP_COUNTER_DIGIT_3 8
  201. # elif BOOST_PP_SLOT_TEMP_3 == 9
  202. # define BOOST_PP_COUNTER_DIGIT_3 9
  203. # endif
  204. #
  205. # if BOOST_PP_SLOT_TEMP_2 == 0
  206. # define BOOST_PP_COUNTER_DIGIT_2 0
  207. # elif BOOST_PP_SLOT_TEMP_2 == 1
  208. # define BOOST_PP_COUNTER_DIGIT_2 1
  209. # elif BOOST_PP_SLOT_TEMP_2 == 2
  210. # define BOOST_PP_COUNTER_DIGIT_2 2
  211. # elif BOOST_PP_SLOT_TEMP_2 == 3
  212. # define BOOST_PP_COUNTER_DIGIT_2 3
  213. # elif BOOST_PP_SLOT_TEMP_2 == 4
  214. # define BOOST_PP_COUNTER_DIGIT_2 4
  215. # elif BOOST_PP_SLOT_TEMP_2 == 5
  216. # define BOOST_PP_COUNTER_DIGIT_2 5
  217. # elif BOOST_PP_SLOT_TEMP_2 == 6
  218. # define BOOST_PP_COUNTER_DIGIT_2 6
  219. # elif BOOST_PP_SLOT_TEMP_2 == 7
  220. # define BOOST_PP_COUNTER_DIGIT_2 7
  221. # elif BOOST_PP_SLOT_TEMP_2 == 8
  222. # define BOOST_PP_COUNTER_DIGIT_2 8
  223. # elif BOOST_PP_SLOT_TEMP_2 == 9
  224. # define BOOST_PP_COUNTER_DIGIT_2 9
  225. # endif
  226. #
  227. # if BOOST_PP_SLOT_TEMP_1 == 0
  228. # define BOOST_PP_COUNTER_DIGIT_1 0
  229. # elif BOOST_PP_SLOT_TEMP_1 == 1
  230. # define BOOST_PP_COUNTER_DIGIT_1 1
  231. # elif BOOST_PP_SLOT_TEMP_1 == 2
  232. # define BOOST_PP_COUNTER_DIGIT_1 2
  233. # elif BOOST_PP_SLOT_TEMP_1 == 3
  234. # define BOOST_PP_COUNTER_DIGIT_1 3
  235. # elif BOOST_PP_SLOT_TEMP_1 == 4
  236. # define BOOST_PP_COUNTER_DIGIT_1 4
  237. # elif BOOST_PP_SLOT_TEMP_1 == 5
  238. # define BOOST_PP_COUNTER_DIGIT_1 5
  239. # elif BOOST_PP_SLOT_TEMP_1 == 6
  240. # define BOOST_PP_COUNTER_DIGIT_1 6
  241. # elif BOOST_PP_SLOT_TEMP_1 == 7
  242. # define BOOST_PP_COUNTER_DIGIT_1 7
  243. # elif BOOST_PP_SLOT_TEMP_1 == 8
  244. # define BOOST_PP_COUNTER_DIGIT_1 8
  245. # elif BOOST_PP_SLOT_TEMP_1 == 9
  246. # define BOOST_PP_COUNTER_DIGIT_1 9
  247. # endif
  248. #
  249. # if BOOST_PP_COUNTER_DIGIT_10
  250. # define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_10(BOOST_PP_COUNTER_DIGIT_10, BOOST_PP_COUNTER_DIGIT_9, BOOST_PP_COUNTER_DIGIT_8, BOOST_PP_COUNTER_DIGIT_7, BOOST_PP_COUNTER_DIGIT_6, BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1)
  251. # elif BOOST_PP_COUNTER_DIGIT_9
  252. # define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_9(BOOST_PP_COUNTER_DIGIT_9, BOOST_PP_COUNTER_DIGIT_8, BOOST_PP_COUNTER_DIGIT_7, BOOST_PP_COUNTER_DIGIT_6, BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1)
  253. # elif BOOST_PP_COUNTER_DIGIT_8
  254. # define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_8(BOOST_PP_COUNTER_DIGIT_8, BOOST_PP_COUNTER_DIGIT_7, BOOST_PP_COUNTER_DIGIT_6, BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1)
  255. # elif BOOST_PP_COUNTER_DIGIT_7
  256. # define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_7(BOOST_PP_COUNTER_DIGIT_7, BOOST_PP_COUNTER_DIGIT_6, BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1)
  257. # elif BOOST_PP_COUNTER_DIGIT_6
  258. # define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_6(BOOST_PP_COUNTER_DIGIT_6, BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1)
  259. # elif BOOST_PP_COUNTER_DIGIT_5
  260. # define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_5(BOOST_PP_COUNTER_DIGIT_5, BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1)
  261. # elif BOOST_PP_COUNTER_DIGIT_4
  262. # define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_4(BOOST_PP_COUNTER_DIGIT_4, BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1)
  263. # elif BOOST_PP_COUNTER_DIGIT_3
  264. # define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_3(BOOST_PP_COUNTER_DIGIT_3, BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1)
  265. # elif BOOST_PP_COUNTER_DIGIT_2
  266. # define BOOST_PP_COUNTER BOOST_PP_SLOT_CC_2(BOOST_PP_COUNTER_DIGIT_2, BOOST_PP_COUNTER_DIGIT_1)
  267. # else
  268. # define BOOST_PP_COUNTER BOOST_PP_COUNTER_DIGIT_1
  269. # endif