diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental')
14 files changed, 517 insertions, 612 deletions
diff --git a/Master/texmf-dist/source/latex/l3experimental/l3color/l3color.dtx b/Master/texmf-dist/source/latex/l3experimental/l3color/l3color.dtx index 68eaa14452d..3654c315ac5 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3color/l3color.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3color/l3color.dtx @@ -44,7 +44,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -263,7 +263,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3color}{2018/03/05}{} +\ProvidesExplPackage{l3color}{2018-04-30}{} {L3 Experimental color support} %</package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-boxes.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-boxes.dtx index 0cfd7239da9..a1086818891 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-boxes.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-boxes.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-paths.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-paths.dtx index 09df8391d17..d6b152be155 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-paths.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-paths.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -1001,8 +1001,7 @@ \dim_set_eq:NN \l_@@_softpath_lastx_dim \g_@@_softpath_lastx_dim \dim_set_eq:NN \l_@@_softpath_lasty_dim \g_@@_softpath_lasty_dim \@@_path_reset_limits: - \@@_softpath_concat:n { } - \tl_set_eq:NN \l_@@_softpath_main_tl \g_@@_softpath_main_tl + \tl_build_get:NN \g_@@_softpath_main_tl \l_@@_softpath_main_tl \bool_set_eq:NN \l_@@_softpath_corners_bool \g_@@_softpath_corners_bool @@ -1010,11 +1009,11 @@ } \cs_new_protected:Npn \draw_path_scope_end: { + \@@_softpath_clear: \bool_gset_eq:NN \g_@@_softpath_corners_bool \l_@@_softpath_corners_bool - \@@_softpath_clear: - \tl_gset_eq:NN \g_@@_softpath_main_tl \l_@@_softpath_main_tl + \@@_softpath_add:o \l_@@_softpath_main_tl \dim_gset_eq:NN \g_@@_softpath_lastx_dim \l_@@_softpath_lastx_dim \dim_gset_eq:NN \g_@@_softpath_lasty_dim \l_@@_softpath_lasty_dim \dim_gset_eq:NN \g_@@_path_xmax_dim \l_@@_path_xmax_dim diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-points.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-points.dtx index 69ca8b6ae73..9e713f30464 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-points.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-points.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -64,7 +64,9 @@ % and return a co-ordinate pair in the form |{|\meta{x}|}{|\meta{y}|}|. % Equivalents of following \pkg{pgf} functions are deliberately omitted: % \begin{itemize} -% \item \cs{pgfpointorigin}: Can be given explicitly as |{0pt}{0pt}|. +% \item \cs{pgfpointorigin}: Can be given explicitly as |0pt,0pt|. +% \item \cs{pgfpoint}, \cs{pgfpointadd}, \cs{pgfpointdiff}, +% \cs{pgfpointscale}: Can be given explicitly. % \item \cs{pgfextractx}, \cs{pgfextracty}: Available by applying % \cs{use_i:nn}/\cs{use_ii:nn} or similar to the \texttt{x}-type % expansion of a point expression. @@ -145,18 +147,6 @@ % \end{macro} % \end{macro} % -% \subsection{Co-ordinates} -% -% The most basic way of giving points is as simple $(x,y)$ co-ordinates. -% -% \begin{macro}[EXP]{\draw_point:nn} -% Simply turn the given values into dimensions. -% \begin{macrocode} -\cs_new:Npn \draw_point:nn #1#2 - { \@@_point_to_dim:n { #1 , #2 } } -% \end{macrocode} -% \end{macro} -% % \subsection{Polar co-ordinates} % % \begin{macro}[EXP]{\draw_point_polar:nn} @@ -182,19 +172,6 @@ % % These functions all take point expressions as arguments. % -% \begin{macro}[EXP] -% {\draw_point_add:nn, \draw_point_diff:nn, \draw_point_scale:nn} -% Simple mathematics. -% \begin{macrocode} -\cs_new:Npn \draw_point_add:nn #1#2 - { \@@_point_to_dim:n { (#1) + (#2) } } -\cs_new:Npn \draw_point_diff:nn #1#2 - { \@@_point_to_dim:n { (#2) - (#1) } } -\cs_new:Npn \draw_point_scale:nn #1#2 - { \@@_point_to_dim:n { #1 * (#2) } } -% \end{macrocode} -% \end{macro} -% % \begin{macro}[EXP]{\draw_point_unit_vector:n} % \begin{macro}[EXP]{\@@_point_unit_vector:nn} % Only a single point expression so the expansion is done here. The diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-scopes.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-scopes.dtx index 451226ccdef..6f4a94b0220 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-scopes.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-scopes.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -129,6 +129,11 @@ \@@_softpath_clear: \draw_linewidth:n { \l_draw_default_linewidth_dim } \draw_color:n { . } + \draw_nonzero_rule: + \draw_cap_butt: + \draw_join_miter: + \draw_miterlimit:n { 10 } + \draw_dash_pattern:nn { } { 0cm } } \cs_new_protected:Npn \draw_end: { diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-softpath.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-softpath.dtx index f98083584bd..558b559ff92 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-softpath.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-softpath.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -65,40 +65,25 @@ % the corners. This means that the path cannot be written piecemeal as % specials, but rather needs to be held in macros. The second aspect that % follows from this is performance: simply adding to a single macro a piece -% at a time will have poor performance as the list gets long. Paths need to -% be global (as specials are), so we cannot use \pkg{l3tl-build} or a similar -% approach. Instead, we use the same idea as \pkg{pgf}: use a series of buffer -% macros such that in most cases we don't add tokens to the main list. This -% will get slow only for \emph{enormous} paths. +% at a time will have poor performance as the list gets long so we use +% \cs[no-index]{tl_build_\ldots{}} functions. % % Each marker (operation) token takes two arguments, which makes processing % more straight-forward. As such, some operations have dummy arguments, whilst % others have to be split over several tokens. As the code here is at a low % level, all dimension arguments are assumed to be explicit and fully-expanded. % -% \begin{variable} -% { -% \g_@@_softpath_main_tl , -% \g_@@_softpath_buffer_a_tl , -% \g_@@_softpath_buffer_b_tl -% } +% \begin{variable}{\g_@@_softpath_main_tl} % The soft path itself. % \begin{macrocode} \tl_new:N \g_@@_softpath_main_tl -\tl_new:N \g_@@_softpath_buffer_a_tl -\tl_new:N \g_@@_softpath_buffer_b_tl % \end{macrocode} % \end{variable} % -% \begin{variable} -% { -% \g_@@_softpath_buffer_a_int , -% \g_@@_softpath_buffer_b_int -% } -% Tracking data. +% \begin{variable}{\l_@@_softpath_internal_tl} +% The soft path itself. % \begin{macrocode} -\int_new:N \g_@@_softpath_buffer_a_int -\int_new:N \g_@@_softpath_buffer_b_int +\tl_new:N \l_@@_softpath_internal_tl % \end{macrocode} % \end{variable} % @@ -109,60 +94,13 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}{\@@_softpath_add:n, \@@_softpath_add:x} -% \begin{macro}{\@@_softpath_concat:n} -% \begin{macro}{\@@_softpath_reset_buffers:} -% The softpath itself is quite simple. We use three token lists to hold the -% data: two buffers of limited length, and the main list of arbitrary size. -% Most of the time this will mean that we don't add to the full list, so -% performance will be acceptable. +% \begin{macro}{\@@_softpath_add:n, \@@_softpath_add:o, \@@_softpath_add:x} % \begin{macrocode} -\cs_new_protected:Npn \@@_softpath_add:n #1 - { - \int_compare:nNnTF \g_@@_softpath_buffer_a_int < { 40 } - { - \int_gincr:N \g_@@_softpath_buffer_a_int - \tl_gput_right:Nn \g_@@_softpath_buffer_a_tl {#1} - } - { - \int_compare:nNnTF \g_@@_softpath_buffer_b_int < { 40 } - { - \int_gincr:N \g_@@_softpath_buffer_b_int - \tl_gset:Nx \g_@@_softpath_buffer_b_tl - { - \exp_not:V \g_@@_softpath_buffer_b_tl - \exp_not:V \g_@@_softpath_buffer_a_tl - \exp_not:n {#1} - } - \int_gzero:N \g_@@_softpath_buffer_a_int - \tl_gclear:N \g_@@_softpath_buffer_a_tl - } - { \@@_softpath_concat:n {#1} } - } - } -\cs_generate_variant:Nn \@@_softpath_add:n { x } -\cs_new_protected:Npn \@@_softpath_concat:n #1 - { - \tl_gset:Nx \g_@@_softpath_main_tl - { - \exp_not:V \g_@@_softpath_main_tl - \exp_not:V \g_@@_softpath_buffer_b_tl - \exp_not:V \g_@@_softpath_buffer_a_tl - \exp_not:n {#1} - } - \@@_softpath_reset_buffers: - } -\cs_new_protected:Npn \@@_softpath_reset_buffers: - { - \int_gzero:N \g_@@_softpath_buffer_a_int - \tl_gclear:N \g_@@_softpath_buffer_a_tl - \int_gzero:N \g_@@_softpath_buffer_b_int - \tl_gclear:N \g_@@_softpath_buffer_b_tl - } +\cs_new_protected:Npn \@@_softpath_add:n + { \tl_build_gput_right:Nn \g_@@_softpath_main_tl } +\cs_generate_variant:Nn \@@_softpath_add:n { o, x } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % % \begin{macro} % {\@@_softpath_use:, \@@_softpath_clear:, \@@_softpath_use_clear:} @@ -170,15 +108,12 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_softpath_use: { - \g_@@_softpath_main_tl - \g_@@_softpath_buffer_b_tl - \g_@@_softpath_buffer_a_tl + \tl_build_get:NN \g_@@_softpath_main_tl \l_@@_softpath_internal_tl + \l_@@_softpath_internal_tl } \cs_new_protected:Npn \@@_softpath_clear: { - \tl_gclear:N \g_@@_softpath_main_tl - \tl_gclear:N \g_@@_softpath_buffer_a_tl - \tl_gclear:N \g_@@_softpath_buffer_b_tl + \tl_build_gclear:N \g_@@_softpath_main_tl \bool_gset_false:N \g_@@_softpath_corners_bool } \cs_new_protected:Npn \@@_softpath_use_clear: @@ -391,9 +326,9 @@ \fp_zero:N \l_@@_softpath_lasty_fp \tl_clear:N \l_@@_softpath_first_tl \tl_clear:N \l_@@_softpath_move_tl - \@@_softpath_concat:n { } + \tl_build_get:NN \g_@@_softpath_main_tl \l_@@_softpath_internal_tl \exp_after:wN \@@_softpath_round_loop:Nnn - \g_@@_softpath_main_tl + \l_@@_softpath_internal_tl \q_recursion_tail ? ? \q_recursion_stop \group_end: @@ -653,7 +588,8 @@ \l_@@_softpath_move_tl \tl_put_right:No \l_@@_softpath_main_tl \l_@@_softpath_part_tl - \tl_gset_eq:NN \g_@@_softpath_main_tl \l_@@_softpath_main_tl + \tl_build_gclear:N \g_@@_softpath_main_tl + \@@_softpath_add:o \l_@@_softpath_main_tl } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx index 4c6bade4569..7e02a505cd9 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-state.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -58,12 +58,20 @@ %<@@=draw> % \end{macrocode} % -% \begin{variable}{\g_@@_linewidth_dim, \g_@@_inner_linewidth_dim} +% This sub-module covers more-or-less the same ideas as +% \texttt{pgfcoregraphicstate.code.tex}. At present, equivalents of the +% following are currently absent: +% \begin{itemize} +% \item \cs{pgfsetinnerlinewidth}, \cs{pgfinnerlinewidth}, +% \cs{pgfsetinnerstrokecolor}, \cs{pgfsetinnerstrokecolor}: Likely to +% be added on further work is done on paths/stroking. +% \end{itemize} +% +% \begin{variable}{\g_@@_linewidth_dim} % Linewidth for strokes: global as the scope for this relies on the graphics % state. The inner line width is used for places where two lines are used. % \begin{macrocode} \dim_new:N \g_@@_linewidth_dim -\dim_new:N \g_@@_inner_linewidth_dim % \end{macrocode} % \end{variable} % @@ -75,21 +83,41 @@ % \end{macrocode} % \end{variable} % -% \begin{macro}{\draw_linewidth:n, \draw_inner_linewidth:n} +% \begin{macro}{\draw_linewidth:n} % Set the linewidth: we need a wrapper as this has to pass to the driver -% layer. The inner version is handled at the macro layer but is given a -% consistent interface here. +% layer. % \begin{macrocode} \cs_new_protected:Npn \draw_linewidth:n #1 { \dim_gset:Nn \g_@@_linewidth_dim { \fp_to_dim:n {#1} } \driver_draw_linewidth:n \g_@@_linewidth_dim } -\cs_new_protected:Npn \draw_inner_linewidth:n #1 - { \dim_gset:Nn \g_@@_inner_linewidth_dim { \fp_to_dim:n {#1} } } % \end{macrocode} % \end{macro} % +% \begin{macro}{\draw_dash_pattern:nn} +% \begin{variable}{\l_@@_tmp_seq} +% Evaluated all of the list and pass it to the driver layer. +% \begin{macrocode} +\cs_new_protected:Npn \draw_dash_pattern:nn #1#2 + { + \group_begin: + \seq_set_from_clist:Nn \l_@@_tmp_seq {#1} + \seq_set_map:NNn \l_@@_tmp_seq \l_@@_tmp_seq + { \fp_to_dim:n {##1} } + \use:x + { + \driver_draw_dash_pattern:nn + { \seq_use:Nn \l_@@_tmp_seq { , } } + { \fp_to_dim:n {#2} } + } + \group_end: + } +\seq_new:N \l_@@_tmp_seq +% \end{macrocode} +% \end{variable} +% \end{macro} +% % \begin{macro}{\draw_miterlimit:n} % Pass through to the driver layer. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-transforms.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-transforms.dtx index 9b1478b48b7..9153c7ff38d 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-transforms.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-transforms.dtx @@ -42,7 +42,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % diff --git a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw.dtx b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw.dtx index 7cefc6d837d..618860c7279 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw.dtx @@ -109,7 +109,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -165,6 +165,14 @@ % drawing using |\int_step_function:nnnn| or similar. On the other hand, % text should not be included directly in drawings, but should rather be % inserted using the appropriate \pkg{l3draw} command. +% +% The drawing environment sets the following standard behaviors +% \begin{itemize} +% \item Non-zero rule for fill overlaps +% \item Butt caps for lines +% \item Mitering for line joins with a miter factor of $10$ +% \item Solid line strokes +% \end{itemize} % \end{function} % % Within a drawing, there are different ways of referring to a position. @@ -218,7 +226,7 @@ % of every drawing (\cs{draw_begin:}). % \end{variable} % -% \begin{function}{\draw_linewidth:n, \draw_inner_linewidth:n} +% \begin{function}{\draw_linewidth:n} % \begin{syntax} % \cs{draw_linewidth:n} \Arg{width} % \end{syntax} @@ -226,6 +234,44 @@ % \meta{fp expr}). % \end{function} % +% \begin{function}{\draw_dash_pattern:nn} +% \begin{syntax} +% \cs{draw_dash_pattern:nn} \Arg{pattern} \Arg{phase} +% \end{syntax} +% Specifies a dash pattern. The \meta{pattern} itself is a comma-separated +% list of entries which represent the \enquote{on} and \enquote{off} +% parts of the line. These are all \meta{fp expr} and repeat as required. +% Thus the \meta{pattern} may be of arbitrary length. The \meta{phase} +% specifies where during the first \enquote{on} line the pattern should +% start. +% \begin{demo} +% \draw_begin: +% \draw_dash_pattern:nn +% { 0.5cm , 0.5cm , 0.1cm , 0.2cm } +% { 0cm } +% \draw_path_moveto:n { 0cm , 0cm } +% \draw_path_lineto:n { 2cm , 0cm } +% \draw_path_use_clear:n { stroke } +% \draw_dash_pattern:nn +% { 0.5cm , 0.5cm , 0.1cm , 0.2cm } +% { 0.1cm } +% \draw_path_moveto:n { 0cm , 1mm } +% \draw_path_lineto:n { 2cm , 1mm } +% \draw_path_use_clear:n { stroke } +% \draw_dash_pattern:nn +% { 0.5cm , 0.5cm , 0.1cm , 0.2cm } +% { 0.2cm } +% \draw_path_moveto:n { 0cm , 2mm } +% \draw_path_lineto:n { 2cm , 2mm } +% \draw_path_use_clear:n { stroke } +% \draw_end: +% \end{demo} +% Setting an empty pattern will produce a solid line. +% +% Note the \meta{pattern} interface here is different from that in \pkg{pgf}: +% the list is comma-separated not given in brace groups. +% \end{function} +% % \begin{function}{\draw_nonzero_rule:, \draw_evenodd_rule:} % \begin{syntax} % \cs{draw_nonzero_rule:} @@ -355,14 +401,6 @@ % % \subsubsection{Basic point functions} % -% \begin{function}[EXP]{\draw_point:nn} -% \begin{syntax} -% \cs{draw_point:nn} \Arg{x} \Arg{y} -% \end{syntax} -% Gives the co-ordinates of the point at \meta{x} and \meta{y}, both of -% which are \meta{fp expr}. -% \end{function} -% % \begin{function}[EXP]{\draw_point_polar:nn, \draw_point_polar:nnn} % \begin{syntax} % \cs{draw_point_polar:nn} \Arg{angle} \Arg{radius} @@ -377,27 +415,6 @@ % whilst in \pkg{pgf} they use the same function and a keyword. % \end{function} % -% \begin{function}[EXP]{\draw_point_add:nn} -% \begin{syntax} -% \cs{draw_point_add:nn} \Arg{point1} \Arg{point2} -% \end{syntax} -% Adds \meta{point1} to \meta{point2}. -% \end{function} -% -% \begin{function}[EXP]{\draw_point_diff:nn} -% \begin{syntax} -% \cs{draw_point_diff:nn} \Arg{point1} \Arg{point2} -% \end{syntax} -% Subtracts \meta{point1} from \meta{point2}. -% \end{function} -% -% \begin{function}[EXP]{\draw_point_scale:nn} -% \begin{syntax} -% \cs{draw_point_scale:nn} \Arg{scale} \Arg{point} -% \end{syntax} -% Scales the \meta{point} by the \meta{scale} (an \meta{fp expr}). -% \end{function} -% % \begin{function}[EXP]{\draw_point_unit_vector:n} % \begin{syntax} % \cs{draw_point_unit_vector:n} \Arg{point} @@ -1089,7 +1106,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3draw}{2018/03/05}{} +\ProvidesExplPackage{l3draw}{2018-04-30}{} {L3 Experimental core drawing support} %</package> % \end{macrocode} 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} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx index 8075162f725..4118358ac5c 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.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 % @@ -158,12 +157,12 @@ % \end{macrocode} % % \begin{macrocode} -%<@@=str_format> +%<@@=str> % \end{macrocode} % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3str-format}{2018/03/05}{} +\ProvidesExplPackage{l3str-format}{2018-04-30}{} {L3 Experimental string formatting} %</package> % \end{macrocode} @@ -185,11 +184,11 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_if_digit:NTF} +% \begin{macro}[EXP]{\@@_format_if_digit:NTF} % Here we expect |#1| to be a character with category other, or -% \cs{s__stop}. +% \cs{s_stop}. % \begin{macrocode} -\prg_new_conditional:Npnn \@@_if_digit:N #1 { TF } +\prg_new_conditional:Npnn \@@_format_if_digit:N #1 { TF } { \if_int_compare:w 9 < 1 #1 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: @@ -198,32 +197,32 @@ % \end{macro} % % \begin{macro}[EXP] -% {\@@_put:nw, \@@_put:ow, \@@_put:fw} -% Put |#1| after an \cs{s__stop} delimiter. +% {\@@_format_put:nw, \@@_format_put:ow, \@@_format_put:fw} +% Put |#1| after an \cs{s_stop} delimiter. % \begin{macrocode} -\cs_new:Npn \@@_put:nw #1 #2 \s__stop { #2 \s__stop #1 } -\cs_generate_variant:Nn \@@_put:nw { o , f } +\cs_new:Npn \@@_format_put:nw #1 #2 \s_stop { #2 \s_stop #1 } +\cs_generate_variant:Nn \@@_format_put:nw { o , f } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP, TF]{\@@_if_in:nN} -% \begin{macro}[EXP]{\@@_if_in_aux:NN} -% A copy of \cs{__str_if_contains_char:nNTF} to avoid relying on +% \begin{macro}[EXP, TF]{\@@_format_if_in:nN} +% \begin{macro}[EXP]{\@@_format_if_in_aux:NN} +% A copy of \cs{@@_if_contains_char:nNTF} to avoid relying on % this weird internal string function. % \begin{macrocode} -\prg_new_conditional:Npnn \@@_if_in:nN #1#2 { TF } +\prg_new_conditional:Npnn \@@_format_if_in:nN #1#2 { TF } { - \@@_if_in_aux:NN #2 #1 - { #2 \prg_return_false: \exp_after:wN \__prg_break: \else: } - \__prg_break_point: + \@@_format_if_in_aux:NN #2 #1 + { #2 \prg_return_false: \exp_after:wN \prg_break: \else: } + \prg_break_point: } -\cs_new:Npn \@@_if_in_aux:NN #1#2 +\cs_new:Npn \@@_format_if_in_aux:NN #1#2 { \if_charcode:w #1 #2 \prg_return_true: - \exp_after:wN \__prg_break: + \exp_after:wN \prg_break: \fi: - \@@_if_in_aux:NN #1 + \@@_format_if_in_aux:NN #1 } % \end{macrocode} % \end{macro} @@ -231,17 +230,17 @@ % % \subsection{Parsing a format specification} % -% \begin{macro}[EXP]{\@@_parse:n} +% \begin{macro}[EXP]{\@@_format_parse:n} % \begin{macro}[EXP] % { -% \@@_parse_auxi:NN, -% \@@_parse_auxii:nN, -% \@@_parse_auxiii:nN, -% \@@_parse_auxiv:nwN, -% \@@_parse_auxv:nN, -% \@@_parse_auxvi:nwN, -% \@@_parse_auxvii:nN, -% \@@_parse_end:nwn, +% \@@_format_parse_auxi:NN, +% \@@_format_parse_auxii:nN, +% \@@_format_parse_auxiii:nN, +% \@@_format_parse_auxiv:nwN, +% \@@_format_parse_auxv:nN, +% \@@_format_parse_auxvi:nwN, +% \@@_format_parse_auxvii:nN, +% \@@_format_parse_end:nwn, % } % The goal is to parse % \begin{equation*} @@ -249,59 +248,59 @@ % [\meta{sign}] [\meta{width}] [.\meta{precision}] [\meta{style}] % \end{equation*} % \begin{macrocode} -\cs_new:Npn \@@_parse:n #1 +\cs_new:Npn \@@_format_parse:n #1 { - \exp_last_unbraced:Nf \@@_parse_auxi:NN - \__str_to_other:n {#1} \s__stop \s__stop {#1} + \exp_last_unbraced:Nf \@@_format_parse_auxi:NN + { \__kernel_str_to_other:n {#1} } \s_stop \s_stop {#1} } -\cs_new:Npx \@@_parse_auxi:NN #1#2 +\cs_new:Npx \@@_format_parse_auxi:NN #1#2 { - \exp_not:N \@@_if_in:nNTF { < > = ^ } #2 - { \exp_not:N \@@_parse_auxiii:nN { #1 #2 } } + \exp_not:N \@@_format_if_in:nNTF { < > = ^ } #2 + { \exp_not:N \@@_format_parse_auxiii:nN { #1 #2 } } { - \exp_not:N \@@_parse_auxii:nN + \exp_not:N \@@_format_parse_auxii:nN { \c_catcode_other_space_tl } #1 #2 } } -\cs_new:Npn \@@_parse_auxii:nN #1#2 +\cs_new:Npn \@@_format_parse_auxii:nN #1#2 { - \@@_if_in:nNTF { < > = ^ } #2 - { \@@_parse_auxiii:nN { #1 #2 } } - { \@@_parse_auxiii:nN { #1 ? } #2 } + \@@_format_if_in:nNTF { < > = ^ } #2 + { \@@_format_parse_auxiii:nN { #1 #2 } } + { \@@_format_parse_auxiii:nN { #1 ? } #2 } } -\cs_new:Npx \@@_parse_auxiii:nN #1#2 +\cs_new:Npx \@@_format_parse_auxiii:nN #1#2 { - \exp_not:N \@@_if_in:nNTF + \exp_not:N \@@_format_if_in:nNTF { + - \c_catcode_other_space_tl } #2 - { \exp_not:N \@@_parse_auxiv:nwN { #1 #2 } ; } - { \exp_not:N \@@_parse_auxiv:nwN { #1 ? } ; #2 } + { \exp_not:N \@@_format_parse_auxiv:nwN { #1 #2 } ; } + { \exp_not:N \@@_format_parse_auxiv:nwN { #1 ? } ; #2 } } -\cs_new:Npn \@@_parse_auxiv:nwN #1#2; #3 +\cs_new:Npn \@@_format_parse_auxiv:nwN #1#2; #3 { - \@@_if_digit:NTF #3 - { \@@_parse_auxiv:nwN {#1} #2 #3 ; } - { \@@_parse_auxv:nN { #1 {#2} } #3 } + \@@_format_if_digit:NTF #3 + { \@@_format_parse_auxiv:nwN {#1} #2 #3 ; } + { \@@_format_parse_auxv:nN { #1 {#2} } #3 } } -\cs_new:Npn \@@_parse_auxv:nN #1#2 +\cs_new:Npn \@@_format_parse_auxv:nN #1#2 { \token_if_eq_charcode:NNTF . #2 - { \@@_parse_auxvi:nwN {#1} 0 ; } - { \@@_parse_auxvii:nN { #1 { } } #2 } + { \@@_format_parse_auxvi:nwN {#1} 0 ; } + { \@@_format_parse_auxvii:nN { #1 { } } #2 } } -\cs_new:Npn \@@_parse_auxvi:nwN #1#2; #3 +\cs_new:Npn \@@_format_parse_auxvi:nwN #1#2; #3 { - \@@_if_digit:NTF #3 - { \@@_parse_auxvi:nwN {#1} #2 #3 ; } - { \@@_parse_auxvii:nN { #1 {#2} } #3 } + \@@_format_if_digit:NTF #3 + { \@@_format_parse_auxvi:nwN {#1} #2 #3 ; } + { \@@_format_parse_auxvii:nN { #1 {#2} } #3 } } -\cs_new:Npn \@@_parse_auxvii:nN #1#2 +\cs_new:Npn \@@_format_parse_auxvii:nN #1#2 { - \token_if_eq_meaning:NNTF \s__stop #2 - { \@@_parse_end:nwn { #1 ? } #2 } - { \@@_parse_end:nwn { #1 #2 } } + \token_if_eq_meaning:NNTF \s_stop #2 + { \@@_format_parse_end:nwn { #1 ? } #2 } + { \@@_format_parse_end:nwn { #1 #2 } } } -\cs_new:Npn \@@_parse_end:nwn #1 #2 \s__stop \s__stop #3 +\cs_new:Npn \@@_format_parse_end:nwn #1 #2 \s_stop \s_stop #3 { \tl_if_empty:nF {#2} { \__kernel_msg_expandable_error:nnn { str } { invalid-format } {#3} } @@ -323,40 +322,40 @@ % padding between the \meta{sign} and the \meta{body}, hence the need to % keep those separate. % -% \begin{macro}[EXP]{\@@_align_<:nnnN} +% \begin{macro}[EXP]{\@@_format_align_<:nnnN} % \begin{quote} -% \cs{@@_align_<:nnnN} \Arg{body} \Arg{sign} \Arg{width} +% \cs{@@_format_align_<:nnnN} \Arg{body} \Arg{sign} \Arg{width} % \meta{fill} % \end{quote} % Aligning \enquote{\meta{sign} \meta{body}} to the left % entails appending |#4| the correct number of times. Then convert % the result to a string. % \begin{macrocode} -\cs_new:cpn { @@_align_<:nnnN } #1#2#3#4 +\cs_new:cpn { @@_format_align_<:nnnN } #1#2#3#4 { \use:nf { #2 #1 } { \prg_replicate:nn - { \int_max:nn { #3 - \__str_count:n { #2 #1 } } { 0 } } + { \int_max:nn { #3 - \@@_count:n { #2 #1 } } { 0 } } {#4} } } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_align_>:nnnN} +% \begin{macro}[EXP]{\@@_format_align_>:nnnN} % \begin{quote} -% \cs{@@_align_>:nnnN} \Arg{body} \Arg{sign} \Arg{width} +% \cs{@@_format_align_>:nnnN} \Arg{body} \Arg{sign} \Arg{width} % \meta{fill} % \end{quote} % Aligning an \enquote{\meta{sign} \meta{body}} to the right % entails prepending |#4| the correct number of times. Then convert % the result to a string. % \begin{macrocode} -\cs_new:cpn { @@_align_>:nnnN } #1#2#3#4 +\cs_new:cpn { @@_format_align_>:nnnN } #1#2#3#4 { \prg_replicate:nn - { \int_max:nn { #3 - \__str_count:n { #2 #1 } } { 0 } } + { \int_max:nn { #3 - \@@_count:n { #2 #1 } } { 0 } } {#4} #2 #1 } @@ -364,9 +363,9 @@ % \end{macro} % % \begingroup\catcode`\^=12 -% \begin{macro}[EXP]{\@@_align_^:nnnN} +% \begin{macro}[EXP]{\@@_format_align_^:nnnN} % \begin{quote} -% \cs{@@_align_^:nnnN} \Arg{body} \Arg{sign} \Arg{width} +% \cs{@@_format_align_^:nnnN} \Arg{body} \Arg{sign} \Arg{width} % \meta{fill} % \end{quote} % Centering \enquote{\meta{sign} \meta{body}} entails @@ -374,14 +373,14 @@ % number of |#4| to be added is odd, we add one more after than % before. % \begin{macrocode} -\cs_new:cpn { @@_align_^:nnnN } #1#2#3#4 +\cs_new:cpn { @@_format_align_^:nnnN } #1#2#3#4 { \use:fnf { \prg_replicate:nn { \int_max:nn { 0 } - { #3 - \__str_count:n { #2 #1 } - 1 } + { #3 - \@@_count:n { #2 #1 } - 1 } / 2 } {#4} @@ -391,7 +390,7 @@ \prg_replicate:nn { \int_max:nn { 0 } - { #3 - \__str_count:n { #2 #1 } } + { #3 - \@@_count:n { #2 #1 } } / 2 } {#4} @@ -401,21 +400,21 @@ % \end{macro} % \endgroup % -% \begin{macro}[EXP]{\@@_align_=:nnnN} +% \begin{macro}[EXP]{\@@_format_align_=:nnnN} % \begin{quote} -% \cs{@@_align_=:nnnN} \Arg{body} \Arg{sign} \Arg{width} +% \cs{@@_format_align_=:nnnN} \Arg{body} \Arg{sign} \Arg{width} % \meta{fill} % \end{quote} % The special numeric alignment |=| means that we insert the % appropriate number of copies of |#4| between the \meta{sign} and the % \meta{body}. Then convert the result to a string. % \begin{macrocode} -\cs_new:cpn { @@_align_=:nnnN } #1#2#3#4 +\cs_new:cpn { @@_format_align_=:nnnN } #1#2#3#4 { \use:nf {#2} { \prg_replicate:nn - { \int_max:nn { #3 - \__str_count:n { #2 #1 } } { 0 } } + { \int_max:nn { #3 - \@@_count:n { #2 #1 } } { 0 } } {#4} } #1 @@ -427,7 +426,7 @@ % \subsection{Formatting token lists} % % \begin{macro}[EXP]{\tl_format:Nn, \tl_format:cn, \tl_format:nn} -% Call \cs{@@_tl:NNNnnNn} to read the parsed \meta{format +% Call \cs{@@_format_tl:NNNnnNn} to read the parsed \meta{format % specification}. Then convert the result to a string. % \begin{macrocode} \cs_new:Npn \tl_format:Nn { \exp_args:No \tl_format:nn } @@ -436,52 +435,52 @@ { \tl_to_str:f { - \exp_last_unbraced:Nf \@@_tl:NNNnnNn - { \@@_parse:n {#2} } + \exp_last_unbraced:Nf \@@_format_tl:NNNnnNn + { \@@_format_parse:n {#2} } {#1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_tl:NNNnnNn} +% \begin{macro}[EXP]{\@@_format_tl:NNNnnNn} % \begin{quote} -% \cs{@@_tl:NNNnnNn} \meta{fill} \meta{alignment} \meta{sign} +% \cs{@@_format_tl:NNNnnNn} \meta{fill} \meta{alignment} \meta{sign} % \Arg{width} \Arg{precision} \meta{style} \Arg{token list} % \end{quote} % First check that the \meta{alignment} is not |=|, and set the % default alignment |?| to |<|. Place the modified information after -% a trailing \cs{s__stop} for later retrieval. Then check that there +% a trailing \cs{s_stop} for later retrieval. Then check that there % was no \meta{sign}. The width will be useful later, store it after -% \cs{s__stop}. Afterwards, store the precision, and the function -% \cs{__str_range:nnn} that will be used to extract the first +% \cs{s_stop}. Afterwards, store the precision, and the function +% \cs{@@_range:nnn} that will be used to extract the first % |#5| characters of the string. % There is a need to use the internal function, as otherwise % leading spaces would get stripped by |f|-expansion. Finally, check % that the \meta{style} is |?| or |s|. % \begin{macrocode} -\cs_new:Npn \@@_tl:NNNnnNn #1#2#3#4#5#6 +\cs_new:Npn \@@_format_tl:NNNnnNn #1#2#3#4#5#6 { \token_if_eq_charcode:NNTF #2 = { \__kernel_msg_expandable_error:nnnn { str } { invalid-align-format } {#2} {tl} - \@@_put:nw { #1 < } + \@@_format_put:nw { #1 < } } { \token_if_eq_charcode:NNTF #2 ? - { \@@_put:nw { #1 < } } - { \@@_put:nw { #1 #2 } } + { \@@_format_put:nw { #1 < } } + { \@@_format_put:nw { #1 #2 } } } \token_if_eq_charcode:NNF #3 ? { \__kernel_msg_expandable_error:nnnn { str } { invalid-sign-format } {#3} {tl} } - \@@_put:nw { {#4} } + \@@_format_put:nw { {#4} } \tl_if_empty:nTF {#5} - { \@@_put:nw { \__str_range:nnn { {1} {-1} } } } - { \@@_put:nw { \__str_range:nnn { {1} {#5} } } } + { \@@_format_put:nw { \@@_range:nnn { {1} {-1} } } } + { \@@_format_put:nw { \@@_range:nnn { {1} {#5} } } } \token_if_eq_charcode:NNF #6 s { \token_if_eq_charcode:NNF #6 ? @@ -490,15 +489,15 @@ { str } { invalid-style-format } {#6} {tl} } } - \@@_tl_s:NNnnNNn - \s__stop + \@@_format_tl_s:NNnnNNn + \s_stop } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_tl_s:NNnnNNn} +% \begin{macro}[EXP]{\@@_format_tl_s:NNnnNNn} % \begin{quote} -% \cs{@@_tl_s:NNnnNNn} \cs{s__stop} \meta{function} +% \cs{@@_format_tl_s:NNnnNNn} \cs{s_stop} \meta{function} % \Arg{arguments} \Arg{width} \meta{fill} \meta{alignment} % \Arg{token list} % \end{quote} @@ -506,13 +505,13 @@ % that |f|-expanding \meta{function} \Arg{other string} % \meta{arguments} yields the piece of the \meta{other string} that we % want to output. The \meta{other string} is built from the -% \meta{token list} by |f|-expanding \cs{__str_to_other:n}. +% \meta{token list} by |f|-expanding \cs{__kernel_str_to_other:n}. % \begin{macrocode} -\cs_new:Npn \@@_tl_s:NNnnNNn #1#2#3#4#5#6#7 +\cs_new:Npn \@@_format_tl_s:NNnnNNn #1#2#3#4#5#6#7 { \exp_args:Nc \exp_args:Nf - { @@_align_#6:nnnN } - { \exp_args:Nf #2 { \__str_to_other:n {#7} } #3 } + { @@_format_align_#6:nnnN } + { \exp_args:Nf #2 { \__kernel_str_to_other:n {#7} } #3 } { } {#4} #5 } @@ -530,32 +529,32 @@ { \tl_to_str:f { - \@@_seq:ff + \@@_format_seq:ff { \exp_after:wN \use_i:nn \exp_after:wN \exp_stop_f: #1 } - { \@@_parse:n {#2} } + { \@@_format_parse:n {#2} } } } \cs_generate_variant:Nn \seq_format:Nn { c } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_seq:nn, \@@_seq:ff} +% \begin{macro}[EXP]{\@@_format_seq:nn, \@@_format_seq:ff} % The first argument is the contents of a \texttt{seq} variable. The % second is a parsed \meta{format specification}. Set up the loop. % \begin{macrocode} -\cs_new:Npn \@@_seq:nn #1#2 +\cs_new:Npn \@@_format_seq:nn #1#2 { - \@@_seq_loop:nnNn { } {#2} + \@@_format_seq_loop:nnNn { } {#2} #1 - { ? \@@_seq_end:w } { } + { ? \@@_format_seq_end:w } { } } -\cs_generate_variant:Nn \@@_seq:nn { ff } +\cs_generate_variant:Nn \@@_format_seq:nn { ff } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_seq_loop:nnNn} +% \begin{macro}[EXP]{\@@_format_seq_loop:nnNn} % \begin{quote} -% \cs{@@_seq_loop:nnNn} \Arg{done} \Arg{parsed format} +% \cs{@@_format_seq_loop:nnNn} \Arg{done} \Arg{parsed format} % \cs{__seq_item:n} \Arg{item} % \end{quote} % The first argument is the result of formatting the items read so @@ -563,81 +562,81 @@ % until we reach the end of the sequence, where |\use_none:n #3| ends % the loop. % \begin{macrocode} -\cs_new:Npn \@@_seq_loop:nnNn #1#2#3#4 +\cs_new:Npn \@@_format_seq_loop:nnNn #1#2#3#4 { \use_none:n #3 - \exp_args:Nf \@@_seq_loop:nnNn - { \use:nf {#1} { \@@_tl:NNNnnNn #2 {#4} } } + \exp_args:Nf \@@_format_seq_loop:nnNn + { \use:nf {#1} { \@@_format_tl:NNNnnNn #2 {#4} } } {#2} } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_seq_end:w} +% \begin{macro}[EXP]{\@@_format_seq_end:w} % Pick the right piece in the loop above. % \begin{macrocode} -\cs_new:Npn \@@_seq_end:w #1#2#3#4 { \use_ii:nnn #3 } +\cs_new:Npn \@@_format_seq_end:w #1#2#3#4 { \use_ii:nnn #3 } % \end{macrocode} % \end{macro} % % \subsection{Formatting integers} % % \begin{macro}[EXP]{\int_format:nn} -% Evaluate the first argument and feed it to \cs{@@_int:nn}. +% Evaluate the first argument and feed it to \cs{@@_format_int:nn}. % \begin{macrocode} \cs_new:Npn \int_format:nn #1 - { \exp_args:Nf \@@_int:nn { \int_eval:n {#1} } } + { \exp_args:Nf \@@_format_int:nn { \int_eval:n {#1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_int:nn} +% \begin{macro}[EXP]{\@@_format_int:nn} % Parse the \meta{format specification} and feed it to -% \cs{@@_int:NNNnnNn}. Then convert the result to a string +% \cs{@@_format_int:NNNnnNn}. Then convert the result to a string % \begin{macrocode} -\cs_new:Npn \@@_int:nn #1#2 +\cs_new:Npn \@@_format_int:nn #1#2 { \tl_to_str:f { - \exp_last_unbraced:Nf \@@_int:NNNnnNn - { \@@_parse:n {#2} } + \exp_last_unbraced:Nf \@@_format_int:NNNnnNn + { \@@_format_parse:n {#2} } {#1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_int:NNNnnNn} +% \begin{macro}[EXP]{\@@_format_int:NNNnnNn} % \begin{quote} -% \cs{@@_int:NNNnnNn} \meta{fill} \meta{alignment} +% \cs{@@_format_int:NNNnnNn} \meta{fill} \meta{alignment} % \meta{sign} \Arg{width} \Arg{precision} \meta{style} \Arg{integer} % \end{quote} % First set the % default alignment |?| to |>|. Place the modified information after -% a trailing \cs{s__stop} for later retrieval. Then check the +% a trailing \cs{s_stop} for later retrieval. Then check the % \meta{sign}: if the integer is negative, always put~|-|. Otherwise, % if the format's \meta{sign} is |~|, put a space (with category % \enquote{other}); if it is~|+| put |+|; if it is |-| (default), put % nothing, represented as a brace group. The width |#4| will be -% useful later, store it after \cs{s__stop}. Afterwards, check that +% useful later, store it after \cs{s_stop}. Afterwards, check that % the \meta{precision} was absent. Finally, dispatch depending on the % \meta{style}. % \begin{macrocode} -\cs_new:Npn \@@_int:NNNnnNn #1#2#3#4#5#6#7 +\cs_new:Npn \@@_format_int:NNNnnNn #1#2#3#4#5#6#7 { \token_if_eq_charcode:NNTF #2 ? - { \@@_put:nw { #1 > } } - { \@@_put:nw { #1 #2 } } + { \@@_format_put:nw { #1 > } } + { \@@_format_put:nw { #1 #2 } } \int_compare:nNnTF {#7} < 0 - { \@@_put:nw { - } } + { \@@_format_put:nw { - } } { \str_case:nnF {#3} { - { ~ } { \@@_put:ow { \c_catcode_other_space_tl } } - { + } { \@@_put:nw { + } } + { ~ } { \@@_format_put:ow { \c_catcode_other_space_tl } } + { + } { \@@_format_put:nw { + } } } - { \@@_put:nw { { } } } + { \@@_format_put:nw { { } } } } - \@@_put:nw { {#4} } + \@@_format_put:nw { {#4} } \tl_if_empty:nF {#5} { \__kernel_msg_expandable_error:nnnn @@ -645,25 +644,25 @@ } \str_case:nnF {#6} { - { ? } { \@@_int:NwnnNNn \use:n } - { d } { \@@_int:NwnnNNn \use:n } - { b } { \@@_int:NwnnNNn \int_to_bin:n } - { o } { \@@_int:NwnnNNn \int_to_oct:n } - { X } { \@@_int:NwnnNNn \int_to_Hex:n } + { ? } { \@@_format_int:NwnnNNn \use:n } + { d } { \@@_format_int:NwnnNNn \use:n } + { b } { \@@_format_int:NwnnNNn \int_to_bin:n } + { o } { \@@_format_int:NwnnNNn \int_to_oct:n } + { X } { \@@_format_int:NwnnNNn \int_to_Hex:n } } { \__kernel_msg_expandable_error:nnnn { str } { invalid-style-format } {#6} { int } - \@@_int:NwnnNNn \use:n + \@@_format_int:NwnnNNn \use:n } - \s__stop {#7} + \s_stop {#7} } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_int:NwnnNNn} +% \begin{macro}[EXP]{\@@_format_int:NwnnNNn} % \begin{quote} -% \cs{@@_int:NwnnNNn} \meta{function} \cs{s__stop} +% \cs{@@_format_int:NwnnNNn} \meta{function} \cs{s_stop} % \Arg{width} \Arg{sign} \meta{fill} \meta{alignment} \Arg{integer} % \end{quote} % Use the |format_align| function corresponding to the @@ -676,115 +675,115 @@ % \item the \meta{fill} character. % \end{itemize} % \begin{macrocode} -\cs_new:Npn \@@_int:NwnnNNn #1#2 \s__stop #3#4#5#6#7 +\cs_new:Npn \@@_format_int:NwnnNNn #1#2 \s_stop #3#4#5#6#7 { \exp_args:Nc \exp_args:Nf - { @@_align_#6:nnnN } + { @@_format_align_#6:nnnN } { #1 { \int_abs:n {#7} } } {#4} {#3} #5 } % \end{macrocode} -% ^^A todo: note similarity with \@@_tl_s:NNnnNNn +% ^^A todo: note similarity with \@@_format_tl_s:NNnnNNn % \end{macro} % % \subsection{Formatting floating points} % % \begin{macro}[EXP]{\fp_format:nn} % Evaluate the first argument to an internal floating point number, and -% feed it to \cs{@@_fp:nn}. +% feed it to \cs{@@_format_fp:nn}. % \begin{macrocode} \cs_new:Npn \fp_format:nn #1 - { \exp_args:Nf \@@_fp:nn { \__fp_parse:n {#1} } } + { \exp_args:Nf \@@_format_fp:nn { \__fp_parse:n {#1} } } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_fp:nn} +% \begin{macro}[EXP]{\@@_format_fp:nn} % Parse the \meta{format specification} and feed it to -% \cs{@@_fp:NNNnnNn}. Then convert the result to a string +% \cs{@@_format_fp:NNNnnNn}. Then convert the result to a string % \begin{macrocode} -\cs_new:Npn \@@_fp:nn #1#2 +\cs_new:Npn \@@_format_fp:nn #1#2 { \tl_to_str:f { - \exp_last_unbraced:Nf \@@_fp:NNNnnNw - { \@@_parse:n {#2} } + \exp_last_unbraced:Nf \@@_format_fp:NNNnnNw + { \@@_format_parse:n {#2} } #1 } } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_fp:NNNnnNw} +% \begin{macro}[EXP]{\@@_format_fp:NNNnnNw} % \begin{quote} -% \cs{@@_fp:NNNnnNw} \meta{fill} \meta{alignment} +% \cs{@@_format_fp:NNNnnNw} \meta{fill} \meta{alignment} % \meta{format sign} \Arg{width} \Arg{precision} \meta{style} % \cs{s__fp} \cs{__fp_chk:w} \meta{fp type} \meta{fp sign} \meta{fp % body} |;| % \end{quote} % First set the default alignment |?| to |>|. Place the modified -% information after a trailing \cs{s__stop} for later retrieval. Then +% information after a trailing \cs{s_stop} for later retrieval. Then % check the \meta{format sign} and the \meta{fp sign}: if the floating % point is negative, always put~|-|. Otherwise (including % \texttt{nan}), if the format's \meta{sign} is |~|, put a space (with % category \enquote{other}); if it is~|+| put |+|; if it is |-| % (default), put nothing, represented as a brace group. The width -% |#4| will be useful later, store it after \cs{s__stop}. Afterwards, +% |#4| will be useful later, store it after \cs{s_stop}. Afterwards, % check the \meta{precision}: if it was not given, replace it by $6$ % (default precision). Finally, dispatch depending on the % \meta{style}. % \begin{macrocode} -\cs_new:Npn \@@_fp:NNNnnNw +\cs_new:Npn \@@_format_fp:NNNnnNw #1#2#3#4#5#6 \s__fp \__fp_chk:w #7 #8 { \token_if_eq_charcode:NNTF #2 ? - { \@@_put:nw { #1 > } } - { \@@_put:nw { #1 #2 } } + { \@@_format_put:nw { #1 > } } + { \@@_format_put:nw { #1 #2 } } \token_if_eq_meaning:NNTF 2 #8 - { \@@_put:nw { - } } + { \@@_format_put:nw { - } } { \str_case:nnF {#3} { - { ~ } { \@@_put:ow { \c_catcode_other_space_tl } } - { + } { \@@_put:nw { + } } + { ~ } { \@@_format_put:ow { \c_catcode_other_space_tl } } + { + } { \@@_format_put:nw { + } } } - { \@@_put:nw { { } } } + { \@@_format_put:nw { { } } } } - \@@_put:nw { {#4} } + \@@_format_put:nw { {#4} } \tl_if_empty:nTF {#5} - { \@@_put:nw { { 6} } } - { \@@_put:nw { {#5} } } + { \@@_format_put:nw { { 6} } } + { \@@_format_put:nw { {#5} } } \str_case:nnF {#6} { - { e } { \@@_fp:wnnnNNw \@@_fp_e:wn } - { f } { \@@_fp:wnnnNNw \@@_fp_f:wn } - { g } { \@@_fp:wnnnNNw \@@_fp_g:wn } - { ? } { \@@_fp:wnnnNNw \@@_fp_g:wn } + { e } { \@@_format_fp:wnnnNNw \@@_format_fp_e:wn } + { f } { \@@_format_fp:wnnnNNw \@@_format_fp_f:wn } + { g } { \@@_format_fp:wnnnNNw \@@_format_fp_g:wn } + { ? } { \@@_format_fp:wnnnNNw \@@_format_fp_g:wn } } { \__kernel_msg_expandable_error:nnnn { str } { invalid-style-format } {#6} { fp } - \@@_fp:wnnnNNw \@@_fp_g:wn + \@@_format_fp:wnnnNNw \@@_format_fp_g:wn } - \s__stop + \s_stop \s__fp \__fp_chk:w #7 #8 } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_fp:wnnnNNw} +% \begin{macro}[EXP]{\@@_format_fp:wnnnNNw} % \begin{quote} -% \cs{@@_fp:wnnnNNw} \meta{formatting function} \cs{s__stop} +% \cs{@@_format_fp:wnnnNNw} \meta{formatting function} \cs{s_stop} % \Arg{precision} \Arg{width} \Arg{sign} \meta{fill} % \meta{alignment} \cs{s__fp} \cs{__fp_chk:w} \meta{fp type} % \meta{fp sign} \meta{fp body} |;| % \end{quote} % \begin{macrocode} -\cs_new:Npn \@@_fp:wnnnNNw - #1 \s__stop #2 #3 #4 #5#6 #7 ; +\cs_new:Npn \@@_format_fp:wnnnNNw + #1 \s_stop #2 #3 #4 #5#6 #7 ; { \exp_args:Nc \exp_args:Nf - { @@_align_#6:nnnN } + { @@_format_align_#6:nnnN } { #1 #7 ; {#2} } {#4} {#3} #5 @@ -792,22 +791,22 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_fp_round:wn} +% \begin{macro}[EXP]{\@@_format_fp_round:wn} % Round the given floating point (not its absolute value, to play % nicely with unusual rounding modes). % \begin{macrocode} -\cs_new:Npn \@@_fp_round:wn #1 ; #2 +\cs_new:Npn \@@_format_fp_round:wn #1 ; #2 { \__fp_parse:n { round ( #1; , #2 - \__fp_exponent:w #1; ) } } % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP]{\@@_fp_e:wn} -% \begin{macro}[EXP]{\@@_fp_e_aux:wn} +% \begin{macro}[EXP]{\@@_format_fp_e:wn} +% \begin{macro}[EXP]{\@@_format_fp_e_aux:wn} % With the |e| type, first filter out special cases. In the normal % case, round to |#4+1| significant figures (one before the decimal % separator, |#4| after). % \begin{macrocode} -\cs_new:Npn \@@_fp_e:wn \s__fp \__fp_chk:w #1#2#3 ; #4 +\cs_new:Npn \@@_format_fp_e:wn \s__fp \__fp_chk:w #1#2#3 ; #4 { \int_case:nnF {#1} { @@ -816,38 +815,38 @@ { 3 } { nan } } { - \exp_last_unbraced:Nf \@@_fp_e_aux:wn - \@@_fp_round:wn \s__fp \__fp_chk:w #1#2#3 ; { #4 + 1 } + \exp_last_unbraced:Nf \@@_format_fp_e_aux:wn + { \@@_format_fp_round:wn \s__fp \__fp_chk:w #1#2#3 ; { #4 + 1 } } {#4} } } -\cs_new:Npn \@@_fp_e_aux:wn +\cs_new:Npn \@@_format_fp_e_aux:wn \s__fp \__fp_chk:w #1#2 #3 #4#5#6#7 ; #8 { - \@@_put:fw { \int_eval:n { #3 - 1 } } - \@@_put:nw { e } + \@@_format_put:fw { \int_eval:n { #3 - 1 } } + \@@_format_put:nw { e } \int_compare:nNnTF {#8} > \c__fp_prec_int { - \@@_put:fw { \prg_replicate:nn { #8 - \c__fp_prec_int + 1 } {0} } - \@@_put:fw { \use_none:n #4#5#6#7 } + \@@_format_put:fw { \prg_replicate:nn { #8 - \c__fp_prec_int + 1 } {0} } + \@@_format_put:fw { \use_none:n #4#5#6#7 } } { - \@@_put:fw + \@@_format_put:fw { \str_range:nnn { #4#5#6#7 0 } { 2 } { #8 + 1 } } } - \@@_put:fw { \use_i:nnnn #4 . } - \use_none:n \s__stop + \@@_format_put:fw { \use_i:nnnn #4 . } + \use_none:n \s_stop } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\@@_fp_f:wn} -% \begin{macro}[EXP]{\@@_fp_f_aux:wwwn} +% \begin{macro}[EXP]{\@@_format_fp_f:wn} +% \begin{macro}[EXP]{\@@_format_fp_f_aux:wwwn} % With the |f| type, first filter out special cases. In the normal % case, round to |#4| (absolute) decimal places. % \begin{macrocode} -\cs_new:Npn \@@_fp_f:wn \s__fp \__fp_chk:w #1#2#3 ; #4 +\cs_new:Npn \@@_format_fp_f:wn \s__fp \__fp_chk:w #1#2#3 ; #4 { \int_case:nnF {#1} { @@ -856,26 +855,28 @@ {3} { nan } } { - \exp_last_unbraced:Nf \@@_fp_f_aux:wwwn - \fp_to_decimal:n - { abs ( round ( \s__fp \__fp_chk:w #1#2#3 ; , #4 ) ) } + \exp_last_unbraced:Nf \@@_format_fp_f_aux:wwwn + { + \fp_to_decimal:n + { abs ( round ( \s__fp \__fp_chk:w #1#2#3 ; , #4 ) ) } + } . . ; {#4} } } -\cs_new:Npn \@@_fp_f_aux:wwwn #1 . #2 . #3 ; #4 +\cs_new:Npn \@@_format_fp_f_aux:wwwn #1 . #2 . #3 ; #4 { \use:nf { #1 . #2 } - { \prg_replicate:nn { #4 - \__str_count:n {#2} } {0} } + { \prg_replicate:nn { #4 - \@@_count:n {#2} } {0} } } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\@@_fp_g:wn} -% \begin{macro}[EXP]{\@@_fp_g_aux:wn} -% \begin{macro}[EXP]{\@@_fp_to_scientific:n, \@@_fp_trim:w} +% \begin{macro}[EXP]{\@@_format_fp_g:wn} +% \begin{macro}[EXP]{\@@_format_fp_g_aux:wn} +% \begin{macro}[EXP]{\@@_format_fp_to_scientific:n, \@@_format_fp_trim:w} % With the |g| type, first filter out special cases. In the normal % case, round to |#4| significant figures, then test the exponent: if % $-4\leq \meta{exponent} < \meta{precision}$, use the presentation @@ -886,7 +887,7 @@ % \cs{fp_to_decimal:n} and \cs{fp_to_scientific:n}, acting on the % (absolute value of the) rounded value. % \begin{macrocode} -\cs_new:Npn \@@_fp_g:wn \s__fp \__fp_chk:w #1#2 ; #3 +\cs_new:Npn \@@_format_fp_g:wn \s__fp \__fp_chk:w #1#2 ; #3 { \int_case:nnF {#1} { @@ -895,29 +896,31 @@ {3} { nan } } { - \exp_last_unbraced:Nf \@@_fp_g_aux:wn - \@@_fp_round:wn \s__fp \__fp_chk:w #1#2 ; - { \int_max:nn {1} {#3} } + \exp_last_unbraced:Nf \@@_format_fp_g_aux:wn + { + \@@_format_fp_round:wn \s__fp \__fp_chk:w #1#2 ; + { \int_max:nn {1} {#3} } + } { \int_max:nn {1} {#3} } } } -\cs_new:Npn \@@_fp_g_aux:wn #1; #2 +\cs_new:Npn \@@_format_fp_g_aux:wn #1; #2 { \int_compare:nNnTF { \__fp_exponent:w #1; } < { -3 } - { \@@_to_scientific:n } + { \@@_format_to_scientific:n } { \int_compare:nNnTF { \__fp_exponent:w #1; } > {#2} - { \@@_to_scientific:n } + { \@@_format_to_scientific:n } { \fp_to_decimal:n } } { \__fp_set_sign_o:w 0 #1; @ \prg_do_nothing: } } -\cs_new:Npn \@@_to_scientific:n +\cs_new:Npn \@@_format_to_scientific:n { - \exp_after:wN \@@_fp_trim:w + \exp_after:wN \@@_format_fp_trim:w \exp:w \exp_end_continue_f:w \fp_to_scientific:n } -\cs_new:Npn \@@_fp_trim:w #1 e { \__fp_trim_zeros:w #1 ; e } +\cs_new:Npn \@@_format_fp_trim:w #1 e { \__fp_trim_zeros:w #1 ; e } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx index e4a7b5b12ea..e5981dcb044 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xcoffins/xcoffins.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: xcoffins.dtx Copyright(C) 2010-2012,2014,2016,2017 The LaTeX3 Project +%% File: xcoffins.dtx Copyright(C) 2010-2012,2014,2016-2018 The LaTeX3 Project % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -54,7 +54,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -673,7 +673,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xcoffins}{2018/03/05}{} +\ProvidesExplPackage{xcoffins}{2018-04-30}{} {L3 Experimental design level coffins} % \end{macrocode} % @@ -890,13 +890,13 @@ % sign, \emph{etc.} % \begin{macrocode} \NewDocumentCommand \CoffinDepth { m } - { \coffin_dp:N #1 } + { \dim_eval:n { \coffin_dp:N #1 } } \NewDocumentCommand \CoffinHeight { m } - { \coffin_ht:N #1 } + { \dim_eval:n { \coffin_ht:N #1 } } \NewDocumentCommand \CoffinTotalHeight { m } - { \__dim_eval:n { \coffin_ht:N #1 + \coffin_dp:N #1 } } + { \dim_eval:n { \coffin_ht:N #1 + \coffin_dp:N #1 } } \NewDocumentCommand \CoffinWidth { m } - { \coffin_wd:N #1 } + { \dim_eval:n { \coffin_wd:N #1 } } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx index f0ff78ee457..1821ea5a0f8 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx @@ -59,7 +59,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -685,7 +685,7 @@ % % \begin{macrocode} %<*package> -\ProvidesExplPackage{l3galley}{2018/03/05}{} +\ProvidesExplPackage{l3galley}{2018-04-30}{} {L3 Experimental galley code} %</package> % \end{macrocode} @@ -1144,10 +1144,10 @@ % % \subsection{The \cs{par} token} % -% \begin{variable}{\s__par_omit} +% \begin{variable}{\s_@@_par_omit} % Used to indicate that a paragraph should be omitted. % \begin{macrocode} -\__scan_new:N \s__par_omit +\scan_new:N \s_@@_par_omit % \end{macrocode} % \end{variable} % @@ -1162,18 +1162,18 @@ % \begin{macrocode} \cs_new_protected:Npn \galley_par: { - \s__par_omit + \s_@@_par_omit \exp_after:wN \@@_par_auxi: \exp:w \exp_end_continue_f:w } \cs_new_protected:Npn \@@_par_auxi: { - \peek_meaning:NTF \s__par_omit + \peek_meaning:NTF \s_@@_par_omit { \@@_par_aux:N } { \@@_par_auxii: } } \cs_new_protected:Npn \@@_par_aux:N #1 { - \str_if_eq_x:nnF {#1} { \s__par_omit } + \str_if_eq_x:nnF {#1} { \s_@@_par_omit } { \@@_par_auxii: #1 @@ -1283,7 +1283,7 @@ % \begin{macrocode} \cs_new_protected:Npn \galley_par:n #1 { - \s__par_omit + \s_@@_par_omit \bool_if:NF \g_@@_begin_level_bool { #1 @@ -1584,7 +1584,7 @@ } { \tex_penalty:D - \__int_eval:n { \g_@@_interpar_penalty_user_tl } + \int_eval:n { \g_@@_interpar_penalty_user_tl } \exp_stop_f: \tl_gclear:N \g_@@_interpar_penalty_user_tl } \bool_gset_false:N \g_galley_no_break_next_bool @@ -1863,15 +1863,15 @@ \cs_new_protected:Npn \@@_parshape_set_indents:NN #1#2 { \tex_parshape:D - \__int_eval:n - { \int_min:nn { \seq_count:N #1 } { \seq_count:N #2 } } + \int_min:nn { \seq_count:N #1 } { \seq_count:N #2 } + \exp_stop_f: \seq_mapthread_function:NNN #1 #2 \@@_parshape_set_indents:nn } \cs_new:Npn \@@_parshape_set_indents:nn #1#2 { - \__dim_eval:n { \l_galley_total_left_margin_dim + #1 } - \__dim_eval:n { \l_galley_text_width_dim - ( #1 + #2 ) } + \dim_eval:n { \l_galley_total_left_margin_dim + #1 } \exp_stop_f: + \dim_eval:n { \l_galley_text_width_dim - ( #1 + #2 ) } \exp_stop_f: } % \end{macrocode} % Calculating cutouts is by far the most complex operation here. The @@ -2225,7 +2225,7 @@ \cs_new_protected:Npn \galley_display_widow_penalties_set:n #1 { \etex_displaywidowpenalties:D - \__int_eval:n { \clist_count:n {#1} + 1 } + \int_eval:n { \clist_count:n {#1} + 1 } \exp_stop_f: \clist_map_function:nN {#1} \@@_set_aux:n 0 \exp_stop_f: } @@ -2233,7 +2233,7 @@ \cs_new_protected:Npn \galley_widow_penalties_set:n #1 { \etex_widowpenalties:D - \__int_eval:n { \clist_count:n {#1} + 1 } + \int_eval:n { \clist_count:n {#1} + 1 } \exp_stop_f: \clist_map_function:nN {#1} \@@_set_aux:n 0 \exp_stop_f: } @@ -2284,7 +2284,7 @@ \cs_new_protected:Npn \galley_display_club_penalties_set:n #1 { \etex_clubpenalties:D - \__int_eval:n { \clist_count:n {#1} + 1 } + \int_eval:n { \clist_count:n {#1} + 1 } \exp_stop_f: \clist_map_function:nN {#1} \@@_set_aux:n 0 \exp_stop_f: \@@_calc_interline_penalties: @@ -2311,18 +2311,19 @@ { \int_compare:nNnTF { \etex_interlinepenalties:D 0 } = 0 { - \etex_interlinepenalties:D 1 = \__int_eval:n {#1} + \etex_interlinepenalties:D 1 = \int_eval:n {#1} \exp_stop_f: \@@_calc_interline_penalties: } { \cs_set:Npn \@@_set_interline_penalty_auxii:n ##1 { - \__int_eval:n + \int_eval:n { \etex_interlinepenalties:D ##1 - \etex_interlinepenalties:D \etex_interlinepenalties:D 0 + #1 } + \exp_stop_f: } \exp_args:Nf \@@_set_interline_penalty:nn { \clist_count:N \l_galley_line_penalties_clist } {#1} @@ -2332,15 +2333,14 @@ { \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f: - \int_step_function:nnnN { 1 } { 1 } {#1} + \int_step_function:nN {#1} \@@_set_interline_penalty_auxi:n - \int_step_function:nnnN { #1 + 1 } { 1 } - { \etex_interlinepenalties:D 0 - 1 } + \int_step_function:nnN { #1 + 1 } { \etex_interlinepenalties:D 0 - 1 } \@@_set_interline_penalty_auxii:n - \__int_eval:n {#2} + \int_eval:n {#2} \exp_stop_f: } \cs_new:Npn \@@_set_interline_penalty_auxi:n #1 - { \etex_interlinepenalties:D \__int_eval:n {#1} } + { \etex_interlinepenalties:D \int_eval:n {#1} \exp_stop_f: } \cs_new:Npn \@@_set_interline_penalty_auxii:n #1 { } % \end{macrocode} % \end{macro} @@ -2384,29 +2384,31 @@ \cs_new_protected:Npn \@@_calc_interline_penalties:nn #1#2 { \etex_interlinepenalties:D #1 ~ - \int_step_function:nnnN { 1 } { 1 } {#2} + \int_step_function:nN {#2} \@@_calc_interline_penalties_auxi:n - \int_step_function:nnnN { #2 + 1 } { 1 } { #1 - 1 } + \int_step_function:nnN { #2 + 1 } { #1 - 1 } \@@_calc_interline_penalties_auxii:n \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f: } \cs_new:Npn \@@_calc_interline_penalties_auxi:n #1 { - \__int_eval:n + \int_eval:n { \clist_item:Nn \l_galley_line_penalties_clist {#1} + 0 \clist_item:Nn \l_galley_club_penalties_clist {#1} - \etex_clubpenalties:D #1 ~ } + \exp_stop_f: } \cs_new:Npn \@@_calc_interline_penalties_auxii:n #1 { - \__int_eval:n + \int_eval:n { \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f: + 0 \clist_item:Nn \l_galley_club_penalties_clist {#1} - \etex_clubpenalties:D #1 ~ } + \exp_stop_f: } % \end{macrocode} % \end{macro} @@ -2443,45 +2445,42 @@ { \clist_set:Nx #1 { - \int_step_function:nnnN { 1 } { 1 } - { \etex_clubpenalties:D 0 - 1 } + \int_step_function:nN { \etex_clubpenalties:D 0 - 1 } \@@_save_display_club_penalties:n } } \cs_new:Npn \@@_save_display_club_penalties:n #1 - { \__int_value:w \etex_clubpenalties:D \__int_eval:n {#1} , } + { \int_value:w \etex_clubpenalties:D \int_eval:n {#1} , } \cs_new_protected:Npn \galley_save_display_widow_penalties:N #1 { \clist_set:Nx #1 { - \int_step_function:nnnN { 1 } { 1 } - { \etex_displaywidowpenalties:D 0 - 1 } + \int_step_function:nN { \etex_displaywidowpenalties:D 0 - 1 } \@@_save_display_widow_penalties:n } } \cs_new:Npn \@@_save_display_widow_penalties:n #1 { - \__int_value:w \etex_displaywidowpenalties:D - \__int_eval:n {#1} , + \int_value:w \etex_displaywidowpenalties:D + \int_eval:n {#1} , } \cs_new_protected:Npn \galley_save_widow_penalties:N #1 { \clist_set:Nx #1 { - \int_step_function:nnnN { 1 } { 1 } - { \etex_widowpenalties:D 0 - 1 } + \int_step_function:nN { \etex_widowpenalties:D 0 - 1 } \@@_save_widow_penalties:n } } \cs_new:Npn \@@_save_widow_penalties:n #1 - { \__int_value:w \etex_widowpenalties:D \__int_eval:n {#1} , } + { \int_value:w \etex_widowpenalties:D \int_eval:n {#1} , } % \end{macrocode} % This one is not an array, but is stored in a primitive, so there is % a simple conversion. The general interline penalty is always the % last value in the primitive array. % \begin{macrocode} \cs_new_protected:Npn \galley_interline_penalty: - { \__int_value:w \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f: } + { \int_value:w \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f: } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx index 7c6dd9656a4..369d93f3b76 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx @@ -45,7 +45,7 @@ % }^^A % } % -% \date{Released 2018/03/05} +% \date{Released 2018-04-30} % % \maketitle % @@ -732,7 +732,7 @@ % \end{macrocode} % % \begin{macrocode} -\ProvidesExplPackage{xgalley}{2018/03/05}{} +\ProvidesExplPackage{xgalley}{2018-04-30}{} {L3 Experimental galley} \RequirePackage{xparse,xtemplate,l3galley} % \end{macrocode} |