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.dtx141
1 files changed, 99 insertions, 42 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx
index d5dd4f94a97..0ab572e458c 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 2018-05-13}
+% \date{Released 2018-06-01}
%
% \maketitle
%
@@ -1415,14 +1415,16 @@
% \emph{etc.})
% \end{function}
%
-% \begin{function}[added = 2018-04-02]{\char_codepoint_to_bytes:n}
+% \begin{function}[added = 2018-06-01, EXP]{\char_codepoint_to_bytes:n}
% \begin{syntax}
% \cs{char_codepoint_to_bytes:n} \Arg{codepoint}
% \end{syntax}
% Converts the (Unicode) \meta{codepoint} to UTF-8 bytes. The expansion
-% of this function comprises a leading integer (|1|--|4|) followed by the
-% appropriate number of brace groups, each of which contains one byte of
-% the UTF-8 sequence for the codepoint.
+% of this function comprises four brace groups, each of which will contain
+% a hexadecimal value: the appropriate byte. As UTF-8 is a variable-length,
+% one or more of the grouos may be empty: the bytes read in the logical order,
+% such that a two-byte codepoint will have groups |#1| and |#2| filled
+% and |#3| and |#4| empty.
% \end{function}
%
% \begin{function}[TF, updated = 2012-12-20]{\peek_N_type:}
@@ -2180,22 +2182,22 @@
{ \l_@@_full_name_str }
}
}
- \sys_if_engine_xetex:T
+ \cs_if_exist:NF \tex_filesize:D
{
\cs_set_protected:Npn \@@_get_details:nnN #1#2#3
{
\tl_clear:N #3
\__kernel_msg_error:nnx
- { kernel } { xetex-primitive-not-available }
- { \exp_not:c { pdffile #2 } }
+ { kernel } { primitive-not-available }
+ { \exp_not:c { (pdf)file #2 } }
}
}
}
-\__kernel_msg_new:nnnn { kernel } { xetex-primitive-not-available }
+\__kernel_msg_new:nnnn { kernel } { primitive-not-available }
{ Primitive~\token_to_str:N #1 not~available }
{
- XeTeX~does~not~currently~provide~functionality~equivalent~to~the~
- \token_to_str:N #1 primitive.
+ The~version~of~XeTeX~in~use~does~not~provide~functionality~equivalent~to~
+ the~\token_to_str:N #1 primitive.
}
% \end{macrocode}
% \end{macro}
@@ -3192,9 +3194,17 @@
% \begin{macro}[EXP]{\@@_codepoint_to_bytes_auxi:n}
% \begin{macro}[EXP]{\@@_codepoint_to_bytes_auxii:Nnn}
% \begin{macro}[EXP]{\@@_codepoint_to_bytes_auxiii:n}
+% \begin{macro}[EXP]
+% {
+% \@@_codepoint_to_bytes_outputi:nw ,
+% \@@_codepoint_to_bytes_outputii:nw ,
+% \@@_codepoint_to_bytes_outputiii:nw ,
+% \@@_codepoint_to_bytes_outputiv:nw
+% }
+% \begin{macro}[EXP]
+% {\@@_codepoint_to_bytes_output:nnn, \@@_codepoint_to_bytes_output:fnn}
+% \begin{macro}[EXP]{\@@_codepoint_to_bytes_end:}
% This code converts a codepoint into the correct UTF-8 representation.
-% As there are a variable number of octets, the result starts with the
-% numeral |1|--|4| to indicate the nature of the returned value.
% In terms of the algorithm itself, see
% \url{https://en.wikipedia.org/wiki/UTF-8} for the octet pattern.
% \begin{macrocode}
@@ -3207,40 +3217,83 @@
{
\if_int_compare:w #1 > "80 \exp_stop_f:
\if_int_compare:w #1 < "800 \exp_stop_f:
- 2
- \@@_codepoint_to_bytes_auxii:Nnn C {#1} { 64 }
- \@@_codepoint_to_bytes_auxiii:n {#1}
+ \@@_codepoint_to_bytes_outputi:nw
+ { \@@_codepoint_to_bytes_auxii:Nnn C {#1} { 64 } }
+ \@@_codepoint_to_bytes_outputii:nw
+ { \@@_codepoint_to_bytes_auxiii:n {#1} }
\else:
\if_int_compare:w #1 < "10000 \exp_stop_f:
- 3
- \@@_codepoint_to_bytes_auxii:Nnn E {#1} { 64 * 64 }
- \@@_codepoint_to_bytes_auxiii:n
- { \int_div_truncate:nn {#1} { 64 } }
- \@@_codepoint_to_bytes_auxiii:n {#1}
+ \@@_codepoint_to_bytes_outputi:nw
+ { \@@_codepoint_to_bytes_auxii:Nnn E {#1} { 64 * 64 } }
+ \@@_codepoint_to_bytes_outputii:nw
+ {
+ \@@_codepoint_to_bytes_auxiii:n
+ { \int_div_truncate:nn {#1} { 64 } }
+ }
+ \@@_codepoint_to_bytes_outputiii:nw
+ { \@@_codepoint_to_bytes_auxiii:n {#1} }
\else:
- 4
- \@@_codepoint_to_bytes_auxii:Nnn F
- {#1} { 64 * 64 * 64 }
- \@@_codepoint_to_bytes_auxiii:n
- { \int_div_truncate:nn {#1} { 64 * 64 } }
- \@@_codepoint_to_bytes_auxiii:n
- { \int_div_truncate:nn {#1} { 64 } }
- \@@_codepoint_to_bytes_auxiii:n {#1}
+ \@@_codepoint_to_bytes_outputi:nw
+ {
+ \@@_codepoint_to_bytes_auxii:Nnn F
+ {#1} { 64 * 64 * 64 }
+ }
+ \@@_codepoint_to_bytes_outputii:nw
+ {
+ \@@_codepoint_to_bytes_auxiii:n
+ { \int_div_truncate:nn {#1} { 64 * 64 } }
+ }
+ \@@_codepoint_to_bytes_outputiii:nw
+ {
+ \@@_codepoint_to_bytes_auxiii:n
+ { \int_div_truncate:nn {#1} { 64 } }
+ }
+ \@@_codepoint_to_bytes_outputiv:nw
+ { \@@_codepoint_to_bytes_auxiii:n {#1} }
\fi:
\fi:
\else:
- 1 {#1}
+ \@@_codepoint_to_bytes_outputi:nw {#1}
\fi:
+ \@@_codepoint_to_bytes_end: { } { } { } { }
}
\cs_new:Npn \@@_codepoint_to_bytes_auxii:Nnn #1#2#3
- { { \int_eval:n { "#10 + \int_div_truncate:nn {#2} {#3} } } }
+ { "#10 + \int_div_truncate:nn {#2} {#3} }
\cs_new:Npn \@@_codepoint_to_bytes_auxiii:n #1
- { { \int_eval:n { \int_mod:nn {#1} { 64 } + 128 } } }
+ { \int_mod:nn {#1} { 64 } + 128 }
+\cs_new:Npn \@@_codepoint_to_bytes_outputi:nw
+ #1 #2 \@@_codepoint_to_bytes_end: #3
+ { \@@_codepoint_to_bytes_output:fnn { \int_eval:n {#1} } { } {#2} }
+\cs_new:Npn \@@_codepoint_to_bytes_outputii:nw
+ #1 #2 \@@_codepoint_to_bytes_end: #3#4
+ { \@@_codepoint_to_bytes_output:fnn { \int_eval:n {#1} } { {#3} } {#2} }
+\cs_new:Npn \@@_codepoint_to_bytes_outputiii:nw
+ #1 #2 \@@_codepoint_to_bytes_end: #3#4#5
+ {
+ \@@_codepoint_to_bytes_output:fnn
+ { \int_eval:n {#1} } { {#3} {#4} } {#2}
+ }
+\cs_new:Npn \@@_codepoint_to_bytes_outputiv:nw
+ #1 #2 \@@_codepoint_to_bytes_end: #3#4#5#6
+ {
+ \@@_codepoint_to_bytes_output:fnn
+ { \int_eval:n {#1} } { {#3} {#4} {#5} } {#2}
+ }
+\cs_new:Npn \@@_codepoint_to_bytes_output:nnn #1#2#3
+ {
+ #3
+ \@@_codepoint_to_bytes_end: #2 {#1}
+ }
+\cs_generate_variant:Nn \@@_codepoint_to_bytes_output:nnn { f }
+\cs_new:Npn \@@_codepoint_to_bytes_end: { }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macrocode}
%<@@=tl>
@@ -4214,21 +4267,25 @@
\cs_set_protected:Npn \@@_tmp:w #1#2
{
\tl_const:Nx #1
- { \char_generate:nn {"#2} { \char_value_catcode:n {"#2} } }
+ {
+ \exp_after:wN \exp_after:wN \exp_after:wN
+ \exp_not:N \char_generate:nn
+ {"#2} { \char_value_catcode:n {"#2} }
+ }
}
}
{
\cs_set_protected:Npn \@@_tmp:w #1#2
{
\group_begin:
- \cs_set_protected:Npn \@@_tmp:w ##1##2##3
+ \cs_set_protected:Npn \@@_tmp:w ##1##2##3##4
{
\tl_const:Nx #1
{
\exp_after:wN \exp_after:wN \exp_after:wN
- \exp_not:N \char_generate:nn {##2} { 13 }
+ \exp_not:N \char_generate:nn {##1} { 13 }
\exp_after:wN \exp_after:wN \exp_after:wN
- \exp_not:N \char_generate:nn {##3} { 13 }
+ \exp_not:N \char_generate:nn {##2} { 13 }
}
}
\tl_set:Nx \l_@@_internal_a_tl
@@ -4267,13 +4324,13 @@
\exp_after:wN \@@_tmp:w \l_@@_internal_a_tl
\@@_loop:nn
}
- \cs_set_protected:Npn \@@_tmp:w #1#2#3#4#5#6
+ \cs_set_protected:Npn \@@_tmp:w #1#2#3#4#5#6#7#8
{
\tl_const:cx
{
c_@@_lower_case_
+ \char_generate:nn {#1} { 12 }
\char_generate:nn {#2} { 12 }
- \char_generate:nn {#3} { 12 }
_tl
}
{
@@ -4291,9 +4348,9 @@
}
{
\exp_after:wN \exp_after:wN \exp_after:wN
- \exp_not:N \char_generate:nn {#2} { 13 }
+ \exp_not:N \char_generate:nn {#1} { 13 }
\exp_after:wN \exp_after:wN \exp_after:wN
- \exp_not:N \char_generate:nn {#3} { 13 }
+ \exp_not:N \char_generate:nn {#2} { 13 }
}
}
\@@_loop:nn
@@ -4401,13 +4458,13 @@
\cs_set_protected:Npn \@@_tmp:w #1#2#3
{
\group_begin:
- \cs_set_protected:Npn \@@_tmp:w ##1##2##3
+ \cs_set_protected:Npn \@@_tmp:w ##1##2##3##4
{
\tl_const:cx
{
c_@@_ #3 _case_
+ \char_generate:nn {##1} { 12 }
\char_generate:nn {##2} { 12 }
- \char_generate:nn {##3} { 12 }
_tl
}
{#2}