mods.hpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. // (C) Copyright Edward Diener 2011-2015
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #if !defined(BOOST_VMD_DETAIL_MODS_HPP)
  6. #define BOOST_VMD_DETAIL_MODS_HPP
  7. #include <boost/preprocessor/arithmetic/inc.hpp>
  8. #include <boost/preprocessor/comparison/equal.hpp>
  9. #include <boost/preprocessor/comparison/greater.hpp>
  10. #include <boost/preprocessor/control/iif.hpp>
  11. #include <boost/preprocessor/control/while.hpp>
  12. #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
  13. #include <boost/preprocessor/tuple/elem.hpp>
  14. #include <boost/preprocessor/tuple/pop_front.hpp>
  15. #include <boost/preprocessor/tuple/push_back.hpp>
  16. #include <boost/preprocessor/tuple/replace.hpp>
  17. #include <boost/preprocessor/tuple/size.hpp>
  18. #include <boost/preprocessor/variadic/to_tuple.hpp>
  19. #include <boost/vmd/identity.hpp>
  20. #include <boost/vmd/is_empty.hpp>
  21. #include <boost/vmd/is_type.hpp>
  22. #include <boost/vmd/detail/modifiers.hpp>
  23. #define BOOST_VMD_DETAIL_MODS_NO_RETURN 0
  24. #define BOOST_VMD_DETAIL_MODS_RETURN 1
  25. #define BOOST_VMD_DETAIL_MODS_RETURN_TUPLE 2
  26. #define BOOST_VMD_DETAIL_MODS_RETURN_ARRAY 3
  27. #define BOOST_VMD_DETAIL_MODS_RETURN_LIST 4
  28. #define BOOST_VMD_DETAIL_MODS_NO_AFTER 0
  29. #define BOOST_VMD_DETAIL_MODS_RETURN_AFTER 1
  30. #define BOOST_VMD_DETAIL_MODS_NO_INDEX 0
  31. #define BOOST_VMD_DETAIL_MODS_RETURN_INDEX 1
  32. #define BOOST_VMD_DETAIL_MODS_NO_ONLY_AFTER 0
  33. #define BOOST_VMD_DETAIL_MODS_RETURN_ONLY_AFTER 1
  34. #define BOOST_VMD_DETAIL_MODS_TUPLE_RETURN 0
  35. #define BOOST_VMD_DETAIL_MODS_TUPLE_AFTER 1
  36. #define BOOST_VMD_DETAIL_MODS_TUPLE_INDEX 2
  37. #define BOOST_VMD_DETAIL_MODS_TUPLE_OTHER 3
  38. #define BOOST_VMD_DETAIL_MODS_TUPLE_ONLY_AFTER 4
  39. #define BOOST_VMD_DETAIL_MODS_TUPLE_TYPE 5
  40. #define BOOST_VMD_DETAIL_MODS_DATA_INPUT 0
  41. #define BOOST_VMD_DETAIL_MODS_DATA_INDEX 1
  42. #define BOOST_VMD_DETAIL_MODS_DATA_SIZE 2
  43. #define BOOST_VMD_DETAIL_MODS_DATA_RESULT 3
  44. #define BOOST_VMD_DETAIL_MODS_DATA_ALLOW 4
  45. #define BOOST_VMD_DETAIL_MODS_STATE_INPUT(state) \
  46. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_DATA_INPUT,state) \
  47. /**/
  48. #define BOOST_VMD_DETAIL_MODS_STATE_INDEX(state) \
  49. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_DATA_INDEX,state) \
  50. /**/
  51. #define BOOST_VMD_DETAIL_MODS_STATE_SIZE(state) \
  52. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_DATA_SIZE,state) \
  53. /**/
  54. #define BOOST_VMD_DETAIL_MODS_STATE_RESULT(state) \
  55. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_DATA_RESULT,state) \
  56. /**/
  57. #define BOOST_VMD_DETAIL_MODS_STATE_ALLOW(state) \
  58. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_DATA_ALLOW,state) \
  59. /**/
  60. #define BOOST_VMD_DETAIL_MODS_STATE_IS_ALLOW_ALL(state) \
  61. BOOST_VMD_DETAIL_IS_ALLOW_ALL(BOOST_VMD_DETAIL_MODS_STATE_ALLOW(state)) \
  62. /**/
  63. #define BOOST_VMD_DETAIL_MODS_STATE_IS_ALLOW_RETURN(state) \
  64. BOOST_VMD_DETAIL_IS_ALLOW_RETURN(BOOST_VMD_DETAIL_MODS_STATE_ALLOW(state)) \
  65. /**/
  66. #define BOOST_VMD_DETAIL_MODS_STATE_IS_ALLOW_AFTER(state) \
  67. BOOST_VMD_DETAIL_IS_ALLOW_AFTER(BOOST_VMD_DETAIL_MODS_STATE_ALLOW(state)) \
  68. /**/
  69. #define BOOST_VMD_DETAIL_MODS_STATE_IS_ALLOW_INDEX(state) \
  70. BOOST_VMD_DETAIL_IS_ALLOW_INDEX(BOOST_VMD_DETAIL_MODS_STATE_ALLOW(state)) \
  71. /**/
  72. #define BOOST_VMD_DETAIL_MODS_STATE_CURRENT(state) \
  73. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_STATE_INDEX(state),BOOST_VMD_DETAIL_MODS_STATE_INPUT(state)) \
  74. /**/
  75. #define BOOST_VMD_DETAIL_MODS_STATE_TYPE(state) \
  76. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_TUPLE_RETURN,BOOST_VMD_DETAIL_MODS_STATE_RESULT(state)) \
  77. /**/
  78. #define BOOST_VMD_DETAIL_MODS_STATE_AFTER(state) \
  79. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_TUPLE_AFTER,BOOST_VMD_DETAIL_MODS_STATE_RESULT(state)) \
  80. /**/
  81. #define BOOST_VMD_DETAIL_MODS_STATE_ONLY_AFTER(state) \
  82. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_TUPLE_ONLY_AFTER,BOOST_VMD_DETAIL_MODS_STATE_RESULT(state)) \
  83. /**/
  84. #define BOOST_VMD_DETAIL_MODS_STATE_TINDEX(state) \
  85. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_TUPLE_INDEX,BOOST_VMD_DETAIL_MODS_STATE_RESULT(state)) \
  86. /**/
  87. #define BOOST_VMD_DETAIL_MODS_RESULT_RETURN_TYPE(result) \
  88. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_TUPLE_RETURN,result) \
  89. /**/
  90. #define BOOST_VMD_DETAIL_MODS_IS_RESULT_AFTER(result) \
  91. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_TUPLE_AFTER,result) \
  92. /**/
  93. #define BOOST_VMD_DETAIL_MODS_IS_RESULT_ONLY_AFTER(result) \
  94. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_TUPLE_ONLY_AFTER,result) \
  95. /**/
  96. #define BOOST_VMD_DETAIL_MODS_IS_RESULT_INDEX(result) \
  97. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_TUPLE_INDEX,result) \
  98. /**/
  99. #define BOOST_VMD_DETAIL_MODS_RESULT_OTHER(result) \
  100. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_TUPLE_OTHER,result) \
  101. /**/
  102. #define BOOST_VMD_DETAIL_MODS_RESULT_TYPE(result) \
  103. BOOST_PP_TUPLE_ELEM(BOOST_VMD_DETAIL_MODS_TUPLE_TYPE,result) \
  104. /**/
  105. #define BOOST_VMD_DETAIL_MODS_PRED(d,state) \
  106. BOOST_PP_GREATER_D(d,BOOST_VMD_DETAIL_MODS_STATE_SIZE(state),BOOST_VMD_DETAIL_MODS_STATE_INDEX(state))
  107. /**/
  108. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_RETURN_TYPE(d,state,number) \
  109. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UPDATE \
  110. ( \
  111. d, \
  112. BOOST_PP_TUPLE_REPLACE_D \
  113. ( \
  114. d, \
  115. state, \
  116. BOOST_VMD_DETAIL_MODS_DATA_RESULT, \
  117. BOOST_PP_TUPLE_REPLACE_D \
  118. ( \
  119. d, \
  120. BOOST_VMD_DETAIL_MODS_STATE_RESULT(state), \
  121. BOOST_VMD_DETAIL_MODS_TUPLE_RETURN, \
  122. number \
  123. ) \
  124. ) \
  125. ) \
  126. /**/
  127. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_ONLY_AFTER(d,state,id) \
  128. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UPDATE \
  129. ( \
  130. d, \
  131. BOOST_PP_TUPLE_REPLACE_D \
  132. ( \
  133. d, \
  134. state, \
  135. BOOST_VMD_DETAIL_MODS_DATA_RESULT, \
  136. BOOST_PP_TUPLE_REPLACE_D \
  137. ( \
  138. d, \
  139. BOOST_PP_TUPLE_REPLACE_D \
  140. ( \
  141. d, \
  142. BOOST_VMD_DETAIL_MODS_STATE_RESULT(state), \
  143. BOOST_VMD_DETAIL_MODS_TUPLE_ONLY_AFTER, \
  144. 1 \
  145. ), \
  146. BOOST_VMD_DETAIL_MODS_TUPLE_AFTER, \
  147. 1 \
  148. ) \
  149. ) \
  150. ) \
  151. /**/
  152. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_INDEX(d,state,number) \
  153. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UPDATE \
  154. ( \
  155. d, \
  156. BOOST_PP_TUPLE_REPLACE_D \
  157. ( \
  158. d, \
  159. state, \
  160. BOOST_VMD_DETAIL_MODS_DATA_RESULT, \
  161. BOOST_PP_TUPLE_REPLACE_D \
  162. ( \
  163. d, \
  164. BOOST_VMD_DETAIL_MODS_STATE_RESULT(state), \
  165. BOOST_VMD_DETAIL_MODS_TUPLE_INDEX, \
  166. number \
  167. ) \
  168. ) \
  169. ) \
  170. /**/
  171. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_GTT(d,state,id) \
  172. BOOST_VMD_DETAIL_MODS_OP_CURRENT_RETURN_TYPE(d,state,BOOST_VMD_DETAIL_MODS_RETURN_TUPLE) \
  173. /**/
  174. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_ET(d,state,id) \
  175. BOOST_VMD_DETAIL_MODS_OP_CURRENT_RETURN_TYPE(d,state,BOOST_VMD_DETAIL_MODS_RETURN) \
  176. /**/
  177. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_SA(d,state,id) \
  178. BOOST_VMD_DETAIL_MODS_OP_CURRENT_RETURN_TYPE(d,state,BOOST_VMD_DETAIL_MODS_RETURN_ARRAY) \
  179. /**/
  180. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_SL(d,state,id) \
  181. BOOST_VMD_DETAIL_MODS_OP_CURRENT_RETURN_TYPE(d,state,BOOST_VMD_DETAIL_MODS_RETURN_LIST) \
  182. /**/
  183. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_NT(d,state,id) \
  184. BOOST_VMD_DETAIL_MODS_OP_CURRENT_RETURN_TYPE(d,state,BOOST_VMD_DETAIL_MODS_NO_RETURN) \
  185. /**/
  186. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_AFT(d,state,id) \
  187. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UPDATE \
  188. ( \
  189. d, \
  190. BOOST_PP_TUPLE_REPLACE_D \
  191. ( \
  192. d, \
  193. state, \
  194. BOOST_VMD_DETAIL_MODS_DATA_RESULT, \
  195. BOOST_PP_TUPLE_REPLACE_D \
  196. ( \
  197. d, \
  198. BOOST_VMD_DETAIL_MODS_STATE_RESULT(state), \
  199. BOOST_VMD_DETAIL_MODS_TUPLE_AFTER, \
  200. BOOST_VMD_DETAIL_MODS_RETURN_AFTER \
  201. ) \
  202. ) \
  203. ) \
  204. /**/
  205. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_NOAFT(d,state,id) \
  206. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UPDATE \
  207. ( \
  208. d, \
  209. BOOST_PP_TUPLE_REPLACE_D \
  210. ( \
  211. d, \
  212. state, \
  213. BOOST_VMD_DETAIL_MODS_DATA_RESULT, \
  214. BOOST_PP_TUPLE_REPLACE_D \
  215. ( \
  216. d, \
  217. BOOST_PP_TUPLE_REPLACE_D \
  218. ( \
  219. d, \
  220. BOOST_VMD_DETAIL_MODS_STATE_RESULT(state), \
  221. BOOST_VMD_DETAIL_MODS_TUPLE_ONLY_AFTER, \
  222. 0 \
  223. ), \
  224. BOOST_VMD_DETAIL_MODS_TUPLE_AFTER, \
  225. BOOST_VMD_DETAIL_MODS_NO_AFTER \
  226. ) \
  227. ) \
  228. ) \
  229. /**/
  230. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_IND(d,state,id) \
  231. BOOST_VMD_DETAIL_MODS_OP_CURRENT_INDEX(d,state,BOOST_VMD_DETAIL_MODS_RETURN_INDEX) \
  232. /**/
  233. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_NO_IND(d,state,id) \
  234. BOOST_VMD_DETAIL_MODS_OP_CURRENT_INDEX(d,state,BOOST_VMD_DETAIL_MODS_NO_INDEX) \
  235. /**/
  236. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN_CTUPLE_REPLACE(d,state,id) \
  237. BOOST_PP_TUPLE_REPLACE_D \
  238. ( \
  239. d, \
  240. BOOST_VMD_DETAIL_MODS_STATE_RESULT(state), \
  241. BOOST_VMD_DETAIL_MODS_TUPLE_OTHER, \
  242. BOOST_PP_VARIADIC_TO_TUPLE(id) \
  243. ) \
  244. /**/
  245. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN_CTUPLE_ADD(d,state,id) \
  246. BOOST_PP_TUPLE_REPLACE_D \
  247. ( \
  248. d, \
  249. BOOST_VMD_DETAIL_MODS_STATE_RESULT(state), \
  250. BOOST_VMD_DETAIL_MODS_TUPLE_OTHER, \
  251. BOOST_PP_TUPLE_PUSH_BACK \
  252. ( \
  253. BOOST_VMD_DETAIL_MODS_RESULT_OTHER(BOOST_VMD_DETAIL_MODS_STATE_RESULT(state)), \
  254. id \
  255. ) \
  256. ) \
  257. /**/
  258. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN_CTUPLE(d,state,id) \
  259. BOOST_PP_IIF \
  260. ( \
  261. BOOST_VMD_IS_EMPTY \
  262. ( \
  263. BOOST_VMD_DETAIL_MODS_RESULT_OTHER(BOOST_VMD_DETAIL_MODS_STATE_RESULT(state)) \
  264. ), \
  265. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN_CTUPLE_REPLACE, \
  266. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN_CTUPLE_ADD \
  267. ) \
  268. (d,state,id) \
  269. /**/
  270. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN_TYPE_RETURN(d,state,id) \
  271. BOOST_PP_TUPLE_REPLACE_D \
  272. ( \
  273. d, \
  274. BOOST_VMD_DETAIL_MODS_STATE_RESULT(state), \
  275. BOOST_VMD_DETAIL_MODS_TUPLE_RETURN, \
  276. BOOST_PP_IIF \
  277. ( \
  278. BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,id,BOOST_VMD_TYPE_ARRAY), \
  279. BOOST_VMD_DETAIL_MODS_RETURN_ARRAY, \
  280. BOOST_PP_IIF \
  281. ( \
  282. BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,id,BOOST_VMD_TYPE_LIST), \
  283. BOOST_VMD_DETAIL_MODS_RETURN_LIST, \
  284. BOOST_VMD_DETAIL_MODS_RETURN_TUPLE \
  285. ) \
  286. ) \
  287. ) \
  288. /**/
  289. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN_TYPE(d,state,id) \
  290. BOOST_PP_TUPLE_REPLACE_D \
  291. ( \
  292. d, \
  293. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN_TYPE_RETURN(d,state,id), \
  294. BOOST_VMD_DETAIL_MODS_TUPLE_TYPE, \
  295. id \
  296. ) \
  297. /**/
  298. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN(d,state,id) \
  299. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UPDATE \
  300. ( \
  301. d, \
  302. BOOST_PP_TUPLE_REPLACE_D \
  303. ( \
  304. d, \
  305. state, \
  306. BOOST_VMD_DETAIL_MODS_DATA_RESULT, \
  307. BOOST_PP_IIF \
  308. ( \
  309. BOOST_PP_BITAND \
  310. ( \
  311. BOOST_VMD_DETAIL_MODS_STATE_IS_ALLOW_ALL(state), \
  312. BOOST_VMD_IS_TYPE_D(d,id) \
  313. ), \
  314. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN_TYPE, \
  315. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN_CTUPLE \
  316. ) \
  317. (d,state,id) \
  318. ) \
  319. ) \
  320. /**/
  321. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_UPDATE(d,state) \
  322. BOOST_PP_TUPLE_REPLACE_D \
  323. ( \
  324. d, \
  325. state, \
  326. BOOST_VMD_DETAIL_MODS_DATA_INDEX, \
  327. BOOST_PP_INC(BOOST_VMD_DETAIL_MODS_STATE_INDEX(state)) \
  328. ) \
  329. /**/
  330. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_ALLOW_ALL(d,state,id) \
  331. BOOST_PP_IIF \
  332. ( \
  333. BOOST_VMD_DETAIL_IS_RETURN_TYPE_TUPLE(id), \
  334. BOOST_VMD_DETAIL_MODS_OP_CURRENT_GTT, \
  335. BOOST_PP_IIF \
  336. ( \
  337. BOOST_VMD_DETAIL_IS_RETURN_TYPE(id), \
  338. BOOST_VMD_DETAIL_MODS_OP_CURRENT_ET, \
  339. BOOST_PP_IIF \
  340. ( \
  341. BOOST_VMD_DETAIL_IS_RETURN_TYPE_ARRAY(id), \
  342. BOOST_VMD_DETAIL_MODS_OP_CURRENT_SA, \
  343. BOOST_PP_IIF \
  344. ( \
  345. BOOST_VMD_DETAIL_IS_RETURN_TYPE_LIST(id), \
  346. BOOST_VMD_DETAIL_MODS_OP_CURRENT_SL, \
  347. BOOST_PP_IIF \
  348. ( \
  349. BOOST_VMD_DETAIL_IS_RETURN_NO_TYPE(id), \
  350. BOOST_VMD_DETAIL_MODS_OP_CURRENT_NT, \
  351. BOOST_PP_IIF \
  352. ( \
  353. BOOST_VMD_DETAIL_IS_RETURN_AFTER(id), \
  354. BOOST_VMD_DETAIL_MODS_OP_CURRENT_AFT, \
  355. BOOST_PP_IIF \
  356. ( \
  357. BOOST_VMD_DETAIL_IS_RETURN_NO_AFTER(id), \
  358. BOOST_VMD_DETAIL_MODS_OP_CURRENT_NOAFT, \
  359. BOOST_PP_IIF \
  360. ( \
  361. BOOST_VMD_DETAIL_IS_RETURN_ONLY_AFTER(id), \
  362. BOOST_VMD_DETAIL_MODS_OP_CURRENT_ONLY_AFTER, \
  363. BOOST_PP_IIF \
  364. ( \
  365. BOOST_VMD_DETAIL_IS_RETURN_INDEX(id), \
  366. BOOST_VMD_DETAIL_MODS_OP_CURRENT_IND, \
  367. BOOST_PP_IIF \
  368. ( \
  369. BOOST_VMD_DETAIL_IS_RETURN_NO_INDEX(id), \
  370. BOOST_VMD_DETAIL_MODS_OP_CURRENT_NO_IND, \
  371. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN \
  372. ) \
  373. ) \
  374. ) \
  375. ) \
  376. ) \
  377. ) \
  378. ) \
  379. ) \
  380. ) \
  381. ) \
  382. (d,state,id) \
  383. /**/
  384. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_ALLOW_RETURN(d,state,id) \
  385. BOOST_PP_IIF \
  386. ( \
  387. BOOST_VMD_DETAIL_IS_RETURN_TYPE_TUPLE(id), \
  388. BOOST_VMD_DETAIL_MODS_OP_CURRENT_GTT, \
  389. BOOST_PP_IIF \
  390. ( \
  391. BOOST_VMD_DETAIL_IS_RETURN_TYPE(id), \
  392. BOOST_VMD_DETAIL_MODS_OP_CURRENT_ET, \
  393. BOOST_PP_IIF \
  394. ( \
  395. BOOST_VMD_DETAIL_IS_RETURN_TYPE_ARRAY(id), \
  396. BOOST_VMD_DETAIL_MODS_OP_CURRENT_SA, \
  397. BOOST_PP_IIF \
  398. ( \
  399. BOOST_VMD_DETAIL_IS_RETURN_TYPE_LIST(id), \
  400. BOOST_VMD_DETAIL_MODS_OP_CURRENT_SL, \
  401. BOOST_PP_IIF \
  402. ( \
  403. BOOST_VMD_DETAIL_IS_RETURN_NO_TYPE(id), \
  404. BOOST_VMD_DETAIL_MODS_OP_CURRENT_NT, \
  405. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN \
  406. ) \
  407. ) \
  408. ) \
  409. ) \
  410. ) \
  411. (d,state,id) \
  412. /**/
  413. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_ALLOW_AFTER(d,state,id) \
  414. BOOST_PP_IIF \
  415. ( \
  416. BOOST_VMD_DETAIL_IS_RETURN_AFTER(id), \
  417. BOOST_VMD_DETAIL_MODS_OP_CURRENT_AFT, \
  418. BOOST_PP_IIF \
  419. ( \
  420. BOOST_VMD_DETAIL_IS_RETURN_NO_AFTER(id), \
  421. BOOST_VMD_DETAIL_MODS_OP_CURRENT_NOAFT, \
  422. BOOST_PP_IIF \
  423. ( \
  424. BOOST_VMD_DETAIL_IS_RETURN_ONLY_AFTER(id), \
  425. BOOST_VMD_DETAIL_MODS_OP_CURRENT_ONLY_AFTER, \
  426. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN \
  427. ) \
  428. ) \
  429. ) \
  430. (d,state,id) \
  431. /**/
  432. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_ALLOW_INDEX(d,state,id) \
  433. BOOST_PP_IIF \
  434. ( \
  435. BOOST_VMD_DETAIL_IS_RETURN_AFTER(id), \
  436. BOOST_VMD_DETAIL_MODS_OP_CURRENT_AFT, \
  437. BOOST_PP_IIF \
  438. ( \
  439. BOOST_VMD_DETAIL_IS_RETURN_NO_AFTER(id), \
  440. BOOST_VMD_DETAIL_MODS_OP_CURRENT_NOAFT, \
  441. BOOST_PP_IIF \
  442. ( \
  443. BOOST_VMD_DETAIL_IS_RETURN_ONLY_AFTER(id), \
  444. BOOST_VMD_DETAIL_MODS_OP_CURRENT_ONLY_AFTER, \
  445. BOOST_PP_IIF \
  446. ( \
  447. BOOST_VMD_DETAIL_IS_RETURN_INDEX(id), \
  448. BOOST_VMD_DETAIL_MODS_OP_CURRENT_IND, \
  449. BOOST_PP_IIF \
  450. ( \
  451. BOOST_VMD_DETAIL_IS_RETURN_NO_INDEX(id), \
  452. BOOST_VMD_DETAIL_MODS_OP_CURRENT_NO_IND, \
  453. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UNKNOWN \
  454. ) \
  455. ) \
  456. ) \
  457. ) \
  458. ) \
  459. (d,state,id) \
  460. /**/
  461. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_ALLOW_UPDATE(d,state,id) \
  462. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UPDATE(d,state) \
  463. /**/
  464. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_ID(d,state,id) \
  465. BOOST_PP_IIF \
  466. ( \
  467. BOOST_VMD_DETAIL_MODS_STATE_IS_ALLOW_ALL(state), \
  468. BOOST_VMD_DETAIL_MODS_OP_CURRENT_ALLOW_ALL, \
  469. BOOST_PP_IIF \
  470. ( \
  471. BOOST_VMD_DETAIL_MODS_STATE_IS_ALLOW_RETURN(state), \
  472. BOOST_VMD_DETAIL_MODS_OP_CURRENT_ALLOW_RETURN, \
  473. BOOST_PP_IIF \
  474. ( \
  475. BOOST_VMD_DETAIL_MODS_STATE_IS_ALLOW_AFTER(state), \
  476. BOOST_VMD_DETAIL_MODS_OP_CURRENT_ALLOW_AFTER, \
  477. BOOST_PP_IIF \
  478. ( \
  479. BOOST_VMD_DETAIL_MODS_STATE_IS_ALLOW_INDEX(state), \
  480. BOOST_VMD_DETAIL_MODS_OP_CURRENT_ALLOW_INDEX, \
  481. BOOST_VMD_DETAIL_MODS_OP_CURRENT_ALLOW_UPDATE \
  482. ) \
  483. ) \
  484. ) \
  485. ) \
  486. (d,state,id) \
  487. /**/
  488. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT_TUPLE(d,state,id) \
  489. BOOST_VMD_DETAIL_MODS_OP_CURRENT_UPDATE \
  490. ( \
  491. d, \
  492. BOOST_PP_TUPLE_REPLACE_D \
  493. ( \
  494. d, \
  495. state, \
  496. BOOST_VMD_DETAIL_MODS_DATA_RESULT, \
  497. BOOST_PP_TUPLE_REPLACE_D \
  498. ( \
  499. d, \
  500. BOOST_VMD_DETAIL_MODS_STATE_RESULT(state), \
  501. BOOST_VMD_DETAIL_MODS_TUPLE_OTHER, \
  502. id \
  503. ) \
  504. ) \
  505. ) \
  506. /**/
  507. #define BOOST_VMD_DETAIL_MODS_OP_CURRENT(d,state,id) \
  508. BOOST_PP_IIF \
  509. ( \
  510. BOOST_PP_IS_BEGIN_PARENS(id), \
  511. BOOST_VMD_DETAIL_MODS_OP_CURRENT_TUPLE, \
  512. BOOST_VMD_DETAIL_MODS_OP_CURRENT_ID \
  513. ) \
  514. (d,state,id) \
  515. /**/
  516. #define BOOST_VMD_DETAIL_MODS_OP(d,state) \
  517. BOOST_VMD_DETAIL_MODS_OP_CURRENT(d,state,BOOST_VMD_DETAIL_MODS_STATE_CURRENT(state)) \
  518. /**/
  519. #define BOOST_VMD_DETAIL_MODS_LOOP(allow,tuple) \
  520. BOOST_PP_TUPLE_ELEM \
  521. ( \
  522. 3, \
  523. BOOST_PP_WHILE \
  524. ( \
  525. BOOST_VMD_DETAIL_MODS_PRED, \
  526. BOOST_VMD_DETAIL_MODS_OP, \
  527. ( \
  528. tuple, \
  529. 0, \
  530. BOOST_PP_TUPLE_SIZE(tuple), \
  531. (0,0,0,,0,), \
  532. allow \
  533. ) \
  534. ) \
  535. ) \
  536. /**/
  537. #define BOOST_VMD_DETAIL_MODS_LOOP_D(d,allow,tuple) \
  538. BOOST_PP_TUPLE_ELEM \
  539. ( \
  540. 3, \
  541. BOOST_PP_WHILE_ ## d \
  542. ( \
  543. BOOST_VMD_DETAIL_MODS_PRED, \
  544. BOOST_VMD_DETAIL_MODS_OP, \
  545. ( \
  546. tuple, \
  547. 0, \
  548. BOOST_PP_TUPLE_SIZE(tuple), \
  549. (0,0,0,,0,), \
  550. allow \
  551. ) \
  552. ) \
  553. ) \
  554. /**/
  555. #define BOOST_VMD_DETAIL_NEW_MODS_VAR(allow,tuple) \
  556. BOOST_VMD_DETAIL_MODS_LOOP \
  557. ( \
  558. allow, \
  559. BOOST_PP_TUPLE_POP_FRONT(tuple) \
  560. ) \
  561. /**/
  562. #define BOOST_VMD_DETAIL_NEW_MODS_VAR_D(d,allow,tuple) \
  563. BOOST_VMD_DETAIL_MODS_LOOP_D \
  564. ( \
  565. d, \
  566. allow, \
  567. BOOST_PP_TUPLE_POP_FRONT(tuple) \
  568. ) \
  569. /**/
  570. #define BOOST_VMD_DETAIL_NEW_MODS_IR(allow,tuple) \
  571. BOOST_VMD_IDENTITY_RESULT \
  572. ( \
  573. BOOST_PP_IIF \
  574. ( \
  575. BOOST_PP_EQUAL(BOOST_PP_TUPLE_SIZE(tuple),1), \
  576. BOOST_VMD_IDENTITY((0,0,0,,0,)), \
  577. BOOST_VMD_DETAIL_NEW_MODS_VAR \
  578. ) \
  579. (allow,tuple) \
  580. ) \
  581. /**/
  582. #define BOOST_VMD_DETAIL_NEW_MODS_IR_D(d,allow,tuple) \
  583. BOOST_VMD_IDENTITY_RESULT \
  584. ( \
  585. BOOST_PP_IIF \
  586. ( \
  587. BOOST_PP_EQUAL_D(d,BOOST_PP_TUPLE_SIZE(tuple),1), \
  588. BOOST_VMD_IDENTITY((0,0,0,,0,)), \
  589. BOOST_VMD_DETAIL_NEW_MODS_VAR_D \
  590. ) \
  591. (d,allow,tuple) \
  592. ) \
  593. /**/
  594. /*
  595. Returns a six-element tuple:
  596. First tuple element = 0 No type return
  597. 1 Exact type return
  598. 2 General tuple type return
  599. 3 Array return
  600. 4 List return
  601. Second tuple element = 0 No after return
  602. 1 After return
  603. Third tuple element = 0 No identifier index
  604. 1 Identifier Index
  605. Fourth tuple element = Tuple of other identifiers
  606. Fifth tuple element = 0 No after only return
  607. 1 After only return
  608. Sixth tuple element = Type identifier
  609. Input = allow, either
  610. BOOST_VMD_ALLOW_ALL
  611. BOOST_VMD_ALLOW_RETURN
  612. BOOST_VMD_ALLOW_AFTER
  613. BOOST_VMD_ALLOW_INDEX
  614. ..., modifiers, first variadic is discarded
  615. Possible modifiers are:
  616. BOOST_VMD_RETURN_NO_TYPE = (0,0)
  617. BOOST_VMD_RETURN_TYPE = (1,0)
  618. BOOST_VMD_RETURN_TYPE_TUPLE = (2,0)
  619. BOOST_VMD_RETURN_TYPE_ARRAY = (3,0)
  620. BOOST_VMD_RETURN_TYPE_LIST = (4,0)
  621. BOOST_VMD_RETURN_NO_AFTER = (0,0)
  622. BOOST_VMD_RETURN_AFTER = (0,1)
  623. */
  624. #define BOOST_VMD_DETAIL_NEW_MODS(allow,...) \
  625. BOOST_VMD_DETAIL_NEW_MODS_IR(allow,BOOST_PP_VARIADIC_TO_TUPLE(__VA_ARGS__)) \
  626. /**/
  627. #define BOOST_VMD_DETAIL_NEW_MODS_D(d,allow,...) \
  628. BOOST_VMD_DETAIL_NEW_MODS_IR_D(d,allow,BOOST_PP_VARIADIC_TO_TUPLE(__VA_ARGS__)) \
  629. /**/
  630. #endif /* BOOST_VMD_DETAIL_MODS_HPP */