Debian Codegraph @

texmf-dist/tex/generic/pgfplots/libs/tikzlibrarypgfplots.external.code.tex

raw
1 %--------------------------------------------
2 %
3 % Package pgfplots, library for image externalization
4 %
5 % Copyright 2007/2008/2009 by Christian Feuersänger.
6 %
7 % This program is free software: you can redistribute it and/or modify
8 % it under the terms of the GNU General Public License as published by
9 % the Free Software Foundation, either version 3 of the License, or
10 % (at your option) any later version.
11 %
12 % This program is distributed in the hope that it will be useful,
13 % but WITHOUT ANY WARRANTY; without even the implied warranty of
14 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 % GNU General Public License for more details.
16 %
17 % You should have received a copy of the GNU General Public License
18 % along with this program. If not, see <http://www.gnu.org/licenses/>.
19 %
20 %--------------------------------------------
21
22 % This file is a wrapper which loads the external library.
23 %
24 % If we have a recent pgf version, use its external lib. If not: load
25 % the copy shipped with pgfplots.
26 %
27 % NOTE:
28 % the external library has been written by Christian Feuersänger as
29 % part of his work on pgfplots -- since it is general purpose, it is
30 % part of tikz. A copy comes with pgfplots.
31 %
32 %
33
34 % \pgfplots@glob@TMPa = 1 iff we can rely on the external lib shipped
35 % with tikz:
36 % -> see also below for a list of patches!
37 \pgfplotsiffileexists{tikzlibraryexternal.code.tex}{%
38 \pgfplots@ifneedspgfcompabitibilitycode@has@pgf@one@zero@zero{%
39 \def\pgfplots@glob@TMPa{0}%
40 }{%
41 \def\pgfplots@glob@TMPa{1}%
42 }%
43 }{%
44 \def\pgfplots@glob@TMPa{0}%
45 }%
46
47 \def\pgfplots@backw@compat@external@load{%
48 \immediate\write16{Package pgfplots external lib: loading complementary code for your PGF version...}
49 % Backwards compatibility:
50 \let\pgfplots@backw@compat@AtBeginDocument=\AtBeginDocument
51 \def\AtBeginDocument##1{}%
52 \input pgfplotsoldpgfsupp_pgfcoreexternal.code.tex
53 \input pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex
54 \let\AtBeginDocument=\pgfplots@backw@compat@AtBeginDocument
55 }%
56
57
58 \if1\pgfplots@glob@TMPa
59 \usetikzlibrary{external}%
60 %
61 % check for patches
62 \gdef\pgfplots@glob@TMPa{0}%
63 \pgfutil@ifundefined{c@tikzexternal@version}{%
64 \gdef\pgfplots@glob@TMPa{1}%
65 }{%
66 \gdef\pgfplots@glob@TMPa{0}%
67 }%
68 %
69 \if1\pgfplots@glob@TMPa
70 \pgfplots@backw@compat@external@load
71 \fi
72 \else
73 \pgfplots@backw@compat@external@load
74 \fi
75
76 % This here is a section for patches.
77 %
78 % A patch contains software pieces which add individual functionality.
79 %
80 % The content is copyright Christian Feuersaenger. I added it to both
81 % PGF and TikZ such that it can be distributed easily
82 \expandafter\ifx\csname pgfsys@prepare@papersize\endcsname\relax
83 \immediate\write16{Package pgfplots external lib: patching system driver code for your PGF version...}
84 % Patch drivers.... this is needed since recent revisions.
85 \def\pgfsys@prepare@papersize#1#2{\pgfsys@papersize{#1}{#2}}
86 \begingroup
87 \expandafter\def\csname pgfplots@backw@[email protected]\endcsname{%
88 \gdef\pgfsys@prepare@papersize##1##2{%
89 \expandafter\gdef\expandafter\pgfsys@atbegindocument\expandafter{\pgfsys@atbegindocument\special{papersize=##1,##2}}%
90 }
91 }%
92 \expandafter\def\csname pgfplots@backw@[email protected]\endcsname{%
93 \gdef\pgfsys@prepare@papersize##1##2{%
94 \expandafter\gdef\expandafter\pgfsys@atbegindocument%
95 \expandafter{\pgfsys@atbegindocument
96 \special{papersize=##1,##2}%
97 }
98 }
99 }%
100 \expandafter\def\csname pgfplots@backw@[email protected]\endcsname{%
101 \gdef\pgfsys@prepare@papersize##1##2{%
102 \expandafter\gdef\expandafter\pgfsys@atbegindocument%
103 \expandafter{\pgfsys@atbegindocument
104 \special{papersize=##1,##2}%
105 }
106 }
107 }%
108 \csname pgfplots@backw@ext@\pgfsysdriver\endcsname
109 \endgroup
110 \fi
111
112
113
114 \def\tikzexternal@externalizefig@systemcall@call@old#1{%
115 \iftikzexternal@verboseio
116 \immediate\write16{===== 'mode=convert with system call': Invoking '#1' ========}%
117 \fi
118 \immediate\write18{#1}%
119 }%
120
121 \def\tikzexternal@externalizefig@systemcall@call@new#1{%
122 \iftikzexternal@verboseio
123 \immediate\write16{===== 'mode=convert with system call': Invoking '#1' ========}%
124 \fi
125 \pgfutil@shellescape{#1}%
126 }%
127 \ifx\tikzexternal@externalizefig@systemcall@call\tikzexternal@externalizefig@systemcall@call@old
128 \let\tikzexternal@externalizefig@systemcall@call=\tikzexternal@externalizefig@systemcall@call@new
129 \fi
130
131 \endinput