From 2442de62d6f8c96d9f2c4ad3a04e6b7869cb0438 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 17 Oct 2012 08:29:54 +0000 Subject: dtl: Reduce TL/W32TeX diffs (from Akira) git-svn-id: svn://tug.org/texlive/trunk@27991 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dtl/ChangeLog | 9 +++++++++ Build/source/texk/dtl/Makefile.am | 14 +++++++++++--- Build/source/texk/dtl/Makefile.in | 20 ++++++++++++++------ Build/source/texk/dtl/configure | 37 +++++++++++++++++++++++++++++++++++-- Build/source/texk/dtl/configure.ac | 5 ++--- Build/source/texk/dtl/dt2dv.c | 33 +++++++++++++++++++++------------ Build/source/texk/dtl/dv2dt.c | 11 ++++++++--- Build/source/texk/dtl/man2ps | 17 ++--------------- 8 files changed, 102 insertions(+), 44 deletions(-) diff --git a/Build/source/texk/dtl/ChangeLog b/Build/source/texk/dtl/ChangeLog index 0cc87da1699..3b6cba183d1 100644 --- a/Build/source/texk/dtl/ChangeLog +++ b/Build/source/texk/dtl/ChangeLog @@ -1,3 +1,12 @@ +2012-10-17 Peter Breitenlohner + + * dt2dv.c, dv2dt.c, man2ps: Reduce TL/W32TeX diffs (from Akira). + * Makefile.am: Use the kpathsea library. + * configure.ac (KPSE_KPATHSEA_FLAGS): Adapt (drop [no-debug]). + + * Makefile.am: Add explicit dv2dt_SOURCES. + Avoid use of deprecated INCLUDES. + 2012-06-27 Peter Breitenlohner * dt2dv.c, dv2dt.c: Drop the problematic prototype for isatty(), diff --git a/Build/source/texk/dtl/Makefile.am b/Build/source/texk/dtl/Makefile.am index 02b472d6f82..3380e268bcb 100644 --- a/Build/source/texk/dtl/Makefile.am +++ b/Build/source/texk/dtl/Makefile.am @@ -1,18 +1,26 @@ ## Makefile.am for the TeX Live subdirectory texk/dtl/ ## -## Copyright (C) 2009, 2010 Peter Breitenlohner +## Copyright (C) 2009-2012 Peter Breitenlohner ## You may freely use, modify and/or distribute this file. ## ACLOCAL_AMFLAGS = -I ../../m4 -INCLUDES = $(KPATHSEA_INCLUDES) -AM_CPPFLAGS = -DUNIX -DKPATHSEA +AM_CPPFLAGS = $(KPATHSEA_INCLUDES) -DUNIX -DKPATHSEA AM_CFLAGS = $(WARNING_CFLAGS) bin_PROGRAMS = dt2dv dv2dt dt2dv_SOURCES = dt2dv.c dtl.h +dv2dt_SOURCES = dv2dt.c dtl.h + +LDADD = $(KPATHSEA_LIBS) + +$(dt2dv_OBJECTS) $(dv2dt_OBJECTS): $(KPATHSEA_DEPEND) + +## Rebuild libkpathsea +@KPATHSEA_RULE@ + dist_man1_MANS = dt2dv.man dv2dt.man dist_check_SCRIPTS = dtl.test diff --git a/Build/source/texk/dtl/Makefile.in b/Build/source/texk/dtl/Makefile.in index 0d894cd8e2d..7fcc032f021 100644 --- a/Build/source/texk/dtl/Makefile.in +++ b/Build/source/texk/dtl/Makefile.in @@ -88,9 +88,12 @@ PROGRAMS = $(bin_PROGRAMS) am_dt2dv_OBJECTS = dt2dv.$(OBJEXT) dt2dv_OBJECTS = $(am_dt2dv_OBJECTS) dt2dv_LDADD = $(LDADD) -dv2dt_SOURCES = dv2dt.c -dv2dt_OBJECTS = dv2dt.$(OBJEXT) +am__DEPENDENCIES_1 = +dt2dv_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_dv2dt_OBJECTS = dv2dt.$(OBJEXT) +dv2dt_OBJECTS = $(am_dv2dt_OBJECTS) dv2dt_LDADD = $(LDADD) +dv2dt_DEPENDENCIES = $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/../../build-aux/depcomp am__depfiles_maybe = depfiles @@ -104,8 +107,8 @@ CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ -SOURCES = $(dt2dv_SOURCES) dv2dt.c -DIST_SOURCES = $(dt2dv_SOURCES) dv2dt.c +SOURCES = $(dt2dv_SOURCES) $(dv2dt_SOURCES) +DIST_SOURCES = $(dt2dv_SOURCES) $(dv2dt_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -286,10 +289,11 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I ../../m4 -INCLUDES = $(KPATHSEA_INCLUDES) -AM_CPPFLAGS = -DUNIX -DKPATHSEA +AM_CPPFLAGS = $(KPATHSEA_INCLUDES) -DUNIX -DKPATHSEA AM_CFLAGS = $(WARNING_CFLAGS) dt2dv_SOURCES = dt2dv.c dtl.h +dv2dt_SOURCES = dv2dt.c dtl.h +LDADD = $(KPATHSEA_LIBS) dist_man1_MANS = dt2dv.man dv2dt.man dist_check_SCRIPTS = dtl.test TESTS = dtl.test @@ -957,6 +961,10 @@ uninstall-man: uninstall-man1 uninstall-man uninstall-man1 +$(dt2dv_OBJECTS) $(dv2dt_OBJECTS): $(KPATHSEA_DEPEND) + +@KPATHSEA_RULE@ + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/Build/source/texk/dtl/configure b/Build/source/texk/dtl/configure index 5d9125fe49d..334cb768de1 100755 --- a/Build/source/texk/dtl/configure +++ b/Build/source/texk/dtl/configure @@ -13014,7 +13014,6 @@ _ACEOF ac_config_headers="$ac_config_headers config.h" -# We don't use libpathsea, so add '-DNO_DEBUG' not to overload fopen. kpse_save_CPPFLAGS=$CPPFLAGS kpse_save_LIBS=$LIBS @@ -14438,7 +14437,41 @@ ${top_builddir}/../kpathsea/paths.h: cd ${top_builddir}/../kpathsea && $(MAKE) $(AM_MAKEFLAGS) rebuild' fi -KPATHSEA_INCLUDES="$KPATHSEA_INCLUDES -DNO_DEBUG" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libkpathsea supports debugging" >&5 +$as_echo_n "checking if libkpathsea supports debugging... " >&6; } +if ${kpse_cv_kpse_debug+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval CPPFLAGS=\"$KPATHSEA_INCLUDES \$CPPFLAGS\" +eval LIBS=\"$KPATHSEA_LIBS \$LIBS\" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen("f", "r") + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + kpse_cv_kpse_debug=yes +else + kpse_cv_kpse_debug=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CPPFLAGS=$kpse_save_CPPFLAGS +LIBS=$kpse_save_LIBS + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $kpse_cv_kpse_debug" >&5 +$as_echo "$kpse_cv_kpse_debug" >&6; } +if test "x$kpse_cv_kpse_debug" != xyes; then : + KPATHSEA_INCLUDES="$KPATHSEA_INCLUDES -DNO_DEBUG" +fi ac_config_files="$ac_config_files Makefile" diff --git a/Build/source/texk/dtl/configure.ac b/Build/source/texk/dtl/configure.ac index 6d44c571dea..6ef2afdb364 100644 --- a/Build/source/texk/dtl/configure.ac +++ b/Build/source/texk/dtl/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. dnl -dnl Copyright (C) 2009, 2010 Peter Breitenlohner +dnl Copyright (C) 2009-2012 Peter Breitenlohner dnl dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, @@ -20,8 +20,7 @@ AC_CHECK_SIZEOF(long) AC_CONFIG_HEADERS([config.h]) -# We don't use libpathsea, so add '-DNO_DEBUG' not to overload fopen. -KPSE_KPATHSEA_FLAGS([no-debug]) +KPSE_KPATHSEA_FLAGS AC_CONFIG_FILES([Makefile]) diff --git a/Build/source/texk/dtl/dt2dv.c b/Build/source/texk/dtl/dt2dv.c index 069afb7d397..97045bf77db 100644 --- a/Build/source/texk/dtl/dt2dv.c +++ b/Build/source/texk/dtl/dt2dv.c @@ -37,6 +37,7 @@ #ifdef KPATHSEA #include +#include #endif #include "dtl.h" @@ -46,7 +47,7 @@ int rd_stdin = 0; int wr_stdout = 0; /* maximum number of characters in a DTL input line */ -#define MAXLINE 1024 +#define MAXLINE 8192 /* input line */ typedef struct @@ -346,7 +347,12 @@ main #endif int i; +#ifdef KPATHSEA + kpse_set_program_name(argv[0], "dv2dt"); + progname = kpse_program_name; +#else progname = argv[0]; /* name of this program */ +#endif /* memory violation signal handler */ /* Not supported under Win32 */ @@ -1107,13 +1113,16 @@ read_char dinfo(); status = 0; } - else if ( ! isprint (c) && ! isspace (c)) + else if ( ! isprint (c) && ! isspace (c) +#ifdef WIN32 + && ! isknj (c) && ! isknj2 (c) +#endif + ) { PRINT_PROGNAME; fprintf (stderr, - "(read_char) : character %d %s.\n", - c, - "not printable and not white space"); + "(read_char) : character %d not printable and not white space.\n", + c); dinfo(); status = 0; } @@ -1150,8 +1159,8 @@ read_variety { PRINT_PROGNAME; fprintf (stderr, "(read_variety) : DTL FILE ERROR (%s) : ", dtl_filename); - fprintf (stderr, "DTL signature must begin with \"%s\", not \"%s\".\n", - "variety", token); + fprintf (stderr, "DTL signature must begin with \"variety\", not \"%s\".\n", + token); dexit (1); } @@ -1956,8 +1965,8 @@ check_bmes PRINT_PROGNAME; fprintf (stderr, "(check_bmes) : DTL FILE ERROR (%s) : ", dtl_filename); - fprintf (stderr, "BMES_CHAR (`%c') %s, not `%c' (char %d).\n", - BMES_CHAR, "expected before string", ch, ch); + fprintf (stderr, "BMES_CHAR (`%c') expected before string, not `%c' (char %d).\n", + BMES_CHAR, ch, ch); dexit (1); } @@ -1992,8 +2001,8 @@ check_emes PRINT_PROGNAME; fprintf (stderr, "(check_emes) : DTL FILE ERROR (%s) : ", dtl_filename); - fprintf (stderr, "EMES_CHAR (`%c') %s, not `%c' (char %d).\n", - EMES_CHAR, "expected to follow string", ch, ch); + fprintf (stderr, "EMES_CHAR (`%c') expected to follow string, not `%c' (char %d).\n", + EMES_CHAR, ch, ch); dexit (1); } @@ -2003,7 +2012,7 @@ check_emes /* Size typically used in this program for Lstring variables */ -#define LSIZE 1024 +#define LSIZE 16384 Void diff --git a/Build/source/texk/dtl/dv2dt.c b/Build/source/texk/dtl/dv2dt.c index 5a4b803f6b1..6c86cdc2e1a 100644 --- a/Build/source/texk/dtl/dv2dt.c +++ b/Build/source/texk/dtl/dv2dt.c @@ -30,6 +30,7 @@ #ifdef KPATHSEA #include +#include #endif #include "dtl.h" @@ -147,7 +148,7 @@ COUNT postamble ARGS((FILE * dvi, FILE * dtl)); COUNT postpost ARGS((FILE * dvi, FILE * dtl)); -String program; /* name of dv2dt program */ +const char * program; /* name of dv2dt program */ int main @@ -162,8 +163,12 @@ main FILE * dvi = stdin; FILE * dtl = stdout; - /* Watch out: C's standard library's string functions are dicey */ - strncpy (program, argv[0], MAXSTRLEN); +#ifdef KPATHSEA + kpse_set_program_name(argv[0], "dv2dt"); + program = kpse_program_name; +#else + program = argv[0]; +#endif if (argc > 1) open_dvi (argv[1], &dvi); diff --git a/Build/source/texk/dtl/man2ps b/Build/source/texk/dtl/man2ps index 47eeb6e3900..87f0164e925 100644 --- a/Build/source/texk/dtl/man2ps +++ b/Build/source/texk/dtl/man2ps @@ -24,18 +24,5 @@ case `basename $0` in *) echo "Unknown troff format:" ; exit 1 ;; esac -# We can use either GNU groff or Sun Solaris troff + dpost -if [ -x /usr/local/bin/groff ] -then # GNU groff - TROFF="groff $FORMAT" - TROFF2PS="cat" -elif [ -x /usr/lib/lp/postscript/dpost ] -then # Solaris 2.1 - TROFF="troff $FORMAT" - TROFF2PS="/usr/lib/lp/postscript/dpost" -else - echo "Cannot find troff-to-PostScript filter" - exit 1 -fi - -tbl $* | eqn | $TROFF | $TROFF2PS +# We use GNU groff +gtbl $* | eqn | groff $FORMAT -- cgit v1.2.3