From 73218bea71a90aeeb78ef67707f0f7dd225b9528 Mon Sep 17 00:00:00 2001 From: Vesa Karvonen Date: Sun, 20 Jan 2002 16:25:09 +0000 Subject: [PATCH] Added BOOST_PP_ENUM, BOOST_PP_ENUM_SHIFTED, BOOST_PP_FOR, BOOST_PP_EXPAND [SVN r12368] --- doc/keywords.txt | 4 ++ doc/plan.txt | 3 +- doc/reference/enum_8hpp.html | 66 +++++++++++++++++++++ doc/reference/enum__shifted_8hpp.html | 66 +++++++++++++++++++++ doc/reference/expand_8hpp.html | 54 ++++++++++++++++++ doc/reference/files.html | 4 ++ doc/reference/for_8hpp.html | 82 +++++++++++++++++++++++++++ doc/reference/globals.html | 10 +++- doc/reference/while_8hpp.html | 14 ++--- 9 files changed, 292 insertions(+), 11 deletions(-) create mode 100644 doc/reference/enum_8hpp.html create mode 100644 doc/reference/enum__shifted_8hpp.html create mode 100644 doc/reference/expand_8hpp.html create mode 100644 doc/reference/for_8hpp.html diff --git a/doc/keywords.txt b/doc/keywords.txt index b2689d3..872a0b7 100644 --- a/doc/keywords.txt +++ b/doc/keywords.txt @@ -8,11 +8,15 @@ BOOST_PP_COMMA_IF BOOST_PP_DEC BOOST_PP_DIV BOOST_PP_EMPTY +BOOST_PP_ENUM BOOST_PP_ENUM_PARAMS BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS +BOOST_PP_ENUM_SHIFTED BOOST_PP_ENUM_SHIFTED_PARAMS BOOST_PP_EQUAL +BOOST_PP_EXPAND +BOOST_PP_FOR BOOST_PP_GREATER BOOST_PP_GREATER_EQUAL BOOST_PP_IDENTITY diff --git a/doc/plan.txt b/doc/plan.txt index 2d84414..68b2f71 100644 --- a/doc/plan.txt +++ b/doc/plan.txt @@ -3,5 +3,6 @@ please e-mail such suggestions to boost@yahoogroups.com, but also cc them to vesa.karvonen@housemarque.fi. Current R&D: -- Faster arithmetic - Data structures (cons list) +- Faster preprocessing +- Faster arithmetic diff --git a/doc/reference/enum_8hpp.html b/doc/reference/enum_8hpp.html new file mode 100644 index 0000000..1562814 --- /dev/null +++ b/doc/reference/enum_8hpp.html @@ -0,0 +1,66 @@ +c++boost.gif (8819 bytes) +
+ +
+Main Page   File List   File Members  
+

enum.hpp File Reference

+ + + +

Defines

#define BOOST_PP_ENUM(N, F, P)
 Generates a comma separated list. More...

+

Detailed Description

+ Click here to see the header. +

+


Define Documentation

+

+ + + + +
+ + + + + + + + + + + + + +
#define BOOST_PP_ENUMN,
F,
  +
+
+ + + + + +
+   + + +

+Generates a comma separated list. +

+In other words, expands to the sequence: +

+

+  F(0,P), F(1,P), ..., F(N-1,P)
+
+

+NOTE: The implementation uses BOOST_PP_REPEAT().

+


+

© Copyright Housemarque Oy 2001

+

Permission to copy, use, modify, sell and distribute this document is granted + provided this copyright notice appears in all copies. This document is provided + "as is" without express or implied warranty, and with no claim as to its suitability + for any purpose.

+ +

Generated:

diff --git a/doc/reference/enum__shifted_8hpp.html b/doc/reference/enum__shifted_8hpp.html new file mode 100644 index 0000000..dabdc4f --- /dev/null +++ b/doc/reference/enum__shifted_8hpp.html @@ -0,0 +1,66 @@ +c++boost.gif (8819 bytes) +
+ +
+Main Page   File List   File Members  
+

enum_shifted.hpp File Reference

+ + + +

Defines

#define BOOST_PP_ENUM_SHIFTED(N, F, P)
 Generates a comma separated shifted list. More...

+

Detailed Description

+ Click here to see the header. +

+


Define Documentation

+

+ + + + +
+ + + + + + + + + + + + + +
#define BOOST_PP_ENUM_SHIFTEDN,
F,
  +
