texlive[60548] Build/source/texk/mendexk: mendex: modify heuristic

commits+takuji at tug.org commits+takuji at tug.org
Sun Sep 19 10:50:52 CEST 2021


Revision: 60548
          http://tug.org/svn/texlive?view=revision&revision=60548
Author:   takuji
Date:     2021-09-19 10:50:52 +0200 (Sun, 19 Sep 2021)
Log Message:
-----------
mendex: modify heuristic detection of page number types

Modified Paths:
--------------
    trunk/Build/source/texk/mendexk/ChangeLog
    trunk/Build/source/texk/mendexk/fread.c
    trunk/Build/source/texk/mendexk/tests/mendex.test
    trunk/Build/source/texk/mendexk/tests/range.idx
    trunk/Build/source/texk/mendexk/tests/range1.ind
    trunk/Build/source/texk/mendexk/tests/range2.ind
    trunk/Build/source/texk/mendexk/tests/range3.ind
    trunk/Build/source/texk/mendexk/version.h

Added Paths:
-----------
    trunk/Build/source/texk/mendexk/tests/pprec3.ist
    trunk/Build/source/texk/mendexk/tests/pprec4.ist
    trunk/Build/source/texk/mendexk/tests/pprecB-0.ind
    trunk/Build/source/texk/mendexk/tests/pprecB-3.ind
    trunk/Build/source/texk/mendexk/tests/pprecB-4.ind
    trunk/Build/source/texk/mendexk/tests/pprecB.idx

Modified: trunk/Build/source/texk/mendexk/ChangeLog
===================================================================
--- trunk/Build/source/texk/mendexk/ChangeLog	2021-09-19 08:43:57 UTC (rev 60547)
+++ trunk/Build/source/texk/mendexk/ChangeLog	2021-09-19 08:50:52 UTC (rev 60548)
@@ -1,3 +1,12 @@
+2021-09-19  TANAKA Takuji  <ttk at 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 at t-lab.opal.ne.jp>
 
 	* fread.c, fwrite.c, sort.c, mendex.h, {,ex}var.h:

Modified: trunk/Build/source/texk/mendexk/fread.c
===================================================================
--- trunk/Build/source/texk/mendexk/fread.c	2021-09-19 08:43:57 UTC (rev 60547)
+++ trunk/Build/source/texk/mendexk/fread.c	2021-09-19 08:50:52 UTC (rev 60548)
@@ -268,7 +268,7 @@
 					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 @@
 					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 @@
 				}
 				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 @@
 				}
 				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;

Modified: trunk/Build/source/texk/mendexk/tests/mendex.test
===================================================================
--- trunk/Build/source/texk/mendexk/tests/mendex.test	2021-09-19 08:43:57 UTC (rev 60547)
+++ trunk/Build/source/texk/mendexk/tests/mendex.test	2021-09-19 08:50:52 UTC (rev 60548)
@@ -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 @@
 	-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
+

Added: trunk/Build/source/texk/mendexk/tests/pprec3.ist
===================================================================
--- trunk/Build/source/texk/mendexk/tests/pprec3.ist	                        (rev 0)
+++ trunk/Build/source/texk/mendexk/tests/pprec3.ist	2021-09-19 08:50:52 UTC (rev 60548)
@@ -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]]"
+

Added: trunk/Build/source/texk/mendexk/tests/pprec4.ist
===================================================================
--- trunk/Build/source/texk/mendexk/tests/pprec4.ist	                        (rev 0)
+++ trunk/Build/source/texk/mendexk/tests/pprec4.ist	2021-09-19 08:50:52 UTC (rev 60548)
@@ -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]]"
+

