diff options
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/dviout-util/ChangeLog | 11 | ||||
-rw-r--r-- | Build/source/texk/dviout-util/chkdvifont.c | 4 | ||||
-rw-r--r-- | Build/source/texk/dviout-util/chkdvifont.man | 11 | ||||
-rwxr-xr-x | Build/source/texk/dviout-util/configure | 22 | ||||
-rw-r--r-- | Build/source/texk/dviout-util/configure.ac | 2 | ||||
-rw-r--r-- | Build/source/texk/dviout-util/dvispc.c | 98 | ||||
-rw-r--r-- | Build/source/texk/dviout-util/dvispc.man | 90 | ||||
-rwxr-xr-x | Build/source/texk/dviout-util/dvispc.test | 7 |
8 files changed, 166 insertions, 79 deletions
diff --git a/Build/source/texk/dviout-util/ChangeLog b/Build/source/texk/dviout-util/ChangeLog index b9acd25e376..e53d6bd67ed 100644 --- a/Build/source/texk/dviout-util/ChangeLog +++ b/Build/source/texk/dviout-util/ChangeLog @@ -1,3 +1,14 @@ +2018-10-10 Hironobu Yamashita <h.y.acetaminophen@gmail.com> + + * dvispc.c: Clean up code, more comments. Mostly revert + the change on 2018-10-06, "Change option handling for + future extensions" and change EXE2INDEP -> EXE2MODIFY. + Make sure outfile string is non-empty. + * chkdvifont.c: Do not stop for usage, always show all. + * dvispc.test: Test pipe input/output. + * chkdvifont.man, dvispc.man: More info. + * configure.ac: Version 20181010. + 2018-10-07 Hironobu Yamashita <h.y.acetaminophen@gmail.com> * chkdvifont.c: Checksum should be read as unsigned. diff --git a/Build/source/texk/dviout-util/chkdvifont.c b/Build/source/texk/dviout-util/chkdvifont.c index d2906bd66f2..4732f52e960 100644 --- a/Build/source/texk/dviout-util/chkdvifont.c +++ b/Build/source/texk/dviout-util/chkdvifont.c @@ -1254,6 +1254,7 @@ void usage() "\t -p: force FONT mode\n" "\t (supported formats: vf/ovf/gf/pk/pkd/pxl/gth/far)\n" "\t By default, mode is guessed from the file extension.\n\n" +#if 0 "Input M to see more. Push Return to quit"); switch (getc(stdin)) { case ('M'): @@ -1266,7 +1267,8 @@ void usage() show: fprintf(stderr, - "\n\nErrorlevel is the sum of the following number\n" +#endif + "Errorlevel is the sum of the following number\n" "\t 1: cmbsy5-9, cmcsc8-9, cmex7-9, cmmib5-9\n" "\t 2: new font: eu??, msam, msbm, wncy??, font_data_file\n" "\t 4: new eufm5-10\n" diff --git a/Build/source/texk/dviout-util/chkdvifont.man b/Build/source/texk/dviout-util/chkdvifont.man index 323b125bec5..9f7713a84c6 100644 --- a/Build/source/texk/dviout-util/chkdvifont.man +++ b/Build/source/texk/dviout-util/chkdvifont.man @@ -81,6 +81,17 @@ By default, the mode is guessed from the file extension. font at = 0.962216 font name = rml +.PP +Listing the fonts used in a DVI file (as shown in the first example) +is almost equivalent to +.B dvifontlist +in TeX-Guy package +<http://www-masu.ist.osaka-u.ac.jp/%7Ekakugawa/TeX-Guy/> +and a script +.B dviinfox +<https://ctan.org/pkg/dviinfox>. +I don't know any alternatives for obtaining information about TFM, OFM, +VF and other font formats. .SH SEE ALSO pltotf(1), tftopl(1), vptovf(1), vftovp(1) .SH AUTHOR diff --git a/Build/source/texk/dviout-util/configure b/Build/source/texk/dviout-util/configure index aae942ab935..0672e7c36ea 100755 --- a/Build/source/texk/dviout-util/configure +++ b/Build/source/texk/dviout-util/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for dviout-util (TeX Live) 20181006. +# Generated by GNU Autoconf 2.69 for dviout-util (TeX Live) 20181010. # # Report bugs to <tex-k@tug.org>. # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dviout-util (TeX Live)' PACKAGE_TARNAME='dviout-util--tex-live-' -PACKAGE_VERSION='20181006' -PACKAGE_STRING='dviout-util (TeX Live) 20181006' +PACKAGE_VERSION='20181010' +PACKAGE_STRING='dviout-util (TeX Live) 20181010' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1332,7 +1332,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 dviout-util (TeX Live) 20181006 to adapt to many kinds of systems. +\`configure' configures dviout-util (TeX Live) 20181010 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1403,7 +1403,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dviout-util (TeX Live) 20181006:";; + short | recursive ) echo "Configuration of dviout-util (TeX Live) 20181010:";; esac cat <<\_ACEOF @@ -1524,7 +1524,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dviout-util (TeX Live) configure 20181006 +dviout-util (TeX Live) configure 20181010 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2180,7 +2180,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 dviout-util (TeX Live) $as_me 20181006, which was +It was created by dviout-util (TeX Live) $as_me 20181010, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -7865,7 +7865,7 @@ fi # Define the identity of the package. PACKAGE='dviout-util--tex-live-' - VERSION='20181006' + VERSION='20181010' cat >>confdefs.h <<_ACEOF @@ -13891,7 +13891,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -dviout-util (TeX Live) config.lt 20181006 +dviout-util (TeX Live) config.lt 20181010 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -15496,7 +15496,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 dviout-util (TeX Live) $as_me 20181006, which was +This file was extended by dviout-util (TeX Live) $as_me 20181010, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15562,7 +15562,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -dviout-util (TeX Live) config.status 20181006 +dviout-util (TeX Live) config.status 20181010 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/texk/dviout-util/configure.ac b/Build/source/texk/dviout-util/configure.ac index 2981dbe145a..506dcfdb99e 100644 --- a/Build/source/texk/dviout-util/configure.ac +++ b/Build/source/texk/dviout-util/configure.ac @@ -6,7 +6,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([dviout-util (TeX Live)], [20181006], [tex-k@tug.org]) +AC_INIT([dviout-util (TeX Live)], [20181010], [tex-k@tug.org]) AC_PREREQ([2.65]) AC_CONFIG_SRCDIR([dvispc.c]) AC_CONFIG_AUX_DIR([../../build-aux]) diff --git a/Build/source/texk/dviout-util/dvispc.c b/Build/source/texk/dviout-util/dvispc.c index b214730a8c7..a747df6feee 100644 --- a/Build/source/texk/dviout-util/dvispc.c +++ b/Build/source/texk/dviout-util/dvispc.c @@ -220,20 +220,16 @@ struct DIMENSION_REC { #define DTL_FORM 0x8000 /* the first line: variety */ int f_dtl = 0; -#define EXE2INDEP 0x1 -#define EXE2FLAT 0x2 -#define EXE2ACTUAL 0x3F /* above are inclusive, below are exclusive */ -#define EXE2CHECK 0x40 -#define EXE2SPECIAL 0x80 -#define EXE2TEXT 0x100 -#define EXE2DVI 0x200 - -int f_mode = 0; /* 1: -c page_indep - 2: -f flatten_nest - 64: -d report only - 128: -s show specials - 256: -a to_Text - 512: -x to_DVI */ +enum { + EXE2NONE, EXE2MODIFY, EXE2CHECK, EXE2SPECIAL, EXE2TEXT, EXE2DVI +}; + +int f_mode = EXE2NONE; /* 1: -c modify + 2: -d report only + 3: -s specials + 4: -a to_Text + 5: -x to_DVI */ +/* default mode will be set in main() to be page_indep */ int f_debug = 0; /* -v */ int f_overwrite = 0; @@ -486,15 +482,9 @@ int main(int argc, char **argv) for(len = 1; argv[i][len]; len++){ switch(argv[i][len]){ case 'c': - f_mode &= EXE2ACTUAL; - f_mode |= EXE2INDEP; - break; -#if 0 - case 'f': - f_mode &= EXE2ACTUAL; - f_mode |= EXE2FLAT; + f_mode = EXE2MODIFY; break; -#endif + case 's': f_mode = EXE2SPECIAL; break; @@ -620,7 +610,7 @@ skip: ; cf. argc = (number of all arguments) + 1 {argv[0] is the program name itself} ^^^ */ - if(!f_mode) f_mode = EXE2INDEP; /* default mode */ + if(!f_mode) f_mode = EXE2MODIFY; /* default mode */ fnum = 0; if(!isatty(fileno(stdin))){ /* if stdin is redirected from a file */ @@ -645,7 +635,7 @@ skip: ; if(fp_out == NULL){ /* outfile not given, free stdout; binary cannot be written, text is fine */ - if((f_mode & EXE2INDEP) || f_mode == EXE2DVI) + if(f_mode == EXE2MODIFY || f_mode == EXE2DVI) usage(1); fp_out = stdout; } @@ -664,17 +654,18 @@ skip: ; /* outfile not given; nonetheless binary should be written to a file, text is fine with free stdout */ - if((f_mode & EXE2INDEP)) + if(f_mode == EXE2MODIFY) strcpy(outfile, argv[argc-1]); else fp_out = stdout; }else + /* [TODO] this may not work well? (especially for EXE2DVI) */ /* if fp_out == NULL, non-empty stdin and free stdout -> the only argument = outfile (input from stdin) otherwise, redirected stdout -> the only argument = infile if fnum == 2, non-empty stdin will be discarded but don't care! - (output to overwrite for EXE2INDEP, stdout for others) */ + (output to overwrite for EXE2MODIFY, stdout for others) */ strcpy((fp_out == NULL)?outfile:infile, argv[argc-1]); break; @@ -690,7 +681,7 @@ skip: ; usage(1); } #ifndef UNIX - if(fp_out && !*outfile && (f_mode == EXE2DVI || (f_mode & EXE2INDEP))) + if(fp_out && !*outfile && (f_mode == EXE2DVI || f_mode == EXE2MODIFY)) setmode( fileno( stdout ), O_BINARY); #endif if(fp_in && !*infile && f_mode != EXE2DVI){ @@ -707,7 +698,7 @@ skip: ; if(fp_in == NULL || *infile){ fp_in = fopen(infile, READ_TEXT); if(fp_in == NULL){ - fprintf(stderr, "Cannot open %s\n", infile); + fprintf(stderr, "Cannot open %s for input\n", infile); exit(1); } } @@ -718,7 +709,7 @@ skip: ; strcat(outfile, ".dvi"); fp_out = fopen(outfile, WRITE_BINARY); if(fp_out == NULL){ - fprintf(stderr, "Cannot open %s\n", outfile); + fprintf(stderr, "Cannot open %s for output\n", outfile); exit(1); } } @@ -737,7 +728,7 @@ skip: ; /* [TODO] comments not added yet */ if(argc - i == 1){ - if((f_mode & EXE2INDEP) && !fnum){ + if(f_mode == EXE2MODIFY && !fnum){ #ifdef UNIX static char tmpfile[] = "/tmp/dvispcXXXXXX"; int fd; @@ -776,19 +767,19 @@ same: strcpy(outfile, infile); dvi_info.file_ptr = fp_in; dvi_info.file_name = "stdin"; }else if ((dvi_info.file_ptr = fopen(dvi_info.file_name, READ_BINARY)) == NULL){ - fprintf(stderr, "Cannot open %s\n", infile); + fprintf(stderr, "Cannot open %s for input\n", infile); exit(1); } /* [TODO] I'd like to use outfile if given */ if(fp_out == NULL || *outfile){ if(!*outfile) fp_out = (f_mode == EXE2TEXT || f_mode == EXE2SPECIAL)?stdout:stderr; - else if((f_mode & EXE2INDEP)) + else if(f_mode == EXE2MODIFY) fp_out = stderr; else{ fp_out = fopen(outfile, WRITE_TEXT); if(fp_out == NULL){ - fprintf(stderr, "Cannot open %s\n", outfile); + fprintf(stderr, "Cannot open %s for output\n", outfile); exit(1); } } @@ -818,10 +809,10 @@ void translate(DVIFILE_INFO *dvi, DIMENSION *dim) int page, page2, pos, count, size, former, current, flag; FILE *fp; - if((f_mode & EXE2INDEP)){ + if(f_mode == EXE2MODIFY){ fp = (*outfile)?fopen(outfile, WRITE_BINARY):fp_out; if(fp == NULL){ - fprintf(stderr, "Cannot open %s\n", outfile); + fprintf(stderr, "Cannot open %s for output\n", outfile); exit(4); }else if(fp==stdout) f_debug = 0; /* ignore -v option, as debug output goes there, sigh */ @@ -879,24 +870,24 @@ lastpage: if(isdigit(*++out_pages)){ fclose(fp_out); dvi->file_ptr = fp_out = NULL; return; - } /* if(f_mode == EXE2TEXT || f_mode == EXE2SPECIAL) */ + } /* done for if(f_mode == EXE2TEXT || f_mode == EXE2SPECIAL), + the rest of translate() is meant for + if((f_mode == EXE2MODIFY) and (f_mode == EXE2CHECK)) */ /* Prior scanning. This ensures page independence in reverse order too, by checking whether non-stack specials appears somewhere in DVI. Specials with paired syntax (push/pop, bcolor/ecolor) are already safe without pre-scanning, so these are skipped due to f_prescan = 1. Other specials (background, pdf_bgcolor, pn) are handled in this scanning. */ - if((f_mode & EXE2INDEP) || f_mode == EXE2CHECK){ - f_prescan = 1; /* change behavior of interpret(dvi) */ - for(page = 1; page <= dim->total_page; page++){ - fseek(dvi->file_ptr, dim->page_index[page], SEEK_SET); - interpret(dvi->file_ptr); - } - f_prescan = 0; /* restore interpret(dvi) */ + f_prescan = 1; /* change behavior of interpret(dvi) */ + for(page = 1; page <= dim->total_page; page++){ + fseek(dvi->file_ptr, dim->page_index[page], SEEK_SET); + interpret(dvi->file_ptr); } + f_prescan = 0; /* restore interpret(dvi) */ former = current = -1; - if(fp){ /* ((f_mode & EXE2INDEP)) and can be opened */ + if(fp){ /* f_mode == EXE2MODIFY and can be opened */ fseek(dvi->file_ptr, 0, SEEK_SET); for(size = dim->page_index[1]; size > 0; size--) write_byte(read_byte(dvi->file_ptr), fp); /* Write preamble */ @@ -907,7 +898,7 @@ lastpage: if(isdigit(*++out_pages)){ write_long(former, fp); /* ptr to the former page = -1 */ } - for(page = 1; page <= dim->total_page; page++){ + for(page = 1; page <= dim->total_page; page++){ /* page loop start */ fseek(dvi->file_ptr, dim->page_index[page], SEEK_SET); f_background = 0; f_pdf_bgcolor = 0; @@ -944,7 +935,7 @@ lastpage: if(isdigit(*++out_pages)){ } if(f_mode == EXE2CHECK) continue; /* skip loop if (f_mode == EXE2CHECK); - * remainings are for (f_mode & EXE2INDEP) */ + * remainings in this loop are for (f_mode == EXE2MODIFY) */ /* [Process 2] at the beginning of each page, recover from stack underflow, and put non-stack specials if necessary */ @@ -995,8 +986,8 @@ lastpage: if(isdigit(*++out_pages)){ former = current; current = ftell(fp); /* get position of BOP/POST */ - /* [Process 5] start the next page, - with passing not-yet-closed stacks */ + /* [Process 5] except for the last page, + start the next page with passing not-yet-closed stacks */ if(page < dim->total_page){ fseek(dvi->file_ptr, dim->page_index[page+1], SEEK_SET); for(size = 41; size > 0; size--) /* write BOP and c[] */ @@ -1018,7 +1009,8 @@ lastpage: if(isdigit(*++out_pages)){ if(tpic_pn[0]) f_needs_corr++; } - } + } /* page loop end */ + if(f_debug) { if(color_depth_max) fprintf(fp_out, "\nMaximal depth of color stack:%d", color_depth_max); @@ -1027,7 +1019,7 @@ lastpage: if(isdigit(*++out_pages)){ if(pdf_annot_depth_max) fprintf(fp_out, "\nMaximal depth of pdf:bann ... pdf:eann stack:%d", pdf_annot_depth_max); } - if(!(f_mode & EXE2INDEP)){ + if(f_mode == EXE2CHECK){ fclose(dvi->file_ptr); fprintf(fp_out, f_needs_corr? "\nSome corrections are necessary!\n": @@ -1035,7 +1027,7 @@ lastpage: if(isdigit(*++out_pages)){ fclose(fp_out); dvi->file_ptr = fp_out = NULL; return; - } + } /* done for EXE2CHECK; remainings are for EXE2MODIFY */ /* if -z option is given, add empty pages to make multiple of 4 pages */ if(f_book && dim->total_page%4 == 0) @@ -1111,7 +1103,7 @@ lastpage: if(isdigit(*++out_pages)){ } fprintf(stderr, "\nDVI file %s is corrected\n", infile); }else - fprintf(stderr, "\nCreate a new DVI file %s\n", outfile); + fprintf(stderr, "\nCreate a new DVI file %s\n", (fp_out==stdout)?"(stdout)":outfile); } @@ -2593,7 +2585,7 @@ err: fprintf(stderr, "Error(line %d, code %d): %s\n", line, code, tmp } num = ftell(fp_out); fprintf(stderr, "Write %d byte (%d page): %s\n", num, page, - (fp_out==stdout)?"":outfile); + (fp_out==stdout)?"(stdout)":outfile); fclose(fp_in); fclose(fp_out); fp_in = fp_out = NULL; diff --git a/Build/source/texk/dviout-util/dvispc.man b/Build/source/texk/dviout-util/dvispc.man index c3e5c205bdb..0c73de6aa4f 100644 --- a/Build/source/texk/dviout-util/dvispc.man +++ b/Build/source/texk/dviout-util/dvispc.man @@ -25,22 +25,22 @@ dvispc \- Modify a DVI file to be page-independent in specials .B Dvispc is a utility to modify/edit \*(TX DVI file with the following features: .PP -Option \fB\-c\fR (default): - modify an input DVI to be page-independent in specials (default) + Mode option \fB\-c\fR (default): + modify an input DVI to be page-independent in specials (default) .PP -Option \fB\-d\fR: - check if an input DVI is page-independent in specials + Mode option \fB\-d\fR: + check if an input DVI is page-independent in specials .PP -Option \fB\-s\fR: - show all specials in the input DVI + Mode option \fB\-s\fR: + show all specials in the input DVI .PP -Option \fB\-a\fR: - translate DVI into a Text (like \fBdv2dt\fR in dtl) + Mode option \fB\-a\fR: + translate DVI into a Text (like \fBdv2dt\fR in dtl) .PP -Option \fB\-x\fR: - translate Text into a DVI (like \fBdt2dv\fR in dtl) + Mode option \fB\-x\fR: + translate Text into a DVI (like \fBdt2dv\fR in dtl) .PP -The main feature of +(1) The \fImain\fR feature of .B dvispc is the first one, to make a page-independent DVI file. .PP @@ -55,8 +55,72 @@ fails to preserve \\special's (e.g. page color might be lost). .PP The program .B dvispc -corrects such DVI files to be page-independent, which can be properly -processed by common DVI drivers such as \fBdvips\fR and \fBdvipdfmx\fR. +corrects such page-"dependent" DVI files to be page-independent, +which can be safely processed by +.B dviselect +or +.B dvidvi +and then properly converted to other formats such as PostScript and PDF. +.PP +(2) To know whether such a correction is needed or not, +.B dvispc \-d +will suffice. +.PP +(3) The mode \fB\-s\fR lists all specials found in the input DVI as-is, +with a preceding number which denotes the page where it appears. +For example, +.PP +.RS +[1] +.br +{color push Black} +.br +{color pop} +.br +{color push rgb 1 0 0} +.br +{color pop} +.br +[2] +.br +{color push Black} +.br +{color pop} +.RE +.LP +This feature is equivalent to a program +.B dvispecials +in TeX-Guy package +<http://www-masu.ist.osaka-u.ac.jp/%7Ekakugawa/TeX-Guy/> +and +.B dvii \-s +<https://ctan.org/pkg/dvii>. +.PP +(4) The mode \fB-a\fR and \fB-x\fR correspond to +.B dv2dt +and +.B dt2dv +in the dtl (= DVI Text Language) package respectively. By default +.B dvispc \-a +formats the output text in its own style, but DTL-compatible +format is available with +.B \-t +option. Also, +.B dvispc \-x +can accept DTL-compatible text input. +.SH SUPPORTED SPECIALS +Currently +.B dvispc +supports the followings: +.PP + dvips-compatible specials + color push, color pop, background + dvipdfm(x) specials + pdf:bcolor, pdf:ecolor, pdf:bgcolor, pdf:bann, pdf:eann + tpic specials: + pn +.PP +Other specials might be supported in the future if needed. .SH SEE ALSO dviselect(1), dvidvi(1), dvips(1), dvipdfmx(1) .SH AUTHOR diff --git a/Build/source/texk/dviout-util/dvispc.test b/Build/source/texk/dviout-util/dvispc.test index 51e025c1f32..5af3aace3db 100755 --- a/Build/source/texk/dviout-util/dvispc.test +++ b/Build/source/texk/dviout-util/dvispc.test @@ -41,6 +41,13 @@ diff --strip-trailing-cr $testdir/test.spc $testdir/test.spc \ ./dvispc -x < x1testa.txt > x1testax.dvi && \ cmp $testdir/test.dvi x1testax.dvi && echo || exit 5 +# not working as expected only for test ?? +#./dvispc -a $testdir/test.dvi | ./dvispc -x x2testax.dvi && \ +# cmp $testdir/test.dvi x2testax.dvi && echo || exit 5 + +./dvispc -a $testdir/test.dvi | ./dvispc -x > x2testax.dvi && \ + cmp $testdir/test.dvi x2testax.dvi && echo || exit 5 + ## EXE2INDEP |