From 0a1e75ee98dd6caa88dd7566007ab4c6c8511544 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Fri, 10 Dec 2010 11:22:05 +0000 Subject: texk/lacheck build: use orig source from ctan + patches git-svn-id: svn://tug.org/texlive/trunk@20707 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/README | 3 +- Build/source/texk/lacheck/ChangeLog | 8 +- Build/source/texk/lacheck/Makefile.am | 29 +- Build/source/texk/lacheck/Makefile.in | 57 +- Build/source/texk/lacheck/configure | 2 +- Build/source/texk/lacheck/configure.ac | 6 +- .../texk/lacheck/lacheck-1.26-PATCHES/ChangeLog | 12 + .../texk/lacheck/lacheck-1.26-PATCHES/TL-Changes | 9 + .../lacheck/lacheck-1.26-PATCHES/patch-01-WIN32 | 14 + .../lacheck/lacheck-1.26-PATCHES/patch-02-ANSI | 176 ++++ .../lacheck-1.26-PATCHES/patch-03-unsigned-char | 56 + .../lacheck/lacheck-1.26-PATCHES/patch-04-manpage | 18 + Build/source/texk/lacheck/lacheck-1.26/Makefile | 97 ++ Build/source/texk/lacheck/lacheck-1.26/lacheck.hlp | 118 +++ Build/source/texk/lacheck/lacheck-1.26/lacheck.l | 1107 +++++++++++++++++++ Build/source/texk/lacheck/lacheck-1.26/lacheck.man | 110 ++ .../source/texk/lacheck/lacheck-1.26/make_vms.com | 16 + Build/source/texk/lacheck/lacheck-1.26/test.old | 33 + Build/source/texk/lacheck/lacheck-1.26/test.tex | 42 + Build/source/texk/lacheck/lacheck.c | 193 ++-- Build/source/texk/lacheck/lacheck.hlp | 118 --- Build/source/texk/lacheck/lacheck.l | 1108 -------------------- Build/source/texk/lacheck/lacheck.man | 113 -- Build/source/texk/lacheck/lacheck.test | 8 +- Build/source/texk/lacheck/make_vms.com | 16 - Build/source/texk/lacheck/test.out | 33 - Build/source/texk/lacheck/test.tex | 42 - 27 files changed, 1972 insertions(+), 1572 deletions(-) create mode 100644 Build/source/texk/lacheck/lacheck-1.26-PATCHES/ChangeLog create mode 100644 Build/source/texk/lacheck/lacheck-1.26-PATCHES/TL-Changes create mode 100644 Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-01-WIN32 create mode 100644 Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-02-ANSI create mode 100644 Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-03-unsigned-char create mode 100644 Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-04-manpage create mode 100644 Build/source/texk/lacheck/lacheck-1.26/Makefile create mode 100644 Build/source/texk/lacheck/lacheck-1.26/lacheck.hlp create mode 100644 Build/source/texk/lacheck/lacheck-1.26/lacheck.l create mode 100644 Build/source/texk/lacheck/lacheck-1.26/lacheck.man create mode 100644 Build/source/texk/lacheck/lacheck-1.26/make_vms.com create mode 100644 Build/source/texk/lacheck/lacheck-1.26/test.old create mode 100644 Build/source/texk/lacheck/lacheck-1.26/test.tex delete mode 100644 Build/source/texk/lacheck/lacheck.hlp delete mode 100644 Build/source/texk/lacheck/lacheck.l delete mode 100644 Build/source/texk/lacheck/lacheck.man delete mode 100644 Build/source/texk/lacheck/make_vms.com delete mode 100644 Build/source/texk/lacheck/test.out delete mode 100644 Build/source/texk/lacheck/test.tex (limited to 'Build/source/texk') diff --git a/Build/source/texk/README b/Build/source/texk/README index bfb9c58dead..b75ad32e621 100644 --- a/Build/source/texk/README +++ b/Build/source/texk/README @@ -66,7 +66,8 @@ gsftopk - from Paul Vojta's xdvi? kpathsea - maintained here by Karl Berry, Akira Kakuto, ... -lacheck - ? +lacheck - checked 10dec10 + http://mirror.ctan.org/support/lacheck/lacheck-1.26.tar.gz lcdf-typetools - checked 04oct10 http://www.lcdf.org/type/ diff --git a/Build/source/texk/lacheck/ChangeLog b/Build/source/texk/lacheck/ChangeLog index b3751189c83..a676c93d4db 100644 --- a/Build/source/texk/lacheck/ChangeLog +++ b/Build/source/texk/lacheck/ChangeLog @@ -1,3 +1,8 @@ +2010-12-10 Peter Breitenlohner + + * Import original lacheck-1.26, patches in lacheck-1.26-PATCHES. + * Makefile.am, configure.ac, lacheck.test: Adapted. + 2010-02-20 Peter Breitenlohner * lacheck.l: Do not #include for MinGW32. @@ -7,7 +12,7 @@ Avoid maximal compiler warnings. * lacheck.l (push): Change param1 from 'unsigned char *' to 'const char *'. - (struct tex_group}: Change member s_name from 'unsigned char *' + (struct tex_group): Change member s_name from 'unsigned char *' to 'char *' and drop or adjust casts accordingly. 2009-06-16 Peter Breitenlohner @@ -52,6 +57,7 @@ Tue Jan 27 14:32:25 1998 Sebastian Rahtz * configure etc: new configure.in, c-auto.in, Makefile.in from Olaf Weber + Tue Jan 27 13:57:52 1998 Sebastian Rahtz * Makefile.in: depend inclusion diff --git a/Build/source/texk/lacheck/Makefile.am b/Build/source/texk/lacheck/Makefile.am index a3b9c05e491..a3070bf2302 100644 --- a/Build/source/texk/lacheck/Makefile.am +++ b/Build/source/texk/lacheck/Makefile.am @@ -1,36 +1,39 @@ ## Makefile.am for the TeX Live subdirectory texk/lacheck/ ## -## Copyright (C) 2009 Peter Breitenlohner +## Copyright (C) 2009, 2010 Peter Breitenlohner ## You may freely use, modify and/or distribute this file. ## ACLOCAL_AMFLAGS = -I ../../m4 +LACHECK_TREE = lacheck-$(REV) + +## We want to re-distribute the whole original lacheck source tree. +EXTRA_DIST = $(LACHECK_TREE) +## Patches applied to the original source tree +EXTRA_DIST += $(LACHECK_TREE)-PATCHES + +# in case of an SVN repository +dist-hook: + rm -rf `find $(distdir) -name .svn` + AM_CFLAGS = $(WARNING_CFLAGS) bin_PROGRAMS = lacheck -lacheck_SOURCES = lacheck.l +lacheck_SOURCES = $(LACHECK_TREE)/lacheck.l nodist_man1_MANS = lacheck.1 -lacheck.1: lacheck.man +lacheck.1: $(LACHECK_TREE)/lacheck.man sed -e "s!%%LACHECKREV%%!Release $(REV)!" \ - -e "s!%%LACHECKDATE%%!`date +%Y-%m-%d`!" \ -e "s!%%LACHECKPATH%%!lacheck!" $< > $@ -EXTRA_DIST = lacheck.man - CLEANFILES = lacheck.1 dist_check_SCRIPTS = lacheck.test TESTS = lacheck.test +TESTS_ENVIRONMENT = LACHECK_TREE=$(LACHECK_TREE) -EXTRA_DIST += test.tex test.out - -CLEANFILES += test.xout - -## Not used -## -EXTRA_DIST += lacheck.hlp make_vms.com +CLEANFILES += test.out diff --git a/Build/source/texk/lacheck/Makefile.in b/Build/source/texk/lacheck/Makefile.in index dd75aca344f..b80cd82702c 100644 --- a/Build/source/texk/lacheck/Makefile.in +++ b/Build/source/texk/lacheck/Makefile.in @@ -252,13 +252,15 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I ../../m4 +LACHECK_TREE = lacheck-$(REV) +EXTRA_DIST = $(LACHECK_TREE) $(LACHECK_TREE)-PATCHES AM_CFLAGS = $(WARNING_CFLAGS) -lacheck_SOURCES = lacheck.l +lacheck_SOURCES = $(LACHECK_TREE)/lacheck.l nodist_man1_MANS = lacheck.1 -EXTRA_DIST = lacheck.man test.tex test.out lacheck.hlp make_vms.com -CLEANFILES = lacheck.1 test.xout +CLEANFILES = lacheck.1 test.out dist_check_SCRIPTS = lacheck.test TESTS = lacheck.test +TESTS_ENVIRONMENT = LACHECK_TREE=$(LACHECK_TREE) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -394,6 +396,11 @@ distclean-compile: .l.c: $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) +lacheck.c: $(LACHECK_TREE)/lacheck.l + \ + $(am__skiplex) \ + $(SHELL) $(YLWRAP) `test -f '$(LACHECK_TREE)/lacheck.l' || echo '$(srcdir)/'`$(LACHECK_TREE)/lacheck.l $(LEX_OUTPUT_ROOT).c lacheck.c -- $(LEX) $(LFLAGS) $(AM_LFLAGS) + mostlyclean-libtool: -rm -f *.lo @@ -626,6 +633,9 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ @@ -856,26 +866,29 @@ uninstall-man: uninstall-man1 .PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \ clean clean-binPROGRAMS clean-generic clean-libtool ctags dist \ - dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \ - dist-xz dist-zip distcheck distclean distclean-compile \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-man1 install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-man \ - uninstall-man1 - - -lacheck.1: lacheck.man + dist-all dist-bzip2 dist-gzip dist-hook dist-lzma dist-shar \ + dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-man1 install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-man uninstall-man1 + + +# in case of an SVN repository +dist-hook: + rm -rf `find $(distdir) -name .svn` + +lacheck.1: $(LACHECK_TREE)/lacheck.man sed -e "s!%%LACHECKREV%%!Release $(REV)!" \ - -e "s!%%LACHECKDATE%%!`date +%Y-%m-%d`!" \ -e "s!%%LACHECKPATH%%!lacheck!" $< > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/Build/source/texk/lacheck/configure b/Build/source/texk/lacheck/configure index 9e7b2457349..696b388ef19 100755 --- a/Build/source/texk/lacheck/configure +++ b/Build/source/texk/lacheck/configure @@ -575,7 +575,7 @@ PACKAGE_STRING='LaCheck for TeX Live 1.26' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' -ac_unique_file="lacheck.l" +ac_unique_file="lacheck-1.26/lacheck.l" # Factoring default headers for most tests. ac_includes_default="\ #include diff --git a/Build/source/texk/lacheck/configure.ac b/Build/source/texk/lacheck/configure.ac index 2faa6aac44d..64f92008001 100644 --- a/Build/source/texk/lacheck/configure.ac +++ b/Build/source/texk/lacheck/configure.ac @@ -1,15 +1,15 @@ dnl Process this file with autoconf to produce a configure script. dnl -dnl Copyright (C) 2009 Peter Breitenlohner +dnl Copyright (C) 2009, 2010 Peter Breitenlohner dnl 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 -m4_define([lacheck_version], [1.26]) +m4_define([lacheck_version], [1.26])[]dnl using unmodified lacheck source tree AC_INIT([LaCheck for TeX Live], lacheck_version, [tex-k@tug.org]) AC_PREREQ([2.65]) -AC_CONFIG_SRCDIR([lacheck.l]) +AC_CONFIG_SRCDIR([lacheck-]lacheck_version[/lacheck.l]) AC_CONFIG_AUX_DIR([../../build-aux]) AC_CONFIG_MACRO_DIR([../../m4]) diff --git a/Build/source/texk/lacheck/lacheck-1.26-PATCHES/ChangeLog b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/ChangeLog new file mode 100644 index 00000000000..7f8601fc99b --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/ChangeLog @@ -0,0 +1,12 @@ +2010-12-10 Peter Breitenlohner + + Patches applied to lacheck-1.26 as obtained from CTAN. + * patch-01-WIN32 (new): #include for WIN32, but not + for __MINGW32__. + * patch-02-ANSI (new): ANSI C function protos and definitions. + Declare param1 of push() as const. Avoid ambiguous `else'. + Define yywrap() after flex-provided prototype. + * patch-03-unsigned-char (new): Change param1 of push() and + member s_name of struct tex_group from 'unsigned char *' to + 'char *' and drop or adjust casts accordingly. + * patch-04-manpage (new): Formatting. Avoid use of build date. \ No newline at end of file diff --git a/Build/source/texk/lacheck/lacheck-1.26-PATCHES/TL-Changes b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/TL-Changes new file mode 100644 index 00000000000..c7c52c5df80 --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/TL-Changes @@ -0,0 +1,9 @@ +Changes applied to the lacheck-1.26 tree as obtained from: + http://mirror.ctan.org/support/lacheck/lacheck-1.26.tar.gz + +Renamed: + lacheck.lex -> lacheck.l + +Removed: + lacheck.c + diff --git a/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-01-WIN32 b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-01-WIN32 new file mode 100644 index 00000000000..4baf9b833c9 --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-01-WIN32 @@ -0,0 +1,14 @@ +diff -ur -x lacheck.c lacheck-1.26.orig/lacheck.l lacheck-1.26/lacheck.l +--- lacheck-1.26.orig/lacheck.l 1998-03-07 08:47:31.000000000 +0100 ++++ lacheck-1.26/lacheck.l 2010-02-20 12:35:04.000000000 +0100 +@@ -117,6 +117,10 @@ + + #include + #include ++ ++#if defined(WIN32) && !defined(__MINGW32__) ++#include ++#endif + /* #include */ + + /* extern char *realloc(); */ diff --git a/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-02-ANSI b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-02-ANSI new file mode 100644 index 00000000000..bb6654b4ef7 --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-02-ANSI @@ -0,0 +1,176 @@ +diff -ur lacheck-1.26.orig/lacheck.l lacheck-1.26/lacheck.l +--- lacheck-1.26.orig/lacheck.l 2010-02-20 12:35:04.000000000 +0100 ++++ lacheck-1.26/lacheck.l 2010-12-09 23:22:45.000000000 +0100 +@@ -125,8 +125,6 @@ + + /* extern char *realloc(); */ + +-int yywrap() { return 1; } +- + #ifdef NEED_STRSTR + char *strstr(); + #endif +@@ -144,16 +142,16 @@ + #define CG_ITALIC gstack[gstackp-1].italic + #define CG_FILE gstack[gstackp-1].s_file + +-char *bg_command(); +-void pop(); +-void push(); +-void linecount(); +-void g_checkend(); +-void e_checkend(); +-void f_checkend(); +-void input_file(); +-void print_bad_match(); +-int check_top_level_end(); ++char *bg_command(char *name); ++void pop(void); ++void push(const char *p_name, int p_type, int p_line); ++void linecount(void); ++void g_checkend(int n); ++void e_checkend(int n, char *name); ++void f_checkend(char *name); ++void input_file(char *file_nam); ++void print_bad_match(char *end_command, int type); ++int check_top_level_end(char *end_command, int type); + + /* global variables */ + +@@ -764,9 +762,7 @@ + + . { ; } + %% +-int main( argc, argv ) +-int argc; +-char *argv[]; ++int main(int argc, char *argv[]) + { + /* allocate initial stacks */ + gstack = (tex_group *)malloc(gstack_size * sizeof(tex_group)); +@@ -824,6 +820,8 @@ + return(0); + } + ++int yywrap(void) { return 1; } ++ + #ifdef NEED_STRSTR + char * + strstr(string, substring) +@@ -860,10 +858,7 @@ + } + #endif /* NEED_STRSTR */ + +-void push(p_name, p_type, p_line) +-unsigned char *p_name; +-int p_type; +-int p_line; ++void push(const unsigned char *p_name, int p_type, int p_line) + { + if ( gstackp == gstack_size ) { /* extend stack */ + gstack_size *= 2; +@@ -895,8 +890,7 @@ + + } + +-void input_file(file_nam) +-char *file_nam; ++void input_file(char *file_nam) + { + char *tmp_file_name; + FILE *tmp_yyin; +@@ -953,7 +947,7 @@ + } + } + +-void pop() ++void pop(void) + { + if ( gstackp == 0 ) + { +@@ -966,8 +960,7 @@ + free(gstack[gstackp].s_file); + } + +-char *bg_command(name) +-char *name; ++char *bg_command(char *name) + { + + switch (CG_TYPE) { +@@ -1001,9 +994,7 @@ + return ((char *)returnval); + } + +-char *eg_command(name,type) +-int type; +-char *name; ++static char *eg_command(char *name, int type) + { + + switch (type) { +@@ -1038,19 +1029,18 @@ + } + + +-void g_checkend(n) +-int n; ++void g_checkend(int n) + { + if ( check_top_level_end(yytext,n) == 1 ) ++ { + if ( CG_TYPE != n ) + print_bad_match(yytext,n); + else + pop(); ++ } + } + +-void e_checkend(n, name) +-int n; +-char *name; ++void e_checkend(int n, char *name) + { + if ( check_top_level_end(name,n) == 1 ) + { +@@ -1062,8 +1052,7 @@ + } + } + +-void f_checkend(name) +-char *name; ++void f_checkend(char *name) + { + if ( check_top_level_end(name,3) == 1 ) + { +@@ -1079,9 +1068,7 @@ + } + } + +-void print_bad_match(end_command,type) +-char *end_command; +-int type; ++void print_bad_match(char *end_command, int type) + { + printf("\"%s\", line %d: <- unmatched \"%s\"\n", + file_name, +@@ -1095,9 +1082,7 @@ + warn_count += 2; + } + +-int check_top_level_end(end_command,type) +-char *end_command; +-int type; ++int check_top_level_end(char *end_command, int type) + { + if ( gstackp == 0 ) + { +@@ -1112,7 +1097,7 @@ + return(1); + } + +-void linecount() ++void linecount(void) + { + int i; + for (i = 0; i < yyleng; i++) diff --git a/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-03-unsigned-char b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-03-unsigned-char new file mode 100644 index 00000000000..e5b07bcfee0 --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-03-unsigned-char @@ -0,0 +1,56 @@ +diff -ur lacheck-1.26.orig/lacheck.l lacheck-1.26/lacheck.l +--- lacheck-1.26.orig/lacheck.l 2010-12-09 23:22:45.000000000 +0100 ++++ lacheck-1.26/lacheck.l 2010-12-09 23:25:22.000000000 +0100 +@@ -136,7 +136,7 @@ + + /* macros */ + +-#define CG_NAME (char *)gstack[gstackp-1].s_name ++#define CG_NAME gstack[gstackp-1].s_name + #define CG_TYPE gstack[gstackp-1].s_type + #define CG_LINE gstack[gstackp-1].s_line + #define CG_ITALIC gstack[gstackp-1].italic +@@ -165,7 +165,7 @@ + + typedef struct tex_group + { +- unsigned char *s_name; ++ char *s_name; + int s_type; + int s_line; + int italic; +@@ -467,7 +467,7 @@ + + \\begingroup/[^a-zA-Z] { + { +- push((unsigned char *)"\\begingroup", 1, line_count); ++ push("\\begingroup", 1, line_count); + }} + + +@@ -858,7 +858,7 @@ + } + #endif /* NEED_STRSTR */ + +-void push(const unsigned char *p_name, int p_type, int p_line) ++void push(const char *p_name, int p_type, int p_line) + { + if ( gstackp == gstack_size ) { /* extend stack */ + gstack_size *= 2; +@@ -870,14 +870,14 @@ + } + + if ( (gstack[gstackp].s_name = +- (unsigned char *)malloc(strlen((char *)p_name) + 1)) == NULL || ++ (char *)malloc(strlen(p_name) + 1)) == NULL || + (gstack[gstackp].s_file = + (char *)malloc(strlen(file_name) + 1)) == NULL ) { + fprintf(stderr, "%s: out of memory\n", PROGNAME); + exit(3); + } + +- strcpy((char *)gstack[gstackp].s_name,(char *)p_name); ++ strcpy(gstack[gstackp].s_name, p_name); + gstack[gstackp].s_type = p_type; + gstack[gstackp].s_line = p_line; + gstack[gstackp].italic = ( (p_type == 4 || p_type == 5) diff --git a/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-04-manpage b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-04-manpage new file mode 100644 index 00000000000..1e482cfbb63 --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26-PATCHES/patch-04-manpage @@ -0,0 +1,18 @@ +diff -ur lacheck-1.26.orig/lacheck.man lacheck-1.26/lacheck.man +--- lacheck-1.26.orig/lacheck.man 1998-03-07 08:47:31.000000000 +0100 ++++ lacheck-1.26/lacheck.man 2010-12-10 11:38:32.032814793 +0100 +@@ -1,12 +1,9 @@ +-.TH "LaCheck" "1" "%%LACHECKDATE%%" "%%LACHECKREV%%" ++.TH "LaCheck" "1" "2010-12-10" "%%LACHECKREV%%" + .SH NAME + lacheck - A consistency checker for LaTeX documents. + .SH SYNOPSIS + .B lacheck +-.I filename +-[ +-.I .tex +-] ++.IR filename [ \fB.tex\fP ] + .SH DESCRIPTION + LaCheck is a general purpose consistency checker for LaTeX documents. + It reads a LaTeX document and displays warning messages, if it finds diff --git a/Build/source/texk/lacheck/lacheck-1.26/Makefile b/Build/source/texk/lacheck/lacheck-1.26/Makefile new file mode 100644 index 00000000000..a7e2b5aeee0 --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26/Makefile @@ -0,0 +1,97 @@ +# Makefile for lacheck. + +# If both flex lacheck.c are missing, copy lacheck.noflex.c to +# lacheck.c. + +prefix = /usr/local +exec_prefix = $(prefix) + +bindir = $(exec_prefix)/bin +mandir = $(prefix)/man/man1 +manext = .1 +srcdir = . + +# Use `cc -bsd' on a next +# use `cc -cckr' on a sgi +# CC = gcc -traditional +CC=cc + +CFLAGS = -g # -O -DNEED_STRSTR + +# No changes should be needed below + +# Remember to change when lacheck is updated. +REV = 1.26 + +DISTFILES = lacheck.lex lacheck.man Makefile lacheck.c test.tex test.old \ + lacheck.hlp make_vms.com + +FTPDIR = /home/ftp/pub/Staff/Per.Abrahamsen/mirror/ftp/lacheck + +SHELL = /bin/sh + +LACHECK=lacheck + +INSTALL = cp +INSTALL_PROGRAM = $(INSTALL) +INSTALL_DATA = $(INSTALL) + +FLEX = flex +FLEXFLAGS = -8 + +LIBS= #-ll + +$(LACHECK): lacheck.o + $(CC) $(CFLAGS) -o $@ $(srcdir)/lacheck.o $(LIBS) + +lacheck.c: lacheck.lex + -if [ ! -f $(srcdir)/lacheck.noflex.c ] ; then \ + if [ -f $(srcdir)/lacheck.c ] ; then \ + $(INSTALL_DATA) $(srcdir)/lacheck.c $(srcdir)/lacheck.noflex.c ; \ + fi ; \ + fi + $(FLEX) $(FLEXFLAGS) $(srcdir)/lacheck.lex + mv $(srcdir)/lex.yy.c $@ + +lacheck.1: lacheck.man + -sed -e "s!%%LACHECKREV%%!Release $(REV)!" $(srcdir)/lacheck.man |\ + sed -e "s!%%LACHECKDATE%%!`date +%D`!" |\ + sed -e "s!%%LACHECKPATH%%!$(bindir)/$(LACHECK)!" > $@ + +test.new: test.tex $(LACHECK) + $(srcdir)/$(LACHECK) $(srcdir)/test.tex > $@ + +test.old: test.tex $(LACHECK) + $(srcdir)/$(LACHECK) $(srcdir)/test.tex > $@ + +check: test.new + -diff $(srcdir)/test.old $(srcdir)/test.new + +install: $(LACHECK) lacheck.1 + cp $(srcdir)/$(LACHECK) $(bindir) + cp $(srcdir)/lacheck.1 $(mandir)/lacheck$(manext) + +uninstall: + -rm -f $(bindir)/$(LACHECK) $(mandir)/lacheck$(manext) + +clean: + -rm -f $(srcdir)/$(LACHECK) $(srcdir)/*.o $(srcdir)/*.1 $(srcdir)/*~ + +distclean: clean + +mostlyclean: clean + -rm -f $(srcdir)/lacheck.c $(srcdir)/lacheck.noflex.c + +realclean: mostlyclean + -rm -f test.old + +dist: $(DISTFILES) + mkdir lacheck-$(REV) + cp $(DISTFILES) lacheck-$(REV) + touch lacheck-$(REV)/lacheck.c + -rm -f $(FTPDIR)/lacheck-$(REV).tar.gz + -rm -f $(FTPDIR)/lacheck.tar.gz $(FTPDIR)/lacheck.tar.Z + tar -cf - lacheck-$(REV) | gzip > $(FTPDIR)/lacheck-$(REV).tar.gz + tar -cf - lacheck-$(REV) | compress > $(FTPDIR)/lacheck-$(REV).tar.Z + (cd $(FTPDIR); ln -s lacheck-$(REV).tar.gz lacheck.tar.gz) + diff --git a/Build/source/texk/lacheck/lacheck-1.26/lacheck.hlp b/Build/source/texk/lacheck/lacheck-1.26/lacheck.hlp new file mode 100644 index 00000000000..b99a0e91a47 --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26/lacheck.hlp @@ -0,0 +1,118 @@ +1 LaCheck + +A consistency checker for LaTeX documents. + + LaCheck filename[.tex] + +2 DESCRIPTION + +LaCheck is a general purpose consistency checker for LaTeX documents. +It reads a LaTeX document and displays warning messages, if it finds +bad sequences. It should be noted, that the badness is very +subjective. LaCheck is designed to help find common mistakes in LaTeX +documents, especially those made by beginners. + +The things checked are: Mismatched groups (braces), environments and +math mode delimiters. When a mismatch is found, line numbers for +"both" start and end of the mismatch is given. The error messages +comes in pairs, one for the end match and one for the beginning, +marked with `<-' and `->' respectively. + +Bad spacing including missing a `\' after an abbreviation, missing an +`\@' before a punctuation mark in a paragraph that is ended by an +capital letter, double spaces like ` ~', bad usage of ellipsis (like +using ... instead of \ldots, or using \ldots where \cdots should be +used), missing \~ before a \cite or \ref commands, space before +footnotes, italic corrections before comma, point, or italic text, +italic correction after normal text, missing italic correction when +switching from italic to normal text, and double italic correction. + +Badly placed punctuation marks around end of math mode delimiters. +This is, pucktuation placed right after display math end or +punctuation placed right before text math end. Sequences of +whitespace followed by punctuation marks are also caught. Bad use of +quotation characters, i.e. constructs like "\'word" or "word\`" are +warned about, tabs in verbatim environments are caught, certain TeX +primitives are frowned upon, attempts to give font specifiers +arguments such as \em{text} are noted, and use of @ in LaTeX macros +are reported. + +LaCheck will read files that are input using \input or \include. Files +with suffix `.sty' are omitted, as they probably will cause LaCheck to +crash. + +2 USAGE + + LaCheck filename[.tex] + +LaCheck may be invoked from within Emacs using compile: + +To run: +"M-x compile RET lacheck RET" +, and then +"C-x `" +to parse the messages + +2 OUTPUT + +The output is UNIX-error like, and may be parsed using Emacs compile +mode. Here is a sample: + +0 +lacheck compiler + +"/usr/mef/compiler.tex", line 34: missing `\' after "etc." + +"/usr/mef/compiler.tex", line 179: double space at " ~" + +"/usr/mef/compiler.tex", line 186: <- unmatched "}" + +"/usr/mef/compiler.tex", line 181: -> unmatched "$$" +1 + +A control space `\\ ' should be inserted at line 34, to prevent an +end-of-sentence space. +Also, at line 179, the first space of the sequence " ~" should +probably be deleted. +The last two lines is an example, where the user mistyped, and +probably inserted an extra "}" somewhere. + +2 DIAGNOSTICS + +Some special cases should be explained. In cases where a sentence ends +with something that LaCheck thinks is an abbreviation an missing `\\' +error may also occur, if the following sentence begins with a +lowercase letter. + +A mismatch error may cause more to follow, due to the chosen +algorithm. In such cases just correct the "first" error and run +LaCheck again + +Braces, environments and math mode must be balanced within a file. + +LaCheck may be confused by unmatched stuff placed inside verbatim-like +environments called something else than exactly `verbatim'. + +2 FILES + +Source: TEX_DISK:[TEX.TEX__SOURCE.LACHECK] + +Executable: TEX_EXE:LACHECK.EXE + +SEE ALSO +TeX, emacs, LaTeX + +2 BUGS + +LaCheck gets confused by advanced macros, is fooled by simple macros, +can't figure out if you use a non-standard way to switch italic on or +off, does not like TeX at all, does not provide any options to turn +off specific warnings, and is at best a crude approximation. + +Ideas for improvements and bug reports are very welcome. Such should +be directed to the maintainers, their email address is +. + +2 AUTHOR +Kresten Krab Thorup with modifications by Per Abrahamsen. + diff --git a/Build/source/texk/lacheck/lacheck-1.26/lacheck.l b/Build/source/texk/lacheck/lacheck-1.26/lacheck.l new file mode 100644 index 00000000000..b6fd1ba5ceb --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26/lacheck.l @@ -0,0 +1,1107 @@ +/* -*- Mode: C -*- + * + * lacheck.lex - A consistency checker checker for LaTeX documents + * + * Copyright (C) 1991, 1992 Kresten Krab Thorup. + * Copyright (C) 1993 --- 1998 Per Abrahamsen. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 1, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Please send bugs, suggestions, and queries to auc-tex_mgr@sunsite.auc.dk. + * + * $Revision: 1.26 $ + * Author : Kresten Krab Thorup + * Created On : Sun May 26 18:11:58 1991 + * + * HISTORY + * 07-Mar-1998 Per Abrahamsen + * Added return to yywrap. Patch by Fabrice POPINEAU + * . + * 14-Jan-1998 Per Abrahamsen + * Added GPL blurp. + * 27-Oct-1997 Per Abrahamsen + * Count newline after newenvironment and newcommand. + * 12-Jan-1996 Per Abrahamsen + * \\} used not to end a group in definitions. Reported by Piet + * van Oostrum . + * 03-Jan-1995 Per Abrahamsen + * Fix bug which prevented detection of multiple illegal characters + * in labels. Reported by eeide@jaguar.cs.utah.edu (Eric Eide). + * 30-Jul-1994 Per Abrahamsen + * Define dummy yywrap so we no longer depend on `libl.a'. + * 26-Apr-1994 Per Abrahamsen + * Removed a few warnings, by Richard Lloyd . + * 23-Apr-1994 Per Abrahamsen + * Changed all `%i' to `%d' for VMS portability. Reported by + * Stephen Harker . + * 16-Feb-1994 Per Abrahamsen + * Try file name with `.tex' appended before trying it bare. This + * will make the case where a directory and a TeX file share the + * same name work. + * 19-Jan-1994 Per Abrahamsen + * Comments don't imply whitespace. Pointed out by Jacco van + * Ossenbruggen . + * 14-Jan-1994 Per Abrahamsen + * Don't complain about \ref at the beginning of a paragraph. + * Suggested by Jean-Marc Lasgouttes . + * 11-Jan-1994 Per Abrahamsen + * Added version string to usage message. Suggested by Uwe Bonnes + * . + * 04-Jan-1994 Per Abrahamsen + * Warn about newlines in \verb. Suggested by Mark Burton + * . The LaTeX Book agrees (p. 168). + * 10-Sep-1993 Per Abrahamsen + * Removed complain about missing ~ before \cite. Requested by + * Nelson H. F. Beebe . The LaTeX Book seems + * to agree. + * 03-Sep-1993 Per Abrahamsen + * Check for illegal characters in labels. + * 16-Aug-1993 Per Abrahamsen + * Recognize \endinput. Suggested by Stefan Farestam + * . + * 13-Aug-1993 Per Abrahamsen + * } was eaten after display math. Reported by Eckhard Rüggeberg + * . + * 13-Aug-1993 Per Abrahamsen + * Recognize \verb*. Reported by Eckhard Rüggeberg + * . + * 08-Aug-1993 Per Abrahamsen + * Better catch begin and end without arguments. + * 08-Aug-1993 Per Abrahamsen + * Removed free(NULL) as reported by Darrel R. Hankerson + * . + * 08-Aug-1993 Per Abrahamsen + * Removed declaration of realloc for some C compilers. Reported by + * Darrel R. Hankerson + * 30-Jul-1993 Per Abrahamsen + * Added check for italic correction after normal text. + * 29-Jul-1993 Per Abrahamsen + * Added cast for (char*) malloc as suggested by John Interrante + * . + * 29-Jul-1993 Per Abrahamsen + * Added check for missing and extra italic correction. + * 29-Jul-1993 Per Abrahamsen + * Made line number counting more reliable (but it still needs a rewrite)! + * 28-Jul-1993 Per Abrahamsen + * Added check for italic correction before point or comma. + * 6-Jun-1992 Kresten Krab Thorup + * Last Modified: Sat Jun 6 16:37:44 1992 #48 (Kresten Krab Thorup) + * Added test for whitespace before punctuation mark + * 17-Dec-1991 (Last Mod: Tue Dec 17 21:01:24 1991 #41) Kresten Krab Thorup + * Added 'word word` and missing ~ before cite and ref + * 18-Jun-1991 (Last Mod: Tue Jun 18 19:20:43 1991 #17) Kresten Krab Thorup + * Added check (or rather management) for \newenvironment and + * \newcommand - as suggested by Per Abrahamsen abrham@hugin.dk + * 30-May-1991 (Last Mod: Thu May 30 02:22:33 1991 #15) Kresten Krab Thorup + * Added check for `$${punct}' and `{punct}$' constructions + * 30-May-1991 (Last Mod: Wed May 29 10:31:35 1991 #6) Kresten Krab Thorup + * Improved (dynamic) stack management from Andreas Stolcke ... + * + * 26-May-1991 Kresten Krab Thorup + * Initial distribution version. + */ + +%{ + +#include +#include + +#if defined(WIN32) && !defined(__MINGW32__) +#include +#endif +/* #include */ + +/* extern char *realloc(); */ + +#ifdef NEED_STRSTR +char *strstr(); +#endif + +#define GROUP_STACK_SIZE 10 +#define INPUT_STACK_SIZE 10 + +#define PROGNAME "LaCheck" + + /* macros */ + +#define CG_NAME gstack[gstackp-1].s_name +#define CG_TYPE gstack[gstackp-1].s_type +#define CG_LINE gstack[gstackp-1].s_line +#define CG_ITALIC gstack[gstackp-1].italic +#define CG_FILE gstack[gstackp-1].s_file + +char *bg_command(char *name); +void pop(void); +void push(const char *p_name, int p_type, int p_line); +void linecount(void); +void g_checkend(int n); +void e_checkend(int n, char *name); +void f_checkend(char *name); +void input_file(char *file_nam); +void print_bad_match(char *end_command, int type); +int check_top_level_end(char *end_command, int type); + + /* global variables */ + +char returnval[100]; +int line_count = 1; +int warn_count = 0; +char *file_name; +char verb_char; + + /* the group stack */ + +typedef struct tex_group + { + char *s_name; + int s_type; + int s_line; + int italic; + char *s_file; + } tex_group; + +tex_group *gstack; +int gstack_size = GROUP_STACK_SIZE; +int gstackp = 0; + +typedef struct input_ + { + YY_BUFFER_STATE stream; + char *name; + int linenum; + } input_; + +input_ *istack; +int istack_size = INPUT_STACK_SIZE; +int istackp = 0; + +int def_count = 0; + +%} + +%x B_ENVIRONMENT E_ENVIRONMENT VERBATIM INCLUDE MATH COMMENT VERB DEF +%x AFTER_DISPLAY ENV_DEF ICOR GETICOR + +b_group ("{"|\\bgroup) +e_group ("}"|\\egroup) + +b_math \\\( +e_math \\\) +math \$ + +b_display \\\[ +e_display \\\] +display \$\$ + +par ([ \t]*\n[ \t]*\n[ \t\n]*) +non_par_ws ([ \t]+\n?[ \t]*|[ \t]*\n[ \t]*|[ \t]*\n?[ \t]+) + +ws [ \n\t](%[^\n]\n)* +space ({ws}|\~|\\space) +hard_space (\~|\\space) + +u_letter [A-ZÆØÅ] +l_letter [a-zæøå] +punct [\!\.\?] +atoz [a-zA-Z] +letter [A-ZÆØÅa-zæøå] + +c_bin ("-"|"+"|"\\cdot"|"\\oplus"|"\\otimes"|"\\times") +l_bin (",") + +general_abbrev {letter}+{punct} + +non_abbrev {u_letter}{u_letter}+{punct} + +italic_spec (sl|it) +normal_spec normalshape +swap_spec em +font_spec (rm|bf|{italic_spec}|tt|{swap_spec}|mediumseries|{normal_spec}) + +primitive \\(above|advance|catcode|chardef|closein|closeout|copy|count|countdef|cr|crcr|csname|delcode|dimendef|dimen|divide|expandafter|font|hskp|vskip|openout) + +symbol ("$"("\\"{atoz}+|.)"$"|"\\#"|"\\$"|"\\%"|"\\ref") + +%% + +<*>"\\\\" { ; } + +"\\\%" { ; } + +"%"[^\n]*\n { line_count++; } + +\n { line_count++; } + +"\\\{" { ; } + +"\\\}" { ; } + +"\\\$" { ; } + +"{"{ws} { + if (CG_TYPE != 4 && CG_TYPE != 5) { + if (!(CG_TYPE == 2 && strstr(CG_NAME, "array"))) { + printf( "\"%s\", line %d: possible unwanted space at \"{\"\n", + file_name, line_count); + ++warn_count ; + } + } + push( "{", 0, line_count); + linecount(); + } + +{b_group} { push( "{", 0, line_count);} + +{e_group} { + { + int italic = CG_ITALIC; + g_checkend(0); + if (italic && !CG_ITALIC) + BEGIN(GETICOR) ; + else + BEGIN(INITIAL); + }} + +{e_group} { g_checkend(0); } + +[A-Za-zæøåÆØÅ0-9;:!()]+ { + { + if (!CG_ITALIC) + { + printf("\"%s\", line %d: you may need a \\/ before \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + } + BEGIN(INITIAL); + }} + +[A-Za-zæøåÆØÅ0-9;:!?()`']+ { + { + if (CG_ITALIC) + { + printf("\"%s\", line %d: \\/ not needed before italic text \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + } + BEGIN(INITIAL); + }} + +^[A-Za-zæøåÆØÅ0-9;:!?()`',.]+{ws}*/\\\/ { + { + linecount(); + if (!CG_ITALIC) + { + printf("\"%s\", line %d: \\/ not needed after non-italic text \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + } + }} + +{ws}[A-Za-zæøåÆØÅ0-9;:!?()`',.]+{ws}*/\\\/ { + { + linecount(); + if (!CG_ITALIC) + { + printf("\"%s\", line %d: \\/ is not needed after non-italic \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + } + }} + +\\\/ { BEGIN(INITIAL); } + +\\\/ { BEGIN(ICOR); } + +\\\/ { + { + printf("\"%s\", line %d: double \\/ found \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + BEGIN(ICOR); + }} + +\\{italic_spec}/[^a-zA-Z] { CG_ITALIC = 1; } + +\\{normal_spec}/[^a-zA-Z] { + { + if(CG_ITALIC) + BEGIN(GETICOR); + else + BEGIN(INITIAL); + CG_ITALIC = 0; + }} + +\\{normal_spec}/[^a-zA-Z] { CG_ITALIC = 0; } + +\\{swap_spec}/[^a-zA-Z] { + { + if(CG_ITALIC) + BEGIN(GETICOR); + else + BEGIN(INITIAL); + CG_ITALIC = !CG_ITALIC; + }} + +\\{swap_spec}/[^a-zA-Z] { CG_ITALIC = !CG_ITALIC; } + +[,.] { + { + printf("\"%s\", line %d: do not use \\/ before \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + BEGIN(INITIAL); + }} + +{ws} { ; } + +~ { ; } + +[^\n] { + { + unput(yytext[0]); + BEGIN(INITIAL); + }} + +"\\"[exg]?(def|newcommand)[^\n\{]+ BEGIN(DEF); + +{b_group} { ++def_count; } + +{e_group} { --def_count; + if(def_count == 0) + BEGIN(INITIAL); } + +. { ; } + +"\\"newenvironment"{"[a-zA-Z]+"}"[^\n\{]+ BEGIN(ENV_DEF); + +{b_group} { ++def_count; } + +{e_group} { --def_count; + if(def_count == 0) + BEGIN(DEF); } + +. { ; } + +{b_math} { + if(CG_TYPE == 4 || CG_TYPE == 5) + print_bad_match(yytext,4); + else + { + push( yytext, 4, line_count); + }} + +{e_math} { g_checkend(4); } + +{b_display} { + if(CG_TYPE == 4 || CG_TYPE == 5) + print_bad_match(yytext,5); + else + { + push( yytext, 5, line_count); + }} + + +{e_display} { g_checkend(5); BEGIN(AFTER_DISPLAY);} + +{punct} { + + printf( "\"%s\", line %d: punctuation mark \"%s\" should be placed before end of displaymath\n", + file_name, line_count, yytext); + ++warn_count ; + + BEGIN(INITIAL); } + +(\n|.) { unput(yytext[0]); BEGIN(INITIAL); } + +{punct}/("\$"|"\\)") { if (CG_TYPE == 4) + { + printf( "\"%s\", line %d: punctuation mark \"%s\" should be placed after end of math mode\n", + file_name, line_count, yytext); + ++warn_count ; + BEGIN(INITIAL); + }} + +{math} { + + if(CG_TYPE == 5) + print_bad_match(yytext, 4); + else + + if(CG_TYPE == 4) + { + e_checkend(4, yytext); + } + else + { + push( yytext, 4, line_count); + }} + + +{display} { + + if(CG_TYPE == 4) + print_bad_match(yytext,5); + else + + if(CG_TYPE == 5) + { + e_checkend(5, yytext); + BEGIN(AFTER_DISPLAY); + } + else + { + push( yytext, 5, line_count); + }} + +\\begingroup/[^a-zA-Z] { + { + push("\\begingroup", 1, line_count); + }} + + +\\endgroup/[^a-zA-Z] { + { + g_checkend(1); + }} + + +\\begin[ \t]*"{" { BEGIN(B_ENVIRONMENT); } + +\\begin[ \t]*(%[^\n]*)?/\n { + { + + printf("\"%s\", line %d: {argument} missing for \\begin\n", + file_name, line_count) ; + ++warn_count; + }} + +[^\}\n]+ { + { + if (strcmp( yytext, "verbatim" ) == 0 ) + { + input(); + BEGIN(VERBATIM); + } + else + { + push(yytext, 2, line_count); + + if ( strcmp (yytext, "sl" ) == 0 + || strcmp (yytext, "it" ) == 0) + CG_ITALIC = 1; + else if (strcmp (yytext, "normalshape") == 0) + CG_ITALIC = 0; + else if (strcmp (yytext, "em") == 0) + CG_ITALIC = !CG_ITALIC; + + input(); + BEGIN(INITIAL); + } + }} + +\\end[ \t]*\{verbatim\} { BEGIN(INITIAL); } + +\t { + printf("\"%s\", line %d: TAB character in verbatim environment\n", + file_name, line_count) ; + ++warn_count; + } + +. { ; } + +\n { ++line_count; } + + +\\verb\*?. { + verb_char = yytext[yyleng-1]; + BEGIN(VERB); + } + +\n { + printf("\"%s\", line %d: \\verb should not contain end of line characters\n", + file_name, line_count) ; + ++line_count; +} + +. { + if ( *yytext == verb_char ) + BEGIN(INITIAL); +} + + +\\end[ \t]*"{" { BEGIN(E_ENVIRONMENT); } + +\\end[ \t]*(%[^\n]*)?/\n { + { + printf("\"%s\", line %d: {argument} missing for \\end\n", + file_name, line_count) ; + ++warn_count; + }} + + +[^\}\n]+ { + { + e_checkend(2, yytext); + input(); + + BEGIN(INITIAL); + }} + + +{ws}({letter}".")*{letter}*{l_letter}"."/{non_par_ws}+{l_letter} { + { + linecount(); + printf( "\"%s\", line %d: missing `\\ ' after \"%s\"\n", + file_name, line_count, ++yytext); + ++warn_count ; + BEGIN(INITIAL); + }} + +({l_letter}".")*{letter}*{l_letter}"."/{non_par_ws}+{l_letter} { + { + printf( "\"%s\", line %d: missing `\\ ' after \"%s\"\n", + file_name, line_count, yytext); + ++warn_count ; + BEGIN(INITIAL); + }} + +{non_abbrev}/{non_par_ws}{u_letter} { + { + linecount(); + printf("\"%s\", line %d: missing `\\@' before `.' in \"%s\"\n", + file_name, line_count, yytext); + ++warn_count ; + BEGIN(INITIAL); + }} + +({hard_space}{space}|{space}{hard_space}) { + + printf("\"%s\", line %d: double space at \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + linecount(); + BEGIN(INITIAL); + } + +{c_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?\\ldots{ws}?(\\(\.|\,|\;|\:))*{ws}?{c_bin} { + printf("\"%s\", line %d: \\ldots should be \\cdots in \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + linecount(); + } + +[^\\]{l_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?\\cdots{ws}?(\\(\.|\,|\;|\:))*{ws}?[^\\]{l_bin} { + printf("\"%s\", line %d: \\cdots should be \\ldots in \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + linecount(); + BEGIN(INITIAL); + } + +{c_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?"."+{ws}?(\\(\.|\,|\;|\:))*{ws}?{c_bin} { + printf("\"%s\", line %d: Dots should be \\cdots in \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + linecount(); + } + +[^\\]{l_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?"."+{ws}?(\\(\.|\,|\;|\:))*{ws}?[^\\]{l_bin} { + printf("\"%s\", line %d: Dots should be \\ldots in \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + linecount(); + BEGIN(INITIAL); + } + + +\.\.\. { + printf("\"%s\", line %d: Dots should be ellipsis \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + BEGIN(INITIAL); + } + +\\label\{[^#$%^&*+={\~"<>\n\t }]*[#$%^&*+={\~"<>\n\t ][^%}]*\} { + linecount(); + printf("\"%s\", line %d: bad character in label \"%s\", see C.10.2\n", + file_name, line_count, yytext); + } + +{par}"\\"ref/[^A-Za-z] { + linecount(); + BEGIN(INITIAL); + } + +{ws}"\\"ref/[^A-Za-z] { + linecount(); + printf("\"%s\", line %d: perhaps you should insert a `~' before \"%s\"\n", + file_name, line_count, ++yytext); + BEGIN(INITIAL); + } + +{ws}"\\"footnote/[^A-Za-z] { + linecount(); + printf("\"%s\", line %d: whitespace before footnote in \"%s\"\n", + file_name, line_count, ++yytext); + BEGIN(INITIAL); + } + + +{primitive}/[^a-zA-Z] { + { + printf("\"%s\", line %d: Don't use \"%s\" in LaTeX documents\n", + file_name, line_count, yytext); + ++warn_count ; + }} + +\\left{ws}*\\?. { linecount() ;} +\\right{ws}*\\?. { linecount(); } + +[^\{]\\{font_spec}/[ \t]*"{" { + { + linecount(); + printf("\"%s\", line %d: Fontspecifiers don't take arguments. \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + /* (void) input(); */ + BEGIN(INITIAL); + }} + +\\([a-zA-Z\@]+\@[a-zA-Z\@]*|[a-zA-Z\@]*\@[a-zA-Z\@]+) { + { + printf("\"%s\", line %d: Do not use @ in LaTeX macro names. \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + }} + +{ws}"'"+{letter}+ { + { + linecount(); + printf("\"%s\", line %d: Use ` to begin quotation, not ' \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + BEGIN(INITIAL); + }} + +{letter}+"`" { + { + printf("\"%s\", line %d: Use ' to end quotation, not ` \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + BEGIN(INITIAL); + }} + + +{ws}+{punct} { + { + printf("\"%s\", line %d: Whitespace before punctation mark in \"%s\"\n", + file_name, line_count, yytext); + ++warn_count; + linecount(); + BEGIN(INITIAL); + }} + +"%" { BEGIN(COMMENT); } + +\n { BEGIN(INITIAL); ++line_count; } + +. { ; } + + +\\(input|include)([ \t]|"{") { BEGIN(INCLUDE); } + +[^\}\n]+ { + { + if ( strstr(yytext,".sty") == NULL ) + { + printf("** %s:\n", yytext); + input_file(yytext); + } + else + { + printf("\"%s\", line %d: Style file `%s\' omitted.\n", + file_name, + line_count, + yytext); + input(); + } + BEGIN(INITIAL); + }} + +\\endinput/[^A-Za-z] | +<> { + if (--istackp < 0) + yyterminate(); + + else + { + fclose(yyin); + f_checkend(file_name); + yy_switch_to_buffer(istack[istackp].stream); + free(file_name); + line_count = istack[istackp].linenum; + file_name = istack[istackp].name; + input(); + BEGIN(INITIAL); + } + + } + + +. { ; } +%% +int main(int argc, char *argv[]) +{ + /* allocate initial stacks */ + gstack = (tex_group *)malloc(gstack_size * sizeof(tex_group)); + istack = (input_ *)malloc(istack_size * sizeof(input_)); + if ( gstack == NULL || istack == NULL ) { + fprintf(stderr, "%s: not enough memory for stacks\n", PROGNAME); + exit(3); + } + + if(argc > 1) + { + if ( (file_name = (char*) malloc(strlen(argv[1]) + 5)) == NULL ) { + fprintf(stderr, "%s: out of memory\n", PROGNAME); + exit(3); + } + + strcpy(file_name, argv[1]); + strcat(file_name, ".tex" ); + + if ((yyin = fopen( file_name, "r")) != NULL ) + { + push(file_name, 3, 1); + yylex(); + f_checkend(file_name); + } + else { + file_name[strlen(file_name) - 4] = '\0'; + if ((yyin = fopen( file_name, "r")) != NULL ) + { + push(file_name, 3, 1); + yylex(); + f_checkend(file_name); + } + else + fprintf(stderr, + "%s: Could not open : %s\n",PROGNAME, argv[1]); + } + } + else + { + printf("\n* %s *\n\n",PROGNAME); + printf("\t...a consistency checker for LaTeX documents.\n"); + printf("$Id: lacheck.lex,v 1.26 1998/03/07 07:46:45 abraham Exp $\n\n"); + + printf("Usage:\n\tlacheck filename[.tex] \n\n\n"); + + printf("\tFrom within Emacs:\n\n"); + printf("\tM-x compile RET lacheck filename[.tex] RET\n\n"); + printf("\tUse C-x ` to step through the messages.\n\n"); + printf("\n\tThe found context is displayed in \"double quotes\"\n\n"); + printf("Remark:\n\tAll messages are only warnings!\n\n"); + printf("\tYour document may be right even though LaCheck says "); + printf("something else.\n\n"); + } + return(0); +} + +int yywrap(void) { return 1; } + +#ifdef NEED_STRSTR +char * +strstr(string, substring) + register char *string; /* String to search. */ + char *substring; /* Substring to try to find in string. */ +{ + register char *a, *b; + + /* First scan quickly through the two strings looking for a + * single-character match. When it's found, then compare the + * rest of the substring. + */ + + b = substring; + if (*b == 0) { + return string; + } + for ( ; *string != 0; string += 1) { + if (*string != *b) { + continue; + } + a = string; + while (1) { + if (*b == 0) { + return string; + } + if (*a++ != *b++) { + break; + } + } + b = substring; + } + return (char *) 0; +} +#endif /* NEED_STRSTR */ + +void push(const char *p_name, int p_type, int p_line) +{ + if ( gstackp == gstack_size ) { /* extend stack */ + gstack_size *= 2; + gstack = (tex_group *)realloc(gstack, gstack_size * sizeof(tex_group)); + if ( gstack == NULL ) { + fprintf(stderr, "%s: stack out of memory", PROGNAME); + exit(3); + } + } + + if ( (gstack[gstackp].s_name = + (char *)malloc(strlen(p_name) + 1)) == NULL || + (gstack[gstackp].s_file = + (char *)malloc(strlen(file_name) + 1)) == NULL ) { + fprintf(stderr, "%s: out of memory\n", PROGNAME); + exit(3); + } + + strcpy(gstack[gstackp].s_name, p_name); + gstack[gstackp].s_type = p_type; + gstack[gstackp].s_line = p_line; + gstack[gstackp].italic = ( (p_type == 4 || p_type == 5) + ? 1 + : ( gstackp + ? gstack[gstackp - 1].italic + : 0)); + strcpy(gstack[gstackp].s_file,file_name); + ++gstackp; + +} + +void input_file(char *file_nam) +{ + char *tmp_file_name; + FILE *tmp_yyin; + + if ( (tmp_file_name = (char*) malloc(strlen(file_nam) + 5)) == NULL ) { + fprintf(stderr, "%s: out of memory\n", PROGNAME); + exit(3); + } + strcpy(tmp_file_name,file_nam); + + if (istackp == istack_size) { /* extend stack */ + istack_size *= 2; + istack = (input_ *)realloc(istack, istack_size * sizeof(input_)); + if ( istack == NULL ) { + fprintf(stderr, "%s: \\input stack out of memory\n", PROGNAME); + exit(3); + } + } + + istack[istackp].stream = YY_CURRENT_BUFFER; + istack[istackp].linenum = line_count; + istack[istackp].name = file_name; + ++istackp; + + (void) strcat(tmp_file_name, ".tex"); + if ((tmp_yyin = fopen( tmp_file_name, "r")) != NULL ) + { + yyin = tmp_yyin; + yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); + file_name = tmp_file_name; + push(file_name, 3, 1); + line_count = 1; + } + else { + tmp_file_name[strlen(tmp_file_name) - 4] = '\0'; + if ((tmp_yyin = fopen( tmp_file_name , "r")) != NULL ) + { + yyin = tmp_yyin; + yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); + file_name = tmp_file_name; + push(file_name, 3, 1); + line_count = 1; + } + else + { + --istackp; + free(tmp_file_name); + printf("\"%s\", line %d: Could not open \"%s\"\n", + file_name, + line_count, + file_nam); + input(); + } + } +} + +void pop(void) +{ + if ( gstackp == 0 ) + { + fprintf(stderr, "%s: Stack underflow\n", PROGNAME); + exit(4); + } + --gstackp; + + free(gstack[gstackp].s_name); + free(gstack[gstackp].s_file); +} + +char *bg_command(char *name) +{ + + switch (CG_TYPE) { + + case 2: + (void) strcpy( returnval, "\\begin{" ); + (void) strcat( returnval, (char *) name); + (void) strcat( returnval, "}" ); + break; + + case 3: + (void) strcpy( returnval, "beginning of file " ); + (void) strcat( returnval, (char *) name); + break; + + case 4: + (void) strcpy( returnval, "math begin " ); + (void) strcat( returnval, (char *) name); + break; + + case 5: + (void) strcpy( returnval, "display math begin " ); + (void) strcat( returnval, (char *) name); + break; + + default: + (void) strcpy( returnval, name ); + + } + + return ((char *)returnval); +} + +static char *eg_command(char *name, int type) +{ + + switch (type) { + + case 2: + (void) strcpy( returnval, "\\end{" ); + (void) strcat( returnval, (char *) name); + (void) strcat( returnval, "}" ); + break; + + case 3: + (void) strcpy( returnval, "end of file " ); + (void) strcat( returnval, (char *) name); + break; + + case 4: + (void) strcpy( returnval, "math end " ); + (void) strcat( returnval, (char *) name); + break; + + case 5: + (void) strcpy( returnval, "display math end " ); + (void) strcat( returnval, (char *) name); + break; + + default: + (void) strcpy( returnval, name ); + break; + } + + return ((char *)returnval); +} + + +void g_checkend(int n) +{ + if ( check_top_level_end(yytext,n) == 1 ) + { + if ( CG_TYPE != n ) + print_bad_match(yytext,n); + else + pop(); + } +} + +void e_checkend(int n, char *name) +{ + if ( check_top_level_end(name,n) == 1 ) + { + if ( CG_TYPE != n || strcmp( CG_NAME, name ) != 0 ) + print_bad_match(name,n); + + pop(); + + } +} + +void f_checkend(char *name) +{ + if ( check_top_level_end(name,3) == 1 ) + { + if ( CG_TYPE != 3 || strcmp( CG_NAME, name ) != 0 ) + + while( CG_TYPE != 3 ) + { + print_bad_match(name,3); + pop(); + } + + pop(); + } +} + +void print_bad_match(char *end_command, int type) +{ + printf("\"%s\", line %d: <- unmatched \"%s\"\n", + file_name, + line_count, + eg_command( end_command , type) ) ; + + printf("\"%s\", line %d: -> unmatched \"%s\"\n", + CG_FILE, + CG_LINE, + bg_command( CG_NAME ) ) ; + warn_count += 2; +} + +int check_top_level_end(char *end_command, int type) +{ + if ( gstackp == 0 ) + { + printf("\"%s\", line %d: \"%s\" found at top level\n", + file_name, + line_count, + eg_command( end_command, type )) ; + ++warn_count; + return(0); + } + else + return(1); +} + +void linecount(void) +{ + int i; + for (i = 0; i < yyleng; i++) + if(yytext[i] == '\n') + line_count++; +} + diff --git a/Build/source/texk/lacheck/lacheck-1.26/lacheck.man b/Build/source/texk/lacheck/lacheck-1.26/lacheck.man new file mode 100644 index 00000000000..66c818f9aad --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26/lacheck.man @@ -0,0 +1,110 @@ +.TH "LaCheck" "1" "2010-12-10" "%%LACHECKREV%%" +.SH NAME +lacheck - A consistency checker for LaTeX documents. +.SH SYNOPSIS +.B lacheck +.IR filename [ \fB.tex\fP ] +.SH DESCRIPTION +LaCheck is a general purpose consistency checker for LaTeX documents. +It reads a LaTeX document and displays warning messages, if it finds +bad sequences. It should be noted, that the badness is +.I very +subjective. LaCheck is designed to help find common mistakes in LaTeX +documents, especially those made by beginners. +.LP +The things checked are: +.LP +Mismatched groups (braces), environments and math mode +delimiters. When a mismatch is found, line numbers for +.I "both" +start and end of the mismatch is given. The error messages comes in +pairs, one for the end match and one for the beginning, marked with +\`<-\' and \`->\' respectively. +.LP +Bad spacing including missing a \`\\ \' after an abbreviation, missing +an \`\\@\' before a punctuation mark in a paragraph that is ended by +an capital letter, double spaces like \` \~\', bad usage of ellipsis +(like using ... instead of \\ldots, or using \\ldots where \\cdots +should be used), missing \~ before a \\cite or \\ref commands, space +before footnotes, italic corrections before comma, point, or italic +text, italic correction after normal text, missing italic correction +when switching from italic to normal text, and double italic +correction. +.LP +Badly placed punctuation marks around end of math mode +delimiters. This is, punctuation placed right after display math end +or punctuation placed right before text math end. Sequences of +whitespace followed by punctuation marks are also caught. +.LP +Bad use of quotation characters, i.e. constructs like "\'word" or +"word\`" are warned about, tabs in verbatim environments are caught, +certain TeX primitives are frowned upon, attempts to give font +specifiers arguments such as \\em{text} are noted, and use of @ in +LaTeX macros are reported. +.LP +LaCheck will read files that are input using \\input or \\include. +Files with suffix \`.sty\' are omitted, as they probably will cause +LaCheck to crash. +.LP +LaCheck may be invoked from within Emacs(1) using compile: + +To run: +.B "M-x compile RET lacheck RET" +, and then +.B "C-x `" +to parse the messages + +.SH OUTPUT +The output is UNIX-error like, and may be parsed using Emacs(1) +compile mode. Here is a sample: + +.PD 0 +lacheck compiler +.TP +"/usr/mef/compiler.tex", line 34: missing \`\\\\\\\\ \' after "etc." +.TP +"/usr/mef/compiler.tex", line 179: double space at " ~" +.TP +"/usr/mef/compiler.tex", line 186: <- unmatched "}" +.TP +"/usr/mef/compiler.tex", line 181: -> unmatched "$$" +.PD 1 +.LP +A control space \`\\ \' should be inserted at line 34, to prevent an +end-of-sentence space. +Also, at line 179, the first space of the sequence " ~" should +probably be deleted. +The last two lines is an example, where the user mistyped, and +probably inserted an extra "}" somewhere. + +.SH DIAGNOSTICS +Some special cases should be explained. In cases where a sentence ends +with something that LaCheck thinks is an abbreviation an missing \`\\ +\' error may also occur, if the following sentence begins with a +lowercase letter. +.LP +A mismatch error may cause more to follow, due to the chosen +algorithm. In such cases just correct the +.I "first" +error and run LaCheck again +.LP +Braces, environments and math mode must be balanced within a file. +.LP +LaCheck may be confused by unmatched stuff placed inside verbatim-like +environments called something else than exactly \`verbatim\'. +.SH FILES +%%LACHECKPATH%% +.SH SEE ALSO +tex(1), emacs(1), latex(1) +.SH BUGS +LaCheck gets confused by advanced macros, is fooled by simple macros, +can't figure out if you use a non-standard way to switch italic on or +off, does not like TeX at all, does not provide any options to turn +off specific warnings, and is at best a crude approximation. +.LP +Ideas for improvements and bug reports are very welcome. Such +should be directed to the maintainers, their email address is +. +.SH AUTHOR +Kresten Krab Thorup with modifications by Per Abrahamsen. + diff --git a/Build/source/texk/lacheck/lacheck-1.26/make_vms.com b/Build/source/texk/lacheck/lacheck-1.26/make_vms.com new file mode 100644 index 00000000000..24d224733a0 --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26/make_vms.com @@ -0,0 +1,16 @@ +$ if f$trnlnm("sys_arch").eqs."ALPHA" +$ then +$ CC :== CC/NoList/opt=level=4/standard=vaxc +$ else +$ CC :==gcc/Nostandard/NoCase_Hack/NoList +$ endif +$ LINK :== Link/NoMap +$ CC lacheck.c +$ if f$trnlnm("sys_arch").eqs."ALPHA" +$ then +$ LINK lacheck.obj +$ else +$ LINK lacheck.obj,gnu_cc:[000000]GCCLIB/LIB, sys$share:vaxcrtl/opt +$ endif +$ Library/Help/Create=Blocks:10 lacheck.hlb lacheck.hlp +$ EXIT diff --git a/Build/source/texk/lacheck/lacheck-1.26/test.old b/Build/source/texk/lacheck/lacheck-1.26/test.old new file mode 100644 index 00000000000..015686391c0 --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26/test.old @@ -0,0 +1,33 @@ +"./test.tex", line 3: possible unwanted space at "{" +"./test.tex", line 4: you may need a \/ before "world" +"./test.tex", line 5: \/ not needed before italic text "world" +"./test.tex", line 6: \/ not needed after non-italic text "hello" +"./test.tex", line 7: double \/ found "\/" +"./test.tex", line 8: do not use \/ before "," +"./test.tex", line 9: punctuation mark "." should be placed before end of displaymath +"./test.tex", line 10: punctuation mark "." should be placed after end of math mode +"./test.tex", line 11: {argument} missing for \begin +"./test.tex", line 13: TAB character in verbatim environment +"./test.tex", line 15: {argument} missing for \end +"./test.tex", line 16: missing `\ ' after "a.k.a." +"./test.tex", line 17: missing `\@' before `.' in "HELLO." +"./test.tex", line 18: double space at "~ " +"./test.tex", line 19: \ldots should be \cdots in "+ \ldots +" +"./test.tex", line 20: \cdots should be \ldots in " , \cdots ," +"./test.tex", line 21: Dots should be \cdots in "+ .. +" +"./test.tex", line 22: Dots should be \ldots in " , .. ," +"./test.tex", line 23: Dots should be ellipsis "..." +"./test.tex", line 24: bad character in label "\label{hello evil world}", see C.10.2 +"./test.tex", line 25: perhaps you should insert a `~' before "\ref" +"./test.tex", line 26: whitespace before footnote in "\footnote" +"./test.tex", line 27: Don't use "\above" in LaTeX documents +"./test.tex", line 28: Fontspecifiers don't take arguments. " \rm" +"./test.tex", line 29: Do not use @ in LaTeX macro names. "\hello@world" +"./test.tex", line 30: Use ` to begin quotation, not ' " ''world" +"./test.tex", line 31: Use ' to end quotation, not ` "hello`" +"./test.tex", line 32: Whitespace before punctation mark in " ." +"./test.tex", line 34: <- unmatched "display math end \]" +"./test.tex", line 33: -> unmatched "math begin \(" +"./test.tex", line 35: \verb should not contain end of line characters +"./test.tex", line 43: <- unmatched "end of file ./test.tex" +"./test.tex", line 33: -> unmatched "math begin \(" diff --git a/Build/source/texk/lacheck/lacheck-1.26/test.tex b/Build/source/texk/lacheck/lacheck-1.26/test.tex new file mode 100644 index 00000000000..98b18c1e3b5 --- /dev/null +++ b/Build/source/texk/lacheck/lacheck-1.26/test.tex @@ -0,0 +1,42 @@ +% $Revision: 1.4 $ + +{ } % Unwanted space after `{' +{\em hello} world % May need `\/' before `world' +{\em hello\/ world}. % `\/' not needed before `world' +hello\/ world % `\/' not needed after `hello' +{\em hello\/}\/ world % Double `\/' +{\em hello\/}, world % `\/' before `,' or `.' +\[display math\]. % Punctuation mark after end of display math +$math.$ % Punctuation mark before end of math mode +\begin % Missing argument for \begin +\begin{verbatim} +TAB TAB % Tab in verbatim +\end{verbatim} +\end % Missing argument for \end +a.k.a. world % Missing `\ ' after abbreviation +HELLO. World % Missing `\@' before `.' +hello~ world % Double space +$ + \ldots + $ % Should be \cdots +$ , \cdots , $ % Should be \ldots +$ + .. + $ % Should be \cdots +$ , .. , $ % Should be \ldots +hello world... % Should be ellipsis +\label{hello evil world} % Bad character in label +Hello \ref{world} % Missing ~ +Hello \footnote{world} % Whitespace before footnote +\above % Primitive in LaTeX +hello \rm{world} % Font specifier with argument +\hello@world % @ in LaTeX macro name +hello ''world'' % Quote begined with ' +``hello`` world % Quote ended with ` +world . % Whitespace before punctuation mark +\(hello +world\] % Bad match +\verb|hello +world| % multi-line \verb + +% Local Variables: +% mode: LaTeX +% TeX-master: t +% TeX-auto-update: nil +% End: diff --git a/Build/source/texk/lacheck/lacheck.c b/Build/source/texk/lacheck/lacheck.c index b66ef042b3a..e08abeb4c10 100644 --- a/Build/source/texk/lacheck/lacheck.c +++ b/Build/source/texk/lacheck/lacheck.c @@ -2101,9 +2101,6 @@ char *yytext; /* extern char *realloc(); */ -#define YY_SKIP_YYWRAP -static int yywrap(void) { return 1; } - #ifdef NEED_STRSTR char *strstr(); #endif @@ -2170,7 +2167,7 @@ int def_count = 0; -#line 2174 "lacheck.c" +#line 2171 "lacheck.c" #define INITIAL 0 #define B_ENVIRONMENT 1 @@ -2367,10 +2364,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 240 "lacheck.l" +#line 237 "lacheck.l" -#line 2374 "lacheck.c" +#line 2371 "lacheck.c" if ( !(yy_init) ) { @@ -2485,45 +2482,45 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 242 "lacheck.l" +#line 239 "lacheck.l" { ; } YY_BREAK case 2: YY_RULE_SETUP -#line 244 "lacheck.l" +#line 241 "lacheck.l" { ; } YY_BREAK case 3: /* rule 3 can match eol */ YY_RULE_SETUP -#line 246 "lacheck.l" +#line 243 "lacheck.l" { line_count++; } YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 248 "lacheck.l" +#line 245 "lacheck.l" { line_count++; } YY_BREAK case 5: YY_RULE_SETUP -#line 250 "lacheck.l" +#line 247 "lacheck.l" { ; } YY_BREAK case 6: YY_RULE_SETUP -#line 252 "lacheck.l" +#line 249 "lacheck.l" { ; } YY_BREAK case 7: YY_RULE_SETUP -#line 254 "lacheck.l" +#line 251 "lacheck.l" { ; } YY_BREAK case 8: /* rule 8 can match eol */ YY_RULE_SETUP -#line 256 "lacheck.l" +#line 253 "lacheck.l" { if (CG_TYPE != 4 && CG_TYPE != 5) { if (!(CG_TYPE == 2 && strstr(CG_NAME, "array"))) { @@ -2538,12 +2535,12 @@ YY_RULE_SETUP YY_BREAK case 9: YY_RULE_SETUP -#line 268 "lacheck.l" +#line 265 "lacheck.l" { push( "{", 0, line_count);} YY_BREAK case 10: YY_RULE_SETUP -#line 270 "lacheck.l" +#line 267 "lacheck.l" { { int italic = CG_ITALIC; @@ -2556,12 +2553,12 @@ YY_RULE_SETUP YY_BREAK case 11: YY_RULE_SETUP -#line 280 "lacheck.l" +#line 277 "lacheck.l" { g_checkend(0); } YY_BREAK case 12: YY_RULE_SETUP -#line 282 "lacheck.l" +#line 279 "lacheck.l" { { if (!CG_ITALIC) @@ -2575,7 +2572,7 @@ YY_RULE_SETUP YY_BREAK case 13: YY_RULE_SETUP -#line 293 "lacheck.l" +#line 290 "lacheck.l" { { if (CG_ITALIC) @@ -2593,7 +2590,7 @@ case 14: (yy_c_buf_p) = yy_cp -= 2; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 304 "lacheck.l" +#line 301 "lacheck.l" { { linecount(); @@ -2611,7 +2608,7 @@ case 15: (yy_c_buf_p) = yy_cp -= 2; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 315 "lacheck.l" +#line 312 "lacheck.l" { { linecount(); @@ -2625,17 +2622,17 @@ YY_RULE_SETUP YY_BREAK case 16: YY_RULE_SETUP -#line 326 "lacheck.l" +#line 323 "lacheck.l" { BEGIN(INITIAL); } YY_BREAK case 17: YY_RULE_SETUP -#line 328 "lacheck.l" +#line 325 "lacheck.l" { BEGIN(ICOR); } YY_BREAK case 18: YY_RULE_SETUP -#line 330 "lacheck.l" +#line 327 "lacheck.l" { { printf("\"%s\", line %d: double \\/ found \"%s\"\n", @@ -2650,7 +2647,7 @@ case 19: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 338 "lacheck.l" +#line 335 "lacheck.l" { CG_ITALIC = 1; } YY_BREAK case 20: @@ -2659,7 +2656,7 @@ case 20: (yy_c_buf_p) = yy_cp = yy_bp + 12; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 340 "lacheck.l" +#line 337 "lacheck.l" { { if(CG_ITALIC) @@ -2675,7 +2672,7 @@ case 21: (yy_c_buf_p) = yy_cp = yy_bp + 12; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 349 "lacheck.l" +#line 346 "lacheck.l" { CG_ITALIC = 0; } YY_BREAK case 22: @@ -2684,7 +2681,7 @@ case 22: (yy_c_buf_p) = yy_cp = yy_bp + 3; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 351 "lacheck.l" +#line 348 "lacheck.l" { { if(CG_ITALIC) @@ -2700,12 +2697,12 @@ case 23: (yy_c_buf_p) = yy_cp = yy_bp + 3; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 360 "lacheck.l" +#line 357 "lacheck.l" { CG_ITALIC = !CG_ITALIC; } YY_BREAK case 24: YY_RULE_SETUP -#line 362 "lacheck.l" +#line 359 "lacheck.l" { { printf("\"%s\", line %d: do not use \\/ before \"%s\"\n", @@ -2717,17 +2714,17 @@ YY_RULE_SETUP case 25: /* rule 25 can match eol */ YY_RULE_SETUP -#line 370 "lacheck.l" +#line 367 "lacheck.l" { ; } YY_BREAK case 26: YY_RULE_SETUP -#line 372 "lacheck.l" +#line 369 "lacheck.l" { ; } YY_BREAK case 27: YY_RULE_SETUP -#line 374 "lacheck.l" +#line 371 "lacheck.l" { { unput(yytext[0]); @@ -2736,51 +2733,51 @@ YY_RULE_SETUP YY_BREAK case 28: YY_RULE_SETUP -#line 380 "lacheck.l" +#line 377 "lacheck.l" BEGIN(DEF); YY_BREAK case 29: YY_RULE_SETUP -#line 382 "lacheck.l" +#line 379 "lacheck.l" { ++def_count; } YY_BREAK case 30: YY_RULE_SETUP -#line 384 "lacheck.l" +#line 381 "lacheck.l" { --def_count; if(def_count == 0) BEGIN(INITIAL); } YY_BREAK case 31: YY_RULE_SETUP -#line 388 "lacheck.l" +#line 385 "lacheck.l" { ; } YY_BREAK case 32: YY_RULE_SETUP -#line 390 "lacheck.l" +#line 387 "lacheck.l" BEGIN(ENV_DEF); YY_BREAK case 33: YY_RULE_SETUP -#line 392 "lacheck.l" +#line 389 "lacheck.l" { ++def_count; } YY_BREAK case 34: YY_RULE_SETUP -#line 394 "lacheck.l" +#line 391 "lacheck.l" { --def_count; if(def_count == 0) BEGIN(DEF); } YY_BREAK case 35: YY_RULE_SETUP -#line 398 "lacheck.l" +#line 395 "lacheck.l" { ; } YY_BREAK case 36: YY_RULE_SETUP -#line 400 "lacheck.l" +#line 397 "lacheck.l" { if(CG_TYPE == 4 || CG_TYPE == 5) print_bad_match(yytext,4); @@ -2791,12 +2788,12 @@ YY_RULE_SETUP YY_BREAK case 37: YY_RULE_SETUP -#line 408 "lacheck.l" +#line 405 "lacheck.l" { g_checkend(4); } YY_BREAK case 38: YY_RULE_SETUP -#line 410 "lacheck.l" +#line 407 "lacheck.l" { if(CG_TYPE == 4 || CG_TYPE == 5) print_bad_match(yytext,5); @@ -2807,12 +2804,12 @@ YY_RULE_SETUP YY_BREAK case 39: YY_RULE_SETUP -#line 419 "lacheck.l" +#line 416 "lacheck.l" { g_checkend(5); BEGIN(AFTER_DISPLAY);} YY_BREAK case 40: YY_RULE_SETUP -#line 421 "lacheck.l" +#line 418 "lacheck.l" { printf( "\"%s\", line %d: punctuation mark \"%s\" should be placed before end of displaymath\n", @@ -2824,7 +2821,7 @@ YY_RULE_SETUP case 41: /* rule 41 can match eol */ YY_RULE_SETUP -#line 429 "lacheck.l" +#line 426 "lacheck.l" { unput(yytext[0]); BEGIN(INITIAL); } YY_BREAK case 42: @@ -2832,7 +2829,7 @@ case 42: (yy_c_buf_p) = yy_cp = yy_bp + 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 431 "lacheck.l" +#line 428 "lacheck.l" { if (CG_TYPE == 4) { printf( "\"%s\", line %d: punctuation mark \"%s\" should be placed after end of math mode\n", @@ -2843,7 +2840,7 @@ YY_RULE_SETUP YY_BREAK case 43: YY_RULE_SETUP -#line 439 "lacheck.l" +#line 436 "lacheck.l" { if(CG_TYPE == 5) @@ -2861,7 +2858,7 @@ YY_RULE_SETUP YY_BREAK case 44: YY_RULE_SETUP -#line 455 "lacheck.l" +#line 452 "lacheck.l" { if(CG_TYPE == 4) @@ -2884,7 +2881,7 @@ case 45: (yy_c_buf_p) = yy_cp = yy_bp + 11; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 471 "lacheck.l" +#line 468 "lacheck.l" { { push("\\begingroup", 1, line_count); @@ -2896,7 +2893,7 @@ case 46: (yy_c_buf_p) = yy_cp = yy_bp + 9; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 477 "lacheck.l" +#line 474 "lacheck.l" { { g_checkend(1); @@ -2904,7 +2901,7 @@ YY_RULE_SETUP YY_BREAK case 47: YY_RULE_SETUP -#line 483 "lacheck.l" +#line 480 "lacheck.l" { BEGIN(B_ENVIRONMENT); } YY_BREAK case 48: @@ -2913,7 +2910,7 @@ case 48: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 485 "lacheck.l" +#line 482 "lacheck.l" { { @@ -2924,7 +2921,7 @@ YY_RULE_SETUP YY_BREAK case 49: YY_RULE_SETUP -#line 493 "lacheck.l" +#line 490 "lacheck.l" { { if (strcmp( yytext, "verbatim" ) == 0 ) @@ -2951,12 +2948,12 @@ YY_RULE_SETUP YY_BREAK case 50: YY_RULE_SETUP -#line 517 "lacheck.l" +#line 514 "lacheck.l" { BEGIN(INITIAL); } YY_BREAK case 51: YY_RULE_SETUP -#line 519 "lacheck.l" +#line 516 "lacheck.l" { printf("\"%s\", line %d: TAB character in verbatim environment\n", file_name, line_count) ; @@ -2965,18 +2962,18 @@ YY_RULE_SETUP YY_BREAK case 52: YY_RULE_SETUP -#line 525 "lacheck.l" +#line 522 "lacheck.l" { ; } YY_BREAK case 53: /* rule 53 can match eol */ YY_RULE_SETUP -#line 527 "lacheck.l" +#line 524 "lacheck.l" { ++line_count; } YY_BREAK case 54: YY_RULE_SETUP -#line 530 "lacheck.l" +#line 527 "lacheck.l" { verb_char = yytext[yyleng-1]; BEGIN(VERB); @@ -2985,7 +2982,7 @@ YY_RULE_SETUP case 55: /* rule 55 can match eol */ YY_RULE_SETUP -#line 535 "lacheck.l" +#line 532 "lacheck.l" { printf("\"%s\", line %d: \\verb should not contain end of line characters\n", file_name, line_count) ; @@ -2994,7 +2991,7 @@ YY_RULE_SETUP YY_BREAK case 56: YY_RULE_SETUP -#line 541 "lacheck.l" +#line 538 "lacheck.l" { if ( *yytext == verb_char ) BEGIN(INITIAL); @@ -3002,7 +2999,7 @@ YY_RULE_SETUP YY_BREAK case 57: YY_RULE_SETUP -#line 547 "lacheck.l" +#line 544 "lacheck.l" { BEGIN(E_ENVIRONMENT); } YY_BREAK case 58: @@ -3011,7 +3008,7 @@ case 58: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 549 "lacheck.l" +#line 546 "lacheck.l" { { printf("\"%s\", line %d: {argument} missing for \\end\n", @@ -3021,7 +3018,7 @@ YY_RULE_SETUP YY_BREAK case 59: YY_RULE_SETUP -#line 557 "lacheck.l" +#line 554 "lacheck.l" { { e_checkend(2, yytext); @@ -3033,7 +3030,7 @@ YY_RULE_SETUP case 60: /* rule 60 can match eol */ YY_RULE_SETUP -#line 566 "lacheck.l" +#line 563 "lacheck.l" { { linecount(); @@ -3046,7 +3043,7 @@ YY_RULE_SETUP case 61: /* rule 61 can match eol */ YY_RULE_SETUP -#line 575 "lacheck.l" +#line 572 "lacheck.l" { { printf( "\"%s\", line %d: missing `\\ ' after \"%s\"\n", @@ -3058,7 +3055,7 @@ YY_RULE_SETUP case 62: /* rule 62 can match eol */ YY_RULE_SETUP -#line 583 "lacheck.l" +#line 580 "lacheck.l" { { linecount(); @@ -3071,7 +3068,7 @@ YY_RULE_SETUP case 63: /* rule 63 can match eol */ YY_RULE_SETUP -#line 592 "lacheck.l" +#line 589 "lacheck.l" { printf("\"%s\", line %d: double space at \"%s\"\n", @@ -3084,7 +3081,7 @@ YY_RULE_SETUP case 64: /* rule 64 can match eol */ YY_RULE_SETUP -#line 601 "lacheck.l" +#line 598 "lacheck.l" { printf("\"%s\", line %d: \\ldots should be \\cdots in \"%s\"\n", file_name, line_count, yytext); @@ -3095,7 +3092,7 @@ YY_RULE_SETUP case 65: /* rule 65 can match eol */ YY_RULE_SETUP -#line 608 "lacheck.l" +#line 605 "lacheck.l" { printf("\"%s\", line %d: \\cdots should be \\ldots in \"%s\"\n", file_name, line_count, yytext); @@ -3107,7 +3104,7 @@ YY_RULE_SETUP case 66: /* rule 66 can match eol */ YY_RULE_SETUP -#line 616 "lacheck.l" +#line 613 "lacheck.l" { printf("\"%s\", line %d: Dots should be \\cdots in \"%s\"\n", file_name, line_count, yytext); @@ -3118,7 +3115,7 @@ YY_RULE_SETUP case 67: /* rule 67 can match eol */ YY_RULE_SETUP -#line 623 "lacheck.l" +#line 620 "lacheck.l" { printf("\"%s\", line %d: Dots should be \\ldots in \"%s\"\n", file_name, line_count, yytext); @@ -3129,7 +3126,7 @@ YY_RULE_SETUP YY_BREAK case 68: YY_RULE_SETUP -#line 632 "lacheck.l" +#line 629 "lacheck.l" { printf("\"%s\", line %d: Dots should be ellipsis \"%s\"\n", file_name, line_count, yytext); @@ -3140,7 +3137,7 @@ YY_RULE_SETUP case 69: /* rule 69 can match eol */ YY_RULE_SETUP -#line 639 "lacheck.l" +#line 636 "lacheck.l" { linecount(); printf("\"%s\", line %d: bad character in label \"%s\", see C.10.2\n", @@ -3153,7 +3150,7 @@ case 70: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 645 "lacheck.l" +#line 642 "lacheck.l" { linecount(); BEGIN(INITIAL); @@ -3165,7 +3162,7 @@ case 71: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 650 "lacheck.l" +#line 647 "lacheck.l" { linecount(); printf("\"%s\", line %d: perhaps you should insert a `~' before \"%s\"\n", @@ -3179,7 +3176,7 @@ case 72: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 657 "lacheck.l" +#line 654 "lacheck.l" { linecount(); printf("\"%s\", line %d: whitespace before footnote in \"%s\"\n", @@ -3193,7 +3190,7 @@ case 73: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 665 "lacheck.l" +#line 662 "lacheck.l" { { printf("\"%s\", line %d: Don't use \"%s\" in LaTeX documents\n", @@ -3204,19 +3201,19 @@ YY_RULE_SETUP case 74: /* rule 74 can match eol */ YY_RULE_SETUP -#line 672 "lacheck.l" +#line 669 "lacheck.l" { linecount() ;} YY_BREAK case 75: /* rule 75 can match eol */ YY_RULE_SETUP -#line 673 "lacheck.l" +#line 670 "lacheck.l" { linecount(); } YY_BREAK case 76: /* rule 76 can match eol */ YY_RULE_SETUP -#line 675 "lacheck.l" +#line 672 "lacheck.l" { { linecount(); @@ -3229,7 +3226,7 @@ YY_RULE_SETUP YY_BREAK case 77: YY_RULE_SETUP -#line 685 "lacheck.l" +#line 682 "lacheck.l" { { printf("\"%s\", line %d: Do not use @ in LaTeX macro names. \"%s\"\n", @@ -3240,7 +3237,7 @@ YY_RULE_SETUP case 78: /* rule 78 can match eol */ YY_RULE_SETUP -#line 692 "lacheck.l" +#line 689 "lacheck.l" { { linecount(); @@ -3252,7 +3249,7 @@ YY_RULE_SETUP YY_BREAK case 79: YY_RULE_SETUP -#line 701 "lacheck.l" +#line 698 "lacheck.l" { { printf("\"%s\", line %d: Use ' to end quotation, not ` \"%s\"\n", @@ -3264,7 +3261,7 @@ YY_RULE_SETUP case 80: /* rule 80 can match eol */ YY_RULE_SETUP -#line 710 "lacheck.l" +#line 707 "lacheck.l" { { printf("\"%s\", line %d: Whitespace before punctation mark in \"%s\"\n", @@ -3276,28 +3273,28 @@ YY_RULE_SETUP YY_BREAK case 81: YY_RULE_SETUP -#line 719 "lacheck.l" +#line 716 "lacheck.l" { BEGIN(COMMENT); } YY_BREAK case 82: /* rule 82 can match eol */ YY_RULE_SETUP -#line 721 "lacheck.l" +#line 718 "lacheck.l" { BEGIN(INITIAL); ++line_count; } YY_BREAK case 83: YY_RULE_SETUP -#line 723 "lacheck.l" +#line 720 "lacheck.l" { ; } YY_BREAK case 84: YY_RULE_SETUP -#line 726 "lacheck.l" +#line 723 "lacheck.l" { BEGIN(INCLUDE); } YY_BREAK case 85: YY_RULE_SETUP -#line 728 "lacheck.l" +#line 725 "lacheck.l" { { if ( strstr(yytext,".sty") == NULL ) @@ -3321,7 +3318,7 @@ case 86: *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ (yy_c_buf_p) = yy_cp = yy_bp + 9; YY_DO_BEFORE_ACTION; /* set up yytext again */ -#line 747 "lacheck.l" +#line 744 "lacheck.l" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(B_ENVIRONMENT): case YY_STATE_EOF(E_ENVIRONMENT): @@ -3335,7 +3332,7 @@ case YY_STATE_EOF(AFTER_DISPLAY): case YY_STATE_EOF(ENV_DEF): case YY_STATE_EOF(ICOR): case YY_STATE_EOF(GETICOR): -#line 747 "lacheck.l" +#line 744 "lacheck.l" { if (--istackp < 0) yyterminate(); @@ -3356,15 +3353,15 @@ case YY_STATE_EOF(GETICOR): YY_BREAK case 87: YY_RULE_SETUP -#line 766 "lacheck.l" +#line 763 "lacheck.l" { ; } YY_BREAK case 88: YY_RULE_SETUP -#line 767 "lacheck.l" +#line 764 "lacheck.l" ECHO; YY_BREAK -#line 3368 "lacheck.c" +#line 3365 "lacheck.c" case YY_END_OF_BUFFER: { @@ -4337,7 +4334,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 767 "lacheck.l" +#line 764 "lacheck.l" int main(int argc, char *argv[]) @@ -4398,6 +4395,8 @@ int main(int argc, char *argv[]) return(0); } +int yywrap(void) { return 1; } + #ifdef NEED_STRSTR char * strstr(string, substring) diff --git a/Build/source/texk/lacheck/lacheck.hlp b/Build/source/texk/lacheck/lacheck.hlp deleted file mode 100644 index b99a0e91a47..00000000000 --- a/Build/source/texk/lacheck/lacheck.hlp +++ /dev/null @@ -1,118 +0,0 @@ -1 LaCheck - -A consistency checker for LaTeX documents. - - LaCheck filename[.tex] - -2 DESCRIPTION - -LaCheck is a general purpose consistency checker for LaTeX documents. -It reads a LaTeX document and displays warning messages, if it finds -bad sequences. It should be noted, that the badness is very -subjective. LaCheck is designed to help find common mistakes in LaTeX -documents, especially those made by beginners. - -The things checked are: Mismatched groups (braces), environments and -math mode delimiters. When a mismatch is found, line numbers for -"both" start and end of the mismatch is given. The error messages -comes in pairs, one for the end match and one for the beginning, -marked with `<-' and `->' respectively. - -Bad spacing including missing a `\' after an abbreviation, missing an -`\@' before a punctuation mark in a paragraph that is ended by an -capital letter, double spaces like ` ~', bad usage of ellipsis (like -using ... instead of \ldots, or using \ldots where \cdots should be -used), missing \~ before a \cite or \ref commands, space before -footnotes, italic corrections before comma, point, or italic text, -italic correction after normal text, missing italic correction when -switching from italic to normal text, and double italic correction. - -Badly placed punctuation marks around end of math mode delimiters. -This is, pucktuation placed right after display math end or -punctuation placed right before text math end. Sequences of -whitespace followed by punctuation marks are also caught. Bad use of -quotation characters, i.e. constructs like "\'word" or "word\`" are -warned about, tabs in verbatim environments are caught, certain TeX -primitives are frowned upon, attempts to give font specifiers -arguments such as \em{text} are noted, and use of @ in LaTeX macros -are reported. - -LaCheck will read files that are input using \input or \include. Files -with suffix `.sty' are omitted, as they probably will cause LaCheck to -crash. - -2 USAGE - - LaCheck filename[.tex] - -LaCheck may be invoked from within Emacs using compile: - -To run: -"M-x compile RET lacheck RET" -, and then -"C-x `" -to parse the messages - -2 OUTPUT - -The output is UNIX-error like, and may be parsed using Emacs compile -mode. Here is a sample: - -0 -lacheck compiler - -"/usr/mef/compiler.tex", line 34: missing `\' after "etc." - -"/usr/mef/compiler.tex", line 179: double space at " ~" - -"/usr/mef/compiler.tex", line 186: <- unmatched "}" - -"/usr/mef/compiler.tex", line 181: -> unmatched "$$" -1 - -A control space `\\ ' should be inserted at line 34, to prevent an -end-of-sentence space. -Also, at line 179, the first space of the sequence " ~" should -probably be deleted. -The last two lines is an example, where the user mistyped, and -probably inserted an extra "}" somewhere. - -2 DIAGNOSTICS - -Some special cases should be explained. In cases where a sentence ends -with something that LaCheck thinks is an abbreviation an missing `\\' -error may also occur, if the following sentence begins with a -lowercase letter. - -A mismatch error may cause more to follow, due to the chosen -algorithm. In such cases just correct the "first" error and run -LaCheck again - -Braces, environments and math mode must be balanced within a file. - -LaCheck may be confused by unmatched stuff placed inside verbatim-like -environments called something else than exactly `verbatim'. - -2 FILES - -Source: TEX_DISK:[TEX.TEX__SOURCE.LACHECK] - -Executable: TEX_EXE:LACHECK.EXE - -SEE ALSO -TeX, emacs, LaTeX - -2 BUGS - -LaCheck gets confused by advanced macros, is fooled by simple macros, -can't figure out if you use a non-standard way to switch italic on or -off, does not like TeX at all, does not provide any options to turn -off specific warnings, and is at best a crude approximation. - -Ideas for improvements and bug reports are very welcome. Such should -be directed to the maintainers, their email address is -. - -2 AUTHOR -Kresten Krab Thorup with modifications by Per Abrahamsen. - diff --git a/Build/source/texk/lacheck/lacheck.l b/Build/source/texk/lacheck/lacheck.l deleted file mode 100644 index 441fbdefefc..00000000000 --- a/Build/source/texk/lacheck/lacheck.l +++ /dev/null @@ -1,1108 +0,0 @@ -/* -*- Mode: C -*- - * - * lacheck.lex - A consistency checker checker for LaTeX documents - * - * Copyright (C) 1991, 1992 Kresten Krab Thorup. - * Copyright (C) 1993 --- 1998 Per Abrahamsen. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 1, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Please send bugs, suggestions, and queries to auc-tex_mgr@sunsite.auc.dk. - * - * $Revision: 1.26 $ - * Author : Kresten Krab Thorup - * Created On : Sun May 26 18:11:58 1991 - * - * HISTORY - * 07-Mar-1998 Per Abrahamsen - * Added return to yywrap. Patch by Fabrice POPINEAU - * . - * 14-Jan-1998 Per Abrahamsen - * Added GPL blurp. - * 27-Oct-1997 Per Abrahamsen - * Count newline after newenvironment and newcommand. - * 12-Jan-1996 Per Abrahamsen - * \\} used not to end a group in definitions. Reported by Piet - * van Oostrum . - * 03-Jan-1995 Per Abrahamsen - * Fix bug which prevented detection of multiple illegal characters - * in labels. Reported by eeide@jaguar.cs.utah.edu (Eric Eide). - * 30-Jul-1994 Per Abrahamsen - * Define dummy yywrap so we no longer depend on `libl.a'. - * 26-Apr-1994 Per Abrahamsen - * Removed a few warnings, by Richard Lloyd . - * 23-Apr-1994 Per Abrahamsen - * Changed all `%i' to `%d' for VMS portability. Reported by - * Stephen Harker . - * 16-Feb-1994 Per Abrahamsen - * Try file name with `.tex' appended before trying it bare. This - * will make the case where a directory and a TeX file share the - * same name work. - * 19-Jan-1994 Per Abrahamsen - * Comments don't imply whitespace. Pointed out by Jacco van - * Ossenbruggen . - * 14-Jan-1994 Per Abrahamsen - * Don't complain about \ref at the beginning of a paragraph. - * Suggested by Jean-Marc Lasgouttes . - * 11-Jan-1994 Per Abrahamsen - * Added version string to usage message. Suggested by Uwe Bonnes - * . - * 04-Jan-1994 Per Abrahamsen - * Warn about newlines in \verb. Suggested by Mark Burton - * . The LaTeX Book agrees (p. 168). - * 10-Sep-1993 Per Abrahamsen - * Removed complain about missing ~ before \cite. Requested by - * Nelson H. F. Beebe . The LaTeX Book seems - * to agree. - * 03-Sep-1993 Per Abrahamsen - * Check for illegal characters in labels. - * 16-Aug-1993 Per Abrahamsen - * Recognize \endinput. Suggested by Stefan Farestam - * . - * 13-Aug-1993 Per Abrahamsen - * } was eaten after display math. Reported by Eckhard Rüggeberg - * . - * 13-Aug-1993 Per Abrahamsen - * Recognize \verb*. Reported by Eckhard Rüggeberg - * . - * 08-Aug-1993 Per Abrahamsen - * Better catch begin and end without arguments. - * 08-Aug-1993 Per Abrahamsen - * Removed free(NULL) as reported by Darrel R. Hankerson - * . - * 08-Aug-1993 Per Abrahamsen - * Removed declaration of realloc for some C compilers. Reported by - * Darrel R. Hankerson - * 30-Jul-1993 Per Abrahamsen - * Added check for italic correction after normal text. - * 29-Jul-1993 Per Abrahamsen - * Added cast for (char*) malloc as suggested by John Interrante - * . - * 29-Jul-1993 Per Abrahamsen - * Added check for missing and extra italic correction. - * 29-Jul-1993 Per Abrahamsen - * Made line number counting more reliable (but it still needs a rewrite)! - * 28-Jul-1993 Per Abrahamsen - * Added check for italic correction before point or comma. - * 6-Jun-1992 Kresten Krab Thorup - * Last Modified: Sat Jun 6 16:37:44 1992 #48 (Kresten Krab Thorup) - * Added test for whitespace before punctuation mark - * 17-Dec-1991 (Last Mod: Tue Dec 17 21:01:24 1991 #41) Kresten Krab Thorup - * Added 'word word` and missing ~ before cite and ref - * 18-Jun-1991 (Last Mod: Tue Jun 18 19:20:43 1991 #17) Kresten Krab Thorup - * Added check (or rather management) for \newenvironment and - * \newcommand - as suggested by Per Abrahamsen abrham@hugin.dk - * 30-May-1991 (Last Mod: Thu May 30 02:22:33 1991 #15) Kresten Krab Thorup - * Added check for `$${punct}' and `{punct}$' constructions - * 30-May-1991 (Last Mod: Wed May 29 10:31:35 1991 #6) Kresten Krab Thorup - * Improved (dynamic) stack management from Andreas Stolcke ... - * - * 26-May-1991 Kresten Krab Thorup - * Initial distribution version. - */ - -%{ - -#include -#include - -#if defined(WIN32) && !defined(__MINGW32__) -#include -#endif -/* #include */ - -/* extern char *realloc(); */ - -#define YY_SKIP_YYWRAP -static int yywrap(void) { return 1; } - -#ifdef NEED_STRSTR -char *strstr(); -#endif - -#define GROUP_STACK_SIZE 10 -#define INPUT_STACK_SIZE 10 - -#define PROGNAME "LaCheck" - - /* macros */ - -#define CG_NAME gstack[gstackp-1].s_name -#define CG_TYPE gstack[gstackp-1].s_type -#define CG_LINE gstack[gstackp-1].s_line -#define CG_ITALIC gstack[gstackp-1].italic -#define CG_FILE gstack[gstackp-1].s_file - -char *bg_command(char *name); -void pop(void); -void push(const char *p_name, int p_type, int p_line); -void linecount(void); -void g_checkend(int n); -void e_checkend(int n, char *name); -void f_checkend(char *name); -void input_file(char *file_nam); -void print_bad_match(char *end_command, int type); -int check_top_level_end(char *end_command, int type); - - /* global variables */ - -char returnval[100]; -int line_count = 1; -int warn_count = 0; -char *file_name; -char verb_char; - - /* the group stack */ - -typedef struct tex_group - { - char *s_name; - int s_type; - int s_line; - int italic; - char *s_file; - } tex_group; - -tex_group *gstack; -int gstack_size = GROUP_STACK_SIZE; -int gstackp = 0; - -typedef struct input_ - { - YY_BUFFER_STATE stream; - char *name; - int linenum; - } input_; - -input_ *istack; -int istack_size = INPUT_STACK_SIZE; -int istackp = 0; - -int def_count = 0; - -%} - -%x B_ENVIRONMENT E_ENVIRONMENT VERBATIM INCLUDE MATH COMMENT VERB DEF -%x AFTER_DISPLAY ENV_DEF ICOR GETICOR - -b_group ("{"|\\bgroup) -e_group ("}"|\\egroup) - -b_math \\\( -e_math \\\) -math \$ - -b_display \\\[ -e_display \\\] -display \$\$ - -par ([ \t]*\n[ \t]*\n[ \t\n]*) -non_par_ws ([ \t]+\n?[ \t]*|[ \t]*\n[ \t]*|[ \t]*\n?[ \t]+) - -ws [ \n\t](%[^\n]\n)* -space ({ws}|\~|\\space) -hard_space (\~|\\space) - -u_letter [A-ZÆØÅ] -l_letter [a-zæøå] -punct [\!\.\?] -atoz [a-zA-Z] -letter [A-ZÆØÅa-zæøå] - -c_bin ("-"|"+"|"\\cdot"|"\\oplus"|"\\otimes"|"\\times") -l_bin (",") - -general_abbrev {letter}+{punct} - -non_abbrev {u_letter}{u_letter}+{punct} - -italic_spec (sl|it) -normal_spec normalshape -swap_spec em -font_spec (rm|bf|{italic_spec}|tt|{swap_spec}|mediumseries|{normal_spec}) - -primitive \\(above|advance|catcode|chardef|closein|closeout|copy|count|countdef|cr|crcr|csname|delcode|dimendef|dimen|divide|expandafter|font|hskp|vskip|openout) - -symbol ("$"("\\"{atoz}+|.)"$"|"\\#"|"\\$"|"\\%"|"\\ref") - -%% - -<*>"\\\\" { ; } - -"\\\%" { ; } - -"%"[^\n]*\n { line_count++; } - -\n { line_count++; } - -"\\\{" { ; } - -"\\\}" { ; } - -"\\\$" { ; } - -"{"{ws} { - if (CG_TYPE != 4 && CG_TYPE != 5) { - if (!(CG_TYPE == 2 && strstr(CG_NAME, "array"))) { - printf( "\"%s\", line %d: possible unwanted space at \"{\"\n", - file_name, line_count); - ++warn_count ; - } - } - push( "{", 0, line_count); - linecount(); - } - -{b_group} { push( "{", 0, line_count);} - -{e_group} { - { - int italic = CG_ITALIC; - g_checkend(0); - if (italic && !CG_ITALIC) - BEGIN(GETICOR) ; - else - BEGIN(INITIAL); - }} - -{e_group} { g_checkend(0); } - -[A-Za-zæøåÆØÅ0-9;:!()]+ { - { - if (!CG_ITALIC) - { - printf("\"%s\", line %d: you may need a \\/ before \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - } - BEGIN(INITIAL); - }} - -[A-Za-zæøåÆØÅ0-9;:!?()`']+ { - { - if (CG_ITALIC) - { - printf("\"%s\", line %d: \\/ not needed before italic text \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - } - BEGIN(INITIAL); - }} - -^[A-Za-zæøåÆØÅ0-9;:!?()`',.]+{ws}*/\\\/ { - { - linecount(); - if (!CG_ITALIC) - { - printf("\"%s\", line %d: \\/ not needed after non-italic text \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - } - }} - -{ws}[A-Za-zæøåÆØÅ0-9;:!?()`',.]+{ws}*/\\\/ { - { - linecount(); - if (!CG_ITALIC) - { - printf("\"%s\", line %d: \\/ is not needed after non-italic \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - } - }} - -\\\/ { BEGIN(INITIAL); } - -\\\/ { BEGIN(ICOR); } - -\\\/ { - { - printf("\"%s\", line %d: double \\/ found \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - BEGIN(ICOR); - }} - -\\{italic_spec}/[^a-zA-Z] { CG_ITALIC = 1; } - -\\{normal_spec}/[^a-zA-Z] { - { - if(CG_ITALIC) - BEGIN(GETICOR); - else - BEGIN(INITIAL); - CG_ITALIC = 0; - }} - -\\{normal_spec}/[^a-zA-Z] { CG_ITALIC = 0; } - -\\{swap_spec}/[^a-zA-Z] { - { - if(CG_ITALIC) - BEGIN(GETICOR); - else - BEGIN(INITIAL); - CG_ITALIC = !CG_ITALIC; - }} - -\\{swap_spec}/[^a-zA-Z] { CG_ITALIC = !CG_ITALIC; } - -[,.] { - { - printf("\"%s\", line %d: do not use \\/ before \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - BEGIN(INITIAL); - }} - -{ws} { ; } - -~ { ; } - -[^\n] { - { - unput(yytext[0]); - BEGIN(INITIAL); - }} - -"\\"[exg]?(def|newcommand)[^\n\{]+ BEGIN(DEF); - -{b_group} { ++def_count; } - -{e_group} { --def_count; - if(def_count == 0) - BEGIN(INITIAL); } - -. { ; } - -"\\"newenvironment"{"[a-zA-Z]+"}"[^\n\{]+ BEGIN(ENV_DEF); - -{b_group} { ++def_count; } - -{e_group} { --def_count; - if(def_count == 0) - BEGIN(DEF); } - -. { ; } - -{b_math} { - if(CG_TYPE == 4 || CG_TYPE == 5) - print_bad_match(yytext,4); - else - { - push( yytext, 4, line_count); - }} - -{e_math} { g_checkend(4); } - -{b_display} { - if(CG_TYPE == 4 || CG_TYPE == 5) - print_bad_match(yytext,5); - else - { - push( yytext, 5, line_count); - }} - - -{e_display} { g_checkend(5); BEGIN(AFTER_DISPLAY);} - -{punct} { - - printf( "\"%s\", line %d: punctuation mark \"%s\" should be placed before end of displaymath\n", - file_name, line_count, yytext); - ++warn_count ; - - BEGIN(INITIAL); } - -(\n|.) { unput(yytext[0]); BEGIN(INITIAL); } - -{punct}/("\$"|"\\)") { if (CG_TYPE == 4) - { - printf( "\"%s\", line %d: punctuation mark \"%s\" should be placed after end of math mode\n", - file_name, line_count, yytext); - ++warn_count ; - BEGIN(INITIAL); - }} - -{math} { - - if(CG_TYPE == 5) - print_bad_match(yytext, 4); - else - - if(CG_TYPE == 4) - { - e_checkend(4, yytext); - } - else - { - push( yytext, 4, line_count); - }} - - -{display} { - - if(CG_TYPE == 4) - print_bad_match(yytext,5); - else - - if(CG_TYPE == 5) - { - e_checkend(5, yytext); - BEGIN(AFTER_DISPLAY); - } - else - { - push( yytext, 5, line_count); - }} - -\\begingroup/[^a-zA-Z] { - { - push("\\begingroup", 1, line_count); - }} - - -\\endgroup/[^a-zA-Z] { - { - g_checkend(1); - }} - - -\\begin[ \t]*"{" { BEGIN(B_ENVIRONMENT); } - -\\begin[ \t]*(%[^\n]*)?/\n { - { - - printf("\"%s\", line %d: {argument} missing for \\begin\n", - file_name, line_count) ; - ++warn_count; - }} - -[^\}\n]+ { - { - if (strcmp( yytext, "verbatim" ) == 0 ) - { - input(); - BEGIN(VERBATIM); - } - else - { - push(yytext, 2, line_count); - - if ( strcmp (yytext, "sl" ) == 0 - || strcmp (yytext, "it" ) == 0) - CG_ITALIC = 1; - else if (strcmp (yytext, "normalshape") == 0) - CG_ITALIC = 0; - else if (strcmp (yytext, "em") == 0) - CG_ITALIC = !CG_ITALIC; - - input(); - BEGIN(INITIAL); - } - }} - -\\end[ \t]*\{verbatim\} { BEGIN(INITIAL); } - -\t { - printf("\"%s\", line %d: TAB character in verbatim environment\n", - file_name, line_count) ; - ++warn_count; - } - -. { ; } - -\n { ++line_count; } - - -\\verb\*?. { - verb_char = yytext[yyleng-1]; - BEGIN(VERB); - } - -\n { - printf("\"%s\", line %d: \\verb should not contain end of line characters\n", - file_name, line_count) ; - ++line_count; -} - -. { - if ( *yytext == verb_char ) - BEGIN(INITIAL); -} - - -\\end[ \t]*"{" { BEGIN(E_ENVIRONMENT); } - -\\end[ \t]*(%[^\n]*)?/\n { - { - printf("\"%s\", line %d: {argument} missing for \\end\n", - file_name, line_count) ; - ++warn_count; - }} - - -[^\}\n]+ { - { - e_checkend(2, yytext); - input(); - - BEGIN(INITIAL); - }} - - -{ws}({letter}".")*{letter}*{l_letter}"."/{non_par_ws}+{l_letter} { - { - linecount(); - printf( "\"%s\", line %d: missing `\\ ' after \"%s\"\n", - file_name, line_count, ++yytext); - ++warn_count ; - BEGIN(INITIAL); - }} - -({l_letter}".")*{letter}*{l_letter}"."/{non_par_ws}+{l_letter} { - { - printf( "\"%s\", line %d: missing `\\ ' after \"%s\"\n", - file_name, line_count, yytext); - ++warn_count ; - BEGIN(INITIAL); - }} - -{non_abbrev}/{non_par_ws}{u_letter} { - { - linecount(); - printf("\"%s\", line %d: missing `\\@' before `.' in \"%s\"\n", - file_name, line_count, yytext); - ++warn_count ; - BEGIN(INITIAL); - }} - -({hard_space}{space}|{space}{hard_space}) { - - printf("\"%s\", line %d: double space at \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - linecount(); - BEGIN(INITIAL); - } - -{c_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?\\ldots{ws}?(\\(\.|\,|\;|\:))*{ws}?{c_bin} { - printf("\"%s\", line %d: \\ldots should be \\cdots in \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - linecount(); - } - -[^\\]{l_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?\\cdots{ws}?(\\(\.|\,|\;|\:))*{ws}?[^\\]{l_bin} { - printf("\"%s\", line %d: \\cdots should be \\ldots in \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - linecount(); - BEGIN(INITIAL); - } - -{c_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?"."+{ws}?(\\(\.|\,|\;|\:))*{ws}?{c_bin} { - printf("\"%s\", line %d: Dots should be \\cdots in \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - linecount(); - } - -[^\\]{l_bin}{ws}?(\\(\.|\,|\;|\:))*{ws}?"."+{ws}?(\\(\.|\,|\;|\:))*{ws}?[^\\]{l_bin} { - printf("\"%s\", line %d: Dots should be \\ldots in \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - linecount(); - BEGIN(INITIAL); - } - - -\.\.\. { - printf("\"%s\", line %d: Dots should be ellipsis \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - BEGIN(INITIAL); - } - -\\label\{[^#$%^&*+={\~"<>\n\t }]*[#$%^&*+={\~"<>\n\t ][^%}]*\} { - linecount(); - printf("\"%s\", line %d: bad character in label \"%s\", see C.10.2\n", - file_name, line_count, yytext); - } - -{par}"\\"ref/[^A-Za-z] { - linecount(); - BEGIN(INITIAL); - } - -{ws}"\\"ref/[^A-Za-z] { - linecount(); - printf("\"%s\", line %d: perhaps you should insert a `~' before \"%s\"\n", - file_name, line_count, ++yytext); - BEGIN(INITIAL); - } - -{ws}"\\"footnote/[^A-Za-z] { - linecount(); - printf("\"%s\", line %d: whitespace before footnote in \"%s\"\n", - file_name, line_count, ++yytext); - BEGIN(INITIAL); - } - - -{primitive}/[^a-zA-Z] { - { - printf("\"%s\", line %d: Don't use \"%s\" in LaTeX documents\n", - file_name, line_count, yytext); - ++warn_count ; - }} - -\\left{ws}*\\?. { linecount() ;} -\\right{ws}*\\?. { linecount(); } - -[^\{]\\{font_spec}/[ \t]*"{" { - { - linecount(); - printf("\"%s\", line %d: Fontspecifiers don't take arguments. \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - /* (void) input(); */ - BEGIN(INITIAL); - }} - -\\([a-zA-Z\@]+\@[a-zA-Z\@]*|[a-zA-Z\@]*\@[a-zA-Z\@]+) { - { - printf("\"%s\", line %d: Do not use @ in LaTeX macro names. \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - }} - -{ws}"'"+{letter}+ { - { - linecount(); - printf("\"%s\", line %d: Use ` to begin quotation, not ' \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - BEGIN(INITIAL); - }} - -{letter}+"`" { - { - printf("\"%s\", line %d: Use ' to end quotation, not ` \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - BEGIN(INITIAL); - }} - - -{ws}+{punct} { - { - printf("\"%s\", line %d: Whitespace before punctation mark in \"%s\"\n", - file_name, line_count, yytext); - ++warn_count; - linecount(); - BEGIN(INITIAL); - }} - -"%" { BEGIN(COMMENT); } - -\n { BEGIN(INITIAL); ++line_count; } - -. { ; } - - -\\(input|include)([ \t]|"{") { BEGIN(INCLUDE); } - -[^\}\n]+ { - { - if ( strstr(yytext,".sty") == NULL ) - { - printf("** %s:\n", yytext); - input_file(yytext); - } - else - { - printf("\"%s\", line %d: Style file `%s\' omitted.\n", - file_name, - line_count, - yytext); - input(); - } - BEGIN(INITIAL); - }} - -\\endinput/[^A-Za-z] | -<> { - if (--istackp < 0) - yyterminate(); - - else - { - fclose(yyin); - f_checkend(file_name); - yy_switch_to_buffer(istack[istackp].stream); - free(file_name); - line_count = istack[istackp].linenum; - file_name = istack[istackp].name; - input(); - BEGIN(INITIAL); - } - - } - - -. { ; } -%% -int main(int argc, char *argv[]) -{ - /* allocate initial stacks */ - gstack = (tex_group *)malloc(gstack_size * sizeof(tex_group)); - istack = (input_ *)malloc(istack_size * sizeof(input_)); - if ( gstack == NULL || istack == NULL ) { - fprintf(stderr, "%s: not enough memory for stacks\n", PROGNAME); - exit(3); - } - - if(argc > 1) - { - if ( (file_name = (char*) malloc(strlen(argv[1]) + 5)) == NULL ) { - fprintf(stderr, "%s: out of memory\n", PROGNAME); - exit(3); - } - - strcpy(file_name, argv[1]); - strcat(file_name, ".tex" ); - - if ((yyin = fopen( file_name, "r")) != NULL ) - { - push(file_name, 3, 1); - yylex(); - f_checkend(file_name); - } - else { - file_name[strlen(file_name) - 4] = '\0'; - if ((yyin = fopen( file_name, "r")) != NULL ) - { - push(file_name, 3, 1); - yylex(); - f_checkend(file_name); - } - else - fprintf(stderr, - "%s: Could not open : %s\n",PROGNAME, argv[1]); - } - } - else - { - printf("\n* %s *\n\n",PROGNAME); - printf("\t...a consistency checker for LaTeX documents.\n"); - printf("$Id: lacheck.lex,v 1.26 1998/03/07 07:46:45 abraham Exp $\n\n"); - - printf("Usage:\n\tlacheck filename[.tex] \n\n\n"); - - printf("\tFrom within Emacs:\n\n"); - printf("\tM-x compile RET lacheck filename[.tex] RET\n\n"); - printf("\tUse C-x ` to step through the messages.\n\n"); - printf("\n\tThe found context is displayed in \"double quotes\"\n\n"); - printf("Remark:\n\tAll messages are only warnings!\n\n"); - printf("\tYour document may be right even though LaCheck says "); - printf("something else.\n\n"); - } - return(0); -} - -#ifdef NEED_STRSTR -char * -strstr(string, substring) - register char *string; /* String to search. */ - char *substring; /* Substring to try to find in string. */ -{ - register char *a, *b; - - /* First scan quickly through the two strings looking for a - * single-character match. When it's found, then compare the - * rest of the substring. - */ - - b = substring; - if (*b == 0) { - return string; - } - for ( ; *string != 0; string += 1) { - if (*string != *b) { - continue; - } - a = string; - while (1) { - if (*b == 0) { - return string; - } - if (*a++ != *b++) { - break; - } - } - b = substring; - } - return (char *) 0; -} -#endif /* NEED_STRSTR */ - -void push(const char *p_name, int p_type, int p_line) -{ - if ( gstackp == gstack_size ) { /* extend stack */ - gstack_size *= 2; - gstack = (tex_group *)realloc(gstack, gstack_size * sizeof(tex_group)); - if ( gstack == NULL ) { - fprintf(stderr, "%s: stack out of memory", PROGNAME); - exit(3); - } - } - - if ( (gstack[gstackp].s_name = - (char *)malloc(strlen(p_name) + 1)) == NULL || - (gstack[gstackp].s_file = - (char *)malloc(strlen(file_name) + 1)) == NULL ) { - fprintf(stderr, "%s: out of memory\n", PROGNAME); - exit(3); - } - - strcpy(gstack[gstackp].s_name, p_name); - gstack[gstackp].s_type = p_type; - gstack[gstackp].s_line = p_line; - gstack[gstackp].italic = ( (p_type == 4 || p_type == 5) - ? 1 - : ( gstackp - ? gstack[gstackp - 1].italic - : 0)); - strcpy(gstack[gstackp].s_file,file_name); - ++gstackp; - -} - -void input_file(char *file_nam) -{ - char *tmp_file_name; - FILE *tmp_yyin; - - if ( (tmp_file_name = (char*) malloc(strlen(file_nam) + 5)) == NULL ) { - fprintf(stderr, "%s: out of memory\n", PROGNAME); - exit(3); - } - strcpy(tmp_file_name,file_nam); - - if (istackp == istack_size) { /* extend stack */ - istack_size *= 2; - istack = (input_ *)realloc(istack, istack_size * sizeof(input_)); - if ( istack == NULL ) { - fprintf(stderr, "%s: \\input stack out of memory\n", PROGNAME); - exit(3); - } - } - - istack[istackp].stream = YY_CURRENT_BUFFER; - istack[istackp].linenum = line_count; - istack[istackp].name = file_name; - ++istackp; - - (void) strcat(tmp_file_name, ".tex"); - if ((tmp_yyin = fopen( tmp_file_name, "r")) != NULL ) - { - yyin = tmp_yyin; - yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); - file_name = tmp_file_name; - push(file_name, 3, 1); - line_count = 1; - } - else { - tmp_file_name[strlen(tmp_file_name) - 4] = '\0'; - if ((tmp_yyin = fopen( tmp_file_name , "r")) != NULL ) - { - yyin = tmp_yyin; - yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); - file_name = tmp_file_name; - push(file_name, 3, 1); - line_count = 1; - } - else - { - --istackp; - free(tmp_file_name); - printf("\"%s\", line %d: Could not open \"%s\"\n", - file_name, - line_count, - file_nam); - input(); - } - } -} - -void pop(void) -{ - if ( gstackp == 0 ) - { - fprintf(stderr, "%s: Stack underflow\n", PROGNAME); - exit(4); - } - --gstackp; - - free(gstack[gstackp].s_name); - free(gstack[gstackp].s_file); -} - -char *bg_command(char *name) -{ - - switch (CG_TYPE) { - - case 2: - (void) strcpy( returnval, "\\begin{" ); - (void) strcat( returnval, (char *) name); - (void) strcat( returnval, "}" ); - break; - - case 3: - (void) strcpy( returnval, "beginning of file " ); - (void) strcat( returnval, (char *) name); - break; - - case 4: - (void) strcpy( returnval, "math begin " ); - (void) strcat( returnval, (char *) name); - break; - - case 5: - (void) strcpy( returnval, "display math begin " ); - (void) strcat( returnval, (char *) name); - break; - - default: - (void) strcpy( returnval, name ); - - } - - return ((char *)returnval); -} - -static char *eg_command(char *name, int type) -{ - - switch (type) { - - case 2: - (void) strcpy( returnval, "\\end{" ); - (void) strcat( returnval, (char *) name); - (void) strcat( returnval, "}" ); - break; - - case 3: - (void) strcpy( returnval, "end of file " ); - (void) strcat( returnval, (char *) name); - break; - - case 4: - (void) strcpy( returnval, "math end " ); - (void) strcat( returnval, (char *) name); - break; - - case 5: - (void) strcpy( returnval, "display math end " ); - (void) strcat( returnval, (char *) name); - break; - - default: - (void) strcpy( returnval, name ); - break; - } - - return ((char *)returnval); -} - - -void g_checkend(int n) -{ - if ( check_top_level_end(yytext,n) == 1 ) - { - if ( CG_TYPE != n ) - print_bad_match(yytext,n); - else - pop(); - } -} - -void e_checkend(int n, char *name) -{ - if ( check_top_level_end(name,n) == 1 ) - { - if ( CG_TYPE != n || strcmp( CG_NAME, name ) != 0 ) - print_bad_match(name,n); - - pop(); - - } -} - -void f_checkend(char *name) -{ - if ( check_top_level_end(name,3) == 1 ) - { - if ( CG_TYPE != 3 || strcmp( CG_NAME, name ) != 0 ) - - while( CG_TYPE != 3 ) - { - print_bad_match(name,3); - pop(); - } - - pop(); - } -} - -void print_bad_match(char *end_command, int type) -{ - printf("\"%s\", line %d: <- unmatched \"%s\"\n", - file_name, - line_count, - eg_command( end_command , type) ) ; - - printf("\"%s\", line %d: -> unmatched \"%s\"\n", - CG_FILE, - CG_LINE, - bg_command( CG_NAME ) ) ; - warn_count += 2; -} - -int check_top_level_end(char *end_command, int type) -{ - if ( gstackp == 0 ) - { - printf("\"%s\", line %d: \"%s\" found at top level\n", - file_name, - line_count, - eg_command( end_command, type )) ; - ++warn_count; - return(0); - } - else - return(1); -} - -void linecount(void) -{ - int i; - for (i = 0; i < yyleng; i++) - if(yytext[i] == '\n') - line_count++; -} - diff --git a/Build/source/texk/lacheck/lacheck.man b/Build/source/texk/lacheck/lacheck.man deleted file mode 100644 index 45a221f3e0e..00000000000 --- a/Build/source/texk/lacheck/lacheck.man +++ /dev/null @@ -1,113 +0,0 @@ -.TH "LaCheck" "1" "%%LACHECKDATE%%" "%%LACHECKREV%%" -.SH NAME -lacheck - A consistency checker for LaTeX documents. -.SH SYNOPSIS -.B lacheck -.I filename -[ -.I .tex -] -.SH DESCRIPTION -LaCheck is a general purpose consistency checker for LaTeX documents. -It reads a LaTeX document and displays warning messages, if it finds -bad sequences. It should be noted, that the badness is -.I very -subjective. LaCheck is designed to help find common mistakes in LaTeX -documents, especially those made by beginners. -.LP -The things checked are: -.LP -Mismatched groups (braces), environments and math mode -delimiters. When a mismatch is found, line numbers for -.I "both" -start and end of the mismatch is given. The error messages comes in -pairs, one for the end match and one for the beginning, marked with -\`<-\' and \`->\' respectively. -.LP -Bad spacing including missing a \`\\ \' after an abbreviation, missing -an \`\\@\' before a punctuation mark in a paragraph that is ended by -an capital letter, double spaces like \` \~\', bad usage of ellipsis -(like using ... instead of \\ldots, or using \\ldots where \\cdots -should be used), missing \~ before a \\cite or \\ref commands, space -before footnotes, italic corrections before comma, point, or italic -text, italic correction after normal text, missing italic correction -when switching from italic to normal text, and double italic -correction. -.LP -Badly placed punctuation marks around end of math mode -delimiters. This is, punctuation placed right after display math end -or punctuation placed right before text math end. Sequences of -whitespace followed by punctuation marks are also caught. -.LP -Bad use of quotation characters, i.e. constructs like "\'word" or -"word\`" are warned about, tabs in verbatim environments are caught, -certain TeX primitives are frowned upon, attempts to give font -specifiers arguments such as \\em{text} are noted, and use of @ in -LaTeX macros are reported. -.LP -LaCheck will read files that are input using \\input or \\include. -Files with suffix \`.sty\' are omitted, as they probably will cause -LaCheck to crash. -.LP -LaCheck may be invoked from within Emacs(1) using compile: - -To run: -.B "M-x compile RET lacheck RET" -, and then -.B "C-x `" -to parse the messages - -.SH OUTPUT -The output is UNIX-error like, and may be parsed using Emacs(1) -compile mode. Here is a sample: - -.PD 0 -lacheck compiler -.TP -"/usr/mef/compiler.tex", line 34: missing \`\\\\\\\\ \' after "etc." -.TP -"/usr/mef/compiler.tex", line 179: double space at " ~" -.TP -"/usr/mef/compiler.tex", line 186: <- unmatched "}" -.TP -"/usr/mef/compiler.tex", line 181: -> unmatched "$$" -.PD 1 -.LP -A control space \`\\ \' should be inserted at line 34, to prevent an -end-of-sentence space. -Also, at line 179, the first space of the sequence " ~" should -probably be deleted. -The last two lines is an example, where the user mistyped, and -probably inserted an extra "}" somewhere. - -.SH DIAGNOSTICS -Some special cases should be explained. In cases where a sentence ends -with something that LaCheck thinks is an abbreviation an missing \`\\ -\' error may also occur, if the following sentence begins with a -lowercase letter. -.LP -A mismatch error may cause more to follow, due to the chosen -algorithm. In such cases just correct the -.I "first" -error and run LaCheck again -.LP -Braces, environments and math mode must be balanced within a file. -.LP -LaCheck may be confused by unmatched stuff placed inside verbatim-like -environments called something else than exactly \`verbatim\'. -.SH FILES -%%LACHECKPATH%% -.SH SEE ALSO -tex(1), emacs(1), latex(1) -.SH BUGS -LaCheck gets confused by advanced macros, is fooled by simple macros, -can't figure out if you use a non-standard way to switch italic on or -off, does not like TeX at all, does not provide any options to turn -off specific warnings, and is at best a crude approximation. -.LP -Ideas for improvements and bug reports are very welcome. Such -should be directed to the maintainers, their email address is -. -.SH AUTHOR -Kresten Krab Thorup with modifications by Per Abrahamsen. - diff --git a/Build/source/texk/lacheck/lacheck.test b/Build/source/texk/lacheck/lacheck.test index 1478bd22885..21b1d5ed0e9 100755 --- a/Build/source/texk/lacheck/lacheck.test +++ b/Build/source/texk/lacheck/lacheck.test @@ -1,10 +1,10 @@ #! /bin/sh -# Copyright (C) 2009 Peter Breitenlohner +# Copyright (C) 2009, 2010 Peter Breitenlohner # You may freely use, modify and/or distribute this file. -./lacheck $srcdir/test.tex | \ - sed -e "s!$srcdir/test.tex!test.tex!g" >test.xout || exit 1 +./lacheck $srcdir/$LACHECK_TREE/test.tex | \ + sed -e "s!$srcdir/$LACHECK_TREE/test.tex!./test.tex!g" >test.out || exit 1 -diff $srcdir/test.out test.xout || exit 1 +diff $srcdir/$LACHECK_TREE/test.old test.out || exit 1 diff --git a/Build/source/texk/lacheck/make_vms.com b/Build/source/texk/lacheck/make_vms.com deleted file mode 100644 index 24d224733a0..00000000000 --- a/Build/source/texk/lacheck/make_vms.com +++ /dev/null @@ -1,16 +0,0 @@ -$ if f$trnlnm("sys_arch").eqs."ALPHA" -$ then -$ CC :== CC/NoList/opt=level=4/standard=vaxc -$ else -$ CC :==gcc/Nostandard/NoCase_Hack/NoList -$ endif -$ LINK :== Link/NoMap -$ CC lacheck.c -$ if f$trnlnm("sys_arch").eqs."ALPHA" -$ then -$ LINK lacheck.obj -$ else -$ LINK lacheck.obj,gnu_cc:[000000]GCCLIB/LIB, sys$share:vaxcrtl/opt -$ endif -$ Library/Help/Create=Blocks:10 lacheck.hlb lacheck.hlp -$ EXIT diff --git a/Build/source/texk/lacheck/test.out b/Build/source/texk/lacheck/test.out deleted file mode 100644 index 6e2d2e50491..00000000000 --- a/Build/source/texk/lacheck/test.out +++ /dev/null @@ -1,33 +0,0 @@ -"test.tex", line 3: possible unwanted space at "{" -"test.tex", line 4: you may need a \/ before "world" -"test.tex", line 5: \/ not needed before italic text "world" -"test.tex", line 6: \/ not needed after non-italic text "hello" -"test.tex", line 7: double \/ found "\/" -"test.tex", line 8: do not use \/ before "," -"test.tex", line 9: punctuation mark "." should be placed before end of displaymath -"test.tex", line 10: punctuation mark "." should be placed after end of math mode -"test.tex", line 11: {argument} missing for \begin -"test.tex", line 13: TAB character in verbatim environment -"test.tex", line 15: {argument} missing for \end -"test.tex", line 16: missing `\ ' after "a.k.a." -"test.tex", line 17: missing `\@' before `.' in "HELLO." -"test.tex", line 18: double space at "~ " -"test.tex", line 19: \ldots should be \cdots in "+ \ldots +" -"test.tex", line 20: \cdots should be \ldots in " , \cdots ," -"test.tex", line 21: Dots should be \cdots in "+ .. +" -"test.tex", line 22: Dots should be \ldots in " , .. ," -"test.tex", line 23: Dots should be ellipsis "..." -"test.tex", line 24: bad character in label "\label{hello evil world}", see C.10.2 -"test.tex", line 25: perhaps you should insert a `~' before "\ref" -"test.tex", line 26: whitespace before footnote in "\footnote" -"test.tex", line 27: Don't use "\above" in LaTeX documents -"test.tex", line 28: Fontspecifiers don't take arguments. " \rm" -"test.tex", line 29: Do not use @ in LaTeX macro names. "\hello@world" -"test.tex", line 30: Use ` to begin quotation, not ' " ''world" -"test.tex", line 31: Use ' to end quotation, not ` "hello`" -"test.tex", line 32: Whitespace before punctation mark in " ." -"test.tex", line 34: <- unmatched "display math end \]" -"test.tex", line 33: -> unmatched "math begin \(" -"test.tex", line 35: \verb should not contain end of line characters -"test.tex", line 43: <- unmatched "end of file test.tex" -"test.tex", line 33: -> unmatched "math begin \(" diff --git a/Build/source/texk/lacheck/test.tex b/Build/source/texk/lacheck/test.tex deleted file mode 100644 index 98b18c1e3b5..00000000000 --- a/Build/source/texk/lacheck/test.tex +++ /dev/null @@ -1,42 +0,0 @@ -% $Revision: 1.4 $ - -{ } % Unwanted space after `{' -{\em hello} world % May need `\/' before `world' -{\em hello\/ world}. % `\/' not needed before `world' -hello\/ world % `\/' not needed after `hello' -{\em hello\/}\/ world % Double `\/' -{\em hello\/}, world % `\/' before `,' or `.' -\[display math\]. % Punctuation mark after end of display math -$math.$ % Punctuation mark before end of math mode -\begin % Missing argument for \begin -\begin{verbatim} -TAB TAB % Tab in verbatim -\end{verbatim} -\end % Missing argument for \end -a.k.a. world % Missing `\ ' after abbreviation -HELLO. World % Missing `\@' before `.' -hello~ world % Double space -$ + \ldots + $ % Should be \cdots -$ , \cdots , $ % Should be \ldots -$ + .. + $ % Should be \cdots -$ , .. , $ % Should be \ldots -hello world... % Should be ellipsis -\label{hello evil world} % Bad character in label -Hello \ref{world} % Missing ~ -Hello \footnote{world} % Whitespace before footnote -\above % Primitive in LaTeX -hello \rm{world} % Font specifier with argument -\hello@world % @ in LaTeX macro name -hello ''world'' % Quote begined with ' -``hello`` world % Quote ended with ` -world . % Whitespace before punctuation mark -\(hello -world\] % Bad match -\verb|hello -world| % multi-line \verb - -% Local Variables: -% mode: LaTeX -% TeX-master: t -% TeX-auto-update: nil -% End: -- cgit v1.2.3