Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

178 rindas
10KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>Top (The GNU C Preprocessor Internals)</title>
  7. <meta name="description" content="Top (The GNU C Preprocessor Internals)">
  8. <meta name="keywords" content="Top (The GNU C Preprocessor Internals)">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <link href="#Top" rel="start" title="Top">
  13. <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
  14. <link href="#SEC_Contents" rel="contents" title="Table of Contents">
  15. <link href="../dir/index.html" rel="up" title="(dir)">
  16. <link href="Conventions.html#Conventions" rel="next" title="Conventions">
  17. <style type="text/css">
  18. <!--
  19. a.summary-letter {text-decoration: none}
  20. blockquote.indentedblock {margin-right: 0em}
  21. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  22. blockquote.smallquotation {font-size: smaller}
  23. div.display {margin-left: 3.2em}
  24. div.example {margin-left: 3.2em}
  25. div.lisp {margin-left: 3.2em}
  26. div.smalldisplay {margin-left: 3.2em}
  27. div.smallexample {margin-left: 3.2em}
  28. div.smalllisp {margin-left: 3.2em}
  29. kbd {font-style: oblique}
  30. pre.display {font-family: inherit}
  31. pre.format {font-family: inherit}
  32. pre.menu-comment {font-family: serif}
  33. pre.menu-preformatted {font-family: serif}
  34. pre.smalldisplay {font-family: inherit; font-size: smaller}
  35. pre.smallexample {font-size: smaller}
  36. pre.smallformat {font-family: inherit; font-size: smaller}
  37. pre.smalllisp {font-size: smaller}
  38. span.nolinebreak {white-space: nowrap}
  39. span.roman {font-family: initial; font-weight: normal}
  40. span.sansserif {font-family: sans-serif; font-weight: normal}
  41. ul.no-bullet {list-style: none}
  42. -->
  43. </style>
  44. </head>
  45. <body lang="en">
  46. <h1 class="settitle" align="center">The GNU C Preprocessor Internals</h1>
  47. <a name="SEC_Contents"></a>
  48. <h2 class="contents-heading">Table of Contents</h2>
  49. <div class="contents">
  50. <ul class="no-bullet">
  51. <li><a name="toc-Cpplib_002d_002d_002dthe-GNU-C-Preprocessor" href="#Cpplib_002d_002d_002dthe-GNU-C-Preprocessor">1 Cpplib&mdash;the GNU C Preprocessor</a></li>
  52. <li><a name="toc-Conventions-1" href="Conventions.html#Conventions">Conventions</a></li>
  53. <li><a name="toc-The-Lexer" href="Lexer.html#Lexer">The Lexer</a>
  54. <ul class="no-bullet">
  55. <li><a name="toc-Overview" href="Lexer.html#Overview">Overview</a></li>
  56. <li><a name="toc-Lexing-a-token" href="Lexer.html#Lexing-a-token">Lexing a token</a></li>
  57. <li><a name="toc-Lexing-a-line-1" href="Lexer.html#Lexing-a-line-1">Lexing a line</a></li>
  58. </ul></li>
  59. <li><a name="toc-Hash-Nodes-1" href="Hash-Nodes.html#Hash-Nodes">Hash Nodes</a></li>
  60. <li><a name="toc-Macro-Expansion-Algorithm" href="Macro-Expansion.html#Macro-Expansion">Macro Expansion Algorithm</a>
  61. <ul class="no-bullet">
  62. <li><a name="toc-Internal-representation-of-macros" href="Macro-Expansion.html#Internal-representation-of-macros">Internal representation of macros</a></li>
  63. <li><a name="toc-Macro-expansion-overview" href="Macro-Expansion.html#Macro-expansion-overview">Macro expansion overview</a></li>
  64. <li><a name="toc-Scanning-the-replacement-list-for-macros-to-expand" href="Macro-Expansion.html#Scanning-the-replacement-list-for-macros-to-expand">Scanning the replacement list for macros to expand</a></li>
  65. <li><a name="toc-Looking-for-a-function_002dlike-macro_0027s-opening-parenthesis" href="Macro-Expansion.html#Looking-for-a-function_002dlike-macro_0027s-opening-parenthesis">Looking for a function-like macro&rsquo;s opening parenthesis</a></li>
  66. <li><a name="toc-Marking-tokens-ineligible-for-future-expansion" href="Macro-Expansion.html#Marking-tokens-ineligible-for-future-expansion">Marking tokens ineligible for future expansion</a></li>
  67. </ul></li>
  68. <li><a name="toc-Token-Spacing-1" href="Token-Spacing.html#Token-Spacing">Token Spacing</a></li>
  69. <li><a name="toc-Line-numbering" href="Line-Numbering.html#Line-Numbering">Line numbering</a>
  70. <ul class="no-bullet">
  71. <li><a name="toc-Just-which-line-number-anyway_003f" href="Line-Numbering.html#Just-which-line-number-anyway_003f">Just which line number anyway?</a></li>
  72. <li><a name="toc-Representation-of-line-numbers" href="Line-Numbering.html#Representation-of-line-numbers">Representation of line numbers</a></li>
  73. </ul></li>
  74. <li><a name="toc-The-Multiple_002dInclude-Optimization" href="Guard-Macros.html#Guard-Macros">The Multiple-Include Optimization</a></li>
  75. <li><a name="toc-File-Handling" href="Files.html#Files">File Handling</a></li>
  76. <li><a name="toc-Concept-Index-1" href="Concept-Index.html#Concept-Index">Concept Index</a></li>
  77. </ul>
  78. </div>
  79. <a name="Top"></a>
  80. <div class="header">
  81. <p>
  82. Next: <a href="Conventions.html#Conventions" accesskey="n" rel="next">Conventions</a>, Up: <a href="../dir/index.html" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  83. </div>
  84. <hr>
  85. <a name="SEC_Top"></a>
  86. <table class="menu" border="0" cellspacing="0">
  87. <tr><td align="left" valign="top">&bull; <a href="Conventions.html#Conventions" accesskey="1">Conventions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  88. </td></tr>
  89. <tr><td align="left" valign="top">&bull; <a href="Lexer.html#Lexer" accesskey="2">Lexer</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  90. </td></tr>
  91. <tr><td align="left" valign="top">&bull; <a href="Hash-Nodes.html#Hash-Nodes" accesskey="3">Hash Nodes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  92. </td></tr>
  93. <tr><td align="left" valign="top">&bull; <a href="Macro-Expansion.html#Macro-Expansion" accesskey="4">Macro Expansion</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  94. </td></tr>
  95. <tr><td align="left" valign="top">&bull; <a href="Token-Spacing.html#Token-Spacing" accesskey="5">Token Spacing</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  96. </td></tr>
  97. <tr><td align="left" valign="top">&bull; <a href="Line-Numbering.html#Line-Numbering" accesskey="6">Line Numbering</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  98. </td></tr>
  99. <tr><td align="left" valign="top">&bull; <a href="Guard-Macros.html#Guard-Macros" accesskey="7">Guard Macros</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  100. </td></tr>
  101. <tr><td align="left" valign="top">&bull; <a href="Files.html#Files" accesskey="8">Files</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  102. </td></tr>
  103. <tr><td align="left" valign="top">&bull; <a href="Concept-Index.html#Concept-Index" accesskey="9">Concept Index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
  104. </td></tr>
  105. </table>
  106. <a name="Cpplib_002d_002d_002dthe-GNU-C-Preprocessor"></a>
  107. <h2 class="chapter">1 Cpplib&mdash;the GNU C Preprocessor</h2>
  108. <p>The GNU C preprocessor is
  109. implemented as a library, <em>cpplib</em>, so it can be easily shared between
  110. a stand-alone preprocessor, and a preprocessor integrated with the C,
  111. C++ and Objective-C front ends. It is also available for use by other
  112. programs, though this is not recommended as its exposed interface has
  113. not yet reached a point of reasonable stability.
  114. </p>
  115. <p>The library has been written to be re-entrant, so that it can be used
  116. to preprocess many files simultaneously if necessary. It has also been
  117. written with the preprocessing token as the fundamental unit; the
  118. preprocessor in previous versions of GCC would operate on text strings
  119. as the fundamental unit.
  120. </p>
  121. <p>This brief manual documents the internals of cpplib, and explains some
  122. of the tricky issues. It is intended that, along with the comments in
  123. the source code, a reasonably competent C programmer should be able to
  124. figure out what the code is doing, and why things have been implemented
  125. the way they have.
  126. </p>
  127. <table class="menu" border="0" cellspacing="0">
  128. <tr><td align="left" valign="top">&bull; <a href="Conventions.html#Conventions" accesskey="1">Conventions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Conventions used in the code.
  129. </td></tr>
  130. <tr><td align="left" valign="top">&bull; <a href="Lexer.html#Lexer" accesskey="2">Lexer</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">The combined C, C++ and Objective-C Lexer.
  131. </td></tr>
  132. <tr><td align="left" valign="top">&bull; <a href="Hash-Nodes.html#Hash-Nodes" accesskey="3">Hash Nodes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">All identifiers are entered into a hash table.
  133. </td></tr>
  134. <tr><td align="left" valign="top">&bull; <a href="Macro-Expansion.html#Macro-Expansion" accesskey="4">Macro Expansion</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Macro expansion algorithm.
  135. </td></tr>
  136. <tr><td align="left" valign="top">&bull; <a href="Token-Spacing.html#Token-Spacing" accesskey="5">Token Spacing</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Spacing and paste avoidance issues.
  137. </td></tr>
  138. <tr><td align="left" valign="top">&bull; <a href="Line-Numbering.html#Line-Numbering" accesskey="6">Line Numbering</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Tracking location within files.
  139. </td></tr>
  140. <tr><td align="left" valign="top">&bull; <a href="Guard-Macros.html#Guard-Macros" accesskey="7">Guard Macros</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Optimizing header files with guard macros.
  141. </td></tr>
  142. <tr><td align="left" valign="top">&bull; <a href="Files.html#Files" accesskey="8">Files</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">File handling.
  143. </td></tr>
  144. <tr><td align="left" valign="top">&bull; <a href="Concept-Index.html#Concept-Index" accesskey="9">Concept Index</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Index.
  145. </td></tr>
  146. </table>
  147. <hr>
  148. <div class="header">
  149. <p>
  150. Next: <a href="Conventions.html#Conventions" accesskey="n" rel="next">Conventions</a>, Up: <a href="../dir/index.html" accesskey="u" rel="up">(dir)</a> &nbsp; [<a href="#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
  151. </div>
  152. </body>
  153. </html>