% This LaTeX file generated by cxref
% cxref program (c) Andrew M. Bishop 1995,96,97.

\markboth{File func.c}{File func.c}
\section{File func.c}
\label{file_func.c}

{\bf RCS Header: /home/amb/cxref/RCS/func.c 1.18 1999/01/24 16:53:49 amb Exp }

\smallskip

  C Cross Referencing \& Documentation tool. Version 1.5.

  Handle Function stuff.


\subsection*{Included Files}

\begin{cxreftabi}
{\stt \#include <stdlib.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include <stdio.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include <string.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include "memory.h"} &\cxreffile{memory.h}\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include "datatype.h"} &\cxreffile{datatype.h}\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include "parse-yy.h"} &\cxreffile{parse-yy.h}\\
\hspace*{0.2in}{\stt \#include <stdio.h>} &\\
\hspace*{0.2in}{\stt \#include <stdlib.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include "cxref.h"} &\cxreffile{cxref.h}\\
\hspace*{0.2in}{\stt \#include "datatype.h"} &\cxreffile{datatype.h}\\
\end{cxreftabi}


\subsection*{Preprocessor definitions}

 Control the debugging information from this file. 

\smallskip
{\stt \#define DEBUG 0}


\subsection{Variables}


\subsubsection{External Variables}

{\bf option\_xref}
\label{var_option_xref_func.c}

 The current parsing options. 

\smallskip
{\stt extern int option\_xref}

\smallskip
\begin{cxreftabiii}
Defined in:& cxref.c & \ & \cxrefvar{option_xref}{cxref.c}\\
\end{cxreftabiii}

\medskip
{\bf CurFile}
\label{var_CurFile_func.c}

 The current file that is being processed. 

\smallskip
{\stt extern File CurFile}

\smallskip
\begin{cxreftabiii}
Defined in:& cxref.c & \ & \cxrefvar{CurFile}{cxref.c}\\
\end{cxreftabiii}

\medskip
{\bf in\_header}
\label{var_in_header_func.c}

 When in a header file include functions from that file (except inline functions). 

\smallskip
{\stt extern int in\_header}

\smallskip
\begin{cxreftabiii}
Defined in:& preproc.c & \ & \cxrefvar{in_header}{preproc.c}\\
\end{cxreftabiii}


\subsubsection{Local Variables}

{\bf cur\_func}
\label{var_cur_func_func.c}

 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. 

\smallskip
{\stt static Function cur\_func}

\smallskip
\begin{cxreftabiii}
Used in:\ & CheckFunctionVariableRef() & \ & \cxreffunc{CheckFunctionVariableRef}{func.c}\\
\ & ResetFunctionAnalyser() & \ & \cxreffunc{ResetFunctionAnalyser}{func.c}\\
\ & SeenFuncIntComment() & \ & \cxreffunc{SeenFuncIntComment}{func.c}\\
\ & SeenFunctionArg() & \ & \cxreffunc{SeenFunctionArg}{func.c}\\
\cxreftabbreak{cxreftabiii}
\ & SeenFunctionCall() & \ & \cxreffunc{SeenFunctionCall}{func.c}\\
\ & SeenFunctionDeclaration() & \ & \cxreffunc{SeenFunctionDeclaration}{func.c}\\
\ & SeenFunctionDefinition() & \ & \cxreffunc{SeenFunctionDefinition}{func.c}\\
\ & SeenFunctionProto() & \ & \cxreffunc{SeenFunctionProto}{func.c}\\
\end{cxreftabiii}

\medskip
{\bf prototypes}
\label{var_prototypes_func.c}

 The list of function prototypes and the files that they are defined in. 

\smallskip
{\stt static StringList2 prototypes}

\smallskip
\begin{cxreftabiii}
Used in:\ & CheckFunctionVariableRef() & \ & \cxreffunc{CheckFunctionVariableRef}{func.c}\\
\ & ResetFunctionAnalyser() & \ & \cxreffunc{ResetFunctionAnalyser}{func.c}\\
\ & SeenFunctionDefinition() & \ & \cxreffunc{SeenFunctionDefinition}{func.c}\\
\ & SeenFunctionProto() & \ & \cxreffunc{SeenFunctionProto}{func.c}\\
\end{cxreftabiii}


\subsection{Functions}


\subsubsection{Global Function CheckFunctionVariableRef()}
\label{func_CheckFunctionVariableRef_func.c}

  Function that is called when a function or variable is referenced in the current function.

\smallskip
{\stt void CheckFunctionVariableRef ( char* name, int in\_a\_function )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the function or variable that is referenced.
\cxrefargitem{int in\_a\_function} Whether the reference is from within a function or at the top level of the file.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & AddToStringList2() & slist.c & \cxreffunc{AddToStringList2}{slist.c}\\
\ & IsAScopeVariable() & var.c & \cxreffunc{IsAScopeVariable}{var.c}\\
\ & \cxreftabiiispan{ strcmp()} &\\
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & CurFile & cxref.c & \cxrefvar{CurFile}{cxref.c}\\
\ & cur\_func & func.c & \cxrefvar{cur_func}{func.c}\\
\ & option\_xref & cxref.c & \cxrefvar{option_xref}{cxref.c}\\
\ & prototypes & func.c & \cxrefvar{prototypes}{func.c}\\
\end{cxreftabiii}


\subsubsection{Global Function DeleteFunctionType()}
\label{func_DeleteFunctionType_func.c}

  Delete the specified Function type.

\smallskip
{\stt void DeleteFunctionType ( Function func )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Function func} The Function type to be deleted.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & DeleteStringList() & slist.c & \cxreffunc{DeleteStringList}{slist.c}\\
\ & DeleteStringList2() & slist.c & \cxreffunc{DeleteStringList2}{slist.c}\\
\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
\cxreftabbreak{cxreftabiii}
Called by:\ & DeleteFile() & file.c & \cxreffunc{DeleteFile}{file.c}\\
\ & ResetFunctionAnalyser() & func.c & \cxreffunc{ResetFunctionAnalyser}{func.c}\\
\ & SeenFunctionDeclaration() & func.c & \cxreffunc{SeenFunctionDeclaration}{func.c}\\
\end{cxreftabiii}


\subsubsection{Global Function ResetFunctionAnalyser()}
\label{func_ResetFunctionAnalyser_func.c}

  Tidy up all of the local variables in case of a problem and abnormal parser termination.

\smallskip
{\stt void ResetFunctionAnalyser ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & DeleteFunctionType() & func.c & \cxreffunc{DeleteFunctionType}{func.c}\\
\ & DeleteStringList2() & slist.c & \cxreffunc{DeleteStringList2}{slist.c}\\
Called by:\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & CurFile & cxref.c & \cxrefvar{CurFile}{cxref.c}\\
\ & cur\_func & func.c & \cxrefvar{cur_func}{func.c}\\
\ & prototypes & func.c & \cxrefvar{prototypes}{func.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenFuncIntComment()}
\label{func_SeenFuncIntComment_func.c}

  Function that is called when a comment is seen, that may be in a function body.

\smallskip
{\stt int SeenFuncIntComment ( char* comment )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{int SeenFuncIntComment} Returns a true value if the comment was accepted as an function internal comment.
\cxrefargitem{char* comment} The comment that has been seen.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & ConcatStrings() & memory.c & \cxreffunc{ConcatStrings}{memory.c}\\
\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
\cxreftabbreak{cxreftabiii}
Called by:\ & SeenComment() & comment.c & \cxreffunc{SeenComment}{comment.c}\\
Refs Var:\ & cur\_func & func.c & \cxrefvar{cur_func}{func.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenFunctionArg()}
\label{func_SeenFunctionArg_func.c}

  Function that is called when a function argument is seen in the current function declaration.

\smallskip
{\stt void SeenFunctionArg ( char* name, char* type )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the argument.
\cxrefargitem{char* type} The type of the argument, or NULL if a traditional style function definition.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & AddToStringList2() & slist.c & \cxreffunc{AddToStringList2}{slist.c}\\
\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
\cxreftabbreak{cxreftabiii}
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
\ & SplitComment() & comment.c & \cxreffunc{SplitComment}{comment.c}\\
\ & \cxreftabiiispan{ strcmp()} &\\
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & cur\_func & func.c & \cxrefvar{cur_func}{func.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenFunctionCall()}
\label{func_SeenFunctionCall_func.c}

  Function that is called when a function call is seen in the current function.

\smallskip
{\stt void SeenFunctionCall ( char* name )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the function that is called.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & AddToStringList2() & slist.c & \cxreffunc{AddToStringList2}{slist.c}\\
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & cur\_func & func.c & \cxrefvar{cur_func}{func.c}\\
\cxreftabbreak{cxreftabiii}
\ & option\_xref & cxref.c & \cxrefvar{option_xref}{cxref.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenFunctionDeclaration()}
\label{func_SeenFunctionDeclaration_func.c}

  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.

\smallskip
{\stt void SeenFunctionDeclaration ( char* name, int scope )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the function.
\cxrefargitem{int scope} The scope of the function definition.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & DeleteFunctionType() & func.c & \cxreffunc{DeleteFunctionType}{func.c}\\
\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\ & NewFunctionType() & func.c & \cxreffunc{NewFunctionType}{func.c}\\
\cxreftabbreak{cxreftabiii}
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & cur\_func & func.c & \cxrefvar{cur_func}{func.c}\\
\ & in\_header & preproc.c & \cxrefvar{in_header}{preproc.c}\\
\ & parse\_file & parse-lex.c & \cxrefvar{parse_file}{parse-lex.c}\\
\ & parse\_line & parse-lex.c & \cxrefvar{parse_line}{parse-lex.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenFunctionDefinition()}
\label{func_SeenFunctionDefinition_func.c}

  Called when a possible function definition is confirmed.

\smallskip
{\stt void SeenFunctionDefinition ( char* type )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* type} The type of the function, or NULL at the end of a definition.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & ConcatStrings() & memory.c & \cxreffunc{ConcatStrings}{memory.c}\\
\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
\cxreftabbreak{cxreftabiii}
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
\ & SplitComment() & comment.c & \cxreffunc{SplitComment}{comment.c}\\
\ & \cxreftabiiispan{ strchr(), strcmp()} &\\
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & CurFile & cxref.c & \cxrefvar{CurFile}{cxref.c}\\
\ & cur\_func & func.c & \cxrefvar{cur_func}{func.c}\\
\ & option\_xref & cxref.c & \cxrefvar{option_xref}{cxref.c}\\
\ & prototypes & func.c & \cxrefvar{prototypes}{func.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenFunctionProto()}
\label{func_SeenFunctionProto_func.c}

  Function that is called when a function prototype is seen.

\smallskip
{\stt void SeenFunctionProto ( char* name, int in\_a\_function )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the function.
\cxrefargitem{int in\_a\_function} Whether the reference is from within a function or at the top level of the file.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & AddToStringList() & slist.c & \cxreffunc{AddToStringList}{slist.c}\\
\ & AddToStringList2() & slist.c & \cxreffunc{AddToStringList2}{slist.c}\\
\ & NewStringList2() & slist.c & \cxreffunc{NewStringList2}{slist.c}\\
\cxreftabbreak{cxreftabiii}
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & cur\_func & func.c & \cxrefvar{cur_func}{func.c}\\
\ & option\_xref & cxref.c & \cxrefvar{option_xref}{cxref.c}\\
\ & parse\_file & parse-lex.c & \cxrefvar{parse_file}{parse-lex.c}\\
\ & prototypes & func.c & \cxrefvar{prototypes}{func.c}\\
\end{cxreftabiii}


\subsubsection{Local Function NewFunctionType()}
\label{func_NewFunctionType_func.c}

  Create a new Function Type variable.

\smallskip
{\stt static Function NewFunctionType ( char* name, char* type )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Function NewFunctionType} Returns the new Function variable.
\cxrefargitem{char* name} The name of the function.
\cxrefargitem{char* type} The type of the function.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& func.c & \ & \cxreffile{func.c}\\
Calls:\ & NewStringList() & slist.c & \cxreffunc{NewStringList}{slist.c}\\
\ & NewStringList2() & slist.c & \cxreffunc{NewStringList2}{slist.c}\\
\ & SafeCalloc() & memory.c & \cxreffunc{SafeCalloc}{memory.c}\\
\cxreftabbreak{cxreftabiii}
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
Called by:\ & SeenFunctionDeclaration() & func.c & \cxreffunc{SeenFunctionDeclaration}{func.c}\\
\end{cxreftabiii}

