summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/lisp-on-tex/lisp-mod-fpnum.sty
blob: 54af9aa33dd65481d2fba43d059031c10b57b1c2 (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
79
80
81
82
83
84
%%% module name :: fpnum

\def\@mod@read@fpnum#1#2{\gdef#1{\@tlabel@fpnum{#2}}}
\def\@tlabel@fpnum{\@eval@fpnum\@apply@fpnum\@@apply@fpnum}

\def\@eval@fpnum#1#2#3{\gdef#3{\@tlabel@fpnum{#1}}} % #1 contents, #2 environment, #3 register
\def\@apply@fpnum{\errmessage{LISP on TeX [internal apply, module fpnum] cannot apply}}
\def\@@apply@fpnum{\errmessage{LISP on TeX [function --- apply, module fpnum] cannot apply}}

\newdimen\@tempdimeni
\newdimen\@tempdimenii

\addassoc\@globalenv\fpnumTOstring{\@tlabel@func{\@mod@fpnum@tostring}}
\def\@mod@fpnum@tostring#1\@tlabel@fpnum#2{\gdef#1{\@tlabel@string{#2}}}

\addassoc\@globalenv\fpplus{\@tlabel@func{\@tempdimeni0pt\relax\@mod@fpnum@plus}}
\def\@mod@fpnum@plus#1#2#3{%
	\ifx#2\relax
		\let\@next@fpnum@plus\@@fin@fpnum@plus
	\else\ifx#2\@tlabel@fpnum
		\advance\@tempdimeni#3pt\relax
		\let\@next@fpnum@plus\@mod@fpnum@plus
	\else
		\errmessage{LISP on TeX [fpnum --- plus]: Invalid argument}%
	\fi\fi\@next@fpnum@plus#1}
\def\@@fin@fpnum@plus#1{\xdef#1{\noexpand\@tlabel@fpnum{\strip@pt\@tempdimeni}}}

\addassoc\@globalenv\fpmul{\@tlabel@func{\@tempdimeni1pt\relax\@mod@fpnum@mul}}
\def\@mod@fpnum@mul#1#2#3{%
	\ifx#2\relax
		\let\@next@fpnum@mul\@@fin@fpnum@mul
	\else\ifx#2\@tlabel@fpnum
		\@tempdimeni#3\@tempdimeni
		\let\@next@fpnum@mul\@mod@fpnum@mul
	\else
		\errmessage{LISP on TeX [fpnum --- mul]: Invalid argument}%
	\fi\fi\@next@fpnum@mul#1}
\def\@@fin@fpnum@mul#1{\xdef#1{\noexpand\@tlabel@fpnum{\strip@pt\@tempdimeni}}}

\addassoc\@globalenv\fpminus{\@tlabel@func{\@mod@fpnum@minus}}
\def\@mod@fpnum@minus#1#2#3#4#5{%
	\ifx#4\relax
		\ifx#2\@tlabel@fpnum
			\@tempdimenii#3pt
			\@tempdimeni0pt
			\advance\@tempdimeni-\@tempdimenii
			\let\@next@fpnum@minus\@@fin@fpnum@minus
		\else
			\errmessage{LISP on TeX [fpnum --- minus]: Invalid argument}%
		\fi
	\else\ifx#4\@tlabel@fpnum
		\ifx#2\@tlabel@fpnum
			\@tempdimeni#3pt
			\let\@next@fpnum@minus\@@next@fpnum@minus
		\else
			\errmessage{LISP on TeX [fpnum --- minus]: Invalid argument}%
		\fi
	\else
		\errmessage{LISP on TeX [fpnum --- minus]: Invalid argument}%
	\fi\fi
	\@next@fpnum@minus#1#4{#5}}
\def\@@fin@fpnum@minus#1{\xdef#1{\noexpand\@tlabel@fpnum{\strip@pt\@tempdimeni}}}
\def\@@next@fpnum@minus#1#2#3{%
	\ifx#2\relax
		\let\@next@fpnum@minus\@@fin@fpnum@minus
	\else\ifx#2\@tlabel@fpnum
		\@tempdimenii#3pt
		\advance\@tempdimeni-\@tempdimenii
		\let\@next@fpnum@minus\@@next@fpnum@minus
	\else
		\errmessage{LISP on TeX [fpnum --- minus]: Invalid argument}%
	\fi\fi
	\@next@fpnum@minus#1}

\addassoc\@globalenv\fplt{\@tlabel@func{\@mod@fpnum@lt}}
\def\@mod@fpnum@lt#1\@tlabel@fpnum#2\@tlabel@fpnum#3{%
	\ifdim#2pt<#3pt
		\gdef#1{\@tlabel@bool{t}}%
	\else
		\gdef#1{\@tlabel@bool{f}}%
	\fi
}