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.dtx110
1 files changed, 67 insertions, 43 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 0635e17f2d7..c964ec55822 100644
--- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx
+++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx
@@ -35,7 +35,7 @@
%
%<*driver|package>
\RequirePackage{expl3}
-\GetIdInfo$Id: l3str-convert.dtx 5659 2015-07-14 18:58:00Z joseph $
+\GetIdInfo$Id: l3str-convert.dtx 5998 2015-09-11 19:51:00Z joseph $
{L3 Experimental string encoding conversions}
%</driver|package>
%<*driver>
@@ -318,7 +318,15 @@
% $1114111$ for other engines.
% \begin{macrocode}
\int_const:Nn \c_max_char_int
- { \pdftex_if_engine:TF { "FF } { "10FFFF } }
+ {
+ \bool_if:nTF
+ {
+ \sys_if_engine_luatex_p: ||
+ \sys_if_engine_xetex_p:
+ }
+ { "10FFFF }
+ { "FF }
+ }
% \end{macrocode}
% \end{variable}
%
@@ -1033,13 +1041,16 @@
%
% \begin{macro}[int, rEXP]{\@@_filter_bytes:n}
% \begin{macro}[aux, rEXP]{\@@_filter_bytes_aux:N}
-% In the case of pdf\TeX{}, every character is a byte. For
+% In the case of 8-bit engines, every character is a byte. For
% Unicode-aware engines, test the character code; non-bytes cause us
% to raise the flag \texttt{str_byte}. Spaces have already been given
% the correct category code when this function is called.
% \begin{macrocode}
-\pdftex_if_engine:TF
- { \cs_new_eq:NN \@@_filter_bytes:n \use:n }
+\bool_if:nTF
+ {
+ \sys_if_engine_luatex_p: ||
+ \sys_if_engine_xetex_p:
+ }
{
\cs_new:Npn \@@_filter_bytes:n #1
{
@@ -1058,6 +1069,7 @@
\@@_filter_bytes_aux:N
}
}
+ { \cs_new_eq:NN \@@_filter_bytes:n \use:n }
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1067,8 +1079,11 @@
% The simplest unescaping method removes non-bytes from
% \cs{g_@@_result_tl}.
% \begin{macrocode}
-\pdftex_if_engine:TF
- { \cs_new_protected_nopar:Npn \@@_convert_unescape_: { } }
+\bool_if:nTF
+ {
+ \sys_if_engine_luatex_p: ||
+ \sys_if_engine_xetex_p:
+ }
{
\cs_new_protected_nopar:Npn \@@_convert_unescape_:
{
@@ -1078,6 +1093,7 @@
\@@_if_flag_error:nnx { str_byte } { non-byte } { bytes }
}
}
+ { \cs_new_protected_nopar:Npn \@@_convert_unescape_: { } }
\cs_new_eq:NN \@@_convert_unescape_bytes: \@@_convert_unescape_:
% \end{macrocode}
% \end{macro}
@@ -1116,42 +1132,12 @@
% \begin{macrocode}
\group_begin:
\char_set_catcode_other:n { 0 }
- \pdftex_if_engine:TF
-% \end{macrocode}
-% \begin{macro}[aux, 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.
-% \begin{macrocode}
+ \bool_if:nTF
{
- \cs_new_protected_nopar: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_two_hundred_fifty_six
- \@@_output_byte:n {#1}
- \else:
- \flag_raise:n { str_error }
- ?
- \fi:
- }
- \__msg_kernel_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.
- }
+ \sys_if_engine_luatex_p: ||
+ \sys_if_engine_xetex_p:
}
% \end{macrocode}
-% \end{macro}
% \begin{macro}[aux]{\@@_encode_native_loop:w}
% \begin{macro}[aux]{\@@_encode_native_flush:}
% \begin{macro}[aux, rEXP]{\@@_encode_native_filter:N}
@@ -1186,6 +1172,40 @@
}
}
% \end{macrocode}
+% \begin{macro}[aux, 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.
+% \begin{macrocode}
+ {
+ \cs_new_protected_nopar: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_two_hundred_fifty_six
+ \@@_output_byte:n {#1}
+ \else:
+ \flag_raise:n { str_error }
+ ?
+ \fi:
+ }
+ \__msg_kernel_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.
+ }
+ }
+% \end{macrocode}
+% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
@@ -1423,11 +1443,15 @@
%
% Message used when the \enquote{bytes} unescaping fails because the
% string given to \cs{str_set_convert:Nnnn} contains a non-byte. This
-% cannot happen for the pdf\TeX{} engine, since that engine only
-% supports 8-bit characters. Messages used for other escapings and
+% cannot happen for the -8-bit engines.
+% Messages used for other escapings and
% encodings are defined in each definition file.
% \begin{macrocode}
-\pdftex_if_engine:F
+\bool_if:nT
+ {
+ \sys_if_engine_luatex_p: ||
+ \sys_if_engine_xetex_p:
+ }
{
\__msg_kernel_new:nnnn { str } { non-byte }
{ String~invalid~in~escaping~'#1':~it~may~only~contain~bytes. }