diff options
-rw-r--r-- | Build/source/texk/mendexk/ChangeLog | 9 | ||||
-rw-r--r-- | Build/source/texk/mendexk/Makefile.am | 1 | ||||
-rw-r--r-- | Build/source/texk/mendexk/Makefile.in | 27 | ||||
-rw-r--r-- | Build/source/texk/mendexk/main.c | 7 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/euc.ist | 10 | ||||
-rwxr-xr-x | Build/source/texk/mendexk/tests/mendex.test | 12 | ||||
-rw-r--r-- | Build/source/texk/mendexk/tests/sjis.ist | 10 | ||||
-rw-r--r-- | Build/source/texk/mendexk/version.h | 2 |
8 files changed, 60 insertions, 18 deletions
diff --git a/Build/source/texk/mendexk/ChangeLog b/Build/source/texk/mendexk/ChangeLog index e6baf5d0a4f..0bb8da67899 100644 --- a/Build/source/texk/mendexk/ChangeLog +++ b/Build/source/texk/mendexk/ChangeLog @@ -1,3 +1,12 @@ +2022-06-12 TANAKA Takuji <ttk@t-lab.opal.ne.jp> + + * main.c: + Support guessing input file encodings. + https://github.com/texjporg/tex-jp-build/issues/142 + * tests/mendex.test, tests/{sjis,euc}.ist, Makefile.am: + Update tests. + * version.h: Date [12-Jun-2022] + 2022-05-22 TANAKA Takuji <ttk@t-lab.opal.ne.jp> * fread.c: diff --git a/Build/source/texk/mendexk/Makefile.am b/Build/source/texk/mendexk/Makefile.am index 98af536b713..2fd2b1b750d 100644 --- a/Build/source/texk/mendexk/Makefile.am +++ b/Build/source/texk/mendexk/Makefile.am @@ -59,6 +59,7 @@ EXTRA_DIST += $(TESTS) 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/sjis.ist tests/euc.ist \ tests/range.idx tests/range2.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 \ diff --git a/Build/source/texk/mendexk/Makefile.in b/Build/source/texk/mendexk/Makefile.in index d9c7c2a73ee..2cbcdab4525 100644 --- a/Build/source/texk/mendexk/Makefile.in +++ b/Build/source/texk/mendexk/Makefile.in @@ -582,19 +582,20 @@ dist_man1_MANS = mendex.1 EXTRA_DIST = COPYRIGHT COPYRIGHT.ja ChangeLog.ja indexsty \ mendex.ja.txt mendex.1 mendex.1.ja $(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/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 tests/pprecA.idx \ - tests/pprecA-0.ind tests/pprecA-1.ind tests/pprecA-2.ind \ - tests/pprecB.idx tests/pprecB-0.ind tests/pprecB-3.ind \ - tests/pprecB-4.ind tests/romalpA.idx tests/romalpA-5.ind \ - 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/uni1.ist tests/uni2.ist tests/uni.ind tests/sjis.ist \ + tests/euc.ist tests/range.idx tests/range2.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 tests/pprecA.idx tests/pprecA-0.ind \ + tests/pprecA-1.ind tests/pprecA-2.ind tests/pprecB.idx \ + tests/pprecB-0.ind tests/pprecB-3.ind tests/pprecB-4.ind \ + tests/romalpA.idx tests/romalpA-5.ind 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 = tests/mendex.test DISTCLEANFILES = foo.* uni.* range*.* pprec*.* romalp*.* all: c-auto.h diff --git a/Build/source/texk/mendexk/main.c b/Build/source/texk/mendexk/main.c index 5d562726437..299006c1394 100644 --- a/Build/source/texk/mendexk/main.c +++ b/Build/source/texk/mendexk/main.c @@ -40,14 +40,12 @@ int main(int argc, char **argv) fprintf (stderr, "Ignoring bad kanji encoding \"%s\".\n", p); } -#ifdef WIN32 p = kpse_var_value ("guess_input_kanji_encoding"); if (p) { if (*p == '1' || *p == 'y' || *p == 't') infile_enc_auto = 1; free(p); } -#endif kp_ist.var_name = "INDEXSTYLE"; kp_ist.path = DEFAULT_INDEXSTYLES; /* default path. */ @@ -189,13 +187,15 @@ int main(int argc, char **argv) case '-': if (strlen(argv[i])==2) chkopt=0; + if (strcmp(argv[i],"--guess-input-enc" )==0) infile_enc_auto=1; + if (strcmp(argv[i],"--no-guess-input-enc")==0) infile_enc_auto=0; if (strcmp(argv[i],"--help")!=0) break; default: fprintf(stderr,"mendex - Japanese index processor, %s (%s) (%s).\n",VERSION, get_enc_string(), TL_VERSION); fprintf(stderr," Copyright 2009 ASCII MEDIA WORKS, 2017-2022 Japanese TeX Development Community\n"); fprintf(stderr,"usage:\n"); - fprintf(stderr,"%% mendex [-ilqrcgfEJSU] [-s sty] [-d dic] [-o ind] [-t log] [-p no] [-I enc] [--] [idx0 idx1 ...]\n"); + fprintf(stderr,"%% mendex [-ilqrcgfEJSU] [-s sty] [-d dic] [-o ind] [-t log] [-p no] [-I enc] [--[no-]guess-input-enc] [--] [idx0 idx1 ...]\n"); fprintf(stderr,"options:\n"); fprintf(stderr,"-i use stdin as the input file.\n"); fprintf(stderr,"-l use letter ordering.\n"); @@ -215,6 +215,7 @@ int main(int argc, char **argv) fprintf(stderr,"-S ShiftJIS mode.\n"); fprintf(stderr,"-U UTF-8 mode.\n"); fprintf(stderr,"-I enc internal encoding for keywords (enc: euc or utf8).\n"); + fprintf(stderr,"--[no-]guess-input-enc disable/enable to guess input file encoding.\n"); fprintf(stderr,"idx... input files.\n"); fprintf(stderr,"\nEmail bug reports to %s.\n", BUG_ADDRESS); exit(0); diff --git a/Build/source/texk/mendexk/tests/euc.ist b/Build/source/texk/mendexk/tests/euc.ist new file mode 100644 index 00000000000..77a0acbe457 --- /dev/null +++ b/Build/source/texk/mendexk/tests/euc.ist @@ -0,0 +1,10 @@ +% -*- coding: euc-jp -*- + +delim_0 "\\leaders\\hbox{$\\cdot$}\\hfill " +delim_1 "\\leaders\\hbox{$\\cdot$}\\hfill " +delim_2 "\\leaders\\hbox{$\\cdot$}\\hfill " + +lethead_flag 1 +lethead_prefix "\n\\centerline{\\bfseries " +lethead_suffix " }\\par\\nobreak" + diff --git a/Build/source/texk/mendexk/tests/mendex.test b/Build/source/texk/mendexk/tests/mendex.test index 2aa11afd633..81ae944748c 100755 --- a/Build/source/texk/mendexk/tests/mendex.test +++ b/Build/source/texk/mendexk/tests/mendex.test @@ -7,7 +7,7 @@ TEXMFCNF=$srcdir/../kpathsea export TEXMFCNF -rm -f foo.* uni.* range*.* pprec*.* romalp*.* +rm -f foo.* uni.* range*.* pprec*.* romalp*.* sjis.* euc.* rc=0 ./mendex $srcdir/tests/foo.idx -o foo.ind1 -t foo.ilg1 \ @@ -29,6 +29,16 @@ cat $srcdir/tests/uni.idx | \ $srcdir/tests/uni.idx -o uni.ind3 -t uni.ilg3 \ && diff $srcdir/tests/uni.ind uni.ind3 || rc=5 +cat $srcdir/tests/uni.idx | \ + guess_input_kanji_encoding=1 ./mendex -U -d $srcdir/tests/uni.dict -s $srcdir/tests/sjis.ist \ + >sjis.ind1 2>sjis.ilg1 \ + && diff $srcdir/tests/uni.ind sjis.ind1 || rc=20 + +cat $srcdir/tests/uni.idx | \ + ./mendex -U -d $srcdir/tests/uni.dict -s $srcdir/tests/euc.ist --guess-input-enc \ + >euc.ind1 2>euc.ilg1 \ + && diff $srcdir/tests/uni.ind euc.ind1 || rc=21 + # test for range suffix_2p, suffix_3p, suffix_mp for num in 1 2 3; do diff --git a/Build/source/texk/mendexk/tests/sjis.ist b/Build/source/texk/mendexk/tests/sjis.ist new file mode 100644 index 00000000000..ec70fecf975 --- /dev/null +++ b/Build/source/texk/mendexk/tests/sjis.ist @@ -0,0 +1,10 @@ +% -*- coding: shift_jis -*- + +delim_0 "\\leaders\\hbox{$\\cdot$}\\hfill " +delim_1 "\\leaders\\hbox{$\\cdot$}\\hfill " +delim_2 "\\leaders\\hbox{$\\cdot$}\\hfill " + +lethead_flag 1 +lethead_prefix "\n\\centerline{\\bfseries " +lethead_suffix " }\\par\\nobreak" + diff --git a/Build/source/texk/mendexk/version.h b/Build/source/texk/mendexk/version.h index b54fe49039c..78d9ac89e01 100644 --- a/Build/source/texk/mendexk/version.h +++ b/Build/source/texk/mendexk/version.h @@ -1,2 +1,2 @@ -#define VERSION "version " PACKAGE_VERSION " [22-May-2022]" +#define VERSION "version " PACKAGE_VERSION " [12-Jun-2022]" #define BUG_ADDRESS "issue@texjp.org" |