summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/third/account/t-floatnumber.tex
blob: 30a1efe0d21d2fc0b5ebc851ecb82994cd717755 (plain)
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
69
70
71
72
73
74
75
76
77
78
%D \module
%D   [       file=t-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

% Commands for floatnumbers:
%
% \definefloatnumber[name]
% \setfloatnumber[name]{value}
% \resetfloatnumber[name]
% \incrementfloatnumber[name]{value}
% \decrementfloatnumber[name]{value}
% \multiplyfloatnumber[name]{value}
% \dividefloatnumber[name]{value}
% \savefloatnumber[name]
% \restorefloatnumber[name]
% \getfloatnumber[name]

\def\setupfloatnumber
  {\dodoubleargument\dosetupfloatnumber}

\def\dosetupfloatnumber[#1][#2]%
  {\getparameters[\s!float\s!number#1][#2]}

\def\definefloatnumber
  {\dodoubleempty\dodefinefloatnumber}

\def\dodefinefloatnumber[#1][#2]%
  {\setupfloatnumber
     [#1]
     [\c!command=\twodigitrounding,
      #2]%
   \makefloatcounter{\s!float\s!number#1}}

\def\setfloatnumber[#1]#2%
  {\setfloatcounter{\s!float\s!number#1}{#2}}

\def\resetfloatnumber[#1]%
  {\resetfloatcounter{\s!float\s!number#1}}

\def\incrementfloatnumber[#1]#2%
  {\plusfloatcounter{\s!float\s!number#1}{#2}}

\def\decrementfloatnumber[#1]#2%
  {\minusfloatcounter{\s!float\s!number#1}{#2}}

\def\multiplyfloatnumber[#1]#2%
  {\multiplyfloatcounter{\s!float\s!number#1}{#2}}

\def\dividefloatnumber[#1]#2%
  {\dividefloatcounter{\s!float\s!number#1}{#2}}

\def\savefloatnumber[#1]%
  {\savefloatcounter{\s!float\s!number#1}}

\def\restorefloatnumber[#1]%
  {\restorefloatcounter{\s!float\s!number#1}}

\def\getfloatnumber[#1]%
  {\csname\s!float\s!number#1\c!command\endcsname
     {\floatcountervalue{\s!float\s!number#1}}}

\def\rawfloatnumber[#1]%
  {\floatcountervalue{\s!float\s!number#1}}

\loadmarkfile{t-floatnumber}

\protect \endinput