<!DOCTYPE LINUXDOC SYSTEM>

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

<article>

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

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

  C Cross Referencing &amp; Documentation tool. Version 1.5.
<newline>
  Collects the variable definition 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 &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 from this file. 
<p>
<tt>#define DEBUG 0</tt><newline>

<sect1>External Variables

<p>
<bf>CurFile</bf><newline>
 The file that is currently being documented. 
<p>
<tt>extern File CurFile</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>CurFile</itemize>
</descrip>
<p>
<bf>in_header</bf><newline>
 When in a header file make a note of which one for the included variables. 
<p>
<tt>extern int in_header</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>in_header</itemize>
</descrip>

<sect1>Local Variables

<p>
<bf>variable</bf><newline>
 A list of the variables found at each level of the scope. 
<p>
<tt>static StringList2* variable</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>DownScope()
<item>IsAScopeVariable()
<item>ResetVariableAnalyser()
<item>SeenScopeVariable()
<item>UpScope()
</itemize>
</descrip>
<p>
<bf>max_scope</bf><newline>
 The number of levels of scope depth allocated. 
<p>
<tt>static int max_scope</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetVariableAnalyser()
<item>UpScope()
</itemize>
</descrip>
<p>
<bf>cur_scope</bf><newline>
 The current scope depth. 
<p>
<tt>static int cur_scope</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>DownScope()
<item>IsAScopeVariable()
<item>ResetVariableAnalyser()
<item>SeenScopeVariable()
<item>UpScope()
</itemize>
</descrip>

<sect1>Global Function DeleteVariableType()

<p>  Delete the specified Variable type.
<p>
<tt>void DeleteVariableType ( Variable var )</tt><newline>
<descrip>
<tag><tt>Variable var</tt></tag>
The Variable 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 DownScope()

<p>  Called when an old scope is exited.
<p>
<tt>void DownScope ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>DeleteStringList2()  :  slist.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_scope  :  var.c
<item>variable  :  var.c
</itemize>
</descrip>

<sect1>Global Function IsAScopeVariable()

<p>  Check through the scope variables to look for the named one.
<p>
<tt>int IsAScopeVariable ( char* name )</tt><newline>
<descrip>
<tag><tt>int IsAScopeVariable</tt></tag>
Returns 1 if the name does refer to a variable that is scoped.
<tag><tt>char* name</tt></tag>
The name of the variable to search for.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>strcmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>CheckFunctionVariableRef()  :  func.c
<item>yylex()  :  parse-lex.c
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_scope  :  var.c
<item>variable  :  var.c
</itemize>
</descrip>

<sect1>Global Function ResetVariableAnalyser()

<p>  Tidy up all of the local variables in case of a problem and abnormal parser termination.
<p>
<tt>void ResetVariableAnalyser ( void )</tt><newline>
<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>main()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_scope  :  var.c
<item>max_scope  :  var.c
<item>variable  :  var.c
</itemize>
</descrip>

<sect1>Global Function SeenScopeVariable()

<p>  Add a variable to the list of known variables.
<p>
<tt>void SeenScopeVariable ( char* name )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the variable.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>AddToStringList2()  :  slist.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_scope  :  var.c
<item>variable  :  var.c
</itemize>
</descrip>

<sect1>Global Function SeenVariableDefinition()

<p>  Function that is called when a variable definition is seen.
<p>
<tt>void SeenVariableDefinition ( char* name, char* type, int scope )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the variable.
<tag><tt>char* type</tt></tag>
The type of the variable.
<tag><tt>int scope</tt></tag>
The scope of variable that has been seen.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>GetCurrentComment()  :  comment.c
<item>NewVariableType()  :  var.c
<item>SafeFree()  :  memory.c
<item>SafeMallocString()  :  memory.c
<item>strcmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>CurFile  :  cxref.c
<item>in_header  :  preproc.c
<item>parse_file  :  parse-lex.c
<item>parse_line  :  parse-lex.c
</itemize>
</descrip>

<sect1>Global Function UpScope()

<p>  Called when a new scope is entered.
<p>
<tt>void UpScope ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>NewStringList2()  :  slist.c
<item>SafeMalloc()  :  memory.c
<item>SafeRealloc()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_scope  :  var.c
<item>max_scope  :  var.c
<item>variable  :  var.c
</itemize>
</descrip>

<sect1>Local Function NewVariableType()

<p>  Create a new variable type.
<p>
<tt>static Variable NewVariableType ( char* name, char* type )</tt><newline>
<descrip>
<tag><tt>Variable NewVariableType</tt></tag>
Returns a new Variable type.
<tag><tt>char* name</tt></tag>
The name of the variable.
<tag><tt>char* type</tt></tag>
The type of the variable.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>var.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>SeenVariableDefinition()  :  var.c
</itemize>
</descrip>

</article>
