<!DOCTYPE LINUXDOC SYSTEM>

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

<article>

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

<sect>File sgml.c
<bf>RCS Header: /home/amb/cxref/RCS/sgml.c 1.1 1998/12/22 14:27:45 amb Exp </bf>
<p>

  C Cross Referencing &amp; Documentation tool. Version 1.5.
<newline>
  Writes the SGML 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 tex file that includes each of the others. 
<p>
<tt>#define SGML_FILE &quot;.sgml&quot;</tt><newline>
<p>
<tt>#define SGML_FILE_BACKUP &quot;.sgml&tilde;&quot;</tt><newline>
<p>
 The name of the output tex file that contains the appendix. 
<p>
<tt>#define SGML_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_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>goback</bf><newline>
 The directories to go back to get to the base output directory. 
<p>
<tt>static char* goback</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>WriteSGMLFile()
</itemize>
</descrip>
<p>
<bf>of</bf><newline>
 The output file for the SGML. 
<p>
<tt>static FILE* of</tt><newline>
<descrip>
<tag>Used in:</tag>
<itemize>
<item>WriteSGMLAppendix()
<item>WriteSGMLDefine()
<item>WriteSGMLFile()
<item>WriteSGMLFilePart()
<item>WriteSGMLFunction()
<item>WriteSGMLInclude()
<item>WriteSGMLStructUnion()
<item>WriteSGMLSubInclude()
<item>WriteSGMLTypedef()
<item>WriteSGMLVariable()
</itemize>
</descrip>

<sect1>Global Function WriteSGMLAppendix()

<p>  Write out the appendix information.
<p>
<tt>void WriteSGMLAppendix ( 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>WriteSGMLPostamble()  :  sgml.c
<item>WriteSGMLPreamble()  :  sgml.c
<item>sgml()  :  sgml.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  :  sgml.c
<item>option_name  :  cxref.c
<item>option_odir  :  cxref.c
</itemize>
</descrip>

<sect1>Global Function WriteSGMLFile()

<p>  Write an sgml file for a complete File structure and all components.
<p>
<tt>void WriteSGMLFile ( 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>WriteSGMLDefine()  :  sgml.c
<item>WriteSGMLFilePart()  :  sgml.c
<item>WriteSGMLFunction()  :  sgml.c
<item>WriteSGMLInclude()  :  sgml.c
<item>WriteSGMLPostamble()  :  sgml.c
<item>WriteSGMLPreamble()  :  sgml.c
<item>WriteSGMLTypedef()  :  sgml.c
<item>WriteSGMLVariable()  :  sgml.c
<item>sgml()  :  sgml.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>goback  :  sgml.c
<item>of  :  sgml.c
<item>option_name  :  cxref.c
<item>option_odir  :  cxref.c
</itemize>
</descrip>

<sect1>Global Function WriteSGMLFileDelete()

<p>  Delete the SGML file and main file reference that belong to the named file.
<p>
<tt>void WriteSGMLFileDelete ( 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 WriteSGMLDefine()

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

<sect1>Local Function WriteSGMLFilePart()

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

<sect1>Local Function WriteSGMLFunction()

<p>  Write a Function structure out.
<p>
<tt>static void WriteSGMLFunction ( Function func )</tt><newline>
<descrip>
<tag><tt>Function func</tt></tag>
The Function structure to output.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>sgml.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>sgml()  :  sgml.c
<item>fprintf(), strcmp(), strncmp(), strstr()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteSGMLFile()  :  sgml.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  sgml.c
<item>option_verbatim_comments  :  cxref.c
</itemize>
</descrip>

<sect1>Local Function WriteSGMLInclude()

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

<sect1>Local Function WriteSGMLPostamble()

<p>  Write out a standard post-amble. This includes the end of document marker.
<p>
<tt>static void WriteSGMLPostamble ( FILE* f )</tt><newline>
<descrip>
<tag><tt>FILE* f</tt></tag>
The file to write the post amble to.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>sgml.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>fputs()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteSGMLAppendix()  :  sgml.c
<item>WriteSGMLFile()  :  sgml.c
</itemize>
</descrip>

<sect1>Local Function WriteSGMLPreamble()

<p>  Write out a standard pre-amble.
<p>
<tt>static void WriteSGMLPreamble ( FILE* f, char* title )</tt><newline>
<descrip>
<tag><tt>FILE* f</tt></tag>
The file to write the pre amble to.
<tag><tt>char* title</tt></tag>
The title of the file.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>sgml.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>fputs()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteSGMLAppendix()  :  sgml.c
<item>WriteSGMLFile()  :  sgml.c
</itemize>
</descrip>

<sect1>Local Function WriteSGMLStructUnion()

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

<sect1>Local Function WriteSGMLSubInclude()

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

<sect1>Local Function WriteSGMLTypedef()

<p>  Write a Typedef structure out.
<p>
<tt>static void WriteSGMLTypedef ( Typedef type )</tt><newline>
<descrip>
<tag><tt>Typedef type</tt></tag>
The Typedef structure to output.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>sgml.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>WriteSGMLStructUnion()  :  sgml.c
<item>sgml()  :  sgml.c
<item>fprintf(), strncmp()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteSGMLFile()  :  sgml.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  sgml.c
</itemize>
</descrip>

<sect1>Local Function WriteSGMLVariable()

<p>  Write a Variable structure out.
<p>
<tt>static void WriteSGMLVariable ( Variable var )</tt><newline>
<descrip>
<tag><tt>Variable var</tt></tag>
The Variable structure to output.
</descrip>
<descrip>
<tag>Prototyped in:</tag>
<itemize>
<item>sgml.c
</itemize>
<tag>Calls:</tag>
<itemize>
<item>sgml()  :  sgml.c
<item>fprintf()
</itemize>
<tag>Called by:</tag>
<itemize>
<item>WriteSGMLFile()  :  sgml.c
</itemize>
<tag>References Variables:</tag>
<itemize>
<item>of  :  sgml.c
</itemize>
</descrip>

<sect1>Local Function sgml()

<p>  Make the input string safe to output as SGML ( not &lt;,  &gt;,  &amp;,  &quot;,  &dollar;,  &num;,  &percnt; or &tilde; ).
<p>
<tt>static char* sgml ( char* c, int verbatim )</tt><newline>
<descrip>
<tag><tt>char* sgml</tt></tag>
Returns a safe SGML string.
<tag><tt>char* c</tt></tag>
A non-safe SGML 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>sgml.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>WriteSGMLAppendix()  :  sgml.c
<item>WriteSGMLDefine()  :  sgml.c
<item>WriteSGMLFile()  :  sgml.c
<item>WriteSGMLFilePart()  :  sgml.c
<item>WriteSGMLFunction()  :  sgml.c
<item>WriteSGMLInclude()  :  sgml.c
<item>WriteSGMLStructUnion()  :  sgml.c
<item>WriteSGMLSubInclude()  :  sgml.c
<item>WriteSGMLTypedef()  :  sgml.c
<item>WriteSGMLVariable()  :  sgml.c
</itemize>
</descrip>

</article>
