diff options
author | Karl Berry <karl@freefriends.org> | 2016-01-08 00:02:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-01-08 00:02:17 +0000 |
commit | 4e668f51370a93cc9dc26b1a11a949b50493b353 (patch) | |
tree | 85ab6891036f9a348e68f83e31c56b069332a9ca /Master/texmf-dist/tex/generic/pgfplots/numtable | |
parent | f2995718d3db02b5ff46d4552b9281b9761327ae (diff) |
pgfplots (7jan16)
git-svn-id: svn://tug.org/texlive/trunk@39303 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgfplots/numtable')
-rw-r--r-- | Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex | 111 |
1 files changed, 99 insertions, 12 deletions
diff --git a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex index 8d470b6c6f5..be1ce3ec05c 100644 --- a/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex +++ b/Master/texmf-dist/tex/generic/pgfplots/numtable/pgfplotstableshared.code.tex @@ -62,6 +62,7 @@ \newif\ifpgfplots@tableread@to@listener \newif\ifpgfplots@tableread@use@begingroup \newif\ifpgfplotstable@trimcells +\newif\ifpgfplotstable@search@path@implicit@CWD \pgfkeys{% /pgfplots/table/every table/.style={}, @@ -73,6 +74,9 @@ /pgfplots/table/header/false/.code={\pgfplotstable@firstline@is@headerfalse\pgfplotstable@search@headerfalse}, /pgfplots/table/header/has colnames/.code={\pgfplotstable@firstline@is@headertrue\pgfplotstable@search@headerfalse}, /pgfplots/table/header=true, + /pgfplots/table/search path/.initial=., + /pgfplots/table/search path/implicit ./.is if=pgfplotstable@search@path@implicit@CWD, + /pgfplots/table/search path/implicit .=true, /pgfplots/table/x index/.initial=0, /pgfplots/table/x/.initial=, /pgfplots/table/x expr/.initial=, @@ -916,6 +920,98 @@ {\catcode`\"=12 \gdef\pgfplots@dquote{"}} +% gets the search path (after applying some basic sanity checks) +\def\pgfplotstable@get@search@path{% + \pgfkeysgetvalue{/pgfplots/table/search path}\pgfplotsretval + \ifx\pgfplotsretval\pgfutil@empty + \def\pgfplotsretval{.}% + \pgfkeyslet{/pgfplots/table/search path}\pgfplotsretval + \fi + % + \ifpgfplotstable@search@path@implicit@CWD + \def\b@pgfplotstable@search@contains@cwd{0}% + \def\pgfplotstable@loc@TMPd{.}% + \def\pgfplotstable@loc@TMPc{./}% + \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplotsretval}\as\pgfplotstable@loc@TMPa{% + \ifx\pgfplotstable@loc@TMPa\pgfplotstable@loc@TMPd + \def\b@pgfplotstable@search@contains@cwd{1}% + \fi + \ifx\pgfplotstable@loc@TMPa\pgfplotstable@loc@TMPc + \def\b@pgfplotstable@search@contains@cwd{1}% + \fi + }% + % + \if0\b@pgfplotstable@search@contains@cwd + \t@pgfplotstable@a=\expandafter{\pgfplotsretval}% + \edef\pgfplotsretval{.,\the\t@pgfplotstable@a}% + \pgfkeyslet{/pgfplots/table/search path}\pgfplotsretval + \fi + \fi +} + +\def\pgfplotstable@search@path@add@slash#1{% + \def\pgfplotsretval{#1/}% + \def\pgfplotstable@loc@TMPd{./}% + \def\pgfplotstable@loc@TMPc{.//}% + \ifx\pgfplotsretval\pgfplotstable@loc@TMPd + % Ah -- we have #1='.' Do NOT use a slash at all in order to + % not disable the processing of TEXINPUTS (if pdftex finds ./ + % , it will NOT evaluated TEXINPUTS as it seems) + \let\pgfplotsretval=\pgfutil@empty + \fi + \ifx\pgfplotsretval\pgfplotstable@loc@TMPc + \let\pgfplotsretval=\pgfutil@empty + \fi +}% + +% +% POSTCONDITION: +% - \r@pgfplots@reada is the opened result file (or eof if there is no +% such file). +% - \pgfplotstableread@filename is the first found file path. +\def\pgfplotstable@search@and@open@file{% + \pgfplotstable@get@search@path + % + \let\pgfplotstableread@filename@name=\pgfplotstableread@filename + % + \def\b@pgfplotstable@search@done{0}% + \expandafter\pgfplotsutilforeachcommasep\expandafter{\pgfplotsretval}\as\pgfplotstable@loc@TMPa{% + \ifx\pgfplotstable@loc@TMPa\pgfutil@empty + % silently skip empty entries in the list. + \else + \if0\b@pgfplotstable@search@done + % + \expandafter\pgfplotstable@search@path@add@slash\expandafter{\pgfplotstable@loc@TMPa}% + % + \t@pgfplotstable@a=\expandafter{\pgfplotsretval}% + \t@pgfplots@tokc=\expandafter{\pgfplotstableread@filename@name}% + \edef\pgfplotstableread@filename{\the\t@pgfplotstable@a\the\t@pgfplots@tokc}% + % + \openin\r@pgfplots@reada=\pgfplotstableread@filename.tex + \ifeof\r@pgfplots@reada + \openin\r@pgfplots@reada=\pgfplotstableread@filename\relax + \else + \pgfplots@warning{% + You requested to open table '\pgfplotstableread@filename', but there is also a '\pgfplotstableread@filename.tex'. + TeX will automatically append the suffix '.tex', so I will now open '\pgfplotstableread@filename.tex'. + Please make sure you don't accidentally load TeX files - this may produce unrecoverable errors.}% + \closein\r@pgfplots@reada + \openin\r@pgfplots@reada=\pgfplotstableread@filename\relax + \fi + % + \ifeof\r@pgfplots@reada + \else + \def\b@pgfplotstable@search@done{1}% + \fi + \fi + \fi + }% + % + \if0\b@pgfplotstable@search@done + \let\pgfplotstableread@filename=\pgfplotstableread@filename@name + \fi +}% + % Opens \pgfplotstableread@filename. \def\pgfplotstableread@openfile{% \def\pgfplotstable@loc@TMPa{\pgfutil@in@{ }}% @@ -926,20 +1022,11 @@ \fi \let\pgfplotstableread@old@crcr=\\% \def\\{\string\\}% just to make sure we don't try to open inline table data... - \openin\r@pgfplots@reada=\pgfplotstableread@filename.tex - \ifeof\r@pgfplots@reada - \openin\r@pgfplots@reada=\pgfplotstableread@filename\relax - \else - \pgfplots@warning{% - You requested to open table '\pgfplotstableread@filename', but there is also a '\pgfplotstableread@filename.tex'. - TeX will automatically append the suffix '.tex', so I will now open '\pgfplotstableread@filename.tex'. - Please make sure you don't accidentally load TeX files - this may produce unrecoverable errors.}% - \closein\r@pgfplots@reada - \openin\r@pgfplots@reada=\pgfplotstableread@filename\relax - \fi + % + \pgfplotstable@search@and@open@file % \ifeof\r@pgfplots@reada - \pgfplotsthrow{no such table file}{\pgfplots@loc@TMPa}{\pgfplotstableread@filename}{Could not read table file '\pgfplotstableread@filename'. In case you intended to provide inline data: maybe TeX screwed up your end-of-lines? Try `row sep=crcr' and terminate your lines with `\string\\' (refer to the pgfplotstable manual for details)}\pgfeov% + \pgfplotsthrow{no such table file}{\pgfplots@loc@TMPa}{\pgfplotstableread@filename}{Could not read table file '\pgfplotstableread@filename' in 'search path=\pgfkeysvalueof{/pgfplots/table/search path}'. In case you intended to provide inline data: maybe TeX screwed up your end-of-lines? Try `row sep=crcr' and terminate your lines with `\string\\' (refer to the pgfplotstable manual for details)}\pgfeov% \global\let\pgfplotstable@colnames@glob=\pgfplots@loc@TMPa \def\pgfplotstableread@ready{0}% \fi |