<!DOCTYPE LINUXDOC SYSTEM>

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

<article>

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

<sect>File latex.c
<bf>RCS Header: /home/amb/cxref/RCS/latex.c 1.30 1998/12/22 14:25:50 amb Exp </bf>
<p>

  C Cross Referencing &amp; Documentation tool. Version 1.5.
<newline>
  Writes the Latex output.
<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 &lt;sys/types.h&gt;</tt>
</itemize>
<itemize>
<item><tt>#include &lt;sys/stat.h&gt;</tt>
</itemize>
<itemize>
<item><tt>#include &lt;unistd.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;cxref.h&quot;</tt>
<itemize>
<item><tt>#include &quot;datatype.h&quot;</tt>
</itemize>
</itemize>

<sect1>Preprocessor definitions

<p>
<tt>#define min( x, y )</tt><newline>
<p>
 The name of the output tex file that includes each of the others. 
<p>
<tt>#define LATEX_FILE &quot;.tex&quot;</tt><newline>
<p>
<tt>#define LATEX_FILE_BACKUP &quot;.tex&tilde;&quot;</tt><newline>
<p>
 The name of the output tex file that contains the appendix. 
<p>
<tt>#define LATEX_APDX &quot;.apdx&quot;</tt><newline>

<sect1>External Variables

<p>
<bf>option_verbatim_comments</bf><newline>
 The comments are to be inserted verbatim. 
<p>
<tt>extern int option_verbatim_comments</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>option_verbatim_comments</itemize>
</descrip>
<p>
<bf>option_latex</bf><newline>
 The type of LaTeX output to produce. 
<p>
<tt>extern int option_latex</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>option_latex</itemize>
</descrip>
<p>
<bf>option_odir</bf><newline>
 The name of the directory for the output. 
<p>
<tt>extern char* option_odir</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>option_odir</itemize>
</descrip>
<p>
<bf>option_name</bf><newline>
 The base name of the file for the output. 
<p>
<tt>extern char* option_name</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>option_name</itemize>
</descrip>
<p>
<bf>latex_fonts_style</bf><newline>
<tt>extern char* latex_fonts_style</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>latex_fonts_style</itemize>
</descrip>
<p>
<bf>latex_page_style</bf><newline>
<tt>extern char* latex_page_style</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>latex_page_style</itemize>
</descrip>
<p>
<bf>latex_cxref_style</bf><newline>
<tt>extern char* latex_cxref_style</tt><newline>
<descrip>
<tag>Defined in:</tag>
<itemize>
<item>latex_cxref_style</itemize>
</descrip>

<sect1>Local Variables

<p>
<bf>of</bf><newline>
 The output file for the latex. 
<p>
<tt>static FILE* of</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>WriteLatexAppendix()
<item>WriteLatexDefine()
<item>WriteLatexFile()
<item>WriteLatexFilePart()
<item>WriteLatexFunction()
<item>WriteLatexInclude()
<item>WriteLatexStructUnion()
<item>WriteLatexSubInclude()
<item>WriteLatexTypedef()
<item>WriteLatexVariable()
</itemize>
</descrip>
<p>
<bf>countlines</bf><newline>
 Counts the lines in a table to insert breaks. 
<p>
<tt>static int countlines</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>WriteLatexInclude()
<item>WriteLatexStructUnion()
<item>WriteLatexSubInclude()
<item>WriteLatexTypedef()
</itemize>
</descrip>

<sect1>Global Function WriteLatexAppendix()

<p>  Write out the appendix information.
<p>
<tt>void WriteLatexAppendix ( StringList files, StringList2 funcs, StringList2 vars, StringList2 types )</tt><newline>
<descrip>
<tag><tt>StringList files</tt></tag>
The list of files to write.
<tag><tt>StringList2 funcs</tt></tag>
The list of functions to write.
<tag><tt>StringList2 vars</tt></tag>
The list of variables to write.
<tag><tt>StringList2 types</tt></tag>
The list of types to write.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>ConcatStrings()  :  memory.c
<item>WriteLatexDocument()  :  latex.c
<item>latex()  :  latex.c
<item>exit(), fclose(), fopen(), fprintf(), strncmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>main()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  latex.c
<item>option_name  :  cxref.c
<item>option_odir  :  cxref.c
</itemize>
</descrip>

<sect1>Global Function WriteLatexFile()

