texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[5704] remove recode options from texi2dvi


From: karl
Subject: [5704] remove recode options from texi2dvi
Date: Mon, 07 Jul 2014 17:45:25 +0000

Revision: 5704
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5704
Author:   karl
Date:     2014-07-07 17:45:16 +0000 (Mon, 07 Jul 2014)
Log Message:
-----------
remove recode options from texi2dvi

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/NEWS
    trunk/util/texi2dvi

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-07-07 01:04:02 UTC (rev 5703)
+++ trunk/ChangeLog     2014-07-07 17:45:16 UTC (rev 5704)
@@ -1,3 +1,11 @@
+2014-07-07  Karl Berry  <address@hidden>
+
+       * util/texi2dvi (run_recode): remove fn (and call) and
+       --recode and --recode-from options.  The implementation has
+       been incorrect for years and no one has noticed.
+       (SED): new variable to allow overriding.
+       http://lists.gnu.org/archive/html/bug-texinfo/2014-07/msg00003.html
+
 2014-07-07  Gavin Smith  <address@hidden>
 
        info: Avoid crashes when resizing screen very small, based on report

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS  2014-07-07 01:04:02 UTC (rev 5703)
+++ trunk/NEWS  2014-07-07 17:45:16 UTC (rev 5704)
@@ -55,6 +55,8 @@
 * texi2dvi:
   . look for the environment variable THUMBPDF_CMD instead of THUMBPDF,
     since thumbpdf itself has used THUMBPDF for options since 2000.
+  . remove --recode and --recode-from options, since they haven't
+    worked as intended for years.
 
 5.2 (26 September 2013)
 * Language:

Modified: trunk/util/texi2dvi
===================================================================
--- trunk/util/texi2dvi 2014-07-07 01:04:02 UTC (rev 5703)
+++ trunk/util/texi2dvi 2014-07-07 17:45:16 UTC (rev 5704)
@@ -33,10 +33,13 @@
 # No failure shall remain unpunished.
 set -e
 
+# In case the default sed doesn't suffice.
+: ${SED=sed}
+
 # This string is expanded automatically when this file is checked out.
 rcs_revision='$Revision$'
 rcs_version=`set - $rcs_revision; echo $2`
-program=`echo $0 | sed -e 's!.*/!!'`
+program=`echo $0 | $SED -e 's!.*/!!'`
 
 build_mode=${TEXI2DVI_BUILD_MODE:-local}
 build_dir=${TEXI2DVI_BUILD_DIRECTORY:-.}
@@ -56,7 +59,6 @@
 oname=          # --output
 out_lang=dvi
 quiet=false     # let the tools' message be displayed
-recode=false
 set_language=
 src_specials=
 shell_escape=
@@ -65,7 +67,6 @@
 txiprereq=19990129 # minimum texinfo.tex version with macro expansion
 verb=false      # true for verbose mode
 translate_file= # name of charset translation file
-recode_from=    # if not empty, recode from this encoding to @documentencoding
 
 orig_pwd=`pwd`
 
@@ -162,7 +163,7 @@
 func_dirname ()
 {
   dirname "$1" 2>/dev/null \
-  || { echo "$1" | sed 's!/[^/]*$!!;s!^$!.!'; }
+  || { echo "$1" | $SED 's!/[^/]*$!!;s!^$!.!'; }
 }
 
 
@@ -171,7 +172,7 @@
 # Return FILE with one extension remove.  foo.bar.baz -> foo.bar.
 noext ()
 {
-  echo "$1" | sed -e 's/\.[^/.][^/.]*$//'
+  echo "$1" | $SED -e 's/\.[^/.][^/.]*$//'
 }
 
 
@@ -186,7 +187,7 @@
       echo "$1"
       ;;
    *) local slashes
-      slashes=`echo "$1" | sed -n 's,.*[^/]\(/*\)$,\1,p'`
+      slashes=`echo "$1" | $SED -n 's,.*[^/]\(/*\)$,\1,p'`
       local rel
       rel=$orig_pwd/`func_dirname "$1"`
       if test -d "$rel"; then
