supported_pragmas.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>Supported Pragma Directives</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. <body>
  9. <table width="100%" border="0" cellspacing="2" background="theme/bkd2.gif">
  10. <tr>
  11. <td width="21"> <h1></h1></td>
  12. <td width="885"> <font face="Verdana, Arial, Helvetica, sans-serif"><b><font size="6">Supported
  13. Pragma Directives</font></b></font></td>
  14. <td width="96"><a href="http://www.boost.org"><img src="theme/wave.gif" width="93" height="68" align="right" border="0"></a></td>
  15. </tr>
  16. </table>
  17. <br>
  18. <table border="0">
  19. <tr>
  20. <td width="10"></td>
  21. <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
  22. <td width="30"><a href="tracing_facility.html"><img src="theme/l_arr.gif" border="0"></a></td>
  23. <td width="30"><a href="acknowledgements.html"><img src="theme/r_arr.gif" border="0"></a></td>
  24. </tr>
  25. </table>
  26. <blockquote>
  27. <p><a href="supported_pragmas.html#library_pragmas">Pragma directives supported by the Wave library</a><br>
  28. <a href="supported_pragmas.html#tool_pragmas">Pragma directives supported by the Wave tool</a></p>
  29. </blockquote>
  30. <h2><a name="library_pragmas"></a>Pragma directives supported by the Wave library </h2>
  31. <p>The <tt>Wave</tt> preprocessor library natively supports the <span class="preprocessor">#pragma&nbsp;once</span> and <span class="preprocessor">#pragma&nbsp;message(&quot;...&quot;)</span> directives. </p>
  32. <p>The <span class="preprocessor">#pragma&nbsp;once</span> directive specifies that the file in which the pragma resides will be included
  33. (opened) only once. This may be used to optimize
  34. the preprocessing of larger compilation units, which include a lot of files. Note though, that the <span class="preprocessor">#pragma&nbsp;once</span> directive is supported only, if the compile time constant <tt>BOOST_WAVE_SUPPORT_PRAGMA_ONCE</tt> was given during compilation of the library.</p>
  35. <p>The <span class="preprocessor">#pragma&nbsp;message(...)</span> directive generates a remark containing the given message text. This may be useful to generate status messages directly from the preprocessed file. Note though, that the #pragma message(...) directive is supported only, if the compile time constant <tt>BOOST_WAVE_SUPPORT_PRAGMA_MESSAGE</tt> was given during the compilation of the library. Note additionally, that the body of the message is preprocessed whenever the <tt>BOOST_WAVE_PREPROCESS_PRAGMA_BODY</tt> compile time constant was defined during compilation of the library. </p>
  36. <h2><a name="tool_pragmas"></a>Pragma directives supported by the Wave tool</h2>
  37. <p>The Wave preprocessor tool additionally supports specific <span class="preprocessor">#pragma</span> directives, which may be used to control some of the tools features. These <span class="preprocessor">#pragma</span> directives are implemented using the <tt>interpret_pragma()</tt> preprocessing hook (see <a href="class_reference_ctxpolicy.html#interpret_pragma">here</a>).</p>
  38. <p>All directives
  39. described here are usable as conventional <span class="preprocessor">#pragma</span> directives and as <span class="preprocessor">operator&nbsp;_Pragma</span> (if variadics are enabled). So for instance the
  40. following directives are functionally identical:</p>
  41. <pre> #pragma wave trace(enable) </pre>
  42. <p>and </p>
  43. <pre> _Pragma(&quot;wave trace(enable)&quot;)</pre>
  44. <p>All <tt>Wave</tt> specific pragma's must have the general form <tt>'wave option[(value)]'</tt>,
  45. where <tt>'wave'</tt> is the specific keyword (which may be configured through the <tt>BOOST_WAVE_PRAGMA_KEYWORD</tt> compile time constant, see <a href="compiletime_config.html">here</a> for more information), <tt>'option'</tt> is the concrete
  46. pragma functionality to trigger and <tt>'value'</tt> is an optional value to
  47. be supplied to the <tt>'option'</tt> functionality. The following table lists
  48. all possible pragma functions supported by the <tt>Wave</tt> library. For all recognised pragmas of this general form the interpret_pragma hook function from inside the <a href="class_reference_ctxpolicy.html">preprocessing_hooks</a> policy are called, so that the user of the library is responsible for the correct interpretation of these pragma's. </p>
  49. <table width="77%" border="0" align="center">
  50. <tr>
  51. <td colspan="3"> <p class="table_title">Supported pragma's</p></td>
  52. </tr>
  53. <tr>
  54. <td> <p class="toc_title" width="36%">pragma option</p></td>
  55. <td> <p class="toc_title" width="28%">pragma value</p></td>
  56. <td> <p class="toc_title" width="36%">description</p></td>
  57. </tr>
  58. <tr>
  59. <td class="table_cells" width="15%"> <p>trace</p></td>
  60. <td class="table_cells" width="31%"> <p>enable/on/1<br>
  61. disable/off/0</p></td>
  62. <td class="table_cells" width="54%"><p>Enable or disable the tracing of the
  63. macro expansion process. This is needed, even if there is given the --trace
  64. command line option, because the trace output is generated only, if there
  65. is at least one trace(enable) pragma found.</p></td>
  66. </tr>
  67. <tr>
  68. <td class="table_cells"><p>stop</p></td>
  69. <td class="table_cells"><p>message</p></td>
  70. <td class="table_cells"><p>Stop the execution of <tt>Wave</tt> and print out
  71. the given message. This is very helpful for direct debugging purposes.</p></td>
  72. </tr>
  73. <tr>
  74. <td class="table_cells"><p>system</p></td>
  75. <td class="table_cells"><p>command</p></td>
  76. <td class="table_cells"><p>Try to spawn the 'command' as a new operating system
  77. command and intercept the generated stdout and stderr. The stdout output
  78. of this command (if any) is retokenized and used as the replacement text
  79. for the whole pragma, the stderr output is ignored. The command is considered
  80. to be successful, if/when the return value is zero, otherwise an error
  81. is reported. <br>
  82. This <span class="preprocessor">#pragma</span> is available only if the command line option -x is specified. The <tt>Wave</tt> driver will issue a remark if this command line argument is not specified and a <span class="preprocessor">#pragma&nbsp;wave&nbsp;system()</span> directive is encountered<br>
  83. </p></td>
  84. </tr>
  85. <tr>
  86. <td class="table_cells"><p>timer</p></td>
  87. <td class="table_cells"><p> restart/0<br>
  88. &lt;no value&gt; <br>
  89. suspend<br>
  90. resume </p></td>
  91. <td class="table_cells"><p>The value <tt>restart</tt> set the current elapsed
  92. time to 0 and restarts the timer.</p>
  93. <p> If no value is provided, the current elapsed time is printed to the std::cerr
  94. stream. </p>
  95. <p>The values <tt>suspend</tt> and <tt>resume</tt> allow to temporarily stop
  96. and resume the timing.</p></td>
  97. </tr>
  98. <tr>
  99. <td class="table_cells"><p>option</p></td>
  100. <td class="table_cells"><p>line: [0 | 1 | push | pop]<br>
  101. preserve: [0 | 1 | 2 | push | pop]<br>
  102. output: [&quot;filename&quot; | null | default | push | pop]
  103. </p>
  104. </td>
  105. <td class="table_cells"><p>The <tt>option(line: ...)</tt> directive allows to control, whether <span class="preprocessor">#line</span> directives will be generated in the output stream. Specify either '0' or '1' as the option parameter. All other values will be flaged as illegal. </p>
  106. <p>The <tt>option(preserve: ...)</tt> directive allows to control the amount of whitespace generated in the output stream. The value '0' removes any not needed whitespace, the value '1' keeps comments only and the value '2' does not remove any whitespace.</p>
  107. <p>The <tt>option(output: ...)</tt> directive allows to specify the name of the file, where the output is generated to. Specify either a valid filename (which will be interpreted relative to directory of the processed file), the value <tt>null</tt> to disable the output at all, or the value <tt>default</tt> to use the output as specified on the command line using the --output/-o option. </p>
  108. <p>The pragma values <tt>push</tt> and <tt>pop</tt> may be used for all of the options (<tt>line</tt>, <tt>preserve</tt> and <tt>output</tt>) to store and restore the current value of the corresponding option. </p></td>
  109. </tr>
  110. </table>
  111. <p>All pragma's not listed here but flagged as <tt>'wave'</tt> are currently reported as
  112. errors. The handling of all remaining pragma's depends on the compilation constant
  113. <code><tt>BOOST_WAVE_RETURN_PRAGMA_DIRECTIVES</tt></code>, which allows to specify,
  114. if those pragmas are left unchanged in the output stream or not. Please note,
  115. that the operator _Pragma variant is always subject to full preprocessing, before
  116. the pragma itself is evaluated. The #pragma variant is subject to preprocessing
  117. only, if the <code><tt>BOOST_WAVE_PREPROCESS_PRAGMA_BODY</tt></code> compilation constant
  118. was specified during compilation. For more information about the possible compilation
  119. constants look <a href="compiletime_config.html">here</a>.</p>
  120. <p>It is fairly easy to implement your own <span class="preprocessor">#pragma&nbsp;wave&nbsp;...</span> directives. All you have to do is to implement your own <tt>interpret_pragma</tt> preprocessing hook function (see <a href="class_reference_ctxpolicy.html#interpret_pragma">here</a>) which should handle the additional directives. For an example of how to do it, you may have a look at the Wave driver application, which implements all of the pragma's listed above with the help of a supplied <tt>interpret_pragma</tt> function (for instance the <span class="preprocessor">#pragma wave timer()</span> directive). </p>
  121. <table border="0">
  122. <tr>
  123. <td width="10"></td>
  124. <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
  125. <td width="30"><a href="tracing_facility.html"><img src="theme/l_arr.gif" border="0"></a></td>
  126. <td width="30"><a href="acknowledgements.html"><img src="theme/r_arr.gif" border="0"></a></td>
  127. </tr>
  128. </table>
  129. <hr size="1">
  130. <p class="copyright">Copyright &copy; 2003-2011 Hartmut Kaiser<br>
  131. <br>
  132. <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>
  133. <span class="updated"></span>
  134. <p class="copyright"><span class="updated">Last updated:
  135. <!-- #BeginDate format:fcAm1m -->Thursday, January 11, 2007 20:14<!-- #EndDate -->
  136. </span>
  137. </p>
  138. <p>&nbsp;</p>
  139. </body>
  140. </html>