diff options
-rw-r--r-- | Build/source/texk/mendexk/ChangeLog | 9 | ||||
-rw-r--r-- | Build/source/texk/mendexk/fread.c | 12 | ||||
-rwxr-xr-x | Build/source/texk/mendexk/tests/mendex.test | 14 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/pprec3.ist | 11 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/pprec4.ist | 11 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/pprecB-0.ind | 5 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/pprecB-3.ind | 5 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/pprecB-4.ind | 5 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/pprecB.idx | 9 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/range.idx | 14 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/range1.ind | 4 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/range2.ind | 4 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/range3.ind | 4 | ||||
-rw-r--r-- | Build/source/texk/mendexk/version.h | 2 |
14 files changed, 90 insertions, 19 deletions
diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog index b443138bec0..535313bf071 100644 --- a/Build/source/texk/mendexk/ChangeLog +++ b/Build/source/texk/mendexk/ChangeLog @@ -1,3 +1,12 @@ +2021-09-19 TANAKA Takuji <ttk@t-lab.opal.ne.jp> + + * fread.c: + Modify heuristic detection of page number types. + * tests/mendex.test, tests/range.idx, tests/range[123].ind, + tests/pprecB.idx, tests/pprec[34].ist, tests/pprecB-[034].ind: + Update tests. + * version.h: Date [19-Sep-2021] + 2021-09-18 TANAKA Takuji <ttk@t-lab.opal.ne.jp> * fread.c, fwrite.c, sort.c, mendex.h, {,ex}var.h: diff --git a/Build/source/texk/mendexk/fread.c b/Build/source/texk/mendexk/fread.c index 855920f4cf6..daffe7d523c 100644 --- a/Build/source/texk/mendexk/fread.c +++ b/Build/source/texk/mendexk/fread.c @@ -268,7 +268,7 @@ LOOP: nest++; else if (buff[j]==arg_close) { if (nest==0) { - table[k]='\0'; + table[k]='\0'; ind[0].p[0].page=xstrdup(table); break; } @@ -339,7 +339,7 @@ LOOP: copy_multibyte_char(buff, table, &j, &k); } - table[k]='\0'; + table[k]='\0'; for (k=0;k<=ind[l].num;k++) { if (strcmp(ind[l].p[k].page,table)==0) { @@ -531,7 +531,9 @@ ATTRLOOP: } break; case 'a': - if (*page0<'a' || *page0>'z' || strlen(buff)>1) { + if (*page0<'a' || *page0>'z' || strlen(buff)>1 || + (strchr("ivx",*page0) && strchr(page_precedence,'r') && !pcpos)) { + /* heuristic detection as roman number since I=1, V=5, X=10 are quite small */ if (pattr[cc]<pplen-1) pattr[cc]++; else pattr[cc]=0; @@ -540,7 +542,9 @@ ATTRLOOP: } break; case 'A': - if (*page0<'A' || *page0>'Z' || strlen(buff)>1) { + if (*page0<'A' || *page0>'Z' || strlen(buff)>1 || + (strchr("IVX",*page0) && strchr(page_precedence,'R') && !pcpos)) { + /* heuristic detection as roman number since I=1, V=5, X=10 are quite small */ if (pattr[cc]<pplen-1) pattr[cc]++; else pattr[cc]=0; diff --git a/Build/source/texk/mendexk/tests/mendex.test b/Build/source/texk/mendexk/tests/mendex.test index e4b36caa8af..f7556555ea9 100755 --- a/Build/source/texk/mendexk/tests/mendex.test +++ b/Build/source/texk/mendexk/tests/mendex.test @@ -7,7 +7,7 @@ TEXMFCNF=$srcdir/../kpathsea export TEXMFCNF -rm -f foo.* uni.* pprec*.* rangetwo.* +rm -f foo.* uni.* range*.* pprec*.* ./mendex $srcdir/tests/foo.idx -o foo.ind1 -t foo.ilg1 \ && diff $srcdir/tests/foo.ind foo.ind1 || exit 1 @@ -54,3 +54,15 @@ cat $srcdir/tests/uni.idx | \ -o pprecA-2.ind1 -t pprecA-2.ilg \ && diff $srcdir/tests/pprecA-2.ind pprecA-2.ind1 || exit 1 +./mendex -s $srcdir/tests/pprec0.ist $srcdir/tests/pprecB.idx \ + -o pprecB-0.ind1 -t pprecB-0.ilg \ + && diff $srcdir/tests/pprecB-0.ind pprecB-0.ind1 || exit 1 + +./mendex -s $srcdir/tests/pprec3.ist $srcdir/tests/pprecB.idx \ + -o pprecB-3.ind1 -t pprecB-3.ilg \ + && diff $srcdir/tests/pprecB-3.ind pprecB-3.ind1 || exit 1 + +./mendex -s $srcdir/tests/pprec4.ist $srcdir/tests/pprecB.idx \ + -o pprecB-4.ind1 -t pprecB-4.ilg \ + && diff $srcdir/tests/pprecB-4.ind pprecB-4.ind1 || exit 1 + diff --git a/Build/source/texk/mendexk/tests/pprec3.ist b/Build/source/texk/mendexk/tests/pprec3.ist new file mode 100644 index 00000000000..b8f33af1dd8 --- /dev/null +++ b/Build/source/texk/mendexk/tests/pprec3.ist @@ -0,0 +1,11 @@ +% -*- coding: utf-8 -*- + +page_precedence "naA" + +delim_0 "[[delim0]]" +delim_1 "[[delim1]]" +delim_2 "[[delim2]]" +delim_r "[[delimr]]" +suffix_2p "[[sfx 2p]]" +suffix_3p "[[sfx 3p]]" + diff --git a/Build/source/texk/mendexk/tests/pprec4.ist b/Build/source/texk/mendexk/tests/pprec4.ist new file mode 100644 index 00000000000..768fec7642b --- /dev/null +++ b/Build/source/texk/mendexk/tests/pprec4.ist @@ -0,0 +1,11 @@ +% -*- coding: utf-8 -*- + +page_precedence "Ana" + +delim_0 "[[delim0]]" +delim_1 "[[delim1]]" +delim_2 "[[delim2]]" +delim_r "[[delimr]]" +suffix_2p "[[sfx 2p]]" +suffix_3p "[[sfx 3p]]" + diff --git a/Build/source/texk/mendexk/tests/pprecB-0.ind b/Build/source/texk/mendexk/tests/pprecB-0.ind new file mode 100644 index 00000000000..1e23d9fb4a7 --- /dev/null +++ b/Build/source/texk/mendexk/tests/pprecB-0.ind @@ -0,0 +1,5 @@ +\begin{theindex} + + \item entryA[[delim0]]1[[sfx 3p]], a[[sfx 3p]], A[[sfx 3p]] + +\end{theindex} diff --git a/Build/source/texk/mendexk/tests/pprecB-3.ind b/Build/source/texk/mendexk/tests/pprecB-3.ind new file mode 100644 index 00000000000..1e23d9fb4a7 --- /dev/null +++ b/Build/source/texk/mendexk/tests/pprecB-3.ind @@ -0,0 +1,5 @@ +\begin{theindex} + + \item entryA[[delim0]]1[[sfx 3p]], a[[sfx 3p]], A[[sfx 3p]] + +\end{theindex} diff --git a/Build/source/texk/mendexk/tests/pprecB-4.ind b/Build/source/texk/mendexk/tests/pprecB-4.ind new file mode 100644 index 00000000000..3943ad48549 --- /dev/null +++ b/Build/source/texk/mendexk/tests/pprecB-4.ind @@ -0,0 +1,5 @@ +\begin{theindex} + + \item entryA[[delim0]]A[[sfx 3p]], 1[[sfx 3p]], a[[sfx 3p]] + +\end{theindex} diff --git a/Build/source/texk/mendexk/tests/pprecB.idx b/Build/source/texk/mendexk/tests/pprecB.idx new file mode 100644 index 00000000000..a1d8fc31ae2 --- /dev/null +++ b/Build/source/texk/mendexk/tests/pprecB.idx @@ -0,0 +1,9 @@ +\indexentry{entryA}{a} +\indexentry{entryA}{b} +\indexentry{entryA}{c} +\indexentry{entryA}{1} +\indexentry{entryA}{2} +\indexentry{entryA}{3} +\indexentry{entryA}{A} +\indexentry{entryA}{B} +\indexentry{entryA}{C} diff --git a/Build/source/texk/mendexk/tests/range.idx b/Build/source/texk/mendexk/tests/range.idx index e77882010c6..3eccb113aa4 100644 --- a/Build/source/texk/mendexk/tests/range.idx +++ b/Build/source/texk/mendexk/tests/range.idx @@ -58,13 +58,13 @@ \indexentry{entryF}{D-DIII} \indexentry{entryF}{D-DIV} -\indexentry{entryP}{A-a-1-I-iii} -\indexentry{entryP}{A-a-2-I-iii} -\indexentry{entryP}{A-a-3-I-iii} -\indexentry{entryP}{A-a-1-II-iii} -\indexentry{entryP}{A-a-1-III-iii} -\indexentry{entryP}{A-a-1-I-iv} -\indexentry{entryP}{A-a-1-I-v} +\indexentry{entryP}{A-a-1-VII-iii} +\indexentry{entryP}{A-a-2-VII-iii} +\indexentry{entryP}{A-a-3-VII-iii} +\indexentry{entryP}{A-a-1-VIII-iii} +\indexentry{entryP}{A-a-1-IX-iii} +\indexentry{entryP}{A-a-1-VII-iv} +\indexentry{entryP}{A-a-1-VII-v} \indexentry{entryQ}{1-2-3-4-5-6-7-8-9-10} \indexentry{entryQ}{1-2-3-4-5-6-7-8-9-11} diff --git a/Build/source/texk/mendexk/tests/range1.ind b/Build/source/texk/mendexk/tests/range1.ind index 0dc1d842a9f..c5f047a55e5 100644 --- a/Build/source/texk/mendexk/tests/range1.ind +++ b/Build/source/texk/mendexk/tests/range1.ind @@ -15,8 +15,8 @@ \item entryF, C-I[[sfx mp]], D-DI[[sfx mp]], V-LIII[[sfx mp]] \item entryF1, C-I[[sfx mp]], \bold{D-DII}, D-DI[[sfx mp]], V-LIII[[sfx mp]] - \item entryP, A-a-1-I-iii[[sfx mp]], A-a-1-II-iii, A-a-1-III-iii, - A-a-2-I-iii, A-a-3-I-iii + \item entryP, A-a-1-VII-iii[[sfx mp]], A-a-1-VIII-iii, A-a-1-IX-iii, + A-a-2-VII-iii, A-a-3-VII-iii \item entryQ, 1-2-3-4-5-6-7-8-9-10[[sfx 2p]], 1-2-3-4-5-6-7-8-9-14[[sfx mp]], 1-2-3-4-5-6-7-8-9-22[[sfx mp]], diff --git a/Build/source/texk/mendexk/tests/range2.ind b/Build/source/texk/mendexk/tests/range2.ind index 9e0bd8ce5e3..789eb3f75c7 100644 --- a/Build/source/texk/mendexk/tests/range2.ind +++ b/Build/source/texk/mendexk/tests/range2.ind @@ -16,8 +16,8 @@ V-LIII[[delim r]]V-LVI \item entryF1, C-I[[delim r]]C-IV, \bold{D-DII}, D-DI[[delim r]]D-DIV, V-LIII[[delim r]]V-LVI - \item entryP, A-a-1-I-iii[[sfx 3p]], A-a-1-II-iii, A-a-1-III-iii, - A-a-2-I-iii, A-a-3-I-iii + \item entryP, A-a-1-VII-iii[[sfx 3p]], A-a-1-VIII-iii, A-a-1-IX-iii, + A-a-2-VII-iii, A-a-3-VII-iii \item entryQ, 1-2-3-4-5-6-7-8-9-10[[sfx 2p]], 1-2-3-4-5-6-7-8-9-14[[sfx 3p]], 1-2-3-4-5-6-7-8-9-22[[delim r]]1-2-3-4-5-6-7-8-9-25, diff --git a/Build/source/texk/mendexk/tests/range3.ind b/Build/source/texk/mendexk/tests/range3.ind index f5b5f5268ff..519730a138e 100644 --- a/Build/source/texk/mendexk/tests/range3.ind +++ b/Build/source/texk/mendexk/tests/range3.ind @@ -15,8 +15,8 @@ \item entryF, C-I[[sfx mp]], D-DI[[sfx mp]], V-LIII[[sfx mp]] \item entryF1, C-I[[sfx mp]], \bold{D-DII}, D-DI[[sfx mp]], V-LIII[[sfx mp]] - \item entryP, A-a-1-I-iii[[sfx 3p]], A-a-1-II-iii, A-a-1-III-iii, - A-a-2-I-iii, A-a-3-I-iii + \item entryP, A-a-1-VII-iii[[sfx 3p]], A-a-1-VIII-iii, A-a-1-IX-iii, + A-a-2-VII-iii, A-a-3-VII-iii \item entryQ, 1-2-3-4-5-6-7-8-9-10[[sfx 2p]], 1-2-3-4-5-6-7-8-9-14[[sfx 3p]], 1-2-3-4-5-6-7-8-9-22[[sfx mp]], diff --git a/Build/source/texk/mendexk/version.h b/Build/source/texk/mendexk/version.h index 20204067866..f61d504deb7 100644 --- a/Build/source/texk/mendexk/version.h +++ b/Build/source/texk/mendexk/version.h @@ -1,2 +1,2 @@ -#define VERSION "version " PACKAGE_VERSION " [18-Sep-2021]" +#define VERSION "version " PACKAGE_VERSION " [19-Sep-2021]" #define BUG_ADDRESS "issue@texjp.org" |