\input macros.tex
\def\begintitle{
  \begingroup\nopagenumbers
  \font\mine=cmb10 scaled 1893
  \hbox{}
}
\def\authors{
  \centerline{C. Batut, K. Belabas, D. Bernardi, H. Cohen, M. Olivier}
  \vskip 1.truecm
  \centerline{Laboratoire A2X, U.M.R. 9936 du C.N.R.S.}
  \centerline{Universit\'e Bordeaux I, 351 Cours de la Lib\'eration}
  \centerline{33405 TALENCE Cedex, FRANCE}
  \centerline{\tt e-mail: pari@math.u-bordeaux.fr}
  \vskip 2.truecm
  \centerline{Primary {\tt ftp} site:}
  \centerline{\tt ftp://megrez.math.u-bordeaux.fr/pub/pari/}
  \vskip 1.truecm
}
\def\endtitle{\vfill\eject\endgroup}

\magnification=\magstephalf
\parskip=6pt plus 1pt minus 1pt
\overfullrule=0pt
% \vsize=23.5cm

\catcode`\@=11
\newwrite\out
\def\typeout#1{\immediate\write\out{#1}}
\long\def\@ifundef#1#2#3{\expandafter\ifx\csname
  #1\endcsname\relax#2\else#3\fi}

\def\@namedef#1{\expandafter\def\csname #1\endcsname}

\def\newlabel#1#2{\@ifundef{r@#1}{}{\message{Label `#1' multiply
  defined}}\global\@namedef{r@#1}{#2}}

\newread\std
\openin\std=users.aux
\ifeof\std
  \message{No aux file.}
\else
  \input users.aux
\fi

\newif\ifsecondpass
\openin\std=users.std
\ifeof\std
  \secondpassfalse
  \typeout{FIRST PASS}
\else
  \secondpasstrue
  \typeout{SECOND PASS}
\fi

\ifsecondpass
  \let\immediate\relax
  \def\condwrite#1#2{}
\else
  \csname newwrite\endcsname\toc
  \csname newwrite\endcsname\index
  \openout\toc=\jobname.toc
  \openout\index=\jobname.idx
  \let\condwrite=\write
\fi

\def\sidx#1{{\condwrite\index{!#1!\the\pageno!}}}
\def\idx#1{\sidx{#1}#1}
\def\tocwrite#1{{\let\the=0\edef\next{\condwrite\toc{#1}}\next}}%cf TeXBook Exercice 21.10

\newcount\chapno
\newcount\secno
\newcount\subsecno
\newcount\subsubsecno

\def\myhook{}
\def\title#1{%
  \ifodd\pageno\else\hbox{}\vfill\eject\fi
  \tocwrite{#1\string\dotfill\the\pageno}
  \centerline{#1}\vskip1cm}

\def\sectitle#1{%
  \tocwrite{{\sevenrm\hskip0.5cm#1\string\dotfill\the\pageno}}
  \medskip\medskip\myhook\noindent{\bf{#1}}\def\myhook{}
  \medskip\nobreak}

\def\subsectitlesp#1#2{%
  \smallskip\myhook{\bf{#1}}\def\myhook{}\nobreak}

\def\subsectitle#1{\subsectitlesp{#1}{#1}}

\def\subsubsectitle#1{
  \smallskip\myhook{\bf{#1}}\def\myhook{}\nobreak}

\def\maketitle#1{\number\chapno.\currentlabel\ #1}

\def\chapter#1{
  \secno=0\global\advance\chapno by 1
  \title{Chapter \number\chapno: #1}}
\def\section#1{
  \subsecno=0\advance\secno by 1
  \gdef\currentlabel{\number\secno}
  \sectitle{\maketitle{#1}}}
\def\subsecprot#1#2{
  \subsubsecno=0\advance\subsecno by 1
  \gdef\currentlabel{\number\secno.\number\subsecno}
  \subsectitlesp{\maketitle{#1}}{\maketitle{#2}}}
\def\subsec#1{\subsecprot{#1}{#1}}
\def\subsubsec#1{
  \advance\subsubsecno by 1
  \gdef\currentlabel{\number\secno.\number\subsecno.\number\subsubsecno}
  \subsubsectitle{\maketitle{#1}}}

\def\unix{\strut\hbox to 0pt{\hss {UNIX: }\indent}}
\def\unixx{\noindent\strut\hbox to 0pt{\hss {UNIX: }}}
\def\emacs{\strut\hbox to 0pt{\hss {EMACS: }\indent}}

\def\sectionunix#1{\def\myhook{\unixx{}}\section{#1}}
\def\unixsubsecunix#1{\def\myhook{\unix{}}\subsec{#1}}
\def\subsecidxunix#1{\def\myhook{\unix{}}\subsecidx{#1}}
\def\subsubsecunix#1{\def\myhook{\unix{}}\subsubsec{#1}}
\def\subsubsecidxunix#1{\def\myhook{\unix{}}\subsubsecidx{#1}}

\def\subsecidx#1{\sidx{#1}\subsec{#1}}
\def\subsubsecidx#1{\sidx{#1}\subsubsec{#1}}
%
% CROSS REFERENCING
%
\newwrite\aux
\openout\aux=\jobname.aux

\ifx\inputlineno\undefined
  \let\on@line\empty
\else
  \def\on@line{ on input line \the\inputlineno}
\fi
\def\@errundef#1{\typeout{Reference `#1' on page \the\pageno \space
undefined\on@line}}

\def\label#1{\immediate\write\aux{\string
  \newlabel{#1}{{\the\chapno}{\currentlabel}}}}

\def\@car#1#2\@nil{#1}
\def\@cdr#1#2\@nil{#2}

\def\@ref{\expandafter\@cdr\@temp \@nil\null}
\def\@cref{\expandafter\@car\@temp \@nil\null}

\def\ref#1{\@ifundef{r@#1}
  {{\bf ??}\@errundef{#1}}
  {\edef\@temp{\csname r@#1\endcsname}%
    \def\lbl{\@ref}\def\chp{\@cref}%
    \ifx\chp{\the\chapno}\lbl\else\chp.\lbl\fi}}
\def\secref#1{Section~\ref{#1}}
\catcode`\@=12
