404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
|
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
|
-
+
+
-
+
-
-
-
-
+
+
+
-
-
-
-
-
-
-
+
+
+
-
-
|
puts [join [lsort -dictionary [pdf4tcl::getPaperSizeList]] \n]
exit
}
}
proc optValidatePlugin {opt arg} {
# We must start up completely to check a plugin
Init
set src [LocatePlugin $arg]
set res [LocatePlugin $arg]
set src [dict get $res src]
if {$src eq ""} {
puts "Bad plugin: $arg"
printPlugins
exit
}
# Look for declarations of command line options
set ch [open $src r]
foreach {name flag doc} [dict get $res opts] {
while {[gets $ch line] >= 0} {
# Only look until empty line
if {[string trim $line] eq ""} break
if {[regexp {^\#\# Option\s+(\S+)(.*)} $line -> name rest]} {
if {$flag} {
addFlags $name
} else {
addOpt $name
docFlag $name "Plugin $arg [string trim $rest]"
addSource $name $arg
}
if {[regexp {^\#\# Flag\s+(\S+)(.*)} $line -> name rest]} {
addFlags $name
docFlag $name "Plugin $arg [string trim $rest]"
addSource $name $arg
}
docFlag $name "Plugin $arg : $doc"
addSource $name $arg
}
}
close $ch
}
# Option database setup
proc initOpts {} {
set ::eskil(opts) {}
set ::eskil(opts,info) {}
set ::eskil(opts,src) ""
set ::eskil(defoptinfo) {
|