From d68167a973bb4bbde94c42c1169ba31ebebb968f Mon Sep 17 00:00:00 2001 From: Mihai Cara Date: Sat, 30 Dec 2023 01:24:14 -0500 Subject: [PATCH] Update WCSLIB to version 8.2.2 --- astropy/wcs/setup_package.py | 2 +- cextern/wcslib/C/GNUmakefile | 4 +- cextern/wcslib/C/cel.c | 8 +- cextern/wcslib/C/cel.h | 6 +- cextern/wcslib/C/dis.c | 20 +- cextern/wcslib/C/dis.h | 6 +- cextern/wcslib/C/fitshdr.h | 6 +- cextern/wcslib/C/fitshdr.l | 4 +- cextern/wcslib/C/flexed/fitshdr.c | 4 +- cextern/wcslib/C/flexed/wcsbth.c | 4 +- cextern/wcslib/C/flexed/wcspih.c | 4 +- cextern/wcslib/C/flexed/wcsulex.c | 4 +- cextern/wcslib/C/flexed/wcsutrn.c | 4 +- cextern/wcslib/C/getwcstab.c | 4 +- cextern/wcslib/C/getwcstab.h | 6 +- cextern/wcslib/C/lin.c | 8 +- cextern/wcslib/C/lin.h | 6 +- cextern/wcslib/C/log.c | 4 +- cextern/wcslib/C/log.h | 6 +- cextern/wcslib/C/prj.c | 67 ++- cextern/wcslib/C/prj.h | 6 +- cextern/wcslib/C/spc.c | 4 +- cextern/wcslib/C/spc.h | 6 +- cextern/wcslib/C/sph.c | 4 +- cextern/wcslib/C/sph.h | 6 +- cextern/wcslib/C/spx.c | 4 +- cextern/wcslib/C/spx.h | 6 +- cextern/wcslib/C/tab.c | 8 +- cextern/wcslib/C/tab.h | 6 +- cextern/wcslib/C/wcs.c | 20 +- cextern/wcslib/C/wcs.h | 6 +- cextern/wcslib/C/wcsbth.l | 4 +- cextern/wcslib/C/wcserr.c | 4 +- cextern/wcslib/C/wcserr.h | 6 +- cextern/wcslib/C/wcsfix.c | 8 +- cextern/wcslib/C/wcsfix.h | 6 +- cextern/wcslib/C/wcshdr.c | 610 ++++++++++++++-------------- cextern/wcslib/C/wcshdr.h | 6 +- cextern/wcslib/C/wcslib.h | 6 +- cextern/wcslib/C/wcsmath.h | 6 +- cextern/wcslib/C/wcspih.l | 4 +- cextern/wcslib/C/wcsprintf.c | 4 +- cextern/wcslib/C/wcsprintf.h | 6 +- cextern/wcslib/C/wcstrig.c | 4 +- cextern/wcslib/C/wcstrig.h | 6 +- cextern/wcslib/C/wcsulex.l | 4 +- cextern/wcslib/C/wcsunits.c | 4 +- cextern/wcslib/C/wcsunits.h | 6 +- cextern/wcslib/C/wcsutil.c | 4 +- cextern/wcslib/C/wcsutil.h | 6 +- cextern/wcslib/C/wcsutrn.l | 4 +- cextern/wcslib/C/wtbarr.h | 6 +- cextern/wcslib/CHANGES | 45 +- cextern/wcslib/GNUmakefile | 19 +- cextern/wcslib/INSTALL | 12 +- cextern/wcslib/README | 6 +- cextern/wcslib/THANKS | 3 +- cextern/wcslib/VALIDATION | 20 +- cextern/wcslib/configure | 24 +- cextern/wcslib/configure.ac | 6 +- cextern/wcslib/flavours | 2 +- cextern/wcslib/makedefs.in | 8 +- cextern/wcslib/wcsconfig.h.in | 4 +- cextern/wcslib/wcsconfig_f77.h.in | 4 +- cextern/wcslib/wcsconfig_tests.h.in | 4 +- cextern/wcslib/wcsconfig_utils.h.in | 4 +- docs/changes/wcs/15795.bugfix.rst | 7 + 67 files changed, 604 insertions(+), 531 deletions(-) create mode 100644 docs/changes/wcs/15795.bugfix.rst diff --git a/astropy/wcs/setup_package.py b/astropy/wcs/setup_package.py index c2808f41d1f6..e99f36fd1386 100644 --- a/astropy/wcs/setup_package.py +++ b/astropy/wcs/setup_package.py @@ -15,7 +15,7 @@ from extension_helpers import get_compiler, import_file, pkg_config, write_if_different WCSROOT = os.path.relpath(os.path.dirname(__file__)) -WCSVERSION = "8.1" +WCSVERSION = "8.2.2" def b(s): diff --git a/cextern/wcslib/C/GNUmakefile b/cextern/wcslib/C/GNUmakefile index 3574efa9573f..7b0dcdfeb9fe 100644 --- a/cextern/wcslib/C/GNUmakefile +++ b/cextern/wcslib/C/GNUmakefile @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# GNU makefile for building WCSLIB 8.1 and its test suite. +# GNU makefile for building WCSLIB 8.2 and its test suite. # # Summary of the main targets # --------------------------- @@ -31,7 +31,7 @@ # # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta -# $Id: GNUmakefile,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +# $Id: GNUmakefile,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ #----------------------------------------------------------------------------- # Get configure settings. SUBDIR := C diff --git a/cextern/wcslib/C/cel.c b/cextern/wcslib/C/cel.c index f62f0ebe3d78..9562268193f7 100644 --- a/cextern/wcslib/C/cel.c +++ b/cextern/wcslib/C/cel.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: cel.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: cel.c,v 8.2.1.2 2023/11/29 07:35:56 mcalabre Exp mcalabre $ *===========================================================================*/ #include @@ -33,8 +33,6 @@ #include "sph.h" #include "cel.h" -const int CELSET = 137; - // Map status return value to message. const char *cel_errmsg[] = { "Success", @@ -54,6 +52,8 @@ const int cel_prjerr[] = { CELERR_BAD_WORLD // 4: PRJERR_BAD_WORLD }; +static const int CELSET = 137; + // Convenience macro for invoking wcserr_set(). #define CEL_ERRMSG(status) WCSERR_SET(status), cel_errmsg[status] diff --git a/cextern/wcslib/C/cel.h b/cextern/wcslib/C/cel.h index b8ebb2d57a94..c35eb8a54a96 100644 --- a/cextern/wcslib/C/cel.h +++ b/cextern/wcslib/C/cel.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: cel.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: cel.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/dis.c b/cextern/wcslib/C/dis.c index 5ff6c333cbc9..636017499901 100644 --- a/cextern/wcslib/C/dis.c +++ b/cextern/wcslib/C/dis.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: dis.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: dis.c,v 8.2.1.2 2023/11/29 07:43:49 mcalabre Exp mcalabre $ *===========================================================================*/ #include @@ -32,12 +32,6 @@ #include "wcsutil.h" #include "dis.h" -const int DISSET = 137; - -const int DIS_TPD = 1; -const int DIS_POLYNOMIAL = 2; -const int DIS_DOTPD = 1024; - // Maximum number of DPja or DQia keywords. int NDPMAX = 256; @@ -50,8 +44,11 @@ const char *dis_errmsg[] = { "Distort error", "De-distort error"}; -// Convenience macro for invoking wcserr_set(). -#define DIS_ERRMSG(status) WCSERR_SET(status), dis_errmsg[status] +static const int DISSET = 137; + +static const int DIS_TPD = 1; +static const int DIS_POLYNOMIAL = 2; +static const int DIS_DOTPD = 1024; // Internal helper functions, not for general use. static int polyset(int j, struct disprm *dis); @@ -81,6 +78,9 @@ static int tpd9(DISP2X_ARGS); #define I_NIPARM 1 // Full (allocated) length of iparm[]. #define I_NDPARM 2 // No. of parameters in dparm[], excl. work space. +// Convenience macro for invoking wcserr_set(). +#define DIS_ERRMSG(status) WCSERR_SET(status), dis_errmsg[status] + //---------------------------------------------------------------------------- int disndp(int ndpmax) { if (ndpmax >= 0) NDPMAX = ndpmax; return NDPMAX; } diff --git a/cextern/wcslib/C/dis.h b/cextern/wcslib/C/dis.h index 40170f057269..6422567604f0 100644 --- a/cextern/wcslib/C/dis.h +++ b/cextern/wcslib/C/dis.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: dis.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: dis.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/fitshdr.h b/cextern/wcslib/C/fitshdr.h index cc668869f1d7..faa589958603 100644 --- a/cextern/wcslib/C/fitshdr.h +++ b/cextern/wcslib/C/fitshdr.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: fitshdr.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: fitshdr.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/fitshdr.l b/cextern/wcslib/C/fitshdr.l index d64ddc5830d0..6a924444da3b 100644 --- a/cextern/wcslib/C/fitshdr.l +++ b/cextern/wcslib/C/fitshdr.l @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: fitshdr.l,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: fitshdr.l,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * * fitshdr.l is a Flex description file containing a lexical scanner diff --git a/cextern/wcslib/C/flexed/fitshdr.c b/cextern/wcslib/C/flexed/fitshdr.c index 3aa0c36cf05f..5fba0da12821 100644 --- a/cextern/wcslib/C/flexed/fitshdr.c +++ b/cextern/wcslib/C/flexed/fitshdr.c @@ -10233,7 +10233,7 @@ static const yy_state_type yy_NUL_trans[551] = #define YY_RESTORE_YY_MORE_OFFSET #line 1 "fitshdr.l" /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -10253,7 +10253,7 @@ static const yy_state_type yy_NUL_trans[551] = Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: fitshdr.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: fitshdr.c,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ *============================================================================= * * fitshdr.l is a Flex description file containing a lexical scanner diff --git a/cextern/wcslib/C/flexed/wcsbth.c b/cextern/wcslib/C/flexed/wcsbth.c index 8656becd5440..32ed715c61b1 100644 --- a/cextern/wcslib/C/flexed/wcsbth.c +++ b/cextern/wcslib/C/flexed/wcsbth.c @@ -26123,7 +26123,7 @@ static const yy_state_type yy_NUL_trans[1458] = #define YY_RESTORE_YY_MORE_OFFSET #line 1 "wcsbth.l" /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -26143,7 +26143,7 @@ static const yy_state_type yy_NUL_trans[1458] = Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsbth.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsbth.c,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ *============================================================================= * * wcsbth.l is a Flex description file containing the definition of a lexical diff --git a/cextern/wcslib/C/flexed/wcspih.c b/cextern/wcslib/C/flexed/wcspih.c index 0f042951c96a..b58017cd2875 100644 --- a/cextern/wcslib/C/flexed/wcspih.c +++ b/cextern/wcslib/C/flexed/wcspih.c @@ -21444,7 +21444,7 @@ static const yy_state_type yy_NUL_trans[1191] = #define YY_RESTORE_YY_MORE_OFFSET #line 1 "wcspih.l" /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -21464,7 +21464,7 @@ static const yy_state_type yy_NUL_trans[1191] = Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcspih.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcspih.c,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ *============================================================================= * * wcspih.l is a Flex description file containing the definition of a lexical diff --git a/cextern/wcslib/C/flexed/wcsulex.c b/cextern/wcslib/C/flexed/wcsulex.c index 104eb652079d..9966bcc45b68 100644 --- a/cextern/wcslib/C/flexed/wcsulex.c +++ b/cextern/wcslib/C/flexed/wcsulex.c @@ -7150,7 +7150,7 @@ static const yy_state_type yy_NUL_trans[375] = #define YY_RESTORE_YY_MORE_OFFSET #line 1 "wcsulex.l" /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -7170,7 +7170,7 @@ static const yy_state_type yy_NUL_trans[375] = Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsulex.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsulex.c,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ *============================================================================= * * wcsulex.l is a Flex description file containing the definition of a diff --git a/cextern/wcslib/C/flexed/wcsutrn.c b/cextern/wcslib/C/flexed/wcsutrn.c index 8ce6f9892695..d29febe8bc17 100644 --- a/cextern/wcslib/C/flexed/wcsutrn.c +++ b/cextern/wcslib/C/flexed/wcsutrn.c @@ -4382,7 +4382,7 @@ static const yy_state_type yy_NUL_trans[217] = #define YY_RESTORE_YY_MORE_OFFSET #line 1 "wcsutrn.l" /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -4402,7 +4402,7 @@ static const yy_state_type yy_NUL_trans[217] = Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsutrn.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsutrn.c,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ *============================================================================= * * wcsutrn.l is a Flex description file containing the definition of a lexical diff --git a/cextern/wcslib/C/getwcstab.c b/cextern/wcslib/C/getwcstab.c index 9f7bde2a9034..d56d66f222f3 100644 --- a/cextern/wcslib/C/getwcstab.c +++ b/cextern/wcslib/C/getwcstab.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: getwcstab.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: getwcstab.c,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/cextern/wcslib/C/getwcstab.h b/cextern/wcslib/C/getwcstab.h index 3bc5714bc4eb..bb2bc9684096 100644 --- a/cextern/wcslib/C/getwcstab.h +++ b/cextern/wcslib/C/getwcstab.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: getwcstab.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: getwcstab.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/lin.c b/cextern/wcslib/C/lin.c index efc301091e41..ac0dedb4fd10 100644 --- a/cextern/wcslib/C/lin.c +++ b/cextern/wcslib/C/lin.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: lin.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: lin.c,v 8.2.1.2 2023/11/29 07:36:19 mcalabre Exp mcalabre $ *===========================================================================*/ #include @@ -32,8 +32,6 @@ #include "lin.h" #include "dis.h" -const int LINSET = 137; - // Map status return value to message. const char *lin_errmsg[] = { "Success", @@ -54,6 +52,8 @@ const int lin_diserr[] = { LINERR_DEDISTORT // 5: DISERR_DEDISTORT }; +static const int LINSET = 137; + // Convenience macro for invoking wcserr_set(). #define LIN_ERRMSG(status) WCSERR_SET(status), lin_errmsg[status] diff --git a/cextern/wcslib/C/lin.h b/cextern/wcslib/C/lin.h index b6714a4cc59b..e8593b118b53 100644 --- a/cextern/wcslib/C/lin.h +++ b/cextern/wcslib/C/lin.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: lin.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: lin.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/log.c b/cextern/wcslib/C/log.c index 8b2bf9fadc20..e23efb0ceb53 100644 --- a/cextern/wcslib/C/log.c +++ b/cextern/wcslib/C/log.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: log.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: log.c,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/cextern/wcslib/C/log.h b/cextern/wcslib/C/log.h index 354402e8c1de..3d416054b3d9 100644 --- a/cextern/wcslib/C/log.h +++ b/cextern/wcslib/C/log.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: log.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: log.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/prj.c b/cextern/wcslib/C/prj.c index 1243662ba735..6cf16a15bd5a 100644 --- a/cextern/wcslib/C/prj.c +++ b/cextern/wcslib/C/prj.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: prj.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: prj.c,v 8.2.1.2 2023/11/29 07:39:01 mcalabre Exp mcalabre $ *===========================================================================*/ #include @@ -57,36 +57,6 @@ const char prj_codes[28][4] = "CEA", "CAR", "MER", "COP", "COE", "COD", "COO", "SFL", "PAR", "MOL", "AIT", "BON", "PCO", "TSC", "CSC", "QSC", "HPX", "XPH"}; -const int AZP = 101; -const int SZP = 102; -const int TAN = 103; -const int STG = 104; -const int SIN = 105; -const int ARC = 106; -const int ZPN = 107; -const int ZEA = 108; -const int AIR = 109; -const int CYP = 201; -const int CEA = 202; -const int CAR = 203; -const int MER = 204; -const int SFL = 301; -const int PAR = 302; -const int MOL = 303; -const int AIT = 401; -const int COP = 501; -const int COE = 502; -const int COD = 503; -const int COO = 504; -const int BON = 601; -const int PCO = 602; -const int TSC = 701; -const int CSC = 702; -const int QSC = 703; -const int HPX = 801; -const int XPH = 802; - - // Map status return value to message. const char *prj_errmsg[] = { "Success", @@ -95,6 +65,35 @@ const char *prj_errmsg[] = { "One or more of the (x,y) coordinates were invalid", "One or more of the (phi,theta) coordinates were invalid"}; +static const int AZP = 101; +static const int SZP = 102; +static const int TAN = 103; +static const int STG = 104; +static const int SIN = 105; +static const int ARC = 106; +static const int ZPN = 107; +static const int ZEA = 108; +static const int AIR = 109; +static const int CYP = 201; +static const int CEA = 202; +static const int CAR = 203; +static const int MER = 204; +static const int SFL = 301; +static const int PAR = 302; +static const int MOL = 303; +static const int AIT = 401; +static const int COP = 501; +static const int COE = 502; +static const int COD = 503; +static const int COO = 504; +static const int BON = 601; +static const int PCO = 602; +static const int TSC = 701; +static const int CSC = 702; +static const int QSC = 703; +static const int HPX = 801; +static const int XPH = 802; + // Convenience macros for generating common error messages. #define PRJERR_BAD_PARAM_SET(function) \ wcserr_set(&(prj->err), PRJERR_BAD_PARAM, function, __FILE__, __LINE__, \ @@ -121,7 +120,7 @@ const char *prj_errmsg[] = { * prjfree frees any memory that may have been allocated to store an error * message in the prjprm struct. * -* prjsize computed the size of a prjprm struct. +* prjsize computes the size of a prjprm struct. * * prjprt prints the contents of a prjprm struct. * @@ -520,7 +519,7 @@ int prjs2x( * outside use. It forces (x,y) = (0,0) at (phi0,theta0). *---------------------------------------------------------------------------*/ -int prjoff( +static int prjoff( struct prjprm *prj, const double phi0, const double theta0) diff --git a/cextern/wcslib/C/prj.h b/cextern/wcslib/C/prj.h index 705c641ee0bc..47fc3316559a 100644 --- a/cextern/wcslib/C/prj.h +++ b/cextern/wcslib/C/prj.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: prj.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: prj.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/spc.c b/cextern/wcslib/C/spc.c index 9d75155ba2b3..49879e8a712c 100644 --- a/cextern/wcslib/C/spc.c +++ b/cextern/wcslib/C/spc.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: spc.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: spc.c,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/cextern/wcslib/C/spc.h b/cextern/wcslib/C/spc.h index fd1229ff1319..6617a0eaaf9c 100644 --- a/cextern/wcslib/C/spc.h +++ b/cextern/wcslib/C/spc.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: spc.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: spc.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/sph.c b/cextern/wcslib/C/sph.c index f1cac824672f..d759bd7990e9 100644 --- a/cextern/wcslib/C/sph.c +++ b/cextern/wcslib/C/sph.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: sph.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: sph.c,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/cextern/wcslib/C/sph.h b/cextern/wcslib/C/sph.h index 8b6967966d29..58b39fee4a82 100644 --- a/cextern/wcslib/C/sph.h +++ b/cextern/wcslib/C/sph.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: sph.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: sph.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/spx.c b/cextern/wcslib/C/spx.c index 0871a7f6eb24..8c645d7f28aa 100644 --- a/cextern/wcslib/C/spx.c +++ b/cextern/wcslib/C/spx.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: spx.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: spx.c,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/cextern/wcslib/C/spx.h b/cextern/wcslib/C/spx.h index a8b27c4ec863..26fd94083af0 100644 --- a/cextern/wcslib/C/spx.h +++ b/cextern/wcslib/C/spx.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: spx.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: spx.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/tab.c b/cextern/wcslib/C/tab.c index a147f1e62afa..5f6548f5401e 100644 --- a/cextern/wcslib/C/tab.c +++ b/cextern/wcslib/C/tab.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: tab.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: tab.c,v 8.2.1.2 2023/11/29 07:39:44 mcalabre Exp mcalabre $ *===========================================================================*/ #include @@ -33,8 +33,6 @@ #include "wcsutil.h" #include "tab.h" -const int TABSET = 137; - // Map status return value to message. const char *tab_errmsg[] = { "Success", @@ -44,6 +42,8 @@ const char *tab_errmsg[] = { "One or more of the x coordinates were invalid", "One or more of the world coordinates were invalid"}; +static const int TABSET = 137; + // Convenience macro for invoking wcserr_set(). #define TAB_ERRMSG(status) WCSERR_SET(status), tab_errmsg[status] diff --git a/cextern/wcslib/C/tab.h b/cextern/wcslib/C/tab.h index 68ef88cb0818..3bd4aa57593f 100644 --- a/cextern/wcslib/C/tab.h +++ b/cextern/wcslib/C/tab.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: tab.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: tab.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/wcs.c b/cextern/wcslib/C/wcs.c index 5403cc0e75a9..1018371ce170 100644 --- a/cextern/wcslib/C/wcs.c +++ b/cextern/wcslib/C/wcs.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcs.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcs.c,v 8.2.1.2 2023/11/29 07:41:57 mcalabre Exp mcalabre $ *===========================================================================*/ #include @@ -44,8 +44,6 @@ #include "tab.h" #include "wcs.h" -const int WCSSET = 137; - // Maximum number of PVi_ma and PSi_ma keywords. int NPVMAX = 64; int NPSMAX = 8; @@ -115,12 +113,7 @@ const int wcs_taberr[] = { WCSERR_BAD_WORLD // 5: TABERR_BAD_WORLD }; -// Convenience macro for invoking wcserr_set(). -#define WCS_ERRMSG(status) WCSERR_SET(status), wcs_errmsg[status] - -#ifndef signbit -#define signbit(X) ((X) < 0.0 ? 1 : 0) -#endif +static const int WCSSET = 137; // Internal helper functions, not for general use. static int wcs_types(struct wcsprm *); @@ -128,6 +121,13 @@ static int time_type(const char *); static int time_code(const char *ctype, int nc); static int wcs_units(struct wcsprm *); +// Convenience macro for invoking wcserr_set(). +#define WCS_ERRMSG(status) WCSERR_SET(status), wcs_errmsg[status] + +#ifndef signbit +#define signbit(X) ((X) < 0.0 ? 1 : 0) +#endif + //---------------------------------------------------------------------------- int wcsnpv(int npvmax) { if (npvmax >= 0) NPVMAX = npvmax; return NPVMAX; } diff --git a/cextern/wcslib/C/wcs.h b/cextern/wcslib/C/wcs.h index 6bde3f27a317..da430a2a4c37 100644 --- a/cextern/wcslib/C/wcs.h +++ b/cextern/wcslib/C/wcs.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcs.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcs.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/wcsbth.l b/cextern/wcslib/C/wcsbth.l index e71c0ff658cb..00af4ac349ee 100644 --- a/cextern/wcslib/C/wcsbth.l +++ b/cextern/wcslib/C/wcsbth.l @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsbth.l,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsbth.l,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * * wcsbth.l is a Flex description file containing the definition of a lexical diff --git a/cextern/wcslib/C/wcserr.c b/cextern/wcslib/C/wcserr.c index 1e41bbb53d52..82db4a87fb07 100644 --- a/cextern/wcslib/C/wcserr.c +++ b/cextern/wcslib/C/wcserr.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -20,7 +20,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. Module author: Michael Droettboom http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcserr.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcserr.c,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/cextern/wcslib/C/wcserr.h b/cextern/wcslib/C/wcserr.h index 22dae943e5d8..21035e0aabfe 100644 --- a/cextern/wcslib/C/wcserr.h +++ b/cextern/wcslib/C/wcserr.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -20,10 +20,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. Module author: Michael Droettboom http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcserr.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcserr.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/wcsfix.c b/cextern/wcslib/C/wcsfix.c index dd223813dbd8..7fcac493a91b 100644 --- a/cextern/wcslib/C/wcsfix.c +++ b/cextern/wcslib/C/wcsfix.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsfix.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsfix.c,v 8.2.1.2 2023/11/29 07:40:24 mcalabre Exp mcalabre $ *===========================================================================*/ #include @@ -39,8 +39,6 @@ #include "wcsutil.h" #include "wtbarr.h" -extern const int WCSSET; - // Maximum number of coordinate axes that can be handled. #define NMAX 16 @@ -84,6 +82,8 @@ const int fix_wcserr[] = { // ...others not used }; +static const int WCSSET = 137; // Matching wcs.c + // Convenience macro for invoking wcserr_set(). #define WCSFIX_ERRMSG(status) WCSERR_SET(status), wcsfix_errmsg[status] diff --git a/cextern/wcslib/C/wcsfix.h b/cextern/wcslib/C/wcsfix.h index c0f0a282c111..a6d92c429b05 100644 --- a/cextern/wcslib/C/wcsfix.h +++ b/cextern/wcslib/C/wcsfix.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsfix.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsfix.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/wcshdr.c b/cextern/wcslib/C/wcshdr.c index bd2eeb58cc09..79d3382bc57b 100644 --- a/cextern/wcslib/C/wcshdr.c +++ b/cextern/wcslib/C/wcshdr.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcshdr.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcshdr.c,v 8.2.1.2 2023/11/29 07:42:43 mcalabre Exp mcalabre $ *===========================================================================*/ #include @@ -37,10 +37,6 @@ #include "dis.h" #include "wcs.h" -extern const int WCSSET; - -extern const int DIS_DOTPD; - // Map status return value to message. const char *wcshdr_errmsg[] = { "Success", @@ -60,8 +56,9 @@ const int wcshdr_taberr[] = { // 5: TABERR_BAD_WORLD }; -// Convenience macro for invoking wcserr_set(). -#define WCSHDR_ERRMSG(status) WCSERR_SET(status), wcshdr_errmsg[status] +static const int WCSSET = 137; // Matching wcs.c + +static const int DIS_DOTPD = 1024; // Matching dis.c // Internal helper functions, not for general use. static void wcshdo_format(int, int, const double [], char *); @@ -70,6 +67,9 @@ static void wcshdo_util(int, const char [], const char [], int, const char [], int, int, int, char, int, int [], char [], const char [], int *, char **, int *); +// Convenience macro for invoking wcserr_set(). +#define WCSHDR_ERRMSG(status) WCSERR_SET(status), wcshdr_errmsg[status] + //---------------------------------------------------------------------------- int wcstab(struct wcsprm *wcs) @@ -77,15 +77,15 @@ int wcstab(struct wcsprm *wcs) { static const char *function = "wcstab"; + // Pointers to allocated memory. char (*PSi_0a)[72] = 0x0, (*PSi_1a)[72] = 0x0, (*PSi_2a)[72] = 0x0; - int *PVi_1a = 0x0, *PVi_2a = 0x0, *PVi_3a = 0x0, *tabax, *tabidx = 0x0; - int getcrd, i, ip, itab, itabax, j, jtabax, m, naxis, ntabax, status; - struct wtbarr *wtbp; - struct tabprm *tabp; - struct wcserr **err; + int *PVi_1a = 0x0, *PVi_2a = 0x0, *PVi_3a = 0x0; + int *tabidx = 0x0; + + int status = 0; if (wcs == 0x0) return WCSHDRERR_NULL_POINTER; - err = &(wcs->err); + struct wcserr **err = &(wcs->err); // Free memory previously allocated by wcstab(). if (wcs->flag != -1 && wcs->m_flag == WCSSET) { @@ -94,7 +94,7 @@ int wcstab(struct wcsprm *wcs) if (wcs->m_wtb) free(wcs->m_wtb); if (wcs->m_tab) { - for (j = 0; j < wcs->ntab; j++) { + for (int j = 0; j < wcs->ntab; j++) { tabfree(wcs->m_tab + j); } @@ -109,13 +109,14 @@ int wcstab(struct wcsprm *wcs) // Determine the number of -TAB axes. - naxis = wcs->naxis; + int naxis = wcs->naxis; + int *tabax; if (!(tabax = calloc(naxis, sizeof(int)))) { return wcserr_set(WCSHDR_ERRMSG(WCSHDRERR_MEMORY)); } - ntabax = 0; - for (i = 0; i < naxis; i++) { + int ntabax = 0; + for (int i = 0; i < naxis; i++) { // Null fill. wcsutil_null_fill(72, wcs->ctype[i]); @@ -128,7 +129,6 @@ int wcstab(struct wcsprm *wcs) if (ntabax == 0) { // No lookup tables. - status = 0; goto cleanup; } @@ -145,15 +145,15 @@ int wcstab(struct wcsprm *wcs) goto cleanup; } - for (itabax = 0; itabax < ntabax; itabax++) { + for (int itabax = 0; itabax < ntabax; itabax++) { // Remember that calloc() zeroes allocated memory. PVi_1a[itabax] = 1; PVi_2a[itabax] = 1; PVi_3a[itabax] = 1; } - for (ip = 0; ip < wcs->nps; ip++) { - itabax = tabax[wcs->ps[ip].i - 1]; + for (int ip = 0; ip < wcs->nps; ip++) { + int itabax = tabax[wcs->ps[ip].i - 1]; if (itabax >= 0) { switch (wcs->ps[ip].m) { case 0: @@ -175,8 +175,8 @@ int wcstab(struct wcsprm *wcs) } } - for (ip = 0; ip < wcs->npv; ip++) { - itabax = tabax[wcs->pv[ip].i - 1]; + for (int ip = 0; ip < wcs->npv; ip++) { + int itabax = tabax[wcs->pv[ip].i - 1]; if (itabax >= 0) { switch (wcs->pv[ip].m) { case 1: @@ -197,7 +197,7 @@ int wcstab(struct wcsprm *wcs) // Determine the number of independent tables. - for (itabax = 0; itabax < ntabax; itabax++) { + for (int itabax = 0; itabax < ntabax; itabax++) { // These have no defaults. if (!PSi_0a[itabax][0] || !PSi_1a[itabax][0]) { status = wcserr_set(WCSERR_SET(WCSHDRERR_BAD_TABULAR_PARAMS), @@ -206,7 +206,8 @@ int wcstab(struct wcsprm *wcs) } tabidx[itabax] = -1; - for (jtabax = 0; jtabax < i; jtabax++) { + int jtabax; + for (jtabax = 0; jtabax < itabax; jtabax++) { // EXTNAME, EXTVER, EXTLEVEL, and TTYPEn for the coordinate array // must match for each axis of a multi-dimensional lookup table. if (strcmp(PSi_0a[itabax], PSi_0a[jtabax]) == 0 && @@ -231,8 +232,8 @@ int wcstab(struct wcsprm *wcs) wcs->m_tab = wcs->tab; // Table dimensionality; find the largest axis number. - for (itabax = 0; itabax < ntabax; itabax++) { - tabp = wcs->tab + tabidx[itabax]; + for (int itabax = 0; itabax < ntabax; itabax++) { + struct tabprm *tabp = wcs->tab + tabidx[itabax]; // PVi_3a records the 1-relative table axis number. if (PVi_3a[itabax] > tabp->M) { @@ -240,7 +241,7 @@ int wcstab(struct wcsprm *wcs) } } - for (itab = 0; itab < wcs->ntab; itab++) { + for (int itab = 0; itab < wcs->ntab; itab++) { if ((status = tabini(1, wcs->tab[itab].M, 0, wcs->tab + itab))) { status = wcserr_set(WCSHDR_ERRMSG(wcshdr_taberr[status])); goto cleanup; @@ -249,23 +250,25 @@ int wcstab(struct wcsprm *wcs) // Copy parameters into the tabprm structs. - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { + int itabax; if ((itabax = tabax[i]) < 0) { // Not a -TAB axis. continue; } // PVi_3a records the 1-relative table axis number. - m = PVi_3a[itabax] - 1; + int m = PVi_3a[itabax] - 1; + struct tabprm *tabp; tabp = wcs->tab + tabidx[itabax]; tabp->map[m] = i; tabp->crval[m] = wcs->crval[i]; } // Check for completeness. - for (itab = 0; itab < wcs->ntab; itab++) { - for (m = 0; m < wcs->tab[itab].M; m++) { + for (int itab = 0; itab < wcs->ntab; itab++) { + for (int m = 0; m < wcs->tab[itab].M; m++) { if (wcs->tab[itab].map[m] < 0) { status = wcserr_set(WCSERR_SET(WCSHDRERR_BAD_TABULAR_PARAMS), "Invalid tabular parameters: the axis mapping is undefined"); @@ -276,7 +279,7 @@ int wcstab(struct wcsprm *wcs) // Set up for reading the arrays; how many arrays are there? - for (itabax = 0; itabax < ntabax; itabax++) { + for (int itabax = 0; itabax < ntabax; itabax++) { // Does this -TAB axis have a non-degenerate index array? if (PSi_2a[itabax][0]) { wcs->nwtb++; @@ -296,10 +299,10 @@ int wcstab(struct wcsprm *wcs) wcs->m_wtb = wcs->wtb; // Set pointers for the index and coordinate arrays. - wtbp = wcs->wtb; - for (itab = 0; itab < wcs->ntab; itab++) { - getcrd = 1; - for (itabax = 0; itabax < ntabax; itabax++) { + struct wtbarr *wtbp = wcs->wtb; + for (int itab = 0; itab < wcs->ntab; itab++) { + int getcrd = 1; + for (int itabax = 0; itabax < ntabax; itabax++) { if (tabidx[itabax] != itab) continue; if (getcrd) { @@ -330,7 +333,7 @@ int wcstab(struct wcsprm *wcs) wtbp->m = PVi_3a[itabax]; wtbp->kind = 'i'; - m = wtbp->m - 1; + int m = wtbp->m - 1; strcpy(wtbp->extnam, PSi_0a[itabax]); wtbp->extver = PVi_1a[itabax]; wtbp->extlev = PVi_2a[itabax]; @@ -348,8 +351,6 @@ int wcstab(struct wcsprm *wcs) } } - status = 0; - cleanup: if (tabax) free(tabax); if (tabidx) free(tabidx); @@ -373,10 +374,7 @@ int wcstab(struct wcsprm *wcs) int wcsidx(int nwcs, struct wcsprm **wcs, int alts[27]) { - int a, iwcs; - struct wcsprm *wcsp; - - for (a = 0; a < 27; a++) { + for (int a = 0; a < 27; a++) { alts[a] = -1; } @@ -384,10 +382,11 @@ int wcsidx(int nwcs, struct wcsprm **wcs, int alts[27]) return WCSHDRERR_NULL_POINTER; } - wcsp = *wcs; - for (iwcs = 0; iwcs < nwcs; iwcs++, wcsp++) { + struct wcsprm *wcsp = *wcs; + for (int iwcs = 0; iwcs < nwcs; iwcs++, wcsp++) { if (wcsp->colnum || wcsp->colax[0]) continue; + int a; if (wcsp->alt[0] == ' ') { a = 0; } else { @@ -405,15 +404,11 @@ int wcsidx(int nwcs, struct wcsprm **wcs, int alts[27]) int wcsbdx(int nwcs, struct wcsprm **wcs, int type, short alts[1000][28]) { - short *ip; - int a, i, icol, iwcs; - struct wcsprm *wcsp; - - for (ip = alts[0]; ip < alts[0] + 28*1000; ip++) { + for (short *ip = alts[0]; ip < alts[0] + 28*1000; ip++) { *ip = -1; } - for (icol = 0; icol < 1000; icol++) { + for (int icol = 0; icol < 1000; icol++) { alts[icol][27] = 0; } @@ -421,8 +416,9 @@ int wcsbdx(int nwcs, struct wcsprm **wcs, int type, short alts[1000][28]) return WCSHDRERR_NULL_POINTER; } - wcsp = *wcs; - for (iwcs = 0; iwcs < nwcs; iwcs++, wcsp++) { + struct wcsprm *wcsp = *wcs; + for (int iwcs = 0; iwcs < nwcs; iwcs++, wcsp++) { + int a; if (wcsp->alt[0] == ' ') { a = 0; } else { @@ -432,7 +428,7 @@ int wcsbdx(int nwcs, struct wcsprm **wcs, int type, short alts[1000][28]) if (type) { // Pixel list. if (wcsp->colax[0]) { - for (i = 0; i < wcsp->naxis; i++) { + for (int i = 0; i < wcsp->naxis; i++) { alts[wcsp->colax[i]][a] = iwcs; alts[wcsp->colax[i]][27]++; } @@ -461,15 +457,14 @@ int wcsbdx(int nwcs, struct wcsprm **wcs, int type, short alts[1000][28]) int wcsvfree(int *nwcs, struct wcsprm **wcs) { - int a, status = 0; - struct wcsprm *wcsp; + int status = 0; if (wcs == 0x0) { return WCSHDRERR_NULL_POINTER; } - wcsp = *wcs; - for (a = 0; a < *nwcs; a++, wcsp++) { + struct wcsprm *wcsp = *wcs; + for (int a = 0; a < *nwcs; a++, wcsp++) { status |= wcsfree(wcsp); } @@ -501,43 +496,34 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) const char axid[] = "xyxuvu", *cp; const int nTPD[] = {1, 4, 7, 12, 17, 24, 31, 40, 49, 60}; - char alt, comment[72], ctemp[32], *ctypei, format[16], fmt01[8], - keyvalue[96], keyword[16], *kp, obsg[8] = "OBSG?", - obsgeo[8] = "OBSGEO-?", pq, ptype, xtype, term[16], timeunit[16], - tpdsrc[24], xyz[] = "XYZ"; - int *axmap, bintab, *colax, colnum, degree, direct = 0, doaux = 0, dofmt, - dosip, dotpd, dotpv, i, idis, idp, *iparm, j, jhat, k, kp0, kpi, m, - naxis, ncoeff, Nhat, p, pixlist, precision, primage, q, status = 0; - double *dparm, keyval; - struct auxprm *aux; - struct disprm *dis; - struct dpkey *keyp; - struct wcserr **err; + char comment[128], keyvalue[96], keyword[16]; + int status = 0; *nkeyrec = 0; *header = 0x0; if (wcs == 0x0) return WCSHDRERR_NULL_POINTER; - err = &(wcs->err); + struct wcserr **err = &(wcs->err); if (wcs->flag != WCSSET) { if ((status = wcsset(wcs))) return status; } + int naxis; if ((naxis = wcs->naxis) == 0) { return 0; } // These are mainly for convenience. - alt = wcs->alt[0]; + char alt = wcs->alt[0]; if (alt == ' ') alt = '\0'; - colnum = wcs->colnum; - colax = wcs->colax; + int colnum = wcs->colnum; + int *colax = wcs->colax; - primage = 0; - bintab = 0; - pixlist = 0; + int primage = 0; + int bintab = 0; + int pixlist = 0; if (colnum) { bintab = 1; } else if (colax[0]) { @@ -548,6 +534,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Initialize floating point format control. + char format[16]; *format = '\0'; if (ctrl & WCSHDO_P17) { strcpy(format, "% 20.17G"); @@ -571,7 +558,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } } - dofmt = (*format == '\0'); + int dofmt = (*format == '\0'); // WCS dimension. @@ -583,7 +570,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Reference pixel coordinates. if (dofmt) wcshdo_format('G', naxis, wcs->crpix, format); - for (j = 0; j < naxis; j++) { + for (int j = 0; j < naxis; j++) { wcsutil_double2str(keyvalue, format, wcs->crpix[j]); wcshdo_util(ctrl, "CRPIX", "CRP", WCSHDO_CRPXna, "CRPX", 0, j+1, 0, alt, colnum, colax, keyvalue, "Pixel coordinate of reference point", nkeyrec, @@ -592,9 +579,9 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Linear transformation matrix. if (dofmt) wcshdo_format('G', naxis*naxis, wcs->pc, format); - k = 0; - for (i = 0; i < naxis; i++) { - for (j = 0; j < naxis; j++, k++) { + int k = 0; + for (int i = 0; i < naxis; i++) { + for (int j = 0; j < naxis; j++, k++) { if (i == j) { if (wcs->pc[k] == 1.0) continue; } else { @@ -611,7 +598,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Coordinate increment at reference point. if (dofmt) wcshdo_format('G', naxis, wcs->cdelt, format); - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { wcsutil_double2str(keyvalue, format, wcs->cdelt[i]); comment[0] = '\0'; if (wcs->cunit[i][0]) sprintf(comment, "[%s] ", wcs->cunit[i]); @@ -621,7 +608,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } // Units of coordinate increment and reference value. - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { if (wcs->cunit[i][0] == '\0') continue; sprintf(keyvalue, "'%s'", wcs->cunit[i]); @@ -633,12 +620,12 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // May need to alter ctype for particular distortions so do basic checks // now. Note that SIP, TPV, DSS, TNX, and ZPX are restricted to exactly // two axes and cannot coexist with other distortion types. - dosip = 0; - dotpv = 0; - dotpd = 0; + char tpdsrc[24]; + int dosip = 0, dotpd = 0, dotpv = 0; + struct disprm *dis; if ((dis = wcs->lin.dispre)) { - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { if (strcmp(dis->dtype[i], "SIP") == 0) { // Simple Imaging Polynomial (SIP). Write it in its native form // if possible, unless specifically requested to write it as TPD. @@ -683,7 +670,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } if ((dis = wcs->lin.disseq)) { - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { if (strcmp(dis->dtype[i], "TPV") == 0) { // TPV "projection". Write it in its native form if possible, // unless specifically requested to write it as TPD. @@ -738,13 +725,13 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } // Coordinate type. - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { if (wcs->ctype[i][0] == '\0') continue; sprintf(keyvalue, "'%s'", wcs->ctype[i]); strcpy(comment, "Coordinate type code"); - ctypei = keyvalue + 1; + char *ctypei = keyvalue + 1; if (i == wcs->lng || i == wcs->lat) { // Alter ctype for particular distortions. if (dosip) { @@ -774,23 +761,27 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) switch (ctypei[0]) { case 'G': - strcpy(comment, "galactic "); + strcpy(comment, "Galactic l"); break; case 'E': - strcpy(comment, "ecliptic "); + strcpy(comment, "Ecliptic l"); break; case 'H': - strcpy(comment, "helioecliptic "); + strcpy(comment, "Helioecliptic l"); break; case 'S': - strcpy(comment, "supergalactic "); + strcpy(comment, "Supergalactic l"); + break; + default: + // User-defined coordinate system. + strcpy(comment, "L"); break; } if (i == wcs->lng) { - strcat(comment, "longitude, "); + strcat(comment, "ongitude, "); } else { - strcat(comment, "latitude, "); + strcat(comment, "atitude, "); } } @@ -799,6 +790,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } } else if (i == wcs->spec) { + char ptype, xtype; spctyp(wcs->ctype[i], 0x0, 0x0, comment, 0x0, &ptype, &xtype, 0x0); if (ptype == xtype) { strcat(comment, " (linear)"); @@ -822,7 +814,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } // Coordinate value at reference point. - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { if (dofmt) wcshdo_format('G', 1, wcs->crval+i, format); wcsutil_double2str(keyvalue, format, wcs->crval[i]); comment[0] = '\0'; @@ -834,7 +826,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Parameter values. if (dofmt) strcpy(format, "%20.12G"); - for (k = 0; k < wcs->npv; k++) { + for (int k = 0; k < wcs->npv; k++) { wcsutil_double2str(keyvalue, format, (wcs->pv[k]).value); if ((wcs->pv[k]).i == (wcs->lng + 1)) { switch ((wcs->pv[k]).m) { @@ -872,53 +864,51 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } wcshdo_util(ctrl, "PV", "V", WCSHDO_PVn_ma, "PV", wcs->pv[k].i, -1, - wcs->pv[k].m, alt, colnum, colax, keyvalue, comment, - nkeyrec, header, &status); + wcs->pv[k].m, alt, colnum, colax, keyvalue, comment, nkeyrec, header, + &status); } - for (k = 0; k < wcs->nps; k++) { + for (int k = 0; k < wcs->nps; k++) { sprintf(keyvalue, "'%s'", (wcs->ps[k]).value); wcshdo_util(ctrl, "PS", "S", WCSHDO_PVn_ma, "PS", wcs->ps[k].i, -1, wcs->ps[k].m, alt, colnum, colax, keyvalue, - "Coordinate transformation parameter", - nkeyrec, header, &status); + "Coordinate transformation parameter", nkeyrec, header, &status); } // Celestial and spectral transformation parameters. if (!undefined(wcs->lonpole)) { wcsutil_double2str(keyvalue, format, wcs->lonpole); - wcshdo_util(ctrl, "LONPOLE", "LONP", 0, 0x0, 0, 0, 0, alt, - colnum, colax, keyvalue, "[deg] Native longitude of celestial pole", - nkeyrec, header, &status); + wcshdo_util(ctrl, "LONPOLE", "LONP", 0, 0x0, 0, 0, 0, alt, colnum, colax, + keyvalue, "[deg] Native longitude of celestial pole", nkeyrec, header, + &status); } if (!undefined(wcs->latpole)) { wcsutil_double2str(keyvalue, format, wcs->latpole); - wcshdo_util(ctrl, "LATPOLE", "LATP", 0, 0x0, 0, 0, 0, alt, - colnum, colax, keyvalue, "[deg] Native latitude of celestial pole", - nkeyrec, header, &status); + wcshdo_util(ctrl, "LATPOLE", "LATP", 0, 0x0, 0, 0, 0, alt, colnum, colax, + keyvalue, "[deg] Native latitude of celestial pole", nkeyrec, header, + &status); } if (wcs->restfrq != 0.0) { wcsutil_double2str(keyvalue, format, wcs->restfrq); - wcshdo_util(ctrl, "RESTFRQ", "RFRQ", 0, 0x0, 0, 0, 0, alt, - colnum, colax, keyvalue, "[Hz] Line rest frequency", - nkeyrec, header, &status); + wcshdo_util(ctrl, "RESTFRQ", "RFRQ", 0, 0x0, 0, 0, 0, alt, colnum, colax, + keyvalue, "[Hz] Line rest frequency", nkeyrec, header, &status); } if (wcs->restwav != 0.0) { wcsutil_double2str(keyvalue, format, wcs->restwav); - wcshdo_util(ctrl, "RESTWAV", "RWAV", 0, 0x0, 0, 0, 0, alt, - colnum, colax, keyvalue, "[Hz] Line rest wavelength", - nkeyrec, header, &status); + wcshdo_util(ctrl, "RESTWAV", "RWAV", 0, 0x0, 0, 0, 0, alt, colnum, colax, + keyvalue, "[Hz] Line rest wavelength", nkeyrec, header, &status); } // - - - - - - - - - - - - - - - - - Auxiliary coordinate axis information. + char timeunit[16]; sprintf(timeunit, "%.15s", wcs->timeunit[0] ? wcs->timeunit : "s"); // Coordinate axis title. if (wcs->cname) { - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { if (wcs->cname[i][0] == '\0') continue; sprintf(keyvalue, "'%s'", wcs->cname[i]); @@ -930,7 +920,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Random error in coordinate. if (wcs->crder) { - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { if (undefined(wcs->crder[i])) continue; wcsutil_double2str(keyvalue, format, wcs->crder[i]); @@ -944,7 +934,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Systematic error in coordinate. if (wcs->csyer) { - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { if (undefined(wcs->csyer[i])) continue; wcsutil_double2str(keyvalue, format, wcs->csyer[i]); @@ -958,7 +948,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Time at zero point of phase axis. if (wcs->czphs) { - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { if (undefined(wcs->czphs[i])) continue; wcsutil_double2str(keyvalue, format, wcs->czphs[i]); @@ -970,7 +960,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Period of phase axis. if (wcs->cperi) { - for (i = 0; i < naxis; i++) { + for (int i = 0; i < naxis; i++) { if (undefined(wcs->cperi[i])) continue; wcsutil_double2str(keyvalue, format, wcs->cperi[i]); @@ -986,9 +976,8 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) if (wcs->wcsname[0]) { sprintf(keyvalue, "'%s'", wcs->wcsname); if (bintab) { - wcshdo_util(ctrl, "WCSNAME", "WCSN", 0, 0x0, 0, 0, 0, alt, - colnum, colax, keyvalue, "Coordinate system title", - nkeyrec, header, &status); + wcshdo_util(ctrl, "WCSNAME", "WCSN", 0, 0x0, 0, 0, 0, alt, colnum, + colax, keyvalue, "Coordinate system title", nkeyrec, header, &status); } else { // TWCS was a mistake. wcshdo_util(ctrl, "WCSNAME", "TWCS", WCSHDO_WCSNna, "WCSN", 0, 0, 0, @@ -1002,44 +991,45 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Time scale. if (wcs->timesys[0]) { sprintf(keyvalue, "'%s'", wcs->timesys); - wcshdo_util(ctrl, "TIMESYS", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "Time scale", nkeyrec, header, &status); + wcshdo_util(ctrl, "TIMESYS", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "Time scale", nkeyrec, header, &status); } // Time reference position. if (wcs->trefpos[0]) { sprintf(keyvalue, "'%s'", wcs->trefpos); - wcshdo_util(ctrl, "TREFPOS", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "Time reference position", nkeyrec, header, &status); + wcshdo_util(ctrl, "TREFPOS", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "Time reference position", nkeyrec, header, &status); } // Time reference direction. if (wcs->trefdir[0]) { sprintf(keyvalue, "'%s'", wcs->trefdir); - wcshdo_util(ctrl, "TREFDIR", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "Time reference direction", nkeyrec, header, &status); + wcshdo_util(ctrl, "TREFDIR", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "Time reference direction", nkeyrec, header, &status); } // Ephemerides used for pathlength delay calculation. if (wcs->plephem[0]) { sprintf(keyvalue, "'%s'", wcs->plephem); - wcshdo_util(ctrl, "PLEPHEM", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "Ephemerides used for pathlength delays", nkeyrec, header, &status); + wcshdo_util(ctrl, "PLEPHEM", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "Ephemerides used for pathlength delays", nkeyrec, header, + &status); } // Time units. if (wcs->timeunit[0]) { sprintf(keyvalue, "'%s'", wcs->timeunit); - wcshdo_util(ctrl, "TIMEUNIT", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "Time units", nkeyrec, header, &status); + wcshdo_util(ctrl, "TIMEUNIT", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "Time units", nkeyrec, header, &status); } // Fiducial (reference) time. if (wcs->mjdref[0] == 0.0 && wcs->mjdref[1] == 0.0) { // MJD of fiducial time (simplified if it takes its default value). wcsutil_double2str(keyvalue, format, 0.0); - wcshdo_util(ctrl, "MJDREF", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "[d] MJD of fiducial time", nkeyrec, header, &status); + wcshdo_util(ctrl, "MJDREF", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "[d] MJD of fiducial time", nkeyrec, header, &status); } else { // ISO-8601 fiducial time. @@ -1080,8 +1070,8 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) if (!undefined(wcs->timeoffs)) { wcsutil_double2str(keyvalue, format, wcs->timeoffs); sprintf(comment, "[%s] Clock correction", timeunit); - wcshdo_util(ctrl, "TIMEOFFS", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - comment, nkeyrec, header, &status); + wcshdo_util(ctrl, "TIMEOFFS", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, comment, nkeyrec, header, &status); } // - - - - - - - - - - - - - - - - - - - - - Data timestamps and durations. @@ -1097,45 +1087,46 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) colnum, colax, keyvalue, comment, nkeyrec, header, &status); } else { // Force DATE-OBS. - wcshdo_util(ctrl, "DATE-OBS", 0x0, 0, 0x0, 0, 0, 0, ' ', - 0, 0x0, keyvalue, comment, nkeyrec, header, &status); + wcshdo_util(ctrl, "DATE-OBS", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, comment, nkeyrec, header, &status); } } // MJD of observation. if (!undefined(wcs->mjdobs)) { wcsutil_double2str(keyvalue, format, wcs->mjdobs); - wcshdo_util(ctrl, "MJD-OBS", "MJDOB", 0, 0x0, 0, 0, 0, ' ', - colnum, colax, keyvalue, "[d] MJD of observation", - nkeyrec, header, &status); + wcshdo_util(ctrl, "MJD-OBS", "MJDOB", 0, 0x0, 0, 0, 0, ' ', colnum, colax, + keyvalue, "[d] MJD of observation", nkeyrec, header, &status); } // Julian epoch of observation. if (!undefined(wcs->jepoch)) { wcsutil_double2str(keyvalue, format, wcs->jepoch); - wcshdo_util(ctrl, "JEPOCH", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "[a] Julian epoch of observation", nkeyrec, header, &status); + wcshdo_util(ctrl, "JEPOCH", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "[a] Julian epoch of observation", nkeyrec, header, &status); } // Besselian epoch of observation. if (!undefined(wcs->bepoch)) { wcsutil_double2str(keyvalue, format, wcs->bepoch); - wcshdo_util(ctrl, "BEPOCH", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "[a] Besselian epoch of observation", nkeyrec, header, &status); + wcshdo_util(ctrl, "BEPOCH", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "[a] Besselian epoch of observation", nkeyrec, header, + &status); } // ISO-8601 time at start of observation. if (wcs->datebeg[0]) { sprintf(keyvalue, "'%s'", wcs->datebeg); - wcshdo_util(ctrl, "DATE-BEG", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "ISO-8601 time at start of observation", nkeyrec, header, &status); + wcshdo_util(ctrl, "DATE-BEG", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "ISO-8601 time at start of observation", nkeyrec, header, + &status); } // MJD at start of observation. if (!undefined(wcs->mjdbeg)) { wcsutil_double2str(keyvalue, format, wcs->mjdbeg); - wcshdo_util(ctrl, "MJD-BEG", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "[d] MJD at start of observation", nkeyrec, header, &status); + wcshdo_util(ctrl, "MJD-BEG", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "[d] MJD at start of observation", nkeyrec, header, &status); } // Time elapsed at start since fiducial time. @@ -1143,38 +1134,39 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) wcsutil_double2str(keyvalue, format, wcs->tstart); sprintf(comment, "[%s] Time elapsed since fiducial time at start", timeunit); - wcshdo_util(ctrl, "TSTART", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - comment, nkeyrec, header, &status); + wcshdo_util(ctrl, "TSTART", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, comment, nkeyrec, header, &status); } // ISO-8601 time at midpoint of observation. if (wcs->dateavg[0]) { sprintf(keyvalue, "'%s'", wcs->dateavg); - wcshdo_util(ctrl, "DATE-AVG", "DAVG", 0, 0x0, 0, 0, 0, ' ', - colnum, colax, keyvalue, "ISO-8601 time at midpoint of observation", - nkeyrec, header, &status); + wcshdo_util(ctrl, "DATE-AVG", "DAVG", 0, 0x0, 0, 0, 0, ' ', colnum, colax, + keyvalue, "ISO-8601 time at midpoint of observation", nkeyrec, header, + &status); } // MJD at midpoint of observation. if (!undefined(wcs->mjdavg)) { wcsutil_double2str(keyvalue, format, wcs->mjdavg); - wcshdo_util(ctrl, "MJD-AVG", "MJDA", 0, 0x0, 0, 0, 0, ' ', - colnum, colax, keyvalue, "[d] MJD at midpoint of observation", - nkeyrec, header, &status); + wcshdo_util(ctrl, "MJD-AVG", "MJDA", 0, 0x0, 0, 0, 0, ' ', colnum, colax, + keyvalue, "[d] MJD at midpoint of observation", nkeyrec, header, + &status); } // ISO-8601 time at end of observation. if (wcs->dateend[0]) { sprintf(keyvalue, "'%s'", wcs->dateend); - wcshdo_util(ctrl, "DATE-END", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "ISO-8601 time at end of observation", nkeyrec, header, &status); + wcshdo_util(ctrl, "DATE-END", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "ISO-8601 time at end of observation", nkeyrec, header, + &status); } // MJD at end of observation. if (!undefined(wcs->mjdend)) { wcsutil_double2str(keyvalue, format, wcs->mjdend); - wcshdo_util(ctrl, "MJD-END", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "[d] MJD at end of observation", nkeyrec, header, &status); + wcshdo_util(ctrl, "MJD-END", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "[d] MJD at end of observation", nkeyrec, header, &status); } // Time elapsed at end since fiducial time. @@ -1182,24 +1174,24 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) wcsutil_double2str(keyvalue, format, wcs->tstop); sprintf(comment, "[%s] Time elapsed since fiducial time at end", timeunit); - wcshdo_util(ctrl, "TSTOP", "", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - comment, nkeyrec, header, &status); + wcshdo_util(ctrl, "TSTOP", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, comment, nkeyrec, header, &status); } // Exposure (integration) time. if (!undefined(wcs->xposure)) { wcsutil_double2str(keyvalue, format, wcs->xposure); sprintf(comment, "[%s] Exposure (integration) time", timeunit); - wcshdo_util(ctrl, "XPOSURE", "", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - comment, nkeyrec, header, &status); + wcshdo_util(ctrl, "XPOSURE", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, comment, nkeyrec, header, &status); } // Elapsed time (start to stop). if (!undefined(wcs->telapse)) { wcsutil_double2str(keyvalue, format, wcs->telapse); sprintf(comment, "[%s] Elapsed time (start to stop)", timeunit); - wcshdo_util(ctrl, "TELAPSE", "", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - comment, nkeyrec, header, &status); + wcshdo_util(ctrl, "TELAPSE", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, comment, nkeyrec, header, &status); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - Timing accuracy. @@ -1208,32 +1200,32 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) if (!undefined(wcs->timsyer)) { wcsutil_double2str(keyvalue, format, wcs->timsyer); sprintf(comment, "[%s] Systematic error in time measurements", timeunit); - wcshdo_util(ctrl, "TIMSYER", "", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - comment, nkeyrec, header, &status); + wcshdo_util(ctrl, "TIMSYER", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, comment, nkeyrec, header, &status); } // Relative error in time measurements. if (!undefined(wcs->timrder)) { wcsutil_double2str(keyvalue, format, wcs->timrder); sprintf(comment, "[%s] Relative error in time measurements", timeunit); - wcshdo_util(ctrl, "TIMRDER", "", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - comment, nkeyrec, header, &status); + wcshdo_util(ctrl, "TIMRDER", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, comment, nkeyrec, header, &status); } // Time resolution. if (!undefined(wcs->timedel)) { wcsutil_double2str(keyvalue, format, wcs->timedel); sprintf(comment, "[%s] Time resolution", timeunit); - wcshdo_util(ctrl, "TIMEDEL", "", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - comment, nkeyrec, header, &status); + wcshdo_util(ctrl, "TIMEDEL", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, comment, nkeyrec, header, &status); } // Reference position of timestamp in binned data. if (!undefined(wcs->timepixr)) { wcsutil_double2str(keyvalue, format, wcs->timepixr); - wcshdo_util(ctrl, "TIMEPIXR", "", 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "Reference position of timestamp in binned data", nkeyrec, header, - &status); + wcshdo_util(ctrl, "TIMEPIXR", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "Reference position of timestamp in binned data", nkeyrec, + header, &status); } // - - - - - - - - - - - - - - - - - - Spatial & celestial reference frame. @@ -1243,13 +1235,14 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) !undefined(wcs->obsgeo[1]) && !undefined(wcs->obsgeo[2])) { - for (k = 0; k < 3; k++) { + char obsgeo[16] = "OBSGEO-?", obsg[8] = "OBSG?", xyz[] = "XYZ"; + for (int k = 0; k < 3; k++) { wcsutil_double2str(keyvalue, format, wcs->obsgeo[k]); sprintf(comment, "[m] observatory %c-coordinate", xyz[k]); obsgeo[7] = xyz[k]; obsg[4] = xyz[k]; - wcshdo_util(ctrl, obsgeo, obsg, 0, 0x0, 0, 0, 0, ' ', - colnum, colax, keyvalue, comment, nkeyrec, header, &status); + wcshdo_util(ctrl, obsgeo, obsg, 0, 0x0, 0, 0, 0, ' ', colnum, colax, + keyvalue, comment, nkeyrec, header, &status); } } else if ( @@ -1258,23 +1251,26 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) !undefined(wcs->obsgeo[5])) { wcsutil_double2str(keyvalue, format, wcs->obsgeo[3]); - wcshdo_util(ctrl, "OBSGEO-L", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "[deg] IAU(1976) observatory longitude", nkeyrec, header, &status); + wcshdo_util(ctrl, "OBSGEO-L", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "[deg] IAU(1976) observatory longitude", nkeyrec, header, + &status); wcsutil_double2str(keyvalue, format, wcs->obsgeo[4]); - wcshdo_util(ctrl, "OBSGEO-B", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "[deg] IAU(1976) observatory latitude", nkeyrec, header, &status); + wcshdo_util(ctrl, "OBSGEO-B", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "[deg] IAU(1976) observatory latitude", nkeyrec, header, + &status); wcsutil_double2str(keyvalue, format, wcs->obsgeo[5]); - wcshdo_util(ctrl, "OBSGEO-L", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "[m] IAU(1976) observatory height", nkeyrec, header, &status); + wcshdo_util(ctrl, "OBSGEO-L", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "[m] IAU(1976) observatory height", nkeyrec, header, + &status); } // Spacecraft orbit ephemeris file. if (wcs->obsorbit[0]) { sprintf(keyvalue, "'%s'", wcs->obsorbit); - wcshdo_util(ctrl, "OBSORBIT", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, - "Spacecraft orbit ephemeris file", nkeyrec, header, &status); + wcshdo_util(ctrl, "OBSORBIT", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + keyvalue, "Spacecraft orbit ephemeris file", nkeyrec, header, &status); } // Equatorial coordinate system type. @@ -1339,6 +1335,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // - - - - - - - - - - - - - - - - - - - - Additional auxiliary parameters. + struct auxprm *aux; if ((aux = wcs->aux)) { if (!undefined(aux->rsun_ref)) { wcsutil_double2str(keyvalue, format, aux->rsun_ref); @@ -1426,6 +1423,9 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // - - - - - - - - - - - - - - - - - - - - - Distortion function parameters. + char term[16]; + double *dparm, keyval; + if (dosip) { // Simple Imaging Polynomial (SIP) is handled by translating its dpkey // records. Determine a suitable numerical precision for the @@ -1433,29 +1433,29 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // them. dis = wcs->lin.dispre; if (dofmt) { - keyp = dis->dp; - kp0 = 2; - for (idp = 0; idp < dis->ndp; idp++, keyp++) { - cp = strchr(keyp->field, '.') + 1; + struct dpkey *ikeyp = dis->dp; + int kp0 = 2; + for (int idp = 0; idp < dis->ndp; idp++, ikeyp++) { + cp = strchr(ikeyp->field, '.') + 1; if (strncmp(cp, "SIP.", 4) != 0) continue; - wcsutil_double2str(keyvalue, "%20.13E", dpkeyd(keyp)); + wcsutil_double2str(keyvalue, "%20.13E", dpkeyd(ikeyp)); - kpi = 15; + int kpi = 15; while (kp0 < kpi && keyvalue[kpi] == '0') kpi--; kp0 = kpi; } - precision = kp0 - 2; + int precision = kp0 - 2; if (precision < 1) precision = 1; if (13 < precision) precision = 13; sprintf(format, "%%20.%dE", precision); } // Ensure the coefficients are written in a human-readable sequence. - for (j = 0; j <= 1; j++) { + for (int j = 0; j <= 1; j++) { // Distortion function polynomial coefficients. - wcshdo_util(ctrl, "", "", 0, 0x0, 0, 0, 0, ' ', 0, 0, "", "", - nkeyrec, header, &status); + wcshdo_util(ctrl, "", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + "", "", nkeyrec, header, &status); if (j == 0) { strcpy(keyword, "A_"); @@ -1463,7 +1463,8 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) strcpy(keyword, "B_"); } - ncoeff = dis->iparm[j][I_TPDNCO]; + int degree; + int ncoeff = dis->iparm[j][I_TPDNCO]; for (degree = 0; degree <= 9; degree++) { if (ncoeff <= nTPD[degree]) break; } @@ -1471,18 +1472,19 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) strcpy(keyword+2, "ORDER"); sprintf(keyvalue, "%20d", degree); sprintf(comment, "SIP polynomial degree, axis %d, pixel-to-sky", j+1); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, ' ', 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, comment, nkeyrec, header, &status); - keyp = dis->dp; - for (idp = 0; idp < dis->ndp; idp++, keyp++) { - if (keyp->j != j+1) continue; - if ((keyval = dpkeyd(keyp)) == 0.0) continue; + struct dpkey *ikeyp = dis->dp; + for (int idp = 0; idp < dis->ndp; idp++, ikeyp++) { + if (ikeyp->j != j+1) continue; + if ((keyval = dpkeyd(ikeyp)) == 0.0) continue; - cp = strchr(keyp->field, '.') + 1; + cp = strchr(ikeyp->field, '.') + 1; if (strncmp(cp, "SIP.FWD.", 8) != 0) continue; cp += 8; strcpy(keyword+2, cp); + int p, q; sscanf(cp, "%d_%d", &p, &q); strncpy(term, "xxxxxxxxx", p); strncpy(term+p, "yyyyyyyyy", q); @@ -1490,14 +1492,14 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) wcsutil_double2str(keyvalue, format, keyval); sprintf(comment, "SIP distortion coefficient: %s", term); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, ' ', 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } if (dis->maxdis[j] != 0.0) { strcpy(keyword+2, "DMAX"); wcsutil_double2str(keyvalue, "%20.3f", dis->maxdis[j]); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, ' ', 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, "Maximum value of distortion function", nkeyrec, header, &status); } @@ -1505,8 +1507,8 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Inverse distortion function polynomial coefficients. if (dis->disx2p == 0x0) continue; - wcshdo_util(ctrl, "", "", 0, 0x0, 0, 0, 0, ' ', 0, 0, "", "", - nkeyrec, header, &status); + wcshdo_util(ctrl, "", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + "", "", nkeyrec, header, &status); if (j == 0) { strcpy(keyword, "AP_"); @@ -1522,18 +1524,19 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) strcpy(keyword+3, "ORDER"); sprintf(keyvalue, "%20d", degree); sprintf(comment, "SIP polynomial degree, axis %d, sky-to-pixel", j+1); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, ' ', 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, comment, nkeyrec, header, &status); - keyp = dis->dp; - for (idp = 0; idp < dis->ndp; idp++, keyp++) { - if (keyp->j != j+1) continue; - if ((keyval = dpkeyd(keyp)) == 0.0) continue; + ikeyp = dis->dp; + for (int idp = 0; idp < dis->ndp; idp++, ikeyp++) { + if (ikeyp->j != j+1) continue; + if ((keyval = dpkeyd(ikeyp)) == 0.0) continue; - cp = strchr(keyp->field, '.') + 1; + cp = strchr(ikeyp->field, '.') + 1; if (strncmp(cp, "SIP.REV.", 8) != 0) continue; cp += 8; strcpy(keyword+3, cp); + int p, q; sscanf(cp, "%d_%d", &p, &q); strncpy(term, "xxxxxxxxx", p); strncpy(term+p, "yyyyyyyyy", q); @@ -1541,20 +1544,20 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) wcsutil_double2str(keyvalue, format, keyval); sprintf(comment, "SIP inverse coefficient: %s", term); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, ' ', 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } } } - for (idis = 0; idis < 2; idis++) { + for (int idis = 0; idis < 2; idis++) { if (idis == 0 && (dis = wcs->lin.dispre) == 0x0) continue; if (idis == 1 && (dis = wcs->lin.disseq) == 0x0) continue; - for (j = 0; j < naxis; j++) { + for (int j = 0; j < naxis; j++) { if (dis->disp2x[j] == 0x0) continue; - iparm = dis->iparm[j]; + int *iparm = dis->iparm[j]; dparm = dis->dparm[j]; // Identify the distortion type. @@ -1565,25 +1568,27 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Determine a suitable numerical precision for the polynomial // coefficients to avoid trailing zeroes common to all of them. if (dofmt) wcshdo_format('E', iparm[I_NDPARM], dparm, format); + char fmt01[8]; sprintf(fmt01, "%.3ss", format); - wcshdo_util(ctrl, "", "", 0, 0x0, 0, 0, 0, ' ', 0, 0, "", "", - nkeyrec, header, &status); + wcshdo_util(ctrl, "", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + "", "", nkeyrec, header, &status); // Distortion function polynomial coefficients. sprintf(keyword, "PV%d_", j+1); - kp = keyword + strlen(keyword); + char *kp = keyword + strlen(keyword); - keyp = dis->dp; - for (idp = 0; idp < dis->ndp; idp++, keyp++) { - if (keyp->j != j+1) continue; - if ((keyval = dpkeyd(keyp)) == 0.0) continue; + struct dpkey *ikeyp = dis->dp; + for (int idp = 0; idp < dis->ndp; idp++, ikeyp++) { + if (ikeyp->j != j+1) continue; + if ((keyval = dpkeyd(ikeyp)) == 0.0) continue; - cp = strchr(keyp->field, '.') + 1; + cp = strchr(ikeyp->field, '.') + 1; if (strncmp(cp, "TPV.", 4) != 0) continue; strcpy(kp, cp+4); // Identify the term of the TPV polynomial for human readers. + int m; sscanf(cp+4, "%d", &m); wcshdo_tpdterm(m, j == wcs->lng, term); sprintf(comment, "TPV coefficient: %s", term); @@ -1593,7 +1598,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } else { wcsutil_double2str(keyvalue, format, keyval); } - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } @@ -1601,8 +1606,8 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) strcmp(dis->dtype[j], "Polynomial") == 0 || strcmp(dis->dtype[j], "Polynomial*") == 0) { // One of the Paper IV type polynomial distortions. - wcshdo_util(ctrl, "", "", 0, 0x0, 0, 0, 0, ' ', 0, 0, "", "", - nkeyrec, header, &status); + wcshdo_util(ctrl, "", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + "", "", nkeyrec, header, &status); if (strcmp(dis->dtype[j], "TPD") == 0) { // Pure TPD. @@ -1613,8 +1618,8 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) strcpy(tpdsrc, "Polynomial distortion"); } - pq = idis ? 'Q' : 'P'; - Nhat = dis->Nhat[j]; + char pq = idis ? 'Q' : 'P'; + int Nhat = dis->Nhat[j]; // CPDISja/CQDISia sprintf(keyword, "C%cDIS%d", pq, j+1); @@ -1624,12 +1629,13 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) strcpy(comment, "Q = sequent, "); } + int direct = 0, doaux; if (dotpd) { strcpy(keyvalue, "'TPD'"); strcat(comment, "Template Polynomial Distortion"); // For identifying terms of the TPD polynomial. - axmap = dis->axmap[j]; + int *axmap = dis->axmap[j]; direct = 1; doaux = iparm[I_TPDAUX]; if (Nhat == 2) { @@ -1648,7 +1654,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) strcat(comment, "general Polynomial distortion"); } - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); // NAXES. @@ -1661,12 +1667,12 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } else { strcpy(comment, "Number of independent variables"); } - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); // AXIS.jhat - for (jhat = 0; jhat < Nhat; jhat++) { - axmap = dis->axmap[j]; + for (int jhat = 0; jhat < Nhat; jhat++) { + int *axmap = dis->axmap[j]; sprintf(keyvalue, "'AXIS.%d: %d'", jhat+1, axmap[jhat]+1); if (jhat == 0) { strcpy(comment, "1st"); @@ -1688,43 +1694,45 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) sprintf(comment+strlen(comment), " (= %c)", cp[jhat]); } - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } + char ctemp[32]; + // OFFSET.jhat if (dofmt) wcshdo_format('f', Nhat, dis->offset[j], format); - for (jhat = 0; jhat < Nhat; jhat++) { + for (int jhat = 0; jhat < Nhat; jhat++) { if (dis->offset[j][jhat] == 0.0) continue; wcsutil_double2str(ctemp, format, dis->offset[j][jhat]); sprintf(keyvalue, "'OFFSET.%d: %s'", jhat+1, ctemp); sprintf(comment, "Variable %d renormalization offset", jhat+1); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } // SCALE.jhat if (dofmt) wcshdo_format('f', Nhat, dis->scale[j], format); - for (jhat = 0; jhat < Nhat; jhat++) { + for (int jhat = 0; jhat < Nhat; jhat++) { if (dis->scale[j][jhat] == 1.0) continue; wcsutil_double2str(ctemp, format, dis->scale[j][jhat]); sprintf(keyvalue, "'SCALE.%d: %s'", jhat+1, ctemp); sprintf(comment, "Variable %d renormalization scale", jhat+1); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } // Does the distortion function compute a correction? if (dis->docorr[j]) { - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, "'DOCORR: 1'", "Distortion function computes a correction", nkeyrec, header, &status); } else { - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, "'DOCORR: 0'", "Distortion function computes coordinates", nkeyrec, header, &status); } @@ -1735,11 +1743,12 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // Polynomial, the dpkey records may not relate to TPD. // Output is therefore handled via dparm. if (dofmt) wcshdo_format('E', iparm[I_NDPARM], dparm, format); + char fmt01[8]; sprintf(fmt01, "%.3ss", format); // AUX.jhat.COEFF.m if (doaux) { - for (idp = 0; idp < 6; idp++) { + for (int idp = 0; idp < 6; idp++) { if (dparm[idp] == 0.0) { sprintf(ctemp, fmt01, "0.0"); } else if (dparm[idp] == 1.0) { @@ -1756,7 +1765,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) sprintf(comment, "TPD: y = d0 + d1*u + d2*v"); } - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } @@ -1765,7 +1774,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } // TPD.FWD.m - for (idp = 0; idp < iparm[I_TPDNCO]; idp++) { + for (int idp = 0; idp < iparm[I_TPDNCO]; idp++) { if (dparm[idp] == 0.0) continue; if (dparm[idp] == 1.0) { @@ -1774,12 +1783,12 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) wcsutil_double2str(ctemp, format, dparm[idp]); } - m = idp; + int m = idp; sprintf(keyvalue, "'TPD.FWD.%d:%s %s'", m, (m<10)?" ":"", ctemp); wcshdo_tpdterm(m, direct, term); sprintf(comment, "TPD coefficient: %s", term); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } @@ -1789,28 +1798,28 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) sprintf(keyvalue, "%20.2f", dis->maxdis[j]); sprintf(comment, "%sMaximum absolute value of distortion", idis?"":"[pix] "); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } // Inverse distortion function polynomial coefficients. if (dis->disx2p[j] == 0x0) continue; - wcshdo_util(ctrl, "", "", 0, 0x0, 0, 0, 0, ' ', 0, 0, "", "", - nkeyrec, header, &status); + wcshdo_util(ctrl, "", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + "", "", nkeyrec, header, &status); // TPD.REV.m sprintf(keyword, "D%c%d", pq, j+1); - for (idp = iparm[I_TPDNCO]; idp < iparm[I_NDPARM]; idp++) { + for (int idp = iparm[I_TPDNCO]; idp < iparm[I_NDPARM]; idp++) { if (dparm[idp] == 0.0) continue; wcsutil_double2str(ctemp, format, dparm[idp]); - m = idp - iparm[I_TPDNCO]; + int m = idp - iparm[I_TPDNCO]; sprintf(keyvalue, "'TPD.REV.%d:%s %s'", m, (m<10)?" ":"", ctemp); wcshdo_tpdterm(m, direct, term); sprintf(comment, "TPD coefficient: %s", term); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } @@ -1819,32 +1828,33 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) // since iparm and dparm may hold a translation to TPD. // Do auxiliary variables first. - keyp = dis->dp; - for (idp = 0; idp < dis->ndp; idp++, keyp++) { - if (keyp->j != j+1) continue; + struct dpkey *ikeyp = dis->dp; + for (int idp = 0; idp < dis->ndp; idp++, ikeyp++) { + if (ikeyp->j != j+1) continue; - cp = strchr(keyp->field, '.') + 1; + cp = strchr(ikeyp->field, '.') + 1; if (strncmp(cp, "NAUX", 4) != 0) continue; - sprintf(keyvalue, "'%s: %d'", cp, dpkeyi(keyp)); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + sprintf(keyvalue, "'%s: %d'", cp, dpkeyi(ikeyp)); + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, "Number of auxiliary variables", nkeyrec, header, &status); - keyp = dis->dp; - for (idp = 0; idp < dis->ndp; idp++, keyp++) { - if (keyp->j != j+1) continue; + struct dpkey *jkeyp = dis->dp; + for (int jdp = 0; jdp < dis->ndp; jdp++, jkeyp++) { + if (jkeyp->j != j+1) continue; - keyval = dpkeyd(keyp); + keyval = dpkeyd(jkeyp); - cp = strchr(keyp->field, '.') + 1; + cp = strchr(jkeyp->field, '.') + 1; if (strncmp(cp, "AUX.", 4) != 0) continue; + int m; sscanf(cp+4, "%d", &m); sprintf(keyvalue, "'%s:", cp); cp = strchr(cp+4, '.') + 1; - kp = keyvalue + strlen(keyvalue); + char *kp = keyvalue + strlen(keyvalue); if ((double)((int)keyval) == keyval) { sprintf(kp, "%4d'", (int)keyval); @@ -1855,6 +1865,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) strcat(keyvalue, "'"); } + int p; sscanf(cp+6, "%d", &p); if (strncmp(cp, "POWER.", 4) == 0) { if (p) { @@ -1870,7 +1881,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } } - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } @@ -1878,33 +1889,34 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } // Do polynomial terms. - keyp = dis->dp; - for (idp = 0; idp < dis->ndp; idp++, keyp++) { - if (keyp->j != j+1) continue; + ikeyp = dis->dp; + for (int idp = 0; idp < dis->ndp; idp++, ikeyp++) { + if (ikeyp->j != j+1) continue; - cp = strchr(keyp->field, '.') + 1; + cp = strchr(ikeyp->field, '.') + 1; if (strncmp(cp, "NTERMS", 6) != 0) continue; - sprintf(keyvalue, "'%s: %d'", cp, dpkeyi(keyp)); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + sprintf(keyvalue, "'%s: %d'", cp, dpkeyi(ikeyp)); + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, "Number of terms in the polynomial", nkeyrec, header, &status); } - keyp = dis->dp; - for (idp = 0; idp < dis->ndp; idp++, keyp++) { - if (keyp->j != j+1) continue; + ikeyp = dis->dp; + for (int idp = 0; idp < dis->ndp; idp++, ikeyp++) { + if (ikeyp->j != j+1) continue; - if ((keyval = dpkeyd(keyp)) == 0.0) continue; + if ((keyval = dpkeyd(ikeyp)) == 0.0) continue; - cp = strchr(keyp->field, '.') + 1; + cp = strchr(ikeyp->field, '.') + 1; if (strncmp(cp, "TERM.", 5) != 0) continue; + int m; sscanf(cp+5, "%d", &m); sprintf(keyvalue, "'%s:%s ", cp, (m<10)?" ":""); cp = strchr(cp+5, '.') + 1; - kp = keyvalue + strlen(keyvalue); + char *kp = keyvalue + strlen(keyvalue); if (strncmp(cp, "VAR.", 4) == 0) { if ((double)((int)keyval) == keyval) { sprintf(kp, "%20d", (int)keyval); @@ -1912,6 +1924,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) wcsutil_double2str(kp, "%20.13f", keyval); } + int p; sscanf(cp+4, "%d", &p); if (p <= Nhat) { sprintf(comment, "Poly term %d: var %d power", m, p); @@ -1925,7 +1938,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) } strcat(keyvalue, "'"); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } @@ -1935,7 +1948,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) sprintf(keyvalue, "%20.2f", dis->maxdis[j]); sprintf(comment, "%sMaximum absolute value of distortion", idis?"":"[pix] "); - wcshdo_util(ctrl, keyword, "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, keyword, 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } } @@ -1946,15 +1959,15 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) if (dis->totdis != 0.0) { sprintf(keyvalue, "%20.2f", dis->totdis); sprintf(comment, "Maximum combined distortion"); - wcshdo_util(ctrl, "DVERR", "", 0, 0x0, 0, 0, 0, alt, 0, 0, + wcshdo_util(ctrl, "DVERR", 0x0, 0, 0x0, 0, 0, 0, alt, 0, 0x0, keyvalue, comment, nkeyrec, header, &status); } } // Add identification. - wcshdo_util(ctrl, "", "", 0, 0x0, 0, 0, 0, ' ', 0, 0, "", "", - nkeyrec, header, &status); + wcshdo_util(ctrl, "", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, + "", "", nkeyrec, header, &status); if (dotpd == DIS_DOTPD) { // TPD by translation. @@ -1965,7 +1978,7 @@ int wcshdo(int ctrl, struct wcsprm *wcs, int *nkeyrec, char **header) wcslib_version(0x0)); } - wcshdo_util(ctrl, "COMMENT", "", 0, 0x0, 0, 0, 0, ' ', 0, 0, + wcshdo_util(ctrl, "COMMENT", 0x0, 0, 0x0, 0, 0, 0, ' ', 0, 0x0, "", comment, nkeyrec, header, &status); @@ -2050,8 +2063,7 @@ void wcshdo_tpdterm( { const int nTPD[] = {1, 4, 7, 12, 17, 24, 31, 40, 49, 60}; - int degree, k; - + int degree; for (degree = 0; degree <= 9; degree++) { if (m < nTPD[degree]) break; } @@ -2060,7 +2072,7 @@ void wcshdo_tpdterm( strcpy(term, "1"); } else { - k = degree - (m - nTPD[degree-1]); + int k = degree - (m - nTPD[degree-1]); if (k < 0) { memcpy(term, "rrrrrrrrr", degree); @@ -2098,14 +2110,12 @@ void wcshdo_util( int *status) { - char ch0, ch1, *hptr, keyword[32], *kptr; - int nbyte, nc = 47, nv; - if (*status) return; // Reallocate memory in blocks of 2880 bytes. + char *hptr; if ((*nkeyrec)%32 == 0) { - nbyte = ((*nkeyrec)/32 + 1) * 2880; + int nbyte = ((*nkeyrec)/32 + 1) * 2880; if (!(hptr = realloc(*header, nbyte))) { *status = WCSHDRERR_MEMORY; return; @@ -2115,6 +2125,7 @@ void wcshdo_util( } // Construct the keyword. + char keyword[32]; if (alt == ' ') alt = '\0'; if (btcol) { // Binary table image array. @@ -2202,11 +2213,11 @@ void wcshdo_util( hptr = keyvalue + 1; while (*hptr) { if (*hptr == '\'') { - kptr = hptr++; + char *kptr = hptr++; if (*hptr) { - ch0 = *kptr; + char ch0 = *kptr; while (*kptr) { - ch1 = *(++kptr); + char ch1 = *(++kptr); *kptr = ch0; ch0 = ch1; } @@ -2233,6 +2244,7 @@ void wcshdo_util( } } + int nc = 47, nv; if ((nv = strlen(keyvalue) > 20)) { // Rob the keycomment to make space for the keyvalue. nc -= (nv - 20); diff --git a/cextern/wcslib/C/wcshdr.h b/cextern/wcslib/C/wcshdr.h index f44295e19770..d11c320872eb 100644 --- a/cextern/wcslib/C/wcshdr.h +++ b/cextern/wcslib/C/wcshdr.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcshdr.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcshdr.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/wcslib.h b/cextern/wcslib/C/wcslib.h index b785676fb1fb..c8493cd36b61 100644 --- a/cextern/wcslib/C/wcslib.h +++ b/cextern/wcslib/C/wcslib.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcslib.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcslib.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/wcsmath.h b/cextern/wcslib/C/wcsmath.h index f669675242e2..09fdad448e03 100644 --- a/cextern/wcslib/C/wcsmath.h +++ b/cextern/wcslib/C/wcsmath.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsmath.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsmath.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/wcspih.l b/cextern/wcslib/C/wcspih.l index f489571602c7..042c72c031fd 100644 --- a/cextern/wcslib/C/wcspih.l +++ b/cextern/wcslib/C/wcspih.l @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcspih.l,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcspih.l,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * * wcspih.l is a Flex description file containing the definition of a lexical diff --git a/cextern/wcslib/C/wcsprintf.c b/cextern/wcslib/C/wcsprintf.c index 0ecc4331fc15..8653bc120934 100644 --- a/cextern/wcslib/C/wcsprintf.c +++ b/cextern/wcslib/C/wcsprintf.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsprintf.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsprintf.c,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/cextern/wcslib/C/wcsprintf.h b/cextern/wcslib/C/wcsprintf.h index c0be62fb7e55..da62d05224b6 100644 --- a/cextern/wcslib/C/wcsprintf.h +++ b/cextern/wcslib/C/wcsprintf.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsprintf.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsprintf.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/wcstrig.c b/cextern/wcslib/C/wcstrig.c index 70cc495de327..7632b6de9910 100644 --- a/cextern/wcslib/C/wcstrig.c +++ b/cextern/wcslib/C/wcstrig.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcstrig.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcstrig.c,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/cextern/wcslib/C/wcstrig.h b/cextern/wcslib/C/wcstrig.h index 5c3f2ba1c121..76665533d7e1 100644 --- a/cextern/wcslib/C/wcstrig.h +++ b/cextern/wcslib/C/wcstrig.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcstrig.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcstrig.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/wcsulex.l b/cextern/wcslib/C/wcsulex.l index 58a11113f520..894afb5a6adc 100644 --- a/cextern/wcslib/C/wcsulex.l +++ b/cextern/wcslib/C/wcsulex.l @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsulex.l,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsulex.l,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * * wcsulex.l is a Flex description file containing the definition of a diff --git a/cextern/wcslib/C/wcsunits.c b/cextern/wcslib/C/wcsunits.c index 2be27dec306d..9ffb841ffb84 100644 --- a/cextern/wcslib/C/wcsunits.c +++ b/cextern/wcslib/C/wcsunits.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsunits.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsunits.c,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/cextern/wcslib/C/wcsunits.h b/cextern/wcslib/C/wcsunits.h index 21f15848fead..96c8894bf765 100644 --- a/cextern/wcslib/C/wcsunits.h +++ b/cextern/wcslib/C/wcsunits.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsunits.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsunits.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/wcsutil.c b/cextern/wcslib/C/wcsutil.c index c6b715511c74..150a41311cfe 100644 --- a/cextern/wcslib/C/wcsutil.c +++ b/cextern/wcslib/C/wcsutil.c @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsutil.c,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsutil.c,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/cextern/wcslib/C/wcsutil.h b/cextern/wcslib/C/wcsutil.h index b2190b71315f..efe643186958 100644 --- a/cextern/wcslib/C/wcsutil.h +++ b/cextern/wcslib/C/wcsutil.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsutil.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsutil.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/C/wcsutrn.l b/cextern/wcslib/C/wcsutrn.l index 4ed4c0e954ae..d29473501d85 100644 --- a/cextern/wcslib/C/wcsutrn.l +++ b/cextern/wcslib/C/wcsutrn.l @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,7 +19,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wcsutrn.l,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wcsutrn.l,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * * wcsutrn.l is a Flex description file containing the definition of a lexical diff --git a/cextern/wcslib/C/wtbarr.h b/cextern/wcslib/C/wtbarr.h index d33c0d939b22..680755fafa5f 100644 --- a/cextern/wcslib/C/wtbarr.h +++ b/cextern/wcslib/C/wtbarr.h @@ -1,5 +1,5 @@ /*============================================================================ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -19,10 +19,10 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: wtbarr.h,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: wtbarr.h,v 8.2.1.1 2023/11/16 10:05:57 mcalabre Exp mcalabre $ *============================================================================= * -* WCSLIB 8.1 - C routines that implement the FITS World Coordinate System +* WCSLIB 8.2 - C routines that implement the FITS World Coordinate System * (WCS) standard. Refer to the README file provided with WCSLIB for an * overview of the library. * diff --git a/cextern/wcslib/CHANGES b/cextern/wcslib/CHANGES index f7de4e1a3a5a..8aa19d1cf06f 100644 --- a/cextern/wcslib/CHANGES +++ b/cextern/wcslib/CHANGES @@ -1,3 +1,46 @@ +WCSLIB version 8.2.2 (2023/11/29) +--------------------------------- + +* C library (installation) + + - In prj.c, a number of variables with global scope that are only used + internally were declared static to avoid namespace conflicts arising + in Link Time Optimization (LTO) builds of the Rwcs wrappers. This + is a patch release as it does not affect the library itself other + than in localising some symbols that were never meant to be global. + Reported by Rodrigo Carrizo with patch. + + Likewise for an internally used helper function, prjoff(). + Likewise for a handful of variables in cel.c, dis.c, lin.c, tab.c, + wcs.c, wcsfix.c, and wcshdr.c. + + +WCSLIB version 8.2.1 (2023/11/17) +--------------------------------- + +* Installation + + - With searching enabled in the HTML manual, doxygen creates a new + subdirectory, html/search, which must be installed explicitly. + + +WCSLIB version 8.2 (2023/11/16) +------------------------------- + +* C library + + - In wcshdo(), fixed character buffer overflows in the comment string + for the longitude and latitude axes triggered by some projections, + and also the formatting for generic coordinate systems. Reported by + Shu Niu. + +* User manual + + - Documentation generation moved to doxygen 1.9.8 (was 1.9.7). + + - Enabled searching in the HTML manual. + + WCSLIB version 8.1 (2023/07/06) ------------------------------- @@ -3420,4 +3463,4 @@ WCSLIB version 1.0 (1995/01/31) Initial release. ------------------------------------------------------------------------ -$Id: CHANGES,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +$Id: CHANGES,v 8.2.1.3 2023/11/29 08:04:47 mcalabre Exp mcalabre $ diff --git a/cextern/wcslib/GNUmakefile b/cextern/wcslib/GNUmakefile index 24097975e2dd..f6d5c3512594 100644 --- a/cextern/wcslib/GNUmakefile +++ b/cextern/wcslib/GNUmakefile @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# GNU makefile for building WCSLIB 8.1 +# GNU makefile for building WCSLIB 8.2 # # Summary of the main targets # --------------------------- @@ -34,7 +34,7 @@ # # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta -# $Id: GNUmakefile,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +# $Id: GNUmakefile,v 8.2.1.2 2023/11/17 03:32:33 mcalabre Exp mcalabre $ #----------------------------------------------------------------------------- # Get configure settings. SUBDIR := . @@ -92,18 +92,12 @@ install : $(INSTALL) -d -m 775 $(DOCDIR) ; \ fi $(INSTALL) -m 444 CHANGES COPYING* README $(DOCDIR) + $(INSTALL) -m 444 INSTALL THANKS VALIDATION $(DOCDIR) - if [ -h $(DOCLINK) ] ; then \ $(RM) $(DOCLINK) ; \ - $(LN_S) $(notdir $(DOCDIR)) $(DOCLINK) ; \ fi - - if [ ! -d "$(PDFDIR)" ] ; then \ - $(INSTALL) -d -m 775 $(PDFDIR) ; \ - fi - $(INSTALL) -m 444 wcslib.pdf $(PDFDIR) - - if [ ! -d "$(HTMLDIR)/html" ] ; then \ - $(INSTALL) -d -m 775 $(HTMLDIR)/html ; \ - fi - $(INSTALL) -m 444 html/* $(HTMLDIR)/html + $(LN_S) $(notdir $(DOCDIR)) $(DOCLINK) + $(MAKE) -k -C doxygen $@ uninstall : @ for DIR in $(INSTDIR) ; do \ @@ -113,8 +107,7 @@ uninstall : - cd $(INCDIR) && $(RM) wcsconfig*.h - $(RM) $(DOCLINK) - $(RM) $(DOCDIR) - - $(RM) $(PDFDIR) - - $(RM) $(HTMLDIR) + $(MAKE) -k -C doxygen $@ clean cleaner : for DIR in $(SUBDIRS) doxygen ; do \ diff --git a/cextern/wcslib/INSTALL b/cextern/wcslib/INSTALL index 8b603745f1c4..256f4e1963d8 100644 --- a/cextern/wcslib/INSTALL +++ b/cextern/wcslib/INSTALL @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------ -WCSLIB 8.1 and PGSBOX 8.1 INSTALLATION +WCSLIB 8.2 and PGSBOX 8.2 INSTALLATION -------------------------------------- WCSLIB requires an ANSI C compiler with standard ANSI C environment, that is, @@ -9,8 +9,8 @@ Ritchie, 2nd ed. If you are running a typical Linux distro and have installed WCSLIB before, then all you should need to do is - tar pxvf wcslib-8.1.tar.bz2 - cd wcslib-8.1 + tar pxvf wcslib-8.2.tar.bz2 + cd wcslib-8.2 make install Otherwise, read on. @@ -19,8 +19,8 @@ Installation of WCSLIB is handled by GNU autoconf; GNU make (referred to here as 'gmake') must be used. The WCSLIB distribution also includes PGSBOX (refer to the README file). To unpack the tar file, type - bzcat wcslib-8.1.tar.bz2 | tar pvxf - - cd wcslib-8.1 + bzcat wcslib-8.2.tar.bz2 | tar pvxf - + cd wcslib-8.2 then if you do not need to specify any configuration options, simply run @@ -102,7 +102,7 @@ The INSTALL file provided with GNU autoconf 2.53 is appended without change. Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta -$Id: INSTALL,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +$Id: INSTALL,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ ============================================================================== diff --git a/cextern/wcslib/README b/cextern/wcslib/README index f519c28932fa..9e827086efd9 100644 --- a/cextern/wcslib/README +++ b/cextern/wcslib/README @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ - WCSLIB 8.1 and PGSBOX 8.1 + WCSLIB 8.2 and PGSBOX 8.2 ------------------------------------------------------------------------------ - WCSLIB 8.1 - an implementation of the FITS WCS standard. + WCSLIB 8.2 - an implementation of the FITS WCS standard. Copyright (C) 1995-2023, Mark Calabretta This file is part of WCSLIB. @@ -21,7 +21,7 @@ Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. http://www.atnf.csiro.au/people/Mark.Calabretta - $Id: README,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ + $Id: README,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ ------------------------------------------------------------------------------ Please refer to diff --git a/cextern/wcslib/THANKS b/cextern/wcslib/THANKS index b68f2a5e06ae..33bfcc606214 100644 --- a/cextern/wcslib/THANKS +++ b/cextern/wcslib/THANKS @@ -77,6 +77,7 @@ David Motl (var.astro.cz) August Muench (CfA) Fergal Mullally (Princeton U.) Stuart Mumford (SunPy) +Shu Niu (Purple Mountain Obs.) Clive Page (U. Leicester) Ralf Palsa (ESO) Sergio Pascual (U. Complutense de Madrid, Fedora maintainer) @@ -116,4 +117,4 @@ Daren Scot Wilson (NRAO) Tony Wong (ATNF/CSIRO) -$Id: THANKS,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +$Id: THANKS,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ diff --git a/cextern/wcslib/VALIDATION b/cextern/wcslib/VALIDATION index 86f4a81c1878..dbfbe56ded86 100644 --- a/cextern/wcslib/VALIDATION +++ b/cextern/wcslib/VALIDATION @@ -1,5 +1,23 @@ Platforms on which the installation procedures and test suite were exercised. +WCSLIB version 8.2.2 (2023/11/29) +--------------------------------- + +* Dell Latitude XPS 15 9560 (Intel Core i7-7700HQ, 4 cores, 8 CPUs, x86_64) + KDE Neon User Edition 5.27 over Ubuntu 22.04 (Jammy Jellyfish) + uname -r (kernel version): 5.19.0-46-generic + gcc --version: gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0 + gfortran --version: GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04.1) 11.3.0 + +WCSLIB version 8.2 (2023/11/16) +------------------------------- + +* Dell Latitude E6530 (Intel Core i7-3740QM, 4 cores, 8 CPUs, x86_64) + KDE Neon User Edition 5.27 over Ubuntu 22.04 (Jammy Jellyfish) + uname -r (kernel version): 5.19.0-38-generic + gcc --version: gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 + gfortran --version: GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 + WCSLIB version 8.1 (2023/07/06) ------------------------------- @@ -771,4 +789,4 @@ WCSLIB version 4.4 (2009/08/06) 2004/04/23 ------------------------------------------------------------------------------ -$Id: VALIDATION,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +$Id: VALIDATION,v 8.2.1.2 2023/11/29 08:07:45 mcalabre Exp mcalabre $ diff --git a/cextern/wcslib/configure b/cextern/wcslib/configure index ecf92e737583..066852bba805 100755 --- a/cextern/wcslib/configure +++ b/cextern/wcslib/configure @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.ac Revision: 8.1 . +# From configure.ac Revision: 8.2.1.3 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for WCSLIB 8.1. +# Generated by GNU Autoconf 2.71 for WCSLIB 8.2.2. # # Report bugs to . # @@ -611,9 +611,9 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='WCSLIB' -PACKAGE_TARNAME='wcslib-8.1' -PACKAGE_VERSION='8.1' -PACKAGE_STRING='WCSLIB 8.1' +PACKAGE_TARNAME='wcslib-8.2.2' +PACKAGE_VERSION='8.2.2' +PACKAGE_STRING='WCSLIB 8.2.2' PACKAGE_BUGREPORT='mark@calabretta.id.au' PACKAGE_URL='' @@ -1318,7 +1318,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures WCSLIB 8.1 to adapt to many kinds of systems. +\`configure' configures WCSLIB 8.2.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1367,7 +1367,7 @@ Fine tuning of the installation directories: --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/wcslib-8.1] + --docdir=DIR documentation root [DATAROOTDIR/doc/wcslib-8.2.2] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] @@ -1388,7 +1388,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of WCSLIB 8.1:";; + short | recursive ) echo "Configuration of WCSLIB 8.2.2:";; esac cat <<\_ACEOF @@ -1494,7 +1494,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -WCSLIB configure 8.1 +WCSLIB configure 8.2.2 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2215,7 +2215,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by WCSLIB $as_me 8.1, which was +It was created by WCSLIB $as_me 8.2.2, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -9401,7 +9401,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by WCSLIB $as_me 8.1, which was +This file was extended by WCSLIB $as_me 8.2.2, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -9465,7 +9465,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -WCSLIB config.status 8.1 +WCSLIB config.status 8.2.2 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/cextern/wcslib/configure.ac b/cextern/wcslib/configure.ac index cf52ae964475..dc2f99aaa42b 100644 --- a/cextern/wcslib/configure.ac +++ b/cextern/wcslib/configure.ac @@ -3,12 +3,12 @@ #----------------------------------------------------------------------------- # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta -# $Id: configure.ac,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +# $Id: configure.ac,v 8.2.1.3 2023/11/29 08:05:55 mcalabre Exp mcalabre $ #----------------------------------------------------------------------------- -AC_INIT([WCSLIB],[8.1],[mark@calabretta.id.au],[wcslib-8.1]) +AC_INIT([WCSLIB],[8.2.2],[mark@calabretta.id.au],[wcslib-8.2.2]) AC_PREREQ([2.71]) -AC_REVISION([$Revision: 8.1 $]) +AC_REVISION([$Revision: 8.2.1.3 $]) AC_SUBST([PACKAGE_VERSION]) AC_DEFINE_UNQUOTED([WCSLIB_VERSION], [$PACKAGE_VERSION], [Define wcslib version]) diff --git a/cextern/wcslib/flavours b/cextern/wcslib/flavours index 525eebe4fa81..c35c91dfb06c 100644 --- a/cextern/wcslib/flavours +++ b/cextern/wcslib/flavours @@ -12,7 +12,7 @@ # # Reminder: add '-d' to FLFLAGS for debugging. # -# $Id: flavours,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +# $Id: flavours,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ #----------------------------------------------------------------------------- F := diff --git a/cextern/wcslib/makedefs.in b/cextern/wcslib/makedefs.in index a749eea5b746..c0cded50cd3b 100644 --- a/cextern/wcslib/makedefs.in +++ b/cextern/wcslib/makedefs.in @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# GNU makefile definitions for building WCSLIB 8.1 +# GNU makefile definitions for building WCSLIB 8.2 # # makedefs is generated from makedefs.in by configure. It contains variable # definitions and some general-purpose rules for building WCSLIB. @@ -39,11 +39,11 @@ # compiled separately without this option. # # The shared library will be installed with version number, e.g. as -# libwcs.so.8.1 or libwcs.8.1.dylib with or without the symlink +# libwcs.so.8.2 or libwcs.8.2.dylib with or without the symlink # required to make it visible to the linker (controlled by the SHRLN # variable). On Macs it is deliberately not created because its very # existence precludes static linking with the cctools linker. You can -# still link dynamically by using -lwcs.8.1. +# still link dynamically by using -lwcs.8.2. # # 4) PGPLOT is Tim Pearson's Fortran graphics library with separate C # interface available from astro.caltech.edu. It is only required by @@ -74,7 +74,7 @@ # # Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. # http://www.atnf.csiro.au/people/Mark.Calabretta -# $Id: makedefs.in,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +# $Id: makedefs.in,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ #----------------------------------------------------------------------------- # Version. LIBVER := @LIBVER@ diff --git a/cextern/wcslib/wcsconfig.h.in b/cextern/wcslib/wcsconfig.h.in index cbd79db1e6c9..9da0fec5b7a2 100644 --- a/cextern/wcslib/wcsconfig.h.in +++ b/cextern/wcslib/wcsconfig.h.in @@ -1,11 +1,11 @@ /*============================================================================ * * wcsconfig.h is generated from wcsconfig.h.in by 'configure'. It contains -* C preprocessor macro definitions for compiling WCSLIB 8.1 +* C preprocessor macro definitions for compiling WCSLIB 8.2 * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta -* $Id: wcsconfig.h.in,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +* $Id: wcsconfig.h.in,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ *===========================================================================*/ /* wcslib_version() is available (as of 5.0). */ diff --git a/cextern/wcslib/wcsconfig_f77.h.in b/cextern/wcslib/wcsconfig_f77.h.in index 39b35c90f99e..63adf254efa9 100644 --- a/cextern/wcslib/wcsconfig_f77.h.in +++ b/cextern/wcslib/wcsconfig_f77.h.in @@ -1,12 +1,12 @@ /*============================================================================ * * wcsconfig_f77.h is generated from wcsconfig_f77.h.in by 'configure'. It -* contains C preprocessor definitions for building the WCSLIB 8.1 Fortran +* contains C preprocessor definitions for building the WCSLIB 8.2 Fortran * wrappers. * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta -* $Id: wcsconfig_f77.h.in,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +* $Id: wcsconfig_f77.h.in,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ *===========================================================================*/ /* Integer array type large enough to hold an address. Set here to int[2] for diff --git a/cextern/wcslib/wcsconfig_tests.h.in b/cextern/wcslib/wcsconfig_tests.h.in index eb018b51de79..3dc051b2fe91 100644 --- a/cextern/wcslib/wcsconfig_tests.h.in +++ b/cextern/wcslib/wcsconfig_tests.h.in @@ -1,12 +1,12 @@ /*============================================================================ * * wcsconfig_test.h is generated from wcsconfig_test.h.in by 'configure'. It -* contains C preprocessor definitions for compiling the WCSLIB 8.1 test/demo +* contains C preprocessor definitions for compiling the WCSLIB 8.2 test/demo * programs. * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta -* $Id: wcsconfig_tests.h.in,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +* $Id: wcsconfig_tests.h.in,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/cextern/wcslib/wcsconfig_utils.h.in b/cextern/wcslib/wcsconfig_utils.h.in index 26740d2748ac..e4203d7f80aa 100644 --- a/cextern/wcslib/wcsconfig_utils.h.in +++ b/cextern/wcslib/wcsconfig_utils.h.in @@ -1,12 +1,12 @@ /*============================================================================ * * wcsconfig_utils.h is generated from wcsconfig_utils.h.in by 'configure'. -* It contains C preprocessor macro definitions for compiling the WCSLIB 8.1 +* It contains C preprocessor macro definitions for compiling the WCSLIB 8.2 * utilities. * * Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. * http://www.atnf.csiro.au/people/Mark.Calabretta -* $Id: wcsconfig_utils.h.in,v 8.1 2023/07/05 17:12:07 mcalabre Exp $ +* $Id: wcsconfig_utils.h.in,v 8.2.1.1 2023/11/16 10:05:58 mcalabre Exp mcalabre $ *===========================================================================*/ #include diff --git a/docs/changes/wcs/15795.bugfix.rst b/docs/changes/wcs/15795.bugfix.rst new file mode 100644 index 000000000000..30fe1ed665b0 --- /dev/null +++ b/docs/changes/wcs/15795.bugfix.rst @@ -0,0 +1,7 @@ +Updated bundled WCSLIB version to 8.2.2. This update fixes character buffer +overflows in the comment string for the longitude and latitude axes triggered +by some projections in ``wcshdo()``, and also the formatting for generic +coordinate systems. For a full list of changes - see +http://www.atnf.csiro.au/people/mcalabre/WCS/CHANGES or +`astropy/cextern/wcslib/CHANGES `_