summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx325
1 files changed, 133 insertions, 192 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx
index 66a01368167..6fa42db903e 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx
@@ -27,7 +27,6 @@
\documentclass[full]{l3doc}
\usepackage{amsmath}
\begin{document}
- \tableofcontents
\DocInput{\jobname.dtx}
\end{document}
%</driver>
@@ -47,7 +46,7 @@
% }^^A
% }
%
-% \date{Released 2018/03/05}
+% \date{Released 2018-04-30}
%
% \maketitle
%
@@ -151,7 +150,7 @@
% in Tables~\ref{tab:encodings} and~\ref{tab:escapings}, respectively.
% The default escaping is to input and output bytes directly. The
% special case of an empty \meta{name} indicates the use of
-% \enquote{native} strings, 8-bit for pdf\TeX{}, and Unicode strings
+% \enquote{native} strings, 8-bit for \pdfTeX{}, and Unicode strings
% for the other two engines.
%
% For example,
@@ -190,23 +189,6 @@
% encoding. Instead, the \meta{false code} is performed.
% \end{function}
%
-% \section{Internal string functions}
-%
-% \begin{function}{\__str_hexadecimal_use:NTF}
-% \begin{syntax}
-% \cs{__str_hexadecimal_use:NTF} \meta{token} \Arg{true code} \Arg{false code}
-% \end{syntax}
-% If the \meta{token} is a hexadecimal digit (upper case or lower
-% case), its upper-case version is left in the input stream,
-% \emph{followed} by the \meta{true code}. Otherwise, the \meta{false
-% code} is left in the input stream.
-% \begin{texnote}
-% This function fails on some inputs if the escape character is a
-% hexadecimal digit. We are thus careful to set the escape
-% character to a known (safe) value before using it.
-% \end{texnote}
-% \end{function}
-%
% \section{Possibilities, and things to do}
%
% Encoding/escaping-related tasks.
@@ -252,7 +234,7 @@
% \end{macrocode}
%
% \begin{macrocode}
-\ProvidesExplPackage{l3str-convert}{2018/03/05}{}
+\ProvidesExplPackage{l3str-convert}{2018-04-30}{}
{L3 Experimental string encoding conversions}
% \end{macrocode}
%
@@ -371,14 +353,14 @@
\prg_new_conditional:Npnn \@@_if_contains_char:NN #1#2 { T , TF }
{
\exp_after:wN \@@_if_contains_char_aux:NN \exp_after:wN #2
- #1 { \__prg_break:n { ? \fi: } }
- \__prg_break_point:
+ #1 { \prg_break:n { ? \fi: } }
+ \prg_break_point:
\prg_return_false:
}
\prg_new_conditional:Npnn \@@_if_contains_char:nN #1#2 { TF }
{
- \@@_if_contains_char_aux:NN #2 #1 { \__prg_break:n { ? \fi: } }
- \__prg_break_point:
+ \@@_if_contains_char_aux:NN #2 #1 { \prg_break:n { ? \fi: } }
+ \prg_break_point:
\prg_return_false:
}
\cs_new:Npn \@@_if_contains_char_aux:NN #1#2
@@ -389,7 +371,7 @@
\@@_if_contains_char_aux:NN #1
}
\cs_new:Npn \@@_if_contains_char_true:
- { \__prg_break:n { \prg_return_true: \use_none:n } }
+ { \prg_break:n { \prg_return_true: \use_none:n } }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -434,9 +416,7 @@
\if_int_compare:w 1 < "1 \token_to_str:N #1 \exp_stop_f:
#1 \prg_return_true:
\else:
- \if_case:w \__int_eval:w
- \exp_after:wN ` \token_to_str:N #1 - `a
- \__int_eval_end:
+ \if_case:w \int_eval:n { \exp_after:wN ` \token_to_str:N #1 - `a }
A
\or: B
\or: C
@@ -485,7 +465,6 @@
% \begin{macro}[EXP]{\@@_output_byte:n}
% \begin{macro}[EXP]{\@@_output_byte:w}
% \begin{macro}[EXP]{\@@_output_hexadecimal:n}
-% \begin{macro}[EXP]{\@@_output_hexadecimal:w}
% \begin{macro}[EXP]{\@@_output_end:}
% Those functions must be used carefully: feeding them a value outside
% the range $[-1,255]$ will attempt to use the undefined token list
@@ -501,24 +480,21 @@
{
\exp_after:wN \exp_after:wN
\exp_after:wN \use_i:nnn
- \cs:w c_@@_byte_ \__int_value:w \__int_eval:w
+ \cs:w c_@@_byte_ \int_eval:w
}
\cs_new:Npn \@@_output_hexadecimal:n #1
- { \@@_output_hexadecimal:w #1 \@@_output_end: }
-\cs_new:Npn \@@_output_hexadecimal:w
{
\exp_after:wN \exp_after:wN
\exp_after:wN \use_none:n
- \cs:w c_@@_byte_ \__int_value:w \__int_eval:w
+ \cs:w c_@@_byte_ \int_eval:n {#1} _tl \cs_end:
}
\cs_new:Npn \@@_output_end:
- { \__int_eval_end: _tl \cs_end: }
+ { \scan_stop: _tl \cs_end: }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
-% \end{macro}
%
% \begin{macro}[rEXP]{\@@_output_byte_pair_be:n}
% \begin{macro}[rEXP]{\@@_output_byte_pair_le:n}
@@ -561,8 +537,8 @@
{
\exp_after:wN \@@_convert_gmap_loop:NN
\exp_after:wN #1
- \g_@@_result_tl { ? \__prg_break: }
- \__prg_break_point:
+ \g_@@_result_tl { ? \prg_break: }
+ \prg_break_point:
}
}
\cs_new:Npn \@@_convert_gmap_loop:NN #1#2
@@ -586,8 +562,8 @@
{
\exp_after:wN \@@_convert_gmap_internal_loop:Nww
\exp_after:wN #1
- \g_@@_result_tl \s__tl \q_stop \__prg_break: \s__tl
- \__prg_break_point:
+ \g_@@_result_tl \s__tl \q_stop \prg_break: \s__tl
+ \prg_break_point:
}
}
\cs_new:Npn \@@_convert_gmap_internal_loop:Nww #1 #2 \s__tl #3 \s__tl
@@ -706,7 +682,7 @@
{
\group_begin:
#1
- \tl_gset:Nx \g_@@_result_tl { \@@_to_other_fast:n {#4} }
+ \tl_gset:Nx \g_@@_result_tl { \__kernel_str_to_other_fast:n {#4} }
\exp_after:wN \@@_convert:wwwnn
\tl_to_str:n {#5} /// \q_stop
{ decode } { unescape }
@@ -856,8 +832,8 @@
\cs_new:Npn \@@_convert_lowercase_alphanum:n #1
{
\exp_after:wN \@@_convert_lowercase_alphanum_loop:N
- \tl_to_str:n {#1} { ? \__prg_break: }
- \__prg_break_point:
+ \tl_to_str:n {#1} { ? \prg_break: }
+ \prg_break_point:
}
\cs_new:Npn \@@_convert_lowercase_alphanum_loop:N #1
{
@@ -932,8 +908,8 @@
\cs_new:Npn \@@_filter_bytes:n #1
{
\@@_filter_bytes_aux:N #1
- { ? \__prg_break: }
- \__prg_break_point:
+ { ? \prg_break: }
+ \prg_break_point:
}
\cs_new:Npn \@@_filter_bytes_aux:N #1
{
@@ -996,101 +972,59 @@
\cs_new_protected:Npn \@@_convert_decode_:
{ \@@_convert_gmap:N \@@_decode_native_char:N }
\cs_new:Npn \@@_decode_native_char:N #1
- { #1 \s__tl \__int_value:w `#1 \s__tl }
+ { #1 \s__tl \int_value:w `#1 \s__tl }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@@_convert_encode_:}
-% The conversion from an internal string to native character tokens is
-% very different in pdf\TeX{} and in other engines. For Unicode-aware
-% engines, we need the definitions to be read when the null byte has
-% category code $12$, so we set that inside a group.
-% \begin{macrocode}
-\group_begin:
- \char_set_catcode_other:n { 0 }
- \bool_lazy_any:nTF
- {
- \sys_if_engine_luatex_p:
- \sys_if_engine_xetex_p:
- }
-% \end{macrocode}
-% \begin{macro}{\@@_encode_native_loop:w}
-% \begin{macro}{\@@_encode_native_flush:}
-% \begin{macro}[rEXP]{\@@_encode_native_filter:N}
-% In Unicode-aware engines, since building particular characters
-% cannot be done expandably in \TeX{}, we cannot hope to get a
-% linear-time function. However, we get quite close using the
-% \pkg{l3tl-build} module, which abuses \tn{toks} to reach an almost
-% linear time. We produce an arbitrary character of category code 12
-% and add that character
-% to the end of the token list being built. At the end of the loop,
-% put the token list together with \cs{__tl_build_end:}. Note that we
-% use an \texttt{x}-expanding assignment because it is slightly
-% faster. Unicode-aware engines will never incur an overflow because
-% the internal string is guaranteed to only contain code points in
-% $[0,\hexnum{10FFFF}]$.
-% \begin{macrocode}
- {
- \cs_new_protected:Npn \@@_convert_encode_:
- {
- \__tl_gbuild_x:Nw \g_@@_result_tl
- \exp_after:wN \@@_encode_native_loop:w
- \g_@@_result_tl \s__tl { \q_stop \__prg_break: } \s__tl
- \__prg_break_point:
- \__tl_build_end:
- }
- \cs_new_protected:Npn \@@_encode_native_loop:w #1 \s__tl #2 \s__tl
- {
- \use_none_delimit_by_q_stop:w #2 \q_stop
- \exp_args:Nx \__tl_build_one:n
- { \char_generate:nn {#2} {12} }
- \@@_encode_native_loop:w
- }
- }
-% \end{macrocode}
% \begin{macro}[EXP]{\@@_encode_native_char:n}
-% Since pdf\TeX{} only supports 8-bit characters, and we have a table
-% of all bytes, the conversion can be done in linear time within an
-% \texttt{x}-expanding assignment. Look out for character codes larger
-% than $255$, those characters are replaced by |?|, and raise a flag,
-% which then triggers a pdf\TeX{}-specific error.
+% The conversion from an internal string to native character tokens
+% basically maps \cs{char_generate:nn} through the code-points, but in
+% non-Unicode-aware engines we use a fall-back character |?| rather
+% than nothing when given a character code outside $[0,255]$. We
+% detect the presence of bad characters using a flag and only produce
+% a single error after the \texttt{x}-expanding assignment.
% \begin{macrocode}
- {
- \cs_new_protected:Npn \@@_convert_encode_:
- {
- \flag_clear:n { str_error }
- \@@_convert_gmap_internal:N \@@_encode_native_char:n
- \@@_if_flag_error:nnx { str_error }
- { pdfTeX-native-overflow } { }
- }
- \cs_new:Npn \@@_encode_native_char:n #1
- {
- \if_int_compare:w #1 > \c_@@_max_byte_int
- \flag_raise:n { str_error }
- ?
- \else:
- \@@_output_byte:n {#1}
- \fi:
- }
- \__kernel_msg_new:nnnn { str } { pdfTeX-native-overflow }
- { Character~code~too~large~for~pdfTeX. }
- {
- The~pdfTeX~engine~only~supports~8-bit~characters:~
- valid~character~codes~are~in~the~range~[0,255].~
- To~manipulate~arbitrary~Unicode,~use~LuaTeX~or~XeTeX.
- }
- }
+\bool_lazy_any:nTF
+ {
+ \sys_if_engine_luatex_p:
+ \sys_if_engine_xetex_p:
+ }
+ {
+ \cs_new_protected:Npn \@@_convert_encode_:
+ { \@@_convert_gmap_internal:N \@@_encode_native_char:n }
+ \cs_new:Npn \@@_encode_native_char:n #1
+ { \char_generate:nn {#1} {12} }
+ }
+ {
+ \cs_new_protected:Npn \@@_convert_encode_:
+ {
+ \flag_clear:n { str_error }
+ \@@_convert_gmap_internal:N \@@_encode_native_char:n
+ \@@_if_flag_error:nnx { str_error }
+ { native-overflow } { }
+ }
+ \cs_new:Npn \@@_encode_native_char:n #1
+ {
+ \if_int_compare:w #1 > \c_@@_max_byte_int
+ \flag_raise:n { str_error }
+ ?
+ \else:
+ \char_generate:nn {#1} {12}
+ \fi:
+ }
+ \__kernel_msg_new:nnnn { str } { native-overflow }
+ { Character~code~too~large~for~this~engine. }
+ {
+ This~engine~only~support~8-bit~characters:~
+ valid~character~codes~are~in~the~range~[0,255].~
+ To~manipulate~arbitrary~Unicode,~use~LuaTeX~or~XeTeX.
+ }
+ }
% \end{macrocode}
% \end{macro}
% \end{macro}
-% \end{macro}
-% \end{macro}
-% End the group to restore the catcode of the null byte.
-% \begin{macrocode}
-\group_end:
-% \end{macrocode}
-% \end{macro}
%
% \subsubsection{\texttt{clist}}
%
@@ -1195,12 +1129,12 @@
\int_zero:N \l_@@_internal_int
\exp_last_unbraced:Nx \@@_decode_eight_bit_load:nn
{ \tl_use:c { c_@@_encoding_#1_tl } }
- { \q_stop \__prg_break: } { }
- \__prg_break_point:
+ { \q_stop \prg_break: } { }
+ \prg_break_point:
\exp_last_unbraced:Nx \@@_decode_eight_bit_load_missing:n
{ \tl_use:c { c_@@_encoding_#1_missing_tl } }
- { \q_stop \__prg_break: }
- \__prg_break_point:
+ { \q_stop \prg_break: }
+ \prg_break_point:
\flag_clear:n { str_error }
\@@_convert_gmap:N \@@_decode_eight_bit_char:N
\@@_if_flag_error:nnx { str_error } { decode-8-bit } {#1}
@@ -1211,7 +1145,7 @@
\use_none_delimit_by_q_stop:w #1 \q_stop
\tex_dimen:D "#1 = \l_@@_internal_int sp \scan_stop:
\tex_skip:D \l_@@_internal_int = "#1 sp \scan_stop:
- \tex_toks:D \l_@@_internal_int \exp_after:wN { \__int_value:w "#2 }
+ \tex_toks:D \l_@@_internal_int \exp_after:wN { \int_value:w "#2 }
\int_incr:N \l_@@_internal_int
\@@_decode_eight_bit_load:nn
}
@@ -1233,7 +1167,7 @@
\tex_the:D \tex_toks:D \tex_dimen:D
\fi:
\fi:
- \__int_value:w `#1 \s__tl
+ \int_value:w `#1 \s__tl
}
% \end{macrocode}
% \end{macro}
@@ -1253,8 +1187,8 @@
\int_zero:N \l_@@_internal_int
\exp_last_unbraced:Nx \@@_encode_eight_bit_load:nn
{ \tl_use:c { c_@@_encoding_#1_tl } }
- { \q_stop \__prg_break: } { }
- \__prg_break_point:
+ { \q_stop \prg_break: } { }
+ \prg_break_point:
\flag_clear:n { str_error }
\@@_convert_gmap_internal:N \@@_encode_eight_bit_char:n
\@@_if_flag_error:nnx { str_error } { encode-8-bit } {#1}
@@ -1374,11 +1308,11 @@
% \begin{itemize}
% \item \texttt{bytes} (default), non-bytes are filtered out, and
% bytes are left untouched (this is defined by default);
-% \item \texttt{hex} or \texttt{hexadecimal}, as per the pdf\TeX{}
+% \item \texttt{hex} or \texttt{hexadecimal}, as per the \pdfTeX{}
% primitive \tn{pdfescapehex}
-% \item \texttt{name}, as per the pdf\TeX{} primitive
+% \item \texttt{name}, as per the \pdfTeX{} primitive
% \tn{pdfescapename}
-% \item \texttt{string}, as per the pdf\TeX{} primitive
+% \item \texttt{string}, as per the \pdfTeX{} primitive
% \tn{pdfescapestring}
% \item \texttt{url}, as per the percent encoding of urls.
% \end{itemize}
@@ -1405,8 +1339,8 @@
\@@_output_byte:w "
\exp_last_unbraced:Nf \@@_unescape_hex_auxi:N
{ \tl_to_str:N \g_@@_result_tl }
- 0 { ? 0 - 1 \__prg_break: }
- \__prg_break_point:
+ 0 { ? 0 - 1 \prg_break: }
+ \prg_break_point:
\@@_output_end:
}
\@@_if_flag_error:nnx { str_error } { unescape-hex } { }
@@ -1484,8 +1418,8 @@
\tl_gset:Nx \g_@@_result_tl
{
\exp_after:wN #3 \g_@@_result_tl
- #1 ? { ? \__prg_break: }
- \__prg_break_point:
+ #1 ? { ? \prg_break: }
+ \prg_break_point:
}
\@@_if_flag_error:nnx { str_byte } { non-byte } { #2 }
\@@_if_flag_error:nnx { str_error } { unescape-#2 } { }
@@ -1576,14 +1510,14 @@
\tl_gset:Nx \g_@@_result_tl
{
\exp_after:wN \@@_unescape_string_newlines:wN
- \g_@@_result_tl \__prg_break: ^^M ?
- \__prg_break_point:
+ \g_@@_result_tl \prg_break: ^^M ?
+ \prg_break_point:
}
\tl_gset:Nx \g_@@_result_tl
{
\exp_after:wN \@@_unescape_string_loop:wNNN
- \g_@@_result_tl #1 ?? { ? \__prg_break: }
- \__prg_break_point:
+ \g_@@_result_tl #1 ?? { ? \prg_break: }
+ \prg_break_point:
}
\@@_if_flag_error:nnx { str_byte } { non-byte } { string }
\@@_if_flag_error:nnx { str_error } { unescape-string } { }
@@ -1877,7 +1811,7 @@
\exp_after:wN \use_none_delimit_by_q_stop:w
\fi:
\exp_after:wN \@@_encode_utf_viii_loop:wwnnw
- \__int_value:w \int_div_truncate:nn {#1} {64} ; #1 ;
+ \int_value:w \int_div_truncate:nn {#1} {64} ; #1 ;
#5 \q_stop
\@@_output_byte:n { #2 - 64 * ( #1 - 2 ) }
}
@@ -1922,11 +1856,14 @@
\flag_clear_new:n { str_overflow }
\__kernel_msg_new:nnnn { str } { utf8-decode }
{
- Invalid~UTF-8~string: \exp_last_unbraced:Nf \use_none:n
- \@@_if_flag_times:nT { str_missing } { ,~missing~continuation~byte }
- \@@_if_flag_times:nT { str_extra } { ,~extra~continuation~byte }
- \@@_if_flag_times:nT { str_overlong } { ,~overlong~form }
- \@@_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
+ Invalid~UTF-8~string:
+ \exp_last_unbraced:Nf \use_none:n
+ {
+ \@@_if_flag_times:nT { str_missing } { ,~missing~continuation~byte }
+ \@@_if_flag_times:nT { str_extra } { ,~extra~continuation~byte }
+ \@@_if_flag_times:nT { str_overlong } { ,~overlong~form }
+ \@@_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
+ }
.
}
{
@@ -2026,7 +1963,7 @@
% need to check whether we reached the end of the string. In a correct
% \textsc{utf-8} string, this happens automatically when the
% \texttt{_start} auxiliary leaves its first argument in the input
-% stream: the end-marker begins with \cs{__prg_break:}, which ends
+% stream: the end-marker begins with \cs{prg_break:}, which ends
% the loop. On the other hand, if the end is reached when looking for
% a continuation byte, the \cs{use_none:n} |#3| construction removes
% the first token from the end-marker, and leaves the \texttt{_end}
@@ -2043,8 +1980,8 @@
\tl_gset:Nx \g_@@_result_tl
{
\exp_after:wN \@@_decode_utf_viii_start:N \g_@@_result_tl
- { \__prg_break: \@@_decode_utf_viii_end: }
- \__prg_break_point:
+ { \prg_break: \@@_decode_utf_viii_end: }
+ \prg_break_point:
}
\@@_if_flag_error:nnx { str_error } { utf8-decode } { }
}
@@ -2054,7 +1991,7 @@
\if_int_compare:w `#1 < "C0 \exp_stop_f:
\s__tl
\if_int_compare:w `#1 < "80 \exp_stop_f:
- \__int_value:w `#1
+ \int_value:w `#1
\else:
\flag_raise:n { str_extra }
\flag_raise:n { str_error }
@@ -2062,7 +1999,7 @@
\fi:
\else:
\exp_after:wN \@@_decode_utf_viii_continuation:wwN
- \__int_value:w \__int_eval:w `#1 - "C0 \exp_after:wN \__int_eval_end:
+ \int_value:w \int_eval:n { `#1 - "C0 } \exp_after:wN
\fi:
\s__tl
\use_none_delimit_by_q_stop:w {"80} {"800} {"10000} {"110000} \q_stop
@@ -2077,9 +2014,7 @@
"C0 \exp_stop_f:
#3
\exp_after:wN \@@_decode_utf_viii_aux:wNnnwN
- \__int_value:w \__int_eval:w
- #1 * "40 + `#3 - "80
- \exp_after:wN \__int_eval_end:
+ \int_value:w \int_eval:n { #1 * "40 + `#3 - "80 } \exp_after:wN
\else:
\s__tl
\flag_raise:n { str_missing }
@@ -2107,7 +2042,7 @@
\@@_decode_utf_viii_overflow:w #1
\fi:
\exp_after:wN \@@_decode_utf_viii_continuation:wwN
- \__int_value:w \__int_eval:w #1 - #4 \exp_after:wN \__int_eval_end:
+ \int_value:w \int_eval:n { #1 - #4 } \exp_after:wN
\fi:
\s__tl
#2 {#4} #5
@@ -2126,7 +2061,7 @@
\flag_raise:n { str_missing }
\flag_raise:n { str_error }
\int_use:N \c_@@_replacement_char_int \s__tl
- \__prg_break:
+ \prg_break:
}
% \end{macrocode}
% \end{macro}
@@ -2246,10 +2181,13 @@
}
\__kernel_msg_new:nnnn { str } { utf16-decode }
{
- Invalid~UTF-16~string: \exp_last_unbraced:Nf \use_none:n
- \@@_if_flag_times:nT { str_missing } { ,~missing~trail~surrogate }
- \@@_if_flag_times:nT { str_extra } { ,~extra~trail~surrogate }
- \@@_if_flag_times:nT { str_end } { ,~odd~number~of~bytes }
+ Invalid~UTF-16~string:
+ \exp_last_unbraced:Nf \use_none:n
+ {
+ \@@_if_flag_times:nT { str_missing } { ,~missing~trail~surrogate }
+ \@@_if_flag_times:nT { str_extra } { ,~extra~trail~surrogate }
+ \@@_if_flag_times:nT { str_end } { ,~odd~number~of~bytes }
+ }
.
}
{
@@ -2299,7 +2237,7 @@
% big-endianness. The three endianness cases are based on a common
% auxiliary whose first argument is $1$ for big-endian and $2$ for
% little-endian, and whose second argument, delimited by the scan mark
-% \cs{s__stop}, is expanded once (the string may be long; passing
+% \cs{s_stop}, is expanded once (the string may be long; passing
% \cs{g_@@_result_tl} as an argument before expansion is cheaper).
%
% The \cs{@@_decode_utf_xvi:Nw} function defines \cs{@@_tmp:w} to
@@ -2309,13 +2247,13 @@
% \cs{@@_decode_utf_xvi_pair:NN} described below.
% \begin{macrocode}
\cs_new_protected:cpn { @@_convert_decode_utf16be: }
- { \@@_decode_utf_xvi:Nw 1 \g_@@_result_tl \s__stop }
+ { \@@_decode_utf_xvi:Nw 1 \g_@@_result_tl \s_stop }
\cs_new_protected:cpn { @@_convert_decode_utf16le: }
- { \@@_decode_utf_xvi:Nw 2 \g_@@_result_tl \s__stop }
+ { \@@_decode_utf_xvi:Nw 2 \g_@@_result_tl \s_stop }
\cs_new_protected:cpn { @@_convert_decode_utf16: }
{
\exp_after:wN \@@_decode_utf_xvi_bom:NN
- \g_@@_result_tl \s__stop \s__stop \s__stop
+ \g_@@_result_tl \s_stop \s_stop \s_stop
}
\cs_new_protected:Npn \@@_decode_utf_xvi_bom:NN #1#2
{
@@ -2327,7 +2265,7 @@
{ \@@_decode_utf_xvi:Nw 1 #1#2 }
}
}
- \cs_new_protected:Npn \@@_decode_utf_xvi:Nw #1#2 \s__stop
+ \cs_new_protected:Npn \@@_decode_utf_xvi:Nw #1#2 \s_stop
{
\flag_clear:n { str_error }
\flag_clear:n { str_missing }
@@ -2338,7 +2276,7 @@
{
\exp_after:wN \@@_decode_utf_xvi_pair:NN
#2 \q_nil \q_nil
- \__prg_break_point:
+ \prg_break_point:
}
\@@_if_flag_error:nnx { str_error } { utf16-decode } { }
}
@@ -2398,7 +2336,7 @@
\@@_decode_utf_xvi_pair_end:Nw #1
\fi:
\if_case:w
- \__int_eval:w ( \@@_tmp:w #1#2 - "D6 ) / 4 \__int_eval_end:
+ \int_eval:n { ( \@@_tmp:w #1#2 - "D6 ) / 4 } \scan_stop:
\or: \exp_after:wN \@@_decode_utf_xvi_quad:NNwNN
\or: \exp_after:wN \@@_decode_utf_xvi_extra:NNw
\fi:
@@ -2440,7 +2378,7 @@
\else:
\@@_decode_utf_xvi_error:nNN { end } #1 \prg_do_nothing:
\fi:
- \__prg_break:
+ \prg_break:
}
\cs_new:Npn \@@_decode_utf_xvi_extra:NNw #1#2 \s__tl #3 \s__tl
{ \@@_decode_utf_xvi_error:nNN { extra } #1#2 }
@@ -2538,9 +2476,12 @@
\flag_clear_new:n { str_end }
\__kernel_msg_new:nnnn { str } { utf32-decode }
{
- Invalid~UTF-32~string: \exp_last_unbraced:Nf \use_none:n
- \@@_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
- \@@_if_flag_times:nT { str_end } { ,~truncated~string }
+ Invalid~UTF-32~string:
+ \exp_last_unbraced:Nf \use_none:n
+ {
+ \@@_if_flag_times:nT { str_overflow } { ,~code~point~too~large }
+ \@@_if_flag_times:nT { str_end } { ,~truncated~string }
+ }
.
}
{
@@ -2576,7 +2517,7 @@
%
% The structure is similar to \textsc{utf-16} decoding functions. If
% the endianness is not given, test the first $4$ bytes of the string
-% (possibly \cs{s__stop} if the string is too short) for the presence
+% (possibly \cs{s_stop} if the string is too short) for the presence
% of a byte-order mark. If there is a byte-order mark, use that
% endianness, and remove the $4$ bytes, otherwise default to
% big-endian, and leave the $4$ bytes in place. The
@@ -2588,22 +2529,22 @@
% inside an \texttt{x}-expanding assignment to \cs{g_@@_result_tl}.
%
% The \texttt{_loop} auxiliary first checks for the end-of-string
-% marker \cs{s__stop}, calling the \texttt{_end} auxiliary if
+% marker \cs{s_stop}, calling the \texttt{_end} auxiliary if
% appropriate. Otherwise, leave the \meta{4~bytes} \cs{s__tl} behind,
% then check that the code point is not overflowing: the leading byte
% must be $0$, and the following byte at most $16$.
%
% In the ending code, we check that there remains no byte: there
-% should be nothing left until the first \cs{s__stop}. Break the map.
+% should be nothing left until the first \cs{s_stop}. Break the map.
% \begin{macrocode}
\cs_new_protected:cpn { @@_convert_decode_utf32be: }
- { \@@_decode_utf_xxxii:Nw 1 \g_@@_result_tl \s__stop }
+ { \@@_decode_utf_xxxii:Nw 1 \g_@@_result_tl \s_stop }
\cs_new_protected:cpn { @@_convert_decode_utf32le: }
- { \@@_decode_utf_xxxii:Nw 2 \g_@@_result_tl \s__stop }
+ { \@@_decode_utf_xxxii:Nw 2 \g_@@_result_tl \s_stop }
\cs_new_protected:cpn { @@_convert_decode_utf32: }
{
\exp_after:wN \@@_decode_utf_xxxii_bom:NNNN \g_@@_result_tl
- \s__stop \s__stop \s__stop \s__stop \s__stop
+ \s_stop \s_stop \s_stop \s_stop \s_stop
}
\cs_new_protected:Npn \@@_decode_utf_xxxii_bom:NNNN #1#2#3#4
{
@@ -2615,7 +2556,7 @@
{ \@@_decode_utf_xxxii:Nw 1 #1#2#3#4 }
}
}
- \cs_new_protected:Npn \@@_decode_utf_xxxii:Nw #1#2 \s__stop
+ \cs_new_protected:Npn \@@_decode_utf_xxxii:Nw #1#2 \s_stop
{
\flag_clear:n { str_overflow }
\flag_clear:n { str_end }
@@ -2624,14 +2565,14 @@
\tl_gset:Nx \g_@@_result_tl
{
\exp_after:wN \@@_decode_utf_xxxii_loop:NNNN
- #2 \s__stop \s__stop \s__stop \s__stop
- \__prg_break_point:
+ #2 \s_stop \s_stop \s_stop \s_stop
+ \prg_break_point:
}
\@@_if_flag_error:nnx { str_error } { utf32-decode } { }
}
\cs_new:Npn \@@_decode_utf_xxxii_loop:NNNN #1#2#3#4
{
- \if_meaning:w \s__stop #4
+ \if_meaning:w \s_stop #4
\exp_after:wN \@@_decode_utf_xxxii_end:w
\fi:
#1#2#3#4 \s__tl
@@ -2652,7 +2593,7 @@
\s__tl
\@@_decode_utf_xxxii_loop:NNNN
}
- \cs_new:Npn \@@_decode_utf_xxxii_end:w #1 \s__stop
+ \cs_new:Npn \@@_decode_utf_xxxii_end:w #1 \s_stop
{
\tl_if_empty:nF {#1}
{
@@ -2661,7 +2602,7 @@
#1 \s__tl
\int_use:N \c_@@_replacement_char_int \s__tl
}
- \__prg_break:
+ \prg_break:
}
% \end{macrocode}
% \end{macro}