diff options
author | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2021-09-04 01:30:39 +0000 |
---|---|---|
committer | Takuji Tanaka <ttk@t-lab.opal.ne.jp> | 2021-09-04 01:30:39 +0000 |
commit | 51ceff662ff70282ed3f3e3ab0844910ed632418 (patch) | |
tree | 47bb2ddf2efd9e257c9d67813b63fc8ffe298df6 /Build/source | |
parent | 33a5ede1594579d65102a37a8b035cc114f51a4f (diff) |
mendex: v3.6, support output order of symbols and numbers separately
git-svn-id: svn://tug.org/texlive/trunk@60417 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source')
-rw-r--r-- | Build/source/texk/mendexk/ChangeLog | 8 | ||||
-rwxr-xr-x | Build/source/texk/mendexk/configure | 22 | ||||
-rw-r--r-- | Build/source/texk/mendexk/configure.ac | 4 | ||||
-rw-r--r-- | Build/source/texk/mendexk/exvar.h | 2 | ||||
-rw-r--r-- | Build/source/texk/mendexk/fwrite.c | 97 | ||||
-rw-r--r-- | Build/source/texk/mendexk/mendex.h | 6 | ||||
-rw-r--r-- | Build/source/texk/mendexk/sort.c | 20 | ||||
-rw-r--r-- | Build/source/texk/mendexk/styfile.c | 2 | ||||
-rw-r--r-- | Build/source/texk/mendexk/var.h | 2 | ||||
-rw-r--r-- | Build/source/texk/mendexk/version.h | 2 |
10 files changed, 93 insertions, 72 deletions
diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog index 8c620696f80..aa76092bbc1 100644 --- a/Build/source/texk/mendexk/ChangeLog +++ b/Build/source/texk/mendexk/ChangeLog @@ -1,3 +1,11 @@ +2021-09-04 TANAKA Takuji <ttk@t-lab.opal.ne.jp> + + * configure.ac, version.h: + Version 3.6 [6-Jun-2021]. + * styfile.c, sort.c, fwrite.c, mendex.h, {,ex}var.h: + Support output order of symbols and numbers separately + when "symbol_flag" is 2 in style file. + 2021-08-29 TANAKA Takuji <ttk@t-lab.opal.ne.jp> * sort.c: diff --git a/Build/source/texk/mendexk/configure b/Build/source/texk/mendexk/configure index ff2a6d0db9c..bcaa84a00f1 100755 --- a/Build/source/texk/mendexk/configure +++ b/Build/source/texk/mendexk/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for mendex (TeX Live) 3.5. +# Generated by GNU Autoconf 2.71 for mendex (TeX Live) 3.6. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, @@ -626,8 +626,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='mendex (TeX Live)' PACKAGE_TARNAME='mendex--tex-live-' -PACKAGE_VERSION='3.5' -PACKAGE_STRING='mendex (TeX Live) 3.5' +PACKAGE_VERSION='3.6' +PACKAGE_STRING='mendex (TeX Live) 3.6' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1374,7 +1374,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 mendex (TeX Live) 3.5 to adapt to many kinds of systems. +\`configure' configures mendex (TeX Live) 3.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1446,7 +1446,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of mendex (TeX Live) 3.5:";; + short | recursive ) echo "Configuration of mendex (TeX Live) 3.6:";; esac cat <<\_ACEOF @@ -1567,7 +1567,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -mendex (TeX Live) configure 3.5 +mendex (TeX Live) configure 3.6 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2091,7 +2091,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 mendex (TeX Live) $as_me 3.5, which was +It was created by mendex (TeX Live) $as_me 3.6, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -8413,7 +8413,7 @@ fi # Define the identity of the package. PACKAGE='mendex--tex-live-' - VERSION='3.5' + VERSION='3.6' # Some tools Automake needs. @@ -14563,7 +14563,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -mendex (TeX Live) config.lt 3.5 +mendex (TeX Live) config.lt 3.6 configured by $0, generated by GNU Autoconf 2.71. Copyright (C) 2011 Free Software Foundation, Inc. @@ -16181,7 +16181,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 mendex (TeX Live) $as_me 3.5, which was +This file was extended by mendex (TeX Live) $as_me 3.6, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16249,7 +16249,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="\\ -mendex (TeX Live) config.status 3.5 +mendex (TeX Live) config.status 3.6 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/Build/source/texk/mendexk/configure.ac b/Build/source/texk/mendexk/configure.ac index 3cd4d8788ae..eda5e8aff99 100644 --- a/Build/source/texk/mendexk/configure.ac +++ b/Build/source/texk/mendexk/configure.ac @@ -8,8 +8,8 @@ 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([mendex (TeX Live)], [3.5]) -AC_PREREQ([2.63]) +AC_INIT([mendex (TeX Live)], [3.6]) +AC_PREREQ([2.71]) AC_CONFIG_SRCDIR([main.c]) AC_CONFIG_AUX_DIR([../../build-aux]) AC_CONFIG_MACRO_DIR([../../m4]) diff --git a/Build/source/texk/mendexk/exvar.h b/Build/source/texk/mendexk/exvar.h index 78720e4dd6b..8d5925443ce 100644 --- a/Build/source/texk/mendexk/exvar.h +++ b/Build/source/texk/mendexk/exvar.h @@ -26,7 +26,7 @@ extern int line_max; extern char indent_space[]; extern int indent_length; extern int priority; -extern char symbol[]; +extern char symhead[],numhead[]; extern char symhead_positive[],symhead_negative[]; extern char numhead_positive[],numhead_negative[]; extern int symbol_flag; diff --git a/Build/source/texk/mendexk/fwrite.c b/Build/source/texk/mendexk/fwrite.c index 523a7c81ee4..4ae17228e2a 100644 --- a/Build/source/texk/mendexk/fwrite.c +++ b/Build/source/texk/mendexk/fwrite.c @@ -123,6 +123,7 @@ void indwrite(char *filename, struct index *ind, int pagenum) char datama[2048],lbuff[BUFFERLEN]; FILE *fp=NULL; int conv_euc_to_euc; + char *init, *init_prev; if (filename && kpse_out_name_ok(filename)) fp=fopen(filename,"wb"); @@ -143,36 +144,40 @@ void indwrite(char *filename, struct index *ind, int pagenum) fprintf(fp,"%s%d%s",setpage_prefix,pagenum,setpage_suffix); } + if (strlen(symhead)==0) { + if (lethead_flag>0) { + strcpy(symhead, symhead_positive); + } + else if (lethead_flag<0) { + strcpy(symhead, symhead_negative); + } + } + { + if (lethead_flag>0) { + strcpy(numhead, numhead_positive); + } + else if (lethead_flag<0) { + strcpy(numhead, numhead_negative); + } + } + for (i=line_length=0;i<lines;i++) { + init = ind[i].dic[0]; if (i==0) { - if (!((alphabet(ind[i].dic[0][0]))||(japanese(ind[i].dic[0])))) { - if (lethead_flag!=0 && symbol_flag) { - if (strlen(symbol)) { - fprintf(fp,"%s%s%s",lethead_prefix,symbol,lethead_suffix); - } - else if (lethead_flag>0) { - fprintf(fp,"%s%s%s",lethead_prefix,symhead_positive,lethead_suffix); - } - else if (lethead_flag<0) { - fprintf(fp,"%s%s%s",lethead_prefix,symhead_negative,lethead_suffix); - } - } - SPRINTF(lbuff,"%s%s",item_0,ind[i].idx[0]); - } - else if (alphabet(ind[i].dic[0][0])) { + if (alphabet(init)) { if (lethead_flag>0) { - fprintf(fp,"%s%c%s",lethead_prefix,ind[i].dic[0][0],lethead_suffix); + fprintf(fp,"%s%c%s",lethead_prefix,init[0],lethead_suffix); } else if (lethead_flag<0) { - fprintf(fp,"%s%c%s",lethead_prefix,ind[i].dic[0][0]+32,lethead_suffix); + fprintf(fp,"%s%c%s",lethead_prefix,init[0]+32,lethead_suffix); } SPRINTF(lbuff,"%s%s",item_0,ind[i].idx[0]); } - else if (japanese(ind[i].dic[0])) { + else if (japanese(init)) { if (lethead_flag) { fputs(lethead_prefix,fp); for (j=hpoint;j<(strlen(datama)/2);j++) { - if ((unsigned char)ind[i].dic[0][1]<(unsigned char)datama[j*2+1]) { + if ((unsigned char)init[1]<(unsigned char)datama[j*2+1]) { fprint_euc_char(fp,atama[(j-1)*2],atama[(j-1)*2+1]); hpoint=j; break; @@ -185,11 +190,20 @@ void indwrite(char *filename, struct index *ind, int pagenum) } SPRINTF(lbuff,"%s%s",item_0,ind[i].idx[0]); for (hpoint=0;hpoint<(strlen(datama)/2);hpoint++) { - if ((unsigned char)ind[i].dic[0][1]<(unsigned char)datama[hpoint*2+1]) { + if ((unsigned char)init[1]<(unsigned char)datama[hpoint*2+1]) { break; } } } + else { + if (lethead_flag!=0 && symbol_flag==2 && numeric(init)) { + fprintf(fp,"%s%s%s",lethead_prefix,numhead,lethead_suffix); + } + if (lethead_flag!=0 && (symbol_flag==1 || (symbol_flag==2 && !numeric(init)))) { + fprintf(fp,"%s%s%s",lethead_prefix,symhead,lethead_suffix); + } + SPRINTF(lbuff,"%s%s",item_0,ind[i].idx[0]); + } switch (ind[i].words) { case 1: SAPPENDF(lbuff,"%s",delim_0); @@ -215,36 +229,21 @@ void indwrite(char *filename, struct index *ind, int pagenum) printpage(ind,fp,i,lbuff); } else { - if (!((alphabet(ind[i].dic[0][0]))||(japanese(ind[i].dic[0])))) { - if ((alphabet(ind[i-1].dic[0][0]))||(japanese(ind[i-1].dic[0]))){ - fputs(group_skip,fp); - if (lethead_flag!=0 && symbol_flag) { - if (strlen(symbol)) { - fprintf(fp,"%s%s%s",lethead_prefix,symbol,lethead_suffix); - } - else if (lethead_flag>0) { - fprintf(fp,"%s%s%s",lethead_prefix,symhead_positive,lethead_suffix); - } - else if (lethead_flag<0) { - fprintf(fp,"%s%s%s",lethead_prefix,symhead_negative,lethead_suffix); - } - } - } - } - else if (alphabet(ind[i].dic[0][0])) { - if (ind[i].dic[0][0]!=ind[i-1].dic[0][0]) { + init_prev = ind[i-1].dic[0]; + if (alphabet(init)) { + if (init[0]!=init_prev[0]) { fputs(group_skip,fp); if (lethead_flag>0) { - fprintf(fp,"%s%c%s",lethead_prefix,ind[i].dic[0][0],lethead_suffix); + fprintf(fp,"%s%c%s",lethead_prefix,init[0],lethead_suffix); } else if (lethead_flag<0) { - fprintf(fp,"%s%c%s",lethead_prefix,ind[i].dic[0][0]+32,lethead_suffix); + fprintf(fp,"%s%c%s",lethead_prefix,init[0]+32,lethead_suffix); } } } - else if (japanese(ind[i].dic[0])) { + else if (japanese(init)) { for (j=hpoint;j<(strlen(datama)/2);j++) { - if ((unsigned char)(ind[i].dic[0][0]<=(unsigned char)datama[j*2])&&((unsigned char)ind[i].dic[0][1]<(unsigned char)datama[j*2+1])) { + if (((unsigned char)init[0]<=(unsigned char)datama[j*2])&&((unsigned char)init[1]<(unsigned char)datama[j*2+1])) { break; } } @@ -258,6 +257,20 @@ void indwrite(char *filename, struct index *ind, int pagenum) } } } + else { + if ( alphabet(init_prev) || japanese(init_prev) || + (!numeric(init_prev)&&numeric(init)) || (numeric(init_prev)&&!numeric(init)) ) { + if (alphabet(init_prev) || japanese(init_prev) || symbol_flag==2) + fputs(group_skip,fp); + if (lethead_flag!=0 && symbol_flag==2 && numeric(init)) { + fprintf(fp,"%s%s%s",lethead_prefix,numhead,lethead_suffix); + } + if (lethead_flag!=0 && (symbol_flag==1 && (alphabet(init_prev)||japanese(init_prev)) || + symbol_flag==2 && !numeric(init)) ) { + fprintf(fp,"%s%s%s",lethead_prefix,symhead,lethead_suffix); + } + } + } switch (ind[i].words) { case 1: diff --git a/Build/source/texk/mendexk/mendex.h b/Build/source/texk/mendexk/mendex.h index ee4541ea0f5..1c0190c2822 100644 --- a/Build/source/texk/mendexk/mendex.h +++ b/Build/source/texk/mendexk/mendex.h @@ -39,9 +39,9 @@ int lastpage(const char *filename); /* sort.c */ void wsort(struct index *ind, int num); void pagesort(struct index *ind, int num); -int alphanumeric(char c); -int alphabet(char c); -int numeric(char c); +int alphanumeric(char *c); +int alphabet(char *c); +int numeric(char *c); int japanese(char *buff); int chkcontinue(struct page *p, int num); diff --git a/Build/source/texk/mendexk/sort.c b/Build/source/texk/mendexk/sort.c index bdf30c4180d..6ab458ee02c 100644 --- a/Build/source/texk/mendexk/sort.c +++ b/Build/source/texk/mendexk/sort.c @@ -112,10 +112,10 @@ static int wcomp(const void *p, const void *q) return 1; /* symbol pattern */ - if ((!numeric((*index1).dic[j][i]))&&(numeric((*index2).dic[j][i]))) + if ((!numeric(&(*index1).dic[j][i]))&&(numeric(&(*index2).dic[j][i]))) return -1; - if ((!numeric((*index2).dic[j][i]))&&(numeric((*index1).dic[j][i]))) + if ((!numeric(&(*index2).dic[j][i]))&&(numeric(&(*index1).dic[j][i]))) return 1; /* simple compare */ @@ -211,8 +211,8 @@ static int pcomp(const void *p, const void *q) static int ordering(char *buff) { if ((unsigned char)(*buff)<0x80) { - if (alphabet(*buff)) return alpha; - else if (numeric(*buff)) return number; + if (alphabet(buff)) return alpha; + else if (numeric(buff)) return number; else return sym; } else { @@ -221,22 +221,22 @@ static int ordering(char *buff) } } -int alphanumeric(char c) +int alphanumeric(char *c) { - if (((c>='A')&&(c<='Z'))||((c>='a')&&(c<='z'))||((c>='0')&&(c<='9'))) + if (((*c>='A')&&(*c<='Z'))||((*c>='a')&&(*c<='z'))||((*c>='0')&&(*c<='9'))) return 1; else return 0; } -int alphabet(char c) +int alphabet(char *c) { - if (((c>='A')&&(c<='Z'))||((c>='a')&&(c<='z'))) return 1; + if (((*c>='A')&&(*c<='Z'))||((*c>='a')&&(*c<='z'))) return 1; else return 0; } -int numeric(char c) +int numeric(char *c) { - if ((c>='0')&&(c<='9')) return 1; + if ((*c>='0')&&(*c<='9')) return 1; else return 0; } diff --git a/Build/source/texk/mendexk/styfile.c b/Build/source/texk/mendexk/styfile.c index 054b24b4283..f81e2b785c9 100644 --- a/Build/source/texk/mendexk/styfile.c +++ b/Build/source/texk/mendexk/styfile.c @@ -116,7 +116,7 @@ void styread(const char *filename) indent_length=atoi(&buff[cc]); continue; } - if (getparam(buff,"symbol",symbol)) continue; + if (getparam(buff,"symbol",symhead)) continue; cc=scompare(buff,"symbol_flag"); if (cc!= -1) { symbol_flag=atoi(&buff[cc]); diff --git a/Build/source/texk/mendexk/var.h b/Build/source/texk/mendexk/var.h index 1d6a475edee..b538988c9e2 100644 --- a/Build/source/texk/mendexk/var.h +++ b/Build/source/texk/mendexk/var.h @@ -27,7 +27,7 @@ int line_max=72; char indent_space[STYBUFSIZE]={"\t\t"}; int indent_length=16; int priority=0; -char symbol[STYBUFSIZE]={""}; +char symhead[STYBUFSIZE]={""},numhead[STYBUFSIZE]={""}; char symhead_positive[STYBUFSIZE]={"Symbols"},symhead_negative[STYBUFSIZE]={"symbols"}; char numhead_positive[STYBUFSIZE]={"Numbers"},numhead_negative[STYBUFSIZE]={"numbers"}; int symbol_flag=1; diff --git a/Build/source/texk/mendexk/version.h b/Build/source/texk/mendexk/version.h index ec3235a6629..b3fe113f399 100644 --- a/Build/source/texk/mendexk/version.h +++ b/Build/source/texk/mendexk/version.h @@ -1,2 +1,2 @@ -#define VERSION "version " PACKAGE_VERSION " [29-Aug-2021]" +#define VERSION "version " PACKAGE_VERSION " [4-Sep-2021]" #define BUG_ADDRESS "issue@texjp.org" |