︙ | | |
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
-
+
|
#-----------------------------------------------
# $Revision$
#-----------------------------------------------
# the next line restarts using wish \
exec wish "$0" "$@"
set debug 1
set diffver "Version 1.8.6 2001-10-26"
set diffver "Version 1.8.7 2001-11-02"
set tmpcnt 0
set tmpfiles {}
set thisscript [file join [pwd] [info script]]
set thisdir [file dirname $thisscript]
if {$tcl_platform(platform) == "windows"} {
cd $thisdir
|
︙ | | |
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
|
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
|
-
-
+
+
+
+
+
+
|
.ft$n.tt insert end "$text\n" $tag
if {$tag != ""} {
set tag "hl$::HighLightCount $tag"
}
.ft$n.tl insert end [myforml $line] $tag
}
proc emptyline {n} {
.ft$n.tl insert end "\n" hl$::HighLightCount
proc emptyline {n {highlight 1}} {
if {$highlight} {
.ft$n.tl insert end "\n" hl$::HighLightCount
} else {
.ft$n.tl insert end "\n"
}
.ft$n.tt insert end "\n"
}
# Insert one line in each text widget.
# Mark them as changed, and optionally parse them.
proc insertMatchingLines {line1 line2} {
global doingLine1 doingLine2 Pref
|
︙ | | |
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
|
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
|
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
+
-
+
+
+
+
+
+
+
|
# n1/n2 is the number of lines involved
# line1/line2 says on what lines this block starts
proc dotext {ch1 ch2 n1 n2 line1 line2} {
global doingLine1 doingLine2 Pref mapMax changesList
if {$n1 == 0 && $n2 == 0} {
# All blocks have been processed. Continue until end of file.
# If "only diffs" is on, just display a couple of context lines.
set limit -1
if {$Pref(onlydiffs) == 1} return
if {$Pref(onlydiffs) == 1} {
set limit $Pref(context)
}
set t 0
while {[gets $ch2 apa] != -1} {
insert 2 $doingLine2 $apa
incr doingLine2
incr mapMax
incr t
if {$limit >= 0 && $t >= $limit} break
}
set t 0
while {[gets $ch1 apa] != -1} {
insert 1 $doingLine1 $apa
incr doingLine1
incr t
if {$limit >= 0 && $t >= $limit} break
}
return
}
if {$n1 == 0} {set tag2 new2} else {set tag2 change}
if {$n2 == 0} {set tag1 new1} else {set tag1 change}
# Display all equal lines before next diff
# If only diff is on, only skip a section if the blank
# line replaces at least 3 lines.
set limit -1
if {$Pref(onlydiffs) == 1 && $doingLine1 < $line1} {
emptyline 1
emptyline 2
if {$Pref(onlydiffs) == 1 && \
($line1 - $doingLine1 > (2 * $Pref(context) + 2))} {
set limit $Pref(context)
incr mapMax
}
set t 0
while {$doingLine1 < $line1} {
gets $ch1 apa
gets $ch2 bepa
if {$Pref(onlydiffs) == 0} {
if {$limit < 0 || ($t < $limit && $doingLine1 > $limit) || \
($line1 - $doingLine1) <= $limit} {
insert 1 $doingLine1 $apa
insert 2 $doingLine2 $bepa
incr mapMax
} elseif {$t == $limit} {
emptyline 1 0
emptyline 2 0
incr mapMax
}
incr doingLine1
incr doingLine2
incr t
}
if {$doingLine2 != $line2} {
.ft1.tt insert end "**Bad alignment here!! $doingLine2 $line2**\n"
.ft2.tt insert end "**Bad alignment here!! $doingLine2 $line2**\n"
.ft1.tl insert end "\n"
.ft2.tl insert end "\n"
}
|
︙ | | |
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
|
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
|
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
|
set i1 0
set i2 0
while {$i1 < $len1 && $i2 < $len2} {
for {set i 0} {$i < 66 && $i1 < $len1} {incr i ; incr i1} {
puts $ch [lindex $wraplines1 $i1]
}
puts -nonewline $ch "\f"
if {$i < 66} {puts -nonewline $ch "\f"}
for {set i 0} {$i < 66 && $i2 < $len2} {incr i ; incr i2} {
puts $ch [lindex $wraplines2 $i2]
}
puts -nonewline $ch "\f"
if {$i < 66} {puts -nonewline $ch "\f"}
}
close $ch
if {$::tcl_platform(platform) == "windows" &&\
![info exists env(ENSCRIPT_LIBRARY)]} {
set ::env(ENSCRIPT_LIBRARY) [pwd]
}
set enscriptCmd [list enscript -2jcre]
if {![regexp {^(.*)( \(.*?\))$} $::diff(leftLabel) -> lfile lrest]} {
set lfile $::diff(leftLabel)
set lrest ""
}
set lfile [file tail $lfile]$lrest
if {![regexp {^(.*)( \(.*?\))$} $::diff(rightLabel) -> rfile rrest]} {
set rfile $::diff(rightLabel)
set rrest ""
}
set rfile [file tail $rfile]$rrest
if {[catch {exec enscript -c -B -e -p $tmpFile2 $tmpFile} result]} {
lappend enscriptCmd "--header=$lfile|Page \$% of \$=|$rfile"
if {$::prettyPrint != ""} {
lappend enscriptCmd -E$::prettyPrint
}
lappend enscriptCmd -p $tmpFile3 $tmpFile
if {[catch {eval exec $enscriptCmd} result]} {
if {[string index $result 0] != "\["} {
tk_messageBox -message "Enscript error: $result"
return
}
}
if {[catch {exec mpage -bA4 -a2 $tmpFile2 > $tmpFile3} result]} {
tk_messageBox -message "Mpage error: $result"
return
}
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"
\n\n$tmpFile3\nCreated with\
'[lrange $enscriptCmd 0 end-3] \\\n \
[lrange $enscriptCmd end-2 end]'" \
-font "Courier 8"
pack .dp.b -side bottom
pack .dp.l -side top
}
}
# Create a print dialog.
proc doPrint {{quiet 0}} {
|
︙ | | |
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
|
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
|
+
+
+
+
+
+
+
|
.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
frame .pr.f
radiobutton .pr.r1 -text "No Syntax" -variable prettyPrint -value ""
radiobutton .pr.r2 -text "VHDL" -variable prettyPrint -value "vhdl"
radiobutton .pr.r3 -text "Tcl" -variable prettyPrint -value "tcl"
button .pr.b1 -text Print -command {destroy .pr; update; printDiffs}
button .pr.b2 -text Cancel -command {destroy .pr}
grid .pr.l1 - -sticky we
grid .pr.l2 - -sticky we
grid .pr.s1 - -sticky we
grid .pr.s2 - -sticky we
grid .pr.f - -sticky we
grid .pr.b1 .pr.b2 -sticky w
grid .pr.b2 -sticky e
pack .pr.r1 .pr.r2 .pr.r3 -in .pr.f -side left -fill x -expand 1
}
#####################################
# GUI stuff
#####################################
|
︙ | | |
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
|
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
|
+
|
set Pref(colorchange) red
set Pref(colornew1) darkgreen
set Pref(colornew2) blue
set Pref(bgchange) gray
set Pref(bgnew1) gray
set Pref(bgnew2) gray
set Pref(onlydiffs) 0
set Pref(context) 2
set Pref(crlf) 0
set Pref(marklast) 1
if {[file exists "~/.diffrc"]} {
source "~/.diffrc"
}
}
|
︙ | | |