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

\markboth{File var.c}{File var.c}
\section{File var.c}
\label{file_var.c}

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

\smallskip

  C Cross Referencing \& Documentation tool. Version 1.5.

  Collects the variable definition 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 output of debugging information from this file. 

\smallskip
{\stt \#define DEBUG 0}


\subsection{Variables}


\subsubsection{External Variables}

{\bf CurFile}
\label{var_CurFile_var.c}

 The file that is currently being documented. 

\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_var.c}

 When in a header file make a note of which one for the included variables. 

\smallskip
{\stt extern int in\_header}

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


\subsubsection{Local Variables}

{\bf variable}
\label{var_variable_var.c}

 A list of the variables found at each level of the scope. 

\smallskip
{\stt static StringList2* variable}

\smallskip
\begin{cxreftabiii}
Used in:\ & DownScope() & \ & \cxreffunc{DownScope}{var.c}\\
\ & IsAScopeVariable() & \ & \cxreffunc{IsAScopeVariable}{var.c}\\
\ & ResetVariableAnalyser() & \ & \cxreffunc{ResetVariableAnalyser}{var.c}\\
\ & SeenScopeVariable() & \ & \cxreffunc{SeenScopeVariable}{var.c}\\
\ & UpScope() & \ & \cxreffunc{UpScope}{var.c}\\
\end{cxreftabiii}

\medskip
{\bf max\_scope}
\label{var_max_scope_var.c}

 The number of levels of scope depth allocated. 

\smallskip
{\stt static int max\_scope}

\smallskip
\begin{cxreftabiii}
Used in:\ & ResetVariableAnalyser() & \ & \cxreffunc{ResetVariableAnalyser}{var.c}\\
\ & UpScope() & \ & \cxreffunc{UpScope}{var.c}\\
\end{cxreftabiii}

\medskip
{\bf cur\_scope}
\label{var_cur_scope_var.c}

 The current scope depth. 

\smallskip
{\stt static int cur\_scope}

\smallskip
\begin{cxreftabiii}
Used in:\ & DownScope() & \ & \cxreffunc{DownScope}{var.c}\\
\ & IsAScopeVariable() & \ & \cxreffunc{IsAScopeVariable}{var.c}\\
\ & ResetVariableAnalyser() & \ & \cxreffunc{ResetVariableAnalyser}{var.c}\\
\ & SeenScopeVariable() & \ & \cxreffunc{SeenScopeVariable}{var.c}\\
\ & UpScope() & \ & \cxreffunc{UpScope}{var.c}\\
\end{cxreftabiii}


\subsection{Functions}


\subsubsection{Global Function DeleteVariableType()}
\label{func_DeleteVariableType_var.c}

  Delete the specified Variable type.

\smallskip
{\stt void DeleteVariableType ( Variable var )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Variable var} The Variable type to be deleted.
\end{cxrefarglist}

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


\subsubsection{Global Function DownScope()}
\label{func_DownScope_var.c}

  Called when an old scope is exited.

\smallskip
{\stt void DownScope ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & DeleteStringList2() & slist.c & \cxreffunc{DeleteStringList2}{slist.c}\\
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & cur\_scope & var.c & \cxrefvar{cur_scope}{var.c}\\
\cxreftabbreak{cxreftabiii}
\ & variable & var.c & \cxrefvar{variable}{var.c}\\
\end{cxreftabiii}


\subsubsection{Global Function IsAScopeVariable()}
\label{func_IsAScopeVariable_var.c}

  Check through the scope variables to look for the named one.

\smallskip
{\stt int IsAScopeVariable ( char* name )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{int IsAScopeVariable} Returns 1 if the name does refer to a variable that is scoped.
\cxrefargitem{char* name} The name of the variable to search for.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & \cxreftabiiispan{ strcmp()} &\\
Called by:\ & CheckFunctionVariableRef() & func.c & \cxreffunc{CheckFunctionVariableRef}{func.c}\\
\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & cur\_scope & var.c & \cxrefvar{cur_scope}{var.c}\\
\ & variable & var.c & \cxrefvar{variable}{var.c}\\
\end{cxreftabiii}


\subsubsection{Global Function ResetVariableAnalyser()}
\label{func_ResetVariableAnalyser_var.c}

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

\smallskip
{\stt void ResetVariableAnalyser ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & DeleteStringList2() & slist.c & \cxreffunc{DeleteStringList2}{slist.c}\\
\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
Called by:\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & cur\_scope & var.c & \cxrefvar{cur_scope}{var.c}\\
\ & max\_scope & var.c & \cxrefvar{max_scope}{var.c}\\
\ & variable & var.c & \cxrefvar{variable}{var.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenScopeVariable()}
\label{func_SeenScopeVariable_var.c}

  Add a variable to the list of known variables.

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

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the variable.
\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\_scope & var.c & \cxrefvar{cur_scope}{var.c}\\
\cxreftabbreak{cxreftabiii}
\ & variable & var.c & \cxrefvar{variable}{var.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenVariableDefinition()}
\label{func_SeenVariableDefinition_var.c}

  Function that is called when a variable definition is seen.

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

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the variable.
\cxrefargitem{char* type} The type of the variable.
\cxrefargitem{int scope} The scope of variable that has been seen.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\ & NewVariableType() & var.c & \cxreffunc{NewVariableType}{var.c}\\
\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
\cxreftabbreak{cxreftabiii}
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
\ & \cxreftabiiispan{ strcmp()} &\\
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & CurFile & cxref.c & \cxrefvar{CurFile}{cxref.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 UpScope()}
\label{func_UpScope_var.c}

  Called when a new scope is entered.

\smallskip
{\stt void UpScope ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & NewStringList2() & slist.c & \cxreffunc{NewStringList2}{slist.c}\\
\ & SafeMalloc() & memory.c & \cxreffunc{SafeMalloc}{memory.c}\\
\ & SafeRealloc() & memory.c & \cxreffunc{SafeRealloc}{memory.c}\\
\cxreftabbreak{cxreftabiii}
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & cur\_scope & var.c & \cxrefvar{cur_scope}{var.c}\\
\ & max\_scope & var.c & \cxrefvar{max_scope}{var.c}\\
\ & variable & var.c & \cxrefvar{variable}{var.c}\\
\end{cxreftabiii}


\subsubsection{Local Function NewVariableType()}
\label{func_NewVariableType_var.c}

  Create a new variable type.

\smallskip
{\stt static Variable NewVariableType ( char* name, char* type )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Variable NewVariableType} Returns a new Variable type.
\cxrefargitem{char* name} The name of the variable.
\cxrefargitem{char* type} The type of the variable.
\end{cxrefarglist}

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

