<!DOCTYPE LINUXDOC SYSTEM>

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

<article>

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

<sect>File rtf.c
<bf>RCS Header: /home/amb/cxref/RCS/rtf.c 1.3 1999/01/11 19:34:07 amb Exp </bf>
<p>

  C Cross Referencing &amp; Documentation tool. Version 1.5.
<newline>
  Writes the RTF 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>
 The name of the output rtf file. 
<p>
<tt>#define RTF_FILE &quot;.rtf&quot;</tt><newline>
<p>
<tt>#define RTF_FILE_BACKUP &quot;.rtf&tilde;&quot;</tt><newline>
<p>
 The name of the output rtf file that contains the appendix. 
<p>
<tt>#define RTF_APDX &quot;.apdx&quot;</tt><newline>
<p>
<tt>#define STYLE_NORM &quot;\\s0\\f0\\fs24&quot;</tt><newline>
<p>
<tt>#define STYLE_H1 &quot;\\s1\\f0\\fs40\\b\\sb400\\sa200\\keepn\\keep&quot;</tt><newline>
<p>
<tt>#define STYLE_H2 &quot;\\s2\\f0\\fs32\\b\\sb200\\sa100\\keepn\\keep&quot;</tt><newline>
<p>
<tt>#define STYLE_H3 &quot;\\s3\\f0\\fs28\\b\\sb100\\sa100\\keepn\\keep&quot;</tt><newline>
<p>
<tt>#define STYLE_H4 &quot;\\s4\\f0\\fs24\\b\\sb100\\sa50\\keepn\\keep&quot;</tt><newline>
<p>
<tt>#define STYLE_TT &quot;\\s5\\f1\\fs20\\ql\\sb50\\sa50&quot;</tt><newline>
<p>
<tt>#define STYLE_IND &quot;\\s6\\f0\\fs24\\ql\\li720&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_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>

<sect1>Local Variables

<p>
<bf>of</bf><newline>
 The output file for the RTF. 
<p>
<tt>static FILE* of</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>WriteRTFAppendix()
<item>WriteRTFDefine()
<item>WriteRTFFile()
<item>WriteRTFFilePart()
<item>WriteRTFFunction()
<item>WriteRTFInclude()
<item>WriteRTFStructUnion()
<item>WriteRTFSubInclude()
<item>WriteRTFTypedef()
<item>WriteRTFVariable()
</itemize>
</descrip>

<sect1>Global Function WriteRTFAppendix()

