summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xintlog.sty
blob: ddf209338a42a725223b1caf1851e04091f77750 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
%%
%% This is file `xintlog.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xint.dtx  (with options: `xintlog')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from xintlog.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file xint.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
%% The xint bundle 1.4b 2020/02/25
%% Copyright (C) 2013-2020 by Jean-Francois Burnol
%% xintlog: Logarithms and exponentials for xintexpr
%% ---------------------------------------------------------------
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5    % ^^M
  \endlinechar=13 %
  \catcode123=1   % {
  \catcode125=2   % }
  \catcode64=11   % @
  \catcode35=6    % #
  \catcode44=12   % ,
  \catcode45=12   % -
  \catcode46=12   % .
  \catcode58=12   % :
  \catcode94=7    % ^
  \def\z{\endgroup}%
  \def\empty{}\def\space{ }\newlinechar10
  \expandafter\let\expandafter\w\csname ver@xintexpr.sty\endcsname
  \expandafter\let\expandafter\x\csname ver@xintlog.sty\endcsname
  \expandafter
    \ifx\csname PackageInfo\endcsname\relax
      \def\y#1#2{\immediate\write-1{Package #1 Info:^^J%
                 \space\space\space\space#2.}}%
    \else
      \def\y#1#2{\PackageInfo{#1}{#2}}%
    \fi
  \expandafter
  \ifx\csname numexpr\endcsname\relax
     \y{xintlog}{\numexpr not available, aborting input}%
     \aftergroup\endinput
  \else
    \ifx\w\relax % xintexpr.sty not yet loaded.
        \y{xintlog}%
          {Loading should be via \ifx\x\empty\string\usepackage{xintexpr.sty}
                          \else\string\input\space xintexpr.sty \fi
           rather, aborting}%
        \aftergroup\endinput
    \else
      \ifx\x\relax % first loading (initiated from xintexpr.sty)
      \else
        \ifx\x\empty % LaTeX first loading, \ProvidesPackage not yet seen
        \else
          \y{xintlog}{Already loaded, aborting}%
          \aftergroup\endinput
        \fi
      \fi
    \fi
  \fi
\z%
\xintexprSafeCatcodes\catcode`_ 11
\XINT_providespackage
\ProvidesPackage{xintlog}%
[2020/02/25 v1.4b Logarithms and exponentials for xintexpr (JFB)]%
\ifdefined\RequirePackage
  \RequirePackage{poormanlog}%
\else
  \input poormanlog.tex
\fi
\xintexprRestoreCatcodes\csname XINT_setcatcodes\endcsname\catcode`\! 11
\expandafter\def\csname XINT_expr_func_log10\endcsname#1#2#3%
{%
    \expandafter #1\expandafter #2\expandafter{%
    \romannumeral`&&@\XINT:NEhook:f:one:from:one
    {\romannumeral`&&@\PoorManLogBaseTen#3}}%
}%
\expandafter\let\csname XINT_flexpr_func_log10\expandafter\endcsname
                \csname XINT_expr_func_log10\endcsname
\expandafter\def\csname XINT_expr_func_pow10\endcsname#1#2#3%
{%
    \expandafter #1\expandafter #2\expandafter{%
    \romannumeral`&&@\XINT:NEhook:f:one:from:one
    {\romannumeral`&&@\PoorManPowerOfTen#3}}%
}%
\expandafter\let\csname XINT_flexpr_func_pow10\expandafter\endcsname
                \csname XINT_expr_func_pow10\endcsname
