From bf0cc9887939cac3d9b488fdfd8180d5bef851ab Mon Sep 17 00:00:00 2001 From: William Joye Date: Fri, 18 Jan 2019 13:23:06 -0500 Subject: clean up internal_error --- ds9/macos/ds9.C | 11 +---------- ds9/unix/ds9.C | 9 +-------- ds9/win/ds9.C | 9 +-------- tksao/util/util.C | 10 +++++++++- tksao/util/util.h | 1 - 5 files changed, 12 insertions(+), 28 deletions(-) diff --git a/ds9/macos/ds9.C b/ds9/macos/ds9.C index 4552442..f5d21b8 100644 --- a/ds9/macos/ds9.C +++ b/ds9/macos/ds9.C @@ -48,16 +48,6 @@ extern "C" { int Tkmacosx_Init(Tcl_Interp*); } -Tcl_Interp *global_interp; - -void internalError(const char* msg) -{ - Tcl_SetVar2(global_interp, "ds9", "msg", msg, TCL_GLOBAL_ONLY); - Tcl_SetVar2(global_interp, "ds9", "msg,level", "error", TCL_GLOBAL_ONLY); -} - -extern char* dupstr(const char* str); - #define PATHSIZE 2048 int SAOLocalMainHook(int* argcPtr, char*** argvPtr) { @@ -90,6 +80,7 @@ int SAOLocalMainHook(int* argcPtr, char*** argvPtr) return TCL_OK; } +extern Tcl_Interp *global_interp; int SAOAppInit(Tcl_Interp *interp) { // save interp for cputs function diff --git a/ds9/unix/ds9.C b/ds9/unix/ds9.C index a6ada4a..ba01780 100644 --- a/ds9/unix/ds9.C +++ b/ds9/unix/ds9.C @@ -48,14 +48,6 @@ extern "C" { int Signal_ext_Init(Tcl_Interp*); } -Tcl_Interp *global_interp; - -void internalError(const char* msg) -{ - Tcl_SetVar2(global_interp, "ds9", "msg", msg, TCL_GLOBAL_ONLY); - Tcl_SetVar2(global_interp, "ds9", "msg,level", "error", TCL_GLOBAL_ONLY); -} - // currently use relative path // using full path with spaces causes problems // with htmwidget and tcl/tk @@ -80,6 +72,7 @@ int SAOLocalMainHook(int* argcPtr, char*** argvPtr) return TCL_OK; } +extern Tcl_Interp *global_interp; int SAOAppInit(Tcl_Interp *interp) { // save interp for cputs function diff --git a/ds9/win/ds9.C b/ds9/win/ds9.C index f66d1f7..e1a6b59 100644 --- a/ds9/win/ds9.C +++ b/ds9/win/ds9.C @@ -49,14 +49,6 @@ extern "C" { int Tkwin32_Init(Tcl_Interp*); } -Tcl_Interp *global_interp; - -void internalError(const char* msg) -{ - Tcl_SetVar2(global_interp, "ds9", "msg", msg, TCL_GLOBAL_ONLY); - Tcl_SetVar2(global_interp, "ds9", "msg,level", "error", TCL_GLOBAL_ONLY); -} - #define PATHSIZE 2048 int SAOLocalMainHook(int* argcPtr, char*** argvPtr) { @@ -106,6 +98,7 @@ int SAOLocalMainHook(int* argcPtr, char*** argvPtr) return TCL_OK; } +extern Tcl_Interp *global_interp; int SAOAppInit(Tcl_Interp *interp) { // save interp for cputs function diff --git a/tksao/util/util.C b/tksao/util/util.C index faade52..1e66305 100644 --- a/tksao/util/util.C +++ b/tksao/util/util.C @@ -2,7 +2,8 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include +#include +//#include #include "util.h" @@ -10,6 +11,7 @@ int maperr= 0; static char tobuf[1024]; +Tcl_Interp *global_interp; int sexSign; // used by parser and lex to indicate sign of dms or hms @@ -41,6 +43,12 @@ int lsb() return (*(short *)"\001\000" & 0x0001); } +void internalError(const char* msg) +{ + Tcl_SetVar2(global_interp, "ds9", "msg", msg, TCL_GLOBAL_ONLY); + Tcl_SetVar2(global_interp, "ds9", "msg,level", "error", TCL_GLOBAL_ONLY); +} + char* dupstr(const char* str) { char* copy; diff --git a/tksao/util/util.h b/tksao/util/util.h index 3609ae6..04321b8 100644 --- a/tksao/util/util.h +++ b/tksao/util/util.h @@ -77,7 +77,6 @@ extern void swap2(char* src, char* dest); extern void swap4(char* src, char* dest); extern void swap8(char* src, char* dest); -// defined in ds9.C extern void internalError(const char*); extern char* dupstr(const char*); -- cgit v0.12