Eskil

Check-in [d787c9f604]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added -limit option. Fixed bug where a skipped large block did not show up in map. Added 'C' to prettyprint options.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d787c9f6049a5fff18a8d6a81124f84934783515
User & Date: spjutp 2002-03-11 13:34:41.000
Context
2002-03-15
14:44
Improved compareBlocks a bit for the case of same number of lines. Clear map and set eqLabel to "*" during external diff execution. Fixed a big in -limit. check-in: c8952314db user: spjutp tags: trunk
2002-03-11
13:34
Added -limit option. Fixed bug where a skipped large block did not show up in map. Added 'C' to prettyprint options. check-in: d787c9f604 user: spjutp tags: trunk
2001-11-09
16:27
Fixed zoom to display better and to adjust to long lines. Fixed Freewrap support. check-in: 7a3de8b571 user: spjutp tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/eskil.tcl.
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#
#-----------------------------------------------
# $Revision$
#-----------------------------------------------
# the next line restarts using wish \
exec wish "$0" "$@"

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

set diffexe diff








|
|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#
#-----------------------------------------------
# $Revision$
#-----------------------------------------------
# the next line restarts using wish \
exec wish "$0" "$@"

set debug 0
set diffver "Version 1.9.3  2002-03-11"
set tmpcnt 0
set tmpfiles {}
set thisscript [file join [pwd] [info script]]
set thisdir [file dirname $thisscript]

set diffexe diff

686
687
688
689
690
691
692






693
694
695
696
697
698
699

    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} {
            set limit $Pref(context)






        }
        set t 0
        while {[gets $ch2 apa] != -1} {
            insert 2 $doingLine2 $apa
            incr doingLine2
            incr mapMax
            incr t







>
>
>
>
>
>







686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705

    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} {
            set limit $Pref(context)
        }
        if {$::diff(limitlines)} {
            set limit [expr {$::diff(limitlines) - $mapMax}]
            if {$limit < 0} {
                set limit 0
            }
        }
        set t 0
        while {[gets $ch2 apa] != -1} {
            insert 2 $doingLine2 $apa
            incr doingLine2
            incr mapMax
            incr t
733
734
735
736
737
738
739



740
741
742
743
744
745
746
            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"
    }







>
>
>







739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
            emptyline 1 0
            emptyline 2 0
            incr mapMax
        }
        incr doingLine1
        incr doingLine2
        incr t
        if {$::diff(limitlines) && $mapMax > $::diff(limitlines)} {
            return
        }
    }
    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"
    }
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
                incr doingLine1
            }
            for {set t 0} {$t < $n2} {incr t} {
                gets $ch2 apa
                insert 2 $doingLine2 $apa $tag2
                incr doingLine2
            }
            if {$n1 < $n2} {
                for {set t $n1} {$t < $n2} {incr t} {
                    emptyline 1
                }
                lappend changesList $mapMax $n2 $tag2 \
                        $line1 $n1 $line2 $n2
                incr mapMax $n2
            } elseif {$n2 < $n1} {







|







789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
                incr doingLine1
            }
            for {set t 0} {$t < $n2} {incr t} {
                gets $ch2 apa
                insert 2 $doingLine2 $apa $tag2
                incr doingLine2
            }
            if {$n1 <= $n2} {
                for {set t $n1} {$t < $n2} {incr t} {
                    emptyline 1
                }
                lappend changesList $mapMax $n2 $tag2 \
                        $line1 $n1 $line2 $n2
                incr mapMax $n2
            } elseif {$n2 < $n1} {
1975
1976
1977
1978
1979
1980
1981
1982
1983

1984
1985
1986
1987
1988
1989
1990
    if {$w != $::diff(isearch)} {
        bell
        endIncrementalSearch $::diff(isearch)
        return -code break
    }

    if {$key == ""} {
        # Ignore the Control key
        if {[string match Contr* $sym]} {return -code break}

        # Ignore any Control-ed key
        if {$state == 4} {return -code break}
        # Break isearch on other non-ascii keys, and let it through
        bell
        endIncrementalSearch $::diff(isearch)
        return
    }







|

>







1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
    if {$w != $::diff(isearch)} {
        bell
        endIncrementalSearch $::diff(isearch)
        return -code break
    }

    if {$key == ""} {
        # Ignore the Control and Shift keys
        if {[string match Contr* $sym]} {return -code break}
        if {[string match Shift* $sym]} {return -code break}
        # Ignore any Control-ed key
        if {$state == 4} {return -code break}
        # Break isearch on other non-ascii keys, and let it through
        bell
        endIncrementalSearch $::diff(isearch)
        return
    }
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326

2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
    wm title .pr "Print diffs"

    label .pr.l1 -justify left -anchor w \
            -text "The print function is just on an\
            experimental level. It will use 'enscript' to write a postcript\
            file \"tcldiff.ps\" in your home directory."
    label .pr.l2 -justify left -anchor w \
            -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 320
    .pr.l2 configure -wraplength 320

    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 -width 7 \
            -command {destroy .pr; update; printDiffs}
    button .pr.b2 -text Cancel -width 7 \
            -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 -padx 5 -pady 5
    grid .pr.b2 -sticky e
    pack .pr.r1 .pr.r2 .pr.r3 -in .pr.f -side left -fill x -expand 1

}

