texlive[60535] Build/source/texk: upmendex: improve multi-levels of

commits+takuji at tug.org commits+takuji at tug.org
Sat Sep 18 10:20:21 CEST 2021


Revision: 60535
          http://tug.org/svn/texlive?view=revision&revision=60535
Author:   takuji
Date:     2021-09-18 10:20:21 +0200 (Sat, 18 Sep 2021)
Log Message:
-----------
upmendex: improve multi-levels of page numbers

Modified Paths:
--------------
    trunk/Build/source/texk/README
    trunk/Build/source/texk/upmendex/ChangeLog
    trunk/Build/source/texk/upmendex/exvar.h
    trunk/Build/source/texk/upmendex/fread.c
    trunk/Build/source/texk/upmendex/fwrite.c
    trunk/Build/source/texk/upmendex/mendex.h
    trunk/Build/source/texk/upmendex/sort.c
    trunk/Build/source/texk/upmendex/tests/upmendex.test
    trunk/Build/source/texk/upmendex/var.h

Added Paths:
-----------
    trunk/Build/source/texk/upmendex/tests/range.idx
    trunk/Build/source/texk/upmendex/tests/range1.ind
    trunk/Build/source/texk/upmendex/tests/range1.ist
    trunk/Build/source/texk/upmendex/tests/range2.ind
    trunk/Build/source/texk/upmendex/tests/range2.ist
    trunk/Build/source/texk/upmendex/tests/range3.ind
    trunk/Build/source/texk/upmendex/tests/range3.ist

Removed Paths:
-------------
    trunk/Build/source/texk/upmendex/tests/rangetwo.idx
    trunk/Build/source/texk/upmendex/tests/rangetwo.ind
    trunk/Build/source/texk/upmendex/tests/rangetwo.ist

Modified: trunk/Build/source/texk/README
===================================================================
--- trunk/Build/source/texk/README	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/README	2021-09-18 08:20:21 UTC (rev 60535)
@@ -108,7 +108,7 @@
 
 ttfdump - maintained here, by us, since Taiwan upstream apparently gone.
 
-upmendex 0.58 - by Takuji Tanaka
+upmendex 0.59 - by Takuji Tanaka
   http://www.ctan.org/pkg/upmendex
   https://github.com/t-tk/upmendex-package
 

Modified: trunk/Build/source/texk/upmendex/ChangeLog
===================================================================
--- trunk/Build/source/texk/upmendex/ChangeLog	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/upmendex/ChangeLog	2021-09-18 08:20:21 UTC (rev 60535)
@@ -1,3 +1,17 @@
+2021-09-18  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
+
+	* fread.c, fwrite.c, sort.c, mendex.h, {,ex}var.h:
+	Extend levels of page numbers from 3 to 10
+	for compatibility with makeindex.
+	Fix a bug of page ranges with multi-level page numbers.
+	* fread.c:
+	Strict check for "page_precedence" and "page_compositor" in style file.
+	* fwrite.c:
+	Do not break lines before "delim_n".
+	* tests/upmendex.test, tests/range.idx, tests/range[123].{ist,ind},
+	removed tests/rangetwo.*:
+	Update tests.
+
 2021-09-05  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
 
 	* fwrite.c:

Modified: trunk/Build/source/texk/upmendex/exvar.h
===================================================================
--- trunk/Build/source/texk/upmendex/exvar.h	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/upmendex/exvar.h	2021-09-18 08:20:21 UTC (rev 60535)
@@ -2,7 +2,7 @@
 
 extern int lines,idxcount,acc,reject;
 extern int prange,fsti,lorder,bcomp,force,fpage,gflg,verb,debug;
-extern int warn,scount,pattr[3];
+extern int warn,scount,pattr[];
 
 extern struct index *ind;
 

