From c1d5b8b44e3980731c43ebd527d84be4b7f9c197 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Wed, 9 Jun 2010 07:51:02 +0000 Subject: more preparation for detex 2.8 git-svn-id: svn://tug.org/texlive/trunk@18840 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/detex/Makefile.am | 19 +- Build/source/texk/detex/Makefile.in | 34 +- Build/source/texk/detex/README | 189 - Build/source/texk/detex/configure | 60 +- Build/source/texk/detex/configure.ac | 13 +- .../source/texk/detex/detex-2.7-PATCHES/TL-Changes | 6 + Build/source/texk/detex/detex-2.7/README | 189 + Build/source/texk/detex/detex-2.7/detex.h | 44 + Build/source/texk/detex/detex-2.7/detex.l | 740 +++ Build/source/texk/detex/detex-2.7/detex.man | 126 + .../source/texk/detex/detex-2.8-PATCHES/TL-Changes | 3 - .../texk/detex/detex-2.8-PATCHES/patch-01-ANSI-C | 186 + Build/source/texk/detex/detex-2.8/detex.l | 64 +- Build/source/texk/detex/detex-2.8/lexout.c | 6234 ++++++++++++++++++++ Build/source/texk/detex/detex.h | 44 - Build/source/texk/detex/detex.l | 740 --- Build/source/texk/detex/detex.man | 126 - 17 files changed, 7638 insertions(+), 1179 deletions(-) delete mode 100644 Build/source/texk/detex/README create mode 100644 Build/source/texk/detex/detex-2.7-PATCHES/TL-Changes create mode 100644 Build/source/texk/detex/detex-2.7/README create mode 100644 Build/source/texk/detex/detex-2.7/detex.h create mode 100644 Build/source/texk/detex/detex-2.7/detex.l create mode 100644 Build/source/texk/detex/detex-2.7/detex.man create mode 100644 Build/source/texk/detex/detex-2.8-PATCHES/patch-01-ANSI-C create mode 100644 Build/source/texk/detex/detex-2.8/lexout.c delete mode 100644 Build/source/texk/detex/detex.h delete mode 100644 Build/source/texk/detex/detex.l delete mode 100644 Build/source/texk/detex/detex.man (limited to 'Build') diff --git a/Build/source/texk/detex/Makefile.am b/Build/source/texk/detex/Makefile.am index 000ec857d59..528c9289a7d 100644 --- a/Build/source/texk/detex/Makefile.am +++ b/Build/source/texk/detex/Makefile.am @@ -1,17 +1,23 @@ ## Makefile.am for the TeX Live subdirectory texk/detex/ ## -## 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 -EXTRA_DIST = detex-2.7 detex-2.8 detex-2.8-PATCHES +## We want to re-distribute the whole original detex source tree. +EXTRA_DIST = $(DETEX_TREE) +## Patches applied to the original source tree +EXTRA_DIST += $(DETEX_TREE)-PATCHES + +## Prepare for switch detex-2.7 -> detex-2.8 +EXTRA_DIST += $(OTHER_TREE) $(OTHER_TREE)-PATCHES # in case of an SVN repository dist-hook: rm -rf `find $(distdir) -name .svn` -INCLUDES = $(KPATHSEA_INCLUDES) +INCLUDES = -I$(top_srcdir)/$(DETEX_TREE) $(KPATHSEA_INCLUDES) AM_CPPFLAGS = -DKPATHSEA -Dlint AM_CFLAGS = $(WARNING_CFLAGS) @@ -22,7 +28,9 @@ AM_CFLAGS = $(WARNING_CFLAGS) bin_PROGRAMS = detex -detex_SOURCES = detex.h detex.l +detex_SOURCES = \ + $(DETEX_TREE)/detex.h \ + $(DETEX_TREE)/detex.l LDADD = $(KPATHSEA_LIBS) @@ -31,7 +39,8 @@ $(detex_OBJECTS): $(KPATHSEA_DEPEND) ## Rebuild libkpathsea @KPATHSEA_RULE@ -dist_man1_MANS = detex.man +man1_MANS = \ + $(DETEX_TREE)/detex.man dist_check_SCRIPTS = detex.test diff --git a/Build/source/texk/detex/Makefile.in b/Build/source/texk/detex/Makefile.in index 81c98d649e2..95ad9b0025c 100644 --- a/Build/source/texk/detex/Makefile.in +++ b/Build/source/texk/detex/Makefile.in @@ -36,8 +36,8 @@ build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = detex$(EXEEXT) subdir = . -DIST_COMMON = README $(am__configure_deps) $(dist_check_SCRIPTS) \ - $(dist_man1_MANS) $(srcdir)/../../build-aux/config.guess \ +DIST_COMMON = $(am__configure_deps) $(dist_check_SCRIPTS) \ + $(srcdir)/../../build-aux/config.guess \ $(srcdir)/../../build-aux/config.sub \ $(srcdir)/../../build-aux/depcomp \ $(srcdir)/../../build-aux/install-sh \ @@ -118,7 +118,7 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man1dir = $(mandir)/man1 NROFF = nroff -MANS = $(dist_man1_MANS) +MANS = $(man1_MANS) ETAGS = etags CTAGS = ctags am__tty_colors = \ @@ -150,6 +150,7 @@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DETEX_TREE = @DETEX_TREE@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ @@ -186,6 +187,7 @@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ +OTHER_TREE = @OTHER_TREE@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ @@ -256,14 +258,19 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ACLOCAL_AMFLAGS = -I ../../m4 -EXTRA_DIST = detex-2.7 detex-2.8 detex-2.8-PATCHES test.lout test.tex \ - test.tout -INCLUDES = $(KPATHSEA_INCLUDES) +EXTRA_DIST = $(DETEX_TREE) $(DETEX_TREE)-PATCHES $(OTHER_TREE) \ + $(OTHER_TREE)-PATCHES test.lout test.tex test.tout +INCLUDES = -I$(top_srcdir)/$(DETEX_TREE) $(KPATHSEA_INCLUDES) AM_CPPFLAGS = -DKPATHSEA -Dlint AM_CFLAGS = $(WARNING_CFLAGS) -detex_SOURCES = detex.h detex.l +detex_SOURCES = \ + $(DETEX_TREE)/detex.h \ + $(DETEX_TREE)/detex.l + LDADD = $(KPATHSEA_LIBS) -dist_man1_MANS = detex.man +man1_MANS = \ + $(DETEX_TREE)/detex.man + dist_check_SCRIPTS = detex.test TESTS = detex.test CLEANFILES = test.out texmf.cnf @@ -402,6 +409,11 @@ distclean-compile: .l.c: $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) +detex.c: $(DETEX_TREE)/detex.l + \ + $(am__skiplex) \ + $(SHELL) $(YLWRAP) `test -f '$(DETEX_TREE)/detex.l' || echo '$(srcdir)/'`$(DETEX_TREE)/detex.l $(LEX_OUTPUT_ROOT).c detex.c -- $(LEX) $(LFLAGS) $(AM_LFLAGS) + mostlyclean-libtool: -rm -f *.lo @@ -410,10 +422,10 @@ clean-libtool: distclean-libtool: -rm -f libtool config.lt -install-man1: $(dist_man1_MANS) +install-man1: $(man1_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" - @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ + @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ @@ -437,7 +449,7 @@ install-man1: $(dist_man1_MANS) uninstall-man1: @$(NORMAL_UNINSTALL) - @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ + @list='$(man1_MANS)'; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ diff --git a/Build/source/texk/detex/README b/Build/source/texk/detex/README deleted file mode 100644 index 59fb6b558c4..00000000000 --- a/Build/source/texk/detex/README +++ /dev/null @@ -1,189 +0,0 @@ -Detex - Version 2.7 - -Detex is a program to remove TeX constructs from a text file. It recognizes -the \input command. - -This program assumes it is dealing with LaTeX input if it sees the string -"\begin{document}" in the text. It recognizes the \include and \includeonly -commands. - -This directory contains the following files: - -README - you're looking at it. - -Makefile - makefile for generating detex on a 4.2BSD Unix system. - -detex.1l - troff source for the detex manual page. - Assuming you have the -man macros, use "make man-page" to - generate it. - -detex.h - Various global definitions. These should be modified to suit - the local installation. - -detex.l - Lex and C source for the detex program. - -lexout.c - C code generated from detex.l using lex on a Sun (SunOS 4.1.1) - This can be useful for DOS, OS/2 or systems that don't have - lex. - -states.sed - sed(1) script to munge the state names in detex.l so that - reasonable names can be used in the source without causing - lex(1) to overflow. - -os2 - subdirectory containing support for compilation on - OS/2 and DOS systems - - -Feel free to redistribute this program, but distribute the complete contents -of this directory. The latest version is available at -http://www.cs.purdue.edu/homes/trinkle/detex/ Send comments and fixes -to me via email. - -Daniel Trinkle -Department of Computer Sciences -Purdue University -West Lafayette, IN 47907-1398 - -April 26, 1986 - -Modified -- June 4, 1986 -Changed so that it automatically recognizes LaTeX source and ignores several -environment modes such as array. - - -Modified (Version 2.0) -- June 30, 1984 -Now handles white space in sequences like "\begin { document }". Detex is not -as easily confused by such things as display mode ends and begins that don't -match up. - - -Modified -- September 19, 1986 -Added the "-e " option to ignore specified LaTeX -environments. - - -Modified -- June 30, 1987 -Added the "-n" no-follow option, to allow detex to ignore \input and \include -commands. Also changed the algorithm for locating the input files. It now -interprets the "." more reasonably (i.e. it is not always the beginning of an -extension). - - -Modified -- December 15, 1988 -Added handling of verbatim environment in LaTeX mode and added it to the list -of modes ignored by default. Because of limitations with lex, it was -necessary to shorten the names of some of the existing start states before -adding a new one (ugh). - - -Modified -- January 3, 1988 -Added ignore of \$ inside $$ (math) pair. - - -Modified (Version 2.2) -- June 25, 1990 -Control sequences are no longer replaced by space, but just removed. This -means accents no longer cause output words to be broken. The "-c" option was -added to show the arguments of \cite, \ref, and \pageref macros. This is -useful when using something like style on the output. - - -Modified (Version 2.3) -- September 7, 1990 -Fixed the handling of Ctl mode a little better and added an exception -for \index on suggestions from kcb@hss.caltech.edu (KC Border). Also -changed the value for DEFAULTINPUTS to coincide with a local change. - - -Modified -- February 10, 1991 -Added -t option to force TeX mode even when seeing the "\begin{document}" -string in the input. - - -Modified -- February 23, 1991 -Based on suggestions from pinard@iro.umontreal.ca (Francois Pinard), I -added support for the SysV string routines (-DUSG), added defines for -the flex lexical scanner (-DFLEX_SCANNER), changed NULL to '\0' when -using it as a character (his sys defined NULL as (void *)0), changed -the Makefile to use ${CC} instead of cc, and added comments about the -new compile time options. - - -Modified (Version 2.4) -- September 2, 1992 -Corrected the way CITEBEGIN worked. Due to serious braindeath I had -the condition wrong in the if test. It should be (fLatex && !fCite). -This solves the problem a couple people reported with amstex style -\ref entries. - -Added a preprocessing sed(1) command to replace all the long, easy to -read state names with short two letter state names (SA-S?) so that lex -won't overflow and I don't have to keep shortening the state names -every time I add one. If a state is added, it must also be added to -states.sed (order is important) along with its unique S? replacement. - -Added \pagestyle, \setcounter, and \verb handling from -K.Sattar@cs.exeter.ac.uk (Khalid Sattar). Also allows invocation as -"delatex" to force LaTeX mode. - -Applied patches from queinnec@cenatls.cena.dgac.fr (Philippe Queinnec) -to handle nested {}s in state (\bibitem, \cite, \index). - -Added special ligature handling (\aa, \ae, \oe, \l, \o, \i, \j, \ss) -at the suggestion of gwp@dido.caltech.edu (G. W. Pigman II). - -Cleaned up the comments on detex.h, added mathmatica to DEFAULTENV. - - -Modified (Version 2.5) -- January 28, 1993 -Leading spaces in macros are no longer stripped. This means -"foo\footnote{ bar}" comes out as "foo bar" instead of "foobar". - -Fixed special ligature handling so it works in cases line {\ss} instead of -just when followed by a space. - - -Modified (Version 2.6) -- July 30, 1993 -Added OS/2 port from hankedr@mail.auburn.edu (Darrel R Hankerson). - -Added handling of leading and trailing ':' in TEXINPUTS per the latest -TeX as suggested by jnp@tfl.dk (J|rgen N|rgaard). - -Changed the way the input path is constructed in SetInputPaths() so we -never try to modify a constant string. - -Changed the way the the ignore environment list is contructed in -SetEnvIgnore() so we never try to modify a constant string. - -Changed the USG define to HAVE_STRING_H. - -Fixed the states.sed script so it only replaces "Input" in the correct -places. I would like to use the \< \> word separator patterns but -they are not supported by all versions of sed. This as least works. - -Changed the detex.c target in the Makefile to use a temporary file -because I experienced problems (segmentation fault) with lex on -Solaris 2.1 when input was from stdin. - - -Modified (Version 2.7) -- September 10, 1997 -Removed line breaks in detex.l between a few patterns and actions. It -appears that flex is no longer able to handle this. Thanks to Anthony -Harris and Marty Leisner - for reporting this. - - -Porting notes -- March 30, 1992 -When using gcc, or compiling on a NeXT, you should compile with --fwritable-strings. With the change to SetInputPaths() in 2.6 this -should no longer be necessary. - -On a NeXT, it has been reported that lex replaces the '\0' with NULL, -and then the compiler complains about it. I think this is an old bug -that is no longer applicable. - -July 30, 1993 -The flex scanner generator does not work because it does not handle -input buffering the same way as lex. I don't know of any reasonable -way to rewrite detex to get around this problem. - -May 25, 1995 -According to alain@ia1.u-strasbg.fr (Alain Ketterlin), using flex -allows 8-bit characters to be handled correctly. diff --git a/Build/source/texk/detex/configure b/Build/source/texk/detex/configure index 2d8716d95d0..a9bff426828 100755 --- a/Build/source/texk/detex/configure +++ b/Build/source/texk/detex/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for detex for TeX Live 2.6. +# Generated by GNU Autoconf 2.65 for detex for TeX Live 2.7. # # Report bugs to . # @@ -701,12 +701,12 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='detex for TeX Live' PACKAGE_TARNAME='detex-for-tex-live' -PACKAGE_VERSION='2.6' -PACKAGE_STRING='detex for TeX Live 2.6' +PACKAGE_VERSION='2.7' +PACKAGE_STRING='detex for TeX Live 2.7' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' -ac_unique_file="detex.l" +ac_unique_file="detex-2.7/detex.l" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -747,6 +747,8 @@ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +OTHER_TREE +DETEX_TREE KPATHSEA_RULE KPATHSEA_DEPEND KPATHSEA_LIBS @@ -1432,7 +1434,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures detex for TeX Live 2.6 to adapt to many kinds of systems. +\`configure' configures detex for TeX Live 2.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1503,7 +1505,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of detex for TeX Live 2.6:";; + short | recursive ) echo "Configuration of detex for TeX Live 2.7:";; esac cat <<\_ACEOF @@ -1613,7 +1615,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -detex for TeX Live configure 2.6 +detex for TeX Live configure 2.7 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. @@ -2095,7 +2097,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by detex for TeX Live $as_me 2.6, which was +It was created by detex for TeX Live $as_me 2.7, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -4545,13 +4547,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4548: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4550: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4551: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4553: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4554: output\"" >&5) + (eval echo "\"\$as_me:4556: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5754,7 +5756,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5757 "configure"' > conftest.$ac_ext + echo '#line 5759 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -6820,7 +6822,7 @@ fi # Define the identity of the package. PACKAGE='detex-for-tex-live' - VERSION='2.6' + VERSION='2.7' cat >>confdefs.h <<_ACEOF @@ -7684,11 +7686,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7687: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7689: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7691: \$? = $ac_status" >&5 + echo "$as_me:7693: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8023,11 +8025,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8026: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8028: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:8030: \$? = $ac_status" >&5 + echo "$as_me:8032: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -8128,11 +8130,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8131: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8133: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8135: \$? = $ac_status" >&5 + echo "$as_me:8137: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8183,11 +8185,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:8186: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8188: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:8190: \$? = $ac_status" >&5 + echo "$as_me:8192: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10550,7 +10552,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10553 "configure" +#line 10555 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10646,7 +10648,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10649 "configure" +#line 10651 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12366,7 +12368,7 @@ Usage: $0 [OPTIONS] Report bugs to ." lt_cl_version="\ -detex for TeX Live config.lt 2.6 +detex for TeX Live config.lt 2.7 configured by $0, generated by GNU Autoconf 2.65. Copyright (C) 2008 Free Software Foundation, Inc. @@ -13404,6 +13406,12 @@ if test "x$kpse_cv_kpse_debug" != xyes; then : fi +DETEX_TREE=detex-2.7 + + +OTHER_TREE=`echo $DETEX_TREE | tr 78 87` + + ac_config_files="$ac_config_files Makefile" @@ -13932,7 +13940,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by detex for TeX Live $as_me 2.6, which was +This file was extended by detex for TeX Live $as_me 2.7, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13998,7 +14006,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -detex for TeX Live config.status 2.6 +detex for TeX Live config.status 2.7 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" diff --git a/Build/source/texk/detex/configure.ac b/Build/source/texk/detex/configure.ac index 67d45a87691..0fd31b2cf01 100644 --- a/Build/source/texk/detex/configure.ac +++ b/Build/source/texk/detex/configure.ac @@ -1,14 +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 -AC_INIT([detex for TeX Live], [2.6], [tex-k@tug.org]) +m4_define([detex_version], [2.7])[]dnl using unmodified detex source tree +AC_INIT([detex for TeX Live], detex_version, [tex-k@tug.org]) AC_PREREQ([2.65]) -AC_CONFIG_SRCDIR([detex.l]) +AC_CONFIG_SRCDIR([detex-]detex_version[/detex.l]) AC_CONFIG_AUX_DIR([../../build-aux]) AC_CONFIG_MACRO_DIR([../../m4]) @@ -22,6 +23,12 @@ AC_CONFIG_HEADERS([c-auto.h:c-auto.in]) KPSE_KPATHSEA_FLAGS +DETEX_TREE=detex-[]detex_version +AC_SUBST([DETEX_TREE]) + +OTHER_TREE=`echo $DETEX_TREE | tr 78 87` +AC_SUBST([OTHER_TREE]) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/Build/source/texk/detex/detex-2.7-PATCHES/TL-Changes b/Build/source/texk/detex/detex-2.7-PATCHES/TL-Changes new file mode 100644 index 00000000000..2ad134b8998 --- /dev/null +++ b/Build/source/texk/detex/detex-2.7-PATCHES/TL-Changes @@ -0,0 +1,6 @@ +Changes applied to the detex-2.7 tree as obtained from: + http://www.cs.purdue.edu/homes/trinkle/detex/ ??? + +Renamed: + detex.1l -> detex.man + diff --git a/Build/source/texk/detex/detex-2.7/README b/Build/source/texk/detex/detex-2.7/README new file mode 100644 index 00000000000..59fb6b558c4 --- /dev/null +++ b/Build/source/texk/detex/detex-2.7/README @@ -0,0 +1,189 @@ +Detex - Version 2.7 + +Detex is a program to remove TeX constructs from a text file. It recognizes +the \input command. + +This program assumes it is dealing with LaTeX input if it sees the string +"\begin{document}" in the text. It recognizes the \include and \includeonly +commands. + +This directory contains the following files: + +README - you're looking at it. + +Makefile - makefile for generating detex on a 4.2BSD Unix system. + +detex.1l - troff source for the detex manual page. + Assuming you have the -man macros, use "make man-page" to + generate it. + +detex.h - Various global definitions. These should be modified to suit + the local installation. + +detex.l - Lex and C source for the detex program. + +lexout.c - C code generated from detex.l using lex on a Sun (SunOS 4.1.1) + This can be useful for DOS, OS/2 or systems that don't have + lex. + +states.sed - sed(1) script to munge the state names in detex.l so that + reasonable names can be used in the source without causing + lex(1) to overflow. + +os2 - subdirectory containing support for compilation on + OS/2 and DOS systems + + +Feel free to redistribute this program, but distribute the complete contents +of this directory. The latest version is available at +http://www.cs.purdue.edu/homes/trinkle/detex/ Send comments and fixes +to me via email. + +Daniel Trinkle +Department of Computer Sciences +Purdue University +West Lafayette, IN 47907-1398 + +April 26, 1986 + +Modified -- June 4, 1986 +Changed so that it automatically recognizes LaTeX source and ignores several +environment modes such as array. + + +Modified (Version 2.0) -- June 30, 1984 +Now handles white space in sequences like "\begin { document }". Detex is not +as easily confused by such things as display mode ends and begins that don't +match up. + + +Modified -- September 19, 1986 +Added the "-e " option to ignore specified LaTeX +environments. + + +Modified -- June 30, 1987 +Added the "-n" no-follow option, to allow detex to ignore \input and \include +commands. Also changed the algorithm for locating the input files. It now +interprets the "." more reasonably (i.e. it is not always the beginning of an +extension). + + +Modified -- December 15, 1988 +Added handling of verbatim environment in LaTeX mode and added it to the list +of modes ignored by default. Because of limitations with lex, it was +necessary to shorten the names of some of the existing start states before +adding a new one (ugh). + + +Modified -- January 3, 1988 +Added ignore of \$ inside $$ (math) pair. + + +Modified (Version 2.2) -- June 25, 1990 +Control sequences are no longer replaced by space, but just removed. This +means accents no longer cause output words to be broken. The "-c" option was +added to show the arguments of \cite, \ref, and \pageref macros. This is +useful when using something like style on the output. + + +Modified (Version 2.3) -- September 7, 1990 +Fixed the handling of Ctl mode a little better and added an exception +for \index on suggestions from kcb@hss.caltech.edu (KC Border). Also +changed the value for DEFAULTINPUTS to coincide with a local change. + + +Modified -- February 10, 1991 +Added -t option to force TeX mode even when seeing the "\begin{document}" +string in the input. + + +Modified -- February 23, 1991 +Based on suggestions from pinard@iro.umontreal.ca (Francois Pinard), I +added support for the SysV string routines (-DUSG), added defines for +the flex lexical scanner (-DFLEX_SCANNER), changed NULL to '\0' when +using it as a character (his sys defined NULL as (void *)0), changed +the Makefile to use ${CC} instead of cc, and added comments about the +new compile time options. + + +Modified (Version 2.4) -- September 2, 1992 +Corrected the way CITEBEGIN worked. Due to serious braindeath I had +the condition wrong in the if test. It should be (fLatex && !fCite). +This solves the problem a couple people reported with amstex style +\ref entries. + +Added a preprocessing sed(1) command to replace all the long, easy to +read state names with short two letter state names (SA-S?) so that lex +won't overflow and I don't have to keep shortening the state names +every time I add one. If a state is added, it must also be added to +states.sed (order is important) along with its unique S? replacement. + +Added \pagestyle, \setcounter, and \verb handling from +K.Sattar@cs.exeter.ac.uk (Khalid Sattar). Also allows invocation as +"delatex" to force LaTeX mode. + +Applied patches from queinnec@cenatls.cena.dgac.fr (Philippe Queinnec) +to handle nested {}s in state (\bibitem, \cite, \index). + +Added special ligature handling (\aa, \ae, \oe, \l, \o, \i, \j, \ss) +at the suggestion of gwp@dido.caltech.edu (G. W. Pigman II). + +Cleaned up the comments on detex.h, added mathmatica to DEFAULTENV. + + +Modified (Version 2.5) -- January 28, 1993 +Leading spaces in macros are no longer stripped. This means +"foo\footnote{ bar}" comes out as "foo bar" instead of "foobar". + +Fixed special ligature handling so it works in cases line {\ss} instead of +just when followed by a space. + + +Modified (Version 2.6) -- July 30, 1993 +Added OS/2 port from hankedr@mail.auburn.edu (Darrel R Hankerson). + +Added handling of leading and trailing ':' in TEXINPUTS per the latest +TeX as suggested by jnp@tfl.dk (J|rgen N|rgaard). + +Changed the way the input path is constructed in SetInputPaths() so we +never try to modify a constant string. + +Changed the way the the ignore environment list is contructed in +SetEnvIgnore() so we never try to modify a constant string. + +Changed the USG define to HAVE_STRING_H. + +Fixed the states.sed script so it only replaces "Input" in the correct +places. I would like to use the \< \> word separator patterns but +they are not supported by all versions of sed. This as least works. + +Changed the detex.c target in the Makefile to use a temporary file +because I experienced problems (segmentation fault) with lex on +Solaris 2.1 when input was from stdin. + + +Modified (Version 2.7) -- September 10, 1997 +Removed line breaks in detex.l between a few patterns and actions. It +appears that flex is no longer able to handle this. Thanks to Anthony +Harris and Marty Leisner + for reporting this. + + +Porting notes -- March 30, 1992 +When using gcc, or compiling on a NeXT, you should compile with +-fwritable-strings. With the change to SetInputPaths() in 2.6 this +should no longer be necessary. + +On a NeXT, it has been reported that lex replaces the '\0' with NULL, +and then the compiler complains about it. I think this is an old bug +that is no longer applicable. + +July 30, 1993 +The flex scanner generator does not work because it does not handle +input buffering the same way as lex. I don't know of any reasonable +way to rewrite detex to get around this problem. + +May 25, 1995 +According to alain@ia1.u-strasbg.fr (Alain Ketterlin), using flex +allows 8-bit characters to be handled correctly. diff --git a/Build/source/texk/detex/detex-2.7/detex.h b/Build/source/texk/detex/detex-2.7/detex.h new file mode 100644 index 00000000000..2ed7fbf1eb0 --- /dev/null +++ b/Build/source/texk/detex/detex-2.7/detex.h @@ -0,0 +1,44 @@ +/****** +** The following parameters should be modified as necessary +** MAXINCLIST - maximum number of files allowed in an \includeonly list +** +** DEFAULTINPUTS - this should be the same as the default TEXINPUTS +** CHPATHSEP - the path separator character in TEXINPUTS +** MAXINPUTPATHS - (arbitrary) number of separate paths in TEXINPUTS +** +** DEFAULTENV - list of LaTeX environments ignored +** CHENVSEP - the list separator character in the ignore envronment list +** MAXENVS - maximum number of environments listed in the ignore list +** CCHMAXENV - maximum count of characters in an environment name (LaTex) +******/ + +#define MAXINCLIST 40 + +#ifdef OS2 +#define DEFAULTINPUTS ".;/emtex/texinput" +#define CHPATHSEP ';' +#else +#define DEFAULTINPUTS ".:/usr/local/tex/inputs" +#define CHPATHSEP ':' +#endif +#define MAXINPUTPATHS 10 + +#define DEFAULTENV "array,eqnarray,equation,figure,mathmatica,picture,table,verbatim" +#define CHENVSEP ',' +#define MAXENVS 10 +#define CCHMAXENV 100 + +/****** +** These probably should not be changed +******/ + +#define CHOPT '-' +#define CHCITEOPT 'c' +#define CHENVOPT 'e' +#define CHLATEXOPT 'l' +#define CHNOFOLLOWOPT 'n' +#define CHSPACEOPT 's' +#define CHTEXOPT 't' +#define CHWORDOPT 'w' + +#define ERROR -1 diff --git a/Build/source/texk/detex/detex-2.7/detex.l b/Build/source/texk/detex/detex-2.7/detex.l new file mode 100644 index 00000000000..3d9a961dfa6 --- /dev/null +++ b/Build/source/texk/detex/detex-2.7/detex.l @@ -0,0 +1,740 @@ +%{ +#ifndef lint +static char rcsid[] = "$Header: /p/src/local/bin/detex/RCS/detex.l,v 2.19 1997/09/10 18:12:37 trinkle Exp $"; +#endif + +/* + * detex [-e environment-list] [-c] [-l] [-n] [-s] [-t] [-w] [file[.tex] ] + * + * This program is used to remove TeX or LaTeX constructs from a text + * file. + * + * Written by: + * Daniel Trinkle + * Department of Computer Science + * Purdue University + * + */ + +#ifdef FPTEX +#include +#undef ERROR +#endif + +#include "detex.h" +#ifndef KPATHSEA + +#ifdef HAVE_STRING_H +#include +#define index strchr +#define rindex strrchr +#else +#include +#endif +#ifndef MAXPATHLEN +#include +#endif +#define PATH_MAX MAXPATHLEN +#ifdef OS2 +#include +#endif +#ifndef NO_MALLOC_DECL +char *malloc(); +#endif + +#else + +#include "c-auto.h" +#include "kpathsea/c-auto.h" +#include "kpathsea/config.h" +#include "kpathsea/c-memstr.h" +#include "kpathsea/c-pathmx.h" +#include "kpathsea/c-std.h" +#include "kpathsea/tex-file.h" + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#endif + +#undef IGNORE + +void SetEnvIgnore(const char *sbEnvList); +int BeginEnv(const char *sbEnv); +int EndEnv(const char *sbEnv); +void InputFile(char *sbFile); +void IncludeFile(char *sbFile); +void AddInclude(char *sbFile); +int InList(char *sbFile); +void SetInputPaths(void); +int SeparateList(char *sbList, char **rgsbList ,char chSep,int csbMax); +FILE * TexOpen(char *sbFile); +char * SafeMalloc(int cch, const char *sbMessage); +void Warning(const char *sb1, const char *sb2); +void ErrorExit(const char *sb1); + +#define LaBEGIN if (fLatex) BEGIN +#define CITEBEGIN if (fLatex && !fCite) BEGIN +#define IGNORE if (fSpace && !fWord) putchar(' ') +#define SPACE if (!fWord) putchar(' ') +#define NEWLINE if (!fWord) putchar('\n') + +#ifdef OS2 +void yyless(int); +void OS2UsageExit(void); +#endif + +char *rgsbEnvIgnore[MAXENVS]; /* list of environments ignored */ +char *rgsbIncList[MAXINCLIST]; /* list of includeonly files */ +char *rgsbInputPaths[MAXINPUTPATHS]; /* list of input paths in order */ +char sbCurrentEnv[CCHMAXENV]; /* current environment being ignored */ +char *sbProgName; /* name we were invoked with */ +#ifndef NOFILE /* might be defined in */ +#define NOFILE 256 +#endif +FILE *rgfp[NOFILE+1]; /* stack of input/include files */ +int cfp = 0; /* count of files in stack */ +int cOpenBrace = 0; /* count of `{' in */ +int csbEnvIgnore; /* count of environments ignored */ +int csbIncList = 0; /* count of includeonly files */ +int csbInputPaths; /* count of input paths */ +int fLatex = 0; /* flag to indicated delatex */ +int fWord = 0; /* flag for -w option */ +int fFollow = 1; /* flag to follow input/include */ +int fCite = 0; /* flag to echo \cite and \ref args */ +int fSpace = 0; /* flag to replace \cs with space */ +int fForcetex = 0; /* flag to inhibit latex mode */ +%} + +S [ \t\n]* +W [a-zA-Z]+ + +%Start Define Display IncludeOnly Input Math Normal Control +%Start LaBegin LaDisplay LaEnd LaEnv LaFormula LaInclude +%Start LaMacro LaMacro2 LaVerbatim + +%% +"%".* /* ignore comments */ ; + +"\\begin"{S}"{"{S}"document"{S}"}" {fLatex = !fForcetex; IGNORE;} + +"\\begin" /* environment start */ {LaBEGIN LaBegin; IGNORE;} + +{S}"{"{S}"verbatim"{S}"}" { if (BeginEnv("verbatim")) + BEGIN LaEnv; + else + BEGIN LaVerbatim; + IGNORE; + } + +"\\end"{S}"{"{S}"verbatim"{S}"}" /* verbatim mode */ {BEGIN Normal; IGNORE;} +. ECHO; + +{W} { if (BeginEnv(yytext)) + BEGIN LaEnv; + else + BEGIN LaMacro; + IGNORE; + } +"\n" NEWLINE; +. ; + +"\\end" /* absorb some environments */ {LaBEGIN LaEnd; IGNORE;} +"\n" NEWLINE; +. ; + +{W} /* end environment */ { if (EndEnv(yytext)) + BEGIN Normal; + IGNORE; + } +"}" {BEGIN LaEnv; IGNORE;} +"\n" NEWLINE; +. ; + +"\\bibitem" /* ignore args */ {LaBEGIN LaMacro2; IGNORE;} +"\\bibliography" /* of these \cs */ {LaBEGIN LaMacro; IGNORE;} +"\\bibstyle" {LaBEGIN LaMacro; IGNORE;} +"\\cite" {CITEBEGIN LaMacro2; IGNORE;} +"\\documentstyle" {LaBEGIN LaMacro; IGNORE;} +"\\end" {LaBEGIN LaMacro; IGNORE;} +"\\footnote" {SPACE;} +"\\index" {LaBEGIN LaMacro2; SPACE;} +"\\label" {LaBEGIN LaMacro; IGNORE;} +"\\pageref" {CITEBEGIN LaMacro; IGNORE;} +"\\pagestyle" {LaBEGIN LaMacro; IGNORE;} +"\\ref" {CITEBEGIN LaMacro; IGNORE;} +"\\setcounter" {LaBEGIN LaMacro; IGNORE;} +"\\verb" /* ignore \verb... */ { if (fLatex) { + char verbchar, c; + verbchar = input(); + while ((c = input()) != verbchar) + if (c == '\n') + NEWLINE; + } + IGNORE; + } +"}" BEGIN Normal; +"\n" NEWLINE; +. ; +"{" { cOpenBrace++; } +"}" { cOpenBrace--; + if (cOpenBrace == 0) + BEGIN Normal; + } +"\n" NEWLINE; +. ; + +"\\def" /* ignore def begin */ {BEGIN Define; IGNORE;} +"{" BEGIN Normal; +"\n" NEWLINE; +. ; + +"\\(" /* formula mode */ {LaBEGIN LaFormula; IGNORE;} +"\\)" BEGIN Normal; +"\n" NEWLINE; +. ; + +"\\[" /* display mode */ {LaBEGIN LaDisplay; IGNORE;} +"\\]" BEGIN Normal; +"\n" NEWLINE; +. ; + +"$$" /* display mode */ {BEGIN Display; IGNORE;} +"$$" BEGIN Normal; +"\n" NEWLINE; +. ; + +"$" /* math mode */ {BEGIN Math; IGNORE;} +"$" BEGIN Normal; +"\n" NEWLINE; +"\\$" ; +. ; + +"\\include" /* process files */ {LaBEGIN LaInclude; IGNORE;} +[^{ \t\n}]+ { IncludeFile(yytext); + BEGIN Normal; + } +"\n" NEWLINE; +. ; + +"\\includeonly" {BEGIN IncludeOnly; IGNORE;} +[^{ \t,\n}]+ AddInclude(yytext); +"}" { if (csbIncList == 0) + rgsbIncList[csbIncList++] = '\0'; + BEGIN Normal; + } +"\n" NEWLINE; +. ; + +"\\input" {BEGIN Input; IGNORE;} +