#####################################
# GUI stuff
#####################################








|
|


|
|








|
>













|







2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
    wm title .pr "Print diffs"

    label .pr.l1 -justify left -anchor w \
            -text "The print function is just on an\
            experimental level. It will use 'enscript' to write a postcript\
            file \"tcldiff.ps\" in your home directory."
    label .pr.l2 -justify left -anchor w \
            -text "Below you can adjust the gray scale\
            levels that are 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 400
    .pr.l2 configure -wraplength 400

    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"
    radiobutton .pr.r4 -text "C"    -variable prettyPrint -value "c"

    button .pr.b1 -text Print -width 7 \
            -command {destroy .pr; update; printDiffs}
    button .pr.b2 -text Cancel -width 7 \
            -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 -padx 5 -pady 5
    grid .pr.b2 -sticky e
    pack .pr.r1 .pr.r2 .pr.r3 .pr.r4 -in .pr.f -side left -fill x -expand 1

}

#####################################
# GUI stuff
#####################################

3130
3131
3132
3133
3134
3135
3136


3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151

3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164


3165
3166
3167
3168
3169
3170
3171
                mode.
  -o <file>   : Specify merge result output file. 

  -browse     : Automatically bring up file dialog after starting.
  -server     : Set up diff to be controllable from the outside.

  -print <file> : Generate postscript and exit.


}
}

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"} {
            set Pref(ignore) "-w"
        } elseif {$arg == "-h"} {







>
>















>













>
>







3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
                mode.
  -o <file>   : Specify merge result output file. 

  -browse     : Automatically bring up file dialog after starting.
  -server     : Set up diff to be controllable from the outside.

  -print <file> : Generate postscript and exit.

  -limit <lines> : Do not process more than <lines> lines.
}
}

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) ""
    set diff(limitlines) 0

    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"
            } elseif {$nextArg == "limitlines"} {
                set diff(limitlines) $arg
            }
            set nextArg ""
            continue
        }
        if {$arg == "-w"} {
            set Pref(ignore) "-w"
        } elseif {$arg == "-h"} {
3187
3188
3189
3190
3191
3192
3193


3194
3195
3196
3197
3198
3199
3200
            set Pref(lineparsewords) 0
        } elseif {$arg == "-word"} {
            set Pref(lineparsewords) 1
        } elseif {$arg == "-2nd"} {
            set Pref(extralineparse) 1
        } elseif {$arg == "-no2nd"} {
            set Pref(extralineparse) 0


        } elseif {$arg == "-nodiff"} {
            set noautodiff 1
        } elseif {$arg == "-browse"} {
            set autobrowse 1
        } elseif {$arg == "-conflict"} {
            set diff(mode) "conflict"
            set Pref(ignore) " "







>
>







3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
            set Pref(lineparsewords) 0
        } elseif {$arg == "-word"} {
            set Pref(lineparsewords) 1
        } elseif {$arg == "-2nd"} {
            set Pref(extralineparse) 1
        } elseif {$arg == "-no2nd"} {
            set Pref(extralineparse) 0
        } elseif {$arg == "-limit"} {
            set nextArg limitlines
        } elseif {$arg == "-nodiff"} {
            set noautodiff 1
        } elseif {$arg == "-browse"} {
            set autobrowse 1
        } elseif {$arg == "-conflict"} {
            set diff(mode) "conflict"
            set Pref(ignore) " "
3350
3351
3352
3353
3354
3355
3356
3357
3358

3359
3360
3361
3362
3363
3364
3365
if {![winfo exists .f]} {
    getOptions
    makeDiffWin
    update idletasks
    parseCommandLine
}

## FIXA, ga igenom Ulfs kod
# Searching contributed by Ulf Nilsson


# Dialog functions from "Practical Programming in Tcl And Tk" by Welch.
proc Dialog_Create {top title args} {
    global dialog
    if {[winfo exists $top]} {
        switch -- [wm state $top] {
            normal {







<

>







3368
3369
3370
3371
3372
3373
3374

3375
3376
3377
3378
3379
3380
3381
3382
3383
if {![winfo exists .f]} {
    getOptions
    makeDiffWin
    update idletasks
    parseCommandLine
}


# Searching contributed by Ulf Nilsson
# FIXA, test this properly and incorporate into the rest of the file

# Dialog functions from "Practical Programming in Tcl And Tk" by Welch.
proc Dialog_Create {top title args} {
    global dialog
    if {[winfo exists $top]} {
        switch -- [wm state $top] {
            normal {