@@ -341,8 +342,6 @@
   -I DIR                     search DIR for Texinfo files
   -l, --language=LANG        specify LANG for FILE, either latex or texinfo
       --no-line-error        do not pass --file-line-error to TeX
-  -r, --recode               call recode before TeX to translate input
-      --recode-from=ENC      recode from ENC to the @documentencoding
       --shell-escape         pass --shell-escape to TeX
       --src-specials         pass --src-specials to TeX
   -t, --command=CMD          insert CMD in copy of input file
@@ -392,7 +391,7 @@
 directories to consider.
 
 The values of the BIBER, BIBTEX, DVIPDF, DVIPS, HEVEA, LATEX, MAKEINDEX,
-MAKEINFO, PDFLATEX, PDFTEX, T4HT, TEX, TEX4HT, TEXINDEX, and THUMBPDF_CMD
+MAKEINFO, PDFLATEX, PDFTEX, SED, T4HT, TEX, TEX4HT, TEXINDEX, and THUMBPDF_CMD
 environment variables are used to run those commands, if they are set.
 
 Regarding --dvipdf, if DVIPDF is not set in the environment, the
@@ -472,7 +471,7 @@
                        -e 's/$path_sep$path_sep/${path_sep}EMPTY:/g'"
   save_IFS=$IFS
   IFS=$path_sep
-  set x `echo "$2" | eval sed $replace_EMPTY`; shift
+  set x `echo "$2" | eval $SED $replace_EMPTY`; shift
   IFS=$save_IFS
   local dir
   for dir
@@ -614,7 +613,7 @@
                        -e 's/$path_sep\$/${path_sep}EMPTY/g' \
                        -e 's/$path_sep$path_sep/${path_sep}EMPTY:/g'"
   local res
-  res=`echo "$1" | eval sed $replace_empty`
+  res=`echo "$1" | eval $SED $replace_empty`
   save_IFS=$IFS
   IFS=$path_sep
   set x $res; shift
@@ -653,7 +652,7 @@
      *) local out_noext
         out_noext=`noext "$oname"`
         local file_ext
-        file_ext=`echo "$1" | sed 's/^.*\.//'`
+        file_ext=`echo "$1" | $SED 's/^.*\.//'`
         echo "$out_noext.$file_ext"
       ;;
   esac
@@ -775,7 +774,7 @@
 index_file_p ()
 {
   test -f "$1" || return 1
-  case $in_lang:$latex2html:`out_lang_tex`:`sed '1q' "$1"` in
+  case $in_lang:$latex2html:`out_lang_tex`:`$SED '1q' "$1"` in
     # When working with TeX4HT, *.idx are created by LaTeX.  They must
     # be processed to produce *.4ix, *.4dx files.  The *.4dx file is
     # passed to makeindex to produce the *.ind file.  This sequence is
@@ -803,7 +802,7 @@
   # process it.  It's suitable if the first character is a
   # backslash or right quote or at, as long as the first line isn't
   # \input texinfo.
-  case `sed '1q' "$1"` in
+  case `$SED '1q' "$1"` in
     "\\input texinfo"*) return 1;;
     [\\''@]*)           return 0;;
            *)           return 1;;
@@ -824,7 +823,7 @@
   # Gather the files created by TeX.
   (
     if test -f "$1.log"; then
-      sed -n -e "s,^\\\\openout.* = \`\\(.*\\)'\\.,\\1,p" "$1.log"
+      $SED -n -e "s,^\\\\openout.* = \`\\(.*\\)'\\.,\\1,p" "$1.log"
     fi
     echo "$1.log"
   ) |
@@ -841,10 +840,10 @@
       latex)
         if aux_file_p $file; then
           # bibtex: *.aux -> *.bbl and *.blg.
-          echo $file | sed 's/^\(.*\)\.aux$/\1.bbl/'
-          echo $file | sed 's/^\(.*\)\.aux$/\1.blg/'
+          echo $file | $SED 's/^\(.*\)\.aux$/\1.bbl/'
+          echo $file | $SED 's/^\(.*\)\.aux$/\1.blg/'
           # -recorder: .fls
