[latex3-commits] [git/LaTeX3-latex3-pdfresources] backendtest: cleaning up (f991077)

Ulrike Fischer fischer at troubleshooting-tex.de
Sat Aug 24 01:22:42 CEST 2019


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

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

commit f9910770509a6b358d0785b409047c7952dd3f80
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sat Aug 24 01:22:42 2019 +0200

    cleaning up


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

f9910770509a6b358d0785b409047c7952dd3f80
 experiments/extgstate.tex |   2 +-
 pdfresources.dtx          | 522 +++++++++++++++++++++++++---------------------
 2 files changed, 289 insertions(+), 235 deletions(-)

diff --git a/experiments/extgstate.tex b/experiments/extgstate.tex
index a44bc21..ca9d0ca 100644
--- a/experiments/extgstate.tex
+++ b/experiments/extgstate.tex
@@ -12,7 +12,7 @@
 \begin{document}
 aba \newpage abc\newpage
 
-x\directlua{tex.sprint(l3kernel.pdf.object_ref("PageN/Resources/ExtGState"))}x
+%x\directlua{tex.sprint(l3kernel.pdf.object_ref("PageN/Resources/ExtGState"))}x
 \ExplSyntaxOn
 
 
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 93589dd..bcbf842 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -97,6 +97,7 @@
 %    \begin{macrocode}
 \prop_new:N \l_@@_tmpa_prop
 \tl_new:N \l_@@_tmpa_tl
+\box_new:N  \l_@@_tmpa_box
 %    \end{macrocode}
 % \end{variable}
 % \begin{macro}{\@@_dict_item:nn,\@@_dict_objref_item:nn}
@@ -271,6 +272,7 @@
   {
     \@@_Pages_gpush:
     \@@_Info_gpush:
+    \@@_PageNResources_gpush:
   }
 %    \end{macrocode}
 % \end{macro}
@@ -1028,7 +1030,7 @@
 \bool_new:N \l_@@_backend_xform_bool
 \@@_prop_new:n {xform/Resources/Properties}
 %quite often needed
