vmd_data_types.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  4. <title>Data types</title>
  5. <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
  6. <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
  7. <link rel="home" href="../index.html" title="Chapter&#160;1.&#160;The Variadic Macro Data Library 1.9">
  8. <link rel="up" href="../index.html" title="Chapter&#160;1.&#160;The Variadic Macro Data Library 1.9">
  9. <link rel="prev" href="vmd_detail.html" title="Functional groups">
  10. <link rel="next" href="vmd_specific.html" title="Specific macros for working with data types">
  11. </head>
  12. <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
  13. <table cellpadding="2" width="100%"><tr>
  14. <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
  15. <td align="center"><a href="../../../../../index.html">Home</a></td>
  16. <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
  17. <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
  18. <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
  19. <td align="center"><a href="../../../../../more/index.htm">More</a></td>
  20. </tr></table>
  21. <hr>
  22. <div class="spirit-nav">
  23. <a accesskey="p" href="vmd_detail.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="vmd_specific.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
  24. </div>
  25. <div class="section">
  26. <div class="titlepage"><div><div><h2 class="title" style="clear: both">
  27. <a name="variadic_macro_data.vmd_data_types"></a><a class="link" href="vmd_data_types.html" title="Data types">Data types</a>
  28. </h2></div></div></div>
  29. <p>
  30. The VMD library has functionality for testing and parsing preprocessor data.
  31. </p>
  32. <p>
  33. The C++ preprocessor defines preprocessor data as preprocessing tokens. The
  34. types of preprocessing tokens can be seen in section 2.5 of the C++ standard
  35. document.
  36. </p>
  37. <p>
  38. The VMD library works with a subset of two of these types of preprocessor tokens
  39. as "data types". These are the "identifier" and "pp-number"
  40. preprocessor tokens. The preprocessor token types which VMD cannot parse are:
  41. </p>
  42. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  43. <li class="listitem">
  44. header-name
  45. </li>
  46. <li class="listitem">
  47. character-literal
  48. </li>
  49. <li class="listitem">
  50. user-defined-characteral-literal
  51. </li>
  52. <li class="listitem">
  53. string-literal
  54. </li>
  55. <li class="listitem">
  56. user-defined-string-literal
  57. </li>
  58. <li class="listitem">
  59. preprocessing-op-or-punc
  60. </li>
  61. </ul></div>
  62. <p>
  63. Even though VMD cannot parse these preprocessor token types, it is still a
  64. very useful library since a large part of macro programming works with 'identifier'
  65. and 'pp-number' tokens.
  66. </p>
  67. <p>
  68. VMD identifiers are preprocessing tokens consisting of alphanumeric characters
  69. and the underscore ( _ ) character. This is very similar to a preprocessor
  70. token "identifier" with the difference being that a VMD identifier
  71. can start with a numeric character, allowing VMD identifiers to also be positive
  72. integral literals. VMD offers functionality for parsing VMD identifiers both
  73. as a separate element or in a sequence of preprocessing tokens.
  74. </p>
  75. <p>
  76. VMD numbers are Boost PP numbers, ie. preprocessing tokens of whole numbers
  77. between 0 and 256 inclusive. These are a small subset of preprocessor token
  78. "pp-number". VMD offers functionality for parsing numbers both as
  79. a separate element or in a sequence of preprocessing tokens. A VMD number is
  80. really a subset of VMD identifiers for which VMD offers specific functionality.
  81. The Boost PP library has it own extensive support for numbers, which VMD does
  82. not duplicate.
  83. </p>
  84. <p>
  85. VMD v-types are, like numbers, a subset of VMD identifiers consisting of identifiers
  86. beginning with BOOST_VMD_TYPE_ followed by a data type mnemonic. Each v-type
  87. can be recognized by VMD functionality and therefore passed or returned by
  88. macros. Like any identifier a v-type can be parsed both as a separate element
  89. or in a sequence of preprocessing tokens.
  90. </p>
  91. <p>
  92. VMD can also test for emptiness, or the absence of any preprocessing tokens
  93. when passed as macro input.
  94. </p>
  95. <p>
  96. The Boost PP library supports four individual high-level data types. These
  97. are arrays, lists, seqs, and tuples. When using variadic macros arrays are
  98. really obsolete since tuples have all the functionality of arrays with a simpler
  99. syntax. Nonetheless arrays are fully supported by VMD. A further data type
  100. supported by Boost PP is variadic data, which is a comma separated grouping
  101. of preprocessor elements. VMD has no special support for variadic data outside
  102. of what is already in Boost PP.
  103. </p>
  104. <p>
  105. VMD has functionality to work with the four Boost PP high-level data types.
  106. VMD can test the Boost PP data types and parse them in a sequence of preprocessor
  107. tokens.
  108. </p>
  109. <p>
  110. VMD can also parse sequences. A sequence consists of zero or more other top-level
  111. data types already mentioned represented consecutively. As such a sequence
  112. represents any data type which VMD can parse since it can consist of emptiness,
  113. a single data type, or multiple data types represented consecutively.
  114. </p>
  115. <p>
  116. Emptiness, the three identifier types, the four Boost PP composite data types,
  117. and VMD sequences are the data types which VMD understands. Other low-level
  118. preprocessor data types can of course be used in macro programming but VMD
  119. cannot parse such preprocessor data.
  120. </p>
  121. </div>
  122. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  123. <td align="left"></td>
  124. <td align="right"><div class="copyright-footer">Copyright &#169; 2010-2017 Tropic Software
  125. East Inc</div></td>
  126. </tr></table>
  127. <hr>
  128. <div class="spirit-nav">
  129. <a accesskey="p" href="vmd_detail.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="vmd_specific.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
  130. </div>
  131. </body>
  132. </html>