[latex3-commits] [git/LaTeX3-latex3-latex3] master: Move \char_<type>case:n to stable (401aef912)
Joseph Wright
joseph.wright at morningstar2.co.uk
Thu Jan 9 17:18:23 CET 2020
Repository : https://github.com/latex3/latex3
On branch : master
Link : https://github.com/latex3/latex3/commit/401aef912c9e614b8bf13295f2894dad6fb81d25
>---------------------------------------------------------------
commit 401aef912c9e614b8bf13295f2894dad6fb81d25
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Thu Jan 2 18:38:05 2020 +0000
Move \char_<type>case:n to stable
>---------------------------------------------------------------
401aef912c9e614b8bf13295f2894dad6fb81d25
l3kernel/CHANGELOG.md | 1 +
l3kernel/l3candidates.dtx | 192 ----------------------------------------------
l3kernel/l3token.dtx | 190 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 191 insertions(+), 192 deletions(-)
diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index 3ed8c750a..6c8170be5 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -15,6 +15,7 @@ this project uses date-based 'snapshot' version identifiers.
### Changed
- Distribute LaTeX3 News
+- Moved `\char_<type>case:N` to stable
- Documentation improvements
### Fixed
diff --git a/l3kernel/l3candidates.dtx b/l3kernel/l3candidates.dtx
index 460743a1c..648d53096 100644
--- a/l3kernel/l3candidates.dtx
+++ b/l3kernel/l3candidates.dtx
@@ -889,26 +889,6 @@
% (\enquote{active}), and character code $32$ (space).
% \end{variable}
%
-% \begin{function}[added = 2020-02-02, EXP]
-% {
-% \char_lowercase:N, \char_uppercase:N,
-% \char_titlecase:N, \char_foldcase:N,
-% \char_str_lowercase:N, \char_str_uppercase:N,
-% \char_str_titlecase:N, \char_str_foldcase:N,
-% }
-% \begin{syntax}
-% \cs{char_lowercase:N} \meta{char}
-% \end{syntax}
-% Converts the \meta{char} to the equivalent case-changed character
-% as detailed by the function name (see \cs{str_fold_case:n}
-% and \cs{tl_mixed_case:n} for details of these terms). The case mapping
-% is carried out with no context-dependence (\emph{cf.}~\cs{tl_upper_case:n},
-% \emph{etc.}) The \texttt{str} versions always generate \enquote{other}
-% (category code $12$) characters, whilst the standard versions generate
-% characters with the category code of the \meta{char} (i.e.~only
-% the character code changes).
-% \end{function}
-%
% \begin{function}[added = 2018-06-01, EXP]{\char_codepoint_to_bytes:n}
% \begin{syntax}
% \cs{char_codepoint_to_bytes:n} \Arg{codepoint}
@@ -1656,178 +1636,6 @@
%<@@=char>
% \end{macrocode}
%
-% \begin{macro}[EXP]
-% {
-% \char_lowercase:N, \char_uppercase:N,
-% \char_titlecase:N, \char_foldcase:N
-% }
-% \begin{macro}[EXP]{\@@_change_case:nNN}
-% \begin{macro}[EXP]{\@@_change_case:nN}
-% \begin{macro}[EXP]{\@@_change_case_multi:nN, \@@_change_case_multi:vN}
-% \begin{macro}[EXP]{\@@_change_case_multi:NNNNw}
-% \begin{macro}[EXP]{\@@_change_case:NNN}
-% \begin{macro}[EXP]{\@@_change_case:NNNN}
-% \begin{macro}[EXP]{\@@_change_case:NN}
-% \begin{macro}[EXP]{\@@_change_case_catcode:N}
-% \begin{macro}[EXP]
-% {
-% \char_str_lowercase:N, \char_str_uppercase:N,
-% \char_str_titlecase:N, \char_str_foldcase:N
-% }
-% \begin{macro}[EXP]{\@@_str_change_case:nNN}
-% \begin{macro}[EXP]{\@@_str_change_case:nN}
-% Expandable character generation is done using a two-part approach.
-% First, see if the current character has a special mapping for the current
-% transformation. If it does, insert that. Otherwise, use the \TeX{} data
-% to look up the one-to-one mapping, and generate the appropriate character
-% with the appropriate category code. Titlecase needs an extra step as it
-% may be special-cased or might be a special upper case outcome. The internal
-% when using non-Unicode engines has to be set up to only do anything
-% with ASCII characters.
-%
-% To ensure that the category codes produced are predictable, every character
-% is re-generated even if it is otherwise unchanged. This makes life a little
-% interesting when we might have multiple output characters: we have to
-% grab each of them and case change them in reverse order to maintain
-% \texttt{f}-type expandability.
-% \begin{macrocode}
-\cs_new:Npn \char_lowercase:N #1
- { \@@_change_case:nNN { lower } \char_value_lccode:n #1 }
-\cs_new:Npn \char_uppercase:N #1
- { \@@_change_case:nNN { upper } \char_value_uccode:n #1 }
-\cs_new:Npn \char_titlecase:N #1
- {
- \tl_if_exist:cTF { c_@@_titlecase_ \token_to_str:N #1 _tl }
- {
- \@@_change_case_multi:vN
- { c_@@_titlecase_ \token_to_str:N #1 _tl } #1
- }
- { \char_uppercase:N #1 }
- }
-\cs_new:Npn \char_foldcase:N #1
- { \@@_change_case:nNN { fold } \char_value_lccode:n #1 }
-\cs_new:Npn \@@_change_case:nNN #1#2#3
- {
- \tl_if_exist:cTF { c_@@_ #1 case_ \token_to_str:N #3 _tl }
- {
- \@@_change_case_multi:vN
- { c_@@_ #1 case_ \token_to_str:N #3 _tl } #3
- }
- { \exp_args:Nf \@@_change_case:nN { #2 { `#3 } } #3 }
- }
-\cs_new:Npn \@@_change_case:nN #1#2
- {
- \int_compare:nNnTF {#1} = 0
- { #2 }
- { \char_generate:nn {#1} { \@@_change_case_catcode:N #2 } }
- }
-\cs_new:Npn \@@_change_case_multi:nN #1#2
- { \@@_change_case_multi:NNNNw #2 #1 \q_no_value \q_no_value \q_stop }
-\cs_generate_variant:Nn \@@_change_case_multi:nN { v }
-\cs_new:Npn \@@_change_case_multi:NNNNw #1#2#3#4#5 \q_stop
- {
- \quark_if_no_value:NTF #4
- {
- \quark_if_no_value:NTF #3
- { \@@_change_case:NN #1 #2 }
- { \@@_change_case:NNN #1 #2#3 }
- }
- { \@@_change_case:NNNN #1 #2#3#4 }
- }
-\cs_new:Npn \@@_change_case:NNN #1#2#3
- {
- \exp_args:Nnf \use:nn
- { \@@_change_case:NN #1 #2 }
- { \@@_change_case:NN #1 #3 }
- }
-\cs_new:Npn \@@_change_case:NNNN #1#2#3#4
- {
- \exp_args:Nnff \use:nnn
- { \@@_change_case:NN #1 #2 }
- { \@@_change_case:NN #1 #3 }
- { \@@_change_case:NN #1 #4 }
- }
-\cs_new:Npn \@@_change_case:NN #1#2
- { \char_generate:nn { `#2 } { \@@_change_case_catcode:N #1 } }
-\cs_new:Npn \@@_change_case_catcode:N #1
- {
- \if_catcode:w \exp_not:N #1 \c_math_toggle_token
- 3
- \else:
- \if_catcode:w \exp_not:N #1 \c_alignment_token
- 4
- \else:
- \if_catcode:w \exp_not:N #1 \c_math_superscript_token
- 7
- \else:
- \if_catcode:w \exp_not:N #1 \c_math_subscript_token
- 8
- \else:
- \if_catcode:w \exp_not:N #1 \c_space_token
- 10
- \else:
- \if_catcode:w \exp_not:N #1 \c_catcode_letter_token
- 11
- \else:
- \if_catcode:w \exp_not:N #1 \c_catcode_other_token
- 12
- \else:
- 13
- \fi:
- \fi:
- \fi:
- \fi:
- \fi:
- \fi:
- \fi:
- }
-% \end{macrocode}
-% Same story for the string version, except category code is easier
-% to follow. This of course makes this version significantly faster.
-% \begin{macrocode}
-\cs_new:Npn \char_str_lowercase:N #1
- { \@@_str_change_case:nNN { lower } \char_value_lccode:n #1 }
-\cs_new:Npn \char_str_uppercase:N #1
- { \@@_str_change_case:nNN { upper } \char_value_uccode:n #1 }
-\cs_new:Npn \char_str_titlecase:N #1
- {
- \tl_if_exist:cTF { c_@@_titlecase_ \token_to_str:N #1 _tl }
- { \tl_to_str:c { c_@@_titlecase_ \token_to_str:N #1 _tl } }
- { \char_str_uppercase:N #1 }
- }
-\cs_new:Npn \char_str_foldcase:N #1
- { \@@_str_change_case:nNN { fold } \char_value_lccode:n #1 }
-\cs_new:Npn \@@_str_change_case:nNN #1#2#3
- {
- \tl_if_exist:cTF { c_@@_ #1 case_ \token_to_str:N #3 _tl }
- { \tl_to_str:c { c_@@_ #1 case_ \token_to_str:N #3 _tl } }
- { \exp_args:Nf \@@_str_change_case:nN { #2 { `#3 } } #3 }
- }
-\cs_new:Npn \@@_str_change_case:nN #1#2
- {
- \int_compare:nNnTF {#1} = 0
- { \tl_to_str:n {#2} }
- { \char_generate:nn {#1} { 12 } }
- }
-\cs_if_exist:NF \tex_Uchar:D
- {
- \cs_set:Npn \@@_str_change_case:nN #1#2
- { \tl_to_str:n {#2} }
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
% \begin{macro}[EXP]{\char_codepoint_to_bytes:n}
% \begin{macro}[EXP]{\@@_codepoint_to_bytes_auxi:n}
% \begin{macro}[EXP]{\@@_codepoint_to_bytes_auxii:Nnn}
diff --git a/l3kernel/l3token.dtx b/l3kernel/l3token.dtx
index 6addd0682..861697194 100644
--- a/l3kernel/l3token.dtx
+++ b/l3kernel/l3token.dtx
@@ -399,6 +399,29 @@
% general document use.
% \end{variable}
%
+% \subsection{Converting character tokens}
+%
+% \begin{function}[added = 2020-02-02, EXP]
+% {
+% \char_lowercase:N, \char_uppercase:N,
+% \char_titlecase:N, \char_foldcase:N,
+% \char_str_lowercase:N, \char_str_uppercase:N,
+% \char_str_titlecase:N, \char_str_foldcase:N
+% }
+% \begin{syntax}
+% \cs{char_lowercase:N} \meta{char}
+% \end{syntax}
+% Converts the \meta{char} to the equivalent case-changed character
+% \emph{etc.}) The \texttt{str} versions always generate \enquote{other}
+% is carried out with no context-dependence (\emph{cf.}~\cs{tl_upper_case:n},
+% and \cs{tl_mixed_case:n} for details of these terms). The case mapping
+% is carried out with no context-dependence (\emph{cf.}~\cs{tl_upper_case:n},
+% \emph{etc.}). The \texttt{str} versions always generate \enquote{other}
+% (category code $12$) characters, whilst the standard versions generate
+% characters with category code of the \meta{char} (\emph{i.e.}~only the
+% character code changes).
+% \end{function}
+%
% \section{Generic tokens}
%
% \begin{variable}
@@ -1562,6 +1585,173 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}[EXP]
+% {
+% \char_lowercase:N, \char_uppercase:N,
+% \char_titlecase:N, \char_foldcase:N
+% }
+% \begin{macro}[EXP]{\@@_change_case:nNN}
+% \begin{macro}[EXP]{\@@_change_case:nN}
+% \begin{macro}[EXP]{\@@_change_case_multi:nN, \@@_change_case_multi:vN}
+% \begin{macro}[EXP]{\@@_change_case_multi:NNNNw}
+% \begin{macro}[EXP]{\@@_change_case:NNN}
+% \begin{macro}[EXP]{\@@_change_case:NNNN}
+% \begin{macro}[EXP]{\@@_change_case:NN}
+% \begin{macro}[EXP]{\@@_change_case_catcode:N}
+% \begin{macro}[EXP]
+% {
+% \char_str_lowercase:N, \char_str_uppercase:N,
+% \char_str_titlecase:N, \char_str_foldcase:N
+% }
+% \begin{macro}[EXP]{\@@_str_change_case:nNN}
+% \begin{macro}[EXP]{\@@_str_change_case:nN}
+% To ensure that the category codes produced are predictable, every character
+% is re-generated even if it is otherwise unchanged. This makes life a little
+% interesting when we might have multiple output characters: we have to
+% grab each of them and case change them in reverse order to maintain
+% \texttt{f}-type expandability.
+% may be special-cased or might be a special upper case outcome. The internal
+% when using non-Unicode engines has to be set up to only do anything
+% with ASCII characters.
+%
+% \begin{macrocode}
+\cs_new:Npn \char_lowercase:N #1
+ { \@@_change_case:nNN { lower } \char_value_lccode:n #1 }
+\cs_new:Npn \char_uppercase:N #1
+ { \@@_change_case:nNN { upper } \char_value_uccode:n #1 }
+\cs_new:Npn \char_titlecase:N #1
+ {
+ \tl_if_exist:cTF { c_@@_titlecase_ \token_to_str:N #1 _tl }
+ {
+ \@@_change_case_multi:vN
+ { c_@@_titlecase_ \token_to_str:N #1 _tl } #1
+ }
+ { \char_uppercase:N #1 }
+ }
+\cs_new:Npn \char_foldcase:N #1
+ { \@@_change_case:nNN { fold } \char_value_lccode:n #1 }
+\cs_new:Npn \@@_change_case:nNN #1#2#3
+ {
+ \tl_if_exist:cTF { c_@@_ #1 case_ \token_to_str:N #3 _tl }
+ {
+ \@@_change_case_multi:vN
+ { c_@@_ #1 case_ \token_to_str:N #3 _tl } #3
+ }
+ { \exp_args:Nf \@@_change_case:nN { #2 { `#3 } } #3 }
+ }
+\cs_new:Npn \@@_change_case:nN #1#2
+ {
+ \int_compare:nNnTF {#1} = 0
+ { #2 }
+ { \char_generate:nn {#1} { \@@_change_case_catcode:N #2 } }
+ }
+\cs_new:Npn \@@_change_case_multi:nN #1#2
+ { \@@_change_case_multi:NNNNw #2 #1 \q_no_value \q_no_value \q_stop }
+\cs_generate_variant:Nn \@@_change_case_multi:nN { v }
+\cs_new:Npn \@@_change_case_multi:NNNNw #1#2#3#4#5 \q_stop
+ {
+ \quark_if_no_value:NTF #4
+ {
+ \quark_if_no_value:NTF #3
+ { \@@_change_case:NN #1 #2 }
+ { \@@_change_case:NNN #1 #2#3 }
+ }
+ { \@@_change_case:NNNN #1 #2#3#4 }
+ }
+\cs_new:Npn \@@_change_case:NNN #1#2#3
+ {
+ \exp_args:Nnf \use:nn
+ { \@@_change_case:NN #1 #2 }
+ { \@@_change_case:NN #1 #3 }
+ }
+\cs_new:Npn \@@_change_case:NNNN #1#2#3#4
+ {
+ \exp_args:Nnff \use:nnn
+ { \@@_change_case:NN #1 #2 }
+ { \@@_change_case:NN #1 #3 }
+ { \@@_change_case:NN #1 #4 }
+ }
+\cs_new:Npn \@@_change_case:NN #1#2
+ { \char_generate:nn { `#2 } { \@@_change_case_catcode:N #1 } }
+\cs_new:Npn \@@_change_case_catcode:N #1
+ {
+ \if_catcode:w \exp_not:N #1 \c_math_toggle_token
+ 3
+ \else:
+ \if_catcode:w \exp_not:N #1 \c_alignment_token
+ 4
+ \else:
+ \if_catcode:w \exp_not:N #1 \c_math_superscript_token
+ 7
+ \else:
+ \if_catcode:w \exp_not:N #1 \c_math_subscript_token
+ 8
+ \else:
+ \if_catcode:w \exp_not:N #1 \c_space_token
+ 10
+ \else:
+ \if_catcode:w \exp_not:N #1 \c_catcode_letter_token
+ 11
+ \else:
+ \if_catcode:w \exp_not:N #1 \c_catcode_other_token
+ 12
+ \else:
+ 13
+ \fi:
+ \fi:
+ \fi:
+ \fi:
+ \fi:
+ \fi:
+ \fi:
+ }
+% \end{macrocode}
+% Same story for the string version, except category code is easier
+% to follow. This of course makes this version significantly faster.
+% \begin{macrocode}
+\cs_new:Npn \char_str_lowercase:N #1
+ { \@@_str_change_case:nNN { lower } \char_value_lccode:n #1 }
+\cs_new:Npn \char_str_uppercase:N #1
+ { \@@_str_change_case:nNN { upper } \char_value_uccode:n #1 }
+\cs_new:Npn \char_str_titlecase:N #1
+ {
+ \tl_if_exist:cTF { c_@@_titlecase_ \token_to_str:N #1 _tl }
+ { \tl_to_str:c { c_@@_titlecase_ \token_to_str:N #1 _tl } }
+ { \char_str_uppercase:N #1 }
+ }
+\cs_new:Npn \char_str_foldcase:N #1
+ { \@@_str_change_case:nNN { fold } \char_value_lccode:n #1 }
+\cs_new:Npn \@@_str_change_case:nNN #1#2#3
+ {
+ \tl_if_exist:cTF { c_@@_ #1 case_ \token_to_str:N #3 _tl }
+ { \tl_to_str:c { c_@@_ #1 case_ \token_to_str:N #3 _tl } }
+ { \exp_args:Nf \@@_str_change_case:nN { #2 { `#3 } } #3 }
+ }
+\cs_new:Npn \@@_str_change_case:nN #1#2
+ {
+ \int_compare:nNnTF {#1} = 0
+ { \tl_to_str:n {#2} }
+ { \char_generate:nn {#1} { 12 } }
+ }
+\cs_if_exist:NF \tex_Uchar:D
+ {
+ \cs_set:Npn \@@_str_change_case:nN #1#2
+ { \tl_to_str:n {#2} }
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{\c_catcode_other_space_tl}
% Create a space with category code $12$: an \enquote{other} space.
% \begin{macrocode}
More information about the latex3-commits
mailing list