%%
%% This is file `plain-xetex-bidi.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% bidi.dtx  (with options: `plain-xetex-bidi.def')
%% 
%%   ______________________________________
%%   Copyright © 2009–2013  Persian TeX Group
%% 
%%   License information appended.
%% 
%% 
\def\TeXXeTOn{\TeXXeTstate=1 }
\def\TeXXeTOff{\TeXXeTstate=0 }
\TeXXeTOn
\def\usebox#1{\leavevmode\copy #1\relax}
\def\bidi@RTL@everypar{\if@RTL{\setbox\z@\lastbox\beginR\ifvoid\z@\else\usebox\z@\fi}\fi}
   \let\bidi@o@everypar=\everypar
   \newtoks\bidi@n@everypar
   \bidi@n@everypar\expandafter{\the\bidi@o@everypar}
   \bidi@o@everypar{\bidi@RTL@everypar\the\bidi@n@everypar}
   \let\everypar=\bidi@n@everypar
\def\moreLRE{\bracetext \aftergroup\endL \beginL\@RTLfalse}
\def\moreRLE{\bracetext \aftergroup\endR \beginR\@RTLtrue}
\protected\def\hboxR{\hbox\bgroup
 \everyhbox{%
  \aftergroup\egroup
  \everyhbox{}%
  \beginR
  \bgroup
  \aftergroup\endR
  \aftergroup\egroup
 }\hbox}
\protected\def\hboxL{\hbox\bgroup
 \everyhbox{%
  \aftergroup\egroup
  \everyhbox{}%
  \beginL
  \bgroup
  \aftergroup\endL
  \aftergroup\egroup
 }\hbox}
\protected\def\vboxR{\vbox\bgroup
 \everyvbox{%
  \aftergroup\egroup
  \everyvbox{}%
  \@RTLtrue
  \bgroup
  \aftergroup\egroup
 }\vbox}
\protected\def\vboxL{\vbox\bgroup
 \everyvbox{%
  \aftergroup\egroup
  \everyvbox{}%
  \@RTLfalse
  \bgroup
  \aftergroup\egroup
 }\vbox}
\def\LTR{\par\@RTLfalse\@RTL@footnotefalse\hsize\linewidth\parshape\z@}
\def\endLTR{\par}
\def\RTL{\par\@RTLtrue\@RTL@footnotetrue\hsize\linewidth\parshape\z@}
\def\endRTL{\par}
\def\@ltr{\if@RTL\par\@RTLfalse\@RTL@footnotefalse\fi}
\def\@rtl{\if@RTL\relax\else\par\@RTLtrue\@RTL@footnotetrue\fi}
\def\setRTL{\@RTLtrue\@RTL@footnotetrue}
\def\setLTR{\@RTLfalse\@RTL@footnotefalse}
\let\unsetRTL=\setLTR
\let\unsetLTR=\setRTL
\let\LR=\LRE
\let\RL=\RLE
\def\@ensure@RTL#1{\if@RTL#1\else\RLE{#1}\fi}
\def\@ensure@LTR#1{\if@RTL\LRE{#1}\else#1\fi}
\let\@ensure@RL=\@ensure@RTL
\let\@ensure@LR=\@ensure@LTR
\def\@ensure@dir#1{\if@RTL\RLE{#1}\else{#1}\fi}
\let\@ensure@maindir=\@ensure@dir
\def\@@RTL{RTL}
\def\@@LTR{LTR}
\def\save@dir{\if@RTL\gdef\saved@@dir{RTL}\else\gdef\saved@@dir{LTR}\fi}
\def\reset@dir{\ifx\saved@@dir\@@RTL\setRTL\else\ifx\saved@@dir\@@LTR\setLTR\else\relax\fi\fi}
\let\@@TeX\TeX
\def\TeX{\@ensure@LTR{\@@TeX}}
\def\reflect#1{{\setbox0=\hbox{#1}\rlap{\kern0.5\wd0
  \special{x:gsave}\special{x:scale -1 1}}\box0 \special{x:grestore}}}
\def\XeTeX{\LR{\leavevmode$\smash{\hbox{X\lower.5ex
  \hbox{\kern-.125em\reflect{E}}\kern-.1667em \TeX}}$}}
\let\setRL=\setRTL
\let\setLR=\setLTR
\let\unsetRL=\setLTR
\let\bidi@saved@eqno=\eqno
\let\bidi@saved@leqno=\leqno
\def\eqno{\ifnum\predisplaydirection<\z@ \bidi@saved@leqno \else \bidi@saved@eqno \fi}
\def\leqno{\ifnum\predisplaydirection<\z@ \bidi@saved@eqno \else \bidi@saved@leqno \fi}
\def\centerline#1{\line{\hss\if@RTL\beginR\fi#1\if@RTL\endR\fi\hss}}
\def\leftline#1{\line{\if@RTL\beginR\fi#1\if@RTL\endR\fi\hss}}
\def\rightline#1{\line{\hss\if@RTL\beginR\fi#1\if@RTL\endR\fi}}
%% 
%% Copyright © 2009–2013  Persian TeX Group <persian-tex@tug.org>
%% 
%% It may be distributed and/or modified under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is “maintained” (as per LPPL maintenance status)
%% by Persian TeX Group.
%% 
%% 
%% 
%%
%% End of file `plain-xetex-bidi.def'.
