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

\markboth{File sgml.c}{File sgml.c}
\section{File sgml.c}
\label{file_sgml.c}

{\bf RCS Header: /home/amb/cxref/RCS/sgml.c 1.1 1998/12/22 14:27:45 amb Exp }

\smallskip

  C Cross Referencing \& Documentation tool. Version 1.5.

  Writes the SGML output.


\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 <sys/types.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include <sys/stat.h>} &\\
\end{cxreftabi}

\medskip
\begin{cxreftabi}
{\stt \#include <unistd.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 "cxref.h"} &\cxreffile{cxref.h}\\
\hspace*{0.2in}{\stt \#include "datatype.h"} &\cxreffile{datatype.h}\\
\end{cxreftabi}


\subsection*{Preprocessor definitions}

 The name of the output tex file that includes each of the others. 

\smallskip
{\stt \#define SGML\_FILE ".sgml"}

\medskip
{\stt \#define SGML\_FILE\_BACKUP ".sgml$\sim$"}

\medskip
 The name of the output tex file that contains the appendix. 

\smallskip
{\stt \#define SGML\_APDX ".apdx"}


\subsection{Variables}


\subsubsection{External Variables}

{\bf option\_verbatim\_comments}
\label{var_option_verbatim_comments_sgml.c}

 The comments are to be inserted verbatim. 

\smallskip
{\stt extern int option\_verbatim\_comments}

\smallskip
\begin{cxreftabiii}
Defined in:& cxref.c & \ & \cxrefvar{option_verbatim_comments}{cxref.c}\\
\end{cxreftabiii}

\medskip
{\bf option\_odir}
\label{var_option_odir_sgml.c}

 The name of the directory for the output. 

\smallskip
{\stt extern char* option\_odir}

\smallskip
\begin{cxreftabiii}
Defined in:& cxref.c & \ & \cxrefvar{option_odir}{cxref.c}\\
\end{cxreftabiii}

\medskip
{\bf option\_name}
\label{var_option_name_sgml.c}

 The base name of the file for the output. 

\smallskip
{\stt extern char* option\_name}

\smallskip
\begin{cxreftabiii}
Defined in:& cxref.c & \ & \cxrefvar{option_name}{cxref.c}\\
\end{cxreftabiii}


\subsubsection{Local Variables}

{\bf goback}
\label{var_goback_sgml.c}

 The directories to go back to get to the base output directory. 

\smallskip
{\stt static char* goback}

\smallskip
\begin{cxreftabiii}
Used in:\ & WriteSGMLFile() & \ & \cxreffunc{WriteSGMLFile}{sgml.c}\\
\end{cxreftabiii}

\medskip
{\bf of}
\label{var_of_sgml.c}

 The output file for the SGML. 

\smallskip
{\stt static FILE* of}

\smallskip
\begin{cxreftabiii}
Used in:\ & WriteSGMLAppendix() & \ & \cxreffunc{WriteSGMLAppendix}{sgml.c}\\
\ & WriteSGMLDefine() & \ & \cxreffunc{WriteSGMLDefine}{sgml.c}\\
\ & WriteSGMLFile() & \ & \cxreffunc{WriteSGMLFile}{sgml.c}\\
\ & WriteSGMLFilePart() & \ & \cxreffunc{WriteSGMLFilePart}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
\ & WriteSGMLFunction() & \ & \cxreffunc{WriteSGMLFunction}{sgml.c}\\
\ & WriteSGMLInclude() & \ & \cxreffunc{WriteSGMLInclude}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
\ & WriteSGMLStructUnion() & \ & \cxreffunc{WriteSGMLStructUnion}{sgml.c}\\
\ & WriteSGMLSubInclude() & \ & \cxreffunc{WriteSGMLSubInclude}{sgml.c}\\
\ & WriteSGMLTypedef() & \ & \cxreffunc{WriteSGMLTypedef}{sgml.c}\\
\ & WriteSGMLVariable() & \ & \cxreffunc{WriteSGMLVariable}{sgml.c}\\
\end{cxreftabiii}


\subsection{Functions}


\subsubsection{Global Function WriteSGMLAppendix()}
\label{func_WriteSGMLAppendix_sgml.c}

  Write out the appendix information.

\smallskip
{\stt void WriteSGMLAppendix ( StringList files, StringList2 funcs, StringList2 vars, StringList2 types )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{StringList files} The list of files to write.
\cxrefargitem{StringList2 funcs} The list of functions to write.
\cxrefargitem{StringList2 vars} The list of variables to write.
\cxrefargitem{StringList2 types} The list of types to write.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & ConcatStrings() & memory.c & \cxreffunc{ConcatStrings}{memory.c}\\
\ & WriteSGMLPostamble() & sgml.c & \cxreffunc{WriteSGMLPostamble}{sgml.c}\\
\ & WriteSGMLPreamble() & sgml.c & \cxreffunc{WriteSGMLPreamble}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\ & \cxreftabiiispan{ exit(), fclose(), fopen(), fprintf(), strncmp()} &\\
Called by:\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
Refs Var:\ & of & sgml.c & \cxrefvar{of}{sgml.c}\\
\ & option\_name & cxref.c & \cxrefvar{option_name}{cxref.c}\\
\ & option\_odir & cxref.c & \cxrefvar{option_odir}{cxref.c}\\
\end{cxreftabiii}


\subsubsection{Global Function WriteSGMLFile()}
\label{func_WriteSGMLFile_sgml.c}

  Write an sgml file for a complete File structure and all components.

\smallskip
{\stt void WriteSGMLFile ( File file )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{File file} The File structure to output.
\end{cxrefarglist}

\smallskip
 The file structure is broken into its components and they are each written out. 

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & ConcatStrings() & memory.c & \cxreffunc{ConcatStrings}{memory.c}\\
\ & WriteSGMLDefine() & sgml.c & \cxreffunc{WriteSGMLDefine}{sgml.c}\\
\ & WriteSGMLFilePart() & sgml.c & \cxreffunc{WriteSGMLFilePart}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
\ & WriteSGMLFunction() & sgml.c & \cxreffunc{WriteSGMLFunction}{sgml.c}\\
\ & WriteSGMLInclude() & sgml.c & \cxreffunc{WriteSGMLInclude}{sgml.c}\\
\ & WriteSGMLPostamble() & sgml.c & \cxreffunc{WriteSGMLPostamble}{sgml.c}\\
\ & WriteSGMLPreamble() & sgml.c & \cxreffunc{WriteSGMLPreamble}{sgml.c}\\
\ & WriteSGMLTypedef() & sgml.c & \cxreffunc{WriteSGMLTypedef}{sgml.c}\\
\ & WriteSGMLVariable() & sgml.c & \cxreffunc{WriteSGMLVariable}{sgml.c}\\
\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\ & \cxreftabiiispan{ exit(), fclose(), fopen(), fprintf(), mkdir(), stat(), strlen()} &\\
Called by:\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & goback & sgml.c & \cxrefvar{goback}{sgml.c}\\
\ & of & sgml.c & \cxrefvar{of}{sgml.c}\\
\ & option\_name & cxref.c & \cxrefvar{option_name}{cxref.c}\\
\ & option\_odir & cxref.c & \cxrefvar{option_odir}{cxref.c}\\
\end{cxreftabiii}


\subsubsection{Global Function WriteSGMLFileDelete()}
\label{func_WriteSGMLFileDelete_sgml.c}

  Delete the SGML file and main file reference that belong to the named file.

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

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* name} The name of the file to delete.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& cxref.h & \ & \cxreffile{cxref.h}\\
Calls:\ & ConcatStrings() & memory.c & \cxreffunc{ConcatStrings}{memory.c}\\
\ & \cxreftabiiispan{ unlink()} &\\
Called by:\ & main() & cxref.c & \cxreffunc{main}{cxref.c}\\
Refs Var:\ & option\_odir & cxref.c & \cxrefvar{option_odir}{cxref.c}\\
\cxreftabbreak{cxreftabiii}
\end{cxreftabiii}


\subsubsection{Local Function WriteSGMLDefine()}
\label{func_WriteSGMLDefine_sgml.c}

  Write a Define structure out.

\smallskip
{\stt static void WriteSGMLDefine ( Define def )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Define def} The Define structure to output.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& sgml.c & \ & \cxreffile{sgml.c}\\
Calls:\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\ & \cxreftabiiispan{ fprintf()} &\\
Called by:\ & WriteSGMLFile() & sgml.c & \cxreffunc{WriteSGMLFile}{sgml.c}\\
Refs Var:\ & of & sgml.c & \cxrefvar{of}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
\end{cxreftabiii}


\subsubsection{Local Function WriteSGMLFilePart()}
\label{func_WriteSGMLFilePart_sgml.c}

  Write a File structure out.

\smallskip
{\stt static void WriteSGMLFilePart ( File file )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{File file} The File to output.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& sgml.c & \ & \cxreffile{sgml.c}\\
Calls:\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\ & \cxreftabiiispan{ fprintf(), strstr()} &\\
Called by:\ & WriteSGMLFile() & sgml.c & \cxreffunc{WriteSGMLFile}{sgml.c}\\
Refs Var:\ & of & sgml.c & \cxrefvar{of}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
\ & option\_verbatim\_comments & cxref.c & \cxrefvar{option_verbatim_comments}{cxref.c}\\
\end{cxreftabiii}


\subsubsection{Local Function WriteSGMLFunction()}
\label{func_WriteSGMLFunction_sgml.c}

  Write a Function structure out.

\smallskip
{\stt static void WriteSGMLFunction ( Function func )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Function func} The Function structure to output.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& sgml.c & \ & \cxreffile{sgml.c}\\
Calls:\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\ & \cxreftabiiispan{ fprintf(), strcmp(), strncmp(), strstr()} &\\
Called by:\ & WriteSGMLFile() & sgml.c & \cxreffunc{WriteSGMLFile}{sgml.c}\\
Refs Var:\ & of & sgml.c & \cxrefvar{of}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
\ & option\_verbatim\_comments & cxref.c & \cxrefvar{option_verbatim_comments}{cxref.c}\\
\end{cxreftabiii}


\subsubsection{Local Function WriteSGMLInclude()}
\label{func_WriteSGMLInclude_sgml.c}

  Write an Include structure out.

\smallskip
{\stt static void WriteSGMLInclude ( Include inc )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Include inc} The Include structure to output.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& sgml.c & \ & \cxreffile{sgml.c}\\
Calls:\ & WriteSGMLSubInclude() & sgml.c & \cxreffunc{WriteSGMLSubInclude}{sgml.c}\\
\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\ & \cxreftabiiispan{ fprintf()} &\\
Called by:\ & WriteSGMLFile() & sgml.c & \cxreffunc{WriteSGMLFile}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & of & sgml.c & \cxrefvar{of}{sgml.c}\\
\end{cxreftabiii}


\subsubsection{Local Function WriteSGMLPostamble()}
\label{func_WriteSGMLPostamble_sgml.c}

  Write out a standard post-amble. This includes the end of document marker.

\smallskip
{\stt static void WriteSGMLPostamble ( FILE* f )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{FILE* f} The file to write the post amble to.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& sgml.c & \ & \cxreffile{sgml.c}\\
Calls:\ & \cxreftabiiispan{ fputs()} &\\
Called by:\ & WriteSGMLAppendix() & sgml.c & \cxreffunc{WriteSGMLAppendix}{sgml.c}\\
\ & WriteSGMLFile() & sgml.c & \cxreffunc{WriteSGMLFile}{sgml.c}\\
\end{cxreftabiii}


\subsubsection{Local Function WriteSGMLPreamble()}
\label{func_WriteSGMLPreamble_sgml.c}

  Write out a standard pre-amble.

\smallskip
{\stt static void WriteSGMLPreamble ( FILE* f, char* title )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{FILE* f} The file to write the pre amble to.
\cxrefargitem{char* title} The title of the file.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& sgml.c & \ & \cxreffile{sgml.c}\\
Calls:\ & \cxreftabiiispan{ fputs()} &\\
Called by:\ & WriteSGMLAppendix() & sgml.c & \cxreffunc{WriteSGMLAppendix}{sgml.c}\\
\ & WriteSGMLFile() & sgml.c & \cxreffunc{WriteSGMLFile}{sgml.c}\\
\end{cxreftabiii}


\subsubsection{Local Function WriteSGMLStructUnion()}
\label{func_WriteSGMLStructUnion_sgml.c}

  Write a structure / union structure out.

\smallskip
{\stt static void WriteSGMLStructUnion ( StructUnion su, int depth )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{StructUnion su} The structure / union to write.
\cxrefargitem{int depth} The current depth within the structure.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& sgml.c & \ & \cxreffile{sgml.c}\\
Calls:\ & WriteSGMLStructUnion() & sgml.c & \cxreffunc{WriteSGMLStructUnion}{sgml.c}\\
\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\ & \cxreftabiiispan{ fprintf(), strstr()} &\\
Called by:\ & WriteSGMLStructUnion() & sgml.c & \cxreffunc{WriteSGMLStructUnion}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
\ & WriteSGMLTypedef() & sgml.c & \cxreffunc{WriteSGMLTypedef}{sgml.c}\\
Refs Var:\ & of & sgml.c & \cxrefvar{of}{sgml.c}\\
\end{cxreftabiii}


\subsubsection{Local Function WriteSGMLSubInclude()}
\label{func_WriteSGMLSubInclude_sgml.c}

  Write an Sub Include structure out. (An include structure that is included from another file.)

\smallskip
{\stt static void WriteSGMLSubInclude ( Include inc, int depth )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Include inc} The Include structure to output.
\cxrefargitem{int depth} The depth of the include hierarchy.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& sgml.c & \ & \cxreffile{sgml.c}\\
Calls:\ & WriteSGMLSubInclude() & sgml.c & \cxreffunc{WriteSGMLSubInclude}{sgml.c}\\
\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\ & \cxreftabiiispan{ fprintf()} &\\
Called by:\ & WriteSGMLInclude() & sgml.c & \cxreffunc{WriteSGMLInclude}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
\ & WriteSGMLSubInclude() & sgml.c & \cxreffunc{WriteSGMLSubInclude}{sgml.c}\\
Refs Var:\ & of & sgml.c & \cxrefvar{of}{sgml.c}\\
\end{cxreftabiii}


\subsubsection{Local Function WriteSGMLTypedef()}
\label{func_WriteSGMLTypedef_sgml.c}

  Write a Typedef structure out.

\smallskip
{\stt static void WriteSGMLTypedef ( Typedef type )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Typedef type} The Typedef structure to output.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& sgml.c & \ & \cxreffile{sgml.c}\\
Calls:\ & WriteSGMLStructUnion() & sgml.c & \cxreffunc{WriteSGMLStructUnion}{sgml.c}\\
\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\ & \cxreftabiiispan{ fprintf(), strncmp()} &\\
Called by:\ & WriteSGMLFile() & sgml.c & \cxreffunc{WriteSGMLFile}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
Refs Var:\ & of & sgml.c & \cxrefvar{of}{sgml.c}\\
\end{cxreftabiii}


\subsubsection{Local Function WriteSGMLVariable()}
\label{func_WriteSGMLVariable_sgml.c}

  Write a Variable structure out.

\smallskip
{\stt static void WriteSGMLVariable ( Variable var )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{Variable var} The Variable structure to output.
\end{cxrefarglist}

\smallskip
\begin{cxreftabiii}
Prototype:& sgml.c & \ & \cxreffile{sgml.c}\\
Calls:\ & sgml() & sgml.c & \cxreffunc{sgml}{sgml.c}\\
\ & \cxreftabiiispan{ fprintf()} &\\
Called by:\ & WriteSGMLFile() & sgml.c & \cxreffunc{WriteSGMLFile}{sgml.c}\\
Refs Var:\ & of & sgml.c & \cxrefvar{of}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
\end{cxreftabiii}


\subsubsection{Local Function sgml()}
\label{func_sgml_sgml.c}

  Make the input string safe to output as SGML ( not $<$,  $>$,  \&,  ",  \$,  \#,  \% or $\sim$ ).

\smallskip
{\stt static char* sgml ( char* c, int verbatim )}

\smallskip
\begin{cxrefarglist}
\cxrefargitem{char* sgml} Returns a safe SGML string.
\cxrefargitem{char* c} A non-safe SGML string.
\cxrefargitem{int verbatim} Set to true inside a verbatim environment.
\end{cxrefarglist}

\smallskip
  The function can only be called four times in each fprintf() since it returns one of only four static strings.

\smallskip
\begin{cxreftabiii}
Prototype:& sgml.c & \ & \cxreffile{sgml.c}\\
Calls:\ & CopyOrSkip() & warn-raw.c & \cxreffunc{CopyOrSkip}{warn-raw.c}\\
\ & SafeFree() & memory.c & \cxreffunc{SafeFree}{memory.c}\\
\ & SafeMalloc() & memory.c & \cxreffunc{SafeMalloc}{memory.c}\\
\cxreftabbreak{cxreftabiii}
\ & SafeRealloc() & memory.c & \cxreffunc{SafeRealloc}{memory.c}\\
\ & \cxreftabiiispan{ strcpy(), strncpy()} &\\
Called by:\ & WriteSGMLAppendix() & sgml.c & \cxreffunc{WriteSGMLAppendix}{sgml.c}\\
\ & WriteSGMLDefine() & sgml.c & \cxreffunc{WriteSGMLDefine}{sgml.c}\\
\ & WriteSGMLFile() & sgml.c & \cxreffunc{WriteSGMLFile}{sgml.c}\\
\ & WriteSGMLFilePart() & sgml.c & \cxreffunc{WriteSGMLFilePart}{sgml.c}\\
\ & WriteSGMLFunction() & sgml.c & \cxreffunc{WriteSGMLFunction}{sgml.c}\\
\ & WriteSGMLInclude() & sgml.c & \cxreffunc{WriteSGMLInclude}{sgml.c}\\
\ & WriteSGMLStructUnion() & sgml.c & \cxreffunc{WriteSGMLStructUnion}{sgml.c}\\
\cxreftabbreak{cxreftabiii}
\ & WriteSGMLSubInclude() & sgml.c & \cxreffunc{WriteSGMLSubInclude}{sgml.c}\\
\ & WriteSGMLTypedef() & sgml.c & \cxreffunc{WriteSGMLTypedef}{sgml.c}\\
\ & WriteSGMLVariable() & sgml.c & \cxreffunc{WriteSGMLVariable}{sgml.c}\\
\end{cxreftabiii}

