1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
%D \module
%D [ file=floatnumber,
%D version=2008.02.11,
%D title=\CONTEXT\ User Module,
%D subtitle=Float Numbers,
%D author=Wolfgang Schuster,
%D date=\currentdate,
%D copyright=Wolfgang Schuster,
%D email=schuster.wolfgang@googlemail.com,
%D license=Public Domain]
\writestatus{loading}{Context User Module / Float Numbers}
\unprotect
\def\@@floatnumber@@v{@@floatnumber@@v}
\def\@@floatnumber@@s{@@floatnumber@@s}
% namespace is already dealt with in the frontend
% \def\@@floatnumber@@v{v:}
% \def\@@floatnumber@@s{s:}
\def\makefloatcounter#1%
{\global\@EA\let\csname\@@floatnumber@@v#1\endcsname\zeropoint
\global\@EA\let\csname\@@floatnumber@@s#1\endcsname\zeropoint}
\def\floatcountervalue#1%
{\ifcsname\@@floatnumber@@v#1\endcsname
\@EA\withoutpt\the\dimexpr\csname\@@floatnumber@@v#1\endcsname\relax
\fi}
\def\plusfloatcounter#1#2%
{\@EA\xdef\csname\@@floatnumber@@v#1\endcsname
{\the\dimexpr\csname\@@floatnumber@@v#1\endcsname+#2\points\relax}}
\def\minusfloatcounter#1#2%
{\@EA\xdef\csname\@@floatnumber@@v#1\endcsname
{\the\dimexpr\csname\@@floatnumber@@v#1\endcsname-#2\points\relax}}
\def\multiplyfloatcounter#1#2%
{\@EA\xdef\csname\@@floatnumber@@v#1\endcsname
{\the\dimexpr\csname\@@floatnumber@@v#1\endcsname*\integerrounding{\@EA\withoutpt\the\dimexpr#2\points*\plushundred\relax}/\plushundred\relax}}
\def\multiplyfloatcounter#1#2%
{\@EA\xdef\csname\@@floatnumber@@v#1\endcsname
{\the\dimexpr\csname\@@floatnumber@@v#1\endcsname*\numexpr\number\dimexpr#2\points\relax*\plushundred/\maxcard\relax/\plushundred\relax}}
\def\dividefloatcounter#1#2%
{\@EA\xdef\csname\@@floatnumber@@v#1\endcsname
{\the\dimexpr\csname\@@floatnumber@@v#1\endcsname*\plushundred/\integerrounding{\@EA\withoutpt\the\dimexpr#2\points*\plushundred\relax}\relax}}
\def\dividefloatcounter#1#2%
{\@EA\xdef\csname\@@floatnumber@@v#1\endcsname
{\the\dimexpr\csname\@@floatnumber@@v#1\endcsname*\plushundred/\numexpr\number\dimexpr#2\points\relax*\plushundred/\maxcard\relax\relax}}
\let\resetfloatcounter\makefloatcounter
\def\setfloatcounter#1#2%
{\global\@EA\xdef\csname\@@floatnumber@@v#1\endcsname{\the\dimexpr#2\points\relax}}
\def\savefloatcounter#1%
{\global\@EA\xdef\csname\@@floatnumber@@s#1\endcsname{\the\dimexpr\csname\@@floatnumber@@v#1\endcsname\relax}}
\def\restorefloatcounter#1%
{\global\@EA\xdef\csname\@@floatnumber@@v#1\endcsname{\the\dimexpr\csname\@@floatnumber@@s#1\endcsname\relax}}
\protect \endinput
|