\documentclass{article} \usepackage{tw,makeidx} \title{Hello World --- A Famous Program} \author{Corey Minyard} \date{\today} \makeindex \begin{document} \maketitle \section{Description} This program is the famous ``hello world'' program. Certainly we have all written one of these programs. \section{Code} \subsection{Start Macro} This is the main part of the program. @code <*> @<Includes> @<Routines> @endcode \subsection{Includes} This program needs \texttt{stdio.h} because it uses printf. @code <Includes> #include <stdio.h> @endcode \subsection{Routines} This program only has one routine, the main routine. @code <Routines> @<main> @endcode \begin{twproc}{main} \Description The main routine. \ReturnValues \verb|int| - Program return code \SideEffects Well, it prints something! \Inputs \begin{twparmlist} \item[argc] Argument count \item[argv] The arguments \end{twparmlist} \StartCode @code <main> int main(int argc, char *argv) { @<Output Hello> @<Leave Program> } @endcode \subsection{Output Hello} This macro actually does the output. @code <Output Hello> printf("hello world\n"); @endcode \subsection{Leave Program} This macro causes the program to exit. @code <Leave Program> exit(0); @endcode \end{twproc} \printindex \end{document}