Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Release 1.4 |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f33ac07fcaf2a4cbfbd3acc2108a3913 |
User & Date: | spjutp 1999-02-10 16:13:03.000 |
Context
1999-06-22
| ||
11:31 | Improved block parse. Added font selection. Added server option. check-in: eab8d09390 user: spjutp tags: trunk | |
1999-02-10
| ||
16:13 | Release 1.4 check-in: f33ac07fca user: spjutp tags: trunk | |
1998-11-30
| ||
15:51 | Use both files for display. Better RCS handling. check-in: 60a86635a3 user: spjutp tags: trunk | |
Changes
Changes to src/eskil.tcl.
︙ | ︙ | |||
12 13 14 15 16 17 18 | # are passed to diff. # [file1],[file2] Files to be compared # If no files are given, the program is # started anyway and you can select files # from within. # If only one file is given, the program # looks for an RCS directory next to the | | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # are passed to diff. # [file1],[file2] Files to be compared # If no files are given, the program is # started anyway and you can select files # from within. # If only one file is given, the program # looks for an RCS directory next to the # file, and if found, runs in RCS mode. # # Options for diff.tcl: # # -nodiff : Normally, if there are enough information on the # command line to run diff, diff.tcl will do so unless # this option is specified. # # -noparse : Diff.tcl can perform analysis of changed blocks to # -line : improve display. See online help for details. # -block : The default is -block, but this can be slow if there # are large change blocks. |
︙ | ︙ | |||
46 47 48 49 50 51 52 | # 1.2 DC-PS 980818 Improved yscroll # Added map next to y-scrollbar # 1.3 DC-PS 980921 Added Prev Diff button # Added colour options, and Only diffs option # Added 2nd stage line parsing # Improved block parsing # Added print | > | > | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # 1.2 DC-PS 980818 Improved yscroll # Added map next to y-scrollbar # 1.3 DC-PS 980921 Added Prev Diff button # Added colour options, and Only diffs option # Added 2nd stage line parsing # Improved block parsing # Added print # 1.4 DC-PS 990210 Bug-fix in "Ignore nothing" # Bug-fix in file handling # Improved RCS handling. # #----------------------------------------------- # the next line restarts using wish \ exec wish "$0" "$@" set debug 0 set diffver "Version 1.4 990210" set tmpcnt 0 proc myform {lineNo text} { return [format "%3d: %s\n" $lineNo $text] } proc myforml {lineNo} { |
︙ | ︙ | |||
206 207 208 209 210 211 212 | #element is equal between the lines. The second, fourth etc. will be #highlighted. proc comparelines {line1 line2 res1Name res2Name {test 0}} { global Pref upvar $res1Name res1 upvar $res2Name res2 | > | | | | | | | > > > > > > > > > | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | #element is equal between the lines. The second, fourth etc. will be #highlighted. proc comparelines {line1 line2 res1Name res2Name {test 0}} { global Pref upvar $res1Name res1 upvar $res2Name res2 if {$Pref(ignore) != " "} { #Skip white space in both ends set apa1 [string trimleft $line1] set leftp1 [expr {[string length $line1] - [string length $apa1]}] set mid1 [string trimright $line1] set apa2 [string trimleft $line2] set leftp2 [expr {[string length $line2] - [string length $apa2]}] set mid2 [string trimright $line2] } else { # If option "ignore nothing" is selected set apa1 "" set leftp1 0 set mid1 $line1 set apa2 "" set leftp2 0 set mid2 $line2 } #Check for matching left chars/words. #leftp1 and leftp2 will be the indicies of the first difference set len1 [string length $apa1] set len2 [string length $apa2] set len [expr {$len1 < $len2 ? $len1 : $len2}] |
︙ | ︙ | |||
485 486 487 488 489 490 491 | .t2 insert end [myform $doingLine2 $line2] change } incr doingLine1 incr doingLine2 } #Process one of the change/add/delete blocks reported by diff. | | | < < > > > > | > | | | | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | .t2 insert end [myform $doingLine2 $line2] change } incr doingLine1 incr doingLine2 } #Process one of the change/add/delete blocks reported by diff. #ch1 is a file channel for the left file #ch2 is a file channel for the right file #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 mapList mapMax if {$n1 == 0 && $n2 == 0} { #All blocks has been processed. Continue until end of file. if {$Pref(onlydiffs) == 1} return while {[gets $ch2 apa] != -1} { .t2 insert end [myform $doingLine2 $apa] incr doingLine2 incr mapMax } while {[gets $ch1 apa] != -1} { .t1 insert end [myform $doingLine1 $apa] incr doingLine1 } 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 {$Pref(onlydiffs) == 1 && $doingLine1 < $line1} { .t1 insert end "\n" .t2 insert end "\n" incr mapMax } while {$doingLine1 < $line1} { gets $ch1 apa gets $ch2 bepa if {$Pref(onlydiffs) == 0} { .t1 insert end [myform $doingLine1 $apa] .t2 insert end [myform $doingLine2 $bepa] incr mapMax } incr doingLine1 incr doingLine2 } if {$doingLine2 != $line2} { .t1 insert end "**Bad alignment here!! $doingLine2 $line2**\n" .t2 insert end "**Bad alignment here!! $doingLine2 $line2**\n" } #Process the block if {$n1 == $n2 && ($n1 == 1 || $Pref(parse) != "block")} { for {set t 0} {$t < $n1} {incr t} { gets $ch1 line1 gets $ch2 line2 insertMatchingLines $line1 $line2 } lappend mapList $mapMax incr mapMax $n1 lappend mapList $mapMax change } else { if {$n1 != 0 && $n2 != 0 && $Pref(parse) == "block"} { set block1 {} for {set t 0} {$t < $n1} {incr t} { gets $ch1 apa lappend block1 $apa } set block2 {} for {set t 0} {$t < $n2} {incr t} { gets $ch2 apa lappend block2 $apa } |
︙ | ︙ | |||
566 567 568 569 570 571 572 | set line2 [lindex $block2 $t2] insertMatchingLines $line1 $line2 incr t1 incr t2 } if {$c == "d"} { set bepa [lindex $block1 $t1] | | > | > | | 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | set line2 [lindex $block2 $t2] insertMatchingLines $line1 $line2 incr t1 incr t2 } if {$c == "d"} { set bepa [lindex $block1 $t1] .t1 insert end [myforml $doingLine1] change .t1 insert end "$bepa\n" new1 .t2 insert end "\n" incr doingLine1 incr t1 } if {$c == "a"} { set bepa [lindex $block2 $t2] .t2 insert end [myforml $doingLine2] change .t2 insert end "$bepa\n" new2 .t1 insert end "\n" incr doingLine2 incr t2 } } lappend mapList $mapMax incr mapMax [llength $apa] lappend mapList $mapMax change } else { for {set t 0} {$t < $n1} {incr t} { gets $ch1 apa .t1 insert end [myform $doingLine1 $apa] $tag1 incr doingLine1 } for {set t 0} {$t < $n2} {incr t} { gets $ch2 apa .t2 insert end [myform $doingLine2 $apa] $tag2 incr doingLine2 |
︙ | ︙ | |||
765 766 767 768 769 770 771 | prepareRCS } set differr [catch {eval exec diff $Pref(dopt) $Pref(ignore) $leftFile $rightFile} diffres] set apa [split $diffres "\n"] set result {} | < < < < | | 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | prepareRCS } set differr [catch {eval exec diff $Pref(dopt) $Pref(ignore) $leftFile $rightFile} diffres] set apa [split $diffres "\n"] set result {} foreach i $apa { if {[string match {[0-9]*} $i]} { lappend result $i } } if {[llength $result] == 0} { if {$differr == 1} { .t1 insert end $diffres normalCursor return } else { set eqLabel "=" } } else { set eqLabel " " } set ch1 [open $leftFile] set ch2 [open $rightFile] set doingLine1 1 set doingLine2 1 foreach i $result { if {![regexp {(.*)([acd])(.*)} $i apa l c r]} { .t1 insert 1.0 "No regexp match for $i\n" |
︙ | ︙ | |||
813 814 815 816 817 818 819 | } else { set n2 1 set line2 $r } switch $c { a { # lucka i left, new i right | | > | < < | > | < < | | > | 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | } else { set n2 1 set line2 $r } switch $c { a { # lucka i left, new i right dotext $ch1 $ch2 0 $n2 [expr {$line1 + 1}] $line2 } c { dotext $ch1 $ch2 $n1 $n2 $line1 $line2 } d { # lucka i right, new i left dotext $ch1 $ch2 $n1 0 $line1 [expr {$line2 + 1}] } } } } dotext $ch1 $ch2 0 0 0 0 close $ch1 close $ch2 if {$RCS} { cleanupRCS } drawMap -1 |
︙ | ︙ | |||
979 980 981 982 983 984 985 986 987 988 989 990 991 992 | set newline 0 set line "\0bggray\{$gray\}" set chars 0 set wrapc 0 } switch $key { text { if {[string range $value end end] == "\n"} { set newline 1 set value [string trimright $value "\n"] } set len [string length $value] while {$chars + $len > 85} { set wrap [expr {85 - $chars}] | > > > | 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 | set newline 0 set line "\0bggray\{$gray\}" set chars 0 set wrapc 0 } switch $key { text { if {[regsub -all "\f" $value {} apa]} { set value $apa } if {[string range $value end end] == "\n"} { set newline 1 set value [string trimright $value "\n"] } set len [string length $value] while {$chars + $len > 85} { set wrap [expr {85 - $chars}] |
︙ | ︙ | |||
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 | .md.m add separator } .md.m add command -label "Stack trace" -command {bgerror Debug} .md.m add separator .md.m add command -label "Reread Source" -command {source diff.tcl} .md.m add separator .md.m add command -label "Redraw Window" -command {makeDiffWin} pack .mf .mo .mh .md -in .f -side left } else { pack .mf .mo .mh -in .f -side left } pack .bfn .bfp .eo .lo -in .f -side right } | > > | 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 | .md.m add separator } .md.m add command -label "Stack trace" -command {bgerror Debug} .md.m add separator .md.m add command -label "Reread Source" -command {source diff.tcl} .md.m add separator .md.m add command -label "Redraw Window" -command {makeDiffWin} .md.m add separator .md.m add command -label "Normal Cursor" -command {normalCursor} pack .mf .mo .mh .md -in .f -side left } else { pack .mf .mo .mh -in .f -side left } pack .bfn .bfp .eo .lo -in .f -side right } |
︙ | ︙ | |||
1345 1346 1347 1348 1349 1350 1351 | } "" {Commands} ul { File Menu Redo Diff : Run diff again on the same files. Open Both : Select two files, run diff. Open Left File : Select a file for left window, run diff Open Right File: Select a file for right window, run diff | | | 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 | } "" {Commands} ul { File Menu Redo Diff : Run diff again on the same files. Open Both : Select two files, run diff. Open Left File : Select a file for left window, run diff Open Right File: Select a file for right window, run diff RCSDiff : (UNIX only) Select one file and diff like rcsdiff. Print : (UNIX only) Experimental print function. It currently creates a postscript file ~/tcldiff.ps Quit : Guess Options Menu Fontsize : Select fontsize for the two main text windows Ignore : Diff options for handling whitespace |
︙ | ︙ | |||
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 | highlight full words only, or check single characters. 2nd stage : More thorough parsing of a line. Diffs only : Only differing lines will be displayed. Colours : Choose highlight colours. Save default: Save current option settings in ~/.diffrc Diff Options Field: Any text written here will be passed to diff. Prev Diff Button: Scrolls to the previous differing block, or to the top if there are no more diffs. Next Diff Button: Scrolls to the next differing block, or to the bottom if there are no more diffs. Equal sign: Above the vertical scrollbar, a "=" will appear if the files | > | 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 | highlight full words only, or check single characters. 2nd stage : More thorough parsing of a line. Diffs only : Only differing lines will be displayed. Colours : Choose highlight colours. Save default: Save current option settings in ~/.diffrc Diff Options Field: Any text written here will be passed to diff. In RCS mode, any -r options will be used to select versions. Prev Diff Button: Scrolls to the previous differing block, or to the top if there are no more diffs. Next Diff Button: Scrolls to the next differing block, or to the bottom if there are no more diffs. Equal sign: Above the vertical scrollbar, a "=" will appear if the files |
︙ | ︙ | |||
1424 1425 1426 1427 1428 1429 1430 | .he.t insert end {5: } change {NET '/I$1/N$1458' IC2-} "" {10} change { } "" {4: } change {NET '/I$1/N$1458' IC2-} "" {9} change "\n" .he.t insert end "\n" .he.t insert end "Example 3. Blocks and characters\n" .he.t insert end {1: } change {NET '/I$1/N$1454' IC} "" {2-15} change { IC5-7 } "" {1: } change {NET '/I$1/N$1454' IC} "" {1-4 IC2-15 IC5-2} change " IC5-7\n" | | | | | 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 | .he.t insert end {5: } change {NET '/I$1/N$1458' IC2-} "" {10} change { } "" {4: } change {NET '/I$1/N$1458' IC2-} "" {9} change "\n" .he.t insert end "\n" .he.t insert end "Example 3. Blocks and characters\n" .he.t insert end {1: } change {NET '/I$1/N$1454' IC} "" {2-15} change { IC5-7 } "" {1: } change {NET '/I$1/N$1454' IC} "" {1-4 IC2-15 IC5-2} change " IC5-7\n" .he.t insert end {2: } change {NET '/I$1/N$1455' IC2-14 IC6-8 } new1 "\n" "" .he.t insert end {3: } change {NET '/I$1/N$1456' IC2-1} "" {3 IC2-1} new1 {2 } "" {2: } change {NET '/I$1/N$1456' IC2-12 } .he.t insert end {4: NET '/I$1/N$1457' IC2-11 IC6-7 3: NET '/I$1/N$1457' IC2-11 IC6-7 } .he.t insert end {5: } change {NET '/I$1/N$1458' IC2-} "" {10} change { } "" {4: } change {NET '/I$1/N$1458' IC2-} "" {9} change "\n" .he.t insert end "\n" .he.t insert end "Example 4. Blocks and words\n" .he.t insert end {1: } change {NET '/I$1/N$1454' } "" {IC2-15} change { IC5-7 } "" {1: } change {NET '/I$1/N$1454' } "" {IC1-4 IC2-15 IC5-2} change " IC5-7\n" .he.t insert end {2: } change {NET '/I$1/N$1455' IC2-14 IC6-8 } new1 "\n" "" .he.t insert end {3: } change {NET '/I$1/N$1456' } "" {IC2-13 } new1 {IC2-12 } "" {2: } change {NET '/I$1/N$1456' IC2-12 } .he.t insert end {4: NET '/I$1/N$1457' IC2-11 IC6-7 3: NET '/I$1/N$1457' IC2-11 IC6-7 } .he.t insert end {5: } change {NET '/I$1/N$1458' } "" {IC2-10} change { } "" {4: } change {NET '/I$1/N$1458' } "" {IC2-9} change "\n" .he.t insert end "\n" .he.t insert end "Example 5. Blocks, words and 2nd stage\n" .he.t insert end {1: } change {NET '/I$1/N$1454' IC2-15 IC5-7 } "" {1: } change {NET '/I$1/N$1454' } "" {IC1-4 } new2 {IC2-15} "" { IC5-2} new2 " IC5-7\n" .he.t insert end {2: } change {NET '/I$1/N$1455' IC2-14 IC6-8 } new1 "\n" "" .he.t insert end {3: } change {NET '/I$1/N$1456' } "" {IC2-13 } new1 {IC2-12 } "" {2: } change {NET '/I$1/N$1456' IC2-12 } .he.t insert end {4: NET '/I$1/N$1457' IC2-11 IC6-7 3: NET '/I$1/N$1457' IC2-11 IC6-7 } .he.t insert end {5: } change {NET '/I$1/N$1458' } "" {IC2-10} change { } "" {4: } change {NET '/I$1/N$1458' } "" {IC2-9} change "\n" } |
︙ | ︙ | |||
1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 | set files "" foreach arg $argv { if {$arg == "-w"} { set Pref(ignore) "-w" } elseif {$arg == "-b"} { set Pref(ignore) "-b" } elseif {$arg == "-noparse"} { set Pref(parse) "none" } elseif {$arg == "-line"} { set Pref(parse) "line" } elseif {$arg == "-block"} { set Pref(parse) "block" } elseif {$arg == "-char"} { | > > | 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 | set files "" foreach arg $argv { if {$arg == "-w"} { set Pref(ignore) "-w" } elseif {$arg == "-b"} { set Pref(ignore) "-b" } elseif {$arg == "-noignore"} { set Pref(ignore) " " } elseif {$arg == "-noparse"} { set Pref(parse) "none" } elseif {$arg == "-line"} { set Pref(parse) "line" } elseif {$arg == "-block"} { set Pref(parse) "block" } elseif {$arg == "-char"} { |
︙ | ︙ |