\hypertarget{msg2src_8c}{
\section{msg2src.c File Reference}
\label{msg2src_8c}\index{msg2src.c@{msg2src.c}}
}
Implements the {\tt msg2src} command.  


{\tt \#include $<$ctype.h$>$}\par
{\tt \#include $<$stdio.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include \char`\"{}PBS/MBA.h\char`\"{}}\par
{\tt \#include \char`\"{}PBS/TASK.h\char`\"{}}\par
{\tt \#include \char`\"{}MDB/MDB\_\-pubdefs.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG/MSG\_\-print\-Proc.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG/MSG\_\-msgs.h\char`\"{}}\par
{\tt \#include \char`\"{}M2S\_\-msgs.h\char`\"{}}\par
{\tt \#include \char`\"{}MSG\_\-m2sdefs.h\char`\"{}}\par


Include dependency graph for msg2src.c:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=136pt]{msg2src_8c__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{struct__MSG__Qualifier}{\_\-MSG\_\-Qualifier}
\begin{CompactList}\small\item\em Standard structure for describing a command qualifier. \item\end{CompactList}\end{CompactItemize}
\subsection*{Defines}
\begin{CompactItemize}
\item 
\hypertarget{msg2src_8c_a0}{
\#define \hyperlink{msg2src_8c_a0}{MSG\_\-FILE\_\-HED}\ 0}
\label{msg2src_8c_a0}

\begin{CompactList}\small\item\em Index for a .h file. \item\end{CompactList}\item 
\hypertarget{msg2src_8c_a1}{
\#define \hyperlink{msg2src_8c_a1}{MSG\_\-FILE\_\-SRC}\ 1}
\label{msg2src_8c_a1}

\begin{CompactList}\small\item\em Index for a .c file. \item\end{CompactList}\item 
\hypertarget{msg2src_8c_a2}{
\#define \hyperlink{msg2src_8c_a2}{MSG\_\-FILE\_\-MSG}\ 2}
\label{msg2src_8c_a2}

\begin{CompactList}\small\item\em Index for a .msg file. \item\end{CompactList}\item 
\hypertarget{msg2src_8c_a3}{
\#define \hyperlink{msg2src_8c_a3}{MSG\_\-FILE\_\-MAX}\ 3}
\label{msg2src_8c_a3}

\begin{CompactList}\small\item\em Number of file indices supported. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{msg2src_8c_a4}{
typedef \hyperlink{struct__MSG__Qualifier}{\_\-MSG\_\-Qualifier} \hyperlink{msg2src_8c_a4}{MSG\_\-Qualifier}}
\label{msg2src_8c_a4}

\begin{CompactList}\small\item\em Typedef for struct \hyperlink{struct__MSG__Qualifier}{\_\-MSG\_\-Qualifier}. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
unsigned int \hyperlink{msg2src_8c_a8}{abbrev} (const char $\ast$left, unsigned int llen, const char $\ast$rite, unsigned int rlen, unsigned int min)
\begin{CompactList}\small\item\em Test a string for being a minimally long abbreviation of another. \item\end{CompactList}\item 
unsigned int \hyperlink{msg2src_8c_a9}{parse\-Arg} (int $\ast$pcnt, char $\ast$parm\mbox{[}$\,$\mbox{]}, unsigned int qcnt, \hyperlink{struct__MSG__Qualifier}{MSG\_\-Qualifier} $\ast$qlst)
\begin{CompactList}\small\item\em Identify parameters and qualifiers in arguments. \item\end{CompactList}\item 
unsigned int \hyperlink{msg2src_8c_a10}{write\-Header} (\hyperlink{struct__MSG__FacDefinition}{MSG\_\-Fac\-Definition} $\ast$fac, char $\ast$file)
\begin{CompactList}\small\item\em Write out a .h file. \item\end{CompactList}\item 
unsigned int \hyperlink{msg2src_8c_a11}{write\-Source} (\hyperlink{struct__MSG__FacDefinition}{MSG\_\-Fac\-Definition} $\ast$fac, char $\ast$file)
\begin{CompactList}\small\item\em Write out a .c file. \item\end{CompactList}\item 
int \hyperlink{msg2src_8c_a12}{main} (int pcnt, char $\ast$parm\mbox{[}$\,$\mbox{]})
\begin{CompactList}\small\item\em Program to 'compile' a .msg file. \item\end{CompactList}\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
\hypertarget{msg2src_8c_a5}{
const char $\ast$ \hyperlink{msg2src_8c_a5}{s\_\-few} = \char`\"{}few\char`\"{}}
\label{msg2src_8c_a5}

\begin{CompactList}\small\item\em The string \char`\"{}few\char`\"{}. \item\end{CompactList}\item 
\hypertarget{msg2src_8c_a6}{
const char $\ast$ \hyperlink{msg2src_8c_a6}{s\_\-many} = \char`\"{}many\char`\"{}}
\label{msg2src_8c_a6}

\begin{CompactList}\small\item\em The string \char`\"{}many\char`\"{}. \item\end{CompactList}\item 
\hypertarget{msg2src_8c_a7}{
const char $\ast$ \hyperlink{msg2src_8c_a7}{cext} \mbox{[}MSG\_\-FILE\_\-MAX\mbox{]} = \{ \char`\"{}.h\char`\"{}, \char`\"{}.c\char`\"{}, \char`\"{}.msg\char`\"{} \}}
\label{msg2src_8c_a7}

\begin{CompactList}\small\item\em File suffixes corresponding to file indices. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Implements the {\tt msg2src} command. 



\footnotesize\begin{verbatim}
CVS $Id: msg2src.c,v 1.6 2005/07/16 19:46:32 apw Exp $
\end{verbatim}\normalsize
\begin{Desc}
\item[Author:]A.P.Waite\end{Desc}


\subsection{Function Documentation}
\hypertarget{msg2src_8c_a8}{
\index{msg2src.c@{msg2src.c}!abbrev@{abbrev}}
\index{abbrev@{abbrev}!msg2src.c@{msg2src.c}}
\subsubsection[abbrev]{\setlength{\rightskip}{0pt plus 5cm}unsigned int abbrev (const char $\ast$ {\em left}, unsigned int {\em llen}, const char $\ast$ {\em rite}, unsigned int {\em rlen}, unsigned int {\em min})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{msg2src_8c_a8}


Test a string for being a minimally long abbreviation of another. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em left}](in) String to test \item[{\em llen}](in) Length of string to test \item[{\em rite}](in) String to test against \item[{\em rlen}](in) Length of string to test against \item[{\em min}](in) Minimum length of overlap\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Success \item[{\em 1}]Failure \end{description}
\end{Desc}
\hypertarget{msg2src_8c_a12}{
\index{msg2src.c@{msg2src.c}!main@{main}}
\index{main@{main}!msg2src.c@{msg2src.c}}
\subsubsection[main]{\setlength{\rightskip}{0pt plus 5cm}int main (int {\em pcnt}, char $\ast$ {\em parm}\mbox{[}$\,$\mbox{]})}}
\label{msg2src_8c_a12}


Program to 'compile' a .msg file. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pcnt}](in) Number of argument tokens \item[{\em parm}](in) Pointers to argument tokens\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em 0}]Success \item[{\em 1}]Failure\end{description}
\end{Desc}
The msg2src command \char`\"{}compiles\char`\"{} a .msg file. It produces a .h file (for inclusion in user programs) and .c file (for compilation and linking in user programs). 

Here is the call graph for this function:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=376pt]{msg2src_8c_a12_cgraph}
\end{center}
\end{figure}
\hypertarget{msg2src_8c_a9}{
\index{msg2src.c@{msg2src.c}!parseArg@{parseArg}}
\index{parseArg@{parseArg}!msg2src.c@{msg2src.c}}
\subsubsection[parseArg]{\setlength{\rightskip}{0pt plus 5cm}unsigned int parse\-Arg (int $\ast$ {\em pcnt}, char $\ast$ {\em parm}\mbox{[}$\,$\mbox{]}, unsigned int {\em qcnt}, \hyperlink{struct__MSG__Qualifier}{MSG\_\-Qualifier} $\ast$ {\em qlst})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{msg2src_8c_a9}


Identify parameters and qualifiers in arguments. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em pcnt}](I/O) Token count on input, parameter count on output \item[{\em parm}](I/O) Token pointers on input, parameter pointers on output \item[{\em qcnt}](in ) Count of predefined qualifiers \item[{\em qlst}](I/O) Predefined qualifier list updated for qualifiers present\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em M2S\_\-SUCCESS}]Success \item[{\em M2S\_\-BADQUAL}]Cannot parse qualifier \item[{\em M2S\_\-BADTOKEN}]Cannot parse token \item[{\em M2S\_\-QULNEGAT}]Qualifier is not negatable \item[{\em M2S\_\-QULVALUD}]Qualifier never takes a value \item[{\em M2S\_\-QULNOVAL}]Qualifier always takes a value \item[{\em M2S\_\-QULUNDEF}]Qualifier is not defined \end{description}
\end{Desc}


Here is the call graph for this function:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=94pt]{msg2src_8c_a9_cgraph}
\end{center}
\end{figure}
\hypertarget{msg2src_8c_a10}{
\index{msg2src.c@{msg2src.c}!writeHeader@{writeHeader}}
\index{writeHeader@{writeHeader}!msg2src.c@{msg2src.c}}
\subsubsection[writeHeader]{\setlength{\rightskip}{0pt plus 5cm}unsigned int write\-Header (\hyperlink{struct__MSG__FacDefinition}{MSG\_\-Fac\-Definition} $\ast$ {\em fac}, char $\ast$ {\em fhed})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{msg2src_8c_a10}


Write out a .h file. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fac}](in) Facility structure \item[{\em fhed}](in) Filename of .h file\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em M2S\_\-SUCCESS}]Success \item[{\em M2S\_\-FILOPEN}]Error opening file \item[{\em M2S\_\-FILWRITE}]Error writing file \item[{\em M2S\_\-FILCLOSE}]Error closing file \end{description}
\end{Desc}
\hypertarget{msg2src_8c_a11}{
\index{msg2src.c@{msg2src.c}!writeSource@{writeSource}}
\index{writeSource@{writeSource}!msg2src.c@{msg2src.c}}
\subsubsection[writeSource]{\setlength{\rightskip}{0pt plus 5cm}unsigned int write\-Source (\hyperlink{struct__MSG__FacDefinition}{MSG\_\-Fac\-Definition} $\ast$ {\em fac}, char $\ast$ {\em fsrc})\hspace{0.3cm}{\tt  \mbox{[}static\mbox{]}}}}
\label{msg2src_8c_a11}


Write out a .c file. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fac}](in) Facility structure \item[{\em fsrc}](in) Filename of .c file\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em M2S\_\-SUCCESS}]Success \item[{\em M2S\_\-FILOPEN}]Error opening file \item[{\em M2S\_\-FILWRITE}]Error writing file \item[{\em M2S\_\-FILCLOSE}]Error closing file \end{description}
\end{Desc}
