[latex3-commits] [git/LaTeX3-latex3-pdfresources] renamedict77: added if empty test (fd7811a)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue Apr 21 11:33:13 CEST 2020


Repository : https://github.com/latex3/pdfresources
On branch  : renamedict77
Link       : https://github.com/latex3/pdfresources/commit/fd7811a86508ff6a9a2dfd568bfcfde57e5487b1

>---------------------------------------------------------------

commit fd7811a86508ff6a9a2dfd568bfcfde57e5487b1
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue Apr 21 11:33:13 2020 +0200

    added if empty test


>---------------------------------------------------------------

fd7811a86508ff6a9a2dfd568bfcfde57e5487b1
 pdfresources.dtx                   |  22 ++++++-
 testfiles/dict_if_empty.luatex.tlg | 127 +++++++++++++++++++++++++++++++++++++
 testfiles/dict_if_empty.lvt        |  19 ++++++
 testfiles/dict_if_empty.tlg        | 103 ++++++++++++++++++++++++++++++
 testfiles/dict_if_empty.xetex.tlg  |  75 ++++++++++++++++++++++
 5 files changed, 345 insertions(+), 1 deletion(-)

diff --git a/pdfresources.dtx b/pdfresources.dtx
index 911397a..2270843 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -611,6 +611,13 @@
         { \prg_return_false: }
    }
 
