summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/xint/xinttools.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-12-23 23:05:36 +0000
committerKarl Berry <karl@freefriends.org>2016-12-23 23:05:36 +0000
commit356fa8c73e53d0d1f2b0e438ed71be0c92c4aaaf (patch)
tree8216d7ba46ae1725d1ca3202b53d27f31d48a8c9 /Master/texmf-dist/tex/generic/xint/xinttools.sty
parent53a12757d6cc681bfd39c6bb93db49b2c21ee97b (diff)
xint (23dec16)
git-svn-id: svn://tug.org/texlive/trunk@42782 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/xint/xinttools.sty')
-rw-r--r--Master/texmf-dist/tex/generic/xint/xinttools.sty532
1 files changed, 286 insertions, 246 deletions
diff --git a/Master/texmf-dist/tex/generic/xint/xinttools.sty b/Master/texmf-dist/tex/generic/xint/xinttools.sty
index 1b33f23c4a5..cd5269ac268 100644
--- a/Master/texmf-dist/tex/generic/xint/xinttools.sty
+++ b/Master/texmf-dist/tex/generic/xint/xinttools.sty
@@ -21,7 +21,7 @@
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%% ---------------------------------------------------------------
-%% The xint bundle 1.2i 2016/12/13
+%% The xint bundle 1.2j 2016/12/22
%% Copyright (C) 2013-2016 by Jean-Francois Burnol
%% xinttools: Expandable and non-expandable utilities
%% ---------------------------------------------------------------
@@ -70,7 +70,7 @@
\XINTsetupcatcodes% defined in xintkernel.sty
\XINT_providespackage
\ProvidesPackage{xinttools}%
- [2016/12/13 1.2i Expandable and non-expandable utilities (JFB)]%
+ [2016/12/22 1.2j Expandable and non-expandable utilities (JFB)]%
\newtoks\XINT_toks
\xint_firstofone{\let\XINT_sptoken= } %<- space here!
\def\xintgodef {\global\xintodef }%
@@ -242,21 +242,21 @@
0-{\XINT_nthelt_pos #1}%
\krof
}%
-\def\XINT_nthelt_zero .{\xintlength }%
+\def\XINT_nthelt_zero #1.{\xintlength }%
\long\def\XINT_nthelt_neg #1.#2%
{%
- \expandafter\XINT_nthelt_neg_a\the\numexpr\xint_c_x\XINT_length_loop
+ \expandafter\XINT_nthelt_neg_a\the\numexpr\xint_c_i+\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
-#1.#2\xint_bye
}%
\def\XINT_nthelt_neg_a #1%
{%
\xint_UDzerominusfork
- #1-\xint_byeandstop
- 0#1\xint_byeandstop
+ #1-\xint_bye_thenstop
+ 0#1\xint_bye_thenstop
0-{}%
\krof
\expandafter\XINT_nthelt_neg_b
@@ -265,30 +265,16 @@
\long\def\XINT_nthelt_neg_b #1#2\xint_bye{ #1}%
\long\def\XINT_nthelt_pos #1.#2%
{%
- \expandafter\XINT_nthelt_loop\the\numexpr\xint_c_ix-#1.%
- #2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
-}%
-\def\XINT_nthelt_loop #1%
-{%
- \xint_UDsignfork
- #1\XINT_nthelt_loop_a
- -{\XINT_nthelt_getit #1}%
- \krof
-}%
-\long\def\XINT_nthelt_loop_a #1.#2#3#4#5#6#7#8#9%
-{%
- \xint_gob_til_xint_relax #9\xint_byeandstop\xint_relax
- \expandafter\XINT_nthelt_loop\the\numexpr\xint_c_viii-#1.%
-}%
-\def\XINT_nthelt_getit #1.%
-{%
- \expandafter\expandafter\expandafter\XINT_nthelt_finish
- \csname xint_gobble_\romannumeral\numexpr\xint_c_viii-#1\endcsname
+ \expandafter\XINT_nthelt_pos_done
+ \romannumeral0\expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_x.%
+ #2\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_bye
}%
-\long\edef\XINT_nthelt_finish #1#2\xint_bye
- {\noexpand\xint_gob_til_xint_relax #1\noexpand\expandafter\space
- \noexpand\xint_gobble_ii\xint_relax\space #1}%
+\def\XINT_nthelt_pos_done #1{%
+\long\def\XINT_nthelt_pos_done ##1##2\xint_bye{%
+ \xint_gob_til_xint_relax##1\expandafter#1\xint_gobble_ii\xint_relax#1##1}%
+}\XINT_nthelt_pos_done{ }%
\def\xintKeep {\romannumeral0\xintkeep }%
\def\xintKeepNoExpand {\romannumeral0\xintkeepnoexpand }%
\long\def\xintkeep #1#2{\expandafter\XINT_keep_a\the\numexpr #1\expandafter.%
@@ -306,11 +292,11 @@
\long\def\XINT_keep_neg #1.#2%
{%
\expandafter\XINT_keep_neg_a\the\numexpr
- #1-\numexpr\xint_c_ix\XINT_length_loop
+ #1-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye.#2%
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye.#2%
}%
\def\XINT_keep_neg_a #1%
{%
@@ -325,7 +311,9 @@
\expandafter\XINT_keep_loop
\the\numexpr#1-\XINT_lengthupto_loop
#1.#2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_c_vii\xint_c_vi\xint_c_v\xint_c_iv
+ \xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye.%
-\xint_c_viii.{}#2\xint_bye%
}%
\def\XINT_keep_loop #1#2.%
@@ -375,7 +363,9 @@
\expandafter\XINT_keepunbr_loop
\the\numexpr#1-\XINT_lengthupto_loop
#1.#2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_c_vii\xint_c_vi\xint_c_v\xint_c_iv
+ \xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye.%
-\xint_c_viii.{}#2\xint_bye%
}%
\def\XINT_keepunbr_loop #1#2.%
@@ -422,11 +412,11 @@
\long\def\XINT_trim_neg #1.#2%
{%
\expandafter\XINT_trim_neg_a\the\numexpr
- #1-\numexpr\xint_c_ix\XINT_length_loop
+ #1-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
.{}#2\xint_bye
}%
\def\XINT_trim_neg_a #1%
@@ -439,29 +429,30 @@
\edef\XINT_trim_trimall {\noexpand\expandafter\space\noexpand\xint_bye}%
\long\def\XINT_trim_pos #1.#2%
{%
- \expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_viii.%
- #2\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_relax\xint_relax\xint_relax\xint_relax\xint_bye
+ \expandafter\XINT_trim_pos_done\expandafter\space
+ \romannumeral0\expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_ix.%
+ #2\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
+ \xint_bye
}%
-\def\XINT_trim_loop #1%
+\def\XINT_trim_loop #1#2.%
{%
- \xint_UDsignfork
- #1\XINT_trim_finish
- -\XINT_trim_loop_a
- \krof #1%
+ \xint_gob_til_minus#1\XINT_trim_finish-%
+ \expandafter\XINT_trim_loop\the\numexpr#1#2\XINT_trim_loop_trimnine
}%
-\long\def\XINT_trim_loop_a #1.#2#3#4#5#6#7#8#9%
+\long\def\XINT_trim_loop_trimnine #1#2#3#4#5#6#7#8#9%
{%
- \xint_gob_til_xint_relax #9\xint_bye_thenstop\xint_relax
- \expandafter\XINT_trim_loop\the\numexpr#1-\xint_c_viii.%
+ \xint_gob_til_xint_relax #9\XINT_trim_toofew\xint_relax-\xint_c_ix.%
}%
-\def\XINT_trim_finish -#1.%
+\def\XINT_trim_toofew\xint_relax{*\xint_c_}%
+\def\XINT_trim_finish#1{%
+\def\XINT_trim_finish-%
+ \expandafter\XINT_trim_loop\the\numexpr-##1\XINT_trim_loop_trimnine
{%
- \expandafter\expandafter\expandafter\XINT_trim_finish_a
- \expandafter\expandafter\expandafter\space
- \csname xint_gobble_\romannumeral\numexpr\xint_c_viii-#1\endcsname
-}%
-\long\def\XINT_trim_finish_a #1\xint_relax #2\xint_bye {#1}%
+ \expandafter\expandafter\expandafter#1%
+ \csname xint_gobble_\romannumeral\numexpr\xint_c_ix-##1\endcsname
+}}\XINT_trim_finish{ }%
+\long\def\XINT_trim_pos_done #1\xint_relax #2\xint_bye {#1}%
\def\xintTrimUnbraced {\romannumeral0\xinttrimunbraced }%
\def\xintTrimUnbracedNoExpand {\romannumeral0\xinttrimunbracednoexpand }%
\long\def\xinttrimunbraced #1#2%
@@ -480,11 +471,11 @@
\long\def\XINT_trimunbr_neg #1.#2%
{%
\expandafter\XINT_trimunbr_neg_a\the\numexpr
- #1-\numexpr\xint_c_ix\XINT_length_loop
+ #1-\numexpr\XINT_length_loop
#2\xint_relax\xint_relax\xint_relax\xint_relax
\xint_relax\xint_relax\xint_relax\xint_relax\xint_relax
- \xint_c_i\xint_c_ii\xint_c_iii\xint_c_iv
- \xint_c_v\xint_c_vi\xint_c_vii\xint_c_viii\xint_c_ix\xint_bye
+ \xint_c_viii\xint_c_vii\xint_c_vi\xint_c_v
+ \xint_c_iv\xint_c_iii\xint_c_ii\xint_c_i\xint_c_\xint_bye
.{}#2\xint_bye
}%
\def\XINT_trimunbr_neg_a #1%
@@ -1120,200 +1111,286 @@
}%
}%
\let\xintDigitsOf\xintAssignArray
-\def\xintTrim:f:csv {\romannumeral0\xinttrim:f:csv }%
-\def\xinttrim:f:csv #1#2%
-{%
- \expandafter\XINT_trim:f:csv_a\the\numexpr #1\expandafter.%
+\def\xintLength:f:csv {\romannumeral0\xintlength:f:csv}%
+\def\xintlength:f:csv #1%
+{\long\def\xintlength:f:csv ##1{%
+ \expandafter#1\the\numexpr\expandafter\XINT_length:f:csv_a
+ \romannumeral`&&@##1\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ \relax
+}}\xintlength:f:csv { }%
+\long\def\XINT_length:f:csv_a #1%
+{%
+ \xint_gob_til_xint_relax #1\xint_c_\xint_bye\xint_relax
+ \XINT_length:f:csv_loop #1%
+}%
+\long\def\XINT_length:f:csv_loop #1,#2,#3,#4,#5,#6,#7,#8,#9,%
+{%
+ \xint_gob_til_xint_relax #9\XINT_length:f:csv_finish\xint_relax
+ \xint_c_ix+\XINT_length:f:csv_loop
+}%
+\def\XINT_length:f:csv_finish\xint_relax\xint_c_ix+\XINT_length:f:csv_loop
+ #1,#2,#3,#4,#5,#6,#7,#8,#9,{#9\xint_bye}%
+\def\xintLengthUpTo:f:csv {\romannumeral0\xintlengthupto:f:csv}%
+\long\def\xintlengthupto:f:csv #1#2%
+{%
+ \expandafter\XINT_lengthupto:f:csv_a
+ \the\numexpr#1\expandafter.%
\romannumeral`&&@#2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
-}%
-\def\XINT_trim:f:csv_a #1%
-{%
- \xint_UDzerominusfork
- #1-{\XINT_trim:f:csv_zero }%
- 0#1{\XINT_trim:f:csv_neg }%
- 0-{\XINT_trim:f:csv_loop_a #1}%
- \krof
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_viii,\xint_c_vii,\xint_c_vi,\xint_c_v,%
+ \xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye.%
}%
-\def\XINT_trim:f:csv_zero .#1\xint_relax #2\xint_bye{ #1}%
-\def\XINT_trim:f:csv_neg #1.#2\xint_relax%
+\long\def\XINT_lengthupto:f:csv_a #1.#2%
{%
- \expandafter\XINT_trim:f:csv_neg_b
- \the\numexpr\XINT_length:f:csv_a #2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
- -#1.#2\xint_relax
+ \xint_gob_til_xint_relax #2\XINT_lengthupto:f:csv_empty\xint_relax
+ \XINT_lengthupto:f:csv_loop_b #1.#2%
}%
-\def\XINT_trim:f:csv_neg_b #1%
+\def\XINT_lengthupto:f:csv_empty\xint_relax
+ \XINT_lengthupto:f:csv_loop_b #1.#2\xint_bye.{ #1}%
+\def\XINT_lengthupto:f:csv_loop_a #1%
{%
- \xint_UDzerominusfork
- #1-{\expandafter\space\xint_bye }%
- 0#1{\expandafter\space\xint_bye }%
- 0-{\XINT_keep:f:csv_pos #1}%
- \krof
+ \xint_UDsignfork
+ #1\XINT_lengthupto:f:csv_gt
+ -\XINT_lengthupto:f:csv_loop_b
+ \krof #1%
}%
-\def\XINT_trim:f:csv_loop_a #1.%
+\long\def\XINT_lengthupto:f:csv_gt #1\xint_bye.{-0}%
+\long\def\XINT_lengthupto:f:csv_loop_b #1.#2,#3,#4,#5,#6,#7,#8,#9,%
{%
- \ifnum #1>\xint_c_vii
- \expandafter\XINT_trim:f:csv_loop_b
- \else
- \expandafter\XINT_trim:f:csv_finish
- \fi
- #1.%
+ \xint_gob_til_xint_relax #9\XINT_lengthupto:f:csv_finish_a\xint_relax
+ \expandafter\XINT_lengthupto:f:csv_loop_a\the\numexpr #1-\xint_c_viii.%
}%
-\def\XINT_trim:f:csv_loop_b #1.#2,#3,#4,#5,#6,#7,#8,#9,%
+\def\XINT_lengthupto:f:csv_finish_a\xint_relax
+ \expandafter\XINT_lengthupto:f:csv_loop_a
+ \the\numexpr #1-\xint_c_viii.#2,#3,#4,#5,#6,#7,#8,#9,%
{%
- \xint_gob_til_xint_relax #9\xint_bye_thenstop\xint_relax
- \expandafter\XINT_trim:f:csv_loop_a\the\numexpr #1-\xint_c_viii.%
+ \expandafter\XINT_lengthupto:f:csv_finish_b\the\numexpr #1-#9\xint_bye
}%
-\def\XINT_trim:f:csv_finish #1.%
+\def\XINT_lengthupto:f:csv_finish_b #1#2.%
{%
- \expandafter\XINT_trim:f:csv_finish_a
- \romannumeral`&&@\csname xint_gobble:csv_\romannumeral#1\endcsname
+ \xint_UDsignfork
+ #1{-0}%
+ -{ #1#2}%
+ \krof
}%
-\def\xint_gobble:csv_ {}%
-\def\xint_gobble:csv_i #1,{}%
-\def\xint_gobble:csv_ii #1,#2,{}%
-\def\xint_gobble:csv_iii #1,#2,#3,{}%
-\def\xint_gobble:csv_iv #1,#2,#3,#4,{}%
-\def\xint_gobble:csv_v #1,#2,#3,#4,#5,{}%
-\def\xint_gobble:csv_vi #1,#2,#3,#4,#5,#6,{}%
-\def\xint_gobble:csv_vii #1,#2,#3,#4,#5,#6,#7,{}%
-\def\XINT_trim:f:csv_finish_a #1\xint_relax #2\xint_bye { #1}%
\def\xintKeep:f:csv {\romannumeral0\xintkeep:f:csv }%
-\def\xintkeep:f:csv #1#2%
+\long\def\xintkeep:f:csv #1#2%
{%
- \expandafter\XINT_keep:f:csv_a\the\numexpr #1\expandafter.%
- \romannumeral`&&@#2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+ \expandafter\xint_gobble_thenstop
+ \romannumeral0\expandafter\XINT_keep:f:csv_a
+ \the\numexpr #1\expandafter.\expandafter{\romannumeral`&&@#2}%
}%
\def\XINT_keep:f:csv_a #1%
{%
\xint_UDzerominusfork
- #1-\xint_bye_thenstop
+ #1-\XINT_keep:f:csv_keepnone
0#1\XINT_keep:f:csv_neg
0-{\XINT_keep:f:csv_pos #1}%
\krof
}%
-\def\XINT_keep:f:csv_neg #1.#2\xint_relax%
+\long\def\XINT_keep:f:csv_keepnone .#1{,}%
+\long\def\XINT_keep:f:csv_neg #1.#2%
{%
- \expandafter\XINT_keep:f:csv_neg_b
- \the\numexpr\XINT_length:f:csv_a #2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
- -#1.#2\xint_relax
+ \expandafter\XINT_keep:f:csv_neg_done\expandafter,%
+ \romannumeral0%
+ \expandafter\XINT_keep:f:csv_neg_a\the\numexpr
+ #1-\numexpr\XINT_length:f:csv_a
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ .#2\xint_bye
}%
-\def\XINT_keep:f:csv_neg_b #1%
+\def\XINT_keep:f:csv_neg_a #1%
{%
- \xint_UDzerominusfork
- #1-{\XINT_keep:f:csv_all }%
- 0#1{\XINT_keep:f:csv_all }%
- 0-{\XINT_trim:f:csv_loop_a #1}%
+ \xint_UDsignfork
+ #1{\expandafter\XINT_keep:f:csv_trimloop\the\numexpr-\xint_c_ix+}%
+ -\XINT_keep:f:csv_keepall
\krof
}%
-\def\XINT_keep:f:csv_all #1.#2\xint_relax #3\xint_bye { #2}%
-\def\XINT_keep:f:csv_pos #1.{\expandafter\xint_gobble_thenstop
- \romannumeral`&&@\XINT_keep:f:csv_loop_a #1.{}}%
-\def\XINT_keep:f:csv_loop_a #1.%
+\def\XINT_keep:f:csv_keepall #1.{ }%
+\long\def\XINT_keep:f:csv_neg_done #1\xint_bye{#1}%
+\def\XINT_keep:f:csv_trimloop #1#2.%
{%
- \ifnum #1>\xint_c_vi
- \expandafter\XINT_keep:f:csv_loop_b
- \else
- \expandafter\XINT_keep:f:csv_finish
- \fi
- #1.%
-}%
-\def\XINT_keep:f:csv_loop_b #1.#2#3,#4,#5,#6,#7,#8,#9,%
-{%
- \xint_gob_til_xint_relax #9\XINT_keep:f:csv_enda\xint_relax
- \expandafter\XINT_keep:f:csv_loop_c\the\numexpr #1-\xint_c_vii.%
- {,#3,#4,#5,#6,#7,#8,#9}{#2}%
-}%
-\def\XINT_keep:f:csv_loop_c #1.#2#3{\XINT_keep:f:csv_loop_a #1.{#3#2}}%
-\def\XINT_keep:f:csv_enda #1.#2#3#4\xint_bye
-{%
- \XINT_keep:f:csv_endb #2\xint_bye {#3}%
-}%
-\def\XINT_keep:f:csv_endb #1\xint_relax #2\xint_bye #3{ #3#1}%
-\def\XINT_keep:f:csv_finish #1.#2#3,#4,#5,#6,#7,#8,#9\xint_bye
-{%
- \csname XINT_keep:f:csv_finish_\romannumeral#1\endcsname
- ,#3,#4,#5,#6,#7,#8,\Z {#2}%
-}%
-\def\XINT_keep:f:csv_finish_ #1\Z #2{#2}%
-\def\XINT_keep:f:csv_finish_i ,#1,#2\Z
- {\XINT_keep:f:csv_finish_f ,#1\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_ii ,#1,#2,#3\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_iii ,#1,#2,#3,#4\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_iv ,#1,#2,#3,#4,#5\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3,#4\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_v ,#1,#2,#3,#4,#5,#6\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3,#4,#5\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_vi ,#1,#2,#3,#4,#5,#6,#7\Z
- {\XINT_keep:f:csv_finish_f ,#1,#2,#3,#4,#5,#6\xint_relax\Z}%
-\def\XINT_keep:f:csv_finish_f #1\xint_relax #2\Z #3{#3#1}%
-\def\xintNthEltPy:f:csv {\romannumeral0\xintntheltpy:f:csv }%
-\def\xintntheltpy:f:csv #1{\expandafter\XINT_ntheltpy:f:csv\the\numexpr #1.}%
-\def\XINT_ntheltpy:f:csv #1%
+ \xint_gob_til_minus#1\XINT_keep:f:csv_trimloop_finish-%
+ \expandafter\XINT_keep:f:csv_trimloop
+ \the\numexpr#1#2-\xint_c_ix\expandafter.\XINT_keep:f:csv_trimloop_trimnine
+}%
+\long\def\XINT_keep:f:csv_trimloop_trimnine #1,#2,#3,#4,#5,#6,#7,#8,#9,{}%
+\def\XINT_keep:f:csv_trimloop_finish-%
+ \expandafter\XINT_keep:f:csv_trimloop
+ \the\numexpr-#1-\xint_c_ix\expandafter.\XINT_keep:f:csv_trimloop_trimnine
+ {\csname XINT_trim:f:csv_finish#1\endcsname}%
+\long\def\XINT_keep:f:csv_pos #1.#2%
+{%
+ \expandafter\XINT_keep:f:csv_pos_fork
+ \romannumeral0\XINT_lengthupto:f:csv_a
+ #1.#2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_viii,\xint_c_vii,\xint_c_vi,\xint_c_v,%
+ \xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye.%
+ .#1.{}#2\xint_bye%
+}%
+\def\XINT_keep:f:csv_pos_fork #1#2.%
{%
\xint_UDsignfork
- #1{\XINT_nthelt:f:csv_neg }%
- -{\XINT_nthelt:f:csv_pos #1}%
+ #1{\expandafter\XINT_keep:f:csv_loop\the\numexpr-\xint_c_viii+}%
+ -\XINT_keep:f:csv_pos_keepall
\krof
}%
-\long\def\XINT_nthelt:f:csv_neg #1.#2%
+\long\def\XINT_keep:f:csv_pos_keepall #1.#2#3\xint_bye{,#3}%
+\def\XINT_keep:f:csv_loop #1#2.%
+{%
+ \xint_gob_til_minus#1\XINT_keep:f:csv_loop_end-%
+ \expandafter\XINT_keep:f:csv_loop
+ \the\numexpr#1#2-\xint_c_viii\expandafter.\XINT_keep:f:csv_loop_pickeight
+}%
+\long\def\XINT_keep:f:csv_loop_pickeight
+ #1#2,#3,#4,#5,#6,#7,#8,#9,{{#1,#2,#3,#4,#5,#6,#7,#8,#9}}%
+\def\XINT_keep:f:csv_loop_end-\expandafter\XINT_keep:f:csv_loop
+ \the\numexpr-#1-\xint_c_viii\expandafter.\XINT_keep:f:csv_loop_pickeight
+ {\csname XINT_keep:f:csv_end#1\endcsname}%
+\long\expandafter\def\csname XINT_keep:f:csv_end1\endcsname
+ #1#2,#3,#4,#5,#6,#7,#8,#9\xint_bye {#1,#2,#3,#4,#5,#6,#7,#8}%
+\long\expandafter\def\csname XINT_keep:f:csv_end2\endcsname
+ #1#2,#3,#4,#5,#6,#7,#8\xint_bye {#1,#2,#3,#4,#5,#6,#7}%
+\long\expandafter\def\csname XINT_keep:f:csv_end3\endcsname
+ #1#2,#3,#4,#5,#6,#7\xint_bye {#1,#2,#3,#4,#5,#6}%
+\long\expandafter\def\csname XINT_keep:f:csv_end4\endcsname
+ #1#2,#3,#4,#5,#6\xint_bye {#1,#2,#3,#4,#5}%
+\long\expandafter\def\csname XINT_keep:f:csv_end5\endcsname
+ #1#2,#3,#4,#5\xint_bye {#1,#2,#3,#4}%
+\long\expandafter\def\csname XINT_keep:f:csv_end6\endcsname
+ #1#2,#3,#4\xint_bye {#1,#2,#3}%
+\long\expandafter\def\csname XINT_keep:f:csv_end7\endcsname
+ #1#2,#3\xint_bye {#1,#2}%
+\long\expandafter\def\csname XINT_keep:f:csv_end8\endcsname
+ #1#2\xint_bye {#1}%
+\def\xintTrim:f:csv {\romannumeral0\xinttrim:f:csv }%
+\long\def\xinttrim:f:csv #1#2%
{%
- \expandafter\XINT_nthelt:f:csv_neg_a
- \the\numexpr\expandafter\XINT_length:f:csv_a\romannumeral`&&@#2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
- -#1+\xint_c_i\expandafter.\romannumeral`&&@#2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+ \expandafter\xint_gobble_thenstop
+ \romannumeral0\expandafter\XINT_trim:f:csv_a
+ \the\numexpr #1\expandafter.\expandafter{\romannumeral`&&@#2}%
}%
-\def\XINT_nthelt:f:csv_neg_a #1%
+\def\XINT_trim:f:csv_a #1%
{%
\xint_UDzerominusfork
- #1-\xint_bye_thenstop
- 0#1\xint_bye_thenstop
- 0-{\XINT_nthelt:f:csv_loop_a #1}%
+ #1-\XINT_trim:f:csv_trimnone
+ 0#1\XINT_trim:f:csv_neg
+ 0-{\XINT_trim:f:csv_pos #1}%
\krof
}%
-\long\def\XINT_nthelt:f:csv_pos #1.#2%
+\long\def\XINT_trim:f:csv_trimnone .#1{,#1}%
+\long\def\XINT_trim:f:csv_neg #1.#2%
{%
- \expandafter\XINT_nthelt:f:csv_loop_a\the\numexpr #1+\xint_c_i\expandafter.%
- \romannumeral`&&@#2%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+ \expandafter\XINT_trim:f:csv_neg_a\the\numexpr
+ #1-\numexpr\XINT_length:f:csv_a
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ .{}#2\xint_bye
}%
-\def\XINT_nthelt:f:csv_loop_a #1.%
+\def\XINT_trim:f:csv_neg_a #1%
{%
- \ifnum #1>\xint_c_viii
- \expandafter\XINT_nthelt:f:csv_loop_b
- \else
- \expandafter\XINT_nthelt:f:csv_getit
- \fi #1.%
+ \xint_UDsignfork
+ #1{\expandafter\XINT_keep:f:csv_loop\the\numexpr-\xint_c_viii+}%
+ -\XINT_trim:f:csv_trimall
+ \krof
}%
-\long\def\XINT_nthelt:f:csv_loop_b #1.#2,#3,#4,#5,#6,#7,#8,#9,%
+\def\XINT_trim:f:csv_trimall {\expandafter,\xint_bye}%
+\long\def\XINT_trim:f:csv_pos #1.#2%
+{%
+ \expandafter\XINT_trim:f:csv_pos_done\expandafter,%
+ \romannumeral0%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr#1-\xint_c_ix.%
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax\xint_bye
+}%
+\def\XINT_trim:f:csv_loop #1#2.%
+{%
+ \xint_gob_til_minus#1\XINT_trim:f:csv_finish-%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr#1#2\XINT_trim:f:csv_loop_trimnine
+}%
+\long\def\XINT_trim:f:csv_loop_trimnine #1,#2,#3,#4,#5,#6,#7,#8,#9,%
+{%
+ \xint_gob_til_xint_relax #9\XINT_trim:f:csv_toofew\xint_relax-\xint_c_ix.%
+}%
+\def\XINT_trim:f:csv_toofew\xint_relax{*\xint_c_}%
+\def\XINT_trim:f:csv_finish-%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr-#1\XINT_trim:f:csv_loop_trimnine
+{%
+ \csname XINT_trim:f:csv_finish#1\endcsname
+}%
+\long\expandafter\def\csname XINT_trim:f:csv_finish1\endcsname
+ #1,#2,#3,#4,#5,#6,#7,#8,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish2\endcsname
+ #1,#2,#3,#4,#5,#6,#7,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish3\endcsname
+ #1,#2,#3,#4,#5,#6,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish4\endcsname
+ #1,#2,#3,#4,#5,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish5\endcsname
+ #1,#2,#3,#4,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish6\endcsname
+ #1,#2,#3,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish7\endcsname
+ #1,#2,{ }%
+\long\expandafter\def\csname XINT_trim:f:csv_finish8\endcsname
+ #1,{ }%
+\expandafter\let\csname XINT_trim:f:csv_finish9\endcsname\space
+\long\def\XINT_trim:f:csv_pos_done #1\xint_relax #2\xint_bye{#1}%
+\def\xintNthEltPy:f:csv {\romannumeral0\xintntheltpy:f:csv }%
+\long\def\xintntheltpy:f:csv #1#2%
{%
- \xint_gob_til_xint_relax #9\XINT_nthelt:f:csv_none\xint_relax
- \expandafter\XINT_nthelt:f:csv_loop_a\the\numexpr #1-\xint_c_viii.%
+ \expandafter\XINT_nthelt:f:csv_a
+ \the\numexpr #1\expandafter.\expandafter{\romannumeral`&&@#2}%
+}%
+\def\XINT_nthelt:f:csv_a #1%
+{%
+ \xint_UDsignfork
+ #1\XINT_nthelt:f:csv_neg
+ -\XINT_nthelt:f:csv_pos
+ \krof #1%
}%
-\def\XINT_nthelt:f:csv_getit #1.%
+\long\def\XINT_nthelt:f:csv_neg -#1.#2%
{%
- \expandafter\XINT_nthelt:f:csv_finish
- \romannumeral`&&@\csname xint_gobble:csv_\romannumeral
- \numexpr#1-\xint_c_i\endcsname
+ \expandafter\XINT_nthelt:f:csv_neg_fork
+ \the\numexpr\XINT_length:f:csv_a
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_c_ix,\xint_c_viii,\xint_c_vii,\xint_c_vi,%
+ \xint_c_v,\xint_c_iv,\xint_c_iii,\xint_c_ii,\xint_c_i,\xint_bye
+ -#1.#2,\xint_bye
}%
-\def\XINT_nthelt:f:csv_finish #1,#2\xint_bye
+\def\XINT_nthelt:f:csv_neg_fork #1%
{%
- \XINT_nthelt:f:csv_finishb #1\xint_relax\xint_bye
+ \if#1-\expandafter\xint_bye_thenstop\fi
+ \expandafter\XINT_nthelt:f:csv_neg_done
+ \romannumeral0%
+ \expandafter\XINT_keep:f:csv_trimloop\the\numexpr-\xint_c_ix+#1%
}%
-\def\XINT_nthelt:f:csv_finishb #1\xint_relax #2\xint_bye { #1}%
+\long\def\XINT_nthelt:f:csv_neg_done#1,#2\xint_bye{ #1}%
+\long\def\XINT_nthelt:f:csv_pos #1.#2%
+{%
+ \expandafter\XINT_nthelt:f:csv_pos_done
+ \romannumeral0%
+ \expandafter\XINT_trim:f:csv_loop\the\numexpr#1-\xint_c_ix.%
+ #2\xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
+ \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
+}%
+\def\XINT_nthelt:f:csv_pos_done #1{%
+\long\def\XINT_nthelt:f:csv_pos_done ##1,##2\xint_bye{%
+ \xint_gob_til_xint_relax##1\XINT_nthelt:f:csv_pos_cleanup\xint_relax#1##1}%
+}\XINT_nthelt:f:csv_pos_done{ }%
+\xint_firstofone{\long\def\XINT_nthelt:f:csv_pos_cleanup\xint_relax} %
+ #1\xint_relax{ #1}%
\def\xintReverse:f:csv {\romannumeral0\xintreverse:f:csv }%
-\def\xintreverse:f:csv #1%
+\long\def\xintreverse:f:csv #1%
{%
\expandafter\XINT_reverse:f:csv_loop
\expandafter{\expandafter}\romannumeral`&&@#1,%
@@ -1322,58 +1399,21 @@
\xint_bye,\xint_bye,\xint_bye,\xint_bye,%
\xint_relax
}%
-\def\XINT_reverse:f:csv_loop #1#2,#3,#4,#5,#6,#7,#8,#9,%
+\long\def\XINT_reverse:f:csv_loop #1#2,#3,#4,#5,#6,#7,#8,#9,%
{%
\xint_bye #9\XINT_reverse:f:csv_cleanup\xint_bye
\XINT_reverse:f:csv_loop {,#9,#8,#7,#6,#5,#4,#3,#2#1}%
}%
-\def\XINT_reverse:f:csv_cleanup\xint_bye\XINT_reverse:f:csv_loop #1#2\xint_relax
+\long\def\XINT_reverse:f:csv_cleanup\xint_bye\XINT_reverse:f:csv_loop #1#2\xint_relax
{%
\XINT_reverse:f:csv_finish #1%
}%
-\def\XINT_reverse:f:csv_finish #1\xint_relax,{ }%
-\def\xintLength:f:csv {\romannumeral0\xintlength:f:csv }%
-\def\xintlength:f:csv #1%
-{%
- \expandafter\XINT_length:f:csv_a
- \romannumeral`&&@#1\xint_relax,\xint_relax,\xint_relax,\xint_relax,%
- \xint_relax,\xint_relax,\xint_relax,\xint_relax,\xint_bye
-}%
-\def\XINT_length:f:csv_a #1%
-{%
- \xint_gob_til_xint_relax #1\XINT_length:f:csv_empty\xint_relax
- \XINT_length:f:csv_loop 0.#1%
-}%
-\def\XINT_length:f:csv_empty #1\xint_bye { 0}%
-\def\XINT_length:f:csv_loop #1.#2,#3,#4,#5,#6,#7,#8,#9,%
-{%
- \xint_gob_til_xint_relax #9\XINT_length:f:csv_finish_a\xint_relax
- \expandafter\XINT_length:f:csv_loop\the\numexpr #1+\xint_c_viii.%
-}%
-\def\XINT_length:f:csv_finish_a\xint_relax
- \expandafter\XINT_length:f:csv_loop\the\numexpr #1+\xint_c_viii.#2\xint_bye
-{%
- \XINT_length:f:csv_finish_b #2\W,\W,\W,\W,\W,\W,\W,\Z {#1}%
-}%
-\def\XINT_length:f:csv_finish_b #1,#2,#3,#4,#5,#6,#7,#8\Z
-{%
- \xint_gob_til_W
- #1\XINT_length:f:csv_finish_c \xint_c_i
- #2\XINT_length:f:csv_finish_c \xint_c_ii
- #3\XINT_length:f:csv_finish_c \xint_c_iii
- #4\XINT_length:f:csv_finish_c \xint_c_iv
- #5\XINT_length:f:csv_finish_c \xint_c_v
- #6\XINT_length:f:csv_finish_c \xint_c_vi
- #7\XINT_length:f:csv_finish_c \xint_c_vii
- \W\XINT_length:f:csv_finish_c \xint_c_viii\Z
-}%
-\edef\XINT_length:f:csv_finish_c #1#2\Z #3%
- {\noexpand\expandafter\space\noexpand\the\numexpr #3+#1\relax}%
-\let\xintCSVTrim \xintTrim:f:csv
+\long\def\XINT_reverse:f:csv_finish #1\xint_relax,{ }%
+\let\xintCSVLength \xintLength:f:csv
\let\xintCSVKeep \xintKeep:f:csv
+\let\xintCSVTrim \xintTrim:f:csv
\let\xintCSVNthEltPy \xintNthEltPy:f:csv
\let\xintCSVReverse \xintReverse:f:csv
-\let\xintCSVLength \xintLength:f:csv
\let\XINT_tmpa\relax \let\XINT_tmpb\relax \let\XINT_tmpc\relax
\XINT_restorecatcodes_endinput%
\endinput