Added: trunk/Build/source/texk/mendexk/tests/pprecB-0.ind
===================================================================
--- trunk/Build/source/texk/mendexk/tests/pprecB-0.ind	                        (rev 0)
+++ trunk/Build/source/texk/mendexk/tests/pprecB-0.ind	2021-09-19 08:50:52 UTC (rev 60548)
@@ -0,0 +1,5 @@
+\begin{theindex}
+
+  \item entryA[[delim0]]1[[sfx 3p]], a[[sfx 3p]], A[[sfx 3p]]
+
+\end{theindex}

Added: trunk/Build/source/texk/mendexk/tests/pprecB-3.ind
===================================================================
--- trunk/Build/source/texk/mendexk/tests/pprecB-3.ind	                        (rev 0)
+++ trunk/Build/source/texk/mendexk/tests/pprecB-3.ind	2021-09-19 08:50:52 UTC (rev 60548)
@@ -0,0 +1,5 @@
+\begin{theindex}
+
+  \item entryA[[delim0]]1[[sfx 3p]], a[[sfx 3p]], A[[sfx 3p]]
+
+\end{theindex}

Added: trunk/Build/source/texk/mendexk/tests/pprecB-4.ind
===================================================================
--- trunk/Build/source/texk/mendexk/tests/pprecB-4.ind	                        (rev 0)
+++ trunk/Build/source/texk/mendexk/tests/pprecB-4.ind	2021-09-19 08:50:52 UTC (rev 60548)
@@ -0,0 +1,5 @@
+\begin{theindex}
+
+  \item entryA[[delim0]]A[[sfx 3p]], 1[[sfx 3p]], a[[sfx 3p]]
+
+\end{theindex}

Added: trunk/Build/source/texk/mendexk/tests/pprecB.idx
===================================================================
--- trunk/Build/source/texk/mendexk/tests/pprecB.idx	                        (rev 0)
+++ trunk/Build/source/texk/mendexk/tests/pprecB.idx	2021-09-19 08:50:52 UTC (rev 60548)
@@ -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}

Modified: trunk/Build/source/texk/mendexk/tests/range.idx
===================================================================
--- trunk/Build/source/texk/mendexk/tests/range.idx	2021-09-19 08:43:57 UTC (rev 60547)
+++ trunk/Build/source/texk/mendexk/tests/range.idx	2021-09-19 08:50:52 UTC (rev 60548)
@@ -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}

Modified: trunk/Build/source/texk/mendexk/tests/range1.ind
===================================================================
--- trunk/Build/source/texk/mendexk/tests/range1.ind	2021-09-19 08:43:57 UTC (rev 60547)
+++ trunk/Build/source/texk/mendexk/tests/range1.ind	2021-09-19 08:50:52 UTC (rev 60548)
@@ -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]], 

Modified: trunk/Build/source/texk/mendexk/tests/range2.ind
===================================================================
--- trunk/Build/source/texk/mendexk/tests/range2.ind	2021-09-19 08:43:57 UTC (rev 60547)
+++ trunk/Build/source/texk/mendexk/tests/range2.ind	2021-09-19 08:50:52 UTC (rev 60548)
@@ -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, 

Modified: trunk/Build/source/texk/mendexk/tests/range3.ind
===================================================================
--- trunk/Build/source/texk/mendexk/tests/range3.ind	2021-09-19 08:43:57 UTC (rev 60547)
+++ trunk/Build/source/texk/mendexk/tests/range3.ind	2021-09-19 08:50:52 UTC (rev 60548)
@@ -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]], 

Modified: trunk/Build/source/texk/mendexk/version.h
===================================================================
--- trunk/Build/source/texk/mendexk/version.h	2021-09-19 08:43:57 UTC (rev 60547)
+++ trunk/Build/source/texk/mendexk/version.h	2021-09-19 08:50:52 UTC (rev 60548)
@@ -1,2 +1,2 @@
-#define VERSION  "version " PACKAGE_VERSION " [18-Sep-2021]"
+#define VERSION  "version " PACKAGE_VERSION " [19-Sep-2021]"
 #define BUG_ADDRESS "issue at texjp.org"



More information about the tex-live-commits mailing list.