From 9f9048e8050471bf6bedd9b8c819f00b98c25dbc Mon Sep 17 00:00:00 2001 From: Vesa Karvonen Date: Fri, 7 Jun 2002 13:04:18 +0000 Subject: [PATCH] Automatic recursion [SVN r14100] --- doc/acknowledgements.htm | 2 + doc/examples.htm | 22 +- doc/keywords.txt | 8 - doc/reference/arithmetic_add.htm | 7 +- doc/reference/arithmetic_div.htm | 7 +- doc/reference/arithmetic_mod.htm | 7 +- doc/reference/arithmetic_mul.htm | 7 +- doc/reference/arithmetic_sub.htm | 7 +- doc/reference/comparison_equal.htm | 7 +- doc/reference/comparison_greater.htm | 7 +- doc/reference/comparison_greater_equal.htm | 7 +- doc/reference/comparison_less.htm | 7 +- doc/reference/comparison_less_equal.htm | 7 +- doc/reference/comparison_not_equal.htm | 7 +- doc/reference/enum.htm | 11 +- doc/reference/for.htm | 8 + doc/reference/index.htm | 16 +- doc/reference/limits.htm | 8 +- doc/reference/list.htm | 14 +- doc/reference/list_adt.htm | 5 +- doc/reference/list_append.htm | 7 +- doc/reference/list_at.htm | 7 +- doc/reference/list_cat.htm | 7 +- doc/reference/list_enum.htm | 2 +- doc/reference/list_filter.htm | 8 +- doc/reference/list_first_n.htm | 7 +- doc/reference/list_fold_left.htm | 22 +- doc/reference/list_fold_left_2nd.htm | 11 +- doc/reference/list_fold_right.htm | 23 +- doc/reference/list_fold_right_2nd.htm | 11 +- doc/reference/list_for_each.htm | 8 +- doc/reference/list_for_each_i.htm | 7 +- doc/reference/list_for_each_product.htm | 7 +- doc/reference/list_rest_n.htm | 7 +- doc/reference/list_reverse.htm | 7 +- doc/reference/list_size.htm | 7 +- doc/reference/list_to_tuple.htm | 7 +- doc/reference/list_transform.htm | 8 +- doc/reference/max.htm | 7 +- doc/reference/min.htm | 7 +- doc/reference/repeat.htm | 19 +- doc/reference/repeat_2nd.htm | 11 +- doc/reference/repeat_3rd.htm | 9 +- doc/reference/repeat_from_to.htm | 20 +- doc/reference/repeat_from_to_2nd.htm | 9 +- doc/reference/repeat_from_to_3rd.htm | 9 +- doc/reference/while.htm | 12 +- doc/tutorial.htm | 35 +- example/repeat_2d.c | 9 +- include/boost/preprocessor.hpp | 2 - .../boost/preprocessor/detail/auto_rec.hpp | 42 ++ include/boost/preprocessor/enum.hpp | 36 +- include/boost/preprocessor/for.hpp | 10 +- include/boost/preprocessor/list.hpp | 15 +- include/boost/preprocessor/list/adt.hpp | 5 +- include/boost/preprocessor/list/append.hpp | 9 +- include/boost/preprocessor/list/at.hpp | 7 +- include/boost/preprocessor/list/cat.hpp | 9 +- include/boost/preprocessor/list/enum.hpp | 2 +- include/boost/preprocessor/list/filter.hpp | 14 +- include/boost/preprocessor/list/first_n.hpp | 15 +- include/boost/preprocessor/list/fold_left.hpp | 55 +- .../boost/preprocessor/list/fold_left_2nd.hpp | 22 +- .../boost/preprocessor/list/fold_right.hpp | 46 +- .../preprocessor/list/fold_right_2nd.hpp | 19 +- include/boost/preprocessor/list/for_each.hpp | 10 +- .../boost/preprocessor/list/for_each_i.hpp | 13 +- .../preprocessor/list/for_each_product.hpp | 7 +- include/boost/preprocessor/list/rest_n.hpp | 15 +- include/boost/preprocessor/list/reverse.hpp | 9 +- include/boost/preprocessor/list/size.hpp | 9 +- include/boost/preprocessor/list/to_tuple.hpp | 7 +- include/boost/preprocessor/list/transform.hpp | 14 +- include/boost/preprocessor/repeat.hpp | 565 +++++++++++++----- include/boost/preprocessor/repeat_2nd.hpp | 144 +---- include/boost/preprocessor/repeat_3rd.hpp | 140 +---- include/boost/preprocessor/repeat_from_to.hpp | 41 +- .../boost/preprocessor/repeat_from_to_2nd.hpp | 13 +- .../boost/preprocessor/repeat_from_to_3rd.hpp | 13 +- include/boost/preprocessor/while.hpp | 16 +- test/list_test.cpp | 14 + test/repeat_2nd_test.cpp | 21 +- 82 files changed, 971 insertions(+), 869 deletions(-) create mode 100644 include/boost/preprocessor/detail/auto_rec.hpp diff --git a/doc/acknowledgements.htm b/doc/acknowledgements.htm index dfdbb39..38c8977 100644 --- a/doc/acknowledgements.htm +++ b/doc/acknowledgements.htm @@ -25,6 +25,8 @@

