summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-11-01 20:15:10 +0000
committerKarl Berry <karl@freefriends.org>2023-11-01 20:15:10 +0000
commit7888ea6606132ba347b147f1d3d3e02122e607cc (patch)
tree1e8d4ec81a3f49287a9d605eac72467ad4f1b6d7 /Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx
parenta776d572cfd8fa24365dbc0cc22bbd856fbbe97b (diff)
latex3 (1nov23)
git-svn-id: svn://tug.org/texlive/trunk@68721 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx87
1 files changed, 78 insertions, 9 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx
index 17d75d10459..385086dca4c 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx
@@ -40,7 +40,7 @@
% {latex-team@latex-project.org}^^A
% }^^A
% }
-% \date{Released 2023-10-23}
+% \date{Released 2023-11-01}
% \maketitle
%
% \begin{documentation}
@@ -165,7 +165,6 @@
% \subsection{Showing values}
%
% \begin{macro}{\fp_show:N, \fp_show:c, \fp_log:N, \fp_log:c, \@@_show:NN}
-% \begin{macro}[EXP]{\@@_show_validate:w}
% This shows the result of computing its argument by
% passing the right data to \cs{tl_show:n} or \cs{tl_log:n}.
% \begin{macrocode}
@@ -176,21 +175,91 @@
\cs_new_protected:Npn \@@_show:NN #1#2
{
\__kernel_chk_tl_type:NnnT #2 { fp }
+ { \exp_args:No \@@_show_validate:n #2 }
+ { \exp_args:Ne #1 { \token_to_str:N #2 = \fp_to_tl:N #2 } }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP]
+% {
+% \@@_show_validate:n, \@@_show_validate_aux:n, \@@_show_validate:nn,
+% }
+% \begin{macro}[EXP]
+% {
+% \@@_show_validate:w,
+% \@@_tuple_show_validate:w,
+% \@@_symbolic_show_validate:w
+% }
+% To support symbolic expression, validation has to be done recursively.
+% Two |\@@_show_validate:nn| wrappers are used to distinguish between
+% initial and recursive calls, in which the former provides a demo of
+% possible forms a |fp| variable would have.
+% \begin{macrocode}
+\cs_new:Npn \@@_show_validate:n #1
+ {
+ \@@_show_validate:nn { #1 }
+ {
+ \s_@@ \@@_chk:w ??? ;~ or \iow_newline:
+ \s_@@_tuple \_@@_tuple_chk:w ? ;~ or \iow_newline:
+ \s_@@_symbolic \@@_symbolic_chk:w ? , ? ;
+ }
+ }
+\cs_new:Npn \@@_show_validate_aux:n #1
+ {
+ \@@_show_validate:nn { #1 } { }
+ }
+\cs_new:Npn \@@_show_validate:nn #1#2
+ {
+ \tl_if_empty:nF { #1 }
{
- \str_if_eq:eeTF { \tl_head:N #2 } { \s_@@_tuple } { \exp_not:o #2 }
+ \str_case:enF { \tl_head:n { #1 } }
{
- \exp_after:wN \@@_show_validate:w #2
- \s_@@ \@@_chk:w ??? ; \s_@@_stop
+ { \s_@@ }
+ {
+ \@@_show_validate:w #1 \s_@@
+ \@@_chk:w ??? ; \s_@@_stop
+ }
+ { \s_@@_tuple }
+ {
+ \@@_tuple_show_validate:w #1
+ \s_@@_tuple \_@@_tuple_chk:w ?? ; \s_@@_stop
+ }
+ { \s_@@_symbolic }
+ {
+ \@@_symbolic_show_validate:w #1
+ \s_@@_symbolic \@@_symbolic_chk:w ? , ?? ; \s_@@_stop
+ }
}
+ { #2 }
}
- { \exp_args:Ne #1 { \token_to_str:N #2 = \fp_to_tl:N #2 } }
}
\cs_new:Npn \@@_show_validate:w
#1 \s_@@ \@@_chk:w #2#3#4#5 ; #6 \s_@@_stop
{
- \token_if_eq_meaning:NNTF #2 1
- { \s_@@ \@@_chk:w #2 #3 {#4} #5 ; }
- { \s_@@ \@@_chk:w #2 #3 #4 #5 ; }
+ \str_if_eq:nnF { #2 } {?}
+ {
+ \token_if_eq_meaning:NNTF #2 1
+ { \s_@@ \@@_chk:w #2 #3 { #4 } #5 ; }
+ { \s_@@ \@@_chk:w #2 #3 #4 #5 ; }
+ \@@_show_validate_aux:n { #6 }
+ }
+ }
+\cs_new:Npn \@@_tuple_show_validate:w
+ #1 \s_@@_tuple \_@@_tuple_chk:w #2#3 ; #4 \s_@@_stop
+ {
+ \str_if_eq:nnF { #2 } {?}
+ { \s_@@_tuple \@@_tuple_chk:w { \@@_show_validate_aux:n { #2 } } ; }
+ }
+\cs_new:Npn \@@_symbolic_show_validate:w
+ #1 \s_@@_symbolic \@@_symbolic_chk:w #2 , #3#4 ; #5 \s_@@_stop
+ {
+ \str_if_eq:nnF { #2 } {?}
+ {
+ \s_@@_symbolic \@@_symbolic_chk:w \exp_not:n { #2 } ,
+ { \@@_show_validate_aux:n { #3 } };
+ \@@_show_validate_aux:n { #5 }
+ }
}
% \end{macrocode}
% \end{macro}