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

\markboth{File type.c}{File type.c}
\section{File type.c}
\label{file_type.c}

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

\smallskip

  C Cross Referencing \& Documentation tool. Version 1.5.

  Collects the typedef 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 in this file. 

\smallskip
{\stt \#define DEBUG 0}


\subsection{Variables}


\subsubsection{External Variables}

{\bf CurFile}
\label{var_CurFile_type.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 in\_typedef}
\label{var_in_typedef_type.c}

 Whether we are parsing a typedef or not. 

\smallskip
{\stt extern int in\_typedef}

\smallskip
\begin{cxreftabiii}
Defined in:& parse-yacc.c & \ & \cxrefvar{in_typedef}{parse-yacc.c}\\
\end{cxreftabiii}


\subsubsection{Local Variables}

{\bf typedefs}
\label{var_typedefs_type.c}

 The defined types that we have seen. 

\smallskip
{\stt static StringList2 typedefs}

\smallskip
\begin{cxreftabiii}
Used in:\ & IsATypeName() & \ & \cxreffunc{IsATypeName}{type.c}\\
\ & ResetTypeAnalyser() & \ & \cxreffunc{ResetTypeAnalyser}{type.c}\\
\ & SeenTypedefName() & \ & \cxreffunc{SeenTypedefName}{type.c}\\
\end{cxreftabiii}

\medskip
{\bf cur\_su}
\label{var_cur_su_type.c}

 The current struct / union or enum definition. 

\smallskip
{\stt static StructUnion cur\_su}

\smallskip
\begin{cxreftabiii}
Used in:\ & ResetTypeAnalyser() & \ & \cxreffunc{ResetTypeAnalyser}{type.c}\\
\ & SeenStructUnionComp() & \ & \cxreffunc{SeenStructUnionComp}{type.c}\\
\ & SeenStructUnionEnd() & \ & \cxreffunc{SeenStructUnionEnd}{type.c}\\
\ & SeenStructUnionStart() & \ & \cxreffunc{SeenStructUnionStart}{type.c}\\
\end{cxreftabiii}

\medskip
{\bf cur\_type\_su}
\label{var_cur_type_su_type.c}

 The current struct / union if seen in a typedef. 

\smallskip
{\stt static StructUnion cur\_type\_su}

\smallskip
\begin{cxreftabiii}
Used in:\ & ResetTypeAnalyser() & \ & \cxreffunc{ResetTypeAnalyser}{type.c}\\
\ & SeenStructUnionEnd() & \ & \cxreffunc{SeenStructUnionEnd}{type.c}\\
\ & SeenTypedef() & \ & \cxreffunc{SeenTypedef}{type.c}\\
\end{cxreftabiii}

\medskip
{\bf last\_typedef}
\label{var_last_typedef_type.c}

 The last typedef seen, used when two types share a typedef statement. 

\smallskip
{\stt static Typedef last\_typedef}

\smallskip
\begin{cxreftabiii}
Used in:\ & ResetTypeAnalyser() & \ & \cxreffunc{ResetTypeAnalyser}{type.c}\\
\ & SeenTypedef() & \ & \cxreffunc{SeenTypedef}{type.c}\\
\end{cxreftabiii}

\medskip
{\bf type\_lineno}
\label{var_type_lineno_type.c}

 The line number that a typedef or structure was seen on. 

\smallskip
{\stt static int type\_lineno}

\smallskip
\begin{cxreftabiii}
Used in:\ & SeenStructUnionEnd() & \ & \cxreffunc{SeenStructUnionEnd}{type.c}\\
\ & SeenStructUnionStart() & \ & \cxreffunc{SeenStructUnionStart}{type.c}\\
\ & SeenTypedef() & \ & \cxreffunc{SeenTypedef}{type.c}\\
\end{cxreftabiii}


\subsection{Functions}


\subsubsection{Global Function DeleteTypedefType()}
\label{func_DeleteTypedefType_type.c}

  Delete the specified Typedef type.

\smallskip
{\stt void DeleteTypedefType ( Typedef type )}

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

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


\subsubsection{Global Function IsATypeName()}
\label{func_IsATypeName_type.c}

  Function that is called when an IDENTIFIER is seen in the current file, it may be a defined type.

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

\smallskip
\begin{cxrefarglist}
\cxrefargitem{int IsATypeName} Returns 1 if the argument is a type that has been defined.
\cxrefargitem{char* name} The name of the possible defined type.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & \cxreftabiiispan{ strcmp()} &\\
Called by:\ & yylex() & parse-lex.c & \cxreffunc{yylex}{parse-lex.c}\\
\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & typedefs & type.c & \cxrefvar{typedefs}{type.c}\\
\cxreftabbreak{cxreftabiii}
\end{cxreftabiii}


\subsubsection{Global Function ResetTypeAnalyser()}
\label{func_ResetTypeAnalyser_type.c}

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

\smallskip
{\stt void ResetTypeAnalyser ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & DeleteStringList2() & slist.c & \cxreffunc{DeleteStringList2}{slist.c}\\
Called by:\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
Refs Var:\ & cur\_su & type.c & \cxrefvar{cur_su}{type.c}\\
\cxreftabbreak{cxreftabiii}
\ & cur\_type\_su & type.c & \cxrefvar{cur_type_su}{type.c}\\
\ & last\_typedef & type.c & \cxrefvar{last_typedef}{type.c}\\
\ & typedefs & type.c & \cxrefvar{typedefs}{type.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenStructUnionComp()}
\label{func_SeenStructUnionComp_type.c}

  Function called when a component of a struct / union / enum is seen.

\smallskip
{\stt void SeenStructUnionComp ( char* name, int depth )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the struct / union / enum component.
\cxrefargitem{int depth} The depth within the nested struct / union / enum.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & ConcatStrings() & memory.c & \cxreffunc{ConcatStrings}{memory.c}\\
\ & CopyStructUnion() & type.c & \cxreffunc{CopyStructUnion}{type.c}\\
\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\cxreftabbreak{cxreftabiii}
\ & NewStructUnionType() & type.c & \cxreffunc{NewStructUnionType}{type.c}\\
\ & NewTypedefType() & type.c & \cxreffunc{NewTypedefType}{type.c}\\
\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
\ & SafeMalloc() & memory.c & \cxreffunc{SafeMalloc}{memory.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
\ & SafeRealloc() & memory.c & \cxreffunc{SafeRealloc}{memory.c}\\
\ & \cxreftabiiispan{ strchr(), strcmp()} &\\
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & CurFile & cxref.c & \cxrefvar{CurFile}{cxref.c}\\
\cxreftabbreak{cxreftabiii}
\ & cur\_su & type.c & \cxrefvar{cur_su}{type.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenStructUnionEnd()}
\label{func_SeenStructUnionEnd_type.c}

  Function that is called when the end of a struct or union or enum definition is seen.

\smallskip
{\stt void SeenStructUnionEnd ( void )}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & NewTypedefType() & type.c & \cxreffunc{NewTypedefType}{type.c}\\
\ & \cxreftabiiispan{ strlen(), strncmp()} &\\
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & CurFile & cxref.c & \cxrefvar{CurFile}{cxref.c}\\
\cxreftabbreak{cxreftabiii}
\ & cur\_su & type.c & \cxrefvar{cur_su}{type.c}\\
\ & cur\_type\_su & type.c & \cxrefvar{cur_type_su}{type.c}\\
\ & in\_typedef & parse-yacc.c & \cxrefvar{in_typedef}{parse-yacc.c}\\
\ & type\_lineno & type.c & \cxrefvar{type_lineno}{type.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenStructUnionStart()}
\label{func_SeenStructUnionStart_type.c}

  Function that is called when the start of a struct or union or enum definition is seen.

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

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the struct type.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\ & NewStructUnionType() & type.c & \cxreffunc{NewStructUnionType}{type.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
\cxreftabbreak{cxreftabiii}
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & cur\_su & type.c & \cxrefvar{cur_su}{type.c}\\
\ & in\_typedef & parse-yacc.c & \cxrefvar{in_typedef}{parse-yacc.c}\\
\ & parse\_line & parse-lex.c & \cxrefvar{parse_line}{parse-lex.c}\\
\ & type\_lineno & type.c & \cxrefvar{type_lineno}{type.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenTypedef()}
\label{func_SeenTypedef_type.c}

  Function that is called when a typedef is seen in the current file. This is recorded fully for later output.

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

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the defined type.
\cxrefargitem{char* type} The type that it is defined to be.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & GetCurrentComment() & comment.c & \cxreffunc{GetCurrentComment}{comment.c}\\
\ & NewTypedefType() & type.c & \cxreffunc{NewTypedefType}{type.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
\cxreftabbreak{cxreftabiii}
\ & \cxreftabiiispan{ strlen(), strncmp()} &\\
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
Refs Var:\ & CurFile & cxref.c & \cxrefvar{CurFile}{cxref.c}\\
\ & cur\_type\_su & type.c & \cxrefvar{cur_type_su}{type.c}\\
\ & last\_typedef & type.c & \cxrefvar{last_typedef}{type.c}\\
\ & parse\_line & parse-lex.c & \cxrefvar{parse_line}{parse-lex.c}\\
\ & type\_lineno & type.c & \cxrefvar{type_lineno}{type.c}\\
\end{cxreftabiii}


\subsubsection{Global Function SeenTypedefName()}
\label{func_SeenTypedefName_type.c}

  Function that is called when a typedef is seen in the current file. The name of the typedef is stored for future reference.

\smallskip
{\stt void SeenTypedefName ( char* name, int what\_type )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the defined type.
\cxrefargitem{int what\_type} Set to 1 for normal types or -1 for a function type (not pointer to function).
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & AddToStringList2() & slist.c & \cxreffunc{AddToStringList2}{slist.c}\\
\ & NewStringList2() & slist.c & \cxreffunc{NewStringList2}{slist.c}\\
Called by:\ & yyparse() & parse-yacc.c & \cxreffunc{yyparse}{parse-yacc.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & typedefs & type.c & \cxrefvar{typedefs}{type.c}\\
\end{cxreftabiii}


\subsubsection{Local Function CopyStructUnion()}
\label{func_CopyStructUnion_type.c}

  Make a copy of the specified Struct / Union structure.

\smallskip
{\stt static StructUnion CopyStructUnion ( StructUnion su )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{StructUnion CopyStructUnion} Returns a malloced copy of the specified struct / union.
\cxrefargitem{StructUnion su} The struct / union to copy.
\end{cxrefarglist}

\smallskip
  This needs to call itself recursively.

\smallskip
\begin{cxreftabiii}
Prototype:& type.c & \ & \cxreffile{type.c}\\
Calls:\ & CopyStructUnion() & type.c & \cxreffunc{CopyStructUnion}{type.c}\\
\ & NewStructUnionType() & type.c & \cxreffunc{NewStructUnionType}{type.c}\\
\ & SafeMalloc() & memory.c & \cxreffunc{SafeMalloc}{memory.c}\\
\cxreftabbreak{cxreftabiii}
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
Called by:\ & CopyStructUnion() & type.c & \cxreffunc{CopyStructUnion}{type.c}\\
\ & SeenStructUnionComp() & type.c & \cxreffunc{SeenStructUnionComp}{type.c}\\
\end{cxreftabiii}


\subsubsection{Local Function DeleteStructUnionType()}
\label{func_DeleteStructUnionType_type.c}

  Free the memory associated with a Struct / Union structure.

\smallskip
{\stt static void DeleteStructUnionType ( StructUnion su )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{StructUnion su} The struct / union to delete.
\end{cxrefarglist}

\smallskip
  This needs to call itself recursively.

\smallskip
\begin{cxreftabiii}
Prototype:& type.c & \ & \cxreffile{type.c}\\
Calls:\ & DeleteStructUnionType() & type.c & \cxreffunc{DeleteStructUnionType}{type.c}\\
\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
Called by:\ & DeleteStructUnionType() & type.c & \cxreffunc{DeleteStructUnionType}{type.c}\\
\cxreftabbreak{cxreftabiii}
\ & DeleteTypedefType() & type.c & \cxreffunc{DeleteTypedefType}{type.c}\\
\end{cxreftabiii}


\subsubsection{Local Function NewStructUnionType()}
\label{func_NewStructUnionType_type.c}

  Create a new struct / union type.

\smallskip
{\stt static StructUnion NewStructUnionType ( char* name )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{StructUnion NewStructUnionType} Return the new StructUnion type.
\cxrefargitem{char* name} The name of the new struct / union.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& type.c & \ & \cxreffile{type.c}\\
Calls:\ & SafeCalloc() & memory.c & \cxreffunc{SafeCalloc}{memory.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
Called by:\ & CopyStructUnion() & type.c & \cxreffunc{CopyStructUnion}{type.c}\\
\cxreftabbreak{cxreftabiii}
\ & SeenStructUnionComp() & type.c & \cxreffunc{SeenStructUnionComp}{type.c}\\
\ & SeenStructUnionStart() & type.c & \cxreffunc{SeenStructUnionStart}{type.c}\\
\end{cxreftabiii}


\subsubsection{Local Function NewTypedefType()}
\label{func_NewTypedefType_type.c}

  Create a new Typedef type.

\smallskip
{\stt static Typedef NewTypedefType ( char* name, char* type )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Typedef NewTypedefType} Returns the new type.
\cxrefargitem{char* name} The name of the type.
\cxrefargitem{char* type} The type of the type.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& type.c & \ & \cxreffile{type.c}\\
Calls:\ & SafeCalloc() & memory.c & \cxreffunc{SafeCalloc}{memory.c}\\
\ & SafeMallocString() & memory.c & \cxreffunc{SafeMallocString}{memory.c}\\
Called by:\ & SeenStructUnionComp() & type.c & \cxreffunc{SeenStructUnionComp}{type.c}\\
\cxreftabbreak{cxreftabiii}
\ & SeenStructUnionEnd() & type.c & \cxreffunc{SeenStructUnionEnd}{type.c}\\
\ & SeenTypedef() & type.c & \cxreffunc{SeenTypedef}{type.c}\\
\end{cxreftabiii}