Modified: trunk/Build/source/texk/upmendex/fread.c
===================================================================
--- trunk/Build/source/texk/upmendex/fread.c	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/upmendex/fread.c	2021-09-18 08:20:21 UTC (rev 60535)
@@ -493,25 +493,54 @@
 
 static void chkpageattr(struct page *p)
 {
-	int i,j,cc=0;
+	int i,j,cc=0,cnt,pplen,pclen;
+	char buff[16],*pcpos,*page0;
 
+	pplen=strlen(page_precedence);
+	pclen=strlen(page_compositor);
 	for (i=0;i<strlen(p->page);i++) {
-		if (strncmp(page_compositor,&p->page[i],strlen(page_compositor))==0) {
+		page0=&p->page[i];
+		if (strncmp(page_compositor,page0,pclen)==0) {
 			p->attr[cc]=pattr[cc];
 			cc++;
-			i+=strlen(page_compositor)-1;
+			i+=pclen-1;
+			if (cc>=PAGE_COMPOSIT_DEPTH) {
+				if (pclen>0)
+					verb_printf(efp, "\nToo many fields of page number \"%s\".\n", p->page);
+				else
+					verb_printf(efp, "\nIllegular page_comositor specification.\n");
+				exit(253);
+			}
 		}
 		else {
-ATTRLOOP:
-			if (!((p->page[i]>='0' && p->page[i]<='9') || (p->page[i]>='A' && p->page[i]<='Z') || (p->page[i]>='a' && p->page[i]<='z'))) {
+			cnt=0;
+			if (!((*page0>='0' && *page0<='9') || (*page0>='A' && *page0<='Z') || (*page0>='a' && *page0<='z'))) {
 				p->attr[cc]= -1;
 				if (cc<2) p->attr[++cc]= -1;
 				return;
 			}
+			pcpos=strstr(page0,page_compositor);
+			j=pcpos ? pcpos-page0 : strlen(page0);
+			if (j>15) {
+				verb_printf(efp, "\nToo long page number string \"%s\".\n", page0);
+				exit(253);
+			}
+			strncpy(buff,page0,j);
+			buff[j]='\0';
+ATTRLOOP:
+			cnt++;
+			if (cnt>pplen) {
+				verb_printf(efp, "\nFailed to find page type for page \"%s\" in page_precedence specification (%s).\n",
+					    page0, page_precedence);
+				exit(253);
+			}
+
 			switch(page_precedence[pattr[cc]]) {
 			case 'r':
-				if (strchr("ivxlcdm",p->page[i])==NULL) {
-					if (pattr[cc]<strlen(page_precedence)-1)
+				if (strchr("ivxlcdm",*page0)==NULL ||
+				    (strchr("lcdm",*page0) && strchr(page_precedence,'a') && strlen(buff)==1 && pcpos))  {
+					/* heuristic detection as alphabet since L=50, C=100, D=100, M=1000 are quite large */
+					if (pattr[cc]<pplen-1)
 						pattr[cc]++;
 					else pattr[cc]=0;
 					for (j=cc+1;j<3;j++) pattr[j]=0;
@@ -519,8 +548,10 @@
 				}
 				break;
 			case 'R':
-				if (strchr("IVXLCDM",p->page[i])==NULL) {
-					if (pattr[cc]<strlen(page_precedence)-1)
+				if (strchr("IVXLCDM",*page0)==NULL ||
+				    (strchr("LCDM",*page0) && strchr(page_precedence,'A') && strlen(buff)==1 && pcpos))  {
+					/* heuristic detection as alphabet since L=50, C=100, D=100, M=1000 are quite large */
+					if (pattr[cc]<pplen-1)
 						pattr[cc]++;
 					else pattr[cc]=0;
 					for (j=cc+1;j<3;j++) pattr[j]=0;
@@ -528,8 +559,8 @@
 				}
 				break;
 			case 'n':
-				if (p->page[i]<'0' || p->page[i]>'9') {
-					if (pattr[cc]<strlen(page_precedence)-1)
+				if (*page0<'0' || *page0>'9') {
+					if (pattr[cc]<pplen-1)
 						pattr[cc]++;
 					else pattr[cc]=0;
 					for (j=cc+1;j<3;j++) pattr[j]=0;
@@ -537,8 +568,8 @@
 				}
 				break;
 			case 'a':
-				if (p->page[i]<'a' || p->page[i]>'z') {
-					if (pattr[cc]<strlen(page_precedence)-1)
+				if (*page0<'a' || *page0>'z' || strlen(buff)>1) {
+					if (pattr[cc]<pplen-1)
 						pattr[cc]++;
 					else pattr[cc]=0;
 					for (j=cc+1;j<3;j++) pattr[j]=0;
@@ -546,8 +577,8 @@
 				}
 				break;
 			case 'A':
-				if (p->page[i]<'A' || p->page[i]>'Z') {
-					if (pattr[cc]<strlen(page_precedence)-1)
+				if (*page0<'A' || *page0>'Z' || strlen(buff)>1) {
+					if (pattr[cc]<pplen-1)
 						pattr[cc]++;
 					else pattr[cc]=0;
 					for (j=cc+1;j<3;j++) pattr[j]=0;
@@ -555,7 +586,9 @@
 				}
 				break;
 			default:
-				break;
+				verb_printf(efp, "\nUnknown page type '%c' in page_precedence specification (%s).\n",
+					   page_precedence[pattr[cc]], page_precedence);
+				exit(253);
 			}
 		}
 	}

Modified: trunk/Build/source/texk/upmendex/fwrite.c
===================================================================
--- trunk/Build/source/texk/upmendex/fwrite.c	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/upmendex/fwrite.c	2021-09-18 08:20:21 UTC (rev 60535)
@@ -13,7 +13,7 @@
 
 static void printpage(struct index *ind, FILE *fp, int num, char *lbuff);
 static int range_check(struct index ind, int count, char *lbuff);
-static void linecheck(char *lbuff, char *tmpbuff);
+static void linecheck(char *lbuff, char *tmpbuff, int force);
 static void crcheck(char *lbuff, FILE *fp);
 static void index_normalize(UChar *istr, UChar *ini, int *chset);
 static int initial_cmp_char(UChar *ini, UChar ch);
@@ -128,7 +128,7 @@
     vsnprintf(print_buff, sizeof print_buff, format, argptr);
     va_end(argptr);
 
-    warn++;    
+    warn++;
     fputs(print_buff, stderr);
     if (fp!=stderr) fputs(print_buff, fp);
 }
@@ -146,7 +146,23 @@
     if (fp!=stderr) fputs(print_buff, fp);
 }
 
+static int pnumconv2(struct page *p)
+{
+	int j,k,cc,pclen;
 
+	pclen=strlen(page_compositor);
+	for (j=k=cc=0;j<strlen(p->page);j++) {
+		if (strncmp(p->page+j,page_compositor,pclen)==0) {
+			j+=pclen;
+			k=j;
+			cc++;
+			continue;
+		}
+	}
+	return pnumconv(p->page+k,p->attr[cc]);
+}
+
+
 /*   write ind file   */
 void indwrite(char *filename, struct index *ind, int pagenum)
 {
@@ -507,7 +523,9 @@
 	for(j=0;j<ind[num].num;j++) {
 		cc=range_check(ind[num],j,lbuff);
 		if (cc>j) {
-			if (pnumconv(ind[num].p[j].page,ind[num].p[j].attr[0])==pnumconv(ind[num].p[cc].page,ind[num].p[cc].attr[0])) {
+			int epage = pnumconv2(&ind[num].p[cc]);
+			int bpage = pnumconv2(&ind[num].p[j]);
+			if (epage==bpage) {
 				j=cc-1;
 				continue;
 			}
@@ -518,20 +536,18 @@
 			if (strlen(ind[num].p[j].enc)>0) {
 				SPRINTF(buff,"%s%s%s",encap_prefix,ind[num].p[j].enc,encap_infix);
 			}
-			if (strlen(suffix_3p)>0 && (pnumconv(ind[num].p[cc].page,ind[num].p[cc].attr[0])-pnumconv(ind[num].p[j].page,ind[num].p[j].attr[0]))==2) {
-				SAPPENDF(buff,"%s",ind[num].p[j].page);
+			/* print beginning of range */
+			SAPPENDF(buff,"%s",ind[num].p[j].page);
+			if (strlen(suffix_3p)>0 && epage-bpage==2) {
 				SAPPENDF(buff,"%s",suffix_3p);
 			}
-			else if (strlen(suffix_mp)>0 && (pnumconv(ind[num].p[cc].page,ind[num].p[cc].attr[0])-pnumconv(ind[num].p[j].page,ind[num].p[j].attr[0]))>=2) {
-				SAPPENDF(buff,"%s",ind[num].p[j].page);
+			else if (strlen(suffix_mp)>0 && epage-bpage>=2) {
 				SAPPENDF(buff,"%s",suffix_mp);
 			}
-			else if (strlen(suffix_2p)>0 && (pnumconv(ind[num].p[cc].page,ind[num].p[cc].attr[0])-pnumconv(ind[num].p[j].page,ind[num].p[j].attr[0]))==1) {
-				SAPPENDF(buff,"%s",ind[num].p[j].page);
+			else if (strlen(suffix_2p)>0 && epage-bpage==1) {
 				SAPPENDF(buff,"%s",suffix_2p);
 			}
 			else {
-				SAPPENDF(buff,"%s",ind[num].p[j].page);
 				SAPPENDF(buff,"%s",delim_r);
 				SAPPENDF(buff,"%s",ind[num].p[cc].page);
 			}
@@ -540,7 +556,7 @@
 			if (strlen(ind[num].p[j].enc)>0) {
 				SAPPENDF(tmpbuff,"%s",encap_suffix);
 			}
-			linecheck(lbuff,tmpbuff);
+			linecheck(lbuff,tmpbuff, FALSE);
 			j=cc;
 			if (j==ind[num].num) {
 				goto PRINT;
@@ -547,7 +563,7 @@
 			}
 			else {
 				SAPPENDF(tmpbuff,"%s",delim_n);
-				linecheck(lbuff,tmpbuff);
+				linecheck(lbuff,tmpbuff, TRUE);
 			}
 		}
 		else if (strlen(ind[num].p[j].enc)>0) {
@@ -569,12 +585,12 @@
 				SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
 				SAPPENDF(tmpbuff,"%s",encap_suffix);
 				SAPPENDF(tmpbuff,"%s",delim_n);
-				linecheck(lbuff,tmpbuff);
+				linecheck(lbuff,tmpbuff, FALSE);
 			}
 			else {
 				SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
 				SAPPENDF(tmpbuff,"%s",delim_n);
-				linecheck(lbuff,tmpbuff);
+				linecheck(lbuff,tmpbuff, FALSE);
 			}
 		}
 		else {
@@ -581,7 +597,7 @@
 /* no encap */
 			SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
 			SAPPENDF(tmpbuff,"%s",delim_n);
-			linecheck(lbuff,tmpbuff);
+			linecheck(lbuff,tmpbuff, FALSE);
 		}
 	}
 
@@ -615,7 +631,7 @@
 	else {
 		SAPPENDF(tmpbuff,"%s",ind[num].p[j].page);
 	}
-	linecheck(lbuff,tmpbuff);
+	linecheck(lbuff,tmpbuff, FALSE);
 
 PRINT:
 	fputs(lbuff,fp);
@@ -661,7 +677,7 @@
 					if (strlen(ind.p[j].enc)>0) {
 						SPRINTF(tmpbuff,"%s%s%s%s%s%s",encap_prefix,ind.p[j].enc,encap_infix
 						                              ,ind.p[j].page,encap_suffix,delim_n);
-						linecheck(lbuff,tmpbuff);
+						linecheck(lbuff,tmpbuff, FALSE);
 					}
 				}
 			}
@@ -691,8 +707,8 @@
 			break;
 		}
 	}
-	cc1=pnumconv(ind.p[i-1].page,ind.p[i-1].attr[0]);
-	cc2=pnumconv(ind.p[count].page,ind.p[count].attr[0]);
+	cc1=pnumconv2(&ind.p[i-1]);
+	cc2=pnumconv2(&ind.p[count]);
 	if (cc1>=cc2+2 || (cc1>=cc2+1 && strlen(suffix_2p)) || force) {
 		return i-1;
 	}
@@ -700,9 +716,9 @@
 }
 
 /*   check line length   */
-static void linecheck(char *lbuff, char *tmpbuff)
+static void linecheck(char *lbuff, char *tmpbuff, int force)
 {
-	if (line_length+strlen(tmpbuff)>line_max) {
+	if (line_length+strlen(tmpbuff)>line_max && !force) {
 		SAPPENDF(lbuff,"\n");
 		SAPPENDF(lbuff,"%s",indent_space);
 		SAPPENDF(lbuff,"%s",tmpbuff);

Modified: trunk/Build/source/texk/upmendex/mendex.h
===================================================================
--- trunk/Build/source/texk/upmendex/mendex.h	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/upmendex/mendex.h	2021-09-18 08:20:21 UTC (rev 60535)
@@ -11,10 +11,12 @@
 #include <unicode/uchar.h>
 #include <unicode/ucol.h>
 
+#define PAGE_COMPOSIT_DEPTH 10
+
 struct page {
 	char *page;
 	char *enc;
-	int attr[3];
+	int attr[PAGE_COMPOSIT_DEPTH];
 };
 
 struct index {

Modified: trunk/Build/source/texk/upmendex/sort.c
===================================================================
--- trunk/Build/source/texk/upmendex/sort.c	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/upmendex/sort.c	2021-09-18 08:20:21 UTC (rev 60535)
@@ -248,12 +248,12 @@
 static int pcomp(const void *p, const void *q)
 {
 	int i,j,cc=0,num1,num2;
-	char buff[16];
+	char buff[16],*p0,*p1;
 	const struct page *page1 = p, *page2 = q;
 
 	scount++;
 
-	for (i=0;i<3;i++) {
+	for (i=0;i<PAGE_COMPOSIT_DEPTH;i++) {
 		if ((page1->attr[i]<0)&&(page2->attr[i]<0)) return 0;
 		else if ((page1->attr[i]<0)&&(page2->attr[i]>=0)) return -1;
 		else if ((page2->attr[i]<0)&&(page1->attr[i]>=0)) return 1;
@@ -261,18 +261,18 @@
 		if (page1->attr[i]>page2->attr[i]) return 1;
 		if (page1->attr[i]<page2->attr[i]) return -1;
 
-		for (j=cc;j<strlen(page1->page);j++) {
-			if (strncmp(&page1->page[j],page_compositor,strlen(page_compositor))==0) break;
-		}
-		strncpy(buff,&page1->page[cc],j-cc);
-		buff[j-cc]='\0';
+		p0=&page1->page[cc];
+		p1=strstr(p0, page_compositor);
+		j=p1 ? p1-p0 : strlen(p0);
+		strncpy(buff,p0,j);
+		buff[j]='\0';
 		num1=pnumconv(buff,page1->attr[i]);
 
-		for (j=cc;j<strlen(page2->page);j++) {
-			if (strncmp(&page2->page[j],page_compositor,strlen(page_compositor))==0) break;
-		}
-		strncpy(buff,&page2->page[cc],j-cc);
-		buff[j-cc]='\0';
+		p0=&page2->page[cc];
+		p1=strstr(p0, page_compositor);
+		j=p1 ? p1-p0 : strlen(p0);
+		strncpy(buff,p0,j);
+		buff[j]='\0';
 		num2=pnumconv(buff,page2->attr[i]);
 
 		if (num1>num2) return 1;
@@ -281,7 +281,8 @@
 		if (page1->enc[0]=='(' || page2->enc[0]==')') return -1;
 		if (page1->enc[0]==')' || page2->enc[0]=='(') return 1;
 
-		cc=j+strlen(page_compositor);
+		if (p1) cc+=j+strlen(page_compositor);
+		else return 0;
 	}
 
 	return 0;
@@ -528,35 +529,48 @@
 
 int chkcontinue(struct page *p, int num)
 {
-	int i,j,cc=0,num1,num2;
-	char buff[16];
+	int i,j,cc=0,num1,num2,k1,k2;
+	char buff1[16],buff2[16],*p0,*p1;
 
-	for (i=0;i<3;i++) {
+	for (i=0;i<PAGE_COMPOSIT_DEPTH;i++) {
 		if ((p[num].attr[i]<0)&&(p[num+1].attr[i]<0)) return 1;
 		else if (p[num].attr[i]!=p[num+1].attr[i]) return 0;
 
-		for (j=cc;j<strlen(p[num].page);j++) {
-			if (strncmp(&p[num].page[j],page_compositor,strlen(page_compositor))==0) break;
+		p0=&p[num].page[cc];
+		p1=strstr(p0, page_compositor);
+		if (p1) {
+			j=p1-p0;
+			k1=j;
+		} else {
+			j=strlen(p0);
+			k1=0;
 		}
-		strncpy(buff,&p[num].page[cc],j);
-		buff[j]='\0';
-		num1=pnumconv(buff,p[num].attr[i]);
+		strncpy(buff1,p0,j);
+		buff1[j]='\0';
+		num1=pnumconv(buff1,p[num].attr[i]);
 
-		for (j=cc;j<strlen(p[num+1].page);j++) {
-			if (strncmp(&p[num+1].page[j],page_compositor,strlen(page_compositor))==0) break;
+		p0=&p[num+1].page[cc];
+		p1=strstr(p0, page_compositor);
+		if (p1) {
+			j=p1-p0;
+			k2=j;
+		} else {
+			j=strlen(p0);
+			k2=0;
 		}
-		strncpy(buff,&p[num+1].page[cc],j);
-		buff[j]='\0';
-		num2=pnumconv(buff,p[num+1].attr[i]);
+		strncpy(buff2,p0,j);
+		buff2[j]='\0';
+		num2=pnumconv(buff2,p[num+1].attr[i]);
 
-		if (num1==num2 || num1+1==num2) {
-			if (i==2) return 1;
-			if ((p[num].attr[i+1]<0)&&(p[num+1].attr[i+1]<0)) return 1;
-			else return 0;
+		if (k1>0 || k2>0) {
+			if (k1!=k2) return 0;
+			if (strcmp(buff1,buff2)) return 0;
+			cc+=k1+strlen(page_compositor);
+			continue;
 		}
-		else if (num1!=num2) return 0;
 
-		cc=j+strlen(page_compositor);
+		if (num1==num2 || num1+1==num2) return 1;
+		else return 0;
 	}
 
 	return 1;

Added: trunk/Build/source/texk/upmendex/tests/range.idx
===================================================================
--- trunk/Build/source/texk/upmendex/tests/range.idx	                        (rev 0)
+++ trunk/Build/source/texk/upmendex/tests/range.idx	2021-09-18 08:20:21 UTC (rev 60535)
@@ -0,0 +1,126 @@
+\indexentry{entryA}{1}
+\indexentry{entryA}{2}
+\indexentry{entryA}{iii}
+\indexentry{entryA}{iv}
+\indexentry{entryA}{IX}
+\indexentry{entryA}{X}
+
+\indexentry{entryB}{1}
+\indexentry{entryB}{2}
+\indexentry{entryB}{3}
+\indexentry{entryB}{iii}
+\indexentry{entryB}{iv}
+\indexentry{entryB}{v}
+\indexentry{entryB}{IX}
+\indexentry{entryB}{X}
+\indexentry{entryB}{XI}
+
+\indexentry{entryC}{1}
+\indexentry{entryC}{2}
+\indexentry{entryC}{3}
+\indexentry{entryC}{4}
+\indexentry{entryC|bold}{iii}
+\indexentry{entryC|bold}{iv}
+\indexentry{entryC|bold}{v}
+\indexentry{entryC|bold}{vi}
+\indexentry{entryC}{IX}
+\indexentry{entryC|bold}{X}
+\indexentry{entryC}{XI}
+\indexentry{entryC}{XII}
+
+\indexentry{entryD}{c-1}
+\indexentry{entryD}{c-2}
+\indexentry{entryD}{i-iii}
+\indexentry{entryD}{i-iv}
+\indexentry{entryD}{d-IX}
+\indexentry{entryD}{d-X}
+
+\indexentry{entryE}{c-1}
+\indexentry{entryE}{c-2}
+\indexentry{entryE}{c-3}
+\indexentry{entryE}{i-iii}
+\indexentry{entryE}{i-iv}
+\indexentry{entryE}{i-v}
+\indexentry{entryE}{d-IX}
+\indexentry{entryE}{d-X}
+\indexentry{entryE}{d-XI}
+
+\indexentry{entryF}{C-I}
+\indexentry{entryF}{C-II}
+\indexentry{entryF}{C-III}
+\indexentry{entryF}{C-IV}
+\indexentry{entryF}{V-LIII}
+\indexentry{entryF}{V-LIV}
+\indexentry{entryF}{V-LV}
+\indexentry{entryF}{V-LVI}
+\indexentry{entryF}{D-DI}
+\indexentry{entryF}{D-DII}
+\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{entryQ}{1-2-3-4-5-6-7-8-9-10}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-11}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-14}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-15}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-16}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-22}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-23}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-24}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-25}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-i}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-ii}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-iii}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-iv}
+\indexentry{entryQ}{1-2-3-4-5-6-7-8-9-v}
+
+\indexentry{entryA1|(}{1}
+\indexentry{entryA1|)}{2}
+\indexentry{entryA1|(}{iii}
+\indexentry{entryA1|)}{iv}
+\indexentry{entryA1|(}{IX}
+\indexentry{entryA1|)}{X}
+
+\indexentry{entryB1|(}{1}
+\indexentry{entryB1|)}{3}
+\indexentry{entryB1|(}{iii}
+\indexentry{entryB1|)}{v}
+\indexentry{entryB1|(}{IX}
+\indexentry{entryB1|)}{XI}
+
+\indexentry{entryC1|(}{1}
+\indexentry{entryC1|)}{4}
+\indexentry{entryC1|(bold}{iii}
+\indexentry{entryC1|)}{vi}
+\indexentry{entryC1|(}{IX}
+\indexentry{entryC1|bold}{X}
+\indexentry{entryC1|)}{XII}
+
+\indexentry{entryD1|(}{c-1}
+\indexentry{entryD1|)}{c-2}
+\indexentry{entryD1|(}{i-iii}
+\indexentry{entryD1|)}{i-iv}
+\indexentry{entryD1|(}{d-IX}
+\indexentry{entryD1|)}{d-X}
+
+\indexentry{entryE1|(}{c-1}
+\indexentry{entryE1|)}{c-3}
+\indexentry{entryE1|(}{i-iii}
+\indexentry{entryE1|)}{i-v}
+\indexentry{entryE1|(}{d-IX}
+\indexentry{entryE1|)}{d-XI}
+
+\indexentry{entryF1|(}{C-I}
+\indexentry{entryF1|)}{C-IV}
+\indexentry{entryF1|(}{V-LIII}
+\indexentry{entryF1|)}{V-LVI}
+\indexentry{entryF1|(}{D-DI}
+\indexentry{entryF1|bold}{D-DII}
+\indexentry{entryF1|)}{D-DIV}

Added: trunk/Build/source/texk/upmendex/tests/range1.ind
===================================================================
--- trunk/Build/source/texk/upmendex/tests/range1.ind	                        (rev 0)
+++ trunk/Build/source/texk/upmendex/tests/range1.ind	2021-09-18 08:20:21 UTC (rev 60535)
@@ -0,0 +1,25 @@
+\begin{theindex}
+
+  \item entryA, 1[[sfx 2p]], iii[[sfx 2p]], IX[[sfx 2p]]
+  \item entryA1, 1[[sfx 2p]], iii[[sfx 2p]], IX[[sfx 2p]]
+  \item entryB, 1[[sfx mp]], iii[[sfx mp]], IX[[sfx mp]]
+  \item entryB1, 1[[sfx mp]], iii[[sfx mp]], IX[[sfx mp]]
+  \item entryC, 1[[sfx mp]], \bold{iii[[sfx mp]]}, IX, \bold{X}, 
+		XI[[sfx 2p]]
+  \item entryC1, 1[[sfx mp]], \bold{iii[[sfx mp]]}, \bold{X}, 
+		IX[[sfx mp]]
+  \item entryD, c-1[[sfx 2p]], d-IX[[sfx 2p]], i-iii[[sfx 2p]]
+  \item entryD1, c-1[[sfx 2p]], d-IX[[sfx 2p]], i-iii[[sfx 2p]]
+  \item entryE, c-1[[sfx mp]], d-IX[[sfx mp]], i-iii[[sfx mp]]
+  \item entryE1, c-1[[sfx mp]], d-IX[[sfx mp]], i-iii[[sfx mp]]
+  \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 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]], 
+		1-2-3-4-5-6-7-8-9-i[[sfx mp]]
+
+\end{theindex}

Added: trunk/Build/source/texk/upmendex/tests/range1.ist
===================================================================
--- trunk/Build/source/texk/upmendex/tests/range1.ist	                        (rev 0)
+++ trunk/Build/source/texk/upmendex/tests/range1.ist	2021-09-18 08:20:21 UTC (rev 60535)
@@ -0,0 +1,3 @@
+page_precedence "nrRaA"
+suffix_2p "[[sfx 2p]]"
+suffix_mp "[[sfx mp]]"

Added: trunk/Build/source/texk/upmendex/tests/range2.ind
===================================================================
--- trunk/Build/source/texk/upmendex/tests/range2.ind	                        (rev 0)
+++ trunk/Build/source/texk/upmendex/tests/range2.ind	2021-09-18 08:20:21 UTC (rev 60535)
@@ -0,0 +1,26 @@
+\begin{theindex}
+
+  \item entryA, 1[[sfx 2p]], iii[[sfx 2p]], IX[[sfx 2p]]
+  \item entryA1, 1[[sfx 2p]], iii[[sfx 2p]], IX[[sfx 2p]]
+  \item entryB, 1[[sfx 3p]], iii[[sfx 3p]], IX[[sfx 3p]]
+  \item entryB1, 1[[sfx 3p]], iii[[sfx 3p]], IX[[sfx 3p]]
+  \item entryC, 1[[delim r]]4, \bold{iii[[delim r]]vi}, IX, \bold{X}, 
+		XI[[sfx 2p]]
+  \item entryC1, 1[[delim r]]4, \bold{iii[[delim r]]vi}, \bold{X}, 
+		IX[[delim r]]XII
+  \item entryD, c-1[[sfx 2p]], d-IX[[sfx 2p]], i-iii[[sfx 2p]]
+  \item entryD1, c-1[[sfx 2p]], d-IX[[sfx 2p]], i-iii[[sfx 2p]]
+  \item entryE, c-1[[sfx 3p]], d-IX[[sfx 3p]], i-iii[[sfx 3p]]
+  \item entryE1, c-1[[sfx 3p]], d-IX[[sfx 3p]], i-iii[[sfx 3p]]
+  \item entryF, C-I[[delim r]]C-IV, D-DI[[delim r]]D-DIV, 
+		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 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, 
+		1-2-3-4-5-6-7-8-9-i[[delim r]]1-2-3-4-5-6-7-8-9-v
+
+\end{theindex}

Added: trunk/Build/source/texk/upmendex/tests/range2.ist
===================================================================
--- trunk/Build/source/texk/upmendex/tests/range2.ist	                        (rev 0)
+++ trunk/Build/source/texk/upmendex/tests/range2.ist	2021-09-18 08:20:21 UTC (rev 60535)
@@ -0,0 +1,4 @@
+page_precedence "nrRaA"
+delim_r "[[delim r]]"
+suffix_2p "[[sfx 2p]]"
+suffix_3p "[[sfx 3p]]"

Added: trunk/Build/source/texk/upmendex/tests/range3.ind
===================================================================
--- trunk/Build/source/texk/upmendex/tests/range3.ind	                        (rev 0)
+++ trunk/Build/source/texk/upmendex/tests/range3.ind	2021-09-18 08:20:21 UTC (rev 60535)
@@ -0,0 +1,25 @@
+\begin{theindex}
+
+  \item entryA, 1[[sfx 2p]], iii[[sfx 2p]], IX[[sfx 2p]]
+  \item entryA1, 1[[sfx 2p]], iii[[sfx 2p]], IX[[sfx 2p]]
+  \item entryB, 1[[sfx 3p]], iii[[sfx 3p]], IX[[sfx 3p]]
+  \item entryB1, 1[[sfx 3p]], iii[[sfx 3p]], IX[[sfx 3p]]
+  \item entryC, 1[[sfx mp]], \bold{iii[[sfx mp]]}, IX, \bold{X}, 
+		XI[[sfx 2p]]
+  \item entryC1, 1[[sfx mp]], \bold{iii[[sfx mp]]}, \bold{X}, 
+		IX[[sfx mp]]
+  \item entryD, c-1[[sfx 2p]], d-IX[[sfx 2p]], i-iii[[sfx 2p]]
+  \item entryD1, c-1[[sfx 2p]], d-IX[[sfx 2p]], i-iii[[sfx 2p]]
+  \item entryE, c-1[[sfx 3p]], d-IX[[sfx 3p]], i-iii[[sfx 3p]]
+  \item entryE1, c-1[[sfx 3p]], d-IX[[sfx 3p]], i-iii[[sfx 3p]]
+  \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 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]], 
+		1-2-3-4-5-6-7-8-9-i[[sfx mp]]
+
+\end{theindex}

