Eskil

Diff
Login

Differences From Artifact [ad61b8550e]:

To Artifact [4fca99b0c4]:


35
36
37
38
39
40
41


42
43
44
45
46
47
48
#             -2nd      : Turn on or off second stage parsing.
#             -no2nd    : It is on by default.
#          
#             -conflict : Treat file as a merge conflict file and enter merge
#                         mode.
#             -o <file> : Specify merge result output file. 
#


#   Author    Peter Spjuth  980612
#
#   Revised   By       Date     Remark
#
#     1.0     DC-PS    980612   New Version.
#     1.1     DC-PS    980807   Parsing of change blocks added
#                               Options menu and variables changed







>
>







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#             -2nd      : Turn on or off second stage parsing.
#             -no2nd    : It is on by default.
#          
#             -conflict : Treat file as a merge conflict file and enter merge
#                         mode.
#             -o <file> : Specify merge result output file. 
#
#             -print    : Generate postscript and exit.
#
#   Author    Peter Spjuth  980612
#
#   Revised   By       Date     Remark
#
#     1.0     DC-PS    980612   New Version.
#     1.1     DC-PS    980807   Parsing of change blocks added
#                               Options menu and variables changed
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#                               New -conflict flag to handle merge conflicts.
#
#-----------------------------------------------
# the next line restarts using wish \
exec wish "$0" "$@"

set debug 1
set diffver "Version 1.8.2  2001-03-13"
set tmpcnt 0
set tmpfiles {}
set thisscript [file join [pwd] [info script]]
set thisdir [file dirname $thisscript]

if {$tcl_platform(platform) == "windows"} {
    cd $thisdir







|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#                               New -conflict flag to handle merge conflicts.
#
#-----------------------------------------------
# the next line restarts using wish \
exec wish "$0" "$@"

set debug 1
set diffver "Version 1.8.3  2001-04-26"
set tmpcnt 0
set tmpfiles {}
set thisscript [file join [pwd] [info script]]
set thisdir [file dirname $thisscript]

if {$tcl_platform(platform) == "windows"} {
    cd $thisdir
1125
1126
1127
1128
1129
1130
1131



1132
1133
1134
1135
1136
1137
1138
        cleanupRCS
    } elseif {[string match "conflict*" $diff(mode)]} {
        cleanupConflict
        if {$eqLabel != "="} {
            after idle makeMergeWin
        }
    }



}

# This is the entrypoint to do a diff via DDE or Send
proc remoteDiff {file1 file2} {
    global diff

    set diff(leftDir) [file dirname $file1]







>
>
>







1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
        cleanupRCS
    } elseif {[string match "conflict*" $diff(mode)]} {
        cleanupConflict
        if {$eqLabel != "="} {
            after idle makeMergeWin
        }
    }
    if {[lsearch $diff(flags) print] >= 0} {
        after idle {doPrint 1 ; exit}
    }
}

# This is the entrypoint to do a diff via DDE or Send
proc remoteDiff {file1 file2} {
    global diff

    set diff(leftDir) [file dirname $file1]
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
        set n [expr {(- $i - $index) % 8}]
        set text [string replace $text $i $i [format %${n}s ""]]
    }
    return $text
}

# Main print function
proc printDiffs {} {
    busyCursor
    update idletasks
    set tmpFile [file nativename ~/tcldiff.enscript]
    set tmpFile2 [file nativename ~/tcldifftmp.ps]
    set tmpFile3 [file nativename ~/tcldiff.ps]

    set lines1 {}







|







1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
        set n [expr {(- $i - $index) % 8}]
        set text [string replace $text $i $i [format %${n}s ""]]
    }
    return $text
}

# Main print function
proc printDiffs {{quiet 0}} {
    busyCursor
    update idletasks
    set tmpFile [file nativename ~/tcldiff.enscript]
    set tmpFile2 [file nativename ~/tcldifftmp.ps]
    set tmpFile3 [file nativename ~/tcldiff.ps]

    set lines1 {}
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855

1856
1857
1858









1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882

    close $ch

    catch {exec enscript -c -B -e -p $tmpFile2 $tmpFile}
    catch {exec mpage -bA4 -a2 $tmpFile2 > $tmpFile3}

    normalCursor

    destroy .dp
    toplevel .dp
    wm title .dp "Diff Print"
    button .dp.b -text Close -command {destroy .dp}
    label .dp.l -anchor w -justify left -text "The following files have\
            been created:\n\n$tmpFile\nInput file to enscript.\
            \n\n$tmpFile2\nCreated with 'enscript -c -B -e -p $tmpFile2\
            $tmpFile'\n\n$tmpFile3\nCreated with 'mpage -bA4 -a2 $tmpFile2 >\
            $tmpFile3'" -font "Courier 8"
    pack .dp.b -side bottom
    pack .dp.l -side top
}


