diff options
author | William Joye <wjoye@cfa.harvard.edu> | 2020-03-23 20:58:53 (GMT) |
---|---|---|
committer | William Joye <wjoye@cfa.harvard.edu> | 2020-03-23 20:58:53 (GMT) |
commit | a89bcfda29cc45526eb3d6ab0a04c11bba317455 (patch) | |
tree | 837bf6ea9076d3ac979963d24b77850a93881927 | |
parent | ac0febb27e3309affa0cd34918bc76ff95cf6760 (diff) | |
download | blt-a89bcfda29cc45526eb3d6ab0a04c11bba317455.zip blt-a89bcfda29cc45526eb3d6ab0a04c11bba317455.tar.gz blt-a89bcfda29cc45526eb3d6ab0a04c11bba317455.tar.bz2 |
libfitsy
-rwxr-xr-x | fitsy/configure | 1 | ||||
-rw-r--r-- | fitsy/file.C | 6 | ||||
-rw-r--r-- | fitsy/file.h | 1 | ||||
-rw-r--r-- | fitsy/hist.C | 1 | ||||
-rw-r--r-- | fitsy/hpx.C | 13 | ||||
-rw-r--r-- | fitsy/outfits.C | 2 | ||||
-rw-r--r-- | tksao/util/util.C | 100 | ||||
-rw-r--r-- | util/util.C | 25 | ||||
-rw-r--r-- | util/util.h | 17 |
9 files changed, 23 insertions, 143 deletions
diff --git a/fitsy/configure b/fitsy/configure index 7e83f5e..2346a61 100755 --- a/fitsy/configure +++ b/fitsy/configure @@ -5164,7 +5164,6 @@ fi sshare.C strm.C var.C - util.C " for i in $vars; do case $i in diff --git a/fitsy/file.C b/fitsy/file.C index 3de8dd6..12562a3 100644 --- a/fitsy/file.C +++ b/fitsy/file.C @@ -82,6 +82,12 @@ void envierror(FitsFile* envi, enviFlexLexer* ll, const char* m) envi->error(cmd); } +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); +} + FitsFile::FitsFile() { primary_ = NULL; diff --git a/fitsy/file.h b/fitsy/file.h index a8cfc46..09d1c8b 100644 --- a/fitsy/file.h +++ b/fitsy/file.h @@ -13,6 +13,7 @@ extern int DebugGZ; extern int DebugCompress; +extern void internalError(const char*); class OutFitsStream; diff --git a/fitsy/hist.C b/fitsy/hist.C index afd71aa..05565ed 100644 --- a/fitsy/hist.C +++ b/fitsy/hist.C @@ -13,7 +13,6 @@ using namespace std; #include "hist.h" #include "util.h" -#include "fitsy.h" #include "filter.h" #ifdef __CYGWIN__ diff --git a/fitsy/hpx.C b/fitsy/hpx.C index e2e0774..8fb3a6b 100644 --- a/fitsy/hpx.C +++ b/fitsy/hpx.C @@ -7,17 +7,10 @@ // WCSLIB 4.7 - an implementation of the FITS WCS standard. // Copyright (C) 1995-2011, Mark Calabretta -#include <string.h> #include <ctype.h> -#include <iostream> -#include <sstream> -#include <iomanip> -using namespace std; - #include "hpx.h" #include "util.h" -#include "fitsy.h" FitsHPX::FitsHPX(FitsFile* fits, Order oo, CoordSys ss, Layout ll, int cc, int qq) @@ -161,7 +154,7 @@ void FitsHPX::build(FitsFile* fits) // create image space size_t pSize = (size_t)pWidth_*pHeight_; float* dest = new float[pSize]; - for (longlong ii=0; ii<pSize; ii++) + for (long long ii=0; ii<pSize; ii++) dest[ii] = NAN; // Write WCS keyrecords @@ -172,9 +165,9 @@ void FitsHPX::build(FitsFile* fits) float row[nside]; // Loop vertically facet-by-facet. - longlong fpixel = 1; + long long fpixel = 1; // longlong group = 0; - longlong nelem = (longlong)nside; + long long nelem = (long long)nside; for (int jfacet = 0; jfacet<nfacet; jfacet++) { // Loop row-by-row. for (int jj = 0; jj<nside; jj++) { diff --git a/fitsy/outfits.C b/fitsy/outfits.C index b05e098..ee6a2cf 100644 --- a/fitsy/outfits.C +++ b/fitsy/outfits.C @@ -2,6 +2,8 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" +#include <string.h> + #include "outfits.h" #include "util.h" diff --git a/tksao/util/util.C b/tksao/util/util.C index b549d5a..94d3c8c 100644 --- a/tksao/util/util.C +++ b/tksao/util/util.C @@ -14,112 +14,12 @@ Tcl_Interp *global_interp; int sexSign; // used by parser and lex to indicate sign of dms or hms -void swap2(char* src, char* dest) { - *(dest ) = *(src+1); - *(dest+1) = *(src ); -} - -void swap4(char* src, char* dest) { - *(dest ) = *(src+3); - *(dest+1) = *(src+2); - *(dest+2) = *(src+1); - *(dest+3) = *(src ); -} - -void swap8(char* src, char* dest) { - *(dest ) = *(src+7); - *(dest+1) = *(src+6); - *(dest+2) = *(src+5); - *(dest+3) = *(src+4); - *(dest+4) = *(src+3); - *(dest+5) = *(src+2); - *(dest+6) = *(src+1); - *(dest+7) = *(src ); -} - -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; - if (str) { - copy=new char[strlen(str)+1]; - strcpy(copy,str); - } - else - copy=NULL; - - return copy; -} - -char* trim(const char* str) -{ - char* rr = dupstr(str); - char* ptr = rr; - while (ptr && *ptr) - ptr++; - ptr--; - while (ptr && (*ptr == ' ')) - ptr--; - ptr++; - *ptr = '\0'; - - return rr; -} - -char* toLower(const char* str) -{ - char* rr = dupstr(str); - char* ptr = rr; - while (*ptr) { - *ptr = (char)(tolower(((int)(*ptr)))); - ptr++; - } - return rr; -} - -char* toUpper(const char* str) -{ - char* rr = dupstr(str); - char* ptr = rr; - while (*ptr) { - *ptr = (char)(toupper(((int)(*ptr)))); - ptr++; - } - return rr; -} - -char* toConstLower(const char* str) -{ - strncpy(tobuf,str,1024); - char* ptr = tobuf; - while (*ptr) { - *ptr = (char)(tolower(((int)(*ptr)))); - ptr++; - } - return tobuf; -} - -char* toConstUpper(const char* str) -{ - strncpy(tobuf,str,1024); - char* ptr = tobuf; - while (*ptr) { - *ptr = (char)(toupper(((int)(*ptr)))); - ptr++; - } - return tobuf; -} - double zeroTWOPI(double aa) { if (isnan(aa) || isinf(aa) || (aa == -DBL_MAX) || (aa == DBL_MAX)) diff --git a/util/util.C b/util/util.C index 00a9da3..1abc0e1 100644 --- a/util/util.C +++ b/util/util.C @@ -2,25 +2,28 @@ // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -#include <tk.h> +#include <iostream> +#include <sstream> +#include <iomanip> +using namespace std; #include "util.h" -Tcl_Interp *global_interp; +static char tobuf[1024]; -static void swap2(char* src, char* dest) { +void swap2(char* src, char* dest) { *(dest ) = *(src+1); *(dest+1) = *(src ); } -static void swap4(char* src, char* dest) { +void swap4(char* src, char* dest) { *(dest ) = *(src+3); *(dest+1) = *(src+2); *(dest+2) = *(src+1); *(dest+3) = *(src ); } -static void swap8(char* src, char* dest) { +void swap8(char* src, char* dest) { *(dest ) = *(src+7); *(dest+1) = *(src+6); *(dest+2) = *(src+5); @@ -31,18 +34,12 @@ static void swap8(char* src, char* dest) { *(dest+7) = *(src ); } -static int lsb() +int lsb() { return (*(short *)"\001\000" & 0x0001); } -static 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); -} - -static char* dupstr(const char* str) +char* dupstr(const char* str) { char* copy; if (str) { @@ -113,5 +110,3 @@ char* toConstUpper(const char* str) } return tobuf; } - -#endif diff --git a/util/util.h b/util/util.h index 096117d..fcbdb98 100644 --- a/util/util.h +++ b/util/util.h @@ -1,31 +1,16 @@ -// Copyright (C) 1999-2018 +// Copyright (C) 1999-2020 // Smithsonian Astrophysical Observatory, Cambridge, MA, USA // For conditions of distribution and use, see copyright notice in "copyright" -// important note: needs to be included first as X11 defs are here - #ifndef __util_h__ #define __util_h__ -#include <stdlib.h> -#include <string.h> -#include <limits.h> -#include <float.h> -#include <math.h> - -#include <iostream> -#include <sstream> -#include <iomanip> -using namespace std; - extern int lsb(); extern void swap2(char* src, char* dest); extern void swap4(char* src, char* dest); extern void swap8(char* src, char* dest); -extern void internalError(const char*); - extern char* dupstr(const char*); extern char* trim(const char*); extern char* toLower(const char*); |