\def\fileversion{0.4}
\def\filedate{2003/01/20}
\csname TuringLoaded\endcsname
\let\TuringLoaded\endinput
\newif\ifTuring@LaTeX
\edef\PstAtCode{\the\catcode`\@}
\catcode`\@=11\relax
\expandafter\ifx\csname @latexerr\endcsname\relax
\Turing@LaTeXtrue
\long\def\@ifundefined#1#2#3{ \expandafter\ifx\csname#1\endcsname\relax#2\else#3\fi}
\def\typeout#1{\immediate\write\@unused{#1}}
\alloc@7\write\chardef\sixt@@n\@unused
\def\@empty{}
\def\@ifnextchar#1#2#3{ \let\@tempe#1\def\@tempa{#2}\def\@tempb{#3}\futurelet\@tempc\@ifnch}
\def\@ifnch{ \ifx\@tempc\@sptoken
\let\@tempd\@xifnch
\else
\ifx\@tempc\@tempe \let\@tempd\@tempa \else \let\@tempd\@tempb \fi
\fi
\@tempd}
\begingroup
\def\:{\global\let\@sptoken= } \:
\def\:{\@xifnch} \expandafter\gdef\: {\futurelet\@tempc\@ifnch}
\endgroup
\fi
\typeout{`Turing' v\fileversion\space\space <\filedate> (jcc)}
\newcount\T@Max \newcount\T@Min \newcount\T@oldMax \newcount\T@oldMin \newcount\T@Current \newcount\T@IO
\newdimen\Twidth \Twidth = 24pt \newdimen\Theight \Theight = 18pt \newdimen\Tthick \Tthick = 0.4pt
\def\Tmark{$\bullet$} \def\Tempty{} \def\Thead{$\bigm\Uparrow$}
\def\Tinit{i} \def\Tstate{i} \def\Tterm{t}
\def\Turingbeforeskip{\smallskip} \def\Turingafterskip{\smallskip}
\def\TuringInit{\begingroup
\catcode`\.=11 \Turing@Init}
\def\Turing@Init#1{\global\T@Max=0 \global\T@Min=0 \global\T@IO=0
\xdef\Tstate{\Tinit} \@TURinit#1. \global\advance\T@Max by -1 \endgroup}
\def\@TURinit#1#2.{\def\next@param{#2} \if*#1
\expandafter\gdef\csname T@band \the\T@Max \endcsname{*} \else
\expandafter\gdef\csname T@band \the\T@Max \endcsname{.} \fi
\global\advance\T@Max by 1
\ifx \empty\next@param
\let\next\relax
\else
\let\next\@TURinit
\edef\next@param{\next@param.} \fi
\expandafter\next\next@param}
\def\TuringTabState{\begingroup
\catcode`\.=11 \T@TS}
\def\T@TS#1{\T@@TS#1,.\endgroup}
\def\T@@TS#1,#2,#3,#4,#5,#6.{ \def\next@param{#6} \expandafter\gdef\csname TS@#1@#2@\endcsname{#3,#4,#5} \ifx\next@param\empty
\let\next\relax
\else
\let\next\T@@TS
\edef\next@param{\next@param.} \fi
\expandafter\next\next@param}
\def\TuringStep{ \edef\Tsymb{\csname T@band \the\T@IO \endcsname} \expandafter\ifx\csname TS@\Tstate @\Tsymb @\endcsname\relax
\ifx\Tstate\Tterm
\else
\immediate\write16{Turing error : state (\Tstate) with symbol (\Tsymb) not defined in state table.} \fi
\let\next\relax
\def\next@param{} \else
\let\next\T@write
\expandafter\edef\expandafter\next@param{ \csname TS@\Tstate @\Tsymb @\endcsname} \fi
\expandafter\next\next@param}
\def\T@write#1,#2,#3{ \gdef\Tstate{#1} \expandafter\gdef\csname T@band \the\T@IO \endcsname{#2} \ifx r#3
\ifnum\T@IO=\T@Max
\TuringEnlarge{0}{1} \fi
\global\advance\T@IO by 1
\else \ifx R#3
\ifnum\T@IO=\T@Max
\TuringEnlarge{0}{1} \fi
\global\advance\T@IO by 1
\else \ifx l#3
\ifnum\T@IO=\T@Min
\TuringEnlarge{1}{0} \fi
\global\advance\T@IO by -1
\else \ifx L#3
\ifnum\T@IO=\T@Min
\TuringEnlarge{1}{0} \fi
\global\advance\T@IO by -1
\fi\fi\fi\fi}
\def\TuringRun{\xdef\Tstate{\Tinit}\@ifnextchar[{\T@Run}{\T@Run[-1]}}
\def\T@Run[#1]{ \global\T@Current=#1 \T@@Run}
\def\T@@Run{ \ifnum\T@Current=0
\let\next\relax
\else
\ifnum\T@Current<0
\let\next\T@@@Run
\else
\let\next\T@@@Run
\global\advance\T@Current by -1
\fi
\fi
\next}
\def\T@@@Run{ \TuringStep \ifx\Tstate\Tterm
\let\next\relax \else
\let\next\T@@Run \fi
\next}
\def\TuringResume{\@ifnextchar[{\T@Run}{\T@Run[-1]}}
\def\TuringPrint{ \T@Current=\T@Min
\setbox0=\hbox{\vrule width\Tthick height\Theight} \loop
\expandafter\if\csname T@band \the\T@Current \endcsname * \setbox0=\hbox{\box0
\hbox to\Twidth{\hss\vbox to\Theight{\vss\hbox{\Tmark}\vss}\hss} \vrule width\Tthick height\Theight} \else
\setbox0=\hbox{\box0
\hbox to\Twidth{\hss\vbox to\Theight{\vss\hbox{\Tempty}\vss}\hss} \vrule width\Tthick height\Theight} \fi
\ifnum\T@Current<\T@Max \advance\T@Current by 1
\repeat
\dimen0=\Twidth \advance\dimen0 by\Tthick \count@=\T@IO
\advance\count@ by-\T@Min \multiply\dimen0 by\count@ \advance\dimen0 by\Tthick \advance\dimen0 by0.5\Twidth \setbox0=\hbox{\vbox{\hrule width0pt height2pt
\hrule height\Tthick \box0 \hrule height\Tthick
\hbox to\dimen0{\hss\vbox{\hbox to0pt{\hss\Thead\hss}}}}} \setbox1=\vbox{\hbox{\Thead}} \dimen0=\dp1 \advance\dimen0 by \ht1 \advance\dimen0 by 2pt
\leavevmode\lower\dimen0\box0}
\def\TuringCenterPrint{\par\Turingbeforeskip\noindent
\ifTuring@LaTeX
\hbox to\columnwidth{\hss\TuringPrint\hss} \else
\hbox to\hsize{\hss\TuringPrint\hss} \fi
\par\Turingafterskip\noindent}
\def\TuringMoveIO#1{ \ifnum\T@Max<#1
\immediate\write16{Turing warning : IO out of range (too big)} \global\T@IO=\T@Max
\else \ifnum\T@Min>#1
\immediate\write16{Turing warning : IO out of range (too small)} \global\T@IO=\T@Min
\else
\global\T@IO=#1
\fi\fi}
\def\TuringFormat{ \@ifnextchar[{\Turing@Format}{\Turing@Format[\the\T@Min]}}
\def\Turing@Format[#1]{ \@ifnextchar[{\Turing@@Format[#1]}{\Turing@@Format[#1][\the\T@Max]}}
\def\Turing@@Format[#1][#2]{ \T@Current=#1
\advance\T@Current by-1
\loop
\advance\T@Current by 1
\expandafter\if\csname T@band \the\T@Current \endcsname . \repeat
\global\T@Min=\T@Current
\T@Current=#2
\advance\T@Current by 1
\loop
\advance\T@Current by -1
\expandafter\if\csname T@band \the\T@Current \endcsname . \repeat
\global\T@Max=\T@Current
\ifnum\T@IO<\T@Min \global\T@IO=\T@Min \fi
\ifnum\T@IO>\T@Max \global\T@IO=\T@Max \fi}
\def\TuringEnlarge#1#2{
\T@oldMin=\T@Min
\T@oldMax=\T@Max
\global\advance\T@Min by -#1
\global\advance\T@Max by #2
\ifnum\T@Min>\T@Max
\global\T@Max=\T@Min
\fi
\ifnum\T@IO<\T@Min
\global\T@IO=\T@Min
\fi
\T@Current=\T@Min
\loop
\expandafter\ifx\csname T@band \the\T@Current \endcsname \relax
\expandafter\gdef\csname T@band \the\T@Current \endcsname{.}
\fi
\ifnum\T@Current<\T@Min \advance\T@Current by 1
\repeat
\T@Current=\T@Max
\loop
\expandafter\ifx\csname T@band \the\T@Current \endcsname \relax
\expandafter\gdef\csname T@band \the\T@Current \endcsname{.}
\fi
\ifnum\T@Current>\T@Max \advance\T@Current by -1
\repeat}
\catcode`\@=\PstAtCode\relax
\endinput

—
Syracuse — Dernière modification : 3 février 2003 (0.08s - 3779416 - 21 novembre 2008)