diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-10-22 09:11:39 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-10-22 09:11:39 +0000 |
commit | 6b265b5706ebc12aa2be12a344f851d69dc237d7 (patch) | |
tree | 71bdb44af1ec166114cecf911e02882948135b69 | |
parent | 2728dbc52e61072d405388dda137c8ed7a1f0721 (diff) |
chktex: Adapt to TeX Live; WIN32 build problems (from Akira)
git-svn-id: svn://tug.org/texlive/trunk@28043 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/chktex/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/chktex/Makefile.am | 5 | ||||
-rw-r--r-- | Build/source/texk/chktex/Makefile.in | 5 | ||||
-rw-r--r-- | Build/source/texk/chktex/chktex-1.7.1-PATCHES/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-10-semicolon | 153 | ||||
-rw-r--r-- | Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-11-TL | 107 | ||||
-rw-r--r-- | Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-12-uint64_t | 122 | ||||
-rw-r--r-- | Build/source/texk/chktex/chktex-1.7.1/ChkTeX.c | 36 | ||||
-rw-r--r-- | Build/source/texk/chktex/chktex-1.7.1/ChkTeX.h | 67 | ||||
-rw-r--r-- | Build/source/texk/chktex/chktex-1.7.1/FindErrs.c | 24 | ||||
-rw-r--r-- | Build/source/texk/chktex/chktex-1.7.1/OpSys.c | 33 | ||||
-rw-r--r-- | Build/source/texk/chktex/chktex-1.7.1/Resource.c | 6 | ||||
-rw-r--r-- | Build/source/texk/chktex/chktex-1.7.1/configure.in | 1 | ||||
-rw-r--r-- | Build/source/texk/texlive/linked_scripts/scripts.lst | 1 |
14 files changed, 484 insertions, 87 deletions
diff --git a/Build/source/texk/chktex/ChangeLog b/Build/source/texk/chktex/ChangeLog index 3b4bf429357..2503fac5564 100644 --- a/Build/source/texk/chktex/ChangeLog +++ b/Build/source/texk/chktex/ChangeLog @@ -1,3 +1,8 @@ +2012-10-22 Peter Breitenlohner <peb@mppmu.mpg.de> + + * Makefile.am: Avoid use of deprecated INCLUDES. + (TESTS_ENVIRONMENT): Add TEXMFCNF. + 2012-10-10 Peter Breitenlohner <peb@mppmu.mpg.de> * configure.ac: Check for declaration of stpcpy(). diff --git a/Build/source/texk/chktex/Makefile.am b/Build/source/texk/chktex/Makefile.am index c12f3f575f7..d4199c10612 100644 --- a/Build/source/texk/chktex/Makefile.am +++ b/Build/source/texk/chktex/Makefile.am @@ -26,8 +26,7 @@ EXTRA_DIST += $(CHKTEX_TREE)-PATCHES dist-hook: rm -rf `find $(distdir) -name .svn` -INCLUDES = $(REGEX_INCLUDES) $(KPATHSEA_INCLUDES) -AM_CPPFLAGS = -DKPATHSEA +AM_CPPFLAGS = $(REGEX_INCLUDES) $(KPATHSEA_INCLUDES) -DKPATHSEA AM_CFLAGS = $(WARNING_CFLAGS) bin_PROGRAMS = chktex @@ -106,7 +105,7 @@ CLEANFILES = $(nodist_bin_SCRIPTS) ## TESTS = chktex.test EXTRA_DIST += $(TESTS) -TESTS_ENVIRONMENT = CHKTEX_TREE=$(CHKTEX_TREE) +TESTS_ENVIRONMENT = CHKTEX_TREE=$(CHKTEX_TREE) TEXMFCNF=$(abs_srcdir)/../kpathsea CLEANFILES += chktest diff --git a/Build/source/texk/chktex/Makefile.in b/Build/source/texk/chktex/Makefile.in index 02d9fbe0796..a9a5e3fd87c 100644 --- a/Build/source/texk/chktex/Makefile.in +++ b/Build/source/texk/chktex/Makefile.in @@ -320,8 +320,7 @@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I ../../m4 EXTRA_DIST = $(CHKTEX_TREE) $(CHKTEX_TREE)-PATCHES regex/COPYING.LIB \ regex/README ../../build-aux/relpath $(TESTS) -INCLUDES = $(REGEX_INCLUDES) $(KPATHSEA_INCLUDES) -AM_CPPFLAGS = -DKPATHSEA +AM_CPPFLAGS = $(REGEX_INCLUDES) $(KPATHSEA_INCLUDES) -DKPATHSEA AM_CFLAGS = $(WARNING_CFLAGS) chktex_SOURCES = $(CHKTEX_TREE)/ChkTeX.c $(CHKTEX_TREE)/ChkTeX.h \ $(CHKTEX_TREE)/FindErrs.c $(CHKTEX_TREE)/FindErrs.h \ @@ -364,7 +363,7 @@ pdfdocdir = $(datarootdir)/texmf/doc/chktex dist_pdfdoc_DATA = $(CHKTEX_TREE)/ChkTeX.pdf CLEANFILES = $(nodist_bin_SCRIPTS) chktest TESTS = chktex.test -TESTS_ENVIRONMENT = CHKTEX_TREE=$(CHKTEX_TREE) +TESTS_ENVIRONMENT = CHKTEX_TREE=$(CHKTEX_TREE) TEXMFCNF=$(abs_srcdir)/../kpathsea all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am diff --git a/Build/source/texk/chktex/chktex-1.7.1-PATCHES/ChangeLog b/Build/source/texk/chktex/chktex-1.7.1-PATCHES/ChangeLog index 2e70d8d189b..f679420e397 100644 --- a/Build/source/texk/chktex/chktex-1.7.1-PATCHES/ChangeLog +++ b/Build/source/texk/chktex/chktex-1.7.1-PATCHES/ChangeLog @@ -1,3 +1,9 @@ +2012-10-22 Peter Breitenlohner <peb@mppmu.mpg.de> + + * patch-10-semicolon: Adapt to upstream. + * patch-11-TL (new): Use kpse_var_value(), binary output files. + * patch-12-uint64_t (new): Use uint64_t and check for it. + 2012-10-10 Peter Breitenlohner <peb@mppmu.mpg.de> * patch-08-stpcpy: Check for declaration of stpcpy(). diff --git a/Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-10-semicolon b/Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-10-semicolon index 6fb15c56e0c..dd0adeabef3 100644 --- a/Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-10-semicolon +++ b/Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-10-semicolon @@ -1,23 +1,150 @@ diff -ur chktex-1.7.1.orig/ChkTeX.c chktex-1.7.1/ChkTeX.c --- chktex-1.7.1.orig/ChkTeX.c 2012-10-10 11:34:16.000000000 +0200 -+++ chktex-1.7.1/ChkTeX.c 2012-10-10 11:41:42.000000000 +0200 -@@ -196,8 +196,8 @@ ++++ chktex-1.7.1/ChkTeX.c 2012-10-21 14:42:07.000000000 +0200 +@@ -195,7 +195,7 @@ + char VerbNormal[] = "%k %n in %f line %l: %m\n" "%r%s%t\n" "%u\n"; - #define DEF(type, name, value) type name = value; --OPTION_DEFAULTS; --STATE_VARS; -+OPTION_DEFAULTS -+STATE_VARS +-#define DEF(type, name, value) type name = value; ++#define DEF(type, name, value) type name = value + OPTION_DEFAULTS; + STATE_VARS; #undef DEF - FILE *OutputFile = NULL; +@@ -426,7 +426,7 @@ + for (Count = 0; Count < NUMBRACKETS; Count++) + Brackets[Count] = 0L; -@@ -688,7 +688,7 @@ +-#define DEF(type, name, value) name = value; ++#define DEF(type, name, value) name = value + STATE_VARS; + #undef DEF + if (UsingStdIn) +@@ -687,7 +687,7 @@ + static void ResetSettings(void) { - #define DEF(type, name, value) name = value; -- OPTION_DEFAULTS; -+ OPTION_DEFAULTS +-#define DEF(type, name, value) name = value; ++#define DEF(type, name, value) name = value + OPTION_DEFAULTS; #undef DEF if (OutputFile != stdout) - { +@@ -855,11 +855,13 @@ + nextc = ShiftArg(&optarg); + break; + +- LOOP(warntype, case 'w': +- ErrType = etWarn; InUse = iuOK; LAST(warntype); case 'e': +- ErrType = etErr; InUse = iuOK; LAST(warntype); case 'm': +- ErrType = etMsg; InUse = iuOK; LAST(warntype); case 'n': +- ErrType = etMsg; InUse = iuNotUser; LAST(warntype);) if (isdigit((unsigned char)*optarg)) ++ LOOP(warntype, ++ case 'w': ErrType = etWarn; InUse = iuOK; LAST(warntype); ++ case 'e': ErrType = etErr; InUse = iuOK; LAST(warntype); ++ case 'm': ErrType = etMsg; InUse = iuOK; LAST(warntype); ++ case 'n': ErrType = etMsg; InUse = iuNotUser; LAST(warntype); ++ ) ++ if (isdigit((unsigned char)*optarg)) + { + nextc = ParseNumArg(&Err, -1, &optarg); + if (betw(emMinFault, Err, emMaxFault)) +diff -ur chktex-1.7.1.orig/ChkTeX.h chktex-1.7.1/ChkTeX.h +--- chktex-1.7.1.orig/ChkTeX.h 2012-10-10 11:32:49.000000000 +0200 ++++ chktex-1.7.1/ChkTeX.h 2012-10-21 14:33:01.000000000 +0200 +@@ -286,38 +286,39 @@ + extern FILE *OutputFile, *InputFile; + + #define OPTION_DEFAULTS \ +- DEF(int, GlobalRC, TRUE) \ +- DEF(int, WipeVerb, TRUE) \ +- DEF(int, BackupOut, TRUE) \ +- DEF(int, Quiet, FALSE) \ +- DEF(int, LicenseOnly, FALSE) \ +- DEF(int, UsingStdIn, FALSE) \ +- DEF(int, InputFiles, TRUE) \ +- DEF(int, HeadErrOut, TRUE) \ +- DEF(const char *, OutputName, "") \ +- DEF(const char *, PseudoInName, NULL) \ +- DEF(char *, OutputFormat, VerbNormal) \ +- DEF(char *, PipeOutputFormat, NULL) \ +- DEF(const char *, Delimit, ":") \ +- DEF(long, DebugLevel, 0) \ ++ DEF(int, GlobalRC, TRUE); \ ++ DEF(int, WipeVerb, TRUE); \ ++ DEF(int, BackupOut, TRUE); \ ++ DEF(int, Quiet, FALSE); \ ++ DEF(int, LicenseOnly, FALSE); \ ++ DEF(int, UsingStdIn, FALSE); \ ++ DEF(int, InputFiles, TRUE); \ ++ DEF(int, HeadErrOut, TRUE); \ ++ DEF(const char *, OutputName, ""); \ ++ DEF(const char *, PseudoInName, NULL); \ ++ DEF(char *, OutputFormat, VerbNormal); \ ++ DEF(char *, PipeOutputFormat, NULL); \ ++ DEF(const char *, Delimit, ":"); \ ++ DEF(long, DebugLevel, 0); \ + DEF(int, NoLineSupp, FALSE) + + #define STATE_VARS \ +- DEF(enum ItState, ItState, itOff) /* Are we doing italics? */ \ +- DEF(int, AtLetter, FALSE) /* Whether `@' is a letter or not. */ \ +- DEF(int, InHeader, TRUE) /* Whether we're in the header */ \ +- DEF(int, VerbMode, FALSE) /* Whether we're in complete ignore-mode */ \ +- DEF(long, MathMode, 0) /* Whether we're in math mode or not */ \ +- DEF(const char *, VerbStr, "") /* String we'll terminate verbmode upon */ \ +- DEF(unsigned long, ErrPrint, 0) /* # errors printed */ \ +- DEF(unsigned long, WarnPrint, 0) /* # warnings printed */ \ +- DEF(unsigned long, UserSupp, 0) /* # user suppressed warnings */ \ +- DEF(unsigned long, LineSupp, 0) /* # warnings suppressed on a single line */ \ +- DEF(unsigned long long, FileSuppressions, 0) /* # warnings suppressed in a file */ \ +- DEF(unsigned long long, UserFileSuppressions, 0) /* # User warnings suppressed in a file */ ++ DEF(enum ItState, ItState, itOff); /* Are we doing italics? */ \ ++ DEF(int, AtLetter, FALSE); /* Whether `@' is a letter or not. */ \ ++ DEF(int, InHeader, TRUE); /* Whether we're in the header */ \ ++ DEF(int, VerbMode, FALSE); /* Whether we're in complete ignore-mode */ \ ++ DEF(long, MathMode, 0); /* Whether we're in math mode or not */ \ ++ DEF(const char *, VerbStr, ""); /* String we'll terminate verbmode upon */ \ ++ DEF(unsigned long, ErrPrint, 0); /* # errors printed */ \ ++ DEF(unsigned long, WarnPrint, 0); /* # warnings printed */ \ ++ DEF(unsigned long, UserSupp, 0); /* # user suppressed warnings */ \ ++ DEF(unsigned long, LineSupp, 0); /* # warnings suppressed on a single line */ \ ++ DEF(unsigned long long, FileSuppressions, 0); /* # warnings suppressed in a file */ \ ++ DEF(unsigned long long, UserFileSuppressions, 0); /* # User warnings suppressed in a file */ + +-#define DEF(type, name, value) extern type name; +-OPTION_DEFAULTS STATE_VARS ++#define DEF(type, name, value) extern type name ++OPTION_DEFAULTS; ++STATE_VARS; + #undef DEF + extern struct Stack CharStack, InputStack, EnvStack; + +diff -ur chktex-1.7.1.orig/Resource.c chktex-1.7.1/Resource.c +--- chktex-1.7.1.orig/Resource.c 2012-04-23 22:22:26.000000000 +0200 ++++ chktex-1.7.1/Resource.c 2012-10-21 14:45:14.000000000 +0200 +@@ -75,7 +75,7 @@ + BIT(Equal), /* = */ \ + BIT(Word), /* Keyword */ \ + BIT(Item) /* List item */ \ +-}; ++} + + #undef BIT + #define BIT BITDEF1 +@@ -323,7 +323,7 @@ + + #define DONEKEY (FLG_Open | FLG_Equal | FLG_BrOpen) + #define DONELIST (FLG_Close | FLG_BrClose) +-#define TOKEN(c, ctxt, tk) case c: if(Expect & (ctxt)) Retval = tk; LAST(token); ++#define TOKEN(c, ctxt, tk) case c: if(Expect & (ctxt)) Retval = tk; LAST(token) + + LOOP(token, + TOKEN('{', DONEKEY, FLG_Open); +@@ -331,7 +331,7 @@ + TOKEN('=', DONEKEY, FLG_Equal); + TOKEN(']', DONELIST, FLG_BrClose); + TOKEN('}', DONELIST, FLG_Close); +- ); ++ ) + if (Retval != FLG_Eof) + { + OnceMore = FALSE; diff --git a/Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-11-TL b/Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-11-TL new file mode 100644 index 00000000000..6ef6b935ae4 --- /dev/null +++ b/Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-11-TL @@ -0,0 +1,107 @@ +diff -ur chktex-1.7.1.orig/ChkTeX.c chktex-1.7.1/ChkTeX.c +--- chktex-1.7.1.orig/ChkTeX.c 2012-10-21 14:42:07.000000000 +0200 ++++ chktex-1.7.1/ChkTeX.c 2012-10-21 16:00:08.000000000 +0200 +@@ -334,7 +334,15 @@ + #endif + + OutputFile = stdout; ++#ifdef KPATHSEA ++ kpse_set_program_name(argv[0], "chktex"); ++ PrgName = kpse_program_name; ++#ifdef WIN32 ++ setmode(fileno(stdout), _O_BINARY); ++#endif ++#else + PrgName = argv[0]; ++#endif + + #undef KEY + #undef LCASE +@@ -512,7 +520,11 @@ + + if (Success) + { ++#ifdef KPATHSEA ++ if (!(OutputFile = fopen(OutputName, "wb"))) ++#else + if (!(OutputFile = fopen(OutputName, "w"))) ++#endif + { + PrintPrgErr(pmOutOpen); + Success = FALSE; +diff -ur chktex-1.7.1.orig/OpSys.c chktex-1.7.1/OpSys.c +--- chktex-1.7.1.orig/OpSys.c 2010-12-18 22:12:10.000000000 +0100 ++++ chktex-1.7.1/OpSys.c 2012-10-21 15:56:54.000000000 +0200 +@@ -37,6 +37,10 @@ + #include "OpSys.h" + #include "Utility.h" + ++#ifdef KPATHSEA ++#include <kpathsea/variable.h> ++#endif ++ + #ifdef HAVE_SYS_STAT_H + # include <sys/stat.h> + #endif +@@ -105,6 +109,8 @@ + + #ifdef __MSDOS__ + # define LOCALRCFILE RCBASENAME ++#elif defined(WIN32) ++# define LOCALRCFILE RCBASENAME + #else + # define LOCALRCFILE "." RCBASENAME + #endif +@@ -173,6 +179,8 @@ + #ifdef __MSDOS__ + + if ((Env = getenv("CHKTEXRC")) || (Env = getenv("CHKTEX_HOME"))) ++#elif defined(TEX_LIVE) ++ if ((Env = kpse_var_value("CHKTEXRC"))) + #else + + if ((Env = getenv("CHKTEXRC"))) +@@ -181,6 +189,9 @@ + { + strcpy(ConfigFile, Env); + tackon(ConfigFile, LOCALRCFILE); ++#ifdef TEX_LIVE ++ free(Env); ++#endif + } + else + #ifdef __MSDOS__ +@@ -217,24 +228,20 @@ + break; + case liSysDir: /* System dir for resource files */ + #ifdef TEX_LIVE +- if ((Env = getenv("CHKTEX_CONFIG"))) ++ if ((Env = kpse_var_value("CHKTEX_CONFIG"))) + { + strcpy(ConfigFile, Env); ++ free(Env); + } +- else ++ else if ((Env = kpse_var_value("TEXMFMAIN"))) + { +- FILE *f; +- *ConfigFile = 0; +- if ((f = popen("kpsewhich -expand-var='$TEXMFMAIN'", "r"))) +- { +- if (1 == fscanf(f, "%1024s", ConfigFile)) +- { +- tackon(ConfigFile, "chktex"); +- tackon(ConfigFile, RCBASENAME); +- } +- (void)pclose(f); +- } ++ strcpy(ConfigFile, Env); ++ tackon(ConfigFile, "chktex"); ++ tackon(ConfigFile, RCBASENAME); ++ free(Env); + } ++ else ++ *ConfigFile = 0; + #else /* TEX_LIVE */ + #if defined(__unix__) || defined(__MSDOS__) + strcpy(ConfigFile, SYSCONFDIR); diff --git a/Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-12-uint64_t b/Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-12-uint64_t new file mode 100644 index 00000000000..298ec44dfee --- /dev/null +++ b/Build/source/texk/chktex/chktex-1.7.1-PATCHES/patch-12-uint64_t @@ -0,0 +1,122 @@ +diff -ur chktex-1.7.1.orig/ChkTeX.h chktex-1.7.1/ChkTeX.h +--- chktex-1.7.1.orig/ChkTeX.h 2012-10-21 14:33:01.000000000 +0200 ++++ chktex-1.7.1/ChkTeX.h 2012-10-22 10:26:21.000000000 +0200 +@@ -72,6 +72,14 @@ + # include <strings.h> + #endif + ++#ifdef HAVE_INTTYPES_H ++# include <inttypes.h> ++#endif ++ ++#ifdef HAVE_STDINT_H ++# include <stdint.h> ++#endif ++ + #include "types.h" + + #ifndef LONG_MAX +@@ -313,8 +321,8 @@ + DEF(unsigned long, WarnPrint, 0); /* # warnings printed */ \ + DEF(unsigned long, UserSupp, 0); /* # user suppressed warnings */ \ + DEF(unsigned long, LineSupp, 0); /* # warnings suppressed on a single line */ \ +- DEF(unsigned long long, FileSuppressions, 0); /* # warnings suppressed in a file */ \ +- DEF(unsigned long long, UserFileSuppressions, 0); /* # User warnings suppressed in a file */ ++ DEF(uint64_t, FileSuppressions, 0); /* # warnings suppressed in a file */ \ ++ DEF(uint64_t, UserFileSuppressions, 0); /* # User warnings suppressed in a file */ + + #define DEF(type, name, value) extern type name + OPTION_DEFAULTS; +diff -ur chktex-1.7.1.orig/FindErrs.c chktex-1.7.1/FindErrs.c +--- chktex-1.7.1.orig/FindErrs.c 2012-10-10 11:24:26.000000000 +0200 ++++ chktex-1.7.1/FindErrs.c 2012-10-22 10:34:58.000000000 +0200 +@@ -75,7 +75,7 @@ + return(func(c)); \ + } + +-#define SUPPRESSED_ON_LINE(c) (LineSuppressions & (1LL<<c)) ++#define SUPPRESSED_ON_LINE(c) (LineSuppressions & ((uint64_t)1<<c)) + + #define INUSE(c) \ + ((LaTeXMsgs[(enum ErrNum) c].InUse == iuOK) && !SUPPRESSED_ON_LINE(c)) +@@ -146,12 +146,12 @@ + /* + * A bit field used to hold the suppressions for the current line. + */ +-static unsigned long long LineSuppressions; ++static uint64_t LineSuppressions; + /* + * A bit field used to hold the suppressions of numbered user warnings + * for the current line. + */ +-static unsigned long long UserLineSuppressions; ++static uint64_t UserLineSuppressions; + + static unsigned long Line; + +@@ -344,7 +344,7 @@ + if (!NoLineSupp) + { + int error; +- const int MaxSuppressionBits = sizeof(unsigned long long)*8-1; ++ const int MaxSuppressionBits = 63; + + /* Convert to lowercase to compare with LineSuppDelim */ + EscapePtr = ++TmpPtr; /* move past NUL terminator */ +@@ -365,13 +365,13 @@ + } + if (error > 0) + { +- FileSuppressions |= (1LL << error); +- LineSuppressions |= (1LL << error); ++ FileSuppressions |= ((uint64_t)1 << error); ++ LineSuppressions |= ((uint64_t)1 << error); + } + else + { +- UserFileSuppressions |= (1LL << (-error)); +- UserLineSuppressions |= (1LL << (-error)); ++ UserFileSuppressions |= ((uint64_t)1 << (-error)); ++ UserLineSuppressions |= ((uint64_t)1 << (-error)); + } + } + TmpPtr = EscapePtr; +@@ -388,11 +388,11 @@ + + if (error > 0) + { +- LineSuppressions |= (1LL << error); ++ LineSuppressions |= ((uint64_t)1 << error); + } + else + { +- UserLineSuppressions |= (1LL << (-error)); ++ UserLineSuppressions |= ((uint64_t)1 << (-error)); + } + } + } +@@ -882,11 +882,11 @@ + while (offset < len) + { + /* Check if this warning should be suppressed. */ +- if (UserLineSuppressions != 0LL && NamedWarning) ++ if (UserLineSuppressions && NamedWarning) + { + /* The warning can be named with positive or negative numbers. */ + int UserWarningNumber = abs(atoi(ErrMessage)); +- if (UserLineSuppressions & (1LL << UserWarningNumber)) ++ if (UserLineSuppressions & ((uint64_t)1 << UserWarningNumber)) + { + break; + } +diff -ur chktex-1.7.1.orig/configure.in chktex-1.7.1/configure.in +--- chktex-1.7.1.orig/configure.in 2012-10-10 11:24:37.000000000 +0200 ++++ chktex-1.7.1/configure.in 2012-10-22 10:24:01.000000000 +0200 +@@ -158,6 +158,7 @@ + AC_C_CONST + AC_C_INLINE + AC_TYPE_SIZE_T ++AC_TYPE_UINT64_T + + dnl Checks for library functions. + AC_FUNC_VPRINTF diff --git a/Build/source/texk/chktex/chktex-1.7.1/ChkTeX.c b/Build/source/texk/chktex/chktex-1.7.1/ChkTeX.c index 495a518f37f..95688728af4 100644 --- a/Build/source/texk/chktex/chktex-1.7.1/ChkTeX.c +++ b/Build/source/texk/chktex/chktex-1.7.1/ChkTeX.c @@ -195,9 +195,9 @@ enum Quote Quote; char VerbNormal[] = "%k %n in %f line %l: %m\n" "%r%s%t\n" "%u\n"; -#define DEF(type, name, value) type name = value; -OPTION_DEFAULTS -STATE_VARS +#define DEF(type, name, value) type name = value +OPTION_DEFAULTS; +STATE_VARS; #undef DEF FILE *OutputFile = NULL; @@ -334,7 +334,15 @@ int main(int argc, char **argv) #endif OutputFile = stdout; +#ifdef KPATHSEA + kpse_set_program_name(argv[0], "chktex"); + PrgName = kpse_program_name; +#ifdef WIN32 + setmode(fileno(stdout), _O_BINARY); +#endif +#else PrgName = argv[0]; +#endif #undef KEY #undef LCASE @@ -426,7 +434,7 @@ int main(int argc, char **argv) for (Count = 0; Count < NUMBRACKETS; Count++) Brackets[Count] = 0L; -#define DEF(type, name, value) name = value; +#define DEF(type, name, value) name = value STATE_VARS; #undef DEF if (UsingStdIn) @@ -512,7 +520,11 @@ static int OpenOut(void) if (Success) { +#ifdef KPATHSEA + if (!(OutputFile = fopen(OutputName, "wb"))) +#else if (!(OutputFile = fopen(OutputName, "w"))) +#endif { PrintPrgErr(pmOutOpen); Success = FALSE; @@ -687,8 +699,8 @@ static void ResetStacks(void) static void ResetSettings(void) { -#define DEF(type, name, value) name = value; - OPTION_DEFAULTS +#define DEF(type, name, value) name = value + OPTION_DEFAULTS; #undef DEF if (OutputFile != stdout) { @@ -855,11 +867,13 @@ static int ParseArgs(int argc, char **argv) nextc = ShiftArg(&optarg); break; - LOOP(warntype, case 'w': - ErrType = etWarn; InUse = iuOK; LAST(warntype); case 'e': - ErrType = etErr; InUse = iuOK; LAST(warntype); case 'm': - ErrType = etMsg; InUse = iuOK; LAST(warntype); case 'n': - ErrType = etMsg; InUse = iuNotUser; LAST(warntype);) if (isdigit((unsigned char)*optarg)) + LOOP(warntype, + case 'w': ErrType = etWarn; InUse = iuOK; LAST(warntype); + case 'e': ErrType = etErr; InUse = iuOK; LAST(warntype); + case 'm': ErrType = etMsg; InUse = iuOK; LAST(warntype); + case 'n': ErrType = etMsg; InUse = iuNotUser; LAST(warntype); + ) + if (isdigit((unsigned char)*optarg)) { nextc = ParseNumArg(&Err, -1, &optarg); if (betw(emMinFault, Err, emMaxFault)) diff --git a/Build/source/texk/chktex/chktex-1.7.1/ChkTeX.h b/Build/source/texk/chktex/chktex-1.7.1/ChkTeX.h index f2b2e13c386..aba2c215239 100644 --- a/Build/source/texk/chktex/chktex-1.7.1/ChkTeX.h +++ b/Build/source/texk/chktex/chktex-1.7.1/ChkTeX.h @@ -72,6 +72,14 @@ # include <strings.h> #endif +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#endif + +#ifdef HAVE_STDINT_H +# include <stdint.h> +#endif + #include "types.h" #ifndef LONG_MAX @@ -286,38 +294,39 @@ extern unsigned long Brackets[NUMBRACKETS]; extern FILE *OutputFile, *InputFile; #define OPTION_DEFAULTS \ - DEF(int, GlobalRC, TRUE) \ - DEF(int, WipeVerb, TRUE) \ - DEF(int, BackupOut, TRUE) \ - DEF(int, Quiet, FALSE) \ - DEF(int, LicenseOnly, FALSE) \ - DEF(int, UsingStdIn, FALSE) \ - DEF(int, InputFiles, TRUE) \ - DEF(int, HeadErrOut, TRUE) \ - DEF(const char *, OutputName, "") \ - DEF(const char *, PseudoInName, NULL) \ - DEF(char *, OutputFormat, VerbNormal) \ - DEF(char *, PipeOutputFormat, NULL) \ - DEF(const char *, Delimit, ":") \ - DEF(long, DebugLevel, 0) \ + DEF(int, GlobalRC, TRUE); \ + DEF(int, WipeVerb, TRUE); \ + DEF(int, BackupOut, TRUE); \ + DEF(int, Quiet, FALSE); \ + DEF(int, LicenseOnly, FALSE); \ + DEF(int, UsingStdIn, FALSE); \ + DEF(int, InputFiles, TRUE); \ + DEF(int, HeadErrOut, TRUE); \ + DEF(const char *, OutputName, ""); \ + DEF(const char *, PseudoInName, NULL); \ + DEF(char *, OutputFormat, VerbNormal); \ + DEF(char *, PipeOutputFormat, NULL); \ + DEF(const char *, Delimit, ":"); \ + DEF(long, DebugLevel, 0); \ DEF(int, NoLineSupp, FALSE) #define STATE_VARS \ - DEF(enum ItState, ItState, itOff) /* Are we doing italics? */ \ - DEF(int, AtLetter, FALSE) /* Whether `@' is a letter or not. */ \ - DEF(int, InHeader, TRUE) /* Whether we're in the header */ \ - DEF(int, VerbMode, FALSE) /* Whether we're in complete ignore-mode */ \ - DEF(long, MathMode, 0) /* Whether we're in math mode or not */ \ - DEF(const char *, VerbStr, "") /* String we'll terminate verbmode upon */ \ - DEF(unsigned long, ErrPrint, 0) /* # errors printed */ \ - DEF(unsigned long, WarnPrint, 0) /* # warnings printed */ \ - DEF(unsigned long, UserSupp, 0) /* # user suppressed warnings */ \ - DEF(unsigned long, LineSupp, 0) /* # warnings suppressed on a single line */ \ - DEF(unsigned long long, FileSuppressions, 0) /* # warnings suppressed in a file */ \ - DEF(unsigned long long, UserFileSuppressions, 0) /* # User warnings suppressed in a file */ - -#define DEF(type, name, value) extern type name; -OPTION_DEFAULTS STATE_VARS + DEF(enum ItState, ItState, itOff); /* Are we doing italics? */ \ + DEF(int, AtLetter, FALSE); /* Whether `@' is a letter or not. */ \ + DEF(int, InHeader, TRUE); /* Whether we're in the header */ \ + DEF(int, VerbMode, FALSE); /* Whether we're in complete ignore-mode */ \ + DEF(long, MathMode, 0); /* Whether we're in math mode or not */ \ + DEF(const char *, VerbStr, ""); /* String we'll terminate verbmode upon */ \ + DEF(unsigned long, ErrPrint, 0); /* # errors printed */ \ + DEF(unsigned long, WarnPrint, 0); /* # warnings printed */ \ + DEF(unsigned long, UserSupp, 0); /* # user suppressed warnings */ \ + DEF(unsigned long, LineSupp, 0); /* # warnings suppressed on a single line */ \ + DEF(uint64_t, FileSuppressions, 0); /* # warnings suppressed in a file */ \ + DEF(uint64_t, UserFileSuppressions, 0); /* # User warnings suppressed in a file */ + +#define DEF(type, name, value) extern type name +OPTION_DEFAULTS; +STATE_VARS; #undef DEF extern struct Stack CharStack, InputStack, EnvStack; diff --git a/Build/source/texk/chktex/chktex-1.7.1/FindErrs.c b/Build/source/texk/chktex/chktex-1.7.1/FindErrs.c index 6ec6e6828f8..7d4eed52066 100644 --- a/Build/source/texk/chktex/chktex-1.7.1/FindErrs.c +++ b/Build/source/texk/chktex/chktex-1.7.1/FindErrs.c @@ -75,7 +75,7 @@ static int my_##func(int c) \ return(func(c)); \ } -#define SUPPRESSED_ON_LINE(c) (LineSuppressions & (1LL<<c)) +#define SUPPRESSED_ON_LINE(c) (LineSuppressions & ((uint64_t)1<<c)) #define INUSE(c) \ ((LaTeXMsgs[(enum ErrNum) c].InUse == iuOK) && !SUPPRESSED_ON_LINE(c)) @@ -146,12 +146,12 @@ const char FileSuppDelim[] = "chktex-file "; /* * A bit field used to hold the suppressions for the current line. */ -static unsigned long long LineSuppressions; +static uint64_t LineSuppressions; /* * A bit field used to hold the suppressions of numbered user warnings * for the current line. */ -static unsigned long long UserLineSuppressions; +static uint64_t UserLineSuppressions; static unsigned long Line; @@ -344,7 +344,7 @@ static char *PreProcess(void) if (!NoLineSupp) { int error; - const int MaxSuppressionBits = sizeof(unsigned long long)*8-1; + const int MaxSuppressionBits = 63; /* Convert to lowercase to compare with LineSuppDelim */ EscapePtr = ++TmpPtr; /* move past NUL terminator */ @@ -365,13 +365,13 @@ static char *PreProcess(void) } if (error > 0) { - FileSuppressions |= (1LL << error); - LineSuppressions |= (1LL << error); + FileSuppressions |= ((uint64_t)1 << error); + LineSuppressions |= ((uint64_t)1 << error); } else { - UserFileSuppressions |= (1LL << (-error)); - UserLineSuppressions |= (1LL << (-error)); + UserFileSuppressions |= ((uint64_t)1 << (-error)); + UserLineSuppressions |= ((uint64_t)1 << (-error)); } } TmpPtr = EscapePtr; @@ -388,11 +388,11 @@ static char *PreProcess(void) if (error > 0) { - LineSuppressions |= (1LL << error); + LineSuppressions |= ((uint64_t)1 << error); } else { - UserLineSuppressions |= (1LL << (-error)); + UserLineSuppressions |= ((uint64_t)1 << (-error)); } } } @@ -882,11 +882,11 @@ static void CheckRest(void) while (offset < len) { /* Check if this warning should be suppressed. */ - if (UserLineSuppressions != 0LL && NamedWarning) + if (UserLineSuppressions && NamedWarning) { /* The warning can be named with positive or negative numbers. */ int UserWarningNumber = abs(atoi(ErrMessage)); - if (UserLineSuppressions & (1LL << UserWarningNumber)) + if (UserLineSuppressions & ((uint64_t)1 << UserWarningNumber)) { break; } diff --git a/Build/source/texk/chktex/chktex-1.7.1/OpSys.c b/Build/source/texk/chktex/chktex-1.7.1/OpSys.c index d2891b08581..3c6ad702bcb 100644 --- a/Build/source/texk/chktex/chktex-1.7.1/OpSys.c +++ b/Build/source/texk/chktex/chktex-1.7.1/OpSys.c @@ -37,6 +37,10 @@ #include "OpSys.h" #include "Utility.h" +#ifdef KPATHSEA +#include <kpathsea/variable.h> +#endif + #ifdef HAVE_SYS_STAT_H # include <sys/stat.h> #endif @@ -105,6 +109,8 @@ static char term_buffer[2048]; #ifdef __MSDOS__ # define LOCALRCFILE RCBASENAME +#elif defined(WIN32) +# define LOCALRCFILE RCBASENAME #else # define LOCALRCFILE "." RCBASENAME #endif @@ -173,6 +179,8 @@ int SetupVars(void) #ifdef __MSDOS__ if ((Env = getenv("CHKTEXRC")) || (Env = getenv("CHKTEX_HOME"))) +#elif defined(TEX_LIVE) + if ((Env = kpse_var_value("CHKTEXRC"))) #else if ((Env = getenv("CHKTEXRC"))) @@ -181,6 +189,9 @@ int SetupVars(void) { strcpy(ConfigFile, Env); tackon(ConfigFile, LOCALRCFILE); +#ifdef TEX_LIVE + free(Env); +#endif } else #ifdef __MSDOS__ @@ -217,24 +228,20 @@ int SetupVars(void) break; case liSysDir: /* System dir for resource files */ #ifdef TEX_LIVE - if ((Env = getenv("CHKTEX_CONFIG"))) + if ((Env = kpse_var_value("CHKTEX_CONFIG"))) { strcpy(ConfigFile, Env); + free(Env); } - else + else if ((Env = kpse_var_value("TEXMFMAIN"))) { - FILE *f; - *ConfigFile = 0; - if ((f = popen("kpsewhich -expand-var='$TEXMFMAIN'", "r"))) - { - if (1 == fscanf(f, "%1024s", ConfigFile)) - { - tackon(ConfigFile, "chktex"); - tackon(ConfigFile, RCBASENAME); - } - (void)pclose(f); - } + strcpy(ConfigFile, Env); + tackon(ConfigFile, "chktex"); + tackon(ConfigFile, RCBASENAME); + free(Env); } + else + *ConfigFile = 0; #else /* TEX_LIVE */ #if defined(__unix__) || defined(__MSDOS__) strcpy(ConfigFile, SYSCONFDIR); diff --git a/Build/source/texk/chktex/chktex-1.7.1/Resource.c b/Build/source/texk/chktex/chktex-1.7.1/Resource.c index 68a4b3196e5..f589d65d0a7 100644 --- a/Build/source/texk/chktex/chktex-1.7.1/Resource.c +++ b/Build/source/texk/chktex/chktex-1.7.1/Resource.c @@ -75,7 +75,7 @@ struct KeyWord Keys[] = { BIT(Equal), /* = */ \ BIT(Word), /* Keyword */ \ BIT(Item) /* List item */ \ -}; +} #undef BIT #define BIT BITDEF1 @@ -323,7 +323,7 @@ static enum Token ReadWord(char *Buffer, FILE * fh) #define DONEKEY (FLG_Open | FLG_Equal | FLG_BrOpen) #define DONELIST (FLG_Close | FLG_BrClose) -#define TOKEN(c, ctxt, tk) case c: if(Expect & (ctxt)) Retval = tk; LAST(token); +#define TOKEN(c, ctxt, tk) case c: if(Expect & (ctxt)) Retval = tk; LAST(token) LOOP(token, TOKEN('{', DONEKEY, FLG_Open); @@ -331,7 +331,7 @@ static enum Token ReadWord(char *Buffer, FILE * fh) TOKEN('=', DONEKEY, FLG_Equal); TOKEN(']', DONELIST, FLG_BrClose); TOKEN('}', DONELIST, FLG_Close); - ); + ) if (Retval != FLG_Eof) { OnceMore = FALSE; diff --git a/Build/source/texk/chktex/chktex-1.7.1/configure.in b/Build/source/texk/chktex/chktex-1.7.1/configure.in index eacc296d951..bedb8d4b1a7 100644 --- a/Build/source/texk/chktex/chktex-1.7.1/configure.in +++ b/Build/source/texk/chktex/chktex-1.7.1/configure.in @@ -158,6 +158,7 @@ dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_SIZE_T +AC_TYPE_UINT64_T dnl Checks for library functions. AC_FUNC_VPRINTF diff --git a/Build/source/texk/texlive/linked_scripts/scripts.lst b/Build/source/texk/texlive/linked_scripts/scripts.lst index d9687ff40c2..ef447403826 100644 --- a/Build/source/texk/texlive/linked_scripts/scripts.lst +++ b/Build/source/texk/texlive/linked_scripts/scripts.lst @@ -9,6 +9,7 @@ texlive/rungs.tlu texlive/tlmgr.pl ' texmf_dist_scripts=' +adhocfilelist/adhocfilelist.sh bibexport/bibexport.sh installfont/installfont-tl latexfileversion/latexfileversion |