+
+ + + + + +
+   + + +

+Generates a comma separated shifted list. +

+In other words, expands to the sequence: +

+

+  F(1,P), F(2,P), ..., F(N-1,P)
+
+

+NOTE: The implementation uses BOOST_PP_REPEAT().

+


+

© Copyright Housemarque Oy 2001

+

Permission to copy, use, modify, sell and distribute this document is granted + provided this copyright notice appears in all copies. This document is provided + "as is" without express or implied warranty, and with no claim as to its suitability + for any purpose.

+ +

Generated:

diff --git a/doc/reference/expand_8hpp.html b/doc/reference/expand_8hpp.html new file mode 100644 index 0000000..e367a28 --- /dev/null +++ b/doc/reference/expand_8hpp.html @@ -0,0 +1,54 @@ +c++boost.gif (8819 bytes) +
+ +
+Main Page   File List   File Members  
+

expand.hpp File Reference

+ + + +

Defines

#define BOOST_PP_EXPAND(X)
 Essentially macro expands the parameter X twice. More...

+

Detailed Description

+ Click here to see the header. +

+


Define Documentation

+

+ + + + +
+ + + + + + + +
#define BOOST_PP_EXPAND  +
+
+ + + + + +
+   + + +

+Essentially macro expands the parameter X twice. +

+

+


+

© Copyright Housemarque Oy 2001

+

Permission to copy, use, modify, sell and distribute this document is granted + provided this copyright notice appears in all copies. This document is provided + "as is" without express or implied warranty, and with no claim as to its suitability + for any purpose.

+ +

Generated:

diff --git a/doc/reference/files.html b/doc/reference/files.html index 4b96dca..30524e5 100644 --- a/doc/reference/files.html +++ b/doc/reference/files.html @@ -21,11 +21,15 @@ eat.hpp elem.hpp empty.hpp + enum.hpp enum_params.hpp enum_params_with_a_default.hpp enum_params_with_defaults.hpp + enum_shifted.hpp enum_shifted_params.hpp equal.hpp + expand.hpp + for.hpp greater.hpp greater_equal.hpp identity.hpp diff --git a/doc/reference/for_8hpp.html b/doc/reference/for_8hpp.html new file mode 100644 index 0000000..19c1bb1 --- /dev/null +++ b/doc/reference/for_8hpp.html @@ -0,0 +1,82 @@ +c++boost.gif (8819 bytes) +
+ +
+Main Page   File List   File Members  
+

for.hpp File Reference

+ + + +

Defines

#define BOOST_PP_FOR(X, C, F, I)
 Repeats I(R,X) and iterates F(R,X) while C(R,X) is true. More...

+

Detailed Description

+ Click here to see the header. +

+


Define Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + +
#define BOOST_PP_FORX,
C,
F,
  +
+
+ + + + + +
+   + + +

+Repeats I(R,X) and iterates F(R,X) while C(R,X) is true. +

+In other words, expands to the sequence: +

+

+  I(R,X)  I(R,F(R,X))  I(R,F(R,F(R,X)))  ...  I(R,F(R,F(...F(R,X)...)))
+
+

+The length of the sequence is determined by C(R,X). +

+

Legend

+ +

+X is the current state of iteration. The state is usually a tuple. +

+C is the condition for iteration. It must expand to a decimal integer literal. +

+F is the iterated macro. Note that if the state is a tuple, then F(R,X) usually expands to a tuple of the same number of elements. +

+I is the state instantiation macro. +

+R is the recursion depth and should only be used as a parameter to other macros implemented using BOOST_PP_FOR() or for invoking BOOST_PP_FOR#R() directly. For each macro implemented using BOOST_PP_FOR(), there is a version of the macro, distinguished by the _R suffix, that accepts an additional recursion depth as the first parameter. This technique is necessary to avoid recursively expanding the same macro again, which is not permitted by the C/C++ preprocessor.

+


+

© Copyright Housemarque Oy 2001

+

Permission to copy, use, modify, sell and distribute this document is granted + provided this copyright notice appears in all copies. This document is provided + "as is" without express or implied warranty, and with no claim as to its suitability + for any purpose.

+ +

Generated:

diff --git a/doc/reference/globals.html b/doc/reference/globals.html index 9f7e2d8..50c7e5f 100644 --- a/doc/reference/globals.html +++ b/doc/reference/globals.html @@ -17,12 +17,16 @@ : comma_if.hpp
  • BOOST_PP_DEC : dec.hpp
  • BOOST_PP_DIV : div.hpp
  • BOOST_PP_EMPTY -: empty.hpp
  • BOOST_PP_ENUM_PARAMS +: empty.hpp
  • BOOST_PP_ENUM +: enum.hpp
  • BOOST_PP_ENUM_PARAMS : enum_params.hpp
  • BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT : enum_params_with_a_default.hpp
  • BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS -: enum_params_with_defaults.hpp
  • BOOST_PP_ENUM_SHIFTED_PARAMS +: enum_params_with_defaults.hpp
  • BOOST_PP_ENUM_SHIFTED +: enum_shifted.hpp
  • BOOST_PP_ENUM_SHIFTED_PARAMS : enum_shifted_params.hpp
  • BOOST_PP_EQUAL -: equal.hpp
  • BOOST_PP_GREATER +: equal.hpp
  • BOOST_PP_EXPAND +: expand.hpp
  • BOOST_PP_FOR +: for.hpp
  • BOOST_PP_GREATER : greater.hpp
  • BOOST_PP_GREATER_EQUAL : greater_equal.hpp
  • BOOST_PP_IDENTITY : identity.hpp
  • BOOST_PP_IF diff --git a/doc/reference/while_8hpp.html b/doc/reference/while_8hpp.html index 6019e30..ab589f1 100644 --- a/doc/reference/while_8hpp.html +++ b/doc/reference/while_8hpp.html @@ -54,9 +54,9 @@ Iterates F(D,X) while C(D,X) is true.

    C is the condition for iteration. It must expand to a decimal integer literal.

    -F is the iterated function. Note that if the state is a tuple, then F(D,X) usually expands to a tuple of the same number of elements. +F is the iterated macro. Note that if the state is a tuple, then F(D,X) usually expands to a tuple of the same number of elements.

    -D is the recursion depth and should only be used as a parameter to other functions implemented using BOOST_PP_WHILE(). Such functions include BOOST_PP_ADD() and other arithmetic operations. For each function implemented using BOOST_PP_WHILE(), there is a version of the function, distinguished by the _D suffix (e.g. BOOST_PP_ADD_D()), that accepts an additional recursion depth as the first parameter. This technique is necessary to avoid recursively expanding the same macro again, which is not permitted by the C/C++ preprocessor. +D is the recursion depth and should only be used as a parameter to other macros implemented using BOOST_PP_WHILE(). Such macros include BOOST_PP_ADD() and other arithmetic operations. For each macro implemented using BOOST_PP_WHILE(), there is a version of the macro, distinguished by the _D suffix (e.g. BOOST_PP_ADD_D()), that accepts an additional recursion depth as the first parameter. This technique is necessary to avoid recursively expanding the same macro again, which is not permitted by the C/C++ preprocessor.

    NOTE: The value of the D parameter may exceed BOOST_PP_LIMIT_MAG.

    @@ -69,13 +69,13 @@ Here is a trivial example that simply counts down from N to 0 ultimately expandi

       #define COUNT_DOWN(N) BOOST_PP_WHILE(COUNT_DOWN_C,COUNT_DOWN_F,N)
    -  // Above is the function we are implementing using BOOST_PP_WHILE().
    +  // Above is the macro we are implementing using BOOST_PP_WHILE().
     
       #define COUNT_DOWN_C(D,N) N
    -  // Above is the Condition. It expands to the current N.
    +  // Above is the condition. It expands to the current N.
     
       #define COUNT_DOWN_F(D,N) BOOST_PP_DEC(N)
    -  // Above is the iteration Function. It decrements N.
    +  // Above is the iteration macro. It decrements N.
     
       COUNT_DOWN(50)
       // The above expands to 0.
    @@ -85,7 +85,7 @@ For a more complex example, let's take a look at an implementation of 
       #define BOOST_PP_MUL(X,Y) BOOST_PP_MUL_D(0,X,Y)
    -  // Since the function is implemented using WHILE, the actual implementation
    +  // Since the macro is implemented using WHILE, the actual implementation
       // takes a depth as a parameter so that it can be called inside a WHILE.
       // The above easy-to-use version simply uses 0 as the depth and can not be
       // called inside a WHILE.
    @@ -101,7 +101,7 @@ For a more complex example, let's take a look at an implementation of