<!DOCTYPE LINUXDOC SYSTEM>

<!-- This SGML file generated by cxref. -->
<!-- cxref program (c) Andrew M. Bishop 1995,96,97,98. -->

<article>

<title>Cross reference for preproc.c of cxref.
<author>cxref

<sect>File preproc.c
<bf>RCS Header: /home/amb/cxref/RCS/preproc.c 1.16 1999/01/24 16:53:49 amb Exp </bf>
<p>

  C Cross Referencing &amp; Documentation tool. Version 1.5.
<newline>
  Collects the pre-processing instruction stuff.
<p>

<sect1>Included Files

<p>
<itemize>
<item><tt>#include &lt;stdlib.h&gt;</tt>
</itemize>
<itemize>
<item><tt>#include &lt;stdio.h&gt;</tt>
</itemize>
<itemize>
<item><tt>#include &lt;string.h&gt;</tt>
</itemize>
<itemize>
<item><tt>#include &lt;unistd.h&gt;</tt>
</itemize>
<itemize>
<item><tt>#include &lt;sys/stat.h&gt;</tt>
</itemize>
<itemize>
<item><tt>#include &quot;memory.h&quot;</tt>
</itemize>
<itemize>
<item><tt>#include &quot;datatype.h&quot;</tt>
</itemize>
<itemize>
<item><tt>#include &quot;parse-yy.h&quot;</tt>
<itemize>
<item><tt>#include &lt;stdio.h&gt;</tt>
<item><tt>#include &lt;stdlib.h&gt;</tt>
</itemize>
</itemize>
<itemize>
<item><tt>#include &quot;cxref.h&quot;</tt>
<itemize>
<item><tt>#include &quot;datatype.h&quot;</tt>
</itemize>
</itemize>

<sect1>Preprocessor definitions

<p>
 Control the output of debugging information for this file. 
<p>
<tt>#define DEBUG 0</tt><newline>

<sect1>Global Variable in_header

<p>
 When in a header file, this is set to 1, to allow most of the stuff to be skipped. 
<p>
<tt>int in_header</tt><newline>
<descrip>
<tag>Visible in:</tag>
<itemize>
<item>func.c
<item>parse-lex.c
<item>parse-yacc.c
<item>preproc.c
<item>var.c
</itemize>
<tag>Used in:</tag>
<itemize>
<item>ResetPreProcAnalyser()  :  preproc.c
<item>SeenFileChange()  :  preproc.c
<item>SeenFunctionDeclaration()  :  func.c
<item>SeenVariableDefinition()  :  var.c
<item>yylex()  :  parse-lex.c
<item>yyparse()  :  parse-yacc.c
</itemize>
</descrip>

<sect1>External Variables

<p>
<bf>CurFile</bf><newline>
 The file that is currently being processed. 
<p>
<tt>extern File CurFile</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>CurFile</itemize>
</descrip>
<p>
<bf>option_incdirs</bf><newline>
 The name of the include directories specified on the command line. 
<p>
<tt>extern char** option_incdirs</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>option_incdirs</itemize>
</descrip>
<p>
<bf>option_nincdirs</bf><newline>
 The number of include directories on the command line. 
<p>
<tt>extern int option_nincdirs</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>option_nincdirs</itemize>
</descrip>

<sect1>Local Variables

<p>
<bf>cur_inc</bf><newline>
 The current &num;include we are looking at. 
<p>
<tt>static Include cur_inc</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetPreProcAnalyser()
<item>SeenFileChange()
<item>SeenInclude()
<item>SeenIncludeComment()
</itemize>
</descrip>
<p>
<bf>cur_def</bf><newline>
 The current &num;define we are looking at. 
<p>
<tt>static Define cur_def</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetPreProcAnalyser()
<item>SeenDefine()
<item>SeenDefineComment()
<item>SeenDefineFuncArgComment()
<item>SeenDefineFunctionArg()
<item>SeenDefineValue()
</itemize>
</descrip>
<p>
<bf>inc_depth</bf><newline>
 The depth of includes. 
<p>
<tt>static int inc_depth</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetPreProcAnalyser()
<item>SeenFileChange()
<item>SeenInclude()
</itemize>
</descrip>
<p>
<bf>inc_type</bf><newline>
 The type of include at this depth. 
<p>
<tt>static char* inc_type</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetPreProcAnalyser()
<item>SeenFileChange()
<item>SeenInclude()
</itemize>
</descrip>
<p>
<bf>cwd</bf><newline>
 The working directory. 
<p>
<tt>static char* cwd</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetPreProcAnalyser()
<item>SeenFileChange()
</itemize>
</descrip>

<sect1>Global Function DeleteDefineType()

<p>  Delete the specified Define type.
<p>
<tt>void DeleteDefineType ( Define def )</tt><newline>
<descrip>
<tag><tt>Define def</tt></tag>
The Define type to be deleted.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>DeleteStringList2()  :  slist.c
<item>SafeFree()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>DeleteFile()  :  file.c
</itemize>
</descrip>

<sect1>Global Function DeleteIncludeType()

<p>  Delete the specified Include type.
<p>
<tt>void DeleteIncludeType ( Include inc )</tt><newline>
<descrip>
<tag><tt>Include inc</tt></tag>
The Include type to be deleted.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>DeleteIncludeType()  :  preproc.c
<item>SafeFree()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>DeleteFile()  :  file.c
<item>DeleteIncludeType()  :  preproc.c
</itemize>
</descrip>