-\clist_const:Nn \c_@@_backend_pageresources_clist
+\clist_const:Nn \c_@@_backend_PageNResources_clist
   {
     ExtGState,
     ColorSpace,
@@ -1089,7 +1091,7 @@
   % at shipout
   \cs_new_protected:Npn \@@_backend_PageN_Resources_gpush:n #1
     {
-      \clist_map_inline:Nn \c_@@_backend_pageresources_clist
+      \clist_map_inline:Nn \c_@@_backend_PageNResources_clist
         {
           \prop_if_empty:cF { \@@_prop_name:n {PageN/Resources/##1} }
             {
@@ -1205,7 +1207,7 @@
              }
            %% add ExtGState etc
            \clist_map_function:NN
-             \c_@@_backend_pageresources_clist
+             \c_@@_backend_PageNResources_clist
              \@@_backend_PageN_Resources_gpush_aux:n
          }
     }
@@ -1315,180 +1317,215 @@
 %    \end{macrocode}
 %
 %   \subsubsection{pdfxform / backend }
+%  \begin{macro}{ \@@_backend_xform_new:nnnn }
+%  \begin{arguments}
+%  \item name
+%  \item attributes
+%  \item resources %needed?? or are all resources autogenerated?
+%  \item content, this doesn't need to be a box!
+%  \end{arguments}
+%  \begin{macro}{ \@@_backend_xform_use:n, \@@_backend_xform_ref:n }
 %    \begin{macrocode}
-\box_new:N  \l_@@_backend_tmpa_box
-
 %%pdftex
 \bool_if:nT {\sys_if_engine_pdftex_p: && \sys_if_output_pdf_p: }
-{
- \cs_new:Npn \@@_backend_xform_new:nnnn #1 #2 #3 #4
-  % #1 name
-  % #2 attributes
-  % #3 resources
-  % #4 content, not necessarly a box!
   {
-   \hbox_set:Nn \l_@@_backend_tmpa_box
+    \cs_new_protected:Npn \@@_backend_xform_new:nnnn #1 #2 #3 #4
+    % #1 name
+    % #2 attributes
+    % #3 resources
+    % #4 content, not necessarly a box!
+      {
+        \hbox_set:Nn \l_@@_tmpa_box
+          {
+            \bool_set_true:N \l_@@_backend_xform_bool
+            \@@_prop_gclear:n {xform/Resources/Properties}
+            #4
+          }
+        %store the dimensions
+        \tl_const:cx
+          { c_@@_backend_xform_wd_ \tl_to_str:n {#1} _tl }
+          { \tex_the:D \box_wd:N \l_@@_tmpa_box }
+        \tl_const:cx
+          { c_@@_backend_xform_ht_ \tl_to_str:n {#1} _tl }
+          { \tex_the:D \box_ht:N \l_@@_tmpa_box }
+        \tl_const:cx
+          { c_@@_backend_xform_dp_ \tl_to_str:n {#1} _tl }
+          { \tex_the:D \box_dp:N \l_@@_tmpa_box }
+        %% do we need to test if #2 and #3 are empty??
+        \tex_immediate:D \tex_pdfxform:D
+          ~  attr      ~ { #2 }
+        %% which other resources should be default? Is an argument actually needed?
+          ~  resources ~
+          {
+            \int_compare:nNnT
+              { \prop_count:c { \@@_prop_name:n {xform/Resources/Properties} } }
+              >
+              { 0 }
+              {
+                /Properties~
+                  <<
+                    \@@_prop_map_dict_item:n {xform/Resources/Properties}
+                  >>
+                ~ #3
+              }
+          }
+          \l_@@_tmpa_box
+       \int_const:cn
+         { c_@@_backend_xform_ \tl_to_str:n {#1} _int }
+         { \tex_pdflastxform:D }
+      }
+
+  \cs_new_protected:Npn \@@_backend_xform_use:n #1
     {
-     \bool_set_true:N \l_@@_backend_xform_bool
-     \@@_prop_gclear:n {xform/Resources/Properties}
-     #4
+      \tex_pdfrefxform:D
+        \int_use:c { c_@@_backend_xform_ \tl_to_str:n {#1} _int }
+        \scan_stop:
     }
-   \tl_const:cx
-     { c_@@_backend_xform_wd_ \tl_to_str:n {#1} _tl }
-     { \tex_the:D \box_wd:N \l_@@_backend_tmpa_box }
-   \tl_const:cx
-     { c_@@_backend_xform_ht_ \tl_to_str:n {#1} _tl }
-     { \tex_the:D \box_ht:N \l_@@_backend_tmpa_box }
-   \tl_const:cx
-     { c_@@_backend_xform_dp_ \tl_to_str:n {#1} _tl }
-     { \tex_the:D \box_dp:N \l_@@_backend_tmpa_box }
-   %% do we need to test if #2 and #3 are empty??
-   \tex_immediate:D \tex_pdfxform:D
-    ~  attr      ~ { #2 }
-   %% which other resources should be default? Is an argument actually needed?
-    ~  resources ~
-     {
-      \int_compare:nNnT
-       {\prop_count:c { \@@_prop_name:n {xform/Resources/Properties} }}>{0}
-       {/Properties~<<\@@_prop_map_dict_item:n {xform/Resources/Properties}>>~ #3}
-     }
-    \l_@@_backend_tmpa_box
-   \int_const:cn
-      { c_@@_backend_xform_ \tl_to_str:n {#1} _int }
-      { \tex_pdflastxform:D }
-  }
 
-\cs_new:Npn \@@_backend_xform_use:n #1
- {
-  \tex_pdfrefxform:D \int_use:c { c_@@_backend_xform_ \tl_to_str:n {#1} _int } \scan_stop:
- }
-
-\cs_new:Npn \@@_backend_xform_ref:n #1
-  {
-   \int_use:c { c_@@_backend_xform_ \tl_to_str:n {#1} _int } ~ 0 ~ R
+  \cs_new:Npn \@@_backend_xform_ref:n #1
+    {
+      \int_use:c { c_@@_backend_xform_ \tl_to_str:n {#1} _int } ~ 0 ~ R
+    }
   }
-}
 
 %luatex
 %nearly identical but not completly ...
 \sys_if_engine_luatex:T
-{
- \cs_new:Npn \@@_backend_xform_new:nnnn #1 #2 #3 #4
-  % #1 name
-  % #2 attributes
-  % #3 resources
-  % #4 content, not necessarly a box!
   {
-   \hbox_set:Nn \l_@@_backend_tmpa_box
-    {
-     \bool_set_true:N \l_@@_backend_xform_bool
-     \@@_prop_gclear:n {xform/Resources/Properties}
-     #4
-    }
-   \tl_const:cx
-     { c_@@_backend_xform_wd_ \tl_to_str:n {#1} _tl }
-     { \tex_the:D \box_wd:N \l_@@_backend_tmpa_box }
-   \tl_const:cx
-     { c_@@_backend_xform_ht_ \tl_to_str:n {#1} _tl }
-     { \tex_the:D \box_ht:N \l_@@_backend_tmpa_box }
-   \tl_const:cx
-     { c_@@_backend_xform_dp_ \tl_to_str:n {#1} _tl }
-     { \tex_the:D \box_dp:N \l_@@_backend_tmpa_box }
-   %% do we need to test if #2 and #3 are empty??
-   \tex_immediate:D \tex_pdfxform:D
-    ~  attr      ~ { #2 }
-   %% which resources should be default? Is an argument actually needed?
-    ~  resources ~
-     {
-      \int_compare:nNnT
-       {\prop_count:c { \@@_prop_name:n {xform/Resources/Properties} }}>{0}
-       {/Properties~<<\@@_prop_map_dict_item:n {xform/Resources/Properties}>>~ #3}
-     }
-    \l_@@_backend_tmpa_box
-   \int_const:cn
-      { c_@@_backend_xform_ \tl_to_str:n {#1} _int }
-      { \tex_pdflastxform:D }
-  }
+    \cs_new:Npn \@@_backend_xform_new:nnnn #1 #2 #3 #4
+    % #1 name
+    % #2 attributes
+    % #3 resources
+    % #4 content, not necessarly a box!
+      {
+        \hbox_set:Nn \l_@@_tmpa_box
+          {
+            \bool_set_true:N \l_@@_backend_xform_bool
+            \@@_prop_gclear:n {xform/Resources/Properties}
+            #4
+          }
+        \tl_const:cx
+          { c_@@_backend_xform_wd_ \tl_to_str:n {#1} _tl }
+          { \tex_the:D \box_wd:N \l_@@_tmpa_box }
+        \tl_const:cx
+          { c_@@_backend_xform_ht_ \tl_to_str:n {#1} _tl }
+          { \tex_the:D \box_ht:N \l_@@_tmpa_box }
+        \tl_const:cx
+          { c_@@_backend_xform_dp_ \tl_to_str:n {#1} _tl }
+          { \tex_the:D \box_dp:N \l_@@_tmpa_box }
+        %% do we need to test if #2 and #3 are empty??
+        \tex_immediate:D \tex_pdfxform:D
+          ~  attr      ~ { #2 }
+          %% which resources should be default? Is an argument actually needed?
+          ~  resources ~
+          {
+            \int_compare:nNnT
+              {\prop_count:c { \@@_prop_name:n {xform/Resources/Properties} }}
+              >
+              { 0 }
+              {
+                /Properties~
+                  <<
+                    \@@_prop_map_dict_item:n {xform/Resources/Properties}
+                  >>
+                ~ #3
+              }
+          }
+          \l_@@_tmpa_box
+          \int_const:cn
+            { c_@@_backend_xform_ \tl_to_str:n {#1} _int }
+            { \tex_pdflastxform:D }
+      }
 
-\cs_new:Npn \@@_backend_xform_use:n #1
- {
-  \tex_pdfrefxform:D \int_use:c { c_@@_backend_xform_ \tl_to_str:n {#1} _int } \scan_stop:
- }
+    \cs_new:Npn \@@_backend_xform_use:n #1
+      {
+        \tex_pdfrefxform:D \int_use:c
+          {
+            c_@@_backend_xform_ \tl_to_str:n {#1} _int
+          }
+          \scan_stop:
+      }
 
-\cs_new:Npn \@@_backend_xform_ref:n #1
-  { \int_use:c { c_@@_backend_xform_ \tl_to_str:n {#1} _int } ~ 0 ~ R }
-}
+    \cs_new:Npn \@@_backend_xform_ref:n #1
+      { \int_use:c { c_@@_backend_xform_ \tl_to_str:n {#1} _int } ~ 0 ~ R }
+  }
 
 
 \sys_if_engine_xetex:T
-{
-% it needs a bit testing if it really works to set the box to 0 before the special ...
-% does it disturb viewing the xobject?
-% what happens with the resources (bdc)? (should work as they are specials too)
-\cs_new:Npn \@@_backend_xform_new:nnnn #1 #2 #3 #4
-  % #1 name
-  % #2 attributes
-  % #3 resources
-  % #4 content, not necessarly a box!
- {
-  \int_gincr:N \g_@@_backend_object_int
-  \int_const:cn
-      { c_@@_backend_xform_ \tl_to_str:n {#1} _int }
-      { \g_@@_backend_object_int }
-  \hbox_set:Nn \l_@@_backend_tmpa_box
-    {
-     \bool_set_true:N \l_@@_backend_xform_bool
-     #4
-    }
-   \tl_const:cx
-     { c_@@_backend_xform_wd_ \tl_to_str:n {#1} _tl }
-     { \tex_the:D \box_wd:N \l_@@_backend_tmpa_box }
-   \tl_const:cx
-     { c_@@_backend_xform_ht_ \tl_to_str:n {#1} _tl }
-     { \tex_the:D \box_ht:N \l_@@_backend_tmpa_box }
-   \tl_const:cx
-     { c_@@_backend_xform_dp_ \tl_to_str:n {#1} _tl }
-     { \tex_the:D \box_dp:N \l_@@_backend_tmpa_box }
-   \box_set_dp:Nn  \l_@@_backend_tmpa_box { \c_zero_dim }
-   \box_set_ht:Nn  \l_@@_backend_tmpa_box { \c_zero_dim }
-   \box_set_wd:Nn  \l_@@_backend_tmpa_box { \c_zero_dim }
-   \exp_args:Nx
-    \@@_backend:n
-    {
-       bxobj  ~ \@@_backend_xform_ref:n  { #1 }
-       \c_space_tl width  ~ \pdf_xform_wd:n { #1 }
-       \c_space_tl height ~ \pdf_xform_ht:n { #1 }
-       \c_space_tl depth  ~ \pdf_xform_dp:n { #1 }
-    }
-   \box_use_drop:N \l_@@_backend_tmpa_box
-   \exp_args:Nx\@@_backend:n {put ~ @resources ~<<#3>> }
-   \exp_args:Nx\@@_backend:n{exobj ~<<#2>>}
- }
+  {
+   % it needs a bit testing if it really works to set the box to 0 before the special ...
+   % does it disturb viewing the xobject?
+   % what happens with the resources (bdc)? (should work as they are specials too)
+    \cs_new:Npn \@@_backend_xform_new:nnnn #1 #2 #3 #4
+    % #1 name
+    % #2 attributes
+    % #3 resources
+    % #4 content, not necessarly a box!
+      {
+        \int_gincr:N \g_@@_backend_object_int
+        \int_const:cn
+          { c_@@_backend_xform_ \tl_to_str:n {#1} _int }
+          { \g_@@_backend_object_int }
+        \hbox_set:Nn \l_@@_tmpa_box
+          {
+            \bool_set_true:N \l_@@_backend_xform_bool
+            #4
+          }
+        \tl_const:cx
+          { c_@@_backend_xform_wd_ \tl_to_str:n {#1} _tl }
+          { \tex_the:D \box_wd:N \l_@@_tmpa_box }
+        \tl_const:cx
+          { c_@@_backend_xform_ht_ \tl_to_str:n {#1} _tl }
+          { \tex_the:D \box_ht:N \l_@@_tmpa_box }
+        \tl_const:cx
+          { c_@@_backend_xform_dp_ \tl_to_str:n {#1} _tl }
+          { \tex_the:D \box_dp:N \l_@@_tmpa_box }
+        \box_set_dp:Nn  \l_@@_tmpa_box { \c_zero_dim }
+        \box_set_ht:Nn  \l_@@_tmpa_box { \c_zero_dim }
+        \box_set_wd:Nn  \l_@@_tmpa_box { \c_zero_dim }
+        \exp_args:Nx
+          \@@_backend:n
+            {
+              bxobj  ~ \@@_backend_xform_ref:n  { #1 }
+              \c_space_tl width  ~ \pdf_xform_wd:n { #1 }
+              \c_space_tl height ~ \pdf_xform_ht:n { #1 }
+              \c_space_tl depth  ~ \pdf_xform_dp:n { #1 }
+            }
+        \box_use_drop:N \l_@@_tmpa_box
+        \exp_args:Nx
+          \@@_backend:n {put ~ @resources ~<<#3>> }
+        \exp_args:Nx
+          \@@_backend:n{exobj ~<<#2>>}
+     }
 
- \cs_new:Npn \@@_backend_xform_ref:n #1
-  { @pdf.xform \int_use:c { c_@@_backend_xform_ \tl_to_str:n {#1} _int } }
+    \cs_new:Npn \@@_backend_xform_ref:n #1
+      {
+        @pdf.xform \int_use:c { c_@@_backend_xform_ \tl_to_str:n {#1} _int }
+      }
 
- \cs_new:Npn \@@_backend_xform_use:n #1
- {
-  \hbox_set:Nn \l_@@_backend_tmpa_box
-   {
-    \exp_args:Nx
-    \@@_backend:n
+    \cs_new:Npn \@@_backend_xform_use:n #1
      {
-      uxobj~ \@@_backend_xform_ref:n { #1 }
+       \hbox_set:Nn \l_@@_tmpa_box
+         {
+           \exp_args:Nx
+             \@@_backend:n
+             {
+               uxobj~ \@@_backend_xform_ref:n { #1 }
+             }
+         }
+       \box_set_wd:Nn  \l_@@_tmpa_box { \pdf_xform_wd:n { #1 } }
+       \box_set_ht:Nn  \l_@@_tmpa_box { \pdf_xform_ht:n { #1 } }
+       \box_set_dp:Nn  \l_@@_tmpa_box { \pdf_xform_dp:n { #1 } }
+       \box_use_drop:N \l_@@_tmpa_box
      }
-   }
-   \box_set_wd:Nn  \l_@@_backend_tmpa_box { \pdf_xform_wd:n { #1 } }
-   \box_set_ht:Nn  \l_@@_backend_tmpa_box { \pdf_xform_ht:n { #1 } }
-   \box_set_dp:Nn  \l_@@_backend_tmpa_box { \pdf_xform_dp:n { #1 } }
-   \box_use_drop:N \l_@@_backend_tmpa_box
- }
-}
+  }
 %    \end{macrocode}
-%
+% \end{macro}
+% \end{macro}
 % \subsection{page resources: ExtGState, ColorSpace, Shading, Pattern }
 % \begin{NOTE}{UF}
-% Only for pdf/luatex and xdvipdfmx backend- and pdf-code is needed to add values to these resources.
+% Only for pdf/luatex and xdvipdfmx backend- and pdf-code is needed to add values
+% to these resources.
 % With dvips the resources are added through high-level code (e.g. transparency), so the
 % backend/pdf commands are no-ops.
 % For every resources there is only one object. References to these objects are added to
@@ -1500,67 +1537,78 @@
 % As pgf does the same, there is a need to patch it for now. Ditto for package colorspace.
 % \end{NOTE}
 % \subsubsection{page resources: ExtGState, ColorSpace, Shading, Pattern / backend}
-% Path: PageN/Resources/ExtGState etc
+% Path: PageN/Resources/ExtGState etc. The actual output of the resources is handled
+% together with the bdc/Properties. Here is only special code.
+% \begin{macro}{\@@_backend_PageNResources_gput:nnn}
+% stores values for the page resources.
+% \begin{arguments}
+% \item name of the resource (ExtGState, ColorSpace, Shading, Pattern)
+% \item a pdf name without slash
+% \item value
+% \end{arguments}
+% \begin{macro}{\@@_PageNResources_gpush:}
+% This pushes out the objects. It is a noop with xdvipdfmx and dvips.
 %    \begin{macrocode}
 % backend commands the command to fill the register
 % and to push the values.
 % pdftex and luatex
-\bool_if:nT { (\sys_if_engine_pdftex_p: && \sys_if_output_pdf_p:) || \sys_if_engine_luatex_p: }
-{
- \clist_map_inline:Nn \c_@@_backend_pageresources_clist
-  {
-   \@@_prop_new:n {PageN/Resources/#1}
-   \@@_backend_object_new:nn {PageN/Resources/#1} {dict}
-   \cs_if_exist:NT \tex_directlua:D
-    {
-     \tex_directlua:D
-      {
-       l3kernel.@@.object["PageN/Resources/#1"]="\@@_backend_object_ref:n{PageN/Resources/#1}"
-      }
-    }
-  }
- \cs_new_protected:Npx \@@_backend_pageresources:n #1
+\bool_if:nT
   {
-    \exp_not:N \tex_global:D
-    \cs_if_exist:NTF \tex_pdfpageresources:D
-      { \tex_pdfpageresources:D }
-      { \tex_pdfvariable:D pageresources }
-      {#1}
+    (\sys_if_engine_pdftex_p: && \sys_if_output_pdf_p:)
+    ||
+    \sys_if_engine_luatex_p:
   }
+  { %create the props and backend objects:
+    \clist_map_inline:Nn \c_@@_backend_PageNResources_clist
+      {
+        \@@_prop_new:n {PageN/Resources/#1}
+        \@@_backend_object_new:nn {PageN/Resources/#1} {dict}
+        \cs_if_exist:NT \tex_directlua:D
+          {
+            \tex_directlua:D
+              {
+                l3kernel.@@.object["PageN/Resources/#1"]
+                =
+                "\@@_backend_object_ref:n{PageN/Resources/#1}"
+              }
+          }
+       }
  % values are only stored in a prop and will be output at end document.
- \sys_if_engine_luatex:TF
- {
-  \cs_new_protected:Npn \@@_backend_pageresources_gput:nnn #1 #2 #3
-   {
-    \@@_prop_gput:nnn {PageN/Resources/#1} { #2 }{ #3 }
-     % luatex must also trigger the lua side
-     \tex_latelua:D{l3kernel.@@.Page.Resources.#1=true}
-     \tex_latelua:D{l3kernel.pdf.Page_Resources_gpush( tex.count["g_@@_abspage_int"])}
-   }
- }
- {
-  \cs_new_protected:Npn \@@_backend_pageresources_gput:nnn #1 #2 #3
-   {
-    \@@_prop_gput:nnn {PageN/Resources/#1} { #2 }{ #3 }
-   }
- }
-
- % code for end of document code
- \cs_new_protected:Npn \@@_backend_pageresources_end_run:
- {
-  \clist_map_inline:Nn \c_@@_backend_pageresources_clist
-   {
-    %\prop_show:c{\@@_prop_name:n {PageN/Resources/##1}}
-    \prop_if_empty:cF
-      { \@@_prop_name:n {PageN/Resources/##1} }
+    \sys_if_engine_luatex:TF
       {
-        \exp_args:Nnx \@@_backend_object_write:nn
-        { PageN/Resources/##1 }
-        { \@@_prop_map_dict_item:n {PageN/Resources/##1} }
+        \cs_new_protected:Npn \@@_backend_PageNResources_gput:nnn #1 #2 #3
+          {
+            \@@_prop_gput:nnn {PageN/Resources/#1} { #2 }{ #3 }
+            % luatex must also trigger the lua side
+            \tex_latelua:D{l3kernel.@@.Page.Resources.#1=true}
+            \tex_latelua:D
+              {
+                l3kernel.pdf.Page_Resources_gpush(tex.count["g_@@_abspage_int"])
+              }
+          }
       }
-   }
+      { %pdftex
+        \cs_new_protected:Npn \@@_backend_PageNResources_gput:nnn #1 #2 #3
+          {
+            \@@_prop_gput:nnn {PageN/Resources/#1} { #2 }{ #3 }
+          }
+      }
+
+ % code for end of document code
+   \cs_new_protected:Npn \@@_PageNResources_gpush:
+     {
+       \clist_map_inline:Nn \c_@@_backend_PageNResources_clist
+         {
+           \prop_if_empty:cF
+             { \@@_prop_name:n {PageN/Resources/##1} }
+             {
+               \exp_args:Nnx \@@_backend_object_write:nn
+                 { PageN/Resources/##1 }
+                 { \@@_prop_map_dict_item:n {PageN/Resources/##1} }
+             }
+        }
+     }
   }
-}
 % xdvipdfmx
 % \special{pdf:pageresources<<#1>>} doesn't work correctly with object names ...
 % https://tug.org/pipermail/dvipdfmx/2019-August/000021.html,
@@ -1568,36 +1616,42 @@
 % this must be issued on every page!
 
 \sys_if_engine_xetex:T
-{
- %objects should not only be created but also "initialized"
- \clist_map_inline:Nn \c_@@_backend_pageresources_clist
   {
-    \@@_backend_object_new:nn   { PageN/Resources/#1 } { dict }
-    \@@_backend_object_write:nn { PageN/Resources/#1 } {}
-  }
+  %objects should not only be created but also "initialized"
+    \clist_map_inline:Nn \c_@@_backend_PageNResources_clist
+      {
+        \@@_backend_object_new:nn   { PageN/Resources/#1 } { dict }
+        \@@_backend_object_write:nn { PageN/Resources/#1 } {}
+      }
 
- \cs_new_protected:Npn \@@_backend_pageresources:n #1
-  {
-   \__pdf_backend:n {put~@resources~<<#1>>}
-  }
+    \cs_new_protected:Npn \@@_backend_PageNResources:n #1
+      {
+        \__pdf_backend:n {put~@resources~<<#1>>}
+      }
 
- \cs_new_protected:Npn \@@_backend_pageresources_gput:nnn #1 #2 #3
-  {
-   %objects are not filled with \pdf_object_write as this is not additive!
-   \@@_backend:x {put~\@@_backend_object_ref:n {PageN/Resources/#1}<</#2~#3>>}
+    \cs_new_protected:Npn \@@_backend_PageNResources_gput:nnn #1 #2 #3
+      {
+       %objects are not filled with \pdf_object_write as this is not additive!
+        \@@_backend:x
+          {
+            put~\@@_backend_object_ref:n {PageN/Resources/#1}<</#2~#3>>
+          }
+      }
+
+    \cs_new_protected:Npn \@@_PageNResources_gpush: {}
   }
- \cs_new_protected:Npn \@@_backend_pageresources_end_run: {}
-}
 
 % dvips unneeded, or no-op
 \bool_if:nT { \sys_if_engine_pdftex_p: && !\sys_if_output_pdf_p: }
-{
- \cs_new_protected:Npn \@@_backend_pageresources:n #1 {}
- \cs_new_protected:Npn \@@_backend_pageresources_gput:nnn #1 #2 #3 {}
- \cs_new_protected:Npn \@@_backend_pageresources_end_run: {}
-}
+  {
+    \cs_new_protected:Npn \@@_backend_PageNResources:n #1 {}
+    \cs_new_protected:Npn \@@_backend_PageNResources_gput:nnn #1 #2 #3 {}
+    \cs_new_protected:Npn \@@_PageNResources_gpush: {}
+  }
 %    \end{macrocode}
-%
+% \end{macro}
+% \end{macro}
+% %XXXXXXXXXXX
 % \subsubsection{ page resources: ExtGState, ColorSpace, Shading, Pattern / management}
 % \begin{function}[added = 2019-08-08]
 %   {\pdf_pageresources_gput:nnn}
@@ -1622,7 +1676,7 @@
 % setter:  #1 is the name of the resource
 \cs_new_protected:Npn \pdf_pageresources_gput:nnn #1 #2 #3
   {
-   \@@_backend_pageresources_gput:nnn {#1} { #2 }{ #3 }
+   \@@_backend_PageNResources_gput:nnn {#1} { #2 }{ #3 }
   }
 %    \end{macrocode}
 %    \begin{macrocode}
@@ -1639,7 +1693,7 @@
 \@@_backend_end_run:n
  {
    % only pdftex??
-   \@@_backend_pageresources_end_run:
+   %\@@_backend_PageNResources_end_run:
  }
 
 %    \end{macrocode}
@@ -2134,7 +2188,7 @@
 %   \msg_none:nnn { pdf }{ empty-value }{ Resources/#2 }
 %  }
 %  {
-%    \@@_backend_pageresources_gput:nnn { #1 } { #2 } { #3 }
+%    \@@_backend_PageNResources_gput:nnn { #1 } { #2 } { #3 }
 %  }
 % }
 %
@@ -2145,7 +2199,7 @@
 %   \msg_none:nnn { pdf }{ empty-value }{ Resources/#3 }
 %  }
 %  {
-%    \@@_backend_pageresources_gput:nnnn { #1 } { #2 } { #3 } { #4}
+%    \@@_backend_PageNResources_gput:nnnn { #1 } { #2 } { #3 } { #4}
 %  }
 % }
 %
@@ -2489,7 +2543,7 @@
   % extgstate
   \cs_new:Npn \@@_patch_pgfextgs:w  #1/#2<<#3>>#4\q_stop
    {
-    \@@_backend_pageresources_gput:nnn {ExtGState}{#2}{<<#3>>}
+    \@@_backend_PageNResources_gput:nnn {ExtGState}{#2}{<<#3>>}
    }
 
   \def\pgf at sys@addpdfresource at extgs@plain#1
@@ -2501,7 +2555,7 @@
   % patterns
   \cs_new:Npn \@@_patch_pgfpatterns:w  #1/#2\space#3\q_stop
    {
-    \exp_args:Nnnx \@@_backend_pageresources_gput:nnn {Pattern}{#2}{#3}
+    \exp_args:Nnnx \@@_backend_PageNResources_gput:nnn {Pattern}{#2}{#3}
    }
   \def\pgf at sys@addpdfresource at patterns@plain#1
    {
@@ -2511,7 +2565,7 @@
   %colorspace is already set when tikz is loaded:
   \cs_new:Npn \@@_patch_pgfcolorspace:w  #1/#2[#3]#4\q_stop
    {
-    \@@_backend_pageresources_gput:nnn {ColorSpace}{#2}{[#3]}
+    \@@_backend_PageNResources_gput:nnn {ColorSpace}{#2}{[#3]}
    }
   \tl_if_exist:NT \pgf at sys@pgf at resource@list at colorspaces
   {
@@ -2526,13 +2580,13 @@
  {
   \def\TRP at addresource
    {
-    \@@_backend_pageresources_gput:nnn{ExtGState}{TRP1}{<</ca~1/CA~1>>}
+    \@@_backend_PageNResources_gput:nnn{ExtGState}{TRP1}{<</ca~1/CA~1>>}
    }
   \def\transparent at use#1
   {
    \tl_if_exist:cF{TRP#1}
     {
-     \@@_backend_pageresources_gput:nnn{ExtGState}{TRP#1}{<</ca~#1/CA~#1>>}
+     \@@_backend_PageNResources_gput:nnn{ExtGState}{TRP#1}{<</ca~#1/CA~#1>>}
      \tl_const:cn{TRP#1}{/TRP#1~gs}
     }
   }





More information about the latex3-commits mailing list