[latex3-commits] [git/LaTeX3-latex3-latex3] main: Adjust PDF object creation to set type at point-of-writing (fixes #1123) (0ea1ad097)
Joseph Wright
joseph.wright at morningstar2.co.uk
Tue Aug 23 16:29:08 CEST 2022
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/0ea1ad0977a9c325a93531eaac7c5936a73ee226
>---------------------------------------------------------------
commit 0ea1ad0977a9c325a93531eaac7c5936a73ee226
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Tue Aug 23 15:22:09 2022 +0100
Adjust PDF object creation to set type at point-of-writing (fixes #1123)
>---------------------------------------------------------------
0ea1ad0977a9c325a93531eaac7c5936a73ee226
l3backend/CHANGELOG.md | 3 +
l3backend/l3backend-color.dtx | 20 ++--
l3backend/l3backend-pdf.dtx | 139 ++++++++++--------------
l3kernel/CHANGELOG.md | 5 +
l3kernel/l3pdf.dtx | 136 +++++++++++++++++------
l3kernel/testfiles-backend/m3color003.tlg | 16 +--
l3kernel/testfiles-backend/m3color003.xetex.tlg | 16 +--
l3kernel/testfiles/m3expl001.luatex.tlg | 5 +-
l3kernel/testfiles/m3expl001.ptex.tlg | 8 +-
l3kernel/testfiles/m3expl001.tlg | 5 +-
l3kernel/testfiles/m3expl001.uptex.tlg | 8 +-
l3kernel/testfiles/m3expl001.xetex.tlg | 5 +-
l3kernel/testfiles/m3expl003.luatex.tlg | 5 +-
l3kernel/testfiles/m3expl003.ptex.tlg | 8 +-
l3kernel/testfiles/m3expl003.tlg | 5 +-
l3kernel/testfiles/m3expl003.uptex.tlg | 8 +-
l3kernel/testfiles/m3expl003.xetex.tlg | 5 +-
17 files changed, 222 insertions(+), 175 deletions(-)
diff --git a/l3backend/CHANGELOG.md b/l3backend/CHANGELOG.md
index 8bf6a9386..e0c728423 100644
--- a/l3backend/CHANGELOG.md
+++ b/l3backend/CHANGELOG.md
@@ -6,6 +6,9 @@ this project uses date-based 'snapshot' version identifiers.
## [Unreleased]
+### Added
+- Support for new approach to writing PDF objects
+
## [2022-08-23]
### Changed
diff --git a/l3backend/l3backend-color.dtx b/l3backend/l3backend-color.dtx
index dabf72842..2d8414fbe 100644
--- a/l3backend/l3backend-color.dtx
+++ b/l3backend/l3backend-color.dtx
@@ -852,8 +852,8 @@
{
\use:x
{
- \pdf_object_new:nn { color \int_use:N \g_@@_model_int } { array }
- \pdf_object_write:nn { color \int_use:N \g_@@_model_int }
+ \pdf_object_new:n { color \int_use:N \g_@@_model_int }
+ \pdf_object_write:nnn { color \int_use:N \g_@@_model_int } { array }
{ /Separation /#1 ~ #2 ~ \pdf_object_ref_last: }
}
\prop_gput:Nnx \g_@@_backend_colorant_prop { /#1 }
@@ -867,8 +867,8 @@
{
\pdf_object_if_exist:nF { @@_illuminant_CIELAB_ #1 }
{
- \pdf_object_new:nn { @@_illuminant_CIELAB_ #1 } { array }
- \pdf_object_write:nx { @@_illuminant_CIELAB_ #1 }
+ \pdf_object_new:n { @@_illuminant_CIELAB_ #1 }
+ \pdf_object_write:nnx { @@_illuminant_CIELAB_ #1 } { array }
{
/Lab ~
<<
@@ -921,8 +921,8 @@
}
\use:x
{
- \pdf_object_new:nn { color \int_use:N \g_@@_model_int } { array }
- \pdf_object_write:nn { color \int_use:N \g_@@_model_int }
+ \pdf_object_new:n { color \int_use:N \g_@@_model_int }
+ \pdf_object_write:nnn { color \int_use:N \g_@@_model_int } { array }
{
/DeviceN ~
[ ~ #1 ~ ] ~
@@ -951,8 +951,8 @@
{
\pdf_object_if_exist:nF { @@_icc_ #1 }
{
- \pdf_object_new:nn { @@_icc_ #1 } { fstream }
- \pdf_object_write:nx { @@_icc_ #1 }
+ \pdf_object_new:n { @@_icc_ #1 }
+ \pdf_object_write:nnx { @@_icc_ #1 } { fstream }
{
{
/N ~ \exp_not:n { #2 } ~
@@ -976,8 +976,8 @@
{
\pdf_object_if_exist:nF { @@_icc_ #1 }
{
- \pdf_object_new:nn { @@_icc_ #1 } { fstream }
- \pdf_object_write:nn { @@_icc_ #1 }
+ \pdf_object_new:n { @@_icc_ #1 }
+ \pdf_object_write:nnn { @@_icc_ #1 } { fstream }
{
{ /N ~ #3 }
{#1}
diff --git a/l3backend/l3backend-pdf.dtx b/l3backend/l3backend-pdf.dtx
index d93ddc4e3..4fde0f167 100644
--- a/l3backend/l3backend-pdf.dtx
+++ b/l3backend/l3backend-pdf.dtx
@@ -105,33 +105,34 @@
%
% \subsubsection{Objects}
%
-% \begin{variable}{\g_@@_backend_object_int, \g_@@_backend_object_prop}
-% For tracking objects to allow finalisation.
+% \begin{variable}{\g_@@_backend_object_int}
+% For tracking objects.
% \begin{macrocode}
\int_new:N \g_@@_backend_object_int
-\prop_new:N \g_@@_backend_object_prop
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\@@_backend_object_new:nn}
+% \begin{macro}{\@@_backend_object_new:n}
% \begin{macro}[EXP]{\@@_backend_object_ref:n}
-% Tracking objects is similar to \texttt{dvipdfmx}.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_object_new:nn #1#2
+\cs_new_protected:Npn \@@_backend_object_new:n #1
{
\int_gincr:N \g_@@_backend_object_int
\int_const:cn
- { c_@@_backend_object_ \tl_to_str:n {#1} _int }
+ { c_@@_object_ \tl_to_str:n {#1} _int }
{ \g_@@_backend_object_int }
- \prop_gput:Nnn \g_@@_backend_object_prop {#1} {#2}
}
\cs_new:Npn \@@_backend_object_ref:n #1
- { { pdf.obj \int_use:c { c_@@_backend_object_ \tl_to_str:n {#1} _int } } }
+ { { pdf.obj \int_use:c { c_@@_object_ \tl_to_str:n {#1} _int } } }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\@@_backend_object_write:nn, \@@_backend_object_write:nx}
+% \begin{macro}
+% {
+% \@@_backend_object_write:nnn, \@@_backend_object_write:nnx,
+% \@@_backend_object_write_aux:nnn
+% }
% \begin{macro}
% {
% \@@_backend_object_write_array:nn ,
@@ -141,16 +142,23 @@
% }
% \begin{macro}{\@@_backend_object_write_stream:nnn}
% This is where we choose the actual type: some work to get things
-% right.
+% right. To allow code sharing with the anonymous version, we use an
+% auxiliary.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_object_write:nn #1#2
+\cs_new_protected:Npn \@@_backend_object_write:nnn #1#2#3
+ {
+ \@@_backend_object_write_aux:nnn
+ { \@@_backend_object_ref:n {#1} }
+ {#2} {#3}
+ }
+\cs_generate_variant:Nn \@@_backend_object_write:nnn { nnx }
+\cs_new_protected:Npn \@@_backend_object_write_aux:nnn #1#2#3
{
\@@_backend_pdfmark:x
{
- /_objdef ~ \@@_backend_object_ref:n {#1}
+ /_objdef ~ #1
/type
- \str_case_e:nn
- { \prop_item:Nn \g_@@_backend_object_prop {#1} }
+ \str_case:nn {#2}
{
{ array } { /array }
{ dict } { /dict }
@@ -159,11 +167,8 @@
}
/OBJ
}
- \use:c
- { @@_backend_object_write_ \prop_item:Nn \g_@@_backend_object_prop {#1} :nn }
- { \@@_backend_object_ref:n {#1} } {#2}
+ \use:c { @@_backend_object_write_ #2 :nn } {#1} {#3}
}
-\cs_generate_variant:Nn \@@_backend_object_write:nn { nx }
\cs_new_protected:Npn \@@_backend_object_write_array:nn #1#2
{
\@@_backend_pdfmark:x
@@ -213,22 +218,9 @@
\cs_new_protected:Npn \@@_backend_object_now:nn #1#2
{
\int_gincr:N \g_@@_backend_object_int
- \@@_backend_pdfmark:x
- {
- /_objdef ~ { pdf.obj \int_use:N \g_@@_backend_object_int }
- /type
- \str_case:nn
- {#1}
- {
- { array } { /array }
- { dict } { /dict }
- { fstream } { /stream }
- { stream } { /stream }
- }
- /OBJ
- }
- \exp_args:Nnx \use:c { @@_backend_object_write_ #1 :nn }
- { { pdf.obj \int_use:N \g_@@_backend_object_int } } {#2}
+ \@@_backend_object_write_aux:nnn
+ { pdf.obj \int_use:N \g_@@_backend_object_int }
+ {#1} {#2}
}
\cs_generate_variant:Nn \@@_backend_object_now:nn { nx }
% \end{macrocode}
@@ -971,12 +963,12 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\@@_backend_object_new:nn}
+% \begin{macro}{\@@_backend_object_new:n}
% \begin{macro}[EXP]{\@@_backend_object_ref:n}
% Declaring objects means reserving at the PDF level plus starting
% tracking.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_object_new:nn #1#2
+\cs_new_protected:Npn \@@_backend_object_new:n #1
{
%<*luatex>
\tex_pdfextension:D obj ~
@@ -986,27 +978,27 @@
%</pdftex>
reserveobjnum ~
\int_const:cn
- { c_@@_backend_object_ \tl_to_str:n {#1} _int }
+ { c_@@_object_ \tl_to_str:n {#1} _int }
%<*luatex>
{ \tex_pdffeedback:D lastobj }
%</luatex>
%<*pdftex>
{ \tex_pdflastobj:D }
%</pdftex>
- \prop_gput:Nnn \g_@@_backend_object_prop {#1} {#2}
}
\cs_new:Npn \@@_backend_object_ref:n #1
- { \int_use:c { c_@@_backend_object_ \tl_to_str:n {#1} _int } ~ 0 ~ R }
+ { \int_use:c { c_@@_object_ \tl_to_str:n {#1} _int } ~ 0 ~ R }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\@@_backend_object_write:nn,\@@_backend_object_write:nx}
+% \begin{macro}{\@@_backend_object_write:nnn, \@@_backend_object_write:nnx}
+% \begin{macro}[EXP]{\@@_backend_object_write:nn}
% \begin{macro}[EXP]{\@@_exp_not_i:nn, \@@_exp_not_ii:nn}
% Writing the data needs a little information about the structure of the
% object.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_object_write:nn #1#2
+\cs_new_protected:Npn \@@_backend_object_write:nnn #1#2#3
{
%<*luatex>
\tex_immediate:D \tex_pdfextension:D obj ~
@@ -1016,9 +1008,12 @@
%</pdftex>
useobjnum ~
\int_use:c
- { c_@@_backend_object_ \tl_to_str:n {#1} _int }
- \str_case_e:nn
- { \prop_item:Nn \g_@@_backend_object_prop {#1} }
+ { c_@@_object_ \tl_to_str:n {#1} _int }
+ \@@_backend_object_write:nn {#2} {#3}
+ }
+\cs_new:Npn \@@_backend_object_write:nn #1#2
+ {
+ \str_case:nn {#1}
{
{ array } { { [ ~ \exp_not:n {#2} ~ ] } }
{ dict } { { << ~ \exp_not:n {#2} ~ >> } }
@@ -1034,12 +1029,13 @@
}
}
}
-\cs_generate_variant:Nn \@@_backend_object_write:nn { nx }
+\cs_generate_variant:Nn \@@_backend_object_write:nnn { nnx }
\cs_new:Npn \@@_exp_not_i:nn #1#2 { \exp_not:n {#1} }
\cs_new:Npn \@@_exp_not_ii:nn #1#2 { \exp_not:n {#2} }
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\@@_backend_object_now:nn, \@@_backend_object_now:nx}
% Much like writing, but direct creation.
@@ -1052,22 +1048,7 @@
%<*pdftex>
\tex_immediate:D \tex_pdfobj:D
%</pdftex>
- \str_case:nn
- {#1}
- {
- { array } { { [ ~ \exp_not:n {#2} ~ ] } }
- { dict } { { << ~ \exp_not:n {#2} ~ >> } }
- { fstream }
- {
- stream ~ attr ~ { \@@_exp_not_i:nn #2 } ~
- file ~ { \@@_exp_not_ii:nn #2 }
- }
- { stream }
- {
- stream ~ attr ~ { \@@_exp_not_i:nn #2 } ~
- { \@@_exp_not_ii:nn #2 }
- }
- }
+ \@@_backend_object_write:nn {#1} {#2}
}
\cs_generate_variant:Nn \@@_backend_object_now:nn { nx }
% \end{macrocode}
@@ -1267,27 +1248,25 @@
% \end{macrocode}
% \end{variable}
%
-% \begin{macro}{\@@_backend_object_new:nn}
+% \begin{macro}{\@@_backend_object_new:n}
% \begin{macro}[EXP]{\@@_backend_object_ref:n}
% Objects are tracked at the macro level, but we don't have to do anything
% at this stage.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_object_new:nn #1#2
+\cs_new_protected:Npn \@@_backend_object_new:n #1
{
\int_gincr:N \g_@@_backend_object_int
\int_const:cn
- { c_@@_backend_object_ \tl_to_str:n {#1} _int }
+ { c_@@_object_ \tl_to_str:n {#1} _int }
{ \g_@@_backend_object_int }
- \prop_gput:Nnn \g_@@_backend_object_prop {#1} {#2}
}
\cs_new:Npn \@@_backend_object_ref:n #1
- { @pdf.obj \int_use:c { c_@@_backend_object_ \tl_to_str:n {#1} _int } }
+ { @pdf.obj \int_use:c { c_@@_object_ \tl_to_str:n {#1} _int } }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\@@_backend_object_write:nn, \@@_backend_object_write:nx}
-% \begin{macro}{\@@_backend_object_write:nnn}
+% \begin{macro}{\@@_backend_object_write:nnn, \@@_backend_object_write:nnx}
% \begin{macro}
% {
% \@@_backend_object_write_array:nn ,
@@ -1298,17 +1277,12 @@
% \begin{macro}{\@@_backend_object_write_stream:nnnn}
% This is where we choose the actual type.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_object_write:nn #1#2
- {
- \exp_args:Nx \@@_backend_object_write:nnn
- { \prop_item:Nn \g_@@_backend_object_prop {#1} } {#1} {#2}
- }
-\cs_generate_variant:Nn \@@_backend_object_write:nn { nx }
\cs_new_protected:Npn \@@_backend_object_write:nnn #1#2#3
{
- \use:c { @@_backend_object_write_ #1 :nn }
- { \@@_backend_object_ref:n {#2} } {#3}
+ \use:c { @@_backend_object_write_ #2 :nn }
+ { \@@_backend_object_ref:n {#1} } {#3}
}
+\cs_generate_variant:Nn \@@_backend_object_write:nnn { nnx }
\cs_new_protected:Npn \@@_backend_object_write_array:nn #1#2
{
\@@_backend:x
@@ -1335,7 +1309,6 @@
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\@@_backend_object_now:nn, \@@_backend_object_now:nx}
% No anonymous objects with \texttt{dvipdfmx} so we have to give an
@@ -1659,18 +1632,18 @@
%
% \subsubsection{Objects}
%
-% \begin{macro}{\@@_backend_object_new:nn}
+% \begin{macro}{\@@_backend_object_new:n}
% \begin{macro}[EXP]{\@@_backend_object_ref:n}
-% \begin{macro}{\@@_backend_object_write:nn, , \@@_backend_object_write:nx}
+% \begin{macro}{\@@_backend_object_write:nnn, \@@_backend_object_write:nx}
% \begin{macro}{\@@_backend_object_now:nn, , \@@_backend_object_now:nx}
% \begin{macro}{\@@_backend_object_last:}
% \begin{macro}[EXP]{\@@_backend_pageobject_ref:n}
% All no-ops here.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_backend_object_new:nn #1#2 { }
+\cs_new_protected:Npn \@@_backend_object_new:nn #1 { }
\cs_new:Npn \@@_backend_object_ref:n #1 { }
-\cs_new_protected:Npn \@@_backend_object_write:nn #1#2 { }
-\cs_new_protected:Npn \@@_backend_object_write:nx #1#2 { }
+\cs_new_protected:Npn \@@_backend_object_write:nnn #1#2#3 { }
+\cs_new_protected:Npn \@@_backend_object_write:nnx #1#2#3 { }
\cs_new_protected:Npn \@@_backend_object_now:nn #1#2 { }
\cs_new_protected:Npn \@@_backend_object_now:nx #1#2 { }
\cs_new:Npn \@@_backend_object_last: { }
diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index d747679ef..93fa0d4a9 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -7,6 +7,11 @@ this project uses date-based 'snapshot' version identifiers.
## [Unreleased]
+### Added
+- `\pdf_object_new:n` and `\pdf_object_write:nnn` - support assignment of object
+ type at point-of-writing (issue
+ [\#1123](https://github.com/latex3/latex3/issues/1123))
+
## [2022-08-23]
### Added
diff --git a/l3kernel/l3pdf.dtx b/l3kernel/l3pdf.dtx
index 5a28010dd..2fe704f5a 100644
--- a/l3kernel/l3pdf.dtx
+++ b/l3kernel/l3pdf.dtx
@@ -51,32 +51,18 @@
%
% \section{Objects}
%
-% \begin{function}[added = 2021-02-10]{\pdf_object_new:nn}
-% \begin{syntax}
-% \cs{pdf_object_new:nn} \Arg{object} \Arg{type}
-% \end{syntax}
-% Declares \meta{object} as a PDF object of \meta{type}, which should be
-% one of
-% \begin{itemize}
-% \item \texttt{array}
-% \item \texttt{dict}
-% \item \texttt{fstream}
-% \item \texttt{stream}
-% \end{itemize}
-% The object may be referenced from this point on, and written later
-% using \cs{pdf_object_write:nn}.
-% \end{function}
-% \begin{function}[EXP, pTF, added=2020-05-15]{\pdf_object_if_exist:n}
+% \begin{function}[added = 2022-08-23]{\pdf_object_new:n}
% \begin{syntax}
-% \cs{pdf_object_if_exist_p:n} \Arg{object}
-% \cs{pdf_object_if_exist:nTF} \Arg{object}
+% \cs{pdf_object_new:n} \Arg{object}
% \end{syntax}
-% Tests whether an object with name \Arg{object} has been defined.
+% Declares \meta{object} as a PDF object. The object may be referenced
+% from this point on, and written later using \cs{pdf_object_write:nnn}.
% \end{function}
-% \begin{function}[added = 2021-02-10]
-% {\pdf_object_write:nn, \pdf_object_write:nx}
+%
+% \begin{function}[added = 2022-08-23]
+% {\pdf_object_write:nnn, \pdf_object_write:nnx}
% \begin{syntax}
-% \cs{pdf_object_write:nn} \Arg{object} \Arg{content}
+% \cs{pdf_object_write:nn} \Arg{object} \Arg{type} \Arg{content}
% \end{syntax}
% Writes the \meta{content} as content of the \meta{object}. Depending on the
% \meta{type} declared for the object, the format required for the
@@ -133,6 +119,14 @@
% Inserts the appropriate information to reference the \meta{pageobject}.
% \end{function}
%
+% \begin{function}[EXP, pTF, added = 2020-05-15]{\pdf_object_if_exist:n}
+% \begin{syntax}
+% \cs{pdf_object_if_exist_p:n} \Arg{object}
+% \cs{pdf_object_if_exist:nTF} \Arg{object}
+% \end{syntax}
+% Tests whether an object with name \Arg{object} has been defined.
+% \end{function}
+%
% \section{Version}
%
% \begin{function}[pTF, EXP, added = 2021-02-10]{\pdf_version_compare:Nn}
@@ -250,6 +244,46 @@
% \end{function}
% \end{documentation}
%
+% \section{Deprecated functions}
+%
+% \begin{function}[added = 2021-02-10]{\pdf_object_new:nn}
+% \begin{syntax}
+% \cs{pdf_object_new:nn} \Arg{object} \Arg{type}
+% \end{syntax}
+% Declares \meta{object} as a PDF object of \meta{type}, which should be
+% one of
+% \begin{itemize}
+% \item \texttt{array}
+% \item \texttt{dict}
+% \item \texttt{fstream}
+% \item \texttt{stream}
+% \end{itemize}
+% The object may be referenced from this point on, and written later
+% using \cs{pdf_object_write:nn}.
+%
+% Deprecated in favor of \cs{pdf_object_new:n}.
+% \end{function}
+%
+% \begin{function}[added = 2021-02-10]{\pdf_object_write:nn, \pdf_object_write:nx}
+% \begin{syntax}
+% \cs{pdf_object_write:nn} \Arg{object} \Arg{content}
+% \end{syntax}
+% Writes the \meta{content} as content of the \meta{object}. Depending on the
+% \meta{type} declared for the object, the format required for the
+% \meta{data} will vary
+% \begin{itemize}
+% \item[\texttt{array}] A space-separated list of values
+% \item[\texttt{dict}] Key--value pairs in the form
+% \texttt{/\meta{key} \meta{value}}
+% \item[\texttt{fstream}] Two brace groups: \meta{file name} and
+% \meta{file content}
+% \item[\texttt{stream}] Two brace groups: \meta{attributes (dictionary)}
+% and \meta{stream contents}
+% \end{itemize}
+%
+% Deprecated in favor of \cs{pdf_object_write:nnn}.
+% \end{function}
+%
% \begin{implementation}
%
% \section{\pkg{l3pdf} implementation}
@@ -306,27 +340,23 @@
%
% \subsection{Objects}
%
-% \begin{macro}{\pdf_object_new:nn, \pdf_object_write:nn, \pdf_object_write:nx}
-% \begin{macro}[pTF]{\pdf_object_if_exist:n}
+% \begin{macro}{\pdf_object_new:n}
+% \begin{macro}{\pdf_object_write:nnn, \pdf_object_write:nnx}
% \begin{macro}{\pdf_object_ref:n}
% \begin{macro}{\pdf_object_unnamed_write:nn, \pdf_object_unnamed_write:nx}
% \begin{macro}{\pdf_object_ref_last:}
-% Simple to do.
+% \begin{macro}[pTF]{\pdf_object_if_exist:n}
+% Simple to do: all objects create a constant |int| so it is not a
+% backend-specific name.
% \begin{macrocode}
-\cs_new_protected:Npn \pdf_object_new:nn #1#2
- { \@@_backend_object_new:nn {#1} {#2} }
-\prg_new_conditional:Npnn \pdf_object_if_exist:n #1 { p , T , F , TF }
- {
- \int_if_exist:cTF { c_@@_backend_object_ \tl_to_str:n {#1} _int }
- { \prg_return_true: }
- { \prg_return_false:}
- }
-\cs_new_protected:Npn \pdf_object_write:nn #1#2
+\cs_new_protected:Npn \pdf_object_new:n #1
+ { \@@_backend_object_new:n {#1} }
+\cs_new_protected:Npn \pdf_object_write:nnn #1#2#3
{
- \@@_backend_object_write:nn {#1} {#2}
+ \@@_backend_object_write:nnn {#1} {#2} {#3}
\bool_gset_true:N \g_@@_init_bool
}
-\cs_generate_variant:Nn \pdf_object_write:nn { nx }
+\cs_generate_variant:Nn \pdf_object_write:nnn { nnx }
\cs_new:Npn \pdf_object_ref:n #1 { \@@_backend_object_ref:n {#1} }
\cs_new_protected:Npn \pdf_object_unnamed_write:nn #1#2
{
@@ -335,6 +365,12 @@
}
\cs_generate_variant:Nn \pdf_object_unnamed_write:nn { nx }
\cs_new:Npn \pdf_object_ref_last: { \@@_backend_object_last: }
+\prg_new_conditional:Npnn \pdf_object_if_exist:n #1 { p , T , F , TF }
+ {
+ \int_if_exist:cTF { c_@@_object_ \tl_to_str:n {#1} _int }
+ \prg_return_true:
+ \prg_return_false:
+ }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -450,6 +486,34 @@
}
% \end{macrocode}
% \end{macro}
+%
+% \subsection{Deprecated functions}
+%
+% \begin{variable}{\g_@@_object_prop}
+% For tracking objects.
+% \begin{macrocode}
+\prop_new:N \g_@@_object_prop
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\pdf_object_new:nn, \pdf_object_write:nn, \pdf_object_write:nx}
+% Wrap up the type data in a prop.
+% \begin{macrocode}
+\cs_new_protected:Npn \pdf_object_new:nn #1#2
+ {
+ \prop_gput:Nnn \g_@@_object_prop {#1} {#2}
+ \@@_backend_object_new:n {#1}
+ }
+\cs_new_protected:Npn \pdf_object_write:nn #1#2
+ {
+ \exp_args:Nnx \@@_backend_object_write:nnn
+ {#1} { \prop_item:Nn \g_@@_object_prop {#1} } {#2}
+ \bool_gset_true:N \g_@@_init_bool
+ }
+\cs_generate_variant:Nn \pdf_object_write:nn { nx }
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
%</package>
% \end{macrocode}
diff --git a/l3kernel/testfiles-backend/m3color003.tlg b/l3kernel/testfiles-backend/m3color003.tlg
index f238d2225..0fe16eeec 100644
--- a/l3kernel/testfiles-backend/m3color003.tlg
+++ b/l3kernel/testfiles-backend/m3color003.tlg
@@ -216,7 +216,7 @@ Defining \__color_parse_model_BarToneCMYK:w on line ...
Defining \c__color_fallback_BarToneCMYK_tl on line ...
Defining \__color_convert_BarToneCMYK_cmyk:w on line ...
Defining \__color_convert_cmyk_BarToneCMYK:w on line ...
-Defining \c__pdf_backend_object_color1_int on line ...
+Defining \c__pdf_object_color1_int on line ...
Defining \l__color_named_fooCMYK_tl on line ...
Defining \l__color_named_fooCMYK_prop on line ...
The color fooCMYK has the properties:
@@ -233,7 +233,7 @@ Defining \__color_parse_model_BarToneRGB:w on line ...
Defining \c__color_fallback_BarToneRGB_tl on line ...
Defining \__color_convert_BarToneRGB_rgb:w on line ...
Defining \__color_convert_rgb_BarToneRGB:w on line ...
-Defining \c__pdf_backend_object_color2_int on line ...
+Defining \c__pdf_object_color2_int on line ...
Defining \l__color_named_fooRGB_tl on line ...
Defining \l__color_named_fooRGB_prop on line ...
The color fooRGB has the properties:
@@ -250,7 +250,7 @@ Defining \__color_parse_model_BarToneGray:w on line ...
Defining \c__color_fallback_BarToneGray_tl on line ...
Defining \__color_convert_BarToneGray_gray:w on line ...
Defining \__color_convert_gray_BarToneGray:w on line ...
-Defining \c__pdf_backend_object_color3_int on line ...
+Defining \c__pdf_object_color3_int on line ...
Defining \l__color_named_fooGray_tl on line ...
Defining \l__color_named_fooGray_prop on line ...
The color fooGray has the properties:
@@ -264,8 +264,8 @@ Defining \__color_backend_select_BarToneCIELAB:n on line ...
Defining \__color_model_BarToneCIELAB_white: on line ...
Defining \__color_parse_mix_BarToneCIELAB:nw on line ...
Defining \__color_parse_model_BarToneCIELAB:w on line ...
-Defining \c__pdf_backend_object___color_illuminant_CIELAB_d65_int on line ..
-Defining \c__pdf_backend_object_color4_int on line ...
+Defining \c__pdf_object___color_illuminant_CIELAB_d65_int on line ...
+Defining \c__pdf_object_color4_int on line ...
Defining \c__color_fallback_BarToneCIELAB_tl on line ...
Defining \__color_convert_BarToneCIELAB_gray:w on line ...
Defining \__color_convert_gray_BarToneCIELAB:w on line ...
@@ -425,7 +425,7 @@ Defining \__color_backend_select_TwoUp:n on line ...
Defining \__color_model_TwoUp_white: on line ...
Defining \__color_parse_model_TwoUp:w on line ...
Defining \__color_parse_mix_TwoUp:nw on line ...
-Defining \c__pdf_backend_object_color5_int on line ...
+Defining \c__pdf_object_color5_int on line ...
Defining \c__color_fallback_TwoUp_tl on line ...
Defining \__color_convert_cmyk_TwoUp:w on line ...
Defining \__color_convert_TwoUp_cmyk:w on line ...
@@ -447,7 +447,7 @@ Defining \__color_backend_select_AllIn:n on line ...
Defining \__color_model_AllIn_white: on line ...
Defining \__color_parse_model_AllIn:w on line ...
Defining \__color_parse_mix_AllIn:nw on line ...
-Defining \c__pdf_backend_object_color6_int on line ...
+Defining \c__pdf_object_color6_int on line ...
Defining \c__color_fallback_AllIn_tl on line ...
Defining \__color_convert_cmyk_AllIn:w on line ...
Defining \__color_convert_AllIn_cmyk:w on line ...
@@ -486,7 +486,7 @@ Defining \__color_convert_ICC_gray:w on line ...
Defining \__color_convert_gray_ICC:w on line ...
Defining \__color_parse_model_ICC:w on line ...
Defining \__color_parse_mix_ICC:nw on line ...
-Defining \c__pdf_backend_object___color_icc_sRGB_v4_ICC_preference.icc_int on line ...
+Defining \c__pdf_object___color_icc_sRGB_v4_ICC_preference.icc_int on line ...
<<sRGB_v4_ICC_preference.icc>>
Defining \l__color_named_ICC3_tl on line ...
Defining \l__color_named_ICC3_prop on line ...
diff --git a/l3kernel/testfiles-backend/m3color003.xetex.tlg b/l3kernel/testfiles-backend/m3color003.xetex.tlg
index fd6fb5236..2ef8556bd 100644
--- a/l3kernel/testfiles-backend/m3color003.xetex.tlg
+++ b/l3kernel/testfiles-backend/m3color003.xetex.tlg
@@ -216,7 +216,7 @@ Defining \__color_parse_model_BarToneCMYK:w on line ...
Defining \c__color_fallback_BarToneCMYK_tl on line ...
Defining \__color_convert_BarToneCMYK_cmyk:w on line ...
Defining \__color_convert_cmyk_BarToneCMYK:w on line ...
-Defining \c__pdf_backend_object_color1_int on line ...
+Defining \c__pdf_object_color1_int on line ...
Defining \l__color_named_fooCMYK_tl on line ...
Defining \l__color_named_fooCMYK_prop on line ...
The color fooCMYK has the properties:
@@ -233,7 +233,7 @@ Defining \__color_parse_model_BarToneRGB:w on line ...
Defining \c__color_fallback_BarToneRGB_tl on line ...
Defining \__color_convert_BarToneRGB_rgb:w on line ...
Defining \__color_convert_rgb_BarToneRGB:w on line ...
-Defining \c__pdf_backend_object_color2_int on line ...
+Defining \c__pdf_object_color2_int on line ...
Defining \l__color_named_fooRGB_tl on line ...
Defining \l__color_named_fooRGB_prop on line ...
The color fooRGB has the properties:
@@ -250,7 +250,7 @@ Defining \__color_parse_model_BarToneGray:w on line ...
Defining \c__color_fallback_BarToneGray_tl on line ...
Defining \__color_convert_BarToneGray_gray:w on line ...
Defining \__color_convert_gray_BarToneGray:w on line ...
-Defining \c__pdf_backend_object_color3_int on line ...
+Defining \c__pdf_object_color3_int on line ...
Defining \l__color_named_fooGray_tl on line ...
Defining \l__color_named_fooGray_prop on line ...
The color fooGray has the properties:
@@ -264,8 +264,8 @@ Defining \__color_backend_select_BarToneCIELAB:n on line ...
Defining \__color_model_BarToneCIELAB_white: on line ...
Defining \__color_parse_mix_BarToneCIELAB:nw on line ...
Defining \__color_parse_model_BarToneCIELAB:w on line ...
-Defining \c__pdf_backend_object___color_illuminant_CIELAB_d65_int on line ..
-Defining \c__pdf_backend_object_color4_int on line ...
+Defining \c__pdf_object___color_illuminant_CIELAB_d65_int on line ...
+Defining \c__pdf_object_color4_int on line ...
Defining \c__color_fallback_BarToneCIELAB_tl on line ...
Defining \__color_convert_BarToneCIELAB_gray:w on line ...
Defining \__color_convert_gray_BarToneCIELAB:w on line ...
@@ -425,7 +425,7 @@ Defining \__color_backend_select_TwoUp:n on line ...
Defining \__color_model_TwoUp_white: on line ...
Defining \__color_parse_model_TwoUp:w on line ...
Defining \__color_parse_mix_TwoUp:nw on line ...
-Defining \c__pdf_backend_object_color5_int on line ...
+Defining \c__pdf_object_color5_int on line ...
Defining \c__color_fallback_TwoUp_tl on line ...
Defining \__color_convert_cmyk_TwoUp:w on line ...
Defining \__color_convert_TwoUp_cmyk:w on line ...
@@ -447,7 +447,7 @@ Defining \__color_backend_select_AllIn:n on line ...
Defining \__color_model_AllIn_white: on line ...
Defining \__color_parse_model_AllIn:w on line ...
Defining \__color_parse_mix_AllIn:nw on line ...
-Defining \c__pdf_backend_object_color6_int on line ...
+Defining \c__pdf_object_color6_int on line ...
Defining \c__color_fallback_AllIn_tl on line ...
Defining \__color_convert_cmyk_AllIn:w on line ...
Defining \__color_convert_AllIn_cmyk:w on line ...
@@ -486,7 +486,7 @@ Defining \__color_convert_ICC_gray:w on line ...
Defining \__color_convert_gray_ICC:w on line ...
Defining \__color_parse_model_ICC:w on line ...
Defining \__color_parse_mix_ICC:nw on line ...
-Defining \c__pdf_backend_object___color_icc_sRGB_v4_ICC_preference.icc_int on line ...
+Defining \c__pdf_object___color_icc_sRGB_v4_ICC_preference.icc_int on line ...
Defining \l__color_named_ICC3_tl on line ...
Defining \l__color_named_ICC3_prop on line ...
The color foo has the properties:
diff --git a/l3kernel/testfiles/m3expl001.luatex.tlg b/l3kernel/testfiles/m3expl001.luatex.tlg
index 36db396ad..e80628aed 100644
--- a/l3kernel/testfiles/m3expl001.luatex.tlg
+++ b/l3kernel/testfiles/m3expl001.luatex.tlg
@@ -152,10 +152,11 @@ Defining \__pdf_backend_destination:nnnn on line ...
Defining \__pdf_backend_catalog_gput:nn on line ...
Defining \__pdf_backend_info_gput:nn on line ...
Defining \g__pdf_backend_object_prop on line ...
-Defining \__pdf_backend_object_new:nn on line ...
+Defining \__pdf_backend_object_new:n on line ...
Defining \__pdf_backend_object_ref:n on line ...
+Defining \__pdf_backend_object_write:nnn on line ...
Defining \__pdf_backend_object_write:nn on line ...
-Defining \__pdf_backend_object_write:nx on line ...
+Defining \__pdf_backend_object_write:nnx on line ...
Defining \__pdf_exp_not_i:nn on line ...
Defining \__pdf_exp_not_ii:nn on line ...
Defining \__pdf_backend_object_now:nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.ptex.tlg b/l3kernel/testfiles/m3expl001.ptex.tlg
index 8785b8fe3..191f8e1fb 100644
--- a/l3kernel/testfiles/m3expl001.ptex.tlg
+++ b/l3kernel/testfiles/m3expl001.ptex.tlg
@@ -128,11 +128,11 @@ Defining \__pdf_backend_catalog_gput:nn on line ...
Defining \__pdf_backend_info_gput:nn on line ...
Defining \g__pdf_backend_object_int on line ...
\g__pdf_backend_object_int=\count...
-Defining \g__pdf_backend_object_prop on line ...
-Defining \__pdf_backend_object_new:nn on line ...
+Defining \__pdf_backend_object_new:n on line ...
Defining \__pdf_backend_object_ref:n on line ...
-Defining \__pdf_backend_object_write:nn on line ...
-Defining \__pdf_backend_object_write:nx on line ...
+Defining \__pdf_backend_object_write:nnn on line ...
+Defining \__pdf_backend_object_write:nnx on line ...
+Defining \__pdf_backend_object_write_aux:nnn on line ...
Defining \__pdf_backend_object_write_array:nn on line ...
Defining \__pdf_backend_object_write_dict:nn on line ...
Defining \__pdf_backend_object_write_fstream:nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.tlg b/l3kernel/testfiles/m3expl001.tlg
index ba3648e6b..d60fb9765 100644
--- a/l3kernel/testfiles/m3expl001.tlg
+++ b/l3kernel/testfiles/m3expl001.tlg
@@ -152,10 +152,11 @@ Defining \__pdf_backend_destination:nnnn on line ...
Defining \__pdf_backend_catalog_gput:nn on line ...
Defining \__pdf_backend_info_gput:nn on line ...
Defining \g__pdf_backend_object_prop on line ...
-Defining \__pdf_backend_object_new:nn on line ...
+Defining \__pdf_backend_object_new:n on line ...
Defining \__pdf_backend_object_ref:n on line ...
+Defining \__pdf_backend_object_write:nnn on line ...
Defining \__pdf_backend_object_write:nn on line ...
-Defining \__pdf_backend_object_write:nx on line ...
+Defining \__pdf_backend_object_write:nnx on line ...
Defining \__pdf_exp_not_i:nn on line ...
Defining \__pdf_exp_not_ii:nn on line ...
Defining \__pdf_backend_object_now:nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.uptex.tlg b/l3kernel/testfiles/m3expl001.uptex.tlg
index 8785b8fe3..191f8e1fb 100644
--- a/l3kernel/testfiles/m3expl001.uptex.tlg
+++ b/l3kernel/testfiles/m3expl001.uptex.tlg
@@ -128,11 +128,11 @@ Defining \__pdf_backend_catalog_gput:nn on line ...
Defining \__pdf_backend_info_gput:nn on line ...
Defining \g__pdf_backend_object_int on line ...
\g__pdf_backend_object_int=\count...
-Defining \g__pdf_backend_object_prop on line ...
-Defining \__pdf_backend_object_new:nn on line ...
+Defining \__pdf_backend_object_new:n on line ...
Defining \__pdf_backend_object_ref:n on line ...
-Defining \__pdf_backend_object_write:nn on line ...
-Defining \__pdf_backend_object_write:nx on line ...
+Defining \__pdf_backend_object_write:nnn on line ...
+Defining \__pdf_backend_object_write:nnx on line ...
+Defining \__pdf_backend_object_write_aux:nnn on line ...
Defining \__pdf_backend_object_write_array:nn on line ...
Defining \__pdf_backend_object_write_dict:nn on line ...
Defining \__pdf_backend_object_write_fstream:nn on line ...
diff --git a/l3kernel/testfiles/m3expl001.xetex.tlg b/l3kernel/testfiles/m3expl001.xetex.tlg
index 563d67c95..2c730a01a 100644
--- a/l3kernel/testfiles/m3expl001.xetex.tlg
+++ b/l3kernel/testfiles/m3expl001.xetex.tlg
@@ -148,11 +148,10 @@ Defining \__pdf_backend_info_gput:nn on line ...
Defining \g__pdf_backend_object_int on line ...
\g__pdf_backend_object_int=\count...
Defining \g__pdf_backend_object_prop on line ...
-Defining \__pdf_backend_object_new:nn on line ...
+Defining \__pdf_backend_object_new:n on line ...
Defining \__pdf_backend_object_ref:n on line ...
-Defining \__pdf_backend_object_write:nn on line ...
-Defining \__pdf_backend_object_write:nx on line ...
Defining \__pdf_backend_object_write:nnn on line ...
+Defining \__pdf_backend_object_write:nnx on line ...
Defining \__pdf_backend_object_write_array:nn on line ...
Defining \__pdf_backend_object_write_dict:nn on line ...
Defining \__pdf_backend_object_write_fstream:nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.luatex.tlg b/l3kernel/testfiles/m3expl003.luatex.tlg
index 36db396ad..e80628aed 100644
--- a/l3kernel/testfiles/m3expl003.luatex.tlg
+++ b/l3kernel/testfiles/m3expl003.luatex.tlg
@@ -152,10 +152,11 @@ Defining \__pdf_backend_destination:nnnn on line ...
Defining \__pdf_backend_catalog_gput:nn on line ...
Defining \__pdf_backend_info_gput:nn on line ...
Defining \g__pdf_backend_object_prop on line ...
-Defining \__pdf_backend_object_new:nn on line ...
+Defining \__pdf_backend_object_new:n on line ...
Defining \__pdf_backend_object_ref:n on line ...
+Defining \__pdf_backend_object_write:nnn on line ...
Defining \__pdf_backend_object_write:nn on line ...
-Defining \__pdf_backend_object_write:nx on line ...
+Defining \__pdf_backend_object_write:nnx on line ...
Defining \__pdf_exp_not_i:nn on line ...
Defining \__pdf_exp_not_ii:nn on line ...
Defining \__pdf_backend_object_now:nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.ptex.tlg b/l3kernel/testfiles/m3expl003.ptex.tlg
index 8785b8fe3..191f8e1fb 100644
--- a/l3kernel/testfiles/m3expl003.ptex.tlg
+++ b/l3kernel/testfiles/m3expl003.ptex.tlg
@@ -128,11 +128,11 @@ Defining \__pdf_backend_catalog_gput:nn on line ...
Defining \__pdf_backend_info_gput:nn on line ...
Defining \g__pdf_backend_object_int on line ...
\g__pdf_backend_object_int=\count...
-Defining \g__pdf_backend_object_prop on line ...
-Defining \__pdf_backend_object_new:nn on line ...
+Defining \__pdf_backend_object_new:n on line ...
Defining \__pdf_backend_object_ref:n on line ...
-Defining \__pdf_backend_object_write:nn on line ...
-Defining \__pdf_backend_object_write:nx on line ...
+Defining \__pdf_backend_object_write:nnn on line ...
+Defining \__pdf_backend_object_write:nnx on line ...
+Defining \__pdf_backend_object_write_aux:nnn on line ...
Defining \__pdf_backend_object_write_array:nn on line ...
Defining \__pdf_backend_object_write_dict:nn on line ...
Defining \__pdf_backend_object_write_fstream:nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.tlg b/l3kernel/testfiles/m3expl003.tlg
index ba3648e6b..d60fb9765 100644
--- a/l3kernel/testfiles/m3expl003.tlg
+++ b/l3kernel/testfiles/m3expl003.tlg
@@ -152,10 +152,11 @@ Defining \__pdf_backend_destination:nnnn on line ...
Defining \__pdf_backend_catalog_gput:nn on line ...
Defining \__pdf_backend_info_gput:nn on line ...
Defining \g__pdf_backend_object_prop on line ...
-Defining \__pdf_backend_object_new:nn on line ...
+Defining \__pdf_backend_object_new:n on line ...
Defining \__pdf_backend_object_ref:n on line ...
+Defining \__pdf_backend_object_write:nnn on line ...
Defining \__pdf_backend_object_write:nn on line ...
-Defining \__pdf_backend_object_write:nx on line ...
+Defining \__pdf_backend_object_write:nnx on line ...
Defining \__pdf_exp_not_i:nn on line ...
Defining \__pdf_exp_not_ii:nn on line ...
Defining \__pdf_backend_object_now:nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.uptex.tlg b/l3kernel/testfiles/m3expl003.uptex.tlg
index 8785b8fe3..191f8e1fb 100644
--- a/l3kernel/testfiles/m3expl003.uptex.tlg
+++ b/l3kernel/testfiles/m3expl003.uptex.tlg
@@ -128,11 +128,11 @@ Defining \__pdf_backend_catalog_gput:nn on line ...
Defining \__pdf_backend_info_gput:nn on line ...
Defining \g__pdf_backend_object_int on line ...
\g__pdf_backend_object_int=\count...
-Defining \g__pdf_backend_object_prop on line ...
-Defining \__pdf_backend_object_new:nn on line ...
+Defining \__pdf_backend_object_new:n on line ...
Defining \__pdf_backend_object_ref:n on line ...
-Defining \__pdf_backend_object_write:nn on line ...
-Defining \__pdf_backend_object_write:nx on line ...
+Defining \__pdf_backend_object_write:nnn on line ...
+Defining \__pdf_backend_object_write:nnx on line ...
+Defining \__pdf_backend_object_write_aux:nnn on line ...
Defining \__pdf_backend_object_write_array:nn on line ...
Defining \__pdf_backend_object_write_dict:nn on line ...
Defining \__pdf_backend_object_write_fstream:nn on line ...
diff --git a/l3kernel/testfiles/m3expl003.xetex.tlg b/l3kernel/testfiles/m3expl003.xetex.tlg
index 563d67c95..2c730a01a 100644
--- a/l3kernel/testfiles/m3expl003.xetex.tlg
+++ b/l3kernel/testfiles/m3expl003.xetex.tlg
@@ -148,11 +148,10 @@ Defining \__pdf_backend_info_gput:nn on line ...
Defining \g__pdf_backend_object_int on line ...
\g__pdf_backend_object_int=\count...
Defining \g__pdf_backend_object_prop on line ...
-Defining \__pdf_backend_object_new:nn on line ...
+Defining \__pdf_backend_object_new:n on line ...
Defining \__pdf_backend_object_ref:n on line ...
-Defining \__pdf_backend_object_write:nn on line ...
-Defining \__pdf_backend_object_write:nx on line ...
Defining \__pdf_backend_object_write:nnn on line ...
+Defining \__pdf_backend_object_write:nnx on line ...
Defining \__pdf_backend_object_write_array:nn on line ...
Defining \__pdf_backend_object_write_dict:nn on line ...
Defining \__pdf_backend_object_write_fstream:nn on line ...
More information about the latex3-commits
mailing list.