<sect1>Global Function ResetPreProcAnalyser()

<p>  Tidy up all of the local variables in case of a problem and abnormal parser termination.
<p>
<tt>void ResetPreProcAnalyser ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>SafeFree()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>main()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_def  :  preproc.c
<item>cur_inc  :  preproc.c
<item>cwd  :  preproc.c
<item>in_header  :  preproc.c
<item>inc_depth  :  preproc.c
<item>inc_type  :  preproc.c
</itemize>
</descrip>

<sect1>Global Function SeenDefine()

<p>  Function that is called when a &num;define is seen in the current file.
<p>
<tt>void SeenDefine ( char* name )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the &num;defined symbol.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>GetCurrentComment()  :  comment.c
<item>NewDefineType()  :  preproc.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>CurFile  :  cxref.c
<item>cur_def  :  preproc.c
<item>parse_line  :  parse-lex.c
</itemize>
</descrip>

<sect1>Global Function SeenDefineComment()

<p>  Function that is called when a comment is seen in a &num;define definition.
<p>
<tt>void SeenDefineComment ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>GetCurrentComment()  :  comment.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_def  :  preproc.c
</itemize>
</descrip>

<sect1>Global Function SeenDefineFuncArgComment()

<p>  Function that is called when a comment is seen in a &num;define function definition.
<p>
<tt>void SeenDefineFuncArgComment ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>GetCurrentComment()  :  comment.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_def  :  preproc.c
</itemize>
</descrip>

<sect1>Global Function SeenDefineFunctionArg()

<p>  Function that is called when a &num;define function argument is seen in the current definition.
<p>
<tt>void SeenDefineFunctionArg ( char* name )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The argument.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>AddToStringList2()  :  slist.c
<item>SplitComment()  :  comment.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_def  :  preproc.c
</itemize>
</descrip>

<sect1>Global Function SeenDefineValue()

<p>  Function that is called when a &num;define value is seen in the current file.
<p>
<tt>void SeenDefineValue ( char* value )</tt><newline>
<descrip>
<tag><tt>char* value</tt></tag>
The value of the &num;defined symbol.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_def  :  preproc.c
</itemize>
</descrip>

<sect1>Global Function SeenFileChange()

<p>  Function that is called when a change in current file is seen.
<p>
<tt>void SeenFileChange ( char* name, int flag )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The pathname of the included file as determined by gcc.
<tag><tt>int flag</tt></tag>
The flags that GCC leaves in the file
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>CanonicaliseName()  :  cxref.c
<item>ConcatStrings()  :  memory.c
<item>SafeFree()  :  memory.c
<item>SafeMalloc()  :  memory.c
<item>SafeMallocString()  :  memory.c
<item>SafeRealloc()  :  memory.c
<item>SeenInclude()  :  preproc.c
<item>SetCurrentComment()  :  comment.c
<item>getcwd(), strlen(), strncmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_inc  :  preproc.c
<item>cwd  :  preproc.c
<item>in_header  :  preproc.c
<item>inc_depth  :  preproc.c
<item>inc_type  :  preproc.c
</itemize>
</descrip>

<sect1>Global Function SeenInclude()

<p>  Function that is called when an included file is seen in the current file.
<p>
<tt>void SeenInclude ( char* name )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the file from the source code.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>CanonicaliseName()  :  cxref.c
<item>ConcatStrings()  :  memory.c
<item>GetCurrentComment()  :  comment.c
<item>NewIncludeType()  :  preproc.c
<item>SafeMallocString()  :  memory.c
<item>lstat(), strlen()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>SeenFileChange()  :  preproc.c
<item>yylex()  :  parse-lex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>CurFile  :  cxref.c
<item>cur_inc  :  preproc.c
<item>inc_depth  :  preproc.c
<item>inc_type  :  preproc.c
<item>option_incdirs  :  cxref.c
<item>option_nincdirs  :  cxref.c
</itemize>
</descrip>

<sect1>Global Function SeenIncludeComment()

<p>  Function that is called when a comment is seen following a &num;include.
<p>
<tt>void SeenIncludeComment ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>GetCurrentComment()  :  comment.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_inc  :  preproc.c
</itemize>
</descrip>

<sect1>Local Function NewDefineType()

<p>  Create a new Define datatype.
<p>
<tt>static Define NewDefineType ( char* name )</tt><newline>
<descrip>
<tag><tt>Define NewDefineType</tt></tag>
Return the new Define type.
<tag><tt>char* name</tt></tag>
The name of the new define.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>preproc.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>NewStringList2()  :  slist.c
<item>SafeCalloc()  :  memory.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>SeenDefine()  :  preproc.c
</itemize>
</descrip>

<sect1>Local Function NewIncludeType()

<p>  Create a new Include datatype.
<p>
<tt>static Include NewIncludeType ( char* name )</tt><newline>
<descrip>
<tag><tt>Include NewIncludeType</tt></tag>
Return the new Include type.
<tag><tt>char* name</tt></tag>
The name of the new include.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>preproc.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>SafeCalloc()  :  memory.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>SeenInclude()  :  preproc.c
</itemize>
</descrip>

</article>
