<!DOCTYPE LINUXDOC SYSTEM>

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

<article>

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

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

  C Cross Referencing &amp; Documentation tool. Version 1.5.
<newline>
  Handle Function 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 debugging information from this file. 
<p>
<tt>#define DEBUG 0</tt><newline>

<sect1>External Variables

<p>
<bf>option_xref</bf><newline>
 The current parsing options. 
<p>
<tt>extern int option_xref</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>option_xref</itemize>
</descrip>
<p>
<bf>CurFile</bf><newline>
 The current file that is being processed. 
<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 include functions from that file (except inline functions). 
<p>
<tt>extern int in_header</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>in_header</itemize>
</descrip>

<sect1>Local Variables

<p>
<bf>cur_func</bf><newline>
 The current function, this is initialised by the start of a possible declaration and maintained until all of the
    arguments have been added and confirmation that it is a definition and not a prototype is seen. 
<p>
<tt>static Function cur_func</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>CheckFunctionVariableRef()
<item>ResetFunctionAnalyser()
<item>SeenFuncIntComment()
<item>SeenFunctionArg()
<item>SeenFunctionCall()
<item>SeenFunctionDeclaration()
<item>SeenFunctionDefinition()
<item>SeenFunctionProto()
</itemize>
</descrip>
<p>
<bf>prototypes</bf><newline>
 The list of function prototypes and the files that they are defined in. 
<p>
<tt>static StringList2 prototypes</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>CheckFunctionVariableRef()
<item>ResetFunctionAnalyser()
<item>SeenFunctionDefinition()
<item>SeenFunctionProto()
</itemize>
</descrip>

<sect1>Global Function CheckFunctionVariableRef()

<p>  Function that is called when a function or variable is referenced in the current function.
<p>
<tt>void CheckFunctionVariableRef ( char* name, int in_a_function )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the function or variable that is referenced.
<tag><tt>int in_a_function</tt></tag>
Whether the reference is from within a function or at the top level of the file.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>AddToStringList2()  :  slist.c
<item>IsAScopeVariable()  :  var.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>cur_func  :  func.c
<item>option_xref  :  cxref.c
<item>prototypes  :  func.c
</itemize>
</descrip>

<sect1>Global Function DeleteFunctionType()

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

<sect1>Global Function ResetFunctionAnalyser()

<p>  Tidy up all of the local variables in case of a problem and abnormal parser termination.
<p>
<tt>void ResetFunctionAnalyser ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>DeleteFunctionType()  :  func.c
<item>DeleteStringList2()  :  slist.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>main()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>CurFile  :  cxref.c
<item>cur_func  :  func.c
<item>prototypes  :  func.c
</itemize>
</descrip>

<sect1>Global Function SeenFuncIntComment()

<p>  Function that is called when a comment is seen, that may be in a function body.
<p>
<tt>int SeenFuncIntComment ( char* comment )</tt><newline>
<descrip>
<tag><tt>int SeenFuncIntComment</tt></tag>
Returns a true value if the comment was accepted as an function internal comment.
<tag><tt>char* comment</tt></tag>
The comment that has been seen.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>ConcatStrings()  :  memory.c
<item>SafeFree()  :  memory.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>SeenComment()  :  comment.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_func  :  func.c
</itemize>
</descrip>

<sect1>Global Function SeenFunctionArg()

<p>  Function that is called when a function argument is seen in the current function declaration.
<p>
<tt>void SeenFunctionArg ( char* name, char* type )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the argument.
<tag><tt>char* type</tt></tag>
The type of the argument, or NULL if a traditional style function definition.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>AddToStringList2()  :  slist.c
<item>GetCurrentComment()  :  comment.c
<item>SafeFree()  :  memory.c
<item>SafeMallocString()  :  memory.c
<item>SplitComment()  :  comment.c
<item>strcmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_func  :  func.c
</itemize>
</descrip>

<sect1>Global Function SeenFunctionCall()

<p>  Function that is called when a function call is seen in the current function.
<p>
<tt>void SeenFunctionCall ( char* name )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the function that is called.
</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_func  :  func.c
<item>option_xref  :  cxref.c
</itemize>
</descrip>

<sect1>Global Function SeenFunctionDeclaration()

<p>  Function that is called when a function declaration is seen.
  This may or may not be a function defintion, we will need to wait and see.
<p>
<tt>void SeenFunctionDeclaration ( char* name, int scope )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the function.
<tag><tt>int scope</tt></tag>
The scope of the function definition.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>DeleteFunctionType()  :  func.c
<item>GetCurrentComment()  :  comment.c
<item>NewFunctionType()  :  func.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_func  :  func.c
<item>in_header  :  preproc.c
<item>parse_file  :  parse-lex.c
<item>parse_line  :  parse-lex.c
</itemize>
</descrip>

<sect1>Global Function SeenFunctionDefinition()

<p>  Called when a possible function definition is confirmed.
<p>
<tt>void SeenFunctionDefinition ( char* type )</tt><newline>
<descrip>
<tag><tt>char* type</tt></tag>
The type of the function, or NULL at the end of a definition.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>ConcatStrings()  :  memory.c
<item>GetCurrentComment()  :  comment.c
<item>SafeFree()  :  memory.c
<item>SafeMallocString()  :  memory.c
<item>SplitComment()  :  comment.c
<item>strchr(), strcmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>CurFile  :  cxref.c
<item>cur_func  :  func.c
<item>option_xref  :  cxref.c
<item>prototypes  :  func.c
</itemize>
</descrip>

<sect1>Global Function SeenFunctionProto()

<p>  Function that is called when a function prototype is seen.
<p>
<tt>void SeenFunctionProto ( char* name, int in_a_function )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the function.
<tag><tt>int in_a_function</tt></tag>
Whether the reference is from within a function or at the top level of the file.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>AddToStringList()  :  slist.c
<item>AddToStringList2()  :  slist.c
<item>NewStringList2()  :  slist.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_func  :  func.c
<item>option_xref  :  cxref.c
<item>parse_file  :  parse-lex.c
<item>prototypes  :  func.c
</itemize>
</descrip>

<sect1>Local Function NewFunctionType()

<p>  Create a new Function Type variable.
<p>
<tt>static Function NewFunctionType ( char* name, char* type )</tt><newline>
<descrip>
<tag><tt>Function NewFunctionType</tt></tag>
Returns the new Function variable.
<tag><tt>char* name</tt></tag>
The name of the function.
<tag><tt>char* type</tt></tag>
The type of the function.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>func.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>NewStringList()  :  slist.c
<item>NewStringList2()  :  slist.c
<item>SafeCalloc()  :  memory.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>SeenFunctionDeclaration()  :  func.c
</itemize>
</descrip>

</article>