<p>  Write a Latex file for a complete File structure and all components.
<p>
<tt>void WriteLatexFile ( File file )</tt><newline>
<descrip>
<tag><tt>File file</tt></tag>
The File structure to output.
</descrip>
 The file structure is broken into its components and they are each written out. 
<p>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>ConcatStrings()  :  memory.c
<item>WriteLatexDefine()  :  latex.c
<item>WriteLatexDocument()  :  latex.c
<item>WriteLatexFilePart()  :  latex.c
<item>WriteLatexFunction()  :  latex.c
<item>WriteLatexInclude()  :  latex.c
<item>WriteLatexTypedef()  :  latex.c
<item>WriteLatexVariable()  :  latex.c
<item>latex()  :  latex.c
<item>exit(), fclose(), fopen(), fprintf(), fputs(), mkdir(), stat(), strlen()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>main()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  latex.c
<item>option_odir  :  cxref.c
</itemize>
</descrip>

<sect1>Global Function WriteLatexFileDelete()

<p>  Delete the latex file and main file reference that belong to the named file.
<p>
<tt>void WriteLatexFileDelete ( char* name )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the file to delete.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>cxref.h
</itemize>
<tag>Calls:</tag>
<itemize>
<item>ConcatStrings()  :  memory.c
<item>fclose(), fgets(), fopen(), fprintf(), fputs(), rename(), strcmp(), unlink()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>main()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>option_name  :  cxref.c
<item>option_odir  :  cxref.c
</itemize>
</descrip>

<sect1>Local Function WriteLatexDefine()

<p>  Write a Define structure out.
<p>
<tt>static void WriteLatexDefine ( Define def )</tt><newline>
<descrip>
<tag><tt>Define def</tt></tag>
The Define structure to output.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>latex.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>latex()  :  latex.c
<item>fprintf()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteLatexFile()  :  latex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  latex.c
</itemize>
</descrip>

<sect1>Local Function WriteLatexDocument()

<p>  Write out a file that will include the current information.
<p>
<tt>static void WriteLatexDocument ( char* name, int appendix )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the file (without the LaTeX extension).
<tag><tt>int appendix</tt></tag>
set to non-zero if the appendix file is to be added, else a normal source file.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>latex.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>ConcatStrings()  :  memory.c
<item>WriteLatexTemplate()  :  latex.c
<item>exit(), fclose(), fgets(), fopen(), fprintf(), fputs(), rename(), strcmp(), unlink()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteLatexAppendix()  :  latex.c
<item>WriteLatexFile()  :  latex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>option_name  :  cxref.c
<item>option_odir  :  cxref.c
</itemize>
</descrip>

<sect1>Local Function WriteLatexFilePart()

<p>  Write a File structure out.
<p>
<tt>static void WriteLatexFilePart ( File file )</tt><newline>
<descrip>
<tag><tt>File file</tt></tag>
The File to output.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>latex.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>latex()  :  latex.c
<item>fprintf(), strstr()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteLatexFile()  :  latex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  latex.c
<item>option_verbatim_comments  :  cxref.c
</itemize>
</descrip>

<sect1>Local Function WriteLatexFunction()

<p>  Write a Function structure out.
<p>
<tt>static void WriteLatexFunction ( Function func, char* filename )</tt><newline>
<descrip>
<tag><tt>Function func</tt></tag>
The Function structure to output.
<tag><tt>char* filename</tt></tag>
The name of the file that is being processed (required for the cross reference label).
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>latex.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>latex()  :  latex.c
<item>fprintf(), strcmp(), strncmp(), strstr()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteLatexFile()  :  latex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  latex.c
<item>option_verbatim_comments  :  cxref.c
</itemize>
</descrip>

<sect1>Local Function WriteLatexInclude()

<p>  Write an Include structure out.
<p>
<tt>static void WriteLatexInclude ( Include inc )</tt><newline>
<descrip>
<tag><tt>Include inc</tt></tag>
The Include structure to output.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>latex.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>WriteLatexSubInclude()  :  latex.c
<item>latex()  :  latex.c
<item>fprintf()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteLatexFile()  :  latex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>countlines  :  latex.c
<item>of  :  latex.c
</itemize>
</descrip>

<sect1>Local Function WriteLatexStructUnion()

