︙ | | | ︙ | |
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# -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
|
|
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# -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 <file> : 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
|
︙ | | | ︙ | |
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
|
set right2 [string range $line2 [expr {$t2 + 1}] end]
set mid2 [string range $line2 $leftp2 $t2]
set left2 [string range $line2 0 [expr {$leftp2 - 1}]]
set res2 [list $left2 $mid2 $right2]
}
if {$Pref(extralineparse) != 0 && $leftp1 <= $t1 && $leftp2 <= $t2} {
compareMidString $mid1 $mid2 mid1 mid2 $test
set res1 [eval lreplace \$res1 1 1 $mid1]
set res2 [eval lreplace \$res2 1 1 $mid2]
}
}
# Compare two lines and rate how much they resemble each other.
# This has never worked well. Some day I'll sit down, think this through,
# and come up with a better algorithm.
proc compareLines2 {line1 line2} {
|
>
|
|
>
>
>
|
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
|
set right2 [string range $line2 [expr {$t2 + 1}] end]
set mid2 [string range $line2 $leftp2 $t2]
set left2 [string range $line2 0 [expr {$leftp2 - 1}]]
set res2 [list $left2 $mid2 $right2]
}
if {$Pref(extralineparse) != 0 && $leftp1 <= $t1 && $leftp2 <= $t2} {
compareMidString $mid1 $mid2 mid1 mid2 $test
# Replace middle element in res* with list elements from mid*
#set res1 [eval lreplace \$res1 1 1 $mid1]
#set res2 [eval lreplace \$res2 1 1 $mid2]
# This makes use of pure-list optimisation in eval
set res1 [eval [linsert $mid1 0 lreplace $res1 1 1]]
set res2 [eval [linsert $mid2 0 lreplace $res2 1 1]]
}
}
# Compare two lines and rate how much they resemble each other.
# This has never worked well. Some day I'll sit down, think this through,
# and come up with a better algorithm.
proc compareLines2 {line1 line2} {
|
︙ | | | ︙ | |
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
|
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
|
|
|
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
|
cleanupRCS
} elseif {[string match "conflict*" $diff(mode)]} {
cleanupConflict
if {$eqLabel != "="} {
after idle makeMergeWin
}
}
if {$diff(printFile) != ""} {
after idle {doPrint 1 ; exit}
}
}
# This is the entrypoint to do a diff via DDE or Send
proc remoteDiff {file1 file2} {
global diff
|
︙ | | | ︙ | |
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
|
# 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 {}
set lines2 {}
set tdump1 [.ft1.tt dump -tag -text 1.0 end]
set tdump2 [.ft2.tt dump -tag -text 1.0 end]
set lineNo1 [processLineno .ft1.tl]
|
>
>
>
|
>
|
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
|
# Main print function
proc printDiffs {{quiet 0}} {
busyCursor
update idletasks
set tmpFile [file nativename ~/tcldiff.enscript]
set tmpFile2 [file nativename ~/tcldifftmp.ps]
if {$::diff(printFile) != ""} {
set tmpFile3 [file nativename $::diff(printFile)]
} else {
set tmpFile3 [file nativename ~/tcldiff.ps]
}
set lines1 {}
set lines2 {}
set tdump1 [.ft1.tt dump -tag -text 1.0 end]
set tdump2 [.ft2.tt dump -tag -text 1.0 end]
set lineNo1 [processLineno .ft1.tl]
|
︙ | | | ︙ | |
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
|
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
set files ""
set nextArg ""
foreach arg $argv {
if {$nextArg != ""} {
if {$nextArg == "mergeFile"} {
set diff(mergeFile) [file join [pwd] $arg]
} elseif {$nextArg == "revision"} {
set Pref(dopt) "$Pref(dopt) -r$arg"
}
set nextArg ""
continue
}
if {$arg == "-w"} {
|
|
>
>
|
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
|
proc parseCommandLine {} {
global diff Pref
global argv argc tcl_platform
set diff(leftOK) 0
set diff(rightOK) 0
set diff(mode) ""
set diff(printFile) ""
set noautodiff 0
set autobrowse 0
set diff(mergeFile) ""
set diff(conflictFile) ""
if {$argc == 0} return
set files ""
set nextArg ""
foreach arg $argv {
if {$nextArg != ""} {
if {$nextArg == "mergeFile"} {
set diff(mergeFile) [file join [pwd] $arg]
} elseif {$nextArg == "printFile"} {
set diff(printFile) [file join [pwd] $arg]
} elseif {$nextArg == "revision"} {
set Pref(dopt) "$Pref(dopt) -r$arg"
}
set nextArg ""
continue
}
if {$arg == "-w"} {
|
︙ | | | ︙ | |
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
|
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"} {
|
|
|
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
|
set noautodiff 1
} elseif {$arg == "-browse"} {
set autobrowse 1
} elseif {$arg == "-conflict"} {
set diff(mode) "conflict"
set Pref(ignore) " "
} elseif {$arg == "-print"} {
set nextArg printFile
} elseif {$arg == "-server"} {
if {$tcl_platform(platform) == "windows"} {
dde servername Diff
} else {
tk appname Diff
}
} elseif {$arg == "-o"} {
|
︙ | | | ︙ | |