\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{views}[2008/11/29 v0.1 Views between modules]
\newif\ifview@show\view@showfalse
\DeclareOption{show}{\view@showtrue}
\ProcessOptions
\RequirePackage{keyval}[1997/11/10]
\RequirePackage{xcomment}
\RequirePackage{modules}

\define@key{view}{id}{\def\stex@id{#1}}
\define@key{view}{from}{\def\view@from{#1}}
\define@key{view}{to}{\def\view@to{#1}}
\define@key{view}{title}{\def\view@title{#1}}

\ifview@show
\newsavebox{\viewbox}
\newcounter{view}[section]
\def\view@heading{{\textbf{View} \thesection.\theview}
    \@ifundefined{stex@id}{}
      {\stex@label{View \thesection.\theproblem}\ifdraft~[\stex@id]\fi}%
    \@ifundefined{view@title}{:\quad}{\quad(\view@title)\hfill\\}}
\newenvironment{view}[1][]{\setkeys{view}{#1}\stex@target\stepcounter{view}
\begin{lrbox}{\viewbox}\begin{minipage}{.9\textwidth}\importmodule{\view@to}}
{\end{minipage}\end{lrbox}
\setbox0=\hbox{\begin{minipage}{.9\textwidth}%
\noindent\view@heading\rm%
\end{minipage}}
\smallskip\noindent\fbox{\vbox{\box0\vspace*{.2em}\usebox\viewbox}}\smallskip}
\else\newxcomment[]{view}\fi

\def\vassign#1#2{#1\ensuremath{\mapsto #2}}
