From bbb4256f0f68c1916bfed4a700ca6d3e6e3de1ac Mon Sep 17 00:00:00 2001 From: Takuji Tanaka Date: Sat, 9 Nov 2024 10:39:33 +0000 Subject: [PATCH] upmendex: Version 1.10 git-svn-id: svn://tug.org/texlive/trunk/Build/source@72806 c570f23f-e606-0410-a88d-b1316a301751 --- libs/icu/ChangeLog | 2 +- texk/README | 2 +- texk/upmendex/ChangeLog | 21 +++ texk/upmendex/Makefile.am | 19 ++- texk/upmendex/Makefile.in | 27 ++-- texk/upmendex/configure | 22 +-- texk/upmendex/configure.ac | 2 +- texk/upmendex/convert.c | 2 +- texk/upmendex/exvar.h | 6 +- texk/upmendex/fread.c | 19 ++- texk/upmendex/fwrite.c | 124 ++++------------- texk/upmendex/mendex.h | 7 +- texk/upmendex/sort.c | 222 +++++++++++++++--------------- texk/upmendex/styfile.c | 37 +++-- texk/upmendex/tests/icu.test | 66 +++++++++ texk/upmendex/tests/nest.test | 41 ++++++ texk/upmendex/tests/nested.idx | 46 +++++++ texk/upmendex/tests/nested.ind | 101 ++++++++++++++ texk/upmendex/tests/nested.ist | 18 +++ texk/upmendex/tests/nested3.idx | 19 +++ texk/upmendex/tests/nested3.ind | 40 ++++++ texk/upmendex/tests/nested3.ist | 10 ++ texk/upmendex/tests/ok-tort.ind | 24 ++++ texk/upmendex/tests/pprec.test | 68 +++++++++ texk/upmendex/tests/toodeep.idx | 6 + texk/upmendex/tests/tort.idx | 53 +++++++ texk/upmendex/tests/tortW.idx | 53 +++++++ texk/upmendex/tests/upmendex.test | 106 ++------------ texk/upmendex/var.h | 18 ++- 29 files changed, 820 insertions(+), 361 deletions(-) create mode 100755 texk/upmendex/tests/icu.test create mode 100755 texk/upmendex/tests/nest.test create mode 100644 texk/upmendex/tests/nested.idx create mode 100644 texk/upmendex/tests/nested.ind create mode 100644 texk/upmendex/tests/nested.ist create mode 100644 texk/upmendex/tests/nested3.idx create mode 100644 texk/upmendex/tests/nested3.ind create mode 100644 texk/upmendex/tests/nested3.ist create mode 100644 texk/upmendex/tests/ok-tort.ind create mode 100755 texk/upmendex/tests/pprec.test create mode 100644 texk/upmendex/tests/toodeep.idx create mode 100644 texk/upmendex/tests/tort.idx create mode 100644 texk/upmendex/tests/tortW.idx diff --git a/libs/icu/ChangeLog b/libs/icu/ChangeLog index 922c3255d5..b6e3c864b9 100644 --- a/libs/icu/ChangeLog +++ b/libs/icu/ChangeLog @@ -8,7 +8,7 @@ 2024-10-27 Karl Berry - * Import 76.2. + * Import 76.1. (version.ac): update. 2023-12-22 Karl Berry diff --git a/texk/README b/texk/README index 6607684092..048ebf90b0 100644 --- a/texk/README +++ b/texk/README @@ -106,7 +106,7 @@ ttf2pk2 - maintained here, by us ttfdump - maintained here, by us, since Taiwan upstream apparently gone. -upmendex 1.09 - by Takuji Tanaka +upmendex 1.10 - by Takuji Tanaka https://ctan.org/pkg/upmendex https://github.com/t-tk/upmendex-package diff --git a/texk/upmendex/ChangeLog b/texk/upmendex/ChangeLog index 915386bdba..0fe73dda5b 100644 --- a/texk/upmendex/ChangeLog +++ b/texk/upmendex/ChangeLog @@ -1,3 +1,24 @@ +2024-11-09 TANAKA Takuji + + * version 1.10 Stable version. + * configure.ac: Bump version. + * {mendex,var,exvar}.h, fread.c, fwrite.c, sort.c, styfile.c: + Support for indices with four sublevels, + conventionally two sublevels. + Thanks to upll request by Sergei Golovan. + https://github.com/t-tk/upmendex-package/pull/9 + * fread.c: Improve error message when reading index entries. + https://github.com/t-tk/upmendex-package/issues/13 + * sort.c: Extend RULEBUFSIZE to adjust ICU 76.1. + Revise to avoid compiler warnings. + * convert.c: Tweak comment. + * tests/{upmendex,pprec,icu}.test: Split test scripts. + * tests/nest.test, tests/nested{,3}.{ist,idx,ind}, + tests/toodeep.idx: Add new tests for nested depth. + * tests/upmendex.test, tests/tort{,W}.idx, tests/ok-tort.ind: + Add new tests for error/warning. + * Makefile.am: Adjust. + 2024-07-06 TANAKA Takuji * version 1.09 Stable version. diff --git a/texk/upmendex/Makefile.am b/texk/upmendex/Makefile.am index 5522da2866..d69f90e579 100644 --- a/texk/upmendex/Makefile.am +++ b/texk/upmendex/Makefile.am @@ -52,14 +52,21 @@ EXTRA_DIST += \ ## Tests ## -TESTS = tests/upmendex.test +TESTS = tests/upmendex.test \ + tests/pprec.test \ + tests/nest.test \ + tests/icu.test EXTRA_DIST += $(TESTS) ## tests/upmendex.test EXTRA_DIST += tests/foo.idx tests/foo.ind \ tests/uni.idx tests/uni.dict tests/uni.ist \ tests/uni1.ist tests/uni2.ist tests/uni.ind \ - tests/range.idx tests/range2.ist tests/range2.ist tests/range3.ist \ + tests/tort.idx tests/tortW.idx tests/ok-tort.ind +DISTCLEANFILES = foo.* uni.* +## tests/pprec.test +EXTRA_DIST += tests/range.idx \ + tests/range1.ist tests/range2.ist tests/range3.ist \ tests/range1.ind tests/range2.ind tests/range3.ind \ tests/pprec0.ist tests/pprec1.ist tests/pprec2.ist tests/pprec3.ist \ tests/pprec4.ist tests/pprec5.ist tests/pprec6.ist tests/pprec7.ist \ @@ -69,7 +76,13 @@ EXTRA_DIST += tests/foo.idx tests/foo.ind \ tests/romalpB.idx tests/romalpB-5.ind tests/romalpB-6.ind tests/romalpB-7.ind \ tests/romalpC.idx tests/romalpC-5.ind \ tests/romalpD.idx tests/romalpD-5.ind tests/romalpD-6.ind tests/romalpD-7.ind -DISTCLEANFILES = foo.* uni.* range*.* pprec*.* romalp*.* +DISTCLEANFILES += range*.* pprec*.* romalp*.* +## tests/nest.test +EXTRA_DIST += tests/nested3.ist tests/nested3.ind \ + tests/nested.ist tests/nested.ind \ + tests/toodeep.idx +DISTCLEANFILES += nested*.* toodeep*.* +## tests/icu.test EXTRA_DIST += tests/locale1.ist tests/locale2.ist tests/locale3.ist tests/rule.idx \ tests/attr1.ist tests/attr1.ind tests/locale1.ind \ tests/locale2-rule.ind tests/locale3-rule.ind \ diff --git a/texk/upmendex/Makefile.in b/texk/upmendex/Makefile.in index 30c536964f..f369c67db2 100644 --- a/texk/upmendex/Makefile.in +++ b/texk/upmendex/Makefile.in @@ -622,8 +622,9 @@ nodist_EXTRA_upmendex_SOURCES = dummy.cxx LDADD = $(KPATHSEA_LIBS) $(ICU_LIBS) $(PTHREAD_LIB) $(ICU_LIBS_EXTRA) EXTRA_DIST = COPYRIGHT indexsty upmendex.ja.txt $(TESTS) tests/foo.idx \ tests/foo.ind tests/uni.idx tests/uni.dict tests/uni.ist \ - tests/uni1.ist tests/uni2.ist tests/uni.ind tests/range.idx \ - tests/range2.ist tests/range2.ist tests/range3.ist \ + tests/uni1.ist tests/uni2.ist tests/uni.ind tests/tort.idx \ + tests/tortW.idx tests/ok-tort.ind tests/range.idx \ + tests/range1.ist tests/range2.ist tests/range3.ist \ tests/range1.ind tests/range2.ind tests/range3.ind \ tests/pprec0.ist tests/pprec1.ist tests/pprec2.ist \ tests/pprec3.ist tests/pprec4.ist tests/pprec5.ist \ @@ -634,14 +635,20 @@ EXTRA_DIST = COPYRIGHT indexsty upmendex.ja.txt $(TESTS) tests/foo.idx \ tests/romalpA-6.ind tests/romalpB.idx tests/romalpB-5.ind \ tests/romalpB-6.ind tests/romalpB-7.ind tests/romalpC.idx \ tests/romalpC-5.ind tests/romalpD.idx tests/romalpD-5.ind \ - tests/romalpD-6.ind tests/romalpD-7.ind tests/locale1.ist \ - tests/locale2.ist tests/locale3.ist tests/rule.idx \ - tests/attr1.ist tests/attr1.ind tests/locale1.ind \ - tests/locale2-rule.ind tests/locale3-rule.ind tests/rule1.ist \ - tests/rule2.ist tests/rule3.ist tests/rule4.ist rule.ind -TESTS = tests/upmendex.test -DISTCLEANFILES = foo.* uni.* range*.* pprec*.* romalp*.* locale*.* \ - attr*.* rule*.* + tests/romalpD-6.ind tests/romalpD-7.ind tests/nested3.ist \ + tests/nested3.ind tests/nested.ist tests/nested.ind \ + tests/toodeep.idx tests/locale1.ist tests/locale2.ist \ + tests/locale3.ist tests/rule.idx tests/attr1.ist \ + tests/attr1.ind tests/locale1.ind tests/locale2-rule.ind \ + tests/locale3-rule.ind tests/rule1.ist tests/rule2.ist \ + tests/rule3.ist tests/rule4.ist rule.ind +TESTS = tests/upmendex.test \ + tests/pprec.test \ + tests/nest.test \ + tests/icu.test + +DISTCLEANFILES = foo.* uni.* range*.* pprec*.* romalp*.* nested*.* \ + toodeep*.* locale*.* attr*.* rule*.* all: c-auto.h $(MAKE) $(AM_MAKEFLAGS) all-am diff --git a/texk/upmendex/configure b/texk/upmendex/configure index 850210068b..d822003441 100755 --- a/texk/upmendex/configure +++ b/texk/upmendex/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.72 for upmendex (TeX Live) 1.09. +# Generated by GNU Autoconf 2.72 for upmendex (TeX Live) 1.10. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2023 Free Software Foundation, @@ -611,8 +611,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='upmendex (TeX Live)' PACKAGE_TARNAME='upmendex--tex-live-' -PACKAGE_VERSION='1.09' -PACKAGE_STRING='upmendex (TeX Live) 1.09' +PACKAGE_VERSION='1.10' +PACKAGE_STRING='upmendex (TeX Live) 1.10' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1380,7 +1380,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -'configure' configures upmendex (TeX Live) 1.09 to adapt to many kinds of systems. +'configure' configures upmendex (TeX Live) 1.10 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1452,7 +1452,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of upmendex (TeX Live) 1.09:";; + short | recursive ) echo "Configuration of upmendex (TeX Live) 1.10:";; esac cat <<\_ACEOF @@ -1578,7 +1578,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -upmendex (TeX Live) configure 1.09 +upmendex (TeX Live) configure 1.10 generated by GNU Autoconf 2.72 Copyright (C) 2023 Free Software Foundation, Inc. @@ -2282,7 +2282,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by upmendex (TeX Live) $as_me 1.09, which was +It was created by upmendex (TeX Live) $as_me 1.10, which was generated by GNU Autoconf 2.72. Invocation command line was $ $0$ac_configure_args_raw @@ -9392,7 +9392,7 @@ fi # Define the identity of the package. PACKAGE='upmendex--tex-live-' - VERSION='1.09' + VERSION='1.10' # Some tools Automake needs. @@ -19772,7 +19772,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -upmendex (TeX Live) config.lt 1.09 +upmendex (TeX Live) config.lt 1.10 configured by $0, generated by GNU Autoconf 2.72. Copyright (C) 2011 Free Software Foundation, Inc. @@ -21991,7 +21991,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by upmendex (TeX Live) $as_me 1.09, which was +This file was extended by upmendex (TeX Live) $as_me 1.10, which was generated by GNU Autoconf 2.72. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22059,7 +22059,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -upmendex (TeX Live) config.status 1.09 +upmendex (TeX Live) config.status 1.10 configured by $0, generated by GNU Autoconf 2.72, with options \\"\$ac_cs_config\\" diff --git a/texk/upmendex/configure.ac b/texk/upmendex/configure.ac index f894413d41..7b72b8db3d 100644 --- a/texk/upmendex/configure.ac +++ b/texk/upmendex/configure.ac @@ -8,7 +8,7 @@ dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl -AC_INIT([upmendex (TeX Live)],[1.09]) +AC_INIT([upmendex (TeX Live)],[1.10]) AC_PREREQ([2.71]) AC_CONFIG_SRCDIR([main.c]) AC_CONFIG_AUX_DIR([../../build-aux]) diff --git a/texk/upmendex/convert.c b/texk/upmendex/convert.c index 2760059a06..8a7e91ca96 100644 --- a/texk/upmendex/convert.c +++ b/texk/upmendex/convert.c @@ -193,7 +193,7 @@ static int dcomp(const void *bf1, const void *bf2) return 0; } -/* convert to capital-hiragana character */ +/* convert to YOMI (reading) or strings of phonograms */ int convert(UChar *buff1, UChar *buff2) { int i=0,j=0,k; diff --git a/texk/upmendex/exvar.h b/texk/upmendex/exvar.h index 790f327e27..af04862108 100644 --- a/texk/upmendex/exvar.h +++ b/texk/upmendex/exvar.h @@ -17,9 +17,9 @@ extern char setpage_prefix[],setpage_suffix[]; extern char group_skip[]; extern char lethead_prefix[],lethead_suffix[]; extern int lethead_flag; -extern char item_0[],item_1[],item_2[]; -extern char item_01[],item_x1[],item_12[],item_x2[]; -extern char delim_0[],delim_1[],delim_2[],delim_n[],delim_r[],delim_t[]; +extern char item_0[][STYBUFSIZE]; +extern char item_01[][STYBUFSIZE],item_x[][STYBUFSIZE]; +extern char delim_0[][STYBUFSIZE],delim_n[],delim_r[],delim_t[]; extern char suffix_2p[],suffix_3p[],suffix_mp[]; extern char encap_prefix[],encap_infix[],encap_suffix[]; extern int line_max; diff --git a/texk/upmendex/fread.c b/texk/upmendex/fread.c index ab3dd4c077..9b2e45ef0b 100644 --- a/texk/upmendex/fread.c +++ b/texk/upmendex/fread.c @@ -111,7 +111,7 @@ int idxread(char *filename, int start) if (nest==0) { if (buff[j]==level) { esc=0; - if (indent>=2) { + if (indent>=MAXDEPTH-1) { fprintf(efp,"\nError: Extra `%c\' in %s, line %d.",level,filename,ind[i].lnum); if (efp!=stderr) fprintf(stderr,"\nError: Extra `%c\' in %s, line %d.",level,filename,ind[i].lnum); eflg++; @@ -150,9 +150,9 @@ int idxread(char *filename, int start) if (buff[j]==encap) { j++; cc=getestr(&buff[j],estr); - if (cc<0) { - fprintf(efp,"\nBad encap string in %s, line %d.",filename,ind[i].lnum); - if (efp!=stderr) fprintf(stderr,"\nBad encap string in %s, line %d.",filename,ind[i].lnum); + if (cc<0 || strchr(estr,encap)) { + fprintf(efp,"\nError: Bad encap string in %s, line %d.",filename,ind[i].lnum); + if (efp!=stderr) fprintf(stderr,"\nError: Bad encap string in %s, line %d.",filename,ind[i].lnum); eflg++; reject++; n++; @@ -208,6 +208,17 @@ int idxread(char *filename, int start) if (buff[j]!=escape) esc=0; copy_multibyte_char(buff, wbuff, &j, &k); } + for (k=0; k<=indent; k++) { + if ((u_strlen(ind[i].idx[k])==0 && ind[i].org[k]==NULL) || + (ind[i].org[k] && u_strlen(ind[i].org[k])==0)) { + fprintf(efp,"\nError: Illegal null field in %s, line %d.",filename,ind[i].lnum); + if (efp!=stderr) fprintf(stderr,"\nError: Illegal null field in %s, line %d.",filename,ind[i].lnum); + eflg++; + reject++; + n++; + goto LOOP; + } + } ind[i].words=indent+1; /* kana-convert */ diff --git a/texk/upmendex/fwrite.c b/texk/upmendex/fwrite.c index ed528406da..4f93790a0e 100644 --- a/texk/upmendex/fwrite.c +++ b/texk/upmendex/fwrite.c @@ -165,7 +165,7 @@ static int pnumconv2(struct page *p) /* write ind file */ void indwrite(char *filename, struct index *ind, int pagenum) { - int i,j,k,hpoint=0,tpoint=0,ipoint=0,jpoint=0,block_open=0; + int i,j,k,q,hpoint=0,tpoint=0,ipoint=0,jpoint=0,block_open=0; char lbuff[BUFFERLEN],obuff[BUFFERLEN]; UChar initial[INITIALLENGTH],initial_prev[INITIALLENGTH]; int chset,chset_prev; @@ -220,8 +220,6 @@ void indwrite(char *filename, struct index *ind, int pagenum) fprint_uchar(fp,initial,lethead_flag,-1); fputs(lethead_suffix,fp); } - widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[0]); - SPRINTF(lbuff,"%s%s",item_0,obuff); } else if (chset==CH_KANA) { if (lethead_flag!=0) { @@ -241,8 +239,6 @@ void indwrite(char *filename, struct index *ind, int pagenum) } fputs(lethead_suffix,fp); } - widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[0]); - SPRINTF(lbuff,"%s%s",item_0,obuff); for (hpoint=0;hpoint<(u_strlen(kana_head));) { if (initial_cmp_char(initial,&kana_head[hpoint])) { break; @@ -265,8 +261,6 @@ void indwrite(char *filename, struct index *ind, int pagenum) } fputs(lethead_suffix,fp); } - widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[0]); - SPRINTF(lbuff,"%s%s",item_0,obuff); for (tpoint=0;tpoint<(u_strlen(hangul_head));tpoint++) { if (initial_cmp_char(initial,&hangul_head[tpoint])) { break; @@ -291,8 +285,6 @@ void indwrite(char *filename, struct index *ind, int pagenum) } fputs(lethead_suffix,fp); } - widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[0]); - SPRINTF(lbuff,"%s%s",item_0,obuff); for (jpoint=0;jpoint<(u_strlen(devanagari_head));) { if (initial_cmp_char(initial,&devanagari_head[jpoint])) { break; @@ -315,8 +307,6 @@ void indwrite(char *filename, struct index *ind, int pagenum) } fputs(lethead_suffix,fp); } - widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[0]); - SPRINTF(lbuff,"%s%s",item_0,obuff); for (ipoint=0;ipoint<(u_strlen(thai_head));ipoint++) { if (initial_cmp_char(initial,&thai_head[ipoint])) { break; @@ -330,35 +320,9 @@ void indwrite(char *filename, struct index *ind, int pagenum) if (lethead_flag!=0 && (symbol_flag==1 || (symbol_flag==2 && chset!=CH_NUMERIC))) { fprintf(fp,"%s%s%s",lethead_prefix,symhead,lethead_suffix); } - widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[0]); - SPRINTF(lbuff,"%s%s",item_0,obuff); } - switch (ind[i].words) { - case 1: - SAPPENDF(lbuff,"%s",delim_0); - break; - - case 2: - widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[1]); - SAPPENDF(lbuff,"%s",item_x1); - SAPPENDF(lbuff,"%s",obuff); - SAPPENDF(lbuff,"%s",delim_1); - break; - - case 3: - widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[1]); - SAPPENDF(lbuff,"%s",item_x1); - SAPPENDF(lbuff,"%s",obuff); - widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[2]); - SAPPENDF(lbuff,"%s",item_x2); - SAPPENDF(lbuff,"%s",obuff); - SAPPENDF(lbuff,"%s",delim_2); - break; - - default: - break; - } - printpage(ind,fp,i,lbuff); + SPRINTF(lbuff,"%s",item_0[0]); + k=0; } else { index_normalize(ind[i-1].dic[0], initial_prev, &chset_prev); @@ -466,70 +430,30 @@ void indwrite(char *filename, struct index *ind, int pagenum) } } - switch (ind[i].words) { - case 1: - widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[0]); - SAPPENDF(lbuff,"%s",item_0); - SAPPENDF(lbuff,"%s",obuff); - SAPPENDF(lbuff,"%s",delim_0); - break; - - case 2: - if (u_strcmp(ind[i-1].idx[0],ind[i].idx[0])!=0 || u_strcmp(ind[i-1].dic[0],ind[i].dic[0])!=0) { - widechar_to_multibyte(obuff,BUFFERLEN,ind[i].idx[0]); - SAPPENDF(lbuff,"%s",item_0); - SAPPENDF(lbuff,"%s",obuff); - SAPPENDF(lbuff,"%s",item_x1); - } - else { - if (ind[i-1].words==1) { - SAPPENDF(lbuff,"%s",item_01); - } - else { - SAPPENDF(lbuff,"%s",item_1); - } + q=0; + for (j=0;j=L'A')&&(*c<=L'Z'))||((*c>=L'a')&&(*c<=L'z'))) return 1; - else if ((*c==0x00AA)||(*c==0x00BA)) return 1; /* Latin-1 Supplement */ - else if ((*c>=0x00C0)&&(*c<=0x00D6)) return 1; - else if ((*c>=0x00D8)&&(*c<=0x00F6)) return 1; - else if ((*c>=0x00F8)&&(*c<=0x00FF)) return 1; - else if ((*c>=0x0100)&&(*c<=0x024F)) return 1; /* Latin Extended-A,B */ - else if ((*c>=0x0250)&&(*c<=0x02AF)) return 1; /* IPA Extensions */ - else if ((*c>=0x2C60)&&(*c<=0x2C7F)) return 1; /* Latin Extended-C */ - else if ((*c>=0xA720)&&(*c<=0xA7FF)) return 1; /* Latin Extended-D */ - else if ((*c>=0xAB30)&&(*c<=0xAB6F)) return 1; /* Latin Extended-E */ - else if ((*c>=0x1E00)&&(*c<=0x1EFF)) return 1; /* Latin Extended Additional */ - else if ((*c>=0xFB00)&&(*c<=0xFB06)) return 1; /* Latin ligatures */ - else if ((*c>=0xFF21)&&(*c<=0xFF3A)) return 1; /* Fullwidth Latin Capital Letter */ - else if ((*c>=0xFF41)&&(*c<=0xFF5A)) return 1; /* Fullwidth Latin Small Letter */ + if (( *c>=L'A' && *c<=L'Z' )||( *c>=L'a' && *c<=L'z' )) return 1; + else if ( *c==0x00AA || *c==0x00BA ) return 1; /* Latin-1 Supplement */ + else if ( *c>=0x00C0 && *c<=0x00D6 ) return 1; + else if ( *c>=0x00D8 && *c<=0x00F6 ) return 1; + else if ( *c>=0x00F8 && *c<=0x00FF ) return 1; + else if ( *c>=0x0100 && *c<=0x024F ) return 1; /* Latin Extended-A,B */ + else if ( *c>=0x0250 && *c<=0x02AF ) return 1; /* IPA Extensions */ + else if ( *c>=0x2C60 && *c<=0x2C7F ) return 1; /* Latin Extended-C */ + else if ( *c>=0xA720 && *c<=0xA7FF ) return 1; /* Latin Extended-D */ + else if ( *c>=0xAB30 && *c<=0xAB6F ) return 1; /* Latin Extended-E */ + else if ( *c>=0x1E00 && *c<=0x1EFF ) return 1; /* Latin Extended Additional */ + else if ( *c>=0xFB00 && *c<=0xFB06 ) return 1; /* Latin ligatures */ + else if ( *c>=0xFF21 && *c<=0xFF3A ) return 1; /* Fullwidth Latin Capital Letter */ + else if ( *c>=0xFF41 && *c<=0xFF5A ) return 1; /* Fullwidth Latin Small Letter */ /* Property of followings is "Common, So (other symbol)", but seem to be treated as Latin by ICU collator */ - else if ((*c>=0x24B6) /* CIRCLED LATIN CAPITAL LETTER */ - &&(*c<=0x24E9)) return 1; /* CIRCLED LATIN SMALL LETTER */ + else if ( *c>=0x24B6 /* CIRCLED LATIN CAPITAL LETTER */ + && *c<=0x24E9 ) return 1; /* CIRCLED LATIN SMALL LETTER */ if (is_surrogate_pair(c)) { UChar32 c32; c32=U16_GET_SUPPLEMENTARY(*c,*(c+1)); - if ((c32>=0x10780) && (c32<=0x107BF)) return 2; /* Latin Extended-F */ - else if ((c32>=0x1DF00) && (c32<=0x1DFFF)) return 2; /* Latin Extended-G */ + if ( c32>=0x10780 && c32<=0x107BF ) return 2; /* Latin Extended-F */ + else if ( c32>=0x1DF00 && c32<=0x1DFFF ) return 2; /* Latin Extended-G */ } return 0; } @@ -463,13 +463,13 @@ int is_numeric(UChar *c) { UChar32 c32; - if ((*c>=L'0')&&(*c<=L'9')) return 1; - else if ((*c>=0xFF10)&&(*c<=0xFF19)) return 1; /* Fullwidth Digit */ + if ( *c>=L'0' && *c<=L'9' ) return 1; + else if ( *c>=0xFF10 && *c<=0xFF19 ) return 1; /* Fullwidth Digit */ /* followings do not seem to be treated as numbers by ICU collator though charType is U_OTHER_NUMBER */ - else if ((*c>=0x3192)&&(*c<=0x3195)) return 0; /* IDEOGRAPHIC ANNOTATION ONE MARK..IDEOGRAPHIC ANNOTATION FOUR MARK */ - else if ((*c>=0x3220)&&(*c<=0x3229)) return 0; /* PARENTHESIZED IDEOGRAPH ONE..PARENTHESIZED IDEOGRAPH TEN */ - else if ((*c>=0x3280)&&(*c<=0x3289)) return 0; /* CIRCLED IDEOGRAPH ONE..CIRCLED IDEOGRAPH TEN */ - else if ((*c>=0xA830)&&(*c<=0xA835)) return 0; /* NORTH INDIC FRACTION ONE QUARTER..NORTH INDIC FRACTION THREE SIXTEENTHS */ + else if ( *c>=0x3192 && *c<=0x3195 ) return 0; /* IDEOGRAPHIC ANNOTATION ONE MARK..IDEOGRAPHIC ANNOTATION FOUR MARK */ + else if ( *c>=0x3220 && *c<=0x3229 ) return 0; /* PARENTHESIZED IDEOGRAPH ONE..PARENTHESIZED IDEOGRAPH TEN */ + else if ( *c>=0x3280 && *c<=0x3289 ) return 0; /* CIRCLED IDEOGRAPH ONE..CIRCLED IDEOGRAPH TEN */ + else if ( *c>=0xA830 && *c<=0xA835 ) return 0; /* NORTH INDIC FRACTION ONE QUARTER..NORTH INDIC FRACTION THREE SIXTEENTHS */ if (is_surrogate_pair(c)) c32=U16_GET_SUPPLEMENTARY(*c,*(c+1)); @@ -487,23 +487,23 @@ int is_numeric(UChar *c) int is_jpn_kana(UChar *c) { - if (*c==0x30A0) return 0; /* KATAKANA-HIRAGANA DOUBLE HYPHEN */ - else if (*c==0x30FB) return 0; /* KATAKANA MIDDLE DOT */ - else if ((*c>=0x3040)&&(*c<=0x30FF)) return 1; /* Hiragana, Katakana */ - else if ((*c>=0x31F0)&&(*c<=0x31FF)) return 1; /* Katakana Phonetic Extensions */ - else if ((*c>=0x32D0)&&(*c<=0x32FE)) return 1; /* Circled Katakana */ - else if ((*c>=0xFF66)&&(*c<=0xFF9F)) return 1; /* Halfwidth Katakana */ - else if ((*c>=0x3300)&&(*c<=0x3357)) return 1; /* Squared Katakana words */ + if ( *c==0x30A0 ) return 0; /* KATAKANA-HIRAGANA DOUBLE HYPHEN */ + else if ( *c==0x30FB ) return 0; /* KATAKANA MIDDLE DOT */ + else if ( *c>=0x3040 && *c<=0x30FF ) return 1; /* Hiragana, Katakana */ + else if ( *c>=0x31F0 && *c<=0x31FF ) return 1; /* Katakana Phonetic Extensions */ + else if ( *c>=0x32D0 && *c<=0x32FE ) return 1; /* Circled Katakana */ + else if ( *c>=0xFF66 && *c<=0xFF9F ) return 1; /* Halfwidth Katakana */ + else if ( *c>=0x3300 && *c<=0x3357 ) return 1; /* Squared Katakana words */ if (is_surrogate_pair(c)) { UChar32 c32; c32=U16_GET_SUPPLEMENTARY(*c,*(c+1)); - if ((c32>=0x1B130) && (c32<=0x1B16F)) return 2; /* Small Kana Extensions */ - else if ((c32==0x1B000)) return 2; /* KATAKANA LETTER ARCHAIC E */ - else if ((c32>=0x1B11F) /* HIRAGANA LETTER ARCHAIC WU */ - && (c32<=0x1B122)) return 2; /* KATAKANA LETTER ARCHAIC WU */ - else if ((c32==0x1F200)) return 2; /* SQUARE HIRAGANA HOKA */ - else if (c32==0x1B001) { + if ( c32>=0x1B130 && c32<=0x1B16F ) return 2; /* Small Kana Extensions */ + else if ( c32==0x1B000 ) return 2; /* KATAKANA LETTER ARCHAIC E */ + else if ( c32>=0x1B11F /* HIRAGANA LETTER ARCHAIC WU */ + && c32<=0x1B122 ) return 2; /* KATAKANA LETTER ARCHAIC WU */ + else if ( c32==0x1F200 ) return 2; /* SQUARE HIRAGANA HOKA */ + else if ( c32==0x1B001 ) { /* check whether U+1B001 is HIRAGANA LETTER ARCHAIC YE or not. It may be HENTAIGANA LETTER E-1 */ if (kana_ye_mode==0) { @@ -528,33 +528,33 @@ int is_jpn_kana(UChar *c) int is_kor_hngl(UChar *c) { - if ((*c>=0xAC00)&&(*c<=0xD7AF)) return 1; /* Hangul Syllables */ - else if ((*c>=0x1100)&&(*c<=0x11FF)) return 1; /* Hangul Jamo */ - else if ((*c>=0xA960)&&(*c<=0xA97F)) return 1; /* Hangul Jamo Extended-A */ - else if ((*c>=0xD7B0)&&(*c<=0xD7FF)) return 1; /* Hangul Jamo Extended-B */ - else if ((*c>=0x3130)&&(*c<=0x318F)) return 1; /* Hangul Compatibility Jamo */ - else if ((*c>=0xFFA0)&&(*c<=0xFFDC)) return 1; /* Hangul Halfwidth Jamo */ - else if ((*c>=0x3200)&&(*c<=0x321E)) return 1; /* Enclosed CJK Letters and Months */ - else if ((*c>=0x3260)&&(*c<=0x327E)) return 1; /* Enclosed CJK Letters and Months */ + if ( *c>=0xAC00 && *c<=0xD7AF ) return 1; /* Hangul Syllables */ + else if ( *c>=0x1100 && *c<=0x11FF ) return 1; /* Hangul Jamo */ + else if ( *c>=0xA960 && *c<=0xA97F ) return 1; /* Hangul Jamo Extended-A */ + else if ( *c>=0xD7B0 && *c<=0xD7FF ) return 1; /* Hangul Jamo Extended-B */ + else if ( *c>=0x3130 && *c<=0x318F ) return 1; /* Hangul Compatibility Jamo */ + else if ( *c>=0xFFA0 && *c<=0xFFDC ) return 1; /* Hangul Halfwidth Jamo */ + else if ( *c>=0x3200 && *c<=0x321E ) return 1; /* Enclosed CJK Letters and Months */ + else if ( *c>=0x3260 && *c<=0x327E ) return 1; /* Enclosed CJK Letters and Months */ else return 0; } int is_hanzi(UChar *c) { - if ((*c>=0x2E80) /* CJK Radicals Supplement */ - &&(*c<=0x2FDF)) return 1; /* Kangxi Radicals */ - else if ((*c>=0x31C0)&&(*c<=0x31EF)) return 1; /* CJK Strokes */ - else if ((*c>=0x3300) /* CJK Compatibility */ - &&(*c<=0x4DBF)) return 1; /* CJK Unified Ideographs Extension A */ - else if ((*c>=0x4E00)&&(*c<=0x9FFF)) return 1; /* CJK Unified Ideographs */ - else if ((*c>=0xF900)&&(*c<=0xFAFF)) return 1; /* CJK Compatibility Ideographs */ + if ( *c>=0x2E80 /* CJK Radicals Supplement */ + && *c<=0x2FDF ) return 1; /* Kangxi Radicals */ + else if ( *c>=0x31C0 && *c<=0x31EF ) return 1; /* CJK Strokes */ + else if ( *c>=0x3300 /* CJK Compatibility */ + && *c<=0x4DBF ) return 1; /* CJK Unified Ideographs Extension A */ + else if ( *c>=0x4E00 && *c<=0x9FFF ) return 1; /* CJK Unified Ideographs */ + else if ( *c>=0xF900 && *c<=0xFAFF ) return 1; /* CJK Compatibility Ideographs */ if (is_surrogate_pair(c)) { UChar32 c32; c32=U16_GET_SUPPLEMENTARY(*c,*(c+1)); - if ((c32>=0x20000) && /* CJK Unified Ideographs Extension B,C,D,E,F,I */ + if ( c32>=0x20000 && /* CJK Unified Ideographs Extension B,C,D,E,F,I */ /* CJK Compatibility Ideographs Supplement */ - (c32<=0x323AF)) return 2; /* CJK Unified Ideographs Extension G,H */ + c32<=0x323AF ) return 2; /* CJK Unified Ideographs Extension G,H */ } if (*c==0xFDD0) { /* Noncharacter */ if (hanzi_mode==HANZI_PINYIN && @@ -567,104 +567,104 @@ int is_hanzi(UChar *c) int is_zhuyin(UChar *c) { - if ((*c>=0x3100)&&(*c<=0x312F)) return 1; /* Bopomofo */ - else if ((*c>=0x31A0)&&(*c<=0x31BF)) return 1; /* Bopomofo Extended */ + if ( *c>=0x3100 && *c<=0x312F ) return 1; /* Bopomofo */ + else if ( *c>=0x31A0 && *c<=0x31BF ) return 1; /* Bopomofo Extended */ else return 0; } int is_cyrillic(UChar *c) { - if ((*c==0x0482)) return 0; /* Cyrillic Thousands Sign */ - else if ((*c>=0x0400) /* Cyrillic */ - &&(*c<=0x052F)) return 1; /* Cyrillic Supplement */ - else if ((*c>=0x1C80)&&(*c<=0x1C8F)) return 1; /* Cyrillic Extended-C */ - else if ((*c>=0x2DE0)&&(*c<=0x2DFF)) return 1; /* Cyrillic Extended-A */ - else if ((*c>=0xA640)&&(*c<=0xA69F)) return 1; /* Cyrillic Extended-B */ + if ( *c==0x0482 ) return 0; /* Cyrillic Thousands Sign */ + else if ( *c>=0x0400 /* Cyrillic */ + && *c<=0x052F ) return 1; /* Cyrillic Supplement */ + else if ( *c>=0x1C80 && *c<=0x1C8F ) return 1; /* Cyrillic Extended-C */ + else if ( *c>=0x2DE0 && *c<=0x2DFF ) return 1; /* Cyrillic Extended-A */ + else if ( *c>=0xA640 && *c<=0xA69F ) return 1; /* Cyrillic Extended-B */ if (is_surrogate_pair(c)) { UChar32 c32; c32=U16_GET_SUPPLEMENTARY(*c,*(c+1)); - if ((c32>=0x1E030) && (c32<=0x1E08F)) return 2; /* Cyrillic Extended-D */ + if ( c32>=0x1E030 && c32<=0x1E08F ) return 2; /* Cyrillic Extended-D */ } return 0; } int is_greek(UChar *c) { - if ((*c==0x03F6)) return 0; /* Greek Reversed Lunate Epsilon Symbol */ - else if ((*c>=0x0370)&&(*c<=0x03FF)) return 1; /* Greek */ - else if ((*c>=0x1F00)&&(*c<=0x1FFF)) return 1; /* Greek Extended */ + if ( *c==0x03F6 ) return 0; /* Greek Reversed Lunate Epsilon Symbol */ + else if ( *c>=0x0370 && *c<=0x03FF ) return 1; /* Greek */ + else if ( *c>=0x1F00 && *c<=0x1FFF ) return 1; /* Greek Extended */ else return 0; } int is_devanagari(UChar *c) { - if ((*c>=0x0964) /* Generic punctuation for scripts of India */ - &&(*c<=0x096F)) return 0; /* Devanagari Digit */ - else if ((*c>=0x0900)&&(*c<=0x097F)) return 1; /* Devanagari */ - else if ((*c>=0xA8E0)&&(*c<=0xA8FF)) return 1; /* Devanagari Extended */ + if ( *c>=0x0964 /* Generic punctuation for scripts of India */ + && *c<=0x096F ) return 0; /* Devanagari Digit */ + else if ( *c>=0x0900 && *c<=0x097F ) return 1; /* Devanagari */ + else if ( *c>=0xA8E0 && *c<=0xA8FF ) return 1; /* Devanagari Extended */ if (is_surrogate_pair(c)) { UChar32 c32; c32=U16_GET_SUPPLEMENTARY(*c,*(c+1)); - if ((c32>=0x11B00) && (c32<=0x11B5F)) return 2; /* Devanagari Extended-A */ + if ( c32>=0x11B00 && c32<=0x11B5F ) return 2; /* Devanagari Extended-A */ } return 0; } int is_thai(UChar *c) { - if ((*c==0x0E3F)) return 0; /* Thai Currency Symbol Baht */ - else if ((*c>=0x0E50)&&(*c<=0x0E59)) return 0; /* Thai Digit */ - else if ((*c>=0x0E00)&&(*c<=0x0E7F)) return 1; /* Thai */ + if ( *c==0x0E3F ) return 0; /* Thai Currency Symbol Baht */ + else if ( *c>=0x0E50 && *c<=0x0E59 ) return 0; /* Thai Digit */ + else if ( *c>=0x0E00 && *c<=0x0E7F ) return 1; /* Thai */ else return 0; } int is_arabic(UChar *c) { - if ((*c>=0x0600) /* ARABIC NUMBER SIGN..ARABIC SIGN SAMVAT */ + if ( *c>=0x0600 /* ARABIC NUMBER SIGN..ARABIC SIGN SAMVAT */ /* ARABIC NUMBER MARK ABOVE */ - &&(*c<=0x0608)) return 0; /* ARABIC-INDIC CUBE ROOT..ARABIC RAY */ - else if ((*c==0x060B)) return 0; /* AFGHANI SIGN */ - else if ((*c==0x060C)) return 0; /* ARABIC COMMA */ - else if ((*c>=0x060E)&&(*c<=0x060F)) return 0; /* ARABIC POETIC VERSE SIGN..ARABIC SIGN MISRA */ - else if ((*c>=0x0660)&&(*c<=0x0669)) return 0; /* ARABIC-INDIC DIGIT ZERO..ARABIC-INDIC DIGIT NINE */ - else if ((*c==0x061B)) return 0; /* ARABIC SEMICOLON */ - else if ((*c==0x061C)) return 0; /* ARABIC LETTER MARK */ - else if ((*c==0x061F)) return 0; /* ARABIC QUESTION MARK */ - else if ((*c==0x0640)) return 0; /* ARABIC TATWEEL */ - else if ((*c==0x06DD)) return 0; /* ARABIC END OF AYAH */ - else if ((*c==0x06DE)) return 0; /* ARABIC START OF RUB EL HIZB */ - else if ((*c==0x06E9)) return 0; /* ARABIC PLACE OF SAJDAH */ - else if ((*c>=0x06F0)&&(*c<=0x06F9)) return 0; /* EXTENDED ARABIC-INDIC DIGIT ZERO..EXTENDED ARABIC-INDIC DIGIT NINE */ - else if ((*c>=0x06FD)&&(*c<=0x06FE)) return 0; /* ARABIC SIGN SINDHI AMPERSAND..ARABIC SIGN SINDHI POSTPOSITION MEN */ - else if ((*c==0x08E2)) return 0; /* ARABIC DISPUTED END OF AYAH */ - else if ((*c>=0x0890)&&(*c<=0x0891)) return 0; /* ARABIC POUND MARK ABOVE..ARABIC PIASTRE MARK ABOVE */ - else if ((*c>=0xFD40)&&(*c<=0xFD4F)) return 0; /* ARABIC LIGATURE RAHIMAHU ALLAAH..ARABIC LIGATURE RAHIMAHUM ALLAAH */ - else if ((*c==0xFDCF)) return 0; /* ARABIC LIGATURE SALAAMUHU ALAYNAA */ - else if ((*c==0xFDFC)) return 0; /* RIAL SIGH */ - else if ((*c>=0xFDFD)&&(*c<=0xFDFF)) return 0; /* ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM..ARABIC LIGATURE AZZA WA JALL */ - - else if ((*c>=0x0600)&&(*c<=0x06FF)) return 1; /* Arabic */ - else if ((*c>=0x0750)&&(*c<=0x077F)) return 1; /* Arabic Supplement */ - else if ((*c>=0x0870) /* Arabic Extended-B */ - &&(*c<=0x08FF)) return 1; /* Arabic Extended-A */ - else if ((*c>=0xFB50)&&(*c<=0xFDFF)) return 1; /* Arabic Presentation Forms-A */ - else if ((*c>=0xFE70)&&(*c<=0xFEFF)) return 1; /* Arabic Presentation Forms-B */ + && *c<=0x0608 ) return 0; /* ARABIC-INDIC CUBE ROOT..ARABIC RAY */ + else if ( *c==0x060B ) return 0; /* AFGHANI SIGN */ + else if ( *c==0x060C ) return 0; /* ARABIC COMMA */ + else if ( *c>=0x060E && *c<=0x060F ) return 0; /* ARABIC POETIC VERSE SIGN..ARABIC SIGN MISRA */ + else if ( *c>=0x0660 && *c<=0x0669 ) return 0; /* ARABIC-INDIC DIGIT ZERO..ARABIC-INDIC DIGIT NINE */ + else if ( *c==0x061B ) return 0; /* ARABIC SEMICOLON */ + else if ( *c==0x061C ) return 0; /* ARABIC LETTER MARK */ + else if ( *c==0x061F ) return 0; /* ARABIC QUESTION MARK */ + else if ( *c==0x0640 ) return 0; /* ARABIC TATWEEL */ + else if ( *c==0x06DD ) return 0; /* ARABIC END OF AYAH */ + else if ( *c==0x06DE ) return 0; /* ARABIC START OF RUB EL HIZB */ + else if ( *c==0x06E9 ) return 0; /* ARABIC PLACE OF SAJDAH */ + else if ( *c>=0x06F0 && *c<=0x06F9 ) return 0; /* EXTENDED ARABIC-INDIC DIGIT ZERO..EXTENDED ARABIC-INDIC DIGIT NINE */ + else if ( *c>=0x06FD && *c<=0x06FE ) return 0; /* ARABIC SIGN SINDHI AMPERSAND..ARABIC SIGN SINDHI POSTPOSITION MEN */ + else if ( *c==0x08E2 ) return 0; /* ARABIC DISPUTED END OF AYAH */ + else if ( *c>=0x0890 && *c<=0x0891 ) return 0; /* ARABIC POUND MARK ABOVE..ARABIC PIASTRE MARK ABOVE */ + else if ( *c>=0xFD40 && *c<=0xFD4F ) return 0; /* ARABIC LIGATURE RAHIMAHU ALLAAH..ARABIC LIGATURE RAHIMAHUM ALLAAH */ + else if ( *c==0xFDCF ) return 0; /* ARABIC LIGATURE SALAAMUHU ALAYNAA */ + else if ( *c==0xFDFC ) return 0; /* RIAL SIGH */ + else if ( *c>=0xFDFD && *c<=0xFDFF ) return 0; /* ARABIC LIGATURE BISMILLAH AR-RAHMAN AR-RAHEEM..ARABIC LIGATURE AZZA WA JALL */ + + else if ( *c>=0x0600 && *c<=0x06FF ) return 1; /* Arabic */ + else if ( *c>=0x0750 && *c<=0x077F ) return 1; /* Arabic Supplement */ + else if ( *c>=0x0870 /* Arabic Extended-B */ + && *c<=0x08FF ) return 1; /* Arabic Extended-A */ + else if ( *c>=0xFB50 && *c<=0xFDFF ) return 1; /* Arabic Presentation Forms-A */ + else if ( *c>=0xFE70 && *c<=0xFEFF ) return 1; /* Arabic Presentation Forms-B */ if (is_surrogate_pair(c)) { UChar32 c32; c32=U16_GET_SUPPLEMENTARY(*c,*(c+1)); - if ((c32>=0x10EC0) && (c32<=0x10EFF)) return 2; /* Arabic Extended-C */ + if ( c32>=0x10EC0 && c32<=0x10EFF ) return 2; /* Arabic Extended-C */ } return 0; } int is_hebrew(UChar *c) { - if ((*c==0xFB29)) return 0; /* Hebrew Letter Alternative Plus Sign */ - else if ((*c>=0x0590)&&(*c<=0x05FF)) return 1; /* Hebrew */ - else if ((*c>=0xFB1D)&&(*c<=0xFB4F)) return 1; /* Hebrew presentation forms */ + if ( *c==0xFB29 ) return 0; /* Hebrew Letter Alternative Plus Sign */ + else if ( *c>=0x0590 && *c<=0x05FF ) return 1; /* Hebrew */ + else if ( *c>=0xFB1D && *c<=0xFB4F ) return 1; /* Hebrew presentation forms */ else return 0; } diff --git a/texk/upmendex/styfile.c b/texk/upmendex/styfile.c index f029679049..ea4451a3e1 100644 --- a/texk/upmendex/styfile.c +++ b/texk/upmendex/styfile.c @@ -37,7 +37,7 @@ bfgets (char *buf, int size, FILE *fp) /* read style file */ void styread(const char *filename) { - int i,cc; + int i,j,q,cc; char buff[4096],tmp[4096]; filename = KP_find_file(&kp_ist,filename); @@ -87,16 +87,31 @@ void styread(const char *filename) priority=atoi(&buff[cc]); continue; } - if (getparam(buff,"item_0",item_0)) continue; - if (getparam(buff,"item_1",item_1)) continue; - if (getparam(buff,"item_2",item_2)) continue; - if (getparam(buff,"item_01",item_01)) continue; - if (getparam(buff,"item_x1",item_x1)) continue; - if (getparam(buff,"item_12",item_12)) continue; - if (getparam(buff,"item_x2",item_x2)) continue; - if (getparam(buff,"delim_0",delim_0)) continue; - if (getparam(buff,"delim_1",delim_1)) continue; - if (getparam(buff,"delim_2",delim_2)) continue; + q=0; + for (j=0;;j++) { + sprintf(tmp,"item_%d",j); + if (getparam(buff,tmp,item_0[j])) { + q=1; + break; + } + sprintf(tmp,"delim_%d",j); + if (getparam(buff,tmp,delim_0[j])) { + q=1; + break; + } + if (j==MAXDEPTH-1) break; + sprintf(tmp,"item_%d%d",j,j+1); + if (getparam(buff,tmp,item_01[j])) { + q=1; + break; + } + sprintf(tmp,"item_x%d",j+1); + if (getparam(buff,tmp,item_x[j])) { + q=1; + break; + } + } + if (q==1) continue; if (getparam(buff,"delim_n",delim_n)) continue; if (getparam(buff,"delim_r",delim_r)) continue; if (getparam(buff,"delim_t",delim_t)) continue; diff --git a/texk/upmendex/tests/icu.test b/texk/upmendex/tests/icu.test new file mode 100755 index 0000000000..69fcfdeba4 --- /dev/null +++ b/texk/upmendex/tests/icu.test @@ -0,0 +1,66 @@ +#! /bin/sh -vx +# $Id$ +# Copyright 2021-2024 TANAKA Takuji +# Copyright 2017-2022 Karl Berry +# Copyright 2013 Peter Breitenlohner +# You may freely use, modify and/or distribute this file. + +BinDir=${BinDir:-.} +ExeExt=${ExeExt:-} +_upmendex=$BinDir/upmendex$ExeExt + +TEXMFCNF=$srcdir/../kpathsea +export TEXMFCNF + +rm -f locale*.* attr*.* rule*.* +rc=0 + +# test for icu_locale +$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/locale1.ist $srcdir/tests/rule.idx \ + -o locale1.ind1 -t locale1.ilg \ + && diff $srcdir/tests/locale1.ind locale1.ind1 || rc=51 + +# 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 || rc=52 + +# 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 \ + && diff $srcdir/tests/rule.ind rule1.ind1 || rc=53 + +$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/rule2.ist $srcdir/tests/rule.idx \ + -o rule2.ind1 -t rule2.ilg \ + && diff $srcdir/tests/rule.ind rule2.ind1 || rc=54 + +# malformed input +$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/rule3.ist $srcdir/tests/rule.idx \ + -o rule3.ind1 -t rule3.ilg +if [ $? -eq 254 ]; then + echo "Error check: OK" +else + echo "Error check: NG" + exit 1 +fi + +$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/rule4.ist $srcdir/tests/rule.idx \ + -o rule4.ind1 -t rule4.ilg +if [ $? -eq 254 ]; then + echo "Error check: OK" +else + echo "Error check: NG" + exit 1 +fi + +# test for icu_locale + icu_rules +$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/locale2.ist -s $srcdir/tests/rule1.ist $srcdir/tests/rule.idx \ + -o locale2-rule1.ind1 -t locale2-rule1.ilg \ + && diff $srcdir/tests/locale2-rule.ind locale2-rule1.ind1 || rc=55 + +$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/locale3.ist -s $srcdir/tests/rule1.ist $srcdir/tests/rule.idx \ + -o locale3-rule1.ind1 -t locale3-rule1.ilg \ + && diff $srcdir/tests/locale3-rule.ind locale3-rule1.ind1 || rc=56 + + +exit $rc diff --git a/texk/upmendex/tests/nest.test b/texk/upmendex/tests/nest.test new file mode 100755 index 0000000000..069f331fa3 --- /dev/null +++ b/texk/upmendex/tests/nest.test @@ -0,0 +1,41 @@ +#! /bin/sh -vx +# $Id$ +# Copyright 2024 TANAKA Takuji +# Copyright 2017-2022 Karl Berry +# Copyright 2013 Peter Breitenlohner +# You may freely use, modify and/or distribute this file. + +BinDir=${BinDir:-.} +ExeExt=${ExeExt:-} +_upmendex=$BinDir/upmendex$ExeExt + +TEXMFCNF=$srcdir/../kpathsea +export TEXMFCNF + +rm -f nested*.* toodeep*.* +rc=0 + +# test for nested items and delimiters +$_upmendex -s $srcdir/tests/nested3.ist -o nested3.ind1 -t nested3.ilg $srcdir/tests/nested3.idx \ + && diff $srcdir/tests/nested3.ind nested3.ind1 || rc=30 +$_upmendex -s $srcdir/tests/nested.ist -o nested.ind1 -t nested.ilg $srcdir/tests/nested.idx \ + && diff $srcdir/tests/nested.ind nested.ind1 || rc=31 + +# check compatibility with makeindex if exist +if type makeindex > /dev/null 2>&1; then + makeindex -s $srcdir/tests/nested3.ist -o nested_mi.ind1 -t nested_mi.ilg $srcdir/tests/nested3.idx \ + && diff $srcdir/tests/nested3.ind nested_mi.ind1 || rc=32 +fi + +# test for too deep indexentry +$_upmendex $srcdir/tests/toodeep.idx -o toodeep.ind1 -t toodeep.ilg + +if [ $? -eq 255 ]; then + echo "Error check: OK" +else + echo "Error check: NG" + rc=56 +fi + + +exit $rc diff --git a/texk/upmendex/tests/nested.idx b/texk/upmendex/tests/nested.idx new file mode 100644 index 0000000000..0d85f2dc0b --- /dev/null +++ b/texk/upmendex/tests/nested.idx @@ -0,0 +1,46 @@ +\indexentry{xa}{1} +\indexentry{xb}{1} +\indexentry{xc}{1} +\indexentry{ya!x}{1} +\indexentry{ya!y}{1} +\indexentry{ya!z}{1} +\indexentry{yb!x!x}{1} +\indexentry{yb!x!y}{1} +\indexentry{yb!x!z}{1} +\indexentry{yc!x!y!x}{1} +\indexentry{yc!x!y!y}{1} +\indexentry{yc!x!y!z}{1} +\indexentry{yd!x!y!z!x}{1} +\indexentry{yd!x!y!z!y}{1} +\indexentry{yd!x!y!z!z}{1} +\indexentry{a}{1} +\indexentry{a!a}{2} +\indexentry{a!a!a}{3} +\indexentry{a!a!a!a}{4} +\indexentry{a!a!a!a!a}{5} +\indexentry{ab}{6} +\indexentry{ac!a!a!a!a}{7} +\indexentry{ad!a}{8} +\indexentry{ad!b}{9} +\indexentry{ad!b!a!a!a}{10} +\indexentry{ae!a!a}{11} +\indexentry{ae!b!b}{12} +\indexentry{ae!b!b!a!a}{13} +\indexentry{af!b!a!a}{14} +\indexentry{af!b!b!b}{15} +\indexentry{af!b!b!b!a}{16} +\indexentry{ag!b!b!a}{17} +\indexentry{ag!b!b!b}{18} +\indexentry{ag!b!b!b!a}{19} +\indexentry{pa}{21} +\indexentry{pa!qa!ra}{22} +\indexentry{pb}{23} +\indexentry{pb!qb!rb!sb}{24} +\indexentry{pc}{25} +\indexentry{pc!qc!rc!sc!tc}{26} +\indexentry{pd!qd}{27} +\indexentry{pd!qd!rd!sd}{28} +\indexentry{pe!qe}{29} +\indexentry{pe!qe!re!se!te}{30} +\indexentry{pf!qf!rf}{31} +\indexentry{pf!qf!rf!sf!tf}{32} diff --git a/texk/upmendex/tests/nested.ind b/texk/upmendex/tests/nested.ind new file mode 100644 index 0000000000..9104a2dad2 --- /dev/null +++ b/texk/upmendex/tests/nested.ind @@ -0,0 +1,101 @@ +\begin{theindex} + + \item_0 a(0) 1 + \item_01 a(1) 2 + \item_12 a(2) 3 + \item_23 a(3) 4 + \item_34 a(4) 5 + \item_0 ab(0) 6 + \item_0 ac + \item_x1 a + \item_x2 a + \item_x3 a + \item_x4 a(4) 7 + \item_0 ad + \item_x1 a(1) 8 + \item_1 b(1) 9 + \item_12 a + \item_x3 a + \item_x4 a(4) 10 + \item_0 ae + \item_x1 a + \item_x2 a(2) 11 + \item_1 b + \item_x2 b(2) 12 + \item_23 a + \item_x4 a(4) 13 + \item_0 af + \item_x1 b + \item_x2 a + \item_x3 a(3) 14 + \item_2 b + \item_x3 b(3) 15 + \item_34 a(4) 16 + \item_0 ag + \item_x1 b + \item_x2 b + \item_x3 a(3) 17 + \item_3 b(3) 18 + \item_34 a(4) 19 + + \indexspace + + \item_0 pa(0) 21 + \item_01 qa + \item_x2 ra(2) 22 + \item_0 pb(0) 23 + \item_01 qb + \item_x2 rb + \item_x3 sb(3) 24 + \item_0 pc(0) 25 + \item_01 qc + \item_x2 rc + \item_x3 sc + \item_x4 tc(4) 26 + \item_0 pd + \item_x1 qd(1) 27 + \item_12 rd + \item_x3 sd(3) 28 + \item_0 pe + \item_x1 qe(1) 29 + \item_12 re + \item_x3 se + \item_x4 te(4) 30 + \item_0 pf + \item_x1 qf + \item_x2 rf(2) 31 + \item_23 sf + \item_x4 tf(4) 32 + + \indexspace + + \item_0 xa(0) 1 + \item_0 xb(0) 1 + \item_0 xc(0) 1 + + \indexspace + + \item_0 ya + \item_x1 x(1) 1 + \item_1 y(1) 1 + \item_1 z(1) 1 + \item_0 yb + \item_x1 x + \item_x2 x(2) 1 + \item_2 y(2) 1 + \item_2 z(2) 1 + \item_0 yc + \item_x1 x + \item_x2 y + \item_x3 x(3) 1 + \item_3 y(3) 1 + \item_3 z(3) 1 + \item_0 yd + \item_x1 x + \item_x2 y + \item_x3 z + \item_x4 x(4) 1 + \item_4 y(4) 1 + \item_4 z(4) 1 + +\end{theindex} diff --git a/texk/upmendex/tests/nested.ist b/texk/upmendex/tests/nested.ist new file mode 100644 index 0000000000..d0aa1d353a --- /dev/null +++ b/texk/upmendex/tests/nested.ist @@ -0,0 +1,18 @@ +item_0 "\n \\item_0 " +item_1 "\n \\item_1 " +item_2 "\n \\item_2 " +item_3 "\n \\item_3 " +item_4 "\n \\item_4 " +item_01 "\n \\item_01 " +item_12 "\n \\item_12 " +item_23 "\n \\item_23 " +item_34 "\n \\item_34 " +item_x1 "\n \\item_x1 " +item_x2 "\n \\item_x2 " +item_x3 "\n \\item_x3 " +item_x4 "\n \\item_x4 " +delim_0 "(0) " +delim_1 "(1) " +delim_2 "(2) " +delim_3 "(3) " +delim_4 "(4) " diff --git a/texk/upmendex/tests/nested3.idx b/texk/upmendex/tests/nested3.idx new file mode 100644 index 0000000000..c6b440b986 --- /dev/null +++ b/texk/upmendex/tests/nested3.idx @@ -0,0 +1,19 @@ +\indexentry{xa}{1} +\indexentry{xb}{1} +\indexentry{xc}{1} +\indexentry{ya!x}{1} +\indexentry{ya!y}{1} +\indexentry{ya!z}{1} +\indexentry{yb!x!x}{1} +\indexentry{yb!x!y}{1} +\indexentry{yb!x!z}{1} +\indexentry{a}{1} +\indexentry{a!a}{2} +\indexentry{a!a!a}{3} +\indexentry{ab}{6} +\indexentry{ad!a}{8} +\indexentry{ad!b}{9} +\indexentry{ae!a!a}{11} +\indexentry{ae!b!b}{12} +\indexentry{pa}{21} +\indexentry{pa!qa!ra}{22} diff --git a/texk/upmendex/tests/nested3.ind b/texk/upmendex/tests/nested3.ind new file mode 100644 index 0000000000..7cd938c3a9 --- /dev/null +++ b/texk/upmendex/tests/nested3.ind @@ -0,0 +1,40 @@ +\begin{theindex} + + \item_0 a(0) 1 + \item_01 a(1) 2 + \item_12 a(2) 3 + \item_0 ab(0) 6 + \item_0 ad + \item_x1 a(1) 8 + \item_1 b(1) 9 + \item_0 ae + \item_x1 a + \item_x2 a(2) 11 + \item_1 b + \item_x2 b(2) 12 + + \indexspace + + \item_0 pa(0) 21 + \item_01 qa + \item_x2 ra(2) 22 + + \indexspace + + \item_0 xa(0) 1 + \item_0 xb(0) 1 + \item_0 xc(0) 1 + + \indexspace + + \item_0 ya + \item_x1 x(1) 1 + \item_1 y(1) 1 + \item_1 z(1) 1 + \item_0 yb + \item_x1 x + \item_x2 x(2) 1 + \item_2 y(2) 1 + \item_2 z(2) 1 + +\end{theindex} diff --git a/texk/upmendex/tests/nested3.ist b/texk/upmendex/tests/nested3.ist new file mode 100644 index 0000000000..7180892937 --- /dev/null +++ b/texk/upmendex/tests/nested3.ist @@ -0,0 +1,10 @@ +item_0 "\n \\item_0 " +item_1 "\n \\item_1 " +item_2 "\n \\item_2 " +item_01 "\n \\item_01 " +item_12 "\n \\item_12 " +item_x1 "\n \\item_x1 " +item_x2 "\n \\item_x2 " +delim_0 "(0) " +delim_1 "(1) " +delim_2 "(2) " diff --git a/texk/upmendex/tests/ok-tort.ind b/texk/upmendex/tests/ok-tort.ind new file mode 100644 index 0000000000..bbd7178301 --- /dev/null +++ b/texk/upmendex/tests/ok-tort.ind @@ -0,0 +1,24 @@ +\begin{theindex} + + \item bad-encaps, \ii{5--7} + + \indexspace + + \item implicit-range, 10--12 + \item incons-encaps, \ii{6}, 5--7 + \item incons-encaps2, \ii{5}, 5 + \item incons-entries, 6, \xx{6} + + \indexspace + + \item missing(, 6 + \item missing), 6 + \item mixed-range, i, 6 + \item mixed-range1, i--iv, 3--6 + \item mixed-range2, \xx{ii}, i--ii, \yy{3--6} + + \indexspace + + \item ok-encaps, \ii{5--7} + +\end{theindex} diff --git a/texk/upmendex/tests/pprec.test b/texk/upmendex/tests/pprec.test new file mode 100755 index 0000000000..fcf333768f --- /dev/null +++ b/texk/upmendex/tests/pprec.test @@ -0,0 +1,68 @@ +#! /bin/sh -vx +# $Id$ +# Copyright 2021-2024 TANAKA Takuji +# Copyright 2017-2022 Karl Berry +# Copyright 2013 Peter Breitenlohner +# You may freely use, modify and/or distribute this file. + +BinDir=${BinDir:-.} +ExeExt=${ExeExt:-} +_upmendex=$BinDir/upmendex$ExeExt + +TEXMFCNF=$srcdir/../kpathsea +export TEXMFCNF + +rm -f range*.* pprec*.* romalp*.* +rc=0 + +# test for range suffix_2p, suffix_3p, suffix_mp +for num in 1 2 3; do +$_upmendex -s $srcdir/tests/range$num.ist $srcdir/tests/range.idx \ + -o range$num.ind1 -t range$num.ilg \ + && diff $srcdir/tests/range$num.ind range$num.ind1 || rc=6 +done + + +# test for page_precedence and suffix_3p +sfx=A +for num in 0 1 2; do +$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/pprec$sfx.idx \ + -o pprec$sfx-$num.ind1 -t pprec$sfx-$num.ilg \ + && diff $srcdir/tests/pprec$sfx-$num.ind pprec$sfx-$num.ind1 || rc=7 +done +sfx=B +for num in 0 3 4; do +$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/pprec$sfx.idx \ + -o pprec$sfx-$num.ind1 -t pprec$sfx-$num.ilg \ + && diff $srcdir/tests/pprec$sfx-$num.ind pprec$sfx-$num.ind1 || rc=8 +done + + +# test for page_precedence, heuristic detection if a letter is Roman or Alpha +sfx=A +for num in 5 6; do +$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/romalp$sfx.idx \ + -o romalp$sfx-$num.ind1 -t romalp$sfx-$num.ilg \ + && diff $srcdir/tests/romalp$sfx-$num.ind romalp$sfx-$num.ind1 || rc=9 +done +sfx=B +for num in 5 6 7; do +$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/romalp$sfx.idx \ + -o romalp$sfx-$num.ind1 -t romalp$sfx-$num.ilg \ + && diff $srcdir/tests/romalp$sfx-$num.ind romalp$sfx-$num.ind1 || rc=10 +done +sfx=C +for num in 5; do +$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/romalp$sfx.idx \ + -o romalp$sfx-$num.ind1 -t romalp$sfx-$num.ilg \ + && diff $srcdir/tests/romalp$sfx-$num.ind romalp$sfx-$num.ind1 || rc=11 +done +sfx=D +for num in 5 6 7; do +$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/romalp$sfx.idx \ + -o romalp$sfx-$num.ind1 -t romalp$sfx-$num.ilg \ + && diff $srcdir/tests/romalp$sfx-$num.ind romalp$sfx-$num.ind1 || rc=12 +done + + +exit $rc diff --git a/texk/upmendex/tests/toodeep.idx b/texk/upmendex/tests/toodeep.idx new file mode 100644 index 0000000000..52e4ce8fa6 --- /dev/null +++ b/texk/upmendex/tests/toodeep.idx @@ -0,0 +1,6 @@ +\indexentry{a}{1} +\indexentry{a!a}{2} +\indexentry{a!a!a}{3} +\indexentry{a!a!a!a}{4} +\indexentry{a!a!a!a!a}{5} +\indexentry{a!a!a!a!a!a}{6} diff --git a/texk/upmendex/tests/tort.idx b/texk/upmendex/tests/tort.idx new file mode 100644 index 0000000000..849cecb3af --- /dev/null +++ b/texk/upmendex/tests/tort.idx @@ -0,0 +1,53 @@ +\indexentry{@illegal-null-field}{9} +\indexentry{!illegal-null-field}{10} +\indexentry{too-may-ats@x@}{10} +\indexentry{too-may-bangs!x!y!z!v!w}{10} +\indexentry{too-may-bars|x|}{10} +\indexentry{hoge!@illegal-null-field}{9} +\indexentry{hoge!fuga!@illegal-null-field}{9} +\indexentry{haha!@!illegal-null-field}{10} +\indexentry{illegal-null-field-in-bangs!p!@r}{10} +\indexentry{illegal-null-field-in-bangs!!r}{10} +\indexentry{fff!p!q@r@s}{11} +\indexentry{ggg!p!q|r|}{12} +\indexentry{hhh|t@p|s}{13} +\indexentry{iii|t!p|s}{14} + +\indexentry{incons-entries|xx}{6} +\indexentry{incons-entries}{6} + +\indexentry{implicit-range}{10} +\indexentry{implicit-range}{11} +\indexentry{implicit-range}{12} + +\indexentry{missing(|)}{6} +\indexentry{missing)|(}{6} + +\indexentry{ok-encaps|(ii}{5} +\indexentry{ok-encaps|ii}{6} +\indexentry{ok-encaps|)}{7} + +\indexentry{bad-encaps|(ii}{5} +\indexentry{bad-encaps|ii}{6} +\indexentry{bad-encaps|)iii}{7} + +\indexentry{incons-encaps|(}{5} +\indexentry{incons-encaps|ii}{6} +\indexentry{incons-encaps|)}{7} + +\indexentry{incons-encaps2|(}{5} +\indexentry{incons-encaps2|ii}{5} +\indexentry{incons-encaps2|)}{5} + +\indexentry{mixed-range|(}{i} +\indexentry{mixed-range|)}{6} + +\indexentry{mixed-range1|(}{i} +\indexentry{mixed-range1}{iv} +\indexentry{mixed-range1}{3} +\indexentry{mixed-range1|)}{6} + +\indexentry{mixed-range2|(}{i} +\indexentry{mixed-range2|xx}{ii} +\indexentry{mixed-range2|yy}{3} +\indexentry{mixed-range2|)}{6} diff --git a/texk/upmendex/tests/tortW.idx b/texk/upmendex/tests/tortW.idx new file mode 100644 index 0000000000..eaedc73711 --- /dev/null +++ b/texk/upmendex/tests/tortW.idx @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + +\indexentry{incons-entries|xx}{6} +\indexentry{incons-entries}{6} + +\indexentry{implicit-range}{10} +\indexentry{implicit-range}{11} +\indexentry{implicit-range}{12} + +\indexentry{missing(|)}{6} +\indexentry{missing)|(}{6} + +\indexentry{ok-encaps|(ii}{5} +\indexentry{ok-encaps|ii}{6} +\indexentry{ok-encaps|)}{7} + +\indexentry{bad-encaps|(ii}{5} +\indexentry{bad-encaps|ii}{6} +\indexentry{bad-encaps|)iii}{7} + +\indexentry{incons-encaps|(}{5} +\indexentry{incons-encaps|ii}{6} +\indexentry{incons-encaps|)}{7} + +\indexentry{incons-encaps2|(}{5} +\indexentry{incons-encaps2|ii}{5} +\indexentry{incons-encaps2|)}{5} + +\indexentry{mixed-range|(}{i} +\indexentry{mixed-range|)}{6} + +\indexentry{mixed-range1|(}{i} +\indexentry{mixed-range1}{iv} +\indexentry{mixed-range1}{3} +\indexentry{mixed-range1|)}{6} + +\indexentry{mixed-range2|(}{i} +\indexentry{mixed-range2|xx}{ii} +\indexentry{mixed-range2|yy}{3} +\indexentry{mixed-range2|)}{6} diff --git a/texk/upmendex/tests/upmendex.test b/texk/upmendex/tests/upmendex.test index 61caa7053d..5074c52927 100755 --- a/texk/upmendex/tests/upmendex.test +++ b/texk/upmendex/tests/upmendex.test @@ -1,6 +1,6 @@ #! /bin/sh -vx # $Id$ -# Copyright 2021-2023 TANAKA Takuji +# Copyright 2021-2024 TANAKA Takuji # Copyright 2017-2022 Karl Berry # Copyright 2013 Peter Breitenlohner # You may freely use, modify and/or distribute this file. @@ -12,7 +12,7 @@ _upmendex=$BinDir/upmendex$ExeExt TEXMFCNF=$srcdir/../kpathsea export TEXMFCNF -rm -f foo.* uni.* range*.* pprec*.* romalp*.* locale*.* attr*.* rule*.* +rm -f foo.* uni.* tort*.* rc=0 $_upmendex $srcdir/tests/foo.idx -o foo.ind1 -t foo.ilg1 \ @@ -34,103 +34,13 @@ $_upmendex -d $srcdir/tests/uni.dict -s $srcdir/tests/uni1.ist -s $srcdir/tests/ $srcdir/tests/uni.idx -o uni.ind3 -t uni.ilg3 \ && diff $srcdir/tests/uni.ind uni.ind3 || rc=5 +$_upmendex $srcdir/tests/tort.idx -o tort.ind1 -t tort.ilg1 \ + && rc=20 +#$_upmendex $srcdir/tests/tort.idx -o tort.ind1 -t tort.ilg1 \ +# && diff $srcdir/tests/ok-tort.ind tort.ind1 || : -# test for range suffix_2p, suffix_3p, suffix_mp -for num in 1 2 3; do -$_upmendex -s $srcdir/tests/range$num.ist $srcdir/tests/range.idx \ - -o range$num.ind1 -t range$num.ilg \ - && diff $srcdir/tests/range$num.ind range$num.ind1 || rc=6 -done - - -# test for page_precedence and suffix_3p -sfx=A -for num in 0 1 2; do -$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/pprec$sfx.idx \ - -o pprec$sfx-$num.ind1 -t pprec$sfx-$num.ilg \ - && diff $srcdir/tests/pprec$sfx-$num.ind pprec$sfx-$num.ind1 || rc=7 -done -sfx=B -for num in 0 3 4; do -$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/pprec$sfx.idx \ - -o pprec$sfx-$num.ind1 -t pprec$sfx-$num.ilg \ - && diff $srcdir/tests/pprec$sfx-$num.ind pprec$sfx-$num.ind1 || rc=8 -done - - -# test for page_precedence, heuristic detection if a letter is Roman or Alpha -sfx=A -for num in 5 6; do -$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/romalp$sfx.idx \ - -o romalp$sfx-$num.ind1 -t romalp$sfx-$num.ilg \ - && diff $srcdir/tests/romalp$sfx-$num.ind romalp$sfx-$num.ind1 || rc=9 -done -sfx=B -for num in 5 6 7; do -$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/romalp$sfx.idx \ - -o romalp$sfx-$num.ind1 -t romalp$sfx-$num.ilg \ - && diff $srcdir/tests/romalp$sfx-$num.ind romalp$sfx-$num.ind1 || rc=10 -done -sfx=C -for num in 5; do -$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/romalp$sfx.idx \ - -o romalp$sfx-$num.ind1 -t romalp$sfx-$num.ilg \ - && diff $srcdir/tests/romalp$sfx-$num.ind romalp$sfx-$num.ind1 || rc=11 -done -sfx=D -for num in 5 6 7; do -$_upmendex -s $srcdir/tests/pprec$num.ist $srcdir/tests/romalp$sfx.idx \ - -o romalp$sfx-$num.ind1 -t romalp$sfx-$num.ilg \ - && diff $srcdir/tests/romalp$sfx-$num.ind romalp$sfx-$num.ind1 || rc=12 -done - - -# test for icu_locale -$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/locale1.ist $srcdir/tests/rule.idx \ - -o locale1.ind1 -t locale1.ilg \ - && diff $srcdir/tests/locale1.ind locale1.ind1 || rc=51 - -# 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 || rc=52 - -# 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 \ - && diff $srcdir/tests/rule.ind rule1.ind1 || rc=53 - -$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/rule2.ist $srcdir/tests/rule.idx \ - -o rule2.ind1 -t rule2.ilg \ - && diff $srcdir/tests/rule.ind rule2.ind1 || rc=54 - -# malformed input -$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/rule3.ist $srcdir/tests/rule.idx \ - -o rule3.ind1 -t rule3.ilg -if [ $? -eq 254 ]; then - echo "Error check: OK" -else - echo "Error check: NG" - exit 1 -fi - -$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/rule4.ist $srcdir/tests/rule.idx \ - -o rule4.ind1 -t rule4.ilg -if [ $? -eq 254 ]; then - echo "Error check: OK" -else - echo "Error check: NG" - exit 1 -fi - -# test for icu_locale + icu_rules -$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/locale2.ist -s $srcdir/tests/rule1.ist $srcdir/tests/rule.idx \ - -o locale2-rule1.ind1 -t locale2-rule1.ilg \ - && diff $srcdir/tests/locale2-rule.ind locale2-rule1.ind1 || rc=55 - -$_upmendex -s $srcdir/tests/uni.ist -s $srcdir/tests/locale3.ist -s $srcdir/tests/rule1.ist $srcdir/tests/rule.idx \ - -o locale3-rule1.ind1 -t locale3-rule1.ilg \ - && diff $srcdir/tests/locale3-rule.ind locale3-rule1.ind1 || rc=56 +$_upmendex $srcdir/tests/tortW.idx -o tortW.ind1 -t tortW.ilg1 \ + && diff $srcdir/tests/ok-tort.ind tortW.ind1 || : exit $rc diff --git a/texk/upmendex/var.h b/texk/upmendex/var.h index c9275fcc91..a80e7444a1 100644 --- a/texk/upmendex/var.h +++ b/texk/upmendex/var.h @@ -18,9 +18,21 @@ char setpage_prefix[STYBUFSIZE]={"\n \\setcounter{page}{"},setpage_suffix[STYBU char group_skip[STYBUFSIZE]={"\n\n \\indexspace\n"}; char lethead_prefix[STYBUFSIZE]={""},lethead_suffix[STYBUFSIZE]={""}; int lethead_flag=0; -char item_0[STYBUFSIZE]={"\n \\item "},item_1[STYBUFSIZE]={"\n \\subitem "},item_2[STYBUFSIZE]={"\n \\subsubitem "}; -char item_01[STYBUFSIZE]={"\n \\subitem "},item_x1[STYBUFSIZE]={"\n \\subitem "},item_12[STYBUFSIZE]={"\n \\subsubitem "},item_x2[STYBUFSIZE]={"\n \\subsubitem "}; -char delim_0[STYBUFSIZE]={", "},delim_1[STYBUFSIZE]={", "},delim_2[STYBUFSIZE]={", "},delim_n[STYBUFSIZE]={", "},delim_r[STYBUFSIZE]={"--"},delim_t[STYBUFSIZE]={""}; +char item_0[][STYBUFSIZE] ={{"\n \\item "}, + {"\n \\subitem "}, + {"\n \\subsubitem "}, + {"\n \\subsubsubitem "}, + {"\n \\subsubsubsubitem "}}; +char item_01[][STYBUFSIZE]={{"\n \\subitem "}, + {"\n \\subsubitem "}, + {"\n \\subsubsubitem "}, + {"\n \\subsubsubsubitem "}}; +char item_x[][STYBUFSIZE] ={{"\n \\subitem "}, + {"\n \\subsubitem "}, + {"\n \\subsubsubitem "}, + {"\n \\subsubsubsubitem "}}; +char delim_0[][STYBUFSIZE]={{", "},{", "},{", "},{", "},{", "}}; +char delim_n[STYBUFSIZE]={", "},delim_r[STYBUFSIZE]={"--"},delim_t[STYBUFSIZE]={""}; char suffix_2p[STYBUFSIZE]={""},suffix_3p[STYBUFSIZE]={""},suffix_mp[STYBUFSIZE]={""}; char encap_prefix[STYBUFSIZE]={"\\"},encap_infix[STYBUFSIZE]={"{"},encap_suffix[STYBUFSIZE]={"}"}; int line_max=72;