| 1 |
|
| 2 |
%\input pgfplotsoldpgfsupp_pgfmathparse.opt.code.tex |
| 3 |
%\beginpgfmathparsecheckfornumber |
| 4 |
|
| 5 |
\pgfutil@ifundefined{pgfmathlessthan@}{% |
| 6 |
\let\pgfmathlessthan@=\pgfmathless@ |
| 7 |
\let\pgfmathgreaterthan@=\pgfmathgreater@ |
| 8 |
}{}% |
| 9 |
|
| 10 |
|
| 11 |
\def\pgfplotsusecompatibilityfile#1{% |
| 12 |
\pgfutil@IfUndefined{pgfplotsusecompatibilityfile@loaded@#1}{% |
| 13 |
\expandafter\gdef\csname pgfplotsusecompatibilityfile@loaded@#1\endcsname{1}% |
| 14 |
\input pgfplotsoldpgfsupp_#1 |
| 15 |
}{% |
| 16 |
% already loaded. |
| 17 |
}% |
| 18 |
}% |
| 19 |
|
| 20 |
|
| 21 |
\def\pgfmathfloatrounddisplaystyle@shared@impl@WRONG#1#2{% |
| 22 |
{\toks0={#1}% |
| 23 |
\toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}% |
| 24 |
\xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% |
| 25 |
}% |
| 26 |
\let\pgfmathresult=\pgfmathfloat@glob@TMP |
| 27 |
}% |
| 28 |
|
| 29 |
% check whether we need to load supplementary code. |
| 30 |
% The development of pgfplots and pgf is intermingled, so pgfplots |
| 31 |
% always uses up-to-date pgf CVS versions - the relevant complements between |
| 32 |
% PGF 2.10 and PGF CVS are loaded here: |
| 33 |
% |
| 34 |
% #1: for backwards compatibility |
| 35 |
% #2: for normal processing. |
| 36 |
\def\pgfplots@ifneedspgfcompabitibilitycode@has@pgf@one@zero@zero#1#2{% |
| 37 |
%\pgfkeysifdefined{/pgf/number format/sci precision/.@cmd}{#2}{#1}% |
| 38 |
\pgfutil@ifundefined{pgfmathprintnumber@RELATIVE@choice@roundtofixed}{#1}{#2}% |
| 39 |
}% |
| 40 |
|
| 41 |
\let\pgfplots@ifneedspgfcompabitibilitycode=\pgfplots@ifneedspgfcompabitibilitycode@has@pgf@one@zero@zero |
| 42 |
|
| 43 |
\pgfplots@ifneedspgfcompabitibilitycode |
| 44 |
{% |
| 45 |
\immediate\write16{Package pgfplots: loading complementary code for your PGF version...} |
| 46 |
\input pgfplotsoldpgfsupp_misc.code.tex |
| 47 |
\let\pgfkeysloaded=\undefined |
| 48 |
\input pgfplotsoldpgfsupp_pgfkeys.code.tex |
| 49 |
\input pgfplotsoldpgfsupp_pgfmathfloat.code.tex |
| 50 |
\input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex |
| 51 |
\input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex |
| 52 |
\input pgfplotsoldpgfsupp_pgfcorescopes.code.tex |
| 53 |
\input pgfplotsoldpgfsupp_pgfcorelayers.code.tex |
| 54 |
}% |
| 55 |
{% |
| 56 |
\pgfplots@iffileexists{pgflibraryfpu.code.tex}{% |
| 57 |
\usepgflibrary{fpu}% |
| 58 |
}{% |
| 59 |
\immediate\write16{Package pgfplots: loading FPU library which doesn't appear to exist in your PGF version...} |
| 60 |
\input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex |
| 61 |
}% |
| 62 |
}% |
| 63 |
|
| 64 |
\gdef\pgfplots@glob@TMPa{0}% |
| 65 |
|
| 66 |
\def\pgfmathfloatfloor@broken#1{% |
| 67 |
\edef\pgfmathfloat@loc@TMPa{#1}% |
| 68 |
\pgfmathfloatcreate{2}{5.0}{-1}% -0.5 |
| 69 |
\let\pgfmathfloat@loc@TMPb=\pgfmathresult |
| 70 |
\pgfmathfloatadd@{\pgfmathfloat@loc@TMPa}{\pgfmathfloat@loc@TMPb}% |
| 71 |
\expandafter\pgfmathfloatround@\expandafter{\pgfmathresult}% |
| 72 |
} |
| 73 |
\ifx\pgfmathfloatfloor\pgfmathfloatfloor@broken |
| 74 |
\gdef\pgfplots@glob@TMPa{1}% |
| 75 |
\fi |
| 76 |
|
| 77 |
\def\pgfmathfloor@broken#1{% |
| 78 |
\begingroup% |
| 79 |
\expandafter\pgfmath@x#1pt\relax% |
| 80 |
\afterassignment\pgfmath@gobbletilpgfmath@% |
| 81 |
\expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@% |
| 82 |
\expandafter\pgfmath@x#1pt\relax% |
| 83 |
\ifdim\pgfmath@x<0pt\relax% |
| 84 |
\advance\c@pgfmath@counta by -1\relax% |
| 85 |
\fi% |
| 86 |
\pgfmath@x\c@pgfmath@counta pt\relax% |
| 87 |
\pgfmath@returnone\pgfmath@x% |
| 88 |
\endgroup% |
| 89 |
}% |
| 90 |
\ifx\pgfmathfloor@\pgfmathfloor@broken |
| 91 |
\def\pgfmathfloor@#1{% |
| 92 |
\begingroup% |
| 93 |
\expandafter\pgfmath@x#1pt\relax% |
| 94 |
\afterassignment\pgfmathfloor@collect@remainder% |
| 95 |
\expandafter\c@pgfmath@counta\the\pgfmath@x\pgfmath@% |
| 96 |
\expandafter\pgfmath@x#1pt\relax% |
| 97 |
\ifdim\pgfmath@x<0pt\relax% |
| 98 |
\ifdim\pgfmathfloor@remainder>0pt |
| 99 |
\advance\c@pgfmath@counta by -1\relax% |
| 100 |
\else |
| 101 |
% ok, we stripped only '0'. |
| 102 |
\fi |
| 103 |
\fi% |
| 104 |
\pgfmath@x\c@pgfmath@counta pt\relax% |
| 105 |
\pgfmath@returnone\pgfmath@x% |
| 106 |
\endgroup% |
| 107 |
}% |
| 108 |
\def\pgfmathfloor@collect@remainder#1\pgfmath@{% |
| 109 |
\def\pgfmathfloor@remainder{#1}% |
| 110 |
\ifx\pgfmathfloor@remainder\pgfutil@empty |
| 111 |
\def\pgfmathfloor@remainder{0}% |
| 112 |
\fi |
| 113 |
}% |
| 114 |
\fi |
| 115 |
|
| 116 |
\pgfutil@IfUndefined{pgfmathifexpression}{% |
| 117 |
\def\pgfmathifexpression#1#2#3{% |
| 118 |
\pgfmathparse{#1}% |
| 119 |
\pgfmath@iftrue{#2}{#3}% |
| 120 |
} |
| 121 |
\def\pgfmath@iftrue{% |
| 122 |
\ifdim\pgfmathresult pt=1.0pt % |
| 123 |
\let\pgfmath@next=\pgfutil@firstoftwo |
| 124 |
\else |
| 125 |
\let\pgfmath@next=\pgfutil@secondoftwo |
| 126 |
\fi |
| 127 |
\pgfmath@next |
| 128 |
}% |
| 129 |
\gdef\pgfplots@glob@TMPa{1}% |
| 130 |
}{}% |
| 131 |
|
| 132 |
\pgfutil@ifundefined{pgfmathfloat@iftrue@}{ |
| 133 |
\gdef\pgfplots@glob@TMPa{1}% |
| 134 |
} |
| 135 |
{}% |
| 136 |
|
| 137 |
\if1\pgfplots@glob@TMPa |
| 138 |
\immediate\write16{Package pgfplots: loading complementary arithmetics for your pgf version...} |
| 139 |
\input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex |
| 140 |
\input pgfplotsoldpgfsupp_pgfmathfloat.code.tex |
| 141 |
\fi |
| 142 |
|
| 143 |
\pgfutil@IfUndefined{pgfmathdeclarefunction}{ |
| 144 |
\pgfplots@warning{Parts of pgfplots require PGF 2.10; you have PGF 2.00 . Consider upgrading if you experience problems.}% |
| 145 |
}{% |
| 146 |
}% |
| 147 |
|
| 148 |
\pgfutil@IfUndefined{pgfutilifcontainsmacro}{% |
| 149 |
\gdef\pgfplots@glob@TMPa{1}% |
| 150 |
}{% |
| 151 |
\gdef\pgfplots@glob@TMPa{0}% |
| 152 |
}% |
| 153 |
\if1\pgfplots@glob@TMPa |
| 154 |
\begingroup |
| 155 |
\catcode`\|=0 |
| 156 |
\catcode`\\=12 |
| 157 |
|gdef|pgfutil@backslash@as@other{\}% |
| 158 |
|endgroup |
| 159 |
\def\pgfutil@command@to@string#1#2{% |
| 160 |
\expandafter\pgfutil@command@to@string@@\meaning#1\pgfutil@EOI{#2}% |
| 161 |
}% |
| 162 |
\xdef\pgfutil@glob@TMPa{\meaning\pgfutil@empty}% |
| 163 |
\expandafter\def\expandafter\pgfutil@command@to@string@@\pgfutil@glob@TMPa#1\pgfutil@EOI#2{% |
| 164 |
\def#2{#1}% |
| 165 |
}% |
| 166 |
\def\pgfutilifcontainsmacro#1#2#3{% |
| 167 |
\def\pgf@marshal{#1}% |
| 168 |
\pgfutil@command@to@string\pgf@marshal\pgf@marshal |
| 169 |
\edef\pgf@marshal{\noexpand\pgfutil@in@{\pgfutil@backslash@as@other}{\pgf@marshal}}% |
| 170 |
\pgf@marshal |
| 171 |
\ifpgfutil@in@ |
| 172 |
\def\pgf@marshal{#2}% |
| 173 |
\else |
| 174 |
\def\pgf@marshal{#3}% |
| 175 |
\fi |
| 176 |
\pgf@marshal |
| 177 |
}% |
| 178 |
\fi |
| 179 |
|
| 180 |
\pgfutil@IfUndefined{t@pgf@toka}{% |
| 181 |
\csname newtoks\endcsname\t@pgf@toka |
| 182 |
\csname newtoks\endcsname\t@pgf@tokb |
| 183 |
\csname newtoks\endcsname\t@pgf@tokc |
| 184 |
\gdef\pgfutil@advancestringcounter{\pgfplotsutil@advancestringcounter}% |
| 185 |
}{}% |
| 186 |
|
| 187 |
\pgfutil@IfUndefined{pgfapplistnewempty}{% |
| 188 |
\input pgfplotsoldpgfsupp_pgfutil-common-lists.tex |
| 189 |
}{}% |
| 190 |
|
| 191 |
\pgfutil@IfUndefined{pgfmathiftrigonometricusesdeg}{% |
| 192 |
\pgfutil@ifundefined{pgfmathdeclarefunction}{% |
| 193 |
% PGF 2.00 !? Well, trig format won't work here. |
| 194 |
}{% |
| 195 |
\input pgfplotsoldpgfsupp_trig_format.code.tex |
| 196 |
}% |
| 197 |
}{}% |
| 198 |
|
| 199 |
\def\pgfmathfloat@install@unimplemented@broken#1{% |
| 200 |
\expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath@#1@\endcsname% |
| 201 |
\expandafter\def\csname pgfmath#1@\endcsname##1{\pgfmathfloat@notimplemented{#1}}% |
| 202 |
} |
| 203 |
|
| 204 |
\ifx\pgfmathfloat@install@unimplemented\pgfmathfloat@install@unimplemented@broken |
| 205 |
\def\pgfmathfloat@install@unimplemented#1{% |
| 206 |
\expandafter\pgfmathfloat@prepareuninstallcmd\csname pgfmath#1@\endcsname% |
| 207 |
\expandafter\def\csname pgfmath#1@\endcsname##1{\pgfmathfloat@notimplemented{#1}}% |
| 208 |
}% |
| 209 |
\fi |
| 210 |
|
| 211 |
|
| 212 |
\ifpgfplots@LUA@supported |
| 213 |
\def\PATCH@pgfmath@local@function@body#1;{% |
| 214 |
\def\pgfmath@local@body{#1}% |
| 215 |
\begingroup% |
| 216 |
\c@pgf@counta=0\relax% |
| 217 |
\ifx\pgfmath@local@args\pgfmath@empty% |
| 218 |
\expandafter\pgfmath@toks\expandafter=\expandafter{\pgfmath@local@body}% |
| 219 |
\else% |
| 220 |
\pgfmath@toks={}% |
| 221 |
\expandafter\pgfmath@local@function@@body\pgfmath@local@args,,% |
| 222 |
\fi% |
| 223 |
\xdef\pgfmath@local@temp{% |
| 224 |
\noexpand\pgfmathnotifynewdeclarefunction{\pgfmath@local@name}{\the\c@pgf@counta}% |
| 225 |
{\the\pgfmath@toks}% |
| 226 |
}% |
| 227 |
\endgroup% |
| 228 |
\pgfmath@local@temp% |
| 229 |
} |
| 230 |
% #1: the name |
| 231 |
% #2: the number of arguments <n> |
| 232 |
% #3: a math expression containing '#1', '#2', ... ,'#'<n> |
| 233 |
% This callback is overwritten by pgflibraryluamath. |
| 234 |
\def\PATCH@pgfmathnotifynewdeclarefunction#1#2#3{% |
| 235 |
\pgfmathdeclarefunction{#1}{#2}{\pgfmathparse{#3}}% |
| 236 |
}% |
| 237 |
% |
| 238 |
% currently, pgfplots does NOT call directly call any TeX macros |
| 239 |
% from this library - but it relies on the fact that "trig |
| 240 |
% format", \pgfmathsetseed and other configuration macros also |
| 241 |
% mirror their values in LUA. |
| 242 |
% And this mirroring is done in library luamath: |
| 243 |
\def\pgfplots@glob@TMPa{3.0.0}% |
| 244 |
\ifx\pgfversion\pgfplots@glob@TMPa |
| 245 |
% 3.0.0 does not have the (correct) luamath library. |
| 246 |
\let\pgfmathnotifynewdeclarefunction=\PATCH@pgfmathnotifynewdeclarefunction |
| 247 |
\let\pgfmath@local@function@body=\PATCH@pgfmath@local@function@body |
| 248 |
\pgfplotsusecompatibilityfile{pgflibraryluamath.code.tex} |
| 249 |
\else |
| 250 |
\let\PATCH@pgfmathnotifynewdeclarefunction@orig=\pgfmathnotifynewdeclarefunction |
| 251 |
\let\PATCH@pgfmathsetseed@pgfbasic = \pgfmathsetseed |
| 252 |
\pgfutil@IfFileExists{pgflibraryluamath.code.tex}{% |
| 253 |
% ah - we have a very recent version of PGF. |
| 254 |
% Well, it will hopefully come with a suitable version of the |
| 255 |
% luamath library! Use it. |
| 256 |
\usepgflibrary{luamath}% |
| 257 |
}{% |
| 258 |
% hm. PGF 2.10 ? |
| 259 |
% |
| 260 |
% FIXME |
| 261 |
%\pgfplots@LUA@supportedfalse |
| 262 |
}% |
| 263 |
% |
| 264 |
\gdef\pgfplots@glob@TMPa{1}% "is up to date = 1" |
| 265 |
\def\pgfplots@glob@TMPa{3.0.1}% |
| 266 |
\ifx\pgfversion\pgfplots@glob@TMPa |
| 267 |
\gdef\pgfplots@glob@TMPa{0}% "is up to date = 0" |
| 268 |
\else |
| 269 |
\def\pgfplots@glob@TMPa{3.0.1a}% |
| 270 |
\ifx\pgfversion\pgfplots@glob@TMPa |
| 271 |
\gdef\pgfplots@glob@TMPa{0}% "is up to date = 0" |
| 272 |
\fi |
| 273 |
\fi |
| 274 |
\if0\pgfplots@glob@TMPa |
| 275 |
% 3.0.1 does not have the (correct) luamath library. |
| 276 |
\pgfutil@directlua{% |
| 277 |
package.loaded["pgf.luamath.functions"]=nil; |
| 278 |
package.loaded["pgf.luamath.parser"]=nil; |
| 279 |
pgfluamathfunctions = nil; |
| 280 |
pgfluamathparser = nil} |
| 281 |
\pgfplotsusecompatibilityfile{pgflibraryluamath.code.tex} |
| 282 |
% ATTENTION: see 'pgfplots.lua' which ALSO loads these items |
| 283 |
% FIXME : some .lua files reference outdated |
| 284 |
% tonumber/tostring functions! |
| 285 |
\pgfutil@directlua{% |
| 286 |
pgfplots.pgfluamathfunctions = pgfluamathfunctions; |
| 287 |
pgfplots.pgfluamathparser = pgfluamathparser}% |
| 288 |
\let\pgfmathnotifynewdeclarefunction@orig=\PATCH@pgfmathnotifynewdeclarefunction@orig |
| 289 |
\let\pgfmathsetseed@pgfbasic=\PATCH@pgfmathsetseed@pgfbasic |
| 290 |
\pgfplots@log4{luamath library shipped with pgf \pgfversion\space is outdated; using a substitute shipped with pgfplots}% |
| 291 |
\else |
| 292 |
\pgfplots@log4{luamath library shipped with pgf \pgfversion\space is up-to-date}% |
| 293 |
\fi |
| 294 |
\fi |
| 295 |
\fi |
| 296 |
|
| 297 |
\def\pgf@plotgnuplot@luatex@eight@seven[#1]#2{% |
| 298 |
\pgf@resample@plottrue% |
| 299 |
\pgfutilpreparefilename{#1.gnuplot}% |
| 300 |
\let\pgf@plotgnuplotfile=\pgfretval |
| 301 |
\pgfutilpreparefilename{#1.table}% |
| 302 |
\let\pgf@plottablefile=\pgfretval |
| 303 |
\let\pgf@plottablefile@quoted=\pgfretvalquoted |
| 304 |
% Check, whether it is up-to-date |
| 305 |
\openin\pgfutil@inputcheck=\pgf@plotgnuplotfile\relax |
| 306 |
\ifeof\pgfutil@inputcheck% |
| 307 |
\else% |
| 308 |
\pgfutil@read\pgfutil@inputcheck to\pgf@temp% ignored |
| 309 |
\pgfutil@read\pgfutil@inputcheck to\pgf@plot@line% |
| 310 |
\closein\pgfutil@inputcheck |
| 311 |
\edef\pgf@plot@code{#2\space}% |
| 312 |
\ifx\pgf@plot@code\pgf@plot@line% |
| 313 |
\openin\pgfutil@inputcheck=\pgfretval\relax |
| 314 |
\ifeof\pgfutil@inputcheck% |
| 315 |
\else% |
| 316 |
\closein\pgfutil@inputcheck |
| 317 |
\pgf@resample@plotfalse% |
| 318 |
\fi% |
| 319 |
\fi% |
| 320 |
\fi |
| 321 |
\ifpgf@resample@plot% |
| 322 |
\immediate\openout\pgf@plotwrite=\pgf@plotgnuplotfile\relax |
| 323 |
\immediate\pgfutil@write\pgf@plotwrite{\pgf@gnuplot@head}% |
| 324 |
\immediate\pgfutil@write\pgf@plotwrite{#2}% |
| 325 |
\immediate\closeout\pgf@plotwrite% |
| 326 |
\pgfutil@shellescape{% |
| 327 |
\pgfkeysvalueof{/pgf/plot/gnuplot call} \pgf@plotgnuplotfile}% |
| 328 |
\fi% |
| 329 |
% \let\pgf@savedparsexyline=\pgf@parsexyline% |
| 330 |
% \let\pgf@parsexyline=\pgf@parsegnuplotxyline% |
| 331 |
\pgfplotxyfile{\pgf@plottablefile}% |
| 332 |
% \let\pgf@parsexyline=\pgf@savedparsexyline% |
| 333 |
} |
| 334 |
|
| 335 |
\pgfutil@IfUndefined{pgfutil@shellescape}{% |
| 336 |
\def\pgfutil@shellescape{\pgfplots@shellescape}% |
| 337 |
\let\pgf@plotgnuplot=\pgf@plotgnuplot@luatex@eight@seven |
| 338 |
}{% |
| 339 |
% ok, plot function is up-to-date |
| 340 |
}% |
| 341 |
|
| 342 |
\def\pgfmathfloatmod@broken#1#2{% |
| 343 |
\begingroup |
| 344 |
\pgfmathfloatdivide@{#1}{#2}% |
| 345 |
\pgfmathfloatint@{\pgfmathresult}% |
| 346 |
\let\pgfmathfloat@loc@TMPa=\pgfmathresult |
| 347 |
\pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% |
| 348 |
\let\pgfmathfloat@loc@TMPb=\pgfmathresult |
| 349 |
\pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% |
| 350 |
\pgfmath@smuggleone\pgfmathresult |
| 351 |
\endgroup |
| 352 |
} |
| 353 |
|
| 354 |
\ifx\pgfmathfloatmod@\pgfmathfloatmod@broken |
| 355 |
\def\pgfmathfloatmod@#1#2{% |
| 356 |
\begingroup |
| 357 |
\pgfmathfloattoint{#1}% |
| 358 |
\let\pgfmathfloat@loc@TMPa=\pgfmathresult |
| 359 |
\pgfmathfloattoint{#2}% |
| 360 |
\let\pgfmathfloat@loc@TMPb=\pgfmathresult |
| 361 |
\c@pgfmath@counta=\pgfmathfloat@loc@TMPa\relax |
| 362 |
\divide\c@pgfmath@counta by\pgfmathfloat@loc@TMPb\relax |
| 363 |
\expandafter\pgfmathfloatparsenumber\expandafter{\the\c@pgfmath@counta}% |
| 364 |
% |
| 365 |
\let\pgfmathfloat@loc@TMPa=\pgfmathresult |
| 366 |
\pgfmathfloatmultiply@{\pgfmathfloat@loc@TMPa}{#2}% |
| 367 |
\let\pgfmathfloat@loc@TMPb=\pgfmathresult |
| 368 |
\pgfmathfloatsubtract@{#1}{\pgfmathfloat@loc@TMPb}% |
| 369 |
\pgfmath@smuggleone\pgfmathresult |
| 370 |
\endgroup |
| 371 |
} |
| 372 |
\fi |
| 373 |
|
| 374 |
\pgfutil@IfUndefined{pgfutilsolvetwotwoleqfloat}{% |
| 375 |
\input pgfplotsoldpgfsupp_leq.code.tex |
| 376 |
}{}% |
| 377 |
|
| 378 |
\pgfutil@IfUndefined{pgfutilifstartswith}{% |
| 379 |
\let\pgfutilifstartswith=\pgfplotsutilifstartswith |
| 380 |
}{} |
| 381 |
|
| 382 |
\endinput |