% -*- latex -*-
%
% Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
%                         University Research and Technology
%                         Corporation.  All rights reserved.
% Copyright (c) 2004-2005 The University of Tennessee and The University
%                         of Tennessee Research Foundation.  All rights
%                         reserved.
% Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 
%                         University of Stuttgart.  All rights reserved.
% Copyright (c) 2004-2005 The Regents of the University of California.
%                         All rights reserved.
% $COPYRIGHT$
% 
% Additional copyrights may follow
% 
% $HEADER$
%

\usepackage{times}
\usepackage[final]{graphicx}
\usepackage{fullpage}
\usepackage{url}
\usepackage{makeidx}
\usepackage[final]{listings}

% Make the index

\makeindex

% Version (gets substituted in by ``make dist'')

\include{version}

% PDF stuff
 
\ifx\pdfoutput\undefined
  \usepackage[colorlinks=true,
              linkcolor=blue,filecolor=blue,pagecolor=blue,urlcolor=blue
              ]{hyperref}
\else
  \usepackage[pdftex,
              colorlinks=true,
              linkcolor=blue,filecolor=blue,pagecolor=blue,urlcolor=blue
              ]{hyperref}
\fi

% Some custom commands.  Can't put spaces in these, or they'll show up
% with extra spaces in the text.  :-(

\newcommand{\cmd}[1]{\texttt{#1}}
\newcommand{\icmd}[1]{\cmd{#1}\index{#1 command@\cmd{#1} command}\index{commands!#1@\cmd{#1}}}
\newcommand{\idepcmd}[1]{\cmd{#1}\index{#1 command (deprecated)@\cmd{#1} command (deprecated)}\index{commands!#1 (deprecated)@\cmd{#1} (deprecated)}}
\newcommand{\cmdindex}[2]{\index{#1 command@\cmd{#1} command!#2}\index{commands!#1@\cmd{#1}}}
\newcommand{\cmdarg}[1]{\texttt{#1}}

\newcommand{\func}[1]{\texttt{#1}}
\newcommand{\ifunc}[1]{\func{#1}\index{#1@\func{#1}}}
\newcommand{\mpifunc}[1]{\textsf{#1}\index{MPI functions!#1@\textsf{#1}}}

\newcommand{\mpidatatype}[1]{\textsf{#1}\index{MPI datatypes!#1@\textsf{#1}}}
\newcommand{\mpitype}[1]{\textsf{#1}\index{MPI types!#1@\textsf{#1}}}
\newcommand{\type}[1]{\texttt{#1}}

\newcommand{\mpiattr}[1]{\textsf{#1}\index{MPI attribute keyvals!#1@\textsf{#1}}} 

\newcommand{\mpiconst}[1]{\textsf{#1}\index{MPI constants!#1@\textsf{#1}}} 
\newcommand{\iconst}[1]{\const{#1}\index{#1@\const{#1}}}
\newcommand{\const}[1]{\textsf{#1}}

\def\mcw{\mpiconst{MPI\_\-COMM\_\-WORLD}}
\def\mcs{\mpiconst{MPI\_\-COMM\_\-SELF}}

\newcommand{\confflag}[1]{\texttt{--#1}\index{#1@\texttt{--#1} configure flag}\index{configure flags!--#1@\texttt{--#1}}}
\newcommand{\confflagtwo}[2]{\texttt{--#1=#2}\index{#1@\texttt{--#1} configure flag}\index{configure flags!--#1@\texttt{--#1}}}
\newcommand{\depconfflag}[1]{\texttt{--#1}\index{#1@\texttt{--#1}
deprecated configure flag}}
\newcommand{\depconfflagtwo}[2]{\texttt{--#1=#2}\index{#1@\texttt{--#1}
deprecated configure flag}}
\newcommand{\confarg}[1]{\textsf{#1}}

\newcommand{\manpage}[1]{\texttt{#1}\index{#1@\texttt{#1} manual page}\index{manual pages!#1@\texttt{#1}}}

\newcommand{\maketarget}[1]{\texttt{#1}\index{#1@\texttt{#1} make target}\index{make targets!#1@\texttt{#1}}}

\newcommand{\file}[1]{\texttt{#1}}
\newcommand{\ifile}[1]{\file{#1}\index{#1@\file{#1} file}\index{files!#1@\file{#1}} }

\newcommand{\envvar}[1]{\texttt{#1}}
\newcommand{\ienvvar}[1]{\envvar{#1}\index{#1 environment variable@\envvar{#1} environment variable}\index{environment variables!#1@\envvar{#1}}}
\newcommand{\idepenvvar}[1]{\envvar{#1}\index{#1 environment variable@\envvar{#1} environment variable (deprecated)}\index{environment variables!#1 (deprecated)@\envvar{#1} (deprecated)}}

\newcommand{\mcafw}[1]{\textsf{#1}}
\newcommand{\mcacomp}[1]{\textsf{#1}}

\newcommand{\mcaparam}[1]{\texttt{#1}}
\newcommand{\imcaparam}[1]{\mcaparam{#1}\index{#1 MCA parameter@\mcaparam{#1} MCA parameter}\index{MCA parameters!#1@\mcaparam{#1}}}

\newcommand{\mcavalue}[1]{\texttt{#1}}
\newcommand{\imcavalue}[2]{\mcavalue{#2}\index{MCA parameters!#1@\mcaparam{#1}!#2 value@\mcavalue{#2} value}}

\newcommand{\host}[1]{\texttt{#1}}
\newcommand{\user}[1]{\texttt{#1}}
\newcommand{\funcarg}[1]{\texttt{#1}}
\newcommand{\var}[1]{\texttt{#1}}

\newcommand{\signal}[1]{\textsf{#1}}

%
% Tables for MCA Parameters
%
\newenvironment{mcaparamtb}
{\noindent
\begin{center}
\begin{tabular}{| p{2.1in} | p{.9in} | p{3in} |} \hline
    \multicolumn{1}{|c|}{MCA parameter name} &
    \multicolumn{1}{|c|}{Default value} &
    \multicolumn{1}{|c|}{Description} \\ \hline \hline}
{\end{tabular}\end{center}}

\newcommand{\mcaparamentry}[3]{\imcaparam{#1} & \multicolumn{1}{|c|}{#2} & #3 \\ \hline}

% Some defines

\def\trademark{$^{\sf (TM)}$}
\def\supportyes{yes}
\def\supportno{no}

% Define some lstlistings styles for convenience

\lstdefinestyle{ompi-c}{
  language=C,
  showspaces=false,
  columns=fullflexible,
  frame=single,
  frameround=tttt
}
\lstdefinestyle{ompi-cxx}{
  language=C++,
  showspaces=false,
  columns=fullflexible,
  frameround=tttt
}
\lstdefinestyle{ompi-perl}{
  language=Perl,
  showspaces=false,
  columns=fullflexible,
  frameround=tttt
}
\lstdefinestyle{ompi-fortran}{
  language=Fortran,
  showspaces=false,
  columns=fullflexible,
  frame=single,
  frameround=tttt
}
\lstdefinestyle{ompi-bourne}{
  language=ksh,
  showspaces=false,
  frame=single,
  frameround=tttt,
  columns=fullflexible,
}
\lstdefinestyle{ompi-shell}{
  language=csh,
  showspaces=false,
  frame=single,
  frameround=tttt,
  columns=fullflexible,
}
\lstdefinestyle{ompi-cmdline}{
  language=csh,
  showspaces=false,
  columns=fullflexible,
  frame=single,
  frameround=tttt,
  emph={shell$},
  emphstyle=\bf
}
% Stupid emacs mode: $
\lstdefinestyle{ompi-ompiinfo}{
  language=csh,
  showspaces=false,
  columns=fixed,
  frame=single,
  frameround=tttt,
  emph={shell$},
  emphstyle=\bf
}
% Stupid emacs mode: $

% Stoopid European-based Linux distributions...
% Gotta force letter size paper, not A4

\ExecuteOptions{letterpaper}

% Discussion item; stolen from the MPI standard

\newenvironment{discuss}{\begin{list}{}{}\item[]{\it Discussion item:}
\addcontentsline{toc}{subsection}{Discussion Item}
}{{\rm ({\it End of discussion item.})} \end{list}}

% Change bars

\newcommand{\changebegin}[1]{\marginpar[\hspace*{75pt}\mbox{\hspace*{10pt}
  $\top$ \tiny (#1)}]{\mbox{$\top$ \tiny (#1)}}}
\newcommand{\changeend}[1]{\marginpar[\hspace*{75pt}\mbox{\hspace*{10pt}
  $\bot$ \tiny (#1)}]{\mbox{$\bot$ \tiny (#1)}}}
