texlive[60350] Build/source/texk/upmendex: upmendex: fix bug of

commits+takuji at tug.org commits+takuji at tug.org
Sun Aug 29 03:24:55 CEST 2021


Revision: 60350
          http://tug.org/svn/texlive?view=revision&revision=60350
Author:   takuji
Date:     2021-08-29 03:24:54 +0200 (Sun, 29 Aug 2021)
Log Message:
-----------
upmendex: fix bug of symbol_flag=0

Modified Paths:
--------------
    trunk/Build/source/texk/upmendex/fwrite.c
    trunk/Build/source/texk/upmendex/sort.c
    trunk/Build/source/texk/upmendex/styfile.c
    trunk/Build/source/texk/upmendex/tests/locale1.ind
    trunk/Build/source/texk/upmendex/tests/rule.idx
    trunk/Build/source/texk/upmendex/tests/rule.ind
    trunk/Build/source/texk/upmendex/tests/upmendex.test

Added Paths:
-----------
    trunk/Build/source/texk/upmendex/tests/attr1.ind
    trunk/Build/source/texk/upmendex/tests/attr1.ist

Modified: trunk/Build/source/texk/upmendex/fwrite.c
===================================================================
--- trunk/Build/source/texk/upmendex/fwrite.c	2021-08-28 23:48:49 UTC (rev 60349)
+++ trunk/Build/source/texk/upmendex/fwrite.c	2021-08-29 01:24:54 UTC (rev 60350)
@@ -280,8 +280,8 @@
 				}
 			}
 			else {
-				if (lethead_flag!=0) {
-					if (symbol_flag && strlen(symbol)) {
+				if (lethead_flag!=0 && symbol_flag) {
+					if (strlen(symbol)) {
 						fprintf(fp,"%s%s%s",lethead_prefix,symbol,lethead_suffix);
 					}
 					else if (lethead_flag>0) {

Modified: trunk/Build/source/texk/upmendex/sort.c
===================================================================
--- trunk/Build/source/texk/upmendex/sort.c	2021-08-28 23:48:49 UTC (rev 60349)
+++ trunk/Build/source/texk/upmendex/sort.c	2021-08-29 01:24:54 UTC (rev 60350)
@@ -66,6 +66,7 @@
 			break;
 
 		default:
+			verb_printf(efp,"\nWarning: Illegal input for character_order (%c).",character_order[i]);
 			break;
 		}
 	}

Modified: trunk/Build/source/texk/upmendex/styfile.c
===================================================================
--- trunk/Build/source/texk/upmendex/styfile.c	2021-08-28 23:48:49 UTC (rev 60349)
+++ trunk/Build/source/texk/upmendex/styfile.c	2021-08-29 01:24:54 UTC (rev 60350)
@@ -319,54 +319,62 @@
 void set_icu_attributes(void)
 {
 	int i,attr;
-	char *pos, *tmp;
+	char *pos, *head, *tmp;
 
 	for (i=0;i<UCOL_ATTRIBUTE_COUNT;i++) icu_attributes[i]=UCOL_DEFAULT;
 	tmp=icu_attr_str;
-	if ((pos=strstr(tmp,"alternate:"))>0) {
+	head=strtok(tmp, " \t");
+	while (head!=NULL) {
+	    pos=head;
+	    if (strncmp(pos,"alternate:",10)==0) {
 		pos+=10;  attr=UCOL_ALTERNATE_HANDLING;
-		if      (strstr(pos,"shifted"))       icu_attributes[attr]=UCOL_SHIFTED;
-		else if (strstr(pos,"non-ignorable")) icu_attributes[attr]=UCOL_NON_IGNORABLE;
-		else	verb_printf(efp,"\nWarning: Illegal input for icu_attributes (alternate).");
-	}
-	if ((pos=strstr(tmp,"strength:"))>0) {
+		if      (strcmp(pos,"shifted")==0)       icu_attributes[attr]=UCOL_SHIFTED;
+		else if (strcmp(pos,"non-ignorable")==0) icu_attributes[attr]=UCOL_NON_IGNORABLE;
+		else	goto illegal;
+	    } else
+	    if (strncmp(pos,"strength:",9)==0) {
 		pos+=9;   attr=UCOL_STRENGTH;
-		if      (strstr(pos,"primary"))       icu_attributes[attr]=UCOL_PRIMARY;
-		else if (strstr(pos,"secondary"))     icu_attributes[attr]=UCOL_SECONDARY;
-		else if (strstr(pos,"tertiary"))      icu_attributes[attr]=UCOL_TERTIARY;
-		else if (strstr(pos,"quaternary"))    icu_attributes[attr]=UCOL_QUATERNARY;
-		else if (strstr(pos,"identical"))     icu_attributes[attr]=UCOL_IDENTICAL;
-		else	verb_printf(efp,"\nWarning: Illegal input for icu_attributes (strength).");
-	}
-	if ((pos=strstr(tmp,"french-collation:"))>0) {
+		if      (strcmp(pos,"primary")==0)       icu_attributes[attr]=UCOL_PRIMARY;
+		else if (strcmp(pos,"secondary")==0)     icu_attributes[attr]=UCOL_SECONDARY;
+		else if (strcmp(pos,"tertiary")==0)      icu_attributes[attr]=UCOL_TERTIARY;
+		else if (strcmp(pos,"quaternary")==0)    icu_attributes[attr]=UCOL_QUATERNARY;
+		else if (strcmp(pos,"identical")==0)     icu_attributes[attr]=UCOL_IDENTICAL;
+		else	goto illegal;
+	    } else
+	      if (strncmp(pos,"french-collation:",17)==0) {
 		pos+=17;  attr=UCOL_FRENCH_COLLATION;
-		if      (strstr(pos,"on"))            icu_attributes[attr]=UCOL_ON;
-		else if (strstr(pos,"off"))           icu_attributes[attr]=UCOL_OFF;
-		else	verb_printf(efp,"\nWarning: Illegal input for icu_attributes (french-collation).");
-	}
-	if ((pos=strstr(tmp,"case-first:"))>0) {
+		if      (strcmp(pos,"on")==0)            icu_attributes[attr]=UCOL_ON;
+		else if (strcmp(pos,"off")==0)           icu_attributes[attr]=UCOL_OFF;
+		else	goto illegal;
+	    } else
+	    if (strncmp(pos,"case-first:",11)==0) {
 		pos+=11;  attr=UCOL_CASE_FIRST;
-		if      (strstr(pos,"off"))           icu_attributes[attr]=UCOL_OFF;
-		else if (strstr(pos,"upper-first"))   icu_attributes[attr]=UCOL_UPPER_FIRST;
-		else if (strstr(pos,"lower-first"))   icu_attributes[attr]=UCOL_LOWER_FIRST;
-		else	verb_printf(efp,"\nWarning: Illegal input for icu_attributes (case-first).");
-	}
-	if ((pos=strstr(tmp,"case-level:"))>0) {
+		if      (strcmp(pos,"off")==0)           icu_attributes[attr]=UCOL_OFF;
+		else if (strcmp(pos,"upper-first")==0)   icu_attributes[attr]=UCOL_UPPER_FIRST;
+		else if (strcmp(pos,"lower-first")==0)   icu_attributes[attr]=UCOL_LOWER_FIRST;
+		else	goto illegal;
+	    } else
+	    if (strncmp(pos,"case-level:",11)==0) {
 		pos+=11;  attr=UCOL_CASE_LEVEL;
-		if      (strstr(pos,"on"))            icu_attributes[attr]=UCOL_ON;
-		else if (strstr(pos,"off"))           icu_attributes[attr]=UCOL_OFF;
-		else	verb_printf(efp,"\nWarning: Illegal input for icu_attributes (case-level).");
-	}
-	if ((pos=strstr(tmp,"normalization-mode:"))>0) {
+		if      (strcmp(pos,"on")==0)            icu_attributes[attr]=UCOL_ON;
+		else if (strcmp(pos,"off")==0)           icu_attributes[attr]=UCOL_OFF;
+		else	goto illegal;
+	    } else
+	    if (strncmp(pos,"normalization-mode:",19)==0) {
 		pos+=19;  attr=UCOL_NORMALIZATION_MODE;
-		if      (strstr(pos,"on"))            icu_attributes[attr]=UCOL_ON;
-		else if (strstr(pos,"off"))           icu_attributes[attr]=UCOL_OFF;
-		else	verb_printf(efp,"\nWarning: Illegal input for icu_attributes (normalization-mode).");
-	}
-	if ((pos=strstr(tmp,"numeric-ordering:"))>0) {
+		if      (strcmp(pos,"on")==0)            icu_attributes[attr]=UCOL_ON;
+		else if (strcmp(pos,"off")==0)           icu_attributes[attr]=UCOL_OFF;
+		else	goto illegal;
+	    } else
+	    if (strncmp(pos,"numeric-ordering:",17)==0) {
 		pos+=17;  attr=UCOL_NUMERIC_COLLATION;
-		if      (strstr(pos,"on"))            icu_attributes[attr]=UCOL_ON;
-		else if (strstr(pos,"off"))           icu_attributes[attr]=UCOL_OFF;
-		else	verb_printf(efp,"\nWarning: Illegal input for icu_attributes (numeric-ordering).");
+		if      (strcmp(pos,"on")==0)            icu_attributes[attr]=UCOL_ON;
+		else if (strcmp(pos,"off")==0)           icu_attributes[attr]=UCOL_OFF;
+		else	goto illegal;
+	    } else {
+	illegal:
+		verb_printf(efp,"\nWarning: Illegal input for icu_attributes (%s).",head);
+	    }
+	    head=strtok(NULL, " \t");
 	}
 }

Added: trunk/Build/source/texk/upmendex/tests/attr1.ind
===================================================================
--- trunk/Build/source/texk/upmendex/tests/attr1.ind	                        (rev 0)
+++ trunk/Build/source/texk/upmendex/tests/attr1.ind	2021-08-29 01:24:54 UTC (rev 60350)
@@ -0,0 +1,37 @@
+\begin{theindex}
+
+\centerline{\bfseries ◆◆◆ Symbols ◆◆◆}\par\nobreak
+  \item #\leaders\hbox{$\cdot$}\hfill 2000
+  \item $\leaders\hbox{$\cdot$}\hfill 2001
+  \item 2\leaders\hbox{$\cdot$}\hfill 1001
+  \item 10\leaders\hbox{$\cdot$}\hfill 1000
+
+  \indexspace
+
+\centerline{\bfseries ◆◆◆ A ◆◆◆}\par\nobreak
+  \item A\leaders\hbox{$\cdot$}\hfill 400
+  \item a\leaders\hbox{$\cdot$}\hfill 401
+
+  \indexspace
+
+\centerline{\bfseries ◆◆◆ B ◆◆◆}\par\nobreak
+  \item B\leaders\hbox{$\cdot$}\hfill 402
+  \item b\leaders\hbox{$\cdot$}\hfill 403
+
+  \indexspace
+
+\centerline{\bfseries ◆◆◆ C ◆◆◆}\par\nobreak
+  \item C\leaders\hbox{$\cdot$}\hfill 404
+  \item c\leaders\hbox{$\cdot$}\hfill 405
+  \item Ç\leaders\hbox{$\cdot$}\hfill 406
+  \item ç\leaders\hbox{$\cdot$}\hfill 407
+
+  \indexspace
+
+\centerline{\bfseries ◆◆◆ U ◆◆◆}\par\nobreak
+  \item U\leaders\hbox{$\cdot$}\hfill 408
+  \item u\leaders\hbox{$\cdot$}\hfill 409
+  \item Ü\leaders\hbox{$\cdot$}\hfill 410
+  \item ü\leaders\hbox{$\cdot$}\hfill 411
+
+\end{theindex}

Added: trunk/Build/source/texk/upmendex/tests/attr1.ist
===================================================================
--- trunk/Build/source/texk/upmendex/tests/attr1.ist	                        (rev 0)
+++ trunk/Build/source/texk/upmendex/tests/attr1.ist	2021-08-29 01:24:54 UTC (rev 60350)
@@ -0,0 +1 @@
+icu_attributes "case-first:upper-first 	numeric-ordering:on	 "

Modified: trunk/Build/source/texk/upmendex/tests/locale1.ind
===================================================================
--- trunk/Build/source/texk/upmendex/tests/locale1.ind	2021-08-28 23:48:49 UTC (rev 60349)
+++ trunk/Build/source/texk/upmendex/tests/locale1.ind	2021-08-29 01:24:54 UTC (rev 60350)
@@ -1,5 +1,13 @@
 \begin{theindex}
 
+\centerline{\bfseries ◆◆◆ Symbols ◆◆◆}\par\nobreak
+  \item #\leaders\hbox{$\cdot$}\hfill 2000
+  \item $\leaders\hbox{$\cdot$}\hfill 2001
+  \item 10\leaders\hbox{$\cdot$}\hfill 1000
+  \item 2\leaders\hbox{$\cdot$}\hfill 1001
+
+  \indexspace
+
 \centerline{\bfseries ◆◆◆ A ◆◆◆}\par\nobreak
   \item a\leaders\hbox{$\cdot$}\hfill 401
   \item A\leaders\hbox{$\cdot$}\hfill 400

Modified: trunk/Build/source/texk/upmendex/tests/rule.idx
===================================================================
--- trunk/Build/source/texk/upmendex/tests/rule.idx	2021-08-28 23:48:49 UTC (rev 60349)
+++ trunk/Build/source/texk/upmendex/tests/rule.idx	2021-08-29 01:24:54 UTC (rev 60350)
@@ -11,3 +11,7 @@
 \indexentry{u}{409}
 \indexentry{Ü}{410}
 \indexentry{ü}{411}
+\indexentry{10}{1000}
+\indexentry{2}{1001}
+\indexentry{#}{2000}
+\indexentry{$}{2001}

Modified: trunk/Build/source/texk/upmendex/tests/rule.ind
===================================================================
--- trunk/Build/source/texk/upmendex/tests/rule.ind	2021-08-28 23:48:49 UTC (rev 60349)
+++ trunk/Build/source/texk/upmendex/tests/rule.ind	2021-08-29 01:24:54 UTC (rev 60350)
@@ -1,5 +1,13 @@
 \begin{theindex}
 
+\centerline{\bfseries ◆◆◆ Symbols ◆◆◆}\par\nobreak
+  \item #\leaders\hbox{$\cdot$}\hfill 2000
+  \item $\leaders\hbox{$\cdot$}\hfill 2001
+  \item 10\leaders\hbox{$\cdot$}\hfill 1000
+  \item 2\leaders\hbox{$\cdot$}\hfill 1001
+
+  \indexspace
+
 \centerline{\bfseries ◆◆◆ A ◆◆◆}\par\nobreak
   \item a\leaders\hbox{$\cdot$}\hfill 401
   \item A\leaders\hbox{$\cdot$}\hfill 400

Modified: trunk/Build/source/texk/upmendex/tests/upmendex.test
===================================================================
--- trunk/Build/source/texk/upmendex/tests/upmendex.test	2021-08-28 23:48:49 UTC (rev 60349)
+++ trunk/Build/source/texk/upmendex/tests/upmendex.test	2021-08-29 01:24:54 UTC (rev 60350)
@@ -7,7 +7,7 @@
 TEXMFCNF=$srcdir/../kpathsea
 export TEXMFCNF
 
-rm -f foo.* uni.* pprec*.* rangetwo.* locale*.* rule*.*
+rm -f foo.* uni.* pprec*.* rangetwo.* locale*.* attr*.* rule*.*
 
 ./upmendex $srcdir/tests/foo.idx -o foo.ind1 -t foo.ilg1 \
 	&& diff $srcdir/tests/foo.ind foo.ind1 || exit 1
@@ -51,6 +51,11 @@
 	-o locale1.ind1 -t locale1.ilg \
 	&& diff $srcdir/tests/locale1.ind locale1.ind1 || exit 1
 
+# test for icu_attributes
+./upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/attr1.ist $srcdir/tests/rule.idx \
+	-o attr1.ind1 -t attr1.ilg \
+	&& diff $srcdir/tests/attr1.ind attr1.ind1 || exit 1
+
 # test for icu_rules
 ./upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/rule1.ist $srcdir/tests/rule.idx \
 	-o rule1.ind1 -t rule1.ilg \



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