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

\markboth{File preproc.c}{File preproc.c}
\section{File preproc.c}
\label{file_preproc.c}

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

\smallskip

  C Cross Referencing \& Documentation tool. Version 1.5.

  Collects the pre-processing instruction 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 <unistd.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include <sys/stat.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 for this file. 

\smallskip
{\stt \#define DEBUG 0}


\subsection{Variables}


\subsubsection{Variable in\_header}
\label{var_in_header_preproc.c}

 When in a header file, this is set to 1, to allow most of the stuff to be skipped. 

\smallskip
{\stt int in\_header}

\smallskip
\begin{cxreftabiii}
Visible in:\ & func.c & \ & \cxreffile{func.c}\\
\ & parse-lex.c & \ & \cxreffile{parse-lex.c}\\
\ & parse-yacc.c & \ & \cxreffile{parse-yacc.c}\\
\ & preproc.c & \ & \cxreffile{preproc.c}\\
\cxreftabbreak{cxreftabiii}
\ & var.c & \ & \cxreffile{var.c}\\
Used in:\ & ResetPreProcAnalyser() & preproc.c & \cxreffunc{ResetPreProcAnalyser}{preproc.c}\\
\ & SeenFileChange() & preproc.c & \cxreffunc{SeenFileChange}{preproc.c}\\
\ & SeenFunctionDeclaration() & func.c & \cxreffunc{SeenFunctionDeclaration}{func.c}\\
\ & SeenVariableDefinition() & var.c & \cxreffunc{SeenVariableDefinition}{var.c}\\
\cxreftabbreak{cxreftabiii}
\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
\end{cxreftabiii}


\subsubsection{External Variables}

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

 The file that is currently being processed. 

\smallskip
{\stt extern File CurFile}

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

\medskip
{\bf option\_incdirs}
\label{var_option_incdirs_preproc.c}

 The name of the include directories specified on the command line. 

\smallskip
{\stt extern char** option\_incdirs}

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

\medskip
{\bf option\_nincdirs}
\label{var_option_nincdirs_preproc.c}

 The number of include directories on the command line. 

\smallskip
{\stt extern int option\_nincdirs}

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


\subsubsection{Local Variables}

{\bf cur\_inc}
\label{var_cur_inc_preproc.c}

 The current \#include we are looking at. 

\smallskip
{\stt static Include cur\_inc}

\smallskip
\begin{cxreftabiii}
Used in:\ & ResetPreProcAnalyser() & \ & \cxreffunc{ResetPreProcAnalyser}{preproc.c}\\
\ & SeenFileChange() & \ & \cxreffunc{SeenFileChange}{preproc.c}\\
\ & SeenInclude() & \ & \cxreffunc{SeenInclude}{preproc.c}\\
\ & SeenIncludeComment() & \ & \cxreffunc{SeenIncludeComment}{preproc.c}\\
\end{cxreftabiii}

\medskip
{\bf cur\_def}
\label{var_cur_def_preproc.c}

 The current \#define we are looking at. 

\smallskip
{\stt static Define cur\_def}

\smallskip
\begin{cxreftabiii}
Used in:\ & ResetPreProcAnalyser() & \ & \cxreffunc{ResetPreProcAnalyser}{preproc.c}\\
\ & SeenDefine() & \ & \cxreffunc{SeenDefine}{preproc.c}\\
\ & SeenDefineComment() & \ & \cxreffunc{SeenDefineComment}{preproc.c}\\
\ & SeenDefineFuncArgComment() & \ & \cxreffunc{SeenDefineFuncArgComment}{preproc.c}\\
\ & SeenDefineFunctionArg() & \ & \cxreffunc{SeenDefineFunctionArg}{preproc.c}\\
\ & SeenDefineValue() & \ & \cxreffunc{SeenDefineValue}{preproc.c}\\
\end{cxreftabiii}

\medskip
{\bf inc\_depth}
\label{var_inc_depth_preproc.c}

 The depth of includes. 

\smallskip
{\stt static int inc\_depth}

\smallskip
\begin{cxreftabiii}
Used in:\ & ResetPreProcAnalyser() & \ & \cxreffunc{ResetPreProcAnalyser}{preproc.c}\\
\ & SeenFileChange() & \ & \cxreffunc{SeenFileChange}{preproc.c}\\
\ & SeenInclude() & \ & \cxreffunc{SeenInclude}{preproc.c}\\
\end{cxreftabiii}

\medskip
{\bf inc\_type}
\label{var_inc_type_preproc.c}

 The type of include at this depth. 

\smallskip
{\stt static char* inc\_type}

\smallskip
\begin{cxreftabiii}
Used in:\ & ResetPreProcAnalyser() & \ & \cxreffunc{ResetPreProcAnalyser}{preproc.c}\\
\ & SeenFileChange() & \ & \cxreffunc{SeenFileChange}{preproc.c}\\
\ & SeenInclude() & \ & \cxreffunc{SeenInclude}{preproc.c}\\
\end{cxreftabiii}

\medskip
{\bf cwd}
\label{var_cwd_preproc.c}

 The working directory. 

\smallskip
{\stt static char* cwd}

\smallskip
\begin{cxreftabiii}
Used in:\ & ResetPreProcAnalyser() & \ & \cxreffunc{ResetPreProcAnalyser}{preproc.c}\\
\ & SeenFileChange() & \ & \cxreffunc{SeenFileChange}{preproc.c}\\
\end{cxreftabiii}


\subsection{Functions}


\subsubsection{Global Function DeleteDefineType()}
\label{func_DeleteDefineType_preproc.c}

  Delete the specified Define type.

\smallskip
{\stt void DeleteDefineType ( Define def )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Define def} The Define 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 DeleteIncludeType()}
\label{func_DeleteIncludeType_preproc.c}

  Delete the specified Include type.

