\gdef\@camila{[?]}
\gdef\include@prototype{\relax }

\input{camila.mac}

\newcount\cec \cec=0
\newcount\ccccci \ccccci=0
\let\tolerantinput=\@input@ % tolerant input is intolerant at the moment

\def\prototype#1{
\gdef\include@prototype{nload("#1.cam");}
\immediate\write\@mainaux{\string\cam@prototype{#1.cam}}}

\tolerantinput{\jobname.cal}
\def\cam@prototype#1{}
%\def\cam@prototype#1{\tolerantinput{\jobname.cal}}

\long\def\camvinput#1{
\global\advance\ccccci by1
\verbatiminput{_\number\ccccci}
\immediate\write\@mainaux{\string\cam@input{_\number\ccccci}{\include@prototype
#1}}}
\long\def\cam@input#1#2{\relax}

\long\def\caminput#1{
\global\advance\ccccci by1
\@input@{_\number\ccccci}
\immediate\write\@mainaux{\string\cam@input{_\number\ccccci}{\include@prototype
#1}}}
\long\def\cam@input#1#2{\relax}

\long\def\scampretty#1{
\global\advance\cec by1
\@camila
\immediate\write\@mainaux{\string\scam@pretty{\number\cec}{#1}}}
\long\def\scam@pretty#1#2{\relax}

\long\def\campretty#1{
\global\advance\cec by1
\@camila
\immediate\write\@mainaux{\string\cam@pretty{\number\cec}{#1}}}
\long\def\cam@pretty#1#2{\relax}

\long\def\camfpretty#1{
\global\advance\cec by1
\@camila
\immediate\write\@mainaux{\string\cam@inppretty{\number\cec}{#1}}}
\long\def\cam@inppretty#1#2{\relax}

\long\def\cameval#1{
\global\advance\cec by1
\@camila
\immediate\write\@mainaux{\string\cam@eval{\number\cec}{#1}}}
\long\def\cam@eval#1#2{\relax}

\def\camdo#1{\cameval{do(#1,"")}}

\RequirePackage{verbatim}

\newenvironment{camcode}%
{\begingroup% Lets keep the changes local
  \global\advance\cec by1
  {\@camila}
  \let\do\@makeother\dospecials\catcode`\^^M\active
  \def\verbatim@processline{%
    \immediate\write\@mainaux{\string\cam@pretty{\number\cec}{\the\verbatim@line}}}%
  \verbatim@start%
}%
{
  \endgroup%
}
                         
