summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx342
1 files changed, 190 insertions, 152 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
index 627f4eba9e0..aeb2ce1469b 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
@@ -42,7 +42,7 @@
% }^^A
% }
%
-% \date{Released 2017/05/13}
+% \date{Released 2017/05/29}
%
% \maketitle
%
@@ -201,89 +201,6 @@
% an error if the file is not found, in contrast to \cs{file_input:n}.
% \end{function}
%
-% \begin{function}[added = 2012-02-11]{\ior_map_inline:Nn}
-% \begin{syntax}
-% \cs{ior_map_inline:Nn} \meta{stream} \Arg{inline function}
-% \end{syntax}
-% Applies the \meta{inline function} to \meta{lines} obtained by
-% reading one or more lines (until an equal number of left and right
-% braces are found) from the \meta{stream}. The \meta{inline function}
-% should consist of code which will receive the \meta{line} as |#1|.
-% Note that \TeX{} removes trailing space and tab characters
-% (character codes 32 and 9) from every line upon input. \TeX{} also
-% ignores any trailing new-line marker from the file it reads.
-% \end{function}
-%
-% \begin{function}[added = 2012-02-11]{\ior_str_map_inline:Nn}
-% \begin{syntax}
-% \cs{ior_str_map_inline:Nn} \Arg{stream} \Arg{inline function}
-% \end{syntax}
-% Applies the \meta{inline function} to every \meta{line}
-% in the \meta{stream}. The material is read from the \meta{stream}
-% as a series of tokens with category code $12$ (other), with the
-% exception of space characters which are given category code $10$
-% (space). The \meta{inline function} should consist of code which
-% will receive the \meta{line} as |#1|.
-% Note that \TeX{} removes trailing space and tab characters
-% (character codes 32 and 9) from every line upon input. \TeX{} also
-% ignores any trailing new-line marker from the file it reads.
-% \end{function}
-%
-% \begin{function}[added = 2012-06-29]{\ior_map_break:}
-% \begin{syntax}
-% \cs{ior_map_break:}
-% \end{syntax}
-% Used to terminate a \cs[no-index]{ior_map_\ldots} function before all
-% lines from the \meta{stream} have been processed. This will
-% normally take place within a conditional statement, for example
-% \begin{verbatim}
-% \ior_map_inline:Nn \l_my_ior
-% {
-% \str_if_eq:nnTF { #1 } { bingo }
-% { \ior_map_break: }
-% {
-% % Do something useful
-% }
-% }
-% \end{verbatim}
-% Use outside of a \cs[no-index]{ior_map_\ldots} scenario will lead to low
-% level \TeX{} errors.
-% \begin{texnote}
-% When the mapping is broken, additional tokens may be inserted by the
-% internal macro \cs{__prg_break_point:Nn} before further items are taken
-% from the input stream. This will depend on the design of the mapping
-% function.
-% \end{texnote}
-% \end{function}
-%
-% \begin{function}[added = 2012-06-29]{\ior_map_break:n}
-% \begin{syntax}
-% \cs{ior_map_break:n} \Arg{tokens}
-% \end{syntax}
-% Used to terminate a \cs[no-index]{ior_map_\ldots} function before all
-% lines in the \meta{stream} have been processed, inserting
-% the \meta{tokens} after the mapping has ended. This will
-% normally take place within a conditional statement, for example
-% \begin{verbatim}
-% \ior_map_inline:Nn \l_my_ior
-% {
-% \str_if_eq:nnTF { #1 } { bingo }
-% { \ior_map_break:n { <tokens> } }
-% {
-% % Do something useful
-% }
-% }
-% \end{verbatim}
-% Use outside of a \cs[no-index]{ior_map_\ldots} scenario will lead to low
-% level \TeX{} errors.
-% \begin{texnote}
-% When the mapping is broken, additional tokens may be inserted by the
-% internal macro \cs{__prg_break_point:Nn} before the \meta{tokens} are
-% inserted into the input stream.
-% This will depend on the design of the mapping function.
-% \end{texnote}
-% \end{function}
-%
% \begin{function}[added = 2014-08-22]
% {\ior_log_streams:, \iow_log_streams:}
% \begin{syntax}
@@ -475,7 +392,7 @@
%
% \section{Additions to \pkg{l3sys}}
%
-% \begin{function}[added = 2017-04-12, EXP, pTF]{\sys_if_rand_exist:}
+% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_rand_exist:}
% \begin{syntax}
% \cs{sys_if_rand_exist_p:}
% \cs{sys_if_rand_exist:TF} \Arg{true code} \Arg{false code}
@@ -484,7 +401,7 @@
% this is the case in \pdfTeX{} and \LuaTeX{}.
% \end{function}
%
-% \begin{function}[added = 2017-04-12, EXP]{\sys_rand_seed:}
+% \begin{function}[added = 2017-05-27, EXP]{\sys_rand_seed:}
% \begin{syntax}
% \cs{sys_rand_seed:}
% \end{syntax}
@@ -493,7 +410,7 @@
% expands to $0$.
% \end{function}
%
-% \begin{function}[added = 2017-04-12]{\sys_gset_rand_seed:n}
+% \begin{function}[added = 2017-05-27]{\sys_gset_rand_seed:n}
% \begin{syntax}
% \cs{sys_gset_rand_seed:n} \Arg{intexpr}
% \end{syntax}
@@ -506,6 +423,61 @@
% random number support this produces an error.
% \end{function}
%
+% \begin{variable}[added = 2017-05-27]{\c_sys_shell_escape_int}
+% This variable exposes the internal triple of the shell escape
+% status. The possible values are
+% \begin{description}
+% \item[0] Shell escape is disabled
+% \item[1] Unrestricted shell escape is enabled
+% \item[2] Restricted shell escape is enabled
+% \end{description}
+% \end{variable}
+%
+% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell:}
+% \begin{syntax}
+% \cs{sys_if_shell_p:}
+% \cs{sys_if_shell:TF} \Arg{true code} \Arg{false code}
+% \end{syntax}
+% Performs a check for whether shell escape is enabled. This will
+% return true if either of restricted or unrestircted shell escape
+% is enabled.
+% \end{function}
+%
+% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell_unrestricted:}
+% \begin{syntax}
+% \cs{sys_if_shell_unrestricted_p:}
+% \cs{sys_if_shell_unrestricted:TF} \Arg{true code} \Arg{false code}
+% \end{syntax}
+% Performs a check for whether \emph{unrestricted} shell escape is
+% enabled.
+% \end{function}
+%
+% \begin{function}[added = 2017-05-27, EXP, pTF]{\sys_if_shell_restricted:}
+% \begin{syntax}
+% \cs{sys_if_shell_restricted_p:}
+% \cs{sys_if_shell_restricted:TF} \Arg{true code} \Arg{false code}
+% \end{syntax}
+% Performs a check for whether \emph{restricted} shell escape is
+% enabled. This will return false if unrestricted shell escape is
+% enabled. Unrestricted shell escape is not considered a superset
+% of restricted shell escape in this case. To find whether any
+% shell escape is enabled use \cs{sys_if_shell:}.
+% \end{function}
+%
+% \begin{function}[added = 2017-05-27]{\sys_shell_now:n, \sys_shell_now:x}
+% \begin{syntax}
+% \cs{sys_shell_now:n} \Arg{tokens}
+% \end{syntax}
+% Execute \meta{tokens} through shell escape immediately.
+% \end{function}
+%
+% \begin{function}[added = 2017-05-27]{\sys_shell_shipout:n, \sys_shell_shipout:x}
+% \begin{syntax}
+% \cs{sys_shell_shipout:n} \Arg{tokens}
+% \end{syntax}
+% Execute \meta{tokens} through shell escape at shipout.
+% \end{function}
+%
% \section{Additions to \pkg{l3tl}}
%
% \begin{function}[EXP,pTF]{\tl_if_single_token:n}
@@ -1523,67 +1495,6 @@
}
% \end{macrocode}
% \end{macro}
-%
-% \begin{macrocode}
-%<@@=ior>
-% \end{macrocode}
-%
-% \begin{macro}[EXP]{\ior_map_break:, \ior_map_break:n}
-% Usual map breaking functions. Those are not yet in \pkg{l3kernel}
-% proper since the mapping below is the first of its kind.
-% \begin{macrocode}
-\cs_new:Npn \ior_map_break:
- { \__prg_map_break:Nn \ior_map_break: { } }
-\cs_new:Npn \ior_map_break:n
- { \__prg_map_break:Nn \ior_map_break: }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\ior_map_inline:Nn, \ior_str_map_inline:Nn}
-% \begin{macro}[aux]{\@@_map_inline:NNn}
-% \begin{macro}[aux]{\@@_map_inline:NNNn}
-% \begin{macro}[aux]{\@@_map_inline_loop:NNN}
-% \begin{variable}{\l_@@_internal_tl}
-% Mapping to an input stream can be done on either a token or a string
-% basis, hence the set up. Within that, there is a check to avoid reading
-% past the end of a file, hence the two applications of \cs{ior_if_eof:N}.
-% This mapping cannot be nested with twice the same stream, as the
-% stream has only one \enquote{current line}.
-% \begin{macrocode}
-\cs_new_protected:Npn \ior_map_inline:Nn
- { \@@_map_inline:NNn \ior_get:NN }
-\cs_new_protected:Npn \ior_str_map_inline:Nn
- { \@@_map_inline:NNn \ior_str_get:NN }
-\cs_new_protected:Npn \@@_map_inline:NNn
- {
- \int_gincr:N \g__prg_map_int
- \exp_args:Nc \@@_map_inline:NNNn
- { __prg_map_ \int_use:N \g__prg_map_int :n }
- }
-\cs_new_protected:Npn \@@_map_inline:NNNn #1#2#3#4
- {
- \cs_gset_protected:Npn #1 ##1 {#4}
- \ior_if_eof:NF #3 { \@@_map_inline_loop:NNN #1#2#3 }
- \__prg_break_point:Nn \ior_map_break:
- { \int_gdecr:N \g__prg_map_int }
- }
-\cs_new_protected:Npn \@@_map_inline_loop:NNN #1#2#3
- {
- #2 #3 \l_@@_internal_tl
- \ior_if_eof:NF #3
- {
- \exp_args:No #1 \l_@@_internal_tl
- \@@_map_inline_loop:NNN #1#2#3
- }
- }
-\tl_new:N \l_@@_internal_tl
-% \end{macrocode}
-% \end{variable}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
% \begin{macro}{\ior_log_streams:}
% Redirect output of \cs{ior_list_streams:} to the log.
% \begin{macrocode}
@@ -1592,10 +1503,6 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macrocode}
-%<@@=iow>
-% \end{macrocode}
-%
% \begin{macro}{\iow_log_streams:}
% Redirect output of \cs{iow_list_streams:} to the log.
% \begin{macrocode}
@@ -1976,6 +1883,10 @@
%
% \subsection{Additions to \pkg{l3sys}}
%
+% \begin{macrocode}
+%<@@=sys>
+% \end{macrocode}
+%
% \begin{macro}[EXP, pTF]{\sys_if_rand_exist:}
% Currently, randomness exists under \pdfTeX{} and \LuaTeX{}.
% \begin{macrocode}
@@ -2006,6 +1917,133 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{variable}{\c_sys_shell_escape_int}
+% Expose the engine's shell escape status to the user.
+% \begin{macrocode}
+\int_const:Nn \c_sys_shell_escape_int
+ {
+ \sys_if_engine_luatex:TF
+ {
+ \luatex_directlua:D
+ {
+ tex.sprint((status.shell_escape~or~os.execute()) .. " ")
+ }
+ }
+ {
+ \pdftex_shellescape:D
+ }
+ }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[EXP, pTF]{\sys_if_shell:}
+% Performs a check for whether shell escape is enabled. This will
+% return true if either of restricted or unrestricted shell escape
+% is enabled.
+% \begin{macrocode}
+\prg_new_conditional:Nnn \sys_if_shell: { p , T , F , TF }
+ {
+ \if_int_compare:w \c_sys_shell_escape_int = 0 ~
+ \prg_return_false:
+ \else:
+ \prg_return_true:
+ \fi:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP, pTF]{\sys_if_shell_unrestricted:}
+% Performs a check for whether \emph{unrestricted} shell escape is
+% enabled.
+% \begin{macrocode}
+\prg_new_conditional:Nnn \sys_if_shell_unrestricted: { p , T , F , TF }
+ {
+ \if_int_compare:w \c_sys_shell_escape_int = 1 ~
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP, pTF]{\sys_if_shell_unrestricted:}
+% Performs a check for whether \emph{restricted} shell escape is
+% enabled. This will return false if unrestricted shell escape is
+% enabled. Unrestricted shell escape is not considered a superset
+% of restricted shell escape in this case. To find whether any
+% shell escape is enabled use \cs{sys_if_shell:}.
+% \begin{macrocode}
+\prg_new_conditional:Nnn \sys_if_shell_restricted: { p , T , F , TF }
+ {
+ \if_int_compare:w \c_sys_shell_escape_int = 2 ~
+ \prg_return_true:
+ \else:
+ \prg_return_false:
+ \fi:
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{variable}{\c_@@_shell_stream_int}
+% This is not needed for \LuaTeX{}: shell escape there isn't done using
+% a \TeX{} interface
+% \begin{macrocode}
+\sys_if_engine_luatex:F
+ { \int_const:Nn \c_@@_shell_stream_int { 18 } }
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}{\sys_shell_now:n}
+% Execute commands through shell escape immediately.
+% \begin{macrocode}
+\sys_if_engine_luatex:TF
+ {
+ \cs_new_protected:Npn \sys_shell_now:n #1
+ {
+ \luatex_directlua:D
+ {
+ os.execute("
+ \luatex_luaescapestring:D { \etex_detokenize:D {#1} }
+ ")
+ }
+ }
+ }
+ {
+ \cs_new_protected:Npn \sys_shell_now:n #1
+ {
+ \iow_now:Nn \c_@@_shell_stream_int { #1 }
+ }
+ }
+\cs_generate_variant:Nn \sys_shell_now:n { x }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sys_shell_shipout:n}
+% Execute commands through shell escape at shipout.
+% \begin{macrocode}
+\sys_if_engine_luatex:TF
+ {
+ \cs_new_protected:Npn \sys_shell_shipout:n #1
+ {
+ \luatex_latelua:D
+ {
+ os.execute("
+ \luatex_luaescapestring:D { \etex_detokenize:D {#1} }
+ ")
+ }
+ }
+ }
+ {
+ \cs_new_protected:Npn \sys_shell_shipout:n #1
+ {
+ \iow_shipout:Nn \c_@@_shell_stream_int { #1 }
+ }
+ }
+\cs_generate_variant:Nn \sys_shell_shipout:n { x }
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Additions to \pkg{l3tl}}
%
% \begin{macrocode}