Debian Codegraph @

texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex

raw
1 % Copyright 2019 by Till Tantau
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Public License.
7 %
8 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9
10 \ProvidesFileRCS{pgfsysprotocol.code.tex}
11
12
13
14 % This package provides the pgf system protocol layer. Protocolling is
15 % used to record a bunch of graphic operations so that they can be
16 % reused quickly at a later point.
17 %
18 % Basically, all ``recordable'' \pgfsys@xxxx commands call
19 % \pgfsysprotocol@protocol for their protocolable literal
20 % specials. The literal text will either be stored in the current
21 % protocol. At a later point (actually, normally this happens
22 % immediately afterwards), the accumulated protocolled text is invoked
23 % using pgfsys@invokeprotocol.
24
25
26
27 \let\pgfsysprotocol@currentprotocol=\pgfutil@empty
28 \newif\ifpgfsysprotocol@buffered
29
30
31 % Add to the protocol buffered
32 \def\pgfsysprotocol@literalbuffered#1{%
33 \edef\pgfsysprotocol@temp{{#1\space}}%
34 \expandafter\pgfutil@g@addto@macro\expandafter\pgfsysprotocol@currentprotocol\pgfsysprotocol@temp%
35 }
36
37 % Add to the protocol
38 \def\pgfsysprotocol@literal#1{%
39 \pgfsysprotocol@literalbuffered{#1}%
40 \ifpgfsysprotocol@buffered%
41 \else%
42 \pgfsysprotocol@flushcurrentprotocol%
43 \fi%
44 }
45
46 % Getting and setting the current protocol
47 \def\pgfsysprotocol@getcurrentprotocol#1{%
48 \let#1=\pgfsysprotocol@currentprotocol%
49 }
50
51 \def\pgfsysprotocol@setcurrentprotocol#1{%
52 \global\let\pgfsysprotocol@currentprotocol=#1%
53 }
54
55
56 % Invoking the current protocol
57 \def\pgfsysprotocol@invokecurrentprotocol{%
58 \ifx\pgfsysprotocol@currentprotocol\pgfutil@empty%
59 \else%
60 \expandafter\pgfsys@invoke\expandafter{\pgfsysprotocol@currentprotocol}%
61 \fi%
62 }
63
64 \def\pgfsysprotocol@flushcurrentprotocol{%
65 \pgfsysprotocol@invokecurrentprotocol%
66 \pgfsysprotocol@setcurrentprotocol\pgfutil@empty%
67 }
68
69
70 \endinput