\subsection{FortranWriter}

FortranWriter receives lines of Fortran source code and writes them to a file correctly indented and wrapped to 79 character length.

\subsubsection{Interface}


\begin{tabular}[]{| p{5.5cm} | l | p{7.5cm} |}
\hline
\textbf{Operation}&\textbf{Return type}&\textbf{Description} \\
\hline
\textbf{FortranWriter}(String fileName) & - & Constructor, specifies which file to write\\
\hline
\textbf{write}(String line) throws IOException & void & Writes \textit{line} to the specified file, correctly indented and multilined if longer than 79 characters\\
\hline
\textbf{write}(String[] lines) throws IOException & & Writes \textit{lines} to the specified file,  correctly indented and multilined if longer than 79 characters\\
\hline
\end{tabular}
\vspace{.5cm}


\subsubsection{Indentation}

If one of the following keywords is found on a line, the next line begins an indented section.
\begin{itemize}
\item BLOCK DATA
\item DO
\item FORALL
\item FUNCTION
\item IF
\item INTERFACE
\item MODULE
\item PROGRAM
\item SELECT CASE
\item SUBROUTINE
\item TYPE typename
\item WHERE
\end{itemize}

If END is found on a line, the previous line was the last line of an indented section.

Keywords that mark both the ending of the previous indented section and the beginning of another:
\begin{itemize}
\item CASE
\item CONTAINS
\item ELSE
\item ELSEWHERE
\end{itemize}

\subsubsection{Line wrapping}

If a line is over 79 characters long, it's cut at the last whitespace found so that it's no longer than 77 characters. ` \&' is added to the end of the line and the rest of it is moved to the next line, indented. If the remaining line is too long as well, it receives the same treatment excluding the indenting of the following line.