Thanks to everyone who participated in the review: David Abrahams, Beman Dawes, Ronald Garcia, Douglas Gregor, Aleksey Gurtovoy, Jeremy Siek, and Daryle Walker.

Thanks to Chris Little and Mat Marcus for providing help with MWCW.

+

The original automatic recursion technique, which makes many of the library +primitives easier to use, was invented by Paul Mensonides.

The PREPROCESSOR library has been developed by Vesa Karvonen.


Revised diff --git a/doc/examples.htm b/doc/examples.htm index 092e187..a4e93a7 100644 --- a/doc/examples.htm +++ b/doc/examples.htm @@ -21,56 +21,56 @@


- - + - - - - - + - - - -
array_arithmetic.cThis example implements over 2200 functions for 1-dimensional arithmetic +
array_arithmetic.cImplements over 2200 functions for 1-dimensional arithmetic array manipulation in C. The idea is to use preprocessor data structures, lists and tuples, for storing metainformation to be used for generating the actual C code.
catch_builtin.cppThis example demonstrates the usage of lists and BOOST_PP_LIST_FOR_EACH().Demonstrates the usage of lists and BOOST_PP_LIST_FOR_EACH().
count_down.c This is a trivial example of using BOOST_PP_WHILE() that simply counts + Trivial example of using BOOST_PP_WHILE() that simply counts down from N to 0 ultimately expanding to a 0.
delay.cThis example implements a macro whose expansion takes exponential amount + Implements a macro whose expansion takes exponential amount of time.
duffs_device.cThis example uses the preprocessor library to implement a generalized + Uses the preprocessor library to implement a generalized macro for implementing a Duff's Device.
is_integral.cppThis example demonstrates the usage of preprocessor lists for generating + Demonstrates the usage of preprocessor lists for generating C++ code.
linear_fib.cThis example shows how BOOST_PP_WHILE() can be used for implementing macros.Shows how BOOST_PP_WHILE() can be used for implementing macros.
note.cThis example shows how BOOST_PP_STRINGIZE() can be used to allow macro + Shows how BOOST_PP_STRINGIZE() can be used to allow macro expansion before stringization.
repeat_2d.cThis example implements a generalized macro for 2D repetition using the + Implements a generalized macro for 2D repetition using the simple repetition primitives of the preprocessor library.
static_assert.cThis example shows how BOOST_PP_CAT() can be used to allow macro expansion + Shows how BOOST_PP_CAT() can be used to allow macro expansion before token concatenation.
subscript_layer.cppThis example shows how BOOST_PP_EMPTY can be used as an unused or empty + Shows how BOOST_PP_EMPTY can be used as an unused or empty parameter.
diff --git a/doc/keywords.txt b/doc/keywords.txt index eedb1cb..47568fd 100644 --- a/doc/keywords.txt +++ b/doc/keywords.txt @@ -51,12 +51,8 @@ BOOST_PP_LIST_FIRST_N BOOST_PP_LIST_FIRST_N_D BOOST_PP_LIST_FOLD_LEFT BOOST_PP_LIST_FOLD_LEFT_D -BOOST_PP_LIST_FOLD_LEFT_2ND -BOOST_PP_LIST_FOLD_LEFT_2ND_D BOOST_PP_LIST_FOLD_RIGHT BOOST_PP_LIST_FOLD_RIGHT_D -BOOST_PP_LIST_FOLD_RIGHT_2ND -BOOST_PP_LIST_FOLD_RIGHT_2ND_D BOOST_PP_LIST_FOR_EACH BOOST_PP_LIST_FOR_EACH_I BOOST_PP_LIST_FOR_EACH_I_R @@ -91,11 +87,7 @@ BOOST_PP_NOT_EQUAL BOOST_PP_NOT_EQUAL_D BOOST_PP_OR BOOST_PP_REPEAT -BOOST_PP_REPEAT_2ND -BOOST_PP_REPEAT_3RD BOOST_PP_REPEAT_FROM_TO -BOOST_PP_REPEAT_FROM_TO_2ND -BOOST_PP_REPEAT_FROM_TO_3RD BOOST_PP_STRINGIZE BOOST_PP_SUB BOOST_PP_SUB_D diff --git a/doc/reference/arithmetic_add.htm b/doc/reference/arithmetic_add.htm index 70d7ff4..126a817 100644 --- a/doc/reference/arithmetic_add.htm +++ b/doc/reference/arithmetic_add.htm @@ -33,11 +33,6 @@ in the range [0, BOOST_PP_LIMIT_MAG]

For example, BOOST_PP_ADD(4,3) expands to 7 (a single token).

-

Uses

- -

Test