%
% Copyright (C) 2008-2001 by Azzeddine LAZREK. All rights reserved.
%
% prtprc.tex
% This file belongs to the CurExt package.
%


%
\def\amdebutparent{
 \amnbparent=-1
 \immediate\openout\amflparent=parent.txt\relax
}

%
\let\parentheses=\parent
\let\openparentheses=\openparent
\let\closeparentheses=\closeparent

% Open parentheses
\def\openparent#1{
 \setbox\ambox=\hbox{${\annulation{#1}}$}
 \global\amsize=\ht\ambox
 \global\advance\amsize by \dp\ambox
 \global\advance\amsize by 1.5pt
 \amtraitparent
 \amwdt=\ht\ambox
 \multiply\amwdt by -2
 \advance\amwdt by \amsize
 \divide\amwdt by 2
 \advance\amwdt by -0.75pt
 \hbox{\lower\amwdt\hbox{${\annulation{\amopopparent\ampos}}$}\box\ambox}
}

% Close parentheses
\def\closeparent#1{
 \setbox\ambox=\hbox{${\annulation{#1}}$}
 \global\amsize=\ht\ambox
 \global\advance\amsize by \dp\ambox
 \global\advance\amsize by 1.5pt
 \amtraitparent
 \amwdt=\ht\ambox
 \multiply\amwdt by -2
 \advance\amwdt by \amsize
 \divide\amwdt by 2
 \advance\amwdt by -0.75pt
 \hbox{\box\ambox\lower\amwdt\hbox{${\annulation{\amopclparent\ampos}}$}}
}

% Parentheses
\def\parent#1{
 \setbox\ambox=\hbox{${\annulation{#1}}$}
 \global\amsize=\ht\ambox
 \global\advance\amsize by \dp\ambox
 \global\advance\amsize by 1.5pt
 \amtraitparent
 \amwdt=\ht\ambox
 \multiply\amwdt by -2
 \advance\amwdt by \amsize
 \divide\amwdt by 2
 \advance\amwdt by -0.75pt
 \hbox{\lower\amwdt\hbox{${\annulation{\amopopparent\ampos}}$}\box\ambox
       \lower\amwdt\hbox{${\annulation{\amopclparent\ampos}}$}}
}

%
\def\amtraitparent{
 \ifnum\amnbparent=-1
 \global\advance\amnbparent by 1
 \global\ampos=\amnbparent
 \immediate\write\amflparent{\the\amsize}
 \else
 \ifnum\amnbparent=255
 \amborneparent
 \ifnum\amposinf=-1
 \global\ampos=\ampossup
 \else
 \ifnum\ampossup=256
 \global\ampos=\amposinf
 \else
 \global\ampos=\ampossup
 \fi
 \fi
 \else
 \ampresentparent
 \ifnum\ampos=-1
 \global\advance\amnbparent by 1
 \global\ampos=\amnbparent
 \immediate\write\amflparent{\the\amsize}
 \fi
 \fi
 \fi
}

%
\def\ampresentparent{
 \global\ampos=-1
 \immediate\closeout\amflparent
 \immediate\openout\amflparent=buffer.txt\relax
 \immediate\openin\amrf=parent.txt\relax
 \amposf=-1
 \moretrue
 \loop
 { \endlinechar=-1 % \catcode`\^^M=9
   \global  % \immediate
   \read\amrf to \amvalf
 }
 \ifeof\amrf \global\morefalse
 \else
 \immediate\write\amflparent{\amvalf}
 \advance\amposf by 1
 \ifdim\amvalf=\amsize \global\ampos=\amposf \fi
 \fi \ifmore \repeat
 \immediate\closein\amrf
 \immediate\closeout\amflparent
 \immediate\openout\amflparent=parent.txt\relax
 \immediate\openin\amrf=buffer.txt\relax
 \moretrue
 \loop
 { \endlinechar=-1 % \catcode`\^^M=9
   \global  % \immediate
   \read\amrf to \amvalf
 }
  \ifeof\amrf \global\morefalse
  \else \immediate\write\amflparent{\amvalf}
  \fi
 \ifmore \repeat
 \immediate\closein\amrf
}

%
{ \catcode`\<=12
\gdef\amborneparent{
 \global\amposinf=-1
 \global\amvalinf=0.0pt
 \global\ampossup=256
 \global\amvalsup=2560pt
 \immediate\closeout\amflparent
 \immediate\openout\amflparent=buffer.txt\relax
 \immediate\openin\amrf=parent.txt\relax
 \amposf=-1
 \moretrue
 \loop
 { \endlinechar=-1 % \catcode`\^^M=9
   \global  % \immediate
   \read\amrf to \amvalf
 }
 \ifeof\amrf \global\morefalse
 \else
 \immediate\write\amflparent{\amvalf}
 \advance\amposf by 1
 \ifdim\amvalf<\amsize
 \ifdim\amvalinf<\amvalf \global\amposinf=\amposf \global\amvalinf=\amvalf \fi
 \else
 \ifdim\amvalf<\amvalsup \global\ampossup=\amposf \global\amvalsup=\amvalf \fi
 \fi
 \fi \ifmore \repeat
 \immediate\closein\amrf
 \immediate\closeout\amflparent
 \immediate\openout\amflparent=parent.txt\relax
 \immediate\openin\amrf=buffer.txt\relax
 \moretrue
 \loop
 { \endlinechar=-1 % \catcode`\^^M=9
   \global  % \immediate
   \read\amrf to \amvalf
 }
  \ifeof\amrf \global\morefalse
  \else \immediate\write\amflparent{\amvalf}
  \fi
 \ifmore \repeat
 \immediate\closein\amrf
 }
}

%
{ \catcode`\<=12
\gdef\amresteparent{
 \global\advance\amnbparent by -1
 \loop
  \global\advance\amnbparent by 1
  \ifnum\amnbparent<255
   \immediate\write\amflparent{0.0pt}
 \repeat
 \immediate\closeout\amflparent
} }

%
\def\amfinalparent{
 \immediate\openout\amflparent=parent.mf\relax
 \immediate\openin\amrf=parent.txt\relax
 \amposf=-1
 \moretrue
 \loop
 { \endlinechar=-1 % \catcode`\^^M=9
   \global  % \immediate
   \read\amrf to \amvalf
 }
  \ifeof\amrf \global\morefalse
  \else
   \advance\amposf by 1
   \immediate\write\amflparent{%
        tup[\the\amposf]\amdieze := \amvalf\amdieze ;}
  \fi
 \ifmore \repeat
 \immediate\closein\amrf
 \immediate\closein\amflparent
}

%
\def\amopopparent#1{ \ifcase#1
 \amopparentaa \or \amopparentab \or \amopparentac \or \amopparentad \or
 \amopparentae \or \amopparentaf \or \amopparentag \or \amopparentah \or
 \amopparentai \or \amopparentaj \or \amopparentak \or \amopparental \or
 \amopparentam \or \amopparentan \or \amopparentao \or \amopparentap \or
 \amopparentaq \or \amopparentar \or \amopparentas \or \amopparentat \or
 \amopparentau \or \amopparentav \or \amopparentaw \or \amopparentax \or
 \amopparentay \or \amopparentaz \or
 \amopparentba \or \amopparentbb \or \amopparentbc \or \amopparentbd \or
 \amopparentbe \or \amopparentbf \or \amopparentbg \or \amopparentbh \or
 \amopparentbi \or \amopparentbj \or \amopparentbk \or \amopparentbl \or
 \amopparentbm \or \amopparentbn \or \amopparentbo \or \amopparentbp \or
 \amopparentbq \or \amopparentbr \or \amopparentbs \or \amopparentbt \or
 \amopparentbu \or \amopparentbv \or \amopparentbw \or \amopparentbx \or
 \amopparentby \or \amopparentbz \or
 \amopparentca \or \amopparentcb \or \amopparentcc \or \amopparentcd \or
 \amopparentce \or \amopparentcf \or \amopparentcg \or \amopparentch \or
 \amopparentci \or \amopparentcj \or \amopparentck \or \amopparentcl \or
 \amopparentcm \or \amopparentcn \or \amopparentco \or \amopparentcp \or
 \amopparentcq \or \amopparentcr \or \amopparentcs \or \amopparentct \or
 \amopparentcu \or \amopparentcv \or \amopparentcw \or \amopparentcx \or
 \amopparentcy \or \amopparentcz \or
 \amopparentda \or \amopparentdb \or \amopparentdc \or \amopparentdd \or
 \amopparentde \or \amopparentdf \or \amopparentdg \or \amopparentdh \or
 \amopparentdi \or \amopparentdj \or \amopparentdk \or \amopparentdl \or
 \amopparentdm \or \amopparentdn \or \amopparentdo \or \amopparentdp \or
 \amopparentdq \or \amopparentdr \or \amopparentds \or \amopparentdt \or
 \amopparentdu \or \amopparentdv \or \amopparentdw \or \amopparentdx \or
 \amopparentdy \or \amopparentdz \or
 \amopparentea \or \amopparenteb \or \amopparentec \or \amopparented \or
 \amopparentee \or \amopparentef \or \amopparenteg \or \amopparenteh \or
 \amopparentei \or \amopparentej \or \amopparentek \or \amopparentel \or
 \amopparentem \or \amopparenten \or \amopparenteo \or \amopparentep \or
 \amopparenteq \or \amopparenter \or \amopparentes \or \amopparentet \or
 \amopparenteu \or \amopparentev \or \amopparentew \or \amopparentex \or
 \amopparentey \or \amopparentez \or
 \amopparentfa \or \amopparentfb \or \amopparentfc \or \amopparentfd \or
 \amopparentfe \or \amopparentff \or \amopparentfg \or \amopparentfh \or
 \amopparentfi \or \amopparentfj \or \amopparentfk \or \amopparentfl \or
 \amopparentfm \or \amopparentfn \or \amopparentfo \or \amopparentfp \or
 \amopparentfq \or \amopparentfr \or \amopparentfs \or \amopparentft \or
 \amopparentfu \or \amopparentfv \or \amopparentfw \or \amopparentfx \or
 \amopparentfy \or \amopparentfz \or
 \amopparentga \or \amopparentgb \or \amopparentgc \or \amopparentgd \or
 \amopparentge \or \amopparentgf \or \amopparentgg \or \amopparentgh \or
 \amopparentgi \or \amopparentgj \or \amopparentgk \or \amopparentgl \or
 \amopparentgm \or \amopparentgn \or \amopparentgo \or \amopparentgp \or
 \amopparentgq \or \amopparentgr \or \amopparentgs \or \amopparentgt \or
 \amopparentgu \or \amopparentgv \or \amopparentgw \or \amopparentgx \or
 \amopparentgy \or \amopparentgz \or
 \amopparentha \or \amopparenthb \or \amopparenthc \or \amopparenthd \or
 \amopparenthe \or \amopparenthf \or \amopparenthg \or \amopparenthh \or
 \amopparenthi \or \amopparenthj \or \amopparenthk \or \amopparenthl \or
 \amopparenthm \or \amopparenthn \or \amopparentho \or \amopparenthp \or
 \amopparenthq \or \amopparenthr \or \amopparenths \or \amopparentht \or
 \amopparenthu \or \amopparenthv \or \amopparenthw \or \amopparenthx \or
 \amopparenthy \or \amopparenthz \or
 \amopparentia \or \amopparentib \or \amopparentic \or \amopparentid \or
 \amopparentie \or \amopparentif \or \amopparentig \or \amopparentih \or
 \amopparentii \or \amopparentij \or \amopparentik \or \amopparentil \or
 \amopparentim \or \amopparentin \or \amopparentio \or \amopparentip \or
 \amopparentiq \or \amopparentir \or \amopparentis \or \amopparentit \or
 \amopparentiu \or \amopparentiv \or \amopparentiw \or \amopparentix \or
 \amopparentiy \or \amopparentiz \or
 \amopparentja \or \amopparentjb \or \amopparentjc \or \amopparentjd \or
 \amopparentje \or \amopparentjf \or \amopparentjg \or \amopparentjh \or
 \amopparentji \or \amopparentjj \or \amopparentjk \or \amopparentjl \or
 \amopparentjm \or \amopparentjn \or \amopparentjo \or \amopparentjp \or
 \amopparentjq \or \amopparentjr \or \amopparentjs \or \amopparentjt \or
 \amopparentju \or \amopparentjv \fi \relax
}

%
\def\amopclparent#1{ \ifcase#1
 \amclparentaa \or \amclparentab \or \amclparentac \or \amclparentad \or
 \amclparentae \or \amclparentaf \or \amclparentag \or \amclparentah \or
 \amclparentai \or \amclparentaj \or \amclparentak \or \amclparental \or
 \amclparentam \or \amclparentan \or \amclparentao \or \amclparentap \or
 \amclparentaq \or \amclparentar \or \amclparentas \or \amclparentat \or
 \amclparentau \or \amclparentav \or \amclparentaw \or \amclparentax \or
 \amclparentay \or \amclparentaz \or
 \amclparentba \or \amclparentbb \or \amclparentbc \or \amclparentbd \or
 \amclparentbe \or \amclparentbf \or \amclparentbg \or \amclparentbh \or
 \amclparentbi \or \amclparentbj \or \amclparentbk \or \amclparentbl \or
 \amclparentbm \or \amclparentbn \or \amclparentbo \or \amclparentbp \or
 \amclparentbq \or \amclparentbr \or \amclparentbs \or \amclparentbt \or
 \amclparentbu \or \amclparentbv \or \amclparentbw \or \amclparentbx \or
 \amclparentby \or \amclparentbz \or
 \amclparentca \or \amclparentcb \or \amclparentcc \or \amclparentcd \or
 \amclparentce \or \amclparentcf \or \amclparentcg \or \amclparentch \or
 \amclparentci \or \amclparentcj \or \amclparentck \or \amclparentcl \or
 \amclparentcm \or \amclparentcn \or \amclparentco \or \amclparentcp \or
 \amclparentcq \or \amclparentcr \or \amclparentcs \or \amclparentct \or
 \amclparentcu \or \amclparentcv \or \amclparentcw \or \amclparentcx \or
 \amclparentcy \or \amclparentcz \or
 \amclparentda \or \amclparentdb \or \amclparentdc \or \amclparentdd \or
 \amclparentde \or \amclparentdf \or \amclparentdg \or \amclparentdh \or
 \amclparentdi \or \amclparentdj \or \amclparentdk \or \amclparentdl \or
 \amclparentdm \or \amclparentdn \or \amclparentdo \or \amclparentdp \or
 \amclparentdq \or \amclparentdr \or \amclparentds \or \amclparentdt \or
 \amclparentdu \or \amclparentdv \or \amclparentdw \or \amclparentdx \or
 \amclparentdy \or \amclparentdz \or
 \amclparentea \or \amclparenteb \or \amclparentec \or \amclparented \or
 \amclparentee \or \amclparentef \or \amclparenteg \or \amclparenteh \or
 \amclparentei \or \amclparentej \or \amclparentek \or \amclparentel \or
 \amclparentem \or \amclparenten \or \amclparenteo \or \amclparentep \or
 \amclparenteq \or \amclparenter \or \amclparentes \or \amclparentet \or
 \amclparenteu \or \amclparentev \or \amclparentew \or \amclparentex \or
 \amclparentey \or \amclparentez \or
 \amclparentfa \or \amclparentfb \or \amclparentfc \or \amclparentfd \or
 \amclparentfe \or \amclparentff \or \amclparentfg \or \amclparentfh \or
 \amclparentfi \or \amclparentfj \or \amclparentfk \or \amclparentfl \or
 \amclparentfm \or \amclparentfn \or \amclparentfo \or \amclparentfp \or
 \amclparentfq \or \amclparentfr \or \amclparentfs \or \amclparentft \or
 \amclparentfu \or \amclparentfv \or \amclparentfw \or \amclparentfx \or
 \amclparentfy \or \amclparentfz \or
 \amclparentga \or \amclparentgb \or \amclparentgc \or \amclparentgd \or
 \amclparentge \or \amclparentgf \or \amclparentgg \or \amclparentgh \or
 \amclparentgi \or \amclparentgj \or \amclparentgk \or \amclparentgl \or
 \amclparentgm \or \amclparentgn \or \amclparentgo \or \amclparentgp \or
 \amclparentgq \or \amclparentgr \or \amclparentgs \or \amclparentgt \or
 \amclparentgu \or \amclparentgv \or \amclparentgw \or \amclparentgx \or
 \amclparentgy \or \amclparentgz \or
 \amclparentha \or \amclparenthb \or \amclparenthc \or \amclparenthd \or
 \amclparenthe \or \amclparenthf \or \amclparenthg \or \amclparenthh \or
 \amclparenthi \or \amclparenthj \or \amclparenthk \or \amclparenthl \or
 \amclparenthm \or \amclparenthn \or \amclparentho \or \amclparenthp \or
 \amclparenthq \or \amclparenthr \or \amclparenths \or \amclparentht \or
 \amclparenthu \or \amclparenthv \or \amclparenthw \or \amclparenthx \or
 \amclparenthy \or \amclparenthz \or
 \amclparentia \or \amclparentib \or \amclparentic \or \amclparentid \or
 \amclparentie \or \amclparentif \or \amclparentig \or \amclparentih \or
 \amclparentii \or \amclparentij \or \amclparentik \or \amclparentil \or
 \amclparentim \or \amclparentin \or \amclparentio \or \amclparentip \or
 \amclparentiq \or \amclparentir \or \amclparentis \or \amclparentit \or
 \amclparentiu \or \amclparentiv \or \amclparentiw \or \amclparentix \or
 \amclparentiy \or \amclparentiz \or
 \amclparentja \or \amclparentjb \or \amclparentjc \or \amclparentjd \or
 \amclparentje \or \amclparentjf \or \amclparentjg \or \amclparentjh \or
 \amclparentji \or \amclparentjj \or \amclparentjk \or \amclparentjl \or
 \amclparentjm \or \amclparentjn \or \amclparentjo \or \amclparentjp \or
 \amclparentjq \or \amclparentjr \or \amclparentjs \or \amclparentjt \or
 \amclparentju \or \amclparentjv \fi \relax
}
