summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/datatool/datatool.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/datatool/datatool.sty')
-rw-r--r--Master/texmf-dist/tex/latex/datatool/datatool.sty112
1 files changed, 85 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/latex/datatool/datatool.sty b/Master/texmf-dist/tex/latex/datatool/datatool.sty
index 35300a8d2c1..4764e53d48d 100644
--- a/Master/texmf-dist/tex/latex/datatool/datatool.sty
+++ b/Master/texmf-dist/tex/latex/datatool/datatool.sty
@@ -39,7 +39,7 @@
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{datatool}[2013/06/28 v2.14 (NLCT)]
+\ProvidesPackage{datatool}[2013/07/10 v2.15 (NLCT)]
\RequirePackage{xkeyval}
\RequirePackage{ifthen}
\RequirePackage{xfor}
@@ -2291,7 +2291,7 @@
\dtlgetentryfromrow{\DTLthisval}{\@dtl@col}{\dtlcurrentrow}%
\expandafter\ifthenelse\expandafter{\@dtl@cond}%
{%
- \ifstrempty{#4}%
+ \ifdefempty{#4}%
{%
\let#4\DTLthisval
}%
@@ -2761,6 +2761,7 @@
\protected@write\@dtl@write{}{%
\string\DTLsetheader*{#1}{\@dtl@k}{\@dtl@h}}%
}%
+ \protected@write{\@dtl@write}{}{\string\def\string\dtllastloadeddb{#1}}%
\closeout\@dtl@write
}%
{%
@@ -2801,8 +2802,9 @@
\def\db@header@id@w{\expandafter\@gobble\string\%^^J\string\db@header@id@w\space}%
\def\db@header@id@end@{\expandafter\@gobble\string\%^^J\string\db@header@id@end@\space}%
\protected@write{\@dtl@write}{}{\string\bgroup\string\makeatletter}%
- \protected@write{\@dtl@write}{}{\string\dtl@message{Reconstructing database
- ^^J`#1'}\expandafter\@gobble\string\%}%
+ \protected@write{\@dtl@write}{}{%
+ \string\dtl@message{Reconstructing database^^J`#1'}%
+ \expandafter\@gobble\string\%}%
\protected@write{\@dtl@write}{}{%
\string\expandafter
\string\global\string\expandafter^^J\string\newtoks
@@ -2815,7 +2817,8 @@
\expandafter\protected@xdef\csname dtl@rawwritedbkeys@#1\endcsname{%
\the\csname dtlkeys@#1\endcsname}%
\protected@write{\@dtl@write}{}{\csname dtl@rawwritedbkeys@#1\endcsname}%
- \protected@write{\@dtl@write}{}{\expandafter\@gobble\string\}\expandafter\@gobble\string\%}%
+ \protected@write{\@dtl@write}{}%
+ {\expandafter\@gobble\string\}\expandafter\@gobble\string\%}%
\dtl@saverawdbhook
\protected@write{\@dtl@write}{}{%
\string\expandafter\string\global
@@ -2825,12 +2828,9 @@
\string\expandafter
\string\global^^J\string\csname\space dtldb@#1\string\endcsname
=\expandafter\@gobble\string\{\expandafter\@gobble\string\%}%
- \@dtl@fmt@bodytok{\csname dtldb@#1\endcsname}%
- \expandafter\protected@xdef\csname dtl@rawwritedb@#1\endcsname{%
- \@dtl@contents}%
+ \expandafter\protected@xdef\csname dtl@rawwritedb@#1\endcsname{\the\csname dtldb@#1\endcsname}%
\protected@write{\@dtl@write}{}{\csname dtl@rawwritedb@#1\endcsname}%
- \protected@write{\@dtl@write}{}{%
- \expandafter\@gobble\string\}\expandafter\@gobble\string\%}%
+ \protected@write{\@dtl@write}{}{\expandafter\@gobble\string\}\expandafter\@gobble\string\%}%
\protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
\string\expandafter\string\newcount
\string\csname\space dtlrows@#1\string\endcsname}%
@@ -2855,6 +2855,7 @@
}%
\protected@write{\@dtl@write}{}{\string\egroup}%
}%
+ \protected@write{\@dtl@write}{}{\string\def\string\dtllastloadeddb{#1}}%
\closeout\@dtl@write
}%
{%
@@ -2862,23 +2863,80 @@
database}{}%
}%
}
-\newcommand*{\@dtl@fmt@bodytok}[1]{%
- \edef\@dtl@contents{\the#1}%
- \@onelevel@sanitize\@dtl@contents
- \@dtl@replace@elt{\@dtl@contents}{db@row@elt@w}%
- \@dtl@replace@elt{\@dtl@contents}{db@row@elt@end@}%
- \@dtl@replace@elt{\@dtl@contents}{db@row@id@w}%
- \@dtl@replace@elt{\@dtl@contents}{db@row@id@end@}%
- \@dtl@replace@elt{\@dtl@contents}{db@col@id@w}%
- \@dtl@replace@elt{\@dtl@contents}{db@col@id@end@}%
- \@dtl@replace@elt{\@dtl@contents}{db@col@elt@w}%
- \@dtl@replace@elt{\@dtl@contents}{db@col@elt@end@}%
-}
-\newcommand*{\@dtl@replace@elt}[2]{%
- \expandafter\def\expandafter\dtl@tmp\expandafter{\csname#2\endcsname }%
- \@onelevel@sanitize\dtl@tmp
- \expandafter\DTLsubstituteall\expandafter#1\expandafter{\dtl@tmp}%
- {\csname#2\endcsname}%
+\newcommand*{\DTLprotectedsaverawdb}[2]{%
+ \DTLifdbexists{#1}%
+ {%
+ \openout\@dtl@write=#2\relax
+ \protected@write{\@dtl@write}{}{%
+ \string\DTLifdbexists{#1}\expandafter\@gobble\string\%^^J%
+ {%
+ \string\PackageError{datatool}{Database `#1' ^^Jalready exists}{}%
+ \expandafter\@gobble\string\%^^J%
+ \string\aftergroup\string\endinput
+ }%
+ {%
+ }\expandafter\@gobble\string\%
+ }%
+ {%
+ \protected@write{\@dtl@write}{}{\string\bgroup\string\makeatletter}%
+ \protected@write{\@dtl@write}{}{\string\dtl@message{Reconstructing database
+ ^^J`#1'}\expandafter\@gobble\string\%}%
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter
+ \string\global\string\expandafter^^J\string\newtoks
+ \string\csname\space dtlkeys@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter
+ \string\global^^J
+ \string\csname\space dtlkeys@#1\string\endcsname
+ =\expandafter\@gobble\string\{\expandafter\@gobble\string\%}%
+ \edef\dtl@rawwrite@keys{\the\csname dtlkeys@#1\endcsname}%
+ \@onelevel@sanitize\dtl@rawwrite@keys
+ \expandafter\write\expandafter\@dtl@write\expandafter
+ {\dtl@rawwrite@keys\expandafter\@gobble\string\}}%
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter\string\global
+ \string\expandafter^^J\string\newtoks
+ \string\csname\space dtldb@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{%
+ \string\expandafter
+ \string\global^^J\string\csname\space dtldb@#1\string\endcsname
+ =\expandafter\@gobble\string\{\expandafter\@gobble\string\%}%
+ \edef\dtl@rawwrite@db{\the\csname dtldb@#1\endcsname}%
+ \@onelevel@sanitize\dtl@rawwrite@db
+ \expandafter\write\expandafter\@dtl@write\expandafter
+ {\dtl@rawwrite@db\expandafter\@gobble\string\}}%
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\expandafter\string\newcount
+ \string\csname\space dtlrows@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\csname\space dtlrows@#1\string\endcsname
+ =\expandafter\number\csname dtlrows@#1\endcsname\string\relax}%
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\expandafter\string\newcount
+ \string\csname\space dtlcols@#1\string\endcsname}%
+ \protected@write{\@dtl@write}{}{\string\expandafter\string\global^^J
+ \string\csname\space dtlcols@#1\string\endcsname
+ =\expandafter\number\csname dtlcols@#1\endcsname\string\relax}%
+ \dtlforeachkey(\@dtl@key,\@dtl@col,\@dtl@type,\@dtl@head)\in{#1}\do
+ {%
+ \edef\dtl@tmp{%
+ \string\expandafter^^J
+ \string\gdef
+ \string\csname\space dtl@ci@#1@\@dtl@key\string\endcsname
+ {\csname dtl@ci@#1@\@dtl@key\endcsname}\expandafter\@gobble\string\%
+ }%
+ \expandafter\write\expandafter\@dtl@write\expandafter{\dtl@tmp}%
+ }%
+ \protected@write{\@dtl@write}{}{\string\egroup}%
+ }%
+ \protected@write{\@dtl@write}{}{\string\def\string\dtllastloadeddb{#1}}%
+ \closeout\@dtl@write
+ }%
+ {%
+ \PackageError{datatool}{Can't save database `#1': no such
+ database}{}%
+ }%
}
\newread\@dtl@read
\newcount\dtl@entrycr