\smallskip
{\stt void DeleteIncludeType ( Include inc )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Include inc} The Include type to be deleted.
\end{cxrefarglist}

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


\subsubsection{Global Function ResetPreProcAnalyser()}
\label{func_ResetPreProcAnalyser_preproc.c}

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

\smallskip
{\stt void ResetPreProcAnalyser ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
Called by:\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
Refs Var:\ & cur\_def & preproc.c & \cxrefvar{cur_def}{preproc.c}\\
\cxreftabbreak{cxreftabiii}
\ & cur\_inc & preproc.c & \cxrefvar{cur_inc}{preproc.c}\\
\ & cwd & preproc.c & \cxrefvar{cwd}{preproc.c}\\
\ & in\_header & preproc.c & \cxrefvar{in_header}{preproc.c}\\
\ & inc\_depth & preproc.c & \cxrefvar{inc_depth}{preproc.c}\\
\ & inc\_type & preproc.c & \cxrefvar{inc_type}{preproc.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenDefine()}
\label{func_SeenDefine_preproc.c}

  Function that is called when a \#define is seen in the current file.

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

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the \#defined symbol.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\ & NewDefineType() & preproc.c & \cxreffunc{NewDefineType}{preproc.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
\cxreftabbreak{cxreftabiii}
Called by:\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
Refs Var:\ & CurFile & cxref.c & \cxrefvar{CurFile}{cxref.c}\\
\ & cur\_def & preproc.c & \cxrefvar{cur_def}{preproc.c}\\
\ & parse\_line & parse-lex.c & \cxrefvar{parse_line}{parse-lex.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenDefineComment()}
\label{func_SeenDefineComment_preproc.c}

  Function that is called when a comment is seen in a \#define definition.

\smallskip
{\stt void SeenDefineComment ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
Called by:\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & cur\_def & preproc.c & \cxrefvar{cur_def}{preproc.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenDefineFuncArgComment()}
\label{func_SeenDefineFuncArgComment_preproc.c}

  Function that is called when a comment is seen in a \#define function definition.

\smallskip
{\stt void SeenDefineFuncArgComment ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
Called by:\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & cur\_def & preproc.c & \cxrefvar{cur_def}{preproc.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenDefineFunctionArg()}
\label{func_SeenDefineFunctionArg_preproc.c}

  Function that is called when a \#define function argument is seen in the current definition.

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

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The argument.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & AddToStringList2() & slist.c & \cxreffunc{AddToStringList2}{slist.c}\\
\ & SplitComment() & comment.c & \cxreffunc{SplitComment}{comment.c}\\
Called by:\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & cur\_def & preproc.c & \cxrefvar{cur_def}{preproc.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenDefineValue()}
\label{func_SeenDefineValue_preproc.c}

  Function that is called when a \#define value is seen in the current file.

\smallskip
{\stt void SeenDefineValue ( char* value )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* value} The value of the \#defined symbol.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
Called by:\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
Refs Var:\ & cur\_def & preproc.c & \cxrefvar{cur_def}{preproc.c}\\
\cxreftabbreak{cxreftabiii}
\end{cxreftabiii}


\subsubsection{Global Function SeenFileChange()}
\label{func_SeenFileChange_preproc.c}

  Function that is called when a change in current file is seen.

\smallskip
{\stt void SeenFileChange ( char* name, int flag )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The pathname of the included file as determined by gcc.
\cxrefargitem{int flag} The flags that GCC leaves in the file
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & CanonicaliseName() & cxref.c & \cxreffunc{CanonicaliseName}{cxref.c}\\
\ & ConcatStrings() & memory.c & \cxreffunc{ConcatStrings}{memory.c}\\
\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
\cxreftabbreak{cxreftabiii}
\ & SafeMalloc() & memory.c & \cxreffunc{SafeMalloc}{memory.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
\ & SafeRealloc() & memory.c & \cxreffunc{SafeRealloc}{memory.c}\\
\ & SeenInclude() & preproc.c & \cxreffunc{SeenInclude}{preproc.c}\\
\ & SetCurrentComment() & comment.c & \cxreffunc{SetCurrentComment}{comment.c}\\
\ & \cxreftabiiispan{ getcwd(), strlen(), strncmp()} &\\
Called by:\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
Refs Var:\ & cur\_inc & preproc.c & \cxrefvar{cur_inc}{preproc.c}\\
\ & cwd & preproc.c & \cxrefvar{cwd}{preproc.c}\\
\cxreftabbreak{cxreftabiii}
\ & in\_header & preproc.c & \cxrefvar{in_header}{preproc.c}\\
\ & inc\_depth & preproc.c & \cxrefvar{inc_depth}{preproc.c}\\
\ & inc\_type & preproc.c & \cxrefvar{inc_type}{preproc.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenInclude()}
\label{func_SeenInclude_preproc.c}

  Function that is called when an included file is seen in the current file.

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

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the file from the source code.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & CanonicaliseName() & cxref.c & \cxreffunc{CanonicaliseName}{cxref.c}\\
\ & ConcatStrings() & memory.c & \cxreffunc{ConcatStrings}{memory.c}\\
\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\cxreftabbreak{cxreftabiii}
\ & NewIncludeType() & preproc.c & \cxreffunc{NewIncludeType}{preproc.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
\ & \cxreftabiiispan{ lstat(), strlen()} &\\
Called by:\ & SeenFileChange() & preproc.c & \cxreffunc{SeenFileChange}{preproc.c}\\
\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
Refs Var:\ & CurFile & cxref.c & \cxrefvar{CurFile}{cxref.c}\\
\ & cur\_inc & preproc.c & \cxrefvar{cur_inc}{preproc.c}\\
\ & inc\_depth & preproc.c & \cxrefvar{inc_depth}{preproc.c}\\
\ & inc\_type & preproc.c & \cxrefvar{inc_type}{preproc.c}\\
\cxreftabbreak{cxreftabiii}
\ & option\_incdirs & cxref.c & \cxrefvar{option_incdirs}{cxref.c}\\
\ & option\_nincdirs & cxref.c & \cxrefvar{option_nincdirs}{cxref.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenIncludeComment()}
\label{func_SeenIncludeComment_preproc.c}

  Function that is called when a comment is seen following a \#include.

\smallskip
{\stt void SeenIncludeComment ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
Called by:\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & cur\_inc & preproc.c & \cxrefvar{cur_inc}{preproc.c}\\
\end{cxreftabiii}


\subsubsection{Local Function NewDefineType()}
\label{func_NewDefineType_preproc.c}

  Create a new Define datatype.

\smallskip
{\stt static Define NewDefineType ( char* name )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Define NewDefineType} Return the new Define type.
\cxrefargitem{char* name} The name of the new define.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& preproc.c & \ & \cxreffile{preproc.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:\ & SeenDefine() & preproc.c & \cxreffunc{SeenDefine}{preproc.c}\\
\end{cxreftabiii}


\subsubsection{Local Function NewIncludeType()}
\label{func_NewIncludeType_preproc.c}

  Create a new Include datatype.

\smallskip
{\stt static Include NewIncludeType ( char* name )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Include NewIncludeType} Return the new Include type.
\cxrefargitem{char* name} The name of the new include.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& preproc.c & \ & \cxreffile{preproc.c}\\
Calls:\ & SafeCalloc() & memory.c & \cxreffunc{SafeCalloc}{memory.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
Called by:\ & SeenInclude() & preproc.c & \cxreffunc{SeenInclude}{preproc.c}\\
\cxreftabbreak{cxreftabiii}
\end{cxreftabiii}

