]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/wave/doc/macro_expansion_process.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / wave / doc / macro_expansion_process.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <title>The Macro Expansion Process</title>
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6 <link href="theme/style.css" rel="stylesheet" type="text/css">
7 </head>
8
9 <body>
10 <table width="100%" border="0" cellspacing="2" background="theme/bkd2.gif">
11 <tr>
12 <td width="21"> <h1></h1></td>
13 <td width="885"> <font face="Verdana, Arial, Helvetica, sans-serif"><b><font size="6">The
14 Macro Expansion Process</font></b></font></td>
15 <td width="96"><a href="http://www.boost.org"><img src="theme/wave.gif" width="93" height="68" align="right" border="0"></a></td>
16 </tr>
17 </table>
18 <br>
19 <table border="0">
20 <tr>
21 <td width="10"></td>
22 <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
23 <td width="30"><a href="predefined_macros.html"><img src="theme/l_arr.gif" border="0"></a></td>
24 <td width="30"><a href="compiletime_config.html"><img src="theme/r_arr.gif" border="0"></a></td>
25 </tr>
26 </table>
27 <p>The macro expansion process described here was initially developed by <a href="mailto:pmenso57@attbi.com">Paul
28 Mensonides</a> and is implemented in <tt>Wave</tt>. It is much more understandable
29 as the description of the desired macro expansion algorithm provided in the
30 C++ Standard <a href="references.html#iso_cpp">[1]</a>.</p>
31 <p>Macro replacement proceeds left-to-right. </p>
32 <p>If, during scanning (or rescanning) an identifier is found, it is looked up
33 in the symbol table. If the identifier is not found in the symbol table, it
34 is not a macro and scanning continues.</p>
35 <p>If the identifier is found, the value of a flag associated with the identifier
36 is used to determine if the identifier is available for expansion. If it is
37 not, the specific token (i.e. the specific instance of the identifier) is marked
38 as disabled and is not expanded. If the identifier is available for expansion,
39 the value of a different flag associated with the identifier in the symbol table
40 is used to determine if the identifier is an object-like or function-like macro.
41 If it is an object-like macro, it is expanded. If it is a function-like macro,
42 it is only expanded if the next token is an left parenthesis.<br>
43 An identifier is available for expansion if it is not marked as disabled and
44 if the the value of the flag associated with the identifier is not set, which
45 is used to determine if the identifier is available for expansion.</p>
46 <p>(If a macro is an object-like macro, skip past the next two paragraphs.)</p>
47 <p>If a macro to be expanded is a function-like macro, it must have the exact
48 number of actual arguments as the number of formal parameters required by the
49 definition of the macro. Each argument is recursively scanned and expanded.
50 Each parameter name found in the replacement list is replaced by the expanded
51 actual argument after leading and trailing whitespace and all placeholder tokens
52 are removed unless the parameter name immediately follows the stringizing operator
53 (<tt>'#'</tt>) or is adjacent to the token-pasting operator (<tt>'##'</tt>).</p>
54 <p>If the parameter name immediately follows the stringizing operator (<tt>'#'</tt>),
55 a stringized version of the unexpanded actual argument is inserted. If the parameter
56 name is adjacent to the token-pasting operator (<tt>'##'</tt>), the unexpanded
57 actual argument is inserted after all placeholder tokens are removed.</p>
58 <p>All concatenation takes place in the replacement list. (If a single concatenation
59 yields multiple tokens, the behavior is undefined. Moreover, <tt>Wave</tt> in
60 normal C++98 and C99 modes issues an error, if more then one token is produced
61 as the result of the concatenation. In C++0x mode <tt>Wave</tt> treats token-pasting
62 of unrelated tokens as well defined and inserts the reparsed string representation
63 of the concatenated tokens into the replacement list.).</p>
64 <p>The flag in the symbol table entry associated with the name of the macro being
65 expanded is set to indicate the that the macro is not available for expansion.</p>
66 <p>The replacement list is rescanned for further macro expansion. All leading
67 and trailing whitespace tokens in the replacement list are removed (the placeholder
68 tokens are left intact). </p>
69 <p>After rescanning completes, the flag in the symbol table entry associated with
70 the name of macro being expanded is cleared to indicate that the macro is again
71 available for expansion, and the sequence of tokens that constitutes the rescanned
72 replacement list is returned to the point of invocation of the macro.</p>
73 <p>If this sequence of tokens is empty, it is replaced by a placeholder token.
74 If a placeholder is found during scanning (or rescanning) it is ignored. (Also,
75 if the only thing separating a parameter from the stringizing operator or token-pasting
76 operator is placeholder, it is also ignored in that context.)</p>
77 <p>This sequence of tokens is inserted at the original point that the macro was
78 invoked, and scanning continues starting with the last token of the newly inserted
79 sequence of tokens. I.e. scanning looks back a single token (possibly a placeholder
80 token) and continues.<br>
81 </p>
82 <table border="0">
83 <tr>
84 <td width="10"></td>
85 <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
86 <td width="30"><a href="predefined_macros.html"><img src="theme/l_arr.gif" border="0"></a></td>
87 <td width="30"><a href="compiletime_config.html"><img src="theme/r_arr.gif" border="0"></a></td>
88 </tr>
89 </table>
90 <hr size="1">
91 <p class="copyright">Copyright &copy; 2003-2011 Hartmut Kaiser<br>
92 <br>
93 <font size="2">Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) </font> </p>
94 <span class="updated"></span>
95 <p class="copyright"><span class="updated">Last updated:
96 <!-- #BeginDate format:fcAm1m -->Sunday, May 15, 2005 12:23<!-- #EndDate -->
97 </span>
98 </p>
99 <p>&nbsp; </p>
100 </body>
101 </html>
102 <!-- #BeginDate format:fcAm1m -->Saturday, February 25, 2006 15:46<!-- #EndDate -->