<!DOCTYPE LINUXDOC SYSTEM>

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

<article>

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

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

  C Cross Referencing &amp; Documentation tool. Version 1.5.
<newline>
  Collects the typedef 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 output of debugging information in this file. 
<p>
<tt>#define DEBUG 0</tt><newline>

<sect1>External Variables

<p>
<bf>CurFile</bf><newline>
 The file that is currently being processed. 
<p>
<tt>extern File CurFile</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>CurFile</itemize>
</descrip>
<p>
<bf>in_typedef</bf><newline>
 Whether we are parsing a typedef or not. 
<p>
<tt>extern int in_typedef</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>in_typedef</itemize>
</descrip>

<sect1>Local Variables

<p>
<bf>typedefs</bf><newline>
 The defined types that we have seen. 
<p>
<tt>static StringList2 typedefs</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>IsATypeName()
<item>ResetTypeAnalyser()
<item>SeenTypedefName()
</itemize>
</descrip>
<p>
<bf>cur_su</bf><newline>
 The current struct / union or enum definition. 
<p>
<tt>static StructUnion cur_su</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetTypeAnalyser()
<item>SeenStructUnionComp()
<item>SeenStructUnionEnd()
<item>SeenStructUnionStart()
</itemize>
</descrip>
<p>
<bf>cur_type_su</bf><newline>
 The current struct / union if seen in a typedef. 
<p>
<tt>static StructUnion cur_type_su</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetTypeAnalyser()
<item>SeenStructUnionEnd()
<item>SeenTypedef()
</itemize>
</descrip>
<p>
<bf>last_typedef</bf><newline>
 The last typedef seen, used when two types share a typedef statement. 
<p>
<tt>static Typedef last_typedef</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>ResetTypeAnalyser()
<item>SeenTypedef()
</itemize>
</descrip>
<p>
<bf>type_lineno</bf><newline>
 The line number that a typedef or structure was seen on. 
<p>
<tt>static int type_lineno</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>SeenStructUnionEnd()
<item>SeenStructUnionStart()
<item>SeenTypedef()
</itemize>
</descrip>

<sect1>Global Function DeleteTypedefType()

<p>  Delete the specified Typedef type.
<p>
<tt>void DeleteTypedefType ( Typedef type )</tt><newline>
<descrip>
<tag><tt>Typedef type</tt></tag>
The Typedef type to be deleted.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>DeleteStructUnionType()  :  type.c
<item>SafeFree()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>DeleteFile()  :  file.c
</itemize>
</descrip>

<sect1>Global Function IsATypeName()

<p>  Function that is called when an IDENTIFIER is seen in the current file, it may be a defined type.
<p>
<tt>int IsATypeName ( char* name )</tt><newline>
<descrip>
<tag><tt>int IsATypeName</tt></tag>
Returns 1 if the argument is a type that has been defined.
<tag><tt>char* name</tt></tag>
The name of the possible defined type.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>strcmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yylex()  :  parse-lex.c
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>typedefs  :  type.c
</itemize>
</descrip>

<sect1>Global Function ResetTypeAnalyser()

<p>  Tidy up all of the local variables in case of a problem and abnormal parser termination.
<p>
<tt>void ResetTypeAnalyser ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>DeleteStringList2()  :  slist.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>main()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_su  :  type.c
<item>cur_type_su  :  type.c
<item>last_typedef  :  type.c
<item>typedefs  :  type.c
</itemize>
</descrip>

<sect1>Global Function SeenStructUnionComp()

<p>  Function called when a component of a struct / union / enum is seen.
<p>
<tt>void SeenStructUnionComp ( char* name, int depth )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the struct / union / enum component.
<tag><tt>int depth</tt></tag>
The depth within the nested struct / union / enum.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>ConcatStrings()  :  memory.c
<item>CopyStructUnion()  :  type.c
<item>GetCurrentComment()  :  comment.c
<item>NewStructUnionType()  :  type.c
<item>NewTypedefType()  :  type.c
<item>SafeFree()  :  memory.c
<item>SafeMalloc()  :  memory.c
<item>SafeMallocString()  :  memory.c
<item>SafeRealloc()  :  memory.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_su  :  type.c
</itemize>
</descrip>

<sect1>Global Function SeenStructUnionEnd()

<p>  Function that is called when the end of a struct or union or enum definition is seen.
<p>
<tt>void SeenStructUnionEnd ( void )</tt><newline>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>NewTypedefType()  :  type.c
<item>strlen(), strncmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>CurFile  :  cxref.c
<item>cur_su  :  type.c
<item>cur_type_su  :  type.c
<item>in_typedef  :  parse-yacc.c
<item>type_lineno  :  type.c
</itemize>
</descrip>

