From e0e7b37a1cb8da46302fda86c287ba09275706e8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 9 Jun 2016 22:51:31 +0000 Subject: animate (8jun16) git-svn-id: svn://tug.org/texlive/trunk@41324 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/animate/animate.sty | 315 ++++++++++------------ Master/texmf-dist/tex/latex/animate/animfp.sty | 331 ------------------------ 2 files changed, 135 insertions(+), 511 deletions(-) delete mode 100644 Master/texmf-dist/tex/latex/animate/animfp.sty (limited to 'Master/texmf-dist/tex/latex/animate') diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty index 521523cd84c..86314c90c77 100644 --- a/Master/texmf-dist/tex/latex/animate/animate.sty +++ b/Master/texmf-dist/tex/latex/animate/animate.sty @@ -13,7 +13,7 @@ \NeedsTeXFormat{LaTeX2e} -\def\@anim@version{2016/04/15} +\def\@anim@version{2016/06/08} \ProvidesPackage{animate} [\@anim@version\space PDF animations from files and inline graphics] @@ -34,7 +34,6 @@ \RequirePackage{ifdraft} \RequirePackage{calc} \RequirePackage{atenddvi}%to really get certain \specials into the dvi -\RequirePackage{animfp} \RequirePackage{graphics}%\scalebox, \resizebox %driver options (the only package options we process immediately) @@ -109,6 +108,8 @@ } \let\@anim@pdfcatalog\pbs_pdfcatalog:n + + \let\@anim@fpeval\fp_eval:n \ExplSyntaxOff %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -171,7 +172,11 @@ \ifcsname pdfmdfivesum\endcsname \def\@anim@pdfmdfivesum#1{\pdfmdfivesum file {#1}} \else - \def\@anim@pdfmdfivesum#1{#1} + \ifcsname mdfivesum\endcsname + \def\@anim@pdfmdfivesum#1{\mdfivesum file {#1}} + \else + \def\@anim@pdfmdfivesum#1{#1} + \fi \fi \fi @@ -263,7 +268,6 @@ % true if any of `autoplay' or `autoresume' options is set \newboolean{@anim@autoplayorresume} % true if any of `controls' or `palindrome' or `label' options is set -\newboolean{@anim@morejs} \newboolean{@anim@timeline} %true if `timeline' option is set \newboolean{@anim@multipage} % multipage document? @@ -1146,59 +1150,29 @@ %draftbox \def\@anim@draftbox{% \begingroup% - \setlength{\unitlength}{1pt}% \vtop{% draw boxes \offinterlineskip% - \hbox{% - \raisebox{-\@anim@animdepth}{% - \begin{picture}(\@anim@animwidth,\@anim@animtotalheight)% - \put(0,0){\framebox(\@anim@animwidth,\@anim@animtotalheight){}}% - \end{picture}% + \hbox{\raisebox{-\@anim@animdepth}{% + \frame{% + \rule{0pt}{\@anim@animtotalheight}\hskip\@anim@animwidth% }% - }% + }}% \if@anim@controls% \setlength{\@anim@tmpdima}{\@anim@btnsize}% \vskip 0.1\@anim@tmpdima% \hbox to \@anim@animwidth {% \hss% - \setlength{\@anim@tmpdimb}{2\@anim@tmpdima}% - \begin{picture}(\strip@pt\@anim@tmpdimb,\strip@pt\@anim@tmpdima)% - \put(0,0){\line(1,0){\strip@pt\@anim@tmpdimb}}% - \put(0,\strip@pt\@anim@tmpdima){% - \line(1,0){\strip@pt\@anim@tmpdimb}% - }% - \put(0,0){\line(0,1){\strip@pt\@anim@tmpdima}}% - \end{picture}% - \if@anim@step\else% - \begin{picture}(\strip@pt\@anim@tmpdimb,\strip@pt\@anim@tmpdima)% - \put(0,0){\line(1,0){\strip@pt\@anim@tmpdimb}}% - \put(0,\strip@pt\@anim@tmpdima){% - \line(1,0){\strip@pt\@anim@tmpdimb}% - }% - \end{picture}% - \fi% - \begin{picture}(\strip@pt\@anim@tmpdimb,\strip@pt\@anim@tmpdima)% - \put(0,0){\line(1,0){\strip@pt\@anim@tmpdimb}}% - \put(0,\strip@pt\@anim@tmpdima){% - \line(1,0){\strip@pt\@anim@tmpdimb}% - }% - \put(\strip@pt\@anim@tmpdimb,0){% - \line(0,1){\strip@pt\@anim@tmpdima}% - }% - \end{picture}% + \frame{% + \setlength{\@anim@tmpdimb}{2\@anim@tmpdima}% + \rule{0pt}{\@anim@tmpdima}\hskip\@anim@tmpdimb\hskip\@anim@tmpdimb% + \if@anim@step\else\hskip\@anim@tmpdimb\fi% + }% \if@anim@step\else% \hskip 0.3\@anim@tmpdima% - \setlength{\@anim@tmpdimb}{3\@anim@tmpdima}% - \begin{picture}(\strip@pt\@anim@tmpdimb,\strip@pt\@anim@tmpdima)% - \put(0,0){\line(0,1){\strip@pt\@anim@tmpdima}}% - \put(0,0){\line(1,0){\strip@pt\@anim@tmpdimb}}% - \put(0,\strip@pt\@anim@tmpdima){% - \line(1,0){\strip@pt\@anim@tmpdimb}% - }% - \put(\strip@pt\@anim@tmpdimb,0){% - \line(0,1){\strip@pt\@anim@tmpdima}% - }% - \end{picture}% + \frame{% + \setlength{\@anim@tmpdimb}{3\@anim@tmpdima}% + \rule{0pt}{\@anim@tmpdima}\hskip\@anim@tmpdimb% + }% \fi% \hss% }% @@ -1346,12 +1320,6 @@ \ifthenelse{\boolean{@anim@autoplay}\OR\boolean{@anim@autoresume}}{% \setboolean{@anim@autoplayorresume}{true}% }{}% - \ifthenelse{\boolean{@anim@controls}\OR\boolean{@anim@palindrome}}{% - \setboolean{@anim@morejs}{true}% - }{}% - \ifx\empty\@anim@label\empty\else% - \setboolean{@anim@morejs}{true}% - \fi% \ifthenelse{\NOT\boolean{@anim@controls}\AND\boolean{@anim@step}}{% \setboolean{@anim@loop}{true}% }{}% @@ -1725,12 +1693,6 @@ \ifthenelse{\boolean{@anim@autoplay}\OR\boolean{@anim@autoresume}}{% \setboolean{@anim@autoplayorresume}{true}% }{}% - \ifthenelse{\boolean{@anim@controls}\OR\boolean{@anim@palindrome}}{% - \setboolean{@anim@morejs}{true}% - }{}% - \ifx\empty\@anim@label\empty\else% - \setboolean{@anim@morejs}{true}% - \fi% \ifthenelse{\NOT\boolean{@anim@controls}\AND\boolean{@anim@step}}{% \setboolean{@anim@loop}{true}% }{}% @@ -1886,7 +1848,10 @@ }{}% \fi\fi% %draw draftbox according to dimensions of the first frame - \if@anim@draft\@anim@scale{\@anim@box}\@anim@draftbox\fi% + \if@anim@draft% + \@anim@scale{\@anim@box}% + \@anim@draftbox% + \fi% \else% remaining frames %deal with zero width or totalheight boxes \ifdim\wd\@anim@box=\z@\global\setbox\@anim@box=\hbox{\phantom{X}}\fi% @@ -1985,13 +1950,15 @@ \OR\equal{\@anim@vartype}{r}\OR\equal{\@anim@vartype}{R}% }{% real numbers, prefix n, N, r, R %initialize variable - \expandafter\@anim@add\csname#1\endcsname{#2}{0.0}% + \expandafter\edef\csname#1\endcsname{\@anim@fpeval{#2}}% %global copy that saves current variable value between loops - \expandafter\xdef\csname#1@old\endcsname{#2}% + \expandafter\xdef\csname#1@old\endcsname{\@anim@fpeval{#2}}% %append script for updating variable to \@anim@updatevars macro \g@addto@macro\@anim@updatevars{% %new value - \expandafter\@anim@add\csname#1\endcsname{\csname#1@old\endcsname}{#3}% + \expandafter\edef\csname#1\endcsname{% + \@anim@fpeval{#3+\csname#1@old\endcsname}% + }% %global copy \expandafter\xdef\csname#1@old\endcsname{\csname#1\endcsname}% }% @@ -2704,7 +2671,6 @@ \setboolean{@anim@multipage}{false}% \setboolean{@anim@meas}{false}% \setboolean{@anim@autoplayorresume}{false}% - \setboolean{@anim@morejs}{false}% \xdef\@anim@ftype{\@anim@@ftype}% } @@ -3026,8 +2992,8 @@ %playing state and direction \if@anim@step \if@anim@palindrome a#1.playsRight=true;\fi% - \else% - \if@anim@morejs a#1.playsRight=true;\fi% + \else + a#1.playsRight=true;% \fi% a#1.isPaused=false;% \if@anim@step\else @@ -3045,11 +3011,7 @@ a#1.setFps=function(f){% a#1.fps=f;% if(a#1.playing){% - \if@anim@morejs - if(a#1.playsRight){a#1.playRight();}else{a#1.playLeft();}% - \else - a#1.playRight();% - \fi% + if(a#1.playsRight){a#1.playRight();}else{a#1.playLeft();}% }% };% \fi% @@ -3158,42 +3120,40 @@ \fi% \fi% };% - \if@anim@morejs - a#1.gotoPrev=function(){% - if(a#1.seekFrame(a#1.idx-1)<0){% - \if@anim@step\else\if@anim@meas a#1.stopMeas();\fi\fi% - \if@anim@palindrome% - \if@anim@step - a#1.stopFirst();% - a#1.playsRight=true;% - \else - if(a#1.playing){% - a#1.seekFrame(a#1.idx+1);% - a#1.playRight();% - }% - \fi% + a#1.gotoPrev=function(){% + if(a#1.seekFrame(a#1.idx-1)<0){% + \if@anim@step\else\if@anim@meas a#1.stopMeas();\fi\fi% + \if@anim@palindrome% + \if@anim@step + a#1.stopFirst();% + a#1.playsRight=true;% + \else + if(a#1.playing){% + a#1.seekFrame(a#1.idx+1);% + a#1.playRight();% + }% + \fi% + \else% + \if@anim@step + a#1.stopFirst();% \else% - \if@anim@step + \if@anim@loop + if(a#1.playing){% + a#1.seekFrame(\@anim@maxframe);% + }else{a#1.stopFirst();}% + \else a#1.stopFirst();% - \else% - \if@anim@loop - if(a#1.playing){% - a#1.seekFrame(\@anim@maxframe);% - }else{a#1.stopFirst();}% - \else - a#1.stopFirst();% - \fi% \fi% - \fi - return;% - }% - \if@anim@step\else% - \if@anim@pauseframes - if(a#1.playing&&a#1.pauseAt[a#1.idx]){a#1.pause();}% \fi% + \fi + return;% + }% + \if@anim@step\else% + \if@anim@pauseframes + if(a#1.playing&&a#1.pauseAt[a#1.idx]){a#1.pause();}% \fi% - };% - \fi% + \fi% + };% \if@anim@step\else a#1.pause=function(stop){% try{app.clearInterval(a#1_int);}catch(e){}% @@ -3209,7 +3169,7 @@ };% a#1.playRight=function(){% try{app.clearInterval(a#1_int);}catch(e){}% - \if@anim@morejs a#1.playsRight=true;\fi + a#1.playsRight=true;% a#1.playing=true;% a#1.isPaused=false;% \if@anim@controls @@ -3223,24 +3183,22 @@ a#1_int=app.setInterval('a#1.gotoNext()',% 1000/(1e-6+a#1.fps)/a#1.sm);% };% - \if@anim@morejs - a#1.playLeft=function(){% - try{app.clearInterval(a#1_int);}catch(e){}% - a#1.playsRight=false;% - a#1.playing=true;% - a#1.isPaused=false;% - \if@anim@controls - a#1.btnPauseLeft.display=display.visible;% - a#1.btnPlayLeft.display=display.hidden;% - a#1.btnPauseRight.display=display.visible;% - a#1.btnPlayRight.display=display.hidden;% - curdoc.dirty=false;% - \fi% - \if@anim@meas a#1.startMeas();\fi - a#1_int=app.setInterval('a#1.gotoPrev()',% - 1000/(1e-6+a#1.fps)/a#1.sm);% - };% - \fi% + a#1.playLeft=function(){% + try{app.clearInterval(a#1_int);}catch(e){}% + a#1.playsRight=false;% + a#1.playing=true;% + a#1.isPaused=false;% + \if@anim@controls + a#1.btnPauseLeft.display=display.visible;% + a#1.btnPlayLeft.display=display.hidden;% + a#1.btnPauseRight.display=display.visible;% + a#1.btnPlayRight.display=display.hidden;% + curdoc.dirty=false;% + \fi% + \if@anim@meas a#1.startMeas();\fi + a#1_int=app.setInterval('a#1.gotoPrev()',% + 1000/(1e-6+a#1.fps)/a#1.sm);% + };% \if@anim@controls a#1.fpsIncr=function(){% speed up animation a#1.sm*=1.1;% @@ -3273,34 +3231,32 @@ };% \fi% \fi% - \if@anim@morejs% - \if@anim@step - a#1.stepBwd=function(){% - a#1.seekFrame(a#1.idx-1);% - a#1.isPaused=true;% - };% - a#1.stepFwd=function(){% - a#1.seekFrame(a#1.idx+1);% - a#1.isPaused=true;% - };% - \else - a#1.stepBwd=function(){if(!a#1.playing){% - a#1.seekFrame(a#1.idx-1);% - a#1.isPaused=true;% - }};% - a#1.stepFwd=function(){if(!a#1.playing){% - a#1.seekFrame(a#1.idx+1);% - a#1.isPaused=true;% - }};% - a#1.playBwd=function(){% - if(a#1.idx==0||!a#1.isPaused){a#1.stopLast();}% - a#1.playLeft();% - };% - a#1.playFwd=function(){% - if(a#1.idx==\@anim@maxframe||!a#1.isPaused){a#1.stopFirst();}% - a#1.playRight();% - };% - \fi% + \if@anim@step + a#1.stepBwd=function(){% + a#1.seekFrame(a#1.idx-1);% + a#1.isPaused=true;% + };% + a#1.stepFwd=function(){% + a#1.seekFrame(a#1.idx+1);% + a#1.isPaused=true;% + };% + \else + a#1.stepBwd=function(){if(!a#1.playing){% + a#1.seekFrame(a#1.idx-1);% + a#1.isPaused=true;% + }};% + a#1.stepFwd=function(){if(!a#1.playing){% + a#1.seekFrame(a#1.idx+1);% + a#1.isPaused=true;% + }};% + a#1.playBwd=function(){% + if(a#1.idx==0||!a#1.isPaused){a#1.stopLast();}% + a#1.playLeft();% + };% + a#1.playFwd=function(){% + if(a#1.idx==\@anim@maxframe||!a#1.isPaused){a#1.stopFirst();}% + a#1.playRight();% + };% \fi% %animation API for labelled anims \ifx\empty\@anim@label\empty\else @@ -3356,12 +3312,8 @@ \if@anim@autoplayorresume% \if@anim@autoresume if(a#1.isPaused){% - \fi% - \if@anim@morejs - if(a#1.playsRight){a#1.playRight();}else{a#1.playLeft();}% - \else - a#1.playRight();% - \fi% + \fi + if(a#1.playsRight){a#1.playRight();}else{a#1.playLeft();}% \if@anim@autoresume% }% \fi% @@ -3384,8 +3336,8 @@ \else a#1.pause(true);% stop \fi% - }% - \if@anim@morejs if(!a#1.isPaused)a#1.playsRight=true;\fi% + } + if(!a#1.isPaused)a#1.playsRight=true;% \fi %re-display poster frame if(!a#1.isPaused){% i.e. if stopped @@ -3414,6 +3366,7 @@ try{% \if@anim@step% \if@anim@palindrome + if(event.shift)a#1.playsRight=!a#1.playsRight;% if(a#1.idx==\@anim@maxframe){% a#1.playsRight=false;% }else if(a#1.idx==0){% @@ -3425,34 +3378,36 @@ a#1.gotoPrev();% }% \else - if(a#1.idx==\@anim@maxframe){% - a#1.stopFirst();% - }else{% - a#1.gotoNext();% - }% + if(event.shift){% + if(a#1.idx==0){% + a#1.stopLast();% + }else{% + a#1.gotoPrev();% + }% + }else{% + if(a#1.idx==\@anim@maxframe){% + a#1.stopFirst();% + }else{% + a#1.gotoNext();% + }% + }% \fi a#1.isPaused=true;% \else if(!a#1.isPaused)a#1.stopFirst();% - \if@anim@morejs% - \if@anim@palindrome - if(a#1.idx==0)a#1.playsRight=true;% - if(a#1.idx==\@anim@maxframe)a#1.playsRight=false;% - \else - if(a#1.idx==\@anim@maxframe&&a#1.playsRight)a#1.stopFirst();% - if(a#1.idx==0&&!a#1.playsRight)a#1.stopLast();% - \fi - if(a#1.playsRight){% - a#1.playRight();% - }else{% - a#1.playLeft();% - }% - \else% - \if@anim@loop\else - if(a#1.idx==\@anim@maxframe){a#1.stopFirst();}% - \fi + if(event.shift)a#1.playsRight=!a#1.playsRight;% + \if@anim@palindrome + if(a#1.idx==0)a#1.playsRight=true;% + if(a#1.idx==\@anim@maxframe)a#1.playsRight=false;% + \else + if(a#1.idx==\@anim@maxframe&&a#1.playsRight)a#1.stopFirst();% + if(a#1.idx==0&&!a#1.playsRight)a#1.stopLast();% + \fi + if(a#1.playsRight){% a#1.playRight();% - \fi% + }else{% + a#1.playLeft();% + }% \fi% }catch(e){}% )>>% diff --git a/Master/texmf-dist/tex/latex/animate/animfp.sty b/Master/texmf-dist/tex/latex/animate/animfp.sty deleted file mode 100644 index 3e28679edef..00000000000 --- a/Master/texmf-dist/tex/latex/animate/animfp.sty +++ /dev/null @@ -1,331 +0,0 @@ -% This material is subject to the LaTeX Project Public License. See -% http://mirrors.ctan.org/help/Catalogue/licenses.lppl.html -% for the details of that license. - -% This package is loaded by animate.sty. It defines \@anim@add for fixed point -% addition - -% Copyright notice: -% The code relavant to fixed point addition was taken with virtually no -% modification from Michael Mehlich's fp-basic[1996/05/13] package - -% Copyright 2008 Alexander Grahn - -\NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{animfp}[2009/07/23 fixed point addition for animate.sty] - -%adding two values -\def\@anim@add#1#2#3{\afp@callc\afp@add#1{#2}{#3}+\relax} % #1 := #2+#3 - -%allocation of registers -\newcount\afp@xs %sign of 1st value -\newcount\afp@xia%integer part of 1st value -\newcount\afp@xib%integer part of 1st value -\newcount\afp@xfa%fractional part of 1st value -\newcount\afp@xfb%fractional part of 1st value -\countdef\afp@ys=5 %sign of 2nd value -\countdef\afp@yia=6%integer part of 2nd value -\countdef\afp@yib=7%integer part of 2nd value -\countdef\afp@yfa=8%fractional part of 2nd value -\countdef\afp@yfb=9%fractional part of 2nd value - -\newcount\afp@rega %auxiliary registers -\newcount\afp@regb -\countdef\afp@regc=36 - -\newcount\afp@regs %local auxiliary registers -\countdef\afp@count=45 - -%auxiliary macros which may be used in all of the following macros -\def\afp@ignorenext#1{} -\def\afp@first#1#2\relax{#1} -\def\afp@swallow#1\relax{} - -\def\ifafp@zero#1{% - \ifnum% - \expandafter\ifnum\csname afp@#1ia\endcsname=0 0\else1\fi% - \expandafter\ifnum\csname afp@#1ib\endcsname=0 0\else1\fi% - \expandafter\ifnum\csname afp@#1fa\endcsname=0 0\else1\fi% - \expandafter\ifnum\csname afp@#1fb\endcsname=0 0\else1\fi% - =0\relax% -} - -%read value -\def\afp@correctintcounter#1\relax{% - {\edef\afp@tmp{#1}% - \afp@count=0\relax% - \loop% - \edef\afp@tmpa{\expandafter\afp@first\afp@tmp\noexpand\relax}% - \expandafter\ifx\afp@tmpa0\relax% - \advance\afp@count1\relax% - \edef\afp@tmp{\expandafter\afp@ignorenext\afp@tmp}% - \repeat% - \ifnum\afp@count>18\relax% - \PackageError{animfp}{Overflow}{}% - \fi% - \expandafter\if!\afp@tmp!% - \advance\afp@count-18\relax% - \afp@count=-\afp@count% - \loop% - \ifnum\afp@count>0\relax% - \afp@regc=\afp@rega% - \divide\afp@rega10\relax\multiply\afp@rega10\relax% - \advance\afp@regc-\afp@rega\multiply\afp@regc100000000\relax% - \divide\afp@rega10\relax% - \divide\afp@regb10\relax\advance\afp@regb\afp@regc% - \advance\afp@count-1\relax% - \repeat% - \global\afp@rega=\afp@rega% - \global\afp@regb=\afp@regb% - \else% - \PackageError{animfp}{Number too big}{}% - \fi% - }% -} -\def\afp@@setintcounter#1#2#3#4#5#6#7#8#9{% - \afp@regb=#1#2#3#4#5#6#7#8#9\relax% - \afp@correctintcounter% -} -\def\afp@setintcounter#1#2#3#4#5#6#7#8#9{% - \afp@rega=#1#2#3#4#5#6#7#8#9\relax% - \afp@@setintcounter% -} - -\def\afp@@setfractcounter#1#2#3#4#5#6#7#8#9{% - \afp@regb=#1#2#3#4#5#6#7#8#9\relax% - \afp@swallow% -} -\def\afp@setfractcounter#1#2#3#4#5#6#7#8#9{% - \afp@rega=#1#2#3#4#5#6#7#8#9\relax% - \afp@@setfractcounter% -} - -\def\afp@getsign#1\relax{% - {\afp@regs=1\relax% - \edef\afp@tmp{#1}% - \loop% - \edef\afp@tmpa{\expandafter\afp@first\afp@tmp\noexpand\relax}% - \expandafter\ifx\afp@tmpa-\relax% - \multiply\afp@regs-1\relax% - \fi% - \ifnum\expandafter\ifx\afp@tmpa-1\else0\fi\expandafter\ifx\afp@tmpa+1\else0\fi>0% - \edef\afp@tmp{\expandafter\afp@ignorenext\afp@tmp}% - \repeat% - \global\let\afp@tmp\afp@tmp% - \global\afp@regs=\afp@regs% - }% -} - -\def\afp@removeleadingzeros#1\relax{% - {\edef\afp@tmp{#1}% - \loop% - \edef\afp@tmpa{\expandafter\afp@first\afp@tmp\noexpand\relax}% - \expandafter\ifx\afp@tmpa0\relax% - \edef\afp@tmp{\expandafter\afp@ignorenext\afp@tmp}% - \repeat% - \global\let\afp@tmp\afp@tmp% - }% -} - -\newif\ifafp@nonstop -\def\afp@strip#1{% - {\edef\afp@tmp{#1}% - \edef\afp@tmpb{}% - \ifx\afp@tmp\@empty\else% - \afp@nonstoptrue% - \loop% - \edef\afp@tmpa{\expandafter\afp@first\afp@tmp\noexpand\relax}% - \expandafter\ifx\afp@tmpa-\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \expandafter\ifx\afp@tmpa+\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \expandafter\ifx\afp@tmpa0\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \expandafter\ifx\afp@tmpa1\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \expandafter\ifx\afp@tmpa2\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \expandafter\ifx\afp@tmpa3\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \expandafter\ifx\afp@tmpa4\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \expandafter\ifx\afp@tmpa5\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \expandafter\ifx\afp@tmpa6\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \expandafter\ifx\afp@tmpa7\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \expandafter\ifx\afp@tmpa8\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \expandafter\ifx\afp@tmpa9\relax\edef\afp@tmpb{\afp@tmpb\afp@tmpa}\else% - \ifx\afp@tmpa\@empty\afp@nonstopfalse\else% - \ifx\afp@tmpa\space\afp@nonstopfalse\else% - \PackageError{animfp}{Illegal character `\afp@tmpa'\space found in float number}{}% - \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi% - \edef\afp@tmp{\expandafter\afp@ignorenext\afp@tmp}% - \ifx\afp@tmp\@empty\afp@nonstopfalse\fi% - \ifafp@nonstop% - \repeat% - \fi% - \global\let\afp@tmp\afp@tmpb% - }% -} - -\def\afp@readvalue#1#2#3{% - % #1 macro family to catch the value - % #2.#3 value - % - % regular expression [+|-]*[d]_0^18.[d]* - % - \afp@strip{#2}% - %sign - \expandafter\afp@getsign\afp@tmp\relax% - \csname afp@#1s\endcsname=\afp@regs% - % - %integer part - \afp@removeleadingzeros\afp@tmp\relax% - \expandafter\afp@setintcounter\afp@tmp000000000000000000\relax% - \csname afp@#1ia\endcsname=\afp@rega% - \csname afp@#1ib\endcsname=\afp@regb% - % - %fractional part - \afp@strip{#3}% - \expandafter\afp@setfractcounter\afp@tmp000000000000000000\relax% - \csname afp@#1fa\endcsname=\afp@rega% - \csname afp@#1fb\endcsname=\afp@regb% - % - %correct sign - \ifnum\afp@rega=0\relax% - \ifnum\afp@regb=0\relax% - \expandafter\ifnum\csname afp@#1ib\endcsname=0\relax% - \expandafter\ifnum\csname afp@#1ia\endcsname=0\relax% - \csname afp@#1s\endcsname=1\relax% - \fi% - \fi% - \fi% - \fi% -} - -%store value in macro -\def\afp@store#1#2{% - % #1 macro - % #2 macro family (value) to store - % - \ifafp@zero{#2}% - \csname afp@#2s\endcsname=1\relax% - \fi% - \expandafter\ifnum\csname afp@#2s\endcsname<0\relax% - \edef#1{-}% - \else% - \edef#1{}% - \fi% - \expandafter\ifnum\csname afp@#2ia\endcsname=0\relax% - \expandafter\ifnum\csname afp@#2ib\endcsname=0\relax% - \edef#1{#10}% - \else% - \edef#1{#1\expandafter\the\csname afp@#2ib\endcsname}% - \fi% - \else% - \expandafter\advance\csname afp@#2ib\endcsname1000000000\relax% - \edef#1{#1\expandafter\the\csname afp@#2ia\endcsname\expandafter\afp@ignorenext\the\csname afp@#2ib\endcsname}% - \fi% - \expandafter\advance\csname afp@#2fa\endcsname1000000000\relax% - \expandafter\advance\csname afp@#2fb\endcsname1000000000\relax% - \edef#1{#1\noexpand.\expandafter\afp@ignorenext\the\csname afp@#2fa\endcsname\expandafter\afp@ignorenext\the\csname afp@#2fb\endcsname}% -} - -%macros to expand some arguments -\def\afp@callc#1#2#3#4{% - % #1 macro to call - % #2 macro, which gets the result - % #3 1st value - % #4 2nd value - % expand the values and split them into the integer and the fractional parts - \edef\next{\noexpand#1\noexpand#2#3..\noexpand\relax#4..\noexpand\relax}% - \next% -} - -%remove trailing zeros of argument (A. Grahn 2009/06/29) -\def\afp@removetrailingzeros#1\relax{% - {% - \edef\afp@tmp{#1}% - \gdef\afp@reversed{}% - \expandafter\afp@reverse\afp@tmp,\@nil% - \afp@removeleadingzeros\afp@reversed\relax% - \gdef\afp@reversed{}% - \expandafter\afp@reverse\afp@tmp,\@nil% - \global\let\afp@tmp\afp@reversed% - }% -} -\def\afp@reverse#1#2\@nil{% reverse string, used in \afp@removetrailingzeros - \if#1,\else% - \xdef\afp@reversed{#1\afp@reversed}% - \afp@reverse#2\@nil% - \fi% -}% - -%add two values -\def\afp@add#1#2.#3.#4\relax#5.#6.#7\relax#8\relax{% - % #1 macro, which gets the result - % #2 integer part of 1st value - % #3 fractional part of 1st value - % #4 dummy to swallow everthing after the 2nd '.' - % #5 integer part of 2nd value - % #6 fractional part of 2nd value - % #7 dummy to swallow everthing after the 2nd '.' - % - {% - \afp@readvalue{x}{#2}{#3}% - \afp@readvalue{y}{#5}{#6}% - % - \ifnum\afp@xs=\afp@ys% - \advance\afp@xfb\afp@yfb% - \advance\afp@xfa\afp@yfa% - \ifnum\afp@xfb<1000000000\relax\else% - \advance\afp@xfb-1000000000\relax% - \advance\afp@xfa1\relax% - \fi% - \advance\afp@xib\afp@yib% - \ifnum\afp@xfa<1000000000\relax\else% - \advance\afp@xfa-1000000000\relax% - \advance\afp@xib1\relax% - \fi% - \advance\afp@xia\afp@yia% - \ifnum\afp@xib<1000000000\relax\else% - \advance\afp@xib-1000000000\relax% - \advance\afp@xia1\relax% - \fi% - \ifnum\afp@xia<1000000000\relax\else% - \PackageError{animfp}{Overflow}{}% - \fi% - \afp@store\afp@tmp{x}% - \else% - \advance\afp@xfb-\afp@yfb% - \ifnum\afp@xfb<0\relax% - \advance\afp@yfa1\relax% - \advance\afp@xfb1000000000\relax% - \fi% - \advance\afp@xfa-\afp@yfa% - \ifnum\afp@xfa<0\relax% - \advance\afp@yib1\relax% - \advance\afp@xfa1000000000\relax% - \fi% - \advance\afp@xib-\afp@yib% - \ifnum\afp@xib<0\relax% - \advance\afp@yia1\relax% - \advance\afp@xib1000000000\relax% - \fi% - \advance\afp@xia-\afp@yia% - \ifnum\afp@xia<0\relax% - \afp@xs=-\afp@xs% - \ifnum\afp@xfb=0\relax\else% - \advance\afp@xfb-1000000000\relax\afp@xfb=-\afp@xfb% - \advance\afp@xfa1\relax% - \fi% - \ifnum\afp@xfa=0\relax\else% - \advance\afp@xfa-1000000000\relax\afp@xfa=-\afp@xfa% - \advance\afp@xib1\relax% - \fi% - \ifnum\afp@xib=0\relax\else% - \advance\afp@xib-1000000000\relax\afp@xib=-\afp@xib% - \advance\afp@xia1\relax% - \fi% - \relax\afp@xia=-\afp@xia% - \fi% - \afp@store\afp@tmp{x}% - \fi% - % - \global\let\afp@tmp\afp@tmp% - }% - \afp@removetrailingzeros\afp@tmp\relax% (A. Grahn 2009/06/29) - \let#1\afp@tmp% -} -- cgit v1.2.3