Added: trunk/Build/source/texk/upmendex/tests/range3.ist
===================================================================
--- trunk/Build/source/texk/upmendex/tests/range3.ist	                        (rev 0)
+++ trunk/Build/source/texk/upmendex/tests/range3.ist	2021-09-18 08:20:21 UTC (rev 60535)
@@ -0,0 +1,4 @@
+page_precedence "nrRaA"
+suffix_2p "[[sfx 2p]]"
+suffix_3p "[[sfx 3p]]"
+suffix_mp "[[sfx mp]]"

Deleted: trunk/Build/source/texk/upmendex/tests/rangetwo.idx
===================================================================
--- trunk/Build/source/texk/upmendex/tests/rangetwo.idx	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/upmendex/tests/rangetwo.idx	2021-09-18 08:20:21 UTC (rev 60535)
@@ -1,2 +0,0 @@
-\indexentry{entryA}{1}
-\indexentry{entryA}{2}

Deleted: trunk/Build/source/texk/upmendex/tests/rangetwo.ind
===================================================================
--- trunk/Build/source/texk/upmendex/tests/rangetwo.ind	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/upmendex/tests/rangetwo.ind	2021-09-18 08:20:21 UTC (rev 60535)
@@ -1,5 +0,0 @@
-\begin{theindex}
-
-  \item entryA, 1[[sfx2p]]
-
-\end{theindex}