<p>  Write a structure / union structure out.
<p>
<tt>static void WriteLatexStructUnion ( StructUnion su, int depth )</tt><newline>
<descrip>
<tag><tt>StructUnion su</tt></tag>
The structure / union to write.
<tag><tt>int depth</tt></tag>
The current depth within the structure.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>latex.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>WriteLatexStructUnion()  :  latex.c
<item>latex()  :  latex.c
<item>fprintf(), strstr()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteLatexStructUnion()  :  latex.c
<item>WriteLatexTypedef()  :  latex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>countlines  :  latex.c
<item>of  :  latex.c
</itemize>
</descrip>

<sect1>Local Function WriteLatexSubInclude()

<p>  Write an Sub Include structure out. (An include structure that is included from another file.)
<p>
<tt>static void WriteLatexSubInclude ( Include inc, int depth )</tt><newline>
<descrip>
<tag><tt>Include inc</tt></tag>
The Include structure to output.
<tag><tt>int depth</tt></tag>
The depth of the include hierarchy.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>latex.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>WriteLatexSubInclude()  :  latex.c
<item>latex()  :  latex.c
<item>fprintf()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteLatexInclude()  :  latex.c
<item>WriteLatexSubInclude()  :  latex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>countlines  :  latex.c
<item>of  :  latex.c
</itemize>
</descrip>

<sect1>Local Function WriteLatexTemplate()

<p>  Write out the standard template for the main LaTeX file.
  This sets up the page styles, and includes markers for the start and end of included source code.
<p>
<tt>static void WriteLatexTemplate ( char* name )</tt><newline>
<descrip>
<tag><tt>char* name</tt></tag>
The name of the file to write the template to.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>latex.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>ConcatStrings()  :  memory.c
<item>exit(), fclose(), fopen(), fprintf(), fputs(), stat()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteLatexDocument()  :  latex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>latex_cxref_style  :  latex-style.c
<item>latex_fonts_style  :  latex-style.c
<item>latex_page_style  :  latex-style.c
<item>option_latex  :  cxref.c
<item>option_odir  :  cxref.c
</itemize>
</descrip>

<sect1>Local Function WriteLatexTypedef()

<p>  Write a Typedef structure out.
<p>
<tt>static void WriteLatexTypedef ( Typedef type, char* filename )</tt><newline>
<descrip>
<tag><tt>Typedef type</tt></tag>
The Typedef structure to output.
<tag><tt>char* filename</tt></tag>
The name of the file that is being processed (required for the cross reference label).
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>latex.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>WriteLatexStructUnion()  :  latex.c
<item>latex()  :  latex.c
<item>fprintf(), strncmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteLatexFile()  :  latex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>countlines  :  latex.c
<item>of  :  latex.c
</itemize>
</descrip>

<sect1>Local Function WriteLatexVariable()

<p>  Write a Variable structure out.
<p>
<tt>static void WriteLatexVariable ( Variable var, char* filename )</tt><newline>
<descrip>
<tag><tt>Variable var</tt></tag>
The Variable structure to output.
<tag><tt>char* filename</tt></tag>
The name of the file that is being processed (required for the cross reference label).
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>latex.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>latex()  :  latex.c
<item>fprintf()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteLatexFile()  :  latex.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  latex.c
</itemize>
</descrip>

<sect1>Local Function latex()

<p>  Make the input string safe to output as LaTeX ( not &num;, &dollar;, &percnt;, &amp;, \, ^, _, {, }, &lt;, &gt; or &tilde; ).
<p>
<tt>static char* latex ( char* c )</tt><newline>
<descrip>
<tag><tt>char* latex</tt></tag>
Returns a safe LaTeX string.
<tag><tt>char* c</tt></tag>
A non-safe LaTeX string.
</descrip>
  The function can only be called four times in each fprintf() since it returns one of only four static strings.
<p>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>latex.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>CopyOrSkip()  :  warn-raw.c
<item>SafeFree()  :  memory.c
<item>SafeMalloc()  :  memory.c
<item>SafeRealloc()  :  memory.c
<item>strcpy(), strncpy()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteLatexAppendix()  :  latex.c
<item>WriteLatexDefine()  :  latex.c
<item>WriteLatexFile()  :  latex.c
<item>WriteLatexFilePart()  :  latex.c
<item>WriteLatexFunction()  :  latex.c
<item>WriteLatexInclude()  :  latex.c
<item>WriteLatexStructUnion()  :  latex.c
<item>WriteLatexSubInclude()  :  latex.c
<item>WriteLatexTypedef()  :  latex.c
<item>WriteLatexVariable()  :  latex.c
</itemize>
</descrip>

</article>
