[latex3-commits] [git/LaTeX3-latex3-pdfresources] splitting: changed bdc, added test for core active (748cd0a)

Ulrike Fischer fischer at troubleshooting-tex.de
Sat Jul 4 17:30:59 CEST 2020


Repository : https://github.com/latex3/pdfresources
On branch  : splitting
Link       : https://github.com/latex3/pdfresources/commit/748cd0afd2cfef417a56334d7b1f8211030c05fb

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

commit 748cd0afd2cfef417a56334d7b1f8211030c05fb
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Sat Jul 4 17:30:59 2020 +0200

    changed bdc, added test for core active


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

748cd0afd2cfef417a56334d7b1f8211030c05fb
 l3pdfcoredict.dtx | 24 ++++++++++++++--
 pdfresources.dtx  | 85 ++++++++++++++++++++++++++++++-------------------------
 2 files changed, 69 insertions(+), 40 deletions(-)

diff --git a/l3pdfcoredict.dtx b/l3pdfcoredict.dtx
index 1e536c7..76740d7 100644
--- a/l3pdfcoredict.dtx
+++ b/l3pdfcoredict.dtx
@@ -53,7 +53,7 @@
 %
 % \section{\pkg{l3pdfcoredict} documentation}
 % When creating a pdf a number of objects, dictionaries and entries to
-% dictionaries must be created. The \LaTeX{} format currently contains no
+% central dictionaries must be created. The \LaTeX{} format currently contains no
 % support for theses tasks. It either relies on the binaries to do the job,
 % or on external packages using the primitives of the binaries. These
 % approach is problematic for two reasons: packages trying to set the same resources
@@ -111,7 +111,15 @@
 %  as this dictionary is not filled directly but
 %  managed through side effects when setting BDC-marks.
 %  \subsection{User Commands}
-%
+%  The avoid problems with older documents the resource management of this
+%  module is not activated unconditionally. The values are pushed out to the
+%  dictionaries only if a boolean has been set to true. The state can be testet
+%  with a conditional.
+%  \begin{function}[EXP,pTF,added=2020-07-04]
+%   {\pdfcoredict_if_active:}
+%   This conditional tests if the resource management code is active.
+%   
+%  \end{function}
 % \begin{function}[added = 2020-04-06]
 %   {\pdfcoredict_gput:nnn}
 %   \begin{syntax}
@@ -481,6 +489,18 @@
     The~dictionary~'#1'~is~already~defined.
   }
 %    \end{macrocode}
