[latex3-commits] [git/LaTeX3-latex3-pdfresources] splitting: correct guards (2cea088)

Ulrike Fischer fischer at troubleshooting-tex.de
Wed Jul 1 00:45:47 CEST 2020


Repository : https://github.com/latex3/pdfresources
On branch  : splitting
Link       : https://github.com/latex3/pdfresources/commit/2cea0881310e9e30e63fc8bbe90d09a3ea556c88

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

commit 2cea0881310e9e30e63fc8bbe90d09a3ea556c88
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Wed Jul 1 00:45:47 2020 +0200

    correct guards


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

2cea0881310e9e30e63fc8bbe90d09a3ea556c88
 l3backend-pdf-extra.dtx | 67 +++++++++++++++++++++++++++++++++++++++++++++++--
 l3pdffile.dtx           | 50 ------------------------------------
 2 files changed, 65 insertions(+), 52 deletions(-)

diff --git a/l3backend-pdf-extra.dtx b/l3backend-pdf-extra.dtx
index 6f2d394..8eca66a 100644
--- a/l3backend-pdf-extra.dtx
+++ b/l3backend-pdf-extra.dtx
@@ -571,9 +571,11 @@
 % \subsection{\enquote{Catalog} \& subdirectories (pdfcatalog) }
 % The backend command is already in the driver:
 % \cs{@@_backend_catalog_gput:nn}
-% \subsubsection { Special case: the /Names dictionary }
+% \subsubsection { Special case: the /Names/EmbeddedFiles dictionary }
 % Entries to /Names are handled differently, in part (/Desc) it is automatic, for
-% other special commands like \cs{pdfnames} must be used.
+% other special commands like \cs{pdfnames} must be used. For EmbeddedFiles
+% we need some code to push the tree if files have been added. dvips wants code
+% for every file and then creates the Name tree automatically.
 %    \begin{macrocode}
 % pdflatex
 %<*pdfmode>
@@ -609,6 +611,67 @@
 \cs_new_protected:Npn \@@_backend_NamesEmbeddedFiles_gpush:n #1 {}
 %</dvips>
 %    \end{macrocode}
+% Names in the EmbeddedFiles name tree must sorted alphabetically,
+% so we need commands to create this names. And we need a sequence to store
+% the names and the objects. We use the prefix l3ef, and we assume that at
+% most 9999 files will be used.
+% \begin{variable}{\g_@@_backend_EmbeddedFiles_int}
+% \end{variable}
+% \begin{macro}{\@@_backend_EmbeddedFiles_name:}
+%    \begin{macrocode}
+%<*drivers>
+\int_new:N \g_@@_backend_EmbeddedFiles_int
+\cs_new:Npn \@@_backend_EmbeddedFiles_name:
+ {
+   (
+    l3ef
+    \int_compare:nNnT {\g_@@_backend_EmbeddedFiles_int} < {10}
+     {0}
+    \int_compare:nNnT {\g_@@_backend_EmbeddedFiles_int} < {100}
+     {0}
+    \int_compare:nNnT {\g_@@_backend_EmbeddedFiles_int} < {1000}
+     {0}
+    \int_use:N \g_@@_backend_EmbeddedFiles_int
+   )
+ }
+%</drivers>
+%    \end{macrocode}
+% \end{macro}
+% \begin{variable}{\g_@@_backend_EmbeddedFiles_seq}
+%    \begin{macrocode}
+%<*drivers>
+\seq_new:N \g_@@_backend_EmbeddedFiles_seq
+%</drivers>
+%    \end{macrocode}
+% \begin{macro}{\@@_backend_NamesEmbeddedFiles_add:nN}
+% This command saves an object reference of a filespec dictionary in the
+% EmbeddedFiles name tree.
+%    \begin{macrocode}
+%<*pdfmode|dvipdfmx|xdvipdfmx>
+\cs_new_protected:Npn  \@@_backend_NamesEmbeddedFiles_add:nN #1 #2
+    %#1 object ref , #2 in case the name must be retourned
+    {
+      \int_gincr:N \g_@@_backend_EmbeddedFiles_int
+      \tl_set:Nx #2 { \@@_backend_EmbeddedFiles_name: }
+      \seq_gput_right:Nx \g_@@_backend_EmbeddedFiles_seq { #2 ~#1 }
+    }
+
+%</pdfmode|dvipdfmx|xdvipdfmx>
+%<*dvips>
+\cs_new_protected:Npn  \@@_backend_NamesEmbeddedFiles_add:nN #1 #2
+      {
+        \int_gincr:N \g_@@_backend_EmbeddedFiles_int
+        \tl_set:Nx #2 { \@@_backend_EmbeddedFiles_name: }
+        \@@_backend_pdfmark:x
+          {
+            /Name~#2~
+            /FS~#1~
+            /EMBED
+          }
+      }
+%</dvips>
+%    \end{macrocode}
+% \end{macro}
 % \end{implementation}
 %
 % \PrintIndex
diff --git a/l3pdffile.dtx b/l3pdffile.dtx
index 679991a..dabf078 100644
--- a/l3pdffile.dtx
+++ b/l3pdffile.dtx
@@ -494,56 +494,6 @@
 % if the sequence is not empty.
 % dvips wants code for every file and then sorts this itself.
 %    \begin{macrocode}
-\int_new:N \g_@@_backend_EmbeddedFiles_int
-\seq_new:N \g_@@_backend_EmbeddedFiles_seq
-\cs_new:Npn \@@_backend_EmbeddedFiles_name:
- {
-   (
-    l3ef
-    \int_compare:nNnT {\g_@@_backend_EmbeddedFiles_int} < {10}
-     {0}
-    \int_compare:nNnT {\g_@@_backend_EmbeddedFiles_int} < {100}
-     {0}
-    \int_compare:nNnT {\g_@@_backend_EmbeddedFiles_int} < {1000}
-     {0}
-    \int_use:N \g_@@_backend_EmbeddedFiles_int
-   )
- }
-
-\bool_if:nT %pdftex,luatex,xetex
-  {
-    ( \sys_if_engine_pdftex_p: && \sys_if_output_pdf_p: ) %
-    ||
-     \sys_if_engine_luatex_p:
-    ||
-     \sys_if_engine_xetex_p:
-  }
- {
-  \cs_new_protected:Npn  \@@_backend_NamesEmbeddedFiles_add:nN #1 #2
-    %#1 object ref , #2 in case the name must be retourned
-    {
-      \int_gincr:N \g_@@_backend_EmbeddedFiles_int
-      \tl_set:Nx #2 { \@@_backend_EmbeddedFiles_name: }
-      \seq_gput_right:Nx \g_@@_backend_EmbeddedFiles_seq { #2 ~#1 }
-    }
- }
-
-% dvips
-\bool_if:nT {\sys_if_engine_pdftex_p: && !\sys_if_output_pdf_p:}
-  {
-    \cs_new_protected:Npn  \@@_backend_NamesEmbeddedFiles_add:nN #1 #2
-      {
-        \int_gincr:N \g_@@_backend_EmbeddedFiles_int
-        \tl_set:Nx #2 { \@@_backend_EmbeddedFiles_name: }
-        \@@_backend_pdfmark:x
-          {
-            /Name~#2~
-            /FS~#1~
-            /EMBED
-          }
-      }
-  }
-
 %    \end{macrocode}
 % \begin{function}[added = 2020-04-24]
 %   {\pdffile_attach:n, \pdffile_attach:nN,}





More information about the latex3-commits mailing list.