\def\XINT_expr_func_log #1#2#3%
{%
    \expandafter #1\expandafter #2\expandafter{%
    \romannumeral`&&@\XINT:NEhook:f:one:from:one
    {\romannumeral`&&@\xintLog#3}}%
}%
\def\XINT_flexpr_func_log #1#2#3%
{%
    \expandafter #1\expandafter #2\expandafter{%
    \romannumeral`&&@\XINT:NEhook:f:one:from:one
    {\romannumeral`&&@\XINTinFloatLog#3}}%
}%
\def\XINT_expr_func_exp #1#2#3%
{%
    \expandafter #1\expandafter #2\expandafter{%
    \romannumeral`&&@\XINT:NEhook:f:one:from:one
    {\romannumeral`&&@\xintExp#3}}%
}%
\def\XINT_flexpr_func_exp #1#2#3%
{%
    \expandafter #1\expandafter #2\expandafter{%
    \romannumeral`&&@\XINT:NEhook:f:one:from:one
    {\romannumeral`&&@\XINTinFloatExp#3}}%
}%
\def\XINT_expr_func_pow #1#2#3%
{%
    \expandafter #1\expandafter #2\expandafter{%
    \romannumeral`&&@\XINT:NEhook:f:one:from:two
    {\romannumeral`&&@\PoorManPower#3}}%
}%
\let\XINT_flexpr_func_pow\XINT_expr_func_pow
\catcode`\* 11
\def\poormanloghack**
{%
 \def\XINT_tmpa ##1##2##3##4##5##6%
 {%
  \def ##3####1% \XINT_expr_op_<op>
  {%
    \expanded{\unexpanded{##4{####1}}\expandafter}%
    \romannumeral`&&@\expandafter##2\romannumeral`&&@\XINT_expr_getnext
  }%
  \def##2####1% \XINT_expr_check-_<op>
  {%
    \xint_UDsignfork
      ####1{\expandafter##2\romannumeral`&&@##1}%
        -{##5####1}%
    \krof
  }%
  \def##5####1####2% \XINT_expr_checkp_<op>
  {%
    \ifnum ####1>\XINT_expr_precedence_**
      \expandafter##5%
      \romannumeral`&&@\csname XINT_##6_op_####2\expandafter\endcsname
    \else
      \expandafter ####1\expandafter ####2%
    \fi
  }%
 }%
 \expandafter\XINT_tmpa
   \csname XINT_expr_op_-ix\expandafter\endcsname
   \csname XINT_expr_check-_**\endcsname
   \XINT_expr_op_**
   \XINT_expr_exec_**
   \XINT_expr_checkp_** {expr}%
 \expandafter\XINT_tmpa
   \csname XINT_flexpr_op_-ix\expandafter\endcsname
   \csname XINT_flexpr_check-_**\endcsname
   \XINT_flexpr_op_**
   \XINT_flexpr_exec_**
   \XINT_flexpr_checkp_** {flexpr}%
 \def\XINT_expr_exec_** ##1##2##3##4% \XINT_expr_exec_<op>
  {%
    \expandafter##2\expandafter##3\expandafter{%
    \romannumeral`&&@\XINT:NEhook:f:one:from:two
    {\romannumeral`&&@\PoorManPower##1##4}}%
  }%
  \let\XINT_flexpr_exec_**\XINT_expr_exec_**
}%
\def\poormanloghack^
{%
 \def\XINT_tmpa ##1##2##3##4##5##6%
 {%
  \def ##3####1% \XINT_expr_op_<op>
  {%
    \expanded{\unexpanded{##4{####1}}\expandafter}%
    \romannumeral`&&@\expandafter##2\romannumeral`&&@\XINT_expr_getnext
  }%
  \def##2####1% \XINT_expr_check-_<op>
  {%
    \xint_UDsignfork
      ####1{\expandafter##2\romannumeral`&&@##1}%
        -{##5####1}%
    \krof
  }%
  \def##5####1####2% \XINT_expr_checkp_<op>
  {%
    \ifnum ####1>\XINT_expr_precedence_^
      \expandafter##5%
      \romannumeral`&&@\csname XINT_##6_op_####2\expandafter\endcsname
    \else
      \expandafter ####1\expandafter ####2%
    \fi
  }%
 }%
 \expandafter\XINT_tmpa
   \csname XINT_expr_op_-ix\expandafter\endcsname
   \csname XINT_expr_check-_^\endcsname
   \XINT_expr_op_^
   \XINT_expr_exec_^
   \XINT_expr_checkp_^ {expr}%
 \expandafter\XINT_tmpa
   \csname XINT_flexpr_op_-ix\expandafter\endcsname
   \csname XINT_flexpr_check-_^\endcsname
   \XINT_flexpr_op_^
   \XINT_flexpr_exec_^
   \XINT_flexpr_checkp_^ {flexpr}%
 \def\XINT_expr_exec_^ ##1##2##3##4% \XINT_expr_exec_<op>
  {%
    \expandafter##2\expandafter##3\expandafter{%
    \romannumeral`&&@\XINT:NEhook:f:one:from:two
    {\romannumeral`&&@\PoorManPower##1##4}}%
  }%
  \let\XINT_flexpr_exec_^\XINT_expr_exec_^
}%
\def\poormanloghack#1{\csname poormanloghack#1\endcsname}%
\endinput
%%
%% End of file `xintlog.sty'.