Click here to Skip to main content
15,867,704 members
Articles / Programming Languages / C++

Wave: a Standard conformant C++ preprocessor library

Rate me:
Please Sign up or sign in to vote.
4.96/5 (58 votes)
10 Jan 200413 min read 393.1K   4.4K   81  
Describes a free and fully Standard conformant C++ preprocessor library
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Supported Pragma Directives</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="theme/style.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="100%" border="0" cellspacing="2" background="theme/bkd2.gif">
  <tr> 
    <td width="21"> <h1></h1></td>
    <td width="885"> <font face="Verdana, Arial, Helvetica, sans-serif"><b><font size="6">Supported 
      Pragma Directives</font></b></font></td>
    <td width="96"><a href="http://spirit.sf.net"><img src="theme/wave.gif" width="93" height="68" align="right" border="0"></a></td>
  </tr>
</table>
<br>
<table border="0">
  <tr> 
    <td width="10"></td>
    <td width="30"><a href="index.html"><img src="theme/u_arr.gif" border="0"></a></td>
    <td width="30"><a href="predefined_macros.html"><img src="theme/l_arr.gif" border="0"></a></td>
    <td width="20"><a href="macro_expansion_process.html"><img src="theme/r_arr.gif" border="0"></a></td>
  </tr>
</table>
<p>The Wave preprocessor library supports a couple of specific <tt>#pragma</tt> 
  directives, which may be used to control some of the library features. All directives 
  described here are usable as conventional <tt>#pragma</tt> directives and as 
  <tt>operator&nbsp;_Pragma</tt> (if variadics are enabled). So for instance the 
  following directives are functionally identical.</p>
<pre>    #pragma wave trace(enable)  </pre>
<p>and </p>
<pre>    _Pragma(&quot;wave trace(enable)&quot;)</pre>
<p>All <tt>Wave</tt> specific pragma's must have the general form <tt>'wave option[(value)]'</tt>, 
  where <tt>'wave'</tt> is the specific keyword, <tt>'option'</tt> is the concrete 
  pragma functionality to trigger and <tt>'value'</tt> is an optional value to 
  be supplied to the <tt>'option'</tt> functionality. The following table lists 
  all possible pragma functions supported by the <tt>Wave</tt> library. </p>
<table width="70%" border="0" align="center">
  <tr> 
    <td colspan="3"> <p class="table_title">Supported pragma's</p></td>
  </tr>
  <tr> 
    <td> <p class="toc_title" width="36%">pragma option</p></td>
    <td> <p class="toc_title" width="28%">pragma value</p></td>
    <td> <p class="toc_title" width="36%">description</p></td>
  </tr>
  <tr> 
    <td class="table_cells" width="20%"> <p>trace</p></td>
    <td class="table_cells"  width="17%"> <p>enable/disable<br>
        1/0</p></td>
    <td class="table_cells"  width="63%"><p>Enable or disable the tracing of the 
        macro expansion process. This is needed, even if there is given the --trace 
        command line option, because the trace output is generated only, if there 
        is at least one trace(enable) pragma found.</p></td>
  </tr>
  <tr> 
    <td class="table_cells"><p>stop</p></td>
    <td class="table_cells"><p>message</p></td>
    <td class="table_cells"><p>Stop the execution of <tt>Wave</tt> and print out 
        the given message. This is very helpful for direct debugging purposes.</p></td>
  </tr>
  <tr>
    <td class="table_cells"><p>system</p></td>
    <td class="table_cells"><p>command</p></td>
    <td class="table_cells"><p>Try to spawn the 'command' as a new operating system 
        command and intercept the generated stdout and stderr. The stdout output 
        of this command (if any) is retokenized and used as the replacement text 
        for the whole pragma, the stderr output is ignored. The command is considered 
        to be successful, if/when the return value is zero, otherwise an error 
        is reported. <br>
      </p></td>
  </tr>
</table>
<p>All pragma's not listed here but flagged as <tt>'wave'</tt> are reported as 
  errors. The handling of all remaining pragma's depends on the compilation constant 
  <code><tt>WAVE_RETURN_PRAGMA_DIRECTIVES</tt></code>, which allows to specify, 
  if those pragmas are left unchanged in the output stream or not. Please note, 
  that the operator _Pragma variant is always subject to full preprocessing, before 
  the pragma itself is evaluated. The #pragma variant is subject to preprocessing 
  only, if the <code><tt>WAVE_PREPROCESS_PRAGMA_BODY</tt></code> compilation constant 
  was specified during compilation.For more information about the possible compilation 
  constants look <a href="compiletime_config.html">here</a>.</p>
<table border="0">
  <tr> 
    <td width="10"></td>
    <td width="30"><a href="./index.html"><img src="theme/u_arr.gif" border="0"></a></td>
    <td width="30"><a href="predefined_macros.html"><img src="theme/l_arr.gif" border="0"></a></td>
    <td width="20"><a href="macro_expansion_process.html"><img src="theme/r_arr.gif" border="0"></a></td>
  </tr>
</table>
<hr size="1">
<p class="copyright">Copyright &copy; 2003 Hartmut Kaiser<br>
  <br>
  <font size="2">Permission to copy, use, modify, sell and distribute this document 
  is granted provided this copyright notice appears in all copies. This document 
  is provided &quot;as is&quot; without express or implied warranty, and with 
  no claim as to its suitability for any purpose. </font> </p>
<span class="updated">Last updated: 
<!-- #BeginDate format:fcAm1m -->Tuesday, April 29, 2003  19:58<!-- #EndDate -->
</span>
<p>&nbsp;</p>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
Actively involved in Boost and the development of the Spirit parser construction framework.

Comments and Discussions