From 6c48a0325ac2743355ca31e65f0f4fb20afcf5ee Mon Sep 17 00:00:00 2001 From: William Joye Date: Wed, 30 May 2018 12:14:52 -0400 Subject: update ds9 parsers --- ds9/library/cat.tcl | 7 +++---- ds9/library/hv.tcl | 13 ++++++------- ds9/library/plotprocess.tcl | 15 ++++++--------- ds9/library/sia.tcl | 7 +++---- ds9/parsers/catparser.tac | 2 +- ds9/parsers/plotparser.tac | 4 ++-- ds9/parsers/siaparser.tac | 2 +- ds9/parsers/webparser.tac | 4 ++-- 8 files changed, 24 insertions(+), 30 deletions(-) diff --git a/ds9/library/cat.tcl b/ds9/library/cat.tcl index 0d30632..81da9ad 100644 --- a/ds9/library/cat.tcl +++ b/ds9/library/cat.tcl @@ -1260,14 +1260,13 @@ proc CatalogCmdCheck {} { if {![info exists cvar(top)]} { Error "[msgcat::mc {Unable to find catalog window}] $cvarname" - cat::YYABORT - return + return 0 } if {![winfo exists $cvar(top)]} { Error "[msgcat:: mc {Unable to find catalog window}] $cvarname" - cat::YYABORT - return + return 0 } + return 1 } proc CatalogCmdRef {ref} { diff --git a/ds9/library/hv.tcl b/ds9/library/hv.tcl index a7defb7..c167a5d 100644 --- a/ds9/library/hv.tcl +++ b/ds9/library/hv.tcl @@ -841,14 +841,13 @@ proc WebCmdCheck {} { if {![info exists cvar(top)]} { Error "[msgcat::mc {Unable to find web window}] $cvarname" - cat::YYABORT - return + return 0 } if {![winfo exists $cvar(top)]} { Error "[msgcat:: mc {Unable to find web window}] $cvarname" - cat::YYABORT - return + return 0 } + return 1 } proc WebCmdRef {ref} { @@ -858,11 +857,11 @@ proc WebCmdRef {ref} { # look for reference in current list if {[lsearch $ihv(windows) $ref] < 0} { Error "[msgcat::mc {Unable to find web window}] $ref" - plot::YYABORT - return + return 0 } + set cvarname $ref - WebCmdCheck + return [WebCmdCheck] } proc WebCmdNew {url {ww {hvweb}}} { diff --git a/ds9/library/plotprocess.tcl b/ds9/library/plotprocess.tcl index 410520a..42d9c4d 100644 --- a/ds9/library/plotprocess.tcl +++ b/ds9/library/plotprocess.tcl @@ -124,14 +124,13 @@ proc PlotCmdCheck {} { if {![info exists cvar(top)]} { Error "[msgcat::mc {Unable to find plot window}] $cvarname" - plot::YYABORT - return + return 0 } if {![winfo exists $cvar(top)]} { Error "[msgcat::mc {Unable to find plot window}] $cvarname" - plot::YYABORT - return + return 0 } + return 1 } proc PlotCmdRef {ref} { @@ -141,11 +140,11 @@ proc PlotCmdRef {ref} { # look for reference in current list if {[lsearch $iap(windows) $ref] < 0} { Error "[msgcat::mc {Unable to find plot window}] $ref" - plot::YYABORT - return + return 0 } + set cvarname $ref - PlotCmdCheck + return [PlotCmdCheck] } proc PlotCmdNew {name} { @@ -203,8 +202,6 @@ proc PlotCmdData {dim} { } if {$parse(buf) == {}} { Error "[msgcat::mc {Unable to load plot data}] $fn" - plot::YYABORT - return } } diff --git a/ds9/library/sia.tcl b/ds9/library/sia.tcl index 0b577ad..5f0c8de 100644 --- a/ds9/library/sia.tcl +++ b/ds9/library/sia.tcl @@ -472,14 +472,13 @@ proc SIACmdCheck {} { if {![info exists cvar(top)]} { Error "[msgcat::mc {Unable to find SIAP window}] $cvarname" - cat::YYABORT - return + return 0 } if {![winfo exists $cvar(top)]} { Error "[msgcat:: mc {Unable to find SIAP window}] $cvarname" - cat::YYABORT - return + return 0 } + return 1 } proc SIACmdRef {ref} { diff --git a/ds9/parsers/catparser.tac b/ds9/parsers/catparser.tac index 13a618e..f3328c4 100644 --- a/ds9/parsers/catparser.tac +++ b/ds9/parsers/catparser.tac @@ -115,7 +115,7 @@ catalog : NEW_ {CATTool} | LOAD_ STRING_ {CatalogCmdLoad $2 VOTRead} | IMPORT_ reader STRING_ {CatalogCmdLoad $3 $2} - | {CatalogCmdCheck} catCmd + | {if {![CatalogCmdCheck]} {cat::YYABORT}} catCmd | STRING_ {CatalogCmdRef $1} | STRING_ {CatalogCmdRef $1} catCmd # backward compatibility diff --git a/ds9/parsers/plotparser.tac b/ds9/parsers/plotparser.tac index d48497b..d601f72 100644 --- a/ds9/parsers/plotparser.tac +++ b/ds9/parsers/plotparser.tac @@ -154,8 +154,8 @@ command : plot | NEW_ {PlotCmdNew {}} new | NEW_ NAME_ STRING_ {PlotCmdNew $3} new - | {PlotCmdCheck} plotCmd - | STRING_ {PlotCmdRef $1} plotCmd + | {if {![PlotCmdCheck]} {plot::YYABORT}} plotCmd + | STRING_ {if {![PlotCmdRef $1]} {plot::YYABORT}} plotCmd ; line : {PlotCmdNew {}; PlotCmdLine {} {} {} xy} diff --git a/ds9/parsers/siaparser.tac b/ds9/parsers/siaparser.tac index 5bdb989..4f117a4 100644 --- a/ds9/parsers/siaparser.tac +++ b/ds9/parsers/siaparser.tac @@ -49,7 +49,7 @@ command : sia | sia {yyclearin; YYACCEPT} STRING_ ; -sia : {SIACmdCheck} siaCmd +sia : {if {![SIACmdCheck]} {sia::YYABORT}} siaCmd | site {SIACmdRef $1} | site {SIACmdRef $1} siaCmd ; diff --git a/ds9/parsers/webparser.tac b/ds9/parsers/webparser.tac index 2be631f..8939480 100644 --- a/ds9/parsers/webparser.tac +++ b/ds9/parsers/webparser.tac @@ -27,8 +27,8 @@ web : {WebCmdNew {}} | STRING_ {WebCmdNew $1} | NEW_ STRING_ STRING_ {WebCmdNew $3 $2} - | {WebCmdCheck} webCmd - | STRING_ {WebCmdRef $1} webCmd + | {if {![WebCmdCheck]} {web::YYABORT}} webCmd + | STRING_ {if {![WebCmdRef $1]} {web::YYABORT}} webCmd ; webCmd : CLICK_ click -- cgit v0.12