diff options
author | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2021-08-29 01:24:54 +0000 |
---|---|---|
committer | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2021-08-29 01:24:54 +0000 |
commit | d514983adc7924f1e6e65af196b16be033fc8d21 (patch) | |
tree | bdab87d6d671eb5ad5d41156129f012b95b746ce /Build | |
parent | af79c0af61254b75d2fde24c0797f3c168dd9602 (diff) |
upmendex: fix bug of symbol_flag=0
git-svn-id: svn://tug.org/texlive/trunk@60350 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/upmendex/fwrite.c | 4 | ||||
-rw-r--r-- | Build/source/texk/upmendex/sort.c | 1 | ||||
-rw-r--r-- | Build/source/texk/upmendex/styfile.c | 86 | ||||
-rw-r--r-- | Build/source/texk/upmendex/tests/attr1.ind | 37 | ||||
-rw-r--r-- | Build/source/texk/upmendex/tests/attr1.ist | 1 | ||||
-rw-r--r-- | Build/source/texk/upmendex/tests/locale1.ind | 8 | ||||
-rw-r--r-- | Build/source/texk/upmendex/tests/rule.idx | 4 | ||||
-rw-r--r-- | Build/source/texk/upmendex/tests/rule.ind | 8 | ||||
-rwxr-xr-x | Build/source/texk/upmendex/tests/upmendex.test | 7 |
9 files changed, 114 insertions, 42 deletions
diff --git a/Build/source/texk/upmendex/fwrite.c b/Build/source/texk/upmendex/fwrite.c index d1685ede1c4..a5efc14f5d4 100644 --- a/Build/source/texk/upmendex/fwrite.c +++ b/Build/source/texk/upmendex/fwrite.c @@ -280,8 +280,8 @@ void indwrite(char *filename, struct index *ind, int pagenum) } } 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) { diff --git a/Build/source/texk/upmendex/sort.c b/Build/source/texk/upmendex/sort.c index d585b385e1b..f1914fc8e13 100644 --- a/Build/source/texk/upmendex/sort.c +++ b/Build/source/texk/upmendex/sort.c @@ -66,6 +66,7 @@ void wsort(struct index *ind, int num) break; default: + verb_printf(efp,"\nWarning: Illegal input for character_order (%c).",character_order[i]); break; } } diff --git a/Build/source/texk/upmendex/styfile.c b/Build/source/texk/upmendex/styfile.c index f7f00bab5ca..961b5f7b6cc 100644 --- a/Build/source/texk/upmendex/styfile.c +++ b/Build/source/texk/upmendex/styfile.c @@ -319,54 +319,62 @@ static int sstrncmp(const char *s1, const char *s2, size_t len) 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"); } } diff --git a/Build/source/texk/upmendex/tests/attr1.ind b/Build/source/texk/upmendex/tests/attr1.ind new file mode 100644 index 00000000000..47e44895159 --- /dev/null +++ b/Build/source/texk/upmendex/tests/attr1.ind @@ -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} diff --git a/Build/source/texk/upmendex/tests/attr1.ist b/Build/source/texk/upmendex/tests/attr1.ist new file mode 100644 index 00000000000..c8d71833adb --- /dev/null +++ b/Build/source/texk/upmendex/tests/attr1.ist @@ -0,0 +1 @@ +icu_attributes "case-first:upper-first numeric-ordering:on " diff --git a/Build/source/texk/upmendex/tests/locale1.ind b/Build/source/texk/upmendex/tests/locale1.ind index 89997778f58..56c8c2c6138 100644 --- a/Build/source/texk/upmendex/tests/locale1.ind +++ b/Build/source/texk/upmendex/tests/locale1.ind @@ -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 diff --git a/Build/source/texk/upmendex/tests/rule.idx b/Build/source/texk/upmendex/tests/rule.idx index ce6ad5d52c8..155ba8e28a7 100644 --- a/Build/source/texk/upmendex/tests/rule.idx +++ b/Build/source/texk/upmendex/tests/rule.idx @@ -11,3 +11,7 @@ \indexentry{u}{409} \indexentry{Ü}{410} \indexentry{ü}{411} +\indexentry{10}{1000} +\indexentry{2}{1001} +\indexentry{#}{2000} +\indexentry{$}{2001} diff --git a/Build/source/texk/upmendex/tests/rule.ind b/Build/source/texk/upmendex/tests/rule.ind index bb5e6c5e256..6dd13b205f9 100644 --- a/Build/source/texk/upmendex/tests/rule.ind +++ b/Build/source/texk/upmendex/tests/rule.ind @@ -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 diff --git a/Build/source/texk/upmendex/tests/upmendex.test b/Build/source/texk/upmendex/tests/upmendex.test index 26dfe4284b7..48787d5ae7c 100755 --- a/Build/source/texk/upmendex/tests/upmendex.test +++ b/Build/source/texk/upmendex/tests/upmendex.test @@ -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 @@ cat $srcdir/tests/uni.idx | \ -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 \ |