+% A predicate to test if the core code should be active
+%    \begin{macrocode}
+\prg_new_conditional:Npnn \@@_if_active:  { p , T , F , TF }
+  {
+    \bool_if:NTF \g__pdf_Core_active_bool
+      { \prg_return_true:  }
+      { \prg_return_false: }
+  }
+\prg_set_eq_conditional:NNn
+  \pdfcoredict_if_active: \@@_if_active: { p , T , F , TF }
+
+%    \end{macrocode}
 %    \begin{macrocode}
 \cs_new_protected:Npn \pdfcoredict_gput:nnn #1 #2 #3
   {
diff --git a/pdfresources.dtx b/pdfresources.dtx
index 485fd95..725713e 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -300,9 +300,9 @@
 %   \meta{dictionary content} is the content of the second argument.
 %   If the PDF resource management is active an dictionary object with the
 %   content is created and referenced with a name in the BDC operator.
-%   Without the resource management the content is use directly. It then
-%   depends on the backend how it is handled: with dvips and dvipdfmx a name is used
-%   while the pdfmode engines write the content into the stream.
+%   Without the resource management the content is used directly. It then
+%   depends on the backend how it is handled: with dvips a name is used
+%   while the pdfmode engines and dvipdfmx write the content into the stream.
 %
 % \end{function}
 % \begin{function}[added = 2020-07-03]
@@ -467,19 +467,25 @@
    {
      \__kernel_backend_literal:n {pdf:code~/#1~BMC}  %pdfbase
    }
-\bool_if:NTF  \g_@@_Core_active_bool
+
+%this require management
+\cs_set_protected:Npn \@@_backend_bdc_contobj:nn #1 #2
   {
-    \cs_set_protected:Npn \@@_backend_bdc:nn #1 #2
-      {
-        \pdf_object_now:nn { dict }{ #2 }
-        \@@_backend_bdc_obj:n { #1 }
-      }
+    \pdf_object_now:nn { dict }{ #2 }
+    \@@_backend_bdc_obj:n { #1 }
   }
+
+\cs_set_protected:Npn \@@_backend_bdc_contstream:nn #1 #2
   {
-    \cs_set_protected:Npn \@@_backend_bdc:nn #1 #2
-      {
-        \__kernel_backend_literal:n {pdf:code~ /#1~<<#2>>~BDC }
-      }
+    \__kernel_backend_literal:n {pdf:code~ /#1~<<#2>>~BDC }
+  }
+
+\cs_set_protected:Npn \@@_backend_bdc:nn #1 #2
+  {
+    \bool_if:NTF  \g_@@_Core_active_bool
+      {\cs_gset_eq:NN \@@_backend_bdc:nn \@@_backend_bdc_contobj:nn}
+      {\cs_gset_eq:NN \@@_backend_bdc:nn \@@_backend_bdc_contstream:nn}
+      \@@_backend_bdc:nn {#1}{#1}
   }
 \cs_set_protected:Npn \@@_backend_emc:
   {
@@ -558,19 +564,21 @@
       {
         \__kernel_backend_literal_page:n { /#1~BMC }
       }
-  \bool_if:NTF \g_@@_Core_active_bool
-    {
-      \cs_set_protected:Npn \@@_backend_bdc:nn #1 #2
-        {
-          \pdf_object_now:nn { dict } { #2 }
-          \@@_backend_bdc_obj:n { #1 }
-        }
-    }
+   \cs_set_protected:Npn \@@_backend_bdc_contobj:nn #1 #2
+     {
+       \pdf_object_now:nn { dict } { #2 }
+       \@@_backend_bdc_obj:n { #1 }
+     }
+   \cs_set_protected:Npn \@@_backend_bdc_contstream:nn #1 #2
+     {
+       \__kernel_backend_literal_page:n { /#1~<<#2>>~BDC }
+     }
+  \cs_set_protected:Npn \@@_backend_bdc:nn #1 #2
     {
-      \cs_set_protected:Npn \@@_backend_bdc:nn #1 #2
-        {
-          \__kernel_backend_literal_page:n { /#1~<<#2>>~BDC }
-        }
+      \bool_if:NTF  \g_@@_Core_active_bool
+        {\cs_gset_eq:NN \@@_backend_bdc:nn \@@_backend_bdc_contobj:nn}
+        {\cs_gset_eq:NN \@@_backend_bdc:nn \@@_backend_bdc_contstream:nn}
+        \@@_backend_bdc:nn {#1}{#1}
     }
     \cs_set_protected:Npn \@@_backend_emc:
       {
@@ -659,21 +667,22 @@
     {
       \__kernel_backend_literal_page:n { /#1~BMC }
     }
-  \bool_if:NTF \g_@@_Core_active_bool
-    {
-      \cs_set_protected:Npn \@@_backend_bdc:nn #1 #2
-        {
-          \pdf_object_now:nn { dict }{ #2 }
-          \@@_backend_bdc_obj:n { #1 }
-        }
-    }
+  \cs_set_protected:Npn \@@_backend_bdc_contobj:nn #1 #2
+     {
+       \pdf_object_now:nn { dict } { #2 }
+       \@@_backend_bdc_obj:n { #1 }
+     }
+  \cs_set_protected:Npn \@@_backend_bdc_contstream:nn #1 #2
+     {
+       \__kernel_backend_literal_page:n { /#1~<<#2>>~BDC }
+     }
+  \cs_set_protected:Npn \@@_backend_bdc:nn #1 #2
     {
-      \cs_set_protected:Npn \@@_backend_bdc:nn #1 #2
-        {
-          \__kernel_backend_literal_page:n { /#1~<<#2>>~BDC }
-        }
+      \bool_if:NTF  \g_@@_Core_active_bool
+        {\cs_gset_eq:NN \@@_backend_bdc:nn \@@_backend_bdc_contobj:nn}
+        {\cs_gset_eq:NN \@@_backend_bdc:nn \@@_backend_bdc_contstream:nn}
+        \@@_backend_bdc:nn {#1}{#1}
     }
-
   \cs_set_protected:Npn \@@_backend_emc:
     {
       \__kernel_backend_literal_page:n { EMC }





More information about the latex3-commits mailing list.