Eskil

Check-in [c0f250b652]
Login

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

Overview
Comment:More plugin examples
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c0f250b652a499bdb77d1bbf19d3e1e0479ee735
User & Date: peter 2008-05-23 04:59:13.000
Context
2008-09-23
18:48
Do not parse GIT revisions. check-in: 61849504cd user: peter tags: trunk
2008-05-23
04:59
More plugin examples check-in: c0f250b652 user: peter tags: trunk
04:50
Push Prefs into plugin check-in: b5abba5fa8 user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Changes.



1
2
3
4
5
6
7



2008-04-09
 Added color option for unchanged text.

2008-03-07
 Added -review to do full tree view like a patch.

2008-03-05
>
>
>







1
2
3
4
5
6
7
8
9
10
2008-05-23
 Started on plugins.

2008-04-09
 Added color option for unchanged text.

2008-03-07
 Added -review to do full tree view like a patch.

2008-03-05
Changes to plugins/nocase.tcl.
1
2
3



4
5




6
7

8
9

10
11



12
13
##Eskil Plugin

# Example file for a plugin.



# Correspondning to -nocase flag.





proc PreProcess {side chi cho} {
    while {1} {

        set data [read $chi 100000]
        if {$data eq ""} break

        puts -nonewline $cho [string tolower $data]
    }



    return 0
}



>
>
>
|

>
>
>
>


>


>


>
>
>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
##Eskil Plugin

# Example file for a plugin.
# A plugin must start with the exact first line as this one.

# This plugin implements case insensitive matching, corresponding to the
# -nocase flag.

# A plugin must define this procedure to do the job.
# side: left or right
# chi:  An input channel for reading the original file.
# cho:  An output channel for writing the processed file.
proc PreProcess {side chi cho} {
    while {1} {
        # Read data in large chunks for speed
        set data [read $chi 100000]
        if {$data eq ""} break
        # Use lower case for comparison, thus getting case insensitive
        puts -nonewline $cho [string tolower $data]
    }
    # Signal that the file after processing should be used only for
    # comparison, not for displaying.
    # The processed file must match the original line-wise.
    return 0
}
Added plugins/words.tcl.




















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
##Eskil Plugin

# Example file for a plugin.
# A plugin must start with the exact first line as this one.

# This plugin compares the set of words in files.

# A plugin must define this procedure to do the job.
# side: left or right
# chi:  An input channel for reading the original file.
# cho:  An output channel for writing the processed file.
proc PreProcess {side chi cho} {
    while {[gets $chi line] >= 0} {
        foreach word [regexp -all -inline {\w+} $line] {
            # Plugins have access to preferences
            if {[info exists ::Pref(nocase)] && $::Pref(nocase)} {
                set word [string tolower $word]
            }
            set words($word) 1
        }
    }
    puts $cho [join [lsort -dictionary [array names words]] \n]
    # Signal that the file after processing should be used both
    # for comparison and for displaying.
    return 1
}
Changes to src/eskil.tcl.
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Stop Tk from meddling with the command line by copying it first.
set ::eskil(argv) $::argv
set ::eskil(argc) $::argc
set ::argv {}
set ::argc 0

set debug 0
set diffver "Version 2.4b2 2008-04-09"
set ::thisScript [file join [pwd] [info script]]

# Do initalisations for needed packages and globals.
# This is not run until needed to speed up command line error reporting.
proc Init {} {
    package require Tk 8.4
    catch {package require textSearch}







|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Stop Tk from meddling with the command line by copying it first.
set ::eskil(argv) $::argv
set ::eskil(argc) $::argc
set ::argv {}
set ::argc 0

set debug 0
set diffver "Version 2.4b3 2008-05-23"
set ::thisScript [file join [pwd] [info script]]

# Do initalisations for needed packages and globals.
# This is not run until needed to speed up command line error reporting.
proc Init {} {
    package require Tk 8.4
    catch {package require textSearch}