<sect1>Global Function SeenStructUnionStart()

<p>  Function that is called when the start of a struct or union or enum definition is seen.
<p>
<tt>void SeenStructUnionStart ( char* name )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the struct type.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>GetCurrentComment()  :  comment.c
<item>NewStructUnionType()  :  type.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>cur_su  :  type.c
<item>in_typedef  :  parse-yacc.c
<item>parse_line  :  parse-lex.c
<item>type_lineno  :  type.c
</itemize>
</descrip>

<sect1>Global Function SeenTypedef()

<p>  Function that is called when a typedef is seen in the current file. This is recorded fully for later output.
<p>
<tt>void SeenTypedef ( char* name, char* type )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the defined type.
<tag><tt>char* type</tt></tag>
The type that it is defined to be.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>GetCurrentComment()  :  comment.c
<item>NewTypedefType()  :  type.c
<item>SafeMallocString()  :  memory.c
<item>strlen(), strncmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>yyparse()  :  parse-yacc.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>CurFile  :  cxref.c
<item>cur_type_su  :  type.c
<item>last_typedef  :  type.c
<item>parse_line  :  parse-lex.c
<item>type_lineno  :  type.c
</itemize>
</descrip>

<sect1>Global Function SeenTypedefName()

<p>  Function that is called when a typedef is seen in the current file. The name of the typedef is stored for future reference.
<p>
<tt>void SeenTypedefName ( char* name, int what_type )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the defined type.
<tag><tt>int what_type</tt></tag>
Set to 1 for normal types or -1 for a function type (not pointer to function).
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<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>typedefs  :  type.c
</itemize>
</descrip>

<sect1>Local Function CopyStructUnion()

<p>  Make a copy of the specified Struct / Union structure.
<p>
<tt>static StructUnion CopyStructUnion ( StructUnion su )</tt><newline>
<descrip>
<tag><tt>StructUnion CopyStructUnion</tt></tag>
Returns a malloced copy of the specified struct / union.
<tag><tt>StructUnion su</tt></tag>
The struct / union to copy.
</descrip>
  This needs to call itself recursively.
<p>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>type.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>CopyStructUnion()  :  type.c
<item>NewStructUnionType()  :  type.c
<item>SafeMalloc()  :  memory.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>CopyStructUnion()  :  type.c
<item>SeenStructUnionComp()  :  type.c
</itemize>
</descrip>

<sect1>Local Function DeleteStructUnionType()

<p>  Free the memory associated with a Struct / Union structure.
<p>
<tt>static void DeleteStructUnionType ( StructUnion su )</tt><newline>
<descrip>
<tag><tt>StructUnion su</tt></tag>
The struct / union to delete.
</descrip>
  This needs to call itself recursively.
<p>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>type.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>DeleteStructUnionType()  :  type.c
<item>SafeFree()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>DeleteStructUnionType()  :  type.c
<item>DeleteTypedefType()  :  type.c
</itemize>
</descrip>

<sect1>Local Function NewStructUnionType()

<p>  Create a new struct / union type.
<p>
<tt>static StructUnion NewStructUnionType ( char* name )</tt><newline>
<descrip>
<tag><tt>StructUnion NewStructUnionType</tt></tag>
Return the new StructUnion type.
<tag><tt>char* name</tt></tag>
The name of the new struct / union.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>type.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>SafeCalloc()  :  memory.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>CopyStructUnion()  :  type.c
<item>SeenStructUnionComp()  :  type.c
<item>SeenStructUnionStart()  :  type.c
</itemize>
</descrip>

<sect1>Local Function NewTypedefType()

<p>  Create a new Typedef type.
<p>
<tt>static Typedef NewTypedefType ( char* name, char* type )</tt><newline>
<descrip>
<tag><tt>Typedef NewTypedefType</tt></tag>
Returns the new type.
<tag><tt>char* name</tt></tag>
The name of the type.
<tag><tt>char* type</tt></tag>
The type of the type.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>type.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>SafeCalloc()  :  memory.c
<item>SafeMallocString()  :  memory.c
</itemize>
<tag>Called by:</tag>
<itemize>
<item>SeenStructUnionComp()  :  type.c
<item>SeenStructUnionEnd()  :  type.c
<item>SeenTypedef()  :  type.c
</itemize>
</descrip>

</article>
