[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: storing (5772463)

Ulrike Fischer fischer at troubleshooting-tex.de
Thu Jun 13 00:17:21 CEST 2019


Repository : https://github.com/latex3/pdfresources
On branch  : backendtest
Link       : https://github.com/latex3/pdfresources/commit/57724632d181ab4b043cec7c076a37601d29c71f

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

commit 57724632d181ab4b043cec7c076a37601d29c71f
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Thu Jun 13 00:17:21 2019 +0200

    storing


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

57724632d181ab4b043cec7c076a37601d29c71f
 pdfresources.dtx |   58 ++++++++++++++++++++++++++++++++----------------------
 1 file changed, 35 insertions(+), 23 deletions(-)

diff --git a/pdfresources.dtx b/pdfresources.dtx
index cc5536d..53fb6ce 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -315,41 +315,61 @@
 %  /PageN/Resources/Pattern
 %  /PageN/Resources/Shading
 %  /PageN/Resources/Properties
-%  /Info           %w, \pdfinfo
+%  //Info           %w, \pdfinfo
 %  /Catalog/OCProperties
 %  /Catalog/OutputIntents
 %  \end{verbatim}
 %    \begin{macrocode}
 %<*package>
-\cs_new_protected:Npn \@@_tree_new:nn #1 #2 %parent/kid
+\cs_new:Npn \@@_tree_prop_name:n #1 % path name without /
  {
-  \prop_if_exist:cF { g_@@_#1/#2_prop }
+   g_@@_/#1_prop
+ }
+
+\cs_new_protected:Npn \@@_tree_new:n #1
+ {
+  \prop_if_exist:cF { \@@_tree_prop_name:n {#1} }
    {
-    \prop_new:c  { g_@@_#1/#2_prop }
+    \prop_new:c  { \@@_tree_prop_name:n {#1} }
    }
  }
-\cs_new_protected:Npn \@@_tree_gput:nnn #1 #2 #3 %#1 path without starting /
+
+
+\cs_new_protected:Npn \@@_tree_gput:nnn #1 #2 #3  %#1 name
  { %test if tree path is allowed here?
   \tl_if_empty:nTF { #3 }
    {
     \msg_none:nnn { pdf }{ empty-value }{ /#1/#2 }
    }
    {
-    \prop_gput:cnn { g_@@_/#1_prop }{ #2 } { #3 }
+    \prop_gput:cnn { \@@_tree_prop_name:n {#1} }{ #2 } { #3 }
    }
  }
-\cs_new_protected:Npn \@@_tree_get:nnN  #1 #2 #3
+\cs_new_protected:Npn \@@_tree_get:nnnN  #1 #2 #3
   {
-   \prop_get:cnN { g_@@_/#1_prop } { #2 } #3
+   \prop_get:cnN { \@@_tree_prop_name:n {#1} } { #2} #3
   }
 
 \cs_new_protected:Npn \@@_tree_gremove:nn #1 #2
   {
-   \prop_gremove:cn { g_@@_/#1_prop } { #2 }
+   \prop_gremove:cn { \@@_tree_prop_name:n {#1} } { #2 }
   }
+
 \cs_new:Npn \@@_tree_map_dict_item:n #1
  {
-   \prop_map_function:cN { g_@@_/#1_prop } \@@_dict_item:nn
+   \prop_map_function:cN { \@@_tree_prop_name:n {#1}} \@@_dict_item:nn
+ }
+
+\cs_new_protected:Npn \@@_tree_merge:nnN #1 #2 #3 % merges: first #1 then optionally #2 into prop #3
+ {
+   \prop_set_eq:Nc #3 { \@@_tree_prop_name:n  { #1 } }
+   \prop_if_exist:cT  { \@@_tree_prop_name:n  { #2 } }
+   {
+    \prop_map_inline:cn { \@@_tree_prop_name:n  { #2 } }
+    {
+      \prop_put:Nnn #3 { ##1 }{ ##2 }
+    }
+   }
  }
 %</package>
 %    \end{macrocode}
@@ -438,7 +458,7 @@
 % \end{function}
 %    \begin{macrocode}
 %<*package>
-\@@_tree_new:nn {}{Pages}
+\@@_tree_new:n {Pages}
 % setter:
 %^^A documentated
 \cs_new_protected:Npn \pdf_pagesattr_gput:nn #1 #2
@@ -542,7 +562,7 @@
 % \end{function}
 %    \begin{macrocode}
 %<*package>
-\@@_tree_new:nn {}{Page}
+\@@_tree_new:n {Page}
 % setter.
 % The register is normally used only a few times in a document, but to get similar
 % behaviour between dvips/dvipdfmx and pdfmode it should be better be updated
@@ -556,7 +576,7 @@
 % setter by page:
 \cs_new_protected:Npn \pdf_pageattr_gput:nnn #1 #2 #3
   {
-   \@@_tree_new:nn {}{Page#1}
+   \@@_tree_new:n {Page#1}
    \@@_tree_gput:nnn {Page#1}{#2}{#3}
   }
 
@@ -577,20 +597,12 @@
 % push to the register
 \cs_new_protected:Npn \@@_pageattr_gpush:n #1 %#1 = page number
  {
-   \prop_set_eq:Nc\l_@@_tmpa_prop { g_@@_/Page_prop }
-   \prop_if_exist:cT { g_@@_/Page#1_prop }
-   {
-    \prop_map_inline:cn { g_@@_/Page#1_prop }
-    {
-      \prop_put:Nnn \l_@@_tmpa_prop { ##1 }{ ##2 }
-    }
-   }
-   \exp_args:Nx \@@_backend_pageattr:n
+  \@@_tree_merge:nnN {Page}{Page#1}\l_@@_tmpa_prop
+  \exp_args:Nx \@@_backend_pageattr:n
    {
     \prop_map_function:NN \l_@@_tmpa_prop \@@_dict_item:nn
    }
  }
-%must this be in a box??
 
 %</package>
 %    \end{macrocode}





More information about the latex3-commits mailing list