-          echo $file | sed 's/^\(.*\)\.aux$/\1.fls/'
+          echo $file | $SED 's/^\(.*\)\.aux$/\1.fls/'
        fi
        ;;
     esac
@@ -915,10 +914,10 @@
 
   # Compare each file until we find a difference.
   for this_file in $xref_files_new; do
-    verbose "Comparing xref file `echo $this_file | sed 's|\./||g'` ..."
+    verbose "Comparing xref file `echo $this_file | $SED 's|\./||g'` ..."
     # cmp -s returns nonzero exit status if files differ.
     if cmp -s "$this_file" "$work_bak/$this_file"; then :; else
-      verbose "xref file `echo $this_file | sed 's|\./||g'` differed ..."
+      verbose "xref file `echo $this_file | $SED 's|\./||g'` differed ..."
       if $debug; then
         diff -u "$work_bak/$this_file" "$this_file"
       fi
@@ -972,7 +971,7 @@
   # subdirectory to exist.
   case $in_lang:$tidy in
     latex:true)
-       sed -n 's|^[ ]*\\include{\(.*\)/.*}.*|\1|p' "$in_input" |
+       $SED -n 's|^[ ]*\\include{\(.*\)/.*}.*|\1|p' "$in_input" |
        sort -u |
        while read d
        do
@@ -1230,7 +1229,7 @@
   # 'input -o output'.  They all seem to accept 'input' only,
   # outputting using the expected file name.
   run $dvipdf "$1"
-  if test ! -f `echo "$1" | sed -e 's/\.dvi$/.pdf/'`; then
+  if test ! -f `echo "$1" | $SED -e 's/\.dvi$/.pdf/'`; then
     error 1 "cannot find output file"
   fi
 }
@@ -1377,7 +1376,7 @@
       cat "$version_test_dir/txiversion.err" >&2
       error 1 "quitting."
     fi
-    eval `sed -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 
txiversion="\2\3\4"/p' "$version_test_dir/txiversion.out"`
+    eval `$SED -n 's/^.*\[\(.*\)version \(....\)-\(..\)-\(..\).*$/txiformat=\1 
txiversion="\2\3\4"/p' "$version_test_dir/txiversion.out"`
     verbose "texinfo.tex preloaded as \`$txiformat', version is \`$txiversion' 
..."
     if test "$txiprereq" -le "$txiversion" >&6 2>&1; then
       makeinfo=
@@ -1403,10 +1402,10 @@
     # (running missing) and then we end up with things like '"-I"',
     # and "-I" (including the quotes) is not an option name.  This
     # happens with gettext 0.14.5, at least.
-    sed "$comment_iftex" "$command_line_filename" \
+    $SED "$comment_iftex" "$command_line_filename" \
       | eval $makeinfo --footnote-style=end -I "$in_dir" $miincludes \
         -o /dev/null --macro-expand=- \
-      | sed "$uncomment_iftex" >"$in_src"
+      | $SED "$uncomment_iftex" >"$in_src"
     # Continue only if everything succeeded.
     if test $? -ne 0 \
        || test ! -r "$in_src"; then
@@ -1434,7 +1433,7 @@
       texinfo) textra_cmd='/address@hidden/a';;
       *)       error 1 "internal error, unknown language: $in_lang";;
     esac
-    sed "$textra_cmd\\
+    $SED "$textra_cmd\\
 $textra" "$in_input" >"$in_xtr"
     in_input=$in_xtr
   fi
@@ -1454,45 +1453,6 @@
   esac
 }
 