+\prg_new_conditional:Npnn \@@_dict_if_empty:n #1 { p , T , F , TF }
+  {
+    \prop_if_empty:cTF
+      { \@@_dict_Xname:n { #1 } }
+      { \prg_return_true: }
+      { \prg_return_false: }
+  }
 %    \end{macrocode}
 %  \end{macro}
 %
@@ -803,7 +810,7 @@
 %   \end{syntax}
 % This function create a new local dictionary.
 %    \begin{macrocode}
-\cs_new_protected:Npn \pdfdict_new:n
+\cs_new_protected:Npn \pdfdict_new:n #1
   {
     \@@_dict_new:n {#1}
   }
@@ -903,6 +910,19 @@
   { TF , T , F , p }
 
 %    \end{macrocode}
+% \begin{function}[EXP, pTF,added = 2020-04-08]
+%   {\pdfdict_if_empty:n }
+%   \begin{syntax}
+%     \cs{pdfdict_if_empty:n}  \Arg{dictionary}
+%   \end{syntax}
+%   This tests if the dictionary is empty. The result is false if the
+%   dictionary doesn't exist.
+%\end{function}
+%    \begin{macrocode}
+\prg_new_eq_conditional:NNn \pdfdict_if_empty:n \@@_dict_if_empty:n
+  { TF , T , F , p }
+%    \end{macrocode}
+%
 % \begin{function}[added = 2020-04-07]
 %   {\pdfdict_get:nn }
 %   \begin{syntax}
diff --git a/testfiles/dict_if_empty.luatex.tlg b/testfiles/dict_if_empty.luatex.tlg
new file mode 100644
index 0000000..c07257d
--- /dev/null
+++ b/testfiles/dict_if_empty.luatex.tlg
@@ -0,0 +1,127 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+Completed box being shipped out [1]
+\vbox(633.0+0.0)x407.0, direction TLT
+.\hbox(0.0+0.0)x0.0, direction TLT
+..\latelua0{l3kernel.__pdf.backend_ThisPage_gpush(tex.count["g__pdf_abspage_int
+"]\ETC.}
+.\glue 16.0
+.\vbox(617.0+0.0)x345.0, shifted 62.0, direction TLT
+..\vbox(12.0+0.0)x345.0, glue set 12.0fil, direction TLT
+...\glue 0.0 plus 1.0fil
+...\hbox(0.0+0.0)x345.0, direction TLT
+..\glue 25.0
+..\glue(\lineskip) 0.0
+..\vbox(550.0+0.0)x345.0, glue set 491.94745fil, direction TLT
+...\write-{}
+...\glue(\topskip) 3.85
+...\hbox(6.15+2.05)x345.0, glue set 288.33002fil, direction TLT
+....\localpar
+.....\localinterlinepenalty=0
+.....\localbrokenpenalty=0
+.....\localleftbox=null
+.....\localrightbox=null
+....\hbox(0.0+0.0)x15.0, direction TLT
+....\TU/lmr/m/n/10 n
+....\TU/lmr/m/n/10 o
+....\TU/lmr/m/n/10 t
+....\TU/lmr/m/n/10 e
+....\TU/lmr/m/n/10 m
+....\TU/lmr/m/n/10 p
+....\TU/lmr/m/n/10 t
+....\kern-0.28 (font)
+....\TU/lmr/m/n/10 y
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.8
+...\hbox(6.15+2.05)x345.0, glue set 302.78fil, direction TLT
+....\localpar
+.....\localinterlinepenalty=0
+.....\localbrokenpenalty=0
+.....\localleftbox=null
+.....\localrightbox=null
+....\hbox(0.0+0.0)x15.0, direction TLT
+....\TU/lmr/m/n/10 e
+....\TU/lmr/m/n/10 m
+....\TU/lmr/m/n/10 p
+....\TU/lmr/m/n/10 t
+....\kern-0.28 (font)
+....\TU/lmr/m/n/10 y
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.8
+...\hbox(6.15+2.05)x345.0, glue set 288.33002fil, direction TLT
+....\localpar
+.....\localinterlinepenalty=0
+.....\localbrokenpenalty=0
+.....\localleftbox=null
+.....\localrightbox=null
+....\hbox(0.0+0.0)x15.0, direction TLT
+....\TU/lmr/m/n/10 n
+....\TU/lmr/m/n/10 o
+....\TU/lmr/m/n/10 t
+....\TU/lmr/m/n/10 e
+....\TU/lmr/m/n/10 m
+....\TU/lmr/m/n/10 p
+....\TU/lmr/m/n/10 t
+....\kern-0.28 (font)
+....\TU/lmr/m/n/10 y
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.8
+...\hbox(6.15+2.05)x345.0, glue set 302.78fil, direction TLT
+....\localpar
+.....\localinterlinepenalty=0
+.....\localbrokenpenalty=0
+.....\localleftbox=null
+.....\localrightbox=null
+....\hbox(0.0+0.0)x15.0, direction TLT
+....\TU/lmr/m/n/10 e
+....\TU/lmr/m/n/10 m
+....\TU/lmr/m/n/10 p
+....\TU/lmr/m/n/10 t
+....\kern-0.28 (font)
+....\TU/lmr/m/n/10 y
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.8
+...\hbox(6.15+2.05)x345.0, glue set 302.78fil, direction TLT
+....\localpar
+.....\localinterlinepenalty=0
+.....\localbrokenpenalty=0
+.....\localleftbox=null
+.....\localrightbox=null
+....\hbox(0.0+0.0)x15.0, direction TLT
+....\TU/lmr/m/n/10 e
+....\TU/lmr/m/n/10 m
+....\TU/lmr/m/n/10 p
+....\TU/lmr/m/n/10 t
+....\kern-0.28 (font)
+....\TU/lmr/m/n/10 y
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue -2.05
+...\glue 0.0 plus 1.0fil
+...\glue 0.0
+...\glue 0.0 plus 0.0001fil
+..\glue(\baselineskip) 23.34
+..\hbox(6.66+0.0)x345.0, glue set 170.0fil, direction TLT
+...\glue 0.0 plus 1.0fil
+...\TU/lmr/m/n/10 1
+...\glue 0.0 plus 1.0fil
+.\kern0.0
+Package atveryend Info: Empty hook `BeforeClearDocument' on input line ....
+Package atveryend Info: Executing hook `AfterLastShipout' on input line ...
+(dict_if_empty.aux)
+Package atveryend Info: Empty hook `AtVeryEndDocument' on input line ....
+Package atveryend Info: Empty hook `AtEndAfterFileList' on input line ....
+Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line ....
diff --git a/testfiles/dict_if_empty.lvt b/testfiles/dict_if_empty.lvt
new file mode 100644
index 0000000..bf81792
--- /dev/null
+++ b/testfiles/dict_if_empty.lvt
@@ -0,0 +1,19 @@
+\input{regression-test}
+\documentclass{article}
+\usepackage{pdfresources}
+
+\begin{document}\START
+\showoutput
+
+\ExplSyntaxOn
+\pdfdict_if_empty:nTF{test}{empty}{not empty}\par
+\pdfdict_new:n {test}
+\pdfdict_if_empty:nTF{test}{empty}{not empty}\par
+\pdfdict_put:nnn {test}{key}{value}
+\pdfdict_if_empty:nTF{test}{empty}{not empty}\par
+\pdfdict_if_empty:nTF{Page}{empty}{not empty}\par
+\pdfdict_gput:nnn {Page}{Rotate}{90}
+\pdfdict_if_empty:nTF{Page}{empty}{not empty}\par
+\ExplSyntaxOff
+
+\end{document}
diff --git a/testfiles/dict_if_empty.tlg b/testfiles/dict_if_empty.tlg
new file mode 100644
index 0000000..7f66453
--- /dev/null
+++ b/testfiles/dict_if_empty.tlg
@@ -0,0 +1,103 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+Completed box being shipped out [1]
+\vbox(633.0+0.0)x407.0
+.\hbox(0.0+0.0)x0.0
+.\glue 16.0
+.\vbox(617.0+0.0)x345.0, shifted 62.0
+..\vbox(12.0+0.0)x345.0, glue set 12.0fil
+...\glue 0.0 plus 1.0fil
+...\hbox(0.0+0.0)x345.0
+..\glue 25.0
+..\glue(\lineskip) 0.0
+..\vbox(550.0+0.0)x345.0, glue set 491.94745fil
+...\write-{}
+...\glue(\topskip) 3.84921
+...\hbox(6.15079+1.94444)x345.0, glue set 288.33322fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/cmr/m/n/10 n
+....\OT1/cmr/m/n/10 o
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 m
+....\OT1/cmr/m/n/10 p
+....\OT1/cmr/m/n/10 t
+....\kern-0.27779
+....\OT1/cmr/m/n/10 y
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.90477
+...\hbox(6.15079+1.94444)x345.0, glue set 302.77771fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 m
+....\OT1/cmr/m/n/10 p
+....\OT1/cmr/m/n/10 t
+....\kern-0.27779
+....\OT1/cmr/m/n/10 y
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.90477
+...\hbox(6.15079+1.94444)x345.0, glue set 288.33322fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/cmr/m/n/10 n
+....\OT1/cmr/m/n/10 o
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 m
+....\OT1/cmr/m/n/10 p
+....\OT1/cmr/m/n/10 t
+....\kern-0.27779
+....\OT1/cmr/m/n/10 y
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.90477
+...\hbox(6.15079+1.94444)x345.0, glue set 302.77771fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 m
+....\OT1/cmr/m/n/10 p
+....\OT1/cmr/m/n/10 t
+....\kern-0.27779
+....\OT1/cmr/m/n/10 y
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.90477
+...\hbox(6.15079+1.94444)x345.0, glue set 288.33322fil
+....\hbox(0.0+0.0)x15.0
+....\OT1/cmr/m/n/10 n
+....\OT1/cmr/m/n/10 o
+....\OT1/cmr/m/n/10 t
+....\OT1/cmr/m/n/10 e
+....\OT1/cmr/m/n/10 m
+....\OT1/cmr/m/n/10 p
+....\OT1/cmr/m/n/10 t
+....\kern-0.27779
+....\OT1/cmr/m/n/10 y
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue -1.94444
+...\glue 0.0 plus 1.0fil
+...\glue 0.0
+...\glue 0.0 plus 0.0001fil
+..\glue(\baselineskip) 23.55556
+..\hbox(6.44444+0.0)x345.0, glue set 170.0fil
+...\glue 0.0 plus 1.0fil
+...\OT1/cmr/m/n/10 1
+...\glue 0.0 plus 1.0fil
+.\kern 0.0
+Package atveryend Info: Empty hook `BeforeClearDocument' on input line ....
+Package atveryend Info: Executing hook `AfterLastShipout' on input line ...
+(dict_if_empty.aux)
+Package atveryend Info: Empty hook `AtVeryEndDocument' on input line ....
+Package atveryend Info: Empty hook `AtEndAfterFileList' on input line ....
+Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line ....
diff --git a/testfiles/dict_if_empty.xetex.tlg b/testfiles/dict_if_empty.xetex.tlg
new file mode 100644
index 0000000..672bb30
--- /dev/null
+++ b/testfiles/dict_if_empty.xetex.tlg
@@ -0,0 +1,75 @@
+This is a generated file for the l3build validation system.
+Don't change this file in any respect.
+Package atveryend Info: Empty hook `BeforeClearDocument' on input line ....
+Completed box being shipped out [1]
+\vbox(633.0+0.0)x407.0
+.\hbox(0.0+0.0)x0.0
+..\special{pdf: put @thispage <</Rotate 90 >>}
+..\special{pdf:put @pages <<>>}
+.\glue 16.0
+.\vbox(617.0+0.0)x345.0, shifted 62.0
+..\vbox(12.0+0.0)x345.0, glue set 12.0fil
+...\glue 0.0 plus 1.0fil
+...\hbox(0.0+0.0)x345.0
+..\glue 25.0
+..\glue(\lineskip) 0.0
+..\vbox(550.0+0.0)x345.0, glue set 491.94745fil
+...\write-{}
+...\special{pdf:obj @pdf.obj1 <<  >>}
+...\special{pdf:obj @pdf.obj2 <<  >>}
+...\special{pdf:obj @pdf.obj3 <<  >>}
+...\special{pdf:obj @pdf.obj4 <<  >>}
+...\glue(\topskip) 3.85
+...\hbox(6.15+2.04999)x345.0, glue set 288.33fil
+....\hbox(0.0+0.0)x15.0
+....\TU/lmr/m/n/10 notempty
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.80002
+...\hbox(6.15+2.04999)x345.0, glue set 302.78fil
+....\hbox(0.0+0.0)x15.0
+....\TU/lmr/m/n/10 empty
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.80002
+...\hbox(6.15+2.04999)x345.0, glue set 288.33fil
+....\hbox(0.0+0.0)x15.0
+....\TU/lmr/m/n/10 notempty
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.80002
+...\hbox(6.15+2.04999)x345.0, glue set 302.78fil
+....\hbox(0.0+0.0)x15.0
+....\TU/lmr/m/n/10 empty
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue(\parskip) 0.0 plus 1.0
+...\glue(\baselineskip) 3.80002
+...\hbox(6.15+2.04999)x345.0, glue set 288.33fil
+....\hbox(0.0+0.0)x15.0
+....\TU/lmr/m/n/10 notempty
+....\penalty 10000
+....\glue(\parfillskip) 0.0 plus 1.0fil
+....\glue(\rightskip) 0.0
+...\glue -2.04999
+...\glue 0.0 plus 1.0fil
+...\glue 0.0
+...\glue 0.0 plus 0.0001fil
+..\glue(\baselineskip) 23.34
+..\hbox(6.66+0.0)x345.0, glue set 170.0fil
+...\glue 0.0 plus 1.0fil
+...\TU/lmr/m/n/10 1
+...\glue 0.0 plus 1.0fil
+.\kern 0.0
+Package atveryend Info: Executing hook `AfterLastShipout' on input line ...
+(dict_if_empty.aux)
+Package atveryend Info: Empty hook `AtVeryEndDocument' on input line ....
+Package atveryend Info: Empty hook `AtEndAfterFileList' on input line ....
+Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line ....





More information about the latex3-commits mailing list.