diff.tcl
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 lappend auto_path \
00016 [file join \
00017 [file dirname [file dirname [file dirname [file dirname [file join [pwd] [info script]]]]]] \
00018 modules struct]
00019 package require struct
00020
00021
00022
00023 f1 = [open [lindex $argv 0] r]
00024 lines1 = [split [read $f1] \n]
00025 close $f1
00026
00027 f2 = [open [lindex $argv 1] r]
00028 lines2 = [split [read $f2] \n]
00029 close $f2
00030
00031 i = 0
00032 j = 0
00033
00034 ::struct::list assign [::struct::list longestCommonSubsequence $lines1 $lines2] x1 x2
00035
00036 foreach p $x1 q $x2 {
00037 while { $i < $p } {
00038 l = [lindex $lines1 $i]
00039 puts "[incr i]\t\t$l"
00040 }
00041 while { $j < $q } {
00042 m = [lindex $lines2 $j]
00043 puts "\t[incr j]\t$m"
00044 }
00045 l = [lindex $lines1 $i]
00046 puts "[incr i]\t[incr j]\t$l"
00047 }
00048 while { $i < [llength $lines1] } {
00049 l = [lindex $lines1 $i]
00050 puts "[incr i]\t\t$l"
00051 }
00052 while { $j < [llength $lines2] } {
00053 m = [lindex $lines2 $j]
00054 puts "\t[incr j]\t$m"
00055 }
00056
00057 exit
00058