From 6fca20c09474a7f6a3559af1c984243a83669f61 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 8 Mar 2017 23:01:35 +0000 Subject: l3 (8mar17) git-svn-id: svn://tug.org/texlive/trunk@43432 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/l3build/README.md | 2 +- Master/texmf-dist/doc/latex/l3build/l3build.pdf | Bin 612003 -> 611714 bytes .../texmf-dist/doc/latex/l3experimental/README.md | 4 +- .../doc/latex/l3experimental/l3str/l3flag.pdf | Bin 319867 -> 0 bytes .../doc/latex/l3experimental/l3str/l3regex.pdf | Bin 455237 -> 455897 bytes .../latex/l3experimental/l3str/l3str-convert.pdf | Bin 447064 -> 446541 bytes .../latex/l3experimental/l3str/l3str-format.pdf | Bin 379870 -> 380000 bytes .../latex/l3experimental/l3str/l3tl-analysis.pdf | Bin 354548 -> 354677 bytes .../doc/latex/l3experimental/l3str/l3tl-build.pdf | Bin 386642 -> 387359 bytes .../doc/latex/l3experimental/xcoffins/xcoffins.pdf | Bin 395870 -> 395864 bytes .../doc/latex/l3experimental/xgalley/l3galley.pdf | Bin 395000 -> 395648 bytes .../doc/latex/l3experimental/xgalley/xgalley.pdf | Bin 291075 -> 290759 bytes Master/texmf-dist/doc/latex/l3kernel/README.md | 4 +- Master/texmf-dist/doc/latex/l3kernel/expl3.pdf | Bin 586708 -> 587118 bytes .../texmf-dist/doc/latex/l3kernel/interface3.pdf | Bin 1512768 -> 1554821 bytes .../texmf-dist/doc/latex/l3kernel/l3docstrip.pdf | Bin 268790 -> 268784 bytes .../texmf-dist/doc/latex/l3kernel/l3obsolete.txt | 60 +- .../texmf-dist/doc/latex/l3kernel/l3styleguide.pdf | Bin 279987 -> 279980 bytes .../doc/latex/l3kernel/l3syntax-changes.pdf | Bin 220230 -> 220223 bytes Master/texmf-dist/doc/latex/l3kernel/source3.pdf | Bin 4622579 -> 4653880 bytes .../texmf-dist/doc/latex/l3kernel/source3body.tex | 26 +- Master/texmf-dist/doc/latex/l3packages/README.md | 14 +- .../doc/latex/l3packages/l3keys2e/l3keys2e.pdf | Bin 332682 -> 333356 bytes Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf | Bin 0 -> 303813 bytes .../doc/latex/l3packages/xfrac/xfrac.pdf | Bin 481425 -> 482083 bytes .../doc/latex/l3packages/xparse/xparse.pdf | Bin 463116 -> 480769 bytes .../doc/latex/l3packages/xtemplate/xtemplate.pdf | Bin 425806 -> 426464 bytes Master/texmf-dist/source/latex/l3build/l3build.dtx | 19 +- .../source/latex/l3experimental/l3str/l3flag.dtx | 306 --- .../source/latex/l3experimental/l3str/l3regex.dtx | 470 +++-- .../latex/l3experimental/l3str/l3str-convert.dtx | 124 +- .../latex/l3experimental/l3str/l3str-format.dtx | 31 +- .../source/latex/l3experimental/l3str/l3str.ins | 1 - .../latex/l3experimental/l3str/l3tl-analysis.dtx | 53 +- .../latex/l3experimental/l3str/l3tl-build.dtx | 12 +- .../latex/l3experimental/xgalley/l3galley.dtx | 145 +- .../latex/l3experimental/xgalley/xgalley.dtx | 12 +- Master/texmf-dist/source/latex/l3kernel/expl3.dtx | 12 +- Master/texmf-dist/source/latex/l3kernel/l3.ins | 2 + .../texmf-dist/source/latex/l3kernel/l3alloc.dtx | 265 +-- .../texmf-dist/source/latex/l3kernel/l3basics.dtx | 79 +- Master/texmf-dist/source/latex/l3kernel/l3box.dtx | 55 +- .../source/latex/l3kernel/l3candidates.dtx | 574 ++---- .../texmf-dist/source/latex/l3kernel/l3clist.dtx | 41 +- .../texmf-dist/source/latex/l3kernel/l3coffins.dtx | 23 +- .../source/latex/l3kernel/l3deprecation.dtx | 161 ++ Master/texmf-dist/source/latex/l3kernel/l3doc.dtx | 62 +- .../texmf-dist/source/latex/l3kernel/l3drivers.dtx | 6 +- .../texmf-dist/source/latex/l3kernel/l3expan.dtx | 6 +- Master/texmf-dist/source/latex/l3kernel/l3file.dtx | 758 +++++--- Master/texmf-dist/source/latex/l3kernel/l3flag.dtx | 351 ++++ .../texmf-dist/source/latex/l3kernel/l3format.ins | 6 +- .../source/latex/l3kernel/l3fp-assign.dtx | 15 +- .../texmf-dist/source/latex/l3kernel/l3fp-aux.dtx | 71 +- .../source/latex/l3kernel/l3fp-basics.dtx | 108 +- .../source/latex/l3kernel/l3fp-convert.dtx | 70 +- .../texmf-dist/source/latex/l3kernel/l3fp-expo.dtx | 189 +- .../source/latex/l3kernel/l3fp-extended.dtx | 48 +- .../source/latex/l3kernel/l3fp-logic.dtx | 12 +- .../source/latex/l3kernel/l3fp-parse.dtx | 158 +- .../source/latex/l3kernel/l3fp-random.dtx | 12 +- .../source/latex/l3kernel/l3fp-round.dtx | 96 +- .../source/latex/l3kernel/l3fp-traps.dtx | 70 +- .../texmf-dist/source/latex/l3kernel/l3fp-trig.dtx | 87 +- Master/texmf-dist/source/latex/l3kernel/l3fp.dtx | 151 +- Master/texmf-dist/source/latex/l3kernel/l3int.dtx | 118 +- Master/texmf-dist/source/latex/l3kernel/l3keys.dtx | 22 +- .../texmf-dist/source/latex/l3kernel/l3luatex.dtx | 97 +- Master/texmf-dist/source/latex/l3kernel/l3msg.dtx | 70 +- .../texmf-dist/source/latex/l3kernel/l3names.dtx | 14 +- .../source/latex/l3kernel/l3oldmodules.dtx | 2 +- Master/texmf-dist/source/latex/l3kernel/l3prg.dtx | 30 +- Master/texmf-dist/source/latex/l3kernel/l3prop.dtx | 20 +- .../texmf-dist/source/latex/l3kernel/l3quark.dtx | 30 +- Master/texmf-dist/source/latex/l3kernel/l3seq.dtx | 26 +- Master/texmf-dist/source/latex/l3kernel/l3skip.dtx | 87 +- Master/texmf-dist/source/latex/l3kernel/l3sort.dtx | 80 +- Master/texmf-dist/source/latex/l3kernel/l3str.dtx | 95 +- Master/texmf-dist/source/latex/l3kernel/l3sys.dtx | 13 +- Master/texmf-dist/source/latex/l3kernel/l3tl.dtx | 67 +- .../texmf-dist/source/latex/l3kernel/l3token.dtx | 84 +- .../source/latex/l3packages/l3keys2e/l3keys2e.dtx | 8 +- .../texmf-dist/source/latex/l3packages/xfp/xfp.dtx | 167 ++ .../texmf-dist/source/latex/l3packages/xfp/xfp.ins | 45 + .../source/latex/l3packages/xfrac/xfrac.dtx | 8 +- .../source/latex/l3packages/xparse/xparse.dtx | 894 +++++---- .../latex/l3packages/xtemplate/xtemplate.dtx | 22 +- Master/texmf-dist/tex/latex/l3build/l3build.lua | 41 +- .../tex/latex/l3build/regression-test.tex | 2 +- .../tex/latex/l3experimental/l3str/l3flag.sty | 92 - .../latex/l3experimental/l3str/l3regex-trace.sty | 422 +++-- .../tex/latex/l3experimental/l3str/l3regex.sty | 418 ++-- .../latex/l3experimental/l3str/l3str-convert.sty | 71 +- .../l3experimental/l3str/l3str-enc-iso88591.def | 2 +- .../l3experimental/l3str/l3str-enc-iso885910.def | 2 +- .../l3experimental/l3str/l3str-enc-iso885911.def | 2 +- .../l3experimental/l3str/l3str-enc-iso885913.def | 2 +- .../l3experimental/l3str/l3str-enc-iso885914.def | 2 +- .../l3experimental/l3str/l3str-enc-iso885915.def | 2 +- .../l3experimental/l3str/l3str-enc-iso885916.def | 2 +- .../l3experimental/l3str/l3str-enc-iso88592.def | 2 +- .../l3experimental/l3str/l3str-enc-iso88593.def | 2 +- .../l3experimental/l3str/l3str-enc-iso88594.def | 2 +- .../l3experimental/l3str/l3str-enc-iso88595.def | 2 +- .../l3experimental/l3str/l3str-enc-iso88596.def | 2 +- .../l3experimental/l3str/l3str-enc-iso88597.def | 2 +- .../l3experimental/l3str/l3str-enc-iso88598.def | 2 +- .../l3experimental/l3str/l3str-enc-iso88599.def | 2 +- .../latex/l3experimental/l3str/l3str-enc-utf16.def | 9 +- .../latex/l3experimental/l3str/l3str-enc-utf32.def | 6 +- .../latex/l3experimental/l3str/l3str-enc-utf8.def | 8 +- .../latex/l3experimental/l3str/l3str-esc-hex.def | 4 +- .../latex/l3experimental/l3str/l3str-esc-name.def | 4 +- .../l3experimental/l3str/l3str-esc-string.def | 12 +- .../latex/l3experimental/l3str/l3str-esc-url.def | 4 +- .../latex/l3experimental/l3str/l3str-format.sty | 30 +- .../latex/l3experimental/l3str/l3tl-analysis.sty | 53 +- .../tex/latex/l3experimental/l3str/l3tl-build.sty | 12 +- .../tex/latex/l3experimental/xgalley/l3galley.sty | 137 +- .../tex/latex/l3experimental/xgalley/xgalley.sty | 12 +- .../texmf-dist/tex/latex/l3kernel/expl3-code.tex | 1987 ++++++++++++-------- .../tex/latex/l3kernel/expl3-generic.tex | 12 +- Master/texmf-dist/tex/latex/l3kernel/expl3.lua | 2 +- Master/texmf-dist/tex/latex/l3kernel/expl3.sty | 4 +- Master/texmf-dist/tex/latex/l3kernel/l3basics.sty | 2 +- .../texmf-dist/tex/latex/l3kernel/l3bootstrap.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3box.sty | 2 +- .../texmf-dist/tex/latex/l3kernel/l3candidates.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3clist.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3coffins.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3color.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3doc.cls | 46 +- .../texmf-dist/tex/latex/l3kernel/l3dvipdfmx.def | 4 +- Master/texmf-dist/tex/latex/l3kernel/l3dvips.def | 4 +- Master/texmf-dist/tex/latex/l3kernel/l3dvisvgm.def | 4 +- Master/texmf-dist/tex/latex/l3kernel/l3expan.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3file.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3fp.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3int.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3keys.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3msg.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3names.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3pdfmode.def | 4 +- Master/texmf-dist/tex/latex/l3kernel/l3prg.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3prop.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3quark.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3seq.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3skip.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3sort.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3str.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3tl.sty | 2 +- Master/texmf-dist/tex/latex/l3kernel/l3token.sty | 2 +- .../texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def | 4 +- .../tex/latex/l3packages/l3keys2e/l3keys2e.sty | 8 +- Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty | 44 + .../tex/latex/l3packages/xfrac/xfrac.sty | 8 +- .../tex/latex/l3packages/xparse/xparse.sty | 504 +++-- .../tex/latex/l3packages/xtemplate/xtemplate.sty | 22 +- 158 files changed, 6289 insertions(+), 4551 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf create mode 100644 Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf delete mode 100644 Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx create mode 100644 Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx create mode 100644 Master/texmf-dist/source/latex/l3kernel/l3flag.dtx create mode 100644 Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx create mode 100644 Master/texmf-dist/source/latex/l3packages/xfp/xfp.ins delete mode 100644 Master/texmf-dist/tex/latex/l3experimental/l3str/l3flag.sty create mode 100644 Master/texmf-dist/tex/latex/l3packages/xfp/xfp.sty diff --git a/Master/texmf-dist/doc/latex/l3build/README.md b/Master/texmf-dist/doc/latex/l3build/README.md index 7d788330b82..ed2078b60ce 100644 --- a/Master/texmf-dist/doc/latex/l3build/README.md +++ b/Master/texmf-dist/doc/latex/l3build/README.md @@ -1,7 +1,7 @@ l3build: a testing and building system for LaTeX3 ================================================= -Release 2017/01/25 (r6826) +Release 2017/03/07 (r6984) Overview -------- diff --git a/Master/texmf-dist/doc/latex/l3build/l3build.pdf b/Master/texmf-dist/doc/latex/l3build/l3build.pdf index 9f33b827f8c..bd2315837f6 100644 Binary files a/Master/texmf-dist/doc/latex/l3build/l3build.pdf and b/Master/texmf-dist/doc/latex/l3build/l3build.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3experimental/README.md b/Master/texmf-dist/doc/latex/l3experimental/README.md index 3c36ac44de5..828699472e2 100644 --- a/Master/texmf-dist/doc/latex/l3experimental/README.md +++ b/Master/texmf-dist/doc/latex/l3experimental/README.md @@ -1,7 +1,7 @@ Experimental LaTeX3 Concepts ============================ -Release 2017/02/10 (r6878) +Release 2017/03/07 (r6984) Overview -------- @@ -115,6 +115,6 @@ the [LaTeX-L list](#Discussion) should be used. ----- -

Copyright (C) 1998-2011,2015 The LaTeX3 Project
+

Copyright (C) 1998-2011,2015-2017 The LaTeX3 Project
http://latex-project.org/
All rights reserved.

diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf deleted file mode 100644 index 80cdf369baf..00000000000 Binary files a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3flag.pdf and /dev/null differ diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf index dd5b7443734..a32f1074aa6 100644 Binary files a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf and b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3regex.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf index f49b760dac4..27902d833ed 100644 Binary files a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf and b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-convert.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf index 841dd6f3c27..822ad2a9bc2 100644 Binary files a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf and b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3str-format.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf index ec8e2e53d3f..2a96fe2dc1e 100644 Binary files a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf and b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-analysis.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf index 7730c6f57c0..af10ae8aa7d 100644 Binary files a/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf and b/Master/texmf-dist/doc/latex/l3experimental/l3str/l3tl-build.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf b/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf index 00926241798..b0d25b1f9af 100644 Binary files a/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf and b/Master/texmf-dist/doc/latex/l3experimental/xcoffins/xcoffins.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf b/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf index 58c2cc7d4f4..ac48998b934 100644 Binary files a/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf and b/Master/texmf-dist/doc/latex/l3experimental/xgalley/l3galley.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf b/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf index 64ab29e99eb..eda168f82e7 100644 Binary files a/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf and b/Master/texmf-dist/doc/latex/l3experimental/xgalley/xgalley.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3kernel/README.md b/Master/texmf-dist/doc/latex/l3kernel/README.md index e658fadb621..32e54312ac6 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/README.md +++ b/Master/texmf-dist/doc/latex/l3kernel/README.md @@ -1,7 +1,7 @@ LaTeX3 Programming Conventions ============================== -Release 2017/02/10 (r6878) +Release 2017/03/07 (r6984) Overview -------- @@ -101,6 +101,6 @@ the [LaTeX-L list](#Discussion) should be used. ----- -

Copyright (C) 1998-2012,2015 The LaTeX3 Project
+

Copyright (C) 1998-2012,2015-2017 The LaTeX3 Project
http://latex-project.org/
All rights reserved.

diff --git a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf index c723b16b3cb..b950eff58dd 100644 Binary files a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf and b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf index ad8bb1536b8..17f9f14bd29 100644 Binary files a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf and b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3docstrip.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3docstrip.pdf index 3c046c52946..cbb4fbe6a6e 100644 Binary files a/Master/texmf-dist/doc/latex/l3kernel/l3docstrip.pdf and b/Master/texmf-dist/doc/latex/l3kernel/l3docstrip.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3obsolete.txt b/Master/texmf-dist/doc/latex/l3kernel/l3obsolete.txt index 6798fbbcf88..8d53477ecdc 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3obsolete.txt +++ b/Master/texmf-dist/doc/latex/l3kernel/l3obsolete.txt @@ -15,11 +15,15 @@ They will be removed from the sources at the end of the given year. -------------------------------------- Function Expires end -------------------------------------- -\iow_get_str:NN 2017 +\c_minus_one 2018 +\ior_get_str:NN 2017 \sort_ordered: 2018 \sort_reversed: 2018 \tl_to_lowercase:n 2017 \tl_to_uppercase:n 2017 +[fp function] round+ 2017 +[fp function] round- 2017 +[fp function] round0 2017 --------------------------------------- Removed functions and variables @@ -91,6 +95,7 @@ Function Date removed SVN \char_value_mathcode:w 2011-09-08 2786 \char_value_sfcode:w 2011-09-08 2786 \char_value_uccode:w 2011-09-08 2786 +\chk_if_free_cs:N 2013-01-08 4412 \clist_display:c 2011-09-08 2786 \clist_display:N 2011-09-08 2786 \clist_gremove_element:Nn 2011-09-08 2786 @@ -108,16 +113,15 @@ Function Date removed SVN \clist_if_eq:NcF 2013-01-08 4412 \clist_if_eq:NcT 2013-01-08 4412 \clist_if_eq:NcTF 2013-01-08 4412 +\clist_length:c 2013-01-08 4412 \clist_length:N 2013-01-08 4412 \clist_length:n 2013-01-08 4412 -\clist_length:c 2013-01-08 4412 \clist_remove_element:Nn 2011-09-08 2786 \clist_top:cN 2011-09-08 2786 \clist_trim_spaces:c 2011-12-20 3114 \clist_trim_spaces:N 2011-12-20 3114 -\clist_use:N 2013-01-08 4412 \clist_use:c 2013-01-08 4412 -\chk_if_free_cs:N 2013-01-08 4412 +\clist_use:N 2013-01-08 4412 \cs_gnew_eq:cc 2011-09-08 2786 \cs_gnew_eq:cN 2011-09-08 2786 \cs_gnew_eq:Nc 2011-09-08 2786 @@ -153,10 +157,6 @@ Function Date removed SVN \dim_set_min:Nn 2013-01-08 4412 \ExplSyntaxNamesOff 2013-01-08 4420 \ExplSyntaxNamesOn 2013-01-08 4420 -\fp_if_undefined_p:N 2014-05-28 4911 -\fp_if_undefined:NF 2014-05-28 4911 -\fp_if_undefined:NT 2014-05-28 4911 -\fp_if_undefined:NTF 2014-05-28 4911 \fp_abs:c 2014-05-28 4911 \fp_abs:N 2014-05-28 4911 \fp_compare:NNNF 2014-05-28 4911 @@ -216,26 +216,26 @@ Function Date removed SVN \fp_sin:Nn 2014-05-28 4911 \fp_tan:cn 2014-05-28 4911 \fp_tan:Nn 2014-05-28 4911 -\hbox_gset_inline_begin:N 2014-08-09 5822 -\hbox_gset_inline_begin:c 2014-08-09 5822 -\hbox_gset_inline_end: 2014-08-09 5822 -\hbox_set_inline_begin:N 2014-08-09 5822 -\hbox_set_inline_begin:c 2014-08-09 5822 -\hbox_set_inline_end: 2014-08-09 5822 \g_tmpa_toks 2011-09-08 2786 \g_tmpb_toks 2011-09-08 2786 \g_tmpc_toks 2011-09-08 2786 \group_execute_after:N 2011-09-08 2786 +\hbox_gset_inline_begin:c 2014-08-09 5822 +\hbox_gset_inline_begin:N 2014-08-09 5822 +\hbox_gset_inline_end: 2014-08-09 5822 +\hbox_set_inline_begin:c 2014-08-09 5822 +\hbox_set_inline_begin:N 2014-08-09 5822 +\hbox_set_inline_end: 2014-08-09 5822 \if_num:w 2013-01-08 4412 \int_case:nnn 2015-07-14 5659 \int_convert_from_base_ten:nn 2011-11-22 2986 \int_convert_from_symbols:nn 2011-11-22 2986 \int_convert_to_base_ten:nn 2011-11-22 2986 +\int_eval:w 2013-01-08 4412 +\int_eval_end: 2013-01-08 4412 \int_from_binary:n 2016-01-05 6366 \int_from_hexadecimal:n 2016-01-05 6366 \int_from_octal:n 2016-01-05 6366 -\int_eval:w 2013-01-08 4412 -\int_eval_end: 2013-01-08 4412 \int_to_binary:n 2016-01-05 6366 \int_to_hexadecimal:n 2016-01-05 6366 \int_to_octal:n 2016-01-05 6366 @@ -243,9 +243,9 @@ Function Date removed SVN \int_value:w 2013-01-08 4412 \ior_gto:NN 2013-07-28 4581 \ior_open_streams: 2011-09-08 2786 -\ior_to:NN 2013-07-28 4581 \ior_str_gto:NN 2013-07-28 4581 \ior_str_to:NN 2013-07-28 4581 +\ior_to:NN 2013-07-28 4581 \iow_now_buffer_safe:Nn 2011-09-08 2786 \iow_now_buffer_safe:Nx 2011-09-08 2786 \iow_now_when_avail:Nn 2012-06-05 3752 @@ -263,8 +263,8 @@ Function Date removed SVN \l_tmpc_int 2013-01-08 4412 \l_tmpc_toks 2011-09-08 2786 \luatex_if_engine_p: 2017-01-01 6811 -\luatex_if_engine:T 2017-01-01 6811 \luatex_if_engine:F 2017-01-01 6811 +\luatex_if_engine:T 2017-01-01 6811 \luatex_if_engine:TF 2017-01-01 6811 \msg_class_new:nn 2011-09-08 2786 \msg_class_set:nn 2013-01-08 4412 @@ -286,8 +286,8 @@ Function Date removed SVN \msg_trace:nnxxxx 2011-09-08 2786 \msg_two_newlines: 2013-01-08 4412 \pdftex_if_engine_p: 2017-01-01 6811 -\pdftex_if_engine:T 2017-01-01 6811 \pdftex_if_engine:F 2017-01-01 6811 +\pdftex_if_engine:T 2017-01-01 6811 \pdftex_if_engine:TF 2017-01-01 6811 \peek_after:NN 2011-09-08 2786 \peek_gafter:NN 2011-09-08 2786 @@ -307,14 +307,14 @@ Function Date removed SVN \prop_del:cV 2013-01-08 4412 \prop_del:Nn 2013-01-08 4412 \prop_del:NV 2013-01-08 4412 +\prop_display:c 2011-09-08 2786 +\prop_display:N 2011-09-08 2786 \prop_gdel:cn 2013-01-08 4412 \prop_gdel:cV 2013-01-08 4412 \prop_gdel:Nn 2013-01-08 4412 \prop_gdel:NV 2013-01-08 4412 \prop_get:cn 2016-01-05 6366 \prop_get:Nn 2016-01-05 6366 -\prop_display:c 2011-09-08 2786 -\prop_display:N 2011-09-08 2786 \prop_get_gdel:NnN 2011-09-08 2786 \prop_gget:cnN 2011-09-08 2786 \prop_gget:cVN 2011-09-08 2786 @@ -359,8 +359,8 @@ Function Date removed SVN \str_case:onn 2015-07-14 5659 \str_case_x:nnn 2015-07-14 5659 \str_if_eq_p:xx 2013-01-08 4412 -\str_if_eq:xxT 2013-01-08 4412 \str_if_eq:xxF 2013-01-08 4412 +\str_if_eq:xxT 2013-01-08 4412 \str_if_eq:xxTF 2013-01-08 4412 \tl_case:cnn 2015-07-14 5659 \tl_case:Nnn 2015-07-14 5659 @@ -383,8 +383,8 @@ Function Date removed SVN \tl_head_iii:f 2011-09-08 2786 \tl_head_iii:n 2011-09-08 2786 \tl_head_iii:w 2011-09-08 2786 -\tl_if_empty:xT 2013-01-08 4412 \tl_if_empty:xF 2013-01-08 4412 +\tl_if_empty:xT 2013-01-08 4412 \tl_if_empty:xTF 2013-01-08 4412 \tl_if_head_group_p:n 2013-01-08 4412 \tl_if_head_group:nF 2013-01-08 4412 @@ -527,20 +527,20 @@ Function Date removed SVN \toks_use_gclear:N 2011-09-08 2786 \toks_use:c 2011-09-08 2786 \toks_use:N 2011-09-08 2786 -\use_i_after_fi:nw 2011-12-30 3114 \use_i_after_else:nw 2011-12-30 3114 +\use_i_after_fi:nw 2011-12-30 3114 \use_i_after_or:nw 2011-12-30 3114 \use_i_after_orelse:nw 2011-12-30 3114 -\xetex_if_engine_p: 2017-01-01 6811 -\xetex_if_engine:T 2017-01-01 6811 -\xetex_if_engine:F 2017-01-01 6811 -\xetex_if_engine:TF 2017-01-01 6811 -\vbox_gset_inline_begin:N 2014-08-09 5822 \vbox_gset_inline_begin:c 2014-08-09 5822 +\vbox_gset_inline_begin:N 2014-08-09 5822 \vbox_gset_inline_end: 2014-08-09 5822 -\vbox_set_inline_begin:N 2014-08-09 5822 \vbox_set_inline_begin:c 2014-08-09 5822 +\vbox_set_inline_begin:N 2014-08-09 5822 \vbox_set_inline_end: 2014-08-09 5822 +\xetex_if_engine_p: 2017-01-01 6811 +\xetex_if_engine:F 2017-01-01 6811 +\xetex_if_engine:T 2017-01-01 6811 +\xetex_if_engine:TF 2017-01-01 6811 [key property] .choice_code:n 2015-07-14 5655 [key property] .choice_code:x 2015-07-14 5655 [key property] .code:x 2013-07-10 4539 diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf index 502f0ec4b07..d016222c467 100644 Binary files a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf and b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf index e69dedc8bed..80cf6343057 100644 Binary files a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf and b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3.pdf b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf index 2fa2ada6a74..4887f8c7f43 100644 Binary files a/Master/texmf-dist/doc/latex/l3kernel/source3.pdf and b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3body.tex b/Master/texmf-dist/doc/latex/l3kernel/source3body.tex index 03a9a144e9d..86203d42ac6 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/source3body.tex +++ b/Master/texmf-dist/doc/latex/l3kernel/source3body.tex @@ -342,9 +342,9 @@ them to be used for different \enquote{true}/\enquote{false} branches, depending on which outcome the conditional is being used to test. To indicate this without repetition, this information is given in a shortened form: -\begin{function}[EXP,TF, label = ]{\xetex_if_engine:} +\begin{function}[EXP,TF, label = ]{\sys_if_engine_xetex:} \begin{syntax} - |\xetex_if_engine:TF| \Arg{true code} \Arg{false code} + |\sys_if_engine_xetex:TF| \Arg{true code} \Arg{false code} \end{syntax} The underlining and italic of \texttt{TF} indicates that |\xetex_if_engine:T|, |\xetex_if_engine:F| and @@ -415,22 +415,20 @@ used on top of \LaTeXe{} if \cs{outer} tokens are used in the arguments. \DocInput{l3names.dtx} \DocInput{l3basics.dtx} \DocInput{l3expan.dtx} -\DocInput{l3prg.dtx} -\DocInput{l3quark.dtx} -\DocInput{l3token.dtx} -\DocInput{l3int.dtx} -\DocInput{l3skip.dtx} \DocInput{l3tl.dtx} \DocInput{l3str.dtx} \DocInput{l3seq.dtx} +\DocInput{l3int.dtx} +\DocInput{l3flag.dtx} +\DocInput{l3quark.dtx} +\DocInput{l3prg.dtx} \DocInput{l3clist.dtx} +\DocInput{l3token.dtx} \DocInput{l3prop.dtx} -\DocInput{l3box.dtx} -\DocInput{l3coffins.dtx} -\DocInput{l3color.dtx} \DocInput{l3msg.dtx} -\DocInput{l3keys.dtx} \DocInput{l3file.dtx} +\DocInput{l3skip.dtx} +\DocInput{l3keys.dtx} \DocInput{l3fp.dtx} % To get the various submodules of l3fp to appear in the implementation % part only, they have to be added to the documentation list after typesetting @@ -454,8 +452,12 @@ used on top of \LaTeXe{} if \cs{outer} tokens are used in the arguments. \ExplSyntaxOff \DocInput{l3sort.dtx} -\DocInput{l3candidates.dtx} +\DocInput{l3box.dtx} +\DocInput{l3coffins.dtx} +\DocInput{l3color.dtx} \DocInput{l3sys.dtx} +\DocInput{l3deprecation.dtx} +\DocInput{l3candidates.dtx} \DocInput{l3luatex.dtx} \DocInput{l3drivers.dtx} diff --git a/Master/texmf-dist/doc/latex/l3packages/README.md b/Master/texmf-dist/doc/latex/l3packages/README.md index bde812d1d7e..51279084af8 100644 --- a/Master/texmf-dist/doc/latex/l3packages/README.md +++ b/Master/texmf-dist/doc/latex/l3packages/README.md @@ -1,7 +1,7 @@ LaTeX3 High-Level Concepts ========================== -Release 2017/02/10 (r6878) +Release 2017/03/07 (r6984) Overview -------- @@ -21,6 +21,7 @@ updated at the same time. Currently included in the CTAN release of `l3packages` are the following bundles: * `l3keys2e` +* `xfp` * `xfrac` * `xparse` * `xtemplate` @@ -33,6 +34,15 @@ and class options with LaTeX2e. This is tied to the method the existing kernel uses for processing options, and so it is likely that a stand-alone LaTeX3 kernel will use a very different approach. +`xfp` +----- + +The `xfp` package provides a document-level interface for the LaTeX3 +FPU. As such, it is a wrapper around the core `\fp_eval:n` function +but does not require code syntax. It provides the expandable command +`\fpeval`, which can be used inside for example `\edef` or contexts +where TeX requires a number. + `xfrac` ------- @@ -112,6 +122,6 @@ the [LaTeX-L list](#Discussion) should be used. ----- -

Copyright (C) 1998-2011,2015 The LaTeX3 Project
+

Copyright (C) 1998-2011,2015-2017 The LaTeX3 Project
http://latex-project.org/
All rights reserved.

diff --git a/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf b/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf index 80eb76b61d9..085d4d24496 100644 Binary files a/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf and b/Master/texmf-dist/doc/latex/l3packages/l3keys2e/l3keys2e.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf b/Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf new file mode 100644 index 00000000000..a58f7e7bcbe Binary files /dev/null and b/Master/texmf-dist/doc/latex/l3packages/xfp/xfp.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf b/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf index 68c509710ac..3d267d9e329 100644 Binary files a/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf and b/Master/texmf-dist/doc/latex/l3packages/xfrac/xfrac.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf b/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf index 153306a6758..47eeedfc227 100644 Binary files a/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf and b/Master/texmf-dist/doc/latex/l3packages/xparse/xparse.pdf differ diff --git a/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf b/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf index feffee6e41b..6ccdd399816 100644 Binary files a/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf and b/Master/texmf-dist/doc/latex/l3packages/xtemplate/xtemplate.pdf differ diff --git a/Master/texmf-dist/source/latex/l3build/l3build.dtx b/Master/texmf-dist/source/latex/l3build/l3build.dtx index 9d90382b555..1c57945c9cc 100644 --- a/Master/texmf-dist/source/latex/l3build/l3build.dtx +++ b/Master/texmf-dist/source/latex/l3build/l3build.dtx @@ -24,8 +24,8 @@ \RequirePackage{expl3} \def\ExplFileName{l3build} \def\ExplFileDescription{L3 Regression test suite} -\def\ExplFileDate{2017/01/25} -\def\ExplFileVersion{6826} +\def\ExplFileDate{2017/03/07} +\def\ExplFileVersion{6984} \documentclass[full]{l3doc} \renewcommand\partname{Part} \usepackage{multicol,needspace} @@ -306,7 +306,7 @@ % testing % \item \texttt{--halt-on-error} (\texttt{-H}) Specifies that checks % should stop as soon as possible, rather than running all requested -% tests +% tests; the difference file is printed in the terminal directly in the case of failure % \item \texttt{--pdf} (\texttt{-p}) Test PDF file against a reference % version rather than using a log comparison % \item \texttt{--quiet} (\texttt{-q}) Suppresses output from unpacking @@ -603,7 +603,7 @@ % \pkg{l3build} will read |config.lua| within the directory (if available). This % should comprise a list of settings which apply to the tests in place of those in % the main build script. -% +% % For example, for the core \LaTeXe{} tests the main test files are contained % in a directory |testfiles| and have \var{checksearch} set \var{false}. To test % font loading for \XeTeX{} and \LuaTeX{} there are a second set of tests in @@ -688,7 +688,6 @@ % years due to a \TeX{} bug). % \item Conversion of \texttt{on line \meta{number}} to \texttt{on line ...} % to allow flexibility in changes to test files. -% \item % \end{itemize} % % \LuaTeX{} makes several additional changes to the log file. As normalising @@ -783,11 +782,11 @@ % \bool_set:Nn \l_tmpa_bool % { % \int_compare_p:nNn 1=1 -% && \bool_if_p:n +% && \bool_lazy_any_p:n % { -% \int_compare_p:nNn 2=3 || -% \int_compare_p:nNn 4=4 || -% \int_compare_p:nNn 1=\ERROR % is skipped +% { \int_compare_p:nNn 2=3 } +% { \int_compare_p:nNn 4=4 } +% { \int_compare_p:nNn 1=\ERROR } % is skipped % } % && \int_compare_p:nNn 2=2 % } @@ -1245,7 +1244,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/source/latex/l3experimental/l3str/l3flag.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx deleted file mode 100644 index ef80dc1a7ba..00000000000 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3flag.dtx +++ /dev/null @@ -1,306 +0,0 @@ -% \iffalse meta-comment -% -%% File: l3flag.dtx Copyright (C) 2011-2012,2014-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. -% -% ----------------------------------------------------------------------- -% -% The development version of the bundle can be found at -% -% https://github.com/latex3/latex3 -% -% for those people who are interested. -% -%<*driver|package> -% The version of expl3 required is tested as early as possible, as -% some really old versions do not define \ProvidesExplPackage. -\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} -% -%<*driver> -\documentclass[full]{l3doc} -\usepackage{amsmath} -\begin{document} - \DocInput{\jobname.dtx} -\end{document} -% -% \fi -% -% -% \title{^^A -% The \textsf{l3flag} package: expandable flags^^A -% \thanks{This file describes v\ExplFileVersion, -% last revised \ExplFileDate.}^^A -% } -% -% \author{^^A -% The \LaTeX3 Project\thanks -% {^^A -% E-mail: -% \href{mailto:latex-team@latex-project.org} -% {latex-team@latex-project.org}^^A -% }^^A -% } -% -% \date{Released \ExplFileDate} -% -% \maketitle -% -% \begin{documentation} -% -% Flags are the only data-type on which \TeX{} can perform -% assignments in expansion-only contexts. This module is meant mostly -% for kernel use: in almost all cases, booleans or integers should be -% preferred to flags, because they are faster. -% -% A flag can hold any non-negative value, which we call its -% \meta{height}. In expansion-only contexts, a flag can only be -% \enquote{raised}: this normally increases the \meta{height} by $1$, -% but can be configured by defining specific traps. The \meta{height} -% can also be queried expandably. However, decreasing it, or setting it -% to zero requires non-expandable assignments. -% -% Flag variables are always local. They are referenced by a \meta{name} -% of the form \meta{package}\texttt{_}\meta{flag name}, for instance, -% \texttt{str_missing}. -% -% \section{Setting up flags} -% -% \begin{function}{\flag_new:n} -% \begin{syntax} -% \cs{flag_new:n} \Arg{flag name} -% \end{syntax} -% Creates a new \meta{flag} with a name given by \meta{flag name}, or -% raises an error if the name is already taken. The \meta{flag name} -% must consist of character tokens only. The declaration is global, -% but flags are always local variables. The \meta{flag} will initially -% have zero height. -% \end{function} -% -% \begin{function}{\flag_clear:n} -% \begin{syntax} -% \cs{flag_clear:n} \Arg{flag name} -% \end{syntax} -% The \meta{flag}'s height is set to zero. The assignment is local. -% \end{function} -% -% \begin{function}{\flag_clear_new:n} -% \begin{syntax} -% \cs{flag_clear_new:n} \Arg{flag name} -% \end{syntax} -% Ensures that the \meta{flag} exists globally by applying -% \cs{flag_new:n} if necessary, then applies \cs{flag_zero:n}, setting -% the height to zero locally. -% \end{function} -% -% \begin{function}{\flag_set_trap:nn} -% \begin{syntax} -% \cs{flag_set_trap:nn} \Arg{flag name} \Arg{inline function} -% \end{syntax} -% Changes the action that is taken when the \meta{flag} is raised -% using \cs{flag_raise:n}. Instead of the default action which is to -% increase the \meta{flag}'s height by $1$, the \meta{inline function} -% will be called, receiving the current flag's height as |#1|. The -% \meta{inline function} should expand to nothing; \emph{e.g.}, it -% could call \cs{msg_expandable_error:n}. This function is very -% experimental. -% \end{function} -% -% \section{Expandable flag commands} -% -% \begin{function}[EXP,pTF]{\flag_if_exist:n} -% \begin{syntax} -% \cs{flag_if_exist:n} \Arg{flag name} -% \end{syntax} -% This function returns \texttt{true} if the \meta{flag name} -% references a flag that has been defined previously, and -% \texttt{false} otherwise. -% \end{function} -% -% \begin{function}[EXP,pTF]{\flag_if_raised:n} -% \begin{syntax} -% \cs{flag_if_raised:n} \Arg{flag name} -% \end{syntax} -% This function returns \texttt{true} if the \meta{flag} has non-zero -% height, and \texttt{false} if the \meta{flag} has zero height. -% \end{function} -% -% \begin{function}[EXP]{\flag_height:n} -% \begin{syntax} -% \cs{flag_height:n} \Arg{flag name} -% \end{syntax} -% Expands to the height of the \meta{flag} as an integer denotation. -% \end{function} -% -% \begin{function}[EXP]{\flag_raise:n} -% \begin{syntax} -% \cs{flag_raise:n} \Arg{flag name} -% \end{syntax} -% The \meta{flag}'s trap is performed, taking the current height as -% its argument. The default behaviour is to increase the \meta{flag}'s -% height by $1$ locally. This function is expandable, as long as the -% trap is expandable (the default trap is expandable, despite being an -% assignment). -% \end{function} -% -% \end{documentation} -% -% \begin{implementation} -% -% \section{\pkg{l3flag} implementation} -% -% \begin{macrocode} -%<*initex|package> -% \end{macrocode} -% -% \begin{macrocode} -%<@@=flag> -% \end{macrocode} -% -% \begin{macrocode} -\ProvidesExplPackage - {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -% \end{macrocode} -% -% \subsection{Non-expandable flag commands} -% -% \begin{macro}{\flag_new:n} -% For each flag, we define a \enquote{trap} function, which by default -% simply increases the flag by $1$. -% \begin{macrocode} -\cs_new_protected:Npn \flag_new:n #1 - { - \cs_new:cpn { @@_trap_#1:w } ##1 ; - { \exp_after:wN \use_none:n \cs:w @@_#1_##1: \cs_end: } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\flag_clear:n} -% \begin{macro}[aux]{\@@_clear:ww} -% Undefine control sequences, starting from the |_0| flag, upwards, -% until reaching an undefined control sequence. -% \begin{macrocode} -\cs_new_protected:Npn \flag_clear:n #1 - { \@@_clear:ww 0 ; #1 \q_stop } -\cs_new_protected:Npn \@@_clear:ww #1 ; #2 \q_stop - { - \if_cs_exist:w @@_#2_#1: \cs_end: - \else: - \exp_after:wN \use_none_delimit_by_q_stop:w - \fi: - \cs_set_eq:cN { @@_#2_#1: } \tex_undefined:D - \exp_after:wN \@@_clear:ww - \__int_value:w \__int_eval:w \c_one + #1 ; - #2 \q_stop - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\flag_clear_new:n} -% As for other datatypes, clear the \meta{flag} or create a new one, -% as appropriate. -% \begin{macrocode} -\cs_new_protected:Npn \flag_clear_new:n #1 - { \flag_if_exist:nTF {#1} { \flag_clear:n } { \flag_new:n } {#1} } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\flag_set_trap:nn} -% ^^A todo: check that the flag exists. -% Redefine the trap. -% \begin{macrocode} -\cs_new_protected:Npn \flag_set_trap:nn #1#2 - { \cs_set:cpn { @@_trap_#1:w } ##1 ; {#2} } -% \end{macrocode} -% \end{macro} -% -% \subsection{Expandable flag commands} -% -% \begin{macro}[EXP, pTF]{\flag_if_exist:n} -% A flag exist if the corresponding trap \cs{@@_trap_\meta{flag -% name}:n} is defined. -% \begin{macrocode} -\prg_new_conditional:Npnn \flag_if_exist:n #1 { p , T , F , TF } - { - \cs_if_exist:cTF { @@_trap_#1:w } - { \prg_return_true: } { \prg_return_false: } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[EXP, pTF]{\flag_if_raised:n} -% Test if the flag is non-zero, by checking the |_0| control sequence. -% \begin{macrocode} -\prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } - { - \if_cs_exist:w @@_#1_0: \cs_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[EXP]{\flag_height:n} -% \begin{macro}[EXP, aux]{\@@_height_loop:ww, \@@_height_end:ww} -% Extract the value of the flag by going through all of the -% |_|\meta{integer} control sequences starting from $0$. -% \begin{macrocode} -\cs_new:Npn \flag_height:n #1 { \@@_height_loop:ww 0; #1 \q_stop } -\cs_new:Npn \@@_height_loop:ww #1 ; #2 \q_stop - { - \if_cs_exist:w @@_#2_#1: \cs_end: - \exp_after:wN \@@_height_loop:ww \__int_value:w \__int_eval:w \c_one + - \else: - \exp_after:wN \@@_height_end:ww - \fi: - #1 ; #2 \q_stop - } -\cs_new:Npn \@@_height_end:ww #1 ; #2 \q_stop { #1 } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}[EXP]{\flag_raise:n} -% Simply apply the trap to the height, after expanding the latter. -% \begin{macrocode} -\cs_new:Npn \flag_raise:n #1 - { - \cs:w @@_trap_#1:w \exp_after:wN \cs_end: - \__int_value:w \flag_height:n {#1} ; - } -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -% -% \end{macrocode} -% -% \end{implementation} -% -% \PrintIndex diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx index 548486edcd5..9586e3f57d1 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3regex.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3regex.dtx Copyright (C) 2011-2016 The LaTeX3 Project +%% File: l3regex.dtx Copyright (C) 2011-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 @@ -23,8 +23,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/02/10] -%\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +%\@ifpackagelater{expl3}{2017/03/07} % {} % {% % \PackageError{l3regex}{Support package l3kernel too old} @@ -36,7 +36,7 @@ % }% % \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} % %<*driver> @@ -740,7 +740,7 @@ %<*package> \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\RequirePackage{l3tl-build, l3tl-analysis, l3flag, l3str-convert} +\RequirePackage{l3tl-build, l3tl-analysis, l3str-convert} % % \end{macrocode} % @@ -1028,17 +1028,15 @@ \cs_new_protected:Npn \@@_compute_case_changed_char: { \int_set_eq:NN \l_@@_case_changed_char_int \l_@@_current_char_int - \if_int_compare:w \l_@@_current_char_int < \c_ninety_one - \if_int_compare:w \l_@@_current_char_int < \c_sixty_five - \else: - \int_add:Nn \l_@@_case_changed_char_int { \c_thirty_two } + \if_int_compare:w \l_@@_current_char_int > `Z \exp_stop_f: + \if_int_compare:w \l_@@_current_char_int > `z \exp_stop_f: \else: + \if_int_compare:w \l_@@_current_char_int < `a \exp_stop_f: \else: + \int_sub:Nn \l_@@_case_changed_char_int { \c__str_ascii_lower_int } + \fi: \fi: \else: - \if_int_compare:w \l_@@_current_char_int < \c_one_hundred_twenty_three - \if_int_compare:w \l_@@_current_char_int < \c_ninety_seven - \else: - \int_sub:Nn \l_@@_case_changed_char_int { \c_thirty_two } - \fi: + \if_int_compare:w \l_@@_current_char_int < `A \exp_stop_f: \else: + \int_add:Nn \l_@@_case_changed_char_int { \c__str_ascii_lower_int } \fi: \fi: } @@ -1071,7 +1069,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 \@@_item_catcode:nT #1 @@ -1088,9 +1086,9 @@ % \end{macro} % \end{macro} % -% \begin{macro}[int]{\@@_item_exact:nn, \@@_item_exact_cs:c} +% \begin{macro}[int]{\@@_item_exact:nn, \@@_item_exact_cs:n} % This matches an exact \meta{category}-\meta{character code} pair, or -% an exact control sequence. +% an exact control sequence, more precisely one of several possible control sequences. % \begin{macrocode} \cs_new_protected:Npn \@@_item_exact:nn #1#2 { @@ -1100,16 +1098,18 @@ \fi: \fi: } -\cs_new_protected:Npn \@@_item_exact_cs:c #1 +\cs_new_protected:Npn \@@_item_exact_cs:n #1 { - \int_compare:nNnTF \l_@@_current_catcode_int = \c_zero + \int_compare:nNnTF \l_@@_current_catcode_int = 0 { - \str_if_eq_x:nnTF + \tl_set:Nx \l_@@_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_@@_current_pos_int + \scan_stop: } - { #1 } + \tl_if_in:noTF { \scan_stop: #1 \scan_stop: } \l_@@_internal_a_tl { \@@_break_true:w } { } } { } @@ -1129,7 +1129,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_item_cs:n #1 { - \int_compare:nNnT \l_@@_current_catcode_int = \c_zero + \int_compare:nNnT \l_@@_current_catcode_int = 0 { \group_begin: \tl_set:Nx \l_@@_cs_name_tl @@ -1170,31 +1170,34 @@ % mostly lower case letter text. % \begin{macrocode} \cs_new_protected:Npn \@@_prop_d: - { \@@_item_caseful_range:nn \c_forty_eight { 57 } } % 0--9 + { \@@_item_caseful_range:nn { `0 } { `9 } } \cs_new_protected:Npn \@@_prop_h: { - \@@_item_caseful_equal:n \c_thirty_two % space - \@@_item_caseful_equal:n \c_nine % tab + \@@_item_caseful_equal:n { `\ } + \@@_item_caseful_equal:n { `\^^I } } \cs_new_protected:Npn \@@_prop_s: { - \@@_item_caseful_equal:n \c_thirty_two % space - \@@_item_caseful_equal:n \c_nine % tab - \@@_item_caseful_equal:n \c_ten % lf - \@@_item_caseful_equal:n \c_twelve % ff - \@@_item_caseful_equal:n \c_thirteen % cr + \@@_item_caseful_equal:n { `\ } + \@@_item_caseful_equal:n { `\^^I } + \@@_item_caseful_equal:n { `\^^J } + \@@_item_caseful_equal:n { `\^^L } + \@@_item_caseful_equal:n { `\^^M } } \cs_new_protected:Npn \@@_prop_v: - { \@@_item_caseful_range:nn \c_ten \c_thirteen } % lf, vtab, ff, cr + { \@@_item_caseful_range:nn { `\^^J } { `\^^M } } % lf, vtab, ff, cr \cs_new_protected:Npn \@@_prop_w: { - \@@_item_caseful_range:nn \c_ninety_seven { 122 } % a--z - \@@_item_caseful_range:nn \c_sixty_five { 90 } % A--Z - \@@_item_caseful_range:nn \c_forty_eight { 57 } % 0--9 - \@@_item_caseful_equal:n { 95 } % _ + \@@_item_caseful_range:nn { `a } { `z } + \@@_item_caseful_range:nn { `A } { `Z } + \@@_item_caseful_range:nn { `0 } { `9 } + \@@_item_caseful_equal:n { `_ } } \cs_new_protected:Npn \@@_prop_N: - { \@@_item_reverse:n { \@@_item_caseful_equal:n \c_ten } } + { + \@@_item_reverse:n + { \@@_item_caseful_equal:n { `\^^J } } + } % \end{macrocode} % \end{macro} % @@ -1213,40 +1216,46 @@ \cs_new_protected:Npn \@@_posix_alpha: { \@@_posix_lower: \@@_posix_upper: } \cs_new_protected:Npn \@@_posix_ascii: - { \@@_item_caseful_range:nn \c_zero \c_one_hundred_twenty_seven } + { + \@@_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_int + } \cs_new_eq:NN \@@_posix_blank: \@@_prop_h: \cs_new_protected:Npn \@@_posix_cntrl: { - \@@_item_caseful_range:nn \c_zero { 31 } - \@@_item_caseful_equal:n \c_one_hundred_twenty_seven + \@@_item_caseful_range:nn + \c__str_ascii_min_int + \c__str_ascii_max_control_int + \@@_item_caseful_equal:n \c__str_ascii_max_int } \cs_new_eq:NN \@@_posix_digit: \@@_prop_d: \cs_new_protected:Npn \@@_posix_graph: - { \@@_item_caseful_range:nn { 33 } { 126 } } + { \@@_item_caseful_range:nn { `! } { `\~ } } \cs_new_protected:Npn \@@_posix_lower: - { \@@_item_caseful_range:nn \c_ninety_seven { 122 } } + { \@@_item_caseful_range:nn { `a } { `z } } \cs_new_protected:Npn \@@_posix_print: - { \@@_item_caseful_range:nn \c_thirty_two { 126 } } + { \@@_item_caseful_range:nn { `\ } { `\~ } } \cs_new_protected:Npn \@@_posix_punct: { - \@@_item_caseful_range:nn { 33 } { 47 } - \@@_item_caseful_range:nn { 58 } { 64 } - \@@_item_caseful_range:nn { 91 } { 96 } - \@@_item_caseful_range:nn { 123 } { 126 } + \@@_item_caseful_range:nn { `! } { `/ } + \@@_item_caseful_range:nn { `: } { `@ } + \@@_item_caseful_range:nn { `[ } { `` } + \@@_item_caseful_range:nn { `\{ } { `\~ } } \cs_new_protected:Npn \@@_posix_space: { - \@@_item_caseful_equal:n \c_thirty_two - \@@_item_caseful_range:nn \c_nine \c_thirteen + \@@_item_caseful_equal:n { `\ } + \@@_item_caseful_range:nn { `\^^I } { `\^^M } } \cs_new_protected:Npn \@@_posix_upper: - { \@@_item_caseful_range:nn \c_sixty_five { 90 } } + { \@@_item_caseful_range:nn { `A } { `Z } } \cs_new_eq:NN \@@_posix_word: \@@_prop_w: \cs_new_protected:Npn \@@_posix_xdigit: { \@@_posix_digit: - \@@_item_caseful_range:nn \c_sixty_five { 70 } - \@@_item_caseful_range:nn \c_ninety_seven { 102 } + \@@_item_caseful_range:nn { `A } { `F } + \@@_item_caseful_range:nn { `a } { `f } } % \end{macrocode} % \end{macro} @@ -1296,7 +1305,7 @@ \cs_set:Npn \@@_escape_unescaped:N ##1 { #1 } \cs_set:Npn \@@_escape_escaped:N ##1 { #2 } \cs_set:Npn \@@_escape_raw:N ##1 { #3 } - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \__str_gset_other:Nn \g_@@_internal_tl { #4 } \tl_set:Nx \l_@@_internal_b_tl { @@ -1398,12 +1407,12 @@ } \cs_new:Npn \@@_escape_x_end:w #1 ; { - \int_compare:nNnTF {#1} < \c_two_hundred_fifty_six + \int_compare:nNnTF {#1} > \c__str_max_byte_int + { \@@_escape_x_large:n {#1} } { \exp_last_unbraced:Nf \@@_escape_raw:N { \__str_output_byte:n {#1} } } - { \@@_escape_x_large:n {#1} } } \group_begin: \char_set_catcode_other:n { 0 } @@ -1418,7 +1427,7 @@ { \if_false: } \fi: } { - \char_set_lccode:nn { \c_zero } {#1} + \char_set_lccode:nn { 0 } {#1} \tex_lowercase:D { \tl_set:Nx \l_@@_internal_b_tl @@ -1542,42 +1551,42 @@ % \begin{macrocode} \prg_new_conditional:Npnn \@@_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 \@@_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: } @@ -1613,7 +1622,9 @@ % \item \cs{@@_item_catcode_reverse:nT} \Arg{catcode bitmap} \Arg{tests} % \item \cs{@@_item_reverse:n} \Arg{tests} % \item \cs{@@_item_exact:nn} \Arg{catcode} \Arg{char code} -% \item \cs{@@_item_exact_cs:c} \Arg{csname} +% \item \cs{@@_item_exact_cs:n} \Arg{csnames}, more precisely given as +% \meta{csname} \cs{scan_stop:} \meta{csname} \cs{scan_stop:} +% \meta{csname} and so on in a brace group. % \item \cs{@@_item_cs:n} \Arg{compiled regex} % \end{itemize} % @@ -1627,13 +1638,30 @@ % \end{variable} % % \begin{variable}{\l_@@_mode_int} +% \begin{variable} +% { +% \c_@@_cs_in_class_mode_int, +% \c_@@_cs_mode_int, +% \c_@@_outer_mode_int, +% \c_@@_catcode_mode_int, +% \c_@@_class_mode_int, +% \c_@@_catcode_in_class_mode_int +% } % While compiling, ten modes are recognized, labelled $-63$, $-23$, % $-6$, $-2$, $0$, $2$, $3$, $6$, $23$, $63$. See -% section~\ref{sec:regex-modes}. +% section~\ref{sec:regex-modes}. We only define some of these as +% constants. % \begin{macrocode} \int_new:N \l_@@_mode_int +\int_const:Nn \c_@@_cs_in_class_mode_int { -6 } +\int_const:Nn \c_@@_cs_mode_int { -2 } +\int_const:Nn \c_@@_outer_mode_int { 0 } +\int_const:Nn \c_@@_catcode_mode_int { 2 } +\int_const:Nn \c_@@_class_mode_int { 3 } +\int_const:Nn \c_@@_catcode_in_class_mode_int { 6 } % \end{macrocode} % \end{variable} +% \end{variable} % % \begin{variable}{\l_@@_catcodes_int, \l_@@_default_catcodes_int} % \begin{variable}{\l_@@_catcodes_bool} @@ -1738,7 +1766,7 @@ \prg_new_conditional:Npnn \@@_if_raw_digit:NN #1#2 { TF } { \if_meaning:w \@@_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: @@ -1763,7 +1791,7 @@ % \item[6] |[\c...]| catcode test in a class, % \item[-63] |[\c{[...]}]| class inside mode $-6$, % \item[-23] |\c{[...]}| class inside mode $-2$, -% \item[3] |[...]| class inside mode $-3$, +% \item[3] |[...]| class inside mode $0$, % \item[23] |\c[...]| class inside mode $2$, % \item[63] |[\c[...]]| class inside mode $6$. % \end{itemize} @@ -1819,7 +1847,7 @@ \if_int_odd:w \l_@@_mode_int \exp_after:wN \use_ii:nn \else: - \if_int_compare:w \l_@@_mode_int < \c_zero + \if_int_compare:w \l_@@_mode_int < \c_@@_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 @@ -1838,7 +1866,7 @@ \if_int_odd:w \l_@@_mode_int \exp_after:wN \use_i:nn \else: - \if_int_compare:w \l_@@_mode_int > \c_zero + \if_int_compare:w \l_@@_mode_int > \c_@@_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 @@ -1856,7 +1884,7 @@ % \begin{macrocode} \cs_new:Npn \@@_if_within_catcode:TF { - \if_int_compare:w \l_@@_mode_int > \c_zero + \if_int_compare:w \l_@@_mode_int > \c_@@_outer_mode_int \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn @@ -1871,10 +1899,10 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_chk_c_allowed:T { - \if_int_compare:w \l_@@_mode_int = \c_zero + \if_int_compare:w \l_@@_mode_int = \c_@@_outer_mode_int \exp_after:wN \use:n \else: - \if_int_compare:w \l_@@_mode_int = \c_three + \if_int_compare:w \l_@@_mode_int = \c_@@_class_mode_int \exp_after:wN \exp_after:wN \exp_after:wN \use:n \else: \__msg_kernel_error:nn { regex } { c-bad-mode } @@ -1891,11 +1919,11 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_mode_quit_c: { - \if_int_compare:w \l_@@_mode_int = \c_two - \l_@@_mode_int = \c_zero + \if_int_compare:w \l_@@_mode_int = \c_@@_catcode_mode_int + \int_set_eq:NN \l_@@_mode_int \c_@@_outer_mode_int \else: - \if_int_compare:w \l_@@_mode_int = \c_six - \l_@@_mode_int = \c_three + \if_int_compare:w \l_@@_mode_int = \c_@@_catcode_in_class_mode_int + \int_set_eq:NN \l_@@_mode_int \c_@@_class_mode_int \fi: \fi: } @@ -1931,7 +1959,7 @@ \prg_do_nothing: \prg_do_nothing: } { } - \if_int_compare:w \l_@@_group_level_int > \c_zero + \if_int_compare:w \l_@@_group_level_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { missing-rparen } { \int_use:N \l_@@_group_level_int } \prg_replicate:nn @@ -1967,8 +1995,8 @@ \cs_new_protected:Npn \@@_compile:n #1 { \@@_compile:w - \int_set:Nn \tex_escapechar:D { 92 } - \int_set_eq:NN \l_@@_mode_int \c_zero + \int_set:Nn \tex_escapechar:D { `\\ } + \int_set_eq:NN \l_@@_mode_int \c_@@_outer_mode_int \@@_escape_use:nnnn { \@@_char_if_special:NTF ##1 @@ -1982,14 +2010,12 @@ { #1 } \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: - \int_compare:nNnT \l_@@_mode_int = \c_two + \int_compare:nNnT \l_@@_mode_int = \c_@@_catcode_mode_int { \__msg_kernel_error:nn { regex } { c-trailing } } - \int_compare:nNnT \l_@@_mode_int < \c_zero + \int_compare:nNnT \l_@@_mode_int < \c_@@_outer_mode_int { \__msg_kernel_error:nn { regex } { c-missing-rbrace } - \@@_compile_end: - \@@_compile_one:x - { \@@_item_cs:n { \exp_not:o \l_@@_internal_regex } } + \@@_compile_end_cs: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: \prg_do_nothing: } @@ -2343,7 +2369,7 @@ } \cs_new_protected:cpn { @@_prop_.: } { - \if_int_compare:w \l_@@_current_char_int > - \c_two + \if_int_compare:w \l_@@_current_char_int > - 2 \exp_stop_f: \exp_after:wN \@@_break_true:w \fi: } @@ -2467,11 +2493,11 @@ { \@@_if_in_class:TF { - \if_int_compare:w \l_@@_mode_int > \c_sixteen + \if_int_compare:w \l_@@_mode_int > \c_@@_catcode_in_class_mode_int \__tl_build_one:n { \if_false: { \fi: } } \fi: - \tex_advance:D \l_@@_mode_int - \c_fifteen - \tex_divide:D \l_@@_mode_int \c_thirteen + \tex_advance:D \l_@@_mode_int - 15 \exp_stop_f: + \tex_divide:D \l_@@_mode_int 13 \exp_stop_f: \if_int_odd:w \l_@@_mode_int \else: \exp_after:wN \@@_compile_quantifier:w \fi: @@ -2531,7 +2557,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_compile_class_catcode:w #1; { - \if_int_compare:w \l_@@_mode_int = \c_two + \if_int_compare:w \l_@@_mode_int = \c_@@_catcode_mode_int \__tl_build_one:n { \@@_class:NnnnN \c_true_bool { \if_false: } \fi: } \fi: @@ -2678,7 +2704,7 @@ } \cs_new_protected:Npn \@@_compile_group_end: { - \if_int_compare:w \l_@@_group_level_int > \c_zero + \if_int_compare:w \l_@@_group_level_int > 0 \exp_stop_f: \__tl_build_one:n { \if_false: { \fi: } } \__tl_build_end: \int_set_eq:NN \l_@@_catcodes_int \l_@@_default_catcodes_int @@ -2821,7 +2847,11 @@ { \int_set_eq:Nc \l_@@_catcodes_int { c_@@_catcode_#2_int } \l_@@_mode_int - = \if_case:w \l_@@_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l_@@_mode_int + \c_@@_catcode_mode_int + \else: + \c_@@_catcode_in_class_mode_int + \fi: } } { \cs_if_exist_use:cF { @@_compile_c_#2:w } } @@ -2847,7 +2877,11 @@ \cs_new_protected:cpn { @@_compile_c_[:w } #1#2 { \l_@@_mode_int - = \if_case:w \l_@@_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l_@@_mode_int + \c_@@_catcode_mode_int + \else: + \c_@@_catcode_in_class_mode_int + \fi: \int_zero:N \l_@@_catcodes_int \str_if_eq:nnTF { #1 #2 } { \@@_compile_special:N ^ } { @@ -2909,32 +2943,93 @@ \@@_compile:w \@@_disable_submatches: \l_@@_mode_int - = - \if_case:w \l_@@_mode_int \c_two \else: \c_six \fi: + = \if_case:w \l_@@_mode_int + \c_@@_cs_mode_int + \else: + \c_@@_cs_in_class_mode_int + \fi: } % \end{macrocode} % \end{macro} % % \begin{macro}+\@@_compile_}:+ +% \begin{macro}{\@@_compile_end_cs:} +% \begin{macro}[EXP,aux]{\@@_compile_cs_aux:Nn, \@@_compile_cs_aux:NNnnnN} % Non-escaped right braces are only special if they appear when % compiling the regular expression for a csname, but not within a -% class: |\c{[}{]}| matches the control sequences |\}| and -% |\{|\ldots{} Admittedly, that would be better done as -% |\c{[{}]}|. So, end compiling the inner regex (this closes any -% dangling class or group). Then insert the corresponding test in the -% outer regex. -% \begin{macrocode} +% class: |\c{[{}]}| matches the control sequences |\{| and |\}|. So, +% end compiling the inner regex (this closes any dangling class or +% group). Then insert the corresponding test in the outer regex. As +% an optimization, if the control sequence test simply consists of +% several explicit possibilities (branches) then use +% \cs{@@_item_exact_cs:n} with an argument consisting of all +% possibilities separated by \cs{scan_stop:}. +% \begin{macrocode} +\flag_new:n { @@_cs } \cs_new_protected:cpn { @@_compile_ \c_right_brace_str : } { \@@_if_in_cs:TF + { \@@_compile_end_cs: } + { \exp_after:wN \@@_compile_raw:N \c_right_brace_str } + } +\cs_new_protected:Npn \@@_compile_end_cs: + { + \@@_compile_end: + \flag_clear:n { @@_cs } + \tl_set:Nx \l_@@_internal_a_tl { - \@@_compile_end: - \@@_compile_one:x + \exp_after:wN \@@_compile_cs_aux:Nn \l_@@_internal_regex + \q_nil \q_nil \q_recursion_stop + } + \exp_args:Nx \@@_compile_one:x + { + \flag_if_raised:nTF { @@_cs } { \@@_item_cs:n { \exp_not:o \l_@@_internal_regex } } + { \@@_item_exact_cs:n { \tl_tail:N \l_@@_internal_a_tl } } + } + } +\cs_new:Npn \@@_compile_cs_aux:Nn #1#2 + { + \cs_if_eq:NNTF #1 \@@_branch:n + { + \scan_stop: + \@@_compile_cs_aux:NNnnnN #2 + \q_nil \q_nil \q_nil \q_nil \q_nil \q_nil \q_recursion_stop + \@@_compile_cs_aux:Nn + } + { + \quark_if_nil:NF #1 { \flag_raise:n { @@_cs } } + \use_none_delimit_by_q_recursion_stop:w + } + } +\cs_new:Npn \@@_compile_cs_aux:NNnnnN #1#2#3#4#5#6 + { + \bool_lazy_all:nTF + { + { \cs_if_eq_p:NN #1 \@@_class:NnnnN } + {#2} + { \tl_if_head_eq_meaning_p:nN {#3} \@@_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} } + \@@_compile_cs_aux:NNnnnN + } + { + \quark_if_nil:NF #1 + { + \flag_raise:n { @@_cs } + \use_i_delimit_by_q_recursion_stop:nw + } + \use_none_delimit_by_q_recursion_stop:w } - { \exp_after:wN \@@_compile_raw:N \c_right_brace_str } } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} % % \subsubsection{Raw token lists with \cs{u}} % @@ -2998,7 +3093,7 @@ \cs_new_protected:Npn \@@_compile_u_end: { \tl_set:Nv \l_@@_internal_a_tl { \l_@@_internal_a_tl } - \if_int_compare:w \l_@@_mode_int = \c_zero + \if_int_compare:w \l_@@_mode_int = \c_@@_outer_mode_int \@@_compile_u_not_cs: \else: \@@_compile_u_in_cs: @@ -3045,8 +3140,8 @@ { \@@_class:NnnnN \c_true_bool { - \if_int_compare:w "##2 = \c_zero - \@@_item_exact_cs:c { \exp_after:wN \cs_to_str:N ##1 } + \if_int_compare:w "##2 = 0 \exp_stop_f: + \@@_item_exact_cs:n { \exp_after:wN \cs_to_str:N ##1 } \else: \@@_item_exact:nn { \__int_value:w "##2 } { ##3 } \fi: @@ -3068,7 +3163,7 @@ % \begin{macrocode} \cs_new_protected:cpn { @@_compile_/K: } { - \int_compare:nNnTF \l_@@_mode_int = \c_zero + \int_compare:nNnTF \l_@@_mode_int = \c_@@_outer_mode_int { \__tl_build_one:n { \@@_command_K: } } { \@@_compile_raw_error:N K } } @@ -3077,12 +3172,12 @@ % % \subsubsection{Showing regexes} % -% \begin{macro}[aux]{\@@_show:Nx} +% \begin{macro}[aux]{\@@_show:Nn} % Within a \cs{__tl_build:Nw} \ldots{} \cs{__tl_build_end:} group, we % redefine all the function that can appear in a compiled regex, then % run the regex. The result is then shown. % \begin{macrocode} -\cs_new_protected:Npn \@@_show:Nx #1#2 +\cs_new_protected:Npn \@@_show:Nn #1#2 { \__tl_build:Nw \l_@@_internal_a_tl \cs_set_protected:Npn \@@_branch:n @@ -3124,16 +3219,16 @@ { \@@_show_scope:nn { Reversed~match } } \cs_set_protected:Npn \@@_item_exact:nn ##1##2 { \@@_show_one:n { char~##2,~catcode~##1 } } - \cs_set_protected:Npn \@@_item_exact_cs:c ##1 - { \@@_show_one:n { control~sequence~\iow_char:N\\##1 } } + \cs_set_eq:NN \@@_item_exact_cs:n \@@_show_item_exact_cs:n \cs_set_protected:Npn \@@_item_cs:n { \@@_show_scope:nn { control~sequence } } \cs_set:cpn { @@_prop_.: } { \@@_show_one:n { any~token } } \seq_clear:N \l_@@_show_prefix_seq \@@_show_push:n { ~ } - #1 + \cs_if_exist_use:N #1 \__tl_build_end: - \__msg_show_wrap:n { >~Compiled~regex~#2: \l_@@_internal_a_tl } + \__msg_show_variable:NNNnn #1 \cs_if_exist:NTF ? { } + { >~Compiled~regex~#2: \l_@@_internal_a_tl } } % \end{macrocode} % \end{macro} @@ -3285,6 +3380,19 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}[aux]{\@@_show_item_exact_cs:n} +% \begin{macrocode} +\cs_new_protected:Npn \@@_show_item_exact_cs:n #1 + { + \seq_set_split:Nnn \l_@@_internal_seq { \scan_stop: } {#1} + \seq_set_map:NNn \l_@@_internal_seq + \l_@@_internal_seq { \iow_char:N\\##1 } + \@@_show_one:n + { control~sequence~ \seq_use:Nn \l_@@_internal_seq { ~or~ } } + } +% \end{macrocode} +% \end{macro} +% % \subsection{Building} % % \subsubsection{Variables used while building} @@ -3385,7 +3493,7 @@ \cs_new_protected:Npn \@@_build:N #1 { % \trace_push:nnn { regex } { 1 } { @@_build } - \int_set:Nn \tex_escapechar:D { 92 } + \int_set:Nn \tex_escapechar:D { `\\ } \int_zero:N \l_@@_capturing_group_int \int_set_eq:NN \l_@@_max_state_int \l_@@_min_state_int \@@_build_new_state: @@ -3513,7 +3621,7 @@ L=\int_use:N \l_@@_left_state_int ~ -> ~ R=\int_use:N \l_@@_right_state_int ~ -> ~ M=\int_use:N \l_@@_max_state_int ~ -> ~ - \int_eval:n { \l_@@_max_state_int + \c_one } + \int_eval:n { \l_@@_max_state_int + 1 } } % \tex_toks:D \l_@@_max_state_int { } @@ -3610,7 +3718,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_class_repeat:nN #1#2 { - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #1 = 0 \exp_stop_f: \@@_build_transitions_lazyness:NNNNN #2 \@@_action_free:n \l_@@_right_state_int \@@_tests_action_cost:n \l_@@_left_state_int @@ -3638,7 +3746,7 @@ { \@@_class_repeat:n {#1} \int_set:Nn \l_@@_internal_a_int - { \l_@@_max_state_int + #2 - \c_one } + { \l_@@_max_state_int + #2 - 1 } \prg_replicate:nn { #2 } { \@@_build_transitions_lazyness:NNNNN #3 @@ -3671,7 +3779,7 @@ \cs_new_protected:Npn \@@_group_aux:nnnnN #1#2#3#4#5 { % \trace_push:nnn { regex } { 1 } { @@_group } - \if_int_compare:w #3 = \c_zero + \if_int_compare:w #3 = 0 \exp_stop_f: \@@_build_new_state: %\assert_int:n { \l_@@_max_state_int = \l_@@_right_state_int + 1 } \@@_build_transition_right:nNn \@@_action_free_group:n @@ -3779,9 +3887,9 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_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_@@_max_state_int - { \l_@@_left_state_int - \c_one } + { \l_@@_left_state_int - 1 } \@@_build_new_state: \else: \@@_group_repeat_aux:n {#2} @@ -3799,7 +3907,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_group_submatches:nNN #1#2#3 { - \if_int_compare:w #1 > - \c_one + \if_int_compare:w #1 > - 1 \exp_stop_f: \@@_toks_put_left:Nx #2 { \@@_action_submatch:n { #1 < } } \@@_toks_put_left:Nx #3 { \@@_action_submatch:n { #1 > } } \fi: @@ -3823,10 +3931,10 @@ \l_@@_right_state_int \l_@@_max_state_int \int_set_eq:NN \l_@@_internal_a_int \l_@@_left_state_int \int_set_eq:NN \l_@@_internal_b_int \l_@@_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_@@_internal_c_int { - ( #1 - \c_one ) + ( #1 - 1 ) * ( \l_@@_internal_b_int - \l_@@_internal_a_int ) } \tex_advance:D \l_@@_right_state_int \l_@@_internal_c_int @@ -3835,8 +3943,8 @@ { \tex_toks:D \l_@@_internal_b_int = \tex_toks:D \l_@@_internal_a_int - \tex_advance:D \l_@@_internal_a_int \c_one - \tex_advance:D \l_@@_internal_b_int \c_one + \int_incr:N \l_@@_internal_a_int + \int_incr:N \l_@@_internal_b_int } \fi: } @@ -3865,11 +3973,11 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_group_repeat:nnN #1#2#3 { - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \@@_group_submatches:nNN {#1} \l_@@_left_state_int \l_@@_right_state_int \int_set:Nn \l_@@_internal_a_int - { \l_@@_left_state_int - \c_one } + { \l_@@_left_state_int - 1 } \@@_build_transition_right:nNn \@@_action_free:n \l_@@_right_state_int \l_@@_internal_a_int \@@_build_new_state: @@ -3929,16 +4037,16 @@ \l_@@_left_state_int \l_@@_max_state_int } \else: - \prg_replicate:nn { #3 - \c_one } + \prg_replicate:nn { #3 - 1 } { \int_sub:Nn \l_@@_right_state_int { \l_@@_internal_b_int - \l_@@_internal_a_int } \@@_build_transition_right:nNn \@@_action_free:n \l_@@_right_state_int \l_@@_max_state_int } - \if_int_compare:w #2 = \c_zero + \if_int_compare:w #2 = 0 \exp_stop_f: \int_set:Nn \l_@@_right_state_int - { \l_@@_left_state_int - \c_one } + { \l_@@_left_state_int - 1 } \else: \int_sub:Nn \l_@@_right_state_int { \l_@@_internal_b_int - \l_@@_internal_a_int } @@ -4243,7 +4351,7 @@ % \trace_push:nnx { regex } { 1 } { @@_match } % \trace:nnx { regex } { 1 } { analyzing~query~token~list } \int_zero:N \l_@@_balance_int - \int_set:Nn \l_@@_current_pos_int { \c_two * \l_@@_max_state_int } + \int_set:Nn \l_@@_current_pos_int { 2 * \l_@@_max_state_int } \@@_query_set:nnn { } { -1 } { -2 } \int_set_eq:NN \l_@@_min_pos_int \l_@@_current_pos_int \__tl_analysis_map_inline:nn {#1} @@ -4253,13 +4361,13 @@ % \trace:nnx { regex } { 1 } { initializing } \bool_gset_false:N \g_@@_success_bool \int_step_inline:nnnn - \l_@@_min_state_int \c_one { \l_@@_max_state_int - \c_one } - { \tex_dimen:D ##1 \c_one sp \scan_stop: } + \l_@@_min_state_int { 1 } { \l_@@_max_state_int - 1 } + { \tex_dimen:D ##1 ~ 1 sp \scan_stop: } \int_set_eq:NN \l_@@_min_active_int \l_@@_max_state_int - \int_set_eq:NN \l_@@_step_int \c_zero + \int_zero:N \l_@@_step_int \int_set_eq:NN \l_@@_success_pos_int \l_@@_min_pos_int \int_set:Nn \l_@@_submatch_int - { \c_two * \l_@@_max_state_int } + { 2 * \l_@@_max_state_int } \bool_set_false:N \l_@@_empty_success_bool \@@_match_once: % \trace_pop:nnx { regex } { 1 } { @@_match } @@ -4295,7 +4403,7 @@ \int_set_eq:NN \l_@@_max_active_int \l_@@_min_active_int \@@_store_state:n { \l_@@_min_state_int } \int_set:Nn \l_@@_current_pos_int - { \l_@@_start_pos_int - \c_one } + { \l_@@_start_pos_int - 1 } \@@_query_get: \@@_match_loop: \l_@@_every_match_tl @@ -4344,7 +4452,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_match_loop: { - \tex_advance:D \l_@@_step_int \c_two + \tex_advance:D \l_@@_step_int 2 \exp_stop_f: \int_incr:N \l_@@_current_pos_int \int_set_eq:NN \l_@@_last_char_int \l_@@_current_char_int \int_set_eq:NN \l_@@_case_changed_char_int \c_max_int @@ -4370,7 +4478,7 @@ { \__int_value:w \tex_skip:D #1 } { \tex_the:D \tex_toks:D #1 } \exp_after:wN \@@_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: } % \end{macrocode} @@ -4437,7 +4545,7 @@ = \l_@@_step_int sp \scan_stop: \tex_the:D \tex_toks:D \l_@@_current_state_int \tex_dimen:D \l_@@_current_state_int - = \__int_eval:w \l_@@_step_int + \c_one \__int_eval_end: sp \scan_stop: + = \__int_eval:w \l_@@_step_int + 1 \__int_eval_end: sp \scan_stop: } % \end{macrocode} % \end{macro} @@ -4714,7 +4822,7 @@ \fi: \tex_the:D \tex_toks:D #1 \exp_stop_f: \exp_after:wN \@@_query_range_loop:ww - \__int_value:w \__int_eval:w #1 + \c_one ; #2 ; + \__int_value:w \__int_eval:w #1 + 1 ; #2 ; } % \end{macrocode} % \end{macro} @@ -4788,7 +4896,7 @@ { \__tl_build_one:n ##1 } {#1} \prg_do_nothing: \prg_do_nothing: - \if_int_compare:w \l_@@_replacement_csnames_int > \c_zero + \if_int_compare:w \l_@@_replacement_csnames_int > 0 \exp_stop_f: \__msg_kernel_error:nnx { regex } { replacement-missing-rbrace } { \int_use:N \l_@@_replacement_csnames_int } \__tl_build_one:x @@ -4828,7 +4936,7 @@ { \cs_if_exist_use:cF { @@_replacement_#1:w } { - \if_int_compare:w \c_one < 1#1 \exp_stop_f: + \if_int_compare:w 1 < 1#1 \exp_stop_f: \@@_replacement_put_submatch:n {#1} \else: \__tl_build_one:o { \token_to_str:N #1 } @@ -4854,7 +4962,7 @@ { \if_int_compare:w #1 < \l_@@_capturing_group_int \__tl_build_one:n { \@@_query_submatch:n { #1 + ##1 } } - \if_int_compare:w \l_@@_replacement_csnames_int = \c_zero + \if_int_compare:w \l_@@_replacement_csnames_int = 0 \exp_stop_f: \tl_put_right:Nn \l_@@_balance_tl { + \@@_submatch_balance:n { \__int_eval:w #1+##1 \__int_eval_end: } } \fi: @@ -4880,9 +4988,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_@@_internal_a_int - { \c_ten * \l_@@_internal_a_int + #2 } + { 10 * \l_@@_internal_a_int + #2 } \exp_after:wN \use_i:nnn \exp_after:wN \@@_replacement_g_digits:NN \else: @@ -4968,7 +5076,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_replacement_rbrace:N #1 { - \if_int_compare:w \l_@@_replacement_csnames_int > \c_zero + \if_int_compare:w \l_@@_replacement_csnames_int > 0 \exp_stop_f: \__tl_build_one:n \cs_end: \int_decr:N \l_@@_replacement_csnames_int \else: @@ -5002,7 +5110,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: } @@ -5032,7 +5140,7 @@ \char_set_catcode_group_begin:N \^^@ \cs_new_protected:Npn \@@_replacement_c_B:w { - \if_int_compare:w \l_@@_replacement_csnames_int = \c_zero + \if_int_compare:w \l_@@_replacement_csnames_int = 0 \exp_stop_f: \int_incr:N \l_@@_balance_int \fi: \@@_replacement_char:nNN @@ -5069,7 +5177,7 @@ \char_set_catcode_group_end:N \^^@ \cs_new_protected:Npn \@@_replacement_c_E:w { - \if_int_compare:w \l_@@_replacement_csnames_int = \c_zero + \if_int_compare:w \l_@@_replacement_csnames_int = 0 \exp_stop_f: \int_decr:N \l_@@_balance_int \fi: \@@_replacement_char:nNN @@ -5133,10 +5241,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: } @@ -5225,11 +5333,11 @@ \cs_new_protected:Npn \regex_show:n #1 { \@@_compile:n {#1} - \@@_show:Nx \l_@@_internal_regex + \@@_show:Nn \l_@@_internal_regex { { \tl_to_str:n {#1} } } } \cs_new_protected:Npn \regex_show:N #1 - { \@@_show:Nx #1 { variable~\token_to_str:N #1 } } + { \@@_show:Nn #1 { variable~\token_to_str:N #1 } } % \end{macrocode} % \end{macro} % @@ -5489,14 +5597,14 @@ { \s__seq \int_step_function:nnnN - { \c_two * \l_@@_max_state_int } - \c_one - { \l_@@_submatch_int - \c_one } + { 2 * \l_@@_max_state_int } + { 1 } + { \l_@@_submatch_int - 1 } \@@_extract_seq_aux:n } \int_compare:nNnF { \flag_height:n { @@_begin } + \flag_height:n { @@_end } } - = \c_zero + = 0 { \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { splitting~or~extracting~submatches } @@ -5528,12 +5636,12 @@ } \cs_new:Npn \@@_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 { @@_end } \prg_replicate:nn {-#1} { \exp_not:n { { \if_false: } \fi: } } \fi: \@@_query_submatch:n {#2} - \if_int_compare:w #1 > \c_zero + \if_int_compare:w #1 > 0 \exp_stop_f: \flag_raise:n { @@_begin } \prg_replicate:nn {#1} { \exp_not:n { \if_false: { \fi: } } } \fi: @@ -5560,12 +5668,12 @@ \int_set_eq:NN \l_@@_zeroth_submatch_int \l_@@_submatch_int \prg_replicate:nn \l_@@_capturing_group_int { - \tex_skip:D \l_@@_submatch_int \c_zero sp \scan_stop: + \tex_skip:D \l_@@_submatch_int 0 sp \scan_stop: \int_incr:N \l_@@_submatch_int } \prop_map_inline:Nn \l_@@_success_submatches_prop { - \if_int_compare:w ##1 - \c_one + \if_int_compare:w ##1 - 1 \exp_stop_f: \exp_after:wN \@@_extract_e:wn \__int_value:w \else: \exp_after:wN \@@_extract_b:wn \__int_value:w @@ -5659,17 +5767,17 @@ { 0 \int_step_function:nnnN - { \c_two * \l_@@_max_state_int } + { 2 * \l_@@_max_state_int } \l_@@_capturing_group_int - { \l_@@_submatch_int - \c_one } + { \l_@@_submatch_int - 1 } \@@_replacement_balance_one_match:n } \tl_set:Nx \l_@@_internal_a_tl { \int_step_function:nnnN - { \c_two * \l_@@_max_state_int } + { 2 * \l_@@_max_state_int } \l_@@_capturing_group_int - { \l_@@_submatch_int - \c_one } + { \l_@@_submatch_int - 1 } \@@_replacement_do_one_match:n \@@_query_range:nn \l_@@_start_pos_int \l_@@_max_pos_int @@ -5687,24 +5795,24 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_group_end_replace:N #1 { - \if_int_compare:w \l_@@_balance_int = \c_zero + \if_int_compare:w \l_@@_balance_int = 0 \exp_stop_f: \else: \__msg_kernel_error:nnxxx { regex } { result-unbalanced } { replacing } - { \int_max:nn { - \l_@@_balance_int } { \c_zero } } - { \int_max:nn { \l_@@_balance_int } { \c_zero } } + { \int_max:nn { - \l_@@_balance_int } { 0 } } + { \int_max:nn { \l_@@_balance_int } { 0 } } \fi: \use:x { \group_end: \tl_set:Nn \exp_not:N #1 { - \if_int_compare:w \l_@@_balance_int < \c_zero + \if_int_compare:w \l_@@_balance_int < 0 \exp_stop_f: \prg_replicate:nn { - \l_@@_balance_int } { { \if_false: } \fi: } \fi: \l_@@_internal_a_tl - \if_int_compare:w \l_@@_balance_int > \c_zero + \if_int_compare:w \l_@@_balance_int > 0 \exp_stop_f: \prg_replicate:nn { \l_@@_balance_int } { \if_false: { \fi: } } \fi: @@ -6028,7 +6136,7 @@ { \int_step_inline:nnnn \l_@@_min_state_int - \c_one + { 1 } { \l_@@_max_state_int - 1 } { \trace:nnx { regex } { #1 } diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx index 7e43d73d790..ad0dad50e0d 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-convert.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3str-convert.dtx Copyright (C) 2013-2016 The LaTeX3 Project +%% File: l3str-convert.dtx Copyright (C) 2013-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 @@ -22,7 +22,7 @@ % %<*driver|package> \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} % %<*driver> @@ -278,7 +278,7 @@ % \begin{macrocode} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} -\RequirePackage{l3tl-analysis,l3tl-build,l3flag} +\RequirePackage{l3tl-analysis,l3tl-build} % \end{macrocode} % % \subsection{Helpers} @@ -327,25 +327,27 @@ % \end{macrocode} % \end{variable} % -% \begin{variable} -% { -% \c_forty_eight, \c_fifty_eight, \c_sixty_five, \c_ninety_one, -% \c_ninety_seven, \c_one_hundred_twenty_three, -% \c_one_hundred_twenty_seven -% } -% We declare here some integer values which delimit ranges of \textsc{ascii} -% characters of various types. This is mostly used in \pkg{l3regex}. +% \begin{variable}{\c_@@_max_byte_int} +% The maximal byte number. % \begin{macrocode} -\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_@@_max_byte_int { 255 } % \end{macrocode} % \end{variable} % +% \begin{macro}{\c_@@_ascii_min_int, \c_@@_ascii_max_control_int, \c_@@_ascii_max_int} +% \begin{macrocode} +\int_const:Nn \c_@@_ascii_min_int { 0 } +\int_const:Nn \c_@@_ascii_max_control_int { 31 } +\int_const:Nn \c_@@_ascii_max_int { 127 } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux]{\c_@@_ascii_lower_int} +% \begin{macrocode} +\int_const:Nn \c_@@_ascii_lower_int { `a - `A } +% \end{macrocode} +% \end{macro} +% % \begin{variable}{\g_@@_alias_prop} % To avoid needing one file per encoding/escaping alias, we keep track % of those in a property list. @@ -494,7 +496,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \@@_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: @@ -510,7 +512,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \@@_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 @@ -941,20 +943,19 @@ \cs_new:Npn \@@_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: - \@@_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: + \@@_output_byte:n { `#1 + \c_@@_ascii_lower_int } \fi: \fi: \@@_convert_lowercase_alphanum_loop:N @@ -1003,9 +1004,9 @@ % to raise the flag \texttt{str_byte}. Spaces have already been given % the correct category code when this function is called. % \begin{macrocode} -\bool_if:nTF +\bool_lazy_any:nTF { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -1036,9 +1037,9 @@ % The simplest unescaping method removes non-bytes from % \cs{g_@@_result_tl}. % \begin{macrocode} -\bool_if:nTF +\bool_lazy_any:nTF { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -1089,9 +1090,9 @@ % \begin{macrocode} \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: } % \end{macrocode} @@ -1146,11 +1147,11 @@ } \cs_new:Npn \@@_encode_native_char:n #1 { - \if_int_compare:w #1 < \c_two_hundred_fifty_six - \@@_output_byte:n {#1} - \else: + \if_int_compare:w #1 > \c_@@_max_byte_int \flag_raise:n { str_error } ? + \else: + \@@_output_byte:n {#1} \fi: } \__msg_kernel_new:nnnn { str } { pdfTeX-native-overflow } @@ -1292,7 +1293,7 @@ \tex_dimen:D "#1 = \l_@@_internal_int sp \scan_stop: \tex_skip:D \l_@@_internal_int = "#1 sp \scan_stop: \tex_toks:D \l_@@_internal_int \exp_after:wN { \__int_value:w "#2 } - \tex_advance:D \l_@@_internal_int \c_one + \int_incr:N \l_@@_internal_int \@@_decode_eight_bit_load:nn } \cs_new_protected:Npn \@@_decode_eight_bit_load_missing:n #1 @@ -1302,7 +1303,7 @@ \tex_skip:D \l_@@_internal_int = "#1 sp \scan_stop: \tex_toks:D \l_@@_internal_int \exp_after:wN { \int_use:N \c_@@_replacement_char_int } - \tex_advance:D \l_@@_internal_int \c_one + \int_incr:N \l_@@_internal_int \@@_decode_eight_bit_load_missing:n } \cs_new:Npn \@@_decode_eight_bit_char:N #1 @@ -1347,7 +1348,7 @@ \tex_skip:D \l_@@_internal_int = "#2 sp \scan_stop: \exp_args:NNf \tex_toks:D \l_@@_internal_int { \@@_output_byte:n { "#1 } } - \tex_advance:D \l_@@_internal_int \c_one + \int_incr:N \l_@@_internal_int \@@_encode_eight_bit_load:nn } \cs_new:Npn \@@_encode_eight_bit_char:n #1 @@ -1366,10 +1367,10 @@ } \cs_new:Npn \@@_encode_eight_bit_char_aux:n #1 { - \if_int_compare:w #1 < \c_two_hundred_fifty_six - \@@_output_byte:n {#1} - \else: + \if_int_compare:w #1 > \c_@@_max_byte_int \flag_raise:n { str_error } + \else: + \@@_output_byte:n {#1} \fi: } % \end{macrocode} @@ -1404,9 +1405,9 @@ % Messages used for other escapings and % encodings are defined in each definition file. % \begin{macrocode} -\bool_if:nT +\bool_lazy_any:nT { - \sys_if_engine_luatex_p: || + \sys_if_engine_luatex_p: \sys_if_engine_xetex_p: } { @@ -1485,7 +1486,7 @@ \@@_output_byte:w " \exp_last_unbraced:Nf \@@_unescape_hex_auxi:N { \tl_to_str:N \g_@@_result_tl } - 0 { ? 0 - \c_one \__prg_break: } + 0 { ? 0 - 1 \__prg_break: } \__prg_break_point: \@@_output_end: } @@ -1582,7 +1583,7 @@ { } { \flag_raise:n { str_error } - * \c_zero + `#1 \use_i:nn + * 0 + `#1 \use_i:nn } } { @@ -1683,7 +1684,7 @@ { \@@_octal_use:NTF #4 { - \if_int_compare:w #2 > \c_three + \if_int_compare:w #2 > 3 \exp_stop_f: - 256 \fi: \@@_unescape_string_repeat:NNNNNN @@ -1703,11 +1704,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 } } \@@_output_end: @@ -1825,8 +1826,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 \@@_if_escape_string:N #1 { TF } @@ -1936,15 +1937,15 @@ % step: use the quotient of |#1| by $64$, and |#1| as arguments for % the looping auxiliary, and output the continuation byte % corresponding to the remainder $|#2|-64|#1|+128$. The bizarre -% construction |- \c_one + \c_zero *| removes the spurious initial +% construction |- 1 + 0 *| removes the spurious initial % continuation byte (better methods welcome). % \begin{macrocode} \cs_new_protected:cpn { @@_convert_encode_utf8: } { \@@_convert_gmap_internal:N \@@_encode_utf_viii_char:n } \cs_new:Npn \@@_encode_utf_viii_char:n #1 { - \@@_encode_utf_viii_loop:wwnnw #1 ; - \c_one + \c_zero * ; - { 128 } { \c_zero } + \@@_encode_utf_viii_loop:wwnnw #1 ; - 1 + 0 * ; + { 128 } { 0 } { 32 } { 192 } { 16 } { 224 } { 8 } { 240 } @@ -1959,7 +1960,7 @@ \exp_after:wN \@@_encode_utf_viii_loop:wwnnw \__int_value:w \int_div_truncate:nn {#1} {64} ; #1 ; #5 \q_stop - \@@_output_byte:n { #2 - 64 * ( #1 - \c_two ) } + \@@_output_byte:n { #2 - 64 * ( #1 - 2 ) } } % \end{macrocode} % \end{macro} @@ -2478,7 +2479,7 @@ \@@_decode_utf_xvi_pair_end:Nw #1 \fi: \if_case:w - \__int_eval:w ( \@@_tmp:w #1#2 - "D6 ) / \c_four \__int_eval_end: + \__int_eval:w ( \@@_tmp:w #1#2 - "D6 ) / 4 \__int_eval_end: \or: \exp_after:wN \@@_decode_utf_xvi_quad:NNwNN \or: \exp_after:wN \@@_decode_utf_xvi_extra:NNw \fi: @@ -2495,10 +2496,11 @@ \fi: \if_int_compare:w \if_int_compare:w \@@_tmp:w #4#5 < "DC \exp_stop_f: - \c_zero = \c_one + 0 = 1 \else: - \@@_tmp:w #4#5 < "E0 \exp_stop_f: + \@@_tmp:w #4#5 < "E0 \fi: + \exp_stop_f: #1 #2 #4 #5 \s__tl \int_eval:n { @@ -2714,12 +2716,12 @@ \exp_after:wN \@@_decode_utf_xxxii_end:w \fi: #1#2#3#4 \s__tl - \if_int_compare:w \@@_tmp:w #1#4 > \c_zero + \if_int_compare:w \@@_tmp:w #1#4 > 0 \exp_stop_f: \flag_raise:n { str_overflow } \flag_raise:n { str_error } \int_use:N \c_@@_replacement_char_int \else: - \if_int_compare:w \@@_tmp:w #2#3 > \c_sixteen + \if_int_compare:w \@@_tmp:w #2#3 > 16 \exp_stop_f: \flag_raise:n { str_overflow } \flag_raise:n { str_error } \int_use:N \c_@@_replacement_char_int diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx index c8dd27cd1e4..4244d7ae570 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str-format.dtx @@ -22,7 +22,7 @@ % %<*driver|package> \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} % %<*driver> @@ -196,7 +196,7 @@ % \begin{macrocode} \prg_new_conditional:Npnn \@@_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: } % \end{macrocode} @@ -385,9 +385,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} } @@ -395,9 +395,9 @@ { \prg_replicate:nn { - \int_max:nn \c_zero + \int_max:nn { 0 } { #3 - \__str_count:n { #2 #1 } } - / \c_two + / 2 } {#4} } @@ -632,7 +632,7 @@ \token_if_eq_charcode:NNTF #2 ? { \@@_put:nw { #1 > } } { \@@_put:nw { #1 #2 } } - \int_compare:nNnTF {#7} < \c_zero + \int_compare:nNnTF {#7} < 0 { \@@_put:nw { - } } { \str_case:nnF {#3} @@ -831,9 +831,9 @@ { \@@_put:fw { \int_eval:n { #3 - 1 } } \@@_put:nw { e } - \int_compare:nNnTF {#8} > \c_sixteen + \int_compare:nNnTF {#8} > \c__fp_prec_int { - \@@_put:fw { \prg_replicate:nn { #8 - \c_fifteen } {0} } + \@@_put:fw { \prg_replicate:nn { #8 - \c__fp_prec_int + 1 } {0} } \@@_put:fw { \use_none:n #4#5#6#7 } } { @@ -881,6 +881,7 @@ % % \begin{macro}[aux, EXP]{\@@_fp_g:wn} % \begin{macro}[aux, EXP]{\@@_fp_g_aux:wn} +% \begin{macro}[aux, EXP]{\@@_fp_to_scientific:n, \@@_fp_trim:w} % With the |g| type, first filter out special cases. In the normal % case, round to |#4| significant figures, then test the exponent: if % $-4\leq \meta{exponent} < \meta{precision}$, use the presentation @@ -909,14 +910,20 @@ \cs_new:Npn \@@_fp_g_aux:wn #1; #2 { \int_compare:nNnTF { \__fp_exponent:w #1; } < { -3 } - { \fp_to_scientific:n } + { \@@_to_scientific:n } { \int_compare:nNnTF { \__fp_exponent:w #1; } > {#2} - { \fp_to_scientific:n } + { \@@_to_scientific:n } { \fp_to_decimal:n } } { \__fp_set_sign_o:w 0 #1; @ \prg_do_nothing: } } +\cs_new:Npn \@@_to_scientific:n + { + \exp_after:wN \@@_fp_trim:w + \exp:w \exp_end_continue_f:w \fp_to_scientific:n + } +\cs_new:Npn \@@_fp_trim:w #1 e { \__fp_trim_zeros:w #1 ; e } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins index 524d98947e3..56c80ce4992 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3str.ins @@ -51,7 +51,6 @@ and all files in that bundle must be distributed together. \keepsilent -\generate{\file{l3flag.sty} {\from{l3flag.dtx} {package}}} \generate{\file{l3regex.sty} {\from{l3regex.dtx} {package}}} \generate{\file{l3str-convert.sty} {\from{l3str-convert.dtx} {package}}} \generate{\file{l3str-format.sty} {\from{l3str-format.dtx} {package}}} diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx index 340125f1313..f08009cbb24 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-analysis.dtx @@ -22,7 +22,7 @@ % %<*driver|package> \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} % %<*driver> @@ -289,7 +289,7 @@ \cs_new:Npn \@@_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 \@@_cs_space_count:w \token_to_str:N #2 \fi: \@@_cs_space_count_end:w ; ~ ! @@ -297,7 +297,7 @@ \cs_new:Npn \@@_cs_space_count:w #1 ~ { \if_false: #1 #1 \fi: - + \c_one + + 1 \@@_cs_space_count:w } \cs_new:Npn \@@_cs_space_count_end:w ; #1 \fi: #2 ! @@ -399,7 +399,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_setup:n #1 { - \int_set:Nn \tex_escapechar:D { - \c_one } + \int_set:Nn \tex_escapechar:D { -1 } \exp_after:wN \@@_disable_loop:N \tl_to_str:n {#1} { ~ } { ? ~ \__prg_break: } \__prg_break_point: @@ -408,7 +408,7 @@ \char_set_catcode_active:N \^^@ \cs_new_protected:Npn \@@_disable_loop:N #1 { - \tex_lccode:D \c_zero `#1 ~ + \tex_lccode:D 0 = `#1 ~ \tex_lowercase:D { \tex_let:D ^^@ } \tex_undefined:D \@@_disable_loop:N } @@ -501,18 +501,19 @@ { \l_@@_type_int = \if_meaning:w \l_@@_token \c_space_token - \c_zero + 0 \else: \if_catcode:w \exp_not:N \l_@@_token \c_group_begin_token - \c_one + 1 \else: \if_catcode:w \exp_not:N \l_@@_token \c_group_end_token - - \c_one + - 1 \else: - \c_two + 2 \fi: \fi: \fi: + \exp_stop_f: \if_case:w \l_@@_type_int \exp_after:wN \@@_a_space:w \or: \exp_after:wN \@@_a_bgroup:w @@ -593,9 +594,9 @@ \group_end: \cs_new_protected:Npn \@@_a_group:nw #1 { - \tex_lccode:D \c_zero = \@@_extract_charcode: \scan_stop: + \tex_lccode:D 0 = \@@_extract_charcode: \scan_stop: \tex_lowercase:D { \tex_toks:D \l_@@_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 \@@_a_group_test:w @@ -650,14 +651,14 @@ \cs_new_protected:Npn \@@_a_store: { \tex_advance:D \l_@@_nesting_int \l_@@_type_int - \if_int_compare:w \tex_lccode:D \c_zero = \c_thirty_two - \tex_multiply:D \l_@@_type_int \c_two + \if_int_compare:w \tex_lccode:D 0 = `\ \exp_stop_f: + \tex_multiply:D \l_@@_type_int 2 \exp_stop_f: \fi: \tex_skip:D \l_@@_index_int = \l_@@_normal_int sp plus \l_@@_type_int sp \scan_stop: \int_incr:N \l_@@_index_int \int_zero:N \l_@@_normal_int - \if_int_compare:w \l_@@_nesting_int = - \c_one + \if_int_compare:w \l_@@_nesting_int = -1 \exp_stop_f: \cs_set_eq:NN \@@_a_loop:w \scan_stop: \fi: } @@ -698,9 +699,9 @@ } \cs_new_protected:Npn \@@_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_@@_index_int - = \__int_eval:w \l_@@_normal_int + \c_one sp \scan_stop: + = \__int_eval:w \l_@@_normal_int + 1 sp \scan_stop: \tex_advance:D \l_@@_index_int #1 \exp_stop_f: \l_@@_normal_int #2 \exp_stop_f: \else: @@ -756,7 +757,7 @@ % \begin{macrocode} \cs_new:Npn \@@_b_normals:ww #1; { - \if_int_compare:w #1 = \c_zero + \if_int_compare:w #1 = 0 \exp_stop_f: \@@_b_special:w \fi: \@@_b_normal:wwN #1; @@ -802,7 +803,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 \@@_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 + } % \end{macrocode} % \end{macro} @@ -823,7 +824,7 @@ { \exp_after:wN \@@_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: @@ -869,7 +870,7 @@ \else: \exp_after:wN \@@_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: @@ -982,10 +983,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 \@@_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 \@@_show_active:n \else: @@ -1028,7 +1029,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 } } } % \end{macrocode} @@ -1058,11 +1059,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_@@_show_etc_str } \c_@@_show_etc_str diff --git a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx index d9631e8092f..b7aba0ecfdc 100644 --- a/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/l3str/l3tl-build.dtx @@ -23,8 +23,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\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} @@ -36,7 +36,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} % %<*driver> @@ -208,7 +208,7 @@ \fi: \tex_the:D \tex_toks:D #1 \exp_stop_f: \exp_after:wN \@@_unpack_loop:w - \int_use:N \__int_eval:w #1 + \c_one ; + \int_use:N \__int_eval:w #1 + 1 ; } % \end{macrocode} % \end{macro} @@ -278,7 +278,7 @@ \cs_new_protected:Npn \@@_one:n #1 { \tex_toks:D \l_@@_index_int {#1} - \tex_advance:D \l_@@_index_int \c_one + \int_incr:N \l_@@_index_int \if_int_compare:w \l_@@_index_int > \c_max_register_int \@@_unpack: \l_@@_index_int \l_@@_start_index_int @@ -287,7 +287,7 @@ \cs_new_protected:Npn \@@_one:o #1 { \tex_toks:D \l_@@_index_int \exp_after:wN {#1} - \tex_advance:D \l_@@_index_int \c_one + \int_incr:N \l_@@_index_int \if_int_compare:w \l_@@_index_int > \c_max_register_int \@@_unpack: \l_@@_index_int \l_@@_start_index_int diff --git a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx index 3d46c309a72..d528151f656 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/l3galley.dtx @@ -1,7 +1,7 @@ % \iffalse % %% File: l3galley.dtx Copyright (C) 1999-2001, 2004-2009 Frank Mittelbach -%% (C) 2010-2016 The LaTeX3 Project +%% (C) 2010-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 @@ -24,8 +24,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\RequirePackage{expl3}[2017/02/10] -%\@ifpackagelater{expl3}{2017/02/10} +\RequirePackage{expl3}[2017/03/07] +%\@ifpackagelater{expl3}{2017/03/07} % {} % {% % \PackageError{l3galley}{Support package l3kernel too old} @@ -37,7 +37,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} % %<*driver> @@ -263,7 +263,7 @@ % is retained for the rest of the paragraph. % For example, % \begin{verbatim} -% \galley_parshape_set_multi_par:nnnN { 1 } +% \galley_parshape_set_multi:nnnN { 1 } % { 2 pt , 4 pt , 6 pt } { 2 pt , 4 pt , 6 pt } \c_true_bool % \end{verbatim} % would create a paragraph shape in which the first line is the full @@ -964,6 +964,13 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\c_@@_max_penalty_int} +% \enquote{Infinite} penalty. +% \begin{macrocode} +\int_const:Nn \c_@@_max_penalty_int { 10000 } +% \end{macrocode} +% \end{variable} +% % \subsection{Independent galley levels} % % As well as the main vertical list, independent galleys are required @@ -1227,7 +1234,7 @@ % \cs{tex_parskip:D}, which will leave an unwanted break-point here % otherwise. % \begin{macrocode} - \tex_penalty:D \c_ten_thousand + \tex_penalty:D \c_@@_max_penalty_int } % \end{macrocode} % Once a cutout has been set, properly tidying up needs some work. The @@ -1251,11 +1258,9 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_par_update_cutout: { - \bool_if:nF - { - \seq_if_empty_p:N \g_@@_cutout_left_seq - && \seq_if_empty_p:N \g_@@_cutout_right_seq - } + \bool_lazy_and:nnF + { \seq_if_empty_p:N \g_@@_cutout_left_seq } + { \seq_if_empty_p:N \g_@@_cutout_right_seq } { \prg_replicate:nn \tex_prevgraf:D { @@ -1266,11 +1271,9 @@ } \int_compare:nNnT \l_@@_group_level_int = \etex_currentgrouplevel:D { - \bool_if:nT - { - \seq_if_empty_p:N \g_@@_cutout_left_seq - && \seq_if_empty_p:N \g_@@_cutout_right_seq - } + \bool_lazy_and:nnT + { \seq_if_empty_p:N \g_@@_cutout_left_seq } + { \seq_if_empty_p:N \g_@@_cutout_right_seq } { \bool_gset_false:N \g_@@_cutout_active_bool } } } @@ -1581,7 +1584,7 @@ \tl_if_empty:NTF \g_@@_interpar_penalty_user_tl { \bool_if:NTF \g_galley_no_break_next_bool - { \tex_penalty:D \c_ten_thousand } + { \tex_penalty:D \c_@@_max_penalty_int } { \tex_penalty:D \l_galley_interpar_penalty_int } } { @@ -1833,15 +1836,13 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_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 } @@ -1855,11 +1856,9 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_parshape_set_indents: { - \bool_if:nF - { - \seq_if_empty_p:N \l_@@_parshape_left_indent_seq - && \seq_if_empty_p:N \l_@@_parshape_right_indent_seq - } + \bool_lazy_and:nnF + { \seq_if_empty_p:N \l_@@_parshape_left_indent_seq } + { \seq_if_empty_p:N \l_@@_parshape_right_indent_seq } { \@@_parshape_set_indents:NN \l_@@_parshape_left_indent_seq @@ -1896,11 +1895,9 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_parshape_set_cutouts: { - \bool_if:nF - { - \seq_if_empty_p:N \g_@@_cutout_left_seq - && \seq_if_empty_p:N \g_@@_cutout_right_seq - } + \bool_lazy_and:nnF + { \seq_if_empty_p:N \g_@@_cutout_left_seq } + { \seq_if_empty_p:N \g_@@_cutout_right_seq } { \@@_parshape_set_cutouts:n { left } \@@_parshape_set_cutouts:n { right } @@ -1909,7 +1906,7 @@ \seq_count:N \l_@@_cutout_left_indent_seq - \seq_count:N \l_@@_cutout_right_indent_seq } - \int_compare:nNnTF \l_@@_tmp_int > \c_zero + \int_compare:nNnTF \l_@@_tmp_int > 0 { \@@_parshape_set_cutouts:N \l_@@_cutout_right_indent_seq } { \@@_parshape_set_cutouts:N \l_@@_cutout_left_indent_seq } \@@_parshape_set_indents:NN @@ -1943,9 +1940,9 @@ { \seq_count:N \g_@@_tmpa_seq - \seq_count:N \g_@@_tmpb_seq - + \c_one + + 1 } - \int_compare:nNnT \l_@@_tmp_int > \c_zero + \int_compare:nNnT \l_@@_tmp_int > 0 { \prg_replicate:nn { \l_@@_tmp_int } @@ -2102,10 +2099,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 } } @@ -2172,12 +2169,12 @@ { \tex_unskip:D \bool_if:NF #1 - { \tex_vadjust:D { \tex_penalty:D \c_ten_thousand } } + { \tex_vadjust:D { \tex_penalty:D \c_@@_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_@@_max_penalty_int \tex_hfil:D - \tex_penalty:D -\c_ten_thousand + \tex_penalty:D - \c_@@_max_penalty_int } } % \end{macrocode} @@ -2236,17 +2233,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} \@@_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} \@@_set_aux:n - \c_zero + 0 \exp_stop_f: } \cs_generate_variant:Nn \galley_widow_penalties_set:n { V , v } \cs_new:Npn \@@_set_aux:n #1 { \int_eval:n {#1} ~ } @@ -2295,9 +2292,9 @@ \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} \@@_set_aux:n - \c_zero + 0 \exp_stop_f: \@@_calc_interline_penalties: } \cs_generate_variant:Nn \galley_display_club_penalties_set:n { V , v } @@ -2320,9 +2317,9 @@ % \begin{macrocode} \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: \@@_calc_interline_penalties: } { @@ -2330,7 +2327,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: } @@ -2341,11 +2338,11 @@ \cs_new_protected:Npn \@@_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} \@@_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 } \@@_set_interline_penalty_auxii:n \__int_eval:w #2 \__int_eval_end: } @@ -2376,17 +2373,11 @@ \exp_args:Nff \@@_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 } @@ -2400,11 +2391,11 @@ \cs_new_protected:Npn \@@_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} \@@_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 } \@@_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 \@@_calc_interline_penalties_auxi:n #1 { @@ -2417,7 +2408,7 @@ \cs_new:Npn \@@_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: @@ -2457,8 +2448,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 } \@@_save_display_club_penalties:n } } @@ -2468,8 +2459,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 } \@@_save_display_widow_penalties:n } } @@ -2482,8 +2473,8 @@ { \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 } \@@_save_widow_penalties:n } } @@ -2495,7 +2486,7 @@ % last value in the primitive array. % \begin{macrocode} \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: } % \end{macrocode} % \end{macro} % \end{macro} @@ -2523,7 +2514,7 @@ { \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 { } } @@ -2643,7 +2634,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/source/latex/l3experimental/xgalley/xgalley.dtx b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx index d86baef3497..290c64bc8b8 100644 --- a/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx +++ b/Master/texmf-dist/source/latex/l3experimental/xgalley/xgalley.dtx @@ -1,7 +1,7 @@ % \iffalse % %% 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 % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -23,7 +23,7 @@ % %<*driver|package> \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} % %<*driver> @@ -892,14 +892,14 @@ \bool_if:NTF \l_@@_parshape_on_left_bool { \galley_parshape_set_single:nVVN - \c_zero + { 0 } \l_@@_tmpa_clist \l_@@_tmpb_clist \c_true_bool } { \galley_parshape_set_single:nVVN - \c_zero + { 0 } \l_@@_tmpb_clist \l_@@_tmpa_clist \c_true_bool @@ -1047,7 +1047,7 @@ \tl_clear:N \l_@@_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 } } @@ -1095,7 +1095,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/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index 7f7774db5e5..55659a6b4e4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -23,8 +23,8 @@ %<*driver|generic|package> \def\ExplFileName{expl3}% \def\ExplFileDescription{L3 programming layer}% -\def\ExplFileDate{2017/02/10}% -\def\ExplFileVersion{6878}% +\def\ExplFileDate{2017/03/07}% +\def\ExplFileVersion{6984}% % %<*driver> \documentclass[full]{l3doc} @@ -1714,11 +1714,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/source/latex/l3kernel/l3.ins b/Master/texmf-dist/source/latex/l3kernel/l3.ins index 3f281392b4e..2c381ced862 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3.ins +++ b/Master/texmf-dist/source/latex/l3kernel/l3.ins @@ -67,6 +67,7 @@ and all files in that bundle must be distributed together. \from{l3str.dtx} {package} \from{l3seq.dtx} {package} \from{l3int.dtx} {package} + \from{l3flag.dtx} {package} \from{l3quark.dtx} {package} \from{l3prg.dtx} {package} \from{l3clist.dtx} {package} @@ -94,6 +95,7 @@ and all files in that bundle must be distributed together. \from{l3coffins.dtx} {package} \from{l3color.dtx} {package} \from{l3sys.dtx} {package} + \from{l3deprecation.dtx}{package} \from{l3candidates.dtx} {package} \from{l3luatex.dtx} {package,tex} } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx index 8d783bd018f..2a788cf80d2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3alloc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3alloc.dtx Copyright (C) 1990-2012,2014-2016 The LaTeX3 Project +%% File: l3alloc.dtx Copyright (C) 1990-2012,2014-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 @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3alloc.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3alloc.dtx 6952 2017-02-18 19:07:47Z joseph $ {L3 Register allocation} \begin{document} \DocInput{\jobname.dtx} @@ -51,70 +51,25 @@ % % \begin{documentation} % -% Note that this module is only used for generating an \pkg{expl3}-based -% format. Under \LaTeX{}, the \pkg{etex} package is used for allocation -% management. -% -% This module provides the basic mechanism for allocating \TeX{}'s -% registers. While designing this we have to take into account the -% following characteristics: -% \begin{itemize} -% \item |\box255| is reserved for use in the output routine, so it -% should not be allocated otherwise. -% \item \TeX{} can load up $256$ hyphenation patterns (registers -% \tn{language} $0$ to $255$), -% \item \TeX{} can load no more than $16$ math families, -% \item \TeX{} supports no more than $16$ I/O streams for reading -% (\tn{read}) and $16$ I/O streams for writing (\tn{write}), -% \item \TeX{} supports no more than $256$ inserts. -% \item The other registers (\tn{count}, \tn{dimen}, \tn{skip}, -% \tn{muskip}, \tn{box}, and \tn{toks}) range from $0$ to $32\,767$ -% ($65\,535$ for \LuaTeX{}), but registers numbered above $255$ are -% accessed somewhat less efficiently (except in \LuaTeX{}, where access -% is \enquote[flat}). -% \item Registers could be allocated both globally and locally; the -% use of registers could also be global or local. Here we -% provide support for globally allocated registers for both -% global and local use. -% \end{itemize} -% We also need to allow for some bookkeeping: we need to know which -% register was allocated last and which registers can not be -% allocated by the standard mechanisms. -% -% \section{Internal functions} -% -% Register-based allocation is a low-level process, and is therefore -% only to be used as part of kernel code. -% -% \begin{function}[updated = 2012-11-09]{\__alloc_new:nnnN} -% \begin{syntax} -% \cs{__alloc_new:nnnN} \Arg{type} \Arg{min} \Arg{max} \meta{function} -% \end{syntax} -% Shorthand for allocating new registers. Defines \cs{\meta{type}_new:N} as -% and allocator function of the specified \meta{type}, indexed up from -% \meta{min} to a \meta{max}, and with assignment carried out by -% the \meta{function}. This process will create two token lists, -% \cs{g_\meta{type}_allocation_tl} and \cs{c_\meta{type}_allocation_max_tl}, -% to store the current and maximum allocation numbers, respectively. -% \end{function} -% -% \begin{function}[updated = 2011-09-05]{\__alloc_setup_type:nnn} -% \begin{syntax} -% \cs{__alloc_setup_type:nnn} \Arg{type} \Arg{min} \Arg{max} -% \end{syntax} -% Sets up the storage needed for the administration of registers of -% \Arg{type}, which will start allocating at \meta{min} and will issue -% an error if there is an attempt to allocate past the \meta{max}. -% \end{function} -% -% \begin{function}{\__alloc_reg:nNN} -% \begin{syntax} -% \cs{__alloc_reg:nNN} \Arg{type} \meta{function} \meta{register} -% \end{syntax} -% Preforms the allocation for a new \meta{register} of \meta{type}, -% using the allocator \meta{function} (which will be either a -% primitive \tn{\ldots def} or \tn{chardef}). -% \end{function} +% This module provides the basic mechanism for allocating \TeX{}'s +% registers when operating in format mode. When loaded as a package on +% an existing format, the mechanisms from the latter are used. +% +% The approach used here is informed by the mechanisms used in plain +% \TeX{}/\LaTeX{} but noting that newer engines provide us much more +% flexibility. In addition to this, we do not need allocators for all +% register types: for example \texttt{toks} are not used by \LaTeX3 whilst +% reads/writes are handled using a pool and thus do not need a classical +% allocator. +% +% In classical (non-\LuaTeX{}) engines, there are various restriction on +% registers, for example |\box255| is hard-coded as the output box and +% inserts have to be allocated below this (not in the extended pool). Rather +% than worry about this, allocations for the registers affected (\TeX{} +% |box|, |count|, |dimen| and |skip| types) are simply made only from the +% extended pool. (There is a performance impact in engines other than +% \LuaTeX{} but the free use of registers in \pkg{expl3} means that code +% cannot be sure of obtaining a low-numbered register in any case.) % % \end{documentation} % @@ -130,127 +85,101 @@ %<@@=alloc> % \end{macrocode} % -% \begin{macro}[int]{\@@_new:nnnN} -% Shorthand for defining new register types and their allocators: creates -% the appropriate variables and the allocator function itself. -% \begin{macrocode} -\cs_new_protected:Npn \@@_new:nnnN #1#2#3#4 - { - \@@_setup_type:nnn {#1} {#2} {#3} - \cs_new_protected:cpn { #1 _new:N } ##1 { \@@_reg:nNN {#1} #4 ##1 } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\@@_setup_type:nnn} -% For each type of register we need to \enquote{counters} that hold the -% last allocated global register, plus a constant for the maximum -% allocation. +% \begin{variable}[int] +% { +% \g_@@_int_int , +% \g_@@_dim_int , +% \g_@@_muskip_int , +% \g_@@_int_int , +% \g_@@_box_int +% } +% The core register tracking is done using the same raw \TeX{} count +% registers as reserved by plain \TeX{} and \LaTeXe{}, as there may be the +% odd piece of generic code that needs to work by number. However, as not +% all of our variables work the same way, some of the older registers are +% simply ignored. For the same reason, there is no special status for the +% low-numbers registers other than counts. To avoid having to worry about +% inserts and reflecting the register availability in \eTeX{}, the lower +% register space is unused here (though is available for hard-coded +% use). % \begin{macrocode} -\cs_new_protected:Npn \@@_setup_type:nnn #1#2#3 - { - \tl_new:c { g__ #1 _allocation_tl } - \tl_gset:cx { g__ #1 _allocation_tl } { \int_eval:n {#2} } - \tl_const:cx { c__ #1 _allocation_max_tl } { \int_eval:n {#3} } - } +\tex_countdef:D \g_@@_int_int = 10 ~ +\tex_countdef:D \g_@@_dim_int = 11 ~ +\tex_countdef:D \g_@@_skip_int = 12 ~ +\tex_countdef:D \g_@@_muskip_int = 13 ~ +\tex_countdef:D \g_@@_box_int = 14 ~ +\g_@@_int_int = 255 ~ +\g_@@_dim_int = 255 ~ +\g_@@_skip_int = 255 ~ +\g_@@_muskip_int = 0 ~ +\g_@@_box_int = 255 ~ % \end{macrocode} -% \end{macro} -% -% \begin{macro}{\int_eval:n} -% For bootstrapping purposes, a definition of \cs{int_eval:n} is needed -% in terms of primitives. This is replaced in \pkg{l3int} with a clearer -% one. +% \end{variable} +% +% \begin{variable} +% { +% \g_@@_attribute_int , +% \g_@@_bytecode_int , +% \g_@@_chunkname_int , +% \g_@@_whatsit_int +% } +% To allow \LuaTeX{} to load |ltluatex.lua| for generic \Lua{} support, a +% small number of counts have to be correctly named at the \TeX{} level. +% At present there are no \pkg{expl3} allocators for these concepts so the +% names and numbers of the tracking variables may change. % \begin{macrocode} -\cs_new:Npn \int_eval:n #1 { \tex_number:D \etex_numexpr:D #1 \scan_stop: } +\etex_ifdefined:D \luatex_luatexversion:D + \tex_global:D \tex_countdef:D \g_@@_attribute_int = 21 ~ + \tex_global:D \tex_countdef:D \g_@@_bytecode_int = 22 ~ + \tex_global:D \tex_countdef:D \g_@@_chunkname_int = 23 ~ + \tex_global:D \tex_countdef:D \g_@@_whatsit_int = 24 ~ +\tex_fi:D % \end{macrocode} -% \end{macro} +% \end{variable} % % \begin{macro} % {\box_new:N, \dim_new:N, \int_new:N, \muskip_new:N \skip_new:N} -% To get everything to work correctly for inserts, some register types -% need to have their allocators set up \enquote{early}. It therefore -% makes sense to collect most of them together here. +% Each of the public allocators is a wrapper around the one internal +% function needed here. % \begin{macrocode} -\cs_if_exist:NTF \luatex_luatexversion:D - { \@@_new:nnnN { box } { 0 } \c_max_register_int \tex_chardef:D } - { \@@_new:nnnN { box } { 0 } \c_max_register_int \tex_mathchardef:D } -\@@_new:nnnN { dim } { 0 } \c_max_register_int \tex_dimendef:D -\@@_new:nnnN { int } { 10 } \c_max_register_int \tex_countdef:D -\@@_new:nnnN { muskip } { 0 } \c_max_register_int \tex_muskipdef:D -\@@_new:nnnN { skip } { 0 } \c_max_register_int \tex_skipdef:D -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\insert_new:N} -% For inserts, there is a need to reserve space in various other registers. -% First, the basic allocation is done. -% \begin{macrocode} -\@@_new:nnnN { insert } { 221 } { 254 } \tex_chardef:D -% \end{macrocode} -% Reserve a gap in the \texttt{box}, \texttt{dim}, \texttt{int} and -% \texttt{skip} lists. (An inline token list mapping would read better here, -% but this does not work until \texttt{int} allocation is available!) Note -% that \texttt{box255} is reserved by \TeX{} itself (\LuaTeX{} does make -% this alterable, but that doesn't really do much for us so we ignore -% that!) -% \begin{macrocode} -\tl_const:Nn \c__box_allocation_reserve_begin_tl { 221 } -\tl_const:Nn \c__box_allocation_reserve_end_tl { 255 } -\tl_const:Nn \c__dim_allocation_reserve_begin_tl { 221 } -\tl_const:Nn \c__dim_allocation_reserve_end_tl { 254 } -\tl_const:Nn \c__int_allocation_reserve_begin_tl { 221 } -\tl_const:Nn \c__int_allocation_reserve_end_tl { 254 } -\tl_const:Nn \c__skip_allocation_reserve_begin_tl { 221 } -\tl_const:Nn \c__skip_allocation_reserve_end_tl { 254 } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\@@_reg:nNN} -% This internal macro performs the actual allocation. -% \begin{macrocode} -\cs_new_protected:Npn \@@_reg:nNN #1#2#3 +\cs_new_protected:Npx \box_new:N #1 { - \__chk_if_free_cs:N #3 - \int_compare:nNnTF - { \tl_use:c { g__ #1 _allocation_tl } } - > { \tl_use:c { c__ #1 _allocation_max_tl } } - { \__msg_kernel_fatal:nnx { kernel } { out-of-registers } {#1} } - { - \tex_global:D #2 #3 \tl_use:c { g__ #1 _allocation_tl } \scan_stop: - \iow_log:x - { - \token_to_str:N #3 ~=~ #1 ~register~ - \tl_use:c { g__ #1 _allocation_tl } - } - \@@_next:n {#1} - } + \exp_not:N \@@_reg:nNnN { box } + \cs_if_exist:NTF \luatex_luatexversion:D + { \tex_chardef:D } + { \tex_mathchardef:D } + \c_max_register_int + #1 } +\cs_new_protected:Npn \dim_new:N #1 + { \@@_reg:nNnN { dim } \tex_dimendef:D \c_max_register_int #1 } +\cs_new_protected:Npn \int_new:N #1 + { \@@_reg:nNnN { int } \tex_countdef:D \c_max_register_int #1 } +\cs_new_protected:Npn \muskip_new:N #1 + { \@@_reg:nNnN { muskip } \tex_muskipdef:D \c_max_register_int #1 } +\cs_new_protected:Npn \skip_new:N #1 + { \@@_reg:nNnN { skip } \tex_skipdef:D \c_max_register_int #1 } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_next:n} -% Set up the next allocation by adding one to the current number, and if -% necessary skipping over a reserved block. +% \begin{macro}[int]{\@@_reg:nNNN} +% The allocator itself is modeled somewhat on \LaTeXe{}'s \tn{e@alloc}, +% though there is no need to set \tn{allocationnumber}. % \begin{macrocode} -\cs_new_protected:Npn \@@_next:n #1 +\cs_new_protected:Npn \@@_reg:nNnN #1#2#3#4 { - \tl_gset:cx { g__ #1 _allocation_tl } + \__chk_if_free_cs:N #4 + \int_compare:nNnTF { \int_use:c { g_@@_ #1 _int } } < {#3} { - \int_eval:n + \int_gincr:c { g_@@_ #1 _int } + \tex_global:D #2 #4 \int_use:c { g_@@_ #1 _int } + \iow_log:x { - \tl_if_exist:cTF { c__ #1 _allocation_reserve_begin_tl } - { - \int_compare:nNnTF - { \tl_use:c { g__ #1 _allocation_tl } + 1 } - = - { \tl_use:c { c__ #1 _allocation_reserve_begin_tl } } - { \tl_use:c { c__ #1 _allocation_reserve_end_tl } } - { \tl_use:c { g__ #1 _allocation_tl } } - } - { \tl_use:c { g__ #1 _allocation_tl } } - + 1 + \token_to_str:N #4 ~=~ #1 ~register~ + \int_use:c { g_@@_ #1 _int } } } + { \__msg_kernel_fatal:nnx { kernel } { out-of-registers } {#1} } } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index 6337bf9c86f..6b66f76f239 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3basics.dtx Copyright (C) 1990-2016 The LaTeX3 project +%% File: l3basics.dtx Copyright (C) 1990-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3basics.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3basics.dtx 6929 2017-02-14 15:53:00Z bruno $ {L3 Basic definitions} % %<*driver> @@ -686,7 +686,7 @@ % \end{texnote} % \end{function} % -% \begin{function}[updated = 2015-08-03]{\cs_show:N, \cs_show:c} +% \begin{function}[updated = 2017-02-14]{\cs_show:N, \cs_show:c} % \begin{syntax} % \cs{cs_show:N} \meta{control sequence} % \end{syntax} @@ -698,6 +698,15 @@ % \end{texnote} % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2017-02-14]{\cs_log:N, \cs_log:c} +% \begin{syntax} +% \cs{cs_log:N} \meta{control sequence} +% \end{syntax} +% Writes the definition of the \meta{control sequence} in the log +% file. See also \cs{cs_show:N} which displays the result in the +% terminal. +% \end{function} +% % \subsection{Converting to and from control sequences} % % \begin{function}[EXP]{\use:c} @@ -1040,7 +1049,7 @@ % \cs{cs_if_eq:NNTF} \Arg{cs_1} \Arg{cs_2} \Arg{true code} \Arg{false code} % \end{syntax} % Compares the definition of two \meta{control sequences} and -% is logically \texttt{true} the same, \emph{i.e.}~if they have exactly +% is logically \texttt{true} if they are the same, \emph{i.e.}~if they have exactly % the same definition when examined with \cs{cs_show:N}. % \end{function} % @@ -1256,6 +1265,15 @@ % such that internal parts of the mechanism are not visible. % \end{function} % +% \begin{function}[updated = 2015-08-03] +% {\__kernel_register_log:N, \__kernel_register_log:c} +% \begin{syntax} +% \cs{__kernel_register_log:N} \meta{register} +% \end{syntax} +% Used to write the contents of a \TeX{} register to the log file in a +% form similar to \cs{__kernel_register_show:N}. +% \end{function} +% % \begin{function}[EXP]{\__prg_case_end:nw} % \begin{syntax} % \cs{__prg_case_end:nw} \Arg{code} \meta{tokens} \cs{q_mark} \Arg{true code} \cs{q_mark} \Arg{false code} \cs{q_stop} @@ -2897,38 +2915,77 @@ % \subsection{Diagnostic functions} % % \begin{macro}[int]{\__kernel_register_show:N, \__kernel_register_show:c} +% \begin{macro}[aux]{\__kernel_register_show_aux:n} % Simply using the \tn{showthe} primitive does not allow for % line-wrapping, so instead use \cs{__msg_show_variable:NNNnn} (defined % in \pkg{l3msg}). This checks that the variable exists (using % \cs{cs_if_exist:NTF}), then displays the third argument, namely -% |>~|\meta{variable}|=|\meta{value}. +% |>~|\meta{variable}|=|\meta{value}. We expand the value before-hand +% as otherwise some integers (such as \tn{currentgrouplevel} or +% \tn{currentgrouptype}) altered by the line-wrapping code would show +% wrong values. % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} +% \end{macro} +% +% \begin{macro}[int]{\__kernel_register_log:N, \__kernel_register_log:c} +% Redirect the output of \cs{__kernel_register_show:N} to the log. +% \begin{macrocode} +\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 } +% \end{macrocode} +% \end{macro} % % \begin{macro}{\cs_show:N, \cs_show:c} % Some control sequences have a very long name or meaning. Thus, % simply using \TeX{}'s primitive \tn{show} could lead to overlong % lines. The output of this primitive is mimicked to some extent, % then the re-built string is given to \cs{iow_wrap:nnnN} for -% line-wrapping. The \cs{cs_show:c} command converts its argument to -% a control sequence within a group to avoid showing \tn{relax} for -% undefined control sequences. +% line-wrapping. We must expand the meaning before passing it to the +% wrapping code as otherwise we would wrongly see the definitions that +% are in place there. To get correct escape characters, set the +% \tn{escapechar} in a group; this also localizes the assignment +% performed by \texttt{x}-expansion. The \cs{cs_show:c} command also +% converts its argument to a control sequence within a group to avoid +% showing \tn{relax} for undefined control sequences. % \begin{macrocode} \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 } % \end{macrocode} % \end{macro} % +% \begin{macro}{\cs_log:N, \cs_log:c} +% Use \cs{cs_show:N} or \cs{cs_show:c} after calling +% \cs{__msg_log_next:} to redirect their output to the log file only. +% Note that \cs{cs_log:c} is not just a variant of \cs{cs_log:N} as +% the csname should be turned to a control sequence within a group +% (see \cs{cs_show:c}). +% \begin{macrocode} +\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 } +% \end{macrocode} +% \end{macro} +% % \subsection{Doing nothing functions} % % \begin{macro}[EXP]{\prg_do_nothing:} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index 239228d0917..0b06dae64f2 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\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} % %<*driver> @@ -915,13 +915,14 @@ % % \begin{macro}{\box_show:N, \box_show:c} % \begin{macro}{\box_show:Nnn, \box_show:cnn} -% Essentially a wrapper around the internal function. +% Essentially a wrapper around the internal function, but evaluating +% the breadth and depth arguments now outside the group. % \begin{macrocode} \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 - { \@@_show:NNnn \c_one } +\cs_new_protected:Npn \box_show:Nnn #1#2#3 + { \@@_show:NNff 1 #1 { \int_eval:n {#2} } { \int_eval:n {#3} } } \cs_generate_variant:Nn \box_show:Nnn { c } % \end{macrocode} % \end{macro} @@ -929,29 +930,28 @@ % % \begin{macro}{\box_log:N, \box_log:c} % \begin{macro}{\box_log:Nnn, \box_log:cnn} +% \begin{macro}[aux]{\@@_log:nNnn} % Getting \TeX{} to write to the log without interruption the run is done by % altering the interaction mode. For that, the \eTeX{} extensions are needed. % \begin{macrocode} \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 \@@_log:nNnn { \tex_the:D \etex_interactionmode:D } } +\cs_new_protected:Npn \@@_log:nNnn #1#2#3#4 { - \use:x - { - \etex_interactionmode:D \c_zero - \@@_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 } + \@@_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 } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % -% \begin{macro}[aux]{\@@_show:NNnn} +% \begin{macro}[aux]{\@@_show:NNnn, \@@_show:NNff} % The internal auxiliary to actually do the output uses a group to deal % with breadth and depth values. The \cs{use:n} here gives better output % appearance. Setting \tn{tracingonline} and \tn{errorcontextlines} is @@ -959,19 +959,22 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_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 \@@_show:NNnn { NNff } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx index 9b68994b370..526762d2529 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3candidates.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3candidates.dtx Copyright (C) 2012-2016 The LaTeX3 Project +%% File: l3candidates.dtx Copyright (C) 2012-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3candidates.dtx 6835 2017-01-30 21:25:17Z bruno $ +\GetIdInfo$Id: l3candidates.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Experimental additions to l3kernel} % %<*driver> @@ -90,26 +90,6 @@ % into the kernel. However, real use sometimes leads to better ideas, so functions from this module are % \textbf{not necessarily stable} and we may have to adjust them! % -% \section{Additions to \pkg{l3basics}} -% -% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\cs_log:N, \cs_log:c} -% \begin{syntax} -% \cs{cs_log:N} \meta{control sequence} -% \end{syntax} -% Writes the definition of the \meta{control sequence} in the log -% file. See also \cs{cs_show:N} which displays the result in the -% terminal. -% \end{function} -% -% \begin{function}[updated = 2015-08-03] -% {\__kernel_register_log:N, \__kernel_register_log:c} -% \begin{syntax} -% \cs{__kernel_register_log:N} \meta{register} -% \end{syntax} -% Used to write the contents of a \TeX{} register to the log file in a -% form similar to \cs{__kernel_register_show:N}. -% \end{function} -% % \section{Additions to \pkg{l3box}} % % \subsection{Affine transformations} @@ -287,22 +267,6 @@ % % \section{Additions to \pkg{l3clist}} % -% \begin{function}[added = 2014-08-22]{\clist_log:N, \clist_log:c} -% \begin{syntax} -% \cs{clist_log:N} \meta{comma list} -% \end{syntax} -% Writes the entries in the \meta{comma list} in the log file. See -% also \cs{clist_show:N} which displays the result in the terminal. -% \end{function} -% -% \begin{function}[added = 2014-08-22]{\clist_log:n} -% \begin{syntax} -% \cs{clist_log:n} \Arg{tokens} -% \end{syntax} -% Writes the entries in the comma list in the log file. See also -% \cs{clist_show:n} which displays the result in the terminal. -% \end{function} -% % \begin{function}[EXP, added = 2016-12-06] % {\clist_rand_item:N, \clist_rand_item:n, \clist_rand_item:c} % \begin{syntax} @@ -349,18 +313,6 @@ % respectively. The two scale factors should be given as real numbers. % \end{function} % -% \begin{function}[added = 2014-08-22] -% {\coffin_log_structure:N, \coffin_log_structure:c} -% \begin{syntax} -% \cs{coffin_log_structure:N} \meta{coffin} -% \end{syntax} -% This function writes the structural information about the -% \meta{coffin} in the log file. The width, height and depth of the -% typeset material are given, along with the location of all of the -% poles of the coffin. See also \cs{coffin_show_structure:N} which -% displays the result in the terminal. -% \end{function} -% % \section{Additions to \pkg{l3file}} % % \begin{function}[TF, added = 2014-07-02]{\file_if_exist_input:n} @@ -469,35 +421,8 @@ % open stream: intended for tracking down problems. % \end{function} % -% \section{Additions to \pkg{l3fp}} -% -% \begin{function}[added = 2014-08-22, updated = 2015-08-07] -% {\fp_log:N, \fp_log:c, \fp_log:n} -% \begin{syntax} -% \cs{fp_log:N} \meta{fp~var} -% \cs{fp_log:n} \Arg{floating point expression} -% \end{syntax} -% Evaluates the \meta{floating point expression} and writes the -% result in the log file. -% \end{function} -% % \section{Additions to \pkg{l3int}} % -% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\int_log:N, \int_log:c} -% \begin{syntax} -% \cs{int_log:N} \meta{integer} -% \end{syntax} -% Writes the value of the \meta{integer} in the log file. -% \end{function} -% -% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\int_log:n} -% \begin{syntax} -% \cs{int_log:n} \Arg{integer expression} -% \end{syntax} -% Writes the result of evaluating the \meta{integer expression} -% in the log file. -% \end{function} -% % \begin{function}[EXP, added = 2016-12-06]{\int_rand:nn} % \begin{syntax} % \cs{int_rand:nn} \Arg{intexpr_1} \Arg{intexpr_2} @@ -507,16 +432,6 @@ % is only available in \pdfTeX{} and \LuaTeX{}. % \end{function} % -% \section{Additions to \pkg{l3keys}} -% -% \begin{function}[added = 2014-08-22]{\keys_log:nn} -% \begin{syntax} -% \cs{keys_log:nn} \Arg{module} \Arg{key} -% \end{syntax} -% Writes in the log file the function which is used to actually -% implement a \meta{key} for a \meta{module}. -% \end{function} -% % \section{Additions to \pkg{l3msg}} % % In very rare cases it may be necessary to produce errors in an @@ -635,21 +550,6 @@ % than two \meta{boolean expressions}. % \end{function} % -% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\bool_log:N, \bool_log:c} -% \begin{syntax} -% \cs{bool_log:N} \meta{boolean} -% \end{syntax} -% Writes the logical truth of the \meta{boolean} in the log file. -% \end{function} -% -% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\bool_log:n} -% \begin{syntax} -% \cs{bool_log:n} \Arg{boolean expression} -% \end{syntax} -% Writes the logical truth of the \meta{boolean expression} in the log -% file. -% \end{function} -% % \section{Additions to \pkg{l3prop}} % % \begin{function}[EXP]{\prop_count:N, \prop_count:c} @@ -678,13 +578,6 @@ % arguments. For that specific task, \cs{prop_item:Nn} is faster. % \end{function} % -% \begin{function}[added = 2014-08-12]{\prop_log:N, \prop_log:c} -% \begin{syntax} -% \cs{prop_log:N} \meta{property list} -% \end{syntax} -% Writes the entries in the \meta{property list} in the log file. -% \end{function} -% % \begin{function}[EXP, added = 2016-12-06] % {\prop_rand_key_value:N, \prop_rand_key_value:c} % \begin{syntax} @@ -755,13 +648,6 @@ % \end{texnote} % \end{function} % -% \begin{function}[added = 2014-08-12]{\seq_log:N, \seq_log:c} -% \begin{syntax} -% \cs{seq_log:N} \meta{sequence} -% \end{syntax} -% Writes the entries in the \meta{sequence} in the log file. -% \end{function} -% % \begin{function}[EXP, added = 2016-12-06]{\seq_rand_item:N, \seq_rand_item:c} % \begin{syntax} % \cs{seq_rand_item:N} \meta{seq~var} @@ -793,51 +679,6 @@ % warning message of some sort. % \end{function} % -% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\dim_log:N, \dim_log:c} -% \begin{syntax} -% \cs{dim_log:N} \meta{dimension} -% \end{syntax} -% Writes the value of the \meta{dimension} in the log file. -% \end{function} -% -% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\dim_log:n} -% \begin{syntax} -% \cs{dim_log:n} \Arg{dimension expression} -% \end{syntax} -% Writes the result of evaluating the \meta{dimension expression} -% in the log file. -% \end{function} -% -% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\skip_log:N, \skip_log:c} -% \begin{syntax} -% \cs{skip_log:N} \meta{skip} -% \end{syntax} -% Writes the value of the \meta{skip} in the log file. -% \end{function} -% -% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\skip_log:n} -% \begin{syntax} -% \cs{skip_log:n} \Arg{skip expression} -% \end{syntax} -% Writes the result of evaluating the \meta{skip expression} -% in the log file. -% \end{function} -% -% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\muskip_log:N, \muskip_log:c} -% \begin{syntax} -% \cs{muskip_log:N} \meta{muskip} -% \end{syntax} -% Writes the value of the \meta{muskip} in the log file. -% \end{function} -% -% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\muskip_log:n} -% \begin{syntax} -% \cs{muskip_log:n} \Arg{muskip expression} -% \end{syntax} -% Writes the result of evaluating the \meta{muskip expression} -% in the log file. -% \end{function} -% % \section{Additions to \pkg{l3tl}} % % \begin{function}[EXP,pTF]{\tl_if_single_token:n} @@ -1103,22 +944,6 @@ % argument. % \end{function} % -% \begin{function}[added = 2014-08-22, updated = 2015-08-01]{\tl_log:N, \tl_log:c} -% \begin{syntax} -% \cs{tl_log:N} \meta{tl~var} -% \end{syntax} -% Writes the content of the \meta{tl~var} in the log file. See also -% \cs{tl_show:N} which displays the result in the terminal. -% \end{function} -% -% \begin{function}[added = 2014-08-22]{\tl_log:n} -% \begin{syntax} -% \cs{tl_log:n} \Arg{token list} -% \end{syntax} -% Writes the \meta{token list} in the log file. See also -% \cs{tl_show:n} which displays the result in the terminal. -% \end{function} -% % \begin{function}[EXP, added = 2016-12-06] % {\tl_rand_item:N, \tl_rand_item:c, \tl_rand_item:n} % \begin{syntax} @@ -1136,6 +961,41 @@ % \end{texnote} % \end{function} % +% \begin{function}[EXP, added = 2017-02-17] +% {\tl_range:Nnn, \tl_range:cnn, \tl_range:nnn} +% \begin{syntax} +% \cs{tl_range:Nnn} \meta{tl~var} \Arg{start index} \Arg{end index} +% \cs{tl_range:nnn} \Arg{token list} \Arg{start index} \Arg{end index} +% \end{syntax} +% Leaves in the input stream the items from the \meta{start index} to the +% \meta{end index} inclusive. Positive \meta{indices} are counted +% from the start of the \meta{token list}, $1$~being the first item, and +% negative \meta{indices} are counted from the end of the token list, +% $-1$~being the last item. If either of \meta{start index} or +% \meta{end index} is~$0$, the result is empty. For instance, +% \begin{verbatim} +% \iow_term:x { \tl_range:nnn { abcdef } { 2 } { 5 } } +% \iow_term:x { \tl_range:nnn { abcdef } { -4 } { -1 } } +% \iow_term:x { \tl_range:nnn { abcdef } { -2 } { -1 } } +% \iow_term:x { \tl_range:nnn { abcdef } { 0 } { -1 } } +% \end{verbatim} +% will print \texttt{{b}{c}{d}{e}}, \texttt{{c}{d}{e}{f}}, \texttt{{e}{f}}, and an empty +% line to the terminal. The \meta{start index} must always be smaller than +% or equal to the \meta{end index}: if this is not the case then no output +% is generated. Thus +% \begin{verbatim} +% \iow_term:x { \tl_range:nnn { abcdef } { 5 } { 2 } } +% \iow_term:x { \tl_range:nnn { abcdef } { -1 } { -4 } } +% \end{verbatim} +% both yield empty token lists. +% \begin{texnote} +% The result is returned within the \tn{unexpanded} +% primitive (\cs{exp_not:n}), which means that the \meta{item} +% will not expand further when appearing in an \texttt{x}-type +% argument expansion. +% \end{texnote} +% \end{function} +% % \section{Additions to \pkg{l3tokens}} % % \begin{function}[TF, updated = 2012-12-20]{\peek_N_type:} @@ -1168,35 +1028,6 @@ %<*initex|package> % \end{macrocode} % -% \subsection{Additions to \pkg{l3basics}} -% -% \begin{macrocode} -%<@@=cs> -% \end{macrocode} -% -% \begin{macro}{\cs_log:N, \cs_log:c} -% Use \cs{cs_show:N} or \cs{cs_show:c} after calling -% \cs{__msg_log_next:} to redirect their output to the log file only. -% Note that \cs{cs_log:c} is not just a variant of \cs{cs_log:N} as -% the csname should be turned to a control sequence within a group -% (see \cs{cs_show:c}). -% \begin{macrocode} -\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 } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[int]{\__kernel_register_log:N, \__kernel_register_log:c} -% Redirect the output of \cs{__kernel_register_show:N} to the log. -% \begin{macrocode} -\cs_new_protected:Npn \__kernel_register_log:N - { \__msg_log_next: \__kernel_register_show:N } -\cs_generate_variant:Nn \__kernel_register_log:N { c } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3box}} % % \begin{macrocode} @@ -1849,17 +1680,6 @@ %<@@=clist> % \end{macrocode} % -% \begin{macro}{\clist_log:N, \clist_log:c, \clist_log:n} -% Redirect output of \cs{clist_show:N} to the log. -% \begin{macrocode} -\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 } -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\clist_rand_item:n, \clist_rand_item:N, \clist_rand_item:c} % \begin{macro}[aux]{\@@_rand_item:nn} % The |N|-type function is not implemented through the |n|-type @@ -1874,7 +1694,7 @@ { \exp_args:Nf \@@_rand_item:nn { \clist_count:n {#1} } {#1} } \cs_new:Npn \@@_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 @@ -2347,17 +2167,6 @@ % \end{macro} % \end{macro} % -% \subsection{Coffin diagnostics} -% -% \begin{macro}{\coffin_log_structure:N, \coffin_log_structure:c} -% Redirect output of \cs{coffin_show_structure:N} to the log. -% \begin{macrocode} -\cs_new_protected:Npn \coffin_log_structure:N - { \__msg_log_next: \coffin_show_structure:N } -\cs_generate_variant:Nn \coffin_log_structure:N { c } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3file}} % % \begin{macrocode} @@ -2477,49 +2286,12 @@ % \end{macrocode} % \end{macro} % -% \subsection{Additions to \pkg{l3fp-assign}} -% -% \begin{macrocode} -%<@@=fp> -% \end{macrocode} -% -% \begin{macro}{\fp_log:N, \fp_log:c, \fp_log:n} -% Redirect output of \cs{fp_show:N} to the log. -% \begin{macrocode} -\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 } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3int}} % % \begin{macrocode} %<@@=int> % \end{macrocode} % -% \begin{macro}{\int_log:N, \int_log:c} -% Redirect output of \cs{int_show:N} to the log. This is not just a -% copy of \cs{__kernel_register_log:N} because of subtleties -% involving \tn{currentgrouplevel} and \tn{currentgrouptype}. See -% \cs{int_show:N} for details. -% \begin{macrocode} -\cs_new_protected:Npn \int_log:N - { \__msg_log_next: \int_show:N } -\cs_generate_variant:Nn \int_log:N { c } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\int_log:n} -% Redirect output of \cs{int_show:n} to the log. -% \begin{macrocode} -\cs_new_protected:Npn \int_log:n - { \__msg_log_next: \int_show:n } -% \end{macrocode} -% \end{macro} -% % \begin{macro}[EXP]{\int_rand:nn} % \begin{macro}[aux, EXP] % { @@ -2556,12 +2328,12 @@ \@@_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 \@@_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) } } } @@ -2603,20 +2375,6 @@ } % \end{macrocode} % -% \subsection{Additions to \pkg{l3keys}} -% -% \begin{macrocode} -%<@@=keys> -% \end{macrocode} -% -% \begin{macro}{\keys_log:nn} -% Redirect output of \cs{keys_show:nn} to the log. -% \begin{macrocode} -\cs_new_protected:Npn \keys_log:nn - { \__msg_log_next: \keys_show:nn } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3msg}} % % \begin{macrocode} @@ -2737,17 +2495,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\bool_log:N, \bool_log:c, \bool_log:n} -% Redirect output of \cs{bool_show:N} to the log. -% \begin{macrocode} -\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 } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3prop}} % % \begin{macrocode} @@ -2765,11 +2512,11 @@ { \int_eval:n { - \c_zero + 0 \prop_map_function:NN #1 \@@_count:nn } } -\cs_new:Npn \@@_count:nn #1#2 { + \c_one } +\cs_new:Npn \@@_count:nn #1#2 { + 1 } \cs_generate_variant:Nn \prop_count:N { c } % \end{macrocode} % \end{macro} @@ -2804,15 +2551,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\prop_log:N, \prop_log:c} -% Redirect output of \cs{prop_show:N} to the log. -% \begin{macrocode} -\cs_new_protected:Npn \prop_log:N - { \__msg_log_next: \prop_show:N } -\cs_generate_variant:Nn \prop_log:N { c } -% \end{macrocode} -% \end{macro} -% % \begin{macro}[EXP] % {\prop_rand_key_value:N, \prop_rand_key_value:c} % \begin{macro}[aux, EXP]{\@@_rand:NN, \@@_rand_item:Nw} @@ -2836,10 +2574,10 @@ } \cs_new:Npn \@@_rand_item:Nw #1#2 \s_@@ \@@_pair:wn #3 \s_@@ #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 \@@_rand_item:Nw \exp_after:wN #1 - \__int_value:w \int_eval:n { #2 - \c_one } \s_@@ + \__int_value:w \int_eval:n { #2 - 1 } \s_@@ } \cs_generate_variant:Nn \prop_rand_key_value:N { c } % \end{macrocode} @@ -2944,15 +2682,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\seq_log:N, \seq_log:c} -% Redirect output of \cs{seq_show:N} to the log. -% \begin{macrocode} -\cs_new_protected:Npn \seq_log:N - { \__msg_log_next: \seq_show:N } -\cs_generate_variant:Nn \seq_log:N { c } -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\seq_rand_item:N, \seq_rand_item:c} % Importantly, \cs{seq_item:Nn} only evaluates its argument once. % \begin{macrocode} @@ -2995,36 +2724,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\dim_log:N, \dim_log:c, \dim_log:n} -% Diagnostics. Redirect output of \cs{dim_show:n} to the log. -% \begin{macrocode} -\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 } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\skip_log:N, \skip_log:c, \skip_log:n} -% Diagnostics. Redirect output of \cs{skip_show:n} to the log. -% \begin{macrocode} -\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 } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\muskip_log:N, \muskip_log:c, \muskip_log:n} -% Diagnostics. Redirect output of \cs{muskip_show:n} to the log. -% \begin{macrocode} -\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 } -% \end{macrocode} -% \end{macro} -% % \subsection{Additions to \pkg{l3tl}} % % \begin{macrocode} @@ -3640,11 +3339,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 } @@ -3786,11 +3485,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 } } { \@@_change_case_output:Vwn \c__unicode_dotless_i_tl } { \@@_change_case_output:nwn { i } @@ -3923,15 +3620,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 } } + } } { \@@_change_case_output:Vwn \c__unicode_dot_above_tl } #1 #2#3 \q_recursion_stop @@ -3978,11 +3675,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 @@ -4559,11 +4254,9 @@ % \begin{macrocode} \cs_new:Npn \@@_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 } } { \@@_change_case_output:nwn { I } \@@_change_case_mixed_nl:Nw @@ -4583,14 +4276,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 } } } { \@@_change_case_output:nwn { J } @@ -4644,23 +4335,7 @@ % \end{macrocode} % \end{variable} % -% -% \begin{macro}{\tl_log:N, \tl_log:c} -% Redirect output of \cs{tl_show:N} to the log. -% \begin{macrocode} -\cs_new_protected:Npn \tl_log:N - { \__msg_log_next: \tl_show:N } -\cs_generate_variant:Nn \tl_log:N { c } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\tl_log:n} -% Redirect output of \cs{tl_show:n} to the log. -% \begin{macrocode} -\cs_new_protected:Npn \tl_log:n - { \__msg_log_next: \tl_show:n } -% \end{macrocode} -% \end{macro} +% \subsubsection{Other additions to \pkg{l3tl}} % % \begin{macro}{\tl_rand_item:n, \tl_rand_item:N, \tl_rand_item:c} % Importantly \cs{tl_item:nn} only evaluates its argument once. @@ -4675,6 +4350,105 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\tl_range:Nnn, \tl_range:cnn, \tl_range:nnn} +% \begin{macro}[aux] +% {\@@_range:nnnw, \@@_range:nnw, \@@_range_normalize:nn, \@@_range_collect:w, \@@_range_skip:w} +% To avoid checking for the end of the token list at every step, start +% by counting the number $l$ of items and \enquote{normalizing} the +% bounds, namely clamping them to the interval $[0,l]$ and dealing +% with negative indices. More precisely, \cs{@@_range:nnw} receives +% the number of items to skip at the beginning of the token list, and +% the index of the last item to keep. If nothing should be kept, +% leave |{}|: this stops the \texttt{f}-expansion of \cs{tl_head:f} +% and that function produces an empty result. Otherwise, repeatedly +% call \cs{@@_range_skip:w} to delete |#1| items from the input stream +% (the extra brace group avoids an off-by-one mistake), then +% repeatedly call \cs{@@_range_collect:w} to store in its second +% argument the items to be kept. Eventually, the result is a brace +% group followed by the rest of the token list, and \cs{tl_head:f} +% cleans up and gives the result in \cs{exp_not:n}. +% \begin{macrocode} +\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 \@@_range:nnnw { \tl_count:n {#1} } {#2} {#3} + #1 + } + } +\cs_new:Npn \@@_range:nnnw #1#2#3 + { + \exp_args:Nff \@@_range:nnw + { + \exp_args:Nf \@@_range_normalize:nn + { \int_eval:n { #2 - 1 } } {#1} + } + { + \exp_args:Nf \@@_range_normalize:nn + { \int_eval:n {#3} } {#1} + } + } +\cs_new:Npn \@@_range:nnw #1#2 + { + \if_int_compare:w #2 > #1 \exp_stop_f: \else: + \exp_after:wN { \exp_after:wN } + \fi: + \exp_after:wN \@@_range_collect:w + \__int_value:w \__int_eval:w #2 - #1 \exp_after:wN ; + \exp_after:wN { \exp_after:wN } + \exp:w \@@_range_skip:w #1 ; { } + } +\cs_new:Npn \@@_range_skip:w #1 ; #2 + { + \if_int_compare:w #1 > 0 \exp_stop_f: + \exp_after:wN \@@_range_skip:w + \__int_value:w \__int_eval:w #1 - 1 \exp_after:wN ; + \else: + \exp_after:wN \exp_end: + \fi: + } +\cs_new:Npn \@@_range_collect:w #1 ; #2#3 + { + \if_int_compare:w #1 > 1 \exp_stop_f: + \exp_after:wN \@@_range_collect:w + \__int_value:w \__int_eval:w #1 - 1 \exp_after:wN ; + \fi: + { #2 {#3} } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \begin{macro}[EXP, aux]{\@@_range_normalize:nn} +% This function converts an \meta{index} argument into an explicit +% position in the token list (a result of $0$ denoting \enquote{out of +% bounds}). Expects two explicit integer arguments: the \meta{index} +% |#1| and the string count~|#2|. If |#1| is negative, replace it by +% $|#1| + |#2| + 1$, then limit to the range $[0, |#2|]$. +% \begin{macrocode} +\cs_new:Npn \@@_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: + } + } +% \end{macrocode} +% \end{macro} +% % \subsection{Additions to \pkg{l3tokens}} % % \begin{macrocode} @@ -4713,10 +4487,10 @@ \cs_new_protected:Npn \@@_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 \@@_N_type:w \token_to_meaning:N \l_peek_token \q_mark \@@_N_type_aux:nnw diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index 12aea777839..f85046e2a98 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -26,7 +26,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\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} % %<*driver> @@ -677,6 +677,22 @@ % Displays the entries in the comma list in the terminal. % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\clist_log:N, \clist_log:c} +% \begin{syntax} +% \cs{clist_log:N} \meta{comma list} +% \end{syntax} +% Writes the entries in the \meta{comma list} in the log file. See +% also \cs{clist_show:N} which displays the result in the terminal. +% \end{function} +% +% \begin{function}[added = 2014-08-22]{\clist_log:n} +% \begin{syntax} +% \cs{clist_log:n} \Arg{tokens} +% \end{syntax} +% Writes the entries in the comma list in the log file. See also +% \cs{clist_show:n} which displays the result in the terminal. +% \end{function} +% % \section{Constant and scratch comma lists} % % \begin{variable}[added = 2012-07-02]{\c_empty_clist} @@ -1641,11 +1657,11 @@ #1 \exp_not:n { , \q_recursion_tail , \q_recursion_stop } } } -\cs_new:Npn \@@_count:n #1 { + \c_one } +\cs_new:Npn \@@_count:n #1 { + 1 } \cs_new:Npx \@@_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 \@@_count:w \c_space_tl } % \end{macrocode} @@ -1743,11 +1759,11 @@ } \cs_new:Npn \@@_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} @@ -1759,7 +1775,7 @@ \cs_generate_variant:Nn \@@_item:nnnN { ffo, ff } \cs_new:Npn \@@_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 \@@_item_N_loop:nw { \int_eval:n { #1 - 1 } } } } @@ -1795,7 +1811,7 @@ \exp_args:No \tl_if_blank:nTF {#2} { \@@_item_n_loop:nw {#1} \prg_do_nothing: } { - \int_compare:nNnTF {#1} = \c_zero + \int_compare:nNnTF {#1} = 0 { \exp_args:No \@@_item_n_end:n {#2} } { \exp_args:Nf \@@_item_n_loop:nw @@ -1842,6 +1858,17 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\clist_log:N, \clist_log:c, \clist_log:n} +% Redirect output of \cs{clist_show:N} and \cs{clist_show:n} to the log. +% \begin{macrocode} +\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 } +% \end{macrocode} +% \end{macro} +% % \subsection{Scratch comma lists} % % \begin{variable}{\l_tmpa_clist, \l_tmpb_clist} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx index 848eeefaa71..2cdab0d37ad 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3coffins.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3coffins.dtx Copyright(C) 2010-2016 The LaTeX3 Project +%% File: l3coffins.dtx Copyright(C) 2010-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3coffins.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3coffins.dtx 6906 2017-02-12 20:07:58Z bruno $ {L3 Coffin code layer} % %<*driver> @@ -309,6 +309,16 @@ % direction of the pole. % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2015-08-01] +% {\coffin_log_structure:N, \coffin_log_structure:c} +% \begin{syntax} +% \cs{coffin_log_structure:N} \meta{coffin} +% \end{syntax} +% This function writes the structural information about the +% \meta{coffin} in the log file. See also \cs{coffin_show_structure:N} +% which displays the result in the terminal. +% \end{function} +% % \subsection{Constants and variables} % % \begin{variable}{\c_empty_coffin} @@ -1679,6 +1689,15 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\coffin_log_structure:N, \coffin_log_structure:c} +% Redirect output of \cs{coffin_show_structure:N} to the log. +% \begin{macrocode} +\cs_new_protected:Npn \coffin_log_structure:N + { \__msg_log_next: \coffin_show_structure:N } +\cs_generate_variant:Nn \coffin_log_structure:N { c } +% \end{macrocode} +% \end{macro} +% % \subsection{Messages} % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx new file mode 100644 index 00000000000..01c880e3d50 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3deprecation.dtx @@ -0,0 +1,161 @@ +% \iffalse meta-comment +% +%% File: l3deprecation.dtx (C) Copyright 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 "l3kernel bundle" (The Work in LPPL) +% and all files in that bundle must be distributed together. +% +% ----------------------------------------------------------------------- +% +% The development version of the bundle can be found at +% +% https://github.com/latex3/latex3 +% +% for those people who are interested. +% +%<*driver> +\documentclass[full]{l3doc} +% +%<*driver|package> +\GetIdInfo$Id: l3deprecation.dtx 6966 2017-02-20 03:39:43Z bruno $ + {L3 Deprecation errors} +% +%<*driver> +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +% +% \fi +% +% \title{^^A +% The \pkg{l3deprecation} package\\ Deprecation errors^^A +% \thanks{This file describes v\ExplFileVersion, +% last revised \ExplFileDate.}^^A +% } +% +% \author{^^A +% The \LaTeX3 Project\thanks +% {^^A +% E-mail: +% \href{mailto:latex-team@latex-project.org} +% {latex-team@latex-project.org}^^A +% }^^A +% } +% +% \date{Released \ExplFileDate} +% +% \maketitle +% +% \begin{documentation} +% +% \section{\pkg{l3deprecation} documentation} +% +% A few commands have had to be deprecated over the years. This module +% defines deprecated and deleted commands to produce an error. +% +% \begin{macro}{\deprecation_error:} +% \begin{syntax} +% \cs{deprecation_error:} +% \end{syntax} +% Defines commands that will soon become deprecated to produce errors. +% \end{macro} +% +% \end{documentation} +% +% \begin{implementation} +% +% \section{\pkg{l3deprecation} implementation} +% +% \begin{macrocode} +%<*initex|package> +% \end{macrocode} +% +% \begin{macrocode} +%<@@=deprecation> +% \end{macrocode} +% +% \begin{macro}[aux]{\@@_error:Nnn} +% The \tn{outer} definition here ensures the command will not appear +% in an argument. Use this auxiliary on all commands that have been +% removed since 2015. +% \begin{macrocode} +\cs_new_protected:Npn \@@_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} } + } + } +\@@_error:Nnn \c_job_name_tl { \c_sys_jobname_str } { 2017-01-01 } +\@@_error:Nnn \dim_case:nnn { \dim_case:nnF } { 2015-07-14 } +\@@_error:Nnn \int_case:nnn { \int_case:nnF } { 2015-07-14 } +\@@_error:Nnn \int_from_binary:n { \int_from_bin:n } { 2016-01-05 } +\@@_error:Nnn \int_from_hexadecimal:n { \int_from_hex:n } { 2016-01-05 } +\@@_error:Nnn \int_from_octal:n { \int_from_oct:n } { 2016-01-05 } +\@@_error:Nnn \int_to_binary:n { \int_to_bin:n } { 2016-01-05 } +\@@_error:Nnn \int_to_hexadecimal:n { \int_to_hex:n } { 2016-01-05 } +\@@_error:Nnn \int_to_octal:n { \int_to_oct:n } { 2016-01-05 } +\@@_error:Nnn \luatex_if_engine_p: { \sys_if_engine_luatex_p: } { 2017-01-01 } +\@@_error:Nnn \luatex_if_engine:F { \sys_if_engine_luatex:F } { 2017-01-01 } +\@@_error:Nnn \luatex_if_engine:T { \sys_if_engine_luatex:T } { 2017-01-01 } +\@@_error:Nnn \luatex_if_engine:TF { \sys_if_engine_luatex:TF } { 2017-01-01 } +\@@_error:Nnn \pdftex_if_engine_p: { \sys_if_engine_pdftex_p: } { 2017-01-01 } +\@@_error:Nnn \pdftex_if_engine:F { \sys_if_engine_pdftex:F } { 2017-01-01 } +\@@_error:Nnn \pdftex_if_engine:T { \sys_if_engine_pdftex:T } { 2017-01-01 } +\@@_error:Nnn \pdftex_if_engine:TF { \sys_if_engine_pdftex:TF } { 2017-01-01 } +\@@_error:Nnn \prop_get:cn { \prop_item:cn } { 2016-01-05 } +\@@_error:Nnn \prop_get:Nn { \prop_item:Nn } { 2016-01-05 } +\@@_error:Nnn \quark_if_recursion_tail_break:N { } { 2015-07-14 } +\@@_error:Nnn \quark_if_recursion_tail_break:n { }{ 2015-07-14 } +\@@_error:Nnn \scan_align_safe_stop: { protected~commands } { 2017-01-01 } +\@@_error:Nnn \str_case:nnn { \str_case:nnF } { 2015-07-14 } +\@@_error:Nnn \str_case:onn { \str_case:onF } { 2015-07-14 } +\@@_error:Nnn \str_case_x:nnn { \str_case_x:nnF } { 2015-07-14 } +\@@_error:Nnn \tl_case:cnn { \tl_case:cnF } { 2015-07-14 } +\@@_error:Nnn \tl_case:Nnn { \tl_case:NnF } { 2015-07-14 } +\@@_error:Nnn \xetex_if_engine_p: { \sys_if_engine_xetex_p: } { 2017-01-01 } +\@@_error:Nnn \xetex_if_engine:F { \sys_if_engine_xetex:F } { 2017-01-01 } +\@@_error:Nnn \xetex_if_engine:T { \sys_if_engine_xetex:T } { 2017-01-01 } +\@@_error:Nnn \xetex_if_engine:TF { \sys_if_engine_xetex:TF } { 2017-01-01 } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\deprecation_error:} +% Some commands were more recently deprecated and not yet removed; +% only make these into errors if the user requests it. This allows +% testing code even if it relies on other packages: load all other +% packages, call \cs{deprecation_error:}, and load the code that one is +% interested in testing. +% \begin{macrocode} +\cs_new_protected:Npn \deprecation_error: + { + \@@_error:Nnn \tl_to_lowercase:n { } { 2017-12-31 } + \@@_error:Nnn \tl_to_uppercase:n { } { 2017-12-31 } + \@@_error:Nnn \ior_get_str:NN { \ior_str_get:NN } { 2017-12-31 } + \@@_error:Nnn \c_minus_one { - 1 } { 2018-12-31 } + \@@_error:Nnn \sort_ordered: { \sort_return_same: } { 2018-12-31 } + \@@_error:Nnn \sort_reversed: { \sort_return_swapped: } { 2018-12-31 } + \cs_set_eq:NN \deprecation_error: \scan_stop: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \end{implementation} +% +% \PrintIndex diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index c1f0e04c7aa..73c126ed443 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -62,7 +62,7 @@ Do not distribute a modified version of this file. % %<*driver|class> \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} % % @@ -1165,6 +1165,9 @@ Do not distribute a modified version of this file. % % \begin{macro}[int, pTF]{\@@_date_compare:nNn} % \begin{macro}[aux]{\@@_date_compare_aux:nnnNnnn, \@@_date_compare_aux:w} +% Expects |#1| and |#3| to be dates in the format YYYY-MM-DD (but +% accepts YYYY or YYYY-MM too). Compares them using |#2| (one of |<|, +% |=|, |>|), filling in zeros for missing data. % \begin{macrocode} \prg_new_conditional:Npnn \@@_date_compare:nNn #1#2#3 { TF , T , F , p } { \@@_date_compare_aux:w #1--- \q_mark #2 #3--- \q_stop } @@ -1232,6 +1235,8 @@ Do not distribute a modified version of this file. } \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. } % \end{macrocode} % % \subsection{Options and configuration} @@ -2137,8 +2142,8 @@ Do not distribute a modified version of this file. \bool_set_true:N \l_@@_macro_noTF_bool \bool_set_true:N \l_@@_macro_TF_bool } , - added .tl_set:N = \l_@@_date_added_tl , - updated .tl_set:N = \l_@@_date_updated_tl , + added .code:n = { \@@_date_set:Nn \l_@@_date_added_tl {#1} }, + updated .code:n = { \@@_date_set:Nn \l_@@_date_updated_tl {#1} } , deprecated .code:n = { \@@_deprecated_on:n {#1} } , tested .code:n = { } , label .code:n = @@ -2152,7 +2157,22 @@ Do not distribute a modified version of this file. } % \end{macrocode} % +% \begin{macro}[aux]{\@@_date_set:Nn} +% Minimal check that the date is not given in the YYYY/MM/DD format. +% Eventually we should check the input more carefully. +% \begin{macrocode} +\cs_new_protected:Npn \@@_date_set:Nn #1#2 + { + \tl_if_in:nnT {#2} { / } + { \msg_error:nnn { l3doc } { date-format } {#2} } + \tl_set:Nn #1 {#2} + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}[aux]{\@@_deprecated_on:n} +% The date comparison function expects two dates in the YYYY-MM-DD +% format (|-|~is not subtraction here). % Complain if a deprecated function should have been removed earlier. % In any case, mark it as internal to suppress the text % \enquote{documented on page \ldots{}}. @@ -2472,11 +2492,9 @@ Do not distribute a modified version of this file. % \begin{macrocode} \cs_new:Npn \@@_typeset_dates: { - \bool_if:nF - { - \tl_if_empty_p:N \l_@@_date_added_tl && - \tl_if_empty_p:N \l_@@_date_updated_tl - } + \bool_lazy_and:nnF + { \tl_if_empty_p:N \l_@@_date_added_tl } + { \tl_if_empty_p:N \l_@@_date_updated_tl } { \midrule } \tl_if_empty:NF \l_@@_date_added_tl { @@ -2638,7 +2656,7 @@ Do not distribute a modified version of this file. \hbox:n { \strut - \int_compare:nNnT \l_@@_macro_int = \c_zero + \int_compare:nNnT \l_@@_macro_int = 0 { \HD@target } } \vskip \int_eval:n { \l_@@_macro_int - 1 } \baselineskip @@ -2967,12 +2985,12 @@ Do not distribute a modified version of this file. % \begin{macrocode} \cs_new_protected:Npn \@@_macro_end_check_tested: { - \bool_if:nT + \bool_lazy_all:nT { - \g_@@_checktest_bool && - ! \l_@@_macro_aux_bool && - ! \l_@@_macro_var_bool && - ! \l_@@_macro_tested_bool + { \g_@@_checktest_bool } + { ! \l_@@_macro_aux_bool } + { ! \l_@@_macro_var_bool } + { ! \l_@@_macro_tested_bool } } { \seq_gput_right:Nx \g_@@_not_tested_seq @@ -3034,11 +3052,9 @@ Do not distribute a modified version of this file. } \cs_new_protected:Npn \@@_print_documented: { - \bool_if:nT - { - ! \l_@@_macro_aux_bool && - ! \l_@@_macro_internal_bool - } + \bool_lazy_or:nnF + { \l_@@_macro_aux_bool } + { \l_@@_macro_internal_bool } { \int_set:Nn \l_@@_tmpa_int { \seq_count:N \g_@@_nested_names_seq } @@ -3512,8 +3528,8 @@ Do not distribute a modified version of this file. % \begin{macrocode} \cs_new_protected:Npn \@@_show_functions_defined: { - \bool_if:nT - { \g_@@_typeset_implementation_bool && \g_@@_checkfunc_bool } + \bool_lazy_and:nnT + { \g_@@_typeset_implementation_bool } { \g_@@_checkfunc_bool } { \iow_term:x { \c_@@_iow_separator_tl \iow_newline: } \iow_open:Nn \g_@@_func_iow { \c_sys_jobname_str .cmds } @@ -4346,8 +4362,8 @@ page_precedence "rnaA" % \c_sixteen, % \c_thirty_two, % \c_hundred_one, -% \c_twohundred_fifty_five, -% \c_twohundred_fifty_six, +% \c_two_hundred_fifty_five, +% \c_two_hundred_fifty_six, % \c_thousand, % \c_ten_thousand, % \c_ten_thousand_one diff --git a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx index 20e53271c95..ca45f93242b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3drivers.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3drivers.dtx Copyright(C) 2011-2016 The LaTeX3 Project +%% File: l3drivers.dtx Copyright(C) 2011-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3drivers.dtx 6809 2017-01-01 06:33:13Z bruno $ +\GetIdInfo$Id: l3drivers.dtx 6954 2017-02-18 20:26:11Z joseph $ {L3 Experimental drivers} % %<*driver> @@ -420,7 +420,7 @@ % % \subsection{Inserting \TeX{} material} % -% \begin{function}{\__driver_draw_hbox:nnnnnn} +% \begin{function}{\__driver_draw_hbox:Nnnnnnn} % \begin{syntax} % \cs{__driver_draw_hbox:Nnnnnnn} \meta{box} % \Arg{a} \Arg{b} \Arg{c} \Arg{d} \Arg{x} \Arg{y} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index 2b15d471d7b..db0cfc7e94a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\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} % %<*driver> @@ -1426,11 +1426,11 @@ %\cs_new_eq:NN \exp:w \tex_romannumeral:D % \end{macrocode} % So to stop the expansion sequence in a controlled way all we need -% to provide is \cs{c_zero} as part of expanded tokens. As this is +% to provide is a constant integer zero as part of expanded tokens. As this is % an integer constant it will immediately stop % \cs{tex_romannumerl:D}'s search for a number. % \begin{macrocode} -%\cs_new_eq:NN \exp_end: \c_zero +%\int_const:Nn \exp_end: { 0 } % \end{macrocode} % (Note that according to our specification all tokens we expand % initiated by \cs{exp:w} are supposed to be expandable (as well as diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx index fee42ad5736..6ea0556fab4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3file.dtx Copyright (C) 1990-2016 The LaTeX3 Project +%% File: l3file.dtx Copyright (C) 1990-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3file.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3file.dtx 6964 2017-02-20 02:59:41Z bruno $ {L3 File and I/O operations} % %<*driver> @@ -691,9 +691,9 @@ 0 \tl_map_function:NN \l_@@_internal_name_tl \@@_name_sanitize_aux:n } - \c_two + { 2 } } - = \c_zero + = 0 { \tl_remove_all:Nn \l_@@_internal_name_tl { " } \tl_if_in:NnT \l_@@_internal_name_tl { ~ } @@ -714,10 +714,7 @@ } } \cs_new:Npn \@@_name_sanitize_aux:n #1 - { - \token_if_eq_charcode:NNT #1 " - { + \c_one } - } + { \token_if_eq_charcode:NNT #1 " { + 1 } } % \end{macrocode} % \end{macro} % \end{macro} @@ -925,7 +922,7 @@ % but non-existent stream number. Unlike writing, there is no concept % of reading from the log. % \begin{macrocode} -\cs_new_eq:NN \c_term_ior \c_sixteen +\int_const:Nn \c_term_ior { 16 } % \end{macrocode} % \end{variable} % @@ -964,14 +961,14 @@ \prop_new:N \g_@@_streams_prop %<*package> \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 } } } { @@ -1100,7 +1097,7 @@ % \begin{macrocode} \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_@@_streams_prop #1 @@ -1147,21 +1144,23 @@ % % \begin{macro}[pTF]{\ior_if_eof:N} % To test if some particular input stream is exhausted the following -% conditional is provided. +% conditional is provided. The primitive test can only deal with +% numbers in the range $[0,15]$ so we catch outliers (they are +% exhausted). % \begin{macrocode} -\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: } } @@ -1184,7 +1183,7 @@ { \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 } } @@ -1213,11 +1212,22 @@ % % \begin{variable}{\c_log_iow, \c_term_iow} % Here we allocate two output streams for writing to the transcript -% file only (\cs{c_log_iow}) and to both the terminal and -% transcript file (\cs{c_term_iow}). +% file only (\cs{c_log_iow}) and to both the terminal and transcript +% file (\cs{c_term_iow}). Recent \LuaTeX{} provide $128$ write +% streams; we also use \cs{c_term_iow} as the first non-allowed write +% stream so its value depends on the engine. % \begin{macrocode} -\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 } + } % \end{macrocode} % \end{variable} % @@ -1226,15 +1236,12 @@ % \begin{macrocode} \seq_new:N \g_@@_streams_seq %<*initex> -\seq_set_eq:NN \g_@@_streams_seq \g__ior_streams_seq -\cs_if_exist:NT \luatex_directlua:D +\use:x { - \int_compare:nNnT \luatex_luatexversion:D > { 80 } + \exp_not:n { \seq_gset_split:Nnn \g_@@_streams_seq { } } { - \int_step_inline:nnnn { 16 } { 1 } { 127 } - { - \seq_gput_right:Nn \g_@@_streams_seq {#1} - } + \int_step_function:nnnN { 0 } { 1 } { \c_term_iow } + \prg_do_nothing: } } % @@ -1255,14 +1262,14 @@ \prop_new:N \g_@@_streams_prop %<*package> \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 } } } { @@ -1339,7 +1346,7 @@ % \begin{macrocode} \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_@@_streams_prop #1 @@ -1386,7 +1393,8 @@ % % \subsubsection{Immediate writing} % -% \begin{macro}[aux]{\@@_with:Nnn, \@@_with_aux:nNnn} +% \begin{macro}[int]{\@@_with:Nnn} +% \begin{macro}[aux]{\@@_with_aux:nNnn} % If the integer~|#1| is equal to~|#2|, just leave~|#3| in the input % stream. Otherwise, pass the old value to an auxiliary, which sets % the integer to the new value, runs the code, and restores the @@ -1406,6 +1414,7 @@ } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\iow_now:Nn, \iow_now:Nx, \iow_now:cn, \iow_now:cx} % This routine writes the second argument onto the output stream without @@ -1464,7 +1473,14 @@ % used by the messaging system, but is designed such that it is % available for other uses. % -% \begin{macro}[var, added = 2012-06-24]{\l_iow_line_count_int} +% \begin{macro}{\c_catcode_other_space_tl} +% Create a space with category code $12$: an \enquote{other} space. +% \begin{macrocode} +\tl_const:Nx \c_catcode_other_space_tl { \char_generate:nn { `\ } { 12 } } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}{\l_iow_line_count_int} % This is the \enquote{raw} number of characters in a line which % can be written to the terminal. % The standard value is the line length typically used by @@ -1473,96 +1489,102 @@ \int_new:N \l_iow_line_count_int \int_set:Nn \l_iow_line_count_int { 78 } % \end{macrocode} -% \end{macro} +% \end{variable} % -% \begin{macro}[aux]{\l_@@_target_count_int} -% This stores the target line count: the full number of characters -% in a line, minus any part for a leader at the start of each line. +% \begin{variable}{\l_@@_newline_tl} +% The token list inserted to produce a new line, with the +% \meta{run-on text}. % \begin{macrocode} -\int_new:N \l_@@_target_count_int +\tl_new:N \l_@@_newline_tl % \end{macrocode} -% \end{macro} +% \end{variable} % -% \begin{macro}[aux] -% { -% \l_@@_current_line_int, -% \l_@@_current_word_int, -% \l_@@_current_indentation_int -% } -% These store the number of characters in the line and word currently -% being constructed, and the current indentation, respectively. +% \begin{variable}{\l_@@_line_target_int} +% This stores the target line count: the full number of characters +% in a line, minus any part for a leader at the start of each line. % \begin{macrocode} -\int_new:N \l_@@_current_line_int -\int_new:N \l_@@_current_word_int -\int_new:N \l_@@_current_indentation_int +\int_new:N \l_@@_line_target_int % \end{macrocode} -% \end{macro} +% \end{variable} % -% \begin{macro}[aux] -% { -% \l_@@_current_line_tl, -% \l_@@_current_word_tl, -% \l_@@_current_indentation_tl -% } -% These hold the current line of text and current word, -% and a number of spaces for indentation, respectively. -% \begin{macrocode} -\tl_new:N \l_@@_current_line_tl -\tl_new:N \l_@@_current_word_tl -\tl_new:N \l_@@_current_indentation_tl +% \begin{macro}[aux]{\@@_set_indent:n} +% \begin{macro}[aux]{\@@_unindent:w} +% \begin{variable}{\l_@@_one_indent_tl, \l_@@_one_indent_int} +% The \texttt{one_indent} variables hold one indentation marker and +% its length. The \cs{@@_unindent:w} auxiliary removes one +% indentation. The function \cs{@@_set_indent:n} (that could possibly +% be public) sets the indentation in a consistent way. We set it to +% four spaces by default. +% \begin{macrocode} +\tl_new:N \l_@@_one_indent_tl +\int_new:N \l_@@_one_indent_int +\cs_new:Npn \@@_unindent:w { } +\cs_new_protected:Npn \@@_set_indent:n #1 + { + \tl_set:Nx \l_@@_one_indent_tl + { \exp_args:No \__str_to_other_fast:n { \tl_to_str:n {#1} } } + \int_set:Nn \l_@@_one_indent_int { \str_count:N \l_@@_one_indent_tl } + \exp_last_unbraced:NNo + \cs_set:Npn \@@_unindent:w \l_@@_one_indent_tl { } + } +\exp_args:Nx \@@_set_indent:n { \prg_replicate:nn { 4 } { ~ } } % \end{macrocode} -%\end{macro} +% \end{variable} +% \end{macro} +% \end{macro} % -% \begin{macro}[aux]{\l_@@_wrap_tl} -% Used for the expansion step before detokenizing, and for the output -% from wrapping text: fully expanded and with lines which are not -% overly long. +% \begin{variable}{\l_@@_indent_tl, \l_@@_indent_int} +% The current indentation (some copies of \cs{l_@@_one_indent_tl}) and +% its number of characters. % \begin{macrocode} -\tl_new:N \l_@@_wrap_tl +\tl_new:N \l_@@_indent_tl +\int_new:N \l_@@_indent_int % \end{macrocode} -% \end{macro} +% \end{variable} % -% \begin{macro}[aux]{\l_@@_newline_tl} -% The token list inserted to produce the new line, with the -% \meta{run-on text}. +% \begin{variable}{\l_@@_line_tl, \l_@@_line_part_tl} +% These hold the current line of text and a partial line to be added +% to it, respectively. % \begin{macrocode} -\tl_new:N \l_@@_newline_tl +\tl_new:N \l_@@_line_tl +\tl_new:N \l_@@_line_part_tl % \end{macrocode} -% \end{macro} +% \end{variable} % -% \begin{macro}[aux]{\l_@@_line_start_bool} -% Boolean to avoid adding a space at the beginning of forced newlines, -% and to know when to add the indentation. +% \begin{variable}{\l_@@_line_break_bool} +% Indicates whether the line was broken precisely at a chunk boundary. % \begin{macrocode} -\bool_new:N \l_@@_line_start_bool +\bool_new:N \l_@@_line_break_bool % \end{macrocode} -% \end{macro} +% \end{variable} % -% \begin{macro}{\c_catcode_other_space_tl} -% Create a space with category code $12$: an \enquote{other} space. +% \begin{variable}{\l_@@_wrap_tl} +% Used for the expansion step before detokenizing, and for the output +% from wrapping text: fully expanded and with lines which are not +% overly long. % \begin{macrocode} -\tl_const:Nx \c_catcode_other_space_tl { \char_generate:nn { `\ } { 12 } } +\tl_new:N \l_@@_wrap_tl % \end{macrocode} -% \end{macro} +% \end{variable} % -% \begin{macro}[aux]{\c_@@_wrap_marker_tl} -% \begin{macro}[aux] +% \begin{variable}{\c_@@_wrap_marker_tl} +% \begin{variable} % { % \c_@@_wrap_end_marker_tl, % \c_@@_wrap_newline_marker_tl, % \c_@@_wrap_indent_marker_tl, % \c_@@_wrap_unindent_marker_tl % } -% Every special action of the wrapping code is preceded by +% Every special action of the wrapping code is starts with % the same recognizable string, \cs{c_@@_wrap_marker_tl}. % Upon seeing that \enquote{word}, the wrapping code reads % one space-delimited argument to know what operation to % perform. The setting of \tn{escapechar} here is not % very important, but makes \cs{c_@@_wrap_marker_tl} look -% nicer. +% marginally nicer. % \begin{macrocode} \group_begin: - \int_set:Nn \tex_escapechar:D { - \c_one } + \int_set:Nn \tex_escapechar:D { -1 } \tl_const:Nx \c_@@_wrap_marker_tl { \tl_to_str:n { \^^I \^^O \^^W \^^_ \^^W \^^R \^^A \^^P } } \group_end: @@ -1571,26 +1593,32 @@ { \tl_const:cx { c_@@_wrap_ #1 _marker_tl } { - \c_catcode_other_space_tl \c_@@_wrap_marker_tl - \c_catcode_other_space_tl #1 \c_catcode_other_space_tl } } % \end{macrocode} -% \end{macro} -% \end{macro} +% \end{variable} +% \end{variable} % % \begin{macro}{\iow_indent:n} -% \begin{macro}[aux]{\@@_indent:n, \@@_indent_error:n} -% We give a (protected) error definition to \cs{iow_indent:n} -% when outside messages. Within wrapped message, it places -% the instruction for increasing the indentation before its -% argument, and the instruction for unindenting afterwards. -% Note that there will be no forced line-break, so the indentation -% only changes when the next line is started. -% \begin{macrocode} +% \begin{macro}[EXP,aux]{\@@_indent:n} +% \begin{macro}[EXP,aux]{\@@_indent_error:n} +% We set \cs{iow_indent:n} to produce an error when outside +% messages. Within wrapped message, it is set to \cs{@@_indent:n} when +% valid and otherwise to \cs{@@_indent_error:n}. The first places the +% instruction for increasing the indentation before its argument, and +% the instruction for unindenting afterwards. The second produces an +% error expandably. Note that there will be no forced line-break, so +% the indentation only changes when the next line is started. +% \begin{macrocode} +\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 \@@_indent:n #1 { \c_@@_wrap_indent_marker_tl @@ -1599,36 +1627,28 @@ } \cs_new:Npn \@@_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 { \@@_indent_error:n } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\iow_wrap:nnnN} % \begin{macro}[aux]{\@@_wrap_set:Nx} % The main wrapping function works as follows. First give |\\|, % \verb*|\ | and other formatting commands the correct definition for -% messages, before fully-expanding the input. In package mode, the -% expansion uses \LaTeXe{}'s \cs{protect} mechanism. Afterwards, set -% the newline marker (two assignments to fully expand, then convert -% to a string) and its length, and initialize some registers. -% There is then a loop over each word in the input, which will do the -% actual wrapping. After the loop, the resulting text is passed on to -% the function which has been given as a post-processor. -% The argument |#4| is available for additional set up steps for -% the output. The definition of |\\| and \verb*|\ | use an -% \enquote{other} space rather than a normal space, because the latter -% might be absorbed by \TeX{} to end a number or other \texttt{f}-type -% expansions. The \cs{tl_to_str:N} step converts the \enquote{other} -% space back to a normal space. +% messages and perform the given setup~|#3|. The definition of +% \verb*|\ | uses an \enquote{other} space rather than a normal space, +% because the latter might be absorbed by \TeX{} to end a number or +% other \texttt{f}-type expansions. % \begin{macrocode} \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 \} } @@ -1639,48 +1659,39 @@ \cs_set_eq:NN \ \c_catcode_other_space_tl \cs_set_eq:NN \iow_indent:n \@@_indent:n #3 -%<*initex> +% \end{macrocode} +% Then fully-expand the input: in package mode, the expansion uses +% \LaTeXe{}'s \cs{protected} mechanism. As soon as the expansion is +% done, reset \cs{iow_indent:n} to its error definition: it only works +% in the first argument of \cs{iow_wrap:nnnN}. +% \begin{macrocode} +%<*initex> \tl_set:Nx \l_@@_wrap_tl {#1} % %<*package> \@@_wrap_set:Nx \l_@@_wrap_tl {#1} % + \cs_set_eq:NN \iow_indent:n \@@_indent_error:n % \end{macrocode} -% To warn users that \cs{iow_indent:n} only works in the first argument -% of \cs{iow_wrap:nnnN} reset \cs{iow_indent:n} to its error -% definition. Then store a newline character and the run-on text as a -% string in \cs{l_@@_newline_tl}, and set some variables. The first -% line's target count is equal to the length of the whole line. The -% value \cs{l_@@_target_count_int} is altered later on by -% \cs{@@_wrap_set_target:}. +% Afterwards, set the newline marker (two assignments to fully expand, +% then convert to a string) and initialize the target count for lines +% (the first line has target count \cs{l_iow_line_count_int} instead). % \begin{macrocode} - \cs_set_eq:NN \iow_indent:n \@@_indent_error:n \tl_set:Nx \l_@@_newline_tl { \iow_newline: #2 } \tl_set:Nx \l_@@_newline_tl { \tl_to_str:N \l_@@_newline_tl } - \int_set_eq:NN \l_@@_target_count_int \l_iow_line_count_int - \tl_clear:N \l_@@_current_indentation_tl - \int_zero:N \l_@@_current_line_int - \tl_set:Nn \l_@@_current_line_tl { \use_none:n } - \bool_set_true:N \l_@@_line_start_bool -% \end{macrocode} -% After some setup above (in particular the odd setting of the current line -% to \cs{use_none:n}), a loop goes through space-delimited words in the -% message, recognizing special markers. To make sure that the first line -% behaves identically to others, start with a newline marker: the -% \cs{use_none:n} above avoids actually getting a new line in the output. -% \begin{macrocode} - \use:x - { - \exp_not:n { \tl_clear:N \l_@@_wrap_tl } - \@@_wrap_loop:w - \tl_to_str:N \c_@@_wrap_newline_marker_tl - \tl_to_str:N \l_@@_wrap_tl - \tl_to_str:N \c_@@_wrap_end_marker_tl - \c_space_tl \c_space_tl - \exp_not:N \q_stop - } - \exp_args:NNo \group_end: - #4 \l_@@_wrap_tl + \int_set:Nn \l_@@_line_target_int + { \l_iow_line_count_int - \str_count:N \l_@@_newline_tl + 1 } +% \end{macrocode} +% There is then a loop over the input, which will store the wrapped +% result in \cs{l_@@_wrap_tl}. After the loop, the resulting text is +% passed on to the function which has been given as a post-processor. +% The \cs{tl_to_str:N} step converts the \enquote{other} spaces back +% to normal spaces. The \texttt{f}-expansion removes a leading space +% from \cs{l_@@_wrap_tl}. +% \begin{macrocode} + \@@_wrap_do: + \exp_args:NNf \group_end: + #4 { \tl_to_str:N \l_@@_wrap_tl } } % \end{macrocode} % As using the generic loader will mean that \cs{protected@edef} is @@ -1694,160 +1705,342 @@ % \end{macro} % \end{macro} % -% \begin{macro}[aux]{\@@_wrap_set_target:} -% This is called at the beginning of every line (both those forced by -% |\\| and those due to line-breaking). The initial call does -% nothing except redefine \cs{@@_wrap_set_target:} itself (within the -% group in which \cs{iow_wrap:nnnN} works). The next call (at the -% beginning of the second line) disables any later call and sets the -% \cs{l_@@_target_count_int} to the correct value, namely the -% \cs{l_iow_line_count_int} shortened by the length of the run-on -% text (the shift by~$1$ is due to the presence of \cs{iow_newline:} -% in \cs{l_@@_newline_tl}). -% This is a bit of a hack to measure the string length of the run on text -% without the \pkg{l3str} module (which is still experimental). This should -% be replaced once the string module is finalised with something a little -% cleaner. -% \begin{macrocode} -\cs_new_protected:Npn \@@_wrap_set_target: +% \begin{macro}[aux]{\@@_wrap_do:, \@@_wrap_start:w} +% Escape spaces. Set up a few variables, in particular the initial +% value of \cs{l_@@_wrap_tl}: the space will stop the +% \texttt{f}-expansion of the main wrapping function and +% \cs{use_none:n} will remove a newline marker inserted by later code. +% The main loop consists of repeatedly calling the \texttt{chunk} +% auxiliary to wrap chunks delimited by (newline or indentation) +% markers. +% \begin{macrocode} +\cs_new_protected:Npn \@@_wrap_do: { - \cs_set_protected:Npn \@@_wrap_set_target: + \tl_set:Nx \l_@@_wrap_tl { - \cs_set_protected:Npn \@@_wrap_set_target: { } - \tl_replace_all:Nnn \l_@@_newline_tl { ~ } { \c_space_tl } - \int_set:Nn \l_@@_target_count_int - { \l_iow_line_count_int - \tl_count:N \l_@@_newline_tl + \c_one } + \exp_args:No \__str_to_other_fast:n \l_@@_wrap_tl + \c_@@_wrap_end_marker_tl } + \exp_after:wN \@@_wrap_start:w \l_@@_wrap_tl + } +\cs_new_protected:Npn \@@_wrap_start:w + { + \bool_set_false:N \l_@@_line_break_bool + \tl_clear:N \l_@@_line_tl + \tl_clear:N \l_@@_line_part_tl + \tl_set:Nn \l_@@_wrap_tl { ~ \use_none:n } + \int_zero:N \l_@@_indent_int + \tl_clear:N \l_@@_indent_tl + \@@_wrap_chunk:nw { \l_iow_line_count_int } } % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_wrap_loop:w} -% The loop grabs one word in the input, and checks whether it is -% the special marker, or a normal word. +% \begin{macro}[aux]{\@@_wrap_chunk:nw, \@@_wrap_next:nw} +% The \texttt{chunk} and \texttt{next} auxiliaries are defined +% indirectly to obtain the expansions of \cs{c_catcode_other_space_tl} +% and \cs{c_@@_wrap_marker_tl} in their definition. The \texttt{next} +% auxiliary calls a function corresponding to the type of marker (its +% |##2|), which can be \texttt{newline} or \texttt{indent} or +% \texttt{unindent} or \texttt{end}. The first argument of the +% \texttt{chunk} auxiliary is a target number of characters and the +% second is some string to wrap. If the chunk is empty simply call +% \texttt{next}. Otherwise, set up a call to \cs{@@_wrap_line:nw}, +% including the indentation if the current line is empty, and +% including a trailing space (|#1|) before the +% \cs{@@_wrap_end_chunk:w} auxiliary. % \begin{macrocode} -\cs_new_protected:Npn \@@_wrap_loop:w #1 ~ % +\cs_set_protected:Npn \@@_tmp:w #1#2 { - \tl_set:Nn \l_@@_current_word_tl {#1} - \tl_if_eq:NNTF \l_@@_current_word_tl \c_@@_wrap_marker_tl - { \@@_wrap_special:w } - { \@@_wrap_word: } + \cs_new_protected:Npn \@@_wrap_chunk:nw ##1##2 #2 + { + \tl_if_empty:nTF {##2} + { + \tl_clear:N \l_@@_line_part_tl + \@@_wrap_next:nw {##1} + } + { + \tl_if_empty:NTF \l_@@_line_tl + { + \@@_wrap_line:nw + { \l_@@_indent_tl } + ##1 - \l_@@_indent_int ; + } + { \@@_wrap_line:nw { } ##1 ; } + ##2 #1 + \@@_wrap_end_chunk:w 7 6 5 4 3 2 1 0 \q_stop + } + } + \cs_new_protected:Npn \@@_wrap_next:nw ##1##2 #1 + { \use:c { @@_wrap_##2:n } {##1} } } +\exp_args:NVV \@@_tmp:w \c_catcode_other_space_tl \c_@@_wrap_marker_tl % \end{macrocode} % \end{macro} % -% \begin{macro}[aux]{\@@_wrap_word:} -% \begin{macro}[aux]{\@@_wrap_word_fits:} -% \begin{macro}[aux]{\@@_wrap_word_newline:} -% For a normal word, update the line count, then test if the current -% word would fit in the current line, and call the appropriate function. -% If the word fits in the current line, add it to the line, preceded by -% a space unless it is the first word of the line. -% Otherwise, the current line is added to the result, with the run-on text. -% The current word (and its character count) are then put in the new line. -% \begin{macrocode} -\cs_new_protected:Npn \@@_wrap_word: +% \begin{macro}[aux]{\@@_wrap_line:nw} +% \begin{macro}[EXP,aux] +% { +% \@@_wrap_line_loop:w, +% \@@_wrap_line_aux:Nw, +% \@@_wrap_line_end:NnnnnnnnN, +% \@@_wrap_line_end:nw, +% \@@_wrap_end_chunk:w +% } +% This is followed by \Arg{string} \meta{intexpr} |;|. It stores the +% \meta{string} and up to \meta{intexpr} characters from the current +% chunk into \cs{l_@@_line_part_tl}. Characters are grabbed 8~at a +% time and left in \cs{l_@@_line_part_tl} by the \texttt{line_loop} +% auxiliary. When $k<8$ remain to be found, the \texttt{line_aux} +% auxiliary calls the \texttt{line_end} auxiliary followed by (the +% single digit) $k$, then $7-k$ empty brace groups, then the chunk's +% remaining characters. The \texttt{line_end} auxiliary leaves +% $k$~characters from the chunk in the line part, then ends the +% assignment. Ignore the \cs{use_none:nnnnn} line for now. If the +% next character is a space the line can be broken there: +% store what we found into the result and get the next line. +% Otherwise some work is needed to find a break-point. So far we have +% ignored what happens if the chunk is shorter than the requested +% number of characters: this is dealt with by the \texttt{end_chunk} +% auxiliary, which gets treated like a character by the rest of the +% code. It ends up being called either as one of the arguments +% |#2|--|#9| of the \texttt{line_loop} auxiliary or as one of the +% arguments |#2|--|#8| of the \texttt{line_end} auxiliary. In both +% cases stop the assignment and work out how many characters are still +% needed. The weird \cs{use_none:nnnnn} ensures that the required +% data is in the right place. +% \begin{macrocode} +\cs_new_protected:Npn \@@_wrap_line:nw #1 + { + \tex_edef:D \l_@@_line_part_tl { \if_false: } \fi: + #1 + \exp_after:wN \@@_wrap_line_loop:w + \__int_value:w \__int_eval:w + } +\cs_new:Npn \@@_wrap_line_loop:w #1 ; #2#3#4#5#6#7#8#9 + { + \if_int_compare:w #1 < 8 \exp_stop_f: + \@@_wrap_line_aux:Nw #1 + \fi: + #2 #3 #4 #5 #6 #7 #8 #9 + \exp_after:wN \@@_wrap_line_loop:w + \__int_value:w \__int_eval:w #1 - 8 ; + } +\cs_new:Npn \@@_wrap_line_aux:Nw #1#2#3 \exp_after:wN #4 ; + { + #2 + \exp_after:wN \@@_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 \@@_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 + { \@@_wrap_line_end:nw { } } + { \if_false: { \fi: } \@@_wrap_break:w #9 } + } +\cs_new:Npn \@@_wrap_line_end:nw #1 + { + \if_false: { \fi: } + \@@_wrap_store_do:n {#1} + \@@_wrap_next_line:w + } +\cs_new:Npn \@@_wrap_end_chunk:w + #1 \__int_eval:w #2 - #3 ; #4#5 \q_stop { - \int_set:Nn \l_@@_current_word_int - { \exp_args:No \str_count_ignore_spaces:n \l_@@_current_word_tl } - \int_add:Nn \l_@@_current_line_int { \l_@@_current_word_int } - \int_compare:nNnTF \l_@@_current_line_int < \l_@@_target_count_int - { \@@_wrap_word_fits: } - { \@@_wrap_word_newline: } - \@@_wrap_loop:w + \if_false: { \fi: } + \exp_args:Nf \@@_wrap_next:nw { \int_eval:n { #2 - #4 } } } -\cs_new_protected:Npn \@@_wrap_word_fits: +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP,aux]{\@@_wrap_break:w} +% \begin{macro}[EXP,aux] +% { +% \@@_wrap_break_first:w, +% \@@_wrap_break_none:w, +% \@@_wrap_break_loop:w, +% \@@_wrap_break_end:w, +% } +% Functions here are defined indirectly: \cs{@@_tmp:w} is eventually +% called with an \enquote{other} space as its argument. The goal is +% to remove from \cs{l_@@_line_part_tl} the part after the last space. +% In most cases this is done by repeatedly calling the +% \texttt{break_loop} auxiliary, which leaves \enquote{words} +% (delimited by spaces) until it hits the trailing space: then its +% argument |##3| is |?| \cs{@@_wrap_break_end:w} instead of a single +% token, and that \texttt{break_end} auxiliary leaves in the +% assignment the line until the last space, then calls +% \cs{@@_wrap_line_end:nw} to finish up the line and move on to the +% next. If there is no space in \cs{l_@@_line_part_tl} then the +% \texttt{break_first} auxiliary calls the \texttt{break_none} +% auxiliary. In that case, if the current line is empty, the complete +% word (including |##4|, characters beyond what we had grabbed) is +% added to the line, making it over-long. Otherwise, the word will be +% used for the following line (and the last space of the line so far +% is removed because it was inserted due to the presence of a marker). +% \begin{macrocode} +\cs_set_protected:Npn \@@_tmp:w #1 { - \bool_if:NTF \l_@@_line_start_bool + \cs_new:Npn \@@_wrap_break:w { - \bool_set_false:N \l_@@_line_start_bool - \tl_put_right:Nx \l_@@_current_line_tl - { \l_@@_current_indentation_tl \l_@@_current_word_tl } - \int_add:Nn \l_@@_current_line_int - { \l_@@_current_indentation_int } + \tex_edef:D \l_@@_line_part_tl + { \if_false: } \fi: + \exp_after:wN \@@_wrap_break_first:w + \l_@@_line_part_tl + #1 + { ? \@@_wrap_break_end:w } + \q_mark } + \cs_new:Npn \@@_wrap_break_first:w ##1 #1 ##2 { - \tl_put_right:Nx \l_@@_current_line_tl - { ~ \l_@@_current_word_tl } - \int_incr:N \l_@@_current_line_int + \use_none:nn ##2 \@@_wrap_break_none:w + \@@_wrap_break_loop:w ##1 #1 ##2 } - } -\cs_new_protected:Npn \@@_wrap_word_newline: - { - \@@_wrap_set_target: - \tl_put_right:Nx \l_@@_wrap_tl - { \l_@@_current_line_tl \l_@@_newline_tl } - \int_set:Nn \l_@@_current_line_int + \cs_new:Npn \@@_wrap_break_none:w ##1##2 #1 ##3 \q_mark ##4 #1 { - \l_@@_current_word_int - + \l_@@_current_indentation_int + \tl_if_empty:NTF \l_@@_line_tl + { ##2 ##4 \@@_wrap_line_end:nw { } } + { \@@_wrap_line_end:nw { \@@_wrap_trim:N } ##2 ##4 #1 } } - \tl_set:Nx \l_@@_current_line_tl - { \l_@@_current_indentation_tl \l_@@_current_word_tl } + \cs_new:Npn \@@_wrap_break_loop:w ##1 #1 ##2 #1 ##3 + { + \use_none:n ##3 + ##1 #1 + \@@_wrap_break_loop:w ##2 #1 ##3 + } + \cs_new:Npn \@@_wrap_break_end:w ##1 #1 ##2 ##3 #1 ##4 \q_mark + { ##1 \@@_wrap_line_end:nw { } ##3 } } +\exp_args:NV \@@_tmp:w \c_catcode_other_space_tl % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % -% \begin{macro}[aux]{\@@_wrap_special:w} -% \begin{macro}[aux]{\@@_wrap_newline:w} -% \begin{macro}[aux]{\@@_wrap_indent:w} -% \begin{macro}[aux]{\@@_wrap_unindent:w} -% \begin{macro}[aux]{\@@_wrap_end:w} -% When the \enquote{special} marker is encountered, -% read what operation to perform, as a space-delimited -% argument, perform it, and remember to loop. -% In fact, to avoid spurious spaces when two special -% actions follow each other, we look ahead for another -% copy of the marker. -% Forced newlines are almost identical to those caused by overflow, -% except that here the word is empty. -% To indent more, add four spaces to the start of the indentation -% token list. To reduce indentation, rebuild the indentation token -% list using \cs{prg_replicate:nn}. -% At the end, we simply save the last line (without the run-on text), -% and prevent the loop. -% \begin{macrocode} -\cs_new_protected:Npn \@@_wrap_special:w #1 ~ #2 ~ #3 ~ % +% \begin{macro}[aux]{\@@_wrap_next_line:w} +% The special case where the end of a line coincides with the end of a +% chunk is detected here, to avoid a spurious empty line. Otherwise, +% call \cs{@@_wrap_line:nw} to find characters for the next line +% (remembering to account for the indentation). +% \begin{macrocode} +\cs_new_protected:Npn \@@_wrap_next_line:w #1#2 \q_stop { - \use:c { @@_wrap_#1: } - \str_if_eq_x:nnTF { #2~#3 } { ~ \c_@@_wrap_marker_tl } - { \@@_wrap_special:w } - { \@@_wrap_loop:w #2 ~ #3 ~ } + \tl_clear:N \l_@@_line_tl + \token_if_eq_meaning:NNTF #1 \@@_wrap_end_chunk:w + { + \tl_clear:N \l_@@_line_part_tl + \bool_set_true:N \l_@@_line_break_bool + \@@_wrap_next:nw { \l_@@_line_target_int } + } + { + \@@_wrap_line:nw + { \l_@@_indent_tl } + \l_@@_line_target_int - \l_@@_indent_int ; + #1 #2 \q_stop + } } -\cs_new_protected:Npn \@@_wrap_newline: +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux]{\@@_wrap_indent:, \@@_wrap_unindent:} +% These functions are called after a chunk has been wrapped, when +% encountering \texttt{indent}/\texttt{unindent} markers. Add the +% line part (last line part of the previous chunk) to the line so far +% and reset a boolean denoting the presence of a line-break. Most +% importantly, add or remove one indent from the current indent (both +% the integer and the token list). Finally, continue wrapping. +% \begin{macrocode} +\cs_new_protected:Npn \@@_wrap_indent:n #1 { - \@@_wrap_set_target: - \tl_put_right:Nx \l_@@_wrap_tl - { \l_@@_current_line_tl \l_@@_newline_tl } - \int_zero:N \l_@@_current_line_int - \tl_clear:N \l_@@_current_line_tl - \bool_set_true:N \l_@@_line_start_bool + \tl_put_right:Nx \l_@@_line_tl { \l_@@_line_part_tl } + \bool_set_false:N \l_@@_line_break_bool + \int_add:Nn \l_@@_indent_int { \l_@@_one_indent_int } + \tl_put_right:No \l_@@_indent_tl { \l_@@_one_indent_tl } + \@@_wrap_chunk:nw {#1} } -\cs_new_protected:Npx \@@_wrap_indent: +\cs_new_protected:Npn \@@_wrap_unindent:n #1 { - \int_add:Nn \l_@@_current_indentation_int \c_four - \tl_put_right:Nx \exp_not:N \l_@@_current_indentation_tl - { \c_space_tl \c_space_tl \c_space_tl \c_space_tl } + \tl_put_right:Nx \l_@@_line_tl { \l_@@_line_part_tl } + \bool_set_false:N \l_@@_line_break_bool + \int_sub:Nn \l_@@_indent_int { \l_@@_one_indent_int } + \tl_set:Nx \l_@@_indent_tl + { \exp_after:wN \@@_unindent:w \l_@@_indent_tl } + \@@_wrap_chunk:nw {#1} } -\cs_new_protected:Npn \@@_wrap_unindent: +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[aux]{\@@_wrap_newline:, \@@_wrap_end:} +% These functions are called after a chunk has been line-wrapped, when +% encountering a \texttt{newline}/\texttt{end} marker. Unless we just +% took a line-break, store the line part and the line so far into the +% whole \cs{l_@@_wrap_tl}, trimming a trailing space. In the +% \texttt{newline} case look for a new line (of length +% \cs{l_@@_line_target_int}) in a new chunk. +% \begin{macrocode} +\cs_new_protected:Npn \@@_wrap_newline:n #1 { - \int_sub:Nn \l_@@_current_indentation_int \c_four - \tl_set:Nx \l_@@_current_indentation_tl - { \prg_replicate:nn \l_@@_current_indentation_int { ~ } } + \bool_if:NF \l_@@_line_break_bool + { \@@_wrap_store_do:n { \@@_wrap_trim:N } } + \bool_set_false:N \l_@@_line_break_bool + \@@_wrap_chunk:nw { \l_@@_line_target_int } } -\cs_new_protected:Npn \@@_wrap_end: +\cs_new_protected:Npn \@@_wrap_end:n #1 { - \tl_put_right:Nx \l_@@_wrap_tl - { \l_@@_current_line_tl } - \use_none_delimit_by_q_stop:w + \bool_if:NF \l_@@_line_break_bool + { \@@_wrap_store_do:n { \@@_wrap_trim:N } } + \bool_set_false:N \l_@@_line_break_bool } % \end{macrocode} % \end{macro} +% +% \begin{macro}[aux]{\@@_wrap_store_do:n} +% First add the last line part to the line, then append it to +% \cs{l_@@_wrap_tl} with the appropriate new line (with +% \enquote{run-on} text), possibly with its last space removed (|#1| +% is empty or \cs{@@_wrap_trim:N}). +% \begin{macrocode} +\cs_new_protected:Npn \@@_wrap_store_do:n #1 + { + \tl_set:Nx \l_@@_line_tl + { \l_@@_line_tl \l_@@_line_part_tl } + \tl_set:Nx \l_@@_wrap_tl + { + \l_@@_wrap_tl + \l_@@_newline_tl + #1 \l_@@_line_tl + } + \tl_clear:N \l_@@_line_tl + } +% \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} +% +% \begin{macro}[EXP, aux]{\@@_wrap_trim:N, \@@_wrap_trim:w} +% Remove one trailing \enquote{other} space from the argument. +% \begin{macrocode} +\cs_set_protected:Npn \@@_tmp:w #1 + { + \cs_new:Npn \@@_wrap_trim:N ##1 + { \tl_if_empty:NF ##1 { \exp_after:wN \@@_wrap_trim:w ##1 \q_stop } } + \cs_new:Npn \@@_wrap_trim:w ##1 #1 \q_stop {##1} + } +\exp_args:NV \@@_tmp:w \c_catcode_other_space_tl +% \end{macrocode} % \end{macro} % % \subsection{Messages} @@ -1878,8 +2071,13 @@ { 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 } +\__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'. + } % \end{macrocode} % % \subsection{Deprecated functions} @@ -1887,7 +2085,15 @@ % \begin{macro}[added = 2012-06-24, updated = 2012-07-31, deprecated=2017-12-31]{\ior_get_str:NN} % For removal after 2017-12-31. % \begin{macrocode} -\cs_new_eq:NN \ior_get_str:NN \ior_str_get:NN +\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 + } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx new file mode 100644 index 00000000000..5afe7e646a7 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3kernel/l3flag.dtx @@ -0,0 +1,351 @@ +% \iffalse meta-comment +% +%% File: l3flag.dtx Copyright (C) 2011-2012,2014-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 "l3kernel bundle" (The Work in LPPL) +% and all files in that bundle must be distributed together. +% +% ----------------------------------------------------------------------- +% +% The development version of the bundle can be found at +% +% https://github.com/latex3/latex3 +% +% for those people who are interested. +% +%<*driver> +\documentclass[full]{l3doc} +% +%<*driver|package> +\GetIdInfo$Id: l3flag.dtx 6969 2017-02-20 18:32:23Z bruno $ + {L3 Flags} +% +%<*driver> +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +% +% \fi +% +% \title{^^A +% The \textsf{l3flag} package: expandable flags^^A +% \thanks{This file describes v\ExplFileVersion, +% last revised \ExplFileDate.}^^A +% } +% +% \author{^^A +% The \LaTeX3 Project\thanks +% {^^A +% E-mail: +% \href{mailto:latex-team@latex-project.org} +% {latex-team@latex-project.org}^^A +% }^^A +% } +% +% \date{Released \ExplFileDate} +% +% \maketitle +% +% \begin{documentation} +% +% Flags are the only data-type that can be modified in expansion-only +% contexts. This module is meant mostly for kernel use: in almost all +% cases, booleans or integers should be preferred to flags because they +% are very significantly faster. +% +% A flag can hold any non-negative value, which we call its +% \meta{height}. In expansion-only contexts, a flag can only be +% \enquote{raised}: this increases the \meta{height} by $1$. The \meta{height} +% can also be queried expandably. However, decreasing it, or setting it +% to zero requires non-expandable assignments. +% +% Flag variables are always local. They are referenced by a \meta{flag +% name} such as \texttt{str_missing}. The \meta{flag name} is used as +% part of \cs{use:c} constructions hence is expanded at point of use. +% It must expand to character tokens only, with no spaces. +% +% A typical use case of flags would be to keep track of whether an +% exceptional condition has occured during expandable processing, and +% produce a meaningful (non-expandable) message after the end of the +% expandable processing. This is exemplified by \pkg{l3str-convert}, +% which for performance reasons performs conversions of individual +% characters expandably and for readability reasons produces a single +% error message describing incorrect inputs that were encountered. +% +% Flags should not be used without carefully considering the fact that +% raising a flag takes a time and memory proportional to its height. +% Flags should not be used unless unavoidable. +% +% \section{Setting up flags} +% +% \begin{function}{\flag_new:n} +% \begin{syntax} +% \cs{flag_new:n} \Arg{flag name} +% \end{syntax} +% Creates a new flag with a name given by \meta{flag name}, or raises +% an error if the name is already taken. The \meta{flag name} may not +% contain spaces. The declaration is global, but flags are always +% local variables. The \meta{flag} will initially have zero height. +% \end{function} +% +% \begin{function}{\flag_clear:n} +% \begin{syntax} +% \cs{flag_clear:n} \Arg{flag name} +% \end{syntax} +% The \meta{flag}'s height is set to zero. The assignment is local. +% \end{function} +% +% \begin{function}{\flag_clear_new:n} +% \begin{syntax} +% \cs{flag_clear_new:n} \Arg{flag name} +% \end{syntax} +% Ensures that the \meta{flag} exists globally by applying +% \cs{flag_new:n} if necessary, then applies \cs{flag_clear:n}, setting +% the height to zero locally. +% \end{function} +% +% \begin{function}{\flag_show:n} +% \begin{syntax} +% \cs{flag_show:n} \Arg{flag name} +% \end{syntax} +% Displays the \meta{flag}'s height in the terminal. +% \end{function} +% +% \begin{function}{\flag_log:n} +% \begin{syntax} +% \cs{flag_log:n} \Arg{flag name} +% \end{syntax} +% Writes the \meta{flag}'s height to the log file. +% \end{function} +% +% \section{Expandable flag commands} +% +% \begin{function}[EXP,pTF]{\flag_if_exist:n} +% \begin{syntax} +% \cs{flag_if_exist:n} \Arg{flag name} +% \end{syntax} +% This function returns \texttt{true} if the \meta{flag name} +% references a flag that has been defined previously, and +% \texttt{false} otherwise. +% \end{function} +% +% \begin{function}[EXP,pTF]{\flag_if_raised:n} +% \begin{syntax} +% \cs{flag_if_raised:n} \Arg{flag name} +% \end{syntax} +% This function returns \texttt{true} if the \meta{flag} has non-zero +% height, and \texttt{false} if the \meta{flag} has zero height. +% \end{function} +% +% \begin{function}[EXP]{\flag_height:n} +% \begin{syntax} +% \cs{flag_height:n} \Arg{flag name} +% \end{syntax} +% Expands to the height of the \meta{flag} as an integer denotation. +% \end{function} +% +% \begin{function}[EXP]{\flag_raise:n} +% \begin{syntax} +% \cs{flag_raise:n} \Arg{flag name} +% \end{syntax} +% The \meta{flag}'s height is increased by $1$ locally. +% \end{function} +% +% \end{documentation} +% +% \begin{implementation} +% +% \section{\pkg{l3flag} implementation} +% +% \begin{macrocode} +%<*initex|package> +% \end{macrocode} +% +% \begin{macrocode} +%<@@=flag> +% \end{macrocode} +% +% \TestFiles{m3flag001} +% +% \subsection{Non-expandable flag commands} +% +% The height $h$ of a flag (initially zero) is stored by setting control +% sequences of the form \cs[no-index]{flag \meta{name} \meta{integer}} +% to \tn{relax} for $0\leq\meta{integer} ~ flag ~ #1 ~ height = \flag_height:n {#1} } + } +\cs_new_protected:Npn \flag_log:n + { \__msg_log_next: \flag_show:n } +% \end{macrocode} +% \end{macro} +% +% \subsection{Expandable flag commands} +% +% \begin{macro}[EXP, pTF]{\flag_if_exist:n} +% A flag exist if the corresponding trap \cs[no-index]{flag \meta{flag +% name}:n} is defined. +% \begin{macrocode} +\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: } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[EXP, pTF]{\flag_if_raised:n} +% Test if the flag has a non-zero height, by checking the |0| control sequence. +% \begin{macrocode} +\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: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[EXP]{\flag_height:n} +% \begin{macro}[EXP, aux]{\@@_height_loop:wn, \@@_height_end:wn} +% Extract the value of the flag by going through all of the +% control sequences starting from |0|. +% \begin{macrocode} +\cs_new:Npn \flag_height:n { \@@_height_loop:wn 0; } +\cs_new:Npn \@@_height_loop:wn #1 ; #2 + { + \if_cs_exist:w flag~#2~#1 \cs_end: + \exp_after:wN \@@_height_loop:wn \__int_value:w \__int_eval:w 1 + + \else: + \exp_after:wN \@@_height_end:wn + \fi: + #1 ; {#2} + } +\cs_new:Npn \@@_height_end:wn #1 ; #2 {#1} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[EXP]{\flag_raise:n} +% Simply apply the trap to the height, after expanding the latter. +% \begin{macrocode} +\cs_new:Npn \flag_raise:n #1 + { + \cs:w flag~#1 \exp_after:wN \cs_end: + \__int_value:w \flag_height:n {#1} ; + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Option check-declarations} +% +% \begin{macro}[EXP,aux]{\@@_chk_exist:n} +% In package mode, there is an option to check all variables used are +% defined. Since flags are not implemented in terms of other +% variables, we need to add checks by hand. Not all functions need to +% be patched because some are defined in terms of others. +% \begin{macrocode} +%<*package> +\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 } + \@@_clear:wn 0 ; {#1} + } + \cs_set:Npn \@@_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 + { + \@@_chk_exist:n {#1} + \@@_height_loop:wn 0; {#1} + } + \prg_set_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF } + { + \@@_chk_exist:n {#1} + \if_cs_exist:w flag~#1~0 \cs_end: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\fi: +% +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \end{implementation} +% +% \PrintIndex diff --git a/Master/texmf-dist/source/latex/l3kernel/l3format.ins b/Master/texmf-dist/source/latex/l3kernel/l3format.ins index d49a7794f86..14d71ea4463 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3format.ins +++ b/Master/texmf-dist/source/latex/l3kernel/l3format.ins @@ -61,12 +61,13 @@ and all files in that bundle must be distributed together. \from{l3basics.dtx} {initex} \from{l3expan.dtx} {initex} \from{l3tl.dtx} {initex} - \from{l3seq.dtx} {initex} \from{l3str.dtx} {initex} + \from{l3seq.dtx} {initex} % ======== FORMAT ONLY ========= \from{l3alloc.dtx} {initex} % ============================== \from{l3int.dtx} {initex} + \from{l3flag.dtx} {initex} \from{l3quark.dtx} {initex} \from{l3prg.dtx} {initex} \from{l3clist.dtx} {initex} @@ -94,6 +95,7 @@ and all files in that bundle must be distributed together. \from{l3coffins.dtx} {initex} \from{l3color.dtx} {initex} \from{l3sys.dtx} {initex} + \from{l3deprecation.dtx}{initex} \from{l3candidates.dtx} {initex} \from{l3luatex.dtx} {initex,tex} % ======== FORMAT ONLY ========= @@ -125,6 +127,6 @@ Do not distribute a modified version of this file. \endpreamble \nopostamble \generate{\file{expl3.lua} {\from{l3luatex.dtx}{lua,package}}} -\generate{\file{l3format.lua}{\from{l3luatex.dtx}{fontloader}}} +\generate{\file{l3format.lua}{\from{l3luatex.dtx}{lua,initex}}} \endbatchfile diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx index d696a2ba2e5..71433549d51 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-assign.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3fp-assign.dtx Copyright (C) 2011-2016 The LaTeX3 project +%% File: l3fp-assign.dtx Copyright (C) 2011-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 @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-assign.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp-assign.dtx 6906 2017-02-12 20:07:58Z bruno $ {L3 Floating-point assignments} \begin{document} \DocInput{\jobname.dtx} @@ -181,6 +181,17 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\fp_log:N, \fp_log:c, \fp_log:n} +% Redirect output of \cs{fp_show:N} and \cs{fp_show:n} to the log. +% \begin{macrocode} +\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 } +% \end{macrocode} +% \end{macro} +% % \subsection{Some useful constants and scratch variables} % % \begin{variable}{\c_one_fp, \c_e_fp} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx index 382bfb3ecc3..de3bae56fd4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-aux.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% 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 % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-aux.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp-aux.dtx 6968 2017-02-20 16:08:44Z bruno $ {L3 Floating-point support functions} \documentclass[full]{l3doc} \begin{document} @@ -301,6 +301,22 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\c_@@_prec_int, \c_@@_half_prec_int, \c_@@_block_int} +% The number of digits of floating points. +% \begin{macrocode} +\int_const:Nn \c_@@_prec_int { 16 } +\int_const:Nn \c_@@_half_prec_int { 8 } +\int_const:Nn \c_@@_block_int { 4 } +% \end{macrocode} +% \end{variable} +% +% \begin{variable}{\c_@@_myriad_int} +% Blocks have $4$~digits so this integer is useful. +% \begin{macrocode} +\int_const:Nn \c_@@_myriad_int { 10000 } +% \end{macrocode} +% \end{variable} +% % \begin{variable}[int]{\c_@@_max_exponent_int} % Normal floating point numbers have an exponent at most % \texttt{max_exponent} in absolute value. Larger numbers are rounded @@ -319,6 +335,14 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\c_@@_max_exp_exponent_int} +% If a number's exponent is larger than that, its exponential +% overflows/underflows. +% \begin{macrocode} +\int_const:Nn \c_@@_max_exp_exponent_int { 5 } +% \end{macrocode} +% \end{variable} +% % \begin{macro}[int, EXP]{\@@_zero_fp:N, \@@_inf_fp:N} % In case of overflow or underflow, we have to output % a zero or infinity with a given sign. @@ -372,7 +396,7 @@ % turned to $2$ (negative), $1$ (\texttt{nan}) to $1$, and $2$ to $0$. % \begin{macrocode} \cs_new:Npn \@@_neg_sign:N #1 - { \__int_eval:w \c_two - #1 \__int_eval_end: } + { \__int_eval:w 2 - #1 \__int_eval_end: } % \end{macrocode} % \end{macro} % @@ -391,9 +415,9 @@ \cs_new:Npn \@@_sanitize:Nw #1 #2; { \if_case:w - \if_int_compare:w #2 > \c_@@_max_exponent_int \c_one \else: - \if_int_compare:w #2 < - \c_@@_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_@@_max_exponent_int 1 ~ \else: + \if_int_compare:w #2 < - \c_@@_max_exponent_int 2 ~ \else: + \if_meaning:w 1 #1 3 ~ \else: 0 ~ \fi: \fi: \fi: \or: \exp_after:wN \@@_overflow:w \or: \exp_after:wN \@@_underflow:w \or: \exp_after:wN \@@_sanitize_zero:w @@ -717,7 +741,7 @@ { \cs:w @@_decimate_ - \if_int_compare:w \__int_eval:w #1 > \c_sixteen + \if_int_compare:w \__int_eval:w #1 > \c_@@_prec_int tiny \else: \__int_to_roman:w \__int_eval:w #1 @@ -760,7 +784,8 @@ % The arguments are as follows: |#1| indicates which function is % being defined; after one step of expansion, |#2| yields the % \enquote{extra digits} which are then converted by -% \cs{@@_round_digit:Nw} to the \meta{rounding} digit. +% \cs{@@_round_digit:Nw} to the \meta{rounding} digit (note the |+| +% separating blocks of digits to avoid overflowing \TeX{}'s integers). % This triggers the \texttt{f}-expansion of % \cs{@@_decimate_pack:nnnnnnnnnnw},\footnote{No, the argument % spec is not a mistake: the function calls an auxiliary to @@ -799,21 +824,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[EXP, aux] -% {\@@_round_digit:Nw, \@@_decimate_pack:nnnnnnnnnnw} -% % ^^A \cs{@@_round_digit:Nw} moved to \pkg{l3fp-round}. -% \cs{@@_round_digit:Nw} will receive the \enquote{extra digits} -% as its argument, and its expansion is triggered by \cs{__int_value:w}. -% If the first digit is neither $0$ nor $5$, then it is the \meta{rounding} -% digit. Otherwise, if the remaining digits are not all zero, we need -% to add $1$ to that leading digit to get the rounding digit. Some caution -% is required, though, because there may be more than $10$ -% \enquote{extra digits}, and this may overflow \TeX{}'s integers. -% Instead of feeding the digits directly to \cs{@@_round_digit:Nw}, -% they come split into several blocks, separated by $+$. Hence the first -% \cs{__int_eval:w} here. -% \begin{macrocode} -% \end{macrocode} +% \begin{macro}[EXP, aux]{\@@_decimate_pack:nnnnnnnnnnw} % The computation of the \meta{rounding} digit leaves an unfinished % \cs{__int_value:w}, which expands the following functions. This % allows us to repack nicely the digits we keep. Those digits come @@ -942,8 +953,8 @@ } \cs_new:Npn \@@_int_normal:nnnnn #1 #2#3#4#5 { - \if_int_compare:w #1 > \c_zero - \@@_decimate:nNnnnn { \c_sixteen - #1 } + \if_int_compare:w #1 > 0 \exp_stop_f: + \@@_decimate:nNnnnn { \c_@@_prec_int - #1 } \@@_int_test:Nw {#2} {#3} {#4} {#5} \else: @@ -1007,8 +1018,8 @@ \cs_new:Npn \@@_small_int_true:wTF #1; #2#3 { #2 {#1} } \cs_new:Npn \@@_small_int_normal:NnwTF #1#2#3; { - \if_int_compare:w #2 > \c_zero - \@@_decimate:nNnnnn { \c_sixteen - #2 } + \if_int_compare:w #2 > 0 \exp_stop_f: + \@@_decimate:nNnnnn { \c_@@_prec_int - #2 } \@@_small_int_test:NnnwNnw #3 #1 {#2} \else: @@ -1021,7 +1032,7 @@ \if_meaning:w 0 #1 \exp_after:wN \@@_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_@@_half_prec_int 1 0000 0000 \else: #3 @@ -1045,13 +1056,13 @@ % \begin{macrocode} \cs_new:Npn \@@_array_count:n #1 { - \__int_value:w \__int_eval:w \c_zero + \__int_value:w \__int_eval:w 0 \@@_array_count_loop:Nw #1 { ? \__prg_break: } ; \__prg_break_point: \__int_eval_end: } \cs_new:Npn \@@_array_count_loop:Nw #1#2; - { \use_none:n #1 + \c_one \@@_array_count_loop:Nw } + { \use_none:n #1 + 1 \@@_array_count_loop:Nw } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx index 8bdb1f07152..6b4ed3846d3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-basics.dtx @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-basics.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp-basics.dtx 6943 2017-02-17 16:47:59Z bruno $ {L3 Floating-point arithmetic} \begin{document} \DocInput{\jobname.dtx} @@ -92,7 +92,7 @@ % |{0000}|. % \begin{macrocode} \cs_new:Npn \@@_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 \@@_basics_pack_high:NNNNNw #1 #2#3#4#5 #6; { \if_meaning:w 2 #1 @@ -101,7 +101,7 @@ ; {#2#3#4#5} {#6} } \cs_new:Npn \@@_basics_pack_high_carry:w \fi: ; #1 - { \fi: + \c_one ; {1000} } + { \fi: + 1 ; {1000} } % \end{macrocode} % \end{macro} % @@ -116,7 +116,7 @@ \cs_new:Npn \@@_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} ; @@ -196,14 +196,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 \@@_add_zeros_o:Nww \__int_value:w \or: \exp_after:wN \@@_add_normal_o:Nww \__int_value:w \or: \exp_after:wN \@@_add_inf_o:Nww \__int_value:w @@ -393,7 +394,7 @@ \cs_new:Npn \@@_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 ; } @@ -444,7 +445,7 @@ \cs_new:Npn \@@_add_significand_carry_o:wwwNN #1; #2; #3#4; #5#6 { - + \c_one + + 1 \exp_after:wN \@@_basics_pack_weird_high:NNNNNNNNw \__int_value:w \__int_eval:w 1 1 #1 \exp_after:wN \@@_basics_pack_weird_low:NNNNw @@ -489,7 +490,7 @@ \cs_new:Npn \@@_sub_npos_ii_o:Nnwnw #1 #2; #3; { \exp_after:wN \@@_sub_npos_i_o:Nnwnw - \__int_value:w \__int_eval:w \c_two - #1 \__int_eval_end: + \__int_value:w \@@_neg_sign:N #1 #3; #2; } % \end{macrocode} @@ -517,7 +518,7 @@ \exp_after:wN \@@_sub_back_near_o:nnnnnnnnN \else: \exp_after:wN \@@_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 \@@_sub_back_far_o:NnnwnnnnN \fi: #5 @@ -546,7 +547,7 @@ \cs_new:Npn \@@_sub_back_near_o:nnnnnnnnN #1#2#3#4 #5#6#7#8 #9 { \exp_after:wN \@@_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 \@@_sub_back_near_pack:NNNNNNw \__int_value:w \__int_eval:w 11#7#8 - #3#4 \exp_after:wN ; } @@ -594,7 +595,7 @@ \cs_new:Npn \@@_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 \@@_sub_back_shift_iii:NNNNNNNNw \__int_value:w #2#3 0 ~ 123456789; @@ -637,13 +638,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 \@@_sub_back_quite_far_o:wwNN \or: \exp_after:wN \@@_sub_back_very_far_o:wwwwNN \else: \exp_after:wN \@@_sub_back_not_far_o:wwwwNN @@ -678,7 +680,7 @@ \exp_after:wN \use_ii:nn \fi: { ; {1000} {0000} {0000} {0000} ; } - { - \c_one ; {9999} {9999} {9999} {9999} ; } + { - 1 ; {9999} {9999} {9999} {9999} ; } } % \end{macrocode} % \end{macro} @@ -687,7 +689,7 @@ % \begin{macro}[aux, rEXP]{\@@_sub_back_not_far_o:wwwwNN} % In the present case, $x$ and $y$ have different exponents, but % $y$~is large enough that $x-y$ has a smaller exponent than~$x$. -% Decrement the exponent (with |- \c_one|). Then proceed in a way +% Decrement the exponent (with |-1|). Then proceed in a way % similar to the \texttt{near} auxiliaries seen earlier, but % multiplying $x$ by~$10$ (|#30| and |#40| below), and with the added % quirk that the \meta{rounding} digit has to be taken into account. @@ -701,9 +703,9 @@ % \begin{macrocode} \cs_new:Npn \@@_sub_back_not_far_o:wwwwNN #1 ~ #2; #3 ~ #4; #5#6 { - - \c_one + - 1 \exp_after:wN \@@_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 \@@_sub_back_near_pack:NNNNNNw \__int_value:w \__int_eval:w 11 0000 0000 + #40 - #2 - \exp_after:wN \@@_round_neg:NNN @@ -736,7 +738,7 @@ \cs_new:Npn \@@_sub_back_very_far_ii_o:nnNwwNN #1#2 ; #3 ; #4 ~ #5; #6#7 { \exp_after:wN \@@_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 \@@_basics_pack_low:NNNNNw \__int_value:w \__int_eval:w 2#5 - #2 - \exp_after:wN \@@_round_neg:NNN @@ -767,7 +769,7 @@ { \@@_mul_cases_o:NnNnww * - { - \c_two + } + { - 2 + } \@@_mul_npos_o:Nww { } } @@ -798,24 +800,24 @@ #1#2#3#4 \s_@@ \@@_chk:w #5#6#7; \s_@@ \@@_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: \@@_case_use:nw { #3 0 } \or: \@@_case_use:nw { #3 2 } @@ -974,7 +976,7 @@ % \begin{macrocode} \cs_new:Npn \@@_mul_significand_small_f:NNwwwN #1 #2#3; #4#5; #6; + #7 { - - \c_one + - 1 \exp_after:wN \@@_basics_pack_high:NNNNNw \__int_value:w \__int_eval:w 1#3#4 \exp_after:wN \@@_basics_pack_low:NNNNNw @@ -998,7 +1000,7 @@ % Filtering special floating point is very similar to what we did for % multiplications, with a few variations. Invalid operation % exceptions display |/| rather than |*|. In the formula for -% dispatch, we replace |- \c_two +| by |-|. The case of normal +% dispatch, we replace |- 2 +| by |-|. The case of normal % numbers is treated using \cs{@@_div_npos_o:Nww} rather than % \cs{@@_mul_npos_o:Nww}. There are two additional cases: if the % first operand is normal and the second is a zero, then the division @@ -1049,7 +1051,7 @@ \__int_value:w \__int_eval:w #3 - #6 \exp_after:wN \@@_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 @@ -1404,7 +1406,7 @@ { 0 \exp_after:wN \@@_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} } @@ -1461,7 +1463,7 @@ % \begin{macrocode} \cs_new:Npn \@@_div_significand_iv:wwnnnnnnn #1; #2;#3#4#5 #6#7#8#9 { - + \c_five * #1 + + 5 * #1 \exp_after:wN \@@_div_significand_vi:Nw \__int_value:w \__int_eval:w -20 + 2*#2#3 - #1*#6#7 + \exp_after:wN \@@_div_significand_v:NN @@ -1473,9 +1475,9 @@ \cs_new:Npn \@@_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: ; } @@ -1565,7 +1567,7 @@ \cs_new:Npn \@@_div_significand_large_o:wwwNNNNwN #1; #2; #3; #4#5#6#7#8; #9 { - + \c_one + + 1 \exp_after:wN \@@_basics_pack_weird_high:NNNNNNNNw \__int_value:w \__int_eval:w 1 #1 #2 \exp_after:wN \@@_basics_pack_weird_low:NNNNw @@ -1621,12 +1623,12 @@ \if_int_odd:w #1 \exp_stop_f: \exp_after:wN \@@_sqrt_npos_auxi_o:wwnnN \fi: - #1 / \c_two + #1 / 2 \@@_sqrt_Newton_o:wwn 56234133; 0; {#2#3} {#4#5} 0 } -\cs_new:Npn \@@_sqrt_npos_auxi_o:wwnnN #1 / \c_two #2; 0; #3#4#5 +\cs_new:Npn \@@_sqrt_npos_auxi_o:wwnnN #1 / 2 #2; 0; #3#4#5 { - ( #1 + \c_one ) / \c_two + ( #1 + 1 ) / 2 \@@_pack_eight:wNNNNNNNN \@@_sqrt_npos_auxii_o:wNNNNNNNN ; @@ -1710,7 +1712,7 @@ \exp_after:wN \@@_use_none_until_s:w \fi: \exp_after:wN \@@_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} } % \end{macrocode} @@ -1880,15 +1882,15 @@ \cs_new:Npn \@@_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 \@@_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 \@@_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 \@@_sqrt_auxvi_o:NNNNNw \__int_value:w \__int_eval:w (#1#2#3#4 %) \else: @@ -1906,7 +1908,7 @@ { \@@_sqrt_auxviii_o:nnnnnnn {0000000#1} {#2#3#4#5#6} } \cs_new:Npn \@@_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 \@@_sqrt_auxx_o:Nnnnnnnn \fi: \@@_sqrt_auxviii_o:nnnnnnn {00000000} {000#1#2#3#4#5} @@ -1982,7 +1984,7 @@ \@@_sqrt_auxii_o:NnnnnnnnN \@@_sqrt_auxxii_o:nnnnnnnnw #2 {#1} - {#3} { #4 + \c_one } #5 + {#3} { #4 + 1 } #5 } % \end{macrocode} % \end{macro} @@ -2001,11 +2003,11 @@ % \begin{macrocode} \cs_new:Npn \@@_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: \@@_sqrt_auxxiii_o:w \fi: \fi: @@ -2055,7 +2057,7 @@ \exp_after:wN \@@_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 \@@_round:NNN \exp_after:wN 0 \exp_after:wN 0 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx index 728085952a1..fa3fe89a2ac 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-convert.dtx @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-convert.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp-convert.dtx 6943 2017-02-17 16:47:59Z bruno $ {L3 Floating-point conversion} \begin{document} \DocInput{\jobname.dtx} @@ -124,22 +124,21 @@ % \enquote{invalid_operation} exception. In the normal case, % decrement the exponent and unbrace the $4$ brace groups, then in a % second step grab the first digit (previously hidden in braces) to -% order the various parts correctly. Finally trim zeros. +% order the various parts correctly. % \begin{macrocode} \cs_new:Npn \@@_to_scientific_dispatch:w \s_@@ \@@_chk:w #1#2 { \if_meaning:w 2 #2 \exp_after:wN - \exp:w \exp_end_continue_f:w \fi: \if_case:w #1 \exp_stop_f: - \@@_case_return:nw { 0 } + \@@_case_return:nw { 0.000000000000000e0 } \or: \exp_after:wN \@@_to_scientific_normal:wnnnnn \or: \@@_case_use:nw { - \@@_invalid_operation:nnw + \exp_args:Nf \@@_invalid_operation:nnw { - \exp_after:wN 1 - \exp_after:wN e - \int_use:N \c_@@_max_exponent_int + \@@_expand:n + { { 1.000000000000000e } \int_use:N \c_@@_max_exponent_int } } { fp_to_scientific } } @@ -147,7 +146,7 @@ \@@_case_use:nw { \@@_invalid_operation:nnw - { 0 } + { 0.000000000000000e0 } { fp_to_scientific } } \fi: @@ -156,17 +155,13 @@ \cs_new:Npn \@@_to_scientific_normal:wnnnnn \s_@@ \@@_chk:w 1 #1 #2 #3#4#5#6 ; { - \if_int_compare:w #2 = \c_one - \exp_after:wN \@@_to_scientific_normal:wNw - \else: - \exp_after:wN \@@_to_scientific_normal:wNw - \exp_after:wN e - \__int_value:w \__int_eval:w #2 - \c_one - \fi: + \exp_after:wN \@@_to_scientific_normal:wNw + \exp_after:wN e + \__int_value:w \__int_eval:w #2 - 1 ; #3 #4 #5 #6 ; } \cs_new:Npn \@@_to_scientific_normal:wNw #1 ; #2#3; - { \@@_trim_zeros:w #2.#3 ; #1 } + { #2.#3 #1 } % \end{macrocode} % \end{macro} % @@ -239,17 +234,17 @@ \cs_new:Npn \@@_to_decimal_normal:wnnnnn \s_@@ \@@_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_@@_prec_int { - \@@_decimate:nNnnnn { \c_sixteen - #2 } + \@@_decimate:nNnnnn { \c_@@_prec_int - #2 } \@@_to_decimal_large:Nnnw } { \exp_after:wN \exp_after:wN \exp_after:wN \@@_to_decimal_huge:wnnnn - \prg_replicate:nn { #2 - \c_sixteen } { 0 } ; + \prg_replicate:nn { #2 - \c_@@_prec_int } { 0 } ; } {#3} {#4} {#5} {#6} } @@ -264,7 +259,7 @@ \cs_new:Npn \@@_to_decimal_large:Nnnw #1#2#3#4; { \exp_after:wN \@@_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: @@ -290,7 +285,11 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}[aux, EXP]{\@@_to_tl_dispatch:w, \@@_to_tl_normal:nnnnn} +% \begin{macro}[aux, EXP] +% { +% \@@_to_tl_dispatch:w, \@@_to_tl_normal:nnnnn, +% \@@_to_tl_scientific:wnnnnn, \@@_to_tl_scientific:wNw +% } % A structure similar to \cs{@@_to_scientific_dispatch:w} and % \cs{@@_to_decimal_dispatch:w}, but without the \enquote{invalid operation} % exception. First filter special cases. We express normal numbers @@ -309,19 +308,22 @@ } \cs_new:Npn \@@_to_tl_normal:nnnnn #1 { - \if_int_compare:w #1 > \c_sixteen - \exp_after:wN \@@_to_scientific_normal:wnnnnn - \else: - \if_int_compare:w #1 < - \c_two - \exp_after:wN \exp_after:wN - \exp_after:wN \@@_to_scientific_normal:wnnnnn - \else: - \exp_after:wN \exp_after:wN - \exp_after:wN \@@_to_decimal_normal:wnnnnn - \fi: - \fi: + \int_compare:nTF + { -2 <= #1 <= \c_@@_prec_int } + { \@@_to_decimal_normal:wnnnnn } + { \@@_to_tl_scientific:wnnnnn } \s_@@ \@@_chk:w 1 0 {#1} } +\cs_new:Npn \@@_to_tl_scientific:wnnnnn + \s_@@ \@@_chk:w 1 #1 #2 #3#4#5#6 ; + { + \exp_after:wN \@@_to_tl_scientific:wNw + \exp_after:wN e + \__int_value:w \__int_eval:w #2 - 1 + ; #3 #4 #5 #6 ; + } +\cs_new:Npn \@@_to_tl_scientific:wNw #1 ; #2#3; + { \@@_trim_zeros:w #2.#3 ; #1 } % \end{macrocode} % \end{macro} % @@ -411,7 +413,7 @@ \@@_case_return:nw { \exp_after:wN \c_zero_fp } \else: \exp_after:wN \@@_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: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx index 5f9a05d834b..d085fd70484 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-expo.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% 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 % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-expo.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp-expo.dtx 6943 2017-02-17 16:47:59Z bruno $ {L3 Floating-point exponential-related functions} \begin{document} \DocInput{\jobname.dtx} @@ -167,7 +167,7 @@ { %^^A todo: ln(1) should be "exact zero", not "underflow" \exp_after:wN \@@_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 @@ -198,8 +198,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: @@ -236,7 +236,7 @@ { #1#2; {#3#4#5#6} {#7} } \cs_new:Npn \@@_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} } % \end{macrocode} @@ -476,7 +476,7 @@ { \@@_ln_Taylor_loop:www 21 ; {0000}{0000}{0000}{0000}{0000}{0000} ; } \cs_new:Npn \@@_ln_Taylor_loop:www #1; #2; #3; { - \if_int_compare:w #1 = \c_one + \if_int_compare:w #1 = 1 \exp_stop_f: \@@_ln_Taylor_break:w \fi: \exp_after:wN \@@_fixed_div_int:wwN \c_@@_one_fixed_tl ; #1; @@ -484,7 +484,7 @@ \@@_fixed_mul:wwn #3; { \exp_after:wN \@@_ln_Taylor_loop:www - \__int_value:w \__int_eval:w #1 - \c_two ; + \__int_value:w \__int_eval:w #1 - 2 ; } #3; } @@ -546,11 +546,11 @@ \cs_new:Npn \@@_ln_exponent:wn #1; #2 { \if_case:w #2 \exp_stop_f: - \c_zero \@@_case_return:nw { \@@_fixed_to_float:Nw 2 } + 0 \@@_case_return:nw { \@@_fixed_to_float:Nw 2 } \or: \exp_after:wN \@@_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 \@@_ln_exponent_small:NNww \exp_after:wN 0 \exp_after:wN \@@_fixed_sub:wwn \__int_value:w @@ -568,7 +568,7 @@ % \begin{macrocode} \cs_new:Npn \@@_ln_exponent_one:ww 1; #1; { - \c_zero + 0 \exp_after:wN \@@_fixed_sub:wwn \c_@@_ln_x_fixed_tl ; #1; \@@_fixed_to_float:wN 0 } @@ -580,7 +580,7 @@ % \begin{macrocode} \cs_new:Npn \@@_ln_exponent_small:NNww #1#2#3; #4#5#6#7#8#9; { - \c_four + 4 \exp_after:wN \@@_fixed_mul:wwn \c_@@_ln_x_fixed_tl ; {#3}{0000}{0000}{0000}{0000}{0000} ; @@ -635,29 +635,29 @@ \exp_after:wN \@@_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_@@_half_prec_int + 1 \exp_after:wN \@@_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_@@_max_exponent_int + \if_int_compare:w #4 > \c_@@_max_exp_exponent_int \exp_after:wN \@@_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 \@@_decimate:nNnnnn { - #4 } \@@_exp_Taylor:Nnnwn } { - \@@_decimate:nNnnnn { \c_sixteen - #4 } + \@@_decimate:nNnnnn { \c_@@_prec_int - #4 } \@@_exp_pos_large:NnnNwn } #5 @@ -666,10 +666,10 @@ \exp:w \fi: \fi: - \exp_after:wN \c_zero + \exp_after:wN \exp_end: } \cs_new:Npn \@@_exp_overflow: - { + \c_two * \c_@@_max_exponent_int ; {1000} {0000} {0000} {0000} ; } + { + 2 * \c_@@_max_exponent_int ; {1000} {0000} {0000} {0000} ; } % \end{macrocode} % \end{macro} % @@ -695,7 +695,7 @@ { \@@_exp_Taylor_loop:www 10 ; #1 ; #1 ; \s__stop } \cs_new:Npn \@@_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 \@@_exp_Taylor_break:Nww \fi: \@@_fixed_div_int:wwN #3 ; #1 ; @@ -861,28 +861,31 @@ % \subsection{Power} % % Raising a number $a$ to a power $b$ leads to many distinct situations. -% \begin{center} +% \begin{center}\def\abs#1{\lvert #1\rvert} % \begin{tabular}{>{$}c<{$}|*8{>{$}l<{$}}} -% a^b &-\infty&-y &-n &\pm 0&+n &+y &+\infty&\nan \\ -% \hline -% +\infty&+0 &+0 &+0 &+1&+\infty &+\infty&+\infty&\nan \\ -% 10$ and the result is also -% $+\infty$, but without any exception. +% and~$2$. Otherwise, either $a=\pm\infty$ and $b>0$ and the result +% is $+\infty$, or $a=\pm 0$ with $b<0$ and we have a division by zero +% unless $b=-\infty$. % \begin{macrocode} \cs_new:Npn \@@_pow_zero_or_inf:ww \s_@@ \@@_chk:w #1#2; \s_@@ \@@_chk:w #3#4 @@ -948,14 +951,17 @@ \if_meaning:w #1 #4 \@@_case_return_o:Nw \c_zero_fp \fi: - \if_meaning:w 0 #1 + \if_meaning:w 2 #1 + \@@_case_return_o:Nw \c_inf_fp + \fi: + \if_meaning:w 2 #3 + \@@_case_return_o:Nw \c_inf_fp + \else: \@@_case_use:nw { \@@_division_by_zero_o:NNww \c_inf_fp ^ \s_@@ \@@_chk:w #1 #2 ; } - \else: - \@@_case_return_o:Nw \c_inf_fp \fi: \s_@@ \@@_chk:w #3#4 } @@ -981,7 +987,7 @@ \s_@@ \@@_chk:w 1 #1#2#3; \s_@@ \@@_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 \@@_case_return_ii_o:ww \fi: @@ -993,7 +999,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 \@@_case_return_o:Nww \exp_after:wN \c_inf_fp \else: @@ -1028,7 +1034,7 @@ \exp_after:wN \@@_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 \@@_pow_npos_aux:NNnww \exp_after:wN + \exp_after:wN \@@_fixed_to_float:wN @@ -1060,7 +1066,7 @@ } \cs_new:Npn \@@_pow_exponent:wnN #1; #2 { - \if_int_compare:w #2 > \c_zero + \if_int_compare:w #2 > 0 \exp_stop_f: \exp_after:wN \@@_pow_exponent:Nwnnnnnw % n\ln(10) - (-\ln(x)) \exp_after:wN + \else: @@ -1092,7 +1098,7 @@ } \cs_new:Npn \@@_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 \@@_pow_C_neg:w \__int_value:w - \else: \if_int_compare:w #7 < 22 \exp_stop_f: @@ -1107,7 +1113,7 @@ } \cs_new:Npn \@@_pow_C_overflow:w #1; #2; #3 { - + \c_two * \c_@@_max_exponent_int + + 2 * \c_@@_max_exponent_int \exp_after:wN \@@_fixed_continue:wn \c_@@_one_fixed_tl ; } \cs_new:Npn \@@_pow_C_neg:w #1 ; 1 @@ -1128,7 +1134,7 @@ \else: \exp_after:wN \@@_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 \@@_pow_C_pack:w @@ -1145,7 +1151,7 @@ % undefined. This is invalid, unless $|a|^b$ turns out to be $+0$ or % \texttt{nan}, in which case we return that as $a^b$. In particular, % since the underflow detection occurs before \cs{@@_pow_neg:www} is -% called, |(-0.1)**(12345.6)| will give $+0$ rather than complaining +% called, |(-0.1)**(12345.67)| will give $+0$ rather than complaining % that the sign is not defined. % \begin{macrocode} \cs_new:Npn \@@_pow_neg:www \s_@@ \@@_chk:w #1#2; #3; #4; @@ -1153,7 +1159,7 @@ \if_case:w \@@_pow_neg_case:w #4 ; \exp_after:wN \@@_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: \@@_invalid_operation_o:Nww ^ #3; #4; \exp:w \exp_end_continue_f:w \exp_after:wN \exp_after:wN @@ -1169,7 +1175,7 @@ \exp_after:wN \s_@@ \exp_after:wN \@@_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: } % \end{macrocode} % ^^A todo: is this \@@_exp_after_o:w necessary? Appropriate? @@ -1178,66 +1184,53 @@ % \begin{macro}[aux, rEXP] % { % \@@_pow_neg_case:w, \@@_pow_neg_case_aux:nnnnn, -% \@@_pow_neg_case_aux:NNNNNNNNw +% \@@_pow_neg_case_aux:w % } -% This function expects a floating point number, and \enquote{returns} -% $-1$ if it is an even integer, $0$ if it is an odd integer, and $1$ -% if it is not an integer. Zeros are even, $\pm\infty$ and -% \texttt{nan} are non-integers. The sign of normal numbers is -% irrelevant to parity. If the exponent is greater than sixteen, then -% the number is even. If the exponent is non-positive, the number -% cannot be an integer. We also separate the ranges of exponent -% $[1,8]$ and $[9,16]$. In the former case, check that the last $8$ -% digits are zero (otherwise we don't have an integer). In both -% cases, consider the appropriate $8$ digits, either |#4#5| or |#2#3|, -% remove the first few: we are then left with \meta{digit} -% \meta{digits} |;| which would be the digits surrounding the decimal -% period. If the \meta{digits} are non-zero, the number is not an -% integer. Otherwise, check the parity of the \meta{digit} and return -% \cs{c_zero} or |-|\cs{c_one}. +% This function expects a floating point number, and determines its +% \enquote{parity}. It should be used after \cs{if_case:w} or in an +% integer expression. It gives $-1$ if the number is an even integer +% divided by some power of~$5$, $0$~if the number is an odd integer +% divided by some power of~$5$, and $1$~otherwise. Zeros and +% $\pm\infty$ are even (because very large finite floating points are +% even), while \texttt{nan} is a non-integer. The sign of normal +% numbers is irrelevant to parity. The idea is to repeatedly multiply +% the number by~$5$ (by halving the mantissa and shifting the +% exponent) until the mantissa is odd (this can only happen at most +% $53$ times since $2^{54}>10^{16}$): if the resulting exponent is +% larger than $16$ the parity is even, if it is exactly $16$ the +% parity is odd, and otherwise we should return~$1$. Of course there +% is a shortcut: we stop as soon as the exponent exceeds~$16$. % \begin{macrocode} \cs_new:Npn \@@_pow_neg_case:w \s_@@ \@@_chk:w #1#2#3; { \if_case:w #1 \exp_stop_f: - -\c_one + -1 \or: \@@_pow_neg_case_aux:nnnnn #3 - \else: \c_one + \or: -1 + \else: 1 \fi: + \exp_stop_f: } \cs_new:Npn \@@_pow_neg_case_aux:nnnnn #1#2#3#4#5 + { \@@_pow_neg_case_aux:w #1 ; #2 #3 ; #4 #5 ; } +\cs_new:Npn \@@_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 \@@_pow_neg_case_aux:NNNNNNNNw - \prg_replicate:nn { \c_sixteen - #1 } { 0 } #4#5 ; - \fi: + \if_int_compare:w #1 > \c_@@_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 \@@_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_@@_prec_int + 0 \else: - \c_one + 1 \fi: \else: - \c_one - \fi: - \fi: - } -\cs_new:Npn \@@_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 \@@_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: } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx index 1e8fe4b7cb5..59f734632b4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-extended.dtx @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-extended.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp-extended.dtx 6943 2017-02-17 16:47:59Z bruno $ {L3 Floating-points with extended precision} \begin{document} \DocInput{\jobname.dtx} @@ -140,7 +140,7 @@ \cs_new:Npn \@@_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_@@_myriad_int + #1 } #2 ; } % \end{macrocode} % \end{macro} @@ -213,8 +213,8 @@ \exp_after:wN \@@_pack:NNNNNw \__int_value:w \__int_eval:w \c_@@_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_@@_myriad_int ) + / \c_@@_myriad_int ; ; } % \end{macrocode} % \end{macro} @@ -276,7 +276,7 @@ { \exp_after:wN \@@_fixed_div_int_after:Nw \exp_after:wN #8 - \__int_value:w \__int_eval:w - \c_one + \__int_value:w \__int_eval:w - 1 \@@_fixed_div_int:wnN #1; {#7} \@@_fixed_div_int_auxi:wnn #2; {#7} \@@_fixed_div_int_auxi:wnn @@ -288,7 +288,7 @@ \cs_new:Npn \@@_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} } @@ -300,7 +300,7 @@ \exp_after:wN \@@_fixed_div_int:wnN \__int_value:w \__int_eval:w #3 - #1*#2 \__int_eval_end: } -\cs_new:Npn \@@_fixed_div_int_auxii:wnn #1; #2 #3 { + #1 + \c_two ; } +\cs_new:Npn \@@_fixed_div_int_auxii:wnn #1; #2 #3 { + #1 + 2 ; } \cs_new:Npn \@@_fixed_div_int_pack:Nw #1 #2; { + #1; {#2} } \cs_new:Npn \@@_fixed_div_int_after:Nw #1 #2; { #1 {#2} } % \end{macrocode} @@ -430,7 +430,7 @@ } \cs_new:Npn \@@_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_@@_myriad_int + #1*#3 + #5*#7 ; ; } % \end{macrocode} @@ -612,7 +612,7 @@ \cs_new:Npn \@@_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_@@_myriad_int } % \end{macrocode} % \end{macro} @@ -639,7 +639,7 @@ \exp_after:wN \@@_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 \@@_ep_to_fixed_auxi:www 1#1; #2; #3#4#5#6#7; { @@ -678,7 +678,7 @@ \cs_new:Npn \@@_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 \@@_ep_to_ep_loop:N \__int_value:w \__int_eval:w 1 0000 0000 + #2 \__int_eval_end: @@ -687,7 +687,7 @@ \cs_new:Npn \@@_ep_to_ep_loop:N #1 { \if_meaning:w 0 #1 - - \c_one + - 1 \else: \@@_ep_to_ep_end:www #1 \fi: @@ -698,7 +698,7 @@ { \fi: \if_meaning:w ; #1 - - \c_two * \c_@@_max_exponent_int + - 2 * \c_@@_max_exponent_int \@@_ep_to_ep_zero:ww \fi: \@@_pack_twice_four:wNNNNNNNN @@ -938,9 +938,9 @@ \cs_new:Npn \@@_ep_div_esti:wwwwn #1,#2#3; #4, { \exp_after:wN \@@_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 \@@_ep_div_estii:wwnnwwn #1; #2,#3#4#5; #6; #7 @@ -1057,8 +1057,8 @@ \exp_after:wN \@@_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 \@@_ep_isqrt_auxii:wwnnnwn #1, #2, #3#4 #5#6; #7 { @@ -1099,13 +1099,13 @@ \fi: \exp_after:wN \@@_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 \@@_ep_isqrt_estii:wwwnnwn #1, #2, #3, #4#5 { \exp_after:wN \@@_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 \@@_ep_isqrt_estiii:NNNNNwwwn 1#1#2#3#4#5#6, 1#7#8; #9; @@ -1207,7 +1207,7 @@ \cs_new:Npn \@@_fixed_to_float:Nw #1#2; { \@@_fixed_to_float:wN #2; #1 } \cs_new:Npn \@@_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_@@_block_int % for the 8-digit-at-the-start thing. \exp_after:wN \exp_after:wN \exp_after:wN \@@_fixed_to_loop:N \exp_after:wN \use_none:n @@ -1222,7 +1222,7 @@ \cs_new:Npn \@@_fixed_to_loop:N #1 { \if_meaning:w 0 #1 - - \c_one + - 1 \exp_after:wN \@@_fixed_to_loop:N \else: \exp_after:wN \@@_fixed_to_loop_end:w @@ -1243,12 +1243,12 @@ } \cs_new:Npn \@@_fixed_to_float_zero:w ; 0000 0000 0000 0000 ; { - - \c_two * \c_@@_max_exponent_int ; + - 2 * \c_@@_max_exponent_int ; {0000} {0000} {0000} {0000} ; } \cs_new:Npn \@@_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 \@@_fixed_to_float_round_up:wnnnnw \fi: ; #1 ; @@ -1258,7 +1258,7 @@ \exp_after:wN \@@_basics_pack_high:NNNNNw \__int_value:w \__int_eval:w 1 #1#2 \exp_after:wN \@@_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 ; } % \end{macrocode} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx index fa1b7538c83..3beb67d2dc4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-logic.dtx @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-logic.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp-logic.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Floating-point conditionals} \begin{document} \DocInput{\jobname.dtx} @@ -170,7 +170,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 @@ -178,7 +178,7 @@ \fi: \exp_stop_f: } -\cs_new:Npn \@@_compare_nan:w #1 \exp_stop_f: { \c_two } +\cs_new:Npn \@@_compare_nan:w #1 \fi: \exp_stop_f: { 2 \exp_stop_f: } % \end{macrocode} % \end{macro} % @@ -445,7 +445,7 @@ \@@_compare_back:ww \s_@@ \@@_chk:w #4#5; \s_@@ \@@_chk:w #2#3; - = #1 \c_one + = #1 1 \exp_stop_f: \@@_minmax_auxii:ww \else: \@@_minmax_auxi:ww @@ -570,12 +570,12 @@ \cs_new:Npn \@@_ternary_loop_break:w #1 \fi: #2 \@@_ternary_break_point:n #3 { - \c_zero = \c_zero \fi: + 0 = 0 \exp_stop_f: \fi: \exp_after:wN \@@_ternary_auxii:NwwN } \cs_new:Npn \@@_ternary_loop:Nw \s_@@ \@@_chk:w #1#2; { - \if_int_compare:w #1 > \c_zero + \if_int_compare:w #1 > 0 \exp_stop_f: \exp_after:wN \@@_ternary_map_break: \fi: \@@_ternary_loop:Nw diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx index 5fe3aaac4d9..1aa0956212d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-parse.dtx @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-parse.dtx 6877 2017-02-10 03:59:09Z bruno $ +\GetIdInfo$Id: l3fp-parse.dtx 6943 2017-02-17 16:47:59Z bruno $ {L3 Floating-point expression parsing} \begin{document} \DocInput{\jobname.dtx} @@ -195,17 +195,17 @@ % already found, |12345|. This integer is unfinished, causing the % second \cs{exp_after:wN} to expand, and to trigger the construction % \cs{exp:w}, which expands |\operand:w|, defined to read -% what follows and make a number out of it, then leave \cs{c_zero}, the +% what follows and make a number out of it, then leave \cs{exp_end:}, the % number, and a semicolon in the input stream. Once |\operand:w| is % done expanding, we obtain essentially % \begin{quote}\ttfamily % \cs{exp_after:wN} |\add:ww| \cs{__int_value:w} 12345 ; \newline -% \cs{exp:w} \cs{c_zero} 333444 ; +% \cs{exp:w} \cs{exp_end:} 333444 ; % \end{quote} % where in fact \cs{exp_after:wN} has already been expanded, % \cs{__int_value:w} has already seen |12345|, and % \cs{exp:w} is still looking for a number. It finds -% \cs{c_zero}, hence expands to nothing. Now, \cs{__int_value:w} sees +% \cs{exp_end:}, hence expands to nothing. Now, \cs{__int_value:w} sees % the \texttt{;}, which cannot be part of a number. The expansion % stops, and we are left with % \begin{quote}\ttfamily @@ -499,33 +499,33 @@ % \item If the next token is a control sequence, it could be the % special marker \cs{s_@@_mark}, and % otherwise it is a case of juxtaposing numbers, such as -% |2\c_three|, with an implied multiplication. +% |2\c_zero|, with an implied multiplication. % \item If the next token is a letter, it is also a case of % juxtaposition, as letters cannot be proper infix operators. % \item Otherwise (including in the case of digits), if the token is a % known infix operator, the appropriate % |\__fp_infix_|\meta{operator}|:N| function is built, and if it % does not exist, we complain. In particular, the juxtaposition -% |\c_three 2| is disallowed. +% |\c_zero 2| is disallowed. % \end{itemize} % % In the above, we need to test whether a character token~|#1| is a % digit: % \begin{verbatim} -% \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: % is a digit % \else: % not a digit % \fi: % \end{verbatim} -% To exclude |0|, replace \cs{c_nine} by \cs{c_ten}. The use of +% To exclude |0|, replace |9| by |10|. The use of % \cs{token_to_str:N} ensures that a digit with any catcode is detected. % To test if a character token is a letter, we need to work with its % character code, testing if |`#1| lies in $[65,90]$ (uppercase letters) % or $[97,112]$ (lowercase letters) % \begin{verbatim} % \if_int_compare:w \__int_eval:w -% ( `#1 \if_int_compare:w `#1 > `Z - 32 \fi: ) / 26 = \c_three +% ( `#1 \if_int_compare:w `#1 > `Z - 32 \fi: ) / 26 = 3 \exp_stop_f: % is a letter % \else: % not a letter @@ -698,7 +698,7 @@ { \cs_new:cpn { @@_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: \@@_parse_return_semicolon:w #3 ##1 @@ -745,7 +745,7 @@ \exp_after:wN \@@_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 \@@_parse_one_digit:NN \else: @@ -940,7 +940,7 @@ \exp_after:wN #1 \exp:w \exp_end_continue_f:w \exp_after:wN \@@_sanitize:wN - \__int_value:w \__int_eval:w \c_zero \@@_parse_trim_zeros:N + \__int_value:w \__int_eval:w 0 \@@_parse_trim_zeros:N } % \end{macrocode} % \end{macro} @@ -956,8 +956,8 @@ { \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 \@@_parse_word:Nw \exp_after:wN #1 \exp_after:wN #2 @@ -1005,13 +1005,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 \@@_parse_letters:N \exp:w @@ -1100,7 +1099,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 \@@_parse_large:N \else: \exp_after:wN \@@_parse_zero: @@ -1123,7 +1122,7 @@ \cs_new:Npn \@@_parse_strim_zeros:N #1 { \if:w 0 \exp_not:N #1 - - \c_one + - 1 \exp_after:wN \@@_parse_strim_zeros:N \exp:w \else: \@@_parse_strim_end:w #1 @@ -1133,7 +1132,7 @@ \cs_new:Npn \@@_parse_strim_end:w #1 \fi: \@@_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 \@@_parse_small:N \else: \exp_after:wN \@@_parse_zero: @@ -1191,7 +1190,7 @@ % We leave \meta{digits} \meta{zeros} in the input stream: the % functions used to grab digits are such that this constitutes digits % $1$ through~$8$ of the significand. Then prepare to pack $8$~more -% digits, with an exponent shift of \cs{c_zero} (this shift is used in +% digits, with an exponent shift of zero (this shift is used in % the case of a large significand). If |#4|~is a digit, leave it % behind for the packing function, and read $6$~more digits to reach a % total of $15$~digits: further digits are involved in the rounding. @@ -1202,9 +1201,9 @@ { #1 #2 \exp_after:wN \@@_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 \@@_parse_small_trailing:wwNN \__int_value:w 1 @@ -1226,14 +1225,14 @@ % stream. If the \meta{next~token} is a digit, it is the $16$th % digit, we keep it, then the \texttt{small_round} auxiliary considers % this digit and all further digits to perform the rounding: the -% function expands to nothing, to |+\c_zero| or to |+\c_one|. +% function expands to nothing, to |+0| or to |+1|. % Otherwise, there is no $16$-th digit, so we put a~$0$, and look for % an exponent. % \begin{macrocode} \cs_new:Npn \@@_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 \@@_parse_small_round:NN \exp_after:wN #4 @@ -1260,7 +1259,7 @@ % argument is~$2$. The \texttt{trailing} function has an exponent % shift as its first argument, which we add to the exponent found in % the |e...| syntax. If the trailing digits cause a carry, the -% integer expression for the leading digits is incremented (|+ \c_one| +% integer expression for the leading digits is incremented (|+1| % in the code below). If the leading digits propagate this carry all % the way up, the function \cs{@@_parse_pack_carry:w} increments the % exponent, and changes the significand from |0000...| to |1000...|: @@ -1269,7 +1268,7 @@ % \begin{macrocode} \cs_new:Npn \@@_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 \@@_parse_pack_leading:NNNNNww #1 #2#3#4#5 #6; #7; @@ -1279,7 +1278,7 @@ ; 0 {#2#3#4#5} {#6} } \cs_new:Npn \@@_parse_pack_carry:w \fi: ; 0 #1 - { \fi: + \c_one ; 0 {1000} } + { \fi: + 1 ; 0 {1000} } % \end{macrocode} % \end{macro} % @@ -1325,10 +1324,10 @@ % \begin{macrocode} \cs_new:Npn \@@_parse_large_leading:wwNN 1 #1 ; #2; #3 #4 { - + \c_eight - #3 + + \c_@@_half_prec_int - #3 \exp_after:wN \@@_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 \@@_parse_large_trailing:wwNN \__int_value:w 1 \token_to_str:N #4 \exp_after:wN \@@_parse_digits_vi:N @@ -1346,7 +1345,7 @@ \else: #2 \exp_after:wN \@@_parse_pack_trailing:NNNNNNww - \exp_after:wN \c_zero + \exp_after:wN 0 \__int_value:w 1 0000 0000 \@@_parse_exponent:Nw #4 \fi: @@ -1376,16 +1375,16 @@ % \begin{macrocode} \cs_new:Npn \@@_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 \@@_parse_pack_trailing:NNNNNNww - \exp_after:wN \c_eight + \exp_after:wN \c_@@_half_prec_int \__int_value:w \__int_eval:w 1 #1 \token_to_str:N #4 \exp_after:wN \@@_parse_large_round:NN \exp_after:wN #4 \exp:w \else: \exp_after:wN \@@_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 \@@_parse_small_trailing:wwNN @@ -1412,15 +1411,15 @@ % small or large). It should appear in an integer expression. This % function reads digits one by one, until reaching a non-digit, and % adds~$1$ to the integer expression for each digit. If all digits -% found are~$0$, the function ends the expression by |;\c_zero|, -% otherwise by |;\c_one|. This is done by switching the loop to +% found are~$0$, the function ends the expression by |;0|, +% otherwise by |;1|. This is done by switching the loop to % |round_up| at the first non-zero digit, thus we avoid to test % whether digits are~$0$ or not once we see a first non-zero digit. % \begin{macrocode} \cs_new:Npn \@@_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 \@@_parse_round_loop:N \exp:w @@ -1429,18 +1428,18 @@ \exp:w \fi: \else: - \@@_parse_return_semicolon:w \c_zero #1 + \@@_parse_return_semicolon:w 0 #1 \fi: \@@_parse_expand:w } \cs_new:Npn \@@_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 \@@_parse_round_up:N \exp:w \else: - \@@_parse_return_semicolon:w \c_one #1 + \@@_parse_return_semicolon:w 1 #1 \fi: \@@_parse_expand:w } @@ -1451,7 +1450,7 @@ % After the loop \cs{@@_parse_round_loop:N}, this function fetches an % exponent with \cs{@@_parse_exponent:N}, and combines it with the % number of digits counted by \cs{@@_parse_round_loop:N}. At the same -% time, the result \cs{c_zero} or \cs{c_one} is added to the +% time, the result |0| or |1| is added to the % surrounding integer expression. % \begin{macrocode} \cs_new:Npn \@@_parse_round_after:wN #1; #2 @@ -1467,11 +1466,11 @@ % Here, |#1|~is the digit that we are currently rounding (we only care % whether it is even or odd). If |#2|~is not a digit, then fetch an % exponent and expand to |;|\meta{exponent} only. Otherwise, we will -% expand to |+\c_zero| or |+\c_one|, then |;|\meta{exponent}. To +% expand to |+0| or |+1|, then |;|\meta{exponent}. To % decide which, call \cs{@@_round_s:NNNw} to know whether to round up, % giving it as arguments a sign~$0$ (all explicit numbers are % positive), the digit |#1|~to round, the first following digit~|#2|, -% and either |+\c_zero| or |+\c_one| depending on whether the +% and either |+0| or |+1| depending on whether the % following digits are all zero or not. This last argument is % obtained by \cs{@@_parse_round_loop:N}, whose number of digits we % discard by multiplying it by~$0$. The exponent which follows the @@ -1479,7 +1478,7 @@ % \begin{macrocode} \cs_new:Npn \@@_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 \@@_round_s:NNNw \exp_after:wN 0 @@ -1487,7 +1486,7 @@ \exp_after:wN #2 \__int_value:w \__int_eval:w \exp_after:wN \@@_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 \@@_parse_round_loop:N \exp:w \else: @@ -1520,7 +1519,7 @@ % \begin{macrocode} \cs_new:Npn \@@_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 \@@_round_s:NNNw \exp_after:wN 0 @@ -1528,7 +1527,7 @@ \exp_after:wN #2 \__int_value:w \__int_eval:w \exp_after:wN \@@_parse_large_round_aux:wNN - \__int_value:w \__int_eval:w \c_one + \__int_value:w \__int_eval:w 1 \exp_after:wN \@@_parse_round_loop:N \else: %^^A could be dot, or e, or other \exp_after:wN \@@_parse_large_round_test:NN @@ -1553,12 +1552,12 @@ \exp_after:wN \@@_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 \@@_parse_round_loop:N \exp:w \exp_after:wN \@@_parse_expand:w \else: \exp_after:wN ; - \exp_after:wN \c_zero + \exp_after:wN 0 \exp_after:wN #3 \fi: } @@ -1633,7 +1632,7 @@ \cs_new:Npn \@@_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 \@@_parse_exponent_sign:N @@ -1665,7 +1664,7 @@ % \begin{macrocode} \cs_new:Npn \@@_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 \@@_parse_exponent_digits:N \exp:w @@ -1692,7 +1691,7 @@ % \begin{macrocode} \cs_new:Npn \@@_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 \@@_parse_exponent_digits:N \exp:w @@ -1723,7 +1722,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_@@ } { \exp_not:N #1 } = \c_zero + \__str_if_eq_x:nn { \s_@@ } { \exp_not:N #1 } + = 0 \exp_stop_f: 0 \__msg_kernel_expandable_error:nnn { kernel } { fp-after-e } { floating~point~ } @@ -1737,7 +1737,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 @@ -1826,7 +1826,7 @@ \exp_after:wN #1 \exp:w \exp_end_continue_f:w \exp_after:wN \@@_sanitize:wN - \__int_value:w \__int_eval:w \c_zero \@@_parse_strim_zeros:N + \__int_value:w \__int_eval:w 0 \@@_parse_strim_zeros:N } % \end{macrocode} % \end{macro} @@ -2111,6 +2111,8 @@ % \end{macro} % % \begin{macro}[aux, EXP]{\@@_parse_word_round:N, \@@_parse_round:Nw} +% \begin{macro}[aux, deprecated = 2017-12-31]{round+, round0, round-} +% This looks for |+|, |-|, |0| after |round|. That syntax is deprecated. % \begin{macrocode} \cs_new:Npn \@@_parse_word_round:N #1#2 { @@ -2133,6 +2135,7 @@ #1 #2 \@@_round_to_nearest:NNN #3#4 { #2 #1 #3 } % \end{macrocode} % \end{macro} +% \end{macro} % % \subsection{Main functions} % @@ -2231,7 +2234,7 @@ \if_catcode:w \scan_stop: \exp_not:N #2 \if_int_compare:w \__str_if_eq_x:nn { \s_@@_mark } { \exp_not:N #2 } - = \c_zero + = 0 \exp_stop_f: \exp_after:wN \exp_after:wN \exp_after:wN \@@_parse_infix_mark:NNN \else: @@ -2241,9 +2244,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 \@@_parse_infix_juxtapose:N \else: @@ -2592,29 +2594,20 @@ % } % \begin{macrocode} \cs_new:cpn { @@_parse_infix_<:N } #1 - { - \@@_parse_compare:NNNNNNN #1 \c_one - \c_zero \c_zero \c_zero \c_zero < - } + { \@@_parse_compare:NNNNNNN #1 1 0 0 0 0 < } \cs_new:cpn { @@_parse_infix_=:N } #1 - { - \@@_parse_compare:NNNNNNN #1 \c_one - \c_zero \c_zero \c_zero \c_zero = - } + { \@@_parse_compare:NNNNNNN #1 1 0 0 0 0 = } \cs_new:cpn { @@_parse_infix_>:N } #1 - { - \@@_parse_compare:NNNNNNN #1 \c_one - \c_zero \c_zero \c_zero \c_zero > - } + { \@@_parse_compare:NNNNNNN #1 1 0 0 0 0 > } \cs_new:cpn { @@_parse_infix_!:N } #1 { \exp_after:wN \@@_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 \@@_parse_excl_error: { @@ -2636,7 +2629,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: @@ -2676,12 +2669,13 @@ { \if_int_odd:w \if_meaning:w \c_zero_fp #3 - \c_zero + 0 \else: \if_case:w \@@_compare_back:ww #8 #2 \exp_stop_f: #5 \or: #6 \or: #7 \else: #4 \fi: \fi: + \exp_stop_f: \exp_after:wN \@@_parse_apply_compare_aux:NNwN \exp_after:wN \c_one_fp \else: @@ -2748,7 +2742,7 @@ { \@@_new_function:Ncfnn #1 { @@_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 \@@_new_function:NNnnn #1#2#3#4#5 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx index a8e3f199dba..c5da3f78998 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-random.dtx @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-random.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp-random.dtx 6943 2017-02-17 16:47:59Z bruno $ {L3 Floating-point random numbers} \begin{document} \DocInput{\jobname.dtx} @@ -239,7 +239,7 @@ \cs_new:Npn \@@_randint_o:Nw ? #1 @ { \if_case:w - \__int_eval:w \@@_array_count:n {#1} - \c_one \__int_eval_end: + \__int_eval:w \@@_array_count:n {#1} - 1 \__int_eval_end: \exp_after:wN \@@_randint_e:w \c_one_fp #1 \or: \@@_randint_e:w #1 \else: @@ -255,19 +255,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_@@_prec_int + 1 \exp_stop_f: \fi: \fi: } - { \c_one } + { 1 \exp_stop_f: } } \cs_new:Npn \@@_randint_e:w #1; #2; { \if_case:w \@@_randint_badarg:w #1; \@@_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 \@@_randint_e:wnn \@@_parse:n { #2; - #1; } { #1; } { #2; } \or: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx index 9f9e0d0f352..31a0ba85783 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-round.dtx @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-round.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp-round.dtx 6968 2017-02-20 16:08:44Z bruno $ {L3 Floating-point rounding} \begin{document} \DocInput{\jobname.dtx} @@ -73,6 +73,14 @@ % % \subsection{Rounding tools} % +% \begin{variable}{\c_@@_five_int} +% This is used as the half-point for which numbers are rounded +% up/down. +% \begin{macrocode} +\int_const:Nn \c_@@_five_int { 5 } +% \end{macrocode} +% \end{variable} +% % Floating point operations often yield a result that cannot be exactly % represented in a significand with $16$ digits. In that case, we need to % round the exact result to a representable number. The \textsc{ieee} @@ -98,16 +106,16 @@ % (but there is not interface for that yet). % % The rounding tools available in this module are many variations on a -% base function \cs{@@_round:NNN}, which expands to \cs{c_zero} or -% \cs{c_one} depending on whether the final result should be rounded up +% base function \cs{@@_round:NNN}, which expands to |0\exp_stop_f:| or +% |1\exp_stop_f:| depending on whether the final result should be rounded up % or down. % \begin{itemize} % \item \cs{@@_round:NNN} \meta{sign} \meta{digit_1} \meta{digit_2} -% can expand to \cs{c_zero} or \cs{c_one}. +% can expand to |0\exp_stop_f:| or |1\exp_stop_f:|. % \item \cs{@@_round_s:NNNw} \meta{sign} \meta{digit_1} \meta{digit_2} -% \meta{more digits}|;| can expand to |\c_zero ;| or |\c_one ;|. +% \meta{more digits}|;| can expand to |0\exp_stop_f:;| or |1\exp_stop_f:;|. % \item \cs{@@_round_neg:NNN} \meta{sign} \meta{digit_1} \meta{digit_2} -% can expand to \cs{c_zero} or \cs{c_one}. +% can expand to |0\exp_stop_f:| or |1\exp_stop_f:|. % \end{itemize} % See implementation comments for details on the syntax. % @@ -127,8 +135,8 @@ % \end{syntax} % If rounding the number $\meta{final sign} % \meta{digit_1}.\meta{digit_2}$ to an integer rounds it towards zero -% (truncates it), this function expands to \cs{c_zero}, and otherwise -% to \cs{c_one}. Typically used within the scope of an +% (truncates it), this function expands to |0\exp_stop_f:|, and otherwise +% to |1\exp_stop_f:|. Typically used within the scope of an % \cs{__int_eval:w}, to add~$1$ if needed, and thereby round % correctly. The result depends on the rounding mode. % @@ -137,9 +145,9 @@ % rounding towards~$-\infty$ or towards~$+\infty$. Also recall that % \meta{final sign} is~$0$ for positive, and~$2$ for negative. % -% By default, the functions below return \cs{c_zero}, but this is +% By default, the functions below return |0\exp_stop_f:|, but this is % superseded by \cs{@@_round_return_one:}, which instead returns -% \cs{c_one}, expanding everything and removing \cs{c_zero} in the +% |1\exp_stop_f:|, expanding everything and removing |0\exp_stop_f:| in the % process. In the case of rounding towards~$\pm\infty$ or % towards~$0$, this is not really useful, but it prepares us for the % \enquote{round to nearest, ties to even} mode. @@ -155,29 +163,29 @@ % or up towards $+\infty$. % \begin{macrocode} \cs_new:Npn \@@_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 \@@_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: \@@_round_return_one: \fi: \fi: - \c_zero + 0 \exp_stop_f: } -\cs_new:Npn \@@_round_to_zero:NNN #1 #2 #3 { \c_zero } +\cs_new:Npn \@@_round_to_zero:NNN #1 #2 #3 { 0 \exp_stop_f: } \cs_new:Npn \@@_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: \@@_round_return_one: \fi: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new:Npn \@@_round_to_nearest:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_five + \if_int_compare:w #3 > \c_@@_five_int \@@_round_return_one: \else: \if_meaning:w 5 #3 @@ -186,11 +194,11 @@ \fi: \fi: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new:Npn \@@_round_to_nearest_ninf:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_five + \if_int_compare:w #3 > \c_@@_five_int \@@_round_return_one: \else: \if_meaning:w 5 #3 @@ -199,18 +207,18 @@ \fi: \fi: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new:Npn \@@_round_to_nearest_zero:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_five + \if_int_compare:w #3 > \c_@@_five_int \@@_round_return_one: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new:Npn \@@_round_to_nearest_pinf:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_five + \if_int_compare:w #3 > \c_@@_five_int \@@_round_return_one: \else: \if_meaning:w 5 #3 @@ -219,7 +227,7 @@ \fi: \fi: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new_eq:NN \@@_round:NNN \@@_round_to_nearest:NNN % \end{macrocode} @@ -231,9 +239,9 @@ % \cs{@@_round_s:NNNw} \meta{final sign} \meta{digit} \meta{more digits} |;| % \end{syntax} % Similar to \cs{@@_round:NNN}, but with an extra semicolon, this -% function expands to |\c_zero ;| if rounding $\meta{final sign} +% function expands to |0\exp_stop_f:;| if rounding $\meta{final sign} % \meta{digit}.\meta{more digits}$ to an integer truncates, and to -% |\c_one ;| otherwise. The \meta{more digits} part must be a digit, +% |1\exp_stop_f:;| otherwise. The \meta{more digits} part must be a digit, % followed by something that does not overflow a \cs{int_use:N} % \cs{__int_eval:w} construction. The only relevant information about % this piece is whether it is zero or not. @@ -247,7 +255,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: @@ -269,11 +277,11 @@ % \begin{macrocode} \cs_new:Npn \@@_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 @@ -295,15 +303,15 @@ % \begin{syntax} % \cs{@@_round_neg:NNN} \meta{final sign} \meta{digit_1} \meta{digit_2} % \end{syntax} -% This expands to \cs{c_zero} or \cs{c_one} after doing the following +% This expands to |0\exp_stop_f:| or |1\exp_stop_f:| after doing the following % test. Starting from a number of % the form $ \meta{final sign}0.\meta{15 digits}\meta{digit_1} $ with exactly % $15$ (non-all-zero) digits before \meta{digit_1}, subtract from it % $\meta{final sign}0.0\ldots{}0\meta{digit_2}$, where there are $16$~zeros. % If in the current rounding mode the result should be rounded down, -% then this function returns \cs{c_one}. Otherwise, \emph{i.e.}, +% then this function returns |1\exp_stop_f:|. Otherwise, \emph{i.e.}, % if the result is rounded back to the first operand, then this function -% returns \cs{c_zero}. +% returns |0\exp_stop_f:|. % % It turns out that this negative \enquote{round to nearest} % is identical to the positive one. And this is the default mode. @@ -311,20 +319,20 @@ \cs_new_eq:NN \@@_round_to_ninf_neg:NNN \@@_round_to_pinf:NNN \cs_new:Npn \@@_round_to_zero_neg:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_zero + \if_int_compare:w #3 > 0 \exp_stop_f: \@@_round_return_one: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new_eq:NN \@@_round_to_pinf_neg:NNN \@@_round_to_ninf:NNN \cs_new_eq:NN \@@_round_to_nearest_neg:NNN \@@_round_to_nearest:NNN \cs_new_eq:NN \@@_round_to_nearest_ninf_neg:NNN \@@_round_to_nearest_pinf:NNN \cs_new:Npn \@@_round_to_nearest_zero_neg:NNN #1 #2 #3 { - \if_int_compare:w #3 > \c_four + \if_int_compare:w #3 < \c_@@_five_int \else: \@@_round_return_one: \fi: - \c_zero + 0 \exp_stop_f: } \cs_new_eq:NN \@@_round_to_nearest_pinf_neg:NNN \@@_round_to_nearest_ninf:NNN \cs_new_eq:NN \@@_round_neg:NNN \@@_round_to_nearest_neg:NNN @@ -459,19 +467,19 @@ } \cs_new:Npn \@@_round_normal:NwNNnw #1#2 \s_@@ \@@_chk:w 1#3#4#5; { - \@@_decimate:nNnnnn { \c_sixteen - #4 - #2 } + \@@_decimate:nNnnnn { \c_@@_prec_int - #4 - #2 } \@@_round_normal:NnnwNNnn #5 #1 #3 {#4} {#2} } \cs_new:Npn \@@_round_normal:NnnwNNnn #1#2#3#4; #5#6 { \exp_after:wN \@@_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 \@@_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: @@ -483,7 +491,7 @@ 0000 0000 0000 0000 ; #6 } \cs_new:Npn \@@_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 \@@_round_normal:NNwNnn #1 #2 { \if_meaning:w 0 #2 @@ -508,7 +516,7 @@ \else: \exp_after:wN \@@_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: ; diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx index e6ce10175fa..685274306b0 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-traps.dtx @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-traps.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp-traps.dtx 6923 2017-02-14 03:07:25Z bruno $ {L3 Floating-point exception trapping} \begin{document} \DocInput{\jobname.dtx} @@ -72,51 +72,19 @@ % % \subsection{Flags} % -% \begin{macro}{\fp_flag_off:n} -% Function to turn a flag off. Simply undefine it. -% \begin{macrocode} -\cs_new_protected:Npn \fp_flag_off:n #1 - { \cs_set_eq:cN { l_@@_ #1 _flag_token } \tex_undefined:D } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[EXP]{\fp_flag_on:n} -% Function to turn a flag on expandably: use \TeX{}'s automatic -% assignment to \cs{scan_stop:}. -% \begin{macrocode} -\cs_new:Npn \fp_flag_on:n #1 - { \exp_args:Nc \use_none:n { l_@@_ #1 _flag_token } } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}[EXP,pTF]{\fp_if_flag_on:n} -% Returns true if the flag is on, false otherwise. -% \begin{macrocode} -\prg_new_conditional:Npnn \fp_if_flag_on:n #1 { p , T , F , TF } - { - \if_cs_exist:w l_@@_ #1 _flag_token \cs_end: - \prg_return_true: - \else: - \prg_return_false: - \fi: - } -% \end{macrocode} -% \end{macro} -% -% \begin{variable}[aux] +% \begin{variable} % { -% \l_@@_invalid_operation_flag_token , -% \l_@@_division_by_zero_flag_token , -% \l_@@_overflow_flag_token , -% \l_@@_underflow_flag_token , +% flag fp_invalid_operation, +% flag fp_division_by_zero, +% flag fp_overflow, +% flag fp_underflow % } -% The \textsc{ieee} standard defines five exceptions. We currently -% don't support the \enquote{inexact} exception. +% Flags to denote exceptions. % \begin{macrocode} -\cs_new_eq:NN \l_@@_invalid_operation_flag_token \tex_undefined:D -\cs_new_eq:NN \l_@@_division_by_zero_flag_token \tex_undefined:D -\cs_new_eq:NN \l_@@_overflow_flag_token \tex_undefined:D -\cs_new_eq:NN \l_@@_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 } % \end{macrocode} % \end{variable} % @@ -124,7 +92,7 @@ % % Exceptions can be trapped to obtain custom behaviour. When an invalid % operation or a division by zero is trapped, the trap receives as -% arguments the result as an $N$-type floating point number, the +% arguments the result as an |N|-type floating point number, the % function name (multiple letters for prefix operations, or a single % symbol for infix operations), and the operand(s). When an overflow or % underflow is trapped, the trap receives the resulting overly large or @@ -199,7 +167,7 @@ { #1 \@@_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 @@ -208,7 +176,7 @@ #1 \@@_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 @@ -216,7 +184,7 @@ { #1 \@@_error:nffn { invalid } {##1} {##2} { } - \fp_flag_on:n { invalid_operation } + \flag_raise:n { fp_invalid_operation } \exp_after:wN \c_nan_fp } } @@ -249,7 +217,7 @@ { #1 \@@_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 @@ -258,7 +226,7 @@ #1 \@@_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 } } @@ -321,7 +289,7 @@ { \fp_to_tl:n { \s_@@ \@@_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 } } @@ -337,7 +305,7 @@ % \@@_division_by_zero_o:Nnw, \@@_division_by_zero_o:NNww, % \@@_overflow:w , \@@_underflow:w % } -% Initialize the two control sequences (to log properly their +% Initialize the control sequences (to log properly their % existence). Then set invalid operations to trigger an error, and % division by zero, overflow, and underflow to act silently on their % flag. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx index e1ab93969d5..af5b1b478c7 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp-trig.dtx @@ -22,7 +22,7 @@ % %<*driver> \documentclass[full]{l3doc} -\GetIdInfo$Id: l3fp-trig.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp-trig.dtx 6943 2017-02-17 16:47:59Z bruno $ {L3 Floating-point trigonometric functions} \begin{document} \DocInput{\jobname.dtx} @@ -112,7 +112,7 @@ \or: \@@_case_use:nw { \@@_trig:NNNNNwn #1 \@@_sin_series_o:NNwwww - \@@_ep_to_float:wwN #3 \c_zero + \@@_ep_to_float:wwN #3 0 } \or: \@@_case_use:nw { \@@_invalid_operation_o:fw { #1 { sin } { sind } } } @@ -139,7 +139,7 @@ \or: \@@_case_use:nw { \@@_trig:NNNNNwn #1 \@@_sin_series_o:NNwwww - \@@_ep_to_float:wwN 0 \c_two + \@@_ep_to_float:wwN 0 2 } \or: \@@_case_use:nw { \@@_invalid_operation_o:fw { #1 { cos } { cosd } } } @@ -169,7 +169,7 @@ \or: \@@_case_use:nw { \@@_trig:NNNNNwn #1 \@@_sin_series_o:NNwwww - \@@_ep_inv_to_float:wwN #3 \c_zero + \@@_ep_inv_to_float:wwN #3 0 } \or: \@@_case_use:nw { \@@_invalid_operation_o:fw { #1 { csc } { cscd } } } @@ -195,7 +195,7 @@ \or: \@@_case_use:nw { \@@_trig:NNNNNwn #1 \@@_sin_series_o:NNwwww - \@@_ep_inv_to_float:wwN 0 \c_two + \@@_ep_inv_to_float:wwN 0 2 } \or: \@@_case_use:nw { \@@_invalid_operation_o:fw { #1 { sec } { secd } } } @@ -222,7 +222,7 @@ \or: \@@_case_use:nw { \@@_trig:NNNNNwn #1 - \@@_tan_series_o:NNwwww 0 #3 \c_one + \@@_tan_series_o:NNwwww 0 #3 1 } \or: \@@_case_use:nw { \@@_invalid_operation_o:fw { #1 { tan } { tand } } } @@ -252,7 +252,7 @@ \or: \@@_case_use:nw { \@@_trig:NNNNNwn #1 - \@@_tan_series_o:NNwwww 2 #3 \c_three + \@@_tan_series_o:NNwwww 2 #3 3 } \or: \@@_case_use:nw { \@@_invalid_operation_o:fw { #1 { cot } { cotd } } } @@ -306,7 +306,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 \@@_trig_large:ww \@@_trigd_large:ww \else: #1 \@@_trig_small:ww \@@_trigd_small:ww @@ -397,16 +397,16 @@ { \exp_after:wN \@@_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 \@@_trigd_large_auxii:wNw #1; #2#3; { - + (#1#2 - \c_four) / \c_nine * \c_two + + (#1#2 - 4) / 9 * 2 \exp_after:wN \@@_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 \@@_trigd_large_auxiii:www #1; #2; #3! { @@ -414,7 +414,7 @@ \exp_after:wN \@@_use_i_until_s:nw \exp_after:wN \@@_fixed_continue:wn \else: - + \c_one + + 1 \fi: \@@_fixed_sub:wwn {9000}{0000}{0000}{0000}{0000}{0000}; {#1}#2{0000}{0000}; @@ -659,11 +659,11 @@ \cs_new:Npn \@@_trig_large_auxi:wwwwww #1, #2, #3, #4! { \prg_replicate:nn {#1} { \@@_trig_large_auxii:ww } - \prg_replicate:nn { #2 - #1 * \c_eight } + \prg_replicate:nn { #2 - #1 * 8 } { \@@_trig_large_auxiii:wNNNNNNNN } - \prg_replicate:nn { #3 - #2 * \c_eight } + \prg_replicate:nn { #3 - #2 * 8 } { \@@_trig_large_auxiv:wN } - \prg_replicate:nn { \c_eight } { \@@_pack_twice_four:wNNNNNNNN } + \prg_replicate:nn { 8 } { \@@_pack_twice_four:wNNNNNNNN } \@@_trig_large_auxv:www ; } @@ -703,7 +703,7 @@ \exp_after:wN \@@_use_i_until_s:nw \exp_after:wN \@@_trig_large_auxvii:w \__int_value:w \__int_eval:w \c_@@_leading_shift_int - \prg_replicate:nn { \c_thirteen } + \prg_replicate:nn { 13 } { \@@_trig_large_auxvi:wnnnnnnnn } + \c_@@_trailing_shift_int - \c_@@_middle_shift_int \@@_use_i_until_s:nw @@ -769,7 +769,7 @@ \exp_after:wN \@@_use_i_until_s:nw \exp_after:wN \@@_trig_large_auxxi:w \__int_value:w \__int_eval:w \c_@@_leading_shift_int - \prg_replicate:nn { \c_thirteen } + \prg_replicate:nn { 13 } { \@@_trig_large_auxx:wNNNNN } + \c_@@_trailing_shift_int - \c_@@_middle_shift_int ; @@ -778,13 +778,13 @@ { \exp_after:wN \@@_trig_large_pack:NNNNNw \__int_value:w \__int_eval:w \c_@@_middle_shift_int - #2 \c_eight * #3#4#5#6 + #2 8 * #3#4#5#6 #1; #2 } \cs_new:Npn \@@_trig_large_auxxi:w #1; { \exp_after:wN \@@_ep_mul_raw:wwwwN - \__int_value:w \__int_eval:w \c_zero \@@_ep_to_ep_loop:N #1 ; ; ! + \__int_value:w \__int_eval:w 0 \@@_ep_to_ep_loop:N #1 ; ; ! 0,{7853}{9816}{3397}{4483}{0961}{5661}; \@@_trig_small:ww } @@ -832,7 +832,7 @@ \exp_after:wN \@@_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: @@ -842,7 +842,7 @@ } \cs_new:Npn \@@_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 @@ -920,7 +920,7 @@ { \exp_after:wN \@@_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: @@ -945,7 +945,7 @@ \@@_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 \@@_reverse_args:Nww \fi: \@@_ep_div:wwwwn 0, @@ -1052,7 +1052,7 @@ \cs_new:Npn \@@_atan_dispatch_o:NNnNw #1#2#3#4#5@ { \if_case:w - \__int_eval:w \@@_array_count:n {#5} - \c_one \__int_eval_end: + \__int_eval:w \@@_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 @@ -1086,13 +1086,14 @@ \if_meaning:w 3 #5 \@@_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: - \@@_case_return:nw { \@@_atan_inf_o:NNNw #1 #3 \c_two } - \or: \@@_case_return:nw { \@@_atan_inf_o:NNNw #1 #3 \c_four } - \or: \@@_case_return:nw { \@@_atan_inf_o:NNNw #1 #3 \c_zero } + \exp_stop_f: + \@@_case_return:nw { \@@_atan_inf_o:NNNw #1 #3 2 } + \or: \@@_case_return:nw { \@@_atan_inf_o:NNNw #1 #3 4 } + \or: \@@_case_return:nw { \@@_atan_inf_o:NNNw #1 #3 0 } \fi: \@@_atan_normal_o:NNnwNnw #1 \s_@@ \@@_chk:w #2#3#4; @@ -1121,7 +1122,7 @@ \exp_after:wN \@@_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_@@_one_fixed_tl ; {0000}{0000}{0000}{0000}{0000}{0000}; 0,{0000}{0000}{0000}{0000}{0000}{0000}; #1 @@ -1169,11 +1170,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 - \@@_ep_compare:wwww #2,#3; #5,#6; > \c_zero - \c_three - + \@@_ep_compare:wwww #2,#3; #5,#6; > 0 \exp_stop_f: + 3 - \exp_after:wN \@@_reverse_args:Nww \fi: \@@_atan_div:wnwwnw #2,#3; #5,#6; @@ -1204,14 +1205,14 @@ \exp_stop_f: \exp_after:wN \@@_atan_near:wwwn \fi: - \c_zero + 0 \@@_ep_div:wwwwn #1,{#2}#3; #4,{#5}#6; \@@_atan_auxi:ww } \cs_new:Npn \@@_atan_near:wwwn - \c_zero \@@_ep_div:wwwwn #1,#2; #3, + 0 \@@_ep_div:wwwwn #1,#2; #3, { - \c_one + 1 \@@_ep_to_fixed:wwn #1 - #3, #2; \@@_atan_near_aux:wwn } @@ -1258,14 +1259,14 @@ % \begin{macrocode} \cs_new:Npn \@@_atan_Taylor_loop:www #1; #2; #3; { - \if_int_compare:w #1 = - \c_one + \if_int_compare:w #1 = -1 \exp_stop_f: \@@_atan_Taylor_break:w \fi: \exp_after:wN \@@_fixed_div_int:wwN \c_@@_one_fixed_tl ; #1; \@@_rrot:www \@@_fixed_mul_sub_back:wwwn #2; #3; { \exp_after:wN \@@_atan_Taylor_loop:www - \__int_value:w \__int_eval:w #1 - \c_two ; + \__int_value:w \__int_eval:w #1 - 2 ; } #3; } @@ -1315,7 +1316,7 @@ \@@_fixed_mul:wwn #3; #4; { \exp_after:wN \@@_atan_combine_aux:ww - \__int_value:w \__int_eval:w #2 / \c_two ; #2; + \__int_value:w \__int_eval:w #2 / 2 ; #2; } } { #7 \@@_fixed_to_float:wN \@@_fixed_to_float_rad:wN } @@ -1378,7 +1379,7 @@ \cs_new:Npn \@@_acos_o:w #1 \s_@@ \@@_chk:w #2#3; @ { \if_case:w #2 \exp_stop_f: - \@@_case_use:nw { \@@_atan_inf_o:NNNw #1 0 \c_four } + \@@_case_use:nw { \@@_atan_inf_o:NNNw #1 0 4 } \or: \@@_case_use:nw { @@ -1410,7 +1411,7 @@ \cs_new:Npn \@@_asin_normal_o:NfwNnnnnw #1#2#3 \s_@@ \@@_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 \@@_use_none_until_s:w \fi: \if_int_compare:w \__int_eval:w #5 + #6#7 + #8#9 = 1000 0001 ~ @@ -1513,7 +1514,7 @@ \@@_acsc_normal_o:NfwNnw #1 { #1 { asec } { asecd } } \@@_reverse_args:Nww } - \or: \@@_case_use:nw { \@@_atan_inf_o:NNNw #1 0 \c_four } + \or: \@@_case_use:nw { \@@_atan_inf_o:NNNw #1 0 4 } \else: \@@_case_return_same_o:w \fi: \s_@@ \@@_chk:w #2 #3; @@ -1532,7 +1533,7 @@ % \begin{macrocode} \cs_new:Npn \@@_acsc_normal_o:NfwNnw #1#2#3 \s_@@ \@@_chk:w 1#4#5#6; { - \int_compare:nNnTF {#5} < \c_one + \int_compare:nNnTF {#5} < 1 { \@@_invalid_operation_o:fw {#2} \s_@@ \@@_chk:w 1#4{#5}#6; diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index ea20f8d1bc8..14b450c1320 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3fp.dtx Copyright (C) 2011-2016 The LaTeX3 Project +%% File: l3fp.dtx Copyright (C) 2011-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3fp.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3fp.dtx 6923 2017-02-14 03:07:25Z bruno $ {L3 Floating points} % %<*driver> @@ -136,12 +136,15 @@ % for higher-level commands. For example, one could provide a function % to typeset nicely the result of floating point computations. % \begin{verbatim} +% \documentclass{article} % \usepackage{xparse, siunitx} % \ExplSyntaxOn % \NewDocumentCommand { \calcnum } { m } % { \num { \fp_to_scientific:n {#1} } } % \ExplSyntaxOff +% \begin{document} % \calcnum { 2 pi * sin ( 2.3 ^ 5 ) } +% \end{document} % \end{verbatim} % % \section{Creating and initialising floating point variables} @@ -315,7 +318,7 @@ % result in (almost) the shortest possible form. Numbers in the % ranges $(0,10^{-3})$ and $[10^{16},\infty)$ are expressed in % scientific notation with trailing zeros trimmed and no decimal -% separator when there is a single significant digit (see +% separator when there is a single significant digit (this differs from % \cs{fp_to_scientific:n}). Numbers in the range $[10^{-3},10^{16})$ % are expressed in a decimal notation without exponent, with trailing % zeros trimmed, and no decimal separator for integer values (see @@ -362,7 +365,7 @@ % \texttt{true} if the \meta{relation} is obeyed. Two floating point % numbers $x$ and~$y$ may obey four mutually exclusive relations: % $xy$, or $x$ and~$y$ are not ordered. The latter -% case occurs exactly when either operand is~\nan{}, and this relation +% case occurs exactly when one or both operands is~\nan{}, and this relation % is denoted by the symbol~|?|. Note that a~\nan{} is distinct from % any value, even another~\nan{}, hence $x=x$ is not true for % a~\nan{}. To test if a value is~\nan{}, compare it to an arbitrary @@ -406,7 +409,7 @@ % computed, even if one comparison is \texttt{false}. Two floating % point numbers $x$ and~$y$ may obey four mutually exclusive % relations: $xy$, or $x$ and~$y$ are not ordered. The -% latter case occurs exactly when one of the operands is~\nan{}, and +% latter case occurs exactly when one or both operands is~\nan{}, and % this relation is denoted by the symbol~|?|. Each \meta{relation} % can be any (non-empty) combination of |<|, |=|, |>|, and~|?|, plus % an optional leading~|!| (which negates the \meta{relation}), with @@ -632,7 +635,8 @@ % % \enquote{Exceptions} may occur when performing some floating point % operations, such as \texttt{0 / 0}, or \texttt{10 ** 1e9999}. The -% \textsc{IEEE} standard defines $5$ types of exceptions. +% relevant \textsc{IEEE} standard defines $5$ types of exceptions, +% of which we implement~$4$. % \begin{itemize} % \item \emph{Overflow} occurs whenever the result of an operation is % too large to be represented as a normal floating point number. This @@ -641,68 +645,38 @@ % too close to $0$ to be represented as a normal floating point % number. This results in $\pm 0$. % \item \emph{Invalid operation} occurs for operations with no defined -% outcome, for instance $0/0$, or $\sin(\infty)$, and almost any -% operation involving a \nan{}. This normally results in a \nan{}, -% except for conversion functions whose target type does not have a -% notion of \nan{} (\emph{e.g.}, \cs{fp_to_dim:n}). +% outcome, for instance $0/0$ or $\sin(\infty)$, and results in a \nan{}. +% It also occurs for conversion functions whose target type does not +% have the appropriate infinite or \nan{} value (\emph{e.g.}, +% \cs{fp_to_dim:n}). % \item \emph{Division by zero} occurs when dividing a non-zero number -% by $0$, or when evaluating \emph{e.g.}, $\ln(0)$ or $\cot(0)$. This -% results in $\pm\infty$. -% \item \emph{Inexact} occurs whenever the result of a computation is -% not exact, in other words, almost always. At the moment, this -% exception is entirely ignored in \LaTeX3. +% by $0$, or when evaluating functions at poles, \emph{e.g.}, +% $\ln(0)$ or $\cot(0)$. This results in $\pm\infty$. +% \item [\emph{(not yet)}] \emph{Inexact} occurs whenever the result of +% a computation is not exact, in other words, almost always. At the +% moment, this exception is entirely ignored in \LaTeX3. % \end{itemize} -% To each exception is associated a \enquote{flag}, which can be either -% \emph{on} or \emph{off}. By default, the \enquote{invalid operation} -% exception triggers an (expandable) error, and raises the corresponding -% flag. Other exceptions only raise the corresponding flag. The state -% of the flag can be tested -% and modified. The behaviour when an exception occurs can be modified -% (using \cs{fp_trap:nn}) to either produce an error and turn the flag -% on, or only turn the flag on, or do nothing at all. -% -% \begin{function}[EXP, pTF, added = 2012-08-08, tested = m3fp-traps001] -% {\fp_if_flag_on:n} -% \begin{syntax} -% \cs{fp_if_flag_on_p:n} \Arg{exception} -% \cs{fp_if_flag_on:nTF} \Arg{exception} \Arg{true code} \Arg{false code} -% \end{syntax} -% Tests if the flag for the \meta{exception} is on, which normally -% means the given \meta{exception} has occurred. -% \emph{This function is experimental, and may be altered or removed.} -% \end{function} -% -% \begin{function}[added = 2012-08-08, tested = m3fp-traps001] -% {\fp_flag_off:n} -% \begin{syntax} -% \cs{fp_flag_off:n} \Arg{exception} -% \end{syntax} -% Locally turns off the flag which indicates whether the -% \meta{exception} has occurred. -% \emph{This function is experimental, and may be altered or removed.} -% \end{function} -% -% \begin{function}[EXP, added = 2012-08-08, tested = m3fp-traps001] -% {\fp_flag_on:n} -% \begin{syntax} -% \cs{fp_flag_on:n} \Arg{exception} -% \end{syntax} -% Locally turns on the flag to indicate (or pretend) that the -% \meta{exception} has occurred. Note that this function is -% expandable: it is used internally by \pkg{l3fp} to signal when -% exceptions do occur. -% \emph{This function is experimental, and may be altered or removed.} -% \end{function} -% -% \begin{function}[added = 2012-07-19, updated = 2012-08-08, +% To each exception we associate a \enquote{flag}: \texttt{fp_overflow}, +% \texttt{fp_underflow}, \texttt{fp_invalid_operation} and +% \texttt{fp_division_by_zero}. The state of these flags can be tested +% and modified with commands from \pkg{l3flag} +% +% By default, the \enquote{invalid operation} exception triggers an +% (expandable) error, and raises the corresponding flag. Other +% exceptions raise the corresponding flag but do not trigger an error. +% The behaviour when an exception occurs can be modified (using +% \cs{fp_trap:nn}) to either produce an error and raise the flag, or +% only raise the flag, or do nothing at all. +% +% \begin{function}[added = 2012-07-19, updated = 2017-02-13, % tested = m3fp-traps001]{\fp_trap:nn} % \begin{syntax} % \cs{fp_trap:nn} \Arg{exception} \Arg{trap type} % \end{syntax} -% All occurrences of the \meta{exception} (\texttt{invalid_operation}, -% \texttt{division_by_zero}, \texttt{overflow}, or \texttt{underflow}) -% within the current group are treated as \meta{trap type}, which can -% be +% All occurrences of the \meta{exception} (\texttt{overflow}, +% \texttt{underflow}, \texttt{invalid_operation} or +% \texttt{division_by_zero}) within the current +% group are treated as \meta{trap type}, which can be % \begin{itemize} % \item \texttt{none}: the \meta{exception} will be entirely % ignored, and leave no trace; @@ -715,6 +689,16 @@ % \emph{This function is experimental, and may be altered or removed.} % \end{function} % +% \begin{variable} +% { +% flag fp_overflow, +% flag fp_underflow, +% flag fp_invalid_operation, +% flag fp_division_by_zero +% } +% Flags denoting the occurrence of various floating-point exceptions. +% \end{variable} +% % \section{Viewing floating points} % % \begin{function}[added = 2012-05-08, updated = 2015-08-07, @@ -727,6 +711,16 @@ % result in the terminal. % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2015-08-07] +% {\fp_log:N, \fp_log:c, \fp_log:n} +% \begin{syntax} +% \cs{fp_log:N} \meta{fp~var} +% \cs{fp_log:n} \Arg{floating point expression} +% \end{syntax} +% Evaluates the \meta{floating point expression} and writes the +% result in the log file. +% \end{function} +% % \section{Floating point expressions} % % \subsection{Input of floating point numbers} \label{sec:l3fp:fp-floats} @@ -774,11 +768,17 @@ % replaced by $\pm\infty$), or an underflow (resulting in $\pm 0$). % % The result is thus $\pm 0$ if and only if \meta{significand} contains no -% non-zero digit (\emph{i.e.}, consists only in~|0| characters, and an -% optional |.| character), or if there is an underflow. Note that a +% non-zero digit (\emph{i.e.}, consists only in characters~|0|, and an +% optional period), or if there is an underflow. Note that a % single dot is currently a valid floating point number, equal to~$+0$, % but that is not guaranteed to remain true. % +% The \meta{significand} must be non-empty, so |e1| and |e-1| are not +% valid floating point numbers. Note that the latter could be mistaken +% with the difference of \enquote{\texttt{e}} and $1$. To avoid +% confusions, the base of natural logarithms cannot be input as |e| and +% should be input as \texttt{exp(1)} or \cs{c_e_fp}. +% % Special numbers are input as follows: % \begin{itemize} % \item \texttt{inf} represents $+\infty$, and can be preceded by any @@ -789,13 +789,6 @@ % \nan{}. % \end{itemize} % -% Note that~|e-1| is not a representation of $10^{-1}$, because it could -% be mistaken with the difference of \enquote{\texttt{e}} and $1$. This -% is consistent with several other programming languages. However, in -% order to avoid confusions, |e-1| is not considered to be this -% difference either. To input the base of natural logarithms, use -% \texttt{exp(1)} or \cs{c_e_fp}. -% % \subsection{Precedence of operators} % \label{sec:l3fp:fp-precedence} % @@ -932,11 +925,14 @@ % \end{syntax} % Raises \meta{operand_1} to the power \meta{operand_2}. This % operation is right associative, hence \texttt{2 ** 2 ** 3} equals -% $2^{2^{3}} = 256$. The \enquote{invalid operation} exception occurs -% if \meta{operand_1} is negative or $-0$, and \meta{operand_2} is not -% an integer, unless the result is zero (in that case, the sign is -% chosen arbitrarily to be $+0$). \enquote{Division by zero} occurs -% when raising $\pm 0$ to a strictly negative power. +% $2^{2^{3}} = 256$. If \meta{operand_1} is negative or $-0$ then: +% the result's sign is $+$ if the \meta{operand_2} is infinite and +% $(-1)^p$ if the \meta{operand_2} is $p/q$ with $p$ integer and $q$ +% odd; the result is $+0$ if +% |abs(|\meta{operand_1}|)^|\meta{operand_2} evaluates to zero; in +% other cases the \enquote{invalid operation} exception occurs because +% the sign cannot be determined. \enquote{Division by zero} occurs +% when raising $\pm 0$ to a finite strictly negative power. % \enquote{Underflow} and \enquote{overflow} occur when appropriate. % \end{function} % @@ -1281,7 +1277,7 @@ % \section{Disclaimer and roadmap} % % The package may break down if the escape character is among -% |0123456789_+|; if it receives a \TeX{} primitive conditional affected +% |0123456789_+|, or if it receives a \TeX{} primitive conditional affected % by \cs{exp_not:N}. % % The following need to be done. I'll try to time-order the items. @@ -1336,7 +1332,6 @@ % \item Document that \pkg{l3trial/l3fp-types} introduces tools for % adding new types. % \item In subsection~\ref{sec:l3fp:fp-floats}, write a grammar. -% \item Fix the |TWO BARS| business with the index. % \item It would be nice if the \texttt{parse} auxiliaries for each % operation were set up in the corresponding module, rather than % centralizing in \pkg{l3fp-parse}. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index cef7ea6897b..bc5675b9a9d 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3int.dtx Copyright (C) 1990-2016 The LaTeX3 Project +%% File: l3int.dtx Copyright (C) 1990-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3int.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3int.dtx 6949 2017-02-18 16:04:10Z joseph $ {L3 Integers} % %<*driver> @@ -777,11 +777,25 @@ % on the terminal. % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\int_log:N, \int_log:c} +% \begin{syntax} +% \cs{int_log:N} \meta{integer} +% \end{syntax} +% Writes the value of the \meta{integer} in the log file. +% \end{function} +% +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\int_log:n} +% \begin{syntax} +% \cs{int_log:n} \Arg{integer expression} +% \end{syntax} +% Writes the result of evaluating the \meta{integer expression} +% in the log file. +% \end{function} +% % \section{Constant integers} % % \begin{variable} % { -% \c_minus_one , % \c_zero , % \c_one , % \c_two , @@ -805,7 +819,7 @@ % \c_two_hundred_fifty_six , % \c_one_thousand , % \c_ten_thousand -% } +% } % Integer values used with primitive tests and assignments: % self-terminating nature makes these more convenient and faster than % literal numbers. @@ -999,19 +1013,11 @@ % \subsection{Integer expressions} % % \begin{macro}{\int_eval:n} -% Wrapper for \cs{@@_eval:w}. Can be used in an integer expression -% or directly in the input stream. In format mode, there is already -% a definition in \pkg{l3alloc} for bootstrapping, which is therefore -% corrected to the \enquote{real} version here. +% Wrapper for \cs{@@_eval:w}: can be used in an integer expression +% or directly in the input stream. % \begin{macrocode} -%<*initex> -\cs_set:Npn \int_eval:n #1 - { \@@_value:w \@@_eval:w #1 \@@_eval_end: } -% -%<*package> \cs_new:Npn \int_eval:n #1 { \@@_value:w \@@_eval:w #1 \@@_eval_end: } -% % \end{macrocode} % \end{macro} % @@ -1098,12 +1104,12 @@ \cs_new:Npn \@@_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 @@ -1922,13 +1928,13 @@ { \exp_args:Nf \@@_to_Base:nn { \int_eval:n {#1} } } \cs_new:Npn \@@_to_base:nn #1#2 { - \int_compare:nNnTF {#1} < \c_zero + \int_compare:nNnTF {#1} < 0 { \exp_args:No \@@_to_base:nnN { \use_none:n #1 } {#2} - } { \@@_to_base:nnN {#1} {#2} \c_empty_tl } } \cs_new:Npn \@@_to_Base:nn #1#2 { - \int_compare:nNnTF {#1} < \c_zero + \int_compare:nNnTF {#1} < 0 { \exp_args:No \@@_to_Base:nnN { \use_none:n #1 } {#2} - } { \@@_to_Base:nnN {#1} {#2} \c_empty_tl } } @@ -1996,7 +2002,7 @@ \cs_new:Npn \@@_to_letter:n #1 { \exp_after:wN \exp_after:wN - \if_case:w \@@_eval:w #1 - \c_ten \@@_eval_end: + \if_case:w \@@_eval:w #1 - 10 \@@_eval_end: a \or: b \or: c @@ -2029,7 +2035,7 @@ \cs_new:Npn \@@_to_Letter:n #1 { \exp_after:wN \exp_after:wN - \if_case:w \@@_eval:w #1 - \c_ten \@@_eval_end: + \if_case:w \@@_eval:w #1 - 10 \@@_eval_end: A \or: B \or: C @@ -2234,11 +2240,11 @@ % Wrappers around the generic function. % \begin{macrocode} \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 } } % \end{macrocode} % \end{macro} % @@ -2288,7 +2294,7 @@ \int_eval:n { ( - \c_zero + 0 \exp_after:wN \@@_from_roman:NN \tl_to_str:n {#1} \q_recursion_tail \q_recursion_tail \q_recursion_stop ) @@ -2318,7 +2324,7 @@ } } \cs_new:Npn \@@_from_roman_error:w #1 \q_recursion_stop #2 - { #2 * \c_zero - \c_one } + { #2 * 0 - 1 } % \end{macrocode} % \end{macro} % \end{macro} @@ -2328,24 +2334,14 @@ % % \begin{macro}{\int_show:N, \int_show:c} % \UnitTested -% This is very similar to other registers done using -% \cs{__kernel_register_show:N}, but differs because the variable -% |#1| may be \tn{currentgrouplevel} or \tn{currentgrouptype}, in -% which case the value must be expanded in the current scope rather -% than when processing \cs{iow_wrap:nnnN}. +% \begin{macro}[aux]{\@@_show:nN} +% Diagnostics. % \begin{macrocode} -\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 } - } - } +\cs_new_eq:NN \int_show:N \__kernel_register_show:N \cs_generate_variant:Nn \int_show:N { c } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\int_show:n} % \UnitTested @@ -2357,6 +2353,22 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\int_log:N, \int_log:c} +% Diagnostics. +% \begin{macrocode} +\cs_new_eq:NN \int_log:N \__kernel_register_log:N +\cs_generate_variant:Nn \int_log:N { c } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\int_log:n} +% Redirect output of \cs{int_show:n} to the log. +% \begin{macrocode} +\cs_new_protected:Npn \int_log:n + { \__msg_log_next: \int_show:n } +% \end{macrocode} +% \end{macro} +% % \subsection{Constant integers} % % \begin{variable}{\c_zero} @@ -2390,19 +2402,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\c_minus_one} -% The actual allocation mechanism is in \pkg{l3alloc}; it requires -% \cs{c_one} to be defined. In package mode, reuse \tn{m@ne}. -% \begin{macrocode} -%<*package> -\cs_new_eq:NN \c_minus_one \m@ne -% -%<*initex> -\int_const:Nn \c_minus_one { -1 } -% -% \end{macrocode} -% \end{variable} -% % \begin{variable}{\c_thirty_two} % One middling value. % \begin{macrocode} @@ -2469,6 +2468,21 @@ % \end{variable} % \end{variable} % +% \subsection{Deprecated} +% +% \begin{variable}[deprecated = 2018-12-31]{\c_minus_one} +% The actual allocation mechanism is in \pkg{l3alloc}; it requires +% \cs{c_one} to be defined. In package mode, reuse \tn{m@ne}. +% \begin{macrocode} +%<*package> +\cs_new_eq:NN \c_minus_one \m@ne +% +%<*initex> +\int_const:Nn \c_minus_one { -1 } +% +% \end{macrocode} +% \end{variable} +% % \begin{macrocode} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx index 202cc321018..e437fcfe1d1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3keys.dtx @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\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} % %<*driver> @@ -791,10 +791,20 @@ % \begin{syntax} % \cs{keys_show:nn} \Arg{module} \Arg{key} % \end{syntax} -% Shows the information associated to the \meta{key} for a \meta{module}, +% Displays in the terminal +% the information associated to the \meta{key} for a \meta{module}, % including the function which is used to actually implement it. % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2015-08-09]{\keys_log:nn} +% \begin{syntax} +% \cs{keys_log:nn} \Arg{module} \Arg{key} +% \end{syntax} +% Writes in the log file the information associated to the \meta{key} +% for a \meta{module}. See also \cs{keys_show:nn} which displays the +% result in the terminal. +% \end{function} +% % \section{Low-level interface for parsing key--val lists} % % To re-cap from earlier, a key--value list is input of the form @@ -2439,6 +2449,14 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\keys_log:nn} +% Redirect output of \cs{keys_show:nn} to the log. +% \begin{macrocode} +\cs_new_protected:Npn \keys_log:nn + { \__msg_log_next: \keys_show:nn } +% \end{macrocode} +% \end{macro} +% % \subsection{Messages} % % For when there is a need to complain. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx index c37e446ac83..90d9ceb11ae 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3luatex.dtx Copyright (C) 2010-2016 The LaTeX3 Project +%% File: l3luatex.dtx Copyright (C) 2010-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package&tex> -\GetIdInfo$Id: l3luatex.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3luatex.dtx 6953 2017-02-18 19:07:54Z joseph $ {L3 Experimental LuaTeX-specific functions} % %<*driver> @@ -277,96 +277,39 @@ l3kernel.charcat = charcat % \end{macrocode} % \end{macro} % -% \begin{macrocode} -% -% \end{macrocode} +% \subsection{Generic \Lua{} and font support} % % \begin{macrocode} -% +%<*initex> % \end{macrocode} % -% \subsection{Format mode code: font loader} -% +% A small amount of generic code is used by almost all \LuaTeX{} material so +% needs to be loaded by the format. % \begin{macrocode} -%<*fontloader> +attribute_count_name = "g__alloc_attribute_int" +bytecode_count_name = "g__alloc_bytecode_int" +chunkname_count_name = "g__alloc_chunkname_int" +whatsit_count_name = "g__alloc_whatsit_int" +require("ltluatex") % \end{macrocode} % -% In format mode, there needs to be a font loader available to let us -% use OpenType fonts. For testing, this is provided by -% \texttt{fontloader.lua} from the Speedata Publisher system -% (\url{https://github.com/speedata/publisher}). The code there is designed -% to be self-contained and has a certain number of build-in assumptions, -% so there is a small amount of compatibility required. -% -% The code we load looks up \texttt{texmf} tree files using -% \texttt{kpse.filelist}, which isn't part of the standard \texttt{kpse} -% library. The interface is emulated using metatable. +% With the above available the font loader code used by plain \TeX{} and +% \LaTeXe{} when used with \LuaTeX{} can be loaded here. This is thus being +% treated more-or-less as part of the engine itself. % \begin{macrocode} -kpse.filelist = setmetatable({}, { - __index = function (t, key) - return kpse.lookup(key) - end -}) +require("luaotfload-main") +local _void = luaotfload.main() % \end{macrocode} -% There is a built-in assumption in \texttt{fontloader.lua} that various -% environmental variables are set. We deal with that by intercepting the -% relevant names and returning something sane. % \begin{macrocode} -local os_getenv = os.getenv -function os.getenv (var) - if var == "SP_FONT_PATH" then return "" end - return os_getenv(var) -end +% % \end{macrocode} -% As detailed in -% \url{https://github.com/speedata/publisher/blob/develop/COPYING}, the current -% license for Speedata Publisher is \textsc{AGPLv3}. We therefore only -% load the file and use its public interfaces rather than copying/modifying -% the code itself. Note though that we do have permission to use -% \texttt{fontloader.lua} as a public domain work -% (\url{http://chat.stackexchange.com/transcript/message/27273687#27273687}): -% if we want to develop a richer loader we may want to take advantage of that -% (which also applies to the simple shaper in the related \texttt{fonts.lua} -% file). -% \begin{macrocode} -local fontloader = require("fontloader.lua") -% \end{macrocode} -% That done, register a callback which at present simply passes everything -% through. There's no attempt to pick up font settings (which presumably -% will be needed). Syntax is coerced to the same as for \XeTeX{}. +% % \begin{macrocode} -callback.register("define_font", - function (name, size, id) - local opts, opttab, otfeatures = "", { }, { } - if string.match(name, "^%[") then - name, opts = string.match(name, "^%[([^%]]*)%][^:]*:?(.*)") - end - if opts ~= "" then - for _,kv in ipairs(string.explode(opts,";")) do - if string.match(kv, "=") then - local k, v = string.match(kv, "([^=]*)=?(.*)") - opttab[k] = v - else - if string.match(kv, "^+") then - otfeatures[string.sub(kv,2,-1)] = "true" - elseif string.match(kv, "^-") then - otfeatures[string.sub(kv,2,-1)] = "false" - else - otfeatures[kv] = "true" - end - end - end - end - if next(otfeatures) then - opttab["otfeatures"] = otfeatures - end - return select(2, fontloader.define_font(name, size, opttab)) - end -) +% % \end{macrocode} % % \begin{macrocode} -% +% % \end{macrocode} % %\end{implementation} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index f44a405ac15..1c67bad74fa 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\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} % %<*driver> @@ -805,6 +805,14 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_line_context_bool} +% Controls whether the line context is shown as part of the decoration +% of all (non-expandable) messages. +% \begin{macrocode} +\bool_new:N \l_@@_line_context_bool +% \end{macrocode} +% \end{variable} +% % \subsection{Creating messages} % % Messages are created and used separately, so there two parts to @@ -1061,7 +1069,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 & @@ -1111,7 +1119,7 @@ % deliberate change by a user this is only set in format mode. % \begin{macrocode} %<*initex> -\int_gset:Nn \tex_errorcontextlines:D { - \c_one } +\int_gset:Nn \tex_errorcontextlines:D { -1 } % % \end{macrocode} % @@ -1126,11 +1134,31 @@ % A function for issuing messages: both the text and order could % in principle vary. % \begin{macrocode} -\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_@@_line_context_bool { ~ \msg_line_context: } + } +\cs_new:Npn \msg_critical_text:n #1 + { + Critical~#1~error + \bool_if:NT \l_@@_line_context_bool { ~ \msg_line_context: } + } +\cs_new:Npn \msg_error_text:n #1 + { + #1~error + \bool_if:NT \l_@@_line_context_bool { ~ \msg_line_context: } + } +\cs_new:Npn \msg_warning_text:n #1 + { + #1~warning + \bool_if:NT \l_@@_line_context_bool { ~ \msg_line_context: } + } +\cs_new:Npn \msg_info_text:n #1 + { + #1~info + \bool_if:NT \l_@@_line_context_bool { ~ \msg_line_context: } + } % \end{macrocode} % \end{macro} % @@ -1611,13 +1639,13 @@ \prop_put:cnn { l_@@_redirect_ #2 _prop } {#3} {#2} \@@_kernel_warning:nnxxxx { kernel } { message-redirect-loop } - { \seq_item:Nn \l_@@_class_loop_seq { \c_one } } - { \seq_item:Nn \l_@@_class_loop_seq { \c_two } } + { \seq_item:Nn \l_@@_class_loop_seq { 1 } } + { \seq_item:Nn \l_@@_class_loop_seq { 2 } } {#3} { \seq_map_function:NN \l_@@_class_loop_seq \@@_redirect_loop_list:n - { \seq_item:Nn \l_@@_class_loop_seq { \c_one } } + { \seq_item:Nn \l_@@_class_loop_seq { 1 } } } } { \@@_redirect_loop_chk:onn \l_@@_class_tl {#2} {#3} } @@ -1845,6 +1873,11 @@ LaTeX~has~been~asked~to~use~a~control~sequence~'#1':\\ this~has~not~been~defined~yet. } +\@@_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'. } + } \@@_kernel_new:nnnn { kernel } { empty-search-pattern } { Empty~search~pattern. } { @@ -2177,12 +2210,17 @@ % show command is called, rather than in the group created by % \cs{iow_wrap:nnnN}. This is only important for expressions % involving the \tn{currentgrouplevel} or \tn{currentgrouptype}. -% This does not lead to double expansion because the -% \texttt{x}-expansion of |#1| |{#2}| is a string in all cases where -% \cs{@@_show_wrap:Nn} is used. +% On the other hand we want the expression to be converted to a string +% with the usual escape character, hence within the wrapping code. % \begin{macrocode} \cs_new_protected:Npn \@@_show_wrap:Nn #1#2 - { \exp_args:Nx \@@_show_wrap:n { > ~ \tl_to_str:n {#2} = #1 {#2} } } + { + \exp_args:Nx \@@_show_wrap:n + { + > ~ \exp_not:n { \tl_to_str:n {#2} } = + \exp_not:N \tl_to_str:n { #1 {#2} } + } + } % \end{macrocode} % \end{macro} % @@ -2243,7 +2281,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_@@_internal_tl } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx index 3865cbf8ad5..013d5bf0546 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3names.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3names.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3names.dtx Copyright (C) 1990-2016 The LaTeX3 project +%% File: l3names.dtx Copyright (C) 1990-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3names.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3names.dtx 6962 2017-02-19 22:58:35Z joseph $ {L3 Namespace for primitives} % %<*driver> @@ -816,11 +816,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 @@ -828,13 +829,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 @@ -858,15 +862,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 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx index ddd243e7fe3..349c59adbdd 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3oldmodules.dtx @@ -21,7 +21,7 @@ % for those people who are interested. % %<*driver|oldmodules> -\def\ExplFileDate{2017/02/10} +\def\ExplFileDate{2017/03/07} % %<*driver> \documentclass[full]{l3doc} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 320c9d230e7..9ed983c9afb 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\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} % %<*driver> @@ -312,6 +312,21 @@ % terminal. % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\bool_log:N, \bool_log:c} +% \begin{syntax} +% \cs{bool_log:N} \meta{boolean} +% \end{syntax} +% Writes the logical truth of the \meta{boolean} in the log file. +% \end{function} +% +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\bool_log:n} +% \begin{syntax} +% \cs{bool_log:n} \Arg{boolean expression} +% \end{syntax} +% Writes the logical truth of the \meta{boolean expression} in the log +% file. +% \end{function} +% % \begin{function}[EXP, pTF, added=2012-03-03] % {\bool_if_exist:N, \bool_if_exist:c} % \begin{syntax} @@ -345,7 +360,7 @@ % A boolean expression is an expression which given input in the form % of predicate functions and boolean variables, return boolean % \meta{true} or \meta{false}. It supports the logical operations And, -% Or and Not as the well-known infix operators |&&|, \verb"||" and |!| +% Or and Not as the well-known infix operators |&&| and \verb"||" and prefix~|!| % with their usual precedences (namely, |&&| binds more tightly than % \verb"||"). In % addition to this, parentheses can be used to isolate @@ -849,6 +864,17 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\bool_log:N, \bool_log:c, \bool_log:n} +% Redirect output of \cs{bool_show:N} to the log. +% \begin{macrocode} +\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 } +% \end{macrocode} +% \end{macro} +% % \begin{variable}{\l_tmpa_bool, \l_tmpb_bool, \g_tmpa_bool, \g_tmpb_bool} % A few booleans just if you need them. % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index cb4deb613d7..290d45e463e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3prop.dtx Copyright (C) 1990-2016 The LaTeX3 Project +%% File: l3prop.dtx Copyright (C) 1990-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3prop.dtx 6805 2016-12-28 22:15:52Z joseph $ +\GetIdInfo$Id: l3prop.dtx 6906 2017-02-12 20:07:58Z bruno $ {L3 Property lists} % %<*driver> @@ -414,6 +414,13 @@ % Displays the entries in the \meta{property list} in the terminal. % \end{function} % +% \begin{function}[added = 2014-08-12, updated = 2015-08-01]{\prop_log:N, \prop_log:c} +% \begin{syntax} +% \cs{prop_log:N} \meta{property list} +% \end{syntax} +% Writes the entries in the \meta{property list} in the log file. +% \end{function} +% % \section{Scratch property lists} % % \begin{variable}[added = 2012-06-23]{\l_tmpa_prop, \l_tmpb_prop} @@ -1114,6 +1121,15 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\prop_log:N, \prop_log:c} +% Redirect output of \cs{prop_show:N} to the log. +% \begin{macrocode} +\cs_new_protected:Npn \prop_log:N + { \__msg_log_next: \prop_show:N } +\cs_generate_variant:Nn \prop_log:N { c } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} % % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index 2516c123615..90c38e62699 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\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} % %<*driver> @@ -206,8 +206,9 @@ % \cs{quark_if_recursion_tail_stop:N} \meta{token} % \end{syntax} % Tests if \meta{token} contains only the marker -% \cs{q_recursion_tail}, and if so terminates the recursion this is -% part of using \cs{use_none_delimit_by_q_recursion_stop:w}. The +% \cs{q_recursion_tail}, and if so uses +% \cs{use_none_delimit_by_q_recursion_stop:w} to terminate the +% recursion that this belongs to. The % recursion input must include the marker tokens \cs{q_recursion_tail} % and \cs{q_recursion_stop} as the last two items. % \end{function} @@ -218,8 +219,9 @@ % \cs{quark_if_recursion_tail_stop:n} \Arg{token list} % \end{syntax} % Tests if the \meta{token list} contains only -% \cs{q_recursion_tail}, and if so terminates the recursion this is -% part of using \cs{use_none_delimit_by_q_recursion_stop:w}. The +% \cs{q_recursion_tail}, and if so uses +% \cs{use_none_delimit_by_q_recursion_stop:w} to terminate the +% recursion that this belongs to. The % recursion input must include the marker tokens \cs{q_recursion_tail} % and \cs{q_recursion_stop} as the last two items. % \end{function} @@ -229,8 +231,9 @@ % \cs{quark_if_recursion_tail_stop_do:Nn} \meta{token} \Arg{insertion} % \end{syntax} % Tests if \meta{token} contains only the marker -% \cs{q_recursion_tail}, and if so terminates the recursion this is -% part of using \cs{use_none_delimit_by_q_recursion_stop:w}. The +% \cs{q_recursion_tail}, and if so uses +% \cs{use_none_delimit_by_q_recursion_stop:w} to terminate the +% recursion that this belongs to. The % recursion input must include the marker tokens \cs{q_recursion_tail} % and \cs{q_recursion_stop} as the last two items. The \meta{insertion} % code is then added to the input stream after the recursion has @@ -243,8 +246,9 @@ % \cs{quark_if_recursion_tail_stop_do:nn} \Arg{token list} \Arg{insertion} % \end{syntax} % Tests if the \meta{token list} contains only -% \cs{q_recursion_tail}, and if so terminates the recursion this is -% part of using \cs{use_none_delimit_by_q_recursion_stop:w}. The +% \cs{q_recursion_tail}, and if so uses +% \cs{use_none_delimit_by_q_recursion_stop:w} to terminate the +% recursion that this belongs to. The % recursion input must include the marker tokens \cs{q_recursion_tail} % and \cs{q_recursion_stop} as the last two items. The \meta{insertion} % code is then added to the input stream after the recursion has @@ -505,7 +509,7 @@ % a string like |aabc| instead of a single token.\footnote{It may % still loop in special circumstances however!} % \begin{macrocode} -\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: @@ -513,7 +517,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: @@ -549,13 +553,13 @@ % second case, the result is not empty since the first~|?!| in the % definition of \cs{quark_if_nil:n} stop~|#3|. % \begin{macrocode} -\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 { \@@_if_nil:w {} #1 {} ? ! \q_nil ? ? ! } } \cs_new:Npn \@@_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 { \@@_if_no_value:w {} #1 {} ? ! \q_no_value ? ? ! } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index dbc4e4dd295..b78874e1227 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\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} % %<*driver> @@ -858,6 +858,13 @@ % Displays the entries in the \meta{sequence} in the terminal. % \end{function} % +% \begin{function}[added = 2014-08-12, updated = 2015-08-01]{\seq_log:N, \seq_log:c} +% \begin{syntax} +% \cs{seq_log:N} \meta{sequence} +% \end{syntax} +% Writes the entries in the \meta{sequence} in the log file. +% \end{function} +% % \section{Internal sequence functions} % % \begin{variable}{\s__seq} @@ -1703,14 +1710,14 @@ } \cs_new:Npn \@@_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 \@@_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 \@@_item:nnn { \int_eval:n { #1 - 1 } } } } @@ -1856,7 +1863,7 @@ \seq_map_function:NN #1 \@@_count:n } } -\cs_new:Npn \@@_count:n #1 { + \c_one } +\cs_new:Npn \@@_count:n #1 { + 1 } \cs_generate_variant:Nn \seq_count:N { c } % \end{macrocode} % \end{macro} @@ -2007,6 +2014,15 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\seq_log:N, \seq_log:c} +% Redirect output of \cs{seq_show:N} to the log. +% \begin{macrocode} +\cs_new_protected:Npn \seq_log:N + { \__msg_log_next: \seq_show:N } +\cs_generate_variant:Nn \seq_log:N { c } +% \end{macrocode} +% \end{macro} +% % \subsection{Scratch sequences} % % \begin{variable}{\l_tmpa_seq, \l_tmpb_seq, \g_tmpa_seq, \g_tmpb_seq} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index 838657d7950..8bc399e2d24 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % %% File: l3skip.dtx Copyright (C) 2004-2011 Frank Mittelbach, The LaTeX3 Project -%% (C) 2012-2016 The LaTeX3 Project +%% (C) 2012-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 @@ -25,7 +25,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3skip.dtx 6809 2017-01-01 06:33:13Z bruno $ +\GetIdInfo$Id: l3skip.dtx 6968 2017-02-20 16:08:44Z bruno $ {L3 Dimensions and skips} % %<*driver> @@ -525,6 +525,21 @@ % on the terminal. % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\dim_log:N, \dim_log:c} +% \begin{syntax} +% \cs{dim_log:N} \meta{dimension} +% \end{syntax} +% Writes the value of the \meta{dimension} in the log file. +% \end{function} +% +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\dim_log:n} +% \begin{syntax} +% \cs{dim_log:n} \Arg{dimension expression} +% \end{syntax} +% Writes the result of evaluating the \meta{dimension expression} +% in the log file. +% \end{function} +% % \section{Constant dimensions} % % \begin{variable}{\c_max_dim} @@ -700,7 +715,7 @@ % % \section{Viewing \texttt{skip} variables} % -% \begin{function}{\skip_show:N, \skip_show:c} +% \begin{function}[updated = 2015-08-03]{\skip_show:N, \skip_show:c} % \begin{syntax} % \cs{skip_show:N} \meta{skip} % \end{syntax} @@ -715,6 +730,21 @@ % on the terminal. % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\skip_log:N, \skip_log:c} +% \begin{syntax} +% \cs{skip_log:N} \meta{skip} +% \end{syntax} +% Writes the value of the \meta{skip} in the log file. +% \end{function} +% +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\skip_log:n} +% \begin{syntax} +% \cs{skip_log:n} \Arg{skip expression} +% \end{syntax} +% Writes the result of evaluating the \meta{skip expression} +% in the log file. +% \end{function} +% % \section{Constant skips} % % \begin{variable}[updated = 2012-11-02]{\c_max_skip} @@ -897,7 +927,7 @@ % % \section{Viewing \texttt{muskip} variables} % -% \begin{function}{\muskip_show:N, \muskip_show:c} +% \begin{function}[updated = 2015-08-03]{\muskip_show:N, \muskip_show:c} % \begin{syntax} % \cs{muskip_show:N} \meta{muskip} % \end{syntax} @@ -912,6 +942,21 @@ % on the terminal. % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2015-08-03]{\muskip_log:N, \muskip_log:c} +% \begin{syntax} +% \cs{muskip_log:N} \meta{muskip} +% \end{syntax} +% Writes the value of the \meta{muskip} in the log file. +% \end{function} +% +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\muskip_log:n} +% \begin{syntax} +% \cs{muskip_log:n} \Arg{muskip expression} +% \end{syntax} +% Writes the result of evaluating the \meta{muskip expression} +% in the log file. +% \end{function} +% % \section{Constant muskips} % % \begin{variable}{\c_max_muskip} @@ -1425,7 +1470,7 @@ ##1 . ##2 \tl_to_str:n { pt } } { - \int_compare:nNnTF {#2} > \c_zero + \int_compare:nNnTF {#2} > { 0 } { #1 . #2 } { #1 } } @@ -1492,6 +1537,16 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\dim_log:N, \dim_log:c, \dim_log:n} +% Diagnostics. Redirect output of \cs{dim_show:n} to the log. +% \begin{macrocode} +\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 } +% \end{macrocode} +% \end{macro} +% % \subsection{Constant dimensions} % % \begin{variable}{\c_zero_dim, \c_max_dim} @@ -1644,7 +1699,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: @@ -1734,6 +1789,16 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\skip_log:N, \skip_log:c, \skip_log:n} +% Diagnostics. Redirect output of \cs{skip_show:n} to the log. +% \begin{macrocode} +\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 } +% \end{macrocode} +% \end{macro} +% % \subsection{Constant skips} % % \begin{macro}{\c_zero_skip, \c_max_skip} @@ -1924,6 +1989,16 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\muskip_log:N, \muskip_log:c, \muskip_log:n} +% Diagnostics. Redirect output of \cs{muskip_show:n} to the log. +% \begin{macrocode} +\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 } +% \end{macrocode} +% \end{macro} +% % \subsection{Constant muskips} % % \begin{macro}{\c_zero_muskip} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx index 265ae84fc05..5307712d1c4 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\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} % %<*driver> @@ -199,26 +199,26 @@ \cs_new_protected:Npn \@@_shrink_range: { \int_set:Nn \l_@@_A_int - { \l_@@_true_max_int - \l_@@_min_int + \c_one } - \int_set:Nn \l_@@_block_int { \c_max_register_int / \c_two } + { \l_@@_true_max_int - \l_@@_min_int + 1 } + \int_set:Nn \l_@@_block_int { \c_max_register_int / 2 } \@@_shrink_range_loop: \int_set:Nn \l_@@_max_int { \int_compare:nNnTF - { \l_@@_block_int * \c_three / \c_two } > \l_@@_A_int + { \l_@@_block_int * 3 / 2 } > \l_@@_A_int { \l_@@_min_int - + ( \l_@@_A_int - \c_one ) / \c_two - + \l_@@_block_int / \c_four - - \c_one + + ( \l_@@_A_int - 1 ) / 2 + + \l_@@_block_int / 4 + - 1 } - { \l_@@_true_max_int - \l_@@_block_int / \c_two } + { \l_@@_true_max_int - \l_@@_block_int / 2 } } } \cs_new_protected:Npn \@@_shrink_range_loop: { \if_int_compare:w \l_@@_A_int < \l_@@_block_int - \tex_divide:D \l_@@_block_int \c_two + \tex_divide:D \l_@@_block_int 2 \exp_stop_f: \exp_after:wN \@@_shrink_range_loop: \fi: } @@ -251,8 +251,8 @@ %<*package> \cs_new_protected:Npn \@@_compute_range: { - \int_set:Nn \l_@@_min_int { \tex_count:D 15 + \c_one } - \int_set:Nn \l_@@_true_max_int { \c_max_register_int + \c_one } + \int_set:Nn \l_@@_min_int { \tex_count:D 15 + 1 } + \int_set:Nn \l_@@_true_max_int { \c_max_register_int + 1 } \@@_shrink_range: \if_meaning:w \loctoks \tex_undefined:D \else: \if_meaning:w \loctoks \scan_stop: \else: @@ -288,8 +288,8 @@ { \cs_gset_protected:Npn \@@_compute_range: { - \int_set:Nn \l_@@_min_int { #1 + \c_one } - \int_set:Nn \l_@@_true_max_int { \c_max_register_int + \c_one } + \int_set:Nn \l_@@_min_int { #1 + 1 } + \int_set:Nn \l_@@_true_max_int { \c_max_register_int + 1 } \@@_shrink_range: } } @@ -300,9 +300,9 @@ { ( \c_max_register_int + 1 ) * 3 / 4 } \cs_new_protected:Npn \@@_compute_range: { - \int_set_eq:NN \l_@@_min_int \c_zero - \int_set:Nn \l_@@_true_max_int { \c_max_register_int + \c_one } - \int_set_eq:NN \l_@@_max_int \c_@@_max_length_int + \int_set:Nn \l_@@_min_int { 0 } + \int_set:Nn \l_@@_true_max_int { \c_max_register_int + 1 } + \int_set:Nn \l_@@_max_int { \c_@@_max_length_int } } % % \end{macrocode} @@ -335,12 +335,12 @@ \@@_too_long_error:NNw #3 #5 \fi: \tex_toks:D \l_@@_top_int {##1} - \tex_advance:D \l_@@_top_int \c_one + \int_incr:N \l_@@_top_int } \int_set:Nn \l_@@_length_int { \l_@@_top_int - \l_@@_min_int } \cs_set:Npn \@@_compare:nn ##1 ##2 { #6 } - \int_set_eq:NN \l_@@_block_int \c_one + \int_set:Nn \l_@@_block_int { 1 } \@@_level: \use:x { @@ -464,7 +464,7 @@ \if_int_compare:w #3 < \l_@@_top_int #1 #2 { \tex_the:D \tex_toks:D #3 } \exp_after:wN \@@_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: } % \end{macrocode} @@ -522,9 +522,9 @@ \l_@@_B_int \l_@@_A_int \l_@@_C_int \l_@@_top_int \@@_copy_block: - \tex_advance:D \l_@@_A_int - \c_one - \tex_advance:D \l_@@_B_int - \c_one - \tex_advance:D \l_@@_C_int - \c_one + \int_decr:N \l_@@_A_int + \int_decr:N \l_@@_B_int + \int_decr:N \l_@@_C_int \exp_after:wN \@@_merge_blocks_aux: \exp_after:wN \@@_merge_blocks: \fi: @@ -542,8 +542,8 @@ \cs_new_protected:Npn \@@_copy_block: { \tex_toks:D \l_@@_C_int \tex_toks:D \l_@@_B_int - \tex_advance:D \l_@@_C_int \c_one - \tex_advance:D \l_@@_B_int \c_one + \int_incr:N \l_@@_C_int + \int_incr:N \l_@@_B_int \if_int_compare:w \l_@@_B_int = \l_@@_end_int \use_i:nn \fi: @@ -621,8 +621,8 @@ \cs_new_protected:Npn \@@_return_same: { \tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_C_int - \tex_advance:D \l_@@_B_int - \c_one - \tex_advance:D \l_@@_C_int - \c_one + \int_decr:N \l_@@_B_int + \int_decr:N \l_@@_C_int \if_int_compare:w \l_@@_C_int < \l_@@_top_int \use_i:nn \fi: @@ -645,8 +645,8 @@ \cs_new_protected:Npn \@@_return_swapped: { \tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_A_int - \tex_advance:D \l_@@_B_int - \c_one - \tex_advance:D \l_@@_A_int - \c_one + \int_decr:N \l_@@_B_int + \int_decr:N \l_@@_A_int \if_int_compare:w \l_@@_A_int < \l_@@_begin_int \@@_merge_blocks_end: \use_i:nn \fi: @@ -665,8 +665,8 @@ \cs_new_protected:Npn \@@_merge_blocks_end: { \tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_C_int - \tex_advance:D \l_@@_B_int - \c_one - \tex_advance:D \l_@@_C_int - \c_one + \int_decr:N \l_@@_B_int + \int_decr:N \l_@@_C_int \if_int_compare:w \l_@@_B_int < \l_@@_begin_int \use_i:nn \fi: @@ -1086,8 +1086,24 @@ % \begin{macro}[deprecated = 2018-12-31]{\sort_ordered:, \sort_reversed:} % These functions were renamed for consistency. % \begin{macrocode} -\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: + } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx index ea75d3e69d1..ef628bab6a3 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3str.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3str.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3str.dtx Copyright (C) 2011-2016 The LaTeX3 Project +%% File: l3str.dtx Copyright (C) 2011-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3str.dtx 6809 2017-01-01 06:33:13Z bruno $ +\GetIdInfo$Id: l3str.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Strings} % %<*driver> @@ -612,6 +612,15 @@ % time quadratic in the character count of the string. % \end{function} % +% \begin{function}[rEXP]{\__str_to_other_fast:n} +% \begin{syntax} +% \cs{__str_to_other_fast:n} \Arg{token list} +% \end{syntax} +% Same behaviour \cs{__str_to_other:n} but only restricted-expandable. +% It takes a time linear in the character count of the string. +% It is used for \cs{iow_wrap:nnnN}. +% \end{function} +% % \begin{function}[EXP]{\__str_count:n} % \begin{syntax} % \cs{__str_count:n} \Arg{other string} @@ -802,7 +811,7 @@ % \begin{macrocode} \cs_new:Npn \@@_if_eq_x_return:nn #1 #2 { - \if_int_compare:w \@@_if_eq_x:nn {#1} {#2} = \c_zero + \if_int_compare:w \@@_if_eq_x:nn {#1} {#2} = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: @@ -826,7 +835,7 @@ { \if_int_compare:w \@@_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 } @@ -839,7 +848,7 @@ \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 \@@_if_eq_x:nn {#1} {#2} = \c_zero + \if_int_compare:w \@@_if_eq_x:nn {#1} {#2} = 0 \exp_stop_f: \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} @@ -853,7 +862,7 @@ \prg_new_conditional:Npnn \str_if_eq:NN #1#2 { p , TF , T , F } { \if_int_compare:w \@@_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 } @@ -976,6 +985,38 @@ % \end{macro} % \end{macro} % +% \begin{macro}[rEXP, int]{\@@_to_other_fast:n} +% \begin{macro}[rEXP, aux]{\@@_to_other_fast_loop:w, \@@_to_other_fast_end:w} +% The difference with \cs{@@_to_other:n} is that the converted part is +% left in the input stream, making these commands only +% restricted-expandable. +% \begin{macrocode} +\cs_new:Npn \@@_to_other_fast:n #1 + { + \exp_after:wN \@@_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 \@@_to_other_fast_loop:w + #1 ~ #2 ~ #3 ~ #4 ~ #5 ~ #6 ~ #7 ~ #8 ~ #9 ~ + { + \if_meaning:w A #9 + \@@_to_other_fast_end:w + \fi: + #1 * #2 * #3 * #4 * #5 * #6 * #7 * #8 * #9 + \@@_to_other_fast_loop:w * + } + \cs_new:Npn \@@_to_other_fast_end:w #1 * A #2 \q_stop {#1} + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}[EXP] % {\str_item:Nn, \str_item:cn, \str_item:nn, \str_item_ignore_spaces:nn} % \begin{macro}[EXP, aux]{\@@_item:nn, \@@_item:w} @@ -1017,7 +1058,7 @@ } \cs_new:Npn \@@_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 } @@ -1059,7 +1100,7 @@ % \begin{macrocode} \cs_new:Npn \@@_skip_exp_end:w #1; { - \if_int_compare:w #1 > \c_eight + \if_int_compare:w #1 > 8 \exp_stop_f: \exp_after:wN \@@_skip_loop:wNNNNNNNN \else: \exp_after:wN \@@_skip_end:w @@ -1068,7 +1109,7 @@ #1 ; } \cs_new:Npn \@@_skip_loop:wNNNNNNNN #1; #2#3#4#5#6#7#8#9 - { \exp_after:wN \@@_skip_exp_end:w \__int_value:w \__int_eval:w #1 - \c_eight ; } + { \exp_after:wN \@@_skip_exp_end:w \__int_value:w \__int_eval:w #1 - 8 ; } \cs_new:Npn \@@_skip_end:w #1 ; { \exp_after:wN \@@_skip_end:NNNNNNNN @@ -1108,7 +1149,7 @@ { \exp_after:wN \@@_range:w \__int_value:w \@@_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 } @@ -1140,11 +1181,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: @@ -1177,7 +1218,7 @@ { \@@_collect_loop:wn #1 ; { } } \cs_new:Npn \@@_collect_loop:wn #1 ; { - \if_int_compare:w #1 > \c_seven + \if_int_compare:w #1 > 7 \exp_stop_f: \exp_after:wN \@@_collect_loop:wnNNNNNNN \else: \exp_after:wN \@@_collect_end:wn @@ -1187,13 +1228,13 @@ \cs_new:Npn \@@_collect_loop:wnNNNNNNN #1; #2 #3#4#5#6#7#8#9 { \exp_after:wN \@@_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 \@@_collect_end:wn #1 ; { \exp_after:wN \@@_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 \@@_collect_end:nnnnnnnnw #1#2#3#4#5#6#7#8 #9 \q_stop @@ -1231,7 +1272,7 @@ \if_meaning:w X #9 \use_i_delimit_by_q_stop:nw \fi: - \c_nine + \@@_count_spaces_loop:w + 9 + \@@_count_spaces_loop:w } % \end{macrocode} % \end{macro} @@ -1280,9 +1321,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 } } @@ -1291,7 +1332,7 @@ \if_meaning:w X #9 \exp_after:wN \use_none_delimit_by_q_stop:w \fi: - \c_nine + \@@_count_loop:NNNNNNNNN + 9 + \@@_count_loop:NNNNNNNNN } % \end{macrocode} % \end{macro} @@ -1561,7 +1602,7 @@ % \LaTeXe{} and Con\TeX{}t MkII and MkIV). % \begin{macrocode} %<*initex> - \tex_chardef:D \g_@@_data_ior \c_zero + \tex_chardef:D \g_@@_data_ior = 0 \scan_stop: % %<*package> \tex_chardef:D \g_@@_data_ior @@ -1624,7 +1665,7 @@ \@@_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 \@@_parse:w ##1 \q_stop { } \fi: \fi: @@ -1658,7 +1699,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_@@_title_ \utex_char:D "#1 _tl } @@ -1675,7 +1716,7 @@ % \begin{macrocode} \cs_set_protected:Npn \@@_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 @@ -1683,7 +1724,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: \@@_parse_auxii:w #1 ~ #3 ~ \q_stop \fi: \fi: @@ -1699,7 +1740,7 @@ { \use:n { \@@_parse_auxii:w #1 ~ lower ~ #2 ~ } ~ \q_stop \use:n { \@@_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 { \@@_parse_auxii:w #1 ~ title ~ #3 ~ } ~ \q_stop \fi: diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx index faca036fc44..a664fbd67da 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sys.dtx @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\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} % %<*driver> @@ -84,7 +84,7 @@ % \end{texnote} % \end{variable} % -% \subsection{Engine} +% \section{Engine} % % \begin{function}[added = 2015-09-07, EXP, pTF] % { @@ -110,7 +110,7 @@ % |luatex|, |pdftex|, |ptex|, |uptex| or |xetex|. % \end{variable} % -% \subsection{Output format} +% \section{Output format} % % \begin{function}[added = 2015-09-19, EXP, pTF] % { @@ -268,11 +268,8 @@ % \begin{variable}{\c_sys_output_str} % This is a simple enough concept: the two views here are complementary. % \begin{macrocode} -\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 diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 1acb5e14625..d3bffb0668a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%% File: l3tl.dtx Copyright (C) 1990-2016 The LaTeX3 Project +%% File: l3tl.dtx Copyright (C) 1990-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 @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\GetIdInfo$Id: l3tl.dtx 6842 2017-02-06 21:51:22Z joseph $ +\GetIdInfo$Id: l3tl.dtx 6967 2017-02-20 14:51:30Z bruno $ {L3 Token lists} % %<*driver> @@ -1021,6 +1021,22 @@ % \end{texnote} % \end{function} % +% \begin{function}[added = 2014-08-22, updated = 2015-08-01]{\tl_log:N, \tl_log:c} +% \begin{syntax} +% \cs{tl_log:N} \meta{tl~var} +% \end{syntax} +% Writes the content of the \meta{tl~var} in the log file. See also +% \cs{tl_show:N} which displays the result in the terminal. +% \end{function} +% +% \begin{function}[added = 2014-08-22, updated = 2015-08-07]{\tl_log:n} +% \begin{syntax} +% \cs{tl_log:n} \Arg{token list} +% \end{syntax} +% Writes the \meta{token list} in the log file. See also +% \cs{tl_show:n} which displays the result in the terminal. +% \end{function} +% % \section{Constant token lists} % % \begin{variable}{\c_empty_tl} @@ -1473,7 +1489,7 @@ \group_begin: \exp_args:No \etex_everyeof:D { \c_@@_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 \@@_set_rescan:n { \tl_to_str:n {#4} } @@ -1570,7 +1586,7 @@ \tex_catcode:D `\^^@ = 12 \scan_stop: \cs_new_protected:Npn \@@_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 } @@ -1585,7 +1601,7 @@ \cs_new_protected:Npn \@@_set_rescan_single:nn #1 { \int_compare:nNnTF - { \char_value_catcode:n { `#1 } / \c_three } = \c_four + { \char_value_catcode:n { `#1 } / 3 } = 4 { \@@_set_rescan_single_aux:nn {#1} } { \int_compare:nNnTF { `#1 } < { `\~ } @@ -1598,7 +1614,7 @@ } \cs_new_protected:Npn \@@_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 @@ -1618,7 +1634,7 @@ \char_value_catcode:n { \exp_last_unbraced:Nf ` \str_head:n {#2} ~ } } - = \c_ten { ~ } + = { 10 } { ~ } \exp_after:wN \@@_rescan:w \exp_after:wN \prg_do_nothing: \etex_scantokens:D { #2 #1 } @@ -2309,7 +2325,7 @@ \int_eval:n { 0 \tl_map_function:NN #1 \@@_count:n } } -\cs_new:Npn \@@_count:n #1 { + \c_one } +\cs_new:Npn \@@_count:n #1 { + 1 } \cs_generate_variant:Nn \tl_count:n { V , o } \cs_generate_variant:Nn \tl_count:N { c } % \end{macrocode} @@ -2897,14 +2913,14 @@ } \cs_new:Npn \@@_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 \@@_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 \@@_item:nn { \int_eval:n { #1 - 1 } } } } @@ -2941,6 +2957,17 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\tl_log:N, \tl_log:c, \tl_log:n} +% Redirect output of \cs{tl_show:N} and \cs{tl_show:n} to the log. +% \begin{macrocode} +\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 } +% \end{macrocode} +% \end{macro} +% % \subsection{Scratch token lists} % % \begin{variable}{\g_tmpa_tl, \g_tmpb_tl} @@ -2970,9 +2997,23 @@ % For removal after 2017-12-31. % \begin{macrocode} \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} } + { + \__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} + } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx index 34bdf48ad68..cfae476c2df 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3token.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3token.dtx @@ -24,7 +24,7 @@ \documentclass[full]{l3doc} % %<*driver|package> -\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} % %<*driver> @@ -1174,37 +1174,37 @@ % } % \begin{macrocode} \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 } } % \end{macrocode} % \end{macro} % @@ -1229,37 +1229,37 @@ % } % \begin{macrocode} \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 } } % \end{macrocode} % \end{macro} % @@ -1418,26 +1418,26 @@ % \begin{macrocode} \cs_new:Npn \@@_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_@@_max_int 1 \fi: \exp_stop_f: \__msg_kernel_expandable_error:nn { kernel } { char-out-of-range } @@ -1885,7 +1885,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: diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx index 9c895dd3b24..4217a5917b6 100644 --- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx +++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx @@ -23,8 +23,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\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} @@ -38,8 +38,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} % %<*driver> \documentclass[full]{l3doc} diff --git a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx new file mode 100644 index 00000000000..46d1becb514 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.dtx @@ -0,0 +1,167 @@ +% \iffalse meta-comment +% +%% File: xfp.dtx (C) Copyright 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. +% +% ----------------------------------------------------------------------- +% +% The development version of the bundle can be found at +% +% https://github.com/latex3/latex3 +% +% for those people who are interested. +% +%<*driver|package> +% The version of expl3 required is tested as early as possible, as +% some really old versions do not define \ProvidesExplPackage. +\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} +% +%<*driver> +\documentclass[full]{l3doc} +\usepackage{amstext} +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +% +% \fi +% +% \providecommand\nan{\texttt{NaN}} +% +% \title{^^A +% The \textsf{xfp} package\\Floating Point Unit^^A +% \thanks{This file describes v\ExplFileVersion, +% last revised \ExplFileDate.}^^A +% } +% +% \author{^^A +% The \LaTeX3 Project\thanks +% {^^A +% E-mail: +% \href{mailto:latex-team@latex-project.org} +% {latex-team@latex-project.org}^^A +% }^^A +% } +% +% \date{Released \ExplFileDate} +% +% \maketitle +% +% \begin{documentation} +% +% This package provides a \LaTeXe{} document-level interface to the \LaTeX{}3 +% floating point unit (part of \pkg{expl3}). +% +% \begin{function}[EXP]{\fpeval} +% The expandable command \cs{fpeval} takes as it's argument a floating +% point expression and will produce a result using the normal rules of +% mathematics. As this command is expandable it can be used where \TeX{} +% requires a number and for example within a low-level \cs{edef} operation +% to give a purely numerical result. +% \end{function} +% +% Briefly, the floating point expressions may comprise: +% \begin{itemize} +% \item Basic arithmetic: addition $x+y$, subtraction $x-y$, +% multiplication $x*y$, division $x/y$, square root~$\sqrt{x}$, +% and parentheses. +% \item Comparison operators: $x\mathop{\mathtt{<}}y$, +% $x\mathop{\mathtt{<=}}y$, $x\mathop{\mathtt{>?}}y$, +% $x\mathop{\mathtt{!=}}y$ \emph{etc.} +% \item Boolean logic: negation $\mathop{!}x$, conjunction +% $x\mathop{\&\&}y$, disjunction $x\mathop{\vert\vert}y$, ternary +% operator $x\mathop{?}y\mathop{:}z$. +% \item Exponentials: $\exp x$, $\ln x$, $x^y$. +% \item Trigonometry: $\sin x$, $\cos x$, $\tan x$, $\cot x$, $\sec +% x$, $\csc x$ expecting their arguments in radians, and +% $\operatorname{sind} x$, $\operatorname{cosd} x$, +% $\operatorname{tand} x$, $\operatorname{cotd} x$, +% $\operatorname{secd} x$, $\operatorname{cscd} x$ expecting their +% arguments in degrees. +% \item Inverse trigonometric functions: $\operatorname{asin} x$, +% $\operatorname{acos} x$, $\operatorname{atan} x$, +% $\operatorname{acot} x$, $\operatorname{asec} x$, +% $\operatorname{acsc} x$ giving a result in radians, and +% $\operatorname{asind} x$, $\operatorname{acosd} x$, +% $\operatorname{atand} x$, $\operatorname{acotd} x$, +% $\operatorname{asecd} x$, $\operatorname{acscd} x$ giving a result +% in degrees. +% \item Extrema: $\max(x,y,\ldots)$, $\min(x,y,\ldots)$, +% $\operatorname{abs}(x)$. +% \item Rounding functions ($n=0$ by default, $t=\nan$ by default): +% $\operatorname{trunc}(x,n)$ rounds towards zero, +% $\operatorname{floor}(x,n)$ rounds towards~$-\infty$, +% $\operatorname{ceil}(x,n)$ rounds towards~$+\infty$, +% $\operatorname{round}(x,n,t)$ rounds to the closest value, with +% ties rounded to an even value by default, towards zero if $t=0$, +% towards $+\infty$ if $t>0$ and towards $-\infty$ if $t<0$. +% \item Random numbers: $\mathop{rand}()$, $\mathop{randint}(m,n)$ (requires +% \pdfTeX{} or \LuaTeX{}). +% \item Constants: \texttt{pi}, \texttt{deg} (one degree in radians). +% \item Dimensions, automatically expressed in points, \emph{e.g.}, +% \texttt{pc} is~$12$. +% \item Automatic conversion (no need for \cs{number} of +% integer, dimension, and skip variables to floating points, +% expressing dimensions in points and ignoring the stretch and +% shrink components of skips. +% \end{itemize} +% +% An example of use could be the following. +% \begin{verbatim} +% \LaTeX{} can now compute: $ \frac{\sin (3.5)}{2} + 2\cdot 10^{-3} +% = \fpeval{sin 3.5 /2 + 2e-3} $. +% \end{verbatim} +% +% \end{documentation} +% +% \begin{implementation} +% +% \section{\pkg{xfpu} implementation} +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macrocode} +\ProvidesExplPackage + {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} +% \end{macrocode} +% +% \begin{macro}{\fpeval} +% A document level wrapper around the code level function. +% \begin{macrocode} +\NewExpandableDocumentCommand \fpeval { m } { \fp_eval:n {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \end{implementation} +% +% \PrintIndex diff --git a/Master/texmf-dist/source/latex/l3packages/xfp/xfp.ins b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.ins new file mode 100644 index 00000000000..421df85cb02 --- /dev/null +++ b/Master/texmf-dist/source/latex/l3packages/xfp/xfp.ins @@ -0,0 +1,45 @@ +\iffalse meta-comment + +File xfp.ins 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. + +The released version of this bundle is available from CTAN. + +\fi + +\input l3docstrip.tex +\askforoverwritefalse + +\preamble + +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. + +\endpreamble +% stop docstrip adding \endinput +\postamble +\endpostamble + +\keepsilent + +\generate{\file{xfp.sty}{\from{xfp.dtx}{package}}} + +\endbatchfile diff --git a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx index 2d01dd37e08..d593178b19a 100644 --- a/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xfrac/xfrac.dtx @@ -24,8 +24,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\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} @@ -40,8 +40,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} % %<*driver> \documentclass[full]{l3doc} diff --git a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx index 768a9a317a5..353aba233b0 100644 --- a/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xparse/xparse.dtx @@ -27,8 +27,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\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} @@ -42,8 +42,8 @@ % } \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} % %<*driver> \documentclass[full]{l3doc} @@ -91,16 +91,20 @@ % At present, the functions in \pkg{xparse} which are regarded as % \enquote{stable} are: % \begin{itemize} -% \item \cs{DeclareDocumentCommand} % \item \cs{NewDocumentCommand} % \item \cs{RenewDocumentCommand} % \item \cs{ProvideDocumentCommand} -% \item \cs{DeclareDocumentEnvironment} +% \item \cs{DeclareDocumentCommand} % \item \cs{NewDocumentEnvironment} % \item \cs{RenewDocumentEnvironment} % \item \cs{ProvideDocumentEnvironment} +% \item \cs{DeclareDocumentEnvironment} +% \item \cs{NewExpandableDocumentCommand} +% \item \cs{RenewExpandableDocumentCommand} +% \item \cs{ProvideExpandableDocumentCommand} % \item \cs{DeclareExpandableDocumentCommand} % \item \cs{IfNoValue(TF)} +% \item \cs{IfValue(TF)} % \item \cs{IfBoolean(TF)} % \end{itemize} % with the other functions currently regarded as \enquote{experimental}. Please @@ -185,7 +189,7 @@ % \emph{value}. If a key is not present, |-NoValue-| is returned. % The returned data is a token list comprising one braced entry per key, % ordered as for the key list in the argument specification. Given as -% \texttt{e}\marg{tokens}. +% \texttt{e}\marg{tokens}. All \meta{tokens} must be distinct. % \emph{This is an experimental type}. % \item[E] As for \texttt{e} but returns one or more \meta{defaults} % if values are not given: \texttt{E}\marg{tokens}\marg{defaults}. See @@ -215,7 +219,7 @@ % defined such that they require matched pairs of delimiters when collecting % an argument. For example % \begin{verbatim} -% \DeclareDocumentCommand{\foo}{o}{#1} +% \NewDocumentCommand{\foo}{o}{#1} % \foo[[content]] % #1 = "[content]" % \foo[[] % Error: missing closing "]" % \end{verbatim} @@ -226,15 +230,15 @@ % Within delimited arguments, non-balanced or otherwise awkward tokens may % be included by protecting the entire argument with a brace pair % \begin{verbatim} -% \DeclareDocumentCommand{\foo}{o}{#1} -% \foo[{[}] % Allowed as the "[" is 'hidden' +% \NewDocumentCommand{\foobar}{o}{#1} +% \foobar[{[}] % Allowed as the "[" is 'hidden' % \end{verbatim} % These braces will be stripped if they surround the \emph{entire} content % of the optional argument % \begin{verbatim} -% \DeclareDocumentCommand{\foo}{o}{#1} -% \foo[{abc}] % => "abc" -% \foo[ {abc}] % => " {abc}" +% \NewDocumentCommand{\foobaz}{o}{#1} +% \foobaz[{abc}] % => "abc" +% \foobaz[ {abc}] % => " {abc}" % \end{verbatim} % % Two more tokens have a special meaning when creating an argument @@ -268,17 +272,17 @@ % to the last mandatory argument to be collected (as it must exist). % So after % \begin{verbatim} -% \DeclareDocumentCommand \foo { m o m } { ... } +% \NewDocumentCommand \foo { m o m } { ... } % \end{verbatim} % the user input |\foo{arg1}[arg2]{arg3}| and % \verb*|\foo{arg1} [arg2] {arg3}| will both be parsed in the same % way. However, spaces are \emph{not} ignored when parsing optional % arguments after the last mandatory argument. Thus with % \begin{verbatim} -% \DeclareDocumentCommand \foo { m o } { ... } +% \NewDocumentCommand \foobar { m o } { ... } % \end{verbatim} -% |\foo{arg1}[arg2]| will find an optional argument but -% \verb*|\foo{arg1} [arg2]| will not. This is so that trailing optional +% |\foobar{arg1}[arg2]| will find an optional argument but +% \verb*|\foobar{arg1} [arg2]| will not. This is so that trailing optional % arguments are not picked up \enquote{by accident} in input. % % There is one major exception to the rules listed above: when @@ -293,8 +297,8 @@ % delimited} (\texttt{R}-type) argument is that an error will be raised if % the latter is missing. Thus for example % \begin{verbatim} -% \DeclareDocumentCommand {\foo} {r()m} {} -% \foo{oops} +% \NewDocumentCommand {\foobaz} {r()m} {} +% \foobaz{oops} % \end{verbatim} % will lead to an error message being issued. The marker |-NoValue-| % (\texttt{r}-type) or user-specified default (for \texttt{R}-type) will be @@ -333,7 +337,7 @@ % default value can be expressed in terms of the value of any other % arguments by using |#1|, |#2|, and so on. % \begin{verbatim} -% \DeclareDocumentCommand {\conjugate} { m O{#1ed} O{#2} } {(#1,#2,#3)} +% \NewDocumentCommand {\conjugate} { m O{#1ed} O{#2} } {(#1,#2,#3)} % \conjugate {walk} % => (walk,walked,walked) % \conjugate {find} [found] % => (find,found,found) % \conjugate {do} [did] [done] % => (do,did,done) @@ -342,7 +346,7 @@ % argument specification. For instance a command could accept two % optional arguments, equal by default: % \begin{verbatim} -% \DeclareDocumentCommand {\margins} { O{#3} m O{#1} m } {(#1,#2,#3,#4)} +% \NewDocumentCommand {\margins} { O{#3} m O{#1} m } {(#1,#2,#3,#4)} % \margins {a} {b} % => {(-NoValue-,a,-NoValue-,b)} % \margins [1cm] {a} {b} % => {(1cm,a,1cm,b)} % \margins {a} [1cm] {b} % => {(1cm,a,1cm,b)} @@ -385,13 +389,13 @@ % % \begin{function} % { -% \DeclareDocumentCommand , % \NewDocumentCommand , % \RenewDocumentCommand , -% \ProvideDocumentCommand +% \ProvideDocumentCommand , +% \DeclareDocumentCommand % } % \begin{syntax} -% \cs{DeclareDocumentCommand} \meta{Function} \Arg{arg spec} \Arg{code} +% \cs{NewDocumentCommand} \meta{Function} \Arg{arg spec} \Arg{code} % \end{syntax} % This family of commands are used to create a document-level % \meta{function}. The argument specification for the function is @@ -401,7 +405,7 @@ % % As an example: % \begin{verbatim} -% \DeclareDocumentCommand \chapter { s o m } +% \NewDocumentCommand \chapter { s o m } % { % \IfBooleanTF {#1} % { \typesetstarchapter {#3} } @@ -414,43 +418,44 @@ % The \cs{typesetnormalchapter} could test its first argument for being % |-NoValue-| to see if an optional argument was present. % -% The difference between the \cs{Declare\ldots}, \cs{New\ldots} -% \cs{Renew\ldots} and \cs{Provide\ldots} versions is the behaviour +% The difference between the \cs{New\ldots} \cs{Renew\ldots}, +% \cs{Provide\ldots} and \cs{Declare\ldots} versions is the behaviour % if \meta{function} is already defined. % \begin{itemize} -% \item \cs{DeclareDocumentCommand} will always create the new -% definition, irrespective of any existing \meta{function} with the -% same name. % \item \cs{NewDocumentCommand} will issue an error if \meta{function} % has already been defined. % \item \cs{RenewDocumentCommand} will issue an error if \meta{function} % has not previously been defined. % \item \cs{ProvideDocumentCommand} creates a new definition for % \meta{function} only if one has not already been given. +% \item \cs{DeclareDocumentCommand} will always create the new +% definition, irrespective of any existing \meta{function} with the +% same name. This should be used sparingly. % \end{itemize} % % \begin{texnote} % Unlike \LaTeXe{}'s \cs{newcommand} and relatives, the -% \cs{DeclareDocumentCommand} family of functions do not prevent creation of +% \cs{NewDocumentCommand} family of functions do not prevent creation of % functions with names starting \cs{end\ldots}. % \end{texnote} % % \begin{function} % { -% \DeclareDocumentEnvironment , % \NewDocumentEnvironment , % \RenewDocumentEnvironment , -% \ProvideDocumentEnvironment +% \ProvideDocumentEnvironment , +% \DeclareDocumentEnvironment % } % \begin{syntax} -% \cs{DeclareDocumentEnvironment} \Arg{environment} \Arg{arg spec} +% \cs{NewDocumentEnvironment} \Arg{environment} \Arg{arg spec} % ~~\Arg{start code} \Arg{end code} % \end{syntax} -% These commands work in the same way as \cs{DeclareDocumentCommand}, -% etc., but create environments (\cs{begin}|{|\meta{function}|}| \ldots -% \cs{end}|{|\meta{function}|}|). Both the \meta{start code} and +% These commands work in the same way as \cs{NewDocumentCommand}, +% etc.\@, but create environments (\cs{begin}\Arg{environment} \ldots{} +% \cs{end}\Arg{environment}). Both the \meta{start code} and % \meta{end code} % may access the arguments as defined by \meta{arg spec}. +% The arguments will be given following \cs{begin}\Arg{environment}. % \end{function} % % \subsection{Testing special values} @@ -468,7 +473,7 @@ % The \cs{IfNoValue(TF)} tests are used to check if \meta{argument} (|#1|, % |#2|, \emph{etc.}) is the special |-NoValue-| marker For example % \begin{verbatim} -% \DeclareDocumentCommand \foo { o m } +% \NewDocumentCommand \foo { o m } % { % \IfNoValueTF {#1} % { \DoSomethingJustWithMandatoryArgument {#2} } @@ -493,6 +498,15 @@ % \IfNoValueTF{-NoValue-} % \end{verbatim} % will be logically \texttt{false}. +% +% When two optional arguments follow each other (a syntax we typically +% discourage), it can make sense to allow users of the command to +% specify only the second argument by providing an empty first +% argument. Rather than testing separately for emptyness and for +% |-NoValue-| it is then best to use the argument type~|O| with an +% empty default value, and simply test for emptyness using the +% \pkg{expl3} conditional \cs{tl_if_blank:nTF} or its \pkg{etoolbox} +% analogue \tn{ifblank}. % \end{function} % % \begin{function}[EXP]{\IfValueT, \IfValueF, \IfValueTF} @@ -517,7 +531,7 @@ % Used to test if \meta{argument} (|#1|, |#2|, \emph{etc.}) is % \cs{BooleanTrue} or \cs{BooleanFalse}. For example % \begin{verbatim} -% \DeclareDocumentCommand \foo { s m } +% \NewDocumentCommand \foo { s m } % { % \IfBooleanTF #1 % { \DoSomethingWithStar {#2} } @@ -565,7 +579,7 @@ % This processor reverses the logic of \cs{BooleanTrue} and % \cs{BooleanFalse}, so that the example from earlier would become % \begin{verbatim} -% \DeclareDocumentCommand \foo { > { \ReverseBoolean } s m } +% \NewDocumentCommand \foo { > { \ReverseBoolean } s m } % { % \IfBooleanTF #1 % { \DoSomethingWithoutStar {#2} } @@ -588,7 +602,7 @@ % then \cs{NoValue} markers are added at the end of the processed % argument. % \begin{verbatim} -% \DeclareDocumentCommand \foo +% \NewDocumentCommand \foo % { > { \SplitArgument { 2 } { ; } } m } % { \InternalFunctionOfThreeArguments #1 } % \end{verbatim} @@ -606,7 +620,7 @@ % then wrapped in braces within |#1|. The result is that the % processed argument can be further processed using a mapping function. % \begin{verbatim} -% \DeclareDocumentCommand \foo +% \NewDocumentCommand \foo % { > { \SplitList { ; } } m } % { \MappingFunction #1 } % \end{verbatim} @@ -623,7 +637,7 @@ % to apply a \meta{function} to every entry in a \meta{list}. The % \meta{function} should absorb one argument: the list entry. For example % \begin{verbatim} -% \DeclareDocumentCommand \foo +% \NewDocumentCommand \foo % { > { \SplitList { ; } } m } % { \ProcessList {#1} { \SomeDocumentFunction } } % \end{verbatim} @@ -639,7 +653,7 @@ % and category code~$10$) for the ends of the argument. Thus for example % declaring a function % \begin{verbatim} -% \DeclareDocumentCommand \foo +% \NewDocumentCommand \foo % { > { \TrimSpaces } m } % { \showtokens {#1} } % \end{verbatim} @@ -666,18 +680,24 @@ % if you do not understand when this might be, \emph{do not use these % functions}! % -% \begin{function}{\DeclareExpandableDocumentCommand} +% \begin{function} +% { +% \NewExpandableDocumentCommand , +% \RenewExpandableDocumentCommand , +% \ProvideExpandableDocumentCommand , +% \DeclareExpandableDocumentCommand +% } % \begin{syntax} -% \cs{DeclareExpandableDocumentCommand} +% \cs{NewExpandableDocumentCommand} % ~~~~\meta{function} \Arg{arg spec} \Arg{code} % \end{syntax} -% This command is used to create a document-level \meta{function}, +% This family of commands is used to create a document-level \meta{function}, % which will grab its arguments in a fully-expandable manner. The % argument specification for the function is given by \meta{arg spec}, % and the function will execute \meta{code}. In general, \meta{code} will % also be fully expandable, although it is possible that this will % not be the case (for example, a function for use in a table might -% expand so that \cs{omit} is the first non-expandable token). +% expand so that \cs{omit} is the first non-expandable non-space token). % % Parsing arguments expandably imposes a number of restrictions on % both the type of arguments that can be read and the error checking @@ -685,10 +705,9 @@ % \begin{itemize} % \item The last argument (if any are present) must be one of the % mandatory types \texttt{m} or \texttt{r}. -% \item All arguments are either short or long: it is not possible -% to mix short and long argument types. -% \item The mandatory argument types \texttt{l} and \texttt{u} are -% not available. +% \item All short arguments appear before long arguments. +% \item The mandatory argument types \texttt{l} and \texttt{u} may +% not be used after optional arguments. % \item The optional argument types \texttt{g} % and \texttt{G} are not available. % \item The \enquote{verbatim} argument type \texttt{v} is not available. @@ -791,24 +810,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\l_@@_all_long_bool} -% For expandable commands, all arguments have the same long status, but this -% needs to be checked. A flag is therefore needed to track whether arguments -% are long at all. -% \begin{macrocode} -\bool_new:N \l_@@_all_long_bool -% \end{macrocode} -% \end{variable} -% -% \begin{variable}{\l_@@_all_long_set_bool} -% Whether \cs{l_@@_all_long_bool}'s value is fixed yet or not. This -% is to deal with the case of leading \texttt{t}-type argument, whose -% \enquote{long} status should be ignored. -% \begin{macrocode} -\bool_new:N \l_@@_all_long_set_bool -% \end{macrocode} -% \end{variable} -% % \begin{variable}{\l_@@_arg_spec_tl} % Holds the argument specification after normalization of shorthands. % \begin{macrocode} @@ -916,6 +917,16 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_grab_expandably_bool} +% When defining a non-expandable command, indicates whether the +% arguments can all safely be grabbed by expandable grabbers. This is +% to support abuses of \pkg{xparse} that use protected functions +% inside csname constructions. +% \begin{macrocode} +\bool_new:N \l_@@_grab_expandably_bool +% \end{macrocode} +% \end{variable} +% % \begin{variable}{\l_@@_last_delimiters_tl} % Holds the delimiters (first tokens) of all optional arguments since % the previous mandatory argument, to warn about cases where it would @@ -928,9 +939,7 @@ % \end{variable} % % \begin{variable}{\l_@@_long_bool} -% Used to indicate that an argument is long: this is used on a per-argument -% basis for non-expandable functions, or for the entire set of arguments -% when working expandably. +% Used to indicate that an argument is long, on a per-argument basis. % \begin{macrocode} \bool_new:N \l_@@_long_bool % \end{macrocode} @@ -986,6 +995,20 @@ % \end{macrocode} % \end{variable} % +% \begin{variable}{\l_@@_some_long_bool, \l_@@_some_short_bool} +% Both of these flags are set while normalizing the argument +% specification. To grab arguments expandably, all short arguments +% must appear before long arguments, so as soon as the first long +% argument is seen (other than \texttt{t}-type, whose long status is +% ignored) the \texttt{some_long} flag is set. The +% \texttt{some_short} flag is used for expandable commands, to know +% whether to define a short auxiliary too. +% \begin{macrocode} +\bool_new:N \l_@@_some_long_bool +\bool_new:N \l_@@_some_short_bool +% \end{macrocode} +% \end{variable} +% % \begin{variable}{\l_@@_tmp_prop, \l_@@_tmpa_tl, \l_@@_tmpb_tl} % \begin{macro}{\@@_tmp:w} % Scratch space. @@ -1029,6 +1052,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} } } @@ -1068,13 +1098,13 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_declare_cmd_code:Nnn { - \bool_if:NTF \l_@@_expandable_bool + \bool_if:NTF \l_@@_grab_expandably_bool { \@@_declare_cmd_code_expandable:Nnn } { \@@_declare_cmd_code_aux:Nnn } } % \end{macrocode} -% Standard functions call -% \cs{@@_start:nNNnnn}, which receives an auxiliary used for +% Standard functions call \cs{@@_start:nNNnnn}, which receives the +% argument specification, an auxiliary used for % grabbing arguments, an auxiliary containing the code, and then the % signature, default arguments, and processors. % \begin{macrocode} @@ -1100,11 +1130,27 @@ } } } +% \end{macrocode} +% Expandable functions and functions whose arguments can be grabbed +% expandably call \cs{@@_start_expandable:nNNNNn}, which receives the +% argument specification, four auxiliaries (two for grabbing arguments, one for +% the code, and one for default arguments), and finally the signature. +% Non-expandable functions that take this branch should nevertheless +% be protected, as well as their \texttt{code} function. They will +% only be expanded in contexts such as constructing a csname. +% The two grabbers (named after the function with one or two spaces) +% are needed when there are both short and long arguments; otherwise +% the same grabber is included twice in the definition. If all +% arguments are long or all are short the (only) grabber is defined +% correspondingly to be long/short. Otherwise two grabbers are +% defined, one long, one short. +% \begin{macrocode} \cs_new_protected:Npn \@@_declare_cmd_code_expandable:Nnn #1#2#3 { - \cs_generate_from_arg_count:cNnn + \exp_args:Ncc \cs_generate_from_arg_count:NNnn { \l_@@_function_tl \c_space_tl code } - \cs_set:Npn \l_@@_current_arg_int {#3} + { cs_set \bool_if:NF \l_@@_expandable_bool { _protected } :Npn } + \l_@@_current_arg_int {#3} \bool_if:NT \l_@@_defaults_bool { \use:x @@ -1115,19 +1161,35 @@ { \exp_not:o \l_@@_defaults_tl } } } - \cs_set_nopar:Npx #1 + \bool_if:NTF \l_@@_expandable_bool + { \cs_set_nopar:Npx } { \cs_set_protected_nopar:Npx } #1 { - \exp_not:N \@@_start_expandable:nNNNn + \exp_not:N \@@_start_expandable:nNNNNn { \exp_not:n {#2} } \exp_not:c { \l_@@_function_tl \c_space_tl } + \exp_not:c + { + \l_@@_function_tl \c_space_tl + \bool_if:NT \l_@@_some_short_bool + { \bool_if:NT \l_@@_some_long_bool { \c_space_tl } } + } \exp_not:c { \l_@@_function_tl \c_space_tl code } - \exp_not:c { \l_@@_function_tl \c_space_tl defaults } + \bool_if:NTF \l_@@_defaults_bool + { \exp_not:c { \l_@@_function_tl \c_space_tl defaults } } + { ? } { \exp_not:o \l_@@_signature_tl } } - \bool_if:NTF \l_@@_all_long_bool - { \cs_set:cpx } + \bool_if:NTF \l_@@_some_long_bool + { + \bool_if:NT \l_@@_some_short_bool + { + \cs_set_nopar:cpx { \l_@@_function_tl \c_space_tl \c_space_tl } + ##1##2 { ##1 {##2} } + } + \cs_set:cpx + } { \cs_set_nopar:cpx } - { \l_@@_function_tl \c_space_tl } ##1##2 { ##1 {##2} } + { \l_@@_function_tl \c_space_tl } ##1##2 { ##1 {##2} } } % \end{macrocode} % \end{macro} @@ -1196,12 +1258,20 @@ % \subsection{Structure of \pkg{xparse} commands} % % \begin{macro}{\@@_start:nNNnnn} +% \begin{macro}[aux]{\@@_start_aux:nNNnnn} % This sets up a few variables to minimize the boilerplate code % included in all \pkg{xparse}-defined commands. It then runs the % grabbers~|#4|. Again, the argument specification |#1| is only for -% diagnostics. +% diagnostics. The control sequence equal to \cs{scan_stop:} protects +% against \texttt{f}-expansion and ensures errors are more reasonable +% when an \pkg{xparse} command is placed in a csname. % \begin{macrocode} -\cs_new_protected:Npn \@@_start:nNNnnn #1#2#3#4#5#6 +\cs_new_protected:Npx \@@_start:nNNnnn + { + \exp_not:c { xparse~function~is~not~expandable } + \exp_not:N \@@_start_aux:nNNnnn + } +\cs_new_protected:Npn \@@_start_aux:nNNnnn #1#2#3#4#5#6 { \tl_clear:N \l_@@_args_tl \tl_set:Nn \l_@@_fn_tl {#2} @@ -1212,6 +1282,7 @@ } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro}{\@@_run_code:} % After arguments are grabbed, this function is responsible for @@ -1359,29 +1430,30 @@ % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\@@_start_expandable:nNNNn} -% This is called for all expandable commands. |#5| is the signature, -% responsible for grabbing arguments. |#4| is used to determine -% default values. |#3| is the code to run. -% |#2|~is a function (named after the command) that grabs a single -% argument in the input stream. The argument specification |#1| is -% unused but used by diagnostic functions. +% \begin{macro}[EXP]{\@@_start_expandable:nNNNNn} +% This is called for all expandable commands. |#6| is the signature, +% responsible for grabbing arguments. |#5| is used to determine +% default values (or is |?| if there are none). |#4| is the code to run. +% |#2|~and~|#3| are functions (named after the command) that grab a single +% argument in the input stream (|#3|~is~short). The argument specification |#1| is +% only used by diagnostic functions. % \begin{macrocode} -\cs_new:Npn \@@_start_expandable:nNNNn #1#2#3#4#5 - { #5 \@@_end_expandable:NNw #4 #3 \q_@@ #2 } +\cs_new:Npn \@@_start_expandable:nNNNNn #1#2#3#4#5#6 + { #6 \@@_end_expandable:NNw #5 #4 \q_@@ #2#3 } % \end{macrocode} % \end{macro} % % \begin{macro}[EXP]{\@@_end_expandable:NNw} % \begin{macro}[EXP,aux]{\@@_end_expandable_aux:w} -% \begin{macro}[EXP,aux]{\@@_end_expandable_aux:nNNN} +% \begin{macro}[EXP,aux]{\@@_end_expandable_aux:nNNNN} % \begin{macro}[EXP,aux]{\@@_end_expandable_defaults:nnnNNn} % \begin{macro}[EXP,aux]{\@@_end_expandable_defaults:nnw} % \begin{macro}[EXP,aux]{\@@_end_expandable_defaults:nw} % \begin{macro}[EXP,aux]{\@@_end_expandable_defaults_E:nnw} -% Followed by a function |#1| to determine default values, the code -% |#2|, arguments that have been grabbed, then \cs{q_@@} and a generic -% grabber. The idea to find default values is similar to the +% Followed by a function |#1| to determine default values (or |?| if +% there are no defaults), the code +% |#2|, arguments that have been grabbed, then \cs{q_@@} and two generic +% grabbers. The idea to find default values is similar to the % non-expandable case but we cannot define an auxiliary function, so % at every step in the loop we need to go through all arguments % searching for which ones started out as |-NoValue-| and replacing @@ -1392,11 +1464,11 @@ % \begin{macrocode} \cs_new:Npn \@@_end_expandable:NNw #1#2 { \@@_end_expandable_aux:w #1#2 \prg_do_nothing: } -\cs_new:Npn \@@_end_expandable_aux:w #1#2#3 \q_@@ #4 - { \exp_args:No \@@_end_expandable_aux:nNNN {#3} #1 #2 #4 } -\cs_new:Npn \@@_end_expandable_aux:nNNN #1#2#3#4 +\cs_new:Npn \@@_end_expandable_aux:w #1#2#3 \q_@@ + { \exp_args:No \@@_end_expandable_aux:nNNNN {#3} #1 #2 } +\cs_new:Npn \@@_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 } \@@_end_expandable_defaults:nnnNNn {#1} { } {#1} #2#3 { } { } { } { } { } { } { } { } { } { } { @@ -1472,17 +1544,29 @@ % must be followed by arguments. % % The third is to check for forbidden types for expandable commands, -% namely \texttt{g}, -% \texttt{G}, \texttt{l} (as the next left brace may have been inserted -% by \pkg{xparse} due to a failed search for an optional argument), -% \texttt{u} (any preceding optional argument may wrap part of the -% delimiter up in braces), and \texttt{v}. +% namely \texttt{G}/\texttt{v} always, and \texttt{l}/\texttt{u} after +% optional arguments (\pkg{xparse} may have inserted braces due to a +% failed search for an optional argument). % % The fourth is that an optional argument should not be followed by a % mandatory argument with the same delimiter, as otherwise the optional % argument could never be omitted. % -% The last is to count mandatory arguments. +% The fifth is to keep track in \cs{l_@@_some_long_bool} and +% \cs{l_@@_some_short_bool} of whether the command has some long/short +% arguments. +% +% The sixth is to keep track in \cs{l_@@_grab_expandably_bool} of +% whether all arguments are \texttt{m}/\texttt{l}/\texttt{u} type and +% short arguments appear before long ones, in which case they can be +% grabbed expandably just as safely as they could be grabbed expandably. +% Regardless of that, arguments of expandable commands will be grabbed +% expandably and arguments of environments will not (because the list of +% arguments built by non-expandable grabbing is used to pass them to the +% end-environment code). +% +% The last is to count mandatory arguments, used later to detect which +% optional arguments are trailing. % % \begin{macro}{\@@_normalize_arg_spec:n} % \begin{macro}{\@@_normalize_arg_spec_loop:n} @@ -1500,6 +1584,10 @@ \int_zero:N \l_@@_current_arg_int \tl_clear:N \l_@@_last_delimiters_tl \tl_clear:N \l_@@_arg_spec_tl + \bool_set_true:N \l_@@_grab_expandably_bool + \bool_set_false:N \l_@@_long_bool + \bool_set_false:N \l_@@_some_long_bool + \bool_set_false:N \l_@@_some_short_bool \@@_normalize_arg_spec_loop:n #1 \q_recursion_tail \q_recursion_tail \q_recursion_tail \q_recursion_stop \int_compare:nNnT \l_@@_current_arg_int > 9 @@ -1517,6 +1605,10 @@ \@@_bad_def:wn } } + \bool_if:NT \l_@@_expandable_bool + { \bool_set_true:N \l_@@_grab_expandably_bool } + \bool_if:NT \l_@@_environment_bool + { \bool_set_false:N \l_@@_grab_expandably_bool } } \cs_new_protected:Npn \@@_normalize_arg_spec_loop:n #1 { @@ -1603,12 +1695,14 @@ } \tl_put_right:Nn \l_@@_arg_spec_tl { > {#1} } \int_decr:N \l_@@_current_arg_int + \bool_set_false:N \l_@@_grab_expandably_bool \@@_normalize_arg_spec_loop:n {#2} } \cs_new_protected:cpn { @@_normalize_type_+:w } #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn } \tl_put_right:Nn \l_@@_arg_spec_tl { + } + \bool_set_true:N \l_@@_long_bool \int_decr:N \l_@@_current_arg_int \@@_normalize_arg_spec_loop:n {#1} } @@ -1622,6 +1716,7 @@ % \@@_normalize_type_G:w, % \@@_normalize_type_t:w, % } +% \begin{macro}[aux]{\@@_normalize_E_unique_check:w} % Optional argument types. Check that all required data is present % (and consists of single tokens if applicable) and check for % forbidden types for expandable commands. For \texttt{E}-type @@ -1637,8 +1732,9 @@ \@@_single_token_check:n {#1} \@@_single_token_check:n {#2} \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn } - \tl_put_right:Nn \l_@@_arg_spec_tl { D #1 #2 {#3} } + \@@_add_arg_spec:n { D #1 #2 {#3} } \tl_put_right:Nn \l_@@_last_delimiters_tl {#1} + \bool_set_false:N \l_@@_grab_expandably_bool \@@_normalize_arg_spec_loop:n } \cs_new_protected:Npn \@@_normalize_type_E:w #1#2 @@ -1646,17 +1742,27 @@ \quark_if_recursion_tail_stop_do:nn {#2} { \@@_bad_arg_spec:wn } \tl_if_blank:nT {#1} { \@@_bad_arg_spec:wn } \tl_map_function:nN {#1} \@@_single_token_check:n + \@@_normalize_E_unique_check:w #1 \q_nil \q_stop \int_compare:nNnT { \tl_count:n {#2} } > { \tl_count:n {#1} } { \@@_bad_arg_spec:wn } - \tl_put_right:Nn \l_@@_arg_spec_tl { E {#1} {#2} } + \@@_add_arg_spec:n { E {#1} {#2} } \tl_put_right:Nn \l_@@_last_delimiters_tl {#1} + \bool_set_false:N \l_@@_grab_expandably_bool \@@_normalize_arg_spec_loop:n } +\cs_new_protected:Npn \@@_normalize_E_unique_check:w #1#2 \q_stop + { + \quark_if_nil:NF #1 + { + \tl_if_in:nnT {#2} {#1} { \@@_bad_arg_spec:wn } + \@@_normalize_E_unique_check:w #2 \q_stop + } + } \cs_new_protected:Npn \@@_normalize_type_G:w #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn } - \@@_normalize_error_if_expandable:N G - \tl_put_right:Nn \l_@@_arg_spec_tl { G {#1} } + \@@_normalize_check_gv:N G + \@@_add_arg_spec:n { G {#1} } \tl_put_right:Nn \l_@@_last_delimiters_tl { { } } \@@_normalize_arg_spec_loop:n } @@ -1666,10 +1772,13 @@ \quark_if_recursion_tail_stop_do:Nn #1 { \@@_bad_arg_spec:wn } \tl_put_right:Nn \l_@@_arg_spec_tl { t #1 } \tl_put_right:Nn \l_@@_last_delimiters_tl {#1} + \bool_set_false:N \l_@@_grab_expandably_bool + \bool_set_false:N \l_@@_long_bool \@@_normalize_arg_spec_loop:n } % \end{macrocode} % \end{macro} +% \end{macro} % % \begin{macro} % { @@ -1690,8 +1799,8 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_normalize_type_l:w { - \@@_normalize_error_if_expandable:N l - \tl_put_right:Nn \l_@@_arg_spec_tl { l } + \@@_normalize_check_lu:N l + \@@_add_arg_spec:n { l } \int_incr:N \l_@@_mandatory_args_int \tl_clear:N \l_@@_last_delimiters_tl \@@_normalize_arg_spec_loop:n @@ -1699,7 +1808,7 @@ \cs_new_protected:Npn \@@_normalize_type_m:w { \@@_delimiter_check:nnn { } { m } { \iow_char:N \{ } - \tl_put_right:Nn \l_@@_arg_spec_tl { m } + \@@_add_arg_spec:n { m } \int_incr:N \l_@@_mandatory_args_int \tl_clear:N \l_@@_last_delimiters_tl \@@_normalize_arg_spec_loop:n @@ -1710,24 +1819,25 @@ \@@_single_token_check:n {#2} \quark_if_recursion_tail_stop_do:nn {#3} { \@@_bad_arg_spec:wn } \@@_delimiter_check:nnn {#1} { R/r } { \tl_to_str:n {#1} } - \tl_put_right:Nn \l_@@_arg_spec_tl { R #1 #2 {#3} } + \@@_add_arg_spec:n { R #1 #2 {#3} } \int_incr:N \l_@@_mandatory_args_int \tl_clear:N \l_@@_last_delimiters_tl + \bool_set_false:N \l_@@_grab_expandably_bool \@@_normalize_arg_spec_loop:n } \cs_new_protected:Npn \@@_normalize_type_u:w #1 { \quark_if_recursion_tail_stop_do:nn {#1} { \@@_bad_arg_spec:wn } - \@@_normalize_error_if_expandable:N u - \tl_put_right:Nn \l_@@_arg_spec_tl { u {#1} } + \@@_normalize_check_lu:N u + \@@_add_arg_spec:n { u {#1} } \int_incr:N \l_@@_mandatory_args_int \tl_clear:N \l_@@_last_delimiters_tl \@@_normalize_arg_spec_loop:n } \cs_new_protected:Npn \@@_normalize_type_v:w { - \@@_normalize_error_if_expandable:N v - \tl_put_right:Nn \l_@@_arg_spec_tl { v } + \@@_normalize_check_gv:N v + \@@_add_arg_spec:n { v } \int_incr:N \l_@@_mandatory_args_int \tl_clear:N \l_@@_last_delimiters_tl \@@_normalize_arg_spec_loop:n @@ -1751,10 +1861,11 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_normalize_error_if_expandable:N} -% Called for arguments that are forbidden for expandable commands. +% \begin{macro}{\@@_normalize_check_gv:N, \@@_normalize_check_lu:N} +% Called for arguments that are always forbidden, or forbidden after +% an optional argument, for expandable commands. % \begin{macrocode} -\cs_new_protected:Npn \@@_normalize_error_if_expandable:N #1 +\cs_new_protected:Npn \@@_normalize_check_gv:N #1 { \bool_if:NT \l_@@_expandable_bool { @@ -1763,6 +1874,20 @@ { \iow_char:N \\ \l_@@_function_tl } { \tl_to_str:n {#1} } \@@_bad_def:wn } + \bool_set_false:N \l_@@_grab_expandably_bool + } +\cs_new_protected:Npn \@@_normalize_check_lu:N #1 + { + \bool_if:NT \l_@@_expandable_bool + { + \tl_if_empty:NF \l_@@_last_delimiters_tl + { + \__msg_kernel_error:nnxx + { xparse } { invalid-after-optional-expandably } + { \iow_char:N \\ \l_@@_function_tl } { \tl_to_str:n {#1} } + \@@_bad_def:wn + } + } } % \end{macrocode} % \end{macro} @@ -1788,8 +1913,8 @@ % \end{macro} % % \begin{macro}{\@@_bad_arg_spec:wn, \@@_bad_def:wn} -% If the argument specification is wrong, this provides an escape from the entire -% definition process. +% If the argument specification is wrong, this provides an escape from +% the entire definition process. % \begin{macrocode} \cs_new_protected:Npn \@@_bad_arg_spec:wn #1 \@@_break_point:n #2 { @@ -1800,6 +1925,38 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_add_arg_spec:n} +% When adding an argument to the argument specification, set the +% \texttt{some_long} or \texttt{some_short} booleans as appropriate +% and clear the boolean keeping track of whether the argument is long. +% Before that, test for a short argument following some long +% arguments: this is forbidden for expandable commands and prevents +% grabbing arguments expandably. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_arg_spec:n #1 + { + \bool_if:NF \l_@@_long_bool + { + \bool_if:NT \l_@@_some_long_bool + { + \bool_if:NT \l_@@_expandable_bool + { + \__msg_kernel_error:nnx { xparse } { inconsistent-long } + { \iow_char:N \\ \l_@@_function_tl } + \@@_bad_def:wn + } + \bool_set_false:N \l_@@_grab_expandably_bool + } + } + \bool_if:NTF \l_@@_long_bool + { \bool_set_true:N \l_@@_some_long_bool } + { \bool_set_true:N \l_@@_some_short_bool } + \bool_set_false:N \l_@@_long_bool + \tl_put_right:Nn \l_@@_arg_spec_tl {#1} + } +% \end{macrocode} +% \end{macro} +% % \subsection{Preparing the signature: general mechanism} % % \begin{macro}{\@@_prepare_signature:n} @@ -1812,8 +1969,6 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_prepare_signature:n #1 { - \bool_set_false:N \l_@@_all_long_bool - \bool_set_false:N \l_@@_all_long_set_bool \int_zero:N \l_@@_current_arg_int \bool_set_false:N \l_@@_long_bool \int_zero:N \l_@@_m_args_int @@ -1849,7 +2004,7 @@ \use:c { @@_add - \bool_if:NT \l_@@_expandable_bool { _expandable } + \bool_if:NT \l_@@_grab_expandably_bool { _expandable } _type_ \token_to_str:N #1 :w } } @@ -2047,7 +2202,7 @@ % \begin{macrocode} \cs_new_protected:Npn \@@_flush_m_args: { - \int_compare:nNnT \l_@@_m_args_int > \c_zero + \int_compare:nNnT \l_@@_m_args_int > 0 { \tl_put_right:Nx \l_@@_signature_tl { \exp_not:c { @@_grab_m_ \int_use:N \l_@@_m_args_int :w } } @@ -2090,7 +2245,7 @@ { @@_grab_ #1 \bool_if:NT \l_@@_long_bool { _long } - \int_compare:nNnF \l_@@_mandatory_args_int > \c_zero + \int_compare:nNnF \l_@@_mandatory_args_int > 0 { _trailing } :w } @@ -2153,7 +2308,11 @@ % the general grabbers are dealt with later. % % \begin{macro}{\@@_add_expandable_type_+:w} -% ^^A todo +% We have already checked that short arguments are before long +% arguments, so \cs{l_@@_long_bool} only changes from \texttt{false} +% to \texttt{true} once (and there is no need to reset it after each +% argument). Also knock back the argument count because |+| is not an +% argument. Continue the loop. % \begin{macrocode} \cs_new_protected:cpn { @@_add_expandable_type_+:w } { @@ -2184,18 +2343,16 @@ \tl_if_eq:nnTF {#2} {#3} { \@@_add_expandable_type_D_aux:NN #1 #2 } { \@@_add_expandable_type_D_aux:NNN #1 #2 #3 } - \bool_set_false:N \l_@@_long_bool \@@_prepare_signature:N } \cs_new_protected:Npn \@@_add_expandable_type_D_aux:NNN #1#2#3 { - \@@_add_expandable_grabber:n {#1} - \bool_if:NTF \l_@@_all_long_bool + \bool_if:NTF \l_@@_long_bool { \cs_set:cpx } { \cs_set_nopar:cpx } { \l_@@_expandable_aux_name_tl } ##1 ##2 #2 ##3 \q_@@ ##4 #3 { ##1 {##2} {##3} {##4} } - \tl_put_right:Nx \l_@@_signature_tl + \@@_add_expandable_grabber:nn {#1} { \exp_not:c { \l_@@_expandable_aux_name_tl } \exp_not:n { #2 #3 } @@ -2203,13 +2360,12 @@ } \cs_new_protected:Npn \@@_add_expandable_type_D_aux:NN #1#2 { - \@@_add_expandable_grabber:n { #1_alt } - \bool_if:NTF \l_@@_all_long_bool + \bool_if:NTF \l_@@_long_bool { \cs_set:cpx } { \cs_set_nopar:cpx } { \l_@@_expandable_aux_name_tl } ##1 #2 ##2 #2 { ##1 {##2} } - \tl_put_right:Nx \l_@@_signature_tl + \@@_add_expandable_grabber:nn { #1_alt } { \exp_not:c { \l_@@_expandable_aux_name_tl } \exp_not:n {#2} @@ -2233,10 +2389,10 @@ \cs_new_protected:Npn \@@_add_expandable_type_E:w #1#2 { \@@_add_default_E:nn {#1} {#2} - \@@_add_expandable_grabber:n { E } \tl_clear:N \l_@@_tmpb_tl \tl_map_function:nN {#1} \@@_add_expandable_type_E_aux:n - \tl_put_right:Nx \l_@@_signature_tl + \@@_add_expandable_grabber:nn + { E \bool_if:NT \l_@@_long_bool { _long } } { { \exp_not:o \l_@@_tmpb_tl } { @@ -2244,7 +2400,6 @@ { { \c_@@_no_value_tl } } } } - \bool_set_false:N \l_@@_long_bool \@@_prepare_signature:N } \cs_new_protected:Npn \@@_add_expandable_type_E_aux:n #1 @@ -2257,6 +2412,16 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\@@_add_expandable_type_l:w} +% Reuse type \texttt{u}, thanks to the fact that \TeX{} macros whose +% parameter text ends with |#| in fact end up being delimited by an +% open brace. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_expandable_type_l:w + { \@@_add_expandable_type_u:w ## } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_add_expandable_type_m:w} % Unlike the standard case, when working expandably each argument is always % grabbed separately. @@ -2264,7 +2429,8 @@ \cs_new_protected:Npn \@@_add_expandable_type_m:w { \@@_add_default: - \@@_add_expandable_grabber:n { m } + \@@_add_expandable_grabber:nn + { m \bool_if:NT \l_@@_long_bool { _long } } { } \@@_prepare_signature:N } % \end{macrocode} @@ -2286,53 +2452,44 @@ \cs_new_protected:Npn \@@_add_expandable_type_t:w #1 { \@@_add_default: - \@@_add_expandable_grabber_t: \@@_get_grabber:NN #1 \l_@@_tmpa_tl - \tl_put_right:Nx \l_@@_signature_tl + \@@_add_expandable_grabber:nn { t } { \exp_not:o \l_@@_tmpa_tl \exp_not:N #1 } - \bool_set_false:N \l_@@_long_bool \@@_prepare_signature:N } % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_add_expandable_grabber:n, \@@_add_expandable_grabber_t:} -% For \texttt{t}-type arguments, simply add a grabber to the signature -% and reset the boolean keeping track of~\texttt{+} markers (they -% should be ignored for the purpose of determining the long status of -% the command because they take no argument). For all other -% arguments, if the command's long status is already known then check -% that this argument has the correct long status, and otherwise set -% the long status to this argument's long status. +% \begin{macro}{\@@_add_expandable_type_u:w} +% Define an auxiliary that will be used directly in the signature. It +% grabs one argument delimited by |#1| and places it before \cs{q_@@}. % \begin{macrocode} -\cs_new_protected:Npn \@@_add_expandable_grabber:n #1 +\cs_new_protected:Npn \@@_add_expandable_type_u:w #1 { - \bool_if:NTF \l_@@_all_long_set_bool - { - \bool_if:nT - { \bool_xor_p:nn { \l_@@_all_long_bool } { \l_@@_long_bool } } - { - \__msg_kernel_error:nnx { xparse } { inconsistent-long } - { \iow_char:N \\ \l_@@_function_tl } - \@@_bad_def:wn - } - } - { - \bool_set:Nn \l_@@_all_long_bool { \l_@@_long_bool } - \bool_set_true:N \l_@@_all_long_set_bool - } - \tl_put_right:Nx \l_@@_signature_tl - { \exp_not:c { @@_expandable_grab_ #1 :w } } - \bool_set_false:N \l_@@_long_bool + \@@_add_default: + \bool_if:NTF \l_@@_long_bool + { \cs_set:cpn } + { \cs_set_nopar:cpn } + { \l_@@_expandable_aux_name_tl } ##1 \q_@@ ##2 ##3 ##4 #1 + { ##1 {##4} \q_@@ ##2 ##3 } + \@@_add_expandable_grabber:nn { u } + { \exp_not:c { \l_@@_expandable_aux_name_tl } } + \@@_prepare_signature:N } -\cs_new_protected:Npn \@@_add_expandable_grabber_t: +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_add_expandable_grabber:nn} +% This is called for all arguments to place the right grabber in the +% signature. +% \begin{macrocode} +\cs_new_protected:Npn \@@_add_expandable_grabber:nn #1#2 { - \tl_put_right:Nn \l_@@_signature_tl - { \@@_expandable_grab_t:w } - \bool_set_false:N \l_@@_long_bool + \tl_put_right:Nx \l_@@_signature_tl + { \exp_not:c { @@_expandable_grab_ #1 :w } #2 } } % \end{macrocode} % \end{macro} @@ -3041,7 +3198,7 @@ \cs_new_protected:Npx \@@_grab_v_bgroup: { \exp_not:N \@@_grab_v_aux_catcodes: - \exp_not:n { \int_set_eq:NN \l_@@_v_nesting_int \c_one } + \exp_not:n { \int_set:Nn \l_@@_v_nesting_int { 1 } } \exp_not:N \@@_grab_v_aux_put:N \iow_char:N \{ \exp_not:N \@@_grab_v_bgroup_loop: } @@ -3058,7 +3215,7 @@ \token_if_eq_charcode:NNTF \c_group_end_token #1 { \int_decr:N \l_@@_v_nesting_int - \int_compare:nNnTF \l_@@_v_nesting_int > \c_zero + \int_compare:nNnTF \l_@@_v_nesting_int > 0 { \@@_grab_v_aux_put:N #1 \@@_grab_v_bgroup_loop: @@ -3175,33 +3332,37 @@ % \subsection{Grabbing arguments expandably} % % \begin{macro}[EXP]{\@@_expandable_grab_D:w} -% \begin{macro}[EXP, aux]{\@@_expandable_grab_D:NNNwNn} -% \begin{macro}[EXP, aux]{\@@_expandable_grab_D:NNNwNnnn} +% \begin{macro}[EXP, aux]{\@@_expandable_grab_D:NNNwNNn} +% \begin{macro}[EXP, aux]{\@@_expandable_grab_D:NNNwNNnnn} % \begin{macro}[EXP, aux]{\@@_expandable_grab_D:Nw} -% \begin{macro}[EXP, aux]{\@@_expandable_grab_D:nnNNNwN} -% The first step is to grab the first token or group. The generic grabber -% \cs{\meta{function}}\verb*| | is just after \cs{q_@@}, we go and find -% it. -% \begin{macrocode} -\cs_new:Npn \@@_expandable_grab_D:w #1 \q_@@ #2 - { #2 { \@@_expandable_grab_D:NNNwNn #1 \q_@@ #2 } } -% \end{macrocode} -% We then wish to test whether |#6|, which we just grabbed, is exactly |#2|. -% Expand the only grabber function we have, |#1|, once: the two strings below -% are equal if and only if |#6| matches |#2| exactly.\footnote{It is obvious -% that if \texttt{\#6} matches \texttt{\#2} then the strings are equal. We +% \begin{macro}[EXP, aux]{\@@_expandable_grab_D:nnNNNwNN} +% The first step is to grab the first token or group. The generic grabbers +% \cs{\meta{function}}\verb*| | and \cs{\meta{function}}\verb*| | are just after \cs{q_@@}, we go and find +% them (and use the long one). +% \begin{macrocode} +\cs_new:Npn \@@_expandable_grab_D:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_D:NNNwNNn #1 \q_@@ #2 #3 } } +% \end{macrocode} +% We then wish to test whether |#7|, which we just grabbed, is exactly |#2|. +% A preliminary test is whether their string representations coincide, then +% expand the only grabber function we have, |#1|, once: the two strings below +% are equal if and only if |#7| matches |#2| exactly.\footnote{It is obvious +% that if \texttt{\#7} matches \texttt{\#2} then the strings are equal. We % must check the converse. The right-hand-side of \cs{str_if_eq:onTF} does % not end with \texttt{\#3}, implying that the grabber function took % everything as its arguments. The first brace group can only be empty if -% \texttt{\#6} starts with \texttt{\#2}, otherwise the brace group preceding -% \texttt{\#6} would not vanish. The third brace group is empty, thus the +% \texttt{\#7} starts with \texttt{\#2}, otherwise the brace group preceding +% \texttt{\#7} would not vanish. The third brace group is empty, thus the % \cs{q_@@} that was used by our grabber \texttt{\#1} must be the one -% that we inserted (not some token in \texttt{\#6}), hence the second brace -% group contains the end of \texttt{\#6} followed by \texttt{\#2}. Since this +% that we inserted (not some token in \texttt{\#7}), hence the second brace +% group contains the end of \texttt{\#7} followed by \texttt{\#2}. Since this % is \texttt{\#2} on the right-hand-side, and no brace can be lost there, -% \texttt{\#6} must contain nothing else than its leading \texttt{\#2}.} If -% |#6| does not match |#2|, then the optional argument is missing, we use the -% default |-NoValue-|, and put back the argument |#6| in the input stream. +% \texttt{\#7} must contain nothing else than its leading \texttt{\#2}.} +% The preliminary test is needed as |#7| could validly contain +% \tn{par} (because a later mandatory argument could be long) and our +% grabber may be short. If +% |#7| does not match |#2|, then the optional argument is missing, we use the +% default |-NoValue-|, and put back the argument |#7| in the input stream. % % If it does match, then interesting things need to be done. We will grab the % argument piece by piece, with the following pattern: @@ -3227,34 +3388,38 @@ % \begin{macrocode} \cs_set_protected:Npn \@@_tmp:w #1 { - \cs_new:Npn \@@_expandable_grab_D:NNNwNn ##1##2##3##4 \q_@@ ##5##6 + \cs_new:Npn \@@_expandable_grab_D:NNNwNNn ##1##2##3##4 \q_@@ ##5##6##7 { - \str_if_eq:onTF - { ##1 { } { } ##6 ##2 \q_@@ ##3 } - { { } {##2} { } } + \str_if_eq:nnTF {##2} {##7} + { + \str_if_eq:onTF + { ##1 { } { } ##7 ##2 \q_@@ ##3 } + { { } {##2} { } } + } + { \use_ii:nn } { ##1 - { \@@_expandable_grab_D:NNNwNnnn ##1##2##3##4 \q_@@ ##5 } + { \@@_expandable_grab_D:NNNwNNnnn ##1##2##3##4 \q_@@ ##5##6 } \q_nil { } ##2 \ERROR \q_@@ \ERROR } - { ##4 {#1} \q_@@ ##5 {##6} } + { ##4 {#1} \q_@@ ##5 ##6 {##7} } } } \exp_args:No \@@_tmp:w { \c_@@_no_value_tl } % \end{macrocode} -% At this stage, |#6| is \cs{q_nil} \Arg{piece 1} \meta{more for piece 1}, +% At this stage, |#7| is \cs{q_nil} \Arg{piece 1} \meta{more for piece 1}, % and we want to concatenate all that, removing \cs{q_nil}, and keeping the -% opening delimiter |#2|. Simply use \cs{use_ii:nn}. Also, |#7| is -% \meta{remainder of piece 2} \cs{ERROR}, and |#8| is \cs{ERROR} \meta{more +% opening delimiter |#2|. Simply use \cs{use_ii:nn}. Also, |#8| is +% \meta{remainder of piece 2} \cs{ERROR}, and |#9| is \cs{ERROR} \meta{more % for piece 2}. We concatenate those, replacing the two \cs{ERROR} by the % closing delimiter |#3|. % \begin{macrocode} -\cs_new:Npn \@@_expandable_grab_D:NNNwNnnn #1#2#3#4 \q_@@ #5#6#7#8 +\cs_new:Npn \@@_expandable_grab_D:NNNwNNnnn #1#2#3#4 \q_@@ #5#6#7#8#9 { - \exp_args:Nof \@@_expandable_grab_D:nnNNNwN - { \use_ii:nn #6 #2 } - { \@@_expandable_grab_D:Nw #3 \exp_stop_f: #7 #8 } - #1#2#3 #4 \q_@@ #5 + \exp_args:Nof \@@_expandable_grab_D:nnNNNwNN + { \use_ii:nn #7 #2 } + { \@@_expandable_grab_D:Nw #3 \exp_stop_f: #8 #9 } + #1#2#3 #4 \q_@@ #5 #6 } \cs_new:Npn \@@_expandable_grab_D:Nw #1#2 \ERROR \ERROR { #2 #1 } % \end{macrocode} @@ -3266,10 +3431,10 @@ % delimiter. In that case, we are done, and put the argument (from which we % remove a spurious pair of delimiters coming from how we started the loop). % Otherwise, we go back to looping with -% \cs{@@_expandable_grab_D:NNNwNnnn}. The code to deal with brace stripping +% \cs{@@_expandable_grab_D:NNNwNNnnn}. The code to deal with brace stripping % is much the same as for the non-expandable case. % \begin{macrocode} -\cs_new:Npn \@@_expandable_grab_D:nnNNNwN #1#2#3#4#5#6 \q_@@ #7 +\cs_new:Npn \@@_expandable_grab_D:nnNNNwNN #1#2#3#4#5#6 \q_@@ #7#8 { \exp_args:No \tl_if_empty:oTF { #3 { \use_none:nnn } #2 \q_@@ #5 #4 \q_@@ #5 } @@ -3283,11 +3448,11 @@ { \@@_put_arg_expandable:ow { \use_iii:nnn #1#2 } } { \@@_put_arg_expandable:ow { \use_none:nn #1#2 } } } - #6 \q_@@ #7 + #6 \q_@@ #7 #8 } { #3 - { \@@_expandable_grab_D:NNNwNnnn #3#4#5#6 \q_@@ #7 } + { \@@_expandable_grab_D:NNNwNNnnn #3#4#5#6 \q_@@ #7 #8 } \q_nil {#1} #2 \ERROR \q_@@ \ERROR } } @@ -3299,58 +3464,66 @@ % \end{macro} % % \begin{macro}[EXP]{\@@_expandable_grab_D_alt:w} -% \begin{macro}[EXP]{\@@_expandable_grab_D_alt:NNwNn} +% \begin{macro}[EXP]{\@@_expandable_grab_D_alt:NNwNNn} % \begin{macro}[EXP]{\@@_expandable_grab_D_alt:Nwn} % When the delimiters are identical, nesting is not possible and a simplified % approach is used. The test concept here is the same as for the case where -% the delimiters are different. +% the delimiters are different but there cannot be any nesting. % \begin{macrocode} -\cs_new:Npn \@@_expandable_grab_D_alt:w #1 \q_@@ #2 - { #2 { \@@_expandable_grab_D_alt:NNwNn #1 \q_@@ #2 } } +\cs_new:Npn \@@_expandable_grab_D_alt:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_D_alt:NNwNNn #1 \q_@@ #2 #3 } } \cs_set_protected:Npn \@@_tmp:w #1 { - \cs_new:Npn \@@_expandable_grab_D_alt:NNwNn ##1##2##3 \q_@@ ##4##5 + \cs_new:Npn \@@_expandable_grab_D_alt:NNwNNn ##1##2##3 \q_@@ ##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 - { \@@_expandable_grab_D_alt:Nwn ##4 ##3 \q_@@ } - ##5 \ERROR + { \@@_expandable_grab_D_alt:NNwn ##4 ##5 ##3 \q_@@ } + ##6 \ERROR } - { ##3 {#1} \q_@@ ##4 {##5} } + { ##3 {#1} \q_@@ ##4 ##5 {##6} } } } \exp_args:No \@@_tmp:w { \c_@@_no_value_tl } -\cs_new:Npn \@@_expandable_grab_D_alt:Nwn #1#2 \q_@@ #3 +\cs_new:Npn \@@_expandable_grab_D_alt:NNwn #1#2#3 \q_@@ #4 { - \tl_if_blank:oTF { \use_none:n #3 } - { \@@_put_arg_expandable:ow { \use_none:n #3 } } + \tl_if_blank:oTF { \use_none:n #4 } + { \@@_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 } } } - { \@@_put_arg_expandable:ow { \use_ii:nn #3 } } - { \@@_put_arg_expandable:ow { \use_none:n #3 } } + { \exp_not:o { \use_none:n #4 } } + { { \exp_not:o { \use_ii:nnn #4 \q_nil } } } + { \@@_put_arg_expandable:ow { \use_ii:nn #4 } } + { \@@_put_arg_expandable:ow { \use_none:n #4 } } } - #2 \q_@@ #1 + #3 \q_@@ #1 #2 } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}[EXP]{\@@_expandable_grab_E:w} -% \begin{macro}[EXP,aux]{\@@_expandable_grab_E_test:nnwn} +% \begin{macro}[EXP]{\@@_expandable_grab_E:w, \@@_expandable_grab_E_long:w} +% \begin{macro}[EXP,aux]{\@@_expandable_grab_E_aux:w} +% \begin{macro}[EXP,aux]{\@@_expandable_grab_E_test:nnw} % \begin{macro}[EXP,aux]{\@@_expandable_grab_E_loop:nnnNNw} -% \begin{macro}[EXP,aux]{\@@_expandable_grab_E_aux:nnw} -% \begin{macro}[EXP,aux]{\@@_expandable_grab_E_aux:nnnnn} +% \begin{macro}[EXP,aux]{\@@_expandable_grab_E_find:w} +% \begin{macro}[EXP,aux]{\@@_expandable_grab_E_find:nnw} % \begin{macro}[EXP,aux]{\@@_expandable_grab_E_end:nnw} -% The function will be called repeatedly with two arguments: the set +% We keep track of long/short by placing the appropriate grabber as +% the third token after \cs{q_@@}; it is eventually removed by the +% \texttt{end:nnw} auxiliary. The \texttt{aux:w} auxiliary will be +% called repeatedly with two arguments: the set % of pairs \meta{parser} \meta{token}, and the set of arguments found % so far (initially all |{-NoValue-}|). At each step, grab what -% follows in the input stream then call the \texttt{loop:nnnNNwn} +% follows in the input stream then call the \texttt{loop:nnnNNw} % auxiliary to compare it with each possible embellishment in turn. % This auxiliary's |#1| is what was found in the input, |#2| collects % \meta{parser} \meta{token} pairs that did not match, |#3| collects @@ -3365,18 +3538,22 @@ % does not match |#5| (see \texttt{t}-type arguments below for a % similar \cs{str_if_eq:onTF} test) then carry on the loop. % Otherwise, we found a new embellishment: grab the corresponding -% argument in the input using the \texttt{:w} auxiliary. To avoid -% losing braces around that auxiliary's argument |#4| we include a +% argument in the input using the \texttt{find:w} auxiliary. To avoid +% losing braces around that auxiliary's argument we include a % space, which will be eliminated in the next loop through % embellishments. % \begin{macrocode} -\cs_new:Npn \@@_expandable_grab_E:w #1 \q_@@ #2 - { #2 { \@@_expandable_grab_E_test:nnwn #1 \q_@@ #2 } } -\cs_new:Npn \@@_expandable_grab_E_test:nnwn #1#2#3 \q_@@ #4#5 +\cs_new:Npn \@@_expandable_grab_E:w #1 \q_@@ #2#3 + { \@@_expandable_grab_E_aux:w #1 \q_@@ #2 #3 #3 } +\cs_new:Npn \@@_expandable_grab_E_long:w #1 \q_@@ #2#3 + { \@@_expandable_grab_E_aux:w #1 \q_@@ #2 #3 #2 } +\cs_new:Npn \@@_expandable_grab_E_aux:w #1 \q_@@ #2#3#4 + { #2 { \@@_expandable_grab_E_test:nnw #1 \q_@@ #2 #3 #4 } } +\cs_new:Npn \@@_expandable_grab_E_test:nnw #1#2#3 \q_@@ #4#5#6#7 { - \@@_expandable_grab_E_loop:nnnNNw {#5} { } { } + \@@_expandable_grab_E_loop:nnnNNw {#7} { } { } #1 \q_nil \q_nil \q_nil \q_mark #2 \q_nil - #3 \q_@@ #4 + #3 \q_@@ #4 #5 #6 } \cs_new:Npn \@@_expandable_grab_E_loop:nnnNNw #1#2#3#4#5#6 \q_nil #7 \q_mark #8 @@ -3387,7 +3564,7 @@ \@@_if_no_value:nTF {#8} { \str_if_eq:onTF { #4 { } #1 #5 } {#5} } { \use_ii:nn } - { \@@_expandable_grab_E_aux:w { #2 #4 #5 #6 } {#3} ~ } + { \@@_expandable_grab_E_find:w { #2 #4 #5 #6 } {#3} ~ } { \@@_expandable_grab_E_loop:nnnNNw {#1} { #2 #4 #5 } { #3 {#8} } @@ -3395,12 +3572,12 @@ } } } -\cs_new:Npn \@@_expandable_grab_E_aux:w #1 \q_@@ #2 - { #2 { \@@_expandable_grab_E_aux:nnw #1 \q_@@ #2 } } -\cs_new:Npn \@@_expandable_grab_E_aux:nnw #1#2#3 \q_nil #4 \q_@@ #5#6 - { \@@_expandable_grab_E:w {#1} { #2 {#6} #3 } #4 \q_@@ #5 } -\cs_new:Npn \@@_expandable_grab_E_end:nnw #1#2#3 \q_@@ #4 - { #3 {#2} \q_@@ #4 {#1} } +\cs_new:Npn \@@_expandable_grab_E_find:w #1 \q_@@ #2#3#4 + { #4 { \@@_expandable_grab_E_find:nnw #1 \q_@@ #2 #3 #4 } } +\cs_new:Npn \@@_expandable_grab_E_find:nnw #1#2#3 \q_nil #4 \q_@@ #5#6#7#8 + { \@@_expandable_grab_E_aux:w {#1} { #2 {#8} #3 } #4 \q_@@ #5 #6 #7 } +\cs_new:Npn \@@_expandable_grab_E_end:nnw #1#2#3 \q_@@ #4#5#6 + { #3 {#2} \q_@@ #4 #5 {#1} } % \end{macrocode} % \end{macro} % \end{macro} @@ -3408,43 +3585,51 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % -% \begin{macro}[EXP]{\@@_expandable_grab_m:w} +% \begin{macro}[EXP]{\@@_expandable_grab_m:w, \@@_expandable_grab_m_long:w} % \begin{macro}[EXP, aux]{\@@_expandable_grab_m_aux:wNn} -% The mandatory case is easy: find the auxiliary after the \cs{q_@@}, and -% use it directly to grab the argument. +% The mandatory case is easy: find the auxiliary after the \cs{q_@@}, +% and use it directly to grab the argument, then correctly position +% the argument before \cs{q_@@}. % \begin{macrocode} -\cs_new:Npn \@@_expandable_grab_m:w #1 \q_@@ #2 - { #2 { \@@_expandable_grab_m_aux:wNn #1 \q_@@ #2 } } -\cs_new:Npn \@@_expandable_grab_m_aux:wNn #1 \q_@@ #2#3 - { #1 {#3} \q_@@ #2 } +\cs_new:Npn \@@_expandable_grab_m:w #1 \q_@@ #2#3 + { #3 { \@@_expandable_grab_m_aux:wNn #1 \q_@@ #2 #3 } } +\cs_new:Npn \@@_expandable_grab_m_long:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_m_aux:wNn #1 \q_@@ #2 #3 } } +\cs_new:Npn \@@_expandable_grab_m_aux:wNn #1 \q_@@ #2#3#4 + { #1 {#4} \q_@@ #2 #3 } % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}[EXP]{\@@_expandable_grab_R:w} -% \begin{macro}[EXP, aux]{\@@_expandable_grab_R_aux:NNNwNn} +% \begin{macro}[EXP, aux]{\@@_expandable_grab_R_aux:NNNwNNn} % Much the same as for the \texttt{D}-type argument, with only the lead-off % function varying. % \begin{macrocode} -\cs_new:Npn \@@_expandable_grab_R:w #1 \q_@@ #2 - { #2 { \@@_expandable_grab_R_aux:NNNwNn #1 \q_@@ #2 } } +\cs_new:Npn \@@_expandable_grab_R:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_R_aux:NNNwNNn #1 \q_@@ #2#3 } } \cs_set_protected:Npn \@@_tmp:w #1 { - \cs_new:Npn \@@_expandable_grab_R_aux:NNNwNn ##1##2##3##4 \q_@@ ##5##6 + \cs_new:Npn \@@_expandable_grab_R_aux:NNNwNNn ##1##2##3##4 \q_@@ ##5##6##7 { - \str_if_eq:onTF - { ##1 { } { } ##6 ##2 \q_@@ ##3 } - { { } {##2} { } } + \str_if_eq:nnTF {##7} {##2} + { + \str_if_eq:onTF + { ##1 { } { } ##7 ##2 \q_@@ ##3 } + { { } {##2} { } } + } + { \use_ii:nn } { ##1 - { \@@_expandable_grab_D:NNNwNnnn ##1##2##3##4 \q_@@ ##5 } + { \@@_expandable_grab_D:NNNwNNnnn ##1##2##3##4 \q_@@ ##5##6 } \q_nil { } ##2 \ERROR \q_@@ \ERROR } { \__msg_kernel_expandable_error:nnnn { xparse } { missing-required } {##5} {##2} - ##4 {#1} \q_@@ ##5 {##6} + ##4 {#1} \q_@@ ##5 ##6 {##7} } } } @@ -3454,29 +3639,33 @@ % \end{macro} % % \begin{macro}[EXP]{\@@_expandable_grab_R_alt:w} -% \begin{macro}[EXP]{\@@_expandable_grab_R_alt_aux:NNwNn} +% \begin{macro}[EXP]{\@@_expandable_grab_R_alt_aux:NNwNNn} % When the delimiters are identical, nesting is not possible and a simplified % approach is used. The test concept here is the same as for the case where % the delimiters are different. % \begin{macrocode} -\cs_new:Npn \@@_expandable_grab_R_alt:w #1 \q_@@ #2 - { #2 { \@@_expandable_grab_R_alt_aux:NNnwNn #1 \q_@@ #2 } } +\cs_new:Npn \@@_expandable_grab_R_alt:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_R_alt_aux:NNnwNn #1 \q_@@ #2#3 } } \cs_set_protected:Npn \@@_tmp:w #1 { - \cs_new:Npn \@@_expandable_grab_R_alt_aux:NNwNn ##1##2##3 \q_@@ ##4##5 + \cs_new:Npn \@@_expandable_grab_R_alt_aux:NNwNn ##1##2##3 \q_@@ ##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 - { \@@_expandable_grab_D_alt:Nwn ##4 ##3 \q_@@ } - ##5 \ERROR + { \@@_expandable_grab_D_alt:NNwn ##4 ##5 ##3 \q_@@ } + ##6 \ERROR } { \__msg_kernel_expandable_error:nnnn { xparse } { missing-required } {##4} {##2} - ##3 {#1} \q_@@ ##4 {##5} + ##3 {#1} \q_@@ ##4 ##5 {##6} } } } @@ -3491,18 +3680,26 @@ % the only parser we have in order to work out if |#2| is exactly equal to % the output of the grabber. % \begin{macrocode} -\cs_new:Npn \@@_expandable_grab_t:w #1 \q_@@ #2 - { #2 { \@@_expandable_grab_t_aux:NNwn #1 \q_@@ #2 } } -\cs_new:Npn \@@_expandable_grab_t_aux:NNwn #1#2#3 \q_@@ #4#5 +\cs_new:Npn \@@_expandable_grab_t:w #1 \q_@@ #2#3 + { #2 { \@@_expandable_grab_t_aux:NNwn #1 \q_@@ #2 #3 } } +\cs_new:Npn \@@_expandable_grab_t_aux:NNwn #1#2#3 \q_@@ #4#5#6 { - \str_if_eq:onTF { #1 { } #5 #2 } {#2} - { #3 { \BooleanTrue } \q_@@ #4 } - { #3 { \BooleanFalse } \q_@@ #4 {#5} } + \str_if_eq:onTF { #1 { } #6 #2 } {#2} + { #3 { \BooleanTrue } \q_@@ #4 #5 } + { #3 { \BooleanFalse } \q_@@ #4 #5 {#6} } } % \end{macrocode} % \end{macro} % \end{macro} % +% \begin{macro}[EXP]{\@@_expandable_grab_u:w} +% It turns out there is nothing to do: this is followed by an +% auxiliary named after the function, that does everything. +% \begin{macrocode} +\cs_new_eq:NN \@@_expandable_grab_u:w \prg_do_nothing: +% \end{macrocode} +% \end{macro} +% % \begin{macro}[EXP] % {\@@_put_arg_expandable:nw, \@@_put_arg_expandable:ow} % A useful helper, to store arguments when they are ready. @@ -3593,27 +3790,27 @@ } \cs_new_protected:Npn \@@_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 \@@_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_@@_no_value_tl } } } } @@ -3768,7 +3965,7 @@ % % \begin{macro}{\@@_check_definable:nNT, \@@_check_definable_aux:nN} % Check that a token list is appropriate as a first argument of -% \cs{DeclareDocumentCommand} and similar functions and otherwise +% \cs{NewDocumentCommand} and similar functions and otherwise % produce an error. First trim whitespace to allow for spaces around % the actual command to be defined. If the result has multiple % tokens, it is not a valid argument. The single token is a control @@ -3857,7 +4054,7 @@ % To determine whether the command is an \pkg{xparse} command check % that its |arg_spec| is empty (this also excludes non-macros) and % that its |replacement_spec| starts with either \cs{@@_start:nNNnnn} -% (non-expandable command) or \cs{@@_start_expandable:nNNNn} +% (non-expandable command) or \cs{@@_start_expandable:nNNNNn} % (expandable command). % \begin{macrocode} \cs_new_protected:Npn \@@_cmd_if_xparse:NTF #1 @@ -3872,7 +4069,7 @@ } { { \token_to_str:N \@@_start:nNNnnn } { } - { \token_to_str:N \@@_start_expandable:nNNNn } { } + { \token_to_str:N \@@_start_expandable:nNNNNn } { } } } \cs_new:Npn \@@_cmd_if_xparse_aux:w #1 ~ #2 \q_stop {#1} @@ -3895,16 +4092,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! } @@ -3918,7 +4115,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 } { @@ -3935,8 +4132,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'. } @@ -3947,6 +4144,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'. } { @@ -4093,6 +4302,12 @@ as~a~previous~optional~argument,~it~will~not~be~possible~to~ omit~all~optional~arguments~when~calling~this~command. } +\__msg_kernel_new:nnn { xparse } { unsupported-let } + { + 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. + } % \end{macrocode} % % \subsection{User functions} @@ -4110,27 +4325,24 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\DeclareDocumentCommand} % \begin{macro}{\NewDocumentCommand} % \begin{macro}{\RenewDocumentCommand} % \begin{macro}{\ProvideDocumentCommand} +% \begin{macro}{\DeclareDocumentCommand} % The user macros are pretty simple wrappers around the internal ones. -% There is however a check that the first argument is a single token -% and is definable. +% There is however a check that the first argument is a single token, +% possibly surrounded by spaces (hence the strange \cs{use:nnn}), and +% is definable. % \begin{macrocode} -\cs_new_protected:Npn \DeclareDocumentCommand #1#2#3 - { - \@@_check_definable:nNT {#1} \DeclareDocumentCommand - { \@@_declare_cmd:Nnn #1 {#2} {#3} } - } \cs_new_protected:Npn \NewDocumentCommand #1#2#3 { \@@_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 } } { \@@_declare_cmd:Nnn #1 {#2} {#3} } } @@ -4142,8 +4354,9 @@ \cs_if_exist:NTF #1 { \@@_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 } } } } @@ -4152,20 +4365,23 @@ \@@_check_definable:nNT {#1} \ProvideDocumentCommand { \cs_if_exist:NF #1 { \@@_declare_cmd:Nnn #1 {#2} {#3} } } } +\cs_new_protected:Npn \DeclareDocumentCommand #1#2#3 + { + \@@_check_definable:nNT {#1} \DeclareDocumentCommand + { \@@_declare_cmd:Nnn #1 {#2} {#3} } + } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\DeclareDocumentEnvironment} % \begin{macro}{\NewDocumentEnvironment} % \begin{macro}{\RenewDocumentEnvironment} % \begin{macro}{\ProvideDocumentEnvironment} +% \begin{macro}{\DeclareDocumentEnvironment} % Very similar for environments. % \begin{macrocode} -\cs_new_protected:Npn \DeclareDocumentEnvironment #1#2#3#4 - { \@@_declare_env:nnnn {#1} {#2} {#3} {#4} } \cs_new_protected:Npn \NewDocumentEnvironment #1#2#3#4 { \cs_if_exist:cTF {#1} @@ -4180,15 +4396,54 @@ } \cs_new_protected:Npn \ProvideDocumentEnvironment #1#2#3#4 { \cs_if_exist:cF {#1} { \@@_declare_env:nnnn {#1} {#2} {#3} {#4} } } +\cs_new_protected:Npn \DeclareDocumentEnvironment #1#2#3#4 + { \@@_declare_env:nnnn {#1} {#2} {#3} {#4} } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % +% \begin{macro}{\NewExpandableDocumentCommand} +% \begin{macro}{\RenewExpandableDocumentCommand} +% \begin{macro}{\ProvideExpandableDocumentCommand} % \begin{macro}{\DeclareExpandableDocumentCommand} -% The expandable version of the basic function is essentially the same. +% The expandable versions are essentially the same as the basic functions. % \begin{macrocode} +\cs_new_protected:Npn \NewExpandableDocumentCommand #1#2#3 + { + \@@_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 } + } + { \@@_declare_expandable_cmd:Nnn #1 {#2} {#3} } + } + } +\cs_new_protected:Npn \RenewExpandableDocumentCommand #1#2#3 + { + \@@_check_definable:nNT {#1} \RenewExpandableDocumentCommand + { + \cs_if_exist:NTF #1 + { \@@_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 + { + \@@_check_definable:nNT {#1} \ProvideExpandableDocumentCommand + { + \cs_if_exist:NF #1 + { \@@_declare_expandable_cmd:Nnn #1 {#2} {#3} } + } + } \cs_new_protected:Npn \DeclareExpandableDocumentCommand #1#2#3 { \@@_check_definable:nNT {#1} \DeclareExpandableDocumentCommand @@ -4196,6 +4451,9 @@ } % \end{macrocode} % \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\IfBooleanT, \IfBooleanF, \IfBooleanTF} % The logical \meta{true} and \meta{false} statements are just the diff --git a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx index 430b5d9490e..a749c690157 100644 --- a/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx +++ b/Master/texmf-dist/source/latex/l3packages/xtemplate/xtemplate.dtx @@ -27,8 +27,8 @@ %<*driver|package> % The version of expl3 required is tested as early as possible, as % some really old versions do not define \ProvidesExplPackage. -\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} @@ -42,8 +42,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} % %<*driver> \documentclass[full]{l3doc} @@ -1123,21 +1123,17 @@ \cs_new_protected:Npn \@@_declare_object_type:nn #1#2 { \int_set:Nn \l_@@_tmp_int {#2} - \bool_if:nTF + \int_compare:nTF { 0 <= \l_@@_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_@@_tmp_int } + \prop_gput:NnV \g_@@_object_type_prop {#1} + \l_@@_tmp_int } { \msg_error:nnxx { xtemplate } { bad-number-of-arguments } {#1} { \exp_not:V \l_@@_tmp_int } } - { - \msg_info:nnxx { xtemplate } { declare-object-type } - {#1} {#2} - \prop_gput:NnV \g_@@_object_type_prop {#1} - \l_@@_tmp_int - } } % \end{macrocode} % \end{macro} 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 { -- cgit v1.2.3