1
2
3
4
5
6
7
8
9
10
11
12
13
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
-
+
|
#!/bin/sh
#---------------------------------------------------------- -*- tcl -*-
#
# Eskil, a Graphical frontend to diff
#
# Copyright (c) 1998-2008, Peter Spjuth (peter.spjuth@gmail.com)
# Copyright (c) 1998-2010, Peter Spjuth (peter.spjuth@gmail.com)
#
# Usage
# Do 'eskil' for interactive mode
# Do 'eskil --help' for command line usage
#
# 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
|
︙ | | |
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
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 1
set diffver "Version 2.4+ 2009-02-12"
set diffver "Version 2.4+ 2010-04-27"
set ::thisScript [file join [pwd] [info script]]
namespace import tcl::mathop::+
namespace import tcl::mathop::-
namespace import tcl::mathop::*
namespace import tcl::mathop::/
|
︙ | | |
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
|
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
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
3373
3374
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
-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 -`/'}
}
# Helper to validate command line option for color
proc ValidatePdfColor {arg opt} {
set fail 0
if {![string is list $arg] || [llength $arg] != 3} {
set fail 1
} else {
foreach val $arg {
if {![string is double -strict $val] || $val < 0.0 || $val > 1.0} {
set fail 1
}
}
}
if {$fail} {
puts "Argument $opt must be a list of RBG values from 0.0 to 1.0"
exit
}
}
# Go through all command line arguments
proc parseCommandLine {} {
global dirdiff Pref
set ::eskil(autoclose) 0
set ::eskil(ignorenewline) 0
if {$::eskil(argc) == 0} {
Init
makeDiffWin
return
}
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
-printHeaderSize -printCharsPerLine -printPaper
-printColorChange -printColorOld -printColorNew
-server -o -r -context -cvs -svn -review
-foreach -preprocess -close -nonewline -plugin -plugininfo
-plugindump
}
# If the first option is "--query", use it to ask about options.
if {$::eskil(argc) == 2 && [lindex $::eskil(argv) 0] == "--query"} {
|
︙ | | |
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
|
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
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 "printHeaderSize"} {
if {![string is double -strict $arg] || $arg <= 0} {
puts "Argument -printHeaderSize must be a positive number"
exit
}
set Pref(printHeaderSize) $arg
} elseif {$nextArg eq "printCharsPerLine"} {
if {![string is integer -strict $arg] || $arg <= 0} {
puts "Argument -printCharsPerLine must be a positive number"
exit
}
set Pref(printCharsPerLine) $arg
} elseif {$nextArg eq "printPaper"} {
package require pdf4tcl
if {[llength [pdf4tcl::getPaperSize $arg]] != 2} {
puts "Argument -printPaper must be a valid paper size"
puts "Valid paper sizes:"
puts [join [lsort -dictionary [pdf4tcl::getPaperSizeList]] \n]
exit
}
set Pref(printPaper) $arg
} elseif {$nextArg eq "printColorChange"} {
ValidatePdfColor $arg -printColorChange
set Pref(printColorChange) $arg
} elseif {$nextArg eq "printColorOld"} {
ValidatePdfColor $arg -printColorOld
set Pref(printColorNew1) $arg
} elseif {$nextArg eq "printColorNew"} {
ValidatePdfColor $arg -printColorNew
set Pref(printColorNew2) $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
|
︙ | | |
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
|
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
|
+
+
+
|
set ::eskil(ignorenewline) 2
} elseif {$arg eq "-close"} {
set ::eskil(autoclose) 1
} elseif {$arg eq "-conflict"} {
set opts(mode) "conflict"
} elseif {$arg eq "-print" || $arg eq "-printpdf"} {
set nextArg printFile
} elseif {$arg in {-printHeaderSize -printCharsPerLine -printPaper \
-printColorChange -printColorOld -printColorNew}} {
set nextArg [string range $arg 1 end]
} elseif {$arg eq "-server"} {
if {$::tcl_platform(platform) eq "windows"} {
catch {
package require dde
dde servername Eskil
}
} else {
|
︙ | | |