From 90ae413a94da014dbf7a6a8ab584f7c668483a5a Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Thu, 27 Feb 2014 00:01:50 +0000
Subject: pgf 3.0.0

git-svn-id: svn://tug.org/texlive/trunk@33057 c570f23f-e606-0410-a88d-b1316a301751
---
 .../libraries/tikzlibraryintersections.code.tex    | 53 ++++++++++------------
 1 file changed, 24 insertions(+), 29 deletions(-)

(limited to 'Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex')

diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex
index dd842033fc8..e35633fc20d 100644
--- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex
@@ -9,23 +9,30 @@
 
 \usepgflibrary{intersections}
 
-\let\tikz@intersect@def=\def
-
 \pgfkeys{%
   /tikz/name path global/.code={%
-    % it might have been more efficient to eliminate the storage macro
-	% \tikz@intersect@namedpaths. But I keep it maintain compatibility
-	% with mixed occurances of local/global names.
-    \let\tikz@intersect@def=\gdef
-    \pgfkeys{/tikz/name path={#1}}%
+  	% reset any "old" variables inheritted from some other path 
+	% - we do not accidentally want to append to an old path with the
+	% same name (or if someone provided the option twice)...
+	\expandafter\global\expandafter\let\csname tikz@intersect@path@name@#1\endcsname=\relax
+  	\tikz@key@name@path{#1}{\gdef}%
   },
   /tikz/name path local/.code={%
-    \let\tikz@intersect@def=\def
     \pgfkeys{/tikz/name path={#1}}%
   },
   /tikz/name path/.code={%
+	% hm. Do we need this "reset old option" as in 'name path global'
+	% for this case as well?
+  	\tikz@key@name@path{#1}{\def}%
+  },
+}
+
+% #1: the name to assign.
+% #2: one of '\def' or '\gdef'.
+\def\tikz@key@name@path#1#2{%
     \tikz@addmode{%
-      \pgfsyssoftpath@getcurrentpath\tikz@intersect@temppath%
+      \pgfsyssoftpath@getcurrentpath\tikz@intersect@temppath@round%
+      \pgfprocessround\tikz@intersect@temppath@round\tikz@intersect@temppath%
       \ifx\tikz@intersect@namedpaths\pgfutil@empty%
       \else%
         \tikz@intersect@namedpaths%
@@ -37,28 +44,16 @@
           \expandafter\expandafter\expandafter{\expandafter\tikz@intersect@temppath\tikz@intersect@temppath}%
         }%
       \fi%
-      \tikz@intersect@addto@path@names{#1}%
+      \tikz@intersect@addto@path@names{#1}{#2}%
     }%
-  }
-}
+}%
 
-\def\tikz@intersect@addto@path@names#1{%
-  % FIXME : I have the impression that something is not correct
-  % here... the \tikz@intersect@def is not used correctly! 
-  % if I am not mistaken, the \tikz@intersect@def will NOT be
-  % invoked until \tikz@intersect@namedpaths. CHECK IT
-  % It seems it works, but only partially.
-  \def\tikz@marshal{\expandafter\tikz@intersect@def\csname tikz@intersect@path@name@#1\endcsname}%
+% #1: the name to assign.
+% #2: one of '\def' or '\gdef'.
+\def\tikz@intersect@addto@path@names#1#2{%
+  \edef\tikz@marshal{#2\expandafter\noexpand\csname tikz@intersect@path@name@#1\endcsname}%
   \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\tikz@marshal%
     \expandafter\expandafter\expandafter{\expandafter\tikz@marshal\expandafter{\tikz@intersect@temppath}}%
-  \ifx\tikz@intersect@def\gdef
-  	% This here is to *ensure* that the \gdef is invoked. 
-	%
-	% I think this solves the problem.
-	%
-	% Please revise this routine such that it works better.
-  	\tikz@marshal
-  \fi
   \expandafter\pgfutil@g@addto@macro\expandafter\tikz@intersect@namedpaths\expandafter{\tikz@marshal}%
 }
 
@@ -89,9 +84,9 @@
       by=,
       #1}%
     \pgfutil@ifundefined{tikz@intersect@path@name@\tikz@intersect@path@a}{%
-      \PackageError{tikz}{I do not know the path named `\tikz@intersect@path@a'. Perhaps you misspelt it}{}}%
+      \tikzerror{I do not know the path named `\tikz@intersect@path@a'. Perhaps you misspelt it}}%
     {\pgfutil@ifundefined{tikz@intersect@path@name@\tikz@intersect@path@b}{%
-        \PackageError{tikz}{I do not know the path named `\tikz@intersect@path@b'. Perhaps you misspelt it}{}}%
+        \tikzerror{I do not know the path named `\tikz@intersect@path@b'. Perhaps you misspelt it}}%
       {%
         \pgfintersectionofpaths%
         {%
-- 
cgit v1.2.3

