aboutsummaryrefslogtreecommitdiffstats
path: root/util/generic/va_args_gen.py
diff options
context:
space:
mode:
authordancingqueue <dancingqueue@yandex-team.ru>2022-02-10 16:50:06 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:06 +0300
commit3c712c7c680d2b93fae03957df9561bd08eb5b7c (patch)
tree67c4d640d22500fe4daafe7144095c91d77424b1 /util/generic/va_args_gen.py
parent0ba74a57f9d49cfef11e512659c5847b98867342 (diff)
downloadydb-3c712c7c680d2b93fae03957df9561bd08eb5b7c.tar.gz
Restoring authorship annotation for <dancingqueue@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/generic/va_args_gen.py')
-rwxr-xr-xutil/generic/va_args_gen.py74
1 files changed, 37 insertions, 37 deletions
diff --git a/util/generic/va_args_gen.py b/util/generic/va_args_gen.py
index 232b53fca6..bacdc10859 100755
--- a/util/generic/va_args_gen.py
+++ b/util/generic/va_args_gen.py
@@ -33,9 +33,9 @@ def generate(limit):
count(limit)
get_elem(limit)
map_args(limit)
- map_args_n(limit)
+ map_args_n(limit)
map_args_with_last(limit)
- map_args_with_last_n(limit)
+ map_args_with_last_n(limit)
all_but_last(limit)
last(limit)
impl_dispatcher()
@@ -96,23 +96,23 @@ def map_args(limit):
'ACTION, __VA_ARGS__))'.format(i, i - 1))
-def map_args_n(limit):
- print(textwrap.dedent('''
- /**
- * Expands a macro for each of the variable arguments with it's sequence number and value.
- * Corresponding sequence numbers will expand in descending order.
- * Doesn't work with empty arguments list.
- */
- '''.rstrip()))
- print('#define Y_MAP_ARGS_N(ACTION, ...) Y_PASS_VA_ARGS(Y_PASS_VA_ARGS(Y_CAT('
- '__Y_MAP_ARGS_N_, Y_COUNT_ARGS(__VA_ARGS__)))(ACTION, __VA_ARGS__))')
- print('#define __Y_MAP_ARGS_N_0(...)')
- print('#define __Y_MAP_ARGS_N_1(ACTION, x, ...) ACTION(1, x)')
- for i in xrange(2, limit + 1):
- print('#define __Y_MAP_ARGS_N_{}(ACTION, x, ...) ACTION({}, x) Y_PASS_VA_ARGS(__Y_MAP_ARGS_N_{}('
- 'ACTION, __VA_ARGS__))'.format(i, i, i - 1))
-
-
+def map_args_n(limit):
+ print(textwrap.dedent('''
+ /**
+ * Expands a macro for each of the variable arguments with it's sequence number and value.
+ * Corresponding sequence numbers will expand in descending order.
+ * Doesn't work with empty arguments list.
+ */
+ '''.rstrip()))
+ print('#define Y_MAP_ARGS_N(ACTION, ...) Y_PASS_VA_ARGS(Y_PASS_VA_ARGS(Y_CAT('
+ '__Y_MAP_ARGS_N_, Y_COUNT_ARGS(__VA_ARGS__)))(ACTION, __VA_ARGS__))')
+ print('#define __Y_MAP_ARGS_N_0(...)')
+ print('#define __Y_MAP_ARGS_N_1(ACTION, x, ...) ACTION(1, x)')
+ for i in xrange(2, limit + 1):
+ print('#define __Y_MAP_ARGS_N_{}(ACTION, x, ...) ACTION({}, x) Y_PASS_VA_ARGS(__Y_MAP_ARGS_N_{}('
+ 'ACTION, __VA_ARGS__))'.format(i, i, i - 1))
+
+
def map_args_with_last(limit):
print(textwrap.dedent('''
/**
@@ -130,24 +130,24 @@ def map_args_with_last(limit):
'__Y_MAP_ARGS_WITH_LAST_{}(ACTION, LAST_ACTION, __VA_ARGS__))'.format(i, i - 1))
-def map_args_with_last_n(limit):
- print(textwrap.dedent('''
- /**
- * Expands a macro for each of the variable arguments with it's sequence number and value.
- * Corresponding sequence numbers will expand in descending order.
- * Doesn't work with empty arguments list.
- */
- '''.rstrip()))
- print('#define Y_MAP_ARGS_WITH_LAST_N(ACTION, LAST_ACTION, ...) Y_PASS_VA_ARGS(Y_PASS_VA_ARGS('
- 'Y_CAT(__Y_MAP_ARGS_WITH_LAST_N_, Y_COUNT_ARGS(__VA_ARGS__)))(ACTION, LAST_ACTION, '
- '__VA_ARGS__))')
- print('#define __Y_MAP_ARGS_WITH_LAST_N_0(...)')
- print('#define __Y_MAP_ARGS_WITH_LAST_N_1(ACTION, LAST_ACTION, x, ...) LAST_ACTION(1, x)')
- for i in xrange(2, limit + 1):
- print('#define __Y_MAP_ARGS_WITH_LAST_N_{}(ACTION, LAST_ACTION, x, ...) ACTION({}, x) Y_PASS_VA_ARGS('
- '__Y_MAP_ARGS_WITH_LAST_N_{}(ACTION, LAST_ACTION, __VA_ARGS__))'.format(i, i, i - 1))
-
-
+def map_args_with_last_n(limit):
+ print(textwrap.dedent('''
+ /**
+ * Expands a macro for each of the variable arguments with it's sequence number and value.
+ * Corresponding sequence numbers will expand in descending order.
+ * Doesn't work with empty arguments list.
+ */
+ '''.rstrip()))
+ print('#define Y_MAP_ARGS_WITH_LAST_N(ACTION, LAST_ACTION, ...) Y_PASS_VA_ARGS(Y_PASS_VA_ARGS('
+ 'Y_CAT(__Y_MAP_ARGS_WITH_LAST_N_, Y_COUNT_ARGS(__VA_ARGS__)))(ACTION, LAST_ACTION, '
+ '__VA_ARGS__))')
+ print('#define __Y_MAP_ARGS_WITH_LAST_N_0(...)')
+ print('#define __Y_MAP_ARGS_WITH_LAST_N_1(ACTION, LAST_ACTION, x, ...) LAST_ACTION(1, x)')
+ for i in xrange(2, limit + 1):
+ print('#define __Y_MAP_ARGS_WITH_LAST_N_{}(ACTION, LAST_ACTION, x, ...) ACTION({}, x) Y_PASS_VA_ARGS('
+ '__Y_MAP_ARGS_WITH_LAST_N_{}(ACTION, LAST_ACTION, __VA_ARGS__))'.format(i, i, i - 1))
+
+
def all_but_last(limit):
print(textwrap.dedent('''
/**