diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-softpath.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3experimental/l3draw/l3draw-softpath.dtx | 100 |
1 files changed, 18 insertions, 82 deletions
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} |