diff options
author | Karl Berry <karl@freefriends.org> | 2009-11-30 23:09:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-11-30 23:09:19 +0000 |
commit | d5ca4092c16996cd2ba4edef1923aa97fa573193 (patch) | |
tree | 221d4974248f07cf458c9764819f40777a83ce38 /Master/texmf-dist/tex/generic/pstricks-add | |
parent | 9f5467bda844e5ea99047c80e8fcc16b5141f2d2 (diff) |
pstricks-add update (30nov09)
git-svn-id: svn://tug.org/texlive/trunk@16250 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pstricks-add')
-rw-r--r-- | Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex | 84 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex | 16 |
2 files changed, 90 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex b/Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex index ff145b5e251..1ad488864df 100644 --- a/Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex +++ b/Master/texmf-dist/tex/generic/pstricks-add/pst-fp.tex @@ -1,4 +1,4 @@ -%% $Id: pst-fp.tex 148 2009-11-14 09:01:39Z herbert $ +%% $Id: pst-fp.tex 155 2009-11-30 07:58:45Z herbert $ %% %% %% This is file `pst-fp.tex', @@ -15,7 +15,8 @@ %% in directory macros/latex/base/lppl.txt. %% %% DESCRIPTION: -%% `pst-fp' is a PSTricks related package for a division +%% `pst-fp' is a PSTricks related package for a division, +%% multiplication and addition %% \csname PSTFPloaded\endcsname \let\PSTFPloaded\endinput @@ -23,8 +24,8 @@ % Requires some packages \ifx\PSTricksLoaded\endinput\else\input pstricks \fi % -\def\fileversion{0.03} -\def\filedate{2009/11/14} +\def\fileversion{0.04} +\def\filedate{2009/11/24} \message{`pst-fp' v\fileversion, \filedate\space (hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -33,6 +34,7 @@ % -999999999999999999.999999999999999999 % and +999999999999999999.999999999999999999 +\def\pstFPadd#1#2#3{\pstFP@callc\pstFP@add#1{#2}{#3}+\relax} % #1 := #2+#3 \def\pstFPmul#1#2#3{\pstFP@callc\pstFP@mul#1{#2}{#3}} % #1 := #2*#3 \def\pstFPdiv#1#2#3{\pstFP@callc\pstFP@div#1{#2}{#3}} % #1 := #2/#3 @@ -400,6 +402,80 @@ }% } % +%add two values +\def\pstFP@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 '.' + % + {\ifx#8+\relax% + \pstFP@readvalue{x}{#2}{#3}% + \pstFP@readvalue{y}{#5}{#6}% + \ifnum\pstFP@xs=\pstFP@ys% + \advance\pstFP@xfb\pstFP@yfb% + \advance\pstFP@xfa\pstFP@yfa% + \ifnum\pstFP@xfb<1000000000\relax\else% + \advance\pstFP@xfb-1000000000\relax% + \advance\pstFP@xfa1\relax% + \fi% + \advance\pstFP@xib\pstFP@yib% + \ifnum\pstFP@xfa<1000000000\relax\else% + \advance\pstFP@xfa-1000000000\relax% + \advance\pstFP@xib1\relax% + \fi% + \advance\pstFP@xia\pstFP@yia% + \ifnum\pstFP@xib<1000000000\relax\else% + \advance\pstFP@xib-1000000000\relax% + \advance\pstFP@xia1\relax% + \fi% + \ifnum\pstFP@xia<1000000000\relax\else% + \pstFP@errmessage{Overflow}% + \fi% + \pstFP@store\pstFP@tmp{x}% + \else% + \advance\pstFP@xfb-\pstFP@yfb% + \ifnum\pstFP@xfb<0\relax% + \advance\pstFP@yfa1\relax% + \advance\pstFP@xfb1000000000\relax% + \fi% + \advance\pstFP@xfa-\pstFP@yfa% + \ifnum\pstFP@xfa<0\relax% + \advance\pstFP@yib1\relax% + \advance\pstFP@xfa1000000000\relax% + \fi% + \advance\pstFP@xib-\pstFP@yib% + \ifnum\pstFP@xib<0\relax% + \advance\pstFP@yia1\relax% + \advance\pstFP@xib1000000000\relax% + \fi% + \advance\pstFP@xia-\pstFP@yia% + \ifnum\pstFP@xia<0\relax% + \pstFP@xs=-\pstFP@xs% + \ifnum\pstFP@xfb=0\relax\else% + \advance\pstFP@xfb-1000000000\relax\pstFP@xfb=-\pstFP@xfb% + \advance\pstFP@xfa1\relax% + \fi% + \ifnum\pstFP@xfa=0\relax\else% + \advance\pstFP@xfa-1000000000\relax\pstFP@xfa=-\pstFP@xfa% + \advance\pstFP@xib1\relax% + \fi% + \ifnum\pstFP@xib=0\relax\else% + \advance\pstFP@xib-1000000000\relax\pstFP@xib=-\pstFP@xib% + \advance\pstFP@xia1\relax% + \fi% + \relax\pstFP@xia=-\pstFP@xia% + \fi% + \pstFP@store\pstFP@tmp{x}% + \fi% + \global\let\pstFP@tmp\pstFP@tmp% + }% + \let#1\pstFP@tmp% +} + \def\pstFP@div#1#2.#3.#4\relax#5.#6.#7\relax{% % #1 macro, which gets the result % #2 integer part of 1st value diff --git a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex index 9f85653803b..e4618d5fbde 100644 --- a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex +++ b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex @@ -1,4 +1,4 @@ -%% $Id: pstricks-add.tex 150 2009-11-14 09:25:53Z herbert $ +%% $Id: pstricks-add.tex 154 2009-11-30 07:51:26Z herbert $ %% %% %% This is file `pstricks-add.tex', @@ -31,7 +31,7 @@ \ifx\PSTFPloaded\endinput\else \input pst-fp \fi \ifx\PSTmathLoaded\endinput\else \input pst-math \fi % -\def\fileversion{3.36}%%% CTAN 3.36 +\def\fileversion{3.36} \def\filedate{2009/11/14} \message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)} % @@ -102,16 +102,20 @@ % % stolen from latex.ltx to make it TeX compatible % +\newcount\psLoopIndex \def\@fornoop#1\@@#2#3{} \long\def\@for#1:=#2\do#3{% + \pst@cntm=0% \expandafter\def\expandafter\@fortmp\expandafter{#2}% \ifx\@fortmp\@empty \else \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}\fi} \long\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else - #5\def#4{#2}\ifx #4\@nnil \else#5\@iforloop #3\@@#4{#5}\fi\fi} -\long\def\@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil - \expandafter\@fornoop \else - #4\relax\expandafter\@iforloop\fi#2\@@#3{#4}} + #5\def#4{#2}\ifx #4\@nnil \else\global\advance\psLoopIndex by \@ne\relax% + #5\@iforloop #3\@@#4{#5}\fi\fi} +\long\def\@iforloop#1,#2\@@#3#4{\global\advance\psLoopIndex by \@ne\relax% + \def#3{#1}\ifx #3\@nnil + \expandafter\@fornoop \else + #4\relax\expandafter\@iforloop\fi#2\@@#3{#4}} \def\psforeach#1#2#3{% \begingroup% \edef\reserved@a{#2}% |