]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/pool/include/boost/pool/detail/for.m4
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / pool / include / boost / pool / detail / for.m4
CommitLineData
7c673cae
FG
1m4_dnl
2m4_dnl Copyright (C) 2000 Stephen Cleary
3m4_dnl
4m4_dnl Distributed under the Boost Software License, Version 1.0. (See accompany-
5m4_dnl ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6m4_dnl
7m4_dnl See http://www.boost.org for updates, documentation, and revision history.
8m4_dnl
9m4_dnl
10m4_dnl
11m4_dnl BOOST_M4_FOR: repeat a given text for a range of values
12m4_dnl $1 - variable to hold the current value.
13m4_dnl $2 - the starting value.
14m4_dnl $3 - the ending value (text is _not_ repeated for this value).
15m4_dnl $4 - the text to repeat.
16m4_dnl $5 - the delimeter text (optional).
17m4_dnl
18m4_dnl If the starting value is < ending value:
19m4_dnl Will repeat $4, binding $1 to the values in the range [$2, $3).
20m4_dnl Else (that is, starting value >= ending value):
21m4_dnl Will do nothing
22m4_dnl Repeats $5 in-between each occurrence of $4
23m4_dnl
24m4_dnl Logic:
25m4_dnl Set $1 to $2 and call BOOST_M4_FOR_LIST_HELPER:
26m4_dnl If $1 >= $3, do nothing
27m4_dnl Else
28m4_dnl output $4,
29m4_dnl set $1 to itself incremented,
30m4_dnl If $1 != $3, output $5,
31m4_dnl and use recursion
32m4_dnl
33m4_define(`BOOST_M4_FOR',
34 `m4_ifelse(m4_eval($# < 4 || $# > 5), 1,
35 `m4_errprint(m4___file__:m4___line__: `Boost m4 script: BOOST_M4_FOR: Wrong number of arguments ($#)')',
36 `m4_pushdef(`$1', `$2')BOOST_M4_FOR_HELPER($@)m4_popdef(`$1')')')m4_dnl
37m4_define(`BOOST_M4_FOR_HELPER',
38 `m4_ifelse(m4_eval($1 >= $3), 1, ,
39 `$4`'m4_define(`$1', m4_incr($1))m4_ifelse(m4_eval($1 != $3), 1, `$5')`'BOOST_M4_FOR_HELPER($@)')')m4_dnl
40m4_dnl
41m4_dnl Testing/Examples:
42m4_dnl
43m4_dnl The following line will output:
44m4_dnl "repeat.m4:42: Boost m4 script: BOOST_M4_FOR: Wrong number of arguments (3)"
45m4_dnl BOOST_M4_FOR(i, 1, 3)
46m4_dnl
47m4_dnl The following line will output:
48m4_dnl "repeat.m4:46: Boost m4 script: BOOST_M4_FOR: Wrong number of arguments (6)"
49m4_dnl BOOST_M4_FOR(i, 1, 3, i, ` ', 13)
50m4_dnl
51m4_dnl The following line will output (nothing):
52m4_dnl ""
53m4_dnl BOOST_M4_FOR(i, 7, 0, i )
54m4_dnl
55m4_dnl The following line will output (nothing):
56m4_dnl ""
57m4_dnl BOOST_M4_FOR(i, 0, 0, i )
58m4_dnl
59m4_dnl The following line will output:
60m4_dnl "0 1 2 3 4 5 6 "
61m4_dnl BOOST_M4_FOR(i, 0, 7, i )
62m4_dnl
63m4_dnl The following line will output:
64m4_dnl "-13 -12 -11 "
65m4_dnl BOOST_M4_FOR(i, -13, -10, i )
66m4_dnl
67m4_dnl The following two lines will output:
68m4_dnl "(0, 0) (0, 1) (0, 2) (0, 3) "
69m4_dnl "(1, 0) (1, 1) (1, 2) (1, 3) "
70m4_dnl "(2, 0) (2, 1) (2, 2) (2, 3) "
71m4_dnl "(3, 0) (3, 1) (3, 2) (3, 3) "
72m4_dnl "(4, 0) (4, 1) (4, 2) (4, 3) "
73m4_dnl "(5, 0) (5, 1) (5, 2) (5, 3) "
74m4_dnl "(6, 0) (6, 1) (6, 2) (6, 3) "
75m4_dnl "(7, 0) (7, 1) (7, 2) (7, 3) "
76m4_dnl ""
77m4_dnl BOOST_M4_FOR(i, 0, 8, BOOST_M4_FOR(j, 0, 4, (i, j) )
78m4_dnl )
79m4_dnl
80m4_dnl The following line will output (nothing):
81m4_dnl ""
82m4_dnl BOOST_M4_FOR(i, 7, 0, i, |)
83m4_dnl
84m4_dnl The following line will output (nothing):
85m4_dnl ""
86m4_dnl BOOST_M4_FOR(i, 0, 0, i, |)
87m4_dnl
88m4_dnl The following line will output:
89m4_dnl "0|1|2|3|4|5|6"
90m4_dnl BOOST_M4_FOR(i, 0, 7, i, |)
91m4_dnl
92m4_dnl The following line will output:
93m4_dnl "-13, -12, -11"
94m4_dnl BOOST_M4_FOR(i, -13, -10, i, `, ')
95m4_dnl
96m4_dnl The following two lines will output:
97m4_dnl "[(0, 0), (0, 1), (0, 2), (0, 3)],"
98m4_dnl "[(1, 0), (1, 1), (1, 2), (1, 3)],"
99m4_dnl "[(2, 0), (2, 1), (2, 2), (2, 3)],"
100m4_dnl "[(3, 0), (3, 1), (3, 2), (3, 3)],"
101m4_dnl "[(4, 0), (4, 1), (4, 2), (4, 3)],"
102m4_dnl "[(5, 0), (5, 1), (5, 2), (5, 3)],"
103m4_dnl "[(6, 0), (6, 1), (6, 2), (6, 3)],"
104m4_dnl "[(7, 0), (7, 1), (7, 2), (7, 3)]"
105m4_dnl BOOST_M4_FOR(i, 0, 8, `[BOOST_M4_FOR(j, 0, 4, (i, j), `, ')]', `,
106m4_dnl ')
107m4_dnl