groff-commit
[Top][All Lists]
Advanced

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

[Groff-commit] groff/contrib/gdiffmk ChangeLog README gdiffmk....


From: Werner LEMBERG
Subject: [Groff-commit] groff/contrib/gdiffmk ChangeLog README gdiffmk....
Date: Sat, 15 Jan 2005 20:43:21 -0500

CVSROOT:        /cvsroot/groff
Module name:    groff
Branch:         
Changes by:     Werner LEMBERG <address@hidden> 05/01/16 01:43:21

Modified files:
        contrib/gdiffmk: ChangeLog README gdiffmk.man gdiffmk.sh 
        contrib/gdiffmk/tests: runtests.in 
Added files:
        contrib/gdiffmk/tests: test_baseline10 test_baseline8 
                               test_baseline9 

Log message:
        * gdiffmk.sh: Add the -D, -M, and -B options, which provide actions
        akin to nrchbar.
        Thanks to Larry Kollar (http://home.alltel.net/kollar/groff/).
        
        * gdiffmk.man: Updated.
        
        * tests/runtests.in: Added tests for gdiffmk's -D, -M, and -B
        options.
        
        * tests/baseline8, tests/baseline9, tests/baseline10: New files.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/contrib/gdiffmk/ChangeLog.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/contrib/gdiffmk/README.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/contrib/gdiffmk/gdiffmk.man.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/contrib/gdiffmk/gdiffmk.sh.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/contrib/gdiffmk/tests/test_baseline10?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/contrib/gdiffmk/tests/test_baseline8?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/contrib/gdiffmk/tests/test_baseline9?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/groff/groff/contrib/gdiffmk/tests/runtests.in.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: groff/contrib/gdiffmk/ChangeLog
diff -u groff/contrib/gdiffmk/ChangeLog:1.8 groff/contrib/gdiffmk/ChangeLog:1.9
--- groff/contrib/gdiffmk/ChangeLog:1.8 Fri Dec 17 05:56:13 2004
+++ groff/contrib/gdiffmk/ChangeLog     Sun Jan 16 01:43:21 2005
@@ -1,3 +1,16 @@
+2005-01-13  Mike Bianchi  <address@hidden>
+
+       * gdiffmk.sh: Add the -D, -M, and -B options, which provide actions
+       akin to nrchbar.
+       Thanks to Larry Kollar (http://home.alltel.net/kollar/groff/).
+
+       * gdiffmk.man: Updated.
+
+       * tests/runtests.in: Added tests for gdiffmk's -D, -M, and -B
+       options.
+
+       * tests/baseline8, tests/baseline9, tests/baseline10: New files.
+
 2004-12-16  Mike Bianchi  <address@hidden>
 
        * tests/runtests.in: Fix typo (s/$(srcdir)/${srcdir}/).
Index: groff/contrib/gdiffmk/README
diff -u groff/contrib/gdiffmk/README:1.3 groff/contrib/gdiffmk/README:1.4
--- groff/contrib/gdiffmk/README:1.3    Thu Dec 16 22:02:21 2004
+++ groff/contrib/gdiffmk/README        Sun Jan 16 01:43:21 2005
@@ -1,13 +1,16 @@
 gdiffmk is approximately a recreation of the original Bell Labs/AT&T diffmk
 command for troff/nroff documents, with enhancements.
 
-It should not be confused with diffmk commands that operate on XML.
+It should not be confused with `diffmk' commands that operate on XML.
 
 The inspiration for this code was a Perl 2 version written in 1989 by Randal
 L. Schwartz.  See
-       
   landfield.com/software/comp.sources.misc/archive-name/volume06/diffmk.p.gz
 
+The command also attempts to reproduce some of the functionality of the old
+`nrchbar' command.  See
+  
open-systems.ufl.edu/mirrors/ftp.isc.org/usenet/comp.sources.unix/volume10/nrchbar.Z
+
 Thanks to Werner Lemberg for help in making the package more portable and
 fit into the GNU groff source structure.
 
@@ -22,7 +25,7 @@
 
 ----------------------------------------------------------------------------
 
-Copyright (C) 2004 Free Software Foundation, Inc.
+Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 Written by Mike Bianchi <address@hidden <mailto:address@hidden>>
 
 This file is part of the gdiffmk utility, which is part of groff.
Index: groff/contrib/gdiffmk/gdiffmk.man
diff -u groff/contrib/gdiffmk/gdiffmk.man:1.4 
groff/contrib/gdiffmk/gdiffmk.man:1.5
--- groff/contrib/gdiffmk/gdiffmk.man:1.4       Wed Dec 15 06:04:48 2004
+++ groff/contrib/gdiffmk/gdiffmk.man   Sun Jan 16 01:43:21 2005
@@ -1,5 +1,5 @@
 .ig \"-*- nroff -*-
-Copyright (C) 2004 Free Software Foundation, Inc.
+Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of the gdiffmk utility, which is part of groff.
 Written by Mike Bianchi <address@hidden <mailto:address@hidden>>
@@ -43,14 +43,19 @@
 .OP \-a \%addmark
 .OP \-c \%changemark
 .OP \-d \%deletemark
+[\ \c
+.B \-D
+.OP \-B
+.OP \-M "\ mark1 mark2"
+]
 .OP \-x \%diffcmd
 .OP \-\-
 .OP \-\-help
-.OP \-\-version
+.OP \%\-\-version
 .I \%file1
 .I \%file2
-[
-.I \%output
+[\ \c
+.IR \%output \ \c
 ]
 .br
 .ad \na
@@ -112,6 +117,20 @@
 .BR + .
 .
 .TP
+.B \-B
+By default, the deleted texts marked by the
+.B \-D
+option end
+with an added troff break command,
+.BR .br ,
+to ensure that the deletions are marked properly.
+This is the only way to guarantee that deletions and small
+changes get flagged.
+This option directs the program not to insert these breaks; it makes no
+sense to use it without
+.BR \-D .
+.
+.TP
 .BI \-c changemark
 Use the
 .I changemark
@@ -128,6 +147,20 @@
 .BR * .
 .
 .TP
+.B \-D
+Show the deleted portions from changed and deleted text.
+Default delimiting marks:
+.BR "[[" " .\&.\&.\&. " "]]" .
+.
+.TP
+.BI \-M " mark1 mark2
+Change the delimiting marks for the
+.B \-D
+option.
+It makes no sense to use this option without
+.BR \-D .
+.
+.TP
 .BI \-x diffcmd
 Use the
 .I diffcmd
@@ -137,7 +170,8 @@
 .IR file2 .
 In particular,
 .I diffcmd
-should accept the
+should accept the GNU
+.B diff
 .BI \-D name
 option.
 Default:
@@ -213,7 +247,7 @@
 .
 .
 .SH COPYRIGHT
-Copyright \(co 2004 Free Software Foundation, Inc.
+Copyright \(co 2004, 2005 Free Software Foundation, Inc.
 .
 .LP
 .B gdiffmk
Index: groff/contrib/gdiffmk/gdiffmk.sh
diff -u groff/contrib/gdiffmk/gdiffmk.sh:1.4 
groff/contrib/gdiffmk/gdiffmk.sh:1.5
--- groff/contrib/gdiffmk/gdiffmk.sh:1.4        Wed Dec 15 06:04:48 2004
+++ groff/contrib/gdiffmk/gdiffmk.sh    Sun Jan 16 01:43:21 2005
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2004 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 # Written by Mike Bianchi <address@hidden <mailto:address@hidden>>
 
 # This file is part of the gdiffmk utility, which is part of groff.
@@ -36,17 +36,25 @@
 groff \`.mc' requests added to indicate how it is different from FILE1.
 
   FILE1   Previous version of the groff file.  \`-' means standard input.
-  FILE2   Current version of the groff file.  \`-' means standard input.
+  FILE2   Current version of the groff file.   \`-' means standard input.
           Either FILE1 or FILE2 can be standard input, but not both.
   OUTPUT  Copy of FILE2 with \`.mc' commands added.
           \`-' means standard output (the default).
 
 OPTIONS:
-  -a addmark     Mark for added groff source lines.    Default: +.
-  -c changemark  Mark for changed groff source lines.  Default: |.
-  -d deletemark  Mark for deleted groff source lines.  Default: *.
-  -x diffcmd     Use a different diff(1) command;
-                 one that accepts the \`-Dname' option, such as GNU diff.
+  -a ADDMARK     Mark for added groff source lines.    Default: \`+'.
+  -c CHANGEMARK  Mark for changed groff source lines.  Default: \`|'.
+  -d DELETEMARK  Mark for deleted groff source lines.  Default: \`*'.
+
+  -D             Show the deleted portions from changed and deleted text.
+                  Default delimiting marks:  \`[[' .... \`]]'.
+  -B             By default, the deleted texts marked by the \`-D' option end
+                  with an added troff \`.br\' command.  This option prevents
+                  the added \`.br\'.
+  -M MARK1 MARK2 Change the delimiting marks for the \`-D' option.
+
+  -x DIFFCMD     Use a different diff(1) command;
+                  one that accepts the \`-Dname' option, such as GNU diff.
   --version      Print version information on the standard output and exit.
   --help         Print this message on the standard error.
 "
@@ -124,9 +132,11 @@
        fi
 }
 
-addmark='+'
-changemark='|'
-deletemark='*'
+ADDMARK='+'
+CHANGEMARK='|'
+DELETEMARK='*'
+MARK1='[['
+MARK2=']]'
 
 function RequiresArgument {
        #       Process flags that take either concatenated or
@@ -148,24 +158,38 @@
 }
 
 badoption=
-diffcmd=diff
+DIFFCMD=diff
+D_option=
+br=.br
 for OPTION
 do
        case "${OPTION}" in
        -a*)
-               addmark=$( RequiresArgument "${OPTION}" $2 )            &&
+               ADDMARK=$( RequiresArgument "${OPTION}" $2 )            &&
                        shift
                ;;
        -c*)
-               changemark=$( RequiresArgument "${OPTION}" $2 )         &&
+               CHANGEMARK=$( RequiresArgument "${OPTION}" $2 )         &&
                        shift
                ;;
        -d*)
-               deletemark=$( RequiresArgument "${OPTION}" $2 )         &&
+               DELETEMARK=$( RequiresArgument "${OPTION}" $2 )         &&
                        shift
                ;;
+       -D )
+               D_option=D_option
+               ;;
+       -M )
+               shift
+               MARK1=$1
+               shift
+               MARK2=$1
+               ;;
+       -B )
+               br=.
+               ;;
        -x* )
-               diffcmd=$( RequiresArgument "${OPTION}" $2 )            &&
+               DIFFCMD=$( RequiresArgument "${OPTION}" $2 )            &&
                        shift
                ;;
        --version)
@@ -193,10 +217,10 @@
        shift
 done
 
-${diffcmd} -Dx /dev/null /dev/null >/dev/null 2>&1  ||
-       Usage "The \`${diffcmd}' program does not accept"       \
+${DIFFCMD} -Dx /dev/null /dev/null >/dev/null 2>&1  ||
+       Usage "The \`${DIFFCMD}' program does not accept"       \
                "the required \`-Dname' option.
-Use GNU diff instead.  See the \`-x diffcmd' option."
+Use GNU diff instead.  See the \`-x DIFFCMD' option."
 
 if test -n "${badoption}"
 then
@@ -239,23 +263,22 @@
 #      To make a very unlikely label even more unlikely ...
 label=__diffmk_$$__
 
-diff -D"${label}" -- ${FILE1} ${FILE2}  |
-       sed -n '
+sed_script='
                /^#ifdef '"${label}"'/,/^#endif \/\* '"${label}"'/ {
-                 /^#ifdef '"${label}"'/          s/.*/.mc '"${addmark}"'/
+                 /^#ifdef '"${label}"'/          s/.*/.mc '"${ADDMARK}"'/
                  /^#endif \/\* '"${label}"'/     s/.*/.mc/
                  p
                  d
                }
                /^#ifndef '"${label}"'/,/^#endif \/\* [!not ]*'"${label}"'/ {
                  /^#else \/\* '"${label}"'/,/^#endif \/\* '"${label}"'/ {
-                   /^#else \/\* '"${label}"'/    s/.*/.mc '"${changemark}"'/
+                   /^#else \/\* '"${label}"'/    s/.*/.mc '"${CHANGEMARK}"'/
                    /^#endif \/\* '"${label}"'/   s/.*/.mc/
                    p
                    d
                  }
                  /^#endif \/\* \(not\|!\) '"${label}"'/ {
-                  s/.*/.mc '"${deletemark}"'/p
+                  s/.*/.mc '"${DELETEMARK}"'/p
                   a\
 .mc
                  }
@@ -264,4 +287,56 @@
                p
        '
 
+if [ ${D_option} ]
+then
+       sed_script='
+               /^#ifdef '"${label}"'/,/^#endif \/\* '"${label}"'/ {
+                 /^#ifdef '"${label}"'/          s/.*/.mc '"${ADDMARK}"'/
+                 /^#endif \/\* '"${label}"'/     s/.*/.mc/
+                 p
+                 d
+               }
+               /^#ifndef '"${label}"'/,/^#endif \/\* [!not ]*'"${label}"'/ {
+                 /^#ifndef '"${label}"'/ {
+                  i\
+'"${MARK1}"'
+                  d
+                 }
+                 /^#else \/\* '"${label}"'/ ! {
+                  /^#endif \/\* [!not ]*'"${label}"'/ ! {
+                   p
+                   d
+                  }
+                 }
+                 /^#else \/\* '"${label}"'/,/^#endif \/\* '"${label}"'/ {
+                   /^#else \/\* '"${label}"'/ {
+                    i\
+'"${MARK2}"'\
+'"${br}"'
+                    s/.*/.mc '"${CHANGEMARK}"'/
+                    a\
+.mc '"${CHANGEMARK}"'
+                    d
+                   }
+                   /^#endif \/\* '"${label}"'/   s/.*/.mc/
+                   p
+                   d
+                 }
+                 /^#endif \/\* \(not\|!\) '"${label}"'/ {
+                  i\
+'"${MARK2}"'\
+'"${br}"'
+                  s/.*/.mc '"${DELETEMARK}"'/p
+                  a\
+.mc
+                 }
+                 d
+               }
+               p
+       '
+fi
+
+diff -D"${label}" -- ${FILE1} ${FILE2}  |
+       sed -n "${sed_script}"
+
 # EOF
Index: groff/contrib/gdiffmk/tests/runtests.in
diff -u groff/contrib/gdiffmk/tests/runtests.in:1.3 
groff/contrib/gdiffmk/tests/runtests.in:1.4
--- groff/contrib/gdiffmk/tests/runtests.in:1.3 Fri Dec 17 05:56:13 2004
+++ groff/contrib/gdiffmk/tests/runtests.in     Sun Jan 16 01:43:21 2005
@@ -8,7 +8,7 @@
 #      Test the number of arguments and the first argument.
 case $#-$1 in
 1-clean )
-       rm -fv test_result? tmp_file?
+       rm -fv test_result* tmp_file*
        exit 0
        ;;
 1-run )
@@ -25,11 +25,14 @@
 esac
 
 function TestResult {
-       if diff $1 $2
+       if cmp -s $1 $2
        then
                echo $2 PASSED
        else
-               echo $2 TEST FAILED '\a'
+               echo ''
+               echo $2 TEST FAILED
+               diff $1 $2
+               echo ''
        fi
 }
 
@@ -72,7 +75,24 @@
 #      Test for accidental file overwrite.
 ResultFile=test_result7
 cp ${srcdir}/file2 tmp_file7
-${command}  -aA -dD -cC  ${srcdir}/file1 tmp_file7  tmp_file7  >${ResultFile} 
2>&1
+${command}  -aA -dD -cC  ${srcdir}/file1 tmp_file7  tmp_file7  \
+                                                       >${ResultFile} 2>&1
 TestResult ${srcdir}/test_baseline7 ${ResultFile}
 
+#      Test -D option
+ResultFile=test_result8
+${command}  -D  ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1
+TestResult ${srcdir}/test_baseline8 ${ResultFile}
+
+#      Test -D  and  -M  options
+ResultFile=test_result9
+${command}  -D  -M '<<<<' '>>>>'                               \
+                       ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1
+TestResult ${srcdir}/test_baseline9 ${ResultFile}
+
+#      Test -D  and  -B  options
+ResultFile=test_result10
+${command}  -D  -B  ${srcdir}/file1 ${srcdir}/file2 >${ResultFile} 2>&1
+TestResult ${srcdir}/test_baseline10 ${ResultFile}
+
 #      EOF




reply via email to

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