4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
|
}
#####################################
# Startup stuff
#####################################
proc printUsage {} {
puts {Usage: eskil [options] [file1] [file2]
[options] See below.
[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 version control of the file, and
if found, runs in version control mode.
Options:
-nodiff : Normally, if there are enough information on the
command line to run diff, Eskil will do so unless
this option is specified.
-dir : Start in directory diff mode. Ignores other args.
-clip : Start in clip diff mode. Ignores other args.
-patch : View patch file.
- : Read patch file from standard input, to allow pipes.
-review : View revision control tree as a patch.
-context <n>: Show only differences, with <n> lines of context.
-foreach : Open one diff window per file listed.
-close : Close windows with no changes.
-sep <c> : See char <c> as separator between columns in files.
-noparse : Eskil can perform analysis of changed blocks to
-line : improve display. See online help for details.
-smallblock : The default. Do block analysis on small blocks.
-block : Full block analysis. This can be slow if there
are large change blocks.
-char : The analysis of changes can be done on either
-word : character or word basis. -char is the default.
-noignore : Don't ignore any whitespace.
-b : Ignore space changes. Default.
-w : Ignore all spaces.
-nocase : Ignore case changes.
-nodigit : Ignore digit changes.
-nokeyword : In directory diff, ignore $ Keywords: $
-nonewline : Try to ignore newline changes.
-nonewline+ : Try to ignore newline changes, and don't display.
-prefix <str> : Care mainly about words starting with "str".
-preprocess <pair> : TBW
-preprocessleft <pair> : TBW
-preprocessright <pair> : TBW
-r <ver> : Version info for version control mode.
-cvs : Detect CVS first, if multiple version systems are used.
-svn : Detect SVN first, if multiple version systems are used.
-a <file> : Give ancestor file for three way merge.
-conflict : Treat file as a merge conflict file and enter merge
mode.
-o <file> : Specify merge result output file.
-fine : Use fine grained chunks. Useful for merging.
-browse : Automatically bring up file dialog after starting.
-server : Set up Eskil to be controllable from the outside.
-print <file> : Generate PDF and exit.
-printCharsPerLine <n> : Adapt font size for this line length and wrap. (80)
-printPaper <paper> : Select paper size (a4)
-printHeaderSize <n> : Font size for page header (10)
-printFont <fontfile> : Select font to use in PDF, afm or ttf. If <fontfile>
is given as "Courier", PDF built in font is used.
-printColorChange <RGB> : Color for change (1.0 0.7 0.7)
-printColorOld <RGB> : Color for old text (0.7 1.0 0.7)
-printColorNew <RGB> : Color for new text (0.8 0.8 1.0)
-plugin <name> : Preprocess files using plugin.
-plugininfo <info> : Pass info to plugin (plugin specific)
-pluginlist : List known plugins
-plugindump <plugin> : Dump plugin source to stdout
-pluginallow : Allow full access privilege for a plugin.
-limit <lines> : Do not process more than <lines> lines.
To list all options matching a prefix, run 'eskil --query prefix'.
In tcsh use this line to get option completion:
complete eskil 'C/-/`eskil --query -`/'}
}
#####################################
# Option/flag handling helpers
#####################################
# Validators
proc optValidatePdfColor {opt arg} {
|
|
|
|
>
|
<
<
|
<
|
<
>
<
<
|
<
<
<
<
<
<
<
<
<
|
|
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
>
|
|
|
>
|
|
<
|
|
|
|
|
<
|
<
|
>
|
<
|
>
|
|
|
|
|
|
|
|
|
|
|
|
<
>
|
|
|
<
|
<
<
<
|
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
|
}
#####################################
# Startup stuff
#####################################
proc printUsage {} {
puts {Usage: eskil [options] [files...]
[options] See below.
[files...] 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 version
control of the file, and if found, runs in version control mode.
If directories are given, Eskil starts in directory diff.
To list all options matching a prefix, run 'eskil --query prefix'.
In tcsh use this line to get option completion:
complete eskil 'C/-/`eskil --query -`/'
Options:}
# Dump option info
foreach name [lsort -dictionary [dict keys $::eskil(opts,info)]] {
set outName $name
if {![dict exists $::eskil(opts,info) $name flag]} {
puts "Internal Error: BOHOHOHO $name"
break
}
if {![dict get $::eskil(opts,info) $name flag]} {
append outName " <v>"
}
# Line up shorter ones
if {[string length $outName] < 10} {
set outName [format %-10s $outName]
}
set outName "$outName : "
set indent [string length $outName]
set len [expr {80 - $indent}]
set d [dict get $::eskil(opts,info) $name shortdescr]
if {$d eq "_"} continue
while {$d ne ""} {
if {[string length $d] <= $len} {
set chunk $d
set d ""
} else {
set ci $len
while {[string index $d $ci] ne " " && $ci > 40} {
incr ci -1
}
set chunk [string range $d 0 $ci-1]
set d [string trim [string range $d $ci end]]
}
puts "$outName$chunk"
set outName [format %*s $indent ""]
}
}
}
#####################################
# Option/flag handling helpers
#####################################
# Validators
proc optValidatePdfColor {opt arg} {
|
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
|
flag 0
given 0
multi 0
type ""
validator ""
filter ""
sideeffect ""
}
}
# Add a command line flag that do not take a value
proc addFlags {args} {
foreach name $args {
dict set ::eskil(opts) $name 0
dict set ::eskil(opts,info) $name $::eskil(defoptinfo)
dict set ::eskil(opts,info) $name flag 1
}
}
# Flag that affects Pref
proc addPrefFlag {name elem {value 1}} {
dict set ::eskil(opts) $name 0
dict set ::eskil(opts,info) $name $::eskil(defoptinfo)
dict set ::eskil(opts,info) $name flag 1
dict set ::eskil(opts,info) $name type Pref
dict set ::eskil(opts,info) $name "elem" $elem
|
>
>
>
>
>
>
>
>
|
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
|
flag 0
given 0
multi 0
type ""
validator ""
filter ""
sideeffect ""
shortdescr ""
longdescr ""
}
}
# Add a command line flag that do not take a value
proc addFlags {args} {
foreach name $args {
dict set ::eskil(opts) $name 0
dict set ::eskil(opts,info) $name $::eskil(defoptinfo)
dict set ::eskil(opts,info) $name flag 1
}
}
# Document a flag
proc docFlag {name short {long {}}} {
dict set ::eskil(opts,info) $name shortdescr $short
dict set ::eskil(opts,info) $name longdescr $long
}
# Flag that affects Pref
proc addPrefFlag {name elem {value 1}} {
dict set ::eskil(opts) $name 0
dict set ::eskil(opts,info) $name $::eskil(defoptinfo)
dict set ::eskil(opts,info) $name flag 1
dict set ::eskil(opts,info) $name type Pref
dict set ::eskil(opts,info) $name "elem" $elem
|
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
|
Init
return [makeDiffWin]
}
# Set up all options info
initOpts
addFlags --help -help
addPrefFlag -w ignore -w
addPrefFlag -b ignore -b
addPrefFlag -noignore ignore " "
addPrefFlag -noparse parse 0
addPrefFlag -line parse 1
addPrefFlag -smallblock parse 2
addPrefFlag -block parse 3
addPrefFlag -char lineparsewords 0
addPrefFlag -word lineparsewords 1
addPrefFlag -i nocase
addPrefFlag -nocase nocase
addPrefFlag -nodigit nodigit
addPrefFlag -nokeyword dir,ignorekey
addPrefFlag -noempty noempty
addPrefFlag -fine finegrainchunks
addOptsFlag -table view table
addOptsFlag -conflict mode conflict
# Conflict implies foreach
addSideEffect -conflicit {
optSet -foreach 1
}
addFlags -dir -clip -patch -review
addFlags -browse -nodiff
addFlags -server -cvs -svn -debug
addFlags -foreach -close
addFlags -nonewline -nonewline+ -nocdiff
addFlags -pluginlist -pluginallow
# Options that take values
addOpt -plugin
addValidator -plugin optValidatePlugin
addOpt -plugininfo
addOpt -plugindump
# These options affect Pref
addPrefOpt -pivot pivot optValidatePositive
addPrefOpt -context context optValidateNatural
addPrefOpt -printHeaderSize printHeaderSize optValidatePositive
addPrefOpt -printCharsPerLine printCharsPerLine optValidatePositive
addPrefOpt -printPaper printPaper optValidatePaper
addPrefOpt -printColorChange printColorChange optValidatePdfColor
addPrefOpt -printColorOld printColorOld optValidatePdfColor
addPrefOpt -printColorNew printColorNew optValidatePdfColor
addPrefOpt -printFont printFont
addMultOpt -prefix
addMultOpt -preprocess
addMultOpt -preprocessleft
addMultOpt -preprocessright
# These affect opts
addOptsOpt -limit limitlines
addOptsOpt -maxwidth maxwidth
addOptsOpt -o mergeFile
addFilter -o [list file join [pwd]]
addOptsOpt -a ancestorFile
addFilter -a [list file join [pwd]]
# Default is no ignore on three-way merge
addSideEffect -a { set ::Pref(ignore) " " }
addOptsOpt -sep separator
# Handle if separator is given e.g. as '\t'
addFilter -sep [list subst -nocommands -novariables]
addOptsOpt -print printFile
addOptsOpt -printpdf printFile ;# Old option
addSideEffect -print { set opts(printFileCmd) 1 }
addSideEffect -printpdf { set opts(printFileCmd) 1 }
addMultOpt -r
# 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]
set allOpts [allOpts]
if {[lsearch -exact $allOpts $arg] < 0} {
set match [lsearch -glob -all -inline $allOpts $arg*]
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
|
Init
return [makeDiffWin]
}
# Set up all options info
initOpts
addFlags --help -help
addPrefFlag -w ignore -w
addPrefFlag -b ignore -b
addPrefFlag -noignore ignore " "
docFlag -w "Ignore all spaces"
docFlag -b "Ignore space changes (default)"
docFlag -noignore "Don't ignore any whitespace"
addPrefFlag -noparse parse 0
addPrefFlag -line parse 1
addPrefFlag -smallblock parse 2
addPrefFlag -block parse 3
docFlag -noparse "No block analysis"
docFlag -line "Line based block analysis"
docFlag -smallblock "Do block analysis on small blocks (default)"
docFlag -block "Full block analysis. This can be slow if there are large change blocks"
addPrefFlag -char lineparsewords 0
addPrefFlag -word lineparsewords 1
docFlag -char "Character based change view (default)"
docFlag -word "Word based change view"
addPrefFlag -i nocase
addPrefFlag -nocase nocase
docFlag -i "Ignore case changes"
docFlag -nocase "Ignore case changes"
addPrefFlag -nodigit nodigit
docFlag -nodigit "Ignore digit changes"
addPrefFlag -nokeyword dir,ignorekey
docFlag -nokeyword "In directory diff, ignore \$ Keywords: \$"
addPrefFlag -noempty noempty
docFlag -noempty "Ignore empty lines initially for matching"
addPrefFlag -fine finegrainchunks
docFlag -fine "Use fine grained chunks. Useful for merging"
addOptsFlag -table view table
docFlag -table "Run in table mode"
addOptsFlag -conflict mode conflict
docFlag -conflict "Treat file as a merge conflict file and enter merge mode"
# Conflict implies foreach
addSideEffect -conflict {
optSet -foreach 1
}
addFlags -dir -clip -patch -review -
docFlag -dir "Start in directory diff mode. Ignores other args"
docFlag -clip "Start in clip diff mode. Ignores other args"
docFlag -patch "View patch file"
docFlag - "Read patch file from standard input, to allow pipes"
docFlag -review "View revision control tree as a patch."
addFlags -browse -nodiff
docFlag -browse "Automatically bring up file dialog after starting"
docFlag -nodiff "Do not run diff after startup"
addFlags -server -cvs -svn -debug
docFlag -server "Set up Eskil to be controllable from the outside"
docFlag -cvs "Detect CVS first, if multiple version systems are used"
docFlag -svn "Detect SVN first, if multiple version systems are used"
docFlag -debug "Start in debug mode"
addFlags -foreach -close
docFlag -foreach "Open one diff window per file listed"
docFlag -close "Close windows with no changes"
addFlags -nonewline -nonewline+ -nocdiff
docFlag -nonewline "Try to ignore newline changes"
docFlag -nonewline+ "Try to ignore newline changes, and don't display"
docFlag -nocdiff "Disable C version of DiffUtil. For debug"
addFlags -pluginlist -pluginallow
docFlag -pluginlist "List known plugins"
docFlag -pluginallow "Allow full access privilege for a plugin"
# Options that take values
addOpt -plugin
docFlag -plugin "Preprocess files using plugin"
addValidator -plugin optValidatePlugin
addOpt -plugininfo
docFlag -plugininfo "Pass info to plugin (plugin specific)"
addOpt -plugindump
docFlag -plugindump "Dump plugin source to stdout"
# These options affect Pref
addPrefOpt -pivot pivot optValidatePositive
docFlag -pivot "Pivot setting for diff algorithm (100)"
addPrefOpt -context context optValidateNatural
docFlag -context "Show only differences, with <n> lines of context"
addPrefOpt -printHeaderSize printHeaderSize optValidatePositive
addPrefOpt -printCharsPerLine printCharsPerLine optValidatePositive
addPrefOpt -printPaper printPaper optValidatePaper
addPrefOpt -printColorChange printColorChange optValidatePdfColor
addPrefOpt -printColorOld printColorOld optValidatePdfColor
addPrefOpt -printColorNew printColorNew optValidatePdfColor
addPrefOpt -printFont printFont
docFlag -printHeaderSize "Font size for page header (10)"
docFlag -printCharsPerLine "Adapt font size for this line length and wrap (80)"
docFlag -printPaper "Select paper size (a4)"
docFlag -printColorChange "Color for change (1.0 0.7 0.7)"
docFlag -printColorOld "Color for old text (0.7 1.0 0.7)"
docFlag -printColorNew "Color for new text (0.8 0.8 1.0)"
docFlag -printFont "Select font to use in PDF, afm or ttf. If <fontfile> is given as \"Courier\", PDF built in font is used"
addMultOpt -prefix
docFlag -prefix "Care mainly about words starting with \"str\""
addMultOpt -preprocess
addMultOpt -preprocessleft
addMultOpt -preprocessright
docFlag -preprocess "TBW <pair>"
docFlag -preprocessleft "TBW <pair>"
docFlag -preprocessright "TBW <pair>"
# These affect opts
addOptsOpt -limit limitlines
docFlag -limit "Do not process more than <lines> lines"
addOptsOpt -maxwidth maxwidth
docFlag -maxwidth "Limit column width in table mode"
addOptsOpt -o mergeFile
docFlag -o "Specify merge result output file"
addFilter -o [list file join [pwd]]
addOptsOpt -a ancestorFile
docFlag -a "Give ancestor file for three way merge"
addFilter -a [list file join [pwd]]
# Default is no ignore on three-way merge
addSideEffect -a { set ::Pref(ignore) " " }
addOptsOpt -sep separator
docFlag -sep "See char <c> as separator between columns in files"
# Handle if separator is given e.g. as '\t'
addFilter -sep [list subst -nocommands -novariables]
addOptsOpt -print printFile
docFlag -print "Generate PDF and exit."
addOptsOpt -printpdf printFile ;# Old option
docFlag -printpdf "_"
addSideEffect -print { set opts(printFileCmd) 1 }
addSideEffect -printpdf { set opts(printFileCmd) 1 }
addMultOpt -r
docFlag -r "Version info for version control mode"
# 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]
set allOpts [allOpts]
if {[lsearch -exact $allOpts $arg] < 0} {
set match [lsearch -glob -all -inline $allOpts $arg*]
|