<p>  Write out the appendix information.
<p>
<tt>void WriteRTFAppendix ( 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>WriteRTFPostamble()  :  rtf.c
<item>WriteRTFPreamble()  :  rtf.c
<item>rtf()  :  rtf.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  :  rtf.c
<item>option_name  :  cxref.c
<item>option_odir  :  cxref.c
</itemize>
</descrip>

<sect1>Global Function WriteRTFFile()

<p>  Write an RTF file for a complete File structure and all components.
<p>
<tt>void WriteRTFFile ( 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>WriteRTFDefine()  :  rtf.c
<item>WriteRTFFilePart()  :  rtf.c
<item>WriteRTFFunction()  :  rtf.c
<item>WriteRTFInclude()  :  rtf.c
<item>WriteRTFPostamble()  :  rtf.c
<item>WriteRTFPreamble()  :  rtf.c
<item>WriteRTFTypedef()  :  rtf.c
<item>WriteRTFVariable()  :  rtf.c
<item>rtf()  :  rtf.c
<item>exit(), fclose(), fopen(), fprintf(), mkdir(), stat(), strlen()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>main()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  rtf.c
<item>option_odir  :  cxref.c
</itemize>
</descrip>

<sect1>Global Function WriteRTFFileDelete()

<p>  Delete the RTF file and main file reference that belong to the named file.
<p>
<tt>void WriteRTFFileDelete ( 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>unlink()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>main()  :  cxref.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>option_odir  :  cxref.c
</itemize>
</descrip>

<sect1>Local Function WriteRTFDefine()

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

<sect1>Local Function WriteRTFFilePart()

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

<sect1>Local Function WriteRTFFunction()

<p>  Write a Function structure out.
<p>
<tt>static void WriteRTFFunction ( 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>rtf.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>rtf()  :  rtf.c
<item>fprintf(), strcmp(), strncmp(), strstr()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteRTFFile()  :  rtf.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  rtf.c
<item>option_verbatim_comments  :  cxref.c
</itemize>
</descrip>

<sect1>Local Function WriteRTFInclude()

<p>  Write an Include structure out.
<p>
<tt>static void WriteRTFInclude ( Include inc )</tt><newline>
<descrip>
<tag><tt>Include inc</tt></tag>
The Include structure to output.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>rtf.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>WriteRTFSubInclude()  :  rtf.c
<item>rtf()  :  rtf.c
<item>fprintf()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteRTFFile()  :  rtf.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  rtf.c
</itemize>
</descrip>

<sect1>Local Function WriteRTFPostamble()

<p>  Write out the tail of an RTF file.
<p>
<tt>static void WriteRTFPostamble ( FILE* f )</tt><newline>
<descrip>
<tag><tt>FILE* f</tt></tag>
The file to write to.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>rtf.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>fputs()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteRTFAppendix()  :  rtf.c
<item>WriteRTFFile()  :  rtf.c
</itemize>
</descrip>

<sect1>Local Function WriteRTFPreamble()

<p>  Write out the head of an RTF file.
<p>
<tt>static void WriteRTFPreamble ( FILE* f )</tt><newline>
<descrip>
<tag><tt>FILE* f</tt></tag>
The file to write to.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>rtf.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>fputs(), strcmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteRTFAppendix()  :  rtf.c
<item>WriteRTFFile()  :  rtf.c
</itemize>
</descrip>

<sect1>Local Function WriteRTFStructUnion()

<p>  Write a structure / union structure out.
<p>
<tt>static void WriteRTFStructUnion ( 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>rtf.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>WriteRTFStructUnion()  :  rtf.c
<item>rtf()  :  rtf.c
<item>fprintf(), strstr()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteRTFStructUnion()  :  rtf.c
<item>WriteRTFTypedef()  :  rtf.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  rtf.c
</itemize>
</descrip>

<sect1>Local Function WriteRTFSubInclude()

<p>  Write an Sub Include structure out. (An include structure that is included from another file.)
<p>
<tt>static void WriteRTFSubInclude ( 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>rtf.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>WriteRTFSubInclude()  :  rtf.c
<item>rtf()  :  rtf.c
<item>fprintf()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteRTFInclude()  :  rtf.c
<item>WriteRTFSubInclude()  :  rtf.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  rtf.c
</itemize>
</descrip>

<sect1>Local Function WriteRTFTypedef()

<p>  Write a Typedef structure out.
<p>
<tt>static void WriteRTFTypedef ( 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>rtf.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>WriteRTFStructUnion()  :  rtf.c
<item>rtf()  :  rtf.c
<item>fprintf(), strncmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteRTFFile()  :  rtf.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  rtf.c
</itemize>
</descrip>

<sect1>Local Function WriteRTFVariable()

<p>  Write a Variable structure out.
<p>
<tt>static void WriteRTFVariable ( 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>rtf.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>rtf()  :  rtf.c
<item>fprintf()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteRTFFile()  :  rtf.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  rtf.c
</itemize>
</descrip>

<sect1>Local Function rtf()

<p>  Make the input string safe to output as RTF ( not \, { or } ).
<p>
<tt>static char* rtf ( char* c, int verbatim )</tt><newline>
<descrip>
<tag><tt>char* rtf</tt></tag>
Returns a safe RTF string.
<tag><tt>char* c</tt></tag>
A non-safe RTF string.
<tag><tt>int verbatim</tt></tag>
Set to true inside a verbatim environment.
</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>rtf.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>CopyOrSkip()  :  warn-raw.c
<item>SafeFree()  :  memory.c
<item>SafeMalloc()  :  memory.c
<item>SafeRealloc()  :  memory.c
<item>strncpy()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteRTFAppendix()  :  rtf.c
<item>WriteRTFDefine()  :  rtf.c
<item>WriteRTFFile()  :  rtf.c
<item>WriteRTFFilePart()  :  rtf.c
<item>WriteRTFFunction()  :  rtf.c
<item>WriteRTFInclude()  :  rtf.c
<item>WriteRTFStructUnion()  :  rtf.c
<item>WriteRTFSubInclude()  :  rtf.c
<item>WriteRTFTypedef()  :  rtf.c
<item>WriteRTFVariable()  :  rtf.c
</itemize>
</descrip>

</article>
