summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex
blob: b34ae3bcdc78e0d8169f1199bdd499dc4368ed13 (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
% Copyright 2006 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.

\ProvidesFileRCS $Header: /cvsroot/pgf/pgf/generic/pgf/systemlayer/pgfsysprotocol.code.tex,v 1.4 2006/10/16 22:32:59 tantau Exp $



% This package provides the pgf system protcol layer. Protocolling is
% used to record a bunch of graphic operations so that they can be
% reused quickly at a later point.
%
% Basically, all ``recordable'' \pgfsys@xxxx commands call
% \pgfsysprotocol@protocol for their protocolable literal
% specials. The literal text will either be stored in the current
% protocol. At a later point (actually, normally this happens
% immediately afterwards), the accumulated protocolled text is invoked
% using pgfsys@invokeprotocol.



\let\pgfsysprotocol@currentprotocol=\pgfutil@empty
\newif\ifpgfsysprotocol@buffered


% Add to the protocol buffered
\def\pgfsysprotocol@literalbuffered#1{%
  \edef\pgfsysprotocol@temp{{#1\space}}%
  \expandafter\pgfutil@g@addto@macro\expandafter\pgfsysprotocol@currentprotocol\pgfsysprotocol@temp%
}

% Add to the protocol
\def\pgfsysprotocol@literal#1{%
  \pgfsysprotocol@literalbuffered{#1}%
  \ifpgfsysprotocol@buffered%
  \else%
    \pgfsysprotocol@flushcurrentprotocol%
  \fi%
}

% Getting and setting the current protocol
\def\pgfsysprotocol@getcurrentprotocol#1{%
  \let#1=\pgfsysprotocol@currentprotocol%
}

\def\pgfsysprotocol@setcurrentprotocol#1{%
  \global\let\pgfsysprotocol@currentprotocol=#1%
}


% Invoking the current protocol
\def\pgfsysprotocol@invokecurrentprotocol{%
  \ifx\pgfsysprotocol@currentprotocol\pgfutil@empty%
  \else%
    \expandafter\pgfsys@invoke\expandafter{\pgfsysprotocol@currentprotocol}%
  \fi%
}

\def\pgfsysprotocol@flushcurrentprotocol{%
  \pgfsysprotocol@invokecurrentprotocol%
  \pgfsysprotocol@setcurrentprotocol\pgfutil@empty%
}


\endinput