[latex3-commits] [latex3/latex3] main: Move part of l3fp-types to kernel (9b03a72cf)
github at latex-project.org
github at latex-project.org
Thu Oct 19 17:50:07 CEST 2023
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/9b03a72cf88b2a2f771193f4ee55a0e70c19e6ce
>---------------------------------------------------------------
commit 9b03a72cf88b2a2f771193f4ee55a0e70c19e6ce
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date: Fri Oct 13 18:04:51 2023 +0100
Move part of l3fp-types to kernel
This holds the parts that will be needed for
variable and fn support, but not the rest.
>---------------------------------------------------------------
9b03a72cf88b2a2f771193f4ee55a0e70c19e6ce
l3kernel/doc/source3body.tex | 1 +
l3kernel/l3.ins | 1 +
l3kernel/l3fp-logic.dtx | 15 +-
l3kernel/l3fp-types.dtx | 184 +++++++++++++++++
l3trial/l3fp-extras/l3fp-extras.ins | 4 +-
l3trial/l3fp-extras/l3fp-types-extras.dtx | 182 +++++++++++++++++
l3trial/l3fp-extras/l3fp-types.dtx | 318 ------------------------------
7 files changed, 383 insertions(+), 322 deletions(-)
diff --git a/l3kernel/doc/source3body.tex b/l3kernel/doc/source3body.tex
index b1a536b8a..08466bb3b 100644
--- a/l3kernel/doc/source3body.tex
+++ b/l3kernel/doc/source3body.tex
@@ -582,6 +582,7 @@ used on top of \LaTeXe{} if \tn{outer} tokens are used in the arguments.
l3fp-trig.dtx ,
l3fp-convert.dtx ,
l3fp-random.dtx ,
+ l3fp-types.dtx
}
\ExplSyntaxOff
diff --git a/l3kernel/l3.ins b/l3kernel/l3.ins
index 52c65e4c8..a7773c06d 100644
--- a/l3kernel/l3.ins
+++ b/l3kernel/l3.ins
@@ -92,6 +92,7 @@ and all files in that bundle must be distributed together.
\from{l3fp-trig.dtx} {package}
\from{l3fp-convert.dtx} {package}
\from{l3fp-random.dtx} {package}
+ \from{l3fp-types.dtx} {package}
\from{l3fparray.dtx} {package}
\from{l3cctab.dtx} {package}
\from{l3sort.dtx} {package}
diff --git a/l3kernel/l3fp-logic.dtx b/l3kernel/l3fp-logic.dtx
index 2f439c292..cd41615b7 100644
--- a/l3kernel/l3fp-logic.dtx
+++ b/l3kernel/l3fp-logic.dtx
@@ -163,7 +163,7 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[EXP]{\@@_compare_back_any:ww, \@@_compare_back:ww, \@@_compare_nan:w}
+% \begin{macro}[EXP]{\@@_compare_back:ww, \@@_bcmp:ww, \@@_compare_back_any:ww, \@@_compare_nan:w}
% \begin{quote}
% \cs{@@_compare_back_any:ww} \meta{y} |;| \meta{x} |;|
% \end{quote}
@@ -178,6 +178,17 @@
% a different type, the highest type is a larger number. Finally, if
% $y\leq 0$, then $x>y$, unless both are zero.
% \begin{macrocode}
+\cs_new:Npn \@@_compare_back:ww #1#2; #3#4;
+ {
+ \cs:w
+ @@
+ \@@_type_from_scan:N #1
+ _bcmp
+ \@@_type_from_scan:N #3
+ :ww
+ \cs_end:
+ #1#2; #3#4;
+ }
\cs_new:Npn \@@_compare_back_any:ww #1#2; #3
{
\@@_if_type_fp:NTwFw
@@ -195,7 +206,7 @@
}
#1#2 ; #3
}
-\cs_new:Npn \@@_compare_back:ww
+\cs_new:Npn \@@_bcmp:ww
\s_@@ \@@_chk:w #1 #2 #3;
\s_@@ \@@_chk:w #4 #5 #6;
{
diff --git a/l3kernel/l3fp-types.dtx b/l3kernel/l3fp-types.dtx
new file mode 100644
index 000000000..a07270dc1
--- /dev/null
+++ b/l3kernel/l3fp-types.dtx
@@ -0,0 +1,184 @@
+% \iffalse
+%
+%% File l3fp-types.dtx (C) Copyright 2012-2015,2017,2018,2020,2021,2023 The LaTeX Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3kernel bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
+%
+%<*driver>
+\documentclass[full]{l3doc}
+\usepackage{amsmath}
+\begin{document}
+ \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \title{^^A
+% The \pkg{l3fp-types} package\\ Floating point types^^A
+% }
+%
+% \author{^^A
+% The \LaTeX{} Project\thanks
+% {^^A
+% E-mail:
+% \href{mailto:latex-team at latex-project.org}
+% {latex-team at latex-project.org}^^A
+% }^^A
+% }
+%
+% \date{Released 2018-04-30}
+%
+% \maketitle
+%
+% \begin{documentation}
+%
+% \end{documentation}
+%
+% \begin{implementation}
+%
+% \section{\pkg{l3fp-types} implementation}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<@@=fp>
+% \end{macrocode}
+%
+% \subsection{Support for types}
+%
+% Despite lack of documentation, the \pkg{l3fp} internals support types.
+% Each additional type must define
+% \begin{itemize}
+% \item |\s__fp_|\meta{type} and |\__fp_|\meta{type}|_chk:w|;
+% \item |\__fp_exp_after_|\meta{type}|_f:nw|;
+% \item |\__fp_|\meta{type}|_to_|\meta{out}|:w| for \meta{out} among
+% |decimal|, |scientific|, |tl|;
+% \end{itemize}
+% and may define
+% \begin{itemize}
+% \item |\__fp_|\meta{type}|_to_int:w| and |\__fp_|\meta{type}|_to_dim:w|;
+% \item |\__fp_|\meta{op}|_|\meta{type}|_o:w| for any of the \meta{op}
+% that the type implements, among |acos|, |acsc|, |asec|, |asin|,
+% |cos|, |cot|, |csc|, |exp|, |ln|, |not|, |sec|, |set_sign|, |sin|,
+% |tan|;
+% \item |\__fp_|\meta{type_1}|_|\meta{op}|_|\meta{type_2}|_o:ww| for
+% \meta{op} among |^*/-+&|\verb"|" and for every pair of types;
+% \item |\__fp_|\meta{type_1}|_bcmp_|\meta{type_2}|:ww| for every
+% pair of types.
+% \end{itemize}
+% The latter is set up in \pkg{l3fp-logic}.
+%
+% \subsection{Dispatch according to the type}
+%
+% \begin{macro}[EXP]
+% {\@@_types_cs_to_op:N, \@@_types_cs_to_op_auxi:wwwn}
+% From |\__fp_|\meta{op}|_o:w| produce \meta{op}, otherwise~|?|.
+% \begin{macrocode}
+\cs_new:Npe \@@_types_cs_to_op:N #1
+ {
+ \exp_not:N \exp_after:wN \exp_not:N \@@_types_cs_to_op_auxi:wwwn
+ \exp_not:N \token_to_str:N #1 \s_@@_mark
+ \exp_not:N \@@_use_i_delimit_by_s_stop:nw
+ \tl_to_str:n { @@_ _o:w } \s_@@_mark
+ { \exp_not:N \@@_use_i_delimit_by_s_stop:nw ? }
+ \s_@@_stop
+ }
+\use:e
+ {
+ \cs_new:Npn \exp_not:N \@@_types_cs_to_op_auxi:wwwn
+ #1 \tl_to_str:n { @@_ } #2
+ \tl_to_str:n { _o:w } #3 \s_@@_mark #4 { #4 {#2} }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP]{\@@_types_unary:NNw}
+% \begin{macro}[EXP]
+% {\@@_types_unary_auxi:nNw, \@@_types_unary_auxii:NnNw}
+% \begin{syntax}
+% \cs{@@_types_unary:NNw} |\__fp_|\meta{function}|_o:w|
+% ~~\meta{token} \meta{operand} |@|
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_types_unary:NNw #1
+ {
+ \exp_args:Nf \@@_types_unary_auxi:nNw
+ { \@@_types_cs_to_op:N #1 }
+ }
+\cs_new:Npn \@@_types_unary_auxi:nNw #1#2#3
+ {
+ \exp_after:wN \@@_types_unary_auxii:NnNw
+ \cs:w @@_#1 \@@_type_from_scan:N #3 _o:w \cs_end:
+ {#1}
+ #2#3
+ }
+\cs_new:Npn \@@_types_unary_auxii:NnNw #1#2#3
+ {
+ \token_if_eq_meaning:NNTF \scan_stop: #1
+ { \@@_invalid_operation_o:nw {#2} }
+ { #1 #3 }
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}[EXP]{\@@_types_binary:Nww}
+% \begin{macro}[EXP]
+% {\@@_types_binary_auxi:Nww, \@@_types_binary_auxii:NNww}
+% \begin{syntax}
+% \cs{@@_types_binary:Nww} |\__fp_|\meta{binop}|_o:ww|
+% ~~\meta{operand_1} \meta{operand_2} |@|
+% \end{syntax}
+% \begin{macrocode}
+\cs_new:Npn \@@_types_binary:Nww #1
+ {
+ \exp_last_unbraced:Nf \@@_types_binary_auxi:Nww
+ { \@@_types_cs_to_op:N #1 }
+ }
+\cs_new:Npn \@@_types_binary_auxi:Nww #1#2#3; #4#5; @
+ {
+ \exp_after:wN \@@_types_binary_auxii:NNww
+ \cs:w
+ @@
+ \@@_type_from_scan:N #2
+ _#1
+ \@@_type_from_scan:N #4
+ _o:ww
+ \cs_end:
+ #1 #2#3; #4#5;
+ }
+\cs_new:Npn \@@_types_binary_auxii:NNww #1#2
+ {
+ \token_if_eq_meaning:NNTF \scan_stop: #1
+ { \@@_invalid_operation_o:Nww #2 }
+ {#1}
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \end{implementation}
+%
+% \PrintIndex
diff --git a/l3trial/l3fp-extras/l3fp-extras.ins b/l3trial/l3fp-extras/l3fp-extras.ins
index 910871a12..5f591d304 100644
--- a/l3trial/l3fp-extras/l3fp-extras.ins
+++ b/l3trial/l3fp-extras/l3fp-extras.ins
@@ -1,6 +1,6 @@
\iffalse meta-comment
-File l3fp-extras.ins Copyright (C) 201,2021 The LaTeX Project
+File l3fp-extras.ins Copyright (C) 201,2021,2023 The LaTeX Project
It may be distributed and/or modified under the conditions of the
LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -40,7 +40,7 @@ Do not distribute a modified version of this file.
\file{l3fp-extras.sty}%
{%
\from{l3fp-extras.dtx}{package}%
- \from{l3fp-types.dtx}{package}%
+ \from{l3fp-types-extras.dtx}{package}%
\from{l3fp-symbolic.dtx}{package}%
\from{l3fp-functions.dtx}{package}%
\from{l3fp-interchange.dtx}{package}%
diff --git a/l3trial/l3fp-extras/l3fp-types-extras.dtx b/l3trial/l3fp-extras/l3fp-types-extras.dtx
new file mode 100644
index 000000000..46f292f7e
--- /dev/null
+++ b/l3trial/l3fp-extras/l3fp-types-extras.dtx
@@ -0,0 +1,182 @@
+% \iffalse
+%
+%% File l3fp-types-extras.dtx (C) Copyright 2012-2015,2017,2018,2020,2021,2023 The LaTeX Project
+%
+% It may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License (LPPL), either version 1.3c of this
+% license or (at your option) any later version. The latest version
+% of this license is in the file
+%
+% http://www.latex-project.org/lppl.txt
+%
+% This file is part of the "l3trial bundle" (The Work in LPPL)
+% and all files in that bundle must be distributed together.
+%
+% -----------------------------------------------------------------------
+%
+% The development version of the bundle can be found at
+%
+% https://github.com/latex3/latex3
+%
+% for those people who are interested.
+%
+%<*driver|package>
+\RequirePackage{expl3}
+%</driver|package>
+%<*driver>
+\documentclass[full]{l3doc}
+\usepackage{amsmath}
+\begin{document}
+ \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \title{^^A
+% The \pkg{l3fp-types-extras} package\\ Floating point types^^A
+% }
+%
+% \author{^^A
+% The \LaTeX{} Project\thanks
+% {^^A
+% E-mail:
+% \href{mailto:latex-team at latex-project.org}
+% {latex-team at latex-project.org}^^A
+% }^^A
+% }
+%
+% \date{Released 2018-04-30}
+%
+% \maketitle
+%
+% \begin{documentation}
+%
+% \end{documentation}
+%
+% \begin{implementation}
+%
+% \section{\pkg{l3fp-types-extras} implementation}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+% \begin{macrocode}
+%<@@=fp>
+% \end{macrocode}
+%
+% \subsection{Comparisons}
+%
+% \begin{macro}[EXP]{\@@_parse_apply_compare:NwNNNNwN}
+% \begin{macro}[EXP]{\@@_infix_compare_o:w}
+% \begin{macro}[EXP]{\@@_compare_o:NNNNww}
+% \begin{macrocode}
+ % \cs_undefine:N \@@_parse_apply_compare:NwNNNNwN
+ % \cs_new:Npn \@@_parse_apply_compare:NwNNNNwN #1 #2@ #3#4#5#6 #7@ #8
+ % {
+ % \exp_after:wN \@@_parse_until_test:NwN
+ % \exp_after:wN #1
+ % \exp:w \exp_end_continue_f:w
+ % \@@_infix_compare_o:w
+ % \s_@@_tokens \@@_tokens_exp_not:n { #3#4#5#6 } ;
+ % #2
+ % #7
+ % \s_@@_stop
+ % \exp:w \exp_end_continue_f:w #8 #1
+ % }
+ % \cs_new_protected:Npn \@@_infix_compare_o:w
+ % \s_@@_tokens \@@_tokens_exp_not:n #1; #2#3; #4#5; \s_@@_stop
+ % {
+ % \cs:w
+ % @@ \@@_type_from_scan:N #2
+ % _compare \@@_type_from_scan:N #4 _o:NNNNww
+ % \cs_end:
+ % #1 #2#3; #4#5;
+ % }
+ % \cs_new:Npn \@@_compare_o:NNNNww #1#2#3#4 #5; #6;
+ % {
+ % \exp_after:wN \exp_after:wN
+ % \exp_after:wN \exp_after:wN
+ % \exp_after:wN \exp_after:wN
+ % \if_case:w \@@_compare_back:ww #6; #5; \exp_stop_f:
+ % #2
+ % \or: #3
+ % \or: #4
+ % \else: #1
+ % \fi:
+ % }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Storing simple tokens}
+%
+% It is sometimes necessary to store a list of \texttt{N}-type tokens in
+% a floating point array. The structure we use is
+% \begin{quote}
+% \cs{s_@@_tokens} \cs{@@_tokens:n} \Arg{\texttt{N}-type tokens} |;|
+% \end{quote}
+% This is not really a floating point datatype, since it cannot appear
+% directly within a floating point expression: there is thus no need to
+% define how the various floating point operators and functions act. We
+% only need to be able to jump over the data with
+% \cs{@@_exp_after_tokens_f:nw}.
+%
+% \begin{variable}{\s_@@_tokens}
+% Marks the start of some \texttt{N}-type tokens stored as a
+% floating-point object.
+% \begin{macrocode}
+\scan_new:N \s_@@_tokens
+% \end{macrocode}
+% \end{variable}
+%
+% \begin{macro}[EXP]{\@@_tokens:n}
+% To be used in combination with \cs{s_@@_tokens}: this function
+% prevents the expansion of its argument.
+% \begin{macrocode}
+\cs_new:Npn \@@_tokens:n #1 { \exp_not:n { \@@_tokens:n {#1} } }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[EXP]{\@@_exp_after_tokens_f:nw}
+% \begin{macro}[EXP]{\@@_exp_after_tokens_aux:N}
+% The loop through tokens ends when the auxiliary takes in the
+% multi-token trailing argument. The \cs{exp_after:wN} chain hits
+% \cs{exp:w} coming from the argument, and
+% \cs{use_none:nn} removes the looping macro.
+% \begin{macrocode}
+\cs_new:Npn \@@_exp_after_tokens_f:nw
+ #1 \s_@@_tokens \@@_tokens:n #2 ;
+ {
+ \exp_after:wN \@@_exp_after_tokens_auxii:w
+ \exp:w
+ \@@_exp_after_tokens_aux:N #2
+ { \s_@@_tokens \exp:w \use_none:nn }
+ \exp_end_continue_f:w #1
+ }
+\cs_new:Npn \@@_exp_after_tokens_aux:N #1
+ {
+ \exp_after:wN \exp_end:
+ \exp_after:wN #1
+ \exp:w
+ \@@_exp_after_tokens_aux:N
+ }
+\cs_new:Npn \@@_exp_after_tokens_auxii:w #1 \s_@@_tokens
+ { \s_@@_tokens \@@_tokens:n {#1} ; }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Road-map}
+%
+% The following functions are not implemented: comparisons, |min|,
+% |max|, |?:|, |round|, |atan|, |acot|.
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \end{implementation}
+%
+% \PrintIndex
diff --git a/l3trial/l3fp-extras/l3fp-types.dtx b/l3trial/l3fp-extras/l3fp-types.dtx
deleted file mode 100644
index cb6f6d31a..000000000
--- a/l3trial/l3fp-extras/l3fp-types.dtx
+++ /dev/null
@@ -1,318 +0,0 @@
-% \iffalse
-%
-%% File l3fp-types.dtx (C) Copyright 2012-2015,2017,2018,2020,2021,2023 The LaTeX Project
-%
-% It may be distributed and/or modified under the conditions of the
-% LaTeX Project Public License (LPPL), either version 1.3c of this
-% license or (at your option) any later version. The latest version
-% of this license is in the file
-%
-% http://www.latex-project.org/lppl.txt
-%
-% This file is part of the "l3trial bundle" (The Work in LPPL)
-% and all files in that bundle must be distributed together.
-%
-% -----------------------------------------------------------------------
-%
-% The development version of the bundle can be found at
-%
-% https://github.com/latex3/latex3
-%
-% for those people who are interested.
-%
-%<*driver|package>
-\RequirePackage{expl3}
-%</driver|package>
-%<*driver>
-\documentclass[full]{l3doc}
-\usepackage{amsmath}
-\begin{document}
- \DocInput{\jobname.dtx}
-\end{document}
-%</driver>
-% \fi
-%
-% \title{^^A
-% The \pkg{l3fp-types} package\\ Floating point types^^A
-% }
-%
-% \author{^^A
-% The \LaTeX{} Project\thanks
-% {^^A
-% E-mail:
-% \href{mailto:latex-team at latex-project.org}
-% {latex-team at latex-project.org}^^A
-% }^^A
-% }
-%
-% \date{Released 2018-04-30}
-%
-% \maketitle
-%
-% \begin{documentation}
-%
-% \end{documentation}
-%
-% \begin{implementation}
-%
-% \section{\pkg{l3fp-types} implementation}
-%
-% \begin{macrocode}
-%<*package>
-% \end{macrocode}
-%
-% \begin{macrocode}
-%<@@=fp>
-% \end{macrocode}
-%
-% \subsection{Support for types}
-%
-% Despite lack of documentation, the \pkg{l3fp} internals support types.
-% Each additional type must define
-% \begin{itemize}
-% \item |\s__fp_|\meta{type} and |\__fp_|\meta{type}|_chk:w|;
-% \item |\__fp_exp_after_|\meta{type}|_f:nw|;
-% \item |\__fp_|\meta{type}|_to_|\meta{out}|:w| for \meta{out} among
-% |decimal|, |scientific|, |tl|;
-% \end{itemize}
-% and may define
-% \begin{itemize}
-% \item |\__fp_|\meta{type}|_to_int:w| and |\__fp_|\meta{type}|_to_dim:w|;
-% \item |\__fp_|\meta{op}|_|\meta{type}|_o:w| for any of the \meta{op}
-% that the type implements, among |acos|, |acsc|, |asec|, |asin|,
-% |cos|, |cot|, |csc|, |exp|, |ln|, |not|, |sec|, |set_sign|, |sin|,
-% |tan|;
-% \item |\__fp_|\meta{type_1}|_|\meta{op}|_|\meta{type_2}|_o:ww| for
-% \meta{op} among |^*/-+&|\verb"|" and for every pair of types;
-% \item |\__fp_|\meta{type_1}|_bcmp_|\meta{type_2}|:ww| for every
-% pair of types.
-% \end{itemize}
-% The latter is something added only by \pkg{l3fp-types} at present.
-%
-% \subsection{Redefining internals of \pkg{l3fp-parse}}
-%
-% \begin{macro}[aux, EXP]{\@@_bcmp:ww, \@@_compare_back:ww}
-% We copy the \cs{@@_compare_back:ww} function of \pkg{l3fp-logic} to
-% \cs{@@_bcmp:ww} and make it dispatch according to the type of
-% operands being compared.
-% \begin{macrocode}
-\cs_new_eq:NN \@@_bcmp:ww \@@_compare_back:ww
-\cs_undefine:N \@@_compare_back:ww
-\cs_new:Npn \@@_compare_back:ww #1#2; #3#4;
- {
- \cs:w
- @@
- \@@_type_from_scan:N #1
- _bcmp
- \@@_type_from_scan:N #3
- :ww
- \cs_end:
- #1#2; #3#4;
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \subsection{Dispatch according to the type}
-%
-% \begin{macro}[EXP]
-% {\@@_types_cs_to_op:N, \@@_types_cs_to_op_auxi:wwwn}
-% From |\__fp_|\meta{op}|_o:w| produce \meta{op}, otherwise~|?|.
-% \begin{macrocode}
-\cs_new:Npe \@@_types_cs_to_op:N #1
- {
- \exp_not:N \exp_after:wN \exp_not:N \@@_types_cs_to_op_auxi:wwwn
- \exp_not:N \token_to_str:N #1 \s_@@_mark
- \exp_not:N \@@_use_i_delimit_by_s_stop:nw
- \tl_to_str:n { _ _ fp _ _ o : w } \s_@@_mark
- { \exp_not:N \@@_use_i_delimit_by_s_stop:nw ? }
- \s_@@_stop
- }
-\use:e
- {
- \cs_new:Npn \exp_not:N \@@_types_cs_to_op_auxi:wwwn
- #1 \tl_to_str:n { _ _ fp _ } #2
- \tl_to_str:n { _ o : w } #3 \s_@@_mark #4 { #4 {#2} }
- }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\@@_types_unary:NNw}
-% \begin{macro}[EXP]
-% {\@@_types_unary_auxi:nNw, \@@_types_unary_auxii:NnNw}
-% \begin{syntax}
-% \cs{@@_types_unary:NNw} |\__fp_|\meta{function}|_o:w|
-% ~~\meta{token} \meta{operand} |@|
-% \end{syntax}
-% \begin{macrocode}
-\cs_new:Npn \@@_types_unary:NNw #1
- {
- \exp_args:Nf \@@_types_unary_auxi:nNw
- { \@@_types_cs_to_op:N #1 }
- }
-\cs_new:Npn \@@_types_unary_auxi:nNw #1#2#3
- {
- \exp_after:wN \@@_types_unary_auxii:NnNw
- \cs:w @@_#1 \@@_type_from_scan:N #3 _o:w \cs_end:
- {#1}
- #2#3
- }
-\cs_new:Npn \@@_types_unary_auxii:NnNw #1#2#3
- {
- \token_if_eq_meaning:NNTF \scan_stop: #1
- { \@@_invalid_operation_o:nw {#2} }
- { #1 #3 }
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\@@_types_binary:Nww}
-% \begin{macro}[EXP]
-% {\@@_types_binary_auxi:Nww, \@@_types_binary_auxii:NNww}
-% \begin{syntax}
-% \cs{@@_types_binary:Nww} |\__fp_|\meta{binop}|_o:ww|
-% ~~\meta{operand_1} \meta{operand_2} |@|
-% \end{syntax}
-% \begin{macrocode}
-\cs_new:Npn \@@_types_binary:Nww #1
- {
- \exp_last_unbraced:Nf \@@_types_binary_auxi:Nww
- { \@@_types_cs_to_op:N #1 }
- }
-\cs_new:Npn \@@_types_binary_auxi:Nww #1#2#3; #4#5; @
- {
- \exp_after:wN \@@_types_binary_auxii:NNww
- \cs:w
- @@
- \@@_type_from_scan:N #2
- _#1
- \@@_type_from_scan:N #4
- _o:ww
- \cs_end:
- #1 #2#3; #4#5;
- }
-\cs_new:Npn \@@_types_binary_auxii:NNww #1#2
- {
- \token_if_eq_meaning:NNTF \scan_stop: #1
- { \@@_invalid_operation_o:Nww #2 }
- {#1}
- }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Comparisons}
-%
-% \begin{macro}[EXP]{\@@_parse_apply_compare:NwNNNNwN}
-% \begin{macro}[EXP]{\@@_infix_compare_o:w}
-% \begin{macro}[EXP]{\@@_compare_o:NNNNww}
-% \begin{macrocode}
- % \cs_undefine:N \@@_parse_apply_compare:NwNNNNwN
- % \cs_new:Npn \@@_parse_apply_compare:NwNNNNwN #1 #2@ #3#4#5#6 #7@ #8
- % {
- % \exp_after:wN \@@_parse_until_test:NwN
- % \exp_after:wN #1
- % \exp:w \exp_end_continue_f:w
- % \@@_infix_compare_o:w
- % \s_@@_tokens \@@_tokens_exp_not:n { #3#4#5#6 } ;
- % #2
- % #7
- % \s_@@_stop
- % \exp:w \exp_end_continue_f:w #8 #1
- % }
- % \cs_new_protected:Npn \@@_infix_compare_o:w
- % \s_@@_tokens \@@_tokens_exp_not:n #1; #2#3; #4#5; \s_@@_stop
- % {
- % \cs:w
- % @@ \@@_type_from_scan:N #2
- % _compare \@@_type_from_scan:N #4 _o:NNNNww
- % \cs_end:
- % #1 #2#3; #4#5;
- % }
- % \cs_new:Npn \@@_compare_o:NNNNww #1#2#3#4 #5; #6;
- % {
- % \exp_after:wN \exp_after:wN
- % \exp_after:wN \exp_after:wN
- % \exp_after:wN \exp_after:wN
- % \if_case:w \@@_compare_back:ww #6; #5; \exp_stop_f:
- % #2
- % \or: #3
- % \or: #4
- % \else: #1
- % \fi:
- % }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Storing simple tokens}
-%
-% It is sometimes necessary to store a list of \texttt{N}-type tokens in
-% a floating point array. The structure we use is
-% \begin{quote}
-% \cs{s_@@_tokens} \cs{@@_tokens:n} \Arg{\texttt{N}-type tokens} |;|
-% \end{quote}
-% This is not really a floating point datatype, since it cannot appear
-% directly within a floating point expression: there is thus no need to
-% define how the various floating point operators and functions act. We
-% only need to be able to jump over the data with
-% \cs{@@_exp_after_tokens_f:nw}.
-%
-% \begin{variable}{\s_@@_tokens}
-% Marks the start of some \texttt{N}-type tokens stored as a
-% floating-point object.
-% \begin{macrocode}
-\scan_new:N \s_@@_tokens
-% \end{macrocode}
-% \end{variable}
-%
-% \begin{macro}[EXP]{\@@_tokens:n}
-% To be used in combination with \cs{s_@@_tokens}: this function
-% prevents the expansion of its argument.
-% \begin{macrocode}
-\cs_new:Npn \@@_tokens:n #1 { \exp_not:n { \@@_tokens:n {#1} } }
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}[EXP]{\@@_exp_after_tokens_f:nw}
-% \begin{macro}[EXP]{\@@_exp_after_tokens_aux:N}
-% The loop through tokens ends when the auxiliary takes in the
-% multi-token trailing argument. The \cs{exp_after:wN} chain hits
-% \cs{exp:w} coming from the argument, and
-% \cs{use_none:nn} removes the looping macro.
-% \begin{macrocode}
-\cs_new:Npn \@@_exp_after_tokens_f:nw
- #1 \s_@@_tokens \@@_tokens:n #2 ;
- {
- \exp_after:wN \@@_exp_after_tokens_auxii:w
- \exp:w
- \@@_exp_after_tokens_aux:N #2
- { \s_@@_tokens \exp:w \use_none:nn }
- \exp_end_continue_f:w #1
- }
-\cs_new:Npn \@@_exp_after_tokens_aux:N #1
- {
- \exp_after:wN \exp_end:
- \exp_after:wN #1
- \exp:w
- \@@_exp_after_tokens_aux:N
- }
-\cs_new:Npn \@@_exp_after_tokens_auxii:w #1 \s_@@_tokens
- { \s_@@_tokens \@@_tokens:n {#1} ; }
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Road-map}
-%
-% The following functions are not implemented: comparisons, |min|,
-% |max|, |?:|, |round|, |atan|, |acot|.
-%
-% \begin{macrocode}
-%</package>
-% \end{macrocode}
-%
-% \end{implementation}
-%
-% \PrintIndex
More information about the latex3-commits
mailing list.