texlive[41324] Master/texmf-dist: animate (8jun16)
commits+karl at tug.org
commits+karl at tug.org
Fri Jun 10 00:51:31 CEST 2016
Revision: 41324
http://tug.org/svn/texlive?view=revision&revision=41324
Author: karl
Date: 2016-06-10 00:51:31 +0200 (Fri, 10 Jun 2016)
Log Message:
-----------
animate (8jun16)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/animate/ChangeLog
trunk/Master/texmf-dist/doc/latex/animate/animate.pdf
trunk/Master/texmf-dist/source/latex/animate/animate.tex
trunk/Master/texmf-dist/tex/latex/animate/animate.sty
Removed Paths:
-------------
trunk/Master/texmf-dist/tex/latex/animate/animfp.sty
Modified: trunk/Master/texmf-dist/doc/latex/animate/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/doc/latex/animate/ChangeLog 2016-06-09 22:10:21 UTC (rev 41323)
+++ trunk/Master/texmf-dist/doc/latex/animate/ChangeLog 2016-06-09 22:51:31 UTC (rev 41324)
@@ -1,3 +1,10 @@
+2016-06-08
+ * new: reverse playback direction with shift + mouse click
+
+2016-05-30
+ * fix: broken `draft' option
+ * new: aux. package `animfp' removed, now using \fp_eval:n from l3fp
+
2016-04-15
* fix: compilation failure when using `timeline' option in beamer class
document
Modified: trunk/Master/texmf-dist/doc/latex/animate/animate.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/animate/animate.tex
===================================================================
--- trunk/Master/texmf-dist/source/latex/animate/animate.tex 2016-06-09 22:10:21 UTC (rev 41323)
+++ trunk/Master/texmf-dist/source/latex/animate/animate.tex 2016-06-09 22:51:31 UTC (rev 41324)
@@ -108,12 +108,12 @@
\section{Introduction}
This package provides an interface to create PDFs with animated content from sets of graphics or image files, from inline graphics, such as \LaTeX-picture, PSTricks or pgf/TikZ generated pictures, or just from typeset text. Unlike standard movie/video formats, package `animate' allows for animating vector graphics. The result is roughly similar to the SWF (Flash) format, although not as space-efficient.
+The user interacts with the animation either through optional animation controls or by using the mouse. Pressing the mouse button over the animation widget immediately pauses a playing animation and releasing it resumes playback. Pressing the shift-key at the same time reverses the playback direction.
+
Package `animate' supports the usual PDF making workflows, i.\,e. pdf\LaTeX{}, Lua\LaTeX{}, \LaTeX{} $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+/Distiller and \pXepLaTeX{} $\rightarrow$ \verb+(x)dvipdfmx+.
The final PDF can be viewed in current Adobe Readers on all supported platforms (except mobile devices) or in PDF-XChange Viewer.
-%The `animate' package relies on Optional Content Groups (OCG), also known as PDF layers, which is a feature provided by the PDF-1.5 specification. Each frame of an animation is associated with an OCG that is hidden or made visible in a dynamic fashion by means of Adobe Reader's built-in JavaScript engine.
-
\section{Requirements}
\begin{trivlist}
%\item $\varepsilon$-\TeX
@@ -170,7 +170,7 @@
Usually, a second \LaTeX{} run is necessary to resolve internally created object references. A warning message will be issued if appropriate.
-\clearpage
+%\clearpage
\section{The user interface}
Package `animate' provides the command
\begin{verbatim}
Modified: trunk/Master/texmf-dist/tex/latex/animate/animate.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/animate/animate.sty 2016-06-09 22:10:21 UTC (rev 41323)
+++ trunk/Master/texmf-dist/tex/latex/animate/animate.sty 2016-06-09 22:51:31 UTC (rev 41324)
@@ -13,7 +13,7 @@
\NeedsTeXFormat{LaTeX2e}
-\def\@anim at version{2016/04/15}
+\def\@anim at version{2016/06/08}
\ProvidesPackage{animate}
[\@anim at 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 at pdfcatalog\pbs_pdfcatalog:n
+
+ \let\@anim at fpeval\fp_eval:n
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -171,7 +172,11 @@
\ifcsname pdfmdfivesum\endcsname
\def\@anim at pdfmdfivesum#1{\pdfmdfivesum file {#1}}
\else
- \def\@anim at pdfmdfivesum#1{#1}
+ \ifcsname mdfivesum\endcsname
+ \def\@anim at pdfmdfivesum#1{\mdfivesum file {#1}}
+ \else
+ \def\@anim at pdfmdfivesum#1{#1}
+ \fi
\fi
\fi
@@ -263,7 +268,6 @@
% true if any of `autoplay' or `autoresume' options is set
\newboolean{@anim at autoplayorresume}
% true if any of `controls' or `palindrome' or `label' options is set
-\newboolean{@anim at morejs}
\newboolean{@anim at timeline} %true if `timeline' option is set
\newboolean{@anim at multipage} % multipage document?
@@ -1146,59 +1150,29 @@
%draftbox
\def\@anim at draftbox{%
\begingroup%
- \setlength{\unitlength}{1pt}%
\vtop{% draw boxes
\offinterlineskip%
- \hbox{%
- \raisebox{-\@anim at animdepth}{%
- \begin{picture}(\@anim at animwidth,\@anim at animtotalheight)%
- \put(0,0){\framebox(\@anim at animwidth,\@anim at animtotalheight){}}%
- \end{picture}%
+ \hbox{\raisebox{-\@anim at animdepth}{%
+ \frame{%
+ \rule{0pt}{\@anim at animtotalheight}\hskip\@anim at animwidth%
}%
- }%
+ }}%
\if at anim@controls%
\setlength{\@anim at tmpdima}{\@anim at btnsize}%
\vskip 0.1\@anim at tmpdima%
\hbox to \@anim at animwidth {%
\hss%
- \setlength{\@anim at tmpdimb}{2\@anim at tmpdima}%
- \begin{picture}(\strip at pt\@anim at tmpdimb,\strip at pt\@anim at tmpdima)%
- \put(0,0){\line(1,0){\strip at pt\@anim at tmpdimb}}%
- \put(0,\strip at pt\@anim at tmpdima){%
- \line(1,0){\strip at pt\@anim at tmpdimb}%
- }%
- \put(0,0){\line(0,1){\strip at pt\@anim at tmpdima}}%
- \end{picture}%
+ \frame{%
+ \setlength{\@anim at tmpdimb}{2\@anim at tmpdima}%
+ \rule{0pt}{\@anim at tmpdima}\hskip\@anim at tmpdimb\hskip\@anim at tmpdimb%
+ \if at anim@step\else\hskip\@anim at tmpdimb\fi%
+ }%
\if at anim@step\else%
- \begin{picture}(\strip at pt\@anim at tmpdimb,\strip at pt\@anim at tmpdima)%
- \put(0,0){\line(1,0){\strip at pt\@anim at tmpdimb}}%
- \put(0,\strip at pt\@anim at tmpdima){%
- \line(1,0){\strip at pt\@anim at tmpdimb}%
- }%
- \end{picture}%
- \fi%
- \begin{picture}(\strip at pt\@anim at tmpdimb,\strip at pt\@anim at tmpdima)%
- \put(0,0){\line(1,0){\strip at pt\@anim at tmpdimb}}%
- \put(0,\strip at pt\@anim at tmpdima){%
- \line(1,0){\strip at pt\@anim at tmpdimb}%
+ \hskip 0.3\@anim at tmpdima%
+ \frame{%
+ \setlength{\@anim at tmpdimb}{3\@anim at tmpdima}%
+ \rule{0pt}{\@anim at tmpdima}\hskip\@anim at tmpdimb%
}%
- \put(\strip at pt\@anim at tmpdimb,0){%
- \line(0,1){\strip at pt\@anim at tmpdima}%
- }%
- \end{picture}%
- \if at anim@step\else%
- \hskip 0.3\@anim at tmpdima%
- \setlength{\@anim at tmpdimb}{3\@anim at tmpdima}%
- \begin{picture}(\strip at pt\@anim at tmpdimb,\strip at pt\@anim at tmpdima)%
- \put(0,0){\line(0,1){\strip at pt\@anim at tmpdima}}%
- \put(0,0){\line(1,0){\strip at pt\@anim at tmpdimb}}%
- \put(0,\strip at pt\@anim at tmpdima){%
- \line(1,0){\strip at pt\@anim at tmpdimb}%
- }%
- \put(\strip at pt\@anim at tmpdimb,0){%
- \line(0,1){\strip at pt\@anim at tmpdima}%
- }%
- \end{picture}%
\fi%
\hss%
}%
@@ -1346,12 +1320,6 @@
\ifthenelse{\boolean{@anim at autoplay}\OR\boolean{@anim at autoresume}}{%
\setboolean{@anim at autoplayorresume}{true}%
}{}%
- \ifthenelse{\boolean{@anim at controls}\OR\boolean{@anim at palindrome}}{%
- \setboolean{@anim at morejs}{true}%
- }{}%
- \ifx\empty\@anim at label\empty\else%
- \setboolean{@anim at morejs}{true}%
- \fi%
\ifthenelse{\NOT\boolean{@anim at controls}\AND\boolean{@anim at step}}{%
\setboolean{@anim at loop}{true}%
}{}%
@@ -1725,12 +1693,6 @@
\ifthenelse{\boolean{@anim at autoplay}\OR\boolean{@anim at autoresume}}{%
\setboolean{@anim at autoplayorresume}{true}%
}{}%
- \ifthenelse{\boolean{@anim at controls}\OR\boolean{@anim at palindrome}}{%
- \setboolean{@anim at morejs}{true}%
- }{}%
- \ifx\empty\@anim at label\empty\else%
- \setboolean{@anim at morejs}{true}%
- \fi%
\ifthenelse{\NOT\boolean{@anim at controls}\AND\boolean{@anim at step}}{%
\setboolean{@anim at loop}{true}%
}{}%
@@ -1886,7 +1848,10 @@
}{}%
\fi\fi%
%draw draftbox according to dimensions of the first frame
- \if at anim@draft\@anim at scale{\@anim at box}\@anim at draftbox\fi%
+ \if at anim@draft%
+ \@anim at scale{\@anim at box}%
+ \@anim at draftbox%
+ \fi%
\else% remaining frames
%deal with zero width or totalheight boxes
\ifdim\wd\@anim at box=\z@\global\setbox\@anim at box=\hbox{\phantom{X}}\fi%
@@ -1985,13 +1950,15 @@
\OR\equal{\@anim at vartype}{r}\OR\equal{\@anim at vartype}{R}%
}{% real numbers, prefix n, N, r, R
%initialize variable
- \expandafter\@anim at add\csname#1\endcsname{#2}{0.0}%
+ \expandafter\edef\csname#1\endcsname{\@anim at fpeval{#2}}%
%global copy that saves current variable value between loops
- \expandafter\xdef\csname#1 at old\endcsname{#2}%
+ \expandafter\xdef\csname#1 at old\endcsname{\@anim at fpeval{#2}}%
%append script for updating variable to \@anim at updatevars macro
\g at addto@macro\@anim at updatevars{%
%new value
- \expandafter\@anim at add\csname#1\endcsname{\csname#1 at old\endcsname}{#3}%
+ \expandafter\edef\csname#1\endcsname{%
+ \@anim at fpeval{#3+\csname#1 at old\endcsname}%
+ }%
%global copy
\expandafter\xdef\csname#1 at old\endcsname{\csname#1\endcsname}%
}%
@@ -2704,7 +2671,6 @@
\setboolean{@anim at multipage}{false}%
\setboolean{@anim at meas}{false}%
\setboolean{@anim at autoplayorresume}{false}%
- \setboolean{@anim at morejs}{false}%
\xdef\@anim at ftype{\@anim@@ftype}%
}
@@ -3026,8 +2992,8 @@
%playing state and direction
\if at anim@step
\if at anim@palindrome a#1.playsRight=true;\fi%
- \else%
- \if at anim@morejs a#1.playsRight=true;\fi%
+ \else
+ a#1.playsRight=true;%
\fi%
a#1.isPaused=false;%
\if at anim@step\else
@@ -3045,11 +3011,7 @@
a#1.setFps=function(f){%
a#1.fps=f;%
if(a#1.playing){%
- \if at 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 at anim@morejs
- a#1.gotoPrev=function(){%
- if(a#1.seekFrame(a#1.idx-1)<0){%
- \if at anim@step\else\if at anim@meas a#1.stopMeas();\fi\fi%
- \if at anim@palindrome%
- \if at anim@step
- a#1.stopFirst();%
- a#1.playsRight=true;%
+ a#1.gotoPrev=function(){%
+ if(a#1.seekFrame(a#1.idx-1)<0){%
+ \if at anim@step\else\if at anim@meas a#1.stopMeas();\fi\fi%
+ \if at anim@palindrome%
+ \if at 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 at anim@step
+ a#1.stopFirst();%
+ \else%
+ \if at anim@loop
+ if(a#1.playing){%
+ a#1.seekFrame(\@anim at maxframe);%
+ }else{a#1.stopFirst();}%
\else
- if(a#1.playing){%
- a#1.seekFrame(a#1.idx+1);%
- a#1.playRight();%
- }%
- \fi%
- \else%
- \if at anim@step
a#1.stopFirst();%
- \else%
- \if at anim@loop
- if(a#1.playing){%
- a#1.seekFrame(\@anim at maxframe);%
- }else{a#1.stopFirst();}%
- \else
- a#1.stopFirst();%
- \fi%
\fi%
- \fi
- return;%
- }%
- \if at anim@step\else%
- \if at anim@pauseframes
- if(a#1.playing&&a#1.pauseAt[a#1.idx]){a#1.pause();}%
\fi%
+ \fi
+ return;%
+ }%
+ \if at anim@step\else%
+ \if at anim@pauseframes
+ if(a#1.playing&&a#1.pauseAt[a#1.idx]){a#1.pause();}%
\fi%
- };%
- \fi%
+ \fi%
+ };%
\if at 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 at anim@morejs a#1.playsRight=true;\fi
+ a#1.playsRight=true;%
a#1.playing=true;%
a#1.isPaused=false;%
\if at anim@controls
@@ -3223,24 +3183,22 @@
a#1_int=app.setInterval('a#1.gotoNext()',%
1000/(1e-6+a#1.fps)/a#1.sm);%
};%
- \if at 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 at 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 at 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 at 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 at anim@meas a#1.startMeas();\fi
+ a#1_int=app.setInterval('a#1.gotoPrev()',%
+ 1000/(1e-6+a#1.fps)/a#1.sm);%
+ };%
\if at anim@controls
a#1.fpsIncr=function(){% speed up animation
a#1.sm*=1.1;%
@@ -3273,34 +3231,32 @@
};%
\fi%
\fi%
- \if at anim@morejs%
- \if at 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 at maxframe||!a#1.isPaused){a#1.stopFirst();}%
- a#1.playRight();%
- };%
- \fi%
+ \if at 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 at maxframe||!a#1.isPaused){a#1.stopFirst();}%
+ a#1.playRight();%
+ };%
\fi%
%animation API for labelled anims
\ifx\empty\@anim at label\empty\else
@@ -3356,12 +3312,8 @@
\if at anim@autoplayorresume%
\if at anim@autoresume
if(a#1.isPaused){%
- \fi%
- \if at 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 at anim@autoresume%
}%
\fi%
@@ -3384,8 +3336,8 @@
\else
a#1.pause(true);% stop
\fi%
- }%
- \if at 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 at anim@step%
\if at anim@palindrome
+ if(event.shift)a#1.playsRight=!a#1.playsRight;%
if(a#1.idx==\@anim at maxframe){%
a#1.playsRight=false;%
}else if(a#1.idx==0){%
@@ -3425,34 +3378,36 @@
a#1.gotoPrev();%
}%
\else
- if(a#1.idx==\@anim at 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 at maxframe){%
+ a#1.stopFirst();%
+ }else{%
+ a#1.gotoNext();%
+ }%
+ }%
\fi
a#1.isPaused=true;%
\else
if(!a#1.isPaused)a#1.stopFirst();%
- \if at anim@morejs%
- \if at anim@palindrome
- if(a#1.idx==0)a#1.playsRight=true;%
- if(a#1.idx==\@anim at maxframe)a#1.playsRight=false;%
- \else
- if(a#1.idx==\@anim at 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 at anim@loop\else
- if(a#1.idx==\@anim at maxframe){a#1.stopFirst();}%
- \fi
+ if(event.shift)a#1.playsRight=!a#1.playsRight;%
+ \if at anim@palindrome
+ if(a#1.idx==0)a#1.playsRight=true;%
+ if(a#1.idx==\@anim at maxframe)a#1.playsRight=false;%
+ \else
+ if(a#1.idx==\@anim at 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){}%
)>>%
Deleted: trunk/Master/texmf-dist/tex/latex/animate/animfp.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/animate/animfp.sty 2016-06-09 22:10:21 UTC (rev 41323)
+++ trunk/Master/texmf-dist/tex/latex/animate/animfp.sty 2016-06-09 22:51:31 UTC (rev 41324)
@@ -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 at 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 at add#1#2#3{\afp at callc\afp at add#1{#2}{#3}+\relax} % #1 := #2+#3
-
-%allocation of registers
-\newcount\afp at xs %sign of 1st value
-\newcount\afp at xia%integer part of 1st value
-\newcount\afp at xib%integer part of 1st value
-\newcount\afp at xfa%fractional part of 1st value
-\newcount\afp at xfb%fractional part of 1st value
-\countdef\afp at ys=5 %sign of 2nd value
-\countdef\afp at yia=6%integer part of 2nd value
-\countdef\afp at yib=7%integer part of 2nd value
-\countdef\afp at yfa=8%fractional part of 2nd value
-\countdef\afp at yfb=9%fractional part of 2nd value
-
-\newcount\afp at rega %auxiliary registers
-\newcount\afp at regb
-\countdef\afp at regc=36
-
-\newcount\afp at regs %local auxiliary registers
-\countdef\afp at count=45
-
-%auxiliary macros which may be used in all of the following macros
-\def\afp at ignorenext#1{}
-\def\afp at first#1#2\relax{#1}
-\def\afp at swallow#1\relax{}
-
-\def\ifafp at 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 at correctintcounter#1\relax{%
- {\edef\afp at tmp{#1}%
- \afp at count=0\relax%
- \loop%
- \edef\afp at tmpa{\expandafter\afp at first\afp at tmp\noexpand\relax}%
- \expandafter\ifx\afp at tmpa0\relax%
- \advance\afp at count1\relax%
- \edef\afp at tmp{\expandafter\afp at ignorenext\afp at tmp}%
- \repeat%
- \ifnum\afp at count>18\relax%
- \PackageError{animfp}{Overflow}{}%
- \fi%
- \expandafter\if!\afp at tmp!%
- \advance\afp at count-18\relax%
- \afp at count=-\afp at count%
- \loop%
- \ifnum\afp at count>0\relax%
- \afp at regc=\afp at rega%
- \divide\afp at rega10\relax\multiply\afp at rega10\relax%
- \advance\afp at regc-\afp at rega\multiply\afp at regc100000000\relax%
- \divide\afp at rega10\relax%
- \divide\afp at regb10\relax\advance\afp at regb\afp at regc%
- \advance\afp at count-1\relax%
- \repeat%
- \global\afp at rega=\afp at rega%
- \global\afp at regb=\afp at regb%
- \else%
- \PackageError{animfp}{Number too big}{}%
- \fi%
- }%
-}
-\def\afp@@setintcounter#1#2#3#4#5#6#7#8#9{%
- \afp at regb=#1#2#3#4#5#6#7#8#9\relax%
- \afp at correctintcounter%
-}
-\def\afp at setintcounter#1#2#3#4#5#6#7#8#9{%
- \afp at 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 at regb=#1#2#3#4#5#6#7#8#9\relax%
- \afp at swallow%
-}
-\def\afp at setfractcounter#1#2#3#4#5#6#7#8#9{%
- \afp at rega=#1#2#3#4#5#6#7#8#9\relax%
- \afp@@setfractcounter%
-}
-
-\def\afp at getsign#1\relax{%
- {\afp at regs=1\relax%
- \edef\afp at tmp{#1}%
- \loop%
- \edef\afp at tmpa{\expandafter\afp at first\afp at tmp\noexpand\relax}%
- \expandafter\ifx\afp at tmpa-\relax%
- \multiply\afp at regs-1\relax%
- \fi%
- \ifnum\expandafter\ifx\afp at tmpa-1\else0\fi\expandafter\ifx\afp at tmpa+1\else0\fi>0%
- \edef\afp at tmp{\expandafter\afp at ignorenext\afp at tmp}%
- \repeat%
- \global\let\afp at tmp\afp at tmp%
- \global\afp at regs=\afp at regs%
- }%
-}
-
-\def\afp at removeleadingzeros#1\relax{%
- {\edef\afp at tmp{#1}%
- \loop%
- \edef\afp at tmpa{\expandafter\afp at first\afp at tmp\noexpand\relax}%
- \expandafter\ifx\afp at tmpa0\relax%
- \edef\afp at tmp{\expandafter\afp at ignorenext\afp at tmp}%
- \repeat%
- \global\let\afp at tmp\afp at tmp%
- }%
-}
-
-\newif\ifafp at nonstop
-\def\afp at strip#1{%
- {\edef\afp at tmp{#1}%
- \edef\afp at tmpb{}%
- \ifx\afp at tmp\@empty\else%
- \afp at nonstoptrue%
- \loop%
- \edef\afp at tmpa{\expandafter\afp at first\afp at tmp\noexpand\relax}%
- \expandafter\ifx\afp at tmpa-\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \expandafter\ifx\afp at tmpa+\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \expandafter\ifx\afp at tmpa0\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \expandafter\ifx\afp at tmpa1\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \expandafter\ifx\afp at tmpa2\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \expandafter\ifx\afp at tmpa3\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \expandafter\ifx\afp at tmpa4\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \expandafter\ifx\afp at tmpa5\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \expandafter\ifx\afp at tmpa6\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \expandafter\ifx\afp at tmpa7\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \expandafter\ifx\afp at tmpa8\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \expandafter\ifx\afp at tmpa9\relax\edef\afp at tmpb{\afp at tmpb\afp at tmpa}\else%
- \ifx\afp at tmpa\@empty\afp at nonstopfalse\else%
- \ifx\afp at tmpa\space\afp at nonstopfalse\else%
- \PackageError{animfp}{Illegal character `\afp at tmpa'\space found in float number}{}%
- \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi%
- \edef\afp at tmp{\expandafter\afp at ignorenext\afp at tmp}%
- \ifx\afp at tmp\@empty\afp at nonstopfalse\fi%
- \ifafp at nonstop%
- \repeat%
- \fi%
- \global\let\afp at tmp\afp at tmpb%
- }%
-}
-
-\def\afp at readvalue#1#2#3{%
- % #1 macro family to catch the value
- % #2.#3 value
- %
- % regular expression [+|-]*[d]_0^18.[d]*
- %
- \afp at strip{#2}%
- %sign
- \expandafter\afp at getsign\afp at tmp\relax%
- \csname afp@#1s\endcsname=\afp at regs%
- %
- %integer part
- \afp at removeleadingzeros\afp at tmp\relax%
- \expandafter\afp at setintcounter\afp at tmp000000000000000000\relax%
- \csname afp@#1ia\endcsname=\afp at rega%
- \csname afp@#1ib\endcsname=\afp at regb%
- %
- %fractional part
- \afp at strip{#3}%
- \expandafter\afp at setfractcounter\afp at tmp000000000000000000\relax%
- \csname afp@#1fa\endcsname=\afp at rega%
- \csname afp@#1fb\endcsname=\afp at regb%
- %
- %correct sign
- \ifnum\afp at rega=0\relax%
- \ifnum\afp at 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 at store#1#2{%
- % #1 macro
- % #2 macro family (value) to store
- %
- \ifafp at 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 at 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 at ignorenext\the\csname afp@#2fa\endcsname\expandafter\afp at ignorenext\the\csname afp@#2fb\endcsname}%
-}
-
-%macros to expand some arguments
-\def\afp at 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 at removetrailingzeros#1\relax{%
- {%
- \edef\afp at tmp{#1}%
- \gdef\afp at reversed{}%
- \expandafter\afp at reverse\afp at tmp,\@nil%
- \afp at removeleadingzeros\afp at reversed\relax%
- \gdef\afp at reversed{}%
- \expandafter\afp at reverse\afp at tmp,\@nil%
- \global\let\afp at tmp\afp at reversed%
- }%
-}
-\def\afp at reverse#1#2\@nil{% reverse string, used in \afp at removetrailingzeros
- \if#1,\else%
- \xdef\afp at reversed{#1\afp at reversed}%
- \afp at reverse#2\@nil%
- \fi%
-}%
-
-%add two values
-\def\afp at 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 at readvalue{x}{#2}{#3}%
- \afp at readvalue{y}{#5}{#6}%
- %
- \ifnum\afp at xs=\afp at ys%
- \advance\afp at xfb\afp at yfb%
- \advance\afp at xfa\afp at yfa%
- \ifnum\afp at xfb<1000000000\relax\else%
- \advance\afp at xfb-1000000000\relax%
- \advance\afp at xfa1\relax%
- \fi%
- \advance\afp at xib\afp at yib%
- \ifnum\afp at xfa<1000000000\relax\else%
- \advance\afp at xfa-1000000000\relax%
- \advance\afp at xib1\relax%
- \fi%
- \advance\afp at xia\afp at yia%
- \ifnum\afp at xib<1000000000\relax\else%
- \advance\afp at xib-1000000000\relax%
- \advance\afp at xia1\relax%
- \fi%
- \ifnum\afp at xia<1000000000\relax\else%
- \PackageError{animfp}{Overflow}{}%
- \fi%
- \afp at store\afp at tmp{x}%
- \else%
- \advance\afp at xfb-\afp at yfb%
- \ifnum\afp at xfb<0\relax%
- \advance\afp at yfa1\relax%
- \advance\afp at xfb1000000000\relax%
- \fi%
- \advance\afp at xfa-\afp at yfa%
- \ifnum\afp at xfa<0\relax%
- \advance\afp at yib1\relax%
- \advance\afp at xfa1000000000\relax%
- \fi%
- \advance\afp at xib-\afp at yib%
- \ifnum\afp at xib<0\relax%
- \advance\afp at yia1\relax%
- \advance\afp at xib1000000000\relax%
- \fi%
- \advance\afp at xia-\afp at yia%
- \ifnum\afp at xia<0\relax%
- \afp at xs=-\afp at xs%
- \ifnum\afp at xfb=0\relax\else%
- \advance\afp at xfb-1000000000\relax\afp at xfb=-\afp at xfb%
- \advance\afp at xfa1\relax%
- \fi%
- \ifnum\afp at xfa=0\relax\else%
- \advance\afp at xfa-1000000000\relax\afp at xfa=-\afp at xfa%
- \advance\afp at xib1\relax%
- \fi%
- \ifnum\afp at xib=0\relax\else%
- \advance\afp at xib-1000000000\relax\afp at xib=-\afp at xib%
- \advance\afp at xia1\relax%
- \fi%
- \relax\afp at xia=-\afp at xia%
- \fi%
- \afp at store\afp at tmp{x}%
- \fi%
- %
- \global\let\afp at tmp\afp at tmp%
- }%
- \afp at removetrailingzeros\afp at tmp\relax% (A. Grahn 2009/06/29)
- \let#1\afp at tmp%
-}
More information about the tex-live-commits
mailing list