summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3kernel/l3pdf.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3pdf.dtx')
-rw-r--r--macros/latex/contrib/l3kernel/l3pdf.dtx140
1 files changed, 105 insertions, 35 deletions
diff --git a/macros/latex/contrib/l3kernel/l3pdf.dtx b/macros/latex/contrib/l3kernel/l3pdf.dtx
index 5a28010dde..f02362df38 100644
--- a/macros/latex/contrib/l3kernel/l3pdf.dtx
+++ b/macros/latex/contrib/l3kernel/l3pdf.dtx
@@ -43,7 +43,7 @@
% }^^A
% }
%
-% \date{Released 2022-08-23}
+% \date{Released 2022-08-30}
%
% \maketitle
%
@@ -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,28 @@
%
% \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 }
+\cs_new_protected:Npn \pdf_object_new:n #1
{
- \int_if_exist:cTF { c_@@_backend_object_ \tl_to_str:n {#1} _int }
- { \prg_return_true: }
- { \prg_return_false:}
+ \@@_backend_object_new:n {#1}
+ \cs_new_eq:cc
+ { c_@@_backend_object_ \tl_to_str:n {#1} _int }
+ { c_@@_object_ \tl_to_str:n {#1} _int }
}
-\cs_new_protected:Npn \pdf_object_write:nn #1#2
+\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,12 +370,19 @@
}
\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}
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\pdf_pageobject_ref:n}
% \begin{macrocode}
@@ -450,6 +492,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}