Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added plugins |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
35db83fb5ffdfcd49076ada8636bb962 |
User & Date: | peter 2008-05-22 20:06:39.000 |
Context
2008-05-23
| ||
04:50 | Push Prefs into plugin check-in: b5abba5fa8 user: peter tags: trunk | |
2008-05-22
| ||
20:06 | Added plugins check-in: 35db83fb5f user: peter tags: trunk | |
2008-05-11
| ||
16:09 | Clear merge file when opening new diff. check-in: eeed6d7805 user: peter tags: trunk | |
Changes
Changes to Makefile.
︙ | ︙ | |||
27 28 29 30 31 32 33 | # Tools NAGELFAR = nagelfar all: setup SRCFILES = src/clip.tcl src/dirdiff.tcl src/help.tcl src/map.tcl \ src/print.tcl src/registry.tcl src/rev.tcl src/eskil.tcl \ | | > > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | # Tools NAGELFAR = nagelfar all: setup SRCFILES = src/clip.tcl src/dirdiff.tcl src/help.tcl src/map.tcl \ src/print.tcl src/registry.tcl src/rev.tcl src/eskil.tcl \ src/compare.tcl src/merge.tcl src/printobj.tcl src/plugin.tcl #---------------------------------------------------------------- # Setup symbolic links from the VFS to the real files #---------------------------------------------------------------- eskil.vfs/src/eskil.tcl: @cd eskil.vfs/src ; for i in $(SRCFILES); do ln -fs ../../$$i ; done eskil.vfs/examples: cd eskil.vfs ; ln -s ../examples eskil.vfs/doc: cd eskil.vfs ; ln -s ../doc eskil.vfs/plugins: cd eskil.vfs ; ln -s ../plugins eskil.vfs/COPYING: cd eskil.vfs ; ln -s ../COPYING eskil.vfs/lib/wcb: cd eskil.vfs/lib ; ln -s $(WCB) wcb eskil.vfs/lib/style: # cd eskil.vfs/lib ; ln -s $(STYLE) style eskil.vfs/lib/griffin: |
︙ | ︙ | |||
73 74 75 76 77 78 79 80 81 82 83 84 85 86 | mkdir eskil.vfs/lib/pstools cd eskil.vfs/lib/pstools ; ln -s $(PSTOOLS)/pstools.tcl cd eskil.vfs/lib/pstools ; ln -s $(PSTOOLS)/pkgIndex.tcl links: eskil.vfs/src/eskil.tcl \ eskil.vfs/examples\ eskil.vfs/doc\ eskil.vfs/COPYING\ eskil.vfs/lib/griffin\ eskil.vfs/lib/style\ eskil.vfs/lib/textsearch\ eskil.vfs/lib/psballoon\ eskil.vfs/lib/pstools\ eskil.vfs/lib/diffutil\ | > | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | mkdir eskil.vfs/lib/pstools cd eskil.vfs/lib/pstools ; ln -s $(PSTOOLS)/pstools.tcl cd eskil.vfs/lib/pstools ; ln -s $(PSTOOLS)/pkgIndex.tcl links: eskil.vfs/src/eskil.tcl \ eskil.vfs/examples\ eskil.vfs/doc\ eskil.vfs/plugins\ eskil.vfs/COPYING\ eskil.vfs/lib/griffin\ eskil.vfs/lib/style\ eskil.vfs/lib/textsearch\ eskil.vfs/lib/psballoon\ eskil.vfs/lib/pstools\ eskil.vfs/lib/diffutil\ |
︙ | ︙ |
Added 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 } |
Changes to src/eskil.tcl.
︙ | ︙ | |||
70 71 72 73 74 75 76 77 78 79 80 81 82 83 | source $::thisDir/clip.tcl source $::thisDir/compare.tcl source $::thisDir/map.tcl source $::thisDir/merge.tcl source $::thisDir/registry.tcl source $::thisDir/dirdiff.tcl source $::thisDir/help.tcl source $::thisDir/printobj.tcl source $::thisDir/print.tcl source $::thisDir/rev.tcl set ::util(diffexe) diff # Diff functionality is in the DiffUtil package. | > | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | source $::thisDir/clip.tcl source $::thisDir/compare.tcl source $::thisDir/map.tcl source $::thisDir/merge.tcl source $::thisDir/registry.tcl source $::thisDir/dirdiff.tcl source $::thisDir/help.tcl source $::thisDir/plugin.tcl source $::thisDir/printobj.tcl source $::thisDir/print.tcl source $::thisDir/rev.tcl set ::util(diffexe) diff # Diff functionality is in the DiffUtil package. |
︙ | ︙ | |||
1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 | set ::diff($top,cleanup) "" if {$::diff($top,mode) eq "rev"} { prepareRev $top set ::diff($top,cleanup) "rev" } elseif {$::diff($top,mode) eq "conflict"} { prepareConflict $top set ::diff($top,cleanup) "conflict" } } # Clean up after a diff proc cleanupFiles {top} { switch $::diff($top,cleanup) { "rev" {cleanupRev $top} "conflict" {cleanupConflict $top} } } # Redo Diff command proc redoDiff {top} { # Note what rows are being displayed set w $::widgets($top,wDiff1) | > > > > > > > > > > > > > | 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 | set ::diff($top,cleanup) "" if {$::diff($top,mode) eq "rev"} { prepareRev $top set ::diff($top,cleanup) "rev" } elseif {$::diff($top,mode) eq "conflict"} { prepareConflict $top set ::diff($top,cleanup) "conflict" } elseif {$::diff($top,plugin) ne ""} { preparePlugin $top set ::diff($top,cleanup) "plugin" } } # Clean up after a diff proc cleanupFiles {top} { switch $::diff($top,cleanup) { "rev" {cleanupRev $top} "conflict" {cleanupConflict $top} "plugin" { if {[info exists ::diff($top,leftFileB)]} { set ::diff($top,leftFile) $::diff($top,leftFileB) } if {[info exists ::diff($top,rightFileB)]} { set ::diff($top,rightFile) $::diff($top,rightFileB) } unset -nocomplain ::diff($top,leftFileB) ::diff($top,rightFileB) \ ::diff($top,leftFileD) ::diff($top,rightFileD) } } } # Redo Diff command proc redoDiff {top} { # Note what rows are being displayed set w $::widgets($top,wDiff1) |
︙ | ︙ | |||
1179 1180 1181 1182 1183 1184 1185 1186 1187 | lappend opts -range $range } if {[llength $Pref(regsub)] > 0} { lappend opts -regsub $Pref(regsub) } # Apply nodigit after preprocess if {$Pref(nodigit)} {lappend opts -nodigit} set differr [catch {eval DiffUtil::diffFiles $opts \ | > > > > > > > > > > > | | 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 | lappend opts -range $range } if {[llength $Pref(regsub)] > 0} { lappend opts -regsub $Pref(regsub) } # Apply nodigit after preprocess if {$Pref(nodigit)} {lappend opts -nodigit} if {[info exists ::diff($top,leftFileD)]} { set dFile1 $::diff($top,leftFileD) } else { set dFile1 $::diff($top,leftFile) } if {[info exists ::diff($top,rightFileD)]} { set dFile2 $::diff($top,rightFileD) } else { set dFile2 $::diff($top,rightFile) } set differr [catch {eval DiffUtil::diffFiles $opts \ \$dFile1 \$dFile2} diffres] # In conflict mode we can use the diff information collected when # parsing the conflict file. This makes sure the blocks in the conflict # file become change-blocks during merge. if {$::diff($top,mode) eq "conflict" && $::diff($top,modetype) eq "Pure"} { set diffres $::diff($top,conflictDiff) } |
︙ | ︙ | |||
2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 | set ::diff($top,rightOK) 0 set ::diff($top,mode) "" set ::diff($top,printFile) "" set ::diff($top,printMode) "PDF" set ::diff($top,mergeFile) "" set ::diff($top,conflictFile) "" set ::diff($top,limitlines) 0 } # Create a new diff window and diff two files proc newDiff {file1 file2 {range {}}} { set top [makeDiffWin] update | > | 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 | set ::diff($top,rightOK) 0 set ::diff($top,mode) "" set ::diff($top,printFile) "" set ::diff($top,printMode) "PDF" set ::diff($top,mergeFile) "" set ::diff($top,conflictFile) "" set ::diff($top,limitlines) 0 set ::diff($top,plugin) "" } # Create a new diff window and diff two files proc newDiff {file1 file2 {range {}}} { set top [makeDiffWin] update |
︙ | ︙ | |||
3281 3282 3283 3284 3285 3286 3287 | } set allOpts { -w --help -help -b -noignore -i -nocase -nodigit -nokeyword -prefix -noparse -line -smallblock -block -char -word -limit -nodiff -dir -clip -patch -browse -conflict -print -printps -printpdf -server -o -r -context -cvs -svn -review | | | 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 | } set allOpts { -w --help -help -b -noignore -i -nocase -nodigit -nokeyword -prefix -noparse -line -smallblock -block -char -word -limit -nodiff -dir -clip -patch -browse -conflict -print -printps -printpdf -server -o -r -context -cvs -svn -review -foreach -preprocess -close -nonewline -plugin -plugininfo } # If the first option is "--query", use it to ask about options. if {$::eskil(argc) == 2 && [lindex $::eskil(argv) 0] == "--query"} { set arg [lindex $::eskil(argv) 1] if {[lsearch -exact $allOpts $arg] < 0} { set match [lsearch -glob -all -inline $allOpts $arg*] |
︙ | ︙ | |||
3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 | set files "" set nextArg "" set revNo 1 set dopatch 0 set doreview 0 set foreach 0 set preferedRev "GIT" foreach arg $::eskil(argv) { if {$nextArg != ""} { if {$nextArg eq "mergeFile"} { set opts(mergeFile) [file join [pwd] $arg] } elseif {$nextArg eq "printFile"} { set opts(printFile) [file join [pwd] $arg] } elseif {$nextArg eq "revision"} { set opts(doptrev$revNo) $arg incr revNo } elseif {$nextArg eq "limitlines"} { set opts(limitlines) $arg } elseif {$nextArg eq "context"} { set Pref(context) $arg } elseif {$nextArg eq "prefix"} { set RE [string map [list % $arg] {^.*?\m(%\w+).*$}] if {$Pref(nocase)} { set RE "(?i)$RE" } lappend ::Pref(regsub) $RE {\1} } elseif {$nextArg eq "preprocess"} { if {[catch {llength $arg} len]} { } elseif {[llength $arg] % 2 == 1} { } else { # FIXA: better validity check | > > > > > > | 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 | set files "" set nextArg "" set revNo 1 set dopatch 0 set doreview 0 set foreach 0 set preferedRev "GIT" set plugin "" set plugininfo "" foreach arg $::eskil(argv) { if {$nextArg != ""} { if {$nextArg eq "mergeFile"} { set opts(mergeFile) [file join [pwd] $arg] } elseif {$nextArg eq "printFile"} { set opts(printFile) [file join [pwd] $arg] } elseif {$nextArg eq "revision"} { set opts(doptrev$revNo) $arg incr revNo } elseif {$nextArg eq "limitlines"} { set opts(limitlines) $arg } elseif {$nextArg eq "context"} { set Pref(context) $arg } elseif {$nextArg eq "prefix"} { set RE [string map [list % $arg] {^.*?\m(%\w+).*$}] if {$Pref(nocase)} { set RE "(?i)$RE" } lappend ::Pref(regsub) $RE {\1} } elseif {$nextArg eq "plugin"} { set plugin $arg } elseif {$nextArg eq "plugininfo"} { set plugininfo $arg } elseif {$nextArg eq "preprocess"} { if {[catch {llength $arg} len]} { } elseif {[llength $arg] % 2 == 1} { } else { # FIXA: better validity check |
︙ | ︙ | |||
3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 | set Pref(nodigit) 1 } elseif {$arg eq "-nokeyword"} { set Pref(dir,ignorekey) 1 } elseif {$arg eq "-prefix"} { set nextArg prefix } elseif {$arg eq "-preprocess"} { set nextArg preprocess } elseif {$arg eq "-context"} { set nextArg context } elseif {$arg eq "-noparse"} { set Pref(parse) 0 } elseif {$arg eq "-line"} { set Pref(parse) 1 } elseif {$arg eq "-smallblock"} { | > > > > | 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 | set Pref(nodigit) 1 } elseif {$arg eq "-nokeyword"} { set Pref(dir,ignorekey) 1 } elseif {$arg eq "-prefix"} { set nextArg prefix } elseif {$arg eq "-preprocess"} { set nextArg preprocess } elseif {$arg eq "-plugin"} { set nextArg plugin } elseif {$arg eq "-plugininfo"} { set nextArg plugininfo } elseif {$arg eq "-context"} { set nextArg context } elseif {$arg eq "-noparse"} { set Pref(parse) 0 } elseif {$arg eq "-line"} { set Pref(parse) 1 } elseif {$arg eq "-smallblock"} { |
︙ | ︙ | |||
3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 | } else { lappend files $apa } } } Init # Do we start in clip diff mode? if {$doclip} { makeClipDiffWin return } | > > > > > > > > > | 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 | } else { lappend files $apa } } } Init if {$plugin ne ""} { set pinterp [createPluginInterp $plugin $plugininfo] if {$pinterp eq ""} { puts "Bad plugin: $plugin" exit } set opts(plugin) $pinterp } # Do we start in clip diff mode? if {$doclip} { makeClipDiffWin return } |
︙ | ︙ |
Added src/plugin.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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | #---------------------------------------------------------------------- # Eskil, Plugin handling # # Copyright (c) 2008, Peter Spjuth (peter.spjuth@gmail.com) # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # #---------------------------------------------------------------------- # $Revision$ #---------------------------------------------------------------------- proc createPluginInterp {plugin info} { # Locate plugin source set src "" set dirs [list . ./plugins] lappend dirs [file join $::thisDir .. ..] lappend dirs [file join $::thisDir .. .. plugins] lappend dirs [file join $::thisDir .. plugins] foreach dir $dirs { set files [list [file join $dir $plugin]] lappend files [file join $dir $plugin.tcl] foreach file $files { if {![file exists $file]} continue if {![file readable $file]} continue set ch [open $file r] set data [read $ch 20] close $ch if {[string match "##Eskil Plugin*" $data]} { set src $file break } } if {$src ne ""} break } if {$src eq ""} { return "" } # Create interpreter set pi [interp create -safe] # Load source $pi invokehidden -global source $src $pi eval [list set ::WhoAmI [file rootname [file tail $src]]] $pi eval [list set ::Info $info] interp share {} stdout $pi # Expose needed commands interp expose $pi fconfigure ;# ?? interp hide $pi close return $pi } proc preparePlugin {top} { #FIXA: plugin miffo disallowEdit $top set out1 [tmpFile] set out2 [tmpFile] set chi [open $::diff($top,leftFile) r] set cho [open $out1 w] interp share {} $chi $::diff($top,plugin) interp share {} $cho $::diff($top,plugin) set usenew1 [$::diff($top,plugin) eval [list PreProcess left $chi $cho]] $::diff($top,plugin) invokehidden close $chi $::diff($top,plugin) invokehidden close $cho close $chi close $cho set chi [open $::diff($top,rightFile) r] set cho [open $out2 w] interp share {} $chi $::diff($top,plugin) interp share {} $cho $::diff($top,plugin) set usenew2 [$::diff($top,plugin) eval [list PreProcess right $chi $cho]] $::diff($top,plugin) invokehidden close $chi $::diff($top,plugin) invokehidden close $cho close $chi close $cho if {$usenew1} { set ::diff($top,leftFileB) $::diff($top,leftFile) set ::diff($top,leftFile) $out1 } else { set ::diff($top,leftFileD) $out1 #set ::diff($top,leftLabel) "$::diff($top,RevFile) $tag" } if {$usenew1} { set ::diff($top,rightFileB) $::diff($top,rightFile) set ::diff($top,rightFile) $out2 } else { set ::diff($top,rightFileD) $out2 #set ::diff($top,rightLabel) $::diff($top,RevFile) } } |