Deleted: trunk/Build/source/texk/upmendex/tests/rangetwo.ist
===================================================================
--- trunk/Build/source/texk/upmendex/tests/rangetwo.ist	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/upmendex/tests/rangetwo.ist	2021-09-18 08:20:21 UTC (rev 60535)
@@ -1,2 +0,0 @@
-suffix_2p "[[sfx2p]]"
-

Modified: trunk/Build/source/texk/upmendex/tests/upmendex.test
===================================================================
--- trunk/Build/source/texk/upmendex/tests/upmendex.test	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/upmendex/tests/upmendex.test	2021-09-18 08:20:21 UTC (rev 60535)
@@ -7,7 +7,7 @@
 TEXMFCNF=$srcdir/../kpathsea
 export TEXMFCNF
 
-rm -f foo.* uni.* pprec*.* rangetwo.* locale*.* attr*.* rule*.*
+rm -f foo.* uni.* pprec*.* range*.* locale*.* attr*.* rule*.*
 
 ./upmendex $srcdir/tests/foo.idx -o foo.ind1 -t foo.ilg1 \
 	&& diff $srcdir/tests/foo.ind foo.ind1 || exit 1
@@ -28,11 +28,19 @@
 	$srcdir/tests/uni.idx -o uni.ind3 -t uni.ilg3 \
 	&& diff $srcdir/tests/uni.ind uni.ind3 || exit 1
 
