diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-08 23:01:35 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-08 23:01:35 +0000 |
commit | 6fca20c09474a7f6a3559af1c984243a83669f61 (patch) | |
tree | cbfda048c91853241ef903a84a088c1e3a66fd50 /Master/texmf-dist/tex/latex | |
parent | ddbc1f2a5f193876d6f1df544e286029c6d671f8 (diff) |
l3 (8mar17)
git-svn-id: svn://tug.org/texlive/trunk@43432 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
71 files changed, 2376 insertions, 1694 deletions
diff --git a/Master/texmf-dist/tex/latex/l3build/l3build.lua b/Master/texmf-dist/tex/latex/l3build/l3build.lua index 4d7e8abe192..bfbe73e91c4 100644 --- a/Master/texmf-dist/tex/latex/l3build/l3build.lua +++ b/Master/texmf-dist/tex/latex/l3build/l3build.lua @@ -23,8 +23,8 @@ for those people who are interested. --]] -- Version information: should be identical to that in l3build.dtx -release_date = "2017/01/25" -release_ver = "6826" +release_date = "2017/03/07" +release_ver = "6984" -- "module" is a deprecated function in Lua 5.2: as we want the name -- for other purposes, and it should eventually be 'free', simply @@ -774,6 +774,8 @@ function formatlog(logfile, newfile, engine) -- Zap line numbers from \show, \showbox, \box_show and the like: -- do this before wrapping lines line = string.gsub(line, "^l%.%d+ ", "l. ...") + -- Also from lua stack traces. + line = string.gsub(line, "lua:%d+: in function", "lua:...: in function") -- Allow for wrapped lines: preserve the content and wrap -- Skip lines that have an explicit marker for truncation if string.len(line) == maxprintline and @@ -799,7 +801,12 @@ function formatlog(logfile, newfile, engine) line = string.gsub(line, "%(%.%/", "(") -- Zap paths if places other than 'here' are accessible if checksearch then - line = string.gsub(line, "%(.*/([%w-]+%.[%w-]+)%)?%s*$", "(../%1") + local pattern = "%w?:?/[^ ]*/([^/%(%)]*%.%w*)" + -- Files loaded from TeX: all start ( -- ) + line = string.gsub(line, "%(" .. pattern, "(../%1") + -- luaotfload files start with keywords + line = string.gsub(line, "from " .. pattern .. "%(", "from. ./%1(") + line = string.gsub(line, ": " .. pattern .. "%)", ": ../%1)") end -- Deal with the fact that "(.aux)" may have still a leading space line = string.gsub(line, "^ %(%.aux%)", "(.aux)") @@ -1119,7 +1126,7 @@ function runcheck(name, hide) errlevel = compare_tlg(name, engine) end if errlevel ~= 0 and opthalt then - checkdiff() + showfaileddiff() if errlevel ~= 0 then return 1 end @@ -1599,6 +1606,23 @@ function checkdiff() print("") end +function showfaileddiff() + print("\nCheck failed with difference file") + for _,i in ipairs(filelist(testdir, "*" .. os_diffext)) do + print(" - " .. testdir .. "/" .. i) + print("") + local f = io.open(testdir .. "/" .. i,"r") + local content = f:read("*all") + f:close() + print("-----------------------------------------------------------------------------------") + print(content) + print("-----------------------------------------------------------------------------------") + end + for _,i in ipairs(filelist(testdir, "*" .. os_cmpext)) do + print(" - " .. testdir .. "/" .. i) + end +end + -- Remove all generated files function clean() -- To make sure that distribdir never contains any stray subdirs, @@ -1634,13 +1658,20 @@ function cmdcheck() mkdir(localdir) cleandir(testdir) depinstall(checkdeps) + for _,i in ipairs({bibfiles, docfiles, sourcefiles, typesetfiles}) do + for _,j in ipairs(i) do + cp(j, ".", testdir) + end + end + for _,i in ipairs(typesetsuppfiles) do + cp(i, supportdir, testdir) + end local engine = string.gsub(stdengine, "tex$", "latex") local localdir = relpath(localdir, testdir) print("Checking source files") for _,i in ipairs(cmdchkfiles) do for _,j in ipairs(filelist(".", i)) do print(" " .. stripext(j)) - cp(j, ".", testdir) run( testdir, os_setenv .. " TEXINPUTS=." .. os_pathsep .. localdir diff --git a/Master/texmf-dist/tex/latex/l3build/regression-test.tex b/Master/texmf-dist/tex/latex/l3build/regression-test.tex index 86d722d7862..b11581fae21 100644 --- a/Master/texmf-dist/tex/latex/l3build/regression-test.tex +++ b/Master/texmf-dist/tex/latex/l3build/regression-test.tex @@ -89,7 +89,7 @@ \LONGTYPEOUT{Bad conditionals: \the\numexpr\currentiflevel-2!}% \fi \fi - \LONGTYPEOUT{END-TEST-LOG}\@@@end + \LONGTYPEOUT{^^JEND-TEST-LOG^^J}\@@@end } \ifx\@@end\@undefined \let\end\END diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty deleted file mode 100644 index b38ece3d01d..00000000000 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty +++ /dev/null @@ -1,92 +0,0 @@ -%% -%% This is file `l3flag.sty', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% l3flag.dtx (with options: `package') -%% -%% Copyright (C) 2011-2016 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 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 "l3experimental bundle" (The Work in LPPL) -%% and all files in that bundle must be distributed together. -%% -%% File: l3flag.dtx Copyright (C) 2011-2012,2014-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} - {} - {% - \PackageError{l3flag}{Support package l3kernel too old} - {% - Please install an up to date version of l3kernel\MessageBreak - using your TeX package manager or from CTAN.\MessageBreak - \MessageBreak - Loading l3flag will abort!% - }% - \endinput - } -\GetIdInfo$Id: l3flag.dtx 6878 2017-02-10 07:40:59Z joseph $ - {L3 Experimental flags} -\ProvidesExplPackage - {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\cs_new_protected:Npn \flag_new:n #1 - { - \cs_new:cpn { __flag_trap_#1:w } ##1 ; - { \exp_after:wN \use_none:n \cs:w __flag_#1_##1: \cs_end: } - } -\cs_new_protected:Npn \flag_clear:n #1 - { \__flag_clear:ww 0 ; #1 \q_stop } -\cs_new_protected:Npn \__flag_clear:ww #1 ; #2 \q_stop - { - \if_cs_exist:w __flag_#2_#1: \cs_end: - \else: - \exp_after:wN \use_none_delimit_by_q_stop:w - \fi: - \cs_set_eq:cN { __flag_#2_#1: } \tex_undefined:D - \exp_after:wN \__flag_clear:ww - \__int_value:w \__int_eval:w \c_one + #1 ; - #2 \q_stop - } -\cs_new_protected:Npn \flag_clear_new:n #1 - { \flag_if_exist:nTF {#1} { \flag_clear:n } { \flag_new:n } {#1} } -\cs_new_protected:Npn \flag_set_trap:nn #1#2 - { \cs_set:cpn { __flag_trap_#1:w } ##1 ; {#2} } -\prg_new_conditional:Npnn \flag_if_exist:n #1 { p , T , F , TF } - { - \cs_if_exist:cTF { __flag_trap_#1:w } - { \prg_return_true: } { \prg_return_false: } - } -\prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } - { - \if_cs_exist:w __flag_#1_0: \cs_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\cs_new:Npn \flag_height:n #1 { \__flag_height_loop:ww 0; #1 \q_stop } -\cs_new:Npn \__flag_height_loop:ww #1 ; #2 \q_stop - { - \if_cs_exist:w __flag_#2_#1: \cs_end: - \exp_after:wN \__flag_height_loop:ww \__int_value:w \__int_eval:w \c_one + - \else: - \exp_after:wN \__flag_height_end:ww - \fi: - #1 ; #2 \q_stop - } -\cs_new:Npn \__flag_height_end:ww #1 ; #2 \q_stop { #1 } -\cs_new:Npn \flag_raise:n #1 - { - \cs:w __flag_trap_#1:w \exp_after:wN \cs_end: - \__int_value:w \flag_height:n {#1} ; - } -%% -%% -%% End of file `l3flag.sty'. diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty index 5c1c9b8be80..7c49cc0c059 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex-trace.sty @@ -18,9 +18,9 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3regex.dtx Copyright (C) 2011-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +%% File: l3regex.dtx Copyright (C) 2011-2017 The LaTeX3 Project +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{l3regex}{Support package l3kernel too old} @@ -32,11 +32,11 @@ }% \endinput } -\GetIdInfo$Id: l3regex.dtx 6878 2017-02-10 07:40:59Z joseph $ +\GetIdInfo$Id: l3regex.dtx 6984 2017-03-07 20:53:23Z joseph $ {L3 Experimental regular expressions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\RequirePackage{l3tl-build, l3tl-analysis, l3flag, l3str-convert} +\RequirePackage{l3tl-build, l3tl-analysis, l3str-convert} \cs_generate_variant:Nn \tl_to_str:n { V } \cs_new:Npn \__regex_tmp:w { } \tl_new:N \l__regex_internal_a_tl @@ -107,17 +107,15 @@ \cs_new_protected:Npn \__regex_compute_case_changed_char: { \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_current_char_int - \if_int_compare:w \l__regex_current_char_int < \c_ninety_one - \if_int_compare:w \l__regex_current_char_int < \c_sixty_five - \else: - \int_add:Nn \l__regex_case_changed_char_int { \c_thirty_two } + \if_int_compare:w \l__regex_current_char_int > `Z \exp_stop_f: + \if_int_compare:w \l__regex_current_char_int > `z \exp_stop_f: \else: + \if_int_compare:w \l__regex_current_char_int < `a \exp_stop_f: \else: + \int_sub:Nn \l__regex_case_changed_char_int { \c__str_ascii_lower_int } + \fi: \fi: \else: - \if_int_compare:w \l__regex_current_char_int < \c_one_hundred_twenty_three - \if_int_compare:w \l__regex_current_char_int < \c_ninety_seven - \else: - \int_sub:Nn \l__regex_case_changed_char_int { \c_thirty_two } - \fi: + \if_int_compare:w \l__regex_current_char_int < `A \exp_stop_f: \else: + \int_add:Nn \l__regex_case_changed_char_int { \c__str_ascii_lower_int } \fi: \fi: } @@ -130,7 +128,7 @@ 1 \or: 4 \or: 10 \or: 40 \or: 100 \or: \or: 1000 \or: 4000 \or: 10000 \or: \or: 100000 \or: 400000 - \or: 1000000 \or: 4000000 \else: 1*\c_zero + \or: 1000000 \or: 4000000 \else: 1*0 \fi: } \cs_new_protected:Npn \__regex_item_catcode:nT #1 @@ -151,23 +149,25 @@ \fi: \fi: } -\cs_new_protected:Npn \__regex_item_exact_cs:c #1 +\cs_new_protected:Npn \__regex_item_exact_cs:n #1 { - \int_compare:nNnTF \l__regex_current_catcode_int = \c_zero + \int_compare:nNnTF \l__regex_current_catcode_int = 0 { - \str_if_eq_x:nnTF + \tl_set:Nx \l__regex_internal_a_tl { + \scan_stop: \exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N \tex_the:D \tex_toks:D \l__regex_current_pos_int + \scan_stop: } - { #1 } + \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l__regex_internal_a_tl { \__regex_break_true:w } { } } { } } \cs_new_protected:Npn \__regex_item_cs:n #1 { - \int_compare:nNnT \l__regex_current_catcode_int = \c_zero + \int_compare:nNnT \l__regex_current_catcode_int = 0 { \group_begin: \tl_set:Nx \l__regex_cs_name_tl @@ -189,70 +189,79 @@ } } \cs_new_protected:Npn \__regex_prop_d: - { \__regex_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9 + { \__regex_item_caseful_range:nn { `0 } { `9 } } \cs_new_protected:Npn \__regex_prop_h: { - \__regex_item_caseful_equal:n \c_thirty_two % space - \__regex_item_caseful_equal:n \c_nine % tab + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_equal:n { `\^^I } } \cs_new_protected:Npn \__regex_prop_s: { - \__regex_item_caseful_equal:n \c_thirty_two % space - \__regex_item_caseful_equal:n \c_nine % tab - \__regex_item_caseful_equal:n \c_ten % lf - \__regex_item_caseful_equal:n \c_twelve % ff - \__regex_item_caseful_equal:n \c_thirteen % cr + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_equal:n { `\^^I } + \__regex_item_caseful_equal:n { `\^^J } + \__regex_item_caseful_equal:n { `\^^L } + \__regex_item_caseful_equal:n { `\^^M } } \cs_new_protected:Npn \__regex_prop_v: - { \__regex_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr + { \__regex_item_caseful_range:nn { `\^^J } { `\^^M } } % lf, vtab, ff, cr \cs_new_protected:Npn \__regex_prop_w: { - \__regex_item_caseful_range:nn \c_ninety_seven { 122 } % a--z - \__regex_item_caseful_range:nn \c_sixty_five { 90 } % A--Z - \__regex_item_caseful_range:nn \c_forty_eight { 57 } % 0--9 - \__regex_item_caseful_equal:n { 95 } % _ + \__regex_item_caseful_range:nn { `a } { `z } + \__regex_item_caseful_range:nn { `A } { `Z } + \__regex_item_caseful_range:nn { `0 } { `9 } + \__regex_item_caseful_equal:n { `_ } } \cs_new_protected:Npn \__regex_prop_N: - { \__regex_item_reverse:n { \__regex_item_caseful_equal:n \c_ten } } + { + \__regex_item_reverse:n + { \__regex_item_caseful_equal:n { `\^^J } } + } \cs_new_protected:Npn \__regex_posix_alnum: { \__regex_posix_alpha: \__regex_posix_digit: } \cs_new_protected:Npn \__regex_posix_alpha: { \__regex_posix_lower: \__regex_posix_upper: } \cs_new_protected:Npn \__regex_posix_ascii: - { \__regex_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven } + { + \__regex_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_int + } \cs_new_eq:NN \__regex_posix_blank: \__regex_prop_h: \cs_new_protected:Npn \__regex_posix_cntrl: { - \__regex_item_caseful_range:nn \c_zero { 31 } - \__regex_item_caseful_equal:n \c_one_hundred_twenty_seven + \__regex_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_control_int + \__regex_item_caseful_equal:n \c__str_ascii_max_int } \cs_new_eq:NN \__regex_posix_digit: \__regex_prop_d: \cs_new_protected:Npn \__regex_posix_graph: - { \__regex_item_caseful_range:nn { 33 } { 126 } } + { \__regex_item_caseful_range:nn { `! } { `\~ } } \cs_new_protected:Npn \__regex_posix_lower: - { \__regex_item_caseful_range:nn \c_ninety_seven { 122 } } + { \__regex_item_caseful_range:nn { `a } { `z } } \cs_new_protected:Npn \__regex_posix_print: - { \__regex_item_caseful_range:nn \c_thirty_two { 126 } } + { \__regex_item_caseful_range:nn { `\ } { `\~ } } \cs_new_protected:Npn \__regex_posix_punct: { - \__regex_item_caseful_range:nn { 33 } { 47 } - \__regex_item_caseful_range:nn { 58 } { 64 } - \__regex_item_caseful_range:nn { 91 } { 96 } - \__regex_item_caseful_range:nn { 123 } { 126 } + \__regex_item_caseful_range:nn { `! } { `/ } + \__regex_item_caseful_range:nn { `: } { `@ } + \__regex_item_caseful_range:nn { `[ } { `` } + \__regex_item_caseful_range:nn { `\{ } { `\~ } } \cs_new_protected:Npn \__regex_posix_space: { - \__regex_item_caseful_equal:n \c_thirty_two - \__regex_item_caseful_range:nn \c_nine \c_thirteen + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_range:nn { `\^^I } { `\^^M } } \cs_new_protected:Npn \__regex_posix_upper: - { \__regex_item_caseful_range:nn \c_sixty_five { 90 } } + { \__regex_item_caseful_range:nn { `A } { `Z } } \cs_new_eq:NN \__regex_posix_word: \__regex_prop_w: \cs_new_protected:Npn \__regex_posix_xdigit: { \__regex_posix_digit: - \__regex_item_caseful_range:nn \c_sixty_five { 70 } - \__regex_item_caseful_range:nn \c_ninety_seven { 102 } + \__regex_item_caseful_range:nn { `A } { `F } + \__regex_item_caseful_range:nn { `a } { `f } } \cs_new_protected:Npn \__regex_escape_use:nnnn #1#2#3#4 { @@ -261,7 +270,7 @@ \cs_set:Npn \__regex_escape_unescaped:N ##1 { #1 } \cs_set:Npn \__regex_escape_escaped:N ##1 { #2 } \cs_set:Npn \__regex_escape_raw:N ##1 { #3 } - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \__str_gset_other:Nn \g__regex_internal_tl { #4 } \tl_set:Nx \l__regex_internal_b_tl { @@ -316,12 +325,12 @@ } \cs_new:Npn \__regex_escape_x_end:w #1 ; { - \int_compare:nNnTF {#1} < \c_two_hundred_fifty_six + \int_compare:nNnTF {#1} > \c__str_max_byte_int + { \__regex_escape_x_large:n {#1} } { \exp_last_unbraced:Nf \__regex_escape_raw:N { \__str_output_byte:n {#1} } } - { \__regex_escape_x_large:n {#1} } } \group_begin: \char_set_catcode_other:n { 0 } @@ -336,7 +345,7 @@ { \if_false: } \fi: } { - \char_set_lccode:nn { \c_zero } {#1} + \char_set_lccode:nn { 0 } {#1} \tex_lowercase:D { \tl_set:Nx \l__regex_internal_b_tl @@ -407,47 +416,53 @@ } \prg_new_conditional:Npnn \__regex_char_if_special:N #1 { TF } { - \if_int_compare:w `#1 < \c_ninety_one - \if_int_compare:w `#1 < \c_fifty_eight - \if_int_compare:w `#1 < \c_forty_eight - \if_int_compare:w `#1 < \c_thirty_two - \prg_return_false: \else: \prg_return_true: \fi: - \else: \prg_return_false: \fi: + \if_int_compare:w `#1 > `Z \exp_stop_f: + \if_int_compare:w `#1 > `z \exp_stop_f: + \if_int_compare:w `#1 < \c__str_ascii_max_int + \prg_return_true: \else: \prg_return_false: \fi: \else: - \if_int_compare:w `#1 < \c_sixty_five + \if_int_compare:w `#1 < `a \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_three - \if_int_compare:w `#1 < \c_ninety_seven + \if_int_compare:w `#1 > `9 \exp_stop_f: + \if_int_compare:w `#1 < `A \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_seven - \prg_return_true: \else: \prg_return_false: \fi: + \if_int_compare:w `#1 < `0 \exp_stop_f: + \if_int_compare:w `#1 < `\ \exp_stop_f: + \prg_return_false: \else: \prg_return_true: \fi: + \else: \prg_return_false: \fi: \fi: \fi: } \prg_new_conditional:Npnn \__regex_char_if_alphanumeric:N #1 { TF } { - \if_int_compare:w `#1 < \c_ninety_one - \if_int_compare:w `#1 < \c_fifty_eight - \if_int_compare:w `#1 < \c_forty_eight - \prg_return_false: \else: \prg_return_true: \fi: + \if_int_compare:w `#1 > `Z \exp_stop_f: + \if_int_compare:w `#1 > `z \exp_stop_f: + \prg_return_false: \else: - \if_int_compare:w `#1 < \c_sixty_five + \if_int_compare:w `#1 < `a \exp_stop_f: \prg_return_false: \else: \prg_return_true: \fi: \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_three - \if_int_compare:w `#1 < \c_ninety_seven + \if_int_compare:w `#1 > `9 \exp_stop_f: + \if_int_compare:w `#1 < `A \exp_stop_f: \prg_return_false: \else: \prg_return_true: \fi: \else: - \prg_return_false: + \if_int_compare:w `#1 < `0 \exp_stop_f: + \prg_return_false: \else: \prg_return_true: \fi: \fi: \fi: } \int_new:N \l__regex_group_level_int \int_new:N \l__regex_mode_int +\int_const:Nn \c__regex_cs_in_class_mode_int { -6 } +\int_const:Nn \c__regex_cs_mode_int { -2 } +\int_const:Nn \c__regex_outer_mode_int { 0 } +\int_const:Nn \c__regex_catcode_mode_int { 2 } +\int_const:Nn \c__regex_class_mode_int { 3 } +\int_const:Nn \c__regex_catcode_in_class_mode_int { 6 } \int_new:N \l__regex_catcodes_int \int_new:N \l__regex_default_catcodes_int \bool_new:N \l__regex_catcodes_bool @@ -482,7 +497,7 @@ \prg_new_conditional:Npnn \__regex_if_raw_digit:NN #1#2 { TF } { \if_meaning:w \__regex_compile_raw:N #1 - \if_int_compare:w \c_one < 1 #2 \exp_stop_f: + \if_int_compare:w 1 < 1 #2 \exp_stop_f: \prg_return_true: \else: \prg_return_false: @@ -504,7 +519,7 @@ \if_int_odd:w \l__regex_mode_int \exp_after:wN \use_ii:nn \else: - \if_int_compare:w \l__regex_mode_int < \c_zero + \if_int_compare:w \l__regex_mode_int < \c__regex_outer_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn \else: \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn @@ -516,7 +531,7 @@ \if_int_odd:w \l__regex_mode_int \exp_after:wN \use_i:nn \else: - \if_int_compare:w \l__regex_mode_int > \c_zero + \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn \else: \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn @@ -525,7 +540,7 @@ } \cs_new:Npn \__regex_if_within_catcode:TF { - \if_int_compare:w \l__regex_mode_int > \c_zero + \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -533,10 +548,10 @@ } \cs_new_protected:Npn \__regex_chk_c_allowed:T { - \if_int_compare:w \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int \exp_after:wN \use:n \else: - \if_int_compare:w \l__regex_mode_int = \c_three + \if_int_compare:w \l__regex_mode_int = \c__regex_class_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use:n \else: \__msg_kernel_error:nn { regex } { c-bad-mode } @@ -546,11 +561,11 @@ } \cs_new_protected:Npn \__regex_mode_quit_c: { - \if_int_compare:w \l__regex_mode_int = \c_two - \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int + \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int \else: - \if_int_compare:w \l__regex_mode_int = \c_six - \l__regex_mode_int = \c_three + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_in_class_mode_int + \int_set_eq:NN \l__regex_mode_int \c__regex_class_mode_int \fi: \fi: } @@ -573,7 +588,7 @@ \prg_do_nothing: \prg_do_nothing: } { } - \if_int_compare:w \l__regex_group_level_int > \c_zero + \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { missing-rparen } { \int_use:N \l__regex_group_level_int } \prg_replicate:nn @@ -594,8 +609,8 @@ \cs_new_protected:Npn \__regex_compile:n #1 { \__regex_compile:w - \int_set:Nn \tex_escapechar:D { 92 } - \int_set_eq:NN \l__regex_mode_int \c_zero + \int_set:Nn \tex_escapechar:D { `\\ } + \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int \__regex_escape_use:nnnn { \__regex_char_if_special:NTF ##1 @@ -609,14 +624,12 @@ { #1 } \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: - \int_compare:nNnT \l__regex_mode_int = \c_two + \int_compare:nNnT \l__regex_mode_int = \c__regex_catcode_mode_int { \__msg_kernel_error:nn { regex } { c-trailing } } - \int_compare:nNnT \l__regex_mode_int < \c_zero + \int_compare:nNnT \l__regex_mode_int < \c__regex_outer_mode_int { \__msg_kernel_error:nn { regex } { c-missing-rbrace } - \__regex_compile_end: - \__regex_compile_one:x - { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } } + \__regex_compile_end_cs: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: } @@ -839,7 +852,7 @@ } \cs_new_protected:cpn { __regex_prop_.: } { - \if_int_compare:w \l__regex_current_char_int > - \c_two + \if_int_compare:w \l__regex_current_char_int > - 2 \exp_stop_f: \exp_after:wN \__regex_break_true:w \fi: } @@ -906,11 +919,11 @@ { \__regex_if_in_class:TF { - \if_int_compare:w \l__regex_mode_int > \c_sixteen + \if_int_compare:w \l__regex_mode_int > \c__regex_catcode_in_class_mode_int \__tl_build_one:n { \if_false: { \fi: } } \fi: - \tex_advance:D \l__regex_mode_int - \c_fifteen - \tex_divide:D \l__regex_mode_int \c_thirteen + \tex_advance:D \l__regex_mode_int - 15 \exp_stop_f: + \tex_divide:D \l__regex_mode_int 13 \exp_stop_f: \if_int_odd:w \l__regex_mode_int \else: \exp_after:wN \__regex_compile_quantifier:w \fi: @@ -938,7 +951,7 @@ } \cs_new_protected:Npn \__regex_compile_class_catcode:w #1; { - \if_int_compare:w \l__regex_mode_int = \c_two + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int \__tl_build_one:n { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: } \fi: @@ -1040,7 +1053,7 @@ } \cs_new_protected:Npn \__regex_compile_group_end: { - \if_int_compare:w \l__regex_group_level_int > \c_zero + \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: \__tl_build_one:n { \if_false: { \fi: } } \__tl_build_end: \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int @@ -1132,7 +1145,11 @@ { \int_set_eq:Nc \l__regex_catcodes_int { c__regex_catcode_#2_int } \l__regex_mode_int - = \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_catcode_mode_int + \else: + \c__regex_catcode_in_class_mode_int + \fi: } } { \cs_if_exist_use:cF { __regex_compile_c_#2:w } } @@ -1144,7 +1161,11 @@ \cs_new_protected:cpn { __regex_compile_c_[:w } #1#2 { \l__regex_mode_int - = \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_catcode_mode_int + \else: + \c__regex_catcode_in_class_mode_int + \fi: \int_zero:N \l__regex_catcodes_int \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ^ } { @@ -1197,17 +1218,72 @@ \__regex_compile:w \__regex_disable_submatches: \l__regex_mode_int - = - \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_cs_mode_int + \else: + \c__regex_cs_in_class_mode_int + \fi: } +\flag_new:n { __regex_cs } \cs_new_protected:cpn { __regex_compile_ \c_right_brace_str : } { \__regex_if_in_cs:TF + { \__regex_compile_end_cs: } + { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str } + } +\cs_new_protected:Npn \__regex_compile_end_cs: + { + \__regex_compile_end: + \flag_clear:n { __regex_cs } + \tl_set:Nx \l__regex_internal_a_tl { - \__regex_compile_end: - \__regex_compile_one:x + \exp_after:wN \__regex_compile_cs_aux:Nn \l__regex_internal_regex + \q_nil \q_nil \q_recursion_stop + } + \exp_args:Nx \__regex_compile_one:x + { + \flag_if_raised:nTF { __regex_cs } { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } } + { \__regex_item_exact_cs:n { \tl_tail:N \l__regex_internal_a_tl } } + } + } +\cs_new:Npn \__regex_compile_cs_aux:Nn #1#2 + { + \cs_if_eq:NNTF #1 \__regex_branch:n + { + \scan_stop: + \__regex_compile_cs_aux:NNnnnN #2 + \q_nil \q_nil \q_nil \q_nil \q_nil \q_nil \q_recursion_stop + \__regex_compile_cs_aux:Nn + } + { + \quark_if_nil:NF #1 { \flag_raise:n { __regex_cs } } + \use_none_delimit_by_q_recursion_stop:w + } + } +\cs_new:Npn \__regex_compile_cs_aux:NNnnnN #1#2#3#4#5#6 + { + \bool_lazy_all:nTF + { + { \cs_if_eq_p:NN #1 \__regex_class:NnnnN } + {#2} + { \tl_if_head_eq_meaning_p:nN {#3} \__regex_item_caseful_equal:n } + { \int_compare_p:nNn { \tl_count:n {#3} } = { 2 } } + { \int_compare_p:nNn {#5} = { 0 } } + } + { + \prg_replicate:nn {#4} + { \char_generate:nn { \use_ii:nn #3 } {12} } + \__regex_compile_cs_aux:NNnnnN + } + { + \quark_if_nil:NF #1 + { + \flag_raise:n { __regex_cs } + \use_i_delimit_by_q_recursion_stop:nw + } + \use_none_delimit_by_q_recursion_stop:w } - { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str } } \cs_new_protected:cpn { __regex_compile_/u: } #1#2 { @@ -1247,7 +1323,7 @@ \cs_new_protected:Npn \__regex_compile_u_end: { \tl_set:Nv \l__regex_internal_a_tl { \l__regex_internal_a_tl } - \if_int_compare:w \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int \__regex_compile_u_not_cs: \else: \__regex_compile_u_in_cs: @@ -1277,8 +1353,8 @@ { \__regex_class:NnnnN \c_true_bool { - \if_int_compare:w "##2 = \c_zero - \__regex_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 } + \if_int_compare:w "##2 = 0 \exp_stop_f: + \__regex_item_exact_cs:n { \exp_after:wN \cs_to_str:N ##1 } \else: \__regex_item_exact:nn { \__int_value:w "##2 } { ##3 } \fi: @@ -1289,11 +1365,11 @@ } \cs_new_protected:cpn { __regex_compile_/K: } { - \int_compare:nNnTF \l__regex_mode_int = \c_zero + \int_compare:nNnTF \l__regex_mode_int = \c__regex_outer_mode_int { \__tl_build_one:n { \__regex_command_K: } } { \__regex_compile_raw_error:N K } } -\cs_new_protected:Npn \__regex_show:Nx #1#2 +\cs_new_protected:Npn \__regex_show:Nn #1#2 { \__tl_build:Nw \l__regex_internal_a_tl \cs_set_protected:Npn \__regex_branch:n @@ -1335,16 +1411,16 @@ { \__regex_show_scope:nn { Reversed~match } } \cs_set_protected:Npn \__regex_item_exact:nn ##1##2 { \__regex_show_one:n { char~##2,~catcode~##1 } } - \cs_set_protected:Npn \__regex_item_exact_cs:c ##1 - { \__regex_show_one:n { control~sequence~\iow_char:N\\##1 } } + \cs_set_eq:NN \__regex_item_exact_cs:n \__regex_show_item_exact_cs:n \cs_set_protected:Npn \__regex_item_cs:n { \__regex_show_scope:nn { control~sequence } } \cs_set:cpn { __regex_prop_.: } { \__regex_show_one:n { any~token } } \seq_clear:N \l__regex_show_prefix_seq \__regex_show_push:n { ~ } - #1 + \cs_if_exist_use:N #1 \__tl_build_end: - \__msg_show_wrap:n { >~Compiled~regex~#2: \l__regex_internal_a_tl } + \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } + { >~Compiled~regex~#2: \l__regex_internal_a_tl } } \cs_new_protected:Npn \__regex_show_one:n #1 { @@ -1439,6 +1515,14 @@ \bool_if:NF #1 { negative~ } class } } +\cs_new_protected:Npn \__regex_show_item_exact_cs:n #1 + { + \seq_set_split:Nnn \l__regex_internal_seq { \scan_stop: } {#1} + \seq_set_map:NNn \l__regex_internal_seq + \l__regex_internal_seq { \iow_char:N\\##1 } + \__regex_show_one:n + { control~sequence~ \seq_use:Nn \l__regex_internal_seq { ~or~ } } + } \int_new:N \l__regex_min_state_int \int_new:N \l__regex_max_state_int \int_new:N \l__regex_left_state_int @@ -1454,7 +1538,7 @@ \cs_new_protected:Npn \__regex_build:N #1 { \trace_push:nnn { regex } { 1 } { __regex_build } - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \int_zero:N \l__regex_capturing_group_int \int_set_eq:NN \l__regex_max_state_int \l__regex_min_state_int \__regex_build_new_state: @@ -1525,7 +1609,7 @@ L=\int_use:N \l__regex_left_state_int ~ -> ~ R=\int_use:N \l__regex_right_state_int ~ -> ~ M=\int_use:N \l__regex_max_state_int ~ -> ~ - \int_eval:n { \l__regex_max_state_int + \c_one } + \int_eval:n { \l__regex_max_state_int + 1 } } \tex_toks:D \l__regex_max_state_int { } \int_set_eq:NN \l__regex_left_state_int \l__regex_right_state_int @@ -1573,7 +1657,7 @@ } \cs_new_protected:Npn \__regex_class_repeat:nN #1#2 { - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #1 = 0 \exp_stop_f: \__regex_build_transitions_lazyness:NNNNN #2 \__regex_action_free:n \l__regex_right_state_int \__regex_tests_action_cost:n \l__regex_left_state_int @@ -1589,7 +1673,7 @@ { \__regex_class_repeat:n {#1} \int_set:Nn \l__regex_internal_a_int - { \l__regex_max_state_int + #2 - \c_one } + { \l__regex_max_state_int + #2 - 1 } \prg_replicate:nn { #2 } { \__regex_build_transitions_lazyness:NNNNN #3 @@ -1600,7 +1684,7 @@ \cs_new_protected:Npn \__regex_group_aux:nnnnN #1#2#3#4#5 { \trace_push:nnn { regex } { 1 } { __regex_group } - \if_int_compare:w #3 = \c_zero + \if_int_compare:w #3 = 0 \exp_stop_f: \__regex_build_new_state: \__regex_build_transition_right:nNn \__regex_action_free_group:n \l__regex_left_state_int \l__regex_right_state_int @@ -1664,9 +1748,9 @@ } \cs_new_protected:Npn \__regex_group_repeat:nn #1#2 { - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \int_set:Nn \l__regex_max_state_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \__regex_build_new_state: \else: \__regex_group_repeat_aux:n {#2} @@ -1677,7 +1761,7 @@ } \cs_new_protected:Npn \__regex_group_submatches:nNN #1#2#3 { - \if_int_compare:w #1 > - \c_one + \if_int_compare:w #1 > - 1 \exp_stop_f: \__regex_toks_put_left:Nx #2 { \__regex_action_submatch:n { #1 < } } \__regex_toks_put_left:Nx #3 { \__regex_action_submatch:n { #1 > } } \fi: @@ -1688,10 +1772,10 @@ \l__regex_right_state_int \l__regex_max_state_int \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int \int_set_eq:NN \l__regex_internal_b_int \l__regex_max_state_int - \if_int_compare:w \__int_eval:w #1 > \c_one + \if_int_compare:w \__int_eval:w #1 > 1 \exp_stop_f: \int_set:Nn \l__regex_internal_c_int { - ( #1 - \c_one ) + ( #1 - 1 ) * ( \l__regex_internal_b_int - \l__regex_internal_a_int ) } \tex_advance:D \l__regex_right_state_int \l__regex_internal_c_int @@ -1700,18 +1784,18 @@ { \tex_toks:D \l__regex_internal_b_int = \tex_toks:D \l__regex_internal_a_int - \tex_advance:D \l__regex_internal_a_int \c_one - \tex_advance:D \l__regex_internal_b_int \c_one + \int_incr:N \l__regex_internal_a_int + \int_incr:N \l__regex_internal_b_int } \fi: } \cs_new_protected:Npn \__regex_group_repeat:nnN #1#2#3 { - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \__regex_group_submatches:nNN {#1} \l__regex_left_state_int \l__regex_right_state_int \int_set:Nn \l__regex_internal_a_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \__regex_build_transition_right:nNn \__regex_action_free:n \l__regex_right_state_int \l__regex_internal_a_int \__regex_build_new_state: @@ -1751,16 +1835,16 @@ \l__regex_left_state_int \l__regex_max_state_int } \else: - \prg_replicate:nn { #3 - \c_one } + \prg_replicate:nn { #3 - 1 } { \int_sub:Nn \l__regex_right_state_int { \l__regex_internal_b_int - \l__regex_internal_a_int } \__regex_build_transition_right:nNn \__regex_action_free:n \l__regex_right_state_int \l__regex_max_state_int } - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \int_set:Nn \l__regex_right_state_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \else: \int_sub:Nn \l__regex_right_state_int { \l__regex_internal_b_int - \l__regex_internal_a_int } @@ -1842,7 +1926,7 @@ \trace_push:nnx { regex } { 1 } { __regex_match } \trace:nnx { regex } { 1 } { analyzing~query~token~list } \int_zero:N \l__regex_balance_int - \int_set:Nn \l__regex_current_pos_int { \c_two * \l__regex_max_state_int } + \int_set:Nn \l__regex_current_pos_int { 2 * \l__regex_max_state_int } \__regex_query_set:nnn { } { -1 } { -2 } \int_set_eq:NN \l__regex_min_pos_int \l__regex_current_pos_int \__tl_analysis_map_inline:nn {#1} @@ -1852,13 +1936,13 @@ \trace:nnx { regex } { 1 } { initializing } \bool_gset_false:N \g__regex_success_bool \int_step_inline:nnnn - \l__regex_min_state_int \c_one { \l__regex_max_state_int - \c_one } - { \tex_dimen:D ##1 \c_one sp \scan_stop: } + \l__regex_min_state_int { 1 } { \l__regex_max_state_int - 1 } + { \tex_dimen:D ##1 ~ 1 sp \scan_stop: } \int_set_eq:NN \l__regex_min_active_int \l__regex_max_state_int - \int_set_eq:NN \l__regex_step_int \c_zero + \int_zero:N \l__regex_step_int \int_set_eq:NN \l__regex_success_pos_int \l__regex_min_pos_int \int_set:Nn \l__regex_submatch_int - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \bool_set_false:N \l__regex_empty_success_bool \__regex_match_once: \trace_pop:nnx { regex } { 1 } { __regex_match } @@ -1877,7 +1961,7 @@ \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int \__regex_store_state:n { \l__regex_min_state_int } \int_set:Nn \l__regex_current_pos_int - { \l__regex_start_pos_int - \c_one } + { \l__regex_start_pos_int - 1 } \__regex_query_get: \__regex_match_loop: \l__regex_every_match_tl @@ -1900,7 +1984,7 @@ } \cs_new_protected:Npn \__regex_match_loop: { - \tex_advance:D \l__regex_step_int \c_two + \tex_advance:D \l__regex_step_int 2 \exp_stop_f: \int_incr:N \l__regex_current_pos_int \int_set_eq:NN \l__regex_last_char_int \l__regex_current_char_int \int_set_eq:NN \l__regex_case_changed_char_int \c_max_int @@ -1926,7 +2010,7 @@ { \__int_value:w \tex_skip:D #1 } { \tex_the:D \tex_toks:D #1 } \exp_after:wN \__regex_match_one_active:w - \__int_value:w \__int_eval:w #1 + \c_one \exp_after:wN ; + \__int_value:w \__int_eval:w #1 + 1 \exp_after:wN ; \fi: } \cs_new_protected:Npn \__regex_query_set:nnn #1#2#3 @@ -1958,7 +2042,7 @@ = \l__regex_step_int sp \scan_stop: \tex_the:D \tex_toks:D \l__regex_current_state_int \tex_dimen:D \l__regex_current_state_int - = \__int_eval:w \l__regex_step_int + \c_one \__int_eval_end: sp \scan_stop: + = \__int_eval:w \l__regex_step_int + 1 \__int_eval_end: sp \scan_stop: } \cs_new_protected:Npn \__regex_use_state_and_submatches:nn #1 #2 { @@ -2063,7 +2147,7 @@ \fi: \tex_the:D \tex_toks:D #1 \exp_stop_f: \exp_after:wN \__regex_query_range_loop:ww - \__int_value:w \__int_eval:w #1 + \c_one ; #2 ; + \__int_value:w \__int_eval:w #1 + 1 ; #2 ; } \cs_new:Npn \__regex_query_submatch:n #1 { @@ -2093,7 +2177,7 @@ { \__tl_build_one:n ##1 } {#1} \prg_do_nothing: \prg_do_nothing: - \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } { \int_use:N \l__regex_replacement_csnames_int } \__tl_build_one:x @@ -2123,7 +2207,7 @@ { \cs_if_exist_use:cF { __regex_replacement_#1:w } { - \if_int_compare:w \c_one < 1#1 \exp_stop_f: + \if_int_compare:w 1 < 1#1 \exp_stop_f: \__regex_replacement_put_submatch:n {#1} \else: \__tl_build_one:o { \token_to_str:N #1 } @@ -2134,7 +2218,7 @@ { \if_int_compare:w #1 < \l__regex_capturing_group_int \__tl_build_one:n { \__regex_query_submatch:n { #1 + ##1 } } - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \tl_put_right:Nn \l__regex_balance_tl { + \__regex_submatch_balance:n { \__int_eval:w #1+##1 \__int_eval_end: } } \fi: @@ -2153,9 +2237,9 @@ { \token_if_eq_meaning:NNTF #1 \__tl_build_one:n { - \if_int_compare:w \c_one < 1#2 \exp_stop_f: + \if_int_compare:w 1 < 1#2 \exp_stop_f: \int_set:Nn \l__regex_internal_a_int - { \c_ten * \l__regex_internal_a_int + #2 } + { 10 * \l__regex_internal_a_int + #2 } \exp_after:wN \use_i:nnn \exp_after:wN \__regex_replacement_g_digits:NN \else: @@ -2209,7 +2293,7 @@ } \cs_new_protected:Npn \__regex_replacement_rbrace:N #1 { - \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: \__tl_build_one:n \cs_end: \int_decr:N \l__regex_replacement_csnames_int \else: @@ -2222,7 +2306,7 @@ \if_meaning:w \prg_do_nothing: #3 \__msg_kernel_error:nn { regex } { replacement-catcode-end } \else: - \tex_lccode:D \c_zero = `#3 \scan_stop: + \tex_lccode:D 0 = `#3 \scan_stop: \tex_lowercase:D { \__tl_build_one:n {#1} } \fi: } @@ -2232,7 +2316,7 @@ \char_set_catcode_group_begin:N \^^@ \cs_new_protected:Npn \__regex_replacement_c_B:w { - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \int_incr:N \l__regex_balance_int \fi: \__regex_replacement_char:nNN @@ -2246,7 +2330,7 @@ \char_set_catcode_group_end:N \^^@ \cs_new_protected:Npn \__regex_replacement_c_E:w { - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \int_decr:N \l__regex_balance_int \fi: \__regex_replacement_char:nNN @@ -2272,10 +2356,10 @@ \if_meaning:w \prg_do_nothing: #2 \__msg_kernel_error:nn { regex } { replacement-catcode-end } \else: - \if_int_compare:w `#2 = \c_zero + \if_int_compare:w `#2 = 0 \exp_stop_f: \__msg_kernel_error:nn { regex } { replacement-null-space } \fi: - \tex_lccode:D 32 = `#2 \scan_stop: + \tex_lccode:D `\ = `#2 \scan_stop: \tex_lowercase:D { \__tl_build_one:n {~} } \fi: } @@ -2311,11 +2395,11 @@ \cs_new_protected:Npn \regex_show:n #1 { \__regex_compile:n {#1} - \__regex_show:Nx \l__regex_internal_regex + \__regex_show:Nn \l__regex_internal_regex { { \tl_to_str:n {#1} } } } \cs_new_protected:Npn \regex_show:N #1 - { \__regex_show:Nx #1 { variable~\token_to_str:N #1 } } + { \__regex_show:Nn #1 { variable~\token_to_str:N #1 } } \prg_new_protected_conditional:Npnn \regex_match:nn #1#2 { T , F , TF } { \__regex_if_match:nn { \__regex_build:n {#1} } {#2} @@ -2432,14 +2516,14 @@ { \s__seq \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } - \c_one - { \l__regex_submatch_int - \c_one } + { 2 * \l__regex_max_state_int } + { 1 } + { \l__regex_submatch_int - 1 } \__regex_extract_seq_aux:n } \int_compare:nNnF { \flag_height:n { __regex_begin } + \flag_height:n { __regex_end } } - = \c_zero + = 0 { \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { splitting~or~extracting~submatches } @@ -2462,12 +2546,12 @@ } \cs_new:Npn \__regex_extract_seq_aux:ww #1; #2; { - \if_int_compare:w #1 < \c_zero + \if_int_compare:w #1 < 0 \exp_stop_f: \flag_raise:n { __regex_end } \prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } } \fi: \__regex_query_submatch:n {#2} - \if_int_compare:w #1 > \c_zero + \if_int_compare:w #1 > 0 \exp_stop_f: \flag_raise:n { __regex_begin } \prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } } \fi: @@ -2478,12 +2562,12 @@ \int_set_eq:NN \l__regex_zeroth_submatch_int \l__regex_submatch_int \prg_replicate:nn \l__regex_capturing_group_int { - \tex_skip:D \l__regex_submatch_int \c_zero sp \scan_stop: + \tex_skip:D \l__regex_submatch_int 0 sp \scan_stop: \int_incr:N \l__regex_submatch_int } \prop_map_inline:Nn \l__regex_success_submatches_prop { - \if_int_compare:w ##1 - \c_one + \if_int_compare:w ##1 - 1 \exp_stop_f: \exp_after:wN \__regex_extract_e:wn \__int_value:w \else: \exp_after:wN \__regex_extract_b:wn \__int_value:w @@ -2542,17 +2626,17 @@ { 0 \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \l__regex_capturing_group_int - { \l__regex_submatch_int - \c_one } + { \l__regex_submatch_int - 1 } \__regex_replacement_balance_one_match:n } \tl_set:Nx \l__regex_internal_a_tl { \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \l__regex_capturing_group_int - { \l__regex_submatch_int - \c_one } + { \l__regex_submatch_int - 1 } \__regex_replacement_do_one_match:n \__regex_query_range:nn \l__regex_start_pos_int \l__regex_max_pos_int @@ -2561,24 +2645,24 @@ } \cs_new_protected:Npn \__regex_group_end_replace:N #1 { - \if_int_compare:w \l__regex_balance_int = \c_zero + \if_int_compare:w \l__regex_balance_int = 0 \exp_stop_f: \else: \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { replacing } - { \int_max:nn { - \l__regex_balance_int } { \c_zero } } - { \int_max:nn { \l__regex_balance_int } { \c_zero } } + { \int_max:nn { - \l__regex_balance_int } { 0 } } + { \int_max:nn { \l__regex_balance_int } { 0 } } \fi: \use:x { \group_end: \tl_set:Nn \exp_not:N #1 { - \if_int_compare:w \l__regex_balance_int < \c_zero + \if_int_compare:w \l__regex_balance_int < 0 \exp_stop_f: \prg_replicate:nn { - \l__regex_balance_int } { { \if_false: } \fi: } \fi: \l__regex_internal_a_tl - \if_int_compare:w \l__regex_balance_int > \c_zero + \if_int_compare:w \l__regex_balance_int > 0 \exp_stop_f: \prg_replicate:nn { \l__regex_balance_int } { \if_false: { \fi: } } \fi: @@ -2832,7 +2916,7 @@ { \int_step_inline:nnnn \l__regex_min_state_int - \c_one + { 1 } { \l__regex_max_state_int - 1 } { \trace:nnx { regex } { #1 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty index fd864d2f41b..26066be4102 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3regex.sty @@ -18,9 +18,9 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3regex.dtx Copyright (C) 2011-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +%% File: l3regex.dtx Copyright (C) 2011-2017 The LaTeX3 Project +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{l3regex}{Support package l3kernel too old} @@ -32,11 +32,11 @@ }% \endinput } -\GetIdInfo$Id: l3regex.dtx 6878 2017-02-10 07:40:59Z joseph $ +\GetIdInfo$Id: l3regex.dtx 6984 2017-03-07 20:53:23Z joseph $ {L3 Experimental regular expressions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\RequirePackage{l3tl-build, l3tl-analysis, l3flag, l3str-convert} +\RequirePackage{l3tl-build, l3tl-analysis, l3str-convert} \cs_generate_variant:Nn \tl_to_str:n { V } \cs_new:Npn \__regex_tmp:w { } \tl_new:N \l__regex_internal_a_tl @@ -107,17 +107,15 @@ \cs_new_protected:Npn \__regex_compute_case_changed_char: { \int_set_eq:NN \l__regex_case_changed_char_int \l__regex_current_char_int - \if_int_compare:w \l__regex_current_char_int < \c_ninety_one - \if_int_compare:w \l__regex_current_char_int < \c_sixty_five - \else: - \int_add:Nn \l__regex_case_changed_char_int { \c_thirty_two } + \if_int_compare:w \l__regex_current_char_int > `Z \exp_stop_f: + \if_int_compare:w \l__regex_current_char_int > `z \exp_stop_f: \else: + \if_int_compare:w \l__regex_current_char_int < `a \exp_stop_f: \else: + \int_sub:Nn \l__regex_case_changed_char_int { \c__str_ascii_lower_int } + \fi: \fi: \else: - \if_int_compare:w \l__regex_current_char_int < \c_one_hundred_twenty_three - \if_int_compare:w \l__regex_current_char_int < \c_ninety_seven - \else: - \int_sub:Nn \l__regex_case_changed_char_int { \c_thirty_two } - \fi: + \if_int_compare:w \l__regex_current_char_int < `A \exp_stop_f: \else: + \int_add:Nn \l__regex_case_changed_char_int { \c__str_ascii_lower_int } \fi: \fi: } @@ -130,7 +128,7 @@ 1 \or: 4 \or: 10 \or: 40 \or: 100 \or: \or: 1000 \or: 4000 \or: 10000 \or: \or: 100000 \or: 400000 - \or: 1000000 \or: 4000000 \else: 1*\c_zero + \or: 1000000 \or: 4000000 \else: 1*0 \fi: } \cs_new_protected:Npn \__regex_item_catcode:nT #1 @@ -151,23 +149,25 @@ \fi: \fi: } -\cs_new_protected:Npn \__regex_item_exact_cs:c #1 +\cs_new_protected:Npn \__regex_item_exact_cs:n #1 { - \int_compare:nNnTF \l__regex_current_catcode_int = \c_zero + \int_compare:nNnTF \l__regex_current_catcode_int = 0 { - \str_if_eq_x:nnTF + \tl_set:Nx \l__regex_internal_a_tl { + \scan_stop: \exp_after:wN \exp_after:wN \exp_after:wN \cs_to_str:N \tex_the:D \tex_toks:D \l__regex_current_pos_int + \scan_stop: } - { #1 } + \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l__regex_internal_a_tl { \__regex_break_true:w } { } } { } } \cs_new_protected:Npn \__regex_item_cs:n #1 { - \int_compare:nNnT \l__regex_current_catcode_int = \c_zero + \int_compare:nNnT \l__regex_current_catcode_int = 0 { \group_begin: \tl_set:Nx \l__regex_cs_name_tl @@ -189,70 +189,79 @@ } } \cs_new_protected:Npn \__regex_prop_d: - { \__regex_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9 + { \__regex_item_caseful_range:nn { `0 } { `9 } } \cs_new_protected:Npn \__regex_prop_h: { - \__regex_item_caseful_equal:n \c_thirty_two % space - \__regex_item_caseful_equal:n \c_nine % tab + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_equal:n { `\^^I } } \cs_new_protected:Npn \__regex_prop_s: { - \__regex_item_caseful_equal:n \c_thirty_two % space - \__regex_item_caseful_equal:n \c_nine % tab - \__regex_item_caseful_equal:n \c_ten % lf - \__regex_item_caseful_equal:n \c_twelve % ff - \__regex_item_caseful_equal:n \c_thirteen % cr + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_equal:n { `\^^I } + \__regex_item_caseful_equal:n { `\^^J } + \__regex_item_caseful_equal:n { `\^^L } + \__regex_item_caseful_equal:n { `\^^M } } \cs_new_protected:Npn \__regex_prop_v: - { \__regex_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr + { \__regex_item_caseful_range:nn { `\^^J } { `\^^M } } % lf, vtab, ff, cr \cs_new_protected:Npn \__regex_prop_w: { - \__regex_item_caseful_range:nn \c_ninety_seven { 122 } % a--z - \__regex_item_caseful_range:nn \c_sixty_five { 90 } % A--Z - \__regex_item_caseful_range:nn \c_forty_eight { 57 } % 0--9 - \__regex_item_caseful_equal:n { 95 } % _ + \__regex_item_caseful_range:nn { `a } { `z } + \__regex_item_caseful_range:nn { `A } { `Z } + \__regex_item_caseful_range:nn { `0 } { `9 } + \__regex_item_caseful_equal:n { `_ } } \cs_new_protected:Npn \__regex_prop_N: - { \__regex_item_reverse:n { \__regex_item_caseful_equal:n \c_ten } } + { + \__regex_item_reverse:n + { \__regex_item_caseful_equal:n { `\^^J } } + } \cs_new_protected:Npn \__regex_posix_alnum: { \__regex_posix_alpha: \__regex_posix_digit: } \cs_new_protected:Npn \__regex_posix_alpha: { \__regex_posix_lower: \__regex_posix_upper: } \cs_new_protected:Npn \__regex_posix_ascii: - { \__regex_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven } + { + \__regex_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_int + } \cs_new_eq:NN \__regex_posix_blank: \__regex_prop_h: \cs_new_protected:Npn \__regex_posix_cntrl: { - \__regex_item_caseful_range:nn \c_zero { 31 } - \__regex_item_caseful_equal:n \c_one_hundred_twenty_seven + \__regex_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_control_int + \__regex_item_caseful_equal:n \c__str_ascii_max_int } \cs_new_eq:NN \__regex_posix_digit: \__regex_prop_d: \cs_new_protected:Npn \__regex_posix_graph: - { \__regex_item_caseful_range:nn { 33 } { 126 } } + { \__regex_item_caseful_range:nn { `! } { `\~ } } \cs_new_protected:Npn \__regex_posix_lower: - { \__regex_item_caseful_range:nn \c_ninety_seven { 122 } } + { \__regex_item_caseful_range:nn { `a } { `z } } \cs_new_protected:Npn \__regex_posix_print: - { \__regex_item_caseful_range:nn \c_thirty_two { 126 } } + { \__regex_item_caseful_range:nn { `\ } { `\~ } } \cs_new_protected:Npn \__regex_posix_punct: { - \__regex_item_caseful_range:nn { 33 } { 47 } - \__regex_item_caseful_range:nn { 58 } { 64 } - \__regex_item_caseful_range:nn { 91 } { 96 } - \__regex_item_caseful_range:nn { 123 } { 126 } + \__regex_item_caseful_range:nn { `! } { `/ } + \__regex_item_caseful_range:nn { `: } { `@ } + \__regex_item_caseful_range:nn { `[ } { `` } + \__regex_item_caseful_range:nn { `\{ } { `\~ } } \cs_new_protected:Npn \__regex_posix_space: { - \__regex_item_caseful_equal:n \c_thirty_two - \__regex_item_caseful_range:nn \c_nine \c_thirteen + \__regex_item_caseful_equal:n { `\ } + \__regex_item_caseful_range:nn { `\^^I } { `\^^M } } \cs_new_protected:Npn \__regex_posix_upper: - { \__regex_item_caseful_range:nn \c_sixty_five { 90 } } + { \__regex_item_caseful_range:nn { `A } { `Z } } \cs_new_eq:NN \__regex_posix_word: \__regex_prop_w: \cs_new_protected:Npn \__regex_posix_xdigit: { \__regex_posix_digit: - \__regex_item_caseful_range:nn \c_sixty_five { 70 } - \__regex_item_caseful_range:nn \c_ninety_seven { 102 } + \__regex_item_caseful_range:nn { `A } { `F } + \__regex_item_caseful_range:nn { `a } { `f } } \cs_new_protected:Npn \__regex_escape_use:nnnn #1#2#3#4 { @@ -260,7 +269,7 @@ \cs_set:Npn \__regex_escape_unescaped:N ##1 { #1 } \cs_set:Npn \__regex_escape_escaped:N ##1 { #2 } \cs_set:Npn \__regex_escape_raw:N ##1 { #3 } - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \__str_gset_other:Nn \g__regex_internal_tl { #4 } \tl_set:Nx \l__regex_internal_b_tl { @@ -314,12 +323,12 @@ } \cs_new:Npn \__regex_escape_x_end:w #1 ; { - \int_compare:nNnTF {#1} < \c_two_hundred_fifty_six + \int_compare:nNnTF {#1} > \c__str_max_byte_int + { \__regex_escape_x_large:n {#1} } { \exp_last_unbraced:Nf \__regex_escape_raw:N { \__str_output_byte:n {#1} } } - { \__regex_escape_x_large:n {#1} } } \group_begin: \char_set_catcode_other:n { 0 } @@ -334,7 +343,7 @@ { \if_false: } \fi: } { - \char_set_lccode:nn { \c_zero } {#1} + \char_set_lccode:nn { 0 } {#1} \tex_lowercase:D { \tl_set:Nx \l__regex_internal_b_tl @@ -405,47 +414,53 @@ } \prg_new_conditional:Npnn \__regex_char_if_special:N #1 { TF } { - \if_int_compare:w `#1 < \c_ninety_one - \if_int_compare:w `#1 < \c_fifty_eight - \if_int_compare:w `#1 < \c_forty_eight - \if_int_compare:w `#1 < \c_thirty_two - \prg_return_false: \else: \prg_return_true: \fi: - \else: \prg_return_false: \fi: + \if_int_compare:w `#1 > `Z \exp_stop_f: + \if_int_compare:w `#1 > `z \exp_stop_f: + \if_int_compare:w `#1 < \c__str_ascii_max_int + \prg_return_true: \else: \prg_return_false: \fi: \else: - \if_int_compare:w `#1 < \c_sixty_five + \if_int_compare:w `#1 < `a \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_three - \if_int_compare:w `#1 < \c_ninety_seven + \if_int_compare:w `#1 > `9 \exp_stop_f: + \if_int_compare:w `#1 < `A \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_seven - \prg_return_true: \else: \prg_return_false: \fi: + \if_int_compare:w `#1 < `0 \exp_stop_f: + \if_int_compare:w `#1 < `\ \exp_stop_f: + \prg_return_false: \else: \prg_return_true: \fi: + \else: \prg_return_false: \fi: \fi: \fi: } \prg_new_conditional:Npnn \__regex_char_if_alphanumeric:N #1 { TF } { - \if_int_compare:w `#1 < \c_ninety_one - \if_int_compare:w `#1 < \c_fifty_eight - \if_int_compare:w `#1 < \c_forty_eight - \prg_return_false: \else: \prg_return_true: \fi: + \if_int_compare:w `#1 > `Z \exp_stop_f: + \if_int_compare:w `#1 > `z \exp_stop_f: + \prg_return_false: \else: - \if_int_compare:w `#1 < \c_sixty_five + \if_int_compare:w `#1 < `a \exp_stop_f: \prg_return_false: \else: \prg_return_true: \fi: \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_three - \if_int_compare:w `#1 < \c_ninety_seven + \if_int_compare:w `#1 > `9 \exp_stop_f: + \if_int_compare:w `#1 < `A \exp_stop_f: \prg_return_false: \else: \prg_return_true: \fi: \else: - \prg_return_false: + \if_int_compare:w `#1 < `0 \exp_stop_f: + \prg_return_false: \else: \prg_return_true: \fi: \fi: \fi: } \int_new:N \l__regex_group_level_int \int_new:N \l__regex_mode_int +\int_const:Nn \c__regex_cs_in_class_mode_int { -6 } +\int_const:Nn \c__regex_cs_mode_int { -2 } +\int_const:Nn \c__regex_outer_mode_int { 0 } +\int_const:Nn \c__regex_catcode_mode_int { 2 } +\int_const:Nn \c__regex_class_mode_int { 3 } +\int_const:Nn \c__regex_catcode_in_class_mode_int { 6 } \int_new:N \l__regex_catcodes_int \int_new:N \l__regex_default_catcodes_int \bool_new:N \l__regex_catcodes_bool @@ -480,7 +495,7 @@ \prg_new_conditional:Npnn \__regex_if_raw_digit:NN #1#2 { TF } { \if_meaning:w \__regex_compile_raw:N #1 - \if_int_compare:w \c_one < 1 #2 \exp_stop_f: + \if_int_compare:w 1 < 1 #2 \exp_stop_f: \prg_return_true: \else: \prg_return_false: @@ -502,7 +517,7 @@ \if_int_odd:w \l__regex_mode_int \exp_after:wN \use_ii:nn \else: - \if_int_compare:w \l__regex_mode_int < \c_zero + \if_int_compare:w \l__regex_mode_int < \c__regex_outer_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn \else: \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn @@ -514,7 +529,7 @@ \if_int_odd:w \l__regex_mode_int \exp_after:wN \use_i:nn \else: - \if_int_compare:w \l__regex_mode_int > \c_zero + \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use_i:nn \else: \exp_after:wN \exp_after:wN \exp_after:wN \use_ii:nn @@ -523,7 +538,7 @@ } \cs_new:Npn \__regex_if_within_catcode:TF { - \if_int_compare:w \l__regex_mode_int > \c_zero + \if_int_compare:w \l__regex_mode_int > \c__regex_outer_mode_int \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -531,10 +546,10 @@ } \cs_new_protected:Npn \__regex_chk_c_allowed:T { - \if_int_compare:w \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int \exp_after:wN \use:n \else: - \if_int_compare:w \l__regex_mode_int = \c_three + \if_int_compare:w \l__regex_mode_int = \c__regex_class_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use:n \else: \__msg_kernel_error:nn { regex } { c-bad-mode } @@ -544,11 +559,11 @@ } \cs_new_protected:Npn \__regex_mode_quit_c: { - \if_int_compare:w \l__regex_mode_int = \c_two - \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int + \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int \else: - \if_int_compare:w \l__regex_mode_int = \c_six - \l__regex_mode_int = \c_three + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_in_class_mode_int + \int_set_eq:NN \l__regex_mode_int \c__regex_class_mode_int \fi: \fi: } @@ -571,7 +586,7 @@ \prg_do_nothing: \prg_do_nothing: } { } - \if_int_compare:w \l__regex_group_level_int > \c_zero + \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { missing-rparen } { \int_use:N \l__regex_group_level_int } \prg_replicate:nn @@ -592,8 +607,8 @@ \cs_new_protected:Npn \__regex_compile:n #1 { \__regex_compile:w - \int_set:Nn \tex_escapechar:D { 92 } - \int_set_eq:NN \l__regex_mode_int \c_zero + \int_set:Nn \tex_escapechar:D { `\\ } + \int_set_eq:NN \l__regex_mode_int \c__regex_outer_mode_int \__regex_escape_use:nnnn { \__regex_char_if_special:NTF ##1 @@ -607,14 +622,12 @@ { #1 } \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: - \int_compare:nNnT \l__regex_mode_int = \c_two + \int_compare:nNnT \l__regex_mode_int = \c__regex_catcode_mode_int { \__msg_kernel_error:nn { regex } { c-trailing } } - \int_compare:nNnT \l__regex_mode_int < \c_zero + \int_compare:nNnT \l__regex_mode_int < \c__regex_outer_mode_int { \__msg_kernel_error:nn { regex } { c-missing-rbrace } - \__regex_compile_end: - \__regex_compile_one:x - { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } } + \__regex_compile_end_cs: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: } @@ -837,7 +850,7 @@ } \cs_new_protected:cpn { __regex_prop_.: } { - \if_int_compare:w \l__regex_current_char_int > - \c_two + \if_int_compare:w \l__regex_current_char_int > - 2 \exp_stop_f: \exp_after:wN \__regex_break_true:w \fi: } @@ -904,11 +917,11 @@ { \__regex_if_in_class:TF { - \if_int_compare:w \l__regex_mode_int > \c_sixteen + \if_int_compare:w \l__regex_mode_int > \c__regex_catcode_in_class_mode_int \__tl_build_one:n { \if_false: { \fi: } } \fi: - \tex_advance:D \l__regex_mode_int - \c_fifteen - \tex_divide:D \l__regex_mode_int \c_thirteen + \tex_advance:D \l__regex_mode_int - 15 \exp_stop_f: + \tex_divide:D \l__regex_mode_int 13 \exp_stop_f: \if_int_odd:w \l__regex_mode_int \else: \exp_after:wN \__regex_compile_quantifier:w \fi: @@ -936,7 +949,7 @@ } \cs_new_protected:Npn \__regex_compile_class_catcode:w #1; { - \if_int_compare:w \l__regex_mode_int = \c_two + \if_int_compare:w \l__regex_mode_int = \c__regex_catcode_mode_int \__tl_build_one:n { \__regex_class:NnnnN \c_true_bool { \if_false: } \fi: } \fi: @@ -1038,7 +1051,7 @@ } \cs_new_protected:Npn \__regex_compile_group_end: { - \if_int_compare:w \l__regex_group_level_int > \c_zero + \if_int_compare:w \l__regex_group_level_int > 0 \exp_stop_f: \__tl_build_one:n { \if_false: { \fi: } } \__tl_build_end: \int_set_eq:NN \l__regex_catcodes_int \l__regex_default_catcodes_int @@ -1130,7 +1143,11 @@ { \int_set_eq:Nc \l__regex_catcodes_int { c__regex_catcode_#2_int } \l__regex_mode_int - = \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_catcode_mode_int + \else: + \c__regex_catcode_in_class_mode_int + \fi: } } { \cs_if_exist_use:cF { __regex_compile_c_#2:w } } @@ -1142,7 +1159,11 @@ \cs_new_protected:cpn { __regex_compile_c_[:w } #1#2 { \l__regex_mode_int - = \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_catcode_mode_int + \else: + \c__regex_catcode_in_class_mode_int + \fi: \int_zero:N \l__regex_catcodes_int \str_if_eq:nnTF { #1 #2 } { \__regex_compile_special:N ^ } { @@ -1195,17 +1216,72 @@ \__regex_compile:w \__regex_disable_submatches: \l__regex_mode_int - = - \if_case:w \l__regex_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l__regex_mode_int + \c__regex_cs_mode_int + \else: + \c__regex_cs_in_class_mode_int + \fi: } +\flag_new:n { __regex_cs } \cs_new_protected:cpn { __regex_compile_ \c_right_brace_str : } { \__regex_if_in_cs:TF + { \__regex_compile_end_cs: } + { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str } + } +\cs_new_protected:Npn \__regex_compile_end_cs: + { + \__regex_compile_end: + \flag_clear:n { __regex_cs } + \tl_set:Nx \l__regex_internal_a_tl { - \__regex_compile_end: - \__regex_compile_one:x + \exp_after:wN \__regex_compile_cs_aux:Nn \l__regex_internal_regex + \q_nil \q_nil \q_recursion_stop + } + \exp_args:Nx \__regex_compile_one:x + { + \flag_if_raised:nTF { __regex_cs } { \__regex_item_cs:n { \exp_not:o \l__regex_internal_regex } } + { \__regex_item_exact_cs:n { \tl_tail:N \l__regex_internal_a_tl } } + } + } +\cs_new:Npn \__regex_compile_cs_aux:Nn #1#2 + { + \cs_if_eq:NNTF #1 \__regex_branch:n + { + \scan_stop: + \__regex_compile_cs_aux:NNnnnN #2 + \q_nil \q_nil \q_nil \q_nil \q_nil \q_nil \q_recursion_stop + \__regex_compile_cs_aux:Nn + } + { + \quark_if_nil:NF #1 { \flag_raise:n { __regex_cs } } + \use_none_delimit_by_q_recursion_stop:w + } + } +\cs_new:Npn \__regex_compile_cs_aux:NNnnnN #1#2#3#4#5#6 + { + \bool_lazy_all:nTF + { + { \cs_if_eq_p:NN #1 \__regex_class:NnnnN } + {#2} + { \tl_if_head_eq_meaning_p:nN {#3} \__regex_item_caseful_equal:n } + { \int_compare_p:nNn { \tl_count:n {#3} } = { 2 } } + { \int_compare_p:nNn {#5} = { 0 } } + } + { + \prg_replicate:nn {#4} + { \char_generate:nn { \use_ii:nn #3 } {12} } + \__regex_compile_cs_aux:NNnnnN + } + { + \quark_if_nil:NF #1 + { + \flag_raise:n { __regex_cs } + \use_i_delimit_by_q_recursion_stop:nw + } + \use_none_delimit_by_q_recursion_stop:w } - { \exp_after:wN \__regex_compile_raw:N \c_right_brace_str } } \cs_new_protected:cpn { __regex_compile_/u: } #1#2 { @@ -1245,7 +1321,7 @@ \cs_new_protected:Npn \__regex_compile_u_end: { \tl_set:Nv \l__regex_internal_a_tl { \l__regex_internal_a_tl } - \if_int_compare:w \l__regex_mode_int = \c_zero + \if_int_compare:w \l__regex_mode_int = \c__regex_outer_mode_int \__regex_compile_u_not_cs: \else: \__regex_compile_u_in_cs: @@ -1275,8 +1351,8 @@ { \__regex_class:NnnnN \c_true_bool { - \if_int_compare:w "##2 = \c_zero - \__regex_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 } + \if_int_compare:w "##2 = 0 \exp_stop_f: + \__regex_item_exact_cs:n { \exp_after:wN \cs_to_str:N ##1 } \else: \__regex_item_exact:nn { \__int_value:w "##2 } { ##3 } \fi: @@ -1287,11 +1363,11 @@ } \cs_new_protected:cpn { __regex_compile_/K: } { - \int_compare:nNnTF \l__regex_mode_int = \c_zero + \int_compare:nNnTF \l__regex_mode_int = \c__regex_outer_mode_int { \__tl_build_one:n { \__regex_command_K: } } { \__regex_compile_raw_error:N K } } -\cs_new_protected:Npn \__regex_show:Nx #1#2 +\cs_new_protected:Npn \__regex_show:Nn #1#2 { \__tl_build:Nw \l__regex_internal_a_tl \cs_set_protected:Npn \__regex_branch:n @@ -1333,16 +1409,16 @@ { \__regex_show_scope:nn { Reversed~match } } \cs_set_protected:Npn \__regex_item_exact:nn ##1##2 { \__regex_show_one:n { char~##2,~catcode~##1 } } - \cs_set_protected:Npn \__regex_item_exact_cs:c ##1 - { \__regex_show_one:n { control~sequence~\iow_char:N\\##1 } } + \cs_set_eq:NN \__regex_item_exact_cs:n \__regex_show_item_exact_cs:n \cs_set_protected:Npn \__regex_item_cs:n { \__regex_show_scope:nn { control~sequence } } \cs_set:cpn { __regex_prop_.: } { \__regex_show_one:n { any~token } } \seq_clear:N \l__regex_show_prefix_seq \__regex_show_push:n { ~ } - #1 + \cs_if_exist_use:N #1 \__tl_build_end: - \__msg_show_wrap:n { >~Compiled~regex~#2: \l__regex_internal_a_tl } + \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } + { >~Compiled~regex~#2: \l__regex_internal_a_tl } } \cs_new_protected:Npn \__regex_show_one:n #1 { @@ -1437,6 +1513,14 @@ \bool_if:NF #1 { negative~ } class } } +\cs_new_protected:Npn \__regex_show_item_exact_cs:n #1 + { + \seq_set_split:Nnn \l__regex_internal_seq { \scan_stop: } {#1} + \seq_set_map:NNn \l__regex_internal_seq + \l__regex_internal_seq { \iow_char:N\\##1 } + \__regex_show_one:n + { control~sequence~ \seq_use:Nn \l__regex_internal_seq { ~or~ } } + } \int_new:N \l__regex_min_state_int \int_new:N \l__regex_max_state_int \int_new:N \l__regex_left_state_int @@ -1451,7 +1535,7 @@ } \cs_new_protected:Npn \__regex_build:N #1 { - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \int_zero:N \l__regex_capturing_group_int \int_set_eq:NN \l__regex_max_state_int \l__regex_min_state_int \__regex_build_new_state: @@ -1557,7 +1641,7 @@ } \cs_new_protected:Npn \__regex_class_repeat:nN #1#2 { - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #1 = 0 \exp_stop_f: \__regex_build_transitions_lazyness:NNNNN #2 \__regex_action_free:n \l__regex_right_state_int \__regex_tests_action_cost:n \l__regex_left_state_int @@ -1573,7 +1657,7 @@ { \__regex_class_repeat:n {#1} \int_set:Nn \l__regex_internal_a_int - { \l__regex_max_state_int + #2 - \c_one } + { \l__regex_max_state_int + #2 - 1 } \prg_replicate:nn { #2 } { \__regex_build_transitions_lazyness:NNNNN #3 @@ -1583,7 +1667,7 @@ } \cs_new_protected:Npn \__regex_group_aux:nnnnN #1#2#3#4#5 { - \if_int_compare:w #3 = \c_zero + \if_int_compare:w #3 = 0 \exp_stop_f: \__regex_build_new_state: \__regex_build_transition_right:nNn \__regex_action_free_group:n \l__regex_left_state_int \l__regex_right_state_int @@ -1644,9 +1728,9 @@ } \cs_new_protected:Npn \__regex_group_repeat:nn #1#2 { - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \int_set:Nn \l__regex_max_state_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \__regex_build_new_state: \else: \__regex_group_repeat_aux:n {#2} @@ -1657,7 +1741,7 @@ } \cs_new_protected:Npn \__regex_group_submatches:nNN #1#2#3 { - \if_int_compare:w #1 > - \c_one + \if_int_compare:w #1 > - 1 \exp_stop_f: \__regex_toks_put_left:Nx #2 { \__regex_action_submatch:n { #1 < } } \__regex_toks_put_left:Nx #3 { \__regex_action_submatch:n { #1 > } } \fi: @@ -1668,10 +1752,10 @@ \l__regex_right_state_int \l__regex_max_state_int \int_set_eq:NN \l__regex_internal_a_int \l__regex_left_state_int \int_set_eq:NN \l__regex_internal_b_int \l__regex_max_state_int - \if_int_compare:w \__int_eval:w #1 > \c_one + \if_int_compare:w \__int_eval:w #1 > 1 \exp_stop_f: \int_set:Nn \l__regex_internal_c_int { - ( #1 - \c_one ) + ( #1 - 1 ) * ( \l__regex_internal_b_int - \l__regex_internal_a_int ) } \tex_advance:D \l__regex_right_state_int \l__regex_internal_c_int @@ -1680,18 +1764,18 @@ { \tex_toks:D \l__regex_internal_b_int = \tex_toks:D \l__regex_internal_a_int - \tex_advance:D \l__regex_internal_a_int \c_one - \tex_advance:D \l__regex_internal_b_int \c_one + \int_incr:N \l__regex_internal_a_int + \int_incr:N \l__regex_internal_b_int } \fi: } \cs_new_protected:Npn \__regex_group_repeat:nnN #1#2#3 { - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \__regex_group_submatches:nNN {#1} \l__regex_left_state_int \l__regex_right_state_int \int_set:Nn \l__regex_internal_a_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \__regex_build_transition_right:nNn \__regex_action_free:n \l__regex_right_state_int \l__regex_internal_a_int \__regex_build_new_state: @@ -1731,16 +1815,16 @@ \l__regex_left_state_int \l__regex_max_state_int } \else: - \prg_replicate:nn { #3 - \c_one } + \prg_replicate:nn { #3 - 1 } { \int_sub:Nn \l__regex_right_state_int { \l__regex_internal_b_int - \l__regex_internal_a_int } \__regex_build_transition_right:nNn \__regex_action_free:n \l__regex_right_state_int \l__regex_max_state_int } - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \int_set:Nn \l__regex_right_state_int - { \l__regex_left_state_int - \c_one } + { \l__regex_left_state_int - 1 } \else: \int_sub:Nn \l__regex_right_state_int { \l__regex_internal_b_int - \l__regex_internal_a_int } @@ -1820,7 +1904,7 @@ \cs_new_protected:Npn \__regex_match:n #1 { \int_zero:N \l__regex_balance_int - \int_set:Nn \l__regex_current_pos_int { \c_two * \l__regex_max_state_int } + \int_set:Nn \l__regex_current_pos_int { 2 * \l__regex_max_state_int } \__regex_query_set:nnn { } { -1 } { -2 } \int_set_eq:NN \l__regex_min_pos_int \l__regex_current_pos_int \__tl_analysis_map_inline:nn {#1} @@ -1829,13 +1913,13 @@ \__regex_query_set:nnn { } { -1 } { -2 } \bool_gset_false:N \g__regex_success_bool \int_step_inline:nnnn - \l__regex_min_state_int \c_one { \l__regex_max_state_int - \c_one } - { \tex_dimen:D ##1 \c_one sp \scan_stop: } + \l__regex_min_state_int { 1 } { \l__regex_max_state_int - 1 } + { \tex_dimen:D ##1 ~ 1 sp \scan_stop: } \int_set_eq:NN \l__regex_min_active_int \l__regex_max_state_int - \int_set_eq:NN \l__regex_step_int \c_zero + \int_zero:N \l__regex_step_int \int_set_eq:NN \l__regex_success_pos_int \l__regex_min_pos_int \int_set:Nn \l__regex_submatch_int - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \bool_set_false:N \l__regex_empty_success_bool \__regex_match_once: } @@ -1853,7 +1937,7 @@ \int_set_eq:NN \l__regex_max_active_int \l__regex_min_active_int \__regex_store_state:n { \l__regex_min_state_int } \int_set:Nn \l__regex_current_pos_int - { \l__regex_start_pos_int - \c_one } + { \l__regex_start_pos_int - 1 } \__regex_query_get: \__regex_match_loop: \l__regex_every_match_tl @@ -1876,7 +1960,7 @@ } \cs_new_protected:Npn \__regex_match_loop: { - \tex_advance:D \l__regex_step_int \c_two + \tex_advance:D \l__regex_step_int 2 \exp_stop_f: \int_incr:N \l__regex_current_pos_int \int_set_eq:NN \l__regex_last_char_int \l__regex_current_char_int \int_set_eq:NN \l__regex_case_changed_char_int \c_max_int @@ -1902,7 +1986,7 @@ { \__int_value:w \tex_skip:D #1 } { \tex_the:D \tex_toks:D #1 } \exp_after:wN \__regex_match_one_active:w - \__int_value:w \__int_eval:w #1 + \c_one \exp_after:wN ; + \__int_value:w \__int_eval:w #1 + 1 \exp_after:wN ; \fi: } \cs_new_protected:Npn \__regex_query_set:nnn #1#2#3 @@ -1933,7 +2017,7 @@ = \l__regex_step_int sp \scan_stop: \tex_the:D \tex_toks:D \l__regex_current_state_int \tex_dimen:D \l__regex_current_state_int - = \__int_eval:w \l__regex_step_int + \c_one \__int_eval_end: sp \scan_stop: + = \__int_eval:w \l__regex_step_int + 1 \__int_eval_end: sp \scan_stop: } \cs_new_protected:Npn \__regex_use_state_and_submatches:nn #1 #2 { @@ -2038,7 +2122,7 @@ \fi: \tex_the:D \tex_toks:D #1 \exp_stop_f: \exp_after:wN \__regex_query_range_loop:ww - \__int_value:w \__int_eval:w #1 + \c_one ; #2 ; + \__int_value:w \__int_eval:w #1 + 1 ; #2 ; } \cs_new:Npn \__regex_query_submatch:n #1 { @@ -2067,7 +2151,7 @@ { \__tl_build_one:n ##1 } {#1} \prg_do_nothing: \prg_do_nothing: - \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } { \int_use:N \l__regex_replacement_csnames_int } \__tl_build_one:x @@ -2096,7 +2180,7 @@ { \cs_if_exist_use:cF { __regex_replacement_#1:w } { - \if_int_compare:w \c_one < 1#1 \exp_stop_f: + \if_int_compare:w 1 < 1#1 \exp_stop_f: \__regex_replacement_put_submatch:n {#1} \else: \__tl_build_one:o { \token_to_str:N #1 } @@ -2107,7 +2191,7 @@ { \if_int_compare:w #1 < \l__regex_capturing_group_int \__tl_build_one:n { \__regex_query_submatch:n { #1 + ##1 } } - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \tl_put_right:Nn \l__regex_balance_tl { + \__regex_submatch_balance:n { \__int_eval:w #1+##1 \__int_eval_end: } } \fi: @@ -2126,9 +2210,9 @@ { \token_if_eq_meaning:NNTF #1 \__tl_build_one:n { - \if_int_compare:w \c_one < 1#2 \exp_stop_f: + \if_int_compare:w 1 < 1#2 \exp_stop_f: \int_set:Nn \l__regex_internal_a_int - { \c_ten * \l__regex_internal_a_int + #2 } + { 10 * \l__regex_internal_a_int + #2 } \exp_after:wN \use_i:nnn \exp_after:wN \__regex_replacement_g_digits:NN \else: @@ -2182,7 +2266,7 @@ } \cs_new_protected:Npn \__regex_replacement_rbrace:N #1 { - \if_int_compare:w \l__regex_replacement_csnames_int > \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int > 0 \exp_stop_f: \__tl_build_one:n \cs_end: \int_decr:N \l__regex_replacement_csnames_int \else: @@ -2195,7 +2279,7 @@ \if_meaning:w \prg_do_nothing: #3 \__msg_kernel_error:nn { regex } { replacement-catcode-end } \else: - \tex_lccode:D \c_zero = `#3 \scan_stop: + \tex_lccode:D 0 = `#3 \scan_stop: \tex_lowercase:D { \__tl_build_one:n {#1} } \fi: } @@ -2205,7 +2289,7 @@ \char_set_catcode_group_begin:N \^^@ \cs_new_protected:Npn \__regex_replacement_c_B:w { - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \int_incr:N \l__regex_balance_int \fi: \__regex_replacement_char:nNN @@ -2219,7 +2303,7 @@ \char_set_catcode_group_end:N \^^@ \cs_new_protected:Npn \__regex_replacement_c_E:w { - \if_int_compare:w \l__regex_replacement_csnames_int = \c_zero + \if_int_compare:w \l__regex_replacement_csnames_int = 0 \exp_stop_f: \int_decr:N \l__regex_balance_int \fi: \__regex_replacement_char:nNN @@ -2245,10 +2329,10 @@ \if_meaning:w \prg_do_nothing: #2 \__msg_kernel_error:nn { regex } { replacement-catcode-end } \else: - \if_int_compare:w `#2 = \c_zero + \if_int_compare:w `#2 = 0 \exp_stop_f: \__msg_kernel_error:nn { regex } { replacement-null-space } \fi: - \tex_lccode:D 32 = `#2 \scan_stop: + \tex_lccode:D `\ = `#2 \scan_stop: \tex_lowercase:D { \__tl_build_one:n {~} } \fi: } @@ -2284,11 +2368,11 @@ \cs_new_protected:Npn \regex_show:n #1 { \__regex_compile:n {#1} - \__regex_show:Nx \l__regex_internal_regex + \__regex_show:Nn \l__regex_internal_regex { { \tl_to_str:n {#1} } } } \cs_new_protected:Npn \regex_show:N #1 - { \__regex_show:Nx #1 { variable~\token_to_str:N #1 } } + { \__regex_show:Nn #1 { variable~\token_to_str:N #1 } } \prg_new_protected_conditional:Npnn \regex_match:nn #1#2 { T , F , TF } { \__regex_if_match:nn { \__regex_build:n {#1} } {#2} @@ -2405,14 +2489,14 @@ { \s__seq \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } - \c_one - { \l__regex_submatch_int - \c_one } + { 2 * \l__regex_max_state_int } + { 1 } + { \l__regex_submatch_int - 1 } \__regex_extract_seq_aux:n } \int_compare:nNnF { \flag_height:n { __regex_begin } + \flag_height:n { __regex_end } } - = \c_zero + = 0 { \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { splitting~or~extracting~submatches } @@ -2435,12 +2519,12 @@ } \cs_new:Npn \__regex_extract_seq_aux:ww #1; #2; { - \if_int_compare:w #1 < \c_zero + \if_int_compare:w #1 < 0 \exp_stop_f: \flag_raise:n { __regex_end } \prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } } \fi: \__regex_query_submatch:n {#2} - \if_int_compare:w #1 > \c_zero + \if_int_compare:w #1 > 0 \exp_stop_f: \flag_raise:n { __regex_begin } \prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } } \fi: @@ -2451,12 +2535,12 @@ \int_set_eq:NN \l__regex_zeroth_submatch_int \l__regex_submatch_int \prg_replicate:nn \l__regex_capturing_group_int { - \tex_skip:D \l__regex_submatch_int \c_zero sp \scan_stop: + \tex_skip:D \l__regex_submatch_int 0 sp \scan_stop: \int_incr:N \l__regex_submatch_int } \prop_map_inline:Nn \l__regex_success_submatches_prop { - \if_int_compare:w ##1 - \c_one + \if_int_compare:w ##1 - 1 \exp_stop_f: \exp_after:wN \__regex_extract_e:wn \__int_value:w \else: \exp_after:wN \__regex_extract_b:wn \__int_value:w @@ -2515,17 +2599,17 @@ { 0 \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \l__regex_capturing_group_int - { \l__regex_submatch_int - \c_one } + { \l__regex_submatch_int - 1 } \__regex_replacement_balance_one_match:n } \tl_set:Nx \l__regex_internal_a_tl { \int_step_function:nnnN - { \c_two * \l__regex_max_state_int } + { 2 * \l__regex_max_state_int } \l__regex_capturing_group_int - { \l__regex_submatch_int - \c_one } + { \l__regex_submatch_int - 1 } \__regex_replacement_do_one_match:n \__regex_query_range:nn \l__regex_start_pos_int \l__regex_max_pos_int @@ -2534,24 +2618,24 @@ } \cs_new_protected:Npn \__regex_group_end_replace:N #1 { - \if_int_compare:w \l__regex_balance_int = \c_zero + \if_int_compare:w \l__regex_balance_int = 0 \exp_stop_f: \else: \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { replacing } - { \int_max:nn { - \l__regex_balance_int } { \c_zero } } - { \int_max:nn { \l__regex_balance_int } { \c_zero } } + { \int_max:nn { - \l__regex_balance_int } { 0 } } + { \int_max:nn { \l__regex_balance_int } { 0 } } \fi: \use:x { \group_end: \tl_set:Nn \exp_not:N #1 { - \if_int_compare:w \l__regex_balance_int < \c_zero + \if_int_compare:w \l__regex_balance_int < 0 \exp_stop_f: \prg_replicate:nn { - \l__regex_balance_int } { { \if_false: } \fi: } \fi: \l__regex_internal_a_tl - \if_int_compare:w \l__regex_balance_int > \c_zero + \if_int_compare:w \l__regex_balance_int > 0 \exp_stop_f: \prg_replicate:nn { \l__regex_balance_int } { \if_false: { \fi: } } \fi: diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty index ba989f071c7..77f2c83eaa9 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-convert.sty @@ -18,13 +18,13 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \RequirePackage{expl3} -\GetIdInfo$Id: l3str-convert.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3str-convert.dtx 6969 2017-02-20 18:32:23Z bruno $ {L3 Experimental string encoding conversions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\RequirePackage{l3tl-analysis,l3tl-build,l3flag} +\RequirePackage{l3tl-analysis,l3tl-build} \cs_if_exist:NF \use_ii_i:nn { \cs_new:Npn \use_ii_i:nn #1#2 { #2 #1 } } \cs_new_protected:Npn \__str_tmp:w { } @@ -32,13 +32,11 @@ \int_new:N \l__str_internal_int \tl_new:N \g__str_result_tl \int_const:Nn \c__str_replacement_char_int { "FFFD } -\int_const:Nn \c_forty_eight { 48 } -\int_const:Nn \c_fifty_eight { 58 } -\int_const:Nn \c_sixty_five { 65 } -\int_const:Nn \c_ninety_one { 91 } -\int_const:Nn \c_ninety_seven { 97 } -\int_const:Nn \c_one_hundred_twenty_three { 123 } -\int_const:Nn \c_one_hundred_twenty_seven { 127 } +\int_const:Nn \c__str_max_byte_int { 255 } +\int_const:Nn \c__str_ascii_min_int { 0 } +\int_const:Nn \c__str_ascii_max_control_int { 31 } +\int_const:Nn \c__str_ascii_max_int { 127 } +\int_const:Nn \c__str_ascii_lower_int { `a - `A } \prop_new:N \g__str_alias_prop \prop_gput:Nnn \g__str_alias_prop { latin1 } { iso88591 } \prop_gput:Nnn \g__str_alias_prop { latin2 } { iso88592 } @@ -108,7 +106,7 @@ { \__prg_break:n { \prg_return_true: \use_none:n } } \prg_new_conditional:Npnn \__str_octal_use:N #1 { TF } { - \if_int_compare:w \c_one < '1 \token_to_str:N #1 \exp_stop_f: + \if_int_compare:w 1 < '1 \token_to_str:N #1 \exp_stop_f: #1 \prg_return_true: \else: \prg_return_false: @@ -116,7 +114,7 @@ } \prg_new_conditional:Npnn \__str_hexadecimal_use:N #1 { TF } { - \if_int_compare:w \c_two < "1 \token_to_str:N #1 \exp_stop_f: + \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 @@ -327,20 +325,19 @@ \cs_new:Npn \__str_convert_lowercase_alphanum_loop:N #1 { \use_none:n #1 - \if_int_compare:w `#1 < \c_ninety_one - \if_int_compare:w `#1 < \c_sixty_five - \if_int_compare:w \c_one < 1#1 \exp_stop_f: + \if_int_compare:w `#1 > `Z \exp_stop_f: + \if_int_compare:w `#1 > `z \exp_stop_f: \else: + \if_int_compare:w `#1 < `a \exp_stop_f: \else: #1 \fi: - \else: - \__str_output_byte:n { `#1 + \c_thirty_two } \fi: \else: - \if_int_compare:w `#1 < \c_one_hundred_twenty_three - \if_int_compare:w `#1 < \c_ninety_seven - \else: + \if_int_compare:w `#1 < `A \exp_stop_f: + \if_int_compare:w 1 < 1#1 \exp_stop_f: #1 \fi: + \else: + \__str_output_byte:n { `#1 + \c__str_ascii_lower_int } \fi: \fi: \__str_convert_lowercase_alphanum_loop:N @@ -363,9 +360,9 @@ \char_set_catcode_comment:N \% \int_set:Nn \tex_endlinechar:D {32} } -\bool_if:nTF +\bool_lazy_any:nTF { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -387,9 +384,9 @@ } } { \cs_new_eq:NN \__str_filter_bytes:n \use:n } -\bool_if:nTF +\bool_lazy_any:nTF { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -411,9 +408,9 @@ { #1 \s__tl \__int_value:w `#1 \s__tl } \group_begin: \char_set_catcode_other:n { 0 } - \bool_if:nTF + \bool_lazy_any:nTF { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -443,11 +440,11 @@ } \cs_new:Npn \__str_encode_native_char:n #1 { - \if_int_compare:w #1 < \c_two_hundred_fifty_six - \__str_output_byte:n {#1} - \else: + \if_int_compare:w #1 > \c__str_max_byte_int \flag_raise:n { str_error } ? + \else: + \__str_output_byte:n {#1} \fi: } \__msg_kernel_new:nnnn { str } { pdfTeX-native-overflow } @@ -509,7 +506,7 @@ \tex_dimen:D "#1 = \l__str_internal_int sp \scan_stop: \tex_skip:D \l__str_internal_int = "#1 sp \scan_stop: \tex_toks:D \l__str_internal_int \exp_after:wN { \__int_value:w "#2 } - \tex_advance:D \l__str_internal_int \c_one + \int_incr:N \l__str_internal_int \__str_decode_eight_bit_load:nn } \cs_new_protected:Npn \__str_decode_eight_bit_load_missing:n #1 @@ -519,7 +516,7 @@ \tex_skip:D \l__str_internal_int = "#1 sp \scan_stop: \tex_toks:D \l__str_internal_int \exp_after:wN { \int_use:N \c__str_replacement_char_int } - \tex_advance:D \l__str_internal_int \c_one + \int_incr:N \l__str_internal_int \__str_decode_eight_bit_load_missing:n } \cs_new:Npn \__str_decode_eight_bit_char:N #1 @@ -552,7 +549,7 @@ \tex_skip:D \l__str_internal_int = "#2 sp \scan_stop: \exp_args:NNf \tex_toks:D \l__str_internal_int { \__str_output_byte:n { "#1 } } - \tex_advance:D \l__str_internal_int \c_one + \int_incr:N \l__str_internal_int \__str_encode_eight_bit_load:nn } \cs_new:Npn \__str_encode_eight_bit_char:n #1 @@ -571,10 +568,10 @@ } \cs_new:Npn \__str_encode_eight_bit_char_aux:n #1 { - \if_int_compare:w #1 < \c_two_hundred_fifty_six - \__str_output_byte:n {#1} - \else: + \if_int_compare:w #1 > \c__str_max_byte_int \flag_raise:n { str_error } + \else: + \__str_output_byte:n {#1} \fi: } \__msg_kernel_new:nnn { str } { unknown-esc } @@ -590,9 +587,9 @@ } \__msg_kernel_new:nnn { str } { file-not-found } { File~'l3str-#1.def'~not~found. } -\bool_if:nT +\bool_lazy_any:nT { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88591.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88591.def index 526bd896aa7..4ec7d5c8d75 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88591.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88591.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88591 } { } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885910.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885910.def index 082fec6653a..6aed0dcb9ef 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885910.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885910.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885910 } { { A1 } { 0104 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885911.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885911.def index e51840885bf..f551a2ac4ad 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885911.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885911.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885911 } { { A1 } { 0E01 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885913.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885913.def index 83718b2a1b0..1c44066f1af 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885913.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885913.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885913 } { { A1 } { 201D } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885914.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885914.def index 90ddd22915c..75814fbb8ad 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885914.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885914.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885914 } { { A1 } { 1E02 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885915.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885915.def index c7980a0cf71..fb0bba2e5ad 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885915.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885915.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885915 } { { A4 } { 20AC } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885916.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885916.def index 1fc3dfa0ad0..89d59900f77 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885916.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso885916.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso885916 } { { A1 } { 0104 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88592.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88592.def index 655d5dfbb12..584fb3de28b 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88592.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88592.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88592 } { { A1 } { 0104 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88593.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88593.def index ffcca4890a7..3ec8d60de3f 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88593.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88593.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88593 } { { A1 } { 0126 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88594.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88594.def index 5a92daf3827..c2c3aaf7ed3 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88594.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88594.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88594 } { { A1 } { 0104 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88595.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88595.def index f43c25b1da1..9a22152f36e 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88595.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88595.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88595 } { { A1 } { 0401 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88596.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88596.def index bae2edd75f3..37d058df1ac 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88596.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88596.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88596 } { { AC } { 060C } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88597.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88597.def index 798746d98d7..101b2225c5c 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88597.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88597.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88597 } { { A1 } { 2018 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88598.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88598.def index 7478b313e58..8183ea85048 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88598.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88598.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88598 } { { AA } { 00D7 } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88599.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88599.def index 6cccd45605a..0f6bf25306e 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88599.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-iso88599.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \__str_declare_eight_bit_encoding:nnn { iso88599 } { { D0 } { 011E } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf16.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf16.def index 0ce28efe7c7..431b242f550 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf16.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf16.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \group_begin: \char_set_catcode_other:N \^^fe \char_set_catcode_other:N \^^ff @@ -144,7 +144,7 @@ \__str_decode_utf_xvi_pair_end:Nw #1 \fi: \if_case:w - \__int_eval:w ( \__str_tmp:w #1#2 - "D6 ) / \c_four \__int_eval_end: + \__int_eval:w ( \__str_tmp:w #1#2 - "D6 ) / 4 \__int_eval_end: \or: \exp_after:wN \__str_decode_utf_xvi_quad:NNwNN \or: \exp_after:wN \__str_decode_utf_xvi_extra:NNw \fi: @@ -161,10 +161,11 @@ \fi: \if_int_compare:w \if_int_compare:w \__str_tmp:w #4#5 < "DC \exp_stop_f: - \c_zero = \c_one + 0 = 1 \else: - \__str_tmp:w #4#5 < "E0 \exp_stop_f: + \__str_tmp:w #4#5 < "E0 \fi: + \exp_stop_f: #1 #2 #4 #5 \s__tl \int_eval:n { diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf32.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf32.def index f0fb7f2514d..6f466ba400d 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf32.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf32.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \group_begin: \char_set_catcode_other:N \^^00 \char_set_catcode_other:N \^^fe @@ -119,12 +119,12 @@ \exp_after:wN \__str_decode_utf_xxxii_end:w \fi: #1#2#3#4 \s__tl - \if_int_compare:w \__str_tmp:w #1#4 > \c_zero + \if_int_compare:w \__str_tmp:w #1#4 > 0 \exp_stop_f: \flag_raise:n { str_overflow } \flag_raise:n { str_error } \int_use:N \c__str_replacement_char_int \else: - \if_int_compare:w \__str_tmp:w #2#3 > \c_sixteen + \if_int_compare:w \__str_tmp:w #2#3 > 16 \exp_stop_f: \flag_raise:n { str_overflow } \flag_raise:n { str_error } \int_use:N \c__str_replacement_char_int diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf8.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf8.def index ae851882149..4518878b883 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf8.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-enc-utf8.def @@ -18,13 +18,13 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \cs_new_protected:cpn { __str_convert_encode_utf8: } { \__str_convert_gmap_internal:N \__str_encode_utf_viii_char:n } \cs_new:Npn \__str_encode_utf_viii_char:n #1 { - \__str_encode_utf_viii_loop:wwnnw #1 ; - \c_one + \c_zero * ; - { 128 } { \c_zero } + \__str_encode_utf_viii_loop:wwnnw #1 ; - 1 + 0 * ; + { 128 } { 0 } { 32 } { 192 } { 16 } { 224 } { 8 } { 240 } @@ -39,7 +39,7 @@ \exp_after:wN \__str_encode_utf_viii_loop:wwnnw \__int_value:w \int_div_truncate:nn {#1} {64} ; #1 ; #5 \q_stop - \__str_output_byte:n { #2 - 64 * ( #1 - \c_two ) } + \__str_output_byte:n { #2 - 64 * ( #1 - 2 ) } } \flag_clear_new:n { str_missing } \flag_clear_new:n { str_extra } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-hex.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-hex.def index 7e2ab8b8db9..3a5e52a5fdc 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-hex.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-hex.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \cs_new_protected:Npn \__str_convert_unescape_hex: { \group_begin: @@ -29,7 +29,7 @@ \__str_output_byte:w " \exp_last_unbraced:Nf \__str_unescape_hex_auxi:N { \tl_to_str:N \g__str_result_tl } - 0 { ? 0 - \c_one \__prg_break: } + 0 { ? 0 - 1 \__prg_break: } \__prg_break_point: \__str_output_end: } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-name.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-name.def index 23c77ecc650..b01837f7369 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-name.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-name.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \cs_set_protected:Npn \__str_tmp:w #1#2#3 { \cs_new_protected:cpn { __str_convert_unescape_#2: } @@ -48,7 +48,7 @@ { } { \flag_raise:n { str_error } - * \c_zero + `#1 \use_i:nn + * 0 + `#1 \use_i:nn } } { diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def index d40866bfb99..83982d00b9f 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-string.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \group_begin: \char_set_lccode:nn {`\*} {`\\} \char_set_catcode_other:N \^^J @@ -59,7 +59,7 @@ { \__str_octal_use:NTF #4 { - \if_int_compare:w #2 > \c_three + \if_int_compare:w #2 > 3 \exp_stop_f: - 256 \fi: \__str_unescape_string_repeat:NNNNNN @@ -79,11 +79,11 @@ { n } { 12 } { t } { 11 } { b } { 10 } - { ^^J } { 0 - \c_one } + { ^^J } { 0 - 1 } } { \flag_raise:n { str_error } - 0 - \c_one \use_i:nn + 0 - 1 \use_i:nn } } \__str_output_end: @@ -122,8 +122,8 @@ { \c_backslash_str \int_div_truncate:nn {`#1} {64} - \int_mod:nn { \int_div_truncate:nn {`#1} \c_eight } \c_eight - \int_mod:nn {`#1} \c_eight + \int_mod:nn { \int_div_truncate:nn {`#1} { 8 } } { 8 } + \int_mod:nn {`#1} { 8 } } } \prg_new_conditional:Npnn \__str_if_escape_string:N #1 { TF } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-url.def b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-url.def index 347d8cfeaf3..8176cf9106e 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-url.def +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-esc-url.def @@ -18,7 +18,7 @@ %% This file is part of the "l3experimental bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-2017 The LaTeX3 Project \cs_set_protected:Npn \__str_tmp:w #1#2#3 { \cs_new_protected:cpn { __str_convert_unescape_#2: } @@ -48,7 +48,7 @@ { } { \flag_raise:n { str_error } - * \c_zero + `#1 \use_i:nn + * 0 + `#1 \use_i:nn } } { diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty index 850ff9f61a0..53429eff945 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3str-format.sty @@ -20,7 +20,7 @@ %% %% File: l3str-format.dtx Copyright (C) 2012-2013,2015,2016 The LaTeX3 Project \RequirePackage{expl3} -\GetIdInfo$Id: l3str-format.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3str-format.dtx 6948 2017-02-18 14:50:25Z bruno $ {L3 Experimental string formatting} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -30,7 +30,7 @@ \cs_generate_variant:Nn \tl_to_str:n { f } \prg_new_conditional:Npnn \__str_format_if_digit:N #1 { TF } { - \if_int_compare:w \c_nine < 1 #1 \exp_stop_f: + \if_int_compare:w 9 < 1 #1 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } \cs_new:Npn \__str_format_put:nw #1 #2 \s__stop { #2 \s__stop #1 } @@ -129,9 +129,9 @@ { \prg_replicate:nn { - \int_max:nn \c_zero - { #3 - \__str_count:n { #2 #1 } - \c_one } - / \c_two + \int_max:nn { 0 } + { #3 - \__str_count:n { #2 #1 } - 1 } + / 2 } {#4} } @@ -139,9 +139,9 @@ { \prg_replicate:nn { - \int_max:nn \c_zero + \int_max:nn { 0 } { #3 - \__str_count:n { #2 #1 } } - / \c_two + / 2 } {#4} } @@ -249,7 +249,7 @@ \token_if_eq_charcode:NNTF #2 ? { \__str_format_put:nw { #1 > } } { \__str_format_put:nw { #1 #2 } } - \int_compare:nNnTF {#7} < \c_zero + \int_compare:nNnTF {#7} < 0 { \__str_format_put:nw { - } } { \str_case:nnF {#3} @@ -364,9 +364,9 @@ { \__str_format_put:fw { \int_eval:n { #3 - 1 } } \__str_format_put:nw { e } - \int_compare:nNnTF {#8} > \c_sixteen + \int_compare:nNnTF {#8} > \c__fp_prec_int { - \__str_format_put:fw { \prg_replicate:nn { #8 - \c_fifteen } {0} } + \__str_format_put:fw { \prg_replicate:nn { #8 - \c__fp_prec_int + 1 } {0} } \__str_format_put:fw { \use_none:n #4#5#6#7 } } { @@ -417,14 +417,20 @@ \cs_new:Npn \__str_format_fp_g_aux:wn #1; #2 { \int_compare:nNnTF { \__fp_exponent:w #1; } < { -3 } - { \fp_to_scientific:n } + { \__str_format_to_scientific:n } { \int_compare:nNnTF { \__fp_exponent:w #1; } > {#2} - { \fp_to_scientific:n } + { \__str_format_to_scientific:n } { \fp_to_decimal:n } } { \__fp_set_sign_o:w 0 #1; @ \prg_do_nothing: } } +\cs_new:Npn \__str_format_to_scientific:n + { + \exp_after:wN \__str_format_fp_trim:w + \exp:w \exp_end_continue_f:w \fp_to_scientific:n + } +\cs_new:Npn \__str_format_fp_trim:w #1 e { \__fp_trim_zeros:w #1 ; e } \__msg_kernel_new:nnn { str } { invalid-format } { Invalid~format~'#1'. } \__msg_kernel_new:nnn { str } { invalid-align-format } diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty index 04d811b352f..ca781f2c6e1 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-analysis.sty @@ -20,7 +20,7 @@ %% %% File: l3tl-analysis.dtx Copyright (C) 2011-2012,2015,2016 The LaTeX3 Project \RequirePackage{expl3} -\GetIdInfo$Id: l3tl-analysis.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3tl-analysis.dtx 6948 2017-02-18 14:50:25Z bruno $ {L3 Experimental token lists analysis} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -42,7 +42,7 @@ \cs_new:Npn \__tl_analysis_cs_space_count:NN #1 #2 { \exp_after:wN #1 - \__int_value:w \__int_eval:w \c_zero + \__int_value:w \__int_eval:w 0 \exp_after:wN \__tl_analysis_cs_space_count:w \token_to_str:N #2 \fi: \__tl_analysis_cs_space_count_end:w ; ~ ! @@ -50,7 +50,7 @@ \cs_new:Npn \__tl_analysis_cs_space_count:w #1 ~ { \if_false: #1 #1 \fi: - + \c_one + + 1 \__tl_analysis_cs_space_count:w } \cs_new:Npn \__tl_analysis_cs_space_count_end:w ; #1 \fi: #2 ! @@ -67,7 +67,7 @@ } \cs_new_protected:Npn \__tl_analysis_setup:n #1 { - \int_set:Nn \tex_escapechar:D { - \c_one } + \int_set:Nn \tex_escapechar:D { -1 } \exp_after:wN \__tl_analysis_disable_loop:N \tl_to_str:n {#1} { ~ } { ? ~ \__prg_break: } \__prg_break_point: @@ -76,7 +76,7 @@ \char_set_catcode_active:N \^^@ \cs_new_protected:Npn \__tl_analysis_disable_loop:N #1 { - \tex_lccode:D \c_zero `#1 ~ + \tex_lccode:D 0 = `#1 ~ \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D \__tl_analysis_disable_loop:N } @@ -96,18 +96,19 @@ { \l__tl_analysis_type_int = \if_meaning:w \l__tl_analysis_token \c_space_token - \c_zero + 0 \else: \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_begin_token - \c_one + 1 \else: \if_catcode:w \exp_not:N \l__tl_analysis_token \c_group_end_token - - \c_one + - 1 \else: - \c_two + 2 \fi: \fi: \fi: + \exp_stop_f: \if_case:w \l__tl_analysis_type_int \exp_after:wN \__tl_analysis_a_space:w \or: \exp_after:wN \__tl_analysis_a_bgroup:w @@ -144,9 +145,9 @@ \group_end: \cs_new_protected:Npn \__tl_analysis_a_group:nw #1 { - \tex_lccode:D \c_zero = \__tl_analysis_extract_charcode: \scan_stop: + \tex_lccode:D 0 = \__tl_analysis_extract_charcode: \scan_stop: \tex_lowercase:D { \tex_toks:D \l__tl_analysis_index_int {#1} } - \if_int_compare:w \tex_lccode:D \c_zero = \tex_escapechar:D + \if_int_compare:w \tex_lccode:D 0 = \tex_escapechar:D \int_set:Nn \tex_escapechar:D { 139 - \tex_escapechar:D } \fi: \tex_afterassignment:D \__tl_analysis_a_group_test:w @@ -166,14 +167,14 @@ \cs_new_protected:Npn \__tl_analysis_a_store: { \tex_advance:D \l__tl_analysis_nesting_int \l__tl_analysis_type_int - \if_int_compare:w \tex_lccode:D \c_zero = \c_thirty_two - \tex_multiply:D \l__tl_analysis_type_int \c_two + \if_int_compare:w \tex_lccode:D 0 = `\ \exp_stop_f: + \tex_multiply:D \l__tl_analysis_type_int 2 \exp_stop_f: \fi: \tex_skip:D \l__tl_analysis_index_int = \l__tl_analysis_normal_int sp plus \l__tl_analysis_type_int sp \scan_stop: \int_incr:N \l__tl_analysis_index_int \int_zero:N \l__tl_analysis_normal_int - \if_int_compare:w \l__tl_analysis_nesting_int = - \c_one + \if_int_compare:w \l__tl_analysis_nesting_int = -1 \exp_stop_f: \cs_set_eq:NN \__tl_analysis_a_loop:w \scan_stop: \fi: } @@ -191,9 +192,9 @@ } \cs_new_protected:Npn \__tl_analysis_a_cs:ww #1; #2; { - \if_int_compare:w #1 > \c_zero + \if_int_compare:w #1 > 0 \exp_stop_f: \tex_skip:D \l__tl_analysis_index_int - = \__int_eval:w \l__tl_analysis_normal_int + \c_one sp \scan_stop: + = \__int_eval:w \l__tl_analysis_normal_int + 1 sp \scan_stop: \tex_advance:D \l__tl_analysis_index_int #1 \exp_stop_f: \l__tl_analysis_normal_int #2 \exp_stop_f: \else: @@ -215,7 +216,7 @@ } \cs_new:Npn \__tl_analysis_b_normals:ww #1; { - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #1 = 0 \exp_stop_f: \__tl_analysis_b_special:w \fi: \__tl_analysis_b_normal:wwN #1; @@ -251,7 +252,7 @@ \exp_not:n { \fi: \fi: \fi: \fi: \fi: \fi: \fi: \fi: } \exp_not:N \__int_value:w `#1 \s__tl \exp_not:N \exp_after:wN \exp_not:N \__tl_analysis_b_normals:ww - \exp_not:N \__int_value:w \exp_not:N \__int_eval:w - \c_one + + \exp_not:N \__int_value:w \exp_not:N \__int_eval:w - 1 + } \cs_new:Npn \__tl_analysis_b_cs:Nww #1 { @@ -262,7 +263,7 @@ { \exp_after:wN \__tl_analysis_b_normals:ww \__int_value:w \__int_eval:w - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #1 = 0 \exp_stop_f: #3 \else: \tex_skip:D \__int_eval:w #4 + #1 \__int_eval_end: @@ -292,7 +293,7 @@ \else: \exp_after:wN \__tl_analysis_b_special_space:w \__int_value:w \fi: - \__int_eval:w \c_one + #1 \exp_after:wN ; + \__int_eval:w 1 + #1 \exp_after:wN ; \token_to_str:N } \group_end: @@ -360,10 +361,10 @@ { \use_none:n #2 \exp_not:n { \\ > \ \ } - \if_int_compare:w "#2 = \c_zero + \if_int_compare:w "#2 = 0 \exp_stop_f: \exp_after:wN \__tl_analysis_show_cs:n \else: - \if_int_compare:w "#2 = \c_thirteen + \if_int_compare:w "#2 = 13 \exp_stop_f: \exp_after:wN \exp_after:wN \exp_after:wN \__tl_analysis_show_active:n \else: @@ -391,7 +392,7 @@ \token_if_toks_register:NTF #1 \__prg_break: { } \use_none:nnn \__prg_break_point: - \use:n { = \tex_the:D #1 } + \use:n { \exp_after:wN = \tex_the:D #1 } } } \cs_new:Npn \__tl_analysis_show_cs:n #1 @@ -409,11 +410,11 @@ { \int_compare:nNnTF { \str_count:n { #1 ~ ( #4 #2 #3 ) } } - > { \l_iow_line_count_int - \c_three } + > { \l_iow_line_count_int - 3 } { - \str_range:nnn { #1 ~ ( #4 #2 #3 ) } \c_one + \str_range:nnn { #1 ~ ( #4 #2 #3 ) } { 1 } { - \l_iow_line_count_int - \c_three + \l_iow_line_count_int - 3 - \str_count:N \c__tl_analysis_show_etc_str } \c__tl_analysis_show_etc_str diff --git a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty index f70277c6b00..aae4b87553e 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/l3str/l3tl-build.sty @@ -19,8 +19,8 @@ %% and all files in that bundle must be distributed together. %% %% File: l3tl-build.dtx Copyright (C) 2011-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{l3tl-build}{Support package l3kernel too old} @@ -32,7 +32,7 @@ }% \endinput } -\GetIdInfo$Id: l3tl-build.dtx 6878 2017-02-10 07:40:59Z joseph $ +\GetIdInfo$Id: l3tl-build.dtx 6984 2017-03-07 20:53:23Z joseph $ {L3 Experimental token list construction} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -55,7 +55,7 @@ \fi: \tex_the:D \tex_toks:D #1 \exp_stop_f: \exp_after:wN \__tl_build_unpack_loop:w - \int_use:N \__int_eval:w #1 + \c_one ; + \int_use:N \__int_eval:w #1 + 1 ; } \cs_new_protected:Npn \__tl_build:Nw { \__tl_build_aux:NNw \tl_set:Nn } @@ -84,7 +84,7 @@ \cs_new_protected:Npn \__tl_build_one:n #1 { \tex_toks:D \l__tl_build_index_int {#1} - \tex_advance:D \l__tl_build_index_int \c_one + \int_incr:N \l__tl_build_index_int \if_int_compare:w \l__tl_build_index_int > \c_max_register_int \__tl_build_unpack: \l__tl_build_index_int \l__tl_build_start_index_int @@ -93,7 +93,7 @@ \cs_new_protected:Npn \__tl_build_one:o #1 { \tex_toks:D \l__tl_build_index_int \exp_after:wN {#1} - \tex_advance:D \l__tl_build_index_int \c_one + \int_incr:N \l__tl_build_index_int \if_int_compare:w \l__tl_build_index_int > \c_max_register_int \__tl_build_unpack: \l__tl_build_index_int \l__tl_build_start_index_int diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty index 31619c5f811..926e1dfb2ac 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/l3galley.sty @@ -19,9 +19,9 @@ %% and all files in that bundle must be distributed together. %% %% File: l3galley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach -%% (C) 2010-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +%% (C) 2010-2017 The LaTeX3 Project +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{l3galley}{Support package l3kernel too old} @@ -33,7 +33,7 @@ }% \endinput } -\GetIdInfo$Id: l3galley.dtx 6878 2017-02-10 07:40:59Z joseph $ +\GetIdInfo$Id: l3galley.dtx 6984 2017-03-07 20:53:23Z joseph $ {L3 Experimental galley code} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -85,6 +85,7 @@ \tl_new:N \l__galley_interpar_penalty_user_tl \tl_new:N \g__galley_interpar_vspace_user_tl \tl_new:N \l__galley_interpar_vspace_user_tl +\int_const:Nn \c__galley_max_penalty_int { 10000 } \int_new:N \l__galley_group_level_int \cs_new_protected:Npn \__galley_initialise_variables: { @@ -249,15 +250,13 @@ } \g_galley_par_reset_hook_tl \tl_gclear:N \g_galley_par_reset_hook_tl - \tex_penalty:D \c_ten_thousand + \tex_penalty:D \c__galley_max_penalty_int } \cs_new_protected:Npn \__galley_par_update_cutout: { - \bool_if:nF - { - \seq_if_empty_p:N \g__galley_cutout_left_seq - && \seq_if_empty_p:N \g__galley_cutout_right_seq - } + \bool_lazy_and:nnF + { \seq_if_empty_p:N \g__galley_cutout_left_seq } + { \seq_if_empty_p:N \g__galley_cutout_right_seq } { \prg_replicate:nn \tex_prevgraf:D { @@ -268,11 +267,9 @@ } \int_compare:nNnT \l__galley_group_level_int = \etex_currentgrouplevel:D { - \bool_if:nT - { - \seq_if_empty_p:N \g__galley_cutout_left_seq - && \seq_if_empty_p:N \g__galley_cutout_right_seq - } + \bool_lazy_and:nnT + { \seq_if_empty_p:N \g__galley_cutout_left_seq } + { \seq_if_empty_p:N \g__galley_cutout_right_seq } { \bool_gset_false:N \g__galley_cutout_active_bool } } } @@ -410,7 +407,7 @@ \tl_if_empty:NTF \g__galley_interpar_penalty_user_tl { \bool_if:NTF \g_galley_no_break_next_bool - { \tex_penalty:D \c_ten_thousand } + { \tex_penalty:D \c__galley_max_penalty_int } { \tex_penalty:D \l_galley_interpar_penalty_int } } { @@ -540,26 +537,22 @@ } \cs_new_protected:Npn \__galley_parshape_set_margins: { - \bool_if:nTF - { - \dim_compare_p:nNn \l_galley_total_left_margin_dim = \c_zero_dim - && \dim_compare_p:nNn \l_galley_total_right_margin_dim = \c_zero_dim - } - { \tex_parshape:D \c_zero } + \bool_lazy_and:nnTF + { \dim_compare_p:nNn \l_galley_total_left_margin_dim = \c_zero_dim } + { \dim_compare_p:nNn \l_galley_total_right_margin_dim = \c_zero_dim } + { \tex_parshape:D 0 \exp_stop_f: } { \tex_parshape:D - \c_one + 1 \exp_stop_f: \l_galley_total_left_margin_dim \l_galley_text_width_dim } } \cs_new_protected:Npn \__galley_parshape_set_indents: { - \bool_if:nF - { - \seq_if_empty_p:N \l__galley_parshape_left_indent_seq - && \seq_if_empty_p:N \l__galley_parshape_right_indent_seq - } + \bool_lazy_and:nnF + { \seq_if_empty_p:N \l__galley_parshape_left_indent_seq } + { \seq_if_empty_p:N \l__galley_parshape_right_indent_seq } { \__galley_parshape_set_indents:NN \l__galley_parshape_left_indent_seq @@ -584,11 +577,9 @@ } \cs_new_protected:Npn \__galley_parshape_set_cutouts: { - \bool_if:nF - { - \seq_if_empty_p:N \g__galley_cutout_left_seq - && \seq_if_empty_p:N \g__galley_cutout_right_seq - } + \bool_lazy_and:nnF + { \seq_if_empty_p:N \g__galley_cutout_left_seq } + { \seq_if_empty_p:N \g__galley_cutout_right_seq } { \__galley_parshape_set_cutouts:n { left } \__galley_parshape_set_cutouts:n { right } @@ -597,7 +588,7 @@ \seq_count:N \l__galley_cutout_left_indent_seq - \seq_count:N \l__galley_cutout_right_indent_seq } - \int_compare:nNnTF \l__galley_tmp_int > \c_zero + \int_compare:nNnTF \l__galley_tmp_int > 0 { \__galley_parshape_set_cutouts:N \l__galley_cutout_right_indent_seq } { \__galley_parshape_set_cutouts:N \l__galley_cutout_left_indent_seq } \__galley_parshape_set_indents:NN @@ -623,9 +614,9 @@ { \seq_count:N \g__galley_tmpa_seq - \seq_count:N \g__galley_tmpb_seq - + \c_one + + 1 } - \int_compare:nNnT \l__galley_tmp_int > \c_zero + \int_compare:nNnT \l__galley_tmp_int > 0 { \prg_replicate:nn { \l__galley_tmp_int } @@ -696,10 +687,10 @@ { \bool_if:NTF #1 { % TODO Hook for font changes required! - \dim_compare:nNnTF { \tex_fontdimen:D \c_three \tex_font:D } + \dim_compare:nNnTF { \tex_fontdimen:D 3 \tex_font:D } = \c_zero_dim { \tex_spaceskip:D \c_zero_dim } - { \tex_spaceskip:D \tex_fontdimen:D \c_two \tex_font:D } + { \tex_spaceskip:D \tex_fontdimen:D 2 \tex_font:D } } { \tex_spaceskip:D \c_zero_dim } } @@ -723,12 +714,12 @@ { \tex_unskip:D \bool_if:NF #1 - { \tex_vadjust:D { \tex_penalty:D \c_ten_thousand } } + { \tex_vadjust:D { \tex_penalty:D \c__galley_max_penalty_int } } \dim_compare:nNnF {#2} = \c_zero_dim { \tex_vadjust:D { \skip_vertical:n {#2} } } - \tex_penalty:D \c_ten_thousand + \tex_penalty:D \c__galley_max_penalty_int \tex_hfil:D - \tex_penalty:D -\c_ten_thousand + \tex_penalty:D - \c__galley_max_penalty_int } } \cs_new_eq:NN \l_galley_broken_penalty_int \tex_brokenpenalty:D @@ -742,17 +733,17 @@ \cs_new_protected:Npn \galley_display_widow_penalties_set:n #1 { \etex_displaywidowpenalties:D - \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: + \__int_eval:w \clist_count:n {#1} + 1 \__int_eval_end: \clist_map_function:nN {#1} \__galley_set_aux:n - \c_zero + 0 \exp_stop_f: } \cs_generate_variant:Nn \galley_display_widow_penalties_set:n { V , v } \cs_new_protected:Npn \galley_widow_penalties_set:n #1 { \etex_widowpenalties:D - \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: + \__int_eval:w \clist_count:n {#1} + 1 \__int_eval_end: \clist_map_function:nN {#1} \__galley_set_aux:n - \c_zero + 0 \exp_stop_f: } \cs_generate_variant:Nn \galley_widow_penalties_set:n { V , v } \cs_new:Npn \__galley_set_aux:n #1 { \int_eval:n {#1} ~ } @@ -771,17 +762,17 @@ \cs_new_protected:Npn \galley_display_club_penalties_set:n #1 { \etex_clubpenalties:D - \__int_eval:w \clist_count:n {#1} + \c_one \__int_eval_end: + \__int_eval:w \clist_count:n {#1} + 1 \__int_eval_end: \clist_map_function:nN {#1} \__galley_set_aux:n - \c_zero + 0 \exp_stop_f: \__galley_calc_interline_penalties: } \cs_generate_variant:Nn \galley_display_club_penalties_set:n { V , v } \cs_new_protected:Npn \galley_interline_penalty_set:n #1 { - \int_compare:nNnTF { \etex_interlinepenalties:D \c_zero } = \c_zero + \int_compare:nNnTF { \etex_interlinepenalties:D 0 } = 0 { - \etex_interlinepenalties:D \c_one \__int_eval:w #1 \__int_eval_end: + \etex_interlinepenalties:D 1 = \__int_eval:w #1 \__int_eval_end: \__galley_calc_interline_penalties: } { @@ -789,7 +780,7 @@ { \__int_eval:w \etex_interlinepenalties:D ##1 - - \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero + - \etex_interlinepenalties:D \etex_interlinepenalties:D 0 + #1 \__int_eval_end: } @@ -800,11 +791,11 @@ \cs_new_protected:Npn \__galley_set_interline_penalty:nn #1#2 { \etex_interlinepenalties:D - \etex_interlinepenalties:D \c_zero - \int_step_function:nnnN \c_one \c_one {#1} + \etex_interlinepenalties:D 0 \exp_stop_f: + \int_step_function:nnnN { 1 } { 1 } {#1} \__galley_set_interline_penalty_auxi:n - \int_step_function:nnnN { #1 + \c_one } \c_one - { \etex_interlinepenalties:D \c_zero - \c_one } + \int_step_function:nnnN { #1 + 1 } { 1 } + { \etex_interlinepenalties:D 0 - 1 } \__galley_set_interline_penalty_auxii:n \__int_eval:w #2 \__int_eval_end: } @@ -816,17 +807,11 @@ \exp_args:Nff \__galley_calc_interline_penalties:nn { \int_max:nn - { - \clist_count:N \l_galley_club_penalties_clist - + \c_one - } + { \clist_count:N \l_galley_club_penalties_clist + 1 } { \int_max:nn - { - \clist_count:N \l_galley_line_penalties_clist - + \c_one - } - { \etex_clubpenalties:D \c_zero } + { \clist_count:N \l_galley_line_penalties_clist + 1 } + { \etex_clubpenalties:D 0 } } } { \clist_count:N \l_galley_line_penalties_clist } @@ -834,11 +819,11 @@ \cs_new_protected:Npn \__galley_calc_interline_penalties:nn #1#2 { \etex_interlinepenalties:D #1 ~ - \int_step_function:nnnN \c_one \c_one {#2} + \int_step_function:nnnN { 1 } { 1 } {#2} \__galley_calc_interline_penalties_auxi:n - \int_step_function:nnnN { #2 + \c_one } \c_one { #1 - \c_one } + \int_step_function:nnnN { #2 + 1 } { 1 } { #1 - 1 } \__galley_calc_interline_penalties_auxii:n - \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero + \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f: } \cs_new:Npn \__galley_calc_interline_penalties_auxi:n #1 { @@ -851,7 +836,7 @@ \cs_new:Npn \__galley_calc_interline_penalties_auxii:n #1 { \__int_eval:w - \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero + \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f: + 0 \clist_item:Nn \l_galley_club_penalties_clist {#1} - \etex_clubpenalties:D #1 ~ \__int_eval_end: @@ -864,8 +849,8 @@ { \clist_set:Nx #1 { - \int_step_function:nnnN \c_one \c_one - { \etex_clubpenalties:D \c_zero - \c_one } + \int_step_function:nnnN { 1 } { 1 } + { \etex_clubpenalties:D 0 - 1 } \__galley_save_display_club_penalties:n } } @@ -875,8 +860,8 @@ { \clist_set:Nx #1 { - \int_step_function:nnnN \c_one \c_one - { \etex_displaywidowpenalties:D \c_zero - \c_one } + \int_step_function:nnnN { 1 } { 1 } + { \etex_displaywidowpenalties:D 0 - 1 } \__galley_save_display_widow_penalties:n } } @@ -889,22 +874,22 @@ { \clist_set:Nx #1 { - \int_step_function:nnnN \c_one \c_one - { \etex_widowpenalties:D \c_zero - \c_one } + \int_step_function:nnnN { 1 } { 1 } + { \etex_widowpenalties:D 0 - 1 } \__galley_save_widow_penalties:n } } \cs_new:Npn \__galley_save_widow_penalties:n #1 { \__int_value:w \etex_widowpenalties:D \__int_eval:w #1 \__int_eval_end: , } \cs_new_protected:Npn \galley_interline_penalty: - { \__int_value:w \etex_interlinepenalties:D \etex_interlinepenalties:D \c_zero } + { \__int_value:w \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f: } \__msg_kernel_new:nnn { galley } { no-line-to-end } { There's~no~line~here~to~end. } \cs_set:Npn \clearpage { \mode_if_vertical:T { - \int_compare:nNnT \@dbltopnum = { - \c_one } + \int_compare:nNnT \@dbltopnum = { -1 } { \dim_compare:nNnT \tex_pagetotal:D < \topskip { \tex_hbox:D { } } @@ -961,7 +946,7 @@ \leavevmode \setbox \@tempboxa = \hbox { {#1} } \galley_parshape_set_single:nnnN - \c_one + { 1 } { \box_wd:N \@tempboxa } \c_zero_dim \c_false_bool diff --git a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty index 598f757ad4f..44c68a9d000 100644 --- a/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty +++ b/Master/texmf-dist/tex/latex/l3experimental/xgalley/xgalley.sty @@ -19,9 +19,9 @@ %% and all files in that bundle must be distributed together. %% %% File: xgalley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach -%% (C) 2010-2012,2014,2106 The LaTeX3 Project +%% (C) 2010-2012,2014,2016-2017 The LaTeX3 Project \RequirePackage{xparse} -\GetIdInfo$Id: xgalley.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: xgalley.dtx 6963 2017-02-20 02:29:02Z bruno $ {L3 Experimental galley} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -118,14 +118,14 @@ \bool_if:NTF \l__galley_parshape_on_left_bool { \galley_parshape_set_single:nVVN - \c_zero + { 0 } \l__galley_tmpa_clist \l__galley_tmpb_clist \c_true_bool } { \galley_parshape_set_single:nVVN - \c_zero + { 0 } \l__galley_tmpb_clist \l__galley_tmpa_clist \c_true_bool @@ -217,7 +217,7 @@ \tl_clear:N \l__galley_justification_other_tl \galley_interword_spacing_set:N \l_galley_fixed_spacing_bool \bool_if:NTF \l_galley_par_stretch_last_bool - { \int_set_eq:NN \l_galley_last_line_fit_int \c_one_thousand } + { \int_set:Nn \l_galley_last_line_fit_int { 1000 } } { \int_zero:N \l_galley_last_line_fit_int } \skip_set:Nn \@rightskip { \l_galley_line_right_skip } } @@ -259,7 +259,7 @@ \AssignTemplateKeys \galley_interword_spacing_set:N \l_galley_fixed_spacing_bool \bool_if:NTF \l_galley_par_stretch_last_bool - { \int_set_eq:NN \l_galley_last_line_fit_int \c_one_thousand } + { \int_set:Nn \l_galley_last_line_fit_int { 1000 } } { \int_zero:N \l_galley_last_line_fit_int } \skip_set:Nn \@rightskip { \l_galley_line_right_skip } } diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex index 6518b52bdbe..72b29f13e11 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-code.tex @@ -13,6 +13,7 @@ %% l3str.dtx (with options: `package') %% l3seq.dtx (with options: `package') %% l3int.dtx (with options: `package') +%% l3flag.dtx (with options: `package') %% l3quark.dtx (with options: `package') %% l3prg.dtx (with options: `package') %% l3clist.dtx (with options: `package') @@ -40,6 +41,7 @@ %% l3coffins.dtx (with options: `package') %% l3color.dtx (with options: `package') %% l3sys.dtx (with options: `package') +%% l3deprecation.dtx (with options: `package') %% l3candidates.dtx (with options: `package') %% l3luatex.dtx (with options: `package,tex') %% @@ -58,8 +60,8 @@ %% File: expl3.dtx Copyright (C) 1990-2017 The LaTeX3 Project \def\ExplFileName{expl3}% \def\ExplFileDescription{L3 programming layer}% -\def\ExplFileDate{2017/02/10}% -\def\ExplFileVersion{6878}% +\def\ExplFileDate{2017/03/07}% +\def\ExplFileVersion{6984}% \begingroup \def\next{\endgroup}% \expandafter\ifx\csname PackageError\endcsname\relax @@ -362,8 +364,8 @@ \tex_endlinechar:D = 32 \scan_stop: \bool_set_true:N \l__kernel_expl_bool } -%% File: l3names.dtx Copyright (C) 1990-2016 The LaTeX3 project -\GetIdInfo$Id: l3names.dtx 6805 2016-12-28 22:15:52Z joseph $ +%% File: l3names.dtx Copyright (C) 1990-2017 The LaTeX3 project +\GetIdInfo$Id: l3names.dtx 6962 2017-02-19 22:58:35Z joseph $ {L3 Namespace for primitives} \let \tex_global:D \global \let \tex_let:D \let @@ -978,11 +980,12 @@ \__kernel_primitive:NN \luatexversion \luatex_luatexversion:D \__kernel_primitive:NN \mathdisplayskipmode \luatex_mathdisplayskipmode:D \__kernel_primitive:NN \matheqnogapstep \luatex_matheqnogapstep:D - \__kernel_primitive:NN \mathoption \luatex_mathoption:D \__kernel_primitive:NN \mathnolimitsmode \luatex_mathnolimitsmode:D + \__kernel_primitive:NN \mathoption \luatex_mathoption:D \__kernel_primitive:NN \mathrulesfam \luatex_mathrulesfam:D \__kernel_primitive:NN \mathscriptsmode \luatex_mathscriptsmode:D \__kernel_primitive:NN \mathstyle \luatex_mathstyle:D + \__kernel_primitive:NN \mathsurroundmode \luatex_mathsurroundmode:D \__kernel_primitive:NN \mathsurroundskip \luatex_mathsurroundskip:D \__kernel_primitive:NN \nohrule \luatex_nohrule:D \__kernel_primitive:NN \nokerns \luatex_nokerns:D @@ -990,13 +993,16 @@ \__kernel_primitive:NN \nospaces \luatex_nospaces:D \__kernel_primitive:NN \novrule \luatex_novrule:D \__kernel_primitive:NN \outputbox \luatex_outputbox:D + \__kernel_primitive:NN \pagebottomoffset \luatex_pagebottomoffset:D \__kernel_primitive:NN \pageleftoffset \luatex_pageleftoffset:D + \__kernel_primitive:NN \pagerightoffset \luatex_pagerightoffset:D \__kernel_primitive:NN \pagetopoffset \luatex_pagetopoffset:D \__kernel_primitive:NN \pdfextension \luatex_pdfextension:D \__kernel_primitive:NN \pdffeedback \luatex_pdffeedback:D \__kernel_primitive:NN \pdfvariable \luatex_pdfvariable:D \__kernel_primitive:NN \postexhyphenchar \luatex_postexhyphenchar:D \__kernel_primitive:NN \posthyphenchar \luatex_posthyphenchar:D + \__kernel_primitive:NN \predisplaygapfactor \luatex_predisplaygapfactor:D \__kernel_primitive:NN \preexhyphenchar \luatex_preexhyphenchar:D \__kernel_primitive:NN \prehyphenchar \luatex_prehyphenchar:D \__kernel_primitive:NN \savecatcodetable \luatex_savecatcodetable:D @@ -1014,15 +1020,13 @@ \__kernel_primitive:NN \bodydir \luatex_bodydir:D \__kernel_primitive:NN \boxdir \luatex_boxdir:D \__kernel_primitive:NN \leftghost \luatex_leftghost:D + \__kernel_primitive:NN \linedir \luatex_linedir:D \__kernel_primitive:NN \localbrokenpenalty \luatex_localbrokenpenalty:D \__kernel_primitive:NN \localinterlinepenalty \luatex_localinterlinepenalty:D \__kernel_primitive:NN \localleftbox \luatex_localleftbox:D \__kernel_primitive:NN \localrightbox \luatex_localrightbox:D \__kernel_primitive:NN \mathdir \luatex_mathdir:D - \__kernel_primitive:NN \linedir \luatex_linedir:D - \__kernel_primitive:NN \pagebottomoffset \luatex_pagebottomoffset:D \__kernel_primitive:NN \pagedir \luatex_pagedir:D - \__kernel_primitive:NN \pagerightoffset \luatex_pagerightoffset:D \__kernel_primitive:NN \pardir \luatex_pardir:D \__kernel_primitive:NN \rightghost \luatex_rightghost:D \__kernel_primitive:NN \textdir \luatex_textdir:D @@ -1363,8 +1367,8 @@ \tex_let:D \tex_middle:D \normalmiddle \tex_let:D \tex_right:D \normalright \tex_fi:D -%% File: l3basics.dtx Copyright (C) 1990-2016 The LaTeX3 project -\GetIdInfo$Id: l3basics.dtx 6805 2016-12-28 22:15:52Z joseph $ +%% File: l3basics.dtx Copyright (C) 1990-2017 The LaTeX3 project +\GetIdInfo$Id: l3basics.dtx 6929 2017-02-14 15:53:00Z bruno $ {L3 Basic definitions} \tex_let:D \if_true: \tex_iftrue:D \tex_let:D \if_false: \tex_iffalse:D @@ -2082,16 +2086,30 @@ \cs_new:Npn \cs_if_eq:ccT { \exp_args:Ncc \cs_if_eq:NNT } \cs_new:Npn \cs_if_eq:ccF { \exp_args:Ncc \cs_if_eq:NNF } \cs_new_protected:Npn \__kernel_register_show:N #1 + { \exp_args:No \__kernel_register_show_aux:nN { \tex_the:D #1 } #1 } +\cs_new_protected:Npn \__kernel_register_show_aux:nN #1#2 { - \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } - { > ~ \token_to_str:N #1 = \tex_the:D #1 } + \__msg_show_variable:NNNnn #2 \cs_if_exist:NTF ? { } + { > ~ \token_to_str:N #2 = #1 } } \cs_new_protected:Npn \__kernel_register_show:c { \exp_args:Nc \__kernel_register_show:N } +\cs_new_protected:Npn \__kernel_register_log:N + { \__msg_log_next: \__kernel_register_show:N } +\cs_new_protected:Npn \__kernel_register_log:c + { \exp_args:Nc \__kernel_register_log:N } \cs_new_protected:Npn \cs_show:N #1 - { \__msg_show_wrap:n { > ~ \token_to_str:N #1 = \cs_meaning:N #1 } } + { + \group_begin: + \int_set:Nn \tex_escapechar:D { `\\ } + \exp_args:NNx + \group_end: + \__msg_show_wrap:n { > ~ \token_to_str:N #1 = \cs_meaning:N #1 } + } \cs_new_protected:Npn \cs_show:c { \group_begin: \exp_args:NNc \group_end: \cs_show:N } +\cs_new_protected:Npn \cs_log:N { \__msg_log_next: \cs_show:N } +\cs_new_protected:Npn \cs_log:c { \__msg_log_next: \cs_show:c } \cs_new_nopar:Npn \prg_do_nothing: { } \cs_new_eq:NN \__prg_break_point:Nn \use_ii:nn \cs_new:Npn \__prg_map_break:Nn #1#2#3 \__prg_break_point:Nn #4#5 @@ -2106,7 +2124,7 @@ \cs_new:Npn \__prg_break: #1 \__prg_break_point: { } \cs_new:Npn \__prg_break:n #1#2 \__prg_break_point: {#1} %% File: l3expan.dtx Copyright (C) 1990-2016 The LaTeX3 project -\GetIdInfo$Id: l3expan.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3expan.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Argument expansion} \cs_new:Npn \__exp_arg_next:nnn #1#2#3 { #2 \::: { #3 {#1} } } \cs_new:Npn \__exp_arg_next:Nnn #1#2#3 { #2 \::: { #3 #1 } } @@ -2554,8 +2572,8 @@ \exp_after:wN \exp_not:N \cs:w :: #1 \cs_end: \__cs_generate_internal_variant_loop:n } -%% File: l3tl.dtx Copyright (C) 1990-2016 The LaTeX3 Project -\GetIdInfo$Id: l3tl.dtx 6842 2017-02-06 21:51:22Z joseph $ +%% File: l3tl.dtx Copyright (C) 1990-2017 The LaTeX3 Project +\GetIdInfo$Id: l3tl.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Token lists} \cs_new_protected:Npn \tl_new:N #1 { @@ -2746,7 +2764,7 @@ \group_begin: \exp_args:No \etex_everyeof:D { \c__tl_rescan_marker_tl \exp_not:N } \int_compare:nNnT \tex_endlinechar:D = { 32 } - { \tex_endlinechar:D - \c_one } + { \int_set:Nn \tex_endlinechar:D { -1 } } \tex_newlinechar:D \tex_endlinechar:D #3 \scan_stop: \exp_args:No \__tl_set_rescan:n { \tl_to_str:n {#4} } @@ -2775,7 +2793,7 @@ \tex_catcode:D `\^^@ = 12 \scan_stop: \cs_new_protected:Npn \__tl_set_rescan:n #1 { - \int_compare:nNnTF \tex_newlinechar:D < \c_zero + \int_compare:nNnTF \tex_newlinechar:D < 0 { \use_ii:nn } { \char_set_lccode:nn { 0 } { \tex_newlinechar:D } @@ -2790,7 +2808,7 @@ \cs_new_protected:Npn \__tl_set_rescan_single:nn #1 { \int_compare:nNnTF - { \char_value_catcode:n { `#1 } / \c_three } = \c_four + { \char_value_catcode:n { `#1 } / 3 } = 4 { \__tl_set_rescan_single_aux:nn {#1} } { \int_compare:nNnTF { `#1 } < { `\~ } @@ -2803,7 +2821,7 @@ } \cs_new_protected:Npn \__tl_set_rescan_single_aux:nn #1#2 { - \tex_endlinechar:D - \c_one + \int_set:Nn \tex_endlinechar:D { -1 } \use:x { \exp_not:N \use:n @@ -2823,7 +2841,7 @@ \char_value_catcode:n { \exp_last_unbraced:Nf ` \str_head:n {#2} ~ } } - = \c_ten { ~ } + = { 10 } { ~ } \exp_after:wN \__tl_rescan:w \exp_after:wN \prg_do_nothing: \etex_scantokens:D { #2 #1 } @@ -3117,7 +3135,7 @@ \int_eval:n { 0 \tl_map_function:NN #1 \__tl_count:n } } -\cs_new:Npn \__tl_count:n #1 { + \c_one } +\cs_new:Npn \__tl_count:n #1 { + 1 } \cs_generate_variant:Nn \tl_count:n { V , o } \cs_generate_variant:Nn \tl_count:N { c } \cs_new:Npn \tl_reverse_items:n #1 @@ -3410,14 +3428,14 @@ } \cs_new:Npn \__tl_item_aux:nn #1#2 { - \int_compare:nNnTF {#1} < \c_zero - { \int_eval:n { \tl_count:n {#2} + \c_one + #1 } } + \int_compare:nNnTF {#1} < 0 + { \int_eval:n { \tl_count:n {#2} + 1 + #1 } } {#1} } \cs_new:Npn \__tl_item:nn #1#2 { \__quark_if_recursion_tail_break:nN {#2} \__prg_break: - \int_compare:nNnTF {#1} = \c_one + \int_compare:nNnTF {#1} = 1 { \__prg_break:n { \exp_not:n {#2} } } { \exp_args:Nf \__tl_item:nn { \int_eval:n { #1 - 1 } } } } @@ -3431,16 +3449,35 @@ \cs_generate_variant:Nn \tl_show:N { c } \cs_new_protected:Npn \tl_show:n #1 { \__msg_show_wrap:n { > ~ \tl_to_str:n {#1} } } +\cs_new_protected:Npn \tl_log:N + { \__msg_log_next: \tl_show:N } +\cs_generate_variant:Nn \tl_log:N { c } +\cs_new_protected:Npn \tl_log:n + { \__msg_log_next: \tl_show:n } \tl_new:N \g_tmpa_tl \tl_new:N \g_tmpb_tl \tl_new:N \l_tmpa_tl \tl_new:N \l_tmpb_tl \cs_new_protected:Npn \tl_to_lowercase:n #1 - { \tex_lowercase:D {#1} } + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2017-12-31 } + { \token_to_str:N \tl_to_lowercase:n } + { } + \cs_gset_eq:NN \tl_to_lowercase:n \tex_lowercase:D + \tex_lowercase:D {#1} + } \cs_new_protected:Npn \tl_to_uppercase:n #1 - { \tex_uppercase:D {#1} } -%% File: l3str.dtx Copyright (C) 2011-2016 The LaTeX3 Project -\GetIdInfo$Id: l3str.dtx 6809 2017-01-01 06:33:13Z bruno $ + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2017-12-31 } + { \token_to_str:N \tl_to_uppercase:n } + { } + \cs_gset_eq:NN \tl_to_uppercase:n \tex_uppercase:D + \tex_uppercase:D {#1} + } +%% File: l3str.dtx Copyright (C) 2011-2017 The LaTeX3 Project +\GetIdInfo$Id: l3str.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Strings} \group_begin: \cs_set_protected:Npn \__str_tmp:n #1 @@ -3514,7 +3551,7 @@ } \cs_new:Npn \__str_if_eq_x_return:nn #1 #2 { - \if_int_compare:w \__str_if_eq_x:nn {#1} {#2} = \c_zero + \if_int_compare:w \__str_if_eq_x:nn {#1} {#2} = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: @@ -3524,7 +3561,7 @@ { \if_int_compare:w \__str_if_eq_x:nn { \exp_not:n {#1} } { \exp_not:n {#2} } - = \c_zero + = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } \cs_generate_variant:Nn \str_if_eq_p:nn { V , o } @@ -3537,13 +3574,13 @@ \cs_generate_variant:Nn \str_if_eq:nnTF { nV , no , VV } \prg_new_conditional:Npnn \str_if_eq_x:nn #1#2 { p , T , F , TF } { - \if_int_compare:w \__str_if_eq_x:nn {#1} {#2} = \c_zero + \if_int_compare:w \__str_if_eq_x:nn {#1} {#2} = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } \prg_new_conditional:Npnn \str_if_eq:NN #1#2 { p , TF , T , F } { \if_int_compare:w \__str_if_eq_x:nn { \tl_to_str:N #1 } { \tl_to_str:N #2 } - = \c_zero \prg_return_true: \else: \prg_return_false: \fi: + = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } \cs_generate_variant:Nn \str_if_eq:NNT { c , Nc , cc } \cs_generate_variant:Nn \str_if_eq:NNF { c , Nc , cc } @@ -3633,6 +3670,28 @@ \cs_new:Npn \__str_to_other_end:w \fi: #1 \q_mark #2 * A #3 \q_stop { \fi: #2 } } +\cs_new:Npn \__str_to_other_fast:n #1 + { + \exp_after:wN \__str_to_other_fast_loop:w \tl_to_str:n {#1} ~ + A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ A ~ \q_stop + } +\group_begin: +\tex_lccode:D `\* = `\ % +\tex_lccode:D `\A = `\A +\tex_lowercase:D + { + \group_end: + \cs_new:Npn \__str_to_other_fast_loop:w + #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 ~ #7 ~ #8 ~ #9 ~ + { + \if_meaning:w A #9 + \__str_to_other_fast_end:w + \fi: + #1 * #2 * #3 * #4 * #5 * #6 * #7 * #8 * #9 + \__str_to_other_fast_loop:w * + } + \cs_new:Npn \__str_to_other_fast_end:w #1 * A #2 \q_stop {#1} + } \cs_new:Npn \str_item:Nn { \exp_args:No \str_item:nn } \cs_generate_variant:Nn \str_item:Nn { c } \cs_new:Npn \str_item:nn #1#2 @@ -3654,7 +3713,7 @@ } \cs_new:Npn \__str_item:w #1; #2; { - \int_compare:nNnTF {#1} < \c_zero + \int_compare:nNnTF {#1} < 0 { \int_compare:nNnTF {#1} < {-#2} { \use_none_delimit_by_q_stop:w } @@ -3675,7 +3734,7 @@ } \cs_new:Npn \__str_skip_exp_end:w #1; { - \if_int_compare:w #1 > \c_eight + \if_int_compare:w #1 > 8 \exp_stop_f: \exp_after:wN \__str_skip_loop:wNNNNNNNN \else: \exp_after:wN \__str_skip_end:w @@ -3684,7 +3743,7 @@ #1 ; } \cs_new:Npn \__str_skip_loop:wNNNNNNNN #1; #2#3#4#5#6#7#8#9 - { \exp_after:wN \__str_skip_exp_end:w \__int_value:w \__int_eval:w #1 - \c_eight ; } + { \exp_after:wN \__str_skip_exp_end:w \__int_value:w \__int_eval:w #1 - 8 ; } \cs_new:Npn \__str_skip_end:w #1 ; { \exp_after:wN \__str_skip_end:NNNNNNNN @@ -3707,7 +3766,7 @@ { \exp_after:wN \__str_range:w \__int_value:w \__str_count:n {#1} \exp_after:wN ; - \__int_value:w \__int_eval:w #2 - \c_one \exp_after:wN ; + \__int_value:w \__int_eval:w #2 - 1 \exp_after:wN ; \__int_value:w \__int_eval:w #3 ; #1 \q_stop } @@ -3727,11 +3786,11 @@ { \int_eval:n { - \if_int_compare:w #1 < \c_zero + \if_int_compare:w #1 < 0 \exp_stop_f: \if_int_compare:w #1 < -#2 \exp_stop_f: - \c_zero + 0 \else: - #1 + #2 + \c_one + #1 + #2 + 1 \fi: \else: \if_int_compare:w #1 < #2 \exp_stop_f: @@ -3746,7 +3805,7 @@ { \__str_collect_loop:wn #1 ; { } } \cs_new:Npn \__str_collect_loop:wn #1 ; { - \if_int_compare:w #1 > \c_seven + \if_int_compare:w #1 > 7 \exp_stop_f: \exp_after:wN \__str_collect_loop:wnNNNNNNN \else: \exp_after:wN \__str_collect_end:wn @@ -3756,13 +3815,13 @@ \cs_new:Npn \__str_collect_loop:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9 { \exp_after:wN \__str_collect_loop:wn - \__int_value:w \__int_eval:w #1 - \c_seven ; + \__int_value:w \__int_eval:w #1 - 7 ; { #2 #3#4#5#6#7#8#9 } } \cs_new:Npn \__str_collect_end:wn #1 ; { \exp_after:wN \__str_collect_end:nnnnnnnnw - \if_case:w \if_int_compare:w #1 > \c_zero #1 \else: 0 \fi: \exp_stop_f: + \if_case:w \if_int_compare:w #1 > 0 \exp_stop_f: #1 \else: 0 \fi: \exp_stop_f: \or: \or: \or: \or: \or: \or: \fi: } \cs_new:Npn \__str_collect_end:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \q_stop @@ -3785,7 +3844,7 @@ \if_meaning:w X #9 \use_i_delimit_by_q_stop:nw \fi: - \c_nine + \__str_count_spaces_loop:w + 9 + \__str_count_spaces_loop:w } \cs_new:Npn \str_count:N { \exp_args:No \str_count:n } \cs_generate_variant:Nn \str_count:N { c } @@ -3812,9 +3871,9 @@ \int_eval:n { #1 - { X \c_eight } { X \c_seven } { X \c_six } - { X \c_five } { X \c_four } { X \c_three } - { X \c_two } { X \c_one } { X \c_zero } + { X 8 } { X 7 } { X 6 } + { X 5 } { X 4 } { X 3 } + { X 2 } { X 1 } { X 0 } \q_stop } } @@ -3823,7 +3882,7 @@ \if_meaning:w X #9 \exp_after:wN \use_none_delimit_by_q_stop:w \fi: - \c_nine + \__str_count_loop:NNNNNNNNN + 9 + \__str_count_loop:NNNNNNNNN } \cs_new:Npn \str_head:N { \exp_args:No \str_head:n } \cs_generate_variant:Nn \str_head:N { c } @@ -3983,7 +4042,7 @@ \__unicode_parse_auxi:w #1#2 \q_stop \else: \if_int_compare:w \__str_if_eq_x:nn - { \exp_not:n {#2} } { ~Conditional~Mappings~ } = \c_zero + { \exp_not:n {#2} } { ~Conditional~Mappings~ } = 0 \exp_stop_f: \cs_set_protected:Npn \__unicode_parse:w ##1 \q_stop { } \fi: \fi: @@ -4006,7 +4065,7 @@ { \tl_if_blank:nF {#7} { - \if_int_compare:w \__str_if_eq_x:nn { #5 ~ } {#7} = \c_zero + \if_int_compare:w \__str_if_eq_x:nn { #5 ~ } {#7} = 0 \exp_stop_f: \else: \tl_const:cx { c__unicode_title_ \utex_char:D "#1 _tl } @@ -4017,7 +4076,7 @@ \__unicode_map_inline:n { UnicodeData.txt } \cs_set_protected:Npn \__unicode_parse_auxi:w #1 ;~ #2 ;~ #3 ; #4 \q_stop { - \if_int_compare:w \__str_if_eq_x:nn {#2} { C } = \c_zero + \if_int_compare:w \__str_if_eq_x:nn {#2} { C } = 0 \exp_stop_f: \if_int_compare:w \tex_lccode:D "#1 = "#3 \scan_stop: \else: \tl_const:cx @@ -4025,7 +4084,7 @@ { \utex_char:D "#3 ~ } \fi: \else: - \if_int_compare:w \__str_if_eq_x:nn {#2} { F } = \c_zero + \if_int_compare:w \__str_if_eq_x:nn {#2} { F } = 0 \exp_stop_f: \__unicode_parse_auxii:w #1 ~ #3 ~ \q_stop \fi: \fi: @@ -4037,7 +4096,7 @@ { \use:n { \__unicode_parse_auxii:w #1 ~ lower ~ #2 ~ } ~ \q_stop \use:n { \__unicode_parse_auxii:w #1 ~ upper ~ #4 ~ } ~ \q_stop - \if_int_compare:w \__str_if_eq_x:nn {#3} {#4} = \c_zero + \if_int_compare:w \__str_if_eq_x:nn {#3} {#4} = 0 \exp_stop_f: \else: \use:n { \__unicode_parse_auxii:w #1 ~ title ~ #3 ~ } ~ \q_stop \fi: @@ -4066,7 +4125,7 @@ } \group_end: %% File: l3seq.dtx Copyright (C) 1990-2017 The LaTeX3 Project -\GetIdInfo$Id: l3seq.dtx 6842 2017-02-06 21:51:22Z joseph $ +\GetIdInfo$Id: l3seq.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Sequences and stacks} \cs_new:Npn \__seq_item:n { @@ -4431,14 +4490,14 @@ } \cs_new:Npn \__seq_item:nN #1#2 { - \int_compare:nNnTF {#1} < \c_zero - { \int_eval:n { \seq_count:N #2 + \c_one + #1 } } + \int_compare:nNnTF {#1} < 0 + { \int_eval:n { \seq_count:N #2 + 1 + #1 } } {#1} } \cs_new:Npn \__seq_item:nnn #1#2#3 { \use_none:n #2 - \int_compare:nNnTF {#1} = \c_one + \int_compare:nNnTF {#1} = 1 { \__prg_break:n { \exp_not:n {#3} } } { \exp_args:Nf \__seq_item:nnn { \int_eval:n { #1 - 1 } } } } @@ -4512,7 +4571,7 @@ \seq_map_function:NN #1 \__seq_count:n } } -\cs_new:Npn \__seq_count:n #1 { + \c_one } +\cs_new:Npn \__seq_count:n #1 { + 1 } \cs_generate_variant:Nn \seq_count:N { c } \cs_new:Npn \seq_use:Nnnn #1#2#3#4 { @@ -4590,12 +4649,15 @@ { \seq_map_function:NN #1 \__msg_show_item:n } } \cs_generate_variant:Nn \seq_show:N { c } +\cs_new_protected:Npn \seq_log:N + { \__msg_log_next: \seq_show:N } +\cs_generate_variant:Nn \seq_log:N { c } \seq_new:N \l_tmpa_seq \seq_new:N \l_tmpb_seq \seq_new:N \g_tmpa_seq \seq_new:N \g_tmpb_seq -%% File: l3int.dtx Copyright (C) 1990-2016 The LaTeX3 Project -\GetIdInfo$Id: l3int.dtx 6805 2016-12-28 22:15:52Z joseph $ +%% File: l3int.dtx Copyright (C) 1990-2017 The LaTeX3 Project +\GetIdInfo$Id: l3int.dtx 6949 2017-02-18 16:04:10Z joseph $ {L3 Integers} \cs_new_eq:NN \__int_value:w \tex_number:D \cs_new_eq:NN \__int_eval:w \etex_numexpr:D @@ -4647,12 +4709,12 @@ \cs_new:Npn \__int_div_truncate:NwNw #1#2; #3#4; { \if_meaning:w 0 #1 - \c_zero + 0 \else: ( #1#2 \if_meaning:w - #1 + \else: - \fi: - ( \if_meaning:w - #3 - \fi: #3#4 - \c_one ) / \c_two + ( \if_meaning:w - #3 - \fi: #3#4 - 1 ) / 2 ) \fi: / #3#4 @@ -5082,13 +5144,13 @@ { \exp_args:Nf \__int_to_Base:nn { \int_eval:n {#1} } } \cs_new:Npn \__int_to_base:nn #1#2 { - \int_compare:nNnTF {#1} < \c_zero + \int_compare:nNnTF {#1} < 0 { \exp_args:No \__int_to_base:nnN { \use_none:n #1 } {#2} - } { \__int_to_base:nnN {#1} {#2} \c_empty_tl } } \cs_new:Npn \__int_to_Base:nn #1#2 { - \int_compare:nNnTF {#1} < \c_zero + \int_compare:nNnTF {#1} < 0 { \exp_args:No \__int_to_Base:nnN { \use_none:n #1 } {#2} - } { \__int_to_Base:nnN {#1} {#2} \c_empty_tl } } @@ -5135,7 +5197,7 @@ \cs_new:Npn \__int_to_letter:n #1 { \exp_after:wN \exp_after:wN - \if_case:w \__int_eval:w #1 - \c_ten \__int_eval_end: + \if_case:w \__int_eval:w #1 - 10 \__int_eval_end: a \or: b \or: c @@ -5168,7 +5230,7 @@ \cs_new:Npn \__int_to_Letter:n #1 { \exp_after:wN \exp_after:wN - \if_case:w \__int_eval:w #1 - \c_ten \__int_eval_end: + \if_case:w \__int_eval:w #1 - 10 \__int_eval_end: A \or: B \or: C @@ -5292,11 +5354,11 @@ { `#1 - \int_compare:nNnTF { `#1 } < { 91 } { 55 } { 87 } } } \cs_new:Npn \int_from_bin:n #1 - { \int_from_base:nn {#1} \c_two } + { \int_from_base:nn {#1} { 2 } } \cs_new:Npn \int_from_hex:n #1 - { \int_from_base:nn {#1} \c_sixteen } + { \int_from_base:nn {#1} { 16 } } \cs_new:Npn \int_from_oct:n #1 - { \int_from_base:nn {#1} \c_eight } + { \int_from_base:nn {#1} { 8 } } \int_const:cn { c__int_from_roman_i_int } { 1 } \int_const:cn { c__int_from_roman_v_int } { 5 } \int_const:cn { c__int_from_roman_x_int } { 10 } @@ -5316,7 +5378,7 @@ \int_eval:n { ( - \c_zero + 0 \exp_after:wN \__int_from_roman:NN \tl_to_str:n {#1} \q_recursion_tail \q_recursion_tail \q_recursion_stop ) @@ -5346,19 +5408,15 @@ } } \cs_new:Npn \__int_from_roman_error:w #1 \q_recursion_stop #2 - { #2 * \c_zero - \c_one } -\cs_new_protected:Npn \int_show:N #1 - { - \use:x - { - \exp_not:n - { \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } } - { > ~ \token_to_str:N #1 = \tex_the:D #1 } - } - } + { #2 * 0 - 1 } +\cs_new_eq:NN \int_show:N \__kernel_register_show:N \cs_generate_variant:Nn \int_show:N { c } \cs_new_protected:Npn \int_show:n { \__msg_show_wrap:Nn \int_eval:n } +\cs_new_eq:NN \int_log:N \__kernel_register_log:N +\cs_generate_variant:Nn \int_log:N { c } +\cs_new_protected:Npn \int_log:n + { \__msg_log_next: \int_show:n } \int_const:Nn \c_one { 1 } \int_const:Nn \c_two { 2 } \int_const:Nn \c_three { 3 } @@ -5375,7 +5433,6 @@ \int_const:Nn \c_fourteen { 14 } \int_const:Nn \c_fifteen { 15 } \int_const:Nn \c_sixteen { 16 } -\cs_new_eq:NN \c_minus_one \m@ne \int_const:Nn \c_thirty_two { 32 } \int_const:Nn \c_two_hundred_fifty_five { 255 } \int_const:Nn \c_two_hundred_fifty_six { 256 } @@ -5397,8 +5454,96 @@ \int_new:N \l_tmpb_int \int_new:N \g_tmpa_int \int_new:N \g_tmpb_int +\cs_new_eq:NN \c_minus_one \m@ne +%% File: l3flag.dtx Copyright (C) 2011-2012,2014-2017 The LaTeX3 Project +\GetIdInfo$Id: l3flag.dtx 6969 2017-02-20 18:32:23Z bruno $ + {L3 Flags} +\cs_new_protected:Npn \flag_new:n #1 + { + \cs_new:cpn { flag~#1 } ##1 ; + { \exp_after:wN \use_none:n \cs:w flag~#1~##1 \cs_end: } + } +\cs_new_protected:Npn \flag_clear:n { \__flag_clear:wn 0 ; } +\cs_new_protected:Npn \__flag_clear:wn #1 ; #2 + { + \if_cs_exist:w flag~#2~#1 \cs_end: + \cs_set_eq:cN { flag~#2~#1 } \tex_undefined:D + \exp_after:wN \__flag_clear:wn + \__int_value:w \__int_eval:w 1 + #1 + \else: + \use_i:nnn + \fi: + ; {#2} + } +\cs_new_protected:Npn \flag_clear_new:n #1 + { \flag_if_exist:nTF {#1} { \flag_clear:n } { \flag_new:n } {#1} } +\cs_new_protected:Npn \flag_show:n #1 + { + \exp_args:Nc \__msg_show_variable:NNNnn { flag~#1 } \cs_if_exist:NTF ? { } + { > ~ flag ~ #1 ~ height = \flag_height:n {#1} } + } +\cs_new_protected:Npn \flag_log:n + { \__msg_log_next: \flag_show:n } +\prg_new_conditional:Npnn \flag_if_exist:n #1 { p , T , F , TF } + { + \cs_if_exist:cTF { flag~#1 } + { \prg_return_true: } { \prg_return_false: } + } +\prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } + { + \if_cs_exist:w flag~#1~0 \cs_end: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_new:Npn \flag_height:n { \__flag_height_loop:wn 0; } +\cs_new:Npn \__flag_height_loop:wn #1 ; #2 + { + \if_cs_exist:w flag~#2~#1 \cs_end: + \exp_after:wN \__flag_height_loop:wn \__int_value:w \__int_eval:w 1 + + \else: + \exp_after:wN \__flag_height_end:wn + \fi: + #1 ; {#2} + } +\cs_new:Npn \__flag_height_end:wn #1 ; #2 {#1} +\cs_new:Npn \flag_raise:n #1 + { + \cs:w flag~#1 \exp_after:wN \cs_end: + \__int_value:w \flag_height:n {#1} ; + } +\tex_ifodd:D \l@expl@check@declarations@bool + \cs_set_protected:Npn \flag_clear:n #1 + { + \exp_args:Nc \__chk_if_exist_var:N { flag~#1 } + \__flag_clear:wn 0 ; {#1} + } + \cs_set:Npn \__flag_chk_exist:n #1 + { + \flag_if_exist:nF {#1} + { + \__msg_kernel_expandable_error:nnn + { kernel } { bad-variable } { flag~#1~ } + } + } + \cs_set:Npn \flag_height:n #1 + { + \__flag_chk_exist:n {#1} + \__flag_height_loop:wn 0; {#1} + } + \prg_set_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } + { + \__flag_chk_exist:n {#1} + \if_cs_exist:w flag~#1~0 \cs_end: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\fi: %% File: l3quark.dtx Copyright (C) 1990-2016 The LaTeX3 Project -\GetIdInfo$Id: l3quark.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3quark.dtx 6947 2017-02-17 21:27:18Z bruno $ {L3 Quarks} \cs_new_protected:Npn \quark_new:N #1 { \tl_const:Nn #1 {#1} } \quark_new:N \q_nil @@ -5452,7 +5597,7 @@ {#2} { } } -\prg_new_conditional:Nnn \quark_if_nil:N { p, T , F , TF } +\prg_new_conditional:Npnn \quark_if_nil:N #1 { p, T , F , TF } { \if_meaning:w \q_nil #1 \prg_return_true: @@ -5460,7 +5605,7 @@ \prg_return_false: \fi: } -\prg_new_conditional:Nnn \quark_if_no_value:N { p, T , F , TF } +\prg_new_conditional:Npnn \quark_if_no_value:N #1 { p, T , F , TF } { \if_meaning:w \q_no_value #1 \prg_return_true: @@ -5472,13 +5617,13 @@ \cs_generate_variant:Nn \quark_if_no_value:NT { c } \cs_generate_variant:Nn \quark_if_no_value:NF { c } \cs_generate_variant:Nn \quark_if_no_value:NTF { c } -\prg_new_conditional:Nnn \quark_if_nil:n { p, T , F , TF } +\prg_new_conditional:Npnn \quark_if_nil:n #1 { p, T , F , TF } { \__tl_if_empty_return:o { \__quark_if_nil:w {} #1 {} ? ! \q_nil ? ? ! } } \cs_new:Npn \__quark_if_nil:w #1 \q_nil #2 ? #3 ? ! { #1 #2 } -\prg_new_conditional:Nnn \quark_if_no_value:n { p, T , F , TF } +\prg_new_conditional:Npnn \quark_if_no_value:n #1 { p, T , F , TF } { \__tl_if_empty_return:o { \__quark_if_no_value:w {} #1 {} ? ! \q_no_value ? ? ! } @@ -5507,7 +5652,7 @@ \cs_new:Npn \__use_none_delimit_by_s__stop:w #1 \s__stop { } \__scan_new:N \s__seq %% File: l3prg.dtx Copyright (C) 2005-2017 The LaTeX3 Project -\GetIdInfo$Id: l3prg.dtx 6811 2017-01-01 08:50:54Z joseph $ +\GetIdInfo$Id: l3prg.dtx 6906 2017-02-12 20:07:58Z bruno $ {L3 Control structures} \cs_new_eq:NN \if_bool:N \tex_ifodd:D \cs_new_eq:NN \if_predicate:w \tex_ifodd:D @@ -5603,6 +5748,11 @@ \cs_new:Npn \__bool_to_str:n #1 { \bool_if:nTF {#1} { true } { false } } \cs_generate_variant:Nn \bool_show:N { c } +\cs_new_protected:Npn \bool_log:N + { \__msg_log_next: \bool_show:N } +\cs_new_protected:Npn \bool_log:n + { \__msg_log_next: \bool_show:n } +\cs_generate_variant:Nn \bool_log:N { c } \bool_new:N \l_tmpa_bool \bool_new:N \l_tmpb_bool \bool_new:N \g_tmpa_bool @@ -5802,7 +5952,7 @@ %% File: l3clist.dtx Copyright (C) 2004-2011 Frank Mittelbach, %% The LaTeX3 project %% (C) 2012-2017 The LaTeX3 Project -\GetIdInfo$Id: l3clist.dtx 6842 2017-02-06 21:51:22Z joseph $ +\GetIdInfo$Id: l3clist.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Comma separated lists} \cs_new_eq:NN \c_empty_clist \c_empty_tl \tl_new:N \l__clist_internal_clist @@ -6222,11 +6372,11 @@ #1 \exp_not:n { , \q_recursion_tail , \q_recursion_stop } } } -\cs_new:Npn \__clist_count:n #1 { + \c_one } +\cs_new:Npn \__clist_count:n #1 { + 1 } \cs_new:Npx \__clist_count:w #1 , { \exp_not:n { \exp_args:Nf \quark_if_recursion_tail_stop:n } {#1} - \exp_not:N \tl_if_blank:nF {#1} { + \c_one } + \exp_not:N \tl_if_blank:nF {#1} { + 1 } \exp_not:N \__clist_count:w \c_space_tl } \cs_new:Npn \clist_use:Nnnn #1#2#3#4 @@ -6272,11 +6422,11 @@ } \cs_new:Npn \__clist_item:nnnN #1#2#3#4 { - \int_compare:nNnTF {#2} < \c_zero + \int_compare:nNnTF {#2} < 0 { \int_compare:nNnTF {#2} < { - #1 } { \use_none_delimit_by_q_stop:w } - { \exp_args:Nf #4 { \int_eval:n { #2 + \c_one + #1 } } } + { \exp_args:Nf #4 { \int_eval:n { #2 + 1 + #1 } } } } { \int_compare:nNnTF {#2} > {#1} @@ -6288,7 +6438,7 @@ \cs_generate_variant:Nn \__clist_item:nnnN { ffo, ff } \cs_new:Npn \__clist_item_N_loop:nw #1 #2, { - \int_compare:nNnTF {#1} = \c_zero + \int_compare:nNnTF {#1} = 0 { \use_i_delimit_by_q_stop:nw { \exp_not:n {#2} } } { \exp_args:Nf \__clist_item_N_loop:nw { \int_eval:n { #1 - 1 } } } } @@ -6308,7 +6458,7 @@ \exp_args:No \tl_if_blank:nTF {#2} { \__clist_item_n_loop:nw {#1} \prg_do_nothing: } { - \int_compare:nNnTF {#1} = \c_zero + \int_compare:nNnTF {#1} = 0 { \exp_args:No \__clist_item_n_end:n {#2} } { \exp_args:Nf \__clist_item_n_loop:nw @@ -6337,12 +6487,17 @@ { \clist_map_function:nN {#1} \__msg_show_item:n } } \cs_generate_variant:Nn \clist_show:N { c } +\cs_new_protected:Npn \clist_log:N + { \__msg_log_next: \clist_show:N } +\cs_new_protected:Npn \clist_log:n + { \__msg_log_next: \clist_show:n } +\cs_generate_variant:Nn \clist_log:N { c } \clist_new:N \l_tmpa_clist \clist_new:N \l_tmpb_clist \clist_new:N \g_tmpa_clist \clist_new:N \g_tmpb_clist %% File: l3token.dtx Copyright (C) 2005-2016 The LaTeX3 Project -\GetIdInfo$Id: l3token.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3token.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Experimental token manipulation} \cs_new_protected:Npn \char_set_catcode:nn #1#2 { @@ -6354,69 +6509,69 @@ \cs_new_protected:Npn \char_show_value_catcode:n #1 { \__msg_show_wrap:n { > ~ \char_value_catcode:n {#1} } } \cs_new_protected:Npn \char_set_catcode_escape:N #1 - { \char_set_catcode:nn { `#1 } \c_zero } + { \char_set_catcode:nn { `#1 } { 0 } } \cs_new_protected:Npn \char_set_catcode_group_begin:N #1 - { \char_set_catcode:nn { `#1 } \c_one } + { \char_set_catcode:nn { `#1 } { 1 } } \cs_new_protected:Npn \char_set_catcode_group_end:N #1 - { \char_set_catcode:nn { `#1 } \c_two } + { \char_set_catcode:nn { `#1 } { 2 } } \cs_new_protected:Npn \char_set_catcode_math_toggle:N #1 - { \char_set_catcode:nn { `#1 } \c_three } + { \char_set_catcode:nn { `#1 } { 3 } } \cs_new_protected:Npn \char_set_catcode_alignment:N #1 - { \char_set_catcode:nn { `#1 } \c_four } + { \char_set_catcode:nn { `#1 } { 4 } } \cs_new_protected:Npn \char_set_catcode_end_line:N #1 - { \char_set_catcode:nn { `#1 } \c_five } + { \char_set_catcode:nn { `#1 } { 5 } } \cs_new_protected:Npn \char_set_catcode_parameter:N #1 - { \char_set_catcode:nn { `#1 } \c_six } + { \char_set_catcode:nn { `#1 } { 6 } } \cs_new_protected:Npn \char_set_catcode_math_superscript:N #1 - { \char_set_catcode:nn { `#1 } \c_seven } + { \char_set_catcode:nn { `#1 } { 7 } } \cs_new_protected:Npn \char_set_catcode_math_subscript:N #1 - { \char_set_catcode:nn { `#1 } \c_eight } + { \char_set_catcode:nn { `#1 } { 8 } } \cs_new_protected:Npn \char_set_catcode_ignore:N #1 - { \char_set_catcode:nn { `#1 } \c_nine } + { \char_set_catcode:nn { `#1 } { 9 } } \cs_new_protected:Npn \char_set_catcode_space:N #1 - { \char_set_catcode:nn { `#1 } \c_ten } + { \char_set_catcode:nn { `#1 } { 10 } } \cs_new_protected:Npn \char_set_catcode_letter:N #1 - { \char_set_catcode:nn { `#1 } \c_eleven } + { \char_set_catcode:nn { `#1 } { 11 } } \cs_new_protected:Npn \char_set_catcode_other:N #1 - { \char_set_catcode:nn { `#1 } \c_twelve } + { \char_set_catcode:nn { `#1 } { 12 } } \cs_new_protected:Npn \char_set_catcode_active:N #1 - { \char_set_catcode:nn { `#1 } \c_thirteen } + { \char_set_catcode:nn { `#1 } { 13 } } \cs_new_protected:Npn \char_set_catcode_comment:N #1 - { \char_set_catcode:nn { `#1 } \c_fourteen } + { \char_set_catcode:nn { `#1 } { 14 } } \cs_new_protected:Npn \char_set_catcode_invalid:N #1 - { \char_set_catcode:nn { `#1 } \c_fifteen } + { \char_set_catcode:nn { `#1 } { 15 } } \cs_new_protected:Npn \char_set_catcode_escape:n #1 - { \char_set_catcode:nn {#1} \c_zero } + { \char_set_catcode:nn {#1} { 0 } } \cs_new_protected:Npn \char_set_catcode_group_begin:n #1 - { \char_set_catcode:nn {#1} \c_one } + { \char_set_catcode:nn {#1} { 1 } } \cs_new_protected:Npn \char_set_catcode_group_end:n #1 - { \char_set_catcode:nn {#1} \c_two } + { \char_set_catcode:nn {#1} { 2 } } \cs_new_protected:Npn \char_set_catcode_math_toggle:n #1 - { \char_set_catcode:nn {#1} \c_three } + { \char_set_catcode:nn {#1} { 3 } } \cs_new_protected:Npn \char_set_catcode_alignment:n #1 - { \char_set_catcode:nn {#1} \c_four } + { \char_set_catcode:nn {#1} { 4 } } \cs_new_protected:Npn \char_set_catcode_end_line:n #1 - { \char_set_catcode:nn {#1} \c_five } + { \char_set_catcode:nn {#1} { 5 } } \cs_new_protected:Npn \char_set_catcode_parameter:n #1 - { \char_set_catcode:nn {#1} \c_six } + { \char_set_catcode:nn {#1} { 6 } } \cs_new_protected:Npn \char_set_catcode_math_superscript:n #1 - { \char_set_catcode:nn {#1} \c_seven } + { \char_set_catcode:nn {#1} { 7 } } \cs_new_protected:Npn \char_set_catcode_math_subscript:n #1 - { \char_set_catcode:nn {#1} \c_eight } + { \char_set_catcode:nn {#1} { 8 } } \cs_new_protected:Npn \char_set_catcode_ignore:n #1 - { \char_set_catcode:nn {#1} \c_nine } + { \char_set_catcode:nn {#1} { 9 } } \cs_new_protected:Npn \char_set_catcode_space:n #1 - { \char_set_catcode:nn {#1} \c_ten } + { \char_set_catcode:nn {#1} { 10 } } \cs_new_protected:Npn \char_set_catcode_letter:n #1 - { \char_set_catcode:nn {#1} \c_eleven } + { \char_set_catcode:nn {#1} { 11 } } \cs_new_protected:Npn \char_set_catcode_other:n #1 - { \char_set_catcode:nn {#1} \c_twelve } + { \char_set_catcode:nn {#1} { 12 } } \cs_new_protected:Npn \char_set_catcode_active:n #1 - { \char_set_catcode:nn {#1} \c_thirteen } + { \char_set_catcode:nn {#1} { 13 } } \cs_new_protected:Npn \char_set_catcode_comment:n #1 - { \char_set_catcode:nn {#1} \c_fourteen } + { \char_set_catcode:nn {#1} { 14 } } \cs_new_protected:Npn \char_set_catcode_invalid:n #1 - { \char_set_catcode:nn {#1} \c_fifteen } + { \char_set_catcode:nn {#1} { 15 } } \cs_new_protected:Npn \char_set_mathcode:nn #1#2 { \tex_mathcode:D \__int_eval:w #1 \__int_eval_end: @@ -6494,26 +6649,26 @@ } \cs_new:Npn \__char_generate_aux:w #1 ; #2 ; { - \if_int_compare:w #2 = \c_thirteen + \if_int_compare:w #2 = 13 \exp_stop_f: \__msg_kernel_expandable_error:nn { kernel } { char-active } \else: - \if_int_compare:w #2 = \c_ten - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #2 = 10 \exp_stop_f: + \if_int_compare:w #1 = 0 \exp_stop_f: \__msg_kernel_expandable_error:nn { kernel } { char-null-space } \else: \__msg_kernel_expandable_error:nn { kernel } { char-space } \fi: \else: \if_int_odd:w 0 - \if_int_compare:w #2 < \c_one 1 \fi: - \if_int_compare:w #2 = \c_five 1 \fi: - \if_int_compare:w #2 = \c_nine 1 \fi: - \if_int_compare:w #2 > \c_thirteen 1 \fi: \exp_stop_f: + \if_int_compare:w #2 < 1 \exp_stop_f: 1 \fi: + \if_int_compare:w #2 = 5 \exp_stop_f: 1 \fi: + \if_int_compare:w #2 = 9 \exp_stop_f: 1 \fi: + \if_int_compare:w #2 > 13 \exp_stop_f: 1 \fi: \exp_stop_f: \__msg_kernel_expandable_error:nn { kernel } { char-invalid-catcode } \else: \if_int_odd:w 0 - \if_int_compare:w #1 < \c_zero 1 \fi: + \if_int_compare:w #1 < 0 \exp_stop_f: 1 \fi: \if_int_compare:w #1 > \c__char_max_int 1 \fi: \exp_stop_f: \__msg_kernel_expandable_error:nn { kernel } { char-out-of-range } @@ -6724,7 +6879,7 @@ ##1 \tl_to_str:n { ma } ##2 \c_colon_str ##3 \exp_not:N \q_stop } { - \if_int_compare:w \__str_if_eq_x:nn { #2 } { cro } = \c_zero + \if_int_compare:w \__str_if_eq_x:nn { #2 } { cro } = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: @@ -7077,8 +7232,8 @@ } { \scan_stop: } } -%% File: l3prop.dtx Copyright (C) 1990-2016 The LaTeX3 Project -\GetIdInfo$Id: l3prop.dtx 6805 2016-12-28 22:15:52Z joseph $ +%% File: l3prop.dtx Copyright (C) 1990-2017 The LaTeX3 Project +\GetIdInfo$Id: l3prop.dtx 6906 2017-02-12 20:07:58Z bruno $ {L3 Property lists} \__scan_new:N \s__prop \cs_new:Npn \__prop_pair:wn #1 \s__prop #2 @@ -7349,10 +7504,14 @@ { \prop_map_function:NN #1 \__msg_show_item:nn } } \cs_generate_variant:Nn \prop_show:N { c } +\cs_new_protected:Npn \prop_log:N + { \__msg_log_next: \prop_show:N } +\cs_generate_variant:Nn \prop_log:N { c } %% File: l3msg.dtx Copyright (C) 2009-2016 The LaTeX3 Project -\GetIdInfo$Id: l3msg.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3msg.dtx 6966 2017-02-20 03:39:43Z bruno $ {L3 Messages} \tl_new:N \l__msg_internal_tl +\bool_new:N \l__msg_line_context_bool \tl_const:Nn \c__msg_text_prefix_tl { msg~text~>~ } \tl_const:Nn \c__msg_more_text_prefix_tl { msg~extra~text~>~ } \prg_new_conditional:Npnn \msg_if_exist:nn #1#2 { p , T , F , TF } @@ -7489,7 +7648,7 @@ } \__iow_with:Nnn \tex_newlinechar:D { `\^^J } { - \__iow_with:Nnn \tex_errorcontextlines:D { - \c_one } + \__iow_with:Nnn \tex_errorcontextlines:D { -1 } { \group_begin: \cs_set_protected:Npn & @@ -7520,11 +7679,31 @@ \iow_wrap:nnnN { * ~ #1} { * ~ } { } \iow_term:n \iow_term:n { ************************************************* } } -\cs_new:Npn \msg_fatal_text:n #1 { Fatal~#1~error } -\cs_new:Npn \msg_critical_text:n #1 { Critical~#1~error } -\cs_new:Npn \msg_error_text:n #1 { #1~error } -\cs_new:Npn \msg_warning_text:n #1 { #1~warning } -\cs_new:Npn \msg_info_text:n #1 { #1~info } +\cs_new:Npn \msg_fatal_text:n #1 + { + Fatal~#1~error + \bool_if:NT \l__msg_line_context_bool { ~ \msg_line_context: } + } +\cs_new:Npn \msg_critical_text:n #1 + { + Critical~#1~error + \bool_if:NT \l__msg_line_context_bool { ~ \msg_line_context: } + } +\cs_new:Npn \msg_error_text:n #1 + { + #1~error + \bool_if:NT \l__msg_line_context_bool { ~ \msg_line_context: } + } +\cs_new:Npn \msg_warning_text:n #1 + { + #1~warning + \bool_if:NT \l__msg_line_context_bool { ~ \msg_line_context: } + } +\cs_new:Npn \msg_info_text:n #1 + { + #1~info + \bool_if:NT \l__msg_line_context_bool { ~ \msg_line_context: } + } \cs_new:Npn \msg_see_documentation_text:n #1 { \\ \\ See~the~ @@ -7754,13 +7933,13 @@ \prop_put:cnn { l__msg_redirect_ #2 _prop } {#3} {#2} \__msg_kernel_warning:nnxxxx { kernel } { message-redirect-loop } - { \seq_item:Nn \l__msg_class_loop_seq { \c_one } } - { \seq_item:Nn \l__msg_class_loop_seq { \c_two } } + { \seq_item:Nn \l__msg_class_loop_seq { 1 } } + { \seq_item:Nn \l__msg_class_loop_seq { 2 } } {#3} { \seq_map_function:NN \l__msg_class_loop_seq \__msg_redirect_loop_list:n - { \seq_item:Nn \l__msg_class_loop_seq { \c_one } } + { \seq_item:Nn \l__msg_class_loop_seq { 1 } } } } { \__msg_redirect_loop_chk:onn \l__msg_class_tl {#2} {#3} } @@ -7891,6 +8070,11 @@ LaTeX~has~been~asked~to~use~a~control~sequence~'#1':\\ this~has~not~been~defined~yet. } +\__msg_kernel_new:nnn { kernel } { deprecated-command } + { + The~deprecated~command~'#2'~has~been~or~will~be~removed~on~#1. + \tl_if_empty:nF {#3} { ~Use~instead~'#3'. } + } \__msg_kernel_new:nnnn { kernel } { empty-search-pattern } { Empty~search~pattern. } { @@ -8111,7 +8295,13 @@ } } \cs_new_protected:Npn \__msg_show_wrap:Nn #1#2 - { \exp_args:Nx \__msg_show_wrap:n { > ~ \tl_to_str:n {#2} = #1 {#2} } } + { + \exp_args:Nx \__msg_show_wrap:n + { + > ~ \exp_not:n { \tl_to_str:n {#2} } = + \exp_not:N \tl_to_str:n { #1 {#2} } + } + } \cs_new_protected:Npn \__msg_show_wrap:n #1 { \iow_wrap:nnnN { #1 . } { } { } \__msg_show_wrap_aux:n } \cs_new_protected:Npn \__msg_show_wrap_aux:n #1 @@ -8127,7 +8317,7 @@ { \__iow_with:Nnn \tex_newlinechar:D { 10 } { - \__iow_with:Nnn \tex_errorcontextlines:D { - \c_one } + \__iow_with:Nnn \tex_errorcontextlines:D { -1 } { \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN { \exp_after:wN \l__msg_internal_tl } @@ -8150,8 +8340,8 @@ \\ > \ \ \tl_to_str:n {#1} \ \ => \ \ \tl_to_str:n {#2} } -%% File: l3file.dtx Copyright (C) 1990-2016 The LaTeX3 Project -\GetIdInfo$Id: l3file.dtx 6805 2016-12-28 22:15:52Z joseph $ +%% File: l3file.dtx Copyright (C) 1990-2017 The LaTeX3 Project +\GetIdInfo$Id: l3file.dtx 6964 2017-02-20 02:59:41Z bruno $ {L3 File and I/O operations} \tl_new:N \g_file_current_name_tl \cs_if_exist:NT \@currname @@ -8181,9 +8371,9 @@ 0 \tl_map_function:NN \l__file_internal_name_tl \__file_name_sanitize_aux:n } - \c_two + { 2 } } - = \c_zero + = 0 { \tl_remove_all:Nn \l__file_internal_name_tl { " } \tl_if_in:NnT \l__file_internal_name_tl { ~ } @@ -8204,10 +8394,7 @@ } } \cs_new:Npn \__file_name_sanitize_aux:n #1 - { - \token_if_eq_charcode:NNT #1 " - { + \c_one } - } + { \token_if_eq_charcode:NNT #1 " { + 1 } } \cs_new_protected:Npn \file_add_path:nN #1 { \__file_name_sanitize:nn {#1} { \__file_add_path:nN } } \cs_new_protected:Npn \__file_add_path:nN #1#2 @@ -8317,19 +8504,19 @@ \clist_map_inline:Nn \@filelist { \seq_gput_right:No \g__file_record_seq { \tl_to_str:n {#1} } } } -\cs_new_eq:NN \c_term_ior \c_sixteen +\int_const:Nn \c_term_ior { 16 } \seq_new:N \g__ior_streams_seq \tl_new:N \l__ior_stream_tl \prop_new:N \g__ior_streams_prop \int_step_inline:nnnn - { \c_zero } - { \c_one } + { 0 } + { 1 } { \cs_if_exist:NTF \normalend { \tex_count:D 38 \scan_stop: } { \tex_count:D 16 \scan_stop: - \cs_if_exist:NT \loccount { - \c_one } + \cs_if_exist:NT \loccount { - 1 } } } { @@ -8384,7 +8571,7 @@ } \cs_new_protected:Npn \ior_close:N #1 { - \int_compare:nT { - \c_one < #1 < \c_sixteen } + \int_compare:nT { -1 < #1 < \c_term_ior } { \tex_closein:D #1 \prop_gremove:NV \g__ior_streams_prop #1 @@ -8404,19 +8591,19 @@ { \prop_map_function:NN #1 \__msg_show_item_unbraced:nn } } \cs_new_eq:NN \if_eof:w \tex_ifeof:D -\prg_new_conditional:Nnn \ior_if_eof:N { p , T , F , TF } +\prg_new_conditional:Npnn \ior_if_eof:N #1 { p , T , F , TF } { \cs_if_exist:NTF #1 { - \if_int_compare:w #1 = \c_sixteen - \prg_return_true: - \else: - \if_eof:w #1 - \prg_return_true: - \else: - \prg_return_false: - \fi: - \fi: + \int_compare:nTF { -1 < #1 < \c_term_ior } + { + \if_eof:w #1 + \prg_return_true: + \else: + \prg_return_false: + \fi: + } + { \prg_return_true: } } { \prg_return_true: } } @@ -8426,26 +8613,35 @@ { \use:x { - \int_set:Nn \tex_endlinechar:D { - \c_one } + \int_set:Nn \tex_endlinechar:D { -1 } \exp_not:n { \etex_readline:D #1 to #2 } \int_set:Nn \tex_endlinechar:D { \int_use:N \tex_endlinechar:D } } } \ior_new:N \g__file_internal_ior -\cs_new_eq:NN \c_log_iow \c_minus_one -\int_const:Nn \c_term_iow { 128 } +\int_const:Nn \c_log_iow { -1 } +\int_const:Nn \c_term_iow + { + \cs_if_exist:NTF \luatex_directlua:D + { + \int_compare:nNnTF \luatex_luatexversion:D > { 80 } + { 128 } + { 16 } + } + { 16 } + } \seq_new:N \g__iow_streams_seq \tl_new:N \l__iow_stream_tl \prop_new:N \g__iow_streams_prop \int_step_inline:nnnn - { \c_zero } - { \c_one } + { 0 } + { 1 } { \cs_if_exist:NTF \normalend { \tex_count:D 39 \scan_stop: } { \tex_count:D 17 \scan_stop: - \cs_if_exist:NT \loccount { - \c_one } + \cs_if_exist:NT \loccount { - 1 } } } { @@ -8478,7 +8674,7 @@ } \cs_new_protected:Npn \iow_close:N #1 { - \int_compare:nT { - \c_one < #1 < \c_sixteen } + \int_compare:nT { - \c_log_iow < #1 < \c_term_iow } { \tex_immediate:D \tex_closeout:D #1 \prop_gremove:NV \g__iow_streams_prop #1 @@ -8521,21 +8717,31 @@ \cs_new_protected:Npn \iow_term:n { \iow_now:Nn \c_term_iow } \cs_new:Npn \iow_newline: { ^^J } \cs_new_eq:NN \iow_char:N \cs_to_str:N +\tl_const:Nx \c_catcode_other_space_tl { \char_generate:nn { `\ } { 12 } } \int_new:N \l_iow_line_count_int \int_set:Nn \l_iow_line_count_int { 78 } -\int_new:N \l__iow_target_count_int -\int_new:N \l__iow_current_line_int -\int_new:N \l__iow_current_word_int -\int_new:N \l__iow_current_indentation_int -\tl_new:N \l__iow_current_line_tl -\tl_new:N \l__iow_current_word_tl -\tl_new:N \l__iow_current_indentation_tl -\tl_new:N \l__iow_wrap_tl \tl_new:N \l__iow_newline_tl -\bool_new:N \l__iow_line_start_bool -\tl_const:Nx \c_catcode_other_space_tl { \char_generate:nn { `\ } { 12 } } +\int_new:N \l__iow_line_target_int +\tl_new:N \l__iow_one_indent_tl +\int_new:N \l__iow_one_indent_int +\cs_new:Npn \__iow_unindent:w { } +\cs_new_protected:Npn \__iow_set_indent:n #1 + { + \tl_set:Nx \l__iow_one_indent_tl + { \exp_args:No \__str_to_other_fast:n { \tl_to_str:n {#1} } } + \int_set:Nn \l__iow_one_indent_int { \str_count:N \l__iow_one_indent_tl } + \exp_last_unbraced:NNo + \cs_set:Npn \__iow_unindent:w \l__iow_one_indent_tl { } + } +\exp_args:Nx \__iow_set_indent:n { \prg_replicate:nn { 4 } { ~ } } +\tl_new:N \l__iow_indent_tl +\int_new:N \l__iow_indent_int +\tl_new:N \l__iow_line_tl +\tl_new:N \l__iow_line_part_tl +\bool_new:N \l__iow_line_break_bool +\tl_new:N \l__iow_wrap_tl \group_begin: - \int_set:Nn \tex_escapechar:D { - \c_one } + \int_set:Nn \tex_escapechar:D { -1 } \tl_const:Nx \c__iow_wrap_marker_tl { \tl_to_str:n { \^^I \^^O \^^W \^^_ \^^W \^^R \^^A \^^P } } \group_end: @@ -8544,13 +8750,17 @@ { \tl_const:cx { c__iow_wrap_ #1 _marker_tl } { - \c_catcode_other_space_tl \c__iow_wrap_marker_tl - \c_catcode_other_space_tl #1 \c_catcode_other_space_tl } } +\cs_new_protected:Npn \iow_indent:n #1 + { + \__msg_kernel_error:nnnnn { kernel } { iow-indent } + { \iow_wrap:nnnN } { \iow_indent:n } {#1} + #1 + } \cs_new:Npx \__iow_indent:n #1 { \c__iow_wrap_indent_marker_tl @@ -8559,14 +8769,14 @@ } \cs_new:Npn \__iow_indent_error:n #1 { - \__msg_kernel_expandable_error:nn { kernel } { indent-outside-wrapping-code } + \__msg_kernel_expandable_error:nnnnn { kernel } { iow-indent } + { \iow_wrap:nnnN } { \iow_indent:n } {#1} #1 } -\cs_new_protected:Npn \iow_indent:n { \__iow_indent_error:n } \cs_new_protected:Npn \iow_wrap:nnnN #1#2#3#4 { \group_begin: - \int_set:Nn \tex_escapechar:D { - \c_one } + \int_set:Nn \tex_escapechar:D { -1 } \cs_set:Npx \{ { \token_to_str:N \{ } \cs_set:Npx \# { \token_to_str:N \# } \cs_set:Npx \} { \token_to_str:N \} } @@ -8581,115 +8791,210 @@ \cs_set_eq:NN \iow_indent:n \__iow_indent_error:n \tl_set:Nx \l__iow_newline_tl { \iow_newline: #2 } \tl_set:Nx \l__iow_newline_tl { \tl_to_str:N \l__iow_newline_tl } - \int_set_eq:NN \l__iow_target_count_int \l_iow_line_count_int - \tl_clear:N \l__iow_current_indentation_tl - \int_zero:N \l__iow_current_line_int - \tl_set:Nn \l__iow_current_line_tl { \use_none:n } - \bool_set_true:N \l__iow_line_start_bool - \use:x - { - \exp_not:n { \tl_clear:N \l__iow_wrap_tl } - \__iow_wrap_loop:w - \tl_to_str:N \c__iow_wrap_newline_marker_tl - \tl_to_str:N \l__iow_wrap_tl - \tl_to_str:N \c__iow_wrap_end_marker_tl - \c_space_tl \c_space_tl - \exp_not:N \q_stop - } - \exp_args:NNo \group_end: - #4 \l__iow_wrap_tl + \int_set:Nn \l__iow_line_target_int + { \l_iow_line_count_int - \str_count:N \l__iow_newline_tl + 1 } + \__iow_wrap_do: + \exp_args:NNf \group_end: + #4 { \tl_to_str:N \l__iow_wrap_tl } } \cs_new_eq:NN \__iow_wrap_set:Nx \protected@edef -\cs_new_protected:Npn \__iow_wrap_set_target: +\cs_new_protected:Npn \__iow_wrap_do: { - \cs_set_protected:Npn \__iow_wrap_set_target: + \tl_set:Nx \l__iow_wrap_tl { - \cs_set_protected:Npn \__iow_wrap_set_target: { } - \tl_replace_all:Nnn \l__iow_newline_tl { ~ } { \c_space_tl } - \int_set:Nn \l__iow_target_count_int - { \l_iow_line_count_int - \tl_count:N \l__iow_newline_tl + \c_one } + \exp_args:No \__str_to_other_fast:n \l__iow_wrap_tl + \c__iow_wrap_end_marker_tl + } + \exp_after:wN \__iow_wrap_start:w \l__iow_wrap_tl + } +\cs_new_protected:Npn \__iow_wrap_start:w + { + \bool_set_false:N \l__iow_line_break_bool + \tl_clear:N \l__iow_line_tl + \tl_clear:N \l__iow_line_part_tl + \tl_set:Nn \l__iow_wrap_tl { ~ \use_none:n } + \int_zero:N \l__iow_indent_int + \tl_clear:N \l__iow_indent_tl + \__iow_wrap_chunk:nw { \l_iow_line_count_int } + } +\cs_set_protected:Npn \__iow_tmp:w #1#2 + { + \cs_new_protected:Npn \__iow_wrap_chunk:nw ##1##2 #2 + { + \tl_if_empty:nTF {##2} + { + \tl_clear:N \l__iow_line_part_tl + \__iow_wrap_next:nw {##1} + } + { + \tl_if_empty:NTF \l__iow_line_tl + { + \__iow_wrap_line:nw + { \l__iow_indent_tl } + ##1 - \l__iow_indent_int ; + } + { \__iow_wrap_line:nw { } ##1 ; } + ##2 #1 + \__iow_wrap_end_chunk:w 7 6 5 4 3 2 1 0 \q_stop + } } + \cs_new_protected:Npn \__iow_wrap_next:nw ##1##2 #1 + { \use:c { __iow_wrap_##2:n } {##1} } } -\cs_new_protected:Npn \__iow_wrap_loop:w #1 ~ % +\exp_args:NVV \__iow_tmp:w \c_catcode_other_space_tl \c__iow_wrap_marker_tl +\cs_new_protected:Npn \__iow_wrap_line:nw #1 { - \tl_set:Nn \l__iow_current_word_tl {#1} - \tl_if_eq:NNTF \l__iow_current_word_tl \c__iow_wrap_marker_tl - { \__iow_wrap_special:w } - { \__iow_wrap_word: } + \tex_edef:D \l__iow_line_part_tl { \if_false: } \fi: + #1 + \exp_after:wN \__iow_wrap_line_loop:w + \__int_value:w \__int_eval:w } -\cs_new_protected:Npn \__iow_wrap_word: +\cs_new:Npn \__iow_wrap_line_loop:w #1 ; #2#3#4#5#6#7#8#9 { - \int_set:Nn \l__iow_current_word_int - { \exp_args:No \str_count_ignore_spaces:n \l__iow_current_word_tl } - \int_add:Nn \l__iow_current_line_int { \l__iow_current_word_int } - \int_compare:nNnTF \l__iow_current_line_int < \l__iow_target_count_int - { \__iow_wrap_word_fits: } - { \__iow_wrap_word_newline: } - \__iow_wrap_loop:w + \if_int_compare:w #1 < 8 \exp_stop_f: + \__iow_wrap_line_aux:Nw #1 + \fi: + #2 #3 #4 #5 #6 #7 #8 #9 + \exp_after:wN \__iow_wrap_line_loop:w + \__int_value:w \__int_eval:w #1 - 8 ; } -\cs_new_protected:Npn \__iow_wrap_word_fits: +\cs_new:Npn \__iow_wrap_line_aux:Nw #1#2#3 \exp_after:wN #4 ; { - \bool_if:NTF \l__iow_line_start_bool + #2 + \exp_after:wN \__iow_wrap_line_end:NnnnnnnnN + \exp_after:wN #1 + \exp:w \exp_end_continue_f:w + \exp_after:wN \exp_after:wN + \if_case:w #1 \exp_stop_f: + \prg_do_nothing: + \or: \use_none:n + \or: \use_none:nn + \or: \use_none:nnn + \or: \use_none:nnnn + \or: \use_none:nnnnn + \or: \use_none:nnnnnn + \or: \use_none:nnnnnnn + \fi: + { } { } { } { } { } { } { } #3 + } +\cs_new:Npn \__iow_wrap_line_end:NnnnnnnnN #1#2#3#4#5#6#7#8#9 + { + #2 #3 #4 #5 #6 #7 #8 + \use_none:nnnnn \__int_eval:w 8 - ; #9 + \token_if_eq_charcode:NNTF \c_space_token #9 + { \__iow_wrap_line_end:nw { } } + { \if_false: { \fi: } \__iow_wrap_break:w #9 } + } +\cs_new:Npn \__iow_wrap_line_end:nw #1 + { + \if_false: { \fi: } + \__iow_wrap_store_do:n {#1} + \__iow_wrap_next_line:w + } +\cs_new:Npn \__iow_wrap_end_chunk:w + #1 \__int_eval:w #2 - #3 ; #4#5 \q_stop + { + \if_false: { \fi: } + \exp_args:Nf \__iow_wrap_next:nw { \int_eval:n { #2 - #4 } } + } +\cs_set_protected:Npn \__iow_tmp:w #1 + { + \cs_new:Npn \__iow_wrap_break:w { - \bool_set_false:N \l__iow_line_start_bool - \tl_put_right:Nx \l__iow_current_line_tl - { \l__iow_current_indentation_tl \l__iow_current_word_tl } - \int_add:Nn \l__iow_current_line_int - { \l__iow_current_indentation_int } + \tex_edef:D \l__iow_line_part_tl + { \if_false: } \fi: + \exp_after:wN \__iow_wrap_break_first:w + \l__iow_line_part_tl + #1 + { ? \__iow_wrap_break_end:w } + \q_mark } + \cs_new:Npn \__iow_wrap_break_first:w ##1 #1 ##2 { - \tl_put_right:Nx \l__iow_current_line_tl - { ~ \l__iow_current_word_tl } - \int_incr:N \l__iow_current_line_int + \use_none:nn ##2 \__iow_wrap_break_none:w + \__iow_wrap_break_loop:w ##1 #1 ##2 } + \cs_new:Npn \__iow_wrap_break_none:w ##1##2 #1 ##3 \q_mark ##4 #1 + { + \tl_if_empty:NTF \l__iow_line_tl + { ##2 ##4 \__iow_wrap_line_end:nw { } } + { \__iow_wrap_line_end:nw { \__iow_wrap_trim:N } ##2 ##4 #1 } + } + \cs_new:Npn \__iow_wrap_break_loop:w ##1 #1 ##2 #1 ##3 + { + \use_none:n ##3 + ##1 #1 + \__iow_wrap_break_loop:w ##2 #1 ##3 + } + \cs_new:Npn \__iow_wrap_break_end:w ##1 #1 ##2 ##3 #1 ##4 \q_mark + { ##1 \__iow_wrap_line_end:nw { } ##3 } } -\cs_new_protected:Npn \__iow_wrap_word_newline: +\exp_args:NV \__iow_tmp:w \c_catcode_other_space_tl +\cs_new_protected:Npn \__iow_wrap_next_line:w #1#2 \q_stop { - \__iow_wrap_set_target: - \tl_put_right:Nx \l__iow_wrap_tl - { \l__iow_current_line_tl \l__iow_newline_tl } - \int_set:Nn \l__iow_current_line_int + \tl_clear:N \l__iow_line_tl + \token_if_eq_meaning:NNTF #1 \__iow_wrap_end_chunk:w { - \l__iow_current_word_int - + \l__iow_current_indentation_int + \tl_clear:N \l__iow_line_part_tl + \bool_set_true:N \l__iow_line_break_bool + \__iow_wrap_next:nw { \l__iow_line_target_int } + } + { + \__iow_wrap_line:nw + { \l__iow_indent_tl } + \l__iow_line_target_int - \l__iow_indent_int ; + #1 #2 \q_stop } - \tl_set:Nx \l__iow_current_line_tl - { \l__iow_current_indentation_tl \l__iow_current_word_tl } } -\cs_new_protected:Npn \__iow_wrap_special:w #1 ~ #2 ~ #3 ~ % +\cs_new_protected:Npn \__iow_wrap_indent:n #1 { - \use:c { __iow_wrap_#1: } - \str_if_eq_x:nnTF { #2~#3 } { ~ \c__iow_wrap_marker_tl } - { \__iow_wrap_special:w } - { \__iow_wrap_loop:w #2 ~ #3 ~ } + \tl_put_right:Nx \l__iow_line_tl { \l__iow_line_part_tl } + \bool_set_false:N \l__iow_line_break_bool + \int_add:Nn \l__iow_indent_int { \l__iow_one_indent_int } + \tl_put_right:No \l__iow_indent_tl { \l__iow_one_indent_tl } + \__iow_wrap_chunk:nw {#1} } -\cs_new_protected:Npn \__iow_wrap_newline: +\cs_new_protected:Npn \__iow_wrap_unindent:n #1 { - \__iow_wrap_set_target: - \tl_put_right:Nx \l__iow_wrap_tl - { \l__iow_current_line_tl \l__iow_newline_tl } - \int_zero:N \l__iow_current_line_int - \tl_clear:N \l__iow_current_line_tl - \bool_set_true:N \l__iow_line_start_bool + \tl_put_right:Nx \l__iow_line_tl { \l__iow_line_part_tl } + \bool_set_false:N \l__iow_line_break_bool + \int_sub:Nn \l__iow_indent_int { \l__iow_one_indent_int } + \tl_set:Nx \l__iow_indent_tl + { \exp_after:wN \__iow_unindent:w \l__iow_indent_tl } + \__iow_wrap_chunk:nw {#1} } -\cs_new_protected:Npx \__iow_wrap_indent: +\cs_new_protected:Npn \__iow_wrap_newline:n #1 { - \int_add:Nn \l__iow_current_indentation_int \c_four - \tl_put_right:Nx \exp_not:N \l__iow_current_indentation_tl - { \c_space_tl \c_space_tl \c_space_tl \c_space_tl } + \bool_if:NF \l__iow_line_break_bool + { \__iow_wrap_store_do:n { \__iow_wrap_trim:N } } + \bool_set_false:N \l__iow_line_break_bool + \__iow_wrap_chunk:nw { \l__iow_line_target_int } } -\cs_new_protected:Npn \__iow_wrap_unindent: +\cs_new_protected:Npn \__iow_wrap_end:n #1 { - \int_sub:Nn \l__iow_current_indentation_int \c_four - \tl_set:Nx \l__iow_current_indentation_tl - { \prg_replicate:nn \l__iow_current_indentation_int { ~ } } + \bool_if:NF \l__iow_line_break_bool + { \__iow_wrap_store_do:n { \__iow_wrap_trim:N } } + \bool_set_false:N \l__iow_line_break_bool } -\cs_new_protected:Npn \__iow_wrap_end: +\cs_new_protected:Npn \__iow_wrap_store_do:n #1 { - \tl_put_right:Nx \l__iow_wrap_tl - { \l__iow_current_line_tl } - \use_none_delimit_by_q_stop:w + \tl_set:Nx \l__iow_line_tl + { \l__iow_line_tl \l__iow_line_part_tl } + \tl_set:Nx \l__iow_wrap_tl + { + \l__iow_wrap_tl + \l__iow_newline_tl + #1 \l__iow_line_tl + } + \tl_clear:N \l__iow_line_tl + } +\cs_set_protected:Npn \__iow_tmp:w #1 + { + \cs_new:Npn \__iow_wrap_trim:N ##1 + { \tl_if_empty:NF ##1 { \exp_after:wN \__iow_wrap_trim:w ##1 \q_stop } } + \cs_new:Npn \__iow_wrap_trim:w ##1 #1 \q_stop {##1} } +\exp_args:NV \__iow_tmp:w \c_catcode_other_space_tl \__msg_kernel_new:nnnn { kernel } { file-not-found } { File~'#1'~not~found. } { @@ -8715,12 +9020,25 @@ { File~names~must~contain~balanced~numbers~of~quotes~("). } -\__msg_kernel_new:nnn { kernel } { indent-outside-wrapping-code } - { Only~\iow_wrap:nnnN~(arg~1)~allows~\iow_indent:n } -\cs_new_eq:NN \ior_get_str:NN \ior_str_get:NN +\__msg_kernel_new:nnnn { kernel } { iow-indent } + { Only~#1 (arg~1)~allows~#2 } + { + The~command~#2 can~only~be~used~in~messages~ + which~will~be~wrapped~using~#1.~ + It~was~called~with~argument~'#3'. + } +\cs_new_protected:Npn \ior_get_str:NN + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2017-12-31 } + { \token_to_str:N \ior_get_str:NN } + { \token_to_str:N \ior_str_get:NN } + \cs_gset_eq:NN \ior_get_str:NN \ior_str_get:NN + \ior_str_get:NN + } %% File: l3skip.dtx Copyright (C) 2004-2011 Frank Mittelbach, The LaTeX3 Project -%% (C) 2012-2016 The LaTeX3 Project -\GetIdInfo$Id: l3skip.dtx 6809 2017-01-01 06:33:13Z bruno $ +%% (C) 2012-2017 The LaTeX3 Project +\GetIdInfo$Id: l3skip.dtx 6968 2017-02-20 16:08:44Z bruno $ {L3 Dimensions and skips} \cs_new_eq:NN \if_dim:w \tex_ifdim:D \cs_new_eq:NN \__dim_eval:w \etex_dimexpr:D @@ -8948,7 +9266,7 @@ ##1 . ##2 \tl_to_str:n { pt } } { - \int_compare:nNnTF {#2} > \c_zero + \int_compare:nNnTF {#2} > { 0 } { #1 . #2 } { #1 } } @@ -8968,6 +9286,10 @@ \cs_generate_variant:Nn \dim_show:N { c } \cs_new_protected:Npn \dim_show:n { \__msg_show_wrap:Nn \dim_eval:n } +\cs_new_eq:NN \dim_log:N \__kernel_register_log:N +\cs_new_eq:NN \dim_log:c \__kernel_register_log:c +\cs_new_protected:Npn \dim_log:n + { \__msg_log_next: \dim_show:n } \dim_const:Nn \c_zero_dim { 0 pt } \dim_const:Nn \c_max_dim { 16383.99999 pt } \dim_new:N \l_tmpa_dim @@ -9025,7 +9347,7 @@ { \if_int_compare:w \__str_if_eq_x:nn { \skip_eval:n { #1 } } { \skip_eval:n { #2 } } - = \c_zero + = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: @@ -9058,6 +9380,10 @@ \cs_generate_variant:Nn \skip_show:N { c } \cs_new_protected:Npn \skip_show:n { \__msg_show_wrap:Nn \skip_eval:n } +\cs_new_eq:NN \skip_log:N \__kernel_register_log:N +\cs_new_eq:NN \skip_log:c \__kernel_register_log:c +\cs_new_protected:Npn \skip_log:n + { \__msg_log_next: \skip_show:n } \skip_const:Nn \c_zero_skip { \c_zero_dim } \skip_const:Nn \c_max_skip { \c_max_dim } \skip_new:N \l_tmpa_skip @@ -9120,6 +9446,10 @@ \cs_generate_variant:Nn \muskip_show:N { c } \cs_new_protected:Npn \muskip_show:n { \__msg_show_wrap:Nn \muskip_eval:n } +\cs_new_eq:NN \muskip_log:N \__kernel_register_log:N +\cs_new_eq:NN \muskip_log:c \__kernel_register_log:c +\cs_new_protected:Npn \muskip_log:n + { \__msg_log_next: \muskip_show:n } \muskip_const:Nn \c_zero_muskip { 0 mu } \muskip_const:Nn \c_max_muskip { 16383.99999 mu } \muskip_new:N \l_tmpa_muskip @@ -9127,7 +9457,7 @@ \muskip_new:N \g_tmpa_muskip \muskip_new:N \g_tmpb_muskip %% File: l3keys.dtx Copyright (C) 2006-2017 The LaTeX3 Project -\GetIdInfo$Id: l3keys.dtx 6811 2017-01-01 08:50:54Z joseph $ +\GetIdInfo$Id: l3keys.dtx 6906 2017-02-12 20:07:58Z bruno $ {L3 Key-value interfaces} \tl_new:N \l__keyval_key_tl \tl_new:N \l__keyval_value_tl @@ -9979,6 +10309,8 @@ } } } +\cs_new_protected:Npn \keys_log:nn + { \__msg_log_next: \keys_show:nn } \__msg_kernel_new:nnnn { kernel } { boolean-values-only } { Key~'#1'~accepts~boolean~values~only. } { The~key~'#1'~only~accepts~the~values~'true'~and~'false'. } @@ -10048,10 +10380,10 @@ { has~the~properties: } { is~undefined. } } -%% File: l3fp.dtx Copyright (C) 2011-2016 The LaTeX3 Project -\GetIdInfo$Id: l3fp.dtx 6805 2016-12-28 22:15:52Z joseph $ +%% File: l3fp.dtx Copyright (C) 2011-2017 The LaTeX3 Project +\GetIdInfo$Id: l3fp.dtx 6923 2017-02-14 03:07:25Z bruno $ {L3 Floating points} -%% File: l3fp-aux.dtx Copyright(C) 2011-2014,2016 The LaTeX3 Project +%% File: l3fp-aux.dtx Copyright(C) 2011-2014,2016-2017 The LaTeX3 Project \cs_new:Npn \__fp_use_none_stop_f:n #1 { \exp_stop_f: } \cs_new:Npn \__fp_use_s:n #1 { #1; } \cs_new:Npn \__fp_use_s:nn #1#2 { #1#2; } @@ -10080,7 +10412,12 @@ \tl_const:Nn \c_inf_fp { \s__fp \__fp_chk:w 2 0 \s__fp_exact ; } \tl_const:Nn \c_minus_inf_fp { \s__fp \__fp_chk:w 2 2 \s__fp_exact ; } \tl_const:Nn \c_nan_fp { \s__fp \__fp_chk:w 3 1 \s__fp_exact ; } +\int_const:Nn \c__fp_prec_int { 16 } +\int_const:Nn \c__fp_half_prec_int { 8 } +\int_const:Nn \c__fp_block_int { 4 } +\int_const:Nn \c__fp_myriad_int { 10000 } \int_const:Nn \c__fp_max_exponent_int { 10000 } +\int_const:Nn \c__fp_max_exp_exponent_int { 5 } \cs_new:Npn \__fp_zero_fp:N #1 { \s__fp \__fp_chk:w 0 #1 \s__fp_underflow ; } \cs_new:Npn \__fp_inf_fp:N #1 @@ -10107,13 +10444,13 @@ \fi: } \cs_new:Npn \__fp_neg_sign:N #1 - { \__int_eval:w \c_two - #1 \__int_eval_end: } + { \__int_eval:w 2 - #1 \__int_eval_end: } \cs_new:Npn \__fp_sanitize:Nw #1 #2; { \if_case:w - \if_int_compare:w #2 > \c__fp_max_exponent_int \c_one \else: - \if_int_compare:w #2 < - \c__fp_max_exponent_int \c_two \else: - \if_meaning:w 1 #1 \c_three \else: \c_zero \fi: \fi: \fi: + \if_int_compare:w #2 > \c__fp_max_exponent_int 1 ~ \else: + \if_int_compare:w #2 < - \c__fp_max_exponent_int 2 ~ \else: + \if_meaning:w 1 #1 3 ~ \else: 0 ~ \fi: \fi: \fi: \or: \exp_after:wN \__fp_overflow:w \or: \exp_after:wN \__fp_underflow:w \or: \exp_after:wN \__fp_sanitize_zero:w @@ -10205,7 +10542,7 @@ { \cs:w __fp_decimate_ - \if_int_compare:w \__int_eval:w #1 > \c_sixteen + \if_int_compare:w \__int_eval:w #1 > \c__fp_prec_int tiny \else: \__int_to_roman:w \__int_eval:w #1 @@ -10269,8 +10606,8 @@ } \cs_new:Npn \__fp_int_normal:nnnnn #1 #2#3#4#5 { - \if_int_compare:w #1 > \c_zero - \__fp_decimate:nNnnnn { \c_sixteen - #1 } + \if_int_compare:w #1 > 0 \exp_stop_f: + \__fp_decimate:nNnnnn { \c__fp_prec_int - #1 } \__fp_int_test:Nw {#2} {#3} {#4} {#5} \else: @@ -10303,8 +10640,8 @@ \cs_new:Npn \__fp_small_int_true:wTF #1; #2#3 { #2 {#1} } \cs_new:Npn \__fp_small_int_normal:NnwTF #1#2#3; { - \if_int_compare:w #2 > \c_zero - \__fp_decimate:nNnnnn { \c_sixteen - #2 } + \if_int_compare:w #2 > 0 \exp_stop_f: + \__fp_decimate:nNnnnn { \c__fp_prec_int - #2 } \__fp_small_int_test:NnnwNnw #3 #1 {#2} \else: @@ -10317,7 +10654,7 @@ \if_meaning:w 0 #1 \exp_after:wN \__fp_small_int_true:wTF \__int_value:w \if_meaning:w 2 #5 - \fi: - \if_int_compare:w #6 > \c_eight + \if_int_compare:w #6 > \c__fp_half_prec_int 1 0000 0000 \else: #3 @@ -10328,13 +10665,13 @@ } \cs_new:Npn \__fp_array_count:n #1 { - \__int_value:w \__int_eval:w \c_zero + \__int_value:w \__int_eval:w 0 \__fp_array_count_loop:Nw #1 { ? \__prg_break: } ; \__prg_break_point: \__int_eval_end: } \cs_new:Npn \__fp_array_count_loop:Nw #1#2; - { \use_none:n #1 + \c_one \__fp_array_count_loop:Nw } + { \use_none:n #1 + 1 \__fp_array_count_loop:Nw } \cs_new:Npn \__fp_expand:n #1 { \__fp_expand_loop:nwnN { } @@ -10357,22 +10694,10 @@ conversion~functions. } %% File: l3fp-traps.dtx Copyright (C) 2011-2014,2016 The LaTeX3 Project -\cs_new_protected:Npn \fp_flag_off:n #1 - { \cs_set_eq:cN { l__fp_ #1 _flag_token } \tex_undefined:D } -\cs_new:Npn \fp_flag_on:n #1 - { \exp_args:Nc \use_none:n { l__fp_ #1 _flag_token } } -\prg_new_conditional:Npnn \fp_if_flag_on:n #1 { p , T , F , TF } - { - \if_cs_exist:w l__fp_ #1 _flag_token \cs_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -\cs_new_eq:NN \l__fp_invalid_operation_flag_token \tex_undefined:D -\cs_new_eq:NN \l__fp_division_by_zero_flag_token \tex_undefined:D -\cs_new_eq:NN \l__fp_overflow_flag_token \tex_undefined:D -\cs_new_eq:NN \l__fp_underflow_flag_token \tex_undefined:D +\flag_new:n { fp_invalid_operation } +\flag_new:n { fp_division_by_zero } +\flag_new:n { fp_overflow } +\flag_new:n { fp_underflow } \cs_new_protected:Npn \fp_trap:nn #1#2 { \cs_if_exist_use:cF { __fp_trap_#1_set_#2: } @@ -10403,7 +10728,7 @@ { #1 \__fp_error:nnfn { invalid } {##2} { \fp_to_tl:n { ##3; } } { } - \fp_flag_on:n { invalid_operation } + \flag_raise:n { fp_invalid_operation } ##1 } \exp_args:Nno \use:n @@ -10412,7 +10737,7 @@ #1 \__fp_error:nffn { invalid-ii } { \fp_to_tl:n { ##2; } } { \fp_to_tl:n { ##3; } } {##1} - \fp_flag_on:n { invalid_operation } + \flag_raise:n { fp_invalid_operation } \exp_after:wN \c_nan_fp } \exp_args:Nno \use:n @@ -10420,7 +10745,7 @@ { #1 \__fp_error:nffn { invalid } {##1} {##2} { } - \fp_flag_on:n { invalid_operation } + \flag_raise:n { fp_invalid_operation } \exp_after:wN \c_nan_fp } } @@ -10437,7 +10762,7 @@ { #1 \__fp_error:nnfn { zero-div } {##2} { \fp_to_tl:n { ##3; } } { } - \fp_flag_on:n { division_by_zero } + \flag_raise:n { fp_division_by_zero } \exp_after:wN ##1 } \exp_args:Nno \use:n @@ -10446,7 +10771,7 @@ #1 \__fp_error:nffn { zero-div-ii } { \fp_to_tl:n { ##3; } } { \fp_to_tl:n { ##4; } } {##2} - \fp_flag_on:n { division_by_zero } + \flag_raise:n { fp_division_by_zero } \exp_after:wN ##1 } } @@ -10477,7 +10802,7 @@ { \fp_to_tl:n { \s__fp \__fp_chk:w ##1##2##3; } } { \token_if_eq_meaning:NNF 0 ##2 { - } #4 } {#2} - \fp_flag_on:n {#2} + \flag_raise:n { fp_#2 } #3 ##2 } } @@ -10537,30 +10862,31 @@ \__msg_kernel_new:nnn { kernel } { fp-invalid-ii } { Invalid~operation~ (#1) #3 (#2) } %% File: l3fp-round.dtx Copyright(C) 2011-2012,2014-2016 The LaTeX3 Project +\int_const:Nn \c__fp_five_int { 5 } \cs_new:Npn \__fp_round_return_one: - { \exp_after:wN \c_one \exp:w } + { \exp_after:wN 1 \exp_after:wN \exp_stop_f: \exp:w } \cs_new:Npn \__fp_round_to_ninf:NNN #1 #2 #3 { \if_meaning:w 2 #1 - \if_int_compare:w #3 > \c_zero + \if_int_compare:w #3 > 0 \exp_stop_f: \__fp_round_return_one: \fi: \fi: - \c_zero + 0 \exp_stop_f: } -\cs_new:Npn \__fp_round_to_zero:NNN #1 #2 #3 { \c_zero } +\cs_new:Npn \__fp_round_to_zero:NNN #1 #2 #3 { 0 \exp_stop_f: } \cs_new:Npn \__fp_round_to_pinf:NNN #1 #2 #3 { \if_meaning:w 0 #1 - \if_int_compare:w #3 > \c_zero + \if_int_compare:w #3 > 0 \exp_stop_f: \__fp_round_return_one: \fi: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new:Npn \__fp_round_to_nearest:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_five + \if_int_compare:w #3 > \c__fp_five_int \__fp_round_return_one: \else: \if_meaning:w 5 #3 @@ -10569,11 +10895,11 @@ \fi: \fi: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new:Npn \__fp_round_to_nearest_ninf:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_five + \if_int_compare:w #3 > \c__fp_five_int \__fp_round_return_one: \else: \if_meaning:w 5 #3 @@ -10582,18 +10908,18 @@ \fi: \fi: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new:Npn \__fp_round_to_nearest_zero:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_five + \if_int_compare:w #3 > \c__fp_five_int \__fp_round_return_one: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new:Npn \__fp_round_to_nearest_pinf:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_five + \if_int_compare:w #3 > \c__fp_five_int \__fp_round_return_one: \else: \if_meaning:w 5 #3 @@ -10602,7 +10928,7 @@ \fi: \fi: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new_eq:NN \__fp_round:NNN \__fp_round_to_nearest:NNN \cs_new:Npn \__fp_round_s:NNNw #1 #2 #3 #4; @@ -10614,7 +10940,7 @@ \if_int_odd:w 0 \if_meaning:w 0 #3 1 \fi: \if_meaning:w 5 #3 1 \fi: \exp_stop_f: - \if_int_compare:w \__int_eval:w #4 > \c_zero + \if_int_compare:w \__int_eval:w #4 > 0 \exp_stop_f: 1 + \fi: \fi: @@ -10623,11 +10949,11 @@ } \cs_new:Npn \__fp_round_digit:Nw #1 #2; { - \if_int_odd:w \if_meaning:w 0 #1 \c_one \else: - \if_meaning:w 5 #1 \c_one \else: - \c_zero \fi: \fi: - \if_int_compare:w \__int_eval:w #2 > \c_zero - \__int_eval:w \c_one + + \if_int_odd:w \if_meaning:w 0 #1 1 \else: + \if_meaning:w 5 #1 1 \else: + 0 \fi: \fi: \exp_stop_f: + \if_int_compare:w \__int_eval:w #2 > 0 \exp_stop_f: + \__int_eval:w 1 + \fi: \fi: #1 @@ -10635,20 +10961,20 @@ \cs_new_eq:NN \__fp_round_to_ninf_neg:NNN \__fp_round_to_pinf:NNN \cs_new:Npn \__fp_round_to_zero_neg:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_zero + \if_int_compare:w #3 > 0 \exp_stop_f: \__fp_round_return_one: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new_eq:NN \__fp_round_to_pinf_neg:NNN \__fp_round_to_ninf:NNN \cs_new_eq:NN \__fp_round_to_nearest_neg:NNN \__fp_round_to_nearest:NNN \cs_new_eq:NN \__fp_round_to_nearest_ninf_neg:NNN \__fp_round_to_nearest_pinf:NNN \cs_new:Npn \__fp_round_to_nearest_zero_neg:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_four + \if_int_compare:w #3 < \c__fp_five_int \else: \__fp_round_return_one: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new_eq:NN \__fp_round_to_nearest_pinf_neg:NNN \__fp_round_to_nearest_ninf:NNN \cs_new_eq:NN \__fp_round_neg:NNN \__fp_round_to_nearest_neg:NNN @@ -10732,19 +11058,19 @@ } \cs_new:Npn \__fp_round_normal:NwNNnw #1#2 \s__fp \__fp_chk:w 1#3#4#5; { - \__fp_decimate:nNnnnn { \c_sixteen - #4 - #2 } + \__fp_decimate:nNnnnn { \c__fp_prec_int - #4 - #2 } \__fp_round_normal:NnnwNNnn #5 #1 #3 {#4} {#2} } \cs_new:Npn \__fp_round_normal:NnnwNNnn #1#2#3#4; #5#6 { \exp_after:wN \__fp_round_normal:NNwNnn \__int_value:w \__int_eval:w - \if_int_compare:w #2 > \c_zero + \if_int_compare:w #2 > 0 \exp_stop_f: 1 \__int_value:w #2 \exp_after:wN \__fp_round_pack:Nw \__int_value:w \__int_eval:w 1#3 + \else: - \if_int_compare:w #3 > \c_zero + \if_int_compare:w #3 > 0 \exp_stop_f: 1 \__int_value:w #3 + \fi: \fi: @@ -10756,7 +11082,7 @@ 0000 0000 0000 0000 ; #6 } \cs_new:Npn \__fp_round_pack:Nw #1 - { \if_meaning:w 2 #1 + \c_one \fi: \__int_eval_end: } + { \if_meaning:w 2 #1 + 1 \fi: \__int_eval_end: } \cs_new:Npn \__fp_round_normal:NNwNnn #1 #2 { \if_meaning:w 0 #2 @@ -10781,7 +11107,7 @@ \else: \exp_after:wN \__fp_round_special_aux:Nw \exp_after:wN #4 - \__int_value:w \__int_eval:w \c_one + \__int_value:w \__int_eval:w 1 \if_meaning:w 1 #1 -#6 \else: +#5 \fi: \fi: ; @@ -10826,7 +11152,7 @@ { \cs_new:cpn { __fp_parse_digits_ #1 :N } ##1 { - \if_int_compare:w \c_nine < 1 \token_to_str:N ##1 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N ##1 \exp_stop_f: \token_to_str:N ##1 \exp_after:wN #2 \exp:w \else: \__fp_parse_return_semicolon:w #3 ##1 @@ -10856,7 +11182,7 @@ \exp_after:wN \__fp_parse_one_register:NN \fi: \else: - \if_int_compare:w \c_nine < 1 \token_to_str:N #2 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N #2 \exp_stop_f: \exp_after:wN \exp_after:wN \exp_after:wN \__fp_parse_one_digit:NN \else: @@ -10965,14 +11291,14 @@ \exp_after:wN #1 \exp:w \exp_end_continue_f:w \exp_after:wN \__fp_sanitize:wN - \__int_value:w \__int_eval:w \c_zero \__fp_parse_trim_zeros:N + \__int_value:w \__int_eval:w 0 \__fp_parse_trim_zeros:N } \cs_new:Npn \__fp_parse_one_other:NN #1 #2 { \if_int_compare:w \__int_eval:w - ( `#2 \if_int_compare:w `#2 > `Z - \c_thirty_two \fi: ) / 26 - = \c_three + ( `#2 \if_int_compare:w `#2 > `Z - 32 \fi: ) / 26 + = 3 \exp_stop_f: \exp_after:wN \__fp_parse_word:Nw \exp_after:wN #1 \exp_after:wN #2 @@ -11006,13 +11332,12 @@ \exp_end_continue_f:w \if_int_compare:w \if_catcode:w \scan_stop: \exp_not:N #1 - \c_zero + 0 \else: \__int_eval:w - ( `#1 \if_int_compare:w `#1 > `Z - \c_thirty_two \fi: ) - / 26 + ( `#1 \if_int_compare:w `#1 > `Z - 32 \fi: ) / 26 \fi: - = \c_three + = 3 \exp_stop_f: \exp_after:wN #1 \exp:w \exp_after:wN \__fp_parse_letters:N \exp:w @@ -11063,7 +11388,7 @@ { \fi: \fi: - \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f: \exp_after:wN \__fp_parse_large:N \else: \exp_after:wN \__fp_parse_zero: @@ -11073,7 +11398,7 @@ \cs_new:Npn \__fp_parse_strim_zeros:N #1 { \if:w 0 \exp_not:N #1 - - \c_one + - 1 \exp_after:wN \__fp_parse_strim_zeros:N \exp:w \else: \__fp_parse_strim_end:w #1 @@ -11083,7 +11408,7 @@ \cs_new:Npn \__fp_parse_strim_end:w #1 \fi: \__fp_parse_expand:w { \fi: - \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f: \exp_after:wN \__fp_parse_small:N \else: \exp_after:wN \__fp_parse_zero: @@ -11108,9 +11433,9 @@ { #1 #2 \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww - \exp_after:wN \c_zero + \exp_after:wN 0 \__int_value:w \__int_eval:w 1 - \if_int_compare:w \c_nine < 1 \token_to_str:N #4 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N #4 \exp_stop_f: \token_to_str:N #4 \exp_after:wN \__fp_parse_small_trailing:wwNN \__int_value:w 1 @@ -11124,7 +11449,7 @@ \cs_new:Npn \__fp_parse_small_trailing:wwNN 1 #1 ; #2; #3 #4 { #1 #2 - \if_int_compare:w \c_nine < 1 \token_to_str:N #4 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N #4 \exp_stop_f: \token_to_str:N #4 \exp_after:wN \__fp_parse_small_round:NN \exp_after:wN #4 @@ -11136,7 +11461,7 @@ } \cs_new:Npn \__fp_parse_pack_trailing:NNNNNNww #1 #2 #3#4#5#6 #7; #8 ; { - \if_meaning:w 2 #2 + \c_one \fi: + \if_meaning:w 2 #2 + 1 \fi: ; #8 + #1 ; {#3#4#5#6} {#7}; } \cs_new:Npn \__fp_parse_pack_leading:NNNNNww #1 #2#3#4#5 #6; #7; @@ -11146,7 +11471,7 @@ ; 0 {#2#3#4#5} {#6} } \cs_new:Npn \__fp_parse_pack_carry:w \fi: ; 0 #1 - { \fi: + \c_one ; 0 {1000} } + { \fi: + 1 ; 0 {1000} } \cs_new:Npn \__fp_parse_large:N #1 { \exp_after:wN \__fp_parse_large_leading:wwNN @@ -11156,10 +11481,10 @@ } \cs_new:Npn \__fp_parse_large_leading:wwNN 1 #1 ; #2; #3 #4 { - + \c_eight - #3 + + \c__fp_half_prec_int - #3 \exp_after:wN \__fp_parse_pack_leading:NNNNNww \__int_value:w \__int_eval:w 1 #1 - \if_int_compare:w \c_nine < 1 \token_to_str:N #4 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N #4 \exp_stop_f: \exp_after:wN \__fp_parse_large_trailing:wwNN \__int_value:w 1 \token_to_str:N #4 \exp_after:wN \__fp_parse_digits_vi:N @@ -11177,7 +11502,7 @@ \else: #2 \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww - \exp_after:wN \c_zero + \exp_after:wN 0 \__int_value:w 1 0000 0000 \__fp_parse_exponent:Nw #4 \fi: @@ -11186,16 +11511,16 @@ } \cs_new:Npn \__fp_parse_large_trailing:wwNN 1 #1 ; #2; #3 #4 { - \if_int_compare:w \c_nine < 1 \token_to_str:N #4 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N #4 \exp_stop_f: \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww - \exp_after:wN \c_eight + \exp_after:wN \c__fp_half_prec_int \__int_value:w \__int_eval:w 1 #1 \token_to_str:N #4 \exp_after:wN \__fp_parse_large_round:NN \exp_after:wN #4 \exp:w \else: \exp_after:wN \__fp_parse_pack_trailing:NNNNNNww - \__int_value:w \__int_eval:w \c_seven - #3 \exp_stop_f: + \__int_value:w \__int_eval:w 7 - #3 \exp_stop_f: \__int_value:w \__int_eval:w 1 #1 \if:w . \exp_not:N #4 \exp_after:wN \__fp_parse_small_trailing:wwNN @@ -11214,8 +11539,8 @@ } \cs_new:Npn \__fp_parse_round_loop:N #1 { - \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: - + \c_one + \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f: + + 1 \if:w 0 \token_to_str:N #1 \exp_after:wN \__fp_parse_round_loop:N \exp:w @@ -11224,18 +11549,18 @@ \exp:w \fi: \else: - \__fp_parse_return_semicolon:w \c_zero #1 + \__fp_parse_return_semicolon:w 0 #1 \fi: \__fp_parse_expand:w } \cs_new:Npn \__fp_parse_round_up:N #1 { - \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: - + \c_one + \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f: + + 1 \exp_after:wN \__fp_parse_round_up:N \exp:w \else: - \__fp_parse_return_semicolon:w \c_one #1 + \__fp_parse_return_semicolon:w 1 #1 \fi: \__fp_parse_expand:w } @@ -11246,7 +11571,7 @@ } \cs_new:Npn \__fp_parse_small_round:NN #1#2 { - \if_int_compare:w \c_nine < 1 \token_to_str:N #2 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N #2 \exp_stop_f: + \exp_after:wN \__fp_round_s:NNNw \exp_after:wN 0 @@ -11254,7 +11579,7 @@ \exp_after:wN #2 \__int_value:w \__int_eval:w \exp_after:wN \__fp_parse_round_after:wN - \__int_value:w \__int_eval:w \c_zero * \__int_eval:w \c_zero + \__int_value:w \__int_eval:w 0 * \__int_eval:w 0 \exp_after:wN \__fp_parse_round_loop:N \exp:w \else: @@ -11264,7 +11589,7 @@ } \cs_new:Npn \__fp_parse_large_round:NN #1#2 { - \if_int_compare:w \c_nine < 1 \token_to_str:N #2 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N #2 \exp_stop_f: + \exp_after:wN \__fp_round_s:NNNw \exp_after:wN 0 @@ -11272,7 +11597,7 @@ \exp_after:wN #2 \__int_value:w \__int_eval:w \exp_after:wN \__fp_parse_large_round_aux:wNN - \__int_value:w \__int_eval:w \c_one + \__int_value:w \__int_eval:w 1 \exp_after:wN \__fp_parse_round_loop:N \else: %^^A could be dot, or e, or other \exp_after:wN \__fp_parse_large_round_test:NN @@ -11297,12 +11622,12 @@ \exp_after:wN \__fp_parse_round_after:wN \__int_value:w \__int_eval:w #1 \if:w . \exp_not:N #3 - + \c_zero * \__int_eval:w \c_zero + + 0 * \__int_eval:w 0 \exp_after:wN \__fp_parse_round_loop:N \exp:w \exp_after:wN \__fp_parse_expand:w \else: \exp_after:wN ; - \exp_after:wN \c_zero + \exp_after:wN 0 \exp_after:wN #3 \fi: } @@ -11324,7 +11649,7 @@ \cs_new:Npn \__fp_parse_exponent_aux:N #1 { \if_int_compare:w \if_catcode:w \scan_stop: \exp_not:N #1 - \c_zero \else: `#1 \fi: > `9 \exp_stop_f: + 0 \else: `#1 \fi: > `9 \exp_stop_f: 0 \exp_after:wN ; \exp_after:wN e \else: \exp_after:wN \__fp_parse_exponent_sign:N @@ -11343,7 +11668,7 @@ } \cs_new:Npn \__fp_parse_exponent_body:N #1 { - \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f: \token_to_str:N #1 \exp_after:wN \__fp_parse_exponent_digits:N \exp:w @@ -11359,7 +11684,7 @@ } \cs_new:Npn \__fp_parse_exponent_digits:N #1 { - \if_int_compare:w \c_nine < 1 \token_to_str:N #1 \exp_stop_f: + \if_int_compare:w 9 < 1 \token_to_str:N #1 \exp_stop_f: \token_to_str:N #1 \exp_after:wN \__fp_parse_exponent_digits:N \exp:w @@ -11373,7 +11698,8 @@ \if_catcode:w \scan_stop: \exp_not:N #1 \if_meaning:w \scan_stop: #1 \if_int_compare:w - \__str_if_eq_x:nn { \s__fp } { \exp_not:N #1 } = \c_zero + \__str_if_eq_x:nn { \s__fp } { \exp_not:N #1 } + = 0 \exp_stop_f: 0 \__msg_kernel_expandable_error:nnn { kernel } { fp-after-e } { floating~point~ } @@ -11387,7 +11713,7 @@ \else: \if_int_compare:w \__str_if_eq_x:nn { \__int_value:w #1 } { \tex_the:D #1 } - = \c_zero + = 0 \exp_stop_f: \__int_value:w #1 \else: 0 @@ -11434,7 +11760,7 @@ \exp_after:wN #1 \exp:w \exp_end_continue_f:w \exp_after:wN \__fp_sanitize:wN - \__int_value:w \__int_eval:w \c_zero \__fp_parse_strim_zeros:N + \__int_value:w \__int_eval:w 0 \__fp_parse_strim_zeros:N } \group_begin: \char_set_catcode_letter:N ( @@ -11644,7 +11970,7 @@ \if_catcode:w \scan_stop: \exp_not:N #2 \if_int_compare:w \__str_if_eq_x:nn { \s__fp_mark } { \exp_not:N #2 } - = \c_zero + = 0 \exp_stop_f: \exp_after:wN \exp_after:wN \exp_after:wN \__fp_parse_infix_mark:NNN \else: @@ -11654,9 +11980,8 @@ \else: \if_int_compare:w \__int_eval:w - ( `#2 \if_int_compare:w `#2 > `Z - \c_thirty_two \fi: ) - / 26 - = \c_three + ( `#2 \if_int_compare:w `#2 > `Z - 32 \fi: ) / 26 + = 3 \exp_stop_f: \exp_after:wN \exp_after:wN \exp_after:wN \__fp_parse_infix_juxtapose:N \else: @@ -11878,29 +12203,20 @@ } \group_end: \cs_new:cpn { __fp_parse_infix_<:N } #1 - { - \__fp_parse_compare:NNNNNNN #1 \c_one - \c_zero \c_zero \c_zero \c_zero < - } + { \__fp_parse_compare:NNNNNNN #1 1 0 0 0 0 < } \cs_new:cpn { __fp_parse_infix_=:N } #1 - { - \__fp_parse_compare:NNNNNNN #1 \c_one - \c_zero \c_zero \c_zero \c_zero = - } + { \__fp_parse_compare:NNNNNNN #1 1 0 0 0 0 = } \cs_new:cpn { __fp_parse_infix_>:N } #1 - { - \__fp_parse_compare:NNNNNNN #1 \c_one - \c_zero \c_zero \c_zero \c_zero > - } + { \__fp_parse_compare:NNNNNNN #1 1 0 0 0 0 > } \cs_new:cpn { __fp_parse_infix_!:N } #1 { \exp_after:wN \__fp_parse_compare:NNNNNNN \exp_after:wN #1 - \exp_after:wN \c_zero - \exp_after:wN \c_one - \exp_after:wN \c_one - \exp_after:wN \c_one - \exp_after:wN \c_one + \exp_after:wN 0 + \exp_after:wN 1 + \exp_after:wN 1 + \exp_after:wN 1 + \exp_after:wN 1 } \cs_new:Npn \__fp_parse_excl_error: { @@ -11922,7 +12238,7 @@ { \if_case:w \if_catcode:w \scan_stop: \exp_not:N #7 - \c_four + 4 \exp_stop_f: \else: \__int_eval:w `#7 - `< \__int_eval_end: \fi: @@ -11962,12 +12278,13 @@ { \if_int_odd:w \if_meaning:w \c_zero_fp #3 - \c_zero + 0 \else: \if_case:w \__fp_compare_back:ww #8 #2 \exp_stop_f: #5 \or: #6 \or: #7 \else: #4 \fi: \fi: + \exp_stop_f: \exp_after:wN \__fp_parse_apply_compare_aux:NNwN \exp_after:wN \c_one_fp \else: @@ -12007,7 +12324,7 @@ { \__fp_new_function:Ncfnn #1 { __fp_user_ \cs_to_str:N #1 } - { \int_eval:n { \tl_count:n {#2} / \c_two } } + { \int_eval:n { \tl_count:n {#2} / 2 } } {#2} } \cs_new_protected:Npn \__fp_new_function:NNnnn #1#2#3#4#5 @@ -12127,7 +12444,7 @@ \if_int_compare:w #4 < #1 - \fi: 1 \fi: \else: - \if_int_compare:w #1#4 = \c_zero + \if_int_compare:w #1#4 = 0 \exp_stop_f: 0 \else: 1 @@ -12135,7 +12452,7 @@ \fi: \exp_stop_f: } -\cs_new:Npn \__fp_compare_nan:w #1 \exp_stop_f: { \c_two } +\cs_new:Npn \__fp_compare_nan:w #1 \fi: \exp_stop_f: { 2 \exp_stop_f: } \cs_new:Npn \__fp_compare_npos:nwnw #1#2; #3#4; { \if_int_compare:w #1 = #3 \exp_stop_f: @@ -12294,7 +12611,7 @@ \__fp_compare_back:ww \s__fp \__fp_chk:w #4#5; \s__fp \__fp_chk:w #2#3; - = #1 \c_one + = #1 1 \exp_stop_f: \__fp_minmax_auxii:ww \else: \__fp_minmax_auxi:ww @@ -12359,12 +12676,12 @@ \cs_new:Npn \__fp_ternary_loop_break:w #1 \fi: #2 \__fp_ternary_break_point:n #3 { - \c_zero = \c_zero \fi: + 0 = 0 \exp_stop_f: \fi: \exp_after:wN \__fp_ternary_auxii:NwwN } \cs_new:Npn \__fp_ternary_loop:Nw \s__fp \__fp_chk:w #1#2; { - \if_int_compare:w #1 > \c_zero + \if_int_compare:w #1 > 0 \exp_stop_f: \exp_after:wN \__fp_ternary_map_break: \fi: \__fp_ternary_loop:Nw @@ -12388,7 +12705,7 @@ } %% File: l3fp-basics.dtx Copyright (C) 2011-2014,2016 The LaTeX3 Project \cs_new:Npn \__fp_basics_pack_low:NNNNNw #1 #2#3#4#5 #6; - { + #1 - \c_one ; {#2#3#4#5} {#6} ; } + { + #1 - 1 ; {#2#3#4#5} {#6} ; } \cs_new:Npn \__fp_basics_pack_high:NNNNNw #1 #2#3#4#5 #6; { \if_meaning:w 2 #1 @@ -12397,11 +12714,11 @@ ; {#2#3#4#5} {#6} } \cs_new:Npn \__fp_basics_pack_high_carry:w \fi: ; #1 - { \fi: + \c_one ; {1000} } + { \fi: + 1 ; {1000} } \cs_new:Npn \__fp_basics_pack_weird_low:NNNNw #1 #2#3#4 #5; { \if_meaning:w 2 #1 - + \c_one + + 1 \fi: \__int_eval_end: #2#3#4; {#5} ; @@ -12418,14 +12735,15 @@ { \if_case:w \if_meaning:w #2 #4 - #2 \exp_stop_f: + #2 \else: \if_int_compare:w #2 > #4 \exp_stop_f: - \c_three + 3 \else: - \c_four + 4 \fi: \fi: + \exp_stop_f: \exp_after:wN \__fp_add_zeros_o:Nww \__int_value:w \or: \exp_after:wN \__fp_add_normal_o:Nww \__int_value:w \or: \exp_after:wN \__fp_add_inf_o:Nww \__int_value:w @@ -12517,7 +12835,7 @@ \cs_new:Npn \__fp_add_significand_pack:NNNNNNN #1 #2#3#4#5#6#7 { \if_meaning:w 2 #1 - + \c_one + + 1 \fi: ; #2 #3 #4 #5 #6 #7 ; } @@ -12542,7 +12860,7 @@ \cs_new:Npn \__fp_add_significand_carry_o:wwwNN #1; #2; #3#4; #5#6 { - + \c_one + + 1 \exp_after:wN \__fp_basics_pack_weird_high:NNNNNNNNw \__int_value:w \__int_eval:w 1 1 #1 \exp_after:wN \__fp_basics_pack_weird_low:NNNNw @@ -12568,7 +12886,7 @@ \cs_new:Npn \__fp_sub_npos_ii_o:Nnwnw #1 #2; #3; { \exp_after:wN \__fp_sub_npos_i_o:Nnwnw - \__int_value:w \__int_eval:w \c_two - #1 \__int_eval_end: + \__int_value:w \__fp_neg_sign:N #1 #3; #2; } \cs_new:Npn \__fp_sub_npos_i_o:Nnwnw #1 #2#3; #4#5; @@ -12581,7 +12899,7 @@ \exp_after:wN \__fp_sub_back_near_o:nnnnnnnnN \else: \exp_after:wN \__fp_decimate:nNnnnn \exp_after:wN - { \__int_value:w \__int_eval:w #2 - #4 - \c_one \exp_after:wN } + { \__int_value:w \__int_eval:w #2 - #4 - 1 \exp_after:wN } \exp_after:wN \__fp_sub_back_far_o:NnnwnnnnN \fi: #5 @@ -12591,7 +12909,7 @@ \cs_new:Npn \__fp_sub_back_near_o:nnnnnnnnN #1#2#3#4 #5#6#7#8 #9 { \exp_after:wN \__fp_sub_back_near_after:wNNNNw - \__int_value:w \__int_eval:w 10#5#6 - #1#2 - \c_eleven + \__int_value:w \__int_eval:w 10#5#6 - #1#2 - 11 \exp_after:wN \__fp_sub_back_near_pack:NNNNNNw \__int_value:w \__int_eval:w 11#7#8 - #3#4 \exp_after:wN ; } @@ -12612,7 +12930,7 @@ \cs_new:Npn \__fp_sub_back_shift_ii:ww #1 0 ; #2#3 ; { \if_meaning:w @ #1 @ - - \c_seven + - 7 - \exp_after:wN \use_i:nnn \exp_after:wN \__fp_sub_back_shift_iii:NNNNNNNNw \__int_value:w #2#3 0 ~ 123456789; @@ -12633,13 +12951,14 @@ \if_case:w \if_int_compare:w 1 #2 = #5#6 \use_i:nnnn #7 \exp_stop_f: \if_int_compare:w #3 = \use_none:n #7#8 0 \exp_stop_f: - \c_zero + 0 \else: - \if_int_compare:w #3 > \use_none:n #7#8 0 - \fi: \c_one + \if_int_compare:w #3 > \use_none:n #7#8 0 - \fi: 1 \fi: \else: - \if_int_compare:w 1 #2 > #5#6 \use_i:nnnn #7 - \fi: \c_one + \if_int_compare:w 1 #2 > #5#6 \use_i:nnnn #7 - \fi: 1 \fi: + \exp_stop_f: \exp_after:wN \__fp_sub_back_quite_far_o:wwNN \or: \exp_after:wN \__fp_sub_back_very_far_o:wwwwNN \else: \exp_after:wN \__fp_sub_back_not_far_o:wwwwNN @@ -12660,13 +12979,13 @@ \exp_after:wN \use_ii:nn \fi: { ; {1000} {0000} {0000} {0000} ; } - { - \c_one ; {9999} {9999} {9999} {9999} ; } + { - 1 ; {9999} {9999} {9999} {9999} ; } } \cs_new:Npn \__fp_sub_back_not_far_o:wwwwNN #1 ~ #2; #3 ~ #4; #5#6 { - - \c_one + - 1 \exp_after:wN \__fp_sub_back_near_after:wNNNNw - \__int_value:w \__int_eval:w 1#30 - #1 - \c_eleven + \__int_value:w \__int_eval:w 1#30 - #1 - 11 \exp_after:wN \__fp_sub_back_near_pack:NNNNNNw \__int_value:w \__int_eval:w 11 0000 0000 + #40 - #2 - \exp_after:wN \__fp_round_neg:NNN @@ -12684,7 +13003,7 @@ \cs_new:Npn \__fp_sub_back_very_far_ii_o:nnNwwNN #1#2 ; #3 ; #4 ~ #5; #6#7 { \exp_after:wN \__fp_basics_pack_high:NNNNNw - \__int_value:w \__int_eval:w 1#4 - #1 - \c_one + \__int_value:w \__int_eval:w 1#4 - #1 - 1 \exp_after:wN \__fp_basics_pack_low:NNNNNw \__int_value:w \__int_eval:w 2#5 - #2 - \exp_after:wN \__fp_round_neg:NNN @@ -12699,7 +13018,7 @@ { \__fp_mul_cases_o:NnNnww * - { - \c_two + } + { - 2 + } \__fp_mul_npos_o:Nww { } } @@ -12707,24 +13026,24 @@ #1#2#3#4 \s__fp \__fp_chk:w #5#6#7; \s__fp \__fp_chk:w #8#9 { \if_case:w \__int_eval:w - \if_int_compare:w #5 #8 = \c_eleven - \c_one + \if_int_compare:w #5 #8 = 11 ~ + 1 \else: \if_meaning:w 3 #8 - \c_three + 3 \else: \if_meaning:w 3 #5 - \c_two + 2 \else: - \if_int_compare:w #5 #8 = \c_ten - \c_nine #2 - \c_two + \if_int_compare:w #5 #8 = 10 ~ + 9 #2 - 2 \else: - (#5 #2 #8) / \c_two * \c_two + \c_seven + (#5 #2 #8) / 2 * 2 + 7 \fi: \fi: \fi: \fi: - \if_meaning:w #6 #9 - \c_one \fi: + \if_meaning:w #6 #9 - 1 \fi: \__int_eval_end: \__fp_case_use:nw { #3 0 } \or: \__fp_case_use:nw { #3 2 } @@ -12795,7 +13114,7 @@ } \cs_new:Npn \__fp_mul_significand_small_f:NNwwwN #1 #2#3; #4#5; #6; + #7 { - - \c_one + - 1 \exp_after:wN \__fp_basics_pack_high:NNNNNw \__int_value:w \__int_eval:w 1#3#4 \exp_after:wN \__fp_basics_pack_low:NNNNNw @@ -12828,7 +13147,7 @@ \__int_value:w \__int_eval:w #3 - #6 \exp_after:wN \__fp_div_significand_i_o:wnnw - \__int_value:w \__int_eval:w #7 \use_i:nnnn #8 + \c_one ; + \__int_value:w \__int_eval:w #7 \use_i:nnnn #8 + 1 ; #4 {#7}{#8}#9 ; #1 @@ -12899,13 +13218,13 @@ { 0 \exp_after:wN \__fp_div_significand_iv:wwnnnnnnn - \__int_value:w \__int_eval:w (\c_two * #2 #3) / #6 #7 ; % <- P + \__int_value:w \__int_eval:w ( 2 * #2 #3) / #6 #7 ; % <- P #2 ; {#3} {#4} {#5} {#6} {#7} } \cs_new:Npn \__fp_div_significand_iv:wwnnnnnnn #1; #2;#3#4#5 #6#7#8#9 { - + \c_five * #1 + + 5 * #1 \exp_after:wN \__fp_div_significand_vi:Nw \__int_value:w \__int_eval:w -20 + 2*#2#3 - #1*#6#7 + \exp_after:wN \__fp_div_significand_v:NN @@ -12917,9 +13236,9 @@ \cs_new:Npn \__fp_div_significand_vi:Nw #1#2; { \if_meaning:w 0 #1 - \if_int_compare:w \__int_eval:w #2 > \c_zero + \c_one \fi: + \if_int_compare:w \__int_eval:w #2 > 0 + 1 \fi: \else: - \if_meaning:w - #1 - \else: + \fi: \c_one + \if_meaning:w - #1 - \else: + \fi: 1 \fi: ; } @@ -12946,7 +13265,7 @@ \cs_new:Npn \__fp_div_significand_large_o:wwwNNNNwN #1; #2; #3; #4#5#6#7#8; #9 { - + \c_one + + 1 \exp_after:wN \__fp_basics_pack_weird_high:NNNNNNNNw \__int_value:w \__int_eval:w 1 #1 #2 \exp_after:wN \__fp_basics_pack_weird_low:NNNNw @@ -12975,12 +13294,12 @@ \if_int_odd:w #1 \exp_stop_f: \exp_after:wN \__fp_sqrt_npos_auxi_o:wwnnN \fi: - #1 / \c_two + #1 / 2 \__fp_sqrt_Newton_o:wwn 56234133; 0; {#2#3} {#4#5} 0 } -\cs_new:Npn \__fp_sqrt_npos_auxi_o:wwnnN #1 / \c_two #2; 0; #3#4#5 +\cs_new:Npn \__fp_sqrt_npos_auxi_o:wwnnN #1 / 2 #2; 0; #3#4#5 { - ( #1 + \c_one ) / \c_two + ( #1 + 1 ) / 2 \__fp_pack_eight:wNNNNNNNN \__fp_sqrt_npos_auxii_o:wNNNNNNNN ; @@ -12996,7 +13315,7 @@ \exp_after:wN \__fp_use_none_until_s:w \fi: \exp_after:wN \__fp_sqrt_Newton_o:wwn - \__int_value:w \__int_eval:w (#1 + #3 * 1 0000 0000 / #1) / \c_two ; + \__int_value:w \__int_eval:w (#1 + #3 * 1 0000 0000 / #1) / 2 ; #1; {#3} } \cs_new:Npn \__fp_sqrt_auxi_o:NNNNwnnN 1 #1#2#3#4#5; @@ -13043,15 +13362,15 @@ \cs_new:Npn \__fp_sqrt_auxiii_o:wnnnnnnnn #1; #2#3#4#5#6#7#8#9 { - \if_int_compare:w #1 > \c_one + \if_int_compare:w #1 > 1 \exp_stop_f: \exp_after:wN \__fp_sqrt_auxiv_o:NNNNNw \__int_value:w \__int_eval:w (#1#2 %) \else: - \if_int_compare:w #1#2 > \c_one + \if_int_compare:w #1#2 > 1 \exp_stop_f: \exp_after:wN \__fp_sqrt_auxv_o:NNNNNw \__int_value:w \__int_eval:w (#1#2#3 %) \else: - \if_int_compare:w #1#2#3 > \c_one + \if_int_compare:w #1#2#3 > 1 \exp_stop_f: \exp_after:wN \__fp_sqrt_auxvi_o:NNNNNw \__int_value:w \__int_eval:w (#1#2#3#4 %) \else: @@ -13069,7 +13388,7 @@ { \__fp_sqrt_auxviii_o:nnnnnnn {0000000#1} {#2#3#4#5#6} } \cs_new:Npn \__fp_sqrt_auxvii_o:NNNNNw 1#1#2#3#4#5#6; { - \if_int_compare:w #1#2 = \c_zero + \if_int_compare:w #1#2 = 0 \exp_stop_f: \exp_after:wN \__fp_sqrt_auxx_o:Nnnnnnnn \fi: \__fp_sqrt_auxviii_o:nnnnnnn {00000000} {000#1#2#3#4#5} @@ -13100,15 +13419,15 @@ \__fp_sqrt_auxii_o:NnnnnnnnN \__fp_sqrt_auxxii_o:nnnnnnnnw #2 {#1} - {#3} { #4 + \c_one } #5 + {#3} { #4 + 1 } #5 } \cs_new:Npn \__fp_sqrt_auxxii_o:nnnnnnnnw 0; #1#2#3#4#5#6#7#8 #9; { - \if_int_compare:w #1#2 > \c_zero - \if_int_compare:w #1#2 = \c_one - \if_int_compare:w #3#4 = \c_zero - \if_int_compare:w #5#6 = \c_zero - \if_int_compare:w #7#8 = \c_zero + \if_int_compare:w #1#2 > 0 \exp_stop_f: + \if_int_compare:w #1#2 = 1 \exp_stop_f: + \if_int_compare:w #3#4 = 0 \exp_stop_f: + \if_int_compare:w #5#6 = 0 \exp_stop_f: + \if_int_compare:w #7#8 = 0 \exp_stop_f: \__fp_sqrt_auxxiii_o:w \fi: \fi: @@ -13134,7 +13453,7 @@ \exp_after:wN \__fp_basics_pack_low:NNNNNw \__int_value:w \__int_eval:w 1 0000 0000 + #4#5 - \if_int_compare:w #6 > #1 \exp_stop_f: + \c_one \fi: + \if_int_compare:w #6 > #1 \exp_stop_f: + 1 \fi: + \exp_after:wN \__fp_round:NNN \exp_after:wN 0 \exp_after:wN 0 @@ -13161,7 +13480,7 @@ \cs_new:Npn \__fp_fixed_add_one:wN #1#2; #3 { \exp_after:wN #3 \exp_after:wN - { \__int_value:w \__int_eval:w \c_ten_thousand + #1 } #2 ; + { \__int_value:w \__int_eval:w \c__fp_myriad_int + #1 } #2 ; } \cs_new:Npn \__fp_fixed_div_myriad:wn #1#2#3#4#5#6; { @@ -13192,14 +13511,14 @@ \exp_after:wN \__fp_pack:NNNNNw \__int_value:w \__int_eval:w \c__fp_trailing_shift_int + #4*#9 + #5*#8 + #6*#7 - + ( #5*#9 + #6*#8 + #6*#9 / \c_ten_thousand ) - / \c_ten_thousand ; ; + + ( #5*#9 + #6*#8 + #6*#9 / \c__fp_myriad_int ) + / \c__fp_myriad_int ; ; } \cs_new:Npn \__fp_fixed_div_int:wwN #1#2#3#4#5#6 ; #7 ; #8 { \exp_after:wN \__fp_fixed_div_int_after:Nw \exp_after:wN #8 - \__int_value:w \__int_eval:w - \c_one + \__int_value:w \__int_eval:w - 1 \__fp_fixed_div_int:wnN #1; {#7} \__fp_fixed_div_int_auxi:wnn #2; {#7} \__fp_fixed_div_int_auxi:wnn @@ -13211,7 +13530,7 @@ \cs_new:Npn \__fp_fixed_div_int:wnN #1; #2 #3 { \exp_after:wN #3 - \__int_value:w \__int_eval:w #1 / #2 - \c_one ; + \__int_value:w \__int_eval:w #1 / #2 - 1 ; {#2} {#1} } @@ -13223,7 +13542,7 @@ \exp_after:wN \__fp_fixed_div_int:wnN \__int_value:w \__int_eval:w #3 - #1*#2 \__int_eval_end: } -\cs_new:Npn \__fp_fixed_div_int_auxii:wnn #1; #2 #3 { + #1 + \c_two ; } +\cs_new:Npn \__fp_fixed_div_int_auxii:wnn #1; #2 #3 { + #1 + 2 ; } \cs_new:Npn \__fp_fixed_div_int_pack:Nw #1 #2; { + #1; {#2} } \cs_new:Npn \__fp_fixed_div_int_after:Nw #1 #2; { #1 {#2} } \cs_new:Npn \__fp_fixed_add:wwn { \__fp_fixed_add:Nnnnnwnn + } @@ -13270,7 +13589,7 @@ } \cs_new:Npn \__fp_fixed_mul:nnnnnnnw #1#2 #3#4 #5#6 #7#8 ; { - #1*#4 + #2*#3 + #5*#8 + #6*#7 ) / \c_ten_thousand + #1*#4 + #2*#3 + #5*#8 + #6*#7 ) / \c__fp_myriad_int + #1*#3 + #5*#7 ; ; } \cs_new:Npn \__fp_fixed_mul_add:wwwn #1; #2; #3#4#5#6#7#8; @@ -13330,14 +13649,14 @@ \cs_new:Npn \__fp_fixed_mul_add:nnnnwnnwN #1#2 #3#4#5; #6#7#8; #9 { #9 (#4* #1 *#7) - #9 (#5*#6+#4* #2 *#7+#3*#8) / \c_ten_thousand + #9 (#5*#6+#4* #2 *#7+#3*#8) / \c__fp_myriad_int } \cs_new:Npn \__fp_ep_to_fixed:wwn #1,#2 { \exp_after:wN \__fp_ep_to_fixed_auxi:www \__int_value:w \__int_eval:w 1 0000 0000 + #2 \exp_after:wN ; \exp:w \exp_end_continue_f:w - \prg_replicate:nn { \c_four - \int_max:nn {#1} { -32 } } { 0 } ; + \prg_replicate:nn { 4 - \int_max:nn {#1} { -32 } } { 0 } ; } \cs_new:Npn \__fp_ep_to_fixed_auxi:www 1#1; #2; #3#4#5#6#7; { @@ -13353,7 +13672,7 @@ \cs_new:Npn \__fp_ep_to_ep:wwN #1,#2#3#4#5#6#7; #8 { \exp_after:wN #8 - \__int_value:w \__int_eval:w #1 + \c_four + \__int_value:w \__int_eval:w #1 + 4 \exp_after:wN \use_i:nn \exp_after:wN \__fp_ep_to_ep_loop:N \__int_value:w \__int_eval:w 1 0000 0000 + #2 \__int_eval_end: @@ -13362,7 +13681,7 @@ \cs_new:Npn \__fp_ep_to_ep_loop:N #1 { \if_meaning:w 0 #1 - - \c_one + - 1 \else: \__fp_ep_to_ep_end:www #1 \fi: @@ -13373,7 +13692,7 @@ { \fi: \if_meaning:w ; #1 - - \c_two * \c__fp_max_exponent_int + - 2 * \c__fp_max_exponent_int \__fp_ep_to_ep_zero:ww \fi: \__fp_pack_twice_four:wNNNNNNNN @@ -13426,9 +13745,9 @@ \cs_new:Npn \__fp_ep_div_esti:wwwwn #1,#2#3; #4, { \exp_after:wN \__fp_ep_div_estii:wwnnwwn - \__int_value:w \__int_eval:w 10 0000 0000 / ( #2 + \c_one ) + \__int_value:w \__int_eval:w 10 0000 0000 / ( #2 + 1 ) \exp_after:wN ; - \__int_value:w \__int_eval:w #4 - #1 + \c_one , + \__int_value:w \__int_eval:w #4 - #1 + 1 , {#2} #3; } \cs_new:Npn \__fp_ep_div_estii:wwnnwwn #1; #2,#3#4#5; #6; #7 @@ -13477,8 +13796,8 @@ \exp_after:wN \__fp_ep_isqrt_auxii:wwnnnwn \__int_value:w \__int_eval:w \int_if_odd:nTF {#1} - { (\c_one - #1) / \c_two , 535 , { 0 } { } } - { \c_one - #1 / \c_two , 168 , { } { 0 } } + { (1 - #1) / 2 , 535 , { 0 } { } } + { 1 - #1 / 2 , 168 , { } { 0 } } } \cs_new:Npn \__fp_ep_isqrt_auxii:wwnnnwn #1, #2, #3#4 #5#6; #7 { @@ -13492,13 +13811,13 @@ \fi: \exp_after:wN \__fp_ep_isqrt_esti:wwwnnwn \__int_value:w \__int_eval:w - (#1 + 1 0050 0000 #4 / (#1 * #3)) / \c_two , + (#1 + 1 0050 0000 #4 / (#1 * #3)) / 2 , #1, #3, {#4} } \cs_new:Npn \__fp_ep_isqrt_estii:wwwnnwn #1, #2, #3, #4#5 { \exp_after:wN \__fp_ep_isqrt_estiii:NNNNNwwwn - \__int_value:w \__int_eval:w 1000 0000 + #2 * #2 #5 * \c_five + \__int_value:w \__int_eval:w 1000 0000 + #2 * #2 #5 * 5 \exp_after:wN , \__int_value:w \__int_eval:w 10000 + #2 ; } \cs_new:Npn \__fp_ep_isqrt_estiii:NNNNNwwwn 1#1#2#3#4#5#6, 1#7#8; #9; @@ -13538,7 +13857,7 @@ \cs_new:Npn \__fp_fixed_to_float:Nw #1#2; { \__fp_fixed_to_float:wN #2; #1 } \cs_new:Npn \__fp_fixed_to_float:wN #1#2#3#4#5#6; #7 { - + \__int_eval:w \c_four % for the 8-digit-at-the-start thing. + + \__int_eval:w \c__fp_block_int % for the 8-digit-at-the-start thing. \exp_after:wN \exp_after:wN \exp_after:wN \__fp_fixed_to_loop:N \exp_after:wN \use_none:n @@ -13553,7 +13872,7 @@ \cs_new:Npn \__fp_fixed_to_loop:N #1 { \if_meaning:w 0 #1 - - \c_one + - 1 \exp_after:wN \__fp_fixed_to_loop:N \else: \exp_after:wN \__fp_fixed_to_loop_end:w @@ -13574,12 +13893,12 @@ } \cs_new:Npn \__fp_fixed_to_float_zero:w ; 0000 0000 0000 0000 ; { - - \c_two * \c__fp_max_exponent_int ; + - 2 * \c__fp_max_exponent_int ; {0000} {0000} {0000} {0000} ; } \cs_new:Npn \__fp_fixed_to_float_pack:ww #1 ; #2#3 ; ; { - \if_int_compare:w #2 > \c_four + \if_int_compare:w #2 > 4 \exp_stop_f: \exp_after:wN \__fp_fixed_to_float_round_up:wnnnnw \fi: ; #1 ; @@ -13589,9 +13908,9 @@ \exp_after:wN \__fp_basics_pack_high:NNNNNw \__int_value:w \__int_eval:w 1 #1#2 \exp_after:wN \__fp_basics_pack_low:NNNNNw - \__int_value:w \__int_eval:w 1 #3#4 + \c_one ; + \__int_value:w \__int_eval:w 1 #3#4 + 1 ; } -%% File: l3fp-expo.dtx Copyright (C) 2011-2014,2016 The LaTeX3 Project +%% File: l3fp-expo.dtx Copyright (C) 2011-2014,2016,2017 The LaTeX3 Project \tl_const:Nn \c__fp_ln_i_fixed_tl { {0000}{0000}{0000}{0000}{0000}{0000} } \tl_const:Nn \c__fp_ln_ii_fixed_tl { {6931}{4718}{0559}{9453}{0941}{7232} } \tl_const:Nn \c__fp_ln_iii_fixed_tl {{10986}{1228}{8668}{1096}{9139}{5245} } @@ -13619,7 +13938,7 @@ { %^^A todo: ln(1) should be "exact zero", not "underflow" \exp_after:wN \__fp_sanitize:Nw \__int_value:w % for the overall sign - \if_int_compare:w #1 < \c_one + \if_int_compare:w #1 < 1 \exp_stop_f: 2 \else: 0 @@ -13635,8 +13954,8 @@ \__int_value:w \if_case:w #1 \exp_stop_f: \or: - \if_int_compare:w #2 < \c_four - \__int_eval:w \c_ten - #2 + \if_int_compare:w #2 < 4 \exp_stop_f: + \__int_eval:w 10 - #2 \else: 6 \fi: @@ -13666,7 +13985,7 @@ { #1#2; {#3#4#5#6} {#7} } \cs_new:Npn \__fp_ln_x_iii_var:NNNNNw #1 #2#3#4#5 #6; { - #1#2#3#4#5 + \c_one ; + #1#2#3#4#5 + 1 ; {#1#2#3#4#5} {#6} } \cs_new:Npn \__fp_ln_x_iv:wnnnnnnnn #1; #2#3#4#5 #6#7#8#9 @@ -13761,7 +14080,7 @@ { \__fp_ln_Taylor_loop:www 21 ; {0000}{0000}{0000}{0000}{0000}{0000} ; } \cs_new:Npn \__fp_ln_Taylor_loop:www #1; #2; #3; { - \if_int_compare:w #1 = \c_one + \if_int_compare:w #1 = 1 \exp_stop_f: \__fp_ln_Taylor_break:w \fi: \exp_after:wN \__fp_fixed_div_int:wwN \c__fp_one_fixed_tl ; #1; @@ -13769,7 +14088,7 @@ \__fp_fixed_mul:wwn #3; { \exp_after:wN \__fp_ln_Taylor_loop:www - \__int_value:w \__int_eval:w #1 - \c_two ; + \__int_value:w \__int_eval:w #1 - 2 ; } #3; } @@ -13791,11 +14110,11 @@ \cs_new:Npn \__fp_ln_exponent:wn #1; #2 { \if_case:w #2 \exp_stop_f: - \c_zero \__fp_case_return:nw { \__fp_fixed_to_float:Nw 2 } + 0 \__fp_case_return:nw { \__fp_fixed_to_float:Nw 2 } \or: \exp_after:wN \__fp_ln_exponent_one:ww \__int_value:w \else: - \if_int_compare:w #2 > \c_zero + \if_int_compare:w #2 > 0 \exp_stop_f: \exp_after:wN \__fp_ln_exponent_small:NNww \exp_after:wN 0 \exp_after:wN \__fp_fixed_sub:wwn \__int_value:w @@ -13809,13 +14128,13 @@ } \cs_new:Npn \__fp_ln_exponent_one:ww 1; #1; { - \c_zero + 0 \exp_after:wN \__fp_fixed_sub:wwn \c__fp_ln_x_fixed_tl ; #1; \__fp_fixed_to_float:wN 0 } \cs_new:Npn \__fp_ln_exponent_small:NNww #1#2#3; #4#5#6#7#8#9; { - \c_four + 4 \exp_after:wN \__fp_fixed_mul:wwn \c__fp_ln_x_fixed_tl ; {#3}{0000}{0000}{0000}{0000}{0000} ; @@ -13856,29 +14175,29 @@ \exp_after:wN \__fp_sanitize:Nw \exp_after:wN 0 \__int_value:w #1 \__int_eval:w - \if_int_compare:w #4 < - \c_eight - \c_one + \if_int_compare:w #4 < - \c__fp_half_prec_int + 1 \exp_after:wN \__fp_add_big_i_o:wNww - \__int_value:w \__int_eval:w \c_one - #4 ; + \__int_value:w \__int_eval:w 1 - #4 ; 0 {1000}{0000}{0000}{0000} ; #5; \exp:w \else: - \if_int_compare:w #4 > \c_five % cf \c__fp_max_exponent_int + \if_int_compare:w #4 > \c__fp_max_exp_exponent_int \exp_after:wN \__fp_exp_overflow: \exp:w \else: - \if_int_compare:w #4 < \c_zero + \if_int_compare:w #4 < 0 \exp_stop_f: \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn \fi: { - \c_zero + 0 \__fp_decimate:nNnnnn { - #4 } \__fp_exp_Taylor:Nnnwn } { - \__fp_decimate:nNnnnn { \c_sixteen - #4 } + \__fp_decimate:nNnnnn { \c__fp_prec_int - #4 } \__fp_exp_pos_large:NnnNwn } #5 @@ -13887,10 +14206,10 @@ \exp:w \fi: \fi: - \exp_after:wN \c_zero + \exp_after:wN \exp_end: } \cs_new:Npn \__fp_exp_overflow: - { + \c_two * \c__fp_max_exponent_int ; {1000} {0000} {0000} {0000} ; } + { + 2 * \c__fp_max_exponent_int ; {1000} {0000} {0000} {0000} ; } \cs_new:Npn \__fp_exp_Taylor:Nnnwn #1#2#3 #4; #5 #6 { #6 @@ -13904,7 +14223,7 @@ { \__fp_exp_Taylor_loop:www 10 ; #1 ; #1 ; \s__stop } \cs_new:Npn \__fp_exp_Taylor_loop:www #1; #2; #3; { - \if_int_compare:w #1 = \c_one + \if_int_compare:w #1 = 1 \exp_stop_f: \exp_after:wN \__fp_exp_Taylor_break:Nww \fi: \__fp_fixed_div_int:wwN #3 ; #1 ; @@ -14064,14 +14383,17 @@ \if_meaning:w #1 #4 \__fp_case_return_o:Nw \c_zero_fp \fi: - \if_meaning:w 0 #1 + \if_meaning:w 2 #1 + \__fp_case_return_o:Nw \c_inf_fp + \fi: + \if_meaning:w 2 #3 + \__fp_case_return_o:Nw \c_inf_fp + \else: \__fp_case_use:nw { \__fp_division_by_zero_o:NNww \c_inf_fp ^ \s__fp \__fp_chk:w #1 #2 ; } - \else: - \__fp_case_return_o:Nw \c_inf_fp \fi: \s__fp \__fp_chk:w #3#4 } @@ -14079,7 +14401,7 @@ \s__fp \__fp_chk:w 1 #1#2#3; \s__fp \__fp_chk:w #4#5 { \if_int_compare:w \__str_if_eq_x:nn { #2 #3 } - { 1 {1000} {0000} {0000} {0000} } = \c_zero + { 1 {1000} {0000} {0000} {0000} } = 0 \exp_stop_f: \if_int_compare:w #4 #1 = 32 \exp_stop_f: \exp_after:wN \__fp_case_return_ii_o:ww \fi: @@ -14091,7 +14413,7 @@ \exp_after:wN #5 \or: \if_meaning:w 2 #5 \exp_after:wN \reverse_if:N \fi: - \if_int_compare:w #2 > \c_zero + \if_int_compare:w #2 > 0 \exp_stop_f: \exp_after:wN \__fp_case_return_o:Nww \exp_after:wN \c_inf_fp \else: @@ -14109,7 +14431,7 @@ \exp_after:wN \__fp_sanitize:Nw \exp_after:wN 0 \__int_value:w - \if:w #1 \if_int_compare:w #3 > \c_zero 0 \else: 2 \fi: + \if:w #1 \if_int_compare:w #3 > 0 \exp_stop_f: 0 \else: 2 \fi: \exp_after:wN \__fp_pow_npos_aux:NNnww \exp_after:wN + \exp_after:wN \__fp_fixed_to_float:wN @@ -14132,7 +14454,7 @@ } \cs_new:Npn \__fp_pow_exponent:wnN #1; #2 { - \if_int_compare:w #2 > \c_zero + \if_int_compare:w #2 > 0 \exp_stop_f: \exp_after:wN \__fp_pow_exponent:Nwnnnnnw % n\ln(10) - (-\ln(x)) \exp_after:wN + \else: @@ -14164,7 +14486,7 @@ } \cs_new:Npn \__fp_pow_B:wwN #1#2#3#4#5#6; #7; { - \if_int_compare:w #7 < \c_zero + \if_int_compare:w #7 < 0 \exp_stop_f: \exp_after:wN \__fp_pow_C_neg:w \__int_value:w - \else: \if_int_compare:w #7 < 22 \exp_stop_f: @@ -14179,7 +14501,7 @@ } \cs_new:Npn \__fp_pow_C_overflow:w #1; #2; #3 { - + \c_two * \c__fp_max_exponent_int + + 2 * \c__fp_max_exponent_int \exp_after:wN \__fp_fixed_continue:wn \c__fp_one_fixed_tl ; } \cs_new:Npn \__fp_pow_C_neg:w #1 ; 1 @@ -14200,7 +14522,7 @@ \else: \exp_after:wN \__fp_pow_C_overflow:w \__int_value:w \fi: - \__int_eval:w #1 - \c_one \exp_after:wN ; + \__int_eval:w #1 - 1 \exp_after:wN ; \fi: } \cs_new:Npn \__fp_pow_C_pack:w @@ -14210,7 +14532,7 @@ \if_case:w \__fp_pow_neg_case:w #4 ; \exp_after:wN \__fp_pow_neg_aux:wNN \or: - \if_int_compare:w \__int_eval:w #1 / \c_two = \c_one + \if_int_compare:w \__int_eval:w #1 / 2 = 1 \exp_stop_f: \__fp_invalid_operation_o:Nww ^ #3; #4; \exp:w \exp_end_continue_f:w \exp_after:wN \exp_after:wN @@ -14226,50 +14548,38 @@ \exp_after:wN \s__fp \exp_after:wN \__fp_chk:w \exp_after:wN #2 - \__int_value:w \__int_eval:w \c_two - #3 \__int_eval_end: + \__int_value:w \__int_eval:w 2 - #3 \__int_eval_end: } \cs_new:Npn \__fp_pow_neg_case:w \s__fp \__fp_chk:w #1#2#3; { \if_case:w #1 \exp_stop_f: - -\c_one + -1 \or: \__fp_pow_neg_case_aux:nnnnn #3 - \else: \c_one + \or: -1 + \else: 1 \fi: + \exp_stop_f: } \cs_new:Npn \__fp_pow_neg_case_aux:nnnnn #1#2#3#4#5 + { \__fp_pow_neg_case_aux:w #1 ; #2 #3 ; #4 #5 ; } +\cs_new:Npn \__fp_pow_neg_case_aux:w #1 ; #2 ; #3 ; { - \if_int_compare:w #1 > \c_eight - \if_int_compare:w #1 > \c_sixteen - -\c_one - \else: - \exp_after:wN \exp_after:wN - \exp_after:wN \__fp_pow_neg_case_aux:NNNNNNNNw - \prg_replicate:nn { \c_sixteen - #1 } { 0 } #4#5 ; - \fi: + \if_int_compare:w #1 > \c__fp_prec_int + -1 \else: - \if_int_compare:w #1 > \c_zero - \if_int_compare:w #4#5 = \c_zero - \exp_after:wN \exp_after:wN - \exp_after:wN \__fp_pow_neg_case_aux:NNNNNNNNw - \prg_replicate:nn { \c_eight - #1 } { 0 } #2#3 ; + \if_int_odd:w #3 \exp_stop_f: + \if_int_compare:w #1 = \c__fp_prec_int + 0 \else: - \c_one + 1 \fi: \else: - \c_one - \fi: - \fi: - } -\cs_new:Npn \__fp_pow_neg_case_aux:NNNNNNNNw #1#2#3#4#5#6#7#8#9; - { - \if_int_compare:w 0 #9 = \c_zero - \if_int_odd:w #8 \exp_stop_f: - \c_zero - \else: - -\c_one + \exp_after:wN \__fp_pow_neg_case_aux:w + \__int_value:w \__int_eval:w #1 + 1 \exp_after:wN ; + \__int_value:w \__int_eval:w (#2 + 1) / 2 - 1 \exp_after:wN ; + \__int_value:w \__int_eval:w + \if_int_odd:w #2 \exp_stop_f: 5000 0000 + \fi: #3 / 2 ; \fi: - \else: - \c_one \fi: } %% File: l3fp-trig.dtx Copyright (C) 2011-2014,2016 The LaTeX3 Project @@ -14280,7 +14590,7 @@ \or: \__fp_case_use:nw { \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww - \__fp_ep_to_float:wwN #3 \c_zero + \__fp_ep_to_float:wwN #3 0 } \or: \__fp_case_use:nw { \__fp_invalid_operation_o:fw { #1 { sin } { sind } } } @@ -14295,7 +14605,7 @@ \or: \__fp_case_use:nw { \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww - \__fp_ep_to_float:wwN 0 \c_two + \__fp_ep_to_float:wwN 0 2 } \or: \__fp_case_use:nw { \__fp_invalid_operation_o:fw { #1 { cos } { cosd } } } @@ -14310,7 +14620,7 @@ \or: \__fp_case_use:nw { \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww - \__fp_ep_inv_to_float:wwN #3 \c_zero + \__fp_ep_inv_to_float:wwN #3 0 } \or: \__fp_case_use:nw { \__fp_invalid_operation_o:fw { #1 { csc } { cscd } } } @@ -14325,7 +14635,7 @@ \or: \__fp_case_use:nw { \__fp_trig:NNNNNwn #1 \__fp_sin_series_o:NNwwww - \__fp_ep_inv_to_float:wwN 0 \c_two + \__fp_ep_inv_to_float:wwN 0 2 } \or: \__fp_case_use:nw { \__fp_invalid_operation_o:fw { #1 { sec } { secd } } } @@ -14340,7 +14650,7 @@ \or: \__fp_case_use:nw { \__fp_trig:NNNNNwn #1 - \__fp_tan_series_o:NNwwww 0 #3 \c_one + \__fp_tan_series_o:NNwwww 0 #3 1 } \or: \__fp_case_use:nw { \__fp_invalid_operation_o:fw { #1 { tan } { tand } } } @@ -14355,7 +14665,7 @@ \or: \__fp_case_use:nw { \__fp_trig:NNNNNwn #1 - \__fp_tan_series_o:NNwwww 2 #3 \c_three + \__fp_tan_series_o:NNwwww 2 #3 3 } \or: \__fp_case_use:nw { \__fp_invalid_operation_o:fw { #1 { cot } { cotd } } } @@ -14378,7 +14688,7 @@ \exp_after:wN #4 \__int_value:w \__int_eval:w #5 \exp_after:wN \exp_after:wN \exp_after:wN \exp_after:wN - \if_int_compare:w #7 > #1 \c_zero \c_one + \if_int_compare:w #7 > #1 0 1 \exp_stop_f: #1 \__fp_trig_large:ww \__fp_trigd_large:ww \else: #1 \__fp_trig_small:ww \__fp_trigd_small:ww @@ -14409,16 +14719,16 @@ { \exp_after:wN \__fp_trigd_large_auxii:wNw \__int_value:w \__int_eval:w #1 + #2 - - (#1 + #2 - \c_four) / \c_nine * \c_nine \__int_eval_end: + - (#1 + #2 - 4) / 9 * 9 \__int_eval_end: #3; #4; #5{#6#7#8#9}; } \cs_new:Npn \__fp_trigd_large_auxii:wNw #1; #2#3; { - + (#1#2 - \c_four) / \c_nine * \c_two + + (#1#2 - 4) / 9 * 2 \exp_after:wN \__fp_trigd_large_auxiii:www \__int_value:w \__int_eval:w #1#2 - - (#1#2 - \c_four) / \c_nine * \c_nine \__int_eval_end: #3 ; + - (#1#2 - 4) / 9 * 9 \__int_eval_end: #3 ; } \cs_new:Npn \__fp_trigd_large_auxiii:www #1; #2; #3! { @@ -14426,7 +14736,7 @@ \exp_after:wN \__fp_use_i_until_s:nw \exp_after:wN \__fp_fixed_continue:wn \else: - + \c_one + + 1 \fi: \__fp_fixed_sub:wwn {9000}{0000}{0000}{0000}{0000}{0000}; {#1}#2{0000}{0000}; @@ -14607,11 +14917,11 @@ \cs_new:Npn \__fp_trig_large_auxi:wwwwww #1, #2, #3, #4! { \prg_replicate:nn {#1} { \__fp_trig_large_auxii:ww } - \prg_replicate:nn { #2 - #1 * \c_eight } + \prg_replicate:nn { #2 - #1 * 8 } { \__fp_trig_large_auxiii:wNNNNNNNN } - \prg_replicate:nn { #3 - #2 * \c_eight } + \prg_replicate:nn { #3 - #2 * 8 } { \__fp_trig_large_auxiv:wN } - \prg_replicate:nn { \c_eight } { \__fp_pack_twice_four:wNNNNNNNN } + \prg_replicate:nn { 8 } { \__fp_pack_twice_four:wNNNNNNNN } \__fp_trig_large_auxv:www ; } @@ -14624,7 +14934,7 @@ \exp_after:wN \__fp_use_i_until_s:nw \exp_after:wN \__fp_trig_large_auxvii:w \__int_value:w \__int_eval:w \c__fp_leading_shift_int - \prg_replicate:nn { \c_thirteen } + \prg_replicate:nn { 13 } { \__fp_trig_large_auxvi:wnnnnnnnn } + \c__fp_trailing_shift_int - \c__fp_middle_shift_int \__fp_use_i_until_s:nw @@ -14661,7 +14971,7 @@ \exp_after:wN \__fp_use_i_until_s:nw \exp_after:wN \__fp_trig_large_auxxi:w \__int_value:w \__int_eval:w \c__fp_leading_shift_int - \prg_replicate:nn { \c_thirteen } + \prg_replicate:nn { 13 } { \__fp_trig_large_auxx:wNNNNN } + \c__fp_trailing_shift_int - \c__fp_middle_shift_int ; @@ -14670,13 +14980,13 @@ { \exp_after:wN \__fp_trig_large_pack:NNNNNw \__int_value:w \__int_eval:w \c__fp_middle_shift_int - #2 \c_eight * #3#4#5#6 + #2 8 * #3#4#5#6 #1; #2 } \cs_new:Npn \__fp_trig_large_auxxi:w #1; { \exp_after:wN \__fp_ep_mul_raw:wwwwN - \__int_value:w \__int_eval:w \c_zero \__fp_ep_to_ep_loop:N #1 ; ; ! + \__int_value:w \__int_eval:w 0 \__fp_ep_to_ep_loop:N #1 ; ; ! 0,{7853}{9816}{3397}{4483}{0961}{5661}; \__fp_trig_small:ww } @@ -14687,7 +14997,7 @@ \exp_after:wN \__fp_sin_series_aux_o:NNnwww \exp_after:wN #1 \__int_value:w - \if_int_odd:w \__int_eval:w (#3 + \c_two) / \c_four \__int_eval_end: + \if_int_odd:w \__int_eval:w (#3 + 2) / 4 \__int_eval_end: #2 \else: \if_meaning:w #2 0 2 \else: 0 \fi: @@ -14697,7 +15007,7 @@ } \cs_new:Npn \__fp_sin_series_aux_o:NNnwww #1#2#3 #4; #5,#6; { - \if_int_odd:w \__int_eval:w #3 / \c_two \__int_eval_end: + \if_int_odd:w \__int_eval:w #3 / 2 \__int_eval_end: \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -14740,7 +15050,7 @@ { \exp_after:wN \__fp_tan_series_aux_o:Nnwww \__int_value:w - \if_int_odd:w \__int_eval:w #3 / \c_two \__int_eval_end: + \if_int_odd:w \__int_eval:w #3 / 2 \__int_eval_end: \exp_after:wN \reverse_if:N \fi: \if_meaning:w #1#2 2 \else: 0 \fi: @@ -14765,7 +15075,7 @@ \__fp_fixed_mul_sub_back:wwwn#3;{10000}{0000}{0000}{0000}{0000}{0000}; { \reverse_if:N \if_int_odd:w - \__int_eval:w (#2 - \c_one) / \c_two \__int_eval_end: + \__int_eval:w (#2 - 1) / 2 \__int_eval_end: \exp_after:wN \__fp_reverse_args:Nww \fi: \__fp_ep_div:wwwwn 0, @@ -14791,7 +15101,7 @@ \cs_new:Npn \__fp_atan_dispatch_o:NNnNw #1#2#3#4#5@ { \if_case:w - \__int_eval:w \__fp_array_count:n {#5} - \c_one \__int_eval_end: + \__int_eval:w \__fp_array_count:n {#5} - 1 \__int_eval_end: \exp_after:wN #1 \exp_after:wN #4 \c_one_fp #5 \exp:w \or: #2 #4 #5 \exp:w @@ -14809,13 +15119,14 @@ \if_meaning:w 3 #5 \__fp_case_return_ii_o:ww \fi: \if_case:w \if_meaning:w #2 #5 - \if_meaning:w 1 #2 \c_ten \else: \c_zero \fi: + \if_meaning:w 1 #2 10 \else: 0 \fi: \else: - \if_int_compare:w #2 > #5 \c_one \else: \c_two \fi: + \if_int_compare:w #2 > #5 \exp_stop_f: 1 \else: 2 \fi: \fi: - \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 \c_two } - \or: \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 \c_four } - \or: \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 \c_zero } + \exp_stop_f: + \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 2 } + \or: \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 4 } + \or: \__fp_case_return:nw { \__fp_atan_inf_o:NNNw #1 #3 0 } \fi: \__fp_atan_normal_o:NNnwNnw #1 \s__fp \__fp_chk:w #2#3#4; @@ -14828,7 +15139,7 @@ \exp_after:wN \__fp_atan_combine_o:NwwwwwN \exp_after:wN #2 \__int_value:w \__int_eval:w - \if_meaning:w 2 #5 \c_seven - \fi: #3 \exp_after:wN ; + \if_meaning:w 2 #5 7 - \fi: #3 \exp_after:wN ; \c__fp_one_fixed_tl ; {0000}{0000}{0000}{0000}{0000}{0000}; 0,{0000}{0000}{0000}{0000}{0000}{0000}; #1 @@ -14846,11 +15157,11 @@ \exp_after:wN #1 \__int_value:w \__int_eval:w \if_meaning:w 2 #4 - \c_seven - \__int_eval:w + 7 - \__int_eval:w \fi: \if_int_compare:w - \__fp_ep_compare:wwww #2,#3; #5,#6; > \c_zero - \c_three - + \__fp_ep_compare:wwww #2,#3; #5,#6; > 0 \exp_stop_f: + 3 - \exp_after:wN \__fp_reverse_args:Nww \fi: \__fp_atan_div:wnwwnw #2,#3; #5,#6; @@ -14863,14 +15174,14 @@ \exp_stop_f: \exp_after:wN \__fp_atan_near:wwwn \fi: - \c_zero + 0 \__fp_ep_div:wwwwn #1,{#2}#3; #4,{#5}#6; \__fp_atan_auxi:ww } \cs_new:Npn \__fp_atan_near:wwwn - \c_zero \__fp_ep_div:wwwwn #1,#2; #3, + 0 \__fp_ep_div:wwwwn #1,#2; #3, { - \c_one + 1 \__fp_ep_to_fixed:wwn #1 - #3, #2; \__fp_atan_near_aux:wwn } @@ -14892,14 +15203,14 @@ } \cs_new:Npn \__fp_atan_Taylor_loop:www #1; #2; #3; { - \if_int_compare:w #1 = - \c_one + \if_int_compare:w #1 = -1 \exp_stop_f: \__fp_atan_Taylor_break:w \fi: \exp_after:wN \__fp_fixed_div_int:wwN \c__fp_one_fixed_tl ; #1; \__fp_rrot:www \__fp_fixed_mul_sub_back:wwwn #2; #3; { \exp_after:wN \__fp_atan_Taylor_loop:www - \__int_value:w \__int_eval:w #1 - \c_two ; + \__int_value:w \__int_eval:w #1 - 2 ; } #3; } @@ -14921,7 +15232,7 @@ \__fp_fixed_mul:wwn #3; #4; { \exp_after:wN \__fp_atan_combine_aux:ww - \__int_value:w \__int_eval:w #2 / \c_two ; #2; + \__int_value:w \__int_eval:w #2 / 2 ; #2; } } { #7 \__fp_fixed_to_float:wN \__fp_fixed_to_float_rad:wN } @@ -14958,7 +15269,7 @@ \cs_new:Npn \__fp_acos_o:w #1 \s__fp \__fp_chk:w #2#3; @ { \if_case:w #2 \exp_stop_f: - \__fp_case_use:nw { \__fp_atan_inf_o:NNNw #1 0 \c_four } + \__fp_case_use:nw { \__fp_atan_inf_o:NNNw #1 0 4 } \or: \__fp_case_use:nw { @@ -14976,7 +15287,7 @@ \cs_new:Npn \__fp_asin_normal_o:NfwNnnnnw #1#2#3 \s__fp \__fp_chk:w 1#4#5#6#7#8#9; { - \if_int_compare:w #5 < \c_one + \if_int_compare:w #5 < 1 \exp_stop_f: \exp_after:wN \__fp_use_none_until_s:w \fi: \if_int_compare:w \__int_eval:w #5 + #6#7 + #8#9 = 1000 0001 ~ @@ -15031,14 +15342,14 @@ \__fp_acsc_normal_o:NfwNnw #1 { #1 { asec } { asecd } } \__fp_reverse_args:Nww } - \or: \__fp_case_use:nw { \__fp_atan_inf_o:NNNw #1 0 \c_four } + \or: \__fp_case_use:nw { \__fp_atan_inf_o:NNNw #1 0 4 } \else: \__fp_case_return_same_o:w \fi: \s__fp \__fp_chk:w #2 #3; } \cs_new:Npn \__fp_acsc_normal_o:NfwNnw #1#2#3 \s__fp \__fp_chk:w 1#4#5#6; { - \int_compare:nNnTF {#5} < \c_one + \int_compare:nNnTF {#5} < 1 { \__fp_invalid_operation_o:fw {#2} \s__fp \__fp_chk:w 1#4{#5}#6; @@ -15071,16 +15382,15 @@ { \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_end_continue_f:w \fi: \if_case:w #1 \exp_stop_f: - \__fp_case_return:nw { 0 } + \__fp_case_return:nw { 0.000000000000000e0 } \or: \exp_after:wN \__fp_to_scientific_normal:wnnnnn \or: \__fp_case_use:nw { - \__fp_invalid_operation:nnw + \exp_args:Nf \__fp_invalid_operation:nnw { - \exp_after:wN 1 - \exp_after:wN e - \int_use:N \c__fp_max_exponent_int + \__fp_expand:n + { { 1.000000000000000e } \int_use:N \c__fp_max_exponent_int } } { fp_to_scientific } } @@ -15088,7 +15398,7 @@ \__fp_case_use:nw { \__fp_invalid_operation:nnw - { 0 } + { 0.000000000000000e0 } { fp_to_scientific } } \fi: @@ -15097,17 +15407,13 @@ \cs_new:Npn \__fp_to_scientific_normal:wnnnnn \s__fp \__fp_chk:w 1 #1 #2 #3#4#5#6 ; { - \if_int_compare:w #2 = \c_one - \exp_after:wN \__fp_to_scientific_normal:wNw - \else: - \exp_after:wN \__fp_to_scientific_normal:wNw - \exp_after:wN e - \__int_value:w \__int_eval:w #2 - \c_one - \fi: + \exp_after:wN \__fp_to_scientific_normal:wNw + \exp_after:wN e + \__int_value:w \__int_eval:w #2 - 1 ; #3 #4 #5 #6 ; } \cs_new:Npn \__fp_to_scientific_normal:wNw #1 ; #2#3; - { \__fp_trim_zeros:w #2.#3 ; #1 } + { #2.#3 #1 } \cs_new:Npn \fp_to_decimal:N #1 { \exp_after:wN \__fp_to_decimal_dispatch:w #1 } \cs_generate_variant:Nn \fp_to_decimal:N { c } @@ -15145,17 +15451,17 @@ \cs_new:Npn \__fp_to_decimal_normal:wnnnnn \s__fp \__fp_chk:w 1 #1 #2 #3#4#5#6 ; { - \int_compare:nNnTF {#2} > \c_zero + \int_compare:nNnTF {#2} > 0 { - \int_compare:nNnTF {#2} < \c_sixteen + \int_compare:nNnTF {#2} < \c__fp_prec_int { - \__fp_decimate:nNnnnn { \c_sixteen - #2 } + \__fp_decimate:nNnnnn { \c__fp_prec_int - #2 } \__fp_to_decimal_large:Nnnw } { \exp_after:wN \exp_after:wN \exp_after:wN \__fp_to_decimal_huge:wnnnn - \prg_replicate:nn { #2 - \c_sixteen } { 0 } ; + \prg_replicate:nn { #2 - \c__fp_prec_int } { 0 } ; } {#3} {#4} {#5} {#6} } @@ -15170,7 +15476,7 @@ \cs_new:Npn \__fp_to_decimal_large:Nnnw #1#2#3#4; { \exp_after:wN \__fp_trim_zeros:w \__int_value:w - \if_int_compare:w #2 > \c_zero + \if_int_compare:w #2 > 0 \exp_stop_f: #2 \fi: \exp_stop_f: @@ -15196,19 +15502,22 @@ } \cs_new:Npn \__fp_to_tl_normal:nnnnn #1 { - \if_int_compare:w #1 > \c_sixteen - \exp_after:wN \__fp_to_scientific_normal:wnnnnn - \else: - \if_int_compare:w #1 < - \c_two - \exp_after:wN \exp_after:wN - \exp_after:wN \__fp_to_scientific_normal:wnnnnn - \else: - \exp_after:wN \exp_after:wN - \exp_after:wN \__fp_to_decimal_normal:wnnnnn - \fi: - \fi: + \int_compare:nTF + { -2 <= #1 <= \c__fp_prec_int } + { \__fp_to_decimal_normal:wnnnnn } + { \__fp_to_tl_scientific:wnnnnn } \s__fp \__fp_chk:w 1 0 {#1} } +\cs_new:Npn \__fp_to_tl_scientific:wnnnnn + \s__fp \__fp_chk:w 1 #1 #2 #3#4#5#6 ; + { + \exp_after:wN \__fp_to_tl_scientific:wNw + \exp_after:wN e + \__int_value:w \__int_eval:w #2 - 1 + ; #3 #4 #5 #6 ; + } +\cs_new:Npn \__fp_to_tl_scientific:wNw #1 ; #2#3; + { \__fp_trim_zeros:w #2.#3 ; #1 } \cs_new:Npn \fp_to_dim:N #1 { \fp_to_decimal:N #1 pt } \cs_generate_variant:Nn \fp_to_dim:N { c } @@ -15239,7 +15548,7 @@ \__fp_case_return:nw { \exp_after:wN \c_zero_fp } \else: \exp_after:wN \__fp_from_dim:wNw - \__int_value:w \__int_eval:w #1 - \c_four + \__int_value:w \__int_eval:w #1 - 4 \if_meaning:w - #2 \exp_after:wN , \exp_after:wN 2 \__int_value:w \else: @@ -15373,7 +15682,7 @@ \cs_new:Npn \__fp_randint_o:Nw ? #1 @ { \if_case:w - \__int_eval:w \__fp_array_count:n {#1} - \c_one \__int_eval_end: + \__int_eval:w \__fp_array_count:n {#1} - 1 \__int_eval_end: \exp_after:wN \__fp_randint_e:w \c_one_fp #1 \or: \__fp_randint_e:w #1 \else: @@ -15389,19 +15698,19 @@ { \if_meaning:w 1 #1 \if_int_compare:w - \use_i_delimit_by_q_stop:nw #3 \q_stop > \c_sixteen - \exp_after:wN \c_one + \use_i_delimit_by_q_stop:nw #3 \q_stop > \c__fp_prec_int + 1 \exp_stop_f: \fi: \fi: } - { \c_one } + { 1 \exp_stop_f: } } \cs_new:Npn \__fp_randint_e:w #1; #2; { \if_case:w \__fp_randint_badarg:w #1; \__fp_randint_badarg:w #2; - \fp_compare:nNnTF { #1; } > { #2; } { \c_one } { \c_zero } + \fp_compare:nNnTF { #1; } > { #2; } { 1 } { 0 } \exp_stop_f: \exp_after:wN \exp_after:wN \exp_after:wN \__fp_randint_e:wnn \__fp_parse:n { #2; - #1; } { #1; } { #2; } \or: @@ -15453,7 +15762,7 @@ { \__fp_exp_after_o:w #1 ; \exp:w } } } -%% File: l3fp-assign.dtx Copyright (C) 2011-2016 The LaTeX3 project +%% File: l3fp-assign.dtx Copyright (C) 2011-2017 The LaTeX3 project \cs_new_protected:Npn \fp_new:N #1 { \cs_new_eq:NN #1 \c_zero_fp } \cs_generate_variant:Nn \fp_new:N {c} @@ -15498,6 +15807,11 @@ \cs_new_protected:Npn \fp_show:n { \__msg_show_wrap:Nn \fp_to_tl:n } \cs_generate_variant:Nn \fp_show:N { c } +\cs_new_protected:Npn \fp_log:N + { \__msg_log_next: \fp_show:N } +\cs_new_protected:Npn \fp_log:n + { \__msg_log_next: \fp_show:n } +\cs_generate_variant:Nn \fp_log:N { c } \fp_const:Nn \c_e_fp { 2.718 2818 2845 9045 } \fp_const:Nn \c_one_fp { 1 } \fp_const:Nn \c_pi_fp { 3.141 5926 5358 9793 } @@ -15507,7 +15821,7 @@ \fp_new:N \g_tmpa_fp \fp_new:N \g_tmpb_fp %% File l3sort.dtx (C) Copyright 2012,2014-2017 The LaTeX3 Project -\GetIdInfo$Id: l3sort.dtx 6847 2017-02-07 15:05:44Z bruno $ +\GetIdInfo$Id: l3sort.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Sorting functions} \int_new:N \l__sort_length_int \int_new:N \l__sort_min_int @@ -15523,33 +15837,33 @@ \cs_new_protected:Npn \__sort_shrink_range: { \int_set:Nn \l__sort_A_int - { \l__sort_true_max_int - \l__sort_min_int + \c_one } - \int_set:Nn \l__sort_block_int { \c_max_register_int / \c_two } + { \l__sort_true_max_int - \l__sort_min_int + 1 } + \int_set:Nn \l__sort_block_int { \c_max_register_int / 2 } \__sort_shrink_range_loop: \int_set:Nn \l__sort_max_int { \int_compare:nNnTF - { \l__sort_block_int * \c_three / \c_two } > \l__sort_A_int + { \l__sort_block_int * 3 / 2 } > \l__sort_A_int { \l__sort_min_int - + ( \l__sort_A_int - \c_one ) / \c_two - + \l__sort_block_int / \c_four - - \c_one + + ( \l__sort_A_int - 1 ) / 2 + + \l__sort_block_int / 4 + - 1 } - { \l__sort_true_max_int - \l__sort_block_int / \c_two } + { \l__sort_true_max_int - \l__sort_block_int / 2 } } } \cs_new_protected:Npn \__sort_shrink_range_loop: { \if_int_compare:w \l__sort_A_int < \l__sort_block_int - \tex_divide:D \l__sort_block_int \c_two + \tex_divide:D \l__sort_block_int 2 \exp_stop_f: \exp_after:wN \__sort_shrink_range_loop: \fi: } \cs_new_protected:Npn \__sort_compute_range: { - \int_set:Nn \l__sort_min_int { \tex_count:D 15 + \c_one } - \int_set:Nn \l__sort_true_max_int { \c_max_register_int + \c_one } + \int_set:Nn \l__sort_min_int { \tex_count:D 15 + 1 } + \int_set:Nn \l__sort_true_max_int { \c_max_register_int + 1 } \__sort_shrink_range: \if_meaning:w \loctoks \tex_undefined:D \else: \if_meaning:w \loctoks \scan_stop: \else: @@ -15585,8 +15899,8 @@ { \cs_gset_protected:Npn \__sort_compute_range: { - \int_set:Nn \l__sort_min_int { #1 + \c_one } - \int_set:Nn \l__sort_true_max_int { \c_max_register_int + \c_one } + \int_set:Nn \l__sort_min_int { #1 + 1 } + \int_set:Nn \l__sort_true_max_int { \c_max_register_int + 1 } \__sort_shrink_range: } } @@ -15603,12 +15917,12 @@ \__sort_too_long_error:NNw #3 #5 \fi: \tex_toks:D \l__sort_top_int {##1} - \tex_advance:D \l__sort_top_int \c_one + \int_incr:N \l__sort_top_int } \int_set:Nn \l__sort_length_int { \l__sort_top_int - \l__sort_min_int } \cs_set:Npn \__sort_compare:nn ##1 ##2 { #6 } - \int_set_eq:NN \l__sort_block_int \c_one + \int_set:Nn \l__sort_block_int { 1 } \__sort_level: \use:x { @@ -15670,7 +15984,7 @@ \if_int_compare:w #3 < \l__sort_top_int #1 #2 { \tex_the:D \tex_toks:D #3 } \exp_after:wN \__sort_toks:NNw \exp_after:wN #1 \exp_after:wN #2 - \__int_value:w \__int_eval:w #3 + \c_one \exp_after:wN ; + \__int_value:w \__int_eval:w #3 + 1 \exp_after:wN ; \fi: } \cs_new_protected:Npn \__sort_level: @@ -15695,9 +16009,9 @@ \l__sort_B_int \l__sort_A_int \l__sort_C_int \l__sort_top_int \__sort_copy_block: - \tex_advance:D \l__sort_A_int - \c_one - \tex_advance:D \l__sort_B_int - \c_one - \tex_advance:D \l__sort_C_int - \c_one + \int_decr:N \l__sort_A_int + \int_decr:N \l__sort_B_int + \int_decr:N \l__sort_C_int \exp_after:wN \__sort_merge_blocks_aux: \exp_after:wN \__sort_merge_blocks: \fi: @@ -15705,8 +16019,8 @@ \cs_new_protected:Npn \__sort_copy_block: { \tex_toks:D \l__sort_C_int \tex_toks:D \l__sort_B_int - \tex_advance:D \l__sort_C_int \c_one - \tex_advance:D \l__sort_B_int \c_one + \int_incr:N \l__sort_C_int + \int_incr:N \l__sort_B_int \if_int_compare:w \l__sort_B_int = \l__sort_end_int \use_i:nn \fi: @@ -15740,8 +16054,8 @@ \cs_new_protected:Npn \__sort_return_same: { \tex_toks:D \l__sort_B_int \tex_toks:D \l__sort_C_int - \tex_advance:D \l__sort_B_int - \c_one - \tex_advance:D \l__sort_C_int - \c_one + \int_decr:N \l__sort_B_int + \int_decr:N \l__sort_C_int \if_int_compare:w \l__sort_C_int < \l__sort_top_int \use_i:nn \fi: @@ -15750,8 +16064,8 @@ \cs_new_protected:Npn \__sort_return_swapped: { \tex_toks:D \l__sort_B_int \tex_toks:D \l__sort_A_int - \tex_advance:D \l__sort_B_int - \c_one - \tex_advance:D \l__sort_A_int - \c_one + \int_decr:N \l__sort_B_int + \int_decr:N \l__sort_A_int \if_int_compare:w \l__sort_A_int < \l__sort_begin_int \__sort_merge_blocks_end: \use_i:nn \fi: @@ -15760,8 +16074,8 @@ \cs_new_protected:Npn \__sort_merge_blocks_end: { \tex_toks:D \l__sort_B_int \tex_toks:D \l__sort_C_int - \tex_advance:D \l__sort_B_int - \c_one - \tex_advance:D \l__sort_C_int - \c_one + \int_decr:N \l__sort_B_int + \int_decr:N \l__sort_C_int \if_int_compare:w \l__sort_B_int < \l__sort_begin_int \use_i:nn \fi: @@ -15903,10 +16217,26 @@ \iow_char:N\\sort_return_swapped: ~multiple~times.~ Exactly~one~of~these~should~be~called. } -\cs_new_eq:NN \sort_ordered: \sort_return_same: -\cs_new_eq:NN \sort_reversed: \sort_return_swapped: +\cs_new_protected:Npn \sort_ordered: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \sort_ordered: } + { \token_to_str:N \sort_return_same: } + \cs_gset_eq:NN \sort_ordered: \sort_return_same: + \sort_return_same: + } +\cs_new_protected:Npn \sort_reversed: + { + \__msg_kernel_warning:nnxxx { kernel } { deprecated-command } + { 2018-12-31 } + { \token_to_str:N \sort_reversed: } + { \token_to_str:N \sort_return_swapped: } + \cs_gset_eq:NN \sort_reversed: \sort_return_swapped: + \sort_return_swapped: + } %% File: l3box.dtx Copyright (C) 2005-2016 The LaTeX3 Project -\GetIdInfo$Id: l3box.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3box.dtx 6943 2017-02-17 16:47:59Z bruno $ {L3 Experimental boxes} \cs_new_protected:Npn \box_new:N #1 { @@ -16004,39 +16334,39 @@ \cs_new_protected:Npn \box_show:N #1 { \box_show:Nnn #1 \c_max_int \c_max_int } \cs_generate_variant:Nn \box_show:N { c } -\cs_new_protected:Npn \box_show:Nnn - { \__box_show:NNnn \c_one } +\cs_new_protected:Npn \box_show:Nnn #1#2#3 + { \__box_show:NNff 1 #1 { \int_eval:n {#2} } { \int_eval:n {#3} } } \cs_generate_variant:Nn \box_show:Nnn { c } \cs_new_protected:Npn \box_log:N #1 { \box_log:Nnn #1 \c_max_int \c_max_int } \cs_generate_variant:Nn \box_log:N { c } -\cs_new_protected:Npn \box_log:Nnn #1#2#3 +\cs_new_protected:Npn \box_log:Nnn + { \exp_args:No \__box_log:nNnn { \tex_the:D \etex_interactionmode:D } } +\cs_new_protected:Npn \__box_log:nNnn #1#2#3#4 { - \use:x - { - \etex_interactionmode:D \c_zero - \__box_show:NNnn \c_zero \exp_not:N #1 - { \int_eval:n {#2} } { \int_eval:n {#3} } - \etex_interactionmode:D - = \tex_the:D \etex_interactionmode:D \scan_stop: - } + \int_set:Nn \etex_interactionmode:D { 0 } + \__box_show:NNff 0 #2 { \int_eval:n {#3} } { \int_eval:n {#4} } + \int_set:Nn \etex_interactionmode:D {#1} } \cs_generate_variant:Nn \box_log:Nnn { c } \cs_new_protected:Npn \__box_show:NNnn #1#2#3#4 { - \group_begin: - \int_set:Nn \tex_showboxbreadth:D {#3} - \int_set:Nn \tex_showboxdepth:D {#4} - \int_set_eq:NN \tex_tracingonline:D #1 - \int_set:Nn \tex_errorcontextlines:D { - \c_one } - \box_if_exist:NTF #2 - { \tex_showbox:D \use:n {#2} } - { - \__msg_kernel_error:nnx { kernel } { variable-not-defined } - { \token_to_str:N #2 } - } - \group_end: + \box_if_exist:NTF #2 + { + \group_begin: + \int_set:Nn \tex_showboxbreadth:D {#3} + \int_set:Nn \tex_showboxdepth:D {#4} + \int_set:Nn \tex_tracingonline:D {#1} + \int_set:Nn \tex_errorcontextlines:D { -1 } + \tex_showbox:D \use:n {#2} + \group_end: + } + { + \__msg_kernel_error:nnx { kernel } { variable-not-defined } + { \token_to_str:N #2 } + } } +\cs_generate_variant:Nn \__box_show:NNnn { NNff } \cs_new_protected:Npn \hbox:n #1 { \tex_hbox:D \scan_stop: {#1} } \cs_new_protected:Npn \hbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_hbox:D {#2} } @@ -16112,8 +16442,8 @@ \cs_generate_variant:Nn \vbox_unpack_clear:N { c } \cs_new_protected:Npn \vbox_set_split_to_ht:NNn #1#2#3 { \tex_setbox:D #1 \tex_vsplit:D #2 to \__dim_eval:w #3 \__dim_eval_end: } -%% File: l3coffins.dtx Copyright(C) 2010-2016 The LaTeX3 Project -\GetIdInfo$Id: l3coffins.dtx 6805 2016-12-28 22:15:52Z joseph $ +%% File: l3coffins.dtx Copyright(C) 2010-2017 The LaTeX3 Project +\GetIdInfo$Id: l3coffins.dtx 6906 2017-02-12 20:07:58Z bruno $ {L3 Coffin code layer} \box_new:N \l__coffin_internal_box \dim_new:N \l__coffin_internal_dim @@ -16891,6 +17221,9 @@ } } \cs_generate_variant:Nn \coffin_show_structure:N { c } +\cs_new_protected:Npn \coffin_log_structure:N + { \__msg_log_next: \coffin_show_structure:N } +\cs_generate_variant:Nn \coffin_log_structure:N { c } \__msg_kernel_new:nnnn { kernel } { no-pole-intersection } { No~intersection~between~coffin~poles. } { @@ -16943,7 +17276,7 @@ } } %% File: l3sys.dtx Copyright (C) 2015-2017 The LaTeX3 Project -\GetIdInfo$Id: l3sys.dtx 6811 2017-01-01 08:50:54Z joseph $ +\GetIdInfo$Id: l3sys.dtx 6976 2017-02-22 16:49:53Z stonezeng $ {L3 Experimental system/runtime functions} \str_const:Nx \c_sys_jobname_str { \tex_jobname:D } \int_const:Nn \c_sys_minute_int @@ -17006,11 +17339,8 @@ \cs_gset_eq:NN \sys_if_engine_xetex_p: \c_true_bool \str_const:Nn \c_sys_engine_str { xetex } } -\bool_if:nTF - { - \cs_if_exist_p:N \pdftex_pdfoutput:D - && \int_compare_p:nNn \pdftex_pdfoutput:D > \c_zero - } +\int_compare:nNnTF + { \cs_if_exist_use:NF \pdftex_pdfoutput:D { 0 } } > { 0 } { \cs_new_eq:NN \sys_if_output_dvi:T \use_none:n \cs_new_eq:NN \sys_if_output_dvi:F \use:n @@ -17033,16 +17363,65 @@ \cs_new_eq:NN \sys_if_output_pdf_p: \c_false_bool \str_const:Nn \c_sys_output_str { dvi } } -%% File: l3candidates.dtx Copyright (C) 2012-2016 The LaTeX3 Project -\GetIdInfo$Id: l3candidates.dtx 6835 2017-01-30 21:25:17Z bruno $ +%% File: l3deprecation.dtx (C) Copyright 2017 The LaTeX3 Project +\GetIdInfo$Id: l3deprecation.dtx 6966 2017-02-20 03:39:43Z bruno $ + {L3 Deprecation errors} +\cs_new_protected:Npn \__deprecation_error:Nnn #1#2#3 + { + \etex_protected:D \tex_outer:D \tex_edef:D #1 + { + \exp_not:N \__msg_kernel_expandable_error:nnnnn + { kernel } { deprecated-command } + { \tl_to_str:n {#3} } { \token_to_str:N #1 } { \tl_to_str:n {#2} } + \exp_not:N \__msg_kernel_error:nnxxx + { kernel } { deprecated-command } + { \tl_to_str:n {#3} } { \token_to_str:N #1 } { \tl_to_str:n {#2} } + } + } +\__deprecation_error:Nnn \c_job_name_tl { \c_sys_jobname_str } { 2017-01-01 } +\__deprecation_error:Nnn \dim_case:nnn { \dim_case:nnF } { 2015-07-14 } +\__deprecation_error:Nnn \int_case:nnn { \int_case:nnF } { 2015-07-14 } +\__deprecation_error:Nnn \int_from_binary:n { \int_from_bin:n } { 2016-01-05 } +\__deprecation_error:Nnn \int_from_hexadecimal:n { \int_from_hex:n } { 2016-01-05 } +\__deprecation_error:Nnn \int_from_octal:n { \int_from_oct:n } { 2016-01-05 } +\__deprecation_error:Nnn \int_to_binary:n { \int_to_bin:n } { 2016-01-05 } +\__deprecation_error:Nnn \int_to_hexadecimal:n { \int_to_hex:n } { 2016-01-05 } +\__deprecation_error:Nnn \int_to_octal:n { \int_to_oct:n } { 2016-01-05 } +\__deprecation_error:Nnn \luatex_if_engine_p: { \sys_if_engine_luatex_p: } { 2017-01-01 } +\__deprecation_error:Nnn \luatex_if_engine:F { \sys_if_engine_luatex:F } { 2017-01-01 } +\__deprecation_error:Nnn \luatex_if_engine:T { \sys_if_engine_luatex:T } { 2017-01-01 } +\__deprecation_error:Nnn \luatex_if_engine:TF { \sys_if_engine_luatex:TF } { 2017-01-01 } +\__deprecation_error:Nnn \pdftex_if_engine_p: { \sys_if_engine_pdftex_p: } { 2017-01-01 } +\__deprecation_error:Nnn \pdftex_if_engine:F { \sys_if_engine_pdftex:F } { 2017-01-01 } +\__deprecation_error:Nnn \pdftex_if_engine:T { \sys_if_engine_pdftex:T } { 2017-01-01 } +\__deprecation_error:Nnn \pdftex_if_engine:TF { \sys_if_engine_pdftex:TF } { 2017-01-01 } +\__deprecation_error:Nnn \prop_get:cn { \prop_item:cn } { 2016-01-05 } +\__deprecation_error:Nnn \prop_get:Nn { \prop_item:Nn } { 2016-01-05 } +\__deprecation_error:Nnn \quark_if_recursion_tail_break:N { } { 2015-07-14 } +\__deprecation_error:Nnn \quark_if_recursion_tail_break:n { }{ 2015-07-14 } +\__deprecation_error:Nnn \scan_align_safe_stop: { protected~commands } { 2017-01-01 } +\__deprecation_error:Nnn \str_case:nnn { \str_case:nnF } { 2015-07-14 } +\__deprecation_error:Nnn \str_case:onn { \str_case:onF } { 2015-07-14 } +\__deprecation_error:Nnn \str_case_x:nnn { \str_case_x:nnF } { 2015-07-14 } +\__deprecation_error:Nnn \tl_case:cnn { \tl_case:cnF } { 2015-07-14 } +\__deprecation_error:Nnn \tl_case:Nnn { \tl_case:NnF } { 2015-07-14 } +\__deprecation_error:Nnn \xetex_if_engine_p: { \sys_if_engine_xetex_p: } { 2017-01-01 } +\__deprecation_error:Nnn \xetex_if_engine:F { \sys_if_engine_xetex:F } { 2017-01-01 } +\__deprecation_error:Nnn \xetex_if_engine:T { \sys_if_engine_xetex:T } { 2017-01-01 } +\__deprecation_error:Nnn \xetex_if_engine:TF { \sys_if_engine_xetex:TF } { 2017-01-01 } +\cs_new_protected:Npn \deprecation_error: + { + \__deprecation_error:Nnn \tl_to_lowercase:n { } { 2017-12-31 } + \__deprecation_error:Nnn \tl_to_uppercase:n { } { 2017-12-31 } + \__deprecation_error:Nnn \ior_get_str:NN { \ior_str_get:NN } { 2017-12-31 } + \__deprecation_error:Nnn \c_minus_one { - 1 } { 2018-12-31 } + \__deprecation_error:Nnn \sort_ordered: { \sort_return_same: } { 2018-12-31 } + \__deprecation_error:Nnn \sort_reversed: { \sort_return_swapped: } { 2018-12-31 } + \cs_set_eq:NN \deprecation_error: \scan_stop: + } +%% File: l3candidates.dtx Copyright (C) 2012-2017 The LaTeX3 Project +\GetIdInfo$Id: l3candidates.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Experimental additions to l3kernel} -\cs_new_protected:Npn \cs_log:N - { \__msg_log_next: \cs_show:N } -\cs_new_protected:Npn \cs_log:c - { \__msg_log_next: \cs_show:c } -\cs_new_protected:Npn \__kernel_register_log:N - { \__msg_log_next: \__kernel_register_show:N } -\cs_generate_variant:Nn \__kernel_register_log:N { c } \fp_new:N \l__box_angle_fp \fp_new:N \l__box_cos_fp \fp_new:N \l__box_sin_fp @@ -17430,16 +17809,11 @@ \box_set_eq:NN #1 \l__box_internal_box } \cs_generate_variant:Nn \box_viewport:Nnnnn { c } -\cs_new_protected:Npn \clist_log:N - { \__msg_log_next: \clist_show:N } -\cs_new_protected:Npn \clist_log:n - { \__msg_log_next: \clist_show:n } -\cs_generate_variant:Nn \clist_log:N { c } \cs_new:Npn \clist_rand_item:n #1 { \exp_args:Nf \__clist_rand_item:nn { \clist_count:n {#1} } {#1} } \cs_new:Npn \__clist_rand_item:nn #1#2 { - \int_compare:nNnF {#1} = \c_zero + \int_compare:nNnF {#1} = 0 { \clist_item:nn {#2} { \int_rand:nn { 1 } {#1} } } } \cs_new:Npn \clist_rand_item:N #1 @@ -17677,9 +18051,6 @@ {#5} {#6} } } -\cs_new_protected:Npn \coffin_log_structure:N - { \__msg_log_next: \coffin_show_structure:N } -\cs_generate_variant:Nn \coffin_log_structure:N { c } \cs_new_protected:Npn \file_if_exist_input:n #1 { \file_if_exist:nT {#1} @@ -17741,16 +18112,6 @@ { \__msg_log_next: \ior_list_streams: } \cs_new_protected:Npn \iow_log_streams: { \__msg_log_next: \iow_list_streams: } -\cs_new_protected:Npn \fp_log:N - { \__msg_log_next: \fp_show:N } -\cs_new_protected:Npn \fp_log:n - { \__msg_log_next: \fp_show:n } -\cs_generate_variant:Nn \fp_log:N { c } -\cs_new_protected:Npn \int_log:N - { \__msg_log_next: \int_show:N } -\cs_generate_variant:Nn \int_log:N { c } -\cs_new_protected:Npn \int_log:n - { \__msg_log_next: \int_show:n } \cs_if_exist:NTF \pdftex_uniformdeviate:D { \cs_new:Npn \int_rand:nn #1#2 @@ -17768,12 +18129,12 @@ \__int_rand:ww #2; #1; } { - \int_compare:nNnTF {#1} > \c_zero + \int_compare:nNnTF {#1} > 0 { \int_compare:nNnTF { #2 - #1 } < \c__fp_rand_size_int } { \int_compare:nNnTF {#2} < { #1 + \c__fp_rand_size_int } } { \exp_args:Nf \__int_rand_narrow:nn - { \int_eval:n { #2 - #1 + \c_one } } {#1} + { \int_eval:n { #2 - #1 + 1 } } {#1} } { \fp_to_int:n { randint(#1,#2) } } } @@ -17807,8 +18168,6 @@ \__msg_kernel_new:nnn { kernel } { backward-range } { Bounds~ordered~backwards~in~\int_rand:nn {#1}~{#2}. } } -\cs_new_protected:Npn \keys_log:nn - { \__msg_log_next: \keys_show:nn } \cs_new:Npn \msg_expandable_error:nnnnnn #1#2#3#4#5#6 { \exp_args:Nf \__msg_expandable_error_module:nn @@ -17866,20 +18225,15 @@ { \prg_return_true: } { \bool_if:nTF {#2} { \prg_return_true: } { \prg_return_false: } } } -\cs_new_protected:Npn \bool_log:N - { \__msg_log_next: \bool_show:N } -\cs_new_protected:Npn \bool_log:n - { \__msg_log_next: \bool_show:n } -\cs_generate_variant:Nn \bool_log:N { c } \cs_new:Npn \prop_count:N #1 { \int_eval:n { - \c_zero + 0 \prop_map_function:NN #1 \__prop_count:nn } } -\cs_new:Npn \__prop_count:nn #1#2 { + \c_one } +\cs_new:Npn \__prop_count:nn #1#2 { + 1 } \cs_generate_variant:Nn \prop_count:N { c } \cs_new:Npn \prop_map_tokens:Nn #1#2 { @@ -17896,9 +18250,6 @@ \__prop_map_tokens:nwwn {#1} } \cs_generate_variant:Nn \prop_map_tokens:Nn { c } -\cs_new_protected:Npn \prop_log:N - { \__msg_log_next: \prop_show:N } -\cs_generate_variant:Nn \prop_log:N { c } \cs_new:Npn \prop_rand_key_value:N { \__prop_rand:NN \__prop_rand:nNn } \cs_new:Npn \__prop_rand:nNn #1#2#3 { \exp_not:n { {#1} {#3} } } \cs_new:Npn \__prop_rand:NN #1#2 @@ -17912,10 +18263,10 @@ } \cs_new:Npn \__prop_rand_item:Nw #1#2 \s__prop \__prop_pair:wn #3 \s__prop #4 { - \int_compare:nNnF {#2} > \c_one + \int_compare:nNnF {#2} > 1 { \use_i_delimit_by_q_stop:nw { #1 {#3} \exp_not:n {#4} } } \exp_after:wN \__prop_rand_item:Nw \exp_after:wN #1 - \__int_value:w \int_eval:n { #2 - \c_one } \s__prop + \__int_value:w \int_eval:n { #2 - 1 } \s__prop } \cs_generate_variant:Nn \prop_rand_key_value:N { c } \cs_new:Npn \seq_mapthread_function:NNN #1#2#3 @@ -17961,9 +18312,6 @@ #1 #2 { #3 } \__seq_pop_item_def: } -\cs_new_protected:Npn \seq_log:N - { \__msg_log_next: \seq_show:N } -\cs_generate_variant:Nn \seq_log:N { c } \cs_new:Npn \seq_rand_item:N #1 { \seq_if_empty:NF #1 @@ -17983,18 +18331,6 @@ #2 } } -\cs_new_eq:NN \dim_log:N \__kernel_register_log:N -\cs_new_eq:NN \dim_log:c \__kernel_register_log:c -\cs_new_protected:Npn \dim_log:n - { \__msg_log_next: \dim_show:n } -\cs_new_eq:NN \skip_log:N \__kernel_register_log:N -\cs_new_eq:NN \skip_log:c \__kernel_register_log:c -\cs_new_protected:Npn \skip_log:n - { \__msg_log_next: \skip_show:n } -\cs_new_eq:NN \muskip_log:N \__kernel_register_log:N -\cs_new_eq:NN \muskip_log:c \__kernel_register_log:c -\cs_new_protected:Npn \muskip_log:n - { \__msg_log_next: \muskip_show:n } \prg_new_conditional:Npnn \tl_if_single_token:n #1 { p , T , F , TF } { \tl_if_head_is_N_type:nTF {#1} @@ -18358,11 +18694,11 @@ { \token_if_expandable:NTF #1 { - \bool_if:nTF + \bool_lazy_any:nTF { - \token_if_protected_macro_p:N #1 - || \token_if_protected_long_macro_p:N #1 - || \token_if_eq_meaning_p:NN \q_recursion_tail #1 + { \token_if_eq_meaning_p:NN \q_recursion_tail #1 } + { \token_if_protected_macro_p:N #1 } + { \token_if_protected_long_macro_p:N #1 } } { \use_ii:nn } { \use_i:nn } @@ -18434,11 +18770,9 @@ #2 \q_recursion_stop } { - \bool_if:nTF - { - \token_if_cs_p:N #1 - || ! ( \int_compare_p:nNn { `#1 } = { "0307 } ) - } + \bool_lazy_or:nnTF + { \token_if_cs_p:N #1 } + { ! \int_compare_p:nNn { `#1 } = { "0307 } } { \__tl_change_case_output:Vwn \c__unicode_dotless_i_tl } { \__tl_change_case_output:nwn { i } @@ -18528,15 +18862,15 @@ #3 \q_recursion_stop } { - \bool_if:nT + \bool_lazy_and:nnT + { ! \token_if_cs_p:N #2 } { - ! \token_if_cs_p:N #2 - && - ( - \int_compare_p:nNn { `#2 } = { "0300 } - || \int_compare_p:nNn { `#2 } = { "0301 } - || \int_compare_p:nNn { `#2 } = { "0303 } - ) + \bool_lazy_any_p:n + { + { \int_compare_p:nNn { `#2 } = { "0300 } } + { \int_compare_p:nNn { `#2 } = { "0301 } } + { \int_compare_p:nNn { `#2 } = { "0303 } } + } } { \__tl_change_case_output:Vwn \c__unicode_dot_above_tl } #1 #2#3 \q_recursion_stop @@ -18578,11 +18912,9 @@ #3 \q_recursion_stop } { - \bool_if:nTF - { - ! \token_if_cs_p:N #2 - && \int_compare_p:nNn { `#2 } = { "0307 } - } + \bool_lazy_and:nnTF + { ! \token_if_cs_p:N #2 } + { \int_compare_p:nNn { `#2 } = { "0307 } } { #1 } { #1 #2 } #3 \q_recursion_stop @@ -19012,11 +19344,9 @@ } \cs_new:Npn \__tl_change_case_mixed_nl:Nnw #1 { - \bool_if:nTF - { - \int_compare_p:nNn { `#1 } = { `i } - || \int_compare_p:nNn { `#1 } = { `I } - } + \bool_lazy_or:nnTF + { \int_compare_p:nNn { `#1 } = { `i } } + { \int_compare_p:nNn { `#1 } = { `I } } { \__tl_change_case_output:nwn { I } \__tl_change_case_mixed_nl:Nw @@ -19036,14 +19366,12 @@ #3 \q_recursion_stop } { - \bool_if:nTF + \bool_lazy_and:nnTF + { ! ( \token_if_cs_p:N #2 ) } { - ! ( \token_if_cs_p:N #2 ) - && - ( - \int_compare_p:nNn { `#2 } = { `j } - || \int_compare_p:nNn { `#2 } = { `J } - ) + \bool_lazy_or_p:nn + { \int_compare_p:nNn { `#2 } = { `j } } + { \int_compare_p:nNn { `#2 } = { `J } } } { \__tl_change_case_output:nwn { J } @@ -19068,11 +19396,6 @@ ` - } -\cs_new_protected:Npn \tl_log:N - { \__msg_log_next: \tl_show:N } -\cs_generate_variant:Nn \tl_log:N { c } -\cs_new_protected:Npn \tl_log:n - { \__msg_log_next: \tl_show:n } \cs_new:Npn \tl_rand_item:n #1 { \tl_if_blank:nF {#1} @@ -19080,16 +19403,84 @@ } \cs_new:Npn \tl_rand_item:N { \exp_args:No \tl_rand_item:n } \cs_generate_variant:Nn \tl_rand_item:N { c } +\cs_new:Npn \tl_range:Nnn { \exp_args:No \tl_range:nnn } +\cs_generate_variant:Nn \tl_range:Nnn { c } +\cs_new:Npn \tl_range:nnn #1#2#3 + { + \tl_head:f + { + \exp_args:Nf \__tl_range:nnnw { \tl_count:n {#1} } {#2} {#3} + #1 + } + } +\cs_new:Npn \__tl_range:nnnw #1#2#3 + { + \exp_args:Nff \__tl_range:nnw + { + \exp_args:Nf \__tl_range_normalize:nn + { \int_eval:n { #2 - 1 } } {#1} + } + { + \exp_args:Nf \__tl_range_normalize:nn + { \int_eval:n {#3} } {#1} + } + } +\cs_new:Npn \__tl_range:nnw #1#2 + { + \if_int_compare:w #2 > #1 \exp_stop_f: \else: + \exp_after:wN { \exp_after:wN } + \fi: + \exp_after:wN \__tl_range_collect:w + \__int_value:w \__int_eval:w #2 - #1 \exp_after:wN ; + \exp_after:wN { \exp_after:wN } + \exp:w \__tl_range_skip:w #1 ; { } + } +\cs_new:Npn \__tl_range_skip:w #1 ; #2 + { + \if_int_compare:w #1 > 0 \exp_stop_f: + \exp_after:wN \__tl_range_skip:w + \__int_value:w \__int_eval:w #1 - 1 \exp_after:wN ; + \else: + \exp_after:wN \exp_end: + \fi: + } +\cs_new:Npn \__tl_range_collect:w #1 ; #2#3 + { + \if_int_compare:w #1 > 1 \exp_stop_f: + \exp_after:wN \__tl_range_collect:w + \__int_value:w \__int_eval:w #1 - 1 \exp_after:wN ; + \fi: + { #2 {#3} } + } +\cs_new:Npn \__tl_range_normalize:nn #1#2 + { + \int_eval:n + { + \if_int_compare:w #1 < 0 \exp_stop_f: + \if_int_compare:w #1 < -#2 \exp_stop_f: + 0 + \else: + #1 + #2 + 1 + \fi: + \else: + \if_int_compare:w #1 < #2 \exp_stop_f: + #1 + \else: + #2 + \fi: + \fi: + } + } \group_begin: \cs_set_protected:Npn \__peek_tmp:w #1 \q_stop { \cs_new_protected:Npn \__peek_execute_branches_N_type: { \if_int_odd:w - \if_catcode:w \exp_not:N \l_peek_token { \c_two \fi: - \if_catcode:w \exp_not:N \l_peek_token } \c_two \fi: - \if_meaning:w \l_peek_token \c_space_token \c_two \fi: - \c_one + \if_catcode:w \exp_not:N \l_peek_token { 0 \exp_stop_f: \fi: + \if_catcode:w \exp_not:N \l_peek_token } 0 \exp_stop_f: \fi: + \if_meaning:w \l_peek_token \c_space_token 0 \exp_stop_f: \fi: + 1 \exp_stop_f: \exp_after:wN \__peek_N_type:w \token_to_meaning:N \l_peek_token \q_mark \__peek_N_type_aux:nnw @@ -19118,8 +19509,8 @@ { \__peek_token_generic:NNT \__peek_execute_branches_N_type: \scan_stop: } \cs_new_protected:Npn \peek_N_type:F { \__peek_token_generic:NNF \__peek_execute_branches_N_type: \scan_stop: } -%% File: l3luatex.dtx Copyright (C) 2010-2016 The LaTeX3 Project -\GetIdInfo$Id: l3luatex.dtx 6805 2016-12-28 22:15:52Z joseph $ +%% File: l3luatex.dtx Copyright (C) 2010-2017 The LaTeX3 Project +\GetIdInfo$Id: l3luatex.dtx 6953 2017-02-18 19:07:54Z joseph $ {L3 Experimental LuaTeX-specific functions} \cs_new:Npn \lua_now_x:n #1 { \luatex_directlua:D {#1} } \cs_new:Npn \lua_now:n #1 { \lua_now_x:n { \exp_not:n {#1} } } diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex b/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex index 1c902bb50c6..fecda62e0c2 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3-generic.tex @@ -21,8 +21,8 @@ %% File: expl3.dtx Copyright (C) 1990-2017 The LaTeX3 Project \def\ExplFileName{expl3}% \def\ExplFileDescription{L3 programming layer}% -\def\ExplFileDate{2017/02/10}% -\def\ExplFileVersion{6878}% +\def\ExplFileDate{2017/03/07}% +\def\ExplFileVersion{6984}% \let\ExplLoaderFileVersion\ExplFileVersion \begingroup \def\tempa{LaTeX2e}% @@ -93,11 +93,9 @@ \sys_if_engine_xetex:TF { xdvipdfmx } { - \bool_if:nTF - { - \cs_if_exist_p:N \pdftex_pdfoutput:D - && \int_compare_p:nNn \pdftex_pdfoutput:D > \c_zero - } + \bool_lazy_and:nnTF + { \cs_if_exist_p:N \pdftex_pdfoutput:D } + { \int_compare_p:nNn \pdftex_pdfoutput:D > 0 } { pdfmode } { dvips } } diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.lua b/Master/texmf-dist/tex/latex/l3kernel/expl3.lua index 3449bd8cad6..41a82db20ba 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.lua +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.lua @@ -13,7 +13,7 @@ -- -- Do not distribute a modified version of this file. -- --- File: l3luatex.dtx Copyright (C) 2010-2016 The LaTeX3 Project +-- File: l3luatex.dtx Copyright (C) 2010-2017 The LaTeX3 Project l3kernel = l3kernel or { } local tex_setcatcode = tex.setcatcode local tex_sprint = tex.sprint diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty index 061e76769f7..39142546652 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -21,8 +21,8 @@ %% File: expl3.dtx Copyright (C) 1990-2017 The LaTeX3 Project \def\ExplFileName{expl3}% \def\ExplFileDescription{L3 programming layer}% -\def\ExplFileDate{2017/02/10}% -\def\ExplFileVersion{6878}% +\def\ExplFileDate{2017/03/07}% +\def\ExplFileVersion{6984}% \let\ExplLoaderFileVersion\ExplFileVersion \ProvidesPackage{\ExplFileName} [% diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty index cb7faa91f68..818afcd20fe 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3basics} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty index 2c940cc90aa..3e8d64ae2a0 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3bootstrap} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty index 036ece889f6..d3b0c6e5d55 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3box} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3candidates.sty b/Master/texmf-dist/tex/latex/l3kernel/l3candidates.sty index 497330ddc05..cb507e50c0d 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3candidates.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3candidates.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3candidates} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty index 5580f3f0fad..e9c6ecd3d29 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3clist} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty b/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty index 52421d84448..067b5635ad9 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3coffins} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3color.sty b/Master/texmf-dist/tex/latex/l3kernel/l3color.sty index d80b2631357..2c15626ebe0 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3color.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3color.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3color} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls index 9bbfb2dfdce..7a7d0125084 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls +++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls @@ -24,7 +24,7 @@ \let \fileversionOld \ExplFileVersion \let \filedescriptionOld \ExplFileDescription \RequirePackage{expl3,xparse,calc} -\GetIdInfo$Id: l3doc.dtx 6847 2017-02-07 15:05:44Z bruno $ +\GetIdInfo$Id: l3doc.dtx 6943 2017-02-17 16:47:59Z bruno $ {L3 Experimental documentation class} \ProvidesExplClass {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -307,6 +307,8 @@ } \msg_new:nnn { l3doc } { deprecated-function } { The~deprecated~function(s)~'#1'~should~have~been~removed~on~#2. } +\msg_new:nnn { l3doc } { date-format } + { The~date~'#1'~should~be~given~in~YYYY-MM-DD~format. } \DeclareOption { a5paper } { \@latexerr { Option~not~supported } { } } \DeclareOption { full } { @@ -827,8 +829,8 @@ \bool_set_true:N \l__codedoc_macro_noTF_bool \bool_set_true:N \l__codedoc_macro_TF_bool } , - added .tl_set:N = \l__codedoc_date_added_tl , - updated .tl_set:N = \l__codedoc_date_updated_tl , + added .code:n = { \__codedoc_date_set:Nn \l__codedoc_date_added_tl {#1} }, + updated .code:n = { \__codedoc_date_set:Nn \l__codedoc_date_updated_tl {#1} } , deprecated .code:n = { \__codedoc_deprecated_on:n {#1} } , tested .code:n = { } , label .code:n = @@ -840,6 +842,12 @@ verb .bool_set:N = \l__codedoc_names_verb_bool , module .tl_set:N = \l__codedoc_override_module_tl , } +\cs_new_protected:Npn \__codedoc_date_set:Nn #1#2 + { + \tl_if_in:nnT {#2} { / } + { \msg_error:nnn { l3doc } { date-format } {#2} } + \tl_set:Nn #1 {#2} + } \cs_new_protected:Npn \__codedoc_deprecated_on:n #1 { \__codedoc_date_compare:nNnT {#1} < { \tex_year:D - \tex_month:D - \tex_day:D } @@ -1040,11 +1048,9 @@ \cs_generate_variant:Nn \__codedoc_function_label:nN { x } \cs_new:Npn \__codedoc_typeset_dates: { - \bool_if:nF - { - \tl_if_empty_p:N \l__codedoc_date_added_tl && - \tl_if_empty_p:N \l__codedoc_date_updated_tl - } + \bool_lazy_and:nnF + { \tl_if_empty_p:N \l__codedoc_date_added_tl } + { \tl_if_empty_p:N \l__codedoc_date_updated_tl } { \midrule } \tl_if_empty:NF \l__codedoc_date_added_tl { @@ -1173,7 +1179,7 @@ \hbox:n { \strut - \int_compare:nNnT \l__codedoc_macro_int = \c_zero + \int_compare:nNnT \l__codedoc_macro_int = 0 { \HD@target } } \vskip \int_eval:n { \l__codedoc_macro_int - 1 } \baselineskip @@ -1380,12 +1386,12 @@ } \cs_new_protected:Npn \__codedoc_macro_end_check_tested: { - \bool_if:nT + \bool_lazy_all:nT { - \g__codedoc_checktest_bool && - ! \l__codedoc_macro_aux_bool && - ! \l__codedoc_macro_var_bool && - ! \l__codedoc_macro_tested_bool + { \g__codedoc_checktest_bool } + { ! \l__codedoc_macro_aux_bool } + { ! \l__codedoc_macro_var_bool } + { ! \l__codedoc_macro_tested_bool } } { \seq_gput_right:Nx \g__codedoc_not_tested_seq @@ -1425,11 +1431,9 @@ } \cs_new_protected:Npn \__codedoc_print_documented: { - \bool_if:nT - { - ! \l__codedoc_macro_aux_bool && - ! \l__codedoc_macro_internal_bool - } + \bool_lazy_or:nnF + { \l__codedoc_macro_aux_bool } + { \l__codedoc_macro_internal_bool } { \int_set:Nn \l__codedoc_tmpa_int { \seq_count:N \g__codedoc_nested_names_seq } @@ -1752,8 +1756,8 @@ \tl_new:N \l__codedoc_undoc_def_tl \cs_new_protected:Npn \__codedoc_show_functions_defined: { - \bool_if:nT - { \g__codedoc_typeset_implementation_bool && \g__codedoc_checkfunc_bool } + \bool_lazy_and:nnT + { \g__codedoc_typeset_implementation_bool } { \g__codedoc_checkfunc_bool } { \iow_term:x { \c__codedoc_iow_separator_tl \iow_newline: } \iow_open:Nn \g__codedoc_func_iow { \c_sys_jobname_str .cmds } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def b/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def index 7576a3c1f95..6a5afa728e8 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def @@ -18,8 +18,8 @@ %% This file is part of the "l3kernel bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3drivers.dtx Copyright(C) 2011-2016 The LaTeX3 Project -\GetIdInfo$Id: l3drivers.dtx 6809 2017-01-01 06:33:13Z bruno $ +%% File: l3drivers.dtx Copyright(C) 2011-2017 The LaTeX3 Project +\GetIdInfo$Id: l3drivers.dtx 6954 2017-02-18 20:26:11Z joseph $ {L3 Experimental drivers} \ProvidesExplFile {l3dvidpfmx.def}{\ExplFileDate}{\ExplFileVersion} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def b/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def index 5c160181f16..fb26087e4ba 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3dvips.def @@ -18,8 +18,8 @@ %% This file is part of the "l3kernel bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3drivers.dtx Copyright(C) 2011-2016 The LaTeX3 Project -\GetIdInfo$Id: l3drivers.dtx 6809 2017-01-01 06:33:13Z bruno $ +%% File: l3drivers.dtx Copyright(C) 2011-2017 The LaTeX3 Project +\GetIdInfo$Id: l3drivers.dtx 6954 2017-02-18 20:26:11Z joseph $ {L3 Experimental drivers} \ProvidesExplFile {l3dvips.def}{\ExplFileDate}{\ExplFileVersion} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def b/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def index be5b305817e..d5379bf5d97 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def @@ -18,8 +18,8 @@ %% This file is part of the "l3kernel bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3drivers.dtx Copyright(C) 2011-2016 The LaTeX3 Project -\GetIdInfo$Id: l3drivers.dtx 6809 2017-01-01 06:33:13Z bruno $ +%% File: l3drivers.dtx Copyright(C) 2011-2017 The LaTeX3 Project +\GetIdInfo$Id: l3drivers.dtx 6954 2017-02-18 20:26:11Z joseph $ {L3 Experimental drivers} \ProvidesExplFile {l3dvisvgm.def}{\ExplFileDate}{\ExplFileVersion} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty index 62823f4bc8d..f6168202c0a 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3expan} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3file.sty b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty index 0c620387825..d6c24b83adb 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3file.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3file.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3file} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty index f41289e23c3..59fb01df30a 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3fp} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty index d4b4b691e3e..941565152ba 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3int} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty b/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty index d682d8421f1..0d8d6905030 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3keys.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3keys} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty index 4bf5fb6207b..d896a830cc3 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3msg} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3names.sty b/Master/texmf-dist/tex/latex/l3kernel/l3names.sty index 7c74891b8f0..712c05e876d 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3names.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3names.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3names} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def b/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def index b517bd9f7ff..d2a281110ad 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def @@ -18,8 +18,8 @@ %% This file is part of the "l3kernel bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3drivers.dtx Copyright(C) 2011-2016 The LaTeX3 Project -\GetIdInfo$Id: l3drivers.dtx 6809 2017-01-01 06:33:13Z bruno $ +%% File: l3drivers.dtx Copyright(C) 2011-2017 The LaTeX3 Project +\GetIdInfo$Id: l3drivers.dtx 6954 2017-02-18 20:26:11Z joseph $ {L3 Experimental drivers} \ProvidesExplFile {l3pdfmode.def}{\ExplFileDate}{\ExplFileVersion} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty index 64add1e2797..96f4a275143 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3prg} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty index 2c50ca3b795..d0afa0eff30 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3prop} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty b/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty index 8570ac35ce1..3555ee57eee 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3quark} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty index 362f18ad24b..af248cbc7c3 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3seq} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty b/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty index 9689bfb36db..b58e08899f2 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3skip} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3sort.sty b/Master/texmf-dist/tex/latex/l3kernel/l3sort.sty index 1ff2b655cae..ae011bd1a17 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3sort.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3sort.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3sort} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3str.sty b/Master/texmf-dist/tex/latex/l3kernel/l3str.sty index c51a97a5cda..09ddcbadbbf 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3str.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3str.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3str} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty index 30ce86054ec..fd8ee701dc3 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3tl} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3token.sty b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty index 1c483d9dec9..c3795885939 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3token.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3token.sty @@ -19,7 +19,7 @@ %% and all files in that bundle must be distributed together. %% %% File: l3oldmodules.dtx Copyright (C) 2014,2016,2017 The LaTeX3 Project -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} \def\old@liii@module@name {l3token} \ProvidesPackage\old@liii@module@name diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def b/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def index af8468476db..0e754eee695 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def +++ b/Master/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def @@ -18,8 +18,8 @@ %% This file is part of the "l3kernel bundle" (The Work in LPPL) %% and all files in that bundle must be distributed together. %% -%% File: l3drivers.dtx Copyright(C) 2011-2016 The LaTeX3 Project -\GetIdInfo$Id: l3drivers.dtx 6809 2017-01-01 06:33:13Z bruno $ +%% File: l3drivers.dtx Copyright(C) 2011-2017 The LaTeX3 Project +\GetIdInfo$Id: l3drivers.dtx 6954 2017-02-18 20:26:11Z joseph $ {L3 Experimental drivers} \ProvidesExplFile {l3xdvidpfmx.def}{\ExplFileDate}{\ExplFileVersion} diff --git a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty index 0910faf247e..9877bb95a42 100644 --- a/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty +++ b/Master/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty @@ -19,8 +19,8 @@ %% and all files in that bundle must be distributed together. %% %% File: l3keys2e.dtx (C) Copyright 2009,2011-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{l3keys2e}{Support package l3kernel too old} @@ -34,8 +34,8 @@ } \def\ExplFileName{l3keys2e} \def\ExplFileDescription{LaTeX2e option processing using LaTeX3 keys} -\def\ExplFileDate{2017/02/10} -\def\ExplFileVersion{6878} +\def\ExplFileDate{2017/03/07} +\def\ExplFileVersion{6984} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \cs_generate_variant:Nn \clist_put_right:Nn { Nv } diff --git a/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty b/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty new file mode 100644 index 00000000000..b014890405e --- /dev/null +++ b/Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty @@ -0,0 +1,44 @@ +%% +%% This is file `xfp.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xfp.dtx (with options: `package') +%% +%% Copyright (C) 2017 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 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 "l3packages bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% File: xfp.dtx (C) Copyright 2017 The LaTeX3 Project +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} + {} + {% + \PackageError{xfpu}{Support package l3kernel too old} + {% + Please install an up to date version of l3kernel\MessageBreak + using your TeX package manager or from CTAN.\MessageBreak + \MessageBreak + Loading xfpu will abort!% + }% + \endinput + } +\def\ExplFileName{xfp} +\def\ExplFileDescription{LaTeX Floating Point Unit} +\def\ExplFileDate{2017/03/07} +\def\ExplFileVersion{6984} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +\NewExpandableDocumentCommand \fpeval { m } { \fp_eval:n {#1} } +%% +%% +%% End of file `xfp.sty'. diff --git a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty index 17f3d1bc319..502208f2580 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xfrac/xfrac.sty @@ -20,8 +20,8 @@ %% %% File: xfrac.dtx Copyright (C) 2004, 2008-2010 Morten Hoegholm %% (C) 2011,2012,2014-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{xfrac}{Support package l3kernel too old} @@ -36,8 +36,8 @@ \RequirePackage{amstext,graphicx,l3keys2e,textcomp,xparse,xtemplate} \def\ExplFileName{xfrac} \def\ExplFileDescription{L3 Experimental split-level fractions} -\def\ExplFileDate{2017/02/10} -\def\ExplFileVersion{6878} +\def\ExplFileDate{2017/03/07} +\def\ExplFileVersion{6984} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \keys_define:nn { xfrac } diff --git a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty index 08e27c11845..1c415e3b513 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xparse/xparse.sty @@ -23,8 +23,8 @@ %% (C) Copyright 2004-2008 Frank Mittelbach, %% The LaTeX3 Project %% (C) Copyright 2009-2017 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{xparse}{Support package l3kernel too old} @@ -38,14 +38,12 @@ } \def\ExplFileName{xparse} \def\ExplFileDescription{L3 Experimental document command parser} -\def\ExplFileDate{2017/02/10} -\def\ExplFileVersion{6878} +\def\ExplFileDate{2017/03/07} +\def\ExplFileVersion{6984} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \tl_const:Nx \c__xparse_no_value_tl { \char_generate:nn { `\- } { 11 } NoValue- } -\bool_new:N \l__xparse_all_long_bool -\bool_new:N \l__xparse_all_long_set_bool \tl_new:N \l__xparse_arg_spec_tl \tl_new:N \l__xparse_args_tl \tl_new:N \l__xparse_args_i_tl @@ -65,6 +63,7 @@ \tl_new:N \l__xparse_fn_tl \tl_new:N \l__xparse_fn_code_tl \tl_new:N \l__xparse_function_tl +\bool_new:N \l__xparse_grab_expandably_bool \tl_new:N \l__xparse_last_delimiters_tl \bool_new:N \l__xparse_long_bool \int_new:N \l__xparse_m_args_int @@ -74,6 +73,8 @@ \tl_new:N \l__xparse_process_one_tl \bool_new:N \l__xparse_process_some_bool \tl_new:N \l__xparse_signature_tl +\bool_new:N \l__xparse_some_long_bool +\bool_new:N \l__xparse_some_short_bool \prop_new:N \l__xparse_tmp_prop \tl_new:N \l__xparse_tmpa_tl \tl_new:N \l__xparse_tmpb_tl @@ -96,6 +97,13 @@ { \token_to_str:N #1 } { \tl_to_str:n {#2} } } { + \bool_lazy_or:nnT + { \cs_if_exist_p:c { \cs_to_str:N #1 ~ code } } + { \cs_if_exist_p:c { \cs_to_str:N #1 ~ defaults } } + { + \__msg_kernel_warning:nnx { xparse } { unsupported-let } + { \token_to_str:N #1 } + } \__msg_kernel_info:nnxx { xparse } { define-command } { \token_to_str:N #1 } { \tl_to_str:n {#2} } } @@ -114,7 +122,7 @@ \cs_new_eq:NN \__xparse_break_point:n \use_none:n \cs_new_protected:Npn \__xparse_declare_cmd_code:Nnn { - \bool_if:NTF \l__xparse_expandable_bool + \bool_if:NTF \l__xparse_grab_expandably_bool { \__xparse_declare_cmd_code_expandable:Nnn } { \__xparse_declare_cmd_code_aux:Nnn } } @@ -142,9 +150,10 @@ } \cs_new_protected:Npn \__xparse_declare_cmd_code_expandable:Nnn #1#2#3 { - \cs_generate_from_arg_count:cNnn + \exp_args:Ncc \cs_generate_from_arg_count:NNnn { \l__xparse_function_tl \c_space_tl code } - \cs_set:Npn \l__xparse_current_arg_int {#3} + { cs_set \bool_if:NF \l__xparse_expandable_bool { _protected } :Npn } + \l__xparse_current_arg_int {#3} \bool_if:NT \l__xparse_defaults_bool { \use:x @@ -155,19 +164,35 @@ { \exp_not:o \l__xparse_defaults_tl } } } - \cs_set_nopar:Npx #1 + \bool_if:NTF \l__xparse_expandable_bool + { \cs_set_nopar:Npx } { \cs_set_protected_nopar:Npx } #1 { - \exp_not:N \__xparse_start_expandable:nNNNn + \exp_not:N \__xparse_start_expandable:nNNNNn { \exp_not:n {#2} } \exp_not:c { \l__xparse_function_tl \c_space_tl } + \exp_not:c + { + \l__xparse_function_tl \c_space_tl + \bool_if:NT \l__xparse_some_short_bool + { \bool_if:NT \l__xparse_some_long_bool { \c_space_tl } } + } \exp_not:c { \l__xparse_function_tl \c_space_tl code } - \exp_not:c { \l__xparse_function_tl \c_space_tl defaults } + \bool_if:NTF \l__xparse_defaults_bool + { \exp_not:c { \l__xparse_function_tl \c_space_tl defaults } } + { ? } { \exp_not:o \l__xparse_signature_tl } } - \bool_if:NTF \l__xparse_all_long_bool - { \cs_set:cpx } + \bool_if:NTF \l__xparse_some_long_bool + { + \bool_if:NT \l__xparse_some_short_bool + { + \cs_set_nopar:cpx { \l__xparse_function_tl \c_space_tl \c_space_tl } + ##1##2 { ##1 {##2} } + } + \cs_set:cpx + } { \cs_set_nopar:cpx } - { \l__xparse_function_tl \c_space_tl } ##1##2 { ##1 {##2} } + { \l__xparse_function_tl \c_space_tl } ##1##2 { ##1 {##2} } } \cs_new_protected:Npn \__xparse_declare_env:nnnn #1#2 { @@ -203,7 +228,12 @@ \cs_set_eq:cc {#1} { environment~ #1 } \cs_set_eq:cc { end #1 } { environment~ #1 ~end } } -\cs_new_protected:Npn \__xparse_start:nNNnnn #1#2#3#4#5#6 +\cs_new_protected:Npx \__xparse_start:nNNnnn + { + \exp_not:c { xparse~function~is~not~expandable } + \exp_not:N \__xparse_start_aux:nNNnnn + } +\cs_new_protected:Npn \__xparse_start_aux:nNNnnn #1#2#3#4#5#6 { \tl_clear:N \l__xparse_args_tl \tl_set:Nn \l__xparse_fn_tl {#2} @@ -309,15 +339,15 @@ \cs_new_protected:Npn \__xparse_args_process_aux:n { \exp_args:No \__xparse_args_process_aux:nn { \ProcessedArgument } } \cs_new_protected:Npn \__xparse_args_process_aux:nn #1#2 { #2 {#1} } -\cs_new:Npn \__xparse_start_expandable:nNNNn #1#2#3#4#5 - { #5 \__xparse_end_expandable:NNw #4 #3 \q__xparse #2 } +\cs_new:Npn \__xparse_start_expandable:nNNNNn #1#2#3#4#5#6 + { #6 \__xparse_end_expandable:NNw #5 #4 \q__xparse #2#3 } \cs_new:Npn \__xparse_end_expandable:NNw #1#2 { \__xparse_end_expandable_aux:w #1#2 \prg_do_nothing: } -\cs_new:Npn \__xparse_end_expandable_aux:w #1#2#3 \q__xparse #4 - { \exp_args:No \__xparse_end_expandable_aux:nNNN {#3} #1 #2 #4 } -\cs_new:Npn \__xparse_end_expandable_aux:nNNN #1#2#3#4 +\cs_new:Npn \__xparse_end_expandable_aux:w #1#2#3 \q__xparse + { \exp_args:No \__xparse_end_expandable_aux:nNNNN {#3} #1 #2 } +\cs_new:Npn \__xparse_end_expandable_aux:nNNNN #1#2#3#4#5 { - \cs_if_exist:NF #2 { \exp_after:wN \use_iv:nnnn } + \token_if_eq_charcode:NNT ? #2 { \exp_after:wN \use_iv:nnnn } \__xparse_end_expandable_defaults:nnnNNn {#1} { } {#1} #2#3 { } { } { } { } { } { } { } { } { } { } { @@ -373,6 +403,10 @@ \int_zero:N \l__xparse_current_arg_int \tl_clear:N \l__xparse_last_delimiters_tl \tl_clear:N \l__xparse_arg_spec_tl + \bool_set_true:N \l__xparse_grab_expandably_bool + \bool_set_false:N \l__xparse_long_bool + \bool_set_false:N \l__xparse_some_long_bool + \bool_set_false:N \l__xparse_some_short_bool \__xparse_normalize_arg_spec_loop:n #1 \q_recursion_tail \q_recursion_tail \q_recursion_tail \q_recursion_stop \int_compare:nNnT \l__xparse_current_arg_int > 9 @@ -390,6 +424,10 @@ \__xparse_bad_def:wn } } + \bool_if:NT \l__xparse_expandable_bool + { \bool_set_true:N \l__xparse_grab_expandably_bool } + \bool_if:NT \l__xparse_environment_bool + { \bool_set_false:N \l__xparse_grab_expandably_bool } } \cs_new_protected:Npn \__xparse_normalize_arg_spec_loop:n #1 { @@ -440,12 +478,14 @@ } \tl_put_right:Nn \l__xparse_arg_spec_tl { > {#1} } \int_decr:N \l__xparse_current_arg_int + \bool_set_false:N \l__xparse_grab_expandably_bool \__xparse_normalize_arg_spec_loop:n {#2} } \cs_new_protected:cpn { __xparse_normalize_type_+:w } #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn } \tl_put_right:Nn \l__xparse_arg_spec_tl { + } + \bool_set_true:N \l__xparse_long_bool \int_decr:N \l__xparse_current_arg_int \__xparse_normalize_arg_spec_loop:n {#1} } @@ -454,8 +494,9 @@ \__xparse_single_token_check:n {#1} \__xparse_single_token_check:n {#2} \quark_if_recursion_tail_stop_do:nn {#3} { \__xparse_bad_arg_spec:wn } - \tl_put_right:Nn \l__xparse_arg_spec_tl { D #1 #2 {#3} } + \__xparse_add_arg_spec:n { D #1 #2 {#3} } \tl_put_right:Nn \l__xparse_last_delimiters_tl {#1} + \bool_set_false:N \l__xparse_grab_expandably_bool \__xparse_normalize_arg_spec_loop:n } \cs_new_protected:Npn \__xparse_normalize_type_E:w #1#2 @@ -463,17 +504,27 @@ \quark_if_recursion_tail_stop_do:nn {#2} { \__xparse_bad_arg_spec:wn } \tl_if_blank:nT {#1} { \__xparse_bad_arg_spec:wn } \tl_map_function:nN {#1} \__xparse_single_token_check:n + \__xparse_normalize_E_unique_check:w #1 \q_nil \q_stop \int_compare:nNnT { \tl_count:n {#2} } > { \tl_count:n {#1} } { \__xparse_bad_arg_spec:wn } - \tl_put_right:Nn \l__xparse_arg_spec_tl { E {#1} {#2} } + \__xparse_add_arg_spec:n { E {#1} {#2} } \tl_put_right:Nn \l__xparse_last_delimiters_tl {#1} + \bool_set_false:N \l__xparse_grab_expandably_bool \__xparse_normalize_arg_spec_loop:n } +\cs_new_protected:Npn \__xparse_normalize_E_unique_check:w #1#2 \q_stop + { + \quark_if_nil:NF #1 + { + \tl_if_in:nnT {#2} {#1} { \__xparse_bad_arg_spec:wn } + \__xparse_normalize_E_unique_check:w #2 \q_stop + } + } \cs_new_protected:Npn \__xparse_normalize_type_G:w #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn } - \__xparse_normalize_error_if_expandable:N G - \tl_put_right:Nn \l__xparse_arg_spec_tl { G {#1} } + \__xparse_normalize_check_gv:N G + \__xparse_add_arg_spec:n { G {#1} } \tl_put_right:Nn \l__xparse_last_delimiters_tl { { } } \__xparse_normalize_arg_spec_loop:n } @@ -483,12 +534,14 @@ \quark_if_recursion_tail_stop_do:Nn #1 { \__xparse_bad_arg_spec:wn } \tl_put_right:Nn \l__xparse_arg_spec_tl { t #1 } \tl_put_right:Nn \l__xparse_last_delimiters_tl {#1} + \bool_set_false:N \l__xparse_grab_expandably_bool + \bool_set_false:N \l__xparse_long_bool \__xparse_normalize_arg_spec_loop:n } \cs_new_protected:Npn \__xparse_normalize_type_l:w { - \__xparse_normalize_error_if_expandable:N l - \tl_put_right:Nn \l__xparse_arg_spec_tl { l } + \__xparse_normalize_check_lu:N l + \__xparse_add_arg_spec:n { l } \int_incr:N \l__xparse_mandatory_args_int \tl_clear:N \l__xparse_last_delimiters_tl \__xparse_normalize_arg_spec_loop:n @@ -496,7 +549,7 @@ \cs_new_protected:Npn \__xparse_normalize_type_m:w { \__xparse_delimiter_check:nnn { } { m } { \iow_char:N \{ } - \tl_put_right:Nn \l__xparse_arg_spec_tl { m } + \__xparse_add_arg_spec:n { m } \int_incr:N \l__xparse_mandatory_args_int \tl_clear:N \l__xparse_last_delimiters_tl \__xparse_normalize_arg_spec_loop:n @@ -507,24 +560,25 @@ \__xparse_single_token_check:n {#2} \quark_if_recursion_tail_stop_do:nn {#3} { \__xparse_bad_arg_spec:wn } \__xparse_delimiter_check:nnn {#1} { R/r } { \tl_to_str:n {#1} } - \tl_put_right:Nn \l__xparse_arg_spec_tl { R #1 #2 {#3} } + \__xparse_add_arg_spec:n { R #1 #2 {#3} } \int_incr:N \l__xparse_mandatory_args_int \tl_clear:N \l__xparse_last_delimiters_tl + \bool_set_false:N \l__xparse_grab_expandably_bool \__xparse_normalize_arg_spec_loop:n } \cs_new_protected:Npn \__xparse_normalize_type_u:w #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \__xparse_bad_arg_spec:wn } - \__xparse_normalize_error_if_expandable:N u - \tl_put_right:Nn \l__xparse_arg_spec_tl { u {#1} } + \__xparse_normalize_check_lu:N u + \__xparse_add_arg_spec:n { u {#1} } \int_incr:N \l__xparse_mandatory_args_int \tl_clear:N \l__xparse_last_delimiters_tl \__xparse_normalize_arg_spec_loop:n } \cs_new_protected:Npn \__xparse_normalize_type_v:w { - \__xparse_normalize_error_if_expandable:N v - \tl_put_right:Nn \l__xparse_arg_spec_tl { v } + \__xparse_normalize_check_gv:N v + \__xparse_add_arg_spec:n { v } \int_incr:N \l__xparse_mandatory_args_int \tl_clear:N \l__xparse_last_delimiters_tl \__xparse_normalize_arg_spec_loop:n @@ -538,7 +592,7 @@ \__xparse_bad_def:wn } } -\cs_new_protected:Npn \__xparse_normalize_error_if_expandable:N #1 +\cs_new_protected:Npn \__xparse_normalize_check_gv:N #1 { \bool_if:NT \l__xparse_expandable_bool { @@ -547,6 +601,20 @@ { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#1} } \__xparse_bad_def:wn } + \bool_set_false:N \l__xparse_grab_expandably_bool + } +\cs_new_protected:Npn \__xparse_normalize_check_lu:N #1 + { + \bool_if:NT \l__xparse_expandable_bool + { + \tl_if_empty:NF \l__xparse_last_delimiters_tl + { + \__msg_kernel_error:nnxx + { xparse } { invalid-after-optional-expandably } + { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#1} } + \__xparse_bad_def:wn + } + } } \cs_new_protected:Npn \__xparse_delimiter_check:nnn #1#2#3 { @@ -565,10 +633,29 @@ { \iow_char:N \\ \l__xparse_function_tl } { \tl_to_str:n {#2} } } \cs_new_protected:Npn \__xparse_bad_def:wn #1 \__xparse_break_point:n #2 { } +\cs_new_protected:Npn \__xparse_add_arg_spec:n #1 + { + \bool_if:NF \l__xparse_long_bool + { + \bool_if:NT \l__xparse_some_long_bool + { + \bool_if:NT \l__xparse_expandable_bool + { + \__msg_kernel_error:nnx { xparse } { inconsistent-long } + { \iow_char:N \\ \l__xparse_function_tl } + \__xparse_bad_def:wn + } + \bool_set_false:N \l__xparse_grab_expandably_bool + } + } + \bool_if:NTF \l__xparse_long_bool + { \bool_set_true:N \l__xparse_some_long_bool } + { \bool_set_true:N \l__xparse_some_short_bool } + \bool_set_false:N \l__xparse_long_bool + \tl_put_right:Nn \l__xparse_arg_spec_tl {#1} + } \cs_new_protected:Npn \__xparse_prepare_signature:n #1 { - \bool_set_false:N \l__xparse_all_long_bool - \bool_set_false:N \l__xparse_all_long_set_bool \int_zero:N \l__xparse_current_arg_int \bool_set_false:N \l__xparse_long_bool \int_zero:N \l__xparse_m_args_int @@ -593,7 +680,7 @@ \use:c { __xparse_add - \bool_if:NT \l__xparse_expandable_bool { _expandable } + \bool_if:NT \l__xparse_grab_expandably_bool { _expandable } _type_ \token_to_str:N #1 :w } } @@ -685,7 +772,7 @@ } \cs_new_protected:Npn \__xparse_flush_m_args: { - \int_compare:nNnT \l__xparse_m_args_int > \c_zero + \int_compare:nNnT \l__xparse_m_args_int > 0 { \tl_put_right:Nx \l__xparse_signature_tl { \exp_not:c { __xparse_grab_m_ \int_use:N \l__xparse_m_args_int :w } } @@ -716,7 +803,7 @@ { __xparse_grab_ #1 \bool_if:NT \l__xparse_long_bool { _long } - \int_compare:nNnF \l__xparse_mandatory_args_int > \c_zero + \int_compare:nNnF \l__xparse_mandatory_args_int > 0 { _trailing } :w } @@ -766,18 +853,16 @@ \tl_if_eq:nnTF {#2} {#3} { \__xparse_add_expandable_type_D_aux:NN #1 #2 } { \__xparse_add_expandable_type_D_aux:NNN #1 #2 #3 } - \bool_set_false:N \l__xparse_long_bool \__xparse_prepare_signature:N } \cs_new_protected:Npn \__xparse_add_expandable_type_D_aux:NNN #1#2#3 { - \__xparse_add_expandable_grabber:n {#1} - \bool_if:NTF \l__xparse_all_long_bool + \bool_if:NTF \l__xparse_long_bool { \cs_set:cpx } { \cs_set_nopar:cpx } { \l__xparse_expandable_aux_name_tl } ##1 ##2 #2 ##3 \q__xparse ##4 #3 { ##1 {##2} {##3} {##4} } - \tl_put_right:Nx \l__xparse_signature_tl + \__xparse_add_expandable_grabber:nn {#1} { \exp_not:c { \l__xparse_expandable_aux_name_tl } \exp_not:n { #2 #3 } @@ -785,13 +870,12 @@ } \cs_new_protected:Npn \__xparse_add_expandable_type_D_aux:NN #1#2 { - \__xparse_add_expandable_grabber:n { #1_alt } - \bool_if:NTF \l__xparse_all_long_bool + \bool_if:NTF \l__xparse_long_bool { \cs_set:cpx } { \cs_set_nopar:cpx } { \l__xparse_expandable_aux_name_tl } ##1 #2 ##2 #2 { ##1 {##2} } - \tl_put_right:Nx \l__xparse_signature_tl + \__xparse_add_expandable_grabber:nn { #1_alt } { \exp_not:c { \l__xparse_expandable_aux_name_tl } \exp_not:n {#2} @@ -800,10 +884,10 @@ \cs_new_protected:Npn \__xparse_add_expandable_type_E:w #1#2 { \__xparse_add_default_E:nn {#1} {#2} - \__xparse_add_expandable_grabber:n { E } \tl_clear:N \l__xparse_tmpb_tl \tl_map_function:nN {#1} \__xparse_add_expandable_type_E_aux:n - \tl_put_right:Nx \l__xparse_signature_tl + \__xparse_add_expandable_grabber:nn + { E \bool_if:NT \l__xparse_long_bool { _long } } { { \exp_not:o \l__xparse_tmpb_tl } { @@ -811,7 +895,6 @@ { { \c__xparse_no_value_tl } } } } - \bool_set_false:N \l__xparse_long_bool \__xparse_prepare_signature:N } \cs_new_protected:Npn \__xparse_add_expandable_type_E_aux:n #1 @@ -820,10 +903,13 @@ \tl_put_right:Nx \l__xparse_tmpb_tl { \exp_not:o \l__xparse_tmpa_tl \exp_not:N #1 } } +\cs_new_protected:Npn \__xparse_add_expandable_type_l:w + { \__xparse_add_expandable_type_u:w ## } \cs_new_protected:Npn \__xparse_add_expandable_type_m:w { \__xparse_add_default: - \__xparse_add_expandable_grabber:n { m } + \__xparse_add_expandable_grabber:nn + { m \bool_if:NT \l__xparse_long_bool { _long } } { } \__xparse_prepare_signature:N } \cs_new_protected:Npn \__xparse_add_expandable_type_R:w @@ -831,41 +917,30 @@ \cs_new_protected:Npn \__xparse_add_expandable_type_t:w #1 { \__xparse_add_default: - \__xparse_add_expandable_grabber_t: \__xparse_get_grabber:NN #1 \l__xparse_tmpa_tl - \tl_put_right:Nx \l__xparse_signature_tl + \__xparse_add_expandable_grabber:nn { t } { \exp_not:o \l__xparse_tmpa_tl \exp_not:N #1 } - \bool_set_false:N \l__xparse_long_bool \__xparse_prepare_signature:N } -\cs_new_protected:Npn \__xparse_add_expandable_grabber:n #1 +\cs_new_protected:Npn \__xparse_add_expandable_type_u:w #1 { - \bool_if:NTF \l__xparse_all_long_set_bool - { - \bool_if:nT - { \bool_xor_p:nn { \l__xparse_all_long_bool } { \l__xparse_long_bool } } - { - \__msg_kernel_error:nnx { xparse } { inconsistent-long } - { \iow_char:N \\ \l__xparse_function_tl } - \__xparse_bad_def:wn - } - } - { - \bool_set:Nn \l__xparse_all_long_bool { \l__xparse_long_bool } - \bool_set_true:N \l__xparse_all_long_set_bool - } - \tl_put_right:Nx \l__xparse_signature_tl - { \exp_not:c { __xparse_expandable_grab_ #1 :w } } - \bool_set_false:N \l__xparse_long_bool + \__xparse_add_default: + \bool_if:NTF \l__xparse_long_bool + { \cs_set:cpn } + { \cs_set_nopar:cpn } + { \l__xparse_expandable_aux_name_tl } ##1 \q__xparse ##2 ##3 ##4 #1 + { ##1 {##4} \q__xparse ##2 ##3 } + \__xparse_add_expandable_grabber:nn { u } + { \exp_not:c { \l__xparse_expandable_aux_name_tl } } + \__xparse_prepare_signature:N } -\cs_new_protected:Npn \__xparse_add_expandable_grabber_t: +\cs_new_protected:Npn \__xparse_add_expandable_grabber:nn #1#2 { - \tl_put_right:Nn \l__xparse_signature_tl - { \__xparse_expandable_grab_t:w } - \bool_set_false:N \l__xparse_long_bool + \tl_put_right:Nx \l__xparse_signature_tl + { \exp_not:c { __xparse_expandable_grab_ #1 :w } #2 } } \cs_new_protected:Npn \__xparse_get_grabber:NN #1#2 { @@ -1271,7 +1346,7 @@ \cs_new_protected:Npx \__xparse_grab_v_bgroup: { \exp_not:N \__xparse_grab_v_aux_catcodes: - \exp_not:n { \int_set_eq:NN \l__xparse_v_nesting_int \c_one } + \exp_not:n { \int_set:Nn \l__xparse_v_nesting_int { 1 } } \exp_not:N \__xparse_grab_v_aux_put:N \iow_char:N \{ \exp_not:N \__xparse_grab_v_bgroup_loop: } @@ -1288,7 +1363,7 @@ \token_if_eq_charcode:NNTF \c_group_end_token #1 { \int_decr:N \l__xparse_v_nesting_int - \int_compare:nNnTF \l__xparse_v_nesting_int > \c_zero + \int_compare:nNnTF \l__xparse_v_nesting_int > 0 { \__xparse_grab_v_aux_put:N #1 \__xparse_grab_v_bgroup_loop: @@ -1349,33 +1424,37 @@ \l__xparse_signature_tl \__xparse_run_code: } \cs_generate_variant:Nn \__xparse_add_arg:n { V , o , x } -\cs_new:Npn \__xparse_expandable_grab_D:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_D:NNNwNn #1 \q__xparse #2 } } +\cs_new:Npn \__xparse_expandable_grab_D:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_D:NNNwNNn #1 \q__xparse #2 #3 } } \cs_set_protected:Npn \__xparse_tmp:w #1 { - \cs_new:Npn \__xparse_expandable_grab_D:NNNwNn ##1##2##3##4 \q__xparse ##5##6 + \cs_new:Npn \__xparse_expandable_grab_D:NNNwNNn ##1##2##3##4 \q__xparse ##5##6##7 { - \str_if_eq:onTF - { ##1 { } { } ##6 ##2 \q__xparse ##3 } - { { } {##2} { } } + \str_if_eq:nnTF {##2} {##7} + { + \str_if_eq:onTF + { ##1 { } { } ##7 ##2 \q__xparse ##3 } + { { } {##2} { } } + } + { \use_ii:nn } { ##1 - { \__xparse_expandable_grab_D:NNNwNnnn ##1##2##3##4 \q__xparse ##5 } + { \__xparse_expandable_grab_D:NNNwNNnnn ##1##2##3##4 \q__xparse ##5##6 } \q_nil { } ##2 \ERROR \q__xparse \ERROR } - { ##4 {#1} \q__xparse ##5 {##6} } + { ##4 {#1} \q__xparse ##5 ##6 {##7} } } } \exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl } -\cs_new:Npn \__xparse_expandable_grab_D:NNNwNnnn #1#2#3#4 \q__xparse #5#6#7#8 +\cs_new:Npn \__xparse_expandable_grab_D:NNNwNNnnn #1#2#3#4 \q__xparse #5#6#7#8#9 { - \exp_args:Nof \__xparse_expandable_grab_D:nnNNNwN - { \use_ii:nn #6 #2 } - { \__xparse_expandable_grab_D:Nw #3 \exp_stop_f: #7 #8 } - #1#2#3 #4 \q__xparse #5 + \exp_args:Nof \__xparse_expandable_grab_D:nnNNNwNN + { \use_ii:nn #7 #2 } + { \__xparse_expandable_grab_D:Nw #3 \exp_stop_f: #8 #9 } + #1#2#3 #4 \q__xparse #5 #6 } \cs_new:Npn \__xparse_expandable_grab_D:Nw #1#2 \ERROR \ERROR { #2 #1 } -\cs_new:Npn \__xparse_expandable_grab_D:nnNNNwN #1#2#3#4#5#6 \q__xparse #7 +\cs_new:Npn \__xparse_expandable_grab_D:nnNNNwNN #1#2#3#4#5#6 \q__xparse #7#8 { \exp_args:No \tl_if_empty:oTF { #3 { \use_none:nnn } #2 \q__xparse #5 #4 \q__xparse #5 } @@ -1389,52 +1468,60 @@ { \__xparse_put_arg_expandable:ow { \use_iii:nnn #1#2 } } { \__xparse_put_arg_expandable:ow { \use_none:nn #1#2 } } } - #6 \q__xparse #7 + #6 \q__xparse #7 #8 } { #3 - { \__xparse_expandable_grab_D:NNNwNnnn #3#4#5#6 \q__xparse #7 } + { \__xparse_expandable_grab_D:NNNwNNnnn #3#4#5#6 \q__xparse #7 #8 } \q_nil {#1} #2 \ERROR \q__xparse \ERROR } } -\cs_new:Npn \__xparse_expandable_grab_D_alt:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_D_alt:NNwNn #1 \q__xparse #2 } } +\cs_new:Npn \__xparse_expandable_grab_D_alt:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_D_alt:NNwNNn #1 \q__xparse #2 #3 } } \cs_set_protected:Npn \__xparse_tmp:w #1 { - \cs_new:Npn \__xparse_expandable_grab_D_alt:NNwNn ##1##2##3 \q__xparse ##4##5 + \cs_new:Npn \__xparse_expandable_grab_D_alt:NNwNNn ##1##2##3 \q__xparse ##4##5##6 { - \str_if_eq:onTF - { ##1 { } ##5 ##2 ##2 } - { { } ##2 } + \str_if_eq:nnTF {##6} {##2} + { + \str_if_eq:onTF + { ##1 { } ##6 ##2 ##2 } + { { } ##2 } + } + { \use_ii:nn } { ##1 - { \__xparse_expandable_grab_D_alt:Nwn ##4 ##3 \q__xparse } - ##5 \ERROR + { \__xparse_expandable_grab_D_alt:NNwn ##4 ##5 ##3 \q__xparse } + ##6 \ERROR } - { ##3 {#1} \q__xparse ##4 {##5} } + { ##3 {#1} \q__xparse ##4 ##5 {##6} } } } \exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl } -\cs_new:Npn \__xparse_expandable_grab_D_alt:Nwn #1#2 \q__xparse #3 +\cs_new:Npn \__xparse_expandable_grab_D_alt:NNwn #1#2#3 \q__xparse #4 { - \tl_if_blank:oTF { \use_none:n #3 } - { \__xparse_put_arg_expandable:ow { \use_none:n #3 } } + \tl_if_blank:oTF { \use_none:n #4 } + { \__xparse_put_arg_expandable:ow { \use_none:n #4 } } { \str_if_eq_x:nnTF - { \exp_not:o { \use_none:n #3 } } - { { \exp_not:o { \use_ii:nnn #3 \q_nil } } } - { \__xparse_put_arg_expandable:ow { \use_ii:nn #3 } } - { \__xparse_put_arg_expandable:ow { \use_none:n #3 } } - } - #2 \q__xparse #1 - } -\cs_new:Npn \__xparse_expandable_grab_E:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_E_test:nnwn #1 \q__xparse #2 } } -\cs_new:Npn \__xparse_expandable_grab_E_test:nnwn #1#2#3 \q__xparse #4#5 - { - \__xparse_expandable_grab_E_loop:nnnNNw {#5} { } { } + { \exp_not:o { \use_none:n #4 } } + { { \exp_not:o { \use_ii:nnn #4 \q_nil } } } + { \__xparse_put_arg_expandable:ow { \use_ii:nn #4 } } + { \__xparse_put_arg_expandable:ow { \use_none:n #4 } } + } + #3 \q__xparse #1 #2 + } +\cs_new:Npn \__xparse_expandable_grab_E:w #1 \q__xparse #2#3 + { \__xparse_expandable_grab_E_aux:w #1 \q__xparse #2 #3 #3 } +\cs_new:Npn \__xparse_expandable_grab_E_long:w #1 \q__xparse #2#3 + { \__xparse_expandable_grab_E_aux:w #1 \q__xparse #2 #3 #2 } +\cs_new:Npn \__xparse_expandable_grab_E_aux:w #1 \q__xparse #2#3#4 + { #2 { \__xparse_expandable_grab_E_test:nnw #1 \q__xparse #2 #3 #4 } } +\cs_new:Npn \__xparse_expandable_grab_E_test:nnw #1#2#3 \q__xparse #4#5#6#7 + { + \__xparse_expandable_grab_E_loop:nnnNNw {#7} { } { } #1 \q_nil \q_nil \q_nil \q_mark #2 \q_nil - #3 \q__xparse #4 + #3 \q__xparse #4 #5 #6 } \cs_new:Npn \__xparse_expandable_grab_E_loop:nnnNNw #1#2#3#4#5#6 \q_nil #7 \q_mark #8 @@ -1445,7 +1532,7 @@ \__xparse_if_no_value:nTF {#8} { \str_if_eq:onTF { #4 { } #1 #5 } {#5} } { \use_ii:nn } - { \__xparse_expandable_grab_E_aux:w { #2 #4 #5 #6 } {#3} ~ } + { \__xparse_expandable_grab_E_find:w { #2 #4 #5 #6 } {#3} ~ } { \__xparse_expandable_grab_E_loop:nnnNNw {#1} { #2 #4 #5 } { #3 {#8} } @@ -1453,68 +1540,79 @@ } } } -\cs_new:Npn \__xparse_expandable_grab_E_aux:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_E_aux:nnw #1 \q__xparse #2 } } -\cs_new:Npn \__xparse_expandable_grab_E_aux:nnw #1#2#3 \q_nil #4 \q__xparse #5#6 - { \__xparse_expandable_grab_E:w {#1} { #2 {#6} #3 } #4 \q__xparse #5 } -\cs_new:Npn \__xparse_expandable_grab_E_end:nnw #1#2#3 \q__xparse #4 - { #3 {#2} \q__xparse #4 {#1} } -\cs_new:Npn \__xparse_expandable_grab_m:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2 } } -\cs_new:Npn \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2#3 - { #1 {#3} \q__xparse #2 } -\cs_new:Npn \__xparse_expandable_grab_R:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_R_aux:NNNwNn #1 \q__xparse #2 } } +\cs_new:Npn \__xparse_expandable_grab_E_find:w #1 \q__xparse #2#3#4 + { #4 { \__xparse_expandable_grab_E_find:nnw #1 \q__xparse #2 #3 #4 } } +\cs_new:Npn \__xparse_expandable_grab_E_find:nnw #1#2#3 \q_nil #4 \q__xparse #5#6#7#8 + { \__xparse_expandable_grab_E_aux:w {#1} { #2 {#8} #3 } #4 \q__xparse #5 #6 #7 } +\cs_new:Npn \__xparse_expandable_grab_E_end:nnw #1#2#3 \q__xparse #4#5#6 + { #3 {#2} \q__xparse #4 #5 {#1} } +\cs_new:Npn \__xparse_expandable_grab_m:w #1 \q__xparse #2#3 + { #3 { \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2 #3 } } +\cs_new:Npn \__xparse_expandable_grab_m_long:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2 #3 } } +\cs_new:Npn \__xparse_expandable_grab_m_aux:wNn #1 \q__xparse #2#3#4 + { #1 {#4} \q__xparse #2 #3 } +\cs_new:Npn \__xparse_expandable_grab_R:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_R_aux:NNNwNNn #1 \q__xparse #2#3 } } \cs_set_protected:Npn \__xparse_tmp:w #1 { - \cs_new:Npn \__xparse_expandable_grab_R_aux:NNNwNn ##1##2##3##4 \q__xparse ##5##6 + \cs_new:Npn \__xparse_expandable_grab_R_aux:NNNwNNn ##1##2##3##4 \q__xparse ##5##6##7 { - \str_if_eq:onTF - { ##1 { } { } ##6 ##2 \q__xparse ##3 } - { { } {##2} { } } + \str_if_eq:nnTF {##7} {##2} + { + \str_if_eq:onTF + { ##1 { } { } ##7 ##2 \q__xparse ##3 } + { { } {##2} { } } + } + { \use_ii:nn } { ##1 - { \__xparse_expandable_grab_D:NNNwNnnn ##1##2##3##4 \q__xparse ##5 } + { \__xparse_expandable_grab_D:NNNwNNnnn ##1##2##3##4 \q__xparse ##5##6 } \q_nil { } ##2 \ERROR \q__xparse \ERROR } { \__msg_kernel_expandable_error:nnnn { xparse } { missing-required } {##5} {##2} - ##4 {#1} \q__xparse ##5 {##6} + ##4 {#1} \q__xparse ##5 ##6 {##7} } } } \exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl } -\cs_new:Npn \__xparse_expandable_grab_R_alt:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_R_alt_aux:NNnwNn #1 \q__xparse #2 } } +\cs_new:Npn \__xparse_expandable_grab_R_alt:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_R_alt_aux:NNnwNn #1 \q__xparse #2#3 } } \cs_set_protected:Npn \__xparse_tmp:w #1 { - \cs_new:Npn \__xparse_expandable_grab_R_alt_aux:NNwNn ##1##2##3 \q__xparse ##4##5 + \cs_new:Npn \__xparse_expandable_grab_R_alt_aux:NNwNn ##1##2##3 \q__xparse ##4##5##6 { - \str_if_eq:onTF - { ##1 { } ##5 ##2 ##2 } - { { } ##2 } + \str_if_eq:nnTF {##6} {##2} + { + \str_if_eq:onTF + { ##1 { } ##6 ##2 ##2 } + { { } ##2 } + } + { \use_ii:nn } { ##1 - { \__xparse_expandable_grab_D_alt:Nwn ##4 ##3 \q__xparse } - ##5 \ERROR + { \__xparse_expandable_grab_D_alt:NNwn ##4 ##5 ##3 \q__xparse } + ##6 \ERROR } { \__msg_kernel_expandable_error:nnnn { xparse } { missing-required } {##4} {##2} - ##3 {#1} \q__xparse ##4 {##5} + ##3 {#1} \q__xparse ##4 ##5 {##6} } } } \exp_args:No \__xparse_tmp:w { \c__xparse_no_value_tl } -\cs_new:Npn \__xparse_expandable_grab_t:w #1 \q__xparse #2 - { #2 { \__xparse_expandable_grab_t_aux:NNwn #1 \q__xparse #2 } } -\cs_new:Npn \__xparse_expandable_grab_t_aux:NNwn #1#2#3 \q__xparse #4#5 +\cs_new:Npn \__xparse_expandable_grab_t:w #1 \q__xparse #2#3 + { #2 { \__xparse_expandable_grab_t_aux:NNwn #1 \q__xparse #2 #3 } } +\cs_new:Npn \__xparse_expandable_grab_t_aux:NNwn #1#2#3 \q__xparse #4#5#6 { - \str_if_eq:onTF { #1 { } #5 #2 } {#2} - { #3 { \BooleanTrue } \q__xparse #4 } - { #3 { \BooleanFalse } \q__xparse #4 {#5} } + \str_if_eq:onTF { #1 { } #6 #2 } {#2} + { #3 { \BooleanTrue } \q__xparse #4 #5 } + { #3 { \BooleanFalse } \q__xparse #4 #5 {#6} } } +\cs_new_eq:NN \__xparse_expandable_grab_u:w \prg_do_nothing: \cs_new:Npn \__xparse_put_arg_expandable:nw #1#2 \q__xparse { #2 {#1} \q__xparse } \cs_generate_variant:Nn \__xparse_put_arg_expandable:nw { o } \cs_new_protected:Npn \__xparse_bool_reverse:N #1 @@ -1567,27 +1665,27 @@ } \cs_new_protected:Npn \__xparse_split_argument_aux:nnnn #1#2#3#4 { - \int_compare:nNnF {#1} = { #2 + \c_one } + \int_compare:nNnF {#1} = { #2 + 1 } { - \int_compare:nNnTF {#1} > { #2 + \c_one } + \int_compare:nNnTF {#1} > { #2 + 1 } { \tl_set:Nx \ProcessedArgument { \exp_last_unbraced:NnNo \__xparse_split_argument_aux:n - { #2 + \c_one } + { #2 + 1 } \use_none_delimit_by_q_stop:w \ProcessedArgument \q_stop } \__msg_kernel_error:nnxxx { xparse } { split-excess-tokens } - { \tl_to_str:n {#3} } { \int_eval:n { #2 + \c_one } } + { \tl_to_str:n {#3} } { \int_eval:n { #2 + 1 } } { \tl_to_str:n {#4} } } { \tl_put_right:Nx \ProcessedArgument { - \prg_replicate:nn { #2 + \c_one - (#1) } + \prg_replicate:nn { #2 + 1 - (#1) } { { \exp_not:V \c__xparse_no_value_tl } } } } @@ -1749,7 +1847,7 @@ } { { \token_to_str:N \__xparse_start:nNNnnn } { } - { \token_to_str:N \__xparse_start_expandable:nNNNn } { } + { \token_to_str:N \__xparse_start_expandable:nNNNNn } { } } } \cs_new:Npn \__xparse_cmd_if_xparse_aux:w #1 ~ #2 \q_stop {#1} @@ -1764,16 +1862,16 @@ \__msg_kernel_new:nnnn { xparse } { command-already-defined } { Command~'#1'~already~defined! } { - You~have~used~\NewDocumentCommand + You~have~used~#2~ with~a~command~that~already~has~a~definition. \\ The~existing~definition~of~'#1'~will~not~be~altered. } \__msg_kernel_new:nnnn { xparse } { command-not-yet-defined } { Command ~'#1'~not~yet~defined! } { - You~have~used~\RenewDocumentCommand + You~have~used~#2~ with~a~command~that~was~never~defined. \\ - A~new~command~'#1'~will~be~created. + LaTeX~will~ignore~this~entire~definition. } \__msg_kernel_new:nnnn { xparse } { environment-already-defined } { Environment~'#1'~already~defined! } @@ -1787,7 +1885,7 @@ { You~have~used~\RenewDocumentEnvironment with~an~environment~that~was~never~defined. \\ - A~new~environment~'#1'~will~be~created. + LaTeX~will~ignore~this~entire~definition. } \__msg_kernel_new:nnnn { xparse } { expandable-ending-optional } { @@ -1804,8 +1902,8 @@ { Inconsistent~long~arguments~for~expandable~command~'#1'. } { \c__msg_coding_error_text_tl - The~arguments~for~an~expandable~command~must~either~all~be~ - short~or~all~be~long.~You~have~tried~to~mix~the~two~types. + The~arguments~for~an~expandable~command~must~not~involve~short~ + arguments~after~long~arguments.~You~have~tried~to~mix~the~two~types. } \__msg_kernel_new:nnnn { xparse } { invalid-expandable-argument-type } { Argument~type~'#2'~not~available~for~expandable~command~'#1'. } @@ -1816,6 +1914,18 @@ \\ \\ LaTeX~will~ignore~this~entire~definition. } +\__msg_kernel_new:nnnn { xparse } { invalid-after-optional-expandably } + { + Argument~type~'#2'~not~available~after~optional~argument~ + for~expandable~command~'#1'. + } + { + \c__msg_coding_error_text_tl + The~letter~'#2'~does~not~specify~an~argument~type~which~can~be~used~ + in~an~expandable~command~after~an~optional~argument. + \\ \\ + LaTeX~will~ignore~this~entire~definition. + } \__msg_kernel_new:nnnn { xparse } { loop-in-defaults } { Circular~dependency~in~defaults~of~'#1'. } { @@ -1958,21 +2068,23 @@ as~a~previous~optional~argument,~it~will~not~be~possible~to~ omit~all~optional~arguments~when~calling~this~command. } -\cs_new_eq:NN \BooleanFalse \c_false_bool -\cs_new_eq:NN \BooleanTrue \c_true_bool -\cs_new_protected:Npn \DeclareDocumentCommand #1#2#3 +\__msg_kernel_new:nnn { xparse } { unsupported-let } { - \__xparse_check_definable:nNT {#1} \DeclareDocumentCommand - { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } + The~command~'#1'~was~undefined~but~not~the~associated~commands~ + '#1~code'~and/or~'#1~defaults'.~Maybe~you~tried~using~ + \iow_char:N\\let.~This~may~lead~to~an~infinite~loop. } +\cs_new_eq:NN \BooleanFalse \c_false_bool +\cs_new_eq:NN \BooleanTrue \c_true_bool \cs_new_protected:Npn \NewDocumentCommand #1#2#3 { \__xparse_check_definable:nNT {#1} \NewDocumentCommand { \cs_if_exist:NTF #1 { - \__msg_kernel_error:nnx { xparse } { command-already-defined } - { \token_to_str:N #1 } + \__msg_kernel_error:nnxx { xparse } { command-already-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \NewDocumentCommand } } { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } } @@ -1984,8 +2096,9 @@ \cs_if_exist:NTF #1 { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } { - \__msg_kernel_error:nnx { xparse } { command-not-yet-defined } - { \token_to_str:N #1 } + \__msg_kernel_error:nnxx { xparse } { command-not-yet-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \RenewDocumentCommand } } } } @@ -1994,8 +2107,11 @@ \__xparse_check_definable:nNT {#1} \ProvideDocumentCommand { \cs_if_exist:NF #1 { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } } } -\cs_new_protected:Npn \DeclareDocumentEnvironment #1#2#3#4 - { \__xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } +\cs_new_protected:Npn \DeclareDocumentCommand #1#2#3 + { + \__xparse_check_definable:nNT {#1} \DeclareDocumentCommand + { \__xparse_declare_cmd:Nnn #1 {#2} {#3} } + } \cs_new_protected:Npn \NewDocumentEnvironment #1#2#3#4 { \cs_if_exist:cTF {#1} @@ -2010,6 +2126,42 @@ } \cs_new_protected:Npn \ProvideDocumentEnvironment #1#2#3#4 { \cs_if_exist:cF {#1} { \__xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } } +\cs_new_protected:Npn \DeclareDocumentEnvironment #1#2#3#4 + { \__xparse_declare_env:nnnn {#1} {#2} {#3} {#4} } +\cs_new_protected:Npn \NewExpandableDocumentCommand #1#2#3 + { + \__xparse_check_definable:nNT {#1} \NewExpandableDocumentCommand + { + \cs_if_exist:NTF #1 + { + \__msg_kernel_error:nnxx { xparse } { command-already-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \NewExpandableDocumentCommand } + } + { \__xparse_declare_expandable_cmd:Nnn #1 {#2} {#3} } + } + } +\cs_new_protected:Npn \RenewExpandableDocumentCommand #1#2#3 + { + \__xparse_check_definable:nNT {#1} \RenewExpandableDocumentCommand + { + \cs_if_exist:NTF #1 + { \__xparse_declare_expandable_cmd:Nnn #1 {#2} {#3} } + { + \__msg_kernel_error:nnxx { xparse } { command-not-yet-defined } + { \use:nnn \token_to_str:N #1 { } } + { \token_to_str:N \RenewExpandableDocumentCommand } + } + } + } +\cs_new_protected:Npn \ProvideExpandableDocumentCommand #1#2#3 + { + \__xparse_check_definable:nNT {#1} \ProvideExpandableDocumentCommand + { + \cs_if_exist:NF #1 + { \__xparse_declare_expandable_cmd:Nnn #1 {#2} {#3} } + } + } \cs_new_protected:Npn \DeclareExpandableDocumentCommand #1#2#3 { \__xparse_check_definable:nNT {#1} \DeclareExpandableDocumentCommand diff --git a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty index 47b2b06a1da..75598aca6e2 100644 --- a/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty +++ b/Master/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty @@ -23,8 +23,8 @@ %% (C) Copyright 2004-2010 Frank Mittelbach, %% The LaTeX3 Project %% (C) Copyright 2011-2016 The LaTeX3 Project -\RequirePackage{expl3}[2017/02/10] -\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +\@ifpackagelater{expl3}{2017/03/07} {} {% \PackageError{xtemplate}{Support package l3kernel too old} @@ -38,8 +38,8 @@ } \def\ExplFileName{xtemplate} \def\ExplFileDescription{L3 Experimental prototype document functions} -\def\ExplFileDate{2017/02/10} -\def\ExplFileVersion{6878} +\def\ExplFileDate{2017/03/07} +\def\ExplFileVersion{6984} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \tl_const:Nn \c__xtemplate_code_root_tl { template~code~>~ } @@ -213,21 +213,17 @@ \cs_new_protected:Npn \__xtemplate_declare_object_type:nn #1#2 { \int_set:Nn \l__xtemplate_tmp_int {#2} - \bool_if:nTF + \int_compare:nTF { 0 <= \l__xtemplate_tmp_int <= 9 } { - \int_compare_p:nNn {#2} > \c_nine || - \int_compare_p:nNn {#2} < \c_zero + \msg_info:nnxx { xtemplate } { declare-object-type } + {#1} { \exp_not:V \l__xtemplate_tmp_int } + \prop_gput:NnV \g__xtemplate_object_type_prop {#1} + \l__xtemplate_tmp_int } { \msg_error:nnxx { xtemplate } { bad-number-of-arguments } {#1} { \exp_not:V \l__xtemplate_tmp_int } } - { - \msg_info:nnxx { xtemplate } { declare-object-type } - {#1} {#2} - \prop_gput:NnV \g__xtemplate_object_type_prop {#1} - \l__xtemplate_tmp_int - } } \cs_new_protected:Npn \__xtemplate_declare_template_keys:nnnn #1#2#3#4 { |