-# run_recode ()
-# -------------
-# If this is a Texinfo file with a specified input encoding, and
-# recode is available, then recode to plain 7 bit Texinfo.
-run_recode ()
-{
-  local from
-  local to
-
-  if test $in_lang = texinfo; then
-    pgm='s/^ address@hidden  *\([^ ][^ ]*\) *$/\1/
-        t found
-        d
-        :found
-        q'
-    encoding=`sed -e "$pgm" "$in_input"`
-    if $recode && test -n "$encoding" && findprog recode; then
-      if test -n "$recode_from"; then
-        from=$recode_from
-        to=$encoding
-      else
-        from=$encoding
-        to=$texinfo
-      fi
-      verbose "Recoding from $from to $to."
-      # _rcd.  The Texinfo file recoded in 7bit.
-      work_rcd=$workdir/recode
-      in_rcd=$work_rcd/$in_base
-      ensure_dir "$work_rcd"
-      if recode "$encoding..$to" <"$in_input" >"$in_rcd" \
-         && test -s "$in_rcd"; then
-        in_input=$in_rcd
-      else
-        verbose "Recoding failed, using original input."
-      fi
-    fi
-  fi
-}
-
 # compute_language FILENAME
 # -------------------------
 # Return the short string describing the language in which FILENAME
@@ -1504,7 +1464,7 @@
   # Otherwise, guess from the file extension.
   if test -n "$set_language"; then
     echo $set_language
-  elif sed 1q "$1" | grep 'input texinfo' >&6; then
+  elif $SED 1q "$1" | grep 'input texinfo' >&6; then
     echo texinfo
   else
     # Get the type of the file (latex or texinfo) from the given language
@@ -1619,9 +1579,6 @@
   # --command, --texinfo
   insert_commands
 
-  # --recode
-  run_recode
-
   # Run until a fix point is reached.
   run_tex_suite
 }
@@ -1690,8 +1647,8 @@
   # Handle --option=value by splitting apart and putting back on argv.
   case "$1" in
     --*=*)
-      opt=`echo "$1" | sed -e 's/=.*//'`
-      val=`echo "$1" | sed -e 's/[^=]*=//'`
+      opt=`echo "$1" | $SED -e 's/=.*//'`
+      val=`echo "$1" | $SED -e 's/[^=]*=//'`
       shift
       set dummy "$opt" "$val" ${1+"$@"}; shift
       ;;
@@ -1721,17 +1678,15 @@
     # Output formats.
     -O|--output-format) shift; out_lang_set "$1";;
        --dvi|--dvipdf|--html|--info|--pdf|--ps|--text)
-       out_lang_set `echo "x$1" | sed 's/^x--//'`;;
+       out_lang_set `echo "x$1" | $SED 's/^x--//'`;;
 
     -p) out_lang_set pdf;;
     -q | -s | --quiet | --silent) quiet=true; batch=true;;
-    -r | --recode) recode=true;;
-    --recode-from) shift; recode=true; recode_from="$1";;
     --src-specials) src_specials=--src-specials;;
     --shell-escape) shell_escape=--shell-escape;;  
     --tex4ht) latex2html=tex4ht;;
     -t | --texinfo | --command ) shift; textra="$textra\\
-"`echo "$1" | sed 's/\\\\/\\\\\\\\/g'`;;
+"`echo "$1" | $SED 's/\\\\/\\\\\\\\/g'`;;
     --translate-file ) shift; translate_file="$1";;
     --tidy) build_mode=tidy;;
     -v | --vers*) version;;
@@ -1858,7 +1813,7 @@
 #   The input file name without extensions (nor directory part).
 # - IN_INPUT
 #   Defaults to COMMAND_LINE_FILENAME, but might change if the
-#   input is preprocessed (recode etc.).  With directory, possibly absolute.
+#   input is preprocessed.  With directory, possibly absolute.
 input_file_name_decode ()
 {
   # See if we are run from within AUC-Tex, in which case we are
@@ -1943,7 +1898,7 @@
          # has active characters.  Transform / into ! so that we don't
          # need `mkdir -p'.  It might be something to reconsider.
          t2ddir=$build_dir/`echo "$out_dir_abs/$out_noext.t2d" |
-             sed "s,^$orig_pwd/,,;s,^\./,,;s,/,!,g"`
+             $SED "s,^$orig_pwd/,,;s,^\./,,;s,/,!,g"`
   esac
   # Remove it at exit if clean mode.
   trap "cleanup" 0 1 2 15




reply via email to

[Prev in Thread] Current Thread [Next in Thread]