-# test for two-element range suffix_2p
-./upmendex -s $srcdir/tests/rangetwo.ist $srcdir/tests/rangetwo.idx \
-	-o rangetwo.ind1 -t rangetwo.ilg \
-	&& diff $srcdir/tests/rangetwo.ind rangetwo.ind1 || exit 1
+# test for range suffix_2p, suffix_3p, suffix_mp
+./upmendex -s $srcdir/tests/range1.ist $srcdir/tests/range.idx \
+	-o range1.ind1 -t range1.ilg \
+	&& diff $srcdir/tests/range1.ind range1.ind1 || exit 1
 
+./upmendex -s $srcdir/tests/range2.ist $srcdir/tests/range.idx \
+	-o range2.ind1 -t range2.ilg \
+	&& diff $srcdir/tests/range2.ind range2.ind1 || exit 1
+
+./upmendex -s $srcdir/tests/range3.ist $srcdir/tests/range.idx \
+	-o range3.ind1 -t range3.ilg \
+	&& diff $srcdir/tests/range3.ind range3.ind1 || exit 1
+
 # test for page_precedence and suffix_3p
 ./upmendex -s $srcdir/tests/pprec0.ist $srcdir/tests/pprecA.idx \
 	-o pprecA-0.ind1 -t pprecA-0.ilg \

Modified: trunk/Build/source/texk/upmendex/var.h
===================================================================
--- trunk/Build/source/texk/upmendex/var.h	2021-09-18 08:15:12 UTC (rev 60534)
+++ trunk/Build/source/texk/upmendex/var.h	2021-09-18 08:20:21 UTC (rev 60535)
@@ -4,7 +4,7 @@
 
 int lines,idxcount,acc=0,reject=0;
 int prange=1,fsti=0,lorder=0,bcomp=0,force=0,fpage=0,gflg=0,verb=1,debug=0;
-int warn=0,scount=0,pattr[3]={0,0,0};
+int warn=0,scount=0,pattr[PAGE_COMPOSIT_DEPTH]={0};
 /* static char roman[]={"ivxlcdm"},Roman[]={"IVXLCDM"}; */
 
 struct index *ind;



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