# Create a print dialog.
proc doPrint {} {
    









    destroy .pr
    toplevel .pr
    wm title .pr "Print diffs"

    label .pr.l1 -justify left -text "The print function is just on an\
            experimental level. It will write a postcript file\
            \"tcldiff.ps\" in your home directory."
    label .pr.l2 -justify left -text "Below you can adjust the what gray scale\
            level is used on the background to mark changes.\
            The first value is used for changed text. The second for\
            new/deleted text."
    .pr.l1 configure -wraplength 300
    .pr.l2 configure -wraplength 300
    if {![info exists ::grayLevel1]} {
        set ::grayLevel1 0.6
        set ::grayLevel2 0.8
    }
    scale .pr.s1 -orient horizontal -resolution 0.1 -showvalue 1 -from 0.0 \
            -to 1.0 -variable grayLevel1
    scale .pr.s2 -orient horizontal -resolution 0.1 -showvalue 1 -from 0.0 \
            -to 1.0 -variable grayLevel2
    button .pr.b1 -text Print -command {destroy .pr; update; printDiffs}
    button .pr.b2 -text Cancel -command {destroy .pr}








|
|
|
|
|
|
|
|
|
|
|
|
|
|
>

|

>
>
>
>
>
>
>
>
>













<
<
<
|







1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886



1887
1888
1889
1890
1891
1892
1893
1894

    close $ch

    catch {exec enscript -c -B -e -p $tmpFile2 $tmpFile}
    catch {exec mpage -bA4 -a2 $tmpFile2 > $tmpFile3}

    normalCursor
    if {!$quiet} {
        destroy .dp
        toplevel .dp
        wm title .dp "Diff Print"
        button .dp.b -text Close -command {destroy .dp}
        label .dp.l -anchor w -justify left -text "The following files have\
                been created:\n\n$tmpFile\nInput file to enscript.\
                \n\n$tmpFile2\nCreated with 'enscript -c -B -e -p $tmpFile2\
                $tmpFile'\n\n$tmpFile3\nCreated with 'mpage -bA4 -a2 $tmpFile2 >\
                $tmpFile3'" -font "Courier 8"
        pack .dp.b -side bottom
        pack .dp.l -side top
    }
}

# Create a print dialog.
proc doPrint {{quiet 0}} {
    
    if {![info exists ::grayLevel1]} {
        set ::grayLevel1 0.6
        set ::grayLevel2 0.8
    }
    if {$quiet} {
        printDiffs 1
        return
    }

    destroy .pr
    toplevel .pr
    wm title .pr "Print diffs"

    label .pr.l1 -justify left -text "The print function is just on an\
            experimental level. It will write a postcript file\
            \"tcldiff.ps\" in your home directory."
    label .pr.l2 -justify left -text "Below you can adjust the what gray scale\
            level is used on the background to mark changes.\
            The first value is used for changed text. The second for\
            new/deleted text."
    .pr.l1 configure -wraplength 300
    .pr.l2 configure -wraplength 300




    scale .pr.s1 -orient horizontal -resolution 0.1 -showvalue 1 -from 0.0 \
            -to 1.0 -variable grayLevel1
    scale .pr.s2 -orient horizontal -resolution 0.1 -showvalue 1 -from 0.0 \
            -to 1.0 -variable grayLevel2
    button .pr.b1 -text Print -command {destroy .pr; update; printDiffs}
    button .pr.b2 -text Cancel -command {destroy .pr}

2617
2618
2619
2620
2621
2622
2623

2624
2625
2626
2627
2628
2629
2630
proc parseCommandLine {} {
    global diff Pref
    global argv argc tcl_platform

    set diff(leftOK) 0
    set diff(rightOK) 0
    set diff(mode) ""

    set noautodiff 0
    set autobrowse 0
    set diff(mergeFile) ""
    set diff(conflictFile) ""

    if {$argc == 0} return








>







2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
proc parseCommandLine {} {
    global diff Pref
    global argv argc tcl_platform

    set diff(leftOK) 0
    set diff(rightOK) 0
    set diff(mode) ""
    set diff(flags) ""
    set noautodiff 0
    set autobrowse 0
    set diff(mergeFile) ""
    set diff(conflictFile) ""

    if {$argc == 0} return

2663
2664
2665
2666
2667
2668
2669


2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
        } elseif {$arg == "-nodiff"} {
            set noautodiff 1
        } elseif {$arg == "-browse"} {
            set autobrowse 1
        } elseif {$arg == "-conflict"} {
            set diff(mode) "conflict"
            set Pref(ignore) " "


        } elseif {$arg == "-server"} {
            if {$tcl_platform(platform) == "unix"} {
                tk appname Diff
            } else {
                dde servername Diff
            }
        } elseif {$arg == "-o"} {
            set nextArg mergeFile
        } elseif {$arg == "-r"} {
            set nextArg revision
        } elseif {[string range $arg 0 0] == "-"} {
            set Pref(dopt) "$Pref(dopt) $arg"







>
>

|
|

|







2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
        } elseif {$arg == "-nodiff"} {
            set noautodiff 1
        } elseif {$arg == "-browse"} {
            set autobrowse 1
        } elseif {$arg == "-conflict"} {
            set diff(mode) "conflict"
            set Pref(ignore) " "
        } elseif {$arg == "-print"} {
            lappend diff(flags) print
        } elseif {$arg == "-server"} {
            if {$tcl_platform(platform) == "windows"} {
                dde servername Diff
            } else {
                tk appname Diff
            }
        } elseif {$arg == "-o"} {
            set nextArg mergeFile
        } elseif {$arg == "-r"} {
            set nextArg revision
        } elseif {[string range $arg 0 0] == "-"} {
            set Pref(dopt) "$Pref(dopt) $arg"