From a89231ca666294b1855b4469fcd8907ccb5c846f Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 27 Jul 2017 16:40:48 -0400 Subject: backout parser changes --- ds9/library/command.tcl | 201 ++++++++++++++++++++---------------------------- ds9/library/source.tcl | 2 - ds9/make.include | 10 +-- 3 files changed, 83 insertions(+), 130 deletions(-) diff --git a/ds9/library/command.tcl b/ds9/library/command.tcl index 1ea681d..89f8cf7 100644 --- a/ds9/library/command.tcl +++ b/ds9/library/command.tcl @@ -23,8 +23,16 @@ proc ProcessCommandLineFirst {} { set item [lindex $argv $i] switch -- $item { + -help { + puts "For more information, use --help" + QuitDS9 + } -debug {incr i; ProcessDebugTclCmd argv i} + -private { + # backward compatibility + } -title { + incr i set ds9(title) [lindex $argv $i] set t "SAOImage[string toupper $ds9(title)]" wm title $ds9(top) "$t" @@ -57,20 +65,6 @@ proc ds9Cmd {argv} { } proc ProcessCommand {argv argc} { - if {0} { - - YY_FLUSH_BUFFER - yy_scan_string $argv - yyparse - - global file - if {$file(load) != 0} { - FinishLoadPost - } - return - - } else { - global ds9 global pds9 global help @@ -92,8 +86,8 @@ proc ProcessCommand {argv argc} { set file(mode) {} set file(layer) {} set file(mosaic) wcs - set file(load) 0 + set load 0 set noopts 0 set i 0 @@ -466,24 +460,24 @@ proc ProcessCommand {argv argc} { return } - if {$file(load) == 0} { + if {$load == 0} { StartLoad - incr file(load) + incr load } switch $ds9(wm) { x11 - - aqua {CommandLineLoad $item} + aqua {CommandLineLoad $item argv i} win32 { # if win32 and envoked via DOS shell # we must expand wildcards ourselves if {[catch {glob $item} fns]} { # cygwin/double click/DOS Shell no wildcards - CommandLineLoad $item + CommandLineLoad $item argv i } else { # DOS Shell with wildcards foreach fn $fns { - CommandLineLoad $fn + CommandLineLoad $fn argv i } } } @@ -495,60 +489,35 @@ proc ProcessCommand {argv argc} { incr i } - if {$file(load) != 0} { + if {$load != 0} { FinishLoadPost } } -} -proc CommandLineFileName {item} { - global ds9 - global file - - if {$file(load) == 0} { - StartLoad - incr file(load) - } - - switch $ds9(wm) { - x11 - - aqua {CommandLineLoad $item} - win32 { - # if win32 and envoked via DOS shell - # we must expand wildcards ourselves - if {[catch {glob $item} fns]} { - # cygwin/double click/DOS Shell no wildcards - CommandLineLoad $item - } else { - # DOS Shell with wildcards - foreach fn $fns { - CommandLineLoad $fn - } - } - } - } - - FinishLoadPre -} +proc CommandLineLoad {item argvname iname} { + upvar $argvname argv + upvar $iname i -proc CommandLineLoad {item} { global file global current if {$current(frame) != {}} { switch -- [$current(frame) get type] { - base {CommandLineLoadBase $item} - rgb {CommandLineLoadRGB $item} - 3d {CommandLineLoad3D $item} + base {CommandLineLoadBase $item $argvname $iname} + rgb {CommandLineLoadRGB $item $argvname $iname} + 3d {CommandLineLoad3D $item $argvname $iname} } } else { - CommandLineLoadBase $item + CommandLineLoadBase $item $argvname $iname } SetFileLast $file(type) $item } -proc CommandLineLoadBase {item} { +proc CommandLineLoadBase {item argvname iname} { + upvar 2 $argvname argv + upvar 2 $iname i + global file global ds9 @@ -600,25 +569,22 @@ proc CommandLineLoadBase {item} { sfits { #backward compatibility - #handle directly - #incr i - #MultiLoad $file(layer) $file(mode) - #LoadSFitsFile $item [lindex $argv $i] $file(layer) $file(mode) + incr i + MultiLoad $file(layer) $file(mode) + LoadSFitsFile $item [lindex $argv $i] $file(layer) $file(mode) } srgbcube { #backward compatibility - #handle directly - #CreateRGBFrame - #incr i - #LoadSRGBCubeFile $item [lindex $argv $i] + CreateRGBFrame + incr i + LoadSRGBCubeFile $item [lindex $argv $i] } smosaic { #backward compatibility - #handle directly - #incr i - #switch -- $file(mosaic) { - #iraf {LoadSMosaicIRAFFile $item [lindex $argv $i] $file(layer)} - #default {LoadSMosaicWCSFile $item [lindex $argv $i] $file(layer) $file(mosaic)} + incr i + switch -- $file(mosaic) { + iraf {LoadSMosaicIRAFFile $item [lindex $argv $i] $file(layer)} + default {LoadSMosaicWCSFile $item [lindex $argv $i] $file(layer) $file(mosaic)} } } @@ -636,16 +602,14 @@ proc CommandLineLoadBase {item} { } envi { MultiLoad - ImportENVIFile $item [FindENVIDataFile $item] - #handle directly - #set fn $item - #set fn2 [lindex $argv [expr $i+1]] - #if {$fn2 == {} || [string range $fn2 0 0] == {-}} { - #set fn2 [FindENVIDataFile $fn] - #} else { - #incr i - #} - #ImportENVIFile $fn $fn2 + set fn $item + set fn2 [lindex $argv [expr $i+1]] + if {$fn2 == {} || [string range $fn2 0 0] == {-}} { + set fn2 [FindENVIDataFile $fn] + } else { + incr i + } + ImportENVIFile $fn $fn2 } gif - tiff - @@ -657,7 +621,10 @@ proc CommandLineLoadBase {item} { } } -proc CommandLineLoadRGB {item} { +proc CommandLineLoadRGB {item argvname iname} { + upvar 2 $argvname argv + upvar 2 $iname i + global file switch -- $file(type) { @@ -694,25 +661,22 @@ proc CommandLineLoadRGB {item} { sfits { #backward compatibility - #handle directly - #incr i - #LoadSFitsFile $item [lindex $argv $i] {} $file(mode) + incr i + LoadSFitsFile $item [lindex $argv $i] {} $file(mode) } srgbcube { #backward compatibility - #handle directly - #MultiLoadRGB - #incr i - #LoadSRGBCubeFile $item [lindex $argv $i] + MultiLoadRGB + incr i + LoadSRGBCubeFile $item [lindex $argv $i] } smosaic { #backward compatibility - #handle directly - #incr i - #switch -- $file(mosaic) { - #iraf {LoadMosaicIRAFSFitsFile $item [lindex $argv $i] {}} - #default {LoadMosaicWCSSFitsFile $item [lindex $argv $i] {} $file(mosaic)} - #} + incr i + switch -- $file(mosaic) { + iraf {LoadMosaicIRAFSFitsFile $item [lindex $argv $i] {}} + default {LoadMosaicWCSSFitsFile $item [lindex $argv $i] {} $file(mosaic)} + } } array {ImportArrayFile $item {}} @@ -729,10 +693,14 @@ proc CommandLineLoadRGB {item} { MultiLoadRGB ImportPhotoFile $item $file(mode) } + } } -proc CommandLineLoad3D {item} { +proc CommandLineLoad3D {item argvname iname} { + upvar 2 $argvname argv + upvar 2 $iname i + global file switch -- $file(type) { @@ -780,26 +748,23 @@ proc CommandLineLoad3D {item} { sfits { #backward compatibility - #handle directly - #incr i - #MultiLoad {} $file(mode) - #LoadSFitsFile $item [lindex $argv $i] {} $file(mode) + incr i + MultiLoad {} $file(mode) + LoadSFitsFile $item [lindex $argv $i] {} $file(mode) } srgbcube { #backward compatibility - #handle directly - #CreateRGBFrame - #incr i - #LoadSRGBCubeFile $item [lindex $argv $i] + CreateRGBFrame + incr i + LoadSRGBCubeFile $item [lindex $argv $i] } smosaic { #backward compatibility - #handle directly - #incr i - #switch -- $file(mosaic) { - #iraf {LoadMosaicIRAFSFitsFile $item [lindex $argv $i] {}} - #default {LoadMosaicWCSSFitsFile $item [lindex $argv $i] {} $file(mosaic)} - #} + incr i + switch -- $file(mosaic) { + iraf {LoadMosaicIRAFSFitsFile $item [lindex $argv $i] {}} + default {LoadMosaicWCSSFitsFile $item [lindex $argv $i] {} $file(mosaic)} + } } array { @@ -815,16 +780,14 @@ proc CommandLineLoad3D {item} { ImportNRRDFile $item {} } envi { - ImportENVIFile $fn [FindENVIDataFile $fn] - #handle directly - #set fn $item - #set fn2 [lindex $argv [expr $i+1]] - #if {$fn2 == {} || [string range $fn2 0 0] == {-}} { - #set fn2 [FindENVIDataFile $fn] - #} else { - #incr i - #} - #ImportENVIFile $fn $fn2 + set fn $item + set fn2 [lindex $argv [expr $i+1]] + if {$fn2 == {} || [string range $fn2 0 0] == {-}} { + set fn2 [FindENVIDataFile $fn] + } else { + incr i + } + ImportENVIFile $fn $fn2 } gif - tiff - diff --git a/ds9/library/source.tcl b/ds9/library/source.tcl index cf78a6b..b8aa00a 100644 --- a/ds9/library/source.tcl +++ b/ds9/library/source.tcl @@ -187,8 +187,6 @@ source $ds9(root)/library/wcs.tcl source $ds9(root)/library/xmfbox.tcl source $ds9(root)/library/xmlrpc.tcl source $ds9(root)/library/xpa.tcl -source $ds9(root)/library/lex.tcl -source $ds9(root)/library/parser.tcl switch [tk windowingsystem] { x11 {} diff --git a/ds9/make.include b/ds9/make.include index 0797797..c49aa53 100644 --- a/ds9/make.include +++ b/ds9/make.include @@ -1,14 +1,6 @@ -#--------------------------parser - -%.tcl: %.fcl - tclsh $(prefix)/fickle/fickle.tcl $< - -%.tcl: %.tac - tclsh $(prefix)/taccle/taccle.tcl -d -v -w $< - #--------------------------framework -$(LIBDIR)/library : $(prefix)/ds9/library/parser.tcl $(prefix)/ds9/library/lex.tcl $(prefix)/ds9/library/*.tcl +$(LIBDIR)/library : $(prefix)/ds9/library/*.tcl mkdir -p "$@" cp -p $? "$@" # must do it this way for win -- cgit v0.12