% French Torture Test with plain TeX 
%                           Copyright GUTenberg-Bernard Gaulle as in french.doc
%
% This is a 7-bit ASCII file
%%
%%      checksum        = "38416 243 530 9322"
%%
\catcode`@=11% 
% just to validate loading and init of french and english with full plain TeX
\begingroup
\input english.sty
\input french.sty 
\endgroup%

% just to allow them to be reloaded correctly
\let\frenchTeXmods\undefined
\let\englishTeXmods\undefined\input english.sty

% LaTeX compatibility macros are here: 
% (just to test and print something readable)
% (giving a small LaTeX compatibility at the macro input level) 
\begingroup
\catcode``=13
\gdef\@noligs{\let`=\@lquote}
\endgroup
%\font\normalsize=cmr10% is defined in french
\font\nbx=cmbx10 at 10truept%
\font\Large=cmbx10 scaled \magstep1%
\font\LARGE=cmbx10 scaled \magstep2%
\font\huge=cmbx12 scaled \magstep2%
%\font\small=cmr9 % is defined in french
\font\sf=cmss10%
% \sc is only a dummy def for \rm in french
\def\sc{\font\FscF=cmcsc10\FscF}\def\em{\it}
\def\@lquote{{\kern\z@}`}
\def\LaTeX{{\rm L\kern-.36em\raise.3ex\hbox{\sc a}\kern-.15em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\def\@pen{\penalty\@M}
\def\part{\vfill\eject\ \vfill\let\fonte\huge\@line} 
\def\chapter{\vfill\eject\ \vfill\let\fonte\LARGE\@line}
\def\section{\let\fonte\Large\@line} 
\def\subsection{\let\fonte\nbx\@line} 
\def\subsubsection{\let\fonte\nbx\@line} 
\def\bibliography{\let\fonte\Large\@line\uppercase{\bibname}}
\def\@line{\begingroup\@ifNextNB[{\@@lineM}{\@@lineN}%]
          }
\def\@@lineN{\@ifNextNB*{\@@lineQ}{\@@lineP}}
\def\@@lineQ*{\@@lineP}
\long\def\@@lineP#1{\par\vskip3\baselineskip
     \line{{\fonte #1}\hfill}\@pen\par\vskip2\baselineskip\endgroup}
\long\def\@@lineM[#1]#2{\@@lineN{#2}}
\def\@xobeysp{\leavevmode\penalty10000\ }
{\catcode`\ =\active\gdef\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}
\def\verb{\begingroup \catcode``=13 \@noligs 
\tt \global\let\do\@makeother \dospecials \@verb}
\def\@sverb#1{\def\@tempa ##1#1{\leavevmode\null##1\endgroup}\@tempa}
\def\@verb{\@vobeyspaces \frenchspacing \@sverb}
\begingroup \catcode `|=0 \catcode `[= 1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12
\catcode`\\=12 |gdef|@xverbatim#1\end{verbatim}[#1|end[verbatim]]
|gdef|@sxverbatim#1\end{verbatim*}[#1|end[verbatim*]]
|endgroup
\def\@gobble#1{}
\def\@verbatim{\vskip\parskip
\obeylines \tt \catcode``=13 \@noligs \let\do\@makeother \dospecials}
\def\verbatim{\@verbatim \frenchspacing\@vobeyspaces \@xverbatim}
\let\endverbatim=\relax
\def\title#1{\ \vfill\bgroup\hbadness=10000
             \def\\{\hfill\break\vskip1\baselineskip\hfill}
             \hfill{\huge #1}\egroup} 
\def\\{\vskip1\baselineskip}
\def\newline{\hfil\break}
\long\def\author#1{\title{#1\\}} 
\let\footORI\footnote\def\footnote#1{\footORI*{#1}}
\def\footnotemark{}%$^*$}
\def\footnotetext#1{\footnote{#1}}
\def\thanks#1{\gdef\thethanks{#1}}
\def\maketitle{\vfill\footORI{*}{\thethanks}\cleardoublepage} 
\def\onecolumn{}\def\twocolumn{}
\def\NOP{\line{%
       \it \% il existe ici au moins une fonction non suport\'ee en plain 
      \TeX{}\hfill}\line{ \hfill}}
\def\tableofcontents{\chapter*\relax\relax\NOP}
\def\glossary#1{\relax}\def\index#1{\relax}
\def\printglossary[#1]{\relax\NOP}
\def\abstract{\medskip{\bf \centerline{\abstractname}}\medskip}
\def\begin#1{\@ifundefined{#1}{\def\@tempa{\message{Environment #1
  undefined}}}{\def\@tempa{\def\@currenvir{#1}%
  \csname #1\endcsname}}\bgroup\@tempa}
\let\enddocument\end
\def\verse{\par\medskip}% ??
\def\endverse{\par}
\def\minipage[t]#1{\par\bgroup\hsize=#1}
\def\endminipage{\egroup\par}
\def\tabbing{\par\medskip\NOP\begingroup\def\>{\space}%
             \def\={\space}\def\kill{\par}\def\\{\par}%
             \def\a`##1{\`##1}\@Skill}
\def\@Skill#1\kill{}
\def\endtabbing{\endgroup}
\def\quotation{\par\bgroup% en fait un \narrower%
               \rightskip=\parindent%
               \advance\textwidth by -\rightskip%
               \hsize=\textwidth%
               \hfill\hbox to \hsize\bgroup\vbox\bgroup}
\def\endquotation{\egroup\egroup\egroup}%
\def\end#1{\csname end#1\endcsname\egroup}%
%%% mon \center ne marche pas !
\def\center{\par\noindent\hbox to \hsize\bgroup\hfill\vbox\bgroup}
\def\endcenter{\egroup\hfill\egroup\par} 

\ifx\mbentoure\relax\endinput\else\let\mbentoure=\relax\fi
\newdimen\entourehor \entourehor=6pt
\newdimen\entourever \entourever=6pt
\newdimen\entouregra \entouregra=.4pt
\newdimen\lgcadre
\lgcadre=\hsize
\newdimen\lgtexte
\newdimen\lgtete
\newbox\entbox
\long\def\entoure#1{\vbox{\hrule height\entouregra%
                          \hbox{\vrule width\entouregra%
                                \kern\entourehor%
                                 \vbox{\kern\entourever%
                                       \hbox{#1}\kern\entourever}%
                                 \kern\entourehor\vrule width\entouregra}%
                           \hrule height\entouregra}}%
\def\entoureformule#1{\entoure{\vbox{\hbox{$\displaystyle #1$}}}}%
\long\def\C@dre#1\par{\par\tolerance=2000\pretolerance=2000\vbadness=10000%
\lgtexte=\lgcadre \advance\lgtexte by -2\entourehor%
\advance\lgtexte by -2\entouregra%
\setbox\entbox=\vbox{\hsize\lgtexte #1\par}%
   \hbox to\lgcadre{\vrule width\entouregra%
     \kern\entourehor\vbox{\kern\entourever%
         \hbox{\vbox{\box\entbox}}\kern\entourever}%
     \kern\entourehor\vrule width\entouregra}%
}%
\long\def\debcad#1\par{\lgtete=\lgcadre\advance\lgtete by 4\entouregra%
   \vskip\entourever\hrule height\entouregra width\lgtete%
\ifx#1\fincad\hrule height\entouregra width\lgtete%
\vskip\entourever\let\next=\relax%
\else \C@dre #1\par\let\next=\suitecad%
\fi\next}%
\long\def\suitecad#1\par{\vskip-1pt%
\ifx#1\fincad\hrule height\entouregra width\lgtete%
\vskip\entourever\let\next=\relax%
\else \C@dre #1\par\let\next=\suitecad%
\fi\next}%
\long\def\fbox#1{\hbox{\raise-0.5\baselineskip%
                       \hbox\bgroup\entoure{#1}\egroup}}%
\long\def\parbox#1#2{\bgroup\def\\{\newline}%
         \hbox{\vbox{\hsize=#1\noindent#2}}\egroup}
\def\newpage{}\def\cleardoublepage{\vfill\eject} 
\def\ldots{...}% PAS BON !
\def\setcounter#1#2{\relax}
\def\thispagestyle#1{\relax}
\def\label#1{\relax}
\def\ref#1{ ?? }\def\pageref{ ?? }
\def\hline{\break\noindent\hbox to\hsize{\hrulefill}\vskip0.5\baselineskip}
\def\marginpar#1{\relax}
\def\etiq{\figurename\space??\space:\space}
\long\def\caption#1{\penalty10000\par\line{{\let\\=\relax%
                                           \hfill\etiq #1\hfill}}%
                    \par\penalty10000}%
\catcode`&=\active
\def\table{\@table}\expandafter\let\csname table*\endcsname\table
\def\@table[#1]{\catcode`&=\active\vskip2\baselineskip%
                \def\etiq{\tablename\space??\space:\space}}
\def&{\hfill}
\def\endtable{\catcode`&=4\vskip2\baselineskip}
\long\def\tabular#1{\vbox\bgroup\def\\{\hfill\par\vskip0.25\baselineskip}
                    \catcode`&=\active\vskip2\baselineskip}
\def\endtabular{\catcode`&=4\egroup\vskip2\baselineskip}
\catcode`&=4
\def\figure[#1]{\vskip2\baselineskip%
                \def\etiq{\figurename\space??\space:\space}}
\def\endfigure{\vskip2\baselineskip}
\let\itemORI\item
\newdimen\itemindent\itemindent=2em
\def\labelitemi{$\bullet$}
\def\item{\hfill\break\hbox to 1\parindent{}%
          \hbox to1\itemindent{\hfill\labelitemi\space}}
\def\itembib{\hfill\break\hbox to 1\parindent{}%
          \hbox to1\itemindent{\hfill[??]\space}}
\def\bibitem{\@ifNextNB[{\@bibcro}{\@bibsimp}}
\def\@bibsimp#1{\itembib}
\def\@bibcro[#1]#2{\itembib}
\def\itemize{\advance\itemindent by 1em\vskip1\baselineskip}
\def\enditemize{\advance\itemindent by -1em\vskip1\baselineskip}
\def\listoffigures{\section{\listfigurename}\NOP}
\def\listoftables{\section{\listtablename}\NOP}
\def\cite{\@ifNextNB[{\@cite@}{\@cite}%]emacs
         }
\def\@cite@[#1]#2{[??,#1]}
\def\@cite#1{[??]}
\def\nocite#1{}
\def\bibliographystyle#1{\relax}
\def\thebibliography#1{\section{\bibname}\NOP}
\def\endthebibliography{\relax}
\def\flushleft{\bgroup\raggedright}
\def\endflushleft{\egroup}
\def\NOF#1{\line{%
  \it \% le listing de #1 est volontairement omis ici.\hfill}\line{ \hfill}}

\catcode`@=12
\hsize 15cm \vsize 24cm

\let\iflatex=\iffalse
\def\listing#1{\NOF{#1}}
\hfuzz=1pt

{\catcode`\<=\active\catcode`\>=\active%
% Je veux :
%\global\def<{\left\langle}\global\def>{\right\rangle}
% Et pour ne pas pouvoir avoir l'effet que localement, 
% je fais : 
\gdef<{\myinf}\gdef>{\mysup}
}
%\frhyphex% loading of exceptions is not possible with plain TeX
%         % because there is no \begin{document}
\input french.sty

%%%% premier passage en francais %%%%
\let\ORIfrench\french\let\ORIenglish\english
\global\let\stdiORI\originalinput%
\def\onecolumn{% On demarre au premier \onecolumn
               \long\gdef\english##1\french{\ORIfrench}}
\def\originalinput#1{\ORIenglish\input #1\ORIfrench}
                   
\frenchtest
\clearpage

%%%% deuxieme passage en anglais %%%%
\def\onecolumn{\gdef\onecolumn{\endinput}}% Reset \onecolumn
\global\let\originalinput\stdiORI% reset appropriate def
\gdef\english{\ORIenglish}
\long\gdef\french#1\english{\ORIfrench\iffalse#1\fi\ORIenglish}
\frenchtest

\\ \ \\
\centerline{\it \ldots{} as you can see plain \TeX{} isn't \LaTeX{}\ldots{}}
\\ \ \\
\centerline{\huge The End}
\end{document}
