summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/bidi/biditools.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/bidi/biditools.sty')
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/biditools.sty83
1 files changed, 81 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/xelatex/bidi/biditools.sty b/Master/texmf-dist/tex/xelatex/bidi/biditools.sty
index 2495bdaf816..904ff08180a 100644
--- a/Master/texmf-dist/tex/xelatex/bidi/biditools.sty
+++ b/Master/texmf-dist/tex/xelatex/bidi/biditools.sty
@@ -17,7 +17,7 @@
%% by Vafa Khalighi.
%%
%%
-%% \CheckSum{48067}
+%% \CheckSum{48388}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -35,7 +35,7 @@
%% Right brace \} Tilde \~}
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{biditools}[2016/11/30 v0.9 Programming tools for bidi package]
+\ProvidesPackage{biditools}[2017/09/19 v1.0 Programming tools for bidi package]
\providecommand{\@bidi@saveprimitive}[2]{\begingroup\escapechar`\\\relax
\edef\@tempa{\string#1}\edef\@tempb{\meaning#1}%
\ifx\@tempa\@tempb \global\let#2#1%
@@ -732,6 +732,85 @@ ill-advised in the old versions of bidi package.%
Patching '\string\end' failed!\MessageBreak
'\string\bidi@AfterEndEnvironment' will not work\@gobble}}
+
+\def\bidi@looprepeat@csarg#1#2{\expandafter#1\csname#2\endcsname}
+\def\bidi@looprepeat@csromannumeral#1{\csname #1\romannumeral\bidi@looprepeat@depth\endcsname}
+\def\bidi@looprepeat@csargromannumeral#1#2{\expandafter#1\csname#2\romannumeral\bidi@looprepeat@depth\endcsname}
+
+\newcount\bidi@looprepeat@depth
+\let\endlooprepeat\relax \def\bidi@csprotect{}
+\let\bidi@looprepeat@traceinit\relax \let\bidi@looprepeat@traceexit\relax
+
+\def\looprepeat#1\doloopbody{\bidi@looprepeat@traceinit % exit in \breakrepeatloop
+ \advance\bidi@looprepeat@depth\@ne\relax
+ \bidi@looprepeat@csargromannumeral\ifx{bidi@looprepeat@count}\relax
+ \bidi@looprepeat@csargromannumeral{\csname newcount\expandafter\endcsname}{bidi@looprepeat@count}%
+ \bidi@looprepeat@csargromannumeral{\csname newtoks\expandafter\endcsname}{bidi@looprepeat@toks}%
+ \bidi@looprepeat@csargromannumeral{\csname newtoks\expandafter\endcsname}{bidi@looprepeat@wtest}%
+ \bidi@looprepeat@csargromannumeral{\csname newtoks\expandafter\endcsname}{bidi@looprepeat@utest}%
+ \fi \bidi@looprepeat@zero \def\bidi@looprepeat@sign{}\def\bidi@looprepeat@comp{>}\bidi@looprepeat@setup{#1}%
+ \edef\bidi@looprepeat@tmp
+ {\def\bidi@looprepeat@csargromannumeral\noexpand{bidi@looprepeat@looprepeat}{\bidi@looprepeat@csargromannumeral\noexpand{bidi@looprepeat@body}}}\bidi@looprepeat@tmp
+ \afterassignment\bidi@looprepeat@dxbody\bidi@looprepeat@csromannumeral{bidi@looprepeat@toks}}
+
+\def\bidi@looprepeat@dxbody{\bidi@looprepeat@csargromannumeral\edef{bidi@looprepeat@body}{%
+ \bidi@looprepeat@csargromannumeral\the{bidi@looprepeat@wtest}%
+ \noexpand\the\bidi@looprepeat@csargromannumeral\noexpand{bidi@looprepeat@toks}%
+ \bidi@looprepeat@csargromannumeral\the{bidi@looprepeat@utest}%
+ \global\bidi@looprepeat@csargromannumeral\advance{bidi@looprepeat@count} by \bidi@looprepeat@sign\bidi@looprepeat@csromannumeral{bidi@looprepeat@inc}\relax
+ \noexpand\endlooprepeat
+ \bidi@looprepeat@csargromannumeral\noexpand{bidi@looprepeat@looprepeat}}%
+ \bidi@looprepeat@csromannumeral{bidi@looprepeat@body}\ignorespaces}
+
+%% In order to stop, issue a
+\def\breaklooprepeat#1\endlooprepeat{\bidi@looprepeat@zero\bidi@looprepeat@csargromannumeral\let{bidi@looprepeat@looprepeat}\relax
+ \advance\bidi@looprepeat@depth\m@ne \bidi@looprepeat@traceexit
+ }
+
+\def\bidi@looprepeat@setup#1{%
+ \begingroup
+ \def\forvariable##1{%
+ \edef\bidi@looprepeat@tmp{%
+ \global\let\bidi@looprepeat@csarg\noexpand{##1}\bidi@looprepeat@csromannumeral{bidi@looprepeat@count}\ignorespaces}%
+ \bidi@looprepeat@tmp}%
+ \def\fromvalue##1{\bidi@looprepeat@csargromannumeral\global{bidi@looprepeat@count}##1\ignorespaces}%
+ \def\tovalue##1{%
+ \edef\bidi@looprepeat@tmp{\global\bidi@looprepeat@csargromannumeral\noexpand{bidi@looprepeat@wtest}=
+ {\bidi@looprepeat@csargromannumeral\the{bidi@looprepeat@wtest}%
+ \noexpand\ifnum\bidi@looprepeat@csargromannumeral\noexpand{bidi@looprepeat@count}\bidi@looprepeat@comp##1\relax
+ \noexpand\expandafter \noexpand\breaklooprepeat
+ \noexpand\fi}\ignorespaces}%
+ \bidi@looprepeat@tmp}%
+ \def\downtovalue##1{%
+ \gdef\bidi@looprepeat@sign{-}\gdef\bidi@looprepeat@comp{<}\tovalue{##1}\ignorespaces}%
+ \def\bystep##1{\ifnum##1<0 \bidi@error{LOOPREPEAT: increment has to be a positive value}\@ehc%
+ \bidi@looprepeat@csargromannumeral\gdef{bidi@looprepeat@inc}{-##1}\else
+ \bidi@looprepeat@csargromannumeral\gdef{bidi@looprepeat@inc}{##1}\fi\ignorespaces}%
+ \def\untilcondition##1{%
+ \edef\bidi@looprepeat@tmp{\global\bidi@looprepeat@csargromannumeral\noexpand{bidi@looprepeat@utest}=
+ {\noexpand##1\relax
+ \noexpand\expandafter \noexpand\breaklooprepeat \noexpand\fi}\ignorespaces}%
+ \bidi@looprepeat@tmp}%
+ \def\whilecondition##1{%
+ \edef\bidi@looprepeat@tmp{\global\bidi@looprepeat@csargromannumeral\noexpand{bidi@looprepeat@wtest}=
+ {\noexpand##1\relax \noexpand\else
+ \noexpand\expandafter \noexpand\breaklooprepeat \noexpand\fi}\ignorespaces}%
+ \bidi@looprepeat@tmp}%
+ \fromvalue{\@ne}\bystep{\@ne}#1%
+ \endgroup}
+\def\bidi@looprepeat@zero
+ {\bidi@looprepeat@csromannumeral{bidi@looprepeat@toks}{}\bidi@looprepeat@csromannumeral{bidi@looprepeat@utest}{}\bidi@looprepeat@csromannumeral{bidi@looprepeat@wtest}{}%
+ \bidi@looprepeat@csargromannumeral\def{bidi@looprepeat@body}{}}
+
+
+
+
+
+
+
+
+
+
\CheckCommand{\InputIfFileExists}[2]{%
\IfFileExists{#1}%
{#2\@addtofilelist